diff -Nru android-platform-frameworks-native-6.0.1+r16/build/phone-hdpi-512-dalvik-heap.mk android-platform-frameworks-native-21/build/phone-hdpi-512-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/phone-hdpi-512-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/phone-hdpi-512-dalvik-heap.mk 2012-10-16 22:57:11.000000000 +0000 @@ -20,7 +20,4 @@ PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapstartsize=5m \ dalvik.vm.heapgrowthlimit=48m \ - dalvik.vm.heapsize=128m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=2m + dalvik.vm.heapsize=128m diff -Nru android-platform-frameworks-native-6.0.1+r16/build/phone-hdpi-dalvik-heap.mk android-platform-frameworks-native-21/build/phone-hdpi-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/phone-hdpi-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/phone-hdpi-dalvik-heap.mk 2012-10-16 22:57:11.000000000 +0000 @@ -18,7 +18,4 @@ PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapstartsize=5m \ - dalvik.vm.heapsize=32m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=2m + dalvik.vm.heapsize=32m diff -Nru android-platform-frameworks-native-6.0.1+r16/build/phone-xhdpi-1024-dalvik-heap.mk android-platform-frameworks-native-21/build/phone-xhdpi-1024-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/phone-xhdpi-1024-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/phone-xhdpi-1024-dalvik-heap.mk 2012-10-16 22:57:11.000000000 +0000 @@ -14,12 +14,9 @@ # limitations under the License. # -# Provides overrides to configure the Dalvik heap for a xhdpi phone +# Provides overrides to configure the Dalvik heap for a standard tablet device. PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapstartsize=8m \ - dalvik.vm.heapgrowthlimit=96m \ - dalvik.vm.heapsize=256m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=8m + dalvik.vm.heapgrowthlimit=64m \ + dalvik.vm.heapsize=256m diff -Nru android-platform-frameworks-native-6.0.1+r16/build/phone-xhdpi-2048-dalvik-heap.mk android-platform-frameworks-native-21/build/phone-xhdpi-2048-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/phone-xhdpi-2048-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/phone-xhdpi-2048-dalvik-heap.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -# -# Copyright (C) 2012 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. -# - -# Provides overrides to configure the Dalvik heap for a 2G phone -# 192m of RAM gives enough space for 5 8 megapixel camera bitmaps in RAM. - -PRODUCT_PROPERTY_OVERRIDES += \ - dalvik.vm.heapstartsize=8m \ - dalvik.vm.heapgrowthlimit=192m \ - dalvik.vm.heapsize=512m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=8m diff -Nru android-platform-frameworks-native-6.0.1+r16/build/tablet-10in-xhdpi-2048-dalvik-heap.mk android-platform-frameworks-native-21/build/tablet-10in-xhdpi-2048-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/tablet-10in-xhdpi-2048-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/tablet-10in-xhdpi-2048-dalvik-heap.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# -# Copyright (C) 2012 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. -# - -# Provides overrides to configure the Dalvik heap for a standard tablet device. - -PRODUCT_PROPERTY_OVERRIDES += \ - dalvik.vm.heapstartsize=16m \ - dalvik.vm.heapgrowthlimit=192m \ - dalvik.vm.heapsize=512m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=8m diff -Nru android-platform-frameworks-native-6.0.1+r16/build/tablet-7in-hdpi-1024-dalvik-heap.mk android-platform-frameworks-native-21/build/tablet-7in-hdpi-1024-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/tablet-7in-hdpi-1024-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/tablet-7in-hdpi-1024-dalvik-heap.mk 2012-10-16 22:57:11.000000000 +0000 @@ -18,8 +18,6 @@ PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapstartsize=8m \ - dalvik.vm.heapgrowthlimit=80m \ - dalvik.vm.heapsize=384m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=8m + dalvik.vm.heapgrowthlimit=64m \ + dalvik.vm.heapsize=384m + \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/build/tablet-7in-xhdpi-2048-dalvik-heap.mk android-platform-frameworks-native-21/build/tablet-7in-xhdpi-2048-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/tablet-7in-xhdpi-2048-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/tablet-7in-xhdpi-2048-dalvik-heap.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -# -# Copyright (C) 2013 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. -# - -# Provides overrides to configure the Dalvik heap for a 320dpi 7" tablet device. - -PRODUCT_PROPERTY_OVERRIDES += \ - dalvik.vm.heapstartsize=16m \ - dalvik.vm.heapgrowthlimit=192m \ - dalvik.vm.heapsize=512m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=8m diff -Nru android-platform-frameworks-native-6.0.1+r16/build/tablet-dalvik-heap.mk android-platform-frameworks-native-21/build/tablet-dalvik-heap.mk --- android-platform-frameworks-native-6.0.1+r16/build/tablet-dalvik-heap.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/build/tablet-dalvik-heap.mk 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,4 @@ PRODUCT_PROPERTY_OVERRIDES += \ dalvik.vm.heapstartsize=5m \ dalvik.vm.heapgrowthlimit=48m \ - dalvik.vm.heapsize=256m \ - dalvik.vm.heaptargetutilization=0.75 \ - dalvik.vm.heapminfree=512k \ - dalvik.vm.heapmaxfree=2m + dalvik.vm.heapsize=256m diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/atrace/Android.mk android-platform-frameworks-native-21/cmds/atrace/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/atrace/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/atrace/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -# Copyright 2012 The Android Open Source Project - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= atrace.cpp - -LOCAL_C_INCLUDES += external/zlib - -LOCAL_MODULE:= atrace - -LOCAL_MODULE_TAGS:= optional - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libcutils \ - libutils \ - libz \ - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/atrace/atrace.cpp android-platform-frameworks-native-21/cmds/atrace/atrace.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/atrace/atrace.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/atrace/atrace.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,997 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -using namespace android; - -#define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) - -enum { MAX_SYS_FILES = 10 }; - -const char* k_traceTagsProperty = "debug.atrace.tags.enableflags"; -const char* k_traceAppCmdlineProperty = "debug.atrace.app_cmdlines"; - -typedef enum { OPT, REQ } requiredness ; - -struct TracingCategory { - // The name identifying the category. - const char* name; - - // A longer description of the category. - const char* longname; - - // The userland tracing tags that the category enables. - uint64_t tags; - - // The fname==NULL terminated list of /sys/ files that the category - // enables. - struct { - // Whether the file must be writable in order to enable the tracing - // category. - requiredness required; - - // The path to the enable file. - const char* path; - } sysfiles[MAX_SYS_FILES]; -}; - -/* Tracing categories */ -static const TracingCategory k_categories[] = { - { "gfx", "Graphics", ATRACE_TAG_GRAPHICS, { } }, - { "input", "Input", ATRACE_TAG_INPUT, { } }, - { "view", "View System", ATRACE_TAG_VIEW, { } }, - { "webview", "WebView", ATRACE_TAG_WEBVIEW, { } }, - { "wm", "Window Manager", ATRACE_TAG_WINDOW_MANAGER, { } }, - { "am", "Activity Manager", ATRACE_TAG_ACTIVITY_MANAGER, { } }, - { "sm", "Sync Manager", ATRACE_TAG_SYNC_MANAGER, { } }, - { "audio", "Audio", ATRACE_TAG_AUDIO, { } }, - { "video", "Video", ATRACE_TAG_VIDEO, { } }, - { "camera", "Camera", ATRACE_TAG_CAMERA, { } }, - { "hal", "Hardware Modules", ATRACE_TAG_HAL, { } }, - { "app", "Application", ATRACE_TAG_APP, { } }, - { "res", "Resource Loading", ATRACE_TAG_RESOURCES, { } }, - { "dalvik", "Dalvik VM", ATRACE_TAG_DALVIK, { } }, - { "rs", "RenderScript", ATRACE_TAG_RS, { } }, - { "bionic", "Bionic C Library", ATRACE_TAG_BIONIC, { } }, - { "power", "Power Management", ATRACE_TAG_POWER, { } }, - { "sched", "CPU Scheduling", 0, { - { REQ, "/sys/kernel/debug/tracing/events/sched/sched_switch/enable" }, - { REQ, "/sys/kernel/debug/tracing/events/sched/sched_wakeup/enable" }, - } }, - { "irq", "IRQ Events", 0, { - { REQ, "/sys/kernel/debug/tracing/events/irq/enable" }, - } }, - { "freq", "CPU Frequency", 0, { - { REQ, "/sys/kernel/debug/tracing/events/power/cpu_frequency/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/power/clock_set_rate/enable" }, - } }, - { "membus", "Memory Bus Utilization", 0, { - { REQ, "/sys/kernel/debug/tracing/events/memory_bus/enable" }, - } }, - { "idle", "CPU Idle", 0, { - { REQ, "/sys/kernel/debug/tracing/events/power/cpu_idle/enable" }, - } }, - { "disk", "Disk I/O", 0, { - { OPT, "/sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_enter/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/f2fs/f2fs_sync_file_exit/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/f2fs/f2fs_write_begin/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/f2fs/f2fs_write_end/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/ext4/ext4_da_write_begin/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/ext4/ext4_da_write_end/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/ext4/ext4_sync_file_enter/enable" }, - { OPT, "/sys/kernel/debug/tracing/events/ext4/ext4_sync_file_exit/enable" }, - { REQ, "/sys/kernel/debug/tracing/events/block/block_rq_issue/enable" }, - { REQ, "/sys/kernel/debug/tracing/events/block/block_rq_complete/enable" }, - } }, - { "mmc", "eMMC commands", 0, { - { REQ, "/sys/kernel/debug/tracing/events/mmc/enable" }, - } }, - { "load", "CPU Load", 0, { - { REQ, "/sys/kernel/debug/tracing/events/cpufreq_interactive/enable" }, - } }, - { "sync", "Synchronization", 0, { - { REQ, "/sys/kernel/debug/tracing/events/sync/enable" }, - } }, - { "workq", "Kernel Workqueues", 0, { - { REQ, "/sys/kernel/debug/tracing/events/workqueue/enable" }, - } }, - { "memreclaim", "Kernel Memory Reclaim", 0, { - { REQ, "/sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_begin/enable" }, - { REQ, "/sys/kernel/debug/tracing/events/vmscan/mm_vmscan_direct_reclaim_end/enable" }, - { REQ, "/sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_wake/enable" }, - { REQ, "/sys/kernel/debug/tracing/events/vmscan/mm_vmscan_kswapd_sleep/enable" }, - } }, - { "regulators", "Voltage and Current Regulators", 0, { - { REQ, "/sys/kernel/debug/tracing/events/regulator/enable" }, - } }, -}; - -/* Command line options */ -static int g_traceDurationSeconds = 5; -static bool g_traceOverwrite = false; -static int g_traceBufferSizeKB = 2048; -static bool g_compress = false; -static bool g_nohup = false; -static int g_initialSleepSecs = 0; -static const char* g_kernelTraceFuncs = NULL; -static const char* g_debugAppCmdLine = ""; - -/* Global state */ -static bool g_traceAborted = false; -static bool g_categoryEnables[NELEM(k_categories)] = {}; - -/* Sys file paths */ -static const char* k_traceClockPath = - "/sys/kernel/debug/tracing/trace_clock"; - -static const char* k_traceBufferSizePath = - "/sys/kernel/debug/tracing/buffer_size_kb"; - -static const char* k_tracingOverwriteEnablePath = - "/sys/kernel/debug/tracing/options/overwrite"; - -static const char* k_currentTracerPath = - "/sys/kernel/debug/tracing/current_tracer"; - -static const char* k_printTgidPath = - "/sys/kernel/debug/tracing/options/print-tgid"; - -static const char* k_funcgraphAbsTimePath = - "/sys/kernel/debug/tracing/options/funcgraph-abstime"; - -static const char* k_funcgraphCpuPath = - "/sys/kernel/debug/tracing/options/funcgraph-cpu"; - -static const char* k_funcgraphProcPath = - "/sys/kernel/debug/tracing/options/funcgraph-proc"; - -static const char* k_funcgraphFlatPath = - "/sys/kernel/debug/tracing/options/funcgraph-flat"; - -static const char* k_funcgraphDurationPath = - "/sys/kernel/debug/tracing/options/funcgraph-duration"; - -static const char* k_ftraceFilterPath = - "/sys/kernel/debug/tracing/set_ftrace_filter"; - -static const char* k_tracingOnPath = - "/sys/kernel/debug/tracing/tracing_on"; - -static const char* k_tracePath = - "/sys/kernel/debug/tracing/trace"; - -static const char* k_traceMarkerPath = - "/sys/kernel/debug/tracing/trace_marker"; - -// Check whether a file exists. -static bool fileExists(const char* filename) { - return access(filename, F_OK) != -1; -} - -// Check whether a file is writable. -static bool fileIsWritable(const char* filename) { - return access(filename, W_OK) != -1; -} - -// Truncate a file. -static bool truncateFile(const char* path) -{ - // This uses creat rather than truncate because some of the debug kernel - // device nodes (e.g. k_ftraceFilterPath) currently aren't changed by - // calls to truncate, but they are cleared by calls to creat. - int traceFD = creat(path, 0); - if (traceFD == -1) { - fprintf(stderr, "error truncating %s: %s (%d)\n", path, - strerror(errno), errno); - return false; - } - - close(traceFD); - - return true; -} - -static bool _writeStr(const char* filename, const char* str, int flags) -{ - int fd = open(filename, flags); - if (fd == -1) { - fprintf(stderr, "error opening %s: %s (%d)\n", filename, - strerror(errno), errno); - return false; - } - - bool ok = true; - ssize_t len = strlen(str); - if (write(fd, str, len) != len) { - fprintf(stderr, "error writing to %s: %s (%d)\n", filename, - strerror(errno), errno); - ok = false; - } - - close(fd); - - return ok; -} - -// Write a string to a file, returning true if the write was successful. -static bool writeStr(const char* filename, const char* str) -{ - return _writeStr(filename, str, O_WRONLY); -} - -// Append a string to a file, returning true if the write was successful. -static bool appendStr(const char* filename, const char* str) -{ - return _writeStr(filename, str, O_APPEND|O_WRONLY); -} - -static void writeClockSyncMarker() -{ - char buffer[128]; - int len = 0; - int fd = open(k_traceMarkerPath, O_WRONLY); - if (fd == -1) { - fprintf(stderr, "error opening %s: %s (%d)\n", k_traceMarkerPath, - strerror(errno), errno); - return; - } - float now_in_seconds = systemTime(CLOCK_MONOTONIC) / 1000000000.0f; - - len = snprintf(buffer, 128, "trace_event_clock_sync: parent_ts=%f\n", now_in_seconds); - if (write(fd, buffer, len) != len) { - fprintf(stderr, "error writing clock sync marker %s (%d)\n", strerror(errno), errno); - } - - int64_t realtime_in_ms = systemTime(CLOCK_REALTIME) / 1000000; - len = snprintf(buffer, 128, "trace_event_clock_sync: realtime_ts=%" PRId64 "\n", realtime_in_ms); - if (write(fd, buffer, len) != len) { - fprintf(stderr, "error writing clock sync marker %s (%d)\n", strerror(errno), errno); - } - - close(fd); -} - -// Enable or disable a kernel option by writing a "1" or a "0" into a /sys -// file. -static bool setKernelOptionEnable(const char* filename, bool enable) -{ - return writeStr(filename, enable ? "1" : "0"); -} - -// Check whether the category is supported on the device with the current -// rootness. A category is supported only if all its required /sys/ files are -// writable and if enabling the category will enable one or more tracing tags -// or /sys/ files. -static bool isCategorySupported(const TracingCategory& category) -{ - bool ok = category.tags != 0; - for (int i = 0; i < MAX_SYS_FILES; i++) { - const char* path = category.sysfiles[i].path; - bool req = category.sysfiles[i].required == REQ; - if (path != NULL) { - if (req) { - if (!fileIsWritable(path)) { - return false; - } else { - ok = true; - } - } else { - ok |= fileIsWritable(path); - } - } - } - return ok; -} - -// Check whether the category would be supported on the device if the user -// were root. This function assumes that root is able to write to any file -// that exists. It performs the same logic as isCategorySupported, but it -// uses file existance rather than writability in the /sys/ file checks. -static bool isCategorySupportedForRoot(const TracingCategory& category) -{ - bool ok = category.tags != 0; - for (int i = 0; i < MAX_SYS_FILES; i++) { - const char* path = category.sysfiles[i].path; - bool req = category.sysfiles[i].required == REQ; - if (path != NULL) { - if (req) { - if (!fileExists(path)) { - return false; - } else { - ok = true; - } - } else { - ok |= fileExists(path); - } - } - } - return ok; -} - -// Enable or disable overwriting of the kernel trace buffers. Disabling this -// will cause tracing to stop once the trace buffers have filled up. -static bool setTraceOverwriteEnable(bool enable) -{ - return setKernelOptionEnable(k_tracingOverwriteEnablePath, enable); -} - -// Enable or disable kernel tracing. -static bool setTracingEnabled(bool enable) -{ - return setKernelOptionEnable(k_tracingOnPath, enable); -} - -// Clear the contents of the kernel trace. -static bool clearTrace() -{ - return truncateFile(k_tracePath); -} - -// Set the size of the kernel's trace buffer in kilobytes. -static bool setTraceBufferSizeKB(int size) -{ - char str[32] = "1"; - int len; - if (size < 1) { - size = 1; - } - snprintf(str, 32, "%d", size); - return writeStr(k_traceBufferSizePath, str); -} - -// Read the trace_clock sysfs file and return true if it matches the requested -// value. The trace_clock file format is: -// local [global] counter uptime perf -static bool isTraceClock(const char *mode) -{ - int fd = open(k_traceClockPath, O_RDONLY); - if (fd == -1) { - fprintf(stderr, "error opening %s: %s (%d)\n", k_traceClockPath, - strerror(errno), errno); - return false; - } - - char buf[4097]; - ssize_t n = read(fd, buf, 4096); - close(fd); - if (n == -1) { - fprintf(stderr, "error reading %s: %s (%d)\n", k_traceClockPath, - strerror(errno), errno); - return false; - } - buf[n] = '\0'; - - char *start = strchr(buf, '['); - if (start == NULL) { - return false; - } - start++; - - char *end = strchr(start, ']'); - if (end == NULL) { - return false; - } - *end = '\0'; - - return strcmp(mode, start) == 0; -} - -// Enable or disable the kernel's use of the global clock. Disabling the global -// clock will result in the kernel using a per-CPU local clock. -// Any write to the trace_clock sysfs file will reset the buffer, so only -// update it if the requested value is not the current value. -static bool setGlobalClockEnable(bool enable) -{ - const char *clock = enable ? "global" : "local"; - - if (isTraceClock(clock)) { - return true; - } - - return writeStr(k_traceClockPath, clock); -} - -static bool setPrintTgidEnableIfPresent(bool enable) -{ - if (fileExists(k_printTgidPath)) { - return setKernelOptionEnable(k_printTgidPath, enable); - } - return true; -} - -// Poke all the binder-enabled processes in the system to get them to re-read -// their system properties. -static bool pokeBinderServices() -{ - sp sm = defaultServiceManager(); - Vector services = sm->listServices(); - for (size_t i = 0; i < services.size(); i++) { - sp obj = sm->checkService(services[i]); - if (obj != NULL) { - Parcel data; - if (obj->transact(IBinder::SYSPROPS_TRANSACTION, data, - NULL, 0) != OK) { - if (false) { - // XXX: For some reason this fails on tablets trying to - // poke the "phone" service. It's not clear whether some - // are expected to fail. - String8 svc(services[i]); - fprintf(stderr, "error poking binder service %s\n", - svc.string()); - return false; - } - } - } - } - return true; -} - -// Set the trace tags that userland tracing uses, and poke the running -// processes to pick up the new value. -static bool setTagsProperty(uint64_t tags) -{ - char buf[64]; - snprintf(buf, 64, "%#" PRIx64, tags); - if (property_set(k_traceTagsProperty, buf) < 0) { - fprintf(stderr, "error setting trace tags system property\n"); - return false; - } - return true; -} - -// Set the system property that indicates which apps should perform -// application-level tracing. -static bool setAppCmdlineProperty(const char* cmdline) -{ - if (property_set(k_traceAppCmdlineProperty, cmdline) < 0) { - fprintf(stderr, "error setting trace app system property\n"); - return false; - } - return true; -} - -// Disable all /sys/ enable files. -static bool disableKernelTraceEvents() { - bool ok = true; - for (int i = 0; i < NELEM(k_categories); i++) { - const TracingCategory &c = k_categories[i]; - for (int j = 0; j < MAX_SYS_FILES; j++) { - const char* path = c.sysfiles[j].path; - if (path != NULL && fileIsWritable(path)) { - ok &= setKernelOptionEnable(path, false); - } - } - } - return ok; -} - -// Verify that the comma separated list of functions are being traced by the -// kernel. -static bool verifyKernelTraceFuncs(const char* funcs) -{ - int fd = open(k_ftraceFilterPath, O_RDONLY); - if (fd == -1) { - fprintf(stderr, "error opening %s: %s (%d)\n", k_ftraceFilterPath, - strerror(errno), errno); - return false; - } - - char buf[4097]; - ssize_t n = read(fd, buf, 4096); - close(fd); - if (n == -1) { - fprintf(stderr, "error reading %s: %s (%d)\n", k_ftraceFilterPath, - strerror(errno), errno); - return false; - } - - buf[n] = '\0'; - String8 funcList = String8::format("\n%s", buf); - - // Make sure that every function listed in funcs is in the list we just - // read from the kernel. - bool ok = true; - char* myFuncs = strdup(funcs); - char* func = strtok(myFuncs, ","); - while (func) { - String8 fancyFunc = String8::format("\n%s\n", func); - bool found = funcList.find(fancyFunc.string(), 0) >= 0; - if (!found || func[0] == '\0') { - fprintf(stderr, "error: \"%s\" is not a valid kernel function " - "to trace.\n", func); - ok = false; - } - func = strtok(NULL, ","); - } - free(myFuncs); - - return ok; -} - -// Set the comma separated list of functions that the kernel is to trace. -static bool setKernelTraceFuncs(const char* funcs) -{ - bool ok = true; - - if (funcs == NULL || funcs[0] == '\0') { - // Disable kernel function tracing. - if (fileIsWritable(k_currentTracerPath)) { - ok &= writeStr(k_currentTracerPath, "nop"); - } - if (fileIsWritable(k_ftraceFilterPath)) { - ok &= truncateFile(k_ftraceFilterPath); - } - } else { - // Enable kernel function tracing. - ok &= writeStr(k_currentTracerPath, "function_graph"); - ok &= setKernelOptionEnable(k_funcgraphAbsTimePath, true); - ok &= setKernelOptionEnable(k_funcgraphCpuPath, true); - ok &= setKernelOptionEnable(k_funcgraphProcPath, true); - ok &= setKernelOptionEnable(k_funcgraphFlatPath, true); - - // Set the requested filter functions. - ok &= truncateFile(k_ftraceFilterPath); - char* myFuncs = strdup(funcs); - char* func = strtok(myFuncs, ","); - while (func) { - ok &= appendStr(k_ftraceFilterPath, func); - func = strtok(NULL, ","); - } - free(myFuncs); - - // Verify that the set functions are being traced. - if (ok) { - ok &= verifyKernelTraceFuncs(funcs); - } - } - - return ok; -} - -// Set all the kernel tracing settings to the desired state for this trace -// capture. -static bool setUpTrace() -{ - bool ok = true; - - // Set up the tracing options. - ok &= setTraceOverwriteEnable(g_traceOverwrite); - ok &= setTraceBufferSizeKB(g_traceBufferSizeKB); - ok &= setGlobalClockEnable(true); - ok &= setPrintTgidEnableIfPresent(true); - ok &= setKernelTraceFuncs(g_kernelTraceFuncs); - - // Set up the tags property. - uint64_t tags = 0; - for (int i = 0; i < NELEM(k_categories); i++) { - if (g_categoryEnables[i]) { - const TracingCategory &c = k_categories[i]; - tags |= c.tags; - } - } - ok &= setTagsProperty(tags); - ok &= setAppCmdlineProperty(g_debugAppCmdLine); - ok &= pokeBinderServices(); - - // Disable all the sysfs enables. This is done as a separate loop from - // the enables to allow the same enable to exist in multiple categories. - ok &= disableKernelTraceEvents(); - - // Enable all the sysfs enables that are in an enabled category. - for (int i = 0; i < NELEM(k_categories); i++) { - if (g_categoryEnables[i]) { - const TracingCategory &c = k_categories[i]; - for (int j = 0; j < MAX_SYS_FILES; j++) { - const char* path = c.sysfiles[j].path; - bool required = c.sysfiles[j].required == REQ; - if (path != NULL) { - if (fileIsWritable(path)) { - ok &= setKernelOptionEnable(path, true); - } else if (required) { - fprintf(stderr, "error writing file %s\n", path); - ok = false; - } - } - } - } - } - - return ok; -} - -// Reset all the kernel tracing settings to their default state. -static void cleanUpTrace() -{ - // Disable all tracing that we're able to. - disableKernelTraceEvents(); - - // Reset the system properties. - setTagsProperty(0); - setAppCmdlineProperty(""); - pokeBinderServices(); - - // Set the options back to their defaults. - setTraceOverwriteEnable(true); - setTraceBufferSizeKB(1); - setGlobalClockEnable(false); - setPrintTgidEnableIfPresent(false); - setKernelTraceFuncs(NULL); -} - - -// Enable tracing in the kernel. -static bool startTrace() -{ - return setTracingEnabled(true); -} - -// Disable tracing in the kernel. -static void stopTrace() -{ - setTracingEnabled(false); -} - -// Read the current kernel trace and write it to stdout. -static void dumpTrace() -{ - int traceFD = open(k_tracePath, O_RDWR); - if (traceFD == -1) { - fprintf(stderr, "error opening %s: %s (%d)\n", k_tracePath, - strerror(errno), errno); - return; - } - - if (g_compress) { - z_stream zs; - uint8_t *in, *out; - int result, flush; - - memset(&zs, 0, sizeof(zs)); - result = deflateInit(&zs, Z_DEFAULT_COMPRESSION); - if (result != Z_OK) { - fprintf(stderr, "error initializing zlib: %d\n", result); - close(traceFD); - return; - } - - const size_t bufSize = 64*1024; - in = (uint8_t*)malloc(bufSize); - out = (uint8_t*)malloc(bufSize); - flush = Z_NO_FLUSH; - - zs.next_out = out; - zs.avail_out = bufSize; - - do { - - if (zs.avail_in == 0) { - // More input is needed. - result = read(traceFD, in, bufSize); - if (result < 0) { - fprintf(stderr, "error reading trace: %s (%d)\n", - strerror(errno), errno); - result = Z_STREAM_END; - break; - } else if (result == 0) { - flush = Z_FINISH; - } else { - zs.next_in = in; - zs.avail_in = result; - } - } - - if (zs.avail_out == 0) { - // Need to write the output. - result = write(STDOUT_FILENO, out, bufSize); - if ((size_t)result < bufSize) { - fprintf(stderr, "error writing deflated trace: %s (%d)\n", - strerror(errno), errno); - result = Z_STREAM_END; // skip deflate error message - zs.avail_out = bufSize; // skip the final write - break; - } - zs.next_out = out; - zs.avail_out = bufSize; - } - - } while ((result = deflate(&zs, flush)) == Z_OK); - - if (result != Z_STREAM_END) { - fprintf(stderr, "error deflating trace: %s\n", zs.msg); - } - - if (zs.avail_out < bufSize) { - size_t bytes = bufSize - zs.avail_out; - result = write(STDOUT_FILENO, out, bytes); - if ((size_t)result < bytes) { - fprintf(stderr, "error writing deflated trace: %s (%d)\n", - strerror(errno), errno); - } - } - - result = deflateEnd(&zs); - if (result != Z_OK) { - fprintf(stderr, "error cleaning up zlib: %d\n", result); - } - - free(in); - free(out); - } else { - ssize_t sent = 0; - while ((sent = sendfile(STDOUT_FILENO, traceFD, NULL, 64*1024*1024)) > 0); - if (sent == -1) { - fprintf(stderr, "error dumping trace: %s (%d)\n", strerror(errno), - errno); - } - } - - close(traceFD); -} - -static void handleSignal(int /*signo*/) -{ - if (!g_nohup) { - g_traceAborted = true; - } -} - -static void registerSigHandler() -{ - struct sigaction sa; - sigemptyset(&sa.sa_mask); - sa.sa_flags = 0; - sa.sa_handler = handleSignal; - sigaction(SIGHUP, &sa, NULL); - sigaction(SIGINT, &sa, NULL); - sigaction(SIGQUIT, &sa, NULL); - sigaction(SIGTERM, &sa, NULL); -} - -static bool setCategoryEnable(const char* name, bool enable) -{ - for (int i = 0; i < NELEM(k_categories); i++) { - const TracingCategory& c = k_categories[i]; - if (strcmp(name, c.name) == 0) { - if (isCategorySupported(c)) { - g_categoryEnables[i] = enable; - return true; - } else { - if (isCategorySupportedForRoot(c)) { - fprintf(stderr, "error: category \"%s\" requires root " - "privileges.\n", name); - } else { - fprintf(stderr, "error: category \"%s\" is not supported " - "on this device.\n", name); - } - return false; - } - } - } - fprintf(stderr, "error: unknown tracing category \"%s\"\n", name); - return false; -} - -static void listSupportedCategories() -{ - for (int i = 0; i < NELEM(k_categories); i++) { - const TracingCategory& c = k_categories[i]; - if (isCategorySupported(c)) { - printf(" %10s - %s\n", c.name, c.longname); - } - } -} - -// Print the command usage help to stderr. -static void showHelp(const char *cmd) -{ - fprintf(stderr, "usage: %s [options] [categories...]\n", cmd); - fprintf(stderr, "options include:\n" - " -a appname enable app-level tracing for a comma " - "separated list of cmdlines\n" - " -b N use a trace buffer size of N KB\n" - " -c trace into a circular buffer\n" - " -k fname,... trace the listed kernel functions\n" - " -n ignore signals\n" - " -s N sleep for N seconds before tracing [default 0]\n" - " -t N trace for N seconds [defualt 5]\n" - " -z compress the trace dump\n" - " --async_start start circular trace and return immediatly\n" - " --async_dump dump the current contents of circular trace buffer\n" - " --async_stop stop tracing and dump the current contents of circular\n" - " trace buffer\n" - " --list_categories\n" - " list the available tracing categories\n" - ); -} - -int main(int argc, char **argv) -{ - bool async = false; - bool traceStart = true; - bool traceStop = true; - bool traceDump = true; - - if (argc == 2 && 0 == strcmp(argv[1], "--help")) { - showHelp(argv[0]); - exit(0); - } - - for (;;) { - int ret; - int option_index = 0; - static struct option long_options[] = { - {"async_start", no_argument, 0, 0 }, - {"async_stop", no_argument, 0, 0 }, - {"async_dump", no_argument, 0, 0 }, - {"list_categories", no_argument, 0, 0 }, - { 0, 0, 0, 0 } - }; - - ret = getopt_long(argc, argv, "a:b:ck:ns:t:z", - long_options, &option_index); - - if (ret < 0) { - for (int i = optind; i < argc; i++) { - if (!setCategoryEnable(argv[i], true)) { - fprintf(stderr, "error enabling tracing category \"%s\"\n", argv[i]); - exit(1); - } - } - break; - } - - switch(ret) { - case 'a': - g_debugAppCmdLine = optarg; - break; - - case 'b': - g_traceBufferSizeKB = atoi(optarg); - break; - - case 'c': - g_traceOverwrite = true; - break; - - case 'k': - g_kernelTraceFuncs = optarg; - break; - - case 'n': - g_nohup = true; - break; - - case 's': - g_initialSleepSecs = atoi(optarg); - break; - - case 't': - g_traceDurationSeconds = atoi(optarg); - break; - - case 'z': - g_compress = true; - break; - - case 0: - if (!strcmp(long_options[option_index].name, "async_start")) { - async = true; - traceStop = false; - traceDump = false; - g_traceOverwrite = true; - } else if (!strcmp(long_options[option_index].name, "async_stop")) { - async = true; - traceStart = false; - } else if (!strcmp(long_options[option_index].name, "async_dump")) { - async = true; - traceStart = false; - traceStop = false; - } else if (!strcmp(long_options[option_index].name, "list_categories")) { - listSupportedCategories(); - exit(0); - } - break; - - default: - fprintf(stderr, "\n"); - showHelp(argv[0]); - exit(-1); - break; - } - } - - registerSigHandler(); - - if (g_initialSleepSecs > 0) { - sleep(g_initialSleepSecs); - } - - bool ok = true; - ok &= setUpTrace(); - ok &= startTrace(); - - if (ok && traceStart) { - printf("capturing trace..."); - fflush(stdout); - - // We clear the trace after starting it because tracing gets enabled for - // each CPU individually in the kernel. Having the beginning of the trace - // contain entries from only one CPU can cause "begin" entries without a - // matching "end" entry to show up if a task gets migrated from one CPU to - // another. - ok = clearTrace(); - - writeClockSyncMarker(); - if (ok && !async) { - // Sleep to allow the trace to be captured. - struct timespec timeLeft; - timeLeft.tv_sec = g_traceDurationSeconds; - timeLeft.tv_nsec = 0; - do { - if (g_traceAborted) { - break; - } - } while (nanosleep(&timeLeft, &timeLeft) == -1 && errno == EINTR); - } - } - - // Stop the trace and restore the default settings. - if (traceStop) - stopTrace(); - - if (ok && traceDump) { - if (!g_traceAborted) { - printf(" done\nTRACE:\n"); - fflush(stdout); - dumpTrace(); - } else { - printf("\ntrace aborted.\n"); - fflush(stdout); - } - clearTrace(); - } else if (!ok) { - fprintf(stderr, "unable to start tracing\n"); - } - - // Reset the trace buffer size to 1. - if (traceStop) - cleanUpTrace(); - - return g_traceAborted ? 1 : 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/atrace/NOTICE android-platform-frameworks-native-21/cmds/atrace/NOTICE --- android-platform-frameworks-native-6.0.1+r16/cmds/atrace/NOTICE 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/atrace/NOTICE 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ - - Copyright (c) 2012, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/bugreport/Android.mk android-platform-frameworks-native-21/cmds/bugreport/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/bugreport/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/bugreport/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= bugreport.cpp - -LOCAL_MODULE:= bugreport - -LOCAL_CFLAGS := -Wall - -LOCAL_SHARED_LIBRARIES := libcutils - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/bugreport/bugreport.cpp android-platform-frameworks-native-21/cmds/bugreport/bugreport.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/bugreport/bugreport.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/bugreport/bugreport.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright (C) 2009 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 -#include -#include -#include -#include - -#include -#include - -// This program will trigger the dumpstate service to start a call to -// dumpstate, then connect to the dumpstate local client to read the -// output. All of the dumpstate output is written to stdout, including -// any errors encountered while reading/writing the output. -int main() { - // Start the dumpstate service. - property_set("ctl.start", "dumpstate"); - - // Socket will not be available until service starts. - int s; - for (int i = 0; i < 20; i++) { - s = socket_local_client("dumpstate", ANDROID_SOCKET_NAMESPACE_RESERVED, - SOCK_STREAM); - if (s >= 0) - break; - // Try again in 1 second. - sleep(1); - } - - if (s == -1) { - printf("Failed to connect to dumpstate service: %s\n", strerror(errno)); - return 1; - } - - // Set a timeout so that if nothing is read in 3 minutes, we'll stop - // reading and quit. No timeout in dumpstate is longer than 60 seconds, - // so this gives lots of leeway in case of unforeseen time outs. - struct timeval tv; - tv.tv_sec = 3 * 60; - tv.tv_usec = 0; - if (setsockopt(s, SOL_SOCKET, SO_RCVTIMEO, &tv, sizeof(tv)) == -1) { - printf("WARNING: Cannot set socket timeout: %s\n", strerror(errno)); - } - - while (1) { - char buffer[65536]; - ssize_t bytes_read = TEMP_FAILURE_RETRY(read(s, buffer, sizeof(buffer))); - if (bytes_read == 0) { - break; - } else if (bytes_read == -1) { - // EAGAIN really means time out, so change the errno. - if (errno == EAGAIN) { - errno = ETIMEDOUT; - } - printf("\nBugreport read terminated abnormally (%s).\n", strerror(errno)); - break; - } - - ssize_t bytes_to_send = bytes_read; - ssize_t bytes_written; - do { - bytes_written = TEMP_FAILURE_RETRY(write(STDOUT_FILENO, - buffer + bytes_read - bytes_to_send, - bytes_to_send)); - if (bytes_written == -1) { - printf("Failed to write data to stdout: read %zd, trying to send %zd (%s)\n", - bytes_read, bytes_to_send, strerror(errno)); - return 1; - } - bytes_to_send -= bytes_written; - } while (bytes_written != 0 && bytes_to_send > 0); - } - - close(s); - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/Android.mk android-platform-frameworks-native-21/cmds/dumpstate/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpstate/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,10 +1,5 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_SRC_FILES := libdumpstate_default.c -LOCAL_MODULE := libdumpstate.default -include $(BUILD_STATIC_LIBRARY) - -include $(CLEAR_VARS) ifdef BOARD_WLAN_DEVICE LOCAL_CFLAGS := -DFWDUMP_$(BOARD_WLAN_DEVICE) @@ -14,8 +9,13 @@ LOCAL_MODULE := dumpstate -LOCAL_SHARED_LIBRARIES := libcutils liblog libselinux -LOCAL_HAL_STATIC_LIBRARIES := libdumpstate +LOCAL_SHARED_LIBRARIES := libcutils + +ifdef BOARD_LIB_DUMPSTATE +LOCAL_STATIC_LIBRARIES := $(BOARD_LIB_DUMPSTATE) +LOCAL_CFLAGS += -DBOARD_HAS_DUMPSTATE +endif + LOCAL_CFLAGS += -Wall -Wno-unused-parameter -std=gnu99 include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/dumpstate.c android-platform-frameworks-native-21/cmds/dumpstate/dumpstate.c --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/dumpstate.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpstate/dumpstate.c 2012-10-16 22:57:11.000000000 +0000 @@ -14,28 +14,26 @@ * limitations under the License. */ -#include #include #include #include -#include #include #include #include -#include -#include #include #include #include #include #include +#include +#include #include #include "private/android_filesystem_config.h" #define LOG_TAG "dumpstate" -#include +#include #include "dumpstate.h" @@ -45,225 +43,8 @@ static char screenshot_path[PATH_MAX] = ""; -#define PSTORE_LAST_KMSG "/sys/fs/pstore/console-ramoops" - -#define TOMBSTONE_DIR "/data/tombstones" -#define TOMBSTONE_FILE_PREFIX TOMBSTONE_DIR "/tombstone_" -/* Can accomodate a tombstone number up to 9999. */ -#define TOMBSTONE_MAX_LEN (sizeof(TOMBSTONE_FILE_PREFIX) + 4) -#define NUM_TOMBSTONES 10 - -typedef struct { - char name[TOMBSTONE_MAX_LEN]; - int fd; -} tombstone_data_t; - -static tombstone_data_t tombstone_data[NUM_TOMBSTONES]; - -/* Get the fds of any tombstone that was modified in the last half an hour. */ -static void get_tombstone_fds(tombstone_data_t data[NUM_TOMBSTONES]) { - time_t thirty_minutes_ago = time(NULL) - 60*30; - for (size_t i = 0; i < NUM_TOMBSTONES; i++) { - snprintf(data[i].name, sizeof(data[i].name), "%s%02zu", TOMBSTONE_FILE_PREFIX, i); - int fd = TEMP_FAILURE_RETRY(open(data[i].name, - O_RDONLY | O_CLOEXEC | O_NOFOLLOW | O_NONBLOCK)); - struct stat st; - if (fstat(fd, &st) == 0 && S_ISREG(st.st_mode) && - (time_t) st.st_mtime >= thirty_minutes_ago) { - data[i].fd = fd; - } else { - close(fd); - data[i].fd = -1; - } - } -} - -static void dump_dev_files(const char *title, const char *driverpath, const char *filename) -{ - DIR *d; - struct dirent *de; - char path[PATH_MAX]; - - d = opendir(driverpath); - if (d == NULL) { - return; - } - - while ((de = readdir(d))) { - if (de->d_type != DT_LNK) { - continue; - } - snprintf(path, sizeof(path), "%s/%s/%s", driverpath, de->d_name, filename); - dump_file(title, path); - } - - closedir(d); -} - -static bool skip_not_stat(const char *path) { - static const char stat[] = "/stat"; - size_t len = strlen(path); - if (path[len - 1] == '/') { /* Directory? */ - return false; - } - return strcmp(path + len - sizeof(stat) + 1, stat); /* .../stat? */ -} - -static const char mmcblk0[] = "/sys/block/mmcblk0/"; -unsigned long worst_write_perf = 20000; /* in KB/s */ - -static int dump_stat_from_fd(const char *title __unused, const char *path, int fd) { - unsigned long fields[11], read_perf, write_perf; - bool z; - char *cp, *buffer = NULL; - size_t i = 0; - FILE *fp = fdopen(fd, "rb"); - getline(&buffer, &i, fp); - fclose(fp); - if (!buffer) { - return -errno; - } - i = strlen(buffer); - while ((i > 0) && (buffer[i - 1] == '\n')) { - buffer[--i] = '\0'; - } - if (!*buffer) { - free(buffer); - return 0; - } - z = true; - for (cp = buffer, i = 0; i < (sizeof(fields) / sizeof(fields[0])); ++i) { - fields[i] = strtol(cp, &cp, 0); - if (fields[i] != 0) { - z = false; - } - } - if (z) { /* never accessed */ - free(buffer); - return 0; - } - - if (!strncmp(path, mmcblk0, sizeof(mmcblk0) - 1)) { - path += sizeof(mmcblk0) - 1; - } - - printf("%s: %s\n", path, buffer); - free(buffer); - - read_perf = 0; - if (fields[3]) { - read_perf = 512 * fields[2] / fields[3]; - } - write_perf = 0; - if (fields[7]) { - write_perf = 512 * fields[6] / fields[7]; - } - printf("%s: read: %luKB/s write: %luKB/s\n", path, read_perf, write_perf); - if ((write_perf > 1) && (write_perf < worst_write_perf)) { - worst_write_perf = write_perf; - } - return 0; -} - -/* Copied policy from system/core/logd/LogBuffer.cpp */ - -#define LOG_BUFFER_SIZE (256 * 1024) -#define LOG_BUFFER_MIN_SIZE (64 * 1024UL) -#define LOG_BUFFER_MAX_SIZE (256 * 1024 * 1024UL) - -static bool valid_size(unsigned long value) { - if ((value < LOG_BUFFER_MIN_SIZE) || (LOG_BUFFER_MAX_SIZE < value)) { - return false; - } - - long pages = sysconf(_SC_PHYS_PAGES); - if (pages < 1) { - return true; - } - - long pagesize = sysconf(_SC_PAGESIZE); - if (pagesize <= 1) { - pagesize = PAGE_SIZE; - } - - // maximum memory impact a somewhat arbitrary ~3% - pages = (pages + 31) / 32; - unsigned long maximum = pages * pagesize; - - if ((maximum < LOG_BUFFER_MIN_SIZE) || (LOG_BUFFER_MAX_SIZE < maximum)) { - return true; - } - - return value <= maximum; -} - -static unsigned long property_get_size(const char *key) { - unsigned long value; - char *cp, property[PROPERTY_VALUE_MAX]; - - property_get(key, property, ""); - value = strtoul(property, &cp, 10); - - switch(*cp) { - case 'm': - case 'M': - value *= 1024; - /* FALLTHRU */ - case 'k': - case 'K': - value *= 1024; - /* FALLTHRU */ - case '\0': - break; - - default: - value = 0; - } - - if (!valid_size(value)) { - value = 0; - } - - return value; -} - -/* timeout in ms */ -static unsigned long logcat_timeout(char *name) { - static const char global_tuneable[] = "persist.logd.size"; // Settings App - static const char global_default[] = "ro.logd.size"; // BoardConfig.mk - char key[PROP_NAME_MAX]; - unsigned long property_size, default_size; - - default_size = property_get_size(global_tuneable); - if (!default_size) { - default_size = property_get_size(global_default); - } - - snprintf(key, sizeof(key), "%s.%s", global_tuneable, name); - property_size = property_get_size(key); - - if (!property_size) { - snprintf(key, sizeof(key), "%s.%s", global_default, name); - property_size = property_get_size(key); - } - - if (!property_size) { - property_size = default_size; - } - - if (!property_size) { - property_size = LOG_BUFFER_SIZE; - } - - /* Engineering margin is ten-fold our guess */ - return 10 * (property_size + worst_write_perf) / worst_write_perf; -} - -/* End copy from system/core/logd/LogBuffer.cpp */ - /* dumps the current system state to stdout */ static void dumpstate() { - unsigned long timeout; time_t now = time(NULL); char build[PROPERTY_VALUE_MAX], fingerprint[PROPERTY_VALUE_MAX]; char radio[PROPERTY_VALUE_MAX], bootloader[PROPERTY_VALUE_MAX]; @@ -294,9 +75,7 @@ printf("Command line: %s\n", strtok(cmdline_buf, "\n")); printf("\n"); - dump_dev_files("TRUSTY VERSION", "/sys/bus/platform/drivers/trusty", "trusty_version"); run_command("UPTIME", 10, "uptime", NULL); - dump_files("UPTIME MMC PERF", mmcblk0, skip_not_stat, dump_stat_from_fd); dump_file("MEMORY INFO", "/proc/meminfo"); run_command("CPU INFO", 10, "top", "-n", "1", "-d", "1", "-m", "30", "-t", NULL); run_command("PROCRANK", 20, "procrank", NULL); @@ -306,49 +85,27 @@ dump_file("ZONEINFO", "/proc/zoneinfo"); dump_file("PAGETYPEINFO", "/proc/pagetypeinfo"); dump_file("BUDDYINFO", "/proc/buddyinfo"); - dump_file("FRAGMENTATION INFO", "/d/extfrag/unusable_index"); + dump_file("KERNEL WAKELOCKS", "/proc/wakelocks"); - dump_file("KERNEL WAKE SOURCES", "/d/wakeup_sources"); dump_file("KERNEL CPUFREQ", "/sys/devices/system/cpu/cpu0/cpufreq/stats/time_in_state"); - dump_file("KERNEL SYNC", "/d/sync"); run_command("PROCESSES", 10, "ps", "-P", NULL); run_command("PROCESSES AND THREADS", 10, "ps", "-t", "-p", "-P", NULL); - run_command("PROCESSES (SELINUX LABELS)", 10, "ps", "-Z", NULL); run_command("LIBRANK", 10, "librank", NULL); do_dmesg(); run_command("LIST OF OPEN FILES", 10, SU_PATH, "root", "lsof", NULL); - for_each_pid(do_showmap, "SMAPS OF ALL PROCESSES"); - for_each_tid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS"); - if (screenshot_path[0]) { - ALOGI("taking screenshot\n"); - run_command(NULL, 10, "/system/bin/screencap", "-p", screenshot_path, NULL); - ALOGI("wrote screenshot: %s\n", screenshot_path); - } + for_each_pid(do_showmap, "SMAPS OF ALL PROCESSES"); + for_each_pid(show_wchan, "BLOCKED PROCESS WAIT-CHANNELS"); // dump_file("EVENT LOG TAGS", "/etc/event-log-tags"); - // calculate timeout - timeout = logcat_timeout("main") + logcat_timeout("system") + logcat_timeout("crash"); - if (timeout < 20000) { - timeout = 20000; - } - run_command("SYSTEM LOG", timeout / 1000, "logcat", "-v", "threadtime", "-d", "*:v", NULL); - timeout = logcat_timeout("events"); - if (timeout < 20000) { - timeout = 20000; - } - run_command("EVENT LOG", timeout / 1000, "logcat", "-b", "events", "-v", "threadtime", "-d", "*:v", NULL); - timeout = logcat_timeout("radio"); - if (timeout < 20000) { - timeout = 20000; - } - run_command("RADIO LOG", timeout / 1000, "logcat", "-b", "radio", "-v", "threadtime", "-d", "*:v", NULL); + run_command("SYSTEM LOG", 20, "logcat", "-v", "threadtime", "-d", "*:v", NULL); + run_command("EVENT LOG", 20, "logcat", "-b", "events", "-v", "threadtime", "-d", "*:v", NULL); + run_command("RADIO LOG", 20, "logcat", "-b", "radio", "-v", "threadtime", "-d", "*:v", NULL); - run_command("LOG STATISTICS", 10, "logcat", "-b", "all", "-S", NULL); /* show the traces we collected in main(), if that was done */ if (dump_traces_path != NULL) { @@ -361,14 +118,10 @@ property_get("dalvik.vm.stack-trace-file", anr_traces_path, ""); if (!anr_traces_path[0]) { printf("*** NO VM TRACES FILE DEFINED (dalvik.vm.stack-trace-file)\n\n"); + } else if (stat(anr_traces_path, &st)) { + printf("*** NO ANR VM TRACES FILE (%s): %s\n\n", anr_traces_path, strerror(errno)); } else { - int fd = TEMP_FAILURE_RETRY(open(anr_traces_path, - O_RDONLY | O_CLOEXEC | O_NOFOLLOW | O_NONBLOCK)); - if (fd < 0) { - printf("*** NO ANR VM TRACES FILE (%s): %s\n\n", anr_traces_path, strerror(errno)); - } else { - dump_file_from_fd("VM TRACES AT LAST ANR", anr_traces_path, fd); - } + dump_file("VM TRACES AT LAST ANR", anr_traces_path); } /* slow traces for slow operations */ @@ -389,51 +142,39 @@ } } - int dumped = 0; - for (size_t i = 0; i < NUM_TOMBSTONES; i++) { - if (tombstone_data[i].fd != -1) { - dumped = 1; - dump_file_from_fd("TOMBSTONE", tombstone_data[i].name, tombstone_data[i].fd); - tombstone_data[i].fd = -1; - } - } - if (!dumped) { - printf("*** NO TOMBSTONES to dump in %s\n\n", TOMBSTONE_DIR); - } - dump_file("NETWORK DEV INFO", "/proc/net/dev"); dump_file("QTAGUID NETWORK INTERFACES INFO", "/proc/net/xt_qtaguid/iface_stat_all"); dump_file("QTAGUID NETWORK INTERFACES INFO (xt)", "/proc/net/xt_qtaguid/iface_stat_fmt"); dump_file("QTAGUID CTRL INFO", "/proc/net/xt_qtaguid/ctrl"); dump_file("QTAGUID STATS INFO", "/proc/net/xt_qtaguid/stats"); - if (!stat(PSTORE_LAST_KMSG, &st)) { - /* Also TODO: Make console-ramoops CAP_SYSLOG protected. */ - dump_file("LAST KMSG", PSTORE_LAST_KMSG); - } else { - /* TODO: Make last_kmsg CAP_SYSLOG protected. b/5555691 */ - dump_file("LAST KMSG", "/proc/last_kmsg"); - } + dump_file("NETWORK ROUTES", "/proc/net/route"); + dump_file("NETWORK ROUTES IPV6", "/proc/net/ipv6_route"); - /* kernels must set CONFIG_PSTORE_PMSG, slice up pstore with device tree */ - run_command("LAST LOGCAT", 10, "logcat", "-L", "-v", "threadtime", - "-b", "all", "-d", "*:v", NULL); - - /* The following have a tendency to get wedged when wifi drivers/fw goes belly-up. */ + /* TODO: Make last_kmsg CAP_SYSLOG protected. b/5555691 */ + dump_file("LAST KMSG", "/proc/last_kmsg"); + dump_file("LAST PANIC CONSOLE", "/data/dontpanic/apanic_console"); + dump_file("LAST PANIC THREADS", "/data/dontpanic/apanic_threads"); - run_command("NETWORK INTERFACES", 10, "ip", "link", NULL); + if (screenshot_path[0]) { + ALOGI("taking screenshot\n"); + run_command(NULL, 5, SU_PATH, "root", "screenshot", screenshot_path, NULL); + ALOGI("wrote screenshot: %s\n", screenshot_path); + } - run_command("IPv4 ADDRESSES", 10, "ip", "-4", "addr", "show", NULL); - run_command("IPv6 ADDRESSES", 10, "ip", "-6", "addr", "show", NULL); + run_command("SYSTEM SETTINGS", 20, SU_PATH, "root", "sqlite3", + "/data/data/com.android.providers.settings/databases/settings.db", + "pragma user_version; select * from system; select * from secure;", NULL); + /* The following have a tendency to get wedged when wifi drivers/fw goes belly-up. */ + run_command("NETWORK INTERFACES", 10, SU_PATH, "root", "netcfg", NULL); run_command("IP RULES", 10, "ip", "rule", "show", NULL); run_command("IP RULES v6", 10, "ip", "-6", "rule", "show", NULL); - - dump_route_tables(); - - run_command("ARP CACHE", 10, "ip", "-4", "neigh", "show", NULL); - run_command("IPv6 ND CACHE", 10, "ip", "-6", "neigh", "show", NULL); - + run_command("ROUTE TABLE 60", 10, "ip", "route", "show", "table", "60", NULL); + run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "60", NULL); + run_command("ROUTE TABLE 61", 10, "ip", "route", "show", "table", "61", NULL); + run_command("ROUTE TABLE 61 v6", 10, "ip", "-6", "route", "show", "table", "61", NULL); + dump_file("ARP CACHE", "/proc/net/arp"); run_command("IPTABLES", 10, SU_PATH, "root", "iptables", "-L", "-nvx", NULL); run_command("IP6TABLES", 10, SU_PATH, "root", "ip6tables", "-L", "-nvx", NULL); run_command("IPTABLE NAT", 10, SU_PATH, "root", "iptables", "-t", "nat", "-L", "-nvx", NULL); @@ -442,41 +183,33 @@ run_command("IP6TABLE RAW", 10, SU_PATH, "root", "ip6tables", "-t", "raw", "-L", "-nvx", NULL); run_command("WIFI NETWORKS", 20, - SU_PATH, "root", "wpa_cli", "IFNAME=wlan0", "list_networks", NULL); - -#ifdef FWDUMP_bcmdhd - run_command("ND OFFLOAD TABLE", 5, - SU_PATH, "root", "wlutil", "nd_hostip", NULL); + SU_PATH, "root", "wpa_cli", "list_networks", NULL); - run_command("DUMP WIFI INTERNAL COUNTERS (1)", 20, - SU_PATH, "root", "wlutil", "counters", NULL); - - run_command("ND OFFLOAD STATUS (1)", 5, - SU_PATH, "root", "wlutil", "nd_status", NULL); - -#endif - dump_file("INTERRUPTS (1)", "/proc/interrupts"); - - run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL); - -#ifdef FWDUMP_bcmdhd + property_get("dhcp.wlan0.gateway", network, ""); + if (network[0]) + run_command("PING GATEWAY", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL); + property_get("dhcp.wlan0.dns1", network, ""); + if (network[0]) + run_command("PING DNS1", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL); + property_get("dhcp.wlan0.dns2", network, ""); + if (network[0]) + run_command("PING DNS2", 10, SU_PATH, "root", "ping", "-c", "3", "-i", ".5", network, NULL); +#ifdef FWDUMP_bcm4329 run_command("DUMP WIFI STATUS", 20, SU_PATH, "root", "dhdutil", "-i", "wlan0", "dump", NULL); - - run_command("DUMP WIFI INTERNAL COUNTERS (2)", 20, + run_command("DUMP WIFI INTERNAL COUNTERS", 20, SU_PATH, "root", "wlutil", "counters", NULL); - - run_command("ND OFFLOAD STATUS (2)", 5, - SU_PATH, "root", "wlutil", "nd_status", NULL); #endif - dump_file("INTERRUPTS (2)", "/proc/interrupts"); print_properties(); run_command("VOLD DUMP", 10, "vdc", "dump", NULL); run_command("SECURE CONTAINERS", 10, "vdc", "asec", "list", NULL); - run_command("FILESYSTEMS & FREE SPACE", 10, "df", NULL); + run_command("FILESYSTEMS & FREE SPACE", 10, SU_PATH, "root", "df", NULL); + + run_command("PACKAGE SETTINGS", 20, SU_PATH, "root", "cat", "/data/system/packages.xml", NULL); + dump_file("PACKAGE UID ERRORS", "/data/system/uiderrors.txt"); run_command("LAST RADIO LOG", 10, "parse_radio_log", "/proc/last_radio_log", NULL); @@ -500,12 +233,14 @@ dump_file("BINDER STATS", "/sys/kernel/debug/binder/stats"); dump_file("BINDER STATE", "/sys/kernel/debug/binder/state"); +#ifdef BOARD_HAS_DUMPSTATE printf("========================================================\n"); printf("== Board\n"); printf("========================================================\n"); dumpstate_board(); printf("\n"); +#endif /* Migrate the ril_dumpstate to a dumpstate_board()? */ char ril_dumpstate_timeout[PROPERTY_VALUE_MAX] = {0}; @@ -533,17 +268,6 @@ run_command("DUMPSYS", 60, "dumpsys", NULL); printf("========================================================\n"); - printf("== Checkins\n"); - printf("========================================================\n"); - - run_command("CHECKIN BATTERYSTATS", 30, "dumpsys", "batterystats", "-c", NULL); - run_command("CHECKIN MEMINFO", 30, "dumpsys", "meminfo", "--checkin", NULL); - run_command("CHECKIN NETSTATS", 30, "dumpsys", "netstats", "--checkin", NULL); - run_command("CHECKIN PROCSTATS", 30, "dumpsys", "procstats", "-c", NULL); - run_command("CHECKIN USAGESTATS", 30, "dumpsys", "usagestats", "-c", NULL); - run_command("CHECKIN PACKAGE", 30, "dumpsys", "package", "--checkin", NULL); - - printf("========================================================\n"); printf("== Running Application Activities\n"); printf("========================================================\n"); @@ -571,69 +295,52 @@ fprintf(stderr, "usage: dumpstate [-b soundfile] [-e soundfile] [-o file [-d] [-p] [-z]] [-s] [-q]\n" " -o: write to file (instead of stdout)\n" " -d: append date to filename (requires -o)\n" + " -z: gzip output (requires -o)\n" " -p: capture screenshot to filename.png (requires -o)\n" " -s: write output to control socket (for init)\n" " -b: play sound file instead of vibrate, at beginning of job\n" " -e: play sound file instead of vibrate, at end of job\n" " -q: disable vibrate\n" - " -B: send broadcast when finished (requires -o and -p)\n" - ); -} - -static void sigpipe_handler(int n) { - // don't complain to stderr or stdout - _exit(EXIT_FAILURE); -} - -static void vibrate(FILE* vibrator, int ms) { - fprintf(vibrator, "%d\n", ms); - fflush(vibrator); + ); } int main(int argc, char *argv[]) { - struct sigaction sigact; int do_add_date = 0; + int do_compress = 0; int do_vibrate = 1; char* use_outfile = 0; + char* begin_sound = 0; + char* end_sound = 0; int use_socket = 0; int do_fb = 0; - int do_broadcast = 0; - - if (getuid() != 0) { - // Old versions of the adb client would call the - // dumpstate command directly. Newer clients - // call /system/bin/bugreport instead. If we detect - // we're being called incorrectly, then exec the - // correct program. - return execl("/system/bin/bugreport", "/system/bin/bugreport", NULL); - } ALOGI("begin\n"); - /* clear SIGPIPE handler */ - memset(&sigact, 0, sizeof(sigact)); - sigact.sa_handler = sigpipe_handler; - sigaction(SIGPIPE, &sigact, NULL); + signal(SIGPIPE, SIG_IGN); /* set as high priority, and protect from OOM killer */ setpriority(PRIO_PROCESS, 0, -20); - FILE *oom_adj = fopen("/proc/self/oom_adj", "we"); + FILE *oom_adj = fopen("/proc/self/oom_adj", "w"); if (oom_adj) { fputs("-17", oom_adj); fclose(oom_adj); } - /* parse arguments */ + /* very first thing, collect stack traces from Dalvik and native processes (needs root) */ + dump_traces_path = dump_traces(); + int c; - while ((c = getopt(argc, argv, "dho:svqzpB")) != -1) { + while ((c = getopt(argc, argv, "b:de:ho:svqzp")) != -1) { switch (c) { + case 'b': begin_sound = optarg; break; case 'd': do_add_date = 1; break; + case 'e': end_sound = optarg; break; case 'o': use_outfile = optarg; break; case 's': use_socket = 1; break; case 'v': break; // compatibility no-op case 'q': do_vibrate = 0; break; + case 'z': do_compress = 6; break; case 'p': do_fb = 1; break; - case 'B': do_broadcast = 1; break; case '?': printf("\n"); case 'h': usage(); @@ -641,78 +348,66 @@ } } - // If we are going to use a socket, do it as early as possible - // to avoid timeouts from bugreport. - if (use_socket) { - redirect_to_socket(stdout, "dumpstate"); - } - - /* open the vibrator before dropping root */ FILE *vibrator = 0; if (do_vibrate) { - vibrator = fopen("/sys/class/timed_output/vibrator/enable", "we"); - if (vibrator) { - vibrate(vibrator, 150); - } + /* open the vibrator before dropping root */ + vibrator = fopen("/sys/class/timed_output/vibrator/enable", "w"); + if (vibrator) fcntl(fileno(vibrator), F_SETFD, FD_CLOEXEC); } /* read /proc/cmdline before dropping root */ - FILE *cmdline = fopen("/proc/cmdline", "re"); + FILE *cmdline = fopen("/proc/cmdline", "r"); if (cmdline != NULL) { fgets(cmdline_buf, sizeof(cmdline_buf), cmdline); fclose(cmdline); } - /* collect stack traces from Dalvik and native processes (needs root) */ - dump_traces_path = dump_traces(); - - /* Get the tombstone fds here while we are running as root. */ - get_tombstone_fds(tombstone_data); - - /* ensure we will keep capabilities when we drop root */ - if (prctl(PR_SET_KEEPCAPS, 1) < 0) { - ALOGE("prctl(PR_SET_KEEPCAPS) failed: %s\n", strerror(errno)); - return -1; - } - - /* switch to non-root user and group */ - gid_t groups[] = { AID_LOG, AID_SDCARD_R, AID_SDCARD_RW, - AID_MOUNT, AID_INET, AID_NET_BW_STATS }; - if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { - ALOGE("Unable to setgroups, aborting: %s\n", strerror(errno)); - return -1; - } - if (setgid(AID_SHELL) != 0) { - ALOGE("Unable to setgid, aborting: %s\n", strerror(errno)); - return -1; - } - if (setuid(AID_SHELL) != 0) { - ALOGE("Unable to setuid, aborting: %s\n", strerror(errno)); - return -1; - } - - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[2]; - memset(&capheader, 0, sizeof(capheader)); - memset(&capdata, 0, sizeof(capdata)); - capheader.version = _LINUX_CAPABILITY_VERSION_3; - capheader.pid = 0; - - capdata[CAP_TO_INDEX(CAP_SYSLOG)].permitted = CAP_TO_MASK(CAP_SYSLOG); - capdata[CAP_TO_INDEX(CAP_SYSLOG)].effective = CAP_TO_MASK(CAP_SYSLOG); - capdata[0].inheritable = 0; - capdata[1].inheritable = 0; - - if (capset(&capheader, &capdata[0]) < 0) { - ALOGE("capset failed: %s\n", strerror(errno)); - return -1; + if (getuid() == 0) { + if (prctl(PR_SET_KEEPCAPS, 1) < 0) { + ALOGE("prctl(PR_SET_KEEPCAPS) failed: %s\n", strerror(errno)); + return -1; + } + + /* switch to non-root user and group */ + gid_t groups[] = { AID_LOG, AID_SDCARD_R, AID_SDCARD_RW, + AID_MOUNT, AID_INET, AID_NET_BW_STATS }; + if (setgroups(sizeof(groups)/sizeof(groups[0]), groups) != 0) { + ALOGE("Unable to setgroups, aborting: %s\n", strerror(errno)); + return -1; + } + if (setgid(AID_SHELL) != 0) { + ALOGE("Unable to setgid, aborting: %s\n", strerror(errno)); + return -1; + } + if (setuid(AID_SHELL) != 0) { + ALOGE("Unable to setuid, aborting: %s\n", strerror(errno)); + return -1; + } + + struct __user_cap_header_struct capheader; + struct __user_cap_data_struct capdata[2]; + memset(&capheader, 0, sizeof(capheader)); + memset(&capdata, 0, sizeof(capdata)); + capheader.version = _LINUX_CAPABILITY_VERSION_3; + capheader.pid = 0; + + capdata[CAP_TO_INDEX(CAP_SYSLOG)].permitted = CAP_TO_MASK(CAP_SYSLOG); + capdata[CAP_TO_INDEX(CAP_SYSLOG)].effective = CAP_TO_MASK(CAP_SYSLOG); + capdata[0].inheritable = 0; + capdata[1].inheritable = 0; + + if (capset(&capheader, &capdata[0]) < 0) { + ALOGE("capset failed: %s\n", strerror(errno)); + return -1; + } } - /* redirect output if needed */ char path[PATH_MAX], tmp_path[PATH_MAX]; pid_t gzip_pid = -1; - if (!use_socket && use_outfile) { + if (use_socket) { + redirect_to_socket(stdout, "dumpstate"); + } else if (use_outfile) { strlcpy(path, use_outfile, sizeof(path)); if (do_add_date) { char date[80]; @@ -725,17 +420,28 @@ strlcat(screenshot_path, ".png", sizeof(screenshot_path)); } strlcat(path, ".txt", sizeof(path)); + if (do_compress) strlcat(path, ".gz", sizeof(path)); strlcpy(tmp_path, path, sizeof(tmp_path)); strlcat(tmp_path, ".tmp", sizeof(tmp_path)); - redirect_to_file(stdout, tmp_path); + gzip_pid = redirect_to_file(stdout, tmp_path, do_compress); + } + + if (begin_sound) { + play_sound(begin_sound); + } else if (vibrator) { + fputs("150", vibrator); + fflush(vibrator); } dumpstate(); - /* done */ - if (vibrator) { - for (int i = 0; i < 3; i++) { - vibrate(vibrator, 75); + if (end_sound) { + play_sound(end_sound); + } else if (vibrator) { + int i; + for (i = 0; i < 3; i++) { + fputs("75\n", vibrator); + fflush(vibrator); usleep((75 + 50) * 1000); } fclose(vibrator); @@ -752,15 +458,6 @@ fprintf(stderr, "rename(%s, %s): %s\n", tmp_path, path, strerror(errno)); } - /* tell activity manager we're done */ - if (do_broadcast && use_outfile && do_fb) { - run_command(NULL, 5, "/system/bin/am", "broadcast", "--user", "0", - "-a", "android.intent.action.BUGREPORT_FINISHED", - "--es", "android.intent.extra.BUGREPORT", path, - "--es", "android.intent.extra.SCREENSHOT", screenshot_path, - "--receiver-permission", "android.permission.DUMP", NULL); - } - ALOGI("done\n"); return 0; diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/dumpstate.h android-platform-frameworks-native-21/cmds/dumpstate/dumpstate.h --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/dumpstate.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpstate/dumpstate.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,31 +19,12 @@ #include #include -#include #include #define SU_PATH "/system/xbin/su" -typedef void (for_each_pid_func)(int, const char *); -typedef void (for_each_tid_func)(int, int, const char *); - /* prints the contents of a file */ -int dump_file(const char *title, const char *path); - -/* prints the contents of the fd - * fd must have been opened with the flag O_NONBLOCK. - */ -int dump_file_from_fd(const char *title, const char *path, int fd); - -/* calls skip to gate calling dump_from_fd recursively - * in the specified directory. dump_from_fd defaults to - * dump_file_from_fd above when set to NULL. skip defaults - * to false when set to NULL. dump_from_fd will always be - * called with title NULL. - */ -int dump_files(const char *title, const char *dir, - bool (*skip)(const char *path), - int (*dump_from_fd)(const char *title, const char *path, int fd)); +int dump_file(const char *title, const char* path); /* forks a command and waits for it to finish -- terminate args with NULL */ int run_command(const char *title, int timeout_seconds, const char *command, ...); @@ -54,20 +35,17 @@ /* redirect output to a service control socket */ void redirect_to_socket(FILE *redirect, const char *service); -/* redirect output to a file */ -void redirect_to_file(FILE *redirect, char *path); +/* redirect output to a file, optionally gzipping; returns gzip pid */ +pid_t redirect_to_file(FILE *redirect, char *path, int gzip_level); /* dump Dalvik and native stack traces, return the trace file location (NULL if none) */ const char *dump_traces(); /* for each process in the system, run the specified function */ -void for_each_pid(for_each_pid_func func, const char *header); - -/* for each thread in the system, run the specified function */ -void for_each_tid(for_each_tid_func func, const char *header); +void for_each_pid(void (*func)(int, const char *), const char *header); /* Displays a blocked processes in-kernel wait channel */ -void show_wchan(int pid, int tid, const char *name); +void show_wchan(int pid, const char *name); /* Runs "showmap" for a process */ void do_showmap(int pid, const char *name); @@ -75,11 +53,8 @@ /* Gets the dmesg output for the kernel */ void do_dmesg(); -/* Prints the contents of all the routing tables, both IPv4 and IPv6. */ -void dump_route_tables(); - /* Play a sound via Stagefright */ -void play_sound(const char *path); +void play_sound(const char* path); /* Implemented by libdumpstate_board to dump board-specific info */ void dumpstate_board(); diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/libdumpstate_default.c android-platform-frameworks-native-21/cmds/dumpstate/libdumpstate_default.c --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/libdumpstate_default.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpstate/libdumpstate_default.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ -/* - * Copyright (C) 2013 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 "dumpstate.h" - -void dumpstate_board(void) -{ -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/utils.c android-platform-frameworks-native-21/cmds/dumpstate/utils.c --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpstate/utils.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpstate/utils.c 2012-10-16 22:57:11.000000000 +0000 @@ -31,58 +31,23 @@ #include #include #include -#include #include #include #include #include -#include - #include "dumpstate.h" -static const int64_t NANOS_PER_SEC = 1000000000; - /* list of native processes to include in the native dumps */ static const char* native_processes_to_dump[] = { - "/system/bin/drmserver", "/system/bin/mediaserver", "/system/bin/sdcard", "/system/bin/surfaceflinger", NULL, }; -static uint64_t nanotime() { - struct timespec ts; - clock_gettime(CLOCK_MONOTONIC, &ts); - return (uint64_t)ts.tv_sec * NANOS_PER_SEC + ts.tv_nsec; -} - -void for_each_userid(void (*func)(int), const char *header) { - DIR *d; - struct dirent *de; - - if (header) printf("\n------ %s ------\n", header); - func(0); - - if (!(d = opendir("/data/system/users"))) { - printf("Failed to open /data/system/users (%s)\n", strerror(errno)); - return; - } - - while ((de = readdir(d))) { - int userid; - if (de->d_type != DT_DIR || !(userid = atoi(de->d_name))) { - continue; - } - func(userid); - } - - closedir(d); -} - -static void __for_each_pid(void (*helper)(int, const char *, void *), const char *header, void *arg) { +void for_each_pid(void (*func)(int, const char *), const char *header) { DIR *d; struct dirent *de; @@ -104,89 +69,27 @@ sprintf(cmdpath,"/proc/%d/cmdline", pid); memset(cmdline, 0, sizeof(cmdline)); - if ((fd = TEMP_FAILURE_RETRY(open(cmdpath, O_RDONLY | O_CLOEXEC))) < 0) { + if ((fd = open(cmdpath, O_RDONLY)) < 0) { strcpy(cmdline, "N/A"); } else { - read(fd, cmdline, sizeof(cmdline) - 1); + read(fd, cmdline, sizeof(cmdline)); close(fd); } - helper(pid, cmdline, arg); + func(pid, cmdline); } closedir(d); } -static void for_each_pid_helper(int pid, const char *cmdline, void *arg) { - for_each_pid_func *func = arg; - func(pid, cmdline); -} - -void for_each_pid(for_each_pid_func func, const char *header) { - __for_each_pid(for_each_pid_helper, header, func); -} - -static void for_each_tid_helper(int pid, const char *cmdline, void *arg) { - DIR *d; - struct dirent *de; - char taskpath[255]; - for_each_tid_func *func = arg; - - sprintf(taskpath, "/proc/%d/task", pid); - - if (!(d = opendir(taskpath))) { - printf("Failed to open %s (%s)\n", taskpath, strerror(errno)); - return; - } - - func(pid, pid, cmdline); - - while ((de = readdir(d))) { - int tid; - int fd; - char commpath[255]; - char comm[255]; - - if (!(tid = atoi(de->d_name))) { - continue; - } - - if (tid == pid) - continue; - - sprintf(commpath,"/proc/%d/comm", tid); - memset(comm, 0, sizeof(comm)); - if ((fd = TEMP_FAILURE_RETRY(open(commpath, O_RDONLY | O_CLOEXEC))) < 0) { - strcpy(comm, "N/A"); - } else { - char *c; - read(fd, comm, sizeof(comm) - 1); - close(fd); - - c = strrchr(comm, '\n'); - if (c) { - *c = '\0'; - } - } - func(pid, tid, comm); - } - - closedir(d); -} - -void for_each_tid(for_each_tid_func func, const char *header) { - __for_each_pid(for_each_tid_helper, header, func); -} - -void show_wchan(int pid, int tid, const char *name) { +void show_wchan(int pid, const char *name) { char path[255]; char buffer[255]; int fd; - char name_buffer[255]; memset(buffer, 0, sizeof(buffer)); - sprintf(path, "/proc/%d/wchan", tid); - if ((fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC))) < 0) { + sprintf(path, "/proc/%d/wchan", pid); + if ((fd = open(path, O_RDONLY)) < 0) { printf("Failed to open '%s' (%s)\n", path, strerror(errno)); return; } @@ -196,10 +99,7 @@ goto out_close; } - snprintf(name_buffer, sizeof(name_buffer), "%*s%s", - pid == tid ? 0 : 3, "", name); - - printf("%-7d %-32s %s\n", tid, name_buffer, buffer); + printf("%-7d %-32s %s\n", pid, name, buffer); out_close: close(fd); @@ -208,8 +108,7 @@ void do_dmesg() { printf("------ KERNEL LOG (dmesg) ------\n"); - /* Get size of kernel buffer */ - int size = klogctl(KLOG_SIZE_BUFFER, NULL, 0); + int size = klogctl(10, NULL, 0); /* Get size of kernel buffer */ if (size <= 0) { printf("Unexpected klogctl return value: %d\n\n", size); return; @@ -240,7 +139,18 @@ run_command(title, 10, SU_PATH, "root", "showmap", arg, NULL); } -static int _dump_file_from_fd(const char *title, const char *path, int fd) { +/* prints the contents of a file */ +int dump_file(const char *title, const char* path) { + char buffer[32768]; + int fd = open(path, O_RDONLY); + if (fd < 0) { + int err = errno; + if (title) printf("------ %s (%s) ------\n", title, path); + printf("*** %s: %s\n", path, strerror(err)); + if (title) printf("\n"); + return -1; + } + if (title) printf("------ %s (%s", title, path); if (title) { @@ -254,195 +164,26 @@ printf(") ------\n"); } - bool newline = false; - fd_set read_set; - struct timeval tm; - while (1) { - FD_ZERO(&read_set); - FD_SET(fd, &read_set); - /* Timeout if no data is read for 30 seconds. */ - tm.tv_sec = 30; - tm.tv_usec = 0; - uint64_t elapsed = nanotime(); - int ret = TEMP_FAILURE_RETRY(select(fd + 1, &read_set, NULL, NULL, &tm)); - if (ret == -1) { - printf("*** %s: select failed: %s\n", path, strerror(errno)); - newline = true; - break; - } else if (ret == 0) { - elapsed = nanotime() - elapsed; - printf("*** %s: Timed out after %.3fs\n", path, - (float) elapsed / NANOS_PER_SEC); - newline = true; - break; - } else { - char buffer[65536]; - ssize_t bytes_read = TEMP_FAILURE_RETRY(read(fd, buffer, sizeof(buffer))); - if (bytes_read > 0) { - fwrite(buffer, bytes_read, 1, stdout); - newline = (buffer[bytes_read-1] == '\n'); - } else { - if (bytes_read == -1) { - printf("*** %s: Failed to read from fd: %s", path, strerror(errno)); - newline = true; - } - break; - } + int newline = 0; + for (;;) { + int ret = read(fd, buffer, sizeof(buffer)); + if (ret > 0) { + newline = (buffer[ret - 1] == '\n'); + ret = fwrite(buffer, ret, 1, stdout); } + if (ret <= 0) break; } - close(fd); + close(fd); if (!newline) printf("\n"); if (title) printf("\n"); return 0; } -/* prints the contents of a file */ -int dump_file(const char *title, const char *path) { - int fd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_NONBLOCK | O_CLOEXEC)); - if (fd < 0) { - int err = errno; - if (title) printf("------ %s (%s) ------\n", title, path); - printf("*** %s: %s\n", path, strerror(err)); - if (title) printf("\n"); - return -1; - } - return _dump_file_from_fd(title, path, fd); -} - -/* calls skip to gate calling dump_from_fd recursively - * in the specified directory. dump_from_fd defaults to - * dump_file_from_fd above when set to NULL. skip defaults - * to false when set to NULL. dump_from_fd will always be - * called with title NULL. - */ -int dump_files(const char *title, const char *dir, - bool (*skip)(const char *path), - int (*dump_from_fd)(const char *title, const char *path, int fd)) { - DIR *dirp; - struct dirent *d; - char *newpath = NULL; - char *slash = "/"; - int fd, retval = 0; - - if (title) { - printf("------ %s (%s) ------\n", title, dir); - } - - if (dir[strlen(dir) - 1] == '/') { - ++slash; - } - dirp = opendir(dir); - if (dirp == NULL) { - retval = -errno; - fprintf(stderr, "%s: %s\n", dir, strerror(errno)); - return retval; - } - - if (!dump_from_fd) { - dump_from_fd = dump_file_from_fd; - } - for (; ((d = readdir(dirp))); free(newpath), newpath = NULL) { - if ((d->d_name[0] == '.') - && (((d->d_name[1] == '.') && (d->d_name[2] == '\0')) - || (d->d_name[1] == '\0'))) { - continue; - } - asprintf(&newpath, "%s%s%s%s", dir, slash, d->d_name, - (d->d_type == DT_DIR) ? "/" : ""); - if (!newpath) { - retval = -errno; - continue; - } - if (skip && (*skip)(newpath)) { - continue; - } - if (d->d_type == DT_DIR) { - int ret = dump_files(NULL, newpath, skip, dump_from_fd); - if (ret < 0) { - retval = ret; - } - continue; - } - fd = TEMP_FAILURE_RETRY(open(newpath, O_RDONLY | O_NONBLOCK | O_CLOEXEC)); - if (fd < 0) { - retval = fd; - printf("*** %s: %s\n", newpath, strerror(errno)); - continue; - } - (*dump_from_fd)(NULL, newpath, fd); - } - closedir(dirp); - if (title) { - printf("\n"); - } - return retval; -} - -/* fd must have been opened with the flag O_NONBLOCK. With this flag set, - * it's possible to avoid issues where opening the file itself can get - * stuck. - */ -int dump_file_from_fd(const char *title, const char *path, int fd) { - int flags = fcntl(fd, F_GETFL); - if (flags == -1) { - printf("*** %s: failed to get flags on fd %d: %s\n", path, fd, strerror(errno)); - return -1; - } else if (!(flags & O_NONBLOCK)) { - printf("*** %s: fd must have O_NONBLOCK set.\n", path); - return -1; - } - return _dump_file_from_fd(title, path, fd); -} - -bool waitpid_with_timeout(pid_t pid, int timeout_seconds, int* status) { - sigset_t child_mask, old_mask; - sigemptyset(&child_mask); - sigaddset(&child_mask, SIGCHLD); - - if (sigprocmask(SIG_BLOCK, &child_mask, &old_mask) == -1) { - printf("*** sigprocmask failed: %s\n", strerror(errno)); - return false; - } - - struct timespec ts; - ts.tv_sec = timeout_seconds; - ts.tv_nsec = 0; - int ret = TEMP_FAILURE_RETRY(sigtimedwait(&child_mask, NULL, &ts)); - int saved_errno = errno; - // Set the signals back the way they were. - if (sigprocmask(SIG_SETMASK, &old_mask, NULL) == -1) { - printf("*** sigprocmask failed: %s\n", strerror(errno)); - if (ret == 0) { - return false; - } - } - if (ret == -1) { - errno = saved_errno; - if (errno == EAGAIN) { - errno = ETIMEDOUT; - } else { - printf("*** sigtimedwait failed: %s\n", strerror(errno)); - } - return false; - } - - pid_t child_pid = waitpid(pid, status, WNOHANG); - if (child_pid != pid) { - if (child_pid != -1) { - printf("*** Waiting for pid %d, got pid %d instead\n", pid, child_pid); - } else { - printf("*** waitpid failed: %s\n", strerror(errno)); - } - return false; - } - return true; -} - /* forks a command and waits for it to finish */ int run_command(const char *title, int timeout_seconds, const char *command, ...) { fflush(stdout); - uint64_t start = nanotime(); + clock_t start = clock(); pid_t pid = fork(); /* handle error case */ @@ -456,15 +197,6 @@ const char *args[1024] = {command}; size_t arg; - /* make sure the child dies when dumpstate dies */ - prctl(PR_SET_PDEATHSIG, SIGKILL); - - /* just ignore SIGPIPE, will go down with parent's */ - struct sigaction sigact; - memset(&sigact, 0, sizeof(sigact)); - sigact.sa_handler = SIG_IGN; - sigaction(SIGPIPE, &sigact, NULL); - va_list ap; va_start(ap, command); if (title) printf("------ %s (%s", title, command); @@ -483,35 +215,28 @@ } /* handle parent case */ - int status; - bool ret = waitpid_with_timeout(pid, timeout_seconds, &status); - uint64_t elapsed = nanotime() - start; - if (!ret) { - if (errno == ETIMEDOUT) { - printf("*** %s: Timed out after %.3fs (killing pid %d)\n", command, - (float) elapsed / NANOS_PER_SEC, pid); - } else { - printf("*** %s: Error after %.4fs (killing pid %d)\n", command, - (float) elapsed / NANOS_PER_SEC, pid); - } - kill(pid, SIGTERM); - if (!waitpid_with_timeout(pid, 5, NULL)) { - kill(pid, SIGKILL); - if (!waitpid_with_timeout(pid, 5, NULL)) { - printf("*** %s: Cannot kill %d even with SIGKILL.\n", command, pid); - } + for (;;) { + int status; + pid_t p = waitpid(pid, &status, WNOHANG); + float elapsed = (float) (clock() - start) / CLOCKS_PER_SEC; + if (p == pid) { + if (WIFSIGNALED(status)) { + printf("*** %s: Killed by signal %d\n", command, WTERMSIG(status)); + } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) { + printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status)); + } + if (title) printf("[%s: %.1fs elapsed]\n\n", command, elapsed); + return status; + } + + if (timeout_seconds && elapsed > timeout_seconds) { + printf("*** %s: Timed out after %.1fs (killing pid %d)\n", command, elapsed, pid); + kill(pid, SIGTERM); + return -1; } - return -1; - } - if (WIFSIGNALED(status)) { - printf("*** %s: Killed by signal %d\n", command, WTERMSIG(status)); - } else if (WIFEXITED(status) && WEXITSTATUS(status) > 0) { - printf("*** %s: Exit code %d\n", command, WEXITSTATUS(status)); + usleep(100000); // poll every 0.1 sec } - if (title) printf("[%s: %.3fs elapsed]\n\n", command, (float)elapsed / NANOS_PER_SEC); - - return status; } size_t num_props = 0; @@ -552,7 +277,6 @@ fprintf(stderr, "android_get_control_socket(%s): %s\n", service, strerror(errno)); exit(1); } - fcntl(s, F_SETFD, FD_CLOEXEC); if (listen(s, 4) < 0) { fprintf(stderr, "listen(control socket): %s\n", strerror(errno)); exit(1); @@ -571,8 +295,8 @@ close(fd); } -/* redirect output to a file */ -void redirect_to_file(FILE *redirect, char *path) { +/* redirect output to a file, optionally gzipping; returns gzip pid (or -1) */ +pid_t redirect_to_file(FILE *redirect, char *path, int gzip_level) { char *chp = path; /* skip initial slash */ @@ -584,20 +308,57 @@ chp = strchr(chp, '/'); if (chp) { *chp = 0; - mkdir(path, 0770); /* drwxrwx--- */ + mkdir(path, 0775); /* drwxrwxr-x */ *chp++ = '/'; } } - int fd = TEMP_FAILURE_RETRY(open(path, O_WRONLY | O_CREAT | O_TRUNC | O_CLOEXEC, - S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)); + int fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); if (fd < 0) { fprintf(stderr, "%s: %s\n", path, strerror(errno)); exit(1); } - TEMP_FAILURE_RETRY(dup2(fd, fileno(redirect))); + pid_t gzip_pid = -1; + if (gzip_level > 0) { + int fds[2]; + if (pipe(fds)) { + fprintf(stderr, "pipe: %s\n", strerror(errno)); + exit(1); + } + + fflush(redirect); + fflush(stdout); + + gzip_pid = fork(); + if (gzip_pid < 0) { + fprintf(stderr, "fork: %s\n", strerror(errno)); + exit(1); + } + + if (gzip_pid == 0) { + dup2(fds[0], STDIN_FILENO); + dup2(fd, STDOUT_FILENO); + + close(fd); + close(fds[0]); + close(fds[1]); + + char level[10]; + snprintf(level, sizeof(level), "-%d", gzip_level); + execlp("gzip", "gzip", level, NULL); + fprintf(stderr, "exec(gzip): %s\n", strerror(errno)); + _exit(-1); + } + + close(fd); + close(fds[0]); + fd = fds[1]; + } + + dup2(fd, fileno(redirect)); close(fd); + return gzip_pid; } static bool should_dump_native_traces(const char* path) { @@ -635,9 +396,6 @@ if (!mkdir(anr_traces_dir, 0775)) { chown(anr_traces_dir, AID_SYSTEM, AID_SYSTEM); chmod(anr_traces_dir, 0775); - if (selinux_android_restorecon(anr_traces_dir, 0) == -1) { - fprintf(stderr, "restorecon failed for %s: %s\n", anr_traces_dir, strerror(errno)); - } } else if (errno != EEXIST) { fprintf(stderr, "mkdir(%s): %s\n", anr_traces_dir, strerror(errno)); return NULL; @@ -645,8 +403,7 @@ } /* create a new, empty traces.txt file to receive stack dumps */ - int fd = TEMP_FAILURE_RETRY(open(traces_path, O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW | O_CLOEXEC, - 0666)); /* -rw-rw-rw- */ + int fd = open(traces_path, O_CREAT | O_WRONLY | O_TRUNC | O_NOFOLLOW, 0666); /* -rw-rw-rw- */ if (fd < 0) { fprintf(stderr, "%s: %s\n", traces_path, strerror(errno)); return NULL; @@ -693,22 +450,21 @@ } data[len] = '\0'; - if (!strncmp(data, "/system/bin/app_process", strlen("/system/bin/app_process"))) { + if (!strcmp(data, "/system/bin/app_process")) { /* skip zygote -- it won't dump its stack anyway */ snprintf(path, sizeof(path), "/proc/%d/cmdline", pid); - int cfd = TEMP_FAILURE_RETRY(open(path, O_RDONLY | O_CLOEXEC)); - len = read(cfd, data, sizeof(data) - 1); - close(cfd); + int fd = open(path, O_RDONLY); + len = read(fd, data, sizeof(data) - 1); + close(fd); if (len <= 0) { continue; } data[len] = '\0'; - if (!strncmp(data, "zygote", strlen("zygote"))) { + if (!strcmp(data, "zygote")) { continue; } ++dalvik_found; - uint64_t start = nanotime(); if (kill(pid, SIGQUIT)) { fprintf(stderr, "kill(%d, SIGQUIT): %s\n", pid, strerror(errno)); continue; @@ -716,7 +472,7 @@ /* wait for the writable-close notification from inotify */ struct pollfd pfd = { ifd, POLLIN, 0 }; - int ret = poll(&pfd, 1, 5000); /* 5 sec timeout */ + int ret = poll(&pfd, 1, 200); /* 200 msec timeout */ if (ret < 0) { fprintf(stderr, "poll: %s\n", strerror(errno)); } else if (ret == 0) { @@ -725,32 +481,12 @@ struct inotify_event ie; read(ifd, &ie, sizeof(ie)); } - - if (lseek(fd, 0, SEEK_END) < 0) { - fprintf(stderr, "lseek: %s\n", strerror(errno)); - } else { - dprintf(fd, "[dump dalvik stack %d: %.3fs elapsed]\n", - pid, (float)(nanotime() - start) / NANOS_PER_SEC); - } } else if (should_dump_native_traces(data)) { /* dump native process if appropriate */ if (lseek(fd, 0, SEEK_END) < 0) { fprintf(stderr, "lseek: %s\n", strerror(errno)); } else { - static uint16_t timeout_failures = 0; - uint64_t start = nanotime(); - - /* If 3 backtrace dumps fail in a row, consider debuggerd dead. */ - if (timeout_failures == 3) { - dprintf(fd, "too many stack dump failures, skipping...\n"); - } else if (dump_backtrace_to_file_timeout(pid, fd, 20) == -1) { - dprintf(fd, "dumping failed, likely due to a timeout\n"); - timeout_failures++; - } else { - timeout_failures = 0; - } - dprintf(fd, "[dump native stack %d: %.3fs elapsed]\n", - pid, (float)(nanotime() - start) / NANOS_PER_SEC); + dump_backtrace_to_file(pid, fd); } } } @@ -778,21 +514,6 @@ return result; } -void dump_route_tables() { - const char* const RT_TABLES_PATH = "/data/misc/net/rt_tables"; - dump_file("RT_TABLES", RT_TABLES_PATH); - FILE* fp = fopen(RT_TABLES_PATH, "re"); - if (!fp) { - printf("*** %s: %s\n", RT_TABLES_PATH, strerror(errno)); - return; - } - char table[16]; - // Each line has an integer (the table number), a space, and a string (the table name). We only - // need the table number. It's a 32-bit unsigned number, so max 10 chars. Skip the table name. - // Add a fixed max limit so this doesn't go awry. - for (int i = 0; i < 64 && fscanf(fp, " %10s %*s", table) == 1; ++i) { - run_command("ROUTE TABLE IPv4", 10, "ip", "-4", "route", "show", "table", table, NULL); - run_command("ROUTE TABLE IPv6", 10, "ip", "-6", "route", "show", "table", table, NULL); - } - fclose(fp); +void play_sound(const char* path) { + run_command(NULL, 5, "/system/bin/stagefright", "-o", "-a", path, NULL); } diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpsys/Android.mk android-platform-frameworks-native-21/cmds/dumpsys/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpsys/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpsys/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -6,7 +6,6 @@ LOCAL_SHARED_LIBRARIES := \ libutils \ - liblog \ libbinder diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/dumpsys/dumpsys.cpp android-platform-frameworks-native-21/cmds/dumpsys/dumpsys.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/dumpsys/dumpsys.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/dumpsys/dumpsys.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -9,7 +9,7 @@ #include #include #include -#include +#include #include #include @@ -39,11 +39,7 @@ Vector services; Vector args; - bool showListOnly = false; - if ((argc == 2) && (strcmp(argv[1], "-l") == 0)) { - showListOnly = true; - } - if ((argc == 1) || showListOnly) { + if (argc == 1) { services = sm->listServices(); services.sort(sort_func); args.add(String16("-a")); @@ -68,10 +64,6 @@ } } - if (showListOnly) { - return 0; - } - for (size_t i=0; i service = sm->checkService(services[i]); if (service != NULL) { diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Android.mk android-platform-frameworks-native-21/cmds/flatland/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -local_target_dir := $(TARGET_OUT_DATA)/local/tmp -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - Composers.cpp \ - GLHelper.cpp \ - Renderers.cpp \ - Main.cpp \ - -LOCAL_MODULE:= flatland - -LOCAL_MODULE_TAGS := tests - -LOCAL_MODULE_PATH := $(local_target_dir) -LOCAL_MULTILIB := both -LOCAL_MODULE_STEM_32 := flatland -LOCAL_MODULE_STEM_64 := flatland64 -LOCAL_SHARED_LIBRARIES := \ - libEGL \ - libGLESv2 \ - libcutils \ - libgui \ - libui \ - libutils \ - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Composers.cpp android-platform-frameworks-native-21/cmds/flatland/Composers.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Composers.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/Composers.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,285 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include - -#include "Flatland.h" -#include "GLHelper.h" - -namespace android { - -class Blitter { -public: - - bool setUp(GLHelper* helper) { - bool result; - - result = helper->getShaderProgram("Blit", &mBlitPgm); - if (!result) { - return false; - } - - mPosAttribLoc = glGetAttribLocation(mBlitPgm, "position"); - mUVAttribLoc = glGetAttribLocation(mBlitPgm, "uv"); - mUVToTexUniformLoc = glGetUniformLocation(mBlitPgm, "uvToTex"); - mObjToNdcUniformLoc = glGetUniformLocation(mBlitPgm, "objToNdc"); - mBlitSrcSamplerLoc = glGetUniformLocation(mBlitPgm, "blitSrc"); - mModColorUniformLoc = glGetUniformLocation(mBlitPgm, "modColor"); - - return true; - } - - bool blit(GLuint texName, const float* texMatrix, - int32_t x, int32_t y, uint32_t w, uint32_t h) { - float modColor[4] = { 1.0f, 1.0f, 1.0f, 1.0f }; - return modBlit(texName, texMatrix, modColor, x, y, w, h); - } - - bool modBlit(GLuint texName, const float* texMatrix, float* modColor, - int32_t x, int32_t y, uint32_t w, uint32_t h) { - glUseProgram(mBlitPgm); - - GLint vp[4]; - glGetIntegerv(GL_VIEWPORT, vp); - float screenToNdc[16] = { - 2.0f/float(vp[2]), 0.0f, 0.0f, 0.0f, - 0.0f, -2.0f/float(vp[3]), 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - -1.0f, 1.0f, 0.0f, 1.0f, - }; - const float pos[] = { - float(x), float(y), - float(x+w), float(y), - float(x), float(y+h), - float(x+w), float(y+h), - }; - const float uv[] = { - 0.0f, 0.0f, - 1.0f, 0.0f, - 0.0f, 1.0f, - 1.0f, 1.0f, - }; - - glVertexAttribPointer(mPosAttribLoc, 2, GL_FLOAT, GL_FALSE, 0, pos); - glVertexAttribPointer(mUVAttribLoc, 2, GL_FLOAT, GL_FALSE, 0, uv); - glEnableVertexAttribArray(mPosAttribLoc); - glEnableVertexAttribArray(mUVAttribLoc); - - glUniformMatrix4fv(mObjToNdcUniformLoc, 1, GL_FALSE, screenToNdc); - glUniformMatrix4fv(mUVToTexUniformLoc, 1, GL_FALSE, texMatrix); - glUniform4fv(mModColorUniformLoc, 1, modColor); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_EXTERNAL_OES, texName); - glUniform1i(mBlitSrcSamplerLoc, 0); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glDisableVertexAttribArray(mPosAttribLoc); - glDisableVertexAttribArray(mUVAttribLoc); - - if (glGetError() != GL_NO_ERROR) { - fprintf(stderr, "GL error!\n"); - } - - return true; - } - -private: - GLuint mBlitPgm; - GLint mPosAttribLoc; - GLint mUVAttribLoc; - GLint mUVToTexUniformLoc; - GLint mObjToNdcUniformLoc; - GLint mBlitSrcSamplerLoc; - GLint mModColorUniformLoc; -}; - -class ComposerBase : public Composer { -public: - virtual ~ComposerBase() {} - - virtual bool setUp(const LayerDesc& desc, - GLHelper* helper) { - mLayerDesc = desc; - return setUp(helper); - } - - virtual void tearDown() { - } - - virtual bool compose(GLuint /*texName*/, const sp& /*glc*/) { - return true; - } - -protected: - virtual bool setUp(GLHelper* /*helper*/) { - return true; - } - - LayerDesc mLayerDesc; -}; - -Composer* nocomp() { - class NoComp : public ComposerBase { - }; - return new NoComp(); -} - -Composer* opaque() { - class OpaqueComp : public ComposerBase { - virtual bool setUp(GLHelper* helper) { - return mBlitter.setUp(helper); - } - - virtual bool compose(GLuint texName, const sp& glc) { - float texMatrix[16]; - glc->getTransformMatrix(texMatrix); - - int32_t x = mLayerDesc.x; - int32_t y = mLayerDesc.y; - int32_t w = mLayerDesc.width; - int32_t h = mLayerDesc.height; - - return mBlitter.blit(texName, texMatrix, x, y, w, h); - } - - Blitter mBlitter; - }; - return new OpaqueComp(); -} - -Composer* opaqueShrink() { - class OpaqueComp : public ComposerBase { - virtual bool setUp(GLHelper* helper) { - mParity = false; - return mBlitter.setUp(helper); - } - - virtual bool compose(GLuint texName, const sp& glc) { - float texMatrix[16]; - glc->getTransformMatrix(texMatrix); - - int32_t x = mLayerDesc.x; - int32_t y = mLayerDesc.y; - int32_t w = mLayerDesc.width; - int32_t h = mLayerDesc.height; - - mParity = !mParity; - if (mParity) { - x += w / 128; - y += h / 128; - w -= w / 64; - h -= h / 64; - } - - return mBlitter.blit(texName, texMatrix, x, y, w, h); - } - - Blitter mBlitter; - bool mParity; - }; - return new OpaqueComp(); -} - -Composer* blend() { - class BlendComp : public ComposerBase { - virtual bool setUp(GLHelper* helper) { - return mBlitter.setUp(helper); - } - - virtual bool compose(GLuint texName, const sp& glc) { - bool result; - - float texMatrix[16]; - glc->getTransformMatrix(texMatrix); - - float modColor[4] = { .75f, .75f, .75f, .75f }; - - int32_t x = mLayerDesc.x; - int32_t y = mLayerDesc.y; - int32_t w = mLayerDesc.width; - int32_t h = mLayerDesc.height; - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - result = mBlitter.modBlit(texName, texMatrix, modColor, - x, y, w, h); - if (!result) { - return false; - } - - glDisable(GL_BLEND); - - return true; - } - - Blitter mBlitter; - }; - return new BlendComp(); -} - -Composer* blendShrink() { - class BlendShrinkComp : public ComposerBase { - virtual bool setUp(GLHelper* helper) { - mParity = false; - return mBlitter.setUp(helper); - } - - virtual bool compose(GLuint texName, const sp& glc) { - bool result; - - float texMatrix[16]; - glc->getTransformMatrix(texMatrix); - - float modColor[4] = { .75f, .75f, .75f, .75f }; - - int32_t x = mLayerDesc.x; - int32_t y = mLayerDesc.y; - int32_t w = mLayerDesc.width; - int32_t h = mLayerDesc.height; - - mParity = !mParity; - if (mParity) { - x += w / 128; - y += h / 128; - w -= w / 64; - h -= h / 64; - } - - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - - result = mBlitter.modBlit(texName, texMatrix, modColor, - x, y, w, h); - if (!result) { - return false; - } - - glDisable(GL_BLEND); - - return true; - } - - Blitter mBlitter; - bool mParity; - }; - return new BlendShrinkComp(); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Flatland.h android-platform-frameworks-native-21/cmds/flatland/Flatland.h --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Flatland.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/Flatland.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2012 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 - -#include -#include - -#include - -namespace android { - -#define NELEMS(x) ((int) (sizeof(x) / sizeof((x)[0]))) - -enum { MAX_NUM_LAYERS = 16 }; -enum { MAX_TEST_RUNS = 16 }; - -class Composer; -class Renderer; -class GLHelper; - -struct LayerDesc { - uint32_t flags; - Renderer* (*rendererFactory)(); - Composer* (*composerFactory)(); - int32_t x; - int32_t y; - uint32_t width; - uint32_t height; -}; - -void resetColorGenerator(); - -class Composer { -public: - virtual ~Composer() {} - virtual bool setUp(const LayerDesc& desc, GLHelper* helper) = 0; - virtual void tearDown() = 0; - virtual bool compose(GLuint texName, const sp& glc) = 0; -}; - -Composer* nocomp(); -Composer* opaque(); -Composer* opaqueShrink(); -Composer* blend(); -Composer* blendShrink(); - -class Renderer { -public: - virtual ~Renderer() {} - virtual bool setUp(GLHelper* helper) = 0; - virtual void tearDown() = 0; - virtual bool render(EGLSurface surface) = 0; -}; - -Renderer* staticGradient(); - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/GLHelper.cpp android-platform-frameworks-native-21/cmds/flatland/GLHelper.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/GLHelper.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/GLHelper.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,464 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include - -#include -#include - -#include "GLHelper.h" - - namespace android { - -GLHelper::GLHelper() : - mGraphicBufferAlloc(new GraphicBufferAlloc()), - mDisplay(EGL_NO_DISPLAY), - mContext(EGL_NO_CONTEXT), - mDummySurface(EGL_NO_SURFACE), - mConfig(0), - mShaderPrograms(NULL), - mDitherTexture(0) { -} - -GLHelper::~GLHelper() { -} - -bool GLHelper::setUp(const ShaderDesc* shaderDescs, size_t numShaders) { - bool result; - - mDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (mDisplay == EGL_NO_DISPLAY) { - fprintf(stderr, "eglGetDisplay error: %#x\n", eglGetError()); - return false; - } - - EGLint majorVersion; - EGLint minorVersion; - result = eglInitialize(mDisplay, &majorVersion, &minorVersion); - if (result != EGL_TRUE) { - fprintf(stderr, "eglInitialize error: %#x\n", eglGetError()); - return false; - } - - EGLint numConfigs = 0; - EGLint configAttribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_NONE - }; - result = eglChooseConfig(mDisplay, configAttribs, &mConfig, 1, - &numConfigs); - if (result != EGL_TRUE) { - fprintf(stderr, "eglChooseConfig error: %#x\n", eglGetError()); - return false; - } - - EGLint contextAttribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE - }; - mContext = eglCreateContext(mDisplay, mConfig, EGL_NO_CONTEXT, - contextAttribs); - if (mContext == EGL_NO_CONTEXT) { - fprintf(stderr, "eglCreateContext error: %#x\n", eglGetError()); - return false; - } - - bool resultb = createNamedSurfaceTexture(0, 1, 1, &mDummyGLConsumer, - &mDummySurface); - if (!resultb) { - return false; - } - - resultb = makeCurrent(mDummySurface); - if (!resultb) { - return false; - } - - resultb = setUpShaders(shaderDescs, numShaders); - if (!resultb) { - return false; - } - - return true; -} - -void GLHelper::tearDown() { - if (mShaderPrograms != NULL) { - delete[] mShaderPrograms; - mShaderPrograms = NULL; - } - - if (mSurfaceComposerClient != NULL) { - mSurfaceComposerClient->dispose(); - mSurfaceComposerClient.clear(); - } - - if (mDisplay != EGL_NO_DISPLAY) { - eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); - } - - if (mContext != EGL_NO_CONTEXT) { - eglDestroyContext(mDisplay, mContext); - } - - if (mDummySurface != EGL_NO_SURFACE) { - eglDestroySurface(mDisplay, mDummySurface); - } - - mDisplay = EGL_NO_DISPLAY; - mContext = EGL_NO_CONTEXT; - mDummySurface = EGL_NO_SURFACE; - mDummyGLConsumer.clear(); - mConfig = 0; -} - -bool GLHelper::makeCurrent(EGLSurface surface) { - EGLint result; - - result = eglMakeCurrent(mDisplay, surface, surface, mContext); - if (result != EGL_TRUE) { - fprintf(stderr, "eglMakeCurrent error: %#x\n", eglGetError()); - return false; - } - - EGLint w, h; - eglQuerySurface(mDisplay, surface, EGL_WIDTH, &w); - eglQuerySurface(mDisplay, surface, EGL_HEIGHT, &h); - glViewport(0, 0, w, h); - - return true; -} - -bool GLHelper::createSurfaceTexture(uint32_t w, uint32_t h, - sp* glConsumer, EGLSurface* surface, - GLuint* name) { - if (!makeCurrent(mDummySurface)) { - return false; - } - - *name = 0; - glGenTextures(1, name); - if (*name == 0) { - fprintf(stderr, "glGenTextures error: %#x\n", glGetError()); - return false; - } - - return createNamedSurfaceTexture(*name, w, h, glConsumer, surface); -} - -void GLHelper::destroySurface(EGLSurface* surface) { - if (eglGetCurrentSurface(EGL_READ) == *surface || - eglGetCurrentSurface(EGL_DRAW) == *surface) { - eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); - } - eglDestroySurface(mDisplay, *surface); - *surface = EGL_NO_SURFACE; -} - -bool GLHelper::swapBuffers(EGLSurface surface) { - EGLint result; - result = eglSwapBuffers(mDisplay, surface); - if (result != EGL_TRUE) { - fprintf(stderr, "eglSwapBuffers error: %#x\n", eglGetError()); - return false; - } - return true; -} - -bool GLHelper::getShaderProgram(const char* name, GLuint* outPgm) { - for (size_t i = 0; i < mNumShaders; i++) { - if (strcmp(mShaderDescs[i].name, name) == 0) { - *outPgm = mShaderPrograms[i]; - return true; - } - } - - fprintf(stderr, "unknown shader name: \"%s\"\n", name); - - return false; -} - -bool GLHelper::createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h, - sp* glConsumer, EGLSurface* surface) { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer, mGraphicBufferAlloc); - sp glc = new GLConsumer(consumer, name, - GL_TEXTURE_EXTERNAL_OES, false, true); - glc->setDefaultBufferSize(w, h); - glc->setDefaultMaxBufferCount(3); - glc->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER); - - sp anw = new Surface(producer); - EGLSurface s = eglCreateWindowSurface(mDisplay, mConfig, anw.get(), NULL); - if (s == EGL_NO_SURFACE) { - fprintf(stderr, "eglCreateWindowSurface error: %#x\n", eglGetError()); - return false; - } - - *glConsumer = glc; - *surface = s; - return true; -} - -bool GLHelper::computeWindowScale(uint32_t w, uint32_t h, float* scale) { - sp dpy = mSurfaceComposerClient->getBuiltInDisplay(0); - if (dpy == NULL) { - fprintf(stderr, "SurfaceComposer::getBuiltInDisplay failed.\n"); - return false; - } - - DisplayInfo info; - status_t err = mSurfaceComposerClient->getDisplayInfo(dpy, &info); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::getDisplayInfo failed: %#x\n", err); - return false; - } - - float scaleX = float(info.w) / float(w); - float scaleY = float(info.h) / float(h); - *scale = scaleX < scaleY ? scaleX : scaleY; - - return true; -} - -bool GLHelper::createWindowSurface(uint32_t w, uint32_t h, - sp* surfaceControl, EGLSurface* surface) { - bool result; - status_t err; - - if (mSurfaceComposerClient == NULL) { - mSurfaceComposerClient = new SurfaceComposerClient; - } - err = mSurfaceComposerClient->initCheck(); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposerClient::initCheck error: %#x\n", err); - return false; - } - - sp sc = mSurfaceComposerClient->createSurface( - String8("Benchmark"), w, h, PIXEL_FORMAT_RGBA_8888, 0); - if (sc == NULL || !sc->isValid()) { - fprintf(stderr, "Failed to create SurfaceControl.\n"); - return false; - } - - float scale; - result = computeWindowScale(w, h, &scale); - if (!result) { - return false; - } - - SurfaceComposerClient::openGlobalTransaction(); - err = sc->setLayer(0x7FFFFFFF); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::setLayer error: %#x\n", err); - return false; - } - err = sc->setMatrix(scale, 0.0f, 0.0f, scale); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::setMatrix error: %#x\n", err); - return false; - } - - err = sc->show(); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::show error: %#x\n", err); - return false; - } - SurfaceComposerClient::closeGlobalTransaction(); - - sp anw = sc->getSurface(); - EGLSurface s = eglCreateWindowSurface(mDisplay, mConfig, anw.get(), NULL); - if (s == EGL_NO_SURFACE) { - fprintf(stderr, "eglCreateWindowSurface error: %#x\n", eglGetError()); - return false; - } - - *surfaceControl = sc; - *surface = s; - return true; -} - -static bool compileShader(GLenum shaderType, const char* src, - GLuint* outShader) { - GLuint shader = glCreateShader(shaderType); - if (shader == 0) { - fprintf(stderr, "glCreateShader error: %#x\n", glGetError()); - return false; - } - - glShaderSource(shader, 1, &src, NULL); - glCompileShader(shader); - - GLint compiled = 0; - glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); - if (!compiled) { - GLint infoLen = 0; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); - if (infoLen) { - char* buf = new char[infoLen]; - if (buf) { - glGetShaderInfoLog(shader, infoLen, NULL, buf); - fprintf(stderr, "Shader compile log:\n%s\n", buf); - delete[] buf; - } - } - glDeleteShader(shader); - return false; - } - *outShader = shader; - return true; -} - -static void printShaderSource(const char* const* src) { - for (size_t i = 0; i < MAX_SHADER_LINES && src[i] != NULL; i++) { - fprintf(stderr, "%3zu: %s\n", i+1, src[i]); - } -} - -static const char* makeShaderString(const char* const* src) { - size_t len = 0; - for (size_t i = 0; i < MAX_SHADER_LINES && src[i] != NULL; i++) { - // The +1 is for the '\n' that will be added. - len += strlen(src[i]) + 1; - } - - char* result = new char[len+1]; - char* end = result; - for (size_t i = 0; i < MAX_SHADER_LINES && src[i] != NULL; i++) { - strcpy(end, src[i]); - end += strlen(src[i]); - *end = '\n'; - end++; - } - *end = '\0'; - - return result; -} - -static bool compileShaderLines(GLenum shaderType, const char* const* lines, - GLuint* outShader) { - const char* src = makeShaderString(lines); - bool result = compileShader(shaderType, src, outShader); - if (!result) { - fprintf(stderr, "Shader source:\n"); - printShaderSource(lines); - return false; - } - delete[] src; - - return true; -} - -static bool linkShaderProgram(GLuint vs, GLuint fs, GLuint* outPgm) { - GLuint program = glCreateProgram(); - if (program == 0) { - fprintf(stderr, "glCreateProgram error: %#x\n", glGetError()); - return false; - } - - glAttachShader(program, vs); - glAttachShader(program, fs); - glLinkProgram(program); - GLint linkStatus = GL_FALSE; - glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); - if (linkStatus != GL_TRUE) { - GLint bufLength = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); - if (bufLength) { - char* buf = new char[bufLength]; - if (buf) { - glGetProgramInfoLog(program, bufLength, NULL, buf); - fprintf(stderr, "Program link log:\n%s\n", buf); - delete[] buf; - } - } - glDeleteProgram(program); - program = 0; - } - - *outPgm = program; - return program != 0; -} - -bool GLHelper::setUpShaders(const ShaderDesc* shaderDescs, size_t numShaders) { - mShaderPrograms = new GLuint[numShaders]; - bool result = true; - - for (size_t i = 0; i < numShaders && result; i++) { - GLuint vs, fs; - - result = compileShaderLines(GL_VERTEX_SHADER, - shaderDescs[i].vertexShader, &vs); - if (!result) { - return false; - } - - result = compileShaderLines(GL_FRAGMENT_SHADER, - shaderDescs[i].fragmentShader, &fs); - if (!result) { - glDeleteShader(vs); - return false; - } - - result = linkShaderProgram(vs, fs, &mShaderPrograms[i]); - glDeleteShader(vs); - glDeleteShader(fs); - } - - mNumShaders = numShaders; - mShaderDescs = shaderDescs; - - return result; -} - -bool GLHelper::getDitherTexture(GLuint* outTexName) { - if (mDitherTexture == 0) { - const uint8_t pattern[] = { - 0, 8, 2, 10, - 12, 4, 14, 6, - 3, 11, 1, 9, - 15, 7, 13, 5 - }; - - glGenTextures(1, &mDitherTexture); - glBindTexture(GL_TEXTURE_2D, mDitherTexture); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - - glTexImage2D(GL_TEXTURE_2D, 0, GL_ALPHA, DITHER_KERNEL_SIZE, - DITHER_KERNEL_SIZE, 0, GL_ALPHA, GL_UNSIGNED_BYTE, &pattern); - } - - *outTexName = mDitherTexture; - - return true; -} - -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/GLHelper.h android-platform-frameworks-native-21/cmds/flatland/GLHelper.h --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/GLHelper.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/GLHelper.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,95 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include -#include -#include - -#include -#include - -namespace android { - -class SurfaceComposerClient; -class SurfaceControl; - -enum { MAX_SHADER_LINES = 128 }; - -struct ShaderDesc { - const char* name; - const char* vertexShader[MAX_SHADER_LINES]; - const char* fragmentShader[MAX_SHADER_LINES]; -}; - -class GLHelper { - -public: - - enum { DITHER_KERNEL_SIZE = 4 }; - - GLHelper(); - - ~GLHelper(); - - bool setUp(const ShaderDesc* shaderDescs, size_t numShaders); - - void tearDown(); - - bool makeCurrent(EGLSurface surface); - - bool createSurfaceTexture(uint32_t w, uint32_t h, - sp* surfaceTexture, EGLSurface* surface, - GLuint* name); - - bool createWindowSurface(uint32_t w, uint32_t h, - sp* surfaceControl, EGLSurface* surface); - - void destroySurface(EGLSurface* surface); - - bool swapBuffers(EGLSurface surface); - - bool getShaderProgram(const char* name, GLuint* outPgm); - - bool getDitherTexture(GLuint* outTexName); - -private: - - bool createNamedSurfaceTexture(GLuint name, uint32_t w, uint32_t h, - sp* surfaceTexture, EGLSurface* surface); - - bool computeWindowScale(uint32_t w, uint32_t h, float* scale); - - bool setUpShaders(const ShaderDesc* shaderDescs, size_t numShaders); - - sp mGraphicBufferAlloc; - - EGLDisplay mDisplay; - EGLContext mContext; - EGLSurface mDummySurface; - sp mDummyGLConsumer; - EGLConfig mConfig; - - sp mSurfaceComposerClient; - - GLuint* mShaderPrograms; - const ShaderDesc* mShaderDescs; - size_t mNumShaders; - - GLuint mDitherTexture; -}; - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Main.cpp android-platform-frameworks-native-21/cmds/flatland/Main.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Main.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/Main.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,791 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define ATRACE_TAG ATRACE_TAG_ALWAYS - -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -#include "Flatland.h" -#include "GLHelper.h" - -using namespace ::android; - -static uint32_t g_SleepBetweenSamplesMs = 0; -static bool g_PresentToWindow = false; -static size_t g_BenchmarkNameLen = 0; - -struct BenchmarkDesc { - // The name of the test. - const char* name; - - // The dimensions of the space in which window layers are specified. - uint32_t width; - uint32_t height; - - // The screen heights at which to run the test. - uint32_t runHeights[MAX_TEST_RUNS]; - - // The list of window layers. - LayerDesc layers[MAX_NUM_LAYERS]; -}; - -static const BenchmarkDesc benchmarks[] = { - { "16:10 Single Static Window", - 2560, 1600, { 800, 1200, 1600, 2400 }, - { - { // Window - 0, staticGradient, opaque, - 0, 50, 2560, 1454, - }, - { // Status bar - 0, staticGradient, opaque, - 0, 0, 2560, 50, - }, - { // Navigation bar - 0, staticGradient, opaque, - 0, 1504, 2560, 96, - }, - }, - }, - - { "4:3 Single Static Window", - 2048, 1536, { 1536 }, - { - { // Window - 0, staticGradient, opaque, - 0, 50, 2048, 1440, - }, - { // Status bar - 0, staticGradient, opaque, - 0, 0, 2048, 50, - }, - { // Navigation bar - 0, staticGradient, opaque, - 0, 1440, 2048, 96, - }, - }, - }, - - { "16:10 App -> Home Transition", - 2560, 1600, { 800, 1200, 1600, 2400 }, - { - { // Wallpaper - 0, staticGradient, opaque, - 0, 50, 2560, 1454, - }, - { // Launcher - 0, staticGradient, blend, - 0, 50, 2560, 1454, - }, - { // Outgoing activity - 0, staticGradient, blendShrink, - 20, 70, 2520, 1414, - }, - { // Status bar - 0, staticGradient, opaque, - 0, 0, 2560, 50, - }, - { // Navigation bar - 0, staticGradient, opaque, - 0, 1504, 2560, 96, - }, - }, - }, - - { "4:3 App -> Home Transition", - 2048, 1536, { 1536 }, - { - { // Wallpaper - 0, staticGradient, opaque, - 0, 50, 2048, 1440, - }, - { // Launcher - 0, staticGradient, blend, - 0, 50, 2048, 1440, - }, - { // Outgoing activity - 0, staticGradient, blendShrink, - 20, 70, 2048, 1400, - }, - { // Status bar - 0, staticGradient, opaque, - 0, 0, 2048, 50, - }, - { // Navigation bar - 0, staticGradient, opaque, - 0, 1440, 2048, 96, - }, - }, - }, - - { "16:10 SurfaceView -> Home Transition", - 2560, 1600, { 800, 1200, 1600, 2400 }, - { - { // Wallpaper - 0, staticGradient, opaque, - 0, 50, 2560, 1454, - }, - { // Launcher - 0, staticGradient, blend, - 0, 50, 2560, 1454, - }, - { // Outgoing SurfaceView - 0, staticGradient, blendShrink, - 20, 70, 2520, 1414, - }, - { // Outgoing activity - 0, staticGradient, blendShrink, - 20, 70, 2520, 1414, - }, - { // Status bar - 0, staticGradient, opaque, - 0, 0, 2560, 50, - }, - { // Navigation bar - 0, staticGradient, opaque, - 0, 1504, 2560, 96, - }, - }, - }, - - { "4:3 SurfaceView -> Home Transition", - 2048, 1536, { 1536 }, - { - { // Wallpaper - 0, staticGradient, opaque, - 0, 50, 2048, 1440, - }, - { // Launcher - 0, staticGradient, blend, - 0, 50, 2048, 1440, - }, - { // Outgoing SurfaceView - 0, staticGradient, blendShrink, - 20, 70, 2048, 1400, - }, - { // Outgoing activity - 0, staticGradient, blendShrink, - 20, 70, 2048, 1400, - }, - { // Status bar - 0, staticGradient, opaque, - 0, 0, 2048, 50, - }, - { // Navigation bar - 0, staticGradient, opaque, - 0, 1440, 2048, 96, - }, - }, - }, -}; - -static const ShaderDesc shaders[] = { - { - name: "Blit", - vertexShader: { - "precision mediump float;", - "", - "attribute vec4 position;", - "attribute vec4 uv;", - "", - "varying vec4 texCoords;", - "", - "uniform mat4 objToNdc;", - "uniform mat4 uvToTex;", - "", - "void main() {", - " gl_Position = objToNdc * position;", - " texCoords = uvToTex * uv;", - "}", - }, - fragmentShader: { - "#extension GL_OES_EGL_image_external : require", - "precision mediump float;", - "", - "varying vec4 texCoords;", - "", - "uniform samplerExternalOES blitSrc;", - "uniform vec4 modColor;", - "", - "void main() {", - " gl_FragColor = texture2D(blitSrc, texCoords.xy);", - " gl_FragColor *= modColor;", - "}", - }, - }, - - { - name: "Gradient", - vertexShader: { - "precision mediump float;", - "", - "attribute vec4 position;", - "attribute vec4 uv;", - "", - "varying float interp;", - "", - "uniform mat4 objToNdc;", - "uniform mat4 uvToInterp;", - "", - "void main() {", - " gl_Position = objToNdc * position;", - " interp = (uvToInterp * uv).x;", - "}", - }, - fragmentShader: { - "precision mediump float;", - "", - "varying float interp;", - "", - "uniform vec4 color0;", - "uniform vec4 color1;", - "", - "uniform sampler2D ditherKernel;", - "uniform float invDitherKernelSize;", - "uniform float invDitherKernelSizeSq;", - "", - "void main() {", - " float dither = texture2D(ditherKernel,", - " gl_FragCoord.xy * invDitherKernelSize).a;", - " dither *= invDitherKernelSizeSq;", - " vec4 color = mix(color0, color1, clamp(interp, 0.0, 1.0));", - " gl_FragColor = color + vec4(dither, dither, dither, 0.0);", - "}", - }, - }, -}; - -class Layer { - -public: - - Layer() : - mFirstFrame(true), - mGLHelper(NULL), - mSurface(EGL_NO_SURFACE) { - } - - bool setUp(const LayerDesc& desc, GLHelper* helper) { - bool result; - - mDesc = desc; - mGLHelper = helper; - - result = mGLHelper->createSurfaceTexture(mDesc.width, mDesc.height, - &mGLConsumer, &mSurface, &mTexName); - if (!result) { - return false; - } - - mRenderer = desc.rendererFactory(); - result = mRenderer->setUp(helper); - if (!result) { - return false; - } - - mComposer = desc.composerFactory(); - result = mComposer->setUp(desc, helper); - if (!result) { - return false; - } - - return true; - } - - void tearDown() { - if (mComposer != NULL) { - mComposer->tearDown(); - delete mComposer; - mComposer = NULL; - } - - if (mRenderer != NULL) { - mRenderer->tearDown(); - delete mRenderer; - mRenderer = NULL; - } - - if (mSurface != EGL_NO_SURFACE) { - mGLHelper->destroySurface(&mSurface); - mGLConsumer->abandon(); - } - mGLHelper = NULL; - mGLConsumer.clear(); - } - - bool render() { - return mRenderer->render(mSurface); - } - - bool prepareComposition() { - status_t err; - - err = mGLConsumer->updateTexImage(); - if (err < 0) { - fprintf(stderr, "GLConsumer::updateTexImage error: %d\n", err); - return false; - } - - return true; - } - - bool compose() { - return mComposer->compose(mTexName, mGLConsumer); - } - -private: - bool mFirstFrame; - - LayerDesc mDesc; - - GLHelper* mGLHelper; - - GLuint mTexName; - sp mGLConsumer; - EGLSurface mSurface; - - Renderer* mRenderer; - Composer* mComposer; -}; - -class BenchmarkRunner { - -public: - - BenchmarkRunner(const BenchmarkDesc& desc, size_t instance) : - mDesc(desc), - mInstance(instance), - mNumLayers(countLayers(desc)), - mGLHelper(NULL), - mSurface(EGL_NO_SURFACE), - mWindowSurface(EGL_NO_SURFACE) { - } - - bool setUp() { - ATRACE_CALL(); - - bool result; - EGLint resulte; - - float scaleFactor = float(mDesc.runHeights[mInstance]) / - float(mDesc.height); - uint32_t w = uint32_t(scaleFactor * float(mDesc.width)); - uint32_t h = mDesc.runHeights[mInstance]; - - mGLHelper = new GLHelper(); - result = mGLHelper->setUp(shaders, NELEMS(shaders)); - if (!result) { - return false; - } - - GLuint texName; - result = mGLHelper->createSurfaceTexture(w, h, &mGLConsumer, &mSurface, - &texName); - if (!result) { - return false; - } - - for (size_t i = 0; i < mNumLayers; i++) { - // Scale the layer to match the current screen size. - LayerDesc ld = mDesc.layers[i]; - ld.x = int32_t(scaleFactor * float(ld.x)); - ld.y = int32_t(scaleFactor * float(ld.y)); - ld.width = uint32_t(scaleFactor * float(ld.width)); - ld.height = uint32_t(scaleFactor * float(ld.height)); - - // Set up the layer. - result = mLayers[i].setUp(ld, mGLHelper); - if (!result) { - return false; - } - } - - if (g_PresentToWindow) { - result = mGLHelper->createWindowSurface(w, h, &mSurfaceControl, - &mWindowSurface); - if (!result) { - return false; - } - - result = doFrame(mWindowSurface); - if (!result) { - return false; - } - } - - return true; - } - - void tearDown() { - ATRACE_CALL(); - - for (size_t i = 0; i < mNumLayers; i++) { - mLayers[i].tearDown(); - } - - if (mGLHelper != NULL) { - if (mWindowSurface != EGL_NO_SURFACE) { - mGLHelper->destroySurface(&mWindowSurface); - } - mGLHelper->destroySurface(&mSurface); - mGLConsumer->abandon(); - mGLConsumer.clear(); - mSurfaceControl.clear(); - mGLHelper->tearDown(); - delete mGLHelper; - mGLHelper = NULL; - } - } - - nsecs_t run(uint32_t warmUpFrames, uint32_t totalFrames) { - ATRACE_CALL(); - - bool result; - status_t err; - - resetColorGenerator(); - - // Do the warm-up frames. - for (uint32_t i = 0; i < warmUpFrames; i++) { - result = doFrame(mSurface); - if (!result) { - return -1; - } - } - - // Grab the fence for the start timestamp. - sp startFence = mGLConsumer->getCurrentFence(); - - // the timed frames. - for (uint32_t i = warmUpFrames; i < totalFrames; i++) { - result = doFrame(mSurface); - if (!result) { - return -1; - } - } - - // Grab the fence for the end timestamp. - sp endFence = mGLConsumer->getCurrentFence(); - - // Keep doing frames until the end fence has signaled. - while (endFence->wait(0) == -ETIME) { - result = doFrame(mSurface); - if (!result) { - return -1; - } - } - - // Compute the time delta. - nsecs_t startTime = startFence->getSignalTime(); - nsecs_t endTime = endFence->getSignalTime(); - - return endTime - startTime; - } - -private: - - bool doFrame(EGLSurface surface) { - bool result; - status_t err; - - for (size_t i = 0; i < mNumLayers; i++) { - result = mLayers[i].render(); - if (!result) { - return false; - } - } - - for (size_t i = 0; i < mNumLayers; i++) { - result = mLayers[i].prepareComposition(); - if (!result) { - return false; - } - } - - result = mGLHelper->makeCurrent(surface); - if (!result) { - return false; - } - - glClearColor(1.0f, 0.0f, 0.0f, 0.0f); - glClear(GL_COLOR_BUFFER_BIT); - - for (size_t i = 0; i < mNumLayers; i++) { - result = mLayers[i].compose(); - if (!result) { - return false; - } - } - - result = mGLHelper->swapBuffers(surface); - if (!result) { - return false; - } - - err = mGLConsumer->updateTexImage(); - if (err < 0) { - fprintf(stderr, "GLConsumer::updateTexImage error: %d\n", err); - return false; - } - - return true; - } - - static size_t countLayers(const BenchmarkDesc& desc) { - size_t i; - for (i = 0; i < MAX_NUM_LAYERS; i++) { - if (desc.layers[i].rendererFactory == NULL) { - break; - } - } - return i; - } - - const BenchmarkDesc& mDesc; - const size_t mInstance; - const size_t mNumLayers; - - GLHelper* mGLHelper; - - // The surface into which layers are composited - sp mGLConsumer; - EGLSurface mSurface; - - // Used for displaying the surface to a window. - EGLSurface mWindowSurface; - sp mSurfaceControl; - - Layer mLayers[MAX_NUM_LAYERS]; -}; - -static int cmpDouble(const double* lhs, const double* rhs) { - if (*lhs < *rhs) { - return -1; - } else if (*rhs < *lhs) { - return 1; - } - return 0; -} - -// Run a single benchmark and print the result. -static bool runTest(const BenchmarkDesc b, size_t run) { - bool success = true; - double prevResult = 0.0, result = 0.0; - Vector samples; - - uint32_t runHeight = b.runHeights[run]; - uint32_t runWidth = b.width * runHeight / b.height; - printf(" %-*s | %4d x %4d | ", static_cast(g_BenchmarkNameLen), b.name, - runWidth, runHeight); - fflush(stdout); - - BenchmarkRunner r(b, run); - if (!r.setUp()) { - fprintf(stderr, "error initializing runner.\n"); - return false; - } - - // The slowest 1/outlierFraction sample results are ignored as potential - // outliers. - const uint32_t outlierFraction = 16; - const double threshold = .0025; - - uint32_t warmUpFrames = 1; - uint32_t totalFrames = 5; - - // Find the number of frames needed to run for over 100ms. - double runTime = 0.0; - while (true) { - runTime = double(r.run(warmUpFrames, totalFrames)); - if (runTime < 50e6) { - warmUpFrames *= 2; - totalFrames *= 2; - } else { - break; - } - } - - - if (totalFrames - warmUpFrames > 16) { - // The test runs too fast to get a stable result. Skip it. - printf(" fast"); - goto done; - } else if (totalFrames == 5 && runTime > 200e6) { - // The test runs too slow to be very useful. Skip it. - printf(" slow"); - goto done; - } - - do { - size_t newSamples = samples.size(); - if (newSamples == 0) { - newSamples = 4*outlierFraction; - } - - if (newSamples > 512) { - printf("varies"); - goto done; - } - - for (size_t i = 0; i < newSamples; i++) { - double sample = double(r.run(warmUpFrames, totalFrames)); - - if (g_SleepBetweenSamplesMs > 0) { - usleep(g_SleepBetweenSamplesMs * 1000); - } - - if (sample < 0.0) { - success = false; - goto done; - } - - samples.add(sample); - } - - samples.sort(cmpDouble); - - prevResult = result; - size_t elem = (samples.size() * (outlierFraction-1) / outlierFraction); - result = (samples[elem-1] + samples[elem]) * 0.5; - } while (fabs(result - prevResult) > threshold * result); - - printf("%6.3f", result / double(totalFrames - warmUpFrames) / 1e6); - -done: - - printf("\n"); - fflush(stdout); - r.tearDown(); - - return success; -} - -static void printResultsTableHeader() { - const char* scenario = "Scenario"; - size_t len = strlen(scenario); - size_t leftPad = (g_BenchmarkNameLen - len) / 2; - size_t rightPad = g_BenchmarkNameLen - len - leftPad; - printf(" %*s%s%*s | Resolution | Time (ms)\n", - static_cast(leftPad), "", - "Scenario", static_cast(rightPad), ""); -} - -// Run ALL the benchmarks! -static bool runTests() { - printResultsTableHeader(); - - for (size_t i = 0; i < NELEMS(benchmarks); i++) { - const BenchmarkDesc& b = benchmarks[i]; - for (size_t j = 0; j < MAX_TEST_RUNS && b.runHeights[j]; j++) { - if (!runTest(b, j)) { - return false; - } - } - } - return true; -} - -// Return the length longest benchmark name. -static size_t maxBenchmarkNameLen() { - size_t maxLen = 0; - for (size_t i = 0; i < NELEMS(benchmarks); i++) { - const BenchmarkDesc& b = benchmarks[i]; - size_t len = strlen(b.name); - if (len > maxLen) { - maxLen = len; - } - } - return maxLen; -} - -// Print the command usage help to stderr. -static void showHelp(const char *cmd) { - fprintf(stderr, "usage: %s [options]\n", cmd); - fprintf(stderr, "options include:\n" - " -s N sleep for N ms between samples\n" - " -d display the test frame to a window\n" - " --help print this helpful message and exit\n" - ); -} - -int main(int argc, char** argv) { - if (argc == 2 && 0 == strcmp(argv[1], "--help")) { - showHelp(argv[0]); - exit(0); - } - - for (;;) { - int ret; - int option_index = 0; - static struct option long_options[] = { - {"help", no_argument, 0, 0 }, - { 0, 0, 0, 0 } - }; - - ret = getopt_long(argc, argv, "ds:", - long_options, &option_index); - - if (ret < 0) { - break; - } - - switch(ret) { - case 'd': - g_PresentToWindow = true; - break; - - case 's': - g_SleepBetweenSamplesMs = atoi(optarg); - break; - - case 0: - if (strcmp(long_options[option_index].name, "help")) { - showHelp(argv[0]); - exit(0); - } - break; - - default: - showHelp(argv[0]); - exit(2); - } - } - - g_BenchmarkNameLen = maxBenchmarkNameLen(); - - printf(" cmdline:"); - for (int i = 0; i < argc; i++) { - printf(" %s", argv[i]); - } - printf("\n"); - - if (!runTests()) { - fprintf(stderr, "exiting due to error.\n"); - return 1; - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/README.txt android-platform-frameworks-native-21/cmds/flatland/README.txt --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/README.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/README.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -Flatland is a benchmark for measuring GPU performance in various 2D UI -rendering and window compositing scenarios. It is designed to be used early -in the device development process to evaluate GPU hardware (e.g. for SoC -selection). It uses OpenGL ES 2.0, gralloc, and the Android explicit -synchronization framework, so it can only be run on devices with drivers -supporting those HALs. - - -Preparing a Device - -Because it's measuring hardware performance, flatland should be run in as -consistent and static an environment as possible. The display should be -turned off and background services should be stopped before running the -benchmark. Running 'adb shell stop' after turning off the display is probably -sufficient for this, but if there are device- specific background services -that consume much CPU cycles, memory bandwidth, or might otherwise interfere -with GPU rendering, those should be stopped as well (and ideally they'd be -fixed or eliminated for production devices). - -Additionally, all relevant hardware clocks should be locked at a particular -frequency when running flatland. At a minimum this includes the CPU, GPU, and -memory bus clocks. Running flatland with dynamic clocking essentially -measures the behavior of the dynamic clocking algorithm under a fairly -unrealistic workload, and will likely result in unstable and useless results. - -If running the benchmark with the clocks locked causes thermal issues, the -s -command line option can be used to insert a sleep (specified in milliseconds) -in between each benchmark sample run. Regardless of the scenario being -measured, each sample measurement runs for between 50 and 200 ms, so a sleep -time between 10 and 50 ms should address most thermal problems. - - -Interpreting the Output - -The output of flatland should look something like this: - - cmdline: flatland - Scenario | Resolution | Time (ms) - 16:10 Single Static Window | 1280 x 800 | fast - 16:10 Single Static Window | 2560 x 1600 | 5.368 - 16:10 Single Static Window | 3840 x 2400 | 11.979 - 16:10 App -> Home Transition | 1280 x 800 | 4.069 - 16:10 App -> Home Transition | 2560 x 1600 | 15.911 - 16:10 App -> Home Transition | 3840 x 2400 | 38.795 - 16:10 SurfaceView -> Home Transition | 1280 x 800 | 5.387 - 16:10 SurfaceView -> Home Transition | 2560 x 1600 | 21.147 - 16:10 SurfaceView -> Home Transition | 3840 x 2400 | slow - -The first column is simply a description of the scenario that's being -simulated. The second column indicates the resolution at which the scenario -was measured. The third column is the measured benchmark result. It -indicates the expected time in milliseconds that a single frame of the -scenario takes to complete. - -The third column may also contain one of three other values: - - fast - This indicates that frames of the scenario completed too fast to be - reliably benchmarked. This corresponds to a frame time less than 3 ms. - Rather than spending time trying (and likely failing) to get a stable - result, the scenario was skipped. - - slow - This indicates that frames of the scenario took too long to - complete. This corresponds to a frame time over 50 ms. Rather than - simulating a scenario that is obviously impractical on this device, the - scenario was skipped. - - varies - This indicates that the scenario was measured, but it did not - yield a stable result. Occasionally this happens with an otherwise stable - scenario. In this case, simply rerunning flatland should yield a valid - result. If a scenario repeatedly results in a 'varies' output, that - probably indicates that something is wrong with the environment in which - flatland is being run. Check that the hardware clock frequencies are - locked and that no heavy-weight services / daemons are running in the - background. diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Renderers.cpp android-platform-frameworks-native-21/cmds/flatland/Renderers.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/flatland/Renderers.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/flatland/Renderers.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,197 +0,0 @@ -/* - * Copyright (C) 2012 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 "Flatland.h" -#include "GLHelper.h" - -namespace android { - -static float colors[][4] = { - { .85f, .14f, .44f, 1.0f }, - { .91f, .72f, .10f, 1.0f }, - { .04f, .66f, .42f, 1.0f }, - { .84f, .39f, .68f, 1.0f }, - { .38f, .53f, .78f, 1.0f }, -}; - -static size_t g_colorIndex; - -const float* genColor() { - float* color = colors[g_colorIndex]; - g_colorIndex = (g_colorIndex + 1) % NELEMS(colors); - return color; -} - -void resetColorGenerator() { - g_colorIndex = 0; -} - -class GradientRenderer { - -public: - - bool setUp(GLHelper* helper) { - bool result; - - result = helper->getShaderProgram("Gradient", &mGradPgm); - if (!result) { - return false; - } - - result = helper->getDitherTexture(&mDitherTexName); - if (!result) { - return false; - } - - mPosAttribLoc = glGetAttribLocation(mGradPgm, "position"); - mUVAttribLoc = glGetAttribLocation(mGradPgm, "uv"); - mUVToInterpUniformLoc = glGetUniformLocation(mGradPgm, "uvToInterp"); - mObjToNdcUniformLoc = glGetUniformLocation(mGradPgm, "objToNdc"); - mDitherKernelSamplerLoc = glGetUniformLocation(mGradPgm, "ditherKernel"); - mInvDitherKernelSizeUniformLoc = glGetUniformLocation(mGradPgm, - "invDitherKernelSize"); - mInvDitherKernelSizeSqUniformLoc = glGetUniformLocation(mGradPgm, - "invDitherKernelSizeSq"); - mColor0UniformLoc = glGetUniformLocation(mGradPgm, "color0"); - mColor1UniformLoc = glGetUniformLocation(mGradPgm, "color1"); - - return true; - } - - void tearDown() { - } - - bool drawGradient() { - float identity[16] = { - 1.0f, 0.0f, 0.0f, 0.0f, - 0.0f, 1.0f, 0.0f, 0.0f, - 0.0f, 0.0f, 1.0f, 0.0f, - 0.0f, 0.0f, 0.0f, 1.0f, - }; - const float pos[] = { - -1.0f, -1.0f, - 1.0f, -1.0f, - -1.0f, 1.0f, - 1.0f, 1.0f, - }; - const float uv[] = { - 0.0f, 0.0f, - 1.0f, 0.0f, - 0.0f, 1.0f, - 1.0f, 1.0f, - }; - const float* color0 = genColor(); - const float* color1 = genColor(); - - glUseProgram(mGradPgm); - - glVertexAttribPointer(mPosAttribLoc, 2, GL_FLOAT, GL_FALSE, 0, pos); - glVertexAttribPointer(mUVAttribLoc, 2, GL_FLOAT, GL_FALSE, 0, uv); - glEnableVertexAttribArray(mPosAttribLoc); - glEnableVertexAttribArray(mUVAttribLoc); - - float invDitherKernelSize = 1.0f / float(GLHelper::DITHER_KERNEL_SIZE); - float invDitherKernelSizeSq = invDitherKernelSize * invDitherKernelSize; - - glUniformMatrix4fv(mObjToNdcUniformLoc, 1, GL_FALSE, identity); - glUniformMatrix4fv(mUVToInterpUniformLoc, 1, GL_FALSE, identity); - glUniform1f(mInvDitherKernelSizeUniformLoc, invDitherKernelSize); - glUniform1f(mInvDitherKernelSizeSqUniformLoc, invDitherKernelSizeSq); - glUniform4fv(mColor0UniformLoc, 1, color0); - glUniform4fv(mColor1UniformLoc, 1, color1); - - if (glGetError() != GL_NO_ERROR) { - fprintf(stderr, "GL error! 0\n"); - } - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_2D, mDitherTexName); - - if (glGetError() != GL_NO_ERROR) { - fprintf(stderr, "GL error! 1\n"); - } - - glUniform1i(mDitherKernelSamplerLoc, 0); - - glDrawArrays(GL_TRIANGLE_STRIP, 0, 4); - - glDisableVertexAttribArray(mPosAttribLoc); - glDisableVertexAttribArray(mUVAttribLoc); - - if (glGetError() != GL_NO_ERROR) { - fprintf(stderr, "GL error! 2\n"); - } - - return true; - } - - GLuint mGradPgm; - GLuint mDitherTexName; - GLuint mPosAttribLoc; - GLuint mUVAttribLoc; - GLuint mObjToNdcUniformLoc; - GLuint mUVToInterpUniformLoc; - GLuint mDitherKernelSamplerLoc; - GLuint mInvDitherKernelSizeUniformLoc; - GLuint mInvDitherKernelSizeSqUniformLoc; - GLuint mColor0UniformLoc; - GLuint mColor1UniformLoc; -}; - -Renderer* staticGradient() { - class NoRenderer : public Renderer { - virtual bool setUp(GLHelper* helper) { - mIsFirstFrame = true; - mGLHelper = helper; - return mGradientRenderer.setUp(helper); - } - - virtual void tearDown() { - mGradientRenderer.tearDown(); - } - - virtual bool render(EGLSurface surface) { - if (mIsFirstFrame) { - bool result; - mIsFirstFrame = false; - - result = mGLHelper->makeCurrent(surface); - if (!result) { - return false; - } - - result = mGradientRenderer.drawGradient(); - if (!result) { - return false; - } - - result = mGLHelper->swapBuffers(surface); - if (!result) { - return false; - } - } - return true; - } - - bool mIsFirstFrame; - GLHelper* mGLHelper; - GradientRenderer mGradientRenderer; - }; - return new NoRenderer; -} - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/Android.mk android-platform-frameworks-native-21/cmds/installd/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -LOCAL_PATH := $(call my-dir) - -common_src_files := commands.cpp utils.cpp -common_cflags := -Wall -Werror - -# -# Static library used in testing and executable -# - -include $(CLEAR_VARS) -LOCAL_MODULE := libinstalld -LOCAL_MODULE_TAGS := eng tests -LOCAL_SRC_FILES := $(common_src_files) -LOCAL_CFLAGS := $(common_cflags) -LOCAL_SHARED_LIBRARIES := \ - libbase \ - liblogwrap \ - -LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk -LOCAL_CLANG := true -include $(BUILD_STATIC_LIBRARY) - -# -# Executable -# - -include $(CLEAR_VARS) -LOCAL_MODULE := installd -LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := $(common_cflags) -LOCAL_SRC_FILES := installd.cpp $(common_src_files) -LOCAL_SHARED_LIBRARIES := \ - libbase \ - libcutils \ - liblog \ - liblogwrap \ - libselinux \ - -LOCAL_STATIC_LIBRARIES := libdiskusage -LOCAL_ADDITIONAL_DEPENDENCIES += $(LOCAL_PATH)/Android.mk -LOCAL_CLANG := true -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/commands.cpp android-platform-frameworks-native-21/cmds/installd/commands.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/commands.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/commands.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1884 +0,0 @@ -/* -** Copyright 2008, 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 "installd.h" - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -using android::base::StringPrintf; - -/* Directory records that are used in execution of commands. */ -dir_rec_t android_data_dir; -dir_rec_t android_asec_dir; -dir_rec_t android_app_dir; -dir_rec_t android_app_private_dir; -dir_rec_t android_app_lib_dir; -dir_rec_t android_media_dir; -dir_rec_t android_mnt_expand_dir; -dir_rec_array_t android_system_dirs; - -static const char* kCpPath = "/system/bin/cp"; - -int install(const char *uuid, const char *pkgname, uid_t uid, gid_t gid, const char *seinfo) -{ - if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) { - ALOGE("invalid uid/gid: %d %d\n", uid, gid); - return -1; - } - - std::string _pkgdir(create_data_user_package_path(uuid, 0, pkgname)); - const char* pkgdir = _pkgdir.c_str(); - - if (mkdir(pkgdir, 0751) < 0) { - ALOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno)); - return -1; - } - if (chmod(pkgdir, 0751) < 0) { - ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -1; - } - - if (selinux_android_setfilecon(pkgdir, pkgname, seinfo, uid) < 0) { - ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -errno; - } - - if (chown(pkgdir, uid, gid) < 0) { - ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -1; - } - - return 0; -} - -int uninstall(const char *uuid, const char *pkgname, userid_t userid) -{ - std::string _pkgdir(create_data_user_package_path(uuid, userid, pkgname)); - const char* pkgdir = _pkgdir.c_str(); - - remove_profile_file(pkgname); - - /* delete contents AND directory, no exceptions */ - return delete_dir_contents(pkgdir, 1, NULL); -} - -int renamepkg(const char *oldpkgname, const char *newpkgname) -{ - char oldpkgdir[PKG_PATH_MAX]; - char newpkgdir[PKG_PATH_MAX]; - - if (create_pkg_path(oldpkgdir, oldpkgname, PKG_DIR_POSTFIX, 0)) - return -1; - if (create_pkg_path(newpkgdir, newpkgname, PKG_DIR_POSTFIX, 0)) - return -1; - - if (rename(oldpkgdir, newpkgdir) < 0) { - ALOGE("cannot rename dir '%s' to '%s': %s\n", oldpkgdir, newpkgdir, strerror(errno)); - return -errno; - } - return 0; -} - -int fix_uid(const char *uuid, const char *pkgname, uid_t uid, gid_t gid) -{ - struct stat s; - - if ((uid < AID_SYSTEM) || (gid < AID_SYSTEM)) { - ALOGE("invalid uid/gid: %d %d\n", uid, gid); - return -1; - } - - std::string _pkgdir(create_data_user_package_path(uuid, 0, pkgname)); - const char* pkgdir = _pkgdir.c_str(); - - if (stat(pkgdir, &s) < 0) return -1; - - if (s.st_uid != 0 || s.st_gid != 0) { - ALOGE("fixing uid of non-root pkg: %s %" PRIu32 " %" PRIu32 "\n", pkgdir, s.st_uid, s.st_gid); - return -1; - } - - if (chmod(pkgdir, 0751) < 0) { - ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -errno; - } - if (chown(pkgdir, uid, gid) < 0) { - ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -errno; - } - - return 0; -} - -int delete_user_data(const char *uuid, const char *pkgname, userid_t userid) -{ - std::string _pkgdir(create_data_user_package_path(uuid, userid, pkgname)); - const char* pkgdir = _pkgdir.c_str(); - - return delete_dir_contents(pkgdir, 0, NULL); -} - -int make_user_data(const char *uuid, const char *pkgname, uid_t uid, userid_t userid, const char* seinfo) -{ - std::string _pkgdir(create_data_user_package_path(uuid, userid, pkgname)); - const char* pkgdir = _pkgdir.c_str(); - - if (mkdir(pkgdir, 0751) < 0) { - ALOGE("cannot create dir '%s': %s\n", pkgdir, strerror(errno)); - return -errno; - } - if (chmod(pkgdir, 0751) < 0) { - ALOGE("cannot chmod dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -errno; - } - - if (selinux_android_setfilecon(pkgdir, pkgname, seinfo, uid) < 0) { - ALOGE("cannot setfilecon dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -errno; - } - - if (chown(pkgdir, uid, uid) < 0) { - ALOGE("cannot chown dir '%s': %s\n", pkgdir, strerror(errno)); - unlink(pkgdir); - return -errno; - } - - return 0; -} - -int copy_complete_app(const char *from_uuid, const char *to_uuid, - const char *package_name, const char *data_app_name, appid_t appid, - const char* seinfo) { - std::vector users = get_known_users(from_uuid); - - // Copy app - { - std::string from(create_data_app_package_path(from_uuid, data_app_name)); - std::string to(create_data_app_package_path(to_uuid, data_app_name)); - std::string to_parent(create_data_app_path(to_uuid)); - - char *argv[] = { - (char*) kCpPath, - (char*) "-F", /* delete any existing destination file first (--remove-destination) */ - (char*) "-p", /* preserve timestamps, ownership, and permissions */ - (char*) "-R", /* recurse into subdirectories (DEST must be a directory) */ - (char*) "-P", /* Do not follow symlinks [default] */ - (char*) "-d", /* don't dereference symlinks */ - (char*) from.c_str(), - (char*) to_parent.c_str() - }; - - LOG(DEBUG) << "Copying " << from << " to " << to; - int rc = android_fork_execvp(ARRAY_SIZE(argv), argv, NULL, false, true); - - if (rc != 0) { - LOG(ERROR) << "Failed copying " << from << " to " << to - << ": status " << rc; - goto fail; - } - - if (selinux_android_restorecon(to.c_str(), SELINUX_ANDROID_RESTORECON_RECURSE) != 0) { - LOG(ERROR) << "Failed to restorecon " << to; - goto fail; - } - } - - // Copy private data for all known users - for (auto user : users) { - std::string from(create_data_user_package_path(from_uuid, user, package_name)); - std::string to(create_data_user_package_path(to_uuid, user, package_name)); - std::string to_parent(create_data_user_path(to_uuid, user)); - - // Data source may not exist for all users; that's okay - if (access(from.c_str(), F_OK) != 0) { - LOG(INFO) << "Missing source " << from; - continue; - } - - std::string user_path(create_data_user_path(to_uuid, user)); - if (fs_prepare_dir(user_path.c_str(), 0771, AID_SYSTEM, AID_SYSTEM) != 0) { - LOG(ERROR) << "Failed to prepare user target " << user_path; - goto fail; - } - - uid_t uid = multiuser_get_uid(user, appid); - if (make_user_data(to_uuid, package_name, uid, user, seinfo) != 0) { - LOG(ERROR) << "Failed to create package target " << to; - goto fail; - } - - char *argv[] = { - (char*) kCpPath, - (char*) "-F", /* delete any existing destination file first (--remove-destination) */ - (char*) "-p", /* preserve timestamps, ownership, and permissions */ - (char*) "-R", /* recurse into subdirectories (DEST must be a directory) */ - (char*) "-P", /* Do not follow symlinks [default] */ - (char*) "-d", /* don't dereference symlinks */ - (char*) from.c_str(), - (char*) to_parent.c_str() - }; - - LOG(DEBUG) << "Copying " << from << " to " << to; - int rc = android_fork_execvp(ARRAY_SIZE(argv), argv, NULL, false, true); - - if (rc != 0) { - LOG(ERROR) << "Failed copying " << from << " to " << to - << ": status " << rc; - goto fail; - } - } - - if (restorecon_data(to_uuid, package_name, seinfo, multiuser_get_uid(0, appid)) != 0) { - LOG(ERROR) << "Failed to restorecon"; - goto fail; - } - - // We let the framework scan the new location and persist that before - // deleting the data in the old location; this ordering ensures that - // we can recover from things like battery pulls. - return 0; - -fail: - // Nuke everything we might have already copied - { - std::string to(create_data_app_package_path(to_uuid, data_app_name)); - if (delete_dir_contents(to.c_str(), 1, NULL) != 0) { - LOG(WARNING) << "Failed to rollback " << to; - } - } - for (auto user : users) { - std::string to(create_data_user_package_path(to_uuid, user, package_name)); - if (delete_dir_contents(to.c_str(), 1, NULL) != 0) { - LOG(WARNING) << "Failed to rollback " << to; - } - } - return -1; -} - -int make_user_config(userid_t userid) -{ - if (ensure_config_user_dirs(userid) == -1) { - return -1; - } - - return 0; -} - -int delete_user(const char *uuid, userid_t userid) -{ - int status = 0; - - std::string data_path(create_data_user_path(uuid, userid)); - if (delete_dir_contents(data_path.c_str(), 1, NULL) != 0) { - status = -1; - } - - std::string media_path(create_data_media_path(uuid, userid)); - if (delete_dir_contents(media_path.c_str(), 1, NULL) != 0) { - status = -1; - } - - // Config paths only exist on internal storage - if (uuid == nullptr) { - char config_path[PATH_MAX]; - if ((create_user_config_path(config_path, userid) != 0) - || (delete_dir_contents(config_path, 1, NULL) != 0)) { - status = -1; - } - } - - return status; -} - -int delete_cache(const char *uuid, const char *pkgname, userid_t userid) -{ - std::string _cachedir( - create_data_user_package_path(uuid, userid, pkgname) + CACHE_DIR_POSTFIX); - const char* cachedir = _cachedir.c_str(); - - /* delete contents, not the directory, no exceptions */ - return delete_dir_contents(cachedir, 0, NULL); -} - -int delete_code_cache(const char *uuid, const char *pkgname, userid_t userid) -{ - std::string _codecachedir( - create_data_user_package_path(uuid, userid, pkgname) + CODE_CACHE_DIR_POSTFIX); - const char* codecachedir = _codecachedir.c_str(); - - struct stat s; - - /* it's okay if code cache is missing */ - if (lstat(codecachedir, &s) == -1 && errno == ENOENT) { - return 0; - } - - /* delete contents, not the directory, no exceptions */ - return delete_dir_contents(codecachedir, 0, NULL); -} - -/* Try to ensure free_size bytes of storage are available. - * Returns 0 on success. - * This is rather simple-minded because doing a full LRU would - * be potentially memory-intensive, and without atime it would - * also require that apps constantly modify file metadata even - * when just reading from the cache, which is pretty awful. - */ -int free_cache(const char *uuid, int64_t free_size) -{ - cache_t* cache; - int64_t avail; - DIR *d; - struct dirent *de; - char tmpdir[PATH_MAX]; - char *dirpos; - - std::string data_path(create_data_path(uuid)); - - avail = data_disk_free(data_path); - if (avail < 0) return -1; - - ALOGI("free_cache(%" PRId64 ") avail %" PRId64 "\n", free_size, avail); - if (avail >= free_size) return 0; - - cache = start_cache_collection(); - - // Special case for owner on internal storage - if (uuid == nullptr) { - std::string _tmpdir(create_data_user_path(nullptr, 0)); - add_cache_files(cache, _tmpdir.c_str(), "cache"); - } - - // Search for other users and add any cache files from them. - std::string _tmpdir(create_data_path(uuid) + "/" + SECONDARY_USER_PREFIX); - strcpy(tmpdir, _tmpdir.c_str()); - - dirpos = tmpdir + strlen(tmpdir); - d = opendir(tmpdir); - if (d != NULL) { - while ((de = readdir(d))) { - if (de->d_type == DT_DIR) { - const char *name = de->d_name; - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - if ((strlen(name)+(dirpos-tmpdir)) < (sizeof(tmpdir)-1)) { - strcpy(dirpos, name); - //ALOGI("adding cache files from %s\n", tmpdir); - add_cache_files(cache, tmpdir, "cache"); - } else { - ALOGW("Path exceeds limit: %s%s", tmpdir, name); - } - } - } - closedir(d); - } - - // Collect cache files on external storage for all users (if it is mounted as part - // of the internal storage). - strcpy(tmpdir, android_media_dir.path); - dirpos = tmpdir + strlen(tmpdir); - d = opendir(tmpdir); - if (d != NULL) { - while ((de = readdir(d))) { - if (de->d_type == DT_DIR) { - const char *name = de->d_name; - /* skip any dir that doesn't start with a number, so not a user */ - if (name[0] < '0' || name[0] > '9') { - continue; - } - if ((strlen(name)+(dirpos-tmpdir)) < (sizeof(tmpdir)-1)) { - strcpy(dirpos, name); - if (lookup_media_dir(tmpdir, "Android") == 0 - && lookup_media_dir(tmpdir, "data") == 0) { - //ALOGI("adding cache files from %s\n", tmpdir); - add_cache_files(cache, tmpdir, "cache"); - } - } else { - ALOGW("Path exceeds limit: %s%s", tmpdir, name); - } - } - } - closedir(d); - } - - clear_cache_files(data_path, cache, free_size); - finish_cache_collection(cache); - - return data_disk_free(data_path) >= free_size ? 0 : -1; -} - -int move_dex(const char *src, const char *dst, const char *instruction_set) -{ - char src_dex[PKG_PATH_MAX]; - char dst_dex[PKG_PATH_MAX]; - - if (validate_apk_path(src)) { - ALOGE("invalid apk path '%s' (bad prefix)\n", src); - return -1; - } - if (validate_apk_path(dst)) { - ALOGE("invalid apk path '%s' (bad prefix)\n", dst); - return -1; - } - - if (create_cache_path(src_dex, src, instruction_set)) return -1; - if (create_cache_path(dst_dex, dst, instruction_set)) return -1; - - ALOGV("move %s -> %s\n", src_dex, dst_dex); - if (rename(src_dex, dst_dex) < 0) { - ALOGE("Couldn't move %s: %s\n", src_dex, strerror(errno)); - return -1; - } else { - return 0; - } -} - -int rm_dex(const char *path, const char *instruction_set) -{ - char dex_path[PKG_PATH_MAX]; - - if (validate_apk_path(path) && validate_system_app_path(path)) { - ALOGE("invalid apk path '%s' (bad prefix)\n", path); - return -1; - } - - if (create_cache_path(dex_path, path, instruction_set)) return -1; - - ALOGV("unlink %s\n", dex_path); - if (unlink(dex_path) < 0) { - if (errno != ENOENT) { - ALOGE("Couldn't unlink %s: %s\n", dex_path, strerror(errno)); - } - return -1; - } else { - return 0; - } -} - -int get_size(const char *uuid, const char *pkgname, int userid, const char *apkpath, - const char *libdirpath, const char *fwdlock_apkpath, const char *asecpath, - const char *instruction_set, int64_t *_codesize, int64_t *_datasize, - int64_t *_cachesize, int64_t* _asecsize) -{ - DIR *d; - int dfd; - struct dirent *de; - struct stat s; - char path[PKG_PATH_MAX]; - - int64_t codesize = 0; - int64_t datasize = 0; - int64_t cachesize = 0; - int64_t asecsize = 0; - - /* count the source apk as code -- but only if it's not - * on the /system partition and its not on the sdcard. */ - if (validate_system_app_path(apkpath) && - strncmp(apkpath, android_asec_dir.path, android_asec_dir.len) != 0) { - if (stat(apkpath, &s) == 0) { - codesize += stat_size(&s); - if (S_ISDIR(s.st_mode)) { - d = opendir(apkpath); - if (d != NULL) { - dfd = dirfd(d); - codesize += calculate_dir_size(dfd); - closedir(d); - } - } - } - } - - /* count the forward locked apk as code if it is given */ - if (fwdlock_apkpath != NULL && fwdlock_apkpath[0] != '!') { - if (stat(fwdlock_apkpath, &s) == 0) { - codesize += stat_size(&s); - } - } - - /* count the cached dexfile as code */ - if (!create_cache_path(path, apkpath, instruction_set)) { - if (stat(path, &s) == 0) { - codesize += stat_size(&s); - } - } - - /* add in size of any libraries */ - if (libdirpath != NULL && libdirpath[0] != '!') { - d = opendir(libdirpath); - if (d != NULL) { - dfd = dirfd(d); - codesize += calculate_dir_size(dfd); - closedir(d); - } - } - - /* compute asec size if it is given */ - if (asecpath != NULL && asecpath[0] != '!') { - if (stat(asecpath, &s) == 0) { - asecsize += stat_size(&s); - } - } - - std::vector users; - if (userid == -1) { - users = get_known_users(uuid); - } else { - users.push_back(userid); - } - - for (auto user : users) { - std::string _pkgdir(create_data_user_package_path(uuid, user, pkgname)); - const char* pkgdir = _pkgdir.c_str(); - - d = opendir(pkgdir); - if (d == NULL) { - PLOG(WARNING) << "Failed to open " << pkgdir; - continue; - } - dfd = dirfd(d); - - /* most stuff in the pkgdir is data, except for the "cache" - * directory and below, which is cache, and the "lib" directory - * and below, which is code... - */ - while ((de = readdir(d))) { - const char *name = de->d_name; - - if (de->d_type == DT_DIR) { - int subfd; - int64_t statsize = 0; - int64_t dirsize = 0; - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { - statsize = stat_size(&s); - } - subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); - if (subfd >= 0) { - dirsize = calculate_dir_size(subfd); - } - if(!strcmp(name,"lib")) { - codesize += dirsize + statsize; - } else if(!strcmp(name,"cache")) { - cachesize += dirsize + statsize; - } else { - datasize += dirsize + statsize; - } - } else if (de->d_type == DT_LNK && !strcmp(name,"lib")) { - // This is the symbolic link to the application's library - // code. We'll count this as code instead of data, since - // it is not something that the app creates. - if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { - codesize += stat_size(&s); - } - } else { - if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { - datasize += stat_size(&s); - } - } - } - closedir(d); - } - *_codesize = codesize; - *_datasize = datasize; - *_cachesize = cachesize; - *_asecsize = asecsize; - return 0; -} - -int create_cache_path(char path[PKG_PATH_MAX], const char *src, const char *instruction_set) -{ - char *tmp; - int srclen; - int dstlen; - - srclen = strlen(src); - - /* demand that we are an absolute path */ - if ((src == 0) || (src[0] != '/') || strstr(src,"..")) { - return -1; - } - - if (srclen > PKG_PATH_MAX) { // XXX: PKG_NAME_MAX? - return -1; - } - - dstlen = srclen + strlen(DALVIK_CACHE_PREFIX) + - strlen(instruction_set) + - strlen(DALVIK_CACHE_POSTFIX) + 2; - - if (dstlen > PKG_PATH_MAX) { - return -1; - } - - sprintf(path,"%s%s/%s%s", - DALVIK_CACHE_PREFIX, - instruction_set, - src + 1, /* skip the leading / */ - DALVIK_CACHE_POSTFIX); - - for(tmp = path + strlen(DALVIK_CACHE_PREFIX) + strlen(instruction_set) + 1; *tmp; tmp++) { - if (*tmp == '/') { - *tmp = '@'; - } - } - - return 0; -} - -static int split_count(const char *str) -{ - char *ctx; - int count = 0; - char buf[PROPERTY_VALUE_MAX]; - - strncpy(buf, str, sizeof(buf)); - char *pBuf = buf; - - while(strtok_r(pBuf, " ", &ctx) != NULL) { - count++; - pBuf = NULL; - } - - return count; -} - -static int split(char *buf, const char **argv) -{ - char *ctx; - int count = 0; - char *tok; - char *pBuf = buf; - - while((tok = strtok_r(pBuf, " ", &ctx)) != NULL) { - argv[count++] = tok; - pBuf = NULL; - } - - return count; -} - -static void run_patchoat(int input_fd, int oat_fd, const char* input_file_name, - const char* output_file_name, const char *pkgname __unused, const char *instruction_set) -{ - static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig - static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; - - static const char* PATCHOAT_BIN = "/system/bin/patchoat"; - if (strlen(instruction_set) >= MAX_INSTRUCTION_SET_LEN) { - ALOGE("Instruction set %s longer than max length of %d", - instruction_set, MAX_INSTRUCTION_SET_LEN); - return; - } - - /* input_file_name/input_fd should be the .odex/.oat file that is precompiled. I think*/ - char instruction_set_arg[strlen("--instruction-set=") + MAX_INSTRUCTION_SET_LEN]; - char output_oat_fd_arg[strlen("--output-oat-fd=") + MAX_INT_LEN]; - char input_oat_fd_arg[strlen("--input-oat-fd=") + MAX_INT_LEN]; - const char* patched_image_location_arg = "--patched-image-location=/system/framework/boot.art"; - // The caller has already gotten all the locks we need. - const char* no_lock_arg = "--no-lock-output"; - sprintf(instruction_set_arg, "--instruction-set=%s", instruction_set); - sprintf(output_oat_fd_arg, "--output-oat-fd=%d", oat_fd); - sprintf(input_oat_fd_arg, "--input-oat-fd=%d", input_fd); - ALOGV("Running %s isa=%s in-fd=%d (%s) out-fd=%d (%s)\n", - PATCHOAT_BIN, instruction_set, input_fd, input_file_name, oat_fd, output_file_name); - - /* patchoat, patched-image-location, no-lock, isa, input-fd, output-fd */ - char* argv[7]; - argv[0] = (char*) PATCHOAT_BIN; - argv[1] = (char*) patched_image_location_arg; - argv[2] = (char*) no_lock_arg; - argv[3] = instruction_set_arg; - argv[4] = output_oat_fd_arg; - argv[5] = input_oat_fd_arg; - argv[6] = NULL; - - execv(PATCHOAT_BIN, (char* const *)argv); - ALOGE("execv(%s) failed: %s\n", PATCHOAT_BIN, strerror(errno)); -} - -static bool check_boolean_property(const char* property_name, bool default_value = false) { - char tmp_property_value[PROPERTY_VALUE_MAX]; - bool have_property = property_get(property_name, tmp_property_value, nullptr) > 0; - if (!have_property) { - return default_value; - } - return strcmp(tmp_property_value, "true") == 0; -} - -static void run_dex2oat(int zip_fd, int oat_fd, const char* input_file_name, - const char* output_file_name, int swap_fd, const char *pkgname, const char *instruction_set, - bool vm_safe_mode, bool debuggable, bool post_bootcomplete) -{ - static const unsigned int MAX_INSTRUCTION_SET_LEN = 7; - - if (strlen(instruction_set) >= MAX_INSTRUCTION_SET_LEN) { - ALOGE("Instruction set %s longer than max length of %d", - instruction_set, MAX_INSTRUCTION_SET_LEN); - return; - } - - char prop_buf[PROPERTY_VALUE_MAX]; - bool profiler = (property_get("dalvik.vm.profiler", prop_buf, "0") > 0) && (prop_buf[0] == '1'); - - char dex2oat_Xms_flag[PROPERTY_VALUE_MAX]; - bool have_dex2oat_Xms_flag = property_get("dalvik.vm.dex2oat-Xms", dex2oat_Xms_flag, NULL) > 0; - - char dex2oat_Xmx_flag[PROPERTY_VALUE_MAX]; - bool have_dex2oat_Xmx_flag = property_get("dalvik.vm.dex2oat-Xmx", dex2oat_Xmx_flag, NULL) > 0; - - char dex2oat_compiler_filter_flag[PROPERTY_VALUE_MAX]; - bool have_dex2oat_compiler_filter_flag = property_get("dalvik.vm.dex2oat-filter", - dex2oat_compiler_filter_flag, NULL) > 0; - - char dex2oat_threads_buf[PROPERTY_VALUE_MAX]; - bool have_dex2oat_threads_flag = false; - if (!post_bootcomplete) { - have_dex2oat_threads_flag = property_get("dalvik.vm.boot-dex2oat-threads", - dex2oat_threads_buf, - NULL) > 0; - // If there's no boot property, fall back to the image property. - if (!have_dex2oat_threads_flag) { - have_dex2oat_threads_flag = property_get("dalvik.vm.image-dex2oat-threads", - dex2oat_threads_buf, - NULL) > 0; - } - // If there's neither, fall back to the default property. - } - if (!have_dex2oat_threads_flag) { - have_dex2oat_threads_flag = property_get("dalvik.vm.dex2oat-threads", - dex2oat_threads_buf, - NULL) > 0; - } - char dex2oat_threads_arg[PROPERTY_VALUE_MAX + 2]; - if (have_dex2oat_threads_flag) { - sprintf(dex2oat_threads_arg, "-j%s", dex2oat_threads_buf); - } - - char dex2oat_isa_features_key[PROPERTY_KEY_MAX]; - sprintf(dex2oat_isa_features_key, "dalvik.vm.isa.%s.features", instruction_set); - char dex2oat_isa_features[PROPERTY_VALUE_MAX]; - bool have_dex2oat_isa_features = property_get(dex2oat_isa_features_key, - dex2oat_isa_features, NULL) > 0; - - char dex2oat_isa_variant_key[PROPERTY_KEY_MAX]; - sprintf(dex2oat_isa_variant_key, "dalvik.vm.isa.%s.variant", instruction_set); - char dex2oat_isa_variant[PROPERTY_VALUE_MAX]; - bool have_dex2oat_isa_variant = property_get(dex2oat_isa_variant_key, - dex2oat_isa_variant, NULL) > 0; - - const char *dex2oat_norelocation = "-Xnorelocate"; - bool have_dex2oat_relocation_skip_flag = false; - - char dex2oat_flags[PROPERTY_VALUE_MAX]; - int dex2oat_flags_count = property_get("dalvik.vm.dex2oat-flags", - dex2oat_flags, NULL) <= 0 ? 0 : split_count(dex2oat_flags); - ALOGV("dalvik.vm.dex2oat-flags=%s\n", dex2oat_flags); - - // If we booting without the real /data, don't spend time compiling. - char vold_decrypt[PROPERTY_VALUE_MAX]; - bool have_vold_decrypt = property_get("vold.decrypt", vold_decrypt, "") > 0; - bool skip_compilation = (have_vold_decrypt && - (strcmp(vold_decrypt, "trigger_restart_min_framework") == 0 || - (strcmp(vold_decrypt, "1") == 0))); - - bool use_jit = check_boolean_property("debug.usejit"); - bool generate_debug_info = check_boolean_property("debug.generate-debug-info"); - - static const char* DEX2OAT_BIN = "/system/bin/dex2oat"; - - static const char* RUNTIME_ARG = "--runtime-arg"; - - static const int MAX_INT_LEN = 12; // '-'+10dig+'\0' -OR- 0x+8dig - - char zip_fd_arg[strlen("--zip-fd=") + MAX_INT_LEN]; - char zip_location_arg[strlen("--zip-location=") + PKG_PATH_MAX]; - char oat_fd_arg[strlen("--oat-fd=") + MAX_INT_LEN]; - char oat_location_arg[strlen("--oat-location=") + PKG_PATH_MAX]; - char instruction_set_arg[strlen("--instruction-set=") + MAX_INSTRUCTION_SET_LEN]; - char instruction_set_variant_arg[strlen("--instruction-set-variant=") + PROPERTY_VALUE_MAX]; - char instruction_set_features_arg[strlen("--instruction-set-features=") + PROPERTY_VALUE_MAX]; - char profile_file_arg[strlen("--profile-file=") + PKG_PATH_MAX]; - char top_k_profile_threshold_arg[strlen("--top-k-profile-threshold=") + PROPERTY_VALUE_MAX]; - char dex2oat_Xms_arg[strlen("-Xms") + PROPERTY_VALUE_MAX]; - char dex2oat_Xmx_arg[strlen("-Xmx") + PROPERTY_VALUE_MAX]; - char dex2oat_compiler_filter_arg[strlen("--compiler-filter=") + PROPERTY_VALUE_MAX]; - bool have_dex2oat_swap_fd = false; - char dex2oat_swap_fd[strlen("--swap-fd=") + MAX_INT_LEN]; - - sprintf(zip_fd_arg, "--zip-fd=%d", zip_fd); - sprintf(zip_location_arg, "--zip-location=%s", input_file_name); - sprintf(oat_fd_arg, "--oat-fd=%d", oat_fd); - sprintf(oat_location_arg, "--oat-location=%s", output_file_name); - sprintf(instruction_set_arg, "--instruction-set=%s", instruction_set); - sprintf(instruction_set_variant_arg, "--instruction-set-variant=%s", dex2oat_isa_variant); - sprintf(instruction_set_features_arg, "--instruction-set-features=%s", dex2oat_isa_features); - if (swap_fd >= 0) { - have_dex2oat_swap_fd = true; - sprintf(dex2oat_swap_fd, "--swap-fd=%d", swap_fd); - } - - bool have_profile_file = false; - bool have_top_k_profile_threshold = false; - if (profiler && (strcmp(pkgname, "*") != 0)) { - char profile_file[PKG_PATH_MAX]; - snprintf(profile_file, sizeof(profile_file), "%s/%s", - DALVIK_CACHE_PREFIX "profiles", pkgname); - struct stat st; - if ((stat(profile_file, &st) == 0) && (st.st_size > 0)) { - sprintf(profile_file_arg, "--profile-file=%s", profile_file); - have_profile_file = true; - if (property_get("dalvik.vm.profile.top-k-thr", prop_buf, NULL) > 0) { - snprintf(top_k_profile_threshold_arg, sizeof(top_k_profile_threshold_arg), - "--top-k-profile-threshold=%s", prop_buf); - have_top_k_profile_threshold = true; - } - } - } - - if (have_dex2oat_Xms_flag) { - sprintf(dex2oat_Xms_arg, "-Xms%s", dex2oat_Xms_flag); - } - if (have_dex2oat_Xmx_flag) { - sprintf(dex2oat_Xmx_arg, "-Xmx%s", dex2oat_Xmx_flag); - } - if (skip_compilation) { - strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-none"); - have_dex2oat_compiler_filter_flag = true; - have_dex2oat_relocation_skip_flag = true; - } else if (vm_safe_mode) { - strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=interpret-only"); - have_dex2oat_compiler_filter_flag = true; - } else if (use_jit) { - strcpy(dex2oat_compiler_filter_arg, "--compiler-filter=verify-at-runtime"); - have_dex2oat_compiler_filter_flag = true; - } else if (have_dex2oat_compiler_filter_flag) { - sprintf(dex2oat_compiler_filter_arg, "--compiler-filter=%s", dex2oat_compiler_filter_flag); - } - - // Check whether all apps should be compiled debuggable. - if (!debuggable) { - debuggable = - (property_get("dalvik.vm.always_debuggable", prop_buf, "0") > 0) && - (prop_buf[0] == '1'); - } - - ALOGV("Running %s in=%s out=%s\n", DEX2OAT_BIN, input_file_name, output_file_name); - - const char* argv[7 // program name, mandatory arguments and the final NULL - + (have_dex2oat_isa_variant ? 1 : 0) - + (have_dex2oat_isa_features ? 1 : 0) - + (have_profile_file ? 1 : 0) - + (have_top_k_profile_threshold ? 1 : 0) - + (have_dex2oat_Xms_flag ? 2 : 0) - + (have_dex2oat_Xmx_flag ? 2 : 0) - + (have_dex2oat_compiler_filter_flag ? 1 : 0) - + (have_dex2oat_threads_flag ? 1 : 0) - + (have_dex2oat_swap_fd ? 1 : 0) - + (have_dex2oat_relocation_skip_flag ? 2 : 0) - + (generate_debug_info ? 1 : 0) - + (debuggable ? 1 : 0) - + dex2oat_flags_count]; - int i = 0; - argv[i++] = DEX2OAT_BIN; - argv[i++] = zip_fd_arg; - argv[i++] = zip_location_arg; - argv[i++] = oat_fd_arg; - argv[i++] = oat_location_arg; - argv[i++] = instruction_set_arg; - if (have_dex2oat_isa_variant) { - argv[i++] = instruction_set_variant_arg; - } - if (have_dex2oat_isa_features) { - argv[i++] = instruction_set_features_arg; - } - if (have_profile_file) { - argv[i++] = profile_file_arg; - } - if (have_top_k_profile_threshold) { - argv[i++] = top_k_profile_threshold_arg; - } - if (have_dex2oat_Xms_flag) { - argv[i++] = RUNTIME_ARG; - argv[i++] = dex2oat_Xms_arg; - } - if (have_dex2oat_Xmx_flag) { - argv[i++] = RUNTIME_ARG; - argv[i++] = dex2oat_Xmx_arg; - } - if (have_dex2oat_compiler_filter_flag) { - argv[i++] = dex2oat_compiler_filter_arg; - } - if (have_dex2oat_threads_flag) { - argv[i++] = dex2oat_threads_arg; - } - if (have_dex2oat_swap_fd) { - argv[i++] = dex2oat_swap_fd; - } - if (generate_debug_info) { - argv[i++] = "--generate-debug-info"; - } - if (debuggable) { - argv[i++] = "--debuggable"; - } - if (dex2oat_flags_count) { - i += split(dex2oat_flags, argv + i); - } - if (have_dex2oat_relocation_skip_flag) { - argv[i++] = RUNTIME_ARG; - argv[i++] = dex2oat_norelocation; - } - // Do not add after dex2oat_flags, they should override others for debugging. - argv[i] = NULL; - - execv(DEX2OAT_BIN, (char * const *)argv); - ALOGE("execv(%s) failed: %s\n", DEX2OAT_BIN, strerror(errno)); -} - -static int wait_child(pid_t pid) -{ - int status; - pid_t got_pid; - - while (1) { - got_pid = waitpid(pid, &status, 0); - if (got_pid == -1 && errno == EINTR) { - printf("waitpid interrupted, retrying\n"); - } else { - break; - } - } - if (got_pid != pid) { - ALOGW("waitpid failed: wanted %d, got %d: %s\n", - (int) pid, (int) got_pid, strerror(errno)); - return 1; - } - - if (WIFEXITED(status) && WEXITSTATUS(status) == 0) { - return 0; - } else { - return status; /* always nonzero */ - } -} - -/* - * Whether dexopt should use a swap file when compiling an APK. - * - * If kAlwaysProvideSwapFile, do this on all devices (dex2oat will make a more informed decision - * itself, anyways). - * - * Otherwise, read "dalvik.vm.dex2oat-swap". If the property exists, return whether it is "true". - * - * Otherwise, return true if this is a low-mem device. - * - * Otherwise, return default value. - */ -static bool kAlwaysProvideSwapFile = false; -static bool kDefaultProvideSwapFile = true; - -static bool ShouldUseSwapFileForDexopt() { - if (kAlwaysProvideSwapFile) { - return true; - } - - // Check the "override" property. If it exists, return value == "true". - char dex2oat_prop_buf[PROPERTY_VALUE_MAX]; - if (property_get("dalvik.vm.dex2oat-swap", dex2oat_prop_buf, "") > 0) { - if (strcmp(dex2oat_prop_buf, "true") == 0) { - return true; - } else { - return false; - } - } - - // Shortcut for default value. This is an implementation optimization for the process sketched - // above. If the default value is true, we can avoid to check whether this is a low-mem device, - // as low-mem is never returning false. The compiler will optimize this away if it can. - if (kDefaultProvideSwapFile) { - return true; - } - - bool is_low_mem = check_boolean_property("ro.config.low_ram"); - if (is_low_mem) { - return true; - } - - // Default value must be false here. - return kDefaultProvideSwapFile; -} - -/* - * Computes the odex file for the given apk_path and instruction_set. - * /system/framework/whatever.jar -> /system/framework/oat//whatever.odex - * - * Returns false if it failed to determine the odex file path. - */ -static bool calculate_odex_file_path(char path[PKG_PATH_MAX], - const char *apk_path, - const char *instruction_set) -{ - if (strlen(apk_path) + strlen("oat/") + strlen(instruction_set) - + strlen("/") + strlen("odex") + 1 > PKG_PATH_MAX) { - ALOGE("apk_path '%s' may be too long to form odex file path.\n", apk_path); - return false; - } - - strcpy(path, apk_path); - char *end = strrchr(path, '/'); - if (end == NULL) { - ALOGE("apk_path '%s' has no '/'s in it?!\n", apk_path); - return false; - } - const char *apk_end = apk_path + (end - path); // strrchr(apk_path, '/'); - - strcpy(end + 1, "oat/"); // path = /system/framework/oat/\0 - strcat(path, instruction_set); // path = /system/framework/oat/\0 - strcat(path, apk_end); // path = /system/framework/oat//whatever.jar\0 - end = strrchr(path, '.'); - if (end == NULL) { - ALOGE("apk_path '%s' has no extension.\n", apk_path); - return false; - } - strcpy(end + 1, "odex"); - return true; -} - -static void SetDex2OatAndPatchOatScheduling(bool set_to_bg) { - if (set_to_bg) { - if (set_sched_policy(0, SP_BACKGROUND) < 0) { - ALOGE("set_sched_policy failed: %s\n", strerror(errno)); - exit(70); - } - if (setpriority(PRIO_PROCESS, 0, ANDROID_PRIORITY_BACKGROUND) < 0) { - ALOGE("setpriority failed: %s\n", strerror(errno)); - exit(71); - } - } -} - -int dexopt(const char *apk_path, uid_t uid, bool is_public, - const char *pkgname, const char *instruction_set, int dexopt_needed, - bool vm_safe_mode, bool debuggable, const char* oat_dir, bool boot_complete) -{ - struct utimbuf ut; - struct stat input_stat; - char out_path[PKG_PATH_MAX]; - char swap_file_name[PKG_PATH_MAX]; - const char *input_file; - char in_odex_path[PKG_PATH_MAX]; - int res, input_fd=-1, out_fd=-1, swap_fd=-1; - - // Early best-effort check whether we can fit the the path into our buffers. - // Note: the cache path will require an additional 5 bytes for ".swap", but we'll try to run - // without a swap file, if necessary. - if (strlen(apk_path) >= (PKG_PATH_MAX - 8)) { - ALOGE("apk_path too long '%s'\n", apk_path); - return -1; - } - - if (oat_dir != NULL && oat_dir[0] != '!') { - if (validate_apk_path(oat_dir)) { - ALOGE("invalid oat_dir '%s'\n", oat_dir); - return -1; - } - if (calculate_oat_file_path(out_path, oat_dir, apk_path, instruction_set)) { - return -1; - } - } else { - if (create_cache_path(out_path, apk_path, instruction_set)) { - return -1; - } - } - - switch (dexopt_needed) { - case DEXOPT_DEX2OAT_NEEDED: - input_file = apk_path; - break; - - case DEXOPT_PATCHOAT_NEEDED: - if (!calculate_odex_file_path(in_odex_path, apk_path, instruction_set)) { - return -1; - } - input_file = in_odex_path; - break; - - case DEXOPT_SELF_PATCHOAT_NEEDED: - input_file = out_path; - break; - - default: - ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); - exit(72); - } - - memset(&input_stat, 0, sizeof(input_stat)); - stat(input_file, &input_stat); - - input_fd = open(input_file, O_RDONLY, 0); - if (input_fd < 0) { - ALOGE("installd cannot open '%s' for input during dexopt\n", input_file); - return -1; - } - - unlink(out_path); - out_fd = open(out_path, O_RDWR | O_CREAT | O_EXCL, 0644); - if (out_fd < 0) { - ALOGE("installd cannot open '%s' for output during dexopt\n", out_path); - goto fail; - } - if (fchmod(out_fd, - S_IRUSR|S_IWUSR|S_IRGRP | - (is_public ? S_IROTH : 0)) < 0) { - ALOGE("installd cannot chmod '%s' during dexopt\n", out_path); - goto fail; - } - if (fchown(out_fd, AID_SYSTEM, uid) < 0) { - ALOGE("installd cannot chown '%s' during dexopt\n", out_path); - goto fail; - } - - // Create profile file if there is a package name present. - if (strcmp(pkgname, "*") != 0) { - create_profile_file(pkgname, uid); - } - - // Create a swap file if necessary. - if (ShouldUseSwapFileForDexopt()) { - // Make sure there really is enough space. - size_t out_len = strlen(out_path); - if (out_len + strlen(".swap") + 1 <= PKG_PATH_MAX) { - strcpy(swap_file_name, out_path); - strcpy(swap_file_name + strlen(out_path), ".swap"); - unlink(swap_file_name); - swap_fd = open(swap_file_name, O_RDWR | O_CREAT | O_EXCL, 0600); - if (swap_fd < 0) { - // Could not create swap file. Optimistically go on and hope that we can compile - // without it. - ALOGE("installd could not create '%s' for swap during dexopt\n", swap_file_name); - } else { - // Immediately unlink. We don't really want to hit flash. - unlink(swap_file_name); - } - } else { - // Swap file path is too long. Try to run without. - ALOGE("installd could not create swap file for path %s during dexopt\n", out_path); - } - } - - ALOGV("DexInv: --- BEGIN '%s' ---\n", input_file); - - pid_t pid; - pid = fork(); - if (pid == 0) { - /* child -- drop privileges before continuing */ - if (setgid(uid) != 0) { - ALOGE("setgid(%d) failed in installd during dexopt\n", uid); - exit(64); - } - if (setuid(uid) != 0) { - ALOGE("setuid(%d) failed in installd during dexopt\n", uid); - exit(65); - } - // drop capabilities - struct __user_cap_header_struct capheader; - struct __user_cap_data_struct capdata[2]; - memset(&capheader, 0, sizeof(capheader)); - memset(&capdata, 0, sizeof(capdata)); - capheader.version = _LINUX_CAPABILITY_VERSION_3; - if (capset(&capheader, &capdata[0]) < 0) { - ALOGE("capset failed: %s\n", strerror(errno)); - exit(66); - } - SetDex2OatAndPatchOatScheduling(boot_complete); - if (flock(out_fd, LOCK_EX | LOCK_NB) != 0) { - ALOGE("flock(%s) failed: %s\n", out_path, strerror(errno)); - exit(67); - } - - if (dexopt_needed == DEXOPT_PATCHOAT_NEEDED - || dexopt_needed == DEXOPT_SELF_PATCHOAT_NEEDED) { - run_patchoat(input_fd, out_fd, input_file, out_path, pkgname, instruction_set); - } else if (dexopt_needed == DEXOPT_DEX2OAT_NEEDED) { - const char *input_file_name = strrchr(input_file, '/'); - if (input_file_name == NULL) { - input_file_name = input_file; - } else { - input_file_name++; - } - run_dex2oat(input_fd, out_fd, input_file_name, out_path, swap_fd, pkgname, - instruction_set, vm_safe_mode, debuggable, boot_complete); - } else { - ALOGE("Invalid dexopt needed: %d\n", dexopt_needed); - exit(73); - } - exit(68); /* only get here on exec failure */ - } else { - res = wait_child(pid); - if (res == 0) { - ALOGV("DexInv: --- END '%s' (success) ---\n", input_file); - } else { - ALOGE("DexInv: --- END '%s' --- status=0x%04x, process failed\n", input_file, res); - goto fail; - } - } - - ut.actime = input_stat.st_atime; - ut.modtime = input_stat.st_mtime; - utime(out_path, &ut); - - close(out_fd); - close(input_fd); - if (swap_fd != -1) { - close(swap_fd); - } - return 0; - -fail: - if (out_fd >= 0) { - close(out_fd); - unlink(out_path); - } - if (input_fd >= 0) { - close(input_fd); - } - return -1; -} - -int mark_boot_complete(const char* instruction_set) -{ - char boot_marker_path[PKG_PATH_MAX]; - sprintf(boot_marker_path,"%s%s/.booting", DALVIK_CACHE_PREFIX, instruction_set); - - ALOGV("mark_boot_complete : %s", boot_marker_path); - if (unlink(boot_marker_path) != 0) { - ALOGE("Unable to unlink boot marker at %s, error=%s", boot_marker_path, - strerror(errno)); - return -1; - } - - return 0; -} - -void mkinnerdirs(char* path, int basepos, mode_t mode, int uid, int gid, - struct stat* statbuf) -{ - while (path[basepos] != 0) { - if (path[basepos] == '/') { - path[basepos] = 0; - if (lstat(path, statbuf) < 0) { - ALOGV("Making directory: %s\n", path); - if (mkdir(path, mode) == 0) { - chown(path, uid, gid); - } else { - ALOGW("Unable to make directory %s: %s\n", path, strerror(errno)); - } - } - path[basepos] = '/'; - basepos++; - } - basepos++; - } -} - -int movefileordir(char* srcpath, char* dstpath, int dstbasepos, - int dstuid, int dstgid, struct stat* statbuf) -{ - DIR *d; - struct dirent *de; - int res; - - int srcend = strlen(srcpath); - int dstend = strlen(dstpath); - - if (lstat(srcpath, statbuf) < 0) { - ALOGW("Unable to stat %s: %s\n", srcpath, strerror(errno)); - return 1; - } - - if ((statbuf->st_mode&S_IFDIR) == 0) { - mkinnerdirs(dstpath, dstbasepos, S_IRWXU|S_IRWXG|S_IXOTH, - dstuid, dstgid, statbuf); - ALOGV("Renaming %s to %s (uid %d)\n", srcpath, dstpath, dstuid); - if (rename(srcpath, dstpath) >= 0) { - if (chown(dstpath, dstuid, dstgid) < 0) { - ALOGE("cannot chown %s: %s\n", dstpath, strerror(errno)); - unlink(dstpath); - return 1; - } - } else { - ALOGW("Unable to rename %s to %s: %s\n", - srcpath, dstpath, strerror(errno)); - return 1; - } - return 0; - } - - d = opendir(srcpath); - if (d == NULL) { - ALOGW("Unable to opendir %s: %s\n", srcpath, strerror(errno)); - return 1; - } - - res = 0; - - while ((de = readdir(d))) { - const char *name = de->d_name; - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - - if ((srcend+strlen(name)) >= (PKG_PATH_MAX-2)) { - ALOGW("Source path too long; skipping: %s/%s\n", srcpath, name); - continue; - } - - if ((dstend+strlen(name)) >= (PKG_PATH_MAX-2)) { - ALOGW("Destination path too long; skipping: %s/%s\n", dstpath, name); - continue; - } - - srcpath[srcend] = dstpath[dstend] = '/'; - strcpy(srcpath+srcend+1, name); - strcpy(dstpath+dstend+1, name); - - if (movefileordir(srcpath, dstpath, dstbasepos, dstuid, dstgid, statbuf) != 0) { - res = 1; - } - - // Note: we will be leaving empty directories behind in srcpath, - // but that is okay, the package manager will be erasing all of the - // data associated with .apks that disappear. - - srcpath[srcend] = dstpath[dstend] = 0; - } - - closedir(d); - return res; -} - -int movefiles() -{ - DIR *d; - int dfd, subfd; - struct dirent *de; - struct stat s; - char buf[PKG_PATH_MAX+1]; - int bufp, bufe, bufi, readlen; - - char srcpkg[PKG_NAME_MAX]; - char dstpkg[PKG_NAME_MAX]; - char srcpath[PKG_PATH_MAX]; - char dstpath[PKG_PATH_MAX]; - int dstuid=-1, dstgid=-1; - int hasspace; - - d = opendir(UPDATE_COMMANDS_DIR_PREFIX); - if (d == NULL) { - goto done; - } - dfd = dirfd(d); - - /* Iterate through all files in the directory, executing the - * file movements requested there-in. - */ - while ((de = readdir(d))) { - const char *name = de->d_name; - - if (de->d_type == DT_DIR) { - continue; - } else { - subfd = openat(dfd, name, O_RDONLY); - if (subfd < 0) { - ALOGW("Unable to open update commands at %s%s\n", - UPDATE_COMMANDS_DIR_PREFIX, name); - continue; - } - - bufp = 0; - bufe = 0; - buf[PKG_PATH_MAX] = 0; - srcpkg[0] = dstpkg[0] = 0; - while (1) { - bufi = bufp; - while (bufi < bufe && buf[bufi] != '\n') { - bufi++; - } - if (bufi < bufe) { - buf[bufi] = 0; - ALOGV("Processing line: %s\n", buf+bufp); - hasspace = 0; - while (bufp < bufi && isspace(buf[bufp])) { - hasspace = 1; - bufp++; - } - if (buf[bufp] == '#' || bufp == bufi) { - // skip comments and empty lines. - } else if (hasspace) { - if (dstpkg[0] == 0) { - ALOGW("Path before package line in %s%s: %s\n", - UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp); - } else if (srcpkg[0] == 0) { - // Skip -- source package no longer exists. - } else { - ALOGV("Move file: %s (from %s to %s)\n", buf+bufp, srcpkg, dstpkg); - if (!create_move_path(srcpath, srcpkg, buf+bufp, 0) && - !create_move_path(dstpath, dstpkg, buf+bufp, 0)) { - movefileordir(srcpath, dstpath, - strlen(dstpath)-strlen(buf+bufp), - dstuid, dstgid, &s); - } - } - } else { - char* div = strchr(buf+bufp, ':'); - if (div == NULL) { - ALOGW("Bad package spec in %s%s; no ':' sep: %s\n", - UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp); - } else { - *div = 0; - div++; - if (strlen(buf+bufp) < PKG_NAME_MAX) { - strcpy(dstpkg, buf+bufp); - } else { - srcpkg[0] = dstpkg[0] = 0; - ALOGW("Package name too long in %s%s: %s\n", - UPDATE_COMMANDS_DIR_PREFIX, name, buf+bufp); - } - if (strlen(div) < PKG_NAME_MAX) { - strcpy(srcpkg, div); - } else { - srcpkg[0] = dstpkg[0] = 0; - ALOGW("Package name too long in %s%s: %s\n", - UPDATE_COMMANDS_DIR_PREFIX, name, div); - } - if (srcpkg[0] != 0) { - if (!create_pkg_path(srcpath, srcpkg, PKG_DIR_POSTFIX, 0)) { - if (lstat(srcpath, &s) < 0) { - // Package no longer exists -- skip. - srcpkg[0] = 0; - } - } else { - srcpkg[0] = 0; - ALOGW("Can't create path %s in %s%s\n", - div, UPDATE_COMMANDS_DIR_PREFIX, name); - } - if (srcpkg[0] != 0) { - if (!create_pkg_path(dstpath, dstpkg, PKG_DIR_POSTFIX, 0)) { - if (lstat(dstpath, &s) == 0) { - dstuid = s.st_uid; - dstgid = s.st_gid; - } else { - // Destination package doesn't - // exist... due to original-package, - // this is normal, so don't be - // noisy about it. - srcpkg[0] = 0; - } - } else { - srcpkg[0] = 0; - ALOGW("Can't create path %s in %s%s\n", - div, UPDATE_COMMANDS_DIR_PREFIX, name); - } - } - ALOGV("Transfering from %s to %s: uid=%d\n", - srcpkg, dstpkg, dstuid); - } - } - } - bufp = bufi+1; - } else { - if (bufp == 0) { - if (bufp < bufe) { - ALOGW("Line too long in %s%s, skipping: %s\n", - UPDATE_COMMANDS_DIR_PREFIX, name, buf); - } - } else if (bufp < bufe) { - memcpy(buf, buf+bufp, bufe-bufp); - bufe -= bufp; - bufp = 0; - } - readlen = read(subfd, buf+bufe, PKG_PATH_MAX-bufe); - if (readlen < 0) { - ALOGW("Failure reading update commands in %s%s: %s\n", - UPDATE_COMMANDS_DIR_PREFIX, name, strerror(errno)); - break; - } else if (readlen == 0) { - break; - } - bufe += readlen; - buf[bufe] = 0; - ALOGV("Read buf: %s\n", buf); - } - } - close(subfd); - } - } - closedir(d); -done: - return 0; -} - -int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId) -{ - struct stat s, libStat; - int rc = 0; - - std::string _pkgdir(create_data_user_package_path(uuid, userId, pkgname)); - std::string _libsymlink(_pkgdir + PKG_LIB_POSTFIX); - - const char* pkgdir = _pkgdir.c_str(); - const char* libsymlink = _libsymlink.c_str(); - - if (stat(pkgdir, &s) < 0) return -1; - - if (chown(pkgdir, AID_INSTALL, AID_INSTALL) < 0) { - ALOGE("failed to chown '%s': %s\n", pkgdir, strerror(errno)); - return -1; - } - - if (chmod(pkgdir, 0700) < 0) { - ALOGE("linklib() 1: failed to chmod '%s': %s\n", pkgdir, strerror(errno)); - rc = -1; - goto out; - } - - if (lstat(libsymlink, &libStat) < 0) { - if (errno != ENOENT) { - ALOGE("couldn't stat lib dir: %s\n", strerror(errno)); - rc = -1; - goto out; - } - } else { - if (S_ISDIR(libStat.st_mode)) { - if (delete_dir_contents(libsymlink, 1, NULL) < 0) { - rc = -1; - goto out; - } - } else if (S_ISLNK(libStat.st_mode)) { - if (unlink(libsymlink) < 0) { - ALOGE("couldn't unlink lib dir: %s\n", strerror(errno)); - rc = -1; - goto out; - } - } - } - - if (symlink(asecLibDir, libsymlink) < 0) { - ALOGE("couldn't symlink directory '%s' -> '%s': %s\n", libsymlink, asecLibDir, - strerror(errno)); - rc = -errno; - goto out; - } - -out: - if (chmod(pkgdir, s.st_mode) < 0) { - ALOGE("linklib() 2: failed to chmod '%s': %s\n", pkgdir, strerror(errno)); - rc = -errno; - } - - if (chown(pkgdir, s.st_uid, s.st_gid) < 0) { - ALOGE("failed to chown '%s' : %s\n", pkgdir, strerror(errno)); - return -errno; - } - - return rc; -} - -static void run_idmap(const char *target_apk, const char *overlay_apk, int idmap_fd) -{ - static const char *IDMAP_BIN = "/system/bin/idmap"; - static const size_t MAX_INT_LEN = 32; - char idmap_str[MAX_INT_LEN]; - - snprintf(idmap_str, sizeof(idmap_str), "%d", idmap_fd); - - execl(IDMAP_BIN, IDMAP_BIN, "--fd", target_apk, overlay_apk, idmap_str, (char*)NULL); - ALOGE("execl(%s) failed: %s\n", IDMAP_BIN, strerror(errno)); -} - -// Transform string /a/b/c.apk to (prefix)/a@b@c.apk@(suffix) -// eg /a/b/c.apk to /data/resource-cache/a@b@c.apk@idmap -static int flatten_path(const char *prefix, const char *suffix, - const char *overlay_path, char *idmap_path, size_t N) -{ - if (overlay_path == NULL || idmap_path == NULL) { - return -1; - } - const size_t len_overlay_path = strlen(overlay_path); - // will access overlay_path + 1 further below; requires absolute path - if (len_overlay_path < 2 || *overlay_path != '/') { - return -1; - } - const size_t len_idmap_root = strlen(prefix); - const size_t len_suffix = strlen(suffix); - if (SIZE_MAX - len_idmap_root < len_overlay_path || - SIZE_MAX - (len_idmap_root + len_overlay_path) < len_suffix) { - // additions below would cause overflow - return -1; - } - if (N < len_idmap_root + len_overlay_path + len_suffix) { - return -1; - } - memset(idmap_path, 0, N); - snprintf(idmap_path, N, "%s%s%s", prefix, overlay_path + 1, suffix); - char *ch = idmap_path + len_idmap_root; - while (*ch != '\0') { - if (*ch == '/') { - *ch = '@'; - } - ++ch; - } - return 0; -} - -int idmap(const char *target_apk, const char *overlay_apk, uid_t uid) -{ - ALOGV("idmap target_apk=%s overlay_apk=%s uid=%d\n", target_apk, overlay_apk, uid); - - int idmap_fd = -1; - char idmap_path[PATH_MAX]; - - if (flatten_path(IDMAP_PREFIX, IDMAP_SUFFIX, overlay_apk, - idmap_path, sizeof(idmap_path)) == -1) { - ALOGE("idmap cannot generate idmap path for overlay %s\n", overlay_apk); - goto fail; - } - - unlink(idmap_path); - idmap_fd = open(idmap_path, O_RDWR | O_CREAT | O_EXCL, 0644); - if (idmap_fd < 0) { - ALOGE("idmap cannot open '%s' for output: %s\n", idmap_path, strerror(errno)); - goto fail; - } - if (fchown(idmap_fd, AID_SYSTEM, uid) < 0) { - ALOGE("idmap cannot chown '%s'\n", idmap_path); - goto fail; - } - if (fchmod(idmap_fd, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH) < 0) { - ALOGE("idmap cannot chmod '%s'\n", idmap_path); - goto fail; - } - - pid_t pid; - pid = fork(); - if (pid == 0) { - /* child -- drop privileges before continuing */ - if (setgid(uid) != 0) { - ALOGE("setgid(%d) failed during idmap\n", uid); - exit(1); - } - if (setuid(uid) != 0) { - ALOGE("setuid(%d) failed during idmap\n", uid); - exit(1); - } - if (flock(idmap_fd, LOCK_EX | LOCK_NB) != 0) { - ALOGE("flock(%s) failed during idmap: %s\n", idmap_path, strerror(errno)); - exit(1); - } - - run_idmap(target_apk, overlay_apk, idmap_fd); - exit(1); /* only if exec call to idmap failed */ - } else { - int status = wait_child(pid); - if (status != 0) { - ALOGE("idmap failed, status=0x%04x\n", status); - goto fail; - } - } - - close(idmap_fd); - return 0; -fail: - if (idmap_fd >= 0) { - close(idmap_fd); - unlink(idmap_path); - } - return -1; -} - -int restorecon_data(const char* uuid, const char* pkgName, - const char* seinfo, uid_t uid) -{ - struct dirent *entry; - DIR *d; - struct stat s; - int ret = 0; - - // SELINUX_ANDROID_RESTORECON_DATADATA flag is set by libselinux. Not needed here. - unsigned int flags = SELINUX_ANDROID_RESTORECON_RECURSE; - - if (!pkgName || !seinfo) { - ALOGE("Package name or seinfo tag is null when trying to restorecon."); - return -1; - } - - // Special case for owner on internal storage - if (uuid == nullptr) { - std::string path(create_data_user_package_path(nullptr, 0, pkgName)); - - if (selinux_android_restorecon_pkgdir(path.c_str(), seinfo, uid, flags) < 0) { - PLOG(ERROR) << "restorecon failed for " << path; - ret |= -1; - } - } - - // Relabel package directory for all secondary users. - std::string userdir(create_data_path(uuid) + "/" + SECONDARY_USER_PREFIX); - d = opendir(userdir.c_str()); - if (d == NULL) { - return -1; - } - - while ((entry = readdir(d))) { - if (entry->d_type != DT_DIR) { - continue; - } - - const char *user = entry->d_name; - // Ignore "." and ".." - if (!strcmp(user, ".") || !strcmp(user, "..")) { - continue; - } - - // user directories start with a number - if (user[0] < '0' || user[0] > '9') { - ALOGE("Expecting numbered directory during restorecon. Instead got '%s'.", user); - continue; - } - - std::string pkgdir(StringPrintf("%s%s/%s", userdir.c_str(), user, pkgName)); - if (stat(pkgdir.c_str(), &s) < 0) { - continue; - } - - if (selinux_android_restorecon_pkgdir(pkgdir.c_str(), seinfo, s.st_uid, flags) < 0) { - PLOG(ERROR) << "restorecon failed for " << pkgdir; - ret |= -1; - } - } - - closedir(d); - return ret; -} - -int create_oat_dir(const char* oat_dir, const char* instruction_set) -{ - char oat_instr_dir[PKG_PATH_MAX]; - - if (validate_apk_path(oat_dir)) { - ALOGE("invalid apk path '%s' (bad prefix)\n", oat_dir); - return -1; - } - if (fs_prepare_dir(oat_dir, S_IRWXU | S_IRWXG | S_IXOTH, AID_SYSTEM, AID_INSTALL)) { - return -1; - } - if (selinux_android_restorecon(oat_dir, 0)) { - ALOGE("cannot restorecon dir '%s': %s\n", oat_dir, strerror(errno)); - return -1; - } - snprintf(oat_instr_dir, PKG_PATH_MAX, "%s/%s", oat_dir, instruction_set); - if (fs_prepare_dir(oat_instr_dir, S_IRWXU | S_IRWXG | S_IXOTH, AID_SYSTEM, AID_INSTALL)) { - return -1; - } - return 0; -} - -int rm_package_dir(const char* apk_path) -{ - if (validate_apk_path(apk_path)) { - ALOGE("invalid apk path '%s' (bad prefix)\n", apk_path); - return -1; - } - return delete_dir_contents(apk_path, 1 /* also_delete_dir */ , NULL /* exclusion_predicate */); -} - -int link_file(const char* relative_path, const char* from_base, const char* to_base) { - char from_path[PKG_PATH_MAX]; - char to_path[PKG_PATH_MAX]; - snprintf(from_path, PKG_PATH_MAX, "%s/%s", from_base, relative_path); - snprintf(to_path, PKG_PATH_MAX, "%s/%s", to_base, relative_path); - - if (validate_apk_path_subdirs(from_path)) { - ALOGE("invalid app data sub-path '%s' (bad prefix)\n", from_path); - return -1; - } - - if (validate_apk_path_subdirs(to_path)) { - ALOGE("invalid app data sub-path '%s' (bad prefix)\n", to_path); - return -1; - } - - const int ret = link(from_path, to_path); - if (ret < 0) { - ALOGE("link(%s, %s) failed : %s", from_path, to_path, strerror(errno)); - return -1; - } - - return 0; -} - -int calculate_oat_file_path(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, - const char *instruction_set) { - char *file_name_start; - char *file_name_end; - - file_name_start = strrchr(apk_path, '/'); - if (file_name_start == NULL) { - ALOGE("apk_path '%s' has no '/'s in it\n", apk_path); - return -1; - } - file_name_end = strrchr(apk_path, '.'); - if (file_name_end < file_name_start) { - ALOGE("apk_path '%s' has no extension\n", apk_path); - return -1; - } - - // Calculate file_name - int file_name_len = file_name_end - file_name_start - 1; - char file_name[file_name_len + 1]; - memcpy(file_name, file_name_start + 1, file_name_len); - file_name[file_name_len] = '\0'; - - // /oat//.odex - snprintf(path, PKG_PATH_MAX, "%s/%s/%s.odex", oat_dir, instruction_set, file_name); - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/installd.cpp android-platform-frameworks-native-21/cmds/installd/installd.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/installd.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/installd.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,737 +0,0 @@ -/* -** Copyright 2008, 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 "installd.h" - -#include - -#include -#include -#include -#include - -#define BUFFER_MAX 1024 /* input buffer for commands */ -#define TOKEN_MAX 16 /* max number of arguments in buffer */ -#define REPLY_MAX 256 /* largest reply allowed */ - -static char* parse_null(char* arg) { - if (strcmp(arg, "!") == 0) { - return nullptr; - } else { - return arg; - } -} - -static int do_ping(char **arg __unused, char reply[REPLY_MAX] __unused) -{ - return 0; -} - -static int do_install(char **arg, char reply[REPLY_MAX] __unused) -{ - return install(parse_null(arg[0]), arg[1], atoi(arg[2]), atoi(arg[3]), arg[4]); /* uuid, pkgname, uid, gid, seinfo */ -} - -static int do_dexopt(char **arg, char reply[REPLY_MAX] __unused) -{ - /* apk_path, uid, is_public, pkgname, instruction_set, - * dexopt_needed, vm_safe_mode, debuggable, oat_dir, boot_complete */ - return dexopt(arg[0], atoi(arg[1]), atoi(arg[2]), arg[3], arg[4], atoi(arg[5]), - atoi(arg[6]), atoi(arg[7]), arg[8], atoi(arg[9])); -} - -static int do_mark_boot_complete(char **arg, char reply[REPLY_MAX] __unused) -{ - return mark_boot_complete(arg[0] /* instruction set */); -} - -static int do_move_dex(char **arg, char reply[REPLY_MAX] __unused) -{ - return move_dex(arg[0], arg[1], arg[2]); /* src, dst, instruction_set */ -} - -static int do_rm_dex(char **arg, char reply[REPLY_MAX] __unused) -{ - return rm_dex(arg[0], arg[1]); /* pkgname, instruction_set */ -} - -static int do_remove(char **arg, char reply[REPLY_MAX] __unused) -{ - return uninstall(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */ -} - -static int do_rename(char **arg, char reply[REPLY_MAX] __unused) -{ - return renamepkg(arg[0], arg[1]); /* oldpkgname, newpkgname */ -} - -static int do_fixuid(char **arg, char reply[REPLY_MAX] __unused) -{ - return fix_uid(parse_null(arg[0]), arg[1], atoi(arg[2]), atoi(arg[3])); /* uuid, pkgname, uid, gid */ -} - -static int do_free_cache(char **arg, char reply[REPLY_MAX] __unused) /* TODO int:free_size */ -{ - return free_cache(parse_null(arg[0]), (int64_t)atoll(arg[1])); /* uuid, free_size */ -} - -static int do_rm_cache(char **arg, char reply[REPLY_MAX] __unused) -{ - return delete_cache(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */ -} - -static int do_rm_code_cache(char **arg, char reply[REPLY_MAX] __unused) -{ - return delete_code_cache(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */ -} - -static int do_get_size(char **arg, char reply[REPLY_MAX]) -{ - int64_t codesize = 0; - int64_t datasize = 0; - int64_t cachesize = 0; - int64_t asecsize = 0; - int res = 0; - - /* uuid, pkgdir, userid, apkpath */ - res = get_size(parse_null(arg[0]), arg[1], atoi(arg[2]), arg[3], arg[4], arg[5], arg[6], - arg[7], &codesize, &datasize, &cachesize, &asecsize); - - /* - * Each int64_t can take up 22 characters printed out. Make sure it - * doesn't go over REPLY_MAX in the future. - */ - snprintf(reply, REPLY_MAX, "%" PRId64 " %" PRId64 " %" PRId64 " %" PRId64, - codesize, datasize, cachesize, asecsize); - return res; -} - -static int do_rm_user_data(char **arg, char reply[REPLY_MAX] __unused) -{ - return delete_user_data(parse_null(arg[0]), arg[1], atoi(arg[2])); /* uuid, pkgname, userid */ -} - -static int do_cp_complete_app(char **arg, char reply[REPLY_MAX] __unused) -{ - // from_uuid, to_uuid, package_name, data_app_name, appid, seinfo - return copy_complete_app(parse_null(arg[0]), parse_null(arg[1]), arg[2], arg[3], atoi(arg[4]), arg[5]); -} - -static int do_mk_user_data(char **arg, char reply[REPLY_MAX] __unused) -{ - return make_user_data(parse_null(arg[0]), arg[1], atoi(arg[2]), atoi(arg[3]), arg[4]); - /* uuid, pkgname, uid, userid, seinfo */ -} - -static int do_mk_user_config(char **arg, char reply[REPLY_MAX] __unused) -{ - return make_user_config(atoi(arg[0])); /* userid */ -} - -static int do_rm_user(char **arg, char reply[REPLY_MAX] __unused) -{ - return delete_user(parse_null(arg[0]), atoi(arg[1])); /* uuid, userid */ -} - -static int do_movefiles(char **arg __unused, char reply[REPLY_MAX] __unused) -{ - return movefiles(); -} - -static int do_linklib(char **arg, char reply[REPLY_MAX] __unused) -{ - return linklib(parse_null(arg[0]), arg[1], arg[2], atoi(arg[3])); -} - -static int do_idmap(char **arg, char reply[REPLY_MAX] __unused) -{ - return idmap(arg[0], arg[1], atoi(arg[2])); -} - -static int do_restorecon_data(char **arg, char reply[REPLY_MAX] __attribute__((unused))) -{ - return restorecon_data(parse_null(arg[0]), arg[1], arg[2], atoi(arg[3])); - /* uuid, pkgName, seinfo, uid*/ -} - -static int do_create_oat_dir(char **arg, char reply[REPLY_MAX] __unused) -{ - /* oat_dir, instruction_set */ - return create_oat_dir(arg[0], arg[1]); -} - -static int do_rm_package_dir(char **arg, char reply[REPLY_MAX] __unused) -{ - /* oat_dir */ - return rm_package_dir(arg[0]); -} - -static int do_link_file(char **arg, char reply[REPLY_MAX] __unused) -{ - /* relative_path, from_base, to_base */ - return link_file(arg[0], arg[1], arg[2]); -} - -struct cmdinfo { - const char *name; - unsigned numargs; - int (*func)(char **arg, char reply[REPLY_MAX]); -}; - -struct cmdinfo cmds[] = { - { "ping", 0, do_ping }, - { "install", 5, do_install }, - { "dexopt", 10, do_dexopt }, - { "markbootcomplete", 1, do_mark_boot_complete }, - { "movedex", 3, do_move_dex }, - { "rmdex", 2, do_rm_dex }, - { "remove", 3, do_remove }, - { "rename", 2, do_rename }, - { "fixuid", 4, do_fixuid }, - { "freecache", 2, do_free_cache }, - { "rmcache", 3, do_rm_cache }, - { "rmcodecache", 3, do_rm_code_cache }, - { "getsize", 8, do_get_size }, - { "rmuserdata", 3, do_rm_user_data }, - { "cpcompleteapp", 6, do_cp_complete_app }, - { "movefiles", 0, do_movefiles }, - { "linklib", 4, do_linklib }, - { "mkuserdata", 5, do_mk_user_data }, - { "mkuserconfig", 1, do_mk_user_config }, - { "rmuser", 2, do_rm_user }, - { "idmap", 3, do_idmap }, - { "restorecondata", 4, do_restorecon_data }, - { "createoatdir", 2, do_create_oat_dir }, - { "rmpackagedir", 1, do_rm_package_dir }, - { "linkfile", 3, do_link_file } -}; - -static int readx(int s, void *_buf, int count) -{ - char *buf = (char *) _buf; - int n = 0, r; - if (count < 0) return -1; - while (n < count) { - r = read(s, buf + n, count - n); - if (r < 0) { - if (errno == EINTR) continue; - ALOGE("read error: %s\n", strerror(errno)); - return -1; - } - if (r == 0) { - ALOGE("eof\n"); - return -1; /* EOF */ - } - n += r; - } - return 0; -} - -static int writex(int s, const void *_buf, int count) -{ - const char *buf = (const char *) _buf; - int n = 0, r; - if (count < 0) return -1; - while (n < count) { - r = write(s, buf + n, count - n); - if (r < 0) { - if (errno == EINTR) continue; - ALOGE("write error: %s\n", strerror(errno)); - return -1; - } - n += r; - } - return 0; -} - - -/* Tokenize the command buffer, locate a matching command, - * ensure that the required number of arguments are provided, - * call the function(), return the result. - */ -static int execute(int s, char cmd[BUFFER_MAX]) -{ - char reply[REPLY_MAX]; - char *arg[TOKEN_MAX+1]; - unsigned i; - unsigned n = 0; - unsigned short count; - int ret = -1; - - // ALOGI("execute('%s')\n", cmd); - - /* default reply is "" */ - reply[0] = 0; - - /* n is number of args (not counting arg[0]) */ - arg[0] = cmd; - while (*cmd) { - if (isspace(*cmd)) { - *cmd++ = 0; - n++; - arg[n] = cmd; - if (n == TOKEN_MAX) { - ALOGE("too many arguments\n"); - goto done; - } - } - if (*cmd) { - cmd++; - } - } - - for (i = 0; i < sizeof(cmds) / sizeof(cmds[0]); i++) { - if (!strcmp(cmds[i].name,arg[0])) { - if (n != cmds[i].numargs) { - ALOGE("%s requires %d arguments (%d given)\n", - cmds[i].name, cmds[i].numargs, n); - } else { - ret = cmds[i].func(arg + 1, reply); - } - goto done; - } - } - ALOGE("unsupported command '%s'\n", arg[0]); - -done: - if (reply[0]) { - n = snprintf(cmd, BUFFER_MAX, "%d %s", ret, reply); - } else { - n = snprintf(cmd, BUFFER_MAX, "%d", ret); - } - if (n > BUFFER_MAX) n = BUFFER_MAX; - count = n; - - // ALOGI("reply: '%s'\n", cmd); - if (writex(s, &count, sizeof(count))) return -1; - if (writex(s, cmd, count)) return -1; - return 0; -} - -/** - * Initialize all the global variables that are used elsewhere. Returns 0 upon - * success and -1 on error. - */ -void free_globals() { - size_t i; - - for (i = 0; i < android_system_dirs.count; i++) { - if (android_system_dirs.dirs[i].path != NULL) { - free(android_system_dirs.dirs[i].path); - } - } - - free(android_system_dirs.dirs); -} - -int initialize_globals() { - // Get the android data directory. - if (get_path_from_env(&android_data_dir, "ANDROID_DATA") < 0) { - return -1; - } - - // Get the android app directory. - if (copy_and_append(&android_app_dir, &android_data_dir, APP_SUBDIR) < 0) { - return -1; - } - - // Get the android protected app directory. - if (copy_and_append(&android_app_private_dir, &android_data_dir, PRIVATE_APP_SUBDIR) < 0) { - return -1; - } - - // Get the android app native library directory. - if (copy_and_append(&android_app_lib_dir, &android_data_dir, APP_LIB_SUBDIR) < 0) { - return -1; - } - - // Get the sd-card ASEC mount point. - if (get_path_from_env(&android_asec_dir, "ASEC_MOUNTPOINT") < 0) { - return -1; - } - - // Get the android media directory. - if (copy_and_append(&android_media_dir, &android_data_dir, MEDIA_SUBDIR) < 0) { - return -1; - } - - // Get the android external app directory. - if (get_path_from_string(&android_mnt_expand_dir, "/mnt/expand/") < 0) { - return -1; - } - - // Take note of the system and vendor directories. - android_system_dirs.count = 4; - - android_system_dirs.dirs = (dir_rec_t*) calloc(android_system_dirs.count, sizeof(dir_rec_t)); - if (android_system_dirs.dirs == NULL) { - ALOGE("Couldn't allocate array for dirs; aborting\n"); - return -1; - } - - dir_rec_t android_root_dir; - if (get_path_from_env(&android_root_dir, "ANDROID_ROOT") < 0) { - ALOGE("Missing ANDROID_ROOT; aborting\n"); - return -1; - } - - android_system_dirs.dirs[0].path = build_string2(android_root_dir.path, APP_SUBDIR); - android_system_dirs.dirs[0].len = strlen(android_system_dirs.dirs[0].path); - - android_system_dirs.dirs[1].path = build_string2(android_root_dir.path, PRIV_APP_SUBDIR); - android_system_dirs.dirs[1].len = strlen(android_system_dirs.dirs[1].path); - - android_system_dirs.dirs[2].path = strdup("/vendor/app/"); - android_system_dirs.dirs[2].len = strlen(android_system_dirs.dirs[2].path); - - android_system_dirs.dirs[3].path = strdup("/oem/app/"); - android_system_dirs.dirs[3].len = strlen(android_system_dirs.dirs[3].path); - - return 0; -} - -int initialize_directories() { - int res = -1; - - // Read current filesystem layout version to handle upgrade paths - char version_path[PATH_MAX]; - snprintf(version_path, PATH_MAX, "%s.layout_version", android_data_dir.path); - - int oldVersion; - if (fs_read_atomic_int(version_path, &oldVersion) == -1) { - oldVersion = 0; - } - int version = oldVersion; - - // /data/user - char *user_data_dir = build_string2(android_data_dir.path, SECONDARY_USER_PREFIX); - // /data/data - char *legacy_data_dir = build_string2(android_data_dir.path, PRIMARY_USER_PREFIX); - // /data/user/0 - char *primary_data_dir = build_string3(android_data_dir.path, SECONDARY_USER_PREFIX, "0"); - if (!user_data_dir || !legacy_data_dir || !primary_data_dir) { - goto fail; - } - - // Make the /data/user directory if necessary - if (access(user_data_dir, R_OK) < 0) { - if (mkdir(user_data_dir, 0711) < 0) { - goto fail; - } - if (chown(user_data_dir, AID_SYSTEM, AID_SYSTEM) < 0) { - goto fail; - } - if (chmod(user_data_dir, 0711) < 0) { - goto fail; - } - } - // Make the /data/user/0 symlink to /data/data if necessary - if (access(primary_data_dir, R_OK) < 0) { - if (symlink(legacy_data_dir, primary_data_dir)) { - goto fail; - } - } - - if (version == 0) { - // Introducing multi-user, so migrate /data/media contents into /data/media/0 - ALOGD("Upgrading /data/media for multi-user"); - - // Ensure /data/media - if (fs_prepare_dir(android_media_dir.path, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { - goto fail; - } - - // /data/media.tmp - char media_tmp_dir[PATH_MAX]; - snprintf(media_tmp_dir, PATH_MAX, "%smedia.tmp", android_data_dir.path); - - // Only copy when upgrade not already in progress - if (access(media_tmp_dir, F_OK) == -1) { - if (rename(android_media_dir.path, media_tmp_dir) == -1) { - ALOGE("Failed to move legacy media path: %s", strerror(errno)); - goto fail; - } - } - - // Create /data/media again - if (fs_prepare_dir(android_media_dir.path, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { - goto fail; - } - - if (selinux_android_restorecon(android_media_dir.path, 0)) { - goto fail; - } - - // /data/media/0 - char owner_media_dir[PATH_MAX]; - snprintf(owner_media_dir, PATH_MAX, "%s0", android_media_dir.path); - - // Move any owner data into place - if (access(media_tmp_dir, F_OK) == 0) { - if (rename(media_tmp_dir, owner_media_dir) == -1) { - ALOGE("Failed to move owner media path: %s", strerror(errno)); - goto fail; - } - } - - // Ensure media directories for any existing users - DIR *dir; - struct dirent *dirent; - char user_media_dir[PATH_MAX]; - - dir = opendir(user_data_dir); - if (dir != NULL) { - while ((dirent = readdir(dir))) { - if (dirent->d_type == DT_DIR) { - const char *name = dirent->d_name; - - // skip "." and ".." - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - - // /data/media/ - snprintf(user_media_dir, PATH_MAX, "%s%s", android_media_dir.path, name); - if (fs_prepare_dir(user_media_dir, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { - goto fail; - } - } - } - closedir(dir); - } - - version = 1; - } - - // /data/media/obb - char media_obb_dir[PATH_MAX]; - snprintf(media_obb_dir, PATH_MAX, "%sobb", android_media_dir.path); - - if (version == 1) { - // Introducing /data/media/obb for sharing OBB across users; migrate - // any existing OBB files from owner. - ALOGD("Upgrading to shared /data/media/obb"); - - // /data/media/0/Android/obb - char owner_obb_path[PATH_MAX]; - snprintf(owner_obb_path, PATH_MAX, "%s0/Android/obb", android_media_dir.path); - - // Only move if target doesn't already exist - if (access(media_obb_dir, F_OK) != 0 && access(owner_obb_path, F_OK) == 0) { - if (rename(owner_obb_path, media_obb_dir) == -1) { - ALOGE("Failed to move OBB from owner: %s", strerror(errno)); - goto fail; - } - } - - version = 2; - } - - if (ensure_media_user_dirs(nullptr, 0) == -1) { - ALOGE("Failed to setup media for user 0"); - goto fail; - } - if (fs_prepare_dir(media_obb_dir, 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { - goto fail; - } - - if (ensure_config_user_dirs(0) == -1) { - ALOGE("Failed to setup misc for user 0"); - goto fail; - } - - if (version == 2) { - ALOGD("Upgrading to /data/misc/user directories"); - - char misc_dir[PATH_MAX]; - snprintf(misc_dir, PATH_MAX, "%smisc", android_data_dir.path); - - char keychain_added_dir[PATH_MAX]; - snprintf(keychain_added_dir, PATH_MAX, "%s/keychain/cacerts-added", misc_dir); - - char keychain_removed_dir[PATH_MAX]; - snprintf(keychain_removed_dir, PATH_MAX, "%s/keychain/cacerts-removed", misc_dir); - - DIR *dir; - struct dirent *dirent; - dir = opendir(user_data_dir); - if (dir != NULL) { - while ((dirent = readdir(dir))) { - const char *name = dirent->d_name; - - // skip "." and ".." - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - - uint32_t user_id = atoi(name); - - // /data/misc/user/ - if (ensure_config_user_dirs(user_id) == -1) { - goto fail; - } - - char misc_added_dir[PATH_MAX]; - snprintf(misc_added_dir, PATH_MAX, "%s/user/%s/cacerts-added", misc_dir, name); - - char misc_removed_dir[PATH_MAX]; - snprintf(misc_removed_dir, PATH_MAX, "%s/user/%s/cacerts-removed", misc_dir, name); - - uid_t uid = multiuser_get_uid(user_id, AID_SYSTEM); - gid_t gid = uid; - if (access(keychain_added_dir, F_OK) == 0) { - if (copy_dir_files(keychain_added_dir, misc_added_dir, uid, gid) != 0) { - ALOGE("Some files failed to copy"); - } - } - if (access(keychain_removed_dir, F_OK) == 0) { - if (copy_dir_files(keychain_removed_dir, misc_removed_dir, uid, gid) != 0) { - ALOGE("Some files failed to copy"); - } - } - } - closedir(dir); - - if (access(keychain_added_dir, F_OK) == 0) { - delete_dir_contents(keychain_added_dir, 1, 0); - } - if (access(keychain_removed_dir, F_OK) == 0) { - delete_dir_contents(keychain_removed_dir, 1, 0); - } - } - - version = 3; - } - - // Persist layout version if changed - if (version != oldVersion) { - if (fs_write_atomic_int(version_path, version) == -1) { - ALOGE("Failed to save version to %s: %s", version_path, strerror(errno)); - goto fail; - } - } - - // Success! - res = 0; - -fail: - free(user_data_dir); - free(legacy_data_dir); - free(primary_data_dir); - return res; -} - -static int log_callback(int type, const char *fmt, ...) { - va_list ap; - int priority; - - switch (type) { - case SELINUX_WARNING: - priority = ANDROID_LOG_WARN; - break; - case SELINUX_INFO: - priority = ANDROID_LOG_INFO; - break; - default: - priority = ANDROID_LOG_ERROR; - break; - } - va_start(ap, fmt); - LOG_PRI_VA(priority, "SELinux", fmt, ap); - va_end(ap); - return 0; -} - -int main(const int argc __unused, char *argv[]) { - char buf[BUFFER_MAX]; - struct sockaddr addr; - socklen_t alen; - int lsocket, s; - int selinux_enabled = (is_selinux_enabled() > 0); - - setenv("ANDROID_LOG_TAGS", "*:v", 1); - android::base::InitLogging(argv); - - ALOGI("installd firing up\n"); - - union selinux_callback cb; - cb.func_log = log_callback; - selinux_set_callback(SELINUX_CB_LOG, cb); - - if (initialize_globals() < 0) { - ALOGE("Could not initialize globals; exiting.\n"); - exit(1); - } - - if (initialize_directories() < 0) { - ALOGE("Could not create directories; exiting.\n"); - exit(1); - } - - if (selinux_enabled && selinux_status_open(true) < 0) { - ALOGE("Could not open selinux status; exiting.\n"); - exit(1); - } - - lsocket = android_get_control_socket(SOCKET_PATH); - if (lsocket < 0) { - ALOGE("Failed to get socket from environment: %s\n", strerror(errno)); - exit(1); - } - if (listen(lsocket, 5)) { - ALOGE("Listen on socket failed: %s\n", strerror(errno)); - exit(1); - } - fcntl(lsocket, F_SETFD, FD_CLOEXEC); - - for (;;) { - alen = sizeof(addr); - s = accept(lsocket, &addr, &alen); - if (s < 0) { - ALOGE("Accept failed: %s\n", strerror(errno)); - continue; - } - fcntl(s, F_SETFD, FD_CLOEXEC); - - ALOGI("new connection\n"); - for (;;) { - unsigned short count; - if (readx(s, &count, sizeof(count))) { - ALOGE("failed to read size\n"); - break; - } - if ((count < 1) || (count >= BUFFER_MAX)) { - ALOGE("invalid size %d\n", count); - break; - } - if (readx(s, buf, count)) { - ALOGE("failed to read command\n"); - break; - } - buf[count] = 0; - if (selinux_enabled && selinux_status_updated() > 0) { - selinux_android_seapp_context_reload(); - } - if (execute(s, buf)) break; - } - ALOGI("closing connection\n"); - close(s); - } - - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/installd.h android-platform-frameworks-native-21/cmds/installd/installd.h --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/installd.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/installd.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,258 +0,0 @@ -/* -** -** Copyright 2008, 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. -*/ - -#define LOG_TAG "installd" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#include - -#if defined(__APPLE__) -#include -#else -#include -#endif - -#define SOCKET_PATH "installd" - - -/* elements combined with a valid package name to form paths */ - -#define PRIMARY_USER_PREFIX "data/" -#define SECONDARY_USER_PREFIX "user/" - -#define PKG_DIR_POSTFIX "" - -#define PKG_LIB_POSTFIX "/lib" - -#define CACHE_DIR_POSTFIX "/cache" -#define CODE_CACHE_DIR_POSTFIX "/code_cache" - -#define APP_SUBDIR "app/" // sub-directory under ANDROID_DATA -#define PRIV_APP_SUBDIR "priv-app/" // sub-directory under ANDROID_DATA - -#define APP_LIB_SUBDIR "app-lib/" // sub-directory under ANDROID_DATA - -#define MEDIA_SUBDIR "media/" // sub-directory under ANDROID_DATA - -/* other handy constants */ - -#define PRIVATE_APP_SUBDIR "app-private/" // sub-directory under ANDROID_DATA - -#define DALVIK_CACHE_PREFIX "/data/dalvik-cache/" -#define DALVIK_CACHE_POSTFIX "/classes.dex" - -#define UPDATE_COMMANDS_DIR_PREFIX "/system/etc/updatecmds/" - -#define IDMAP_PREFIX "/data/resource-cache/" -#define IDMAP_SUFFIX "@idmap" - -#define PKG_NAME_MAX 128 /* largest allowed package name */ -#define PKG_PATH_MAX 256 /* max size of any path we use */ - -/* dexopt needed flags matching those in dalvik.system.DexFile */ -#define DEXOPT_DEX2OAT_NEEDED 1 -#define DEXOPT_PATCHOAT_NEEDED 2 -#define DEXOPT_SELF_PATCHOAT_NEEDED 3 - -#define ARRAY_SIZE(a) (sizeof(a) / sizeof(*(a))) - -/* data structures */ - -typedef struct { - char* path; - size_t len; -} dir_rec_t; - -typedef struct { - size_t count; - dir_rec_t* dirs; -} dir_rec_array_t; - -extern dir_rec_t android_app_dir; -extern dir_rec_t android_app_private_dir; -extern dir_rec_t android_app_lib_dir; -extern dir_rec_t android_data_dir; -extern dir_rec_t android_asec_dir; -extern dir_rec_t android_media_dir; -extern dir_rec_t android_mnt_expand_dir; -extern dir_rec_array_t android_system_dirs; - -typedef struct cache_dir_struct { - struct cache_dir_struct* parent; - int32_t childCount; - int32_t hiddenCount; - int32_t deleted; - char name[]; -} cache_dir_t; - -typedef struct { - cache_dir_t* dir; - time_t modTime; - char name[]; -} cache_file_t; - -typedef struct { - size_t numDirs; - size_t availDirs; - cache_dir_t** dirs; - size_t numFiles; - size_t availFiles; - cache_file_t** files; - size_t numCollected; - void* memBlocks; - int8_t* curMemBlockAvail; - int8_t* curMemBlockEnd; -} cache_t; - -/* util.c */ - -int create_pkg_path(char path[PKG_PATH_MAX], - const char *pkgname, - const char *postfix, - userid_t userid); - -std::string create_data_path(const char* volume_uuid); - -std::string create_data_app_path(const char* volume_uuid); - -std::string create_data_app_package_path(const char* volume_uuid, const char* package_name); - -std::string create_data_user_path(const char* volume_uuid, userid_t userid); - -std::string create_data_user_package_path(const char* volume_uuid, - userid_t user, const char* package_name); - -std::string create_data_media_path(const char* volume_uuid, userid_t userid); - -std::vector get_known_users(const char* volume_uuid); - -int create_user_config_path(char path[PKG_PATH_MAX], userid_t userid); - -int create_move_path(char path[PKG_PATH_MAX], - const char* pkgname, - const char* leaf, - userid_t userid); - -int is_valid_package_name(const char* pkgname); - -int create_cache_path(char path[PKG_PATH_MAX], const char *src, - const char *instruction_set); - -int delete_dir_contents(const char *pathname, - int also_delete_dir, - int (*exclusion_predicate)(const char *name, const int is_dir)); - -int delete_dir_contents_fd(int dfd, const char *name); - -int copy_dir_files(const char *srcname, const char *dstname, uid_t owner, gid_t group); - -int lookup_media_dir(char basepath[PATH_MAX], const char *dir); - -int64_t data_disk_free(const std::string& data_path); - -cache_t* start_cache_collection(); - -void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir); - -void clear_cache_files(const std::string& data_path, cache_t* cache, int64_t free_size); - -void finish_cache_collection(cache_t* cache); - -int validate_system_app_path(const char* path); - -int get_path_from_env(dir_rec_t* rec, const char* var); - -int get_path_from_string(dir_rec_t* rec, const char* path); - -int copy_and_append(dir_rec_t* dst, const dir_rec_t* src, const char* suffix); - -int validate_apk_path(const char *path); -int validate_apk_path_subdirs(const char *path); - -int append_and_increment(char** dst, const char* src, size_t* dst_size); - -char *build_string2(const char *s1, const char *s2); -char *build_string3(const char *s1, const char *s2, const char *s3); - -int ensure_dir(const char* path, mode_t mode, uid_t uid, gid_t gid); -int ensure_media_user_dirs(const char* uuid, userid_t userid); -int ensure_config_user_dirs(userid_t userid); -int create_profile_file(const char *pkgname, gid_t gid); -void remove_profile_file(const char *pkgname); - -/* commands.c */ - -int install(const char *uuid, const char *pkgname, uid_t uid, gid_t gid, const char *seinfo); -int uninstall(const char *uuid, const char *pkgname, userid_t userid); -int renamepkg(const char *oldpkgname, const char *newpkgname); -int fix_uid(const char *uuid, const char *pkgname, uid_t uid, gid_t gid); -int delete_user_data(const char *uuid, const char *pkgname, userid_t userid); -int make_user_data(const char *uuid, const char *pkgname, uid_t uid, - userid_t userid, const char* seinfo); -int copy_complete_app(const char* from_uuid, const char *to_uuid, - const char *package_name, const char *data_app_name, appid_t appid, - const char* seinfo); -int make_user_config(userid_t userid); -int delete_user(const char *uuid, userid_t userid); -int delete_cache(const char *uuid, const char *pkgname, userid_t userid); -int delete_code_cache(const char *uuid, const char *pkgname, userid_t userid); -int move_dex(const char *src, const char *dst, const char *instruction_set); -int rm_dex(const char *path, const char *instruction_set); -int protect(char *pkgname, gid_t gid); -int get_size(const char *uuid, const char *pkgname, int userid, - const char *apkpath, const char *libdirpath, - const char *fwdlock_apkpath, const char *asecpath, - const char *instruction_set, int64_t *codesize, int64_t *datasize, - int64_t *cachesize, int64_t *asecsize); -int free_cache(const char *uuid, int64_t free_size); -int dexopt(const char *apk_path, uid_t uid, bool is_public, const char *pkgName, - const char *instruction_set, int dexopt_needed, bool vm_safe_mode, - bool debuggable, const char* oat_dir, bool boot_complete); -int mark_boot_complete(const char *instruction_set); -int movefiles(); -int linklib(const char* uuid, const char* pkgname, const char* asecLibDir, int userId); -int idmap(const char *target_path, const char *overlay_path, uid_t uid); -int restorecon_data(const char *uuid, const char* pkgName, const char* seinfo, uid_t uid); -int create_oat_dir(const char* oat_dir, const char *instruction_set); -int rm_package_dir(const char* apk_path); -int calculate_oat_file_path(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, - const char *instruction_set); -int move_package_dir(char path[PKG_PATH_MAX], const char *oat_dir, const char *apk_path, - const char *instruction_set); -int link_file(const char *relative_path, const char *from_base, const char *to_base); diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/tests/Android.mk android-platform-frameworks-native-21/cmds/installd/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/tests/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -# Build the unit tests for installd -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - -# Build the unit tests. -test_src_files := \ - installd_utils_test.cpp - -shared_libraries := \ - libbase \ - libutils \ - libcutils \ - -static_libraries := \ - libinstalld \ - libdiskusage \ - -c_includes := \ - frameworks/native/cmds/installd - -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_C_INCLUDES := $(c_includes)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval LOCAL_CLANG := true) \ - $(eval include $(BUILD_NATIVE_TEST)) \ -) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/tests/installd_utils_test.cpp android-platform-frameworks-native-21/cmds/installd/tests/installd_utils_test.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/tests/installd_utils_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/tests/installd_utils_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,502 +0,0 @@ -/* - * 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 -#include - -#include - -#include "installd.h" - -#undef LOG_TAG -#define LOG_TAG "utils_test" - -#define TEST_DATA_DIR "/data/" -#define TEST_APP_DIR "/data/app/" -#define TEST_APP_PRIVATE_DIR "/data/app-private/" -#define TEST_ASEC_DIR "/mnt/asec/" -#define TEST_EXPAND_DIR "/mnt/expand/" - -#define TEST_SYSTEM_DIR1 "/system/app/" -#define TEST_SYSTEM_DIR2 "/vendor/app/" - -#define REALLY_LONG_APP_NAME "com.example." \ - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa." \ - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa." \ - "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa" - -#define REALLY_LONG_LEAF_NAME "shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_" \ - "shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_" \ - "shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_" \ - "shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_shared_prefs_" - -namespace android { - -class UtilsTest : public testing::Test { -protected: - virtual void SetUp() { - android_app_dir.path = (char*) TEST_APP_DIR; - android_app_dir.len = strlen(TEST_APP_DIR); - - android_app_private_dir.path = (char*) TEST_APP_PRIVATE_DIR; - android_app_private_dir.len = strlen(TEST_APP_PRIVATE_DIR); - - android_data_dir.path = (char*) TEST_DATA_DIR; - android_data_dir.len = strlen(TEST_DATA_DIR); - - android_asec_dir.path = (char*) TEST_ASEC_DIR; - android_asec_dir.len = strlen(TEST_ASEC_DIR); - - android_mnt_expand_dir.path = (char*) TEST_EXPAND_DIR; - android_mnt_expand_dir.len = strlen(TEST_EXPAND_DIR); - - android_system_dirs.count = 2; - - android_system_dirs.dirs = (dir_rec_t*) calloc(android_system_dirs.count, sizeof(dir_rec_t)); - android_system_dirs.dirs[0].path = (char*) TEST_SYSTEM_DIR1; - android_system_dirs.dirs[0].len = strlen(TEST_SYSTEM_DIR1); - - android_system_dirs.dirs[1].path = (char*) TEST_SYSTEM_DIR2; - android_system_dirs.dirs[1].len = strlen(TEST_SYSTEM_DIR2); - } - - virtual void TearDown() { - free(android_system_dirs.dirs); - } -}; - -TEST_F(UtilsTest, IsValidApkPath_BadPrefix) { - // Bad prefixes directories - const char *badprefix1 = "/etc/passwd"; - EXPECT_EQ(-1, validate_apk_path(badprefix1)) - << badprefix1 << " should be allowed as a valid path"; - - const char *badprefix2 = "../.." TEST_APP_DIR "../../../blah"; - EXPECT_EQ(-1, validate_apk_path(badprefix2)) - << badprefix2 << " should be allowed as a valid path"; - - const char *badprefix3 = "init.rc"; - EXPECT_EQ(-1, validate_apk_path(badprefix3)) - << badprefix3 << " should be allowed as a valid path"; - - const char *badprefix4 = "/init.rc"; - EXPECT_EQ(-1, validate_apk_path(badprefix4)) - << badprefix4 << " should be allowed as a valid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_Internal) { - // Internal directories - const char *internal1 = TEST_APP_DIR "example.apk"; - EXPECT_EQ(0, validate_apk_path(internal1)) - << internal1 << " should be allowed as a valid path"; - - // b/16888084 - const char *path2 = TEST_APP_DIR "example.com/example.apk"; - EXPECT_EQ(0, validate_apk_path(path2)) - << path2 << " should be allowed as a valid path"; - - const char *badint1 = TEST_APP_DIR "../example.apk"; - EXPECT_EQ(-1, validate_apk_path(badint1)) - << badint1 << " should be rejected as a invalid path"; - - const char *badint2 = TEST_APP_DIR "/../example.apk"; - EXPECT_EQ(-1, validate_apk_path(badint2)) - << badint2 << " should be rejected as a invalid path"; - - // Only one subdir should be allowed. - const char *bad_path3 = TEST_APP_DIR "example.com/subdir/pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(bad_path3)) - << bad_path3 << " should be rejected as a invalid path"; - - const char *bad_path4 = TEST_APP_DIR "example.com/subdir/../pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(bad_path4)) - << bad_path4 << " should be rejected as a invalid path"; - - const char *bad_path5 = TEST_APP_DIR "example.com1/../example.com2/pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(bad_path5)) - << bad_path5 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_Private) { - // Internal directories - const char *private1 = TEST_APP_PRIVATE_DIR "example.apk"; - EXPECT_EQ(0, validate_apk_path(private1)) - << private1 << " should be allowed as a valid path"; - - // b/16888084 - const char *path2 = TEST_APP_DIR "example.com/example.apk"; - EXPECT_EQ(0, validate_apk_path(path2)) - << path2 << " should be allowed as a valid path"; - - const char *badpriv1 = TEST_APP_PRIVATE_DIR "../example.apk"; - EXPECT_EQ(-1, validate_apk_path(badpriv1)) - << badpriv1 << " should be rejected as a invalid path"; - - const char *badpriv2 = TEST_APP_PRIVATE_DIR "/../example.apk"; - EXPECT_EQ(-1, validate_apk_path(badpriv2)) - << badpriv2 << " should be rejected as a invalid path"; - - // Only one subdir should be allowed. - const char *bad_path3 = TEST_APP_PRIVATE_DIR "example.com/subdir/pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(bad_path3)) - << bad_path3 << " should be rejected as a invalid path"; - - const char *bad_path4 = TEST_APP_PRIVATE_DIR "example.com/subdir/../pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(bad_path4)) - << bad_path4 << " should be rejected as a invalid path"; - - const char *bad_path5 = TEST_APP_PRIVATE_DIR "example.com1/../example.com2/pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(bad_path5)) - << bad_path5 << " should be rejected as a invalid path"; -} - - -TEST_F(UtilsTest, IsValidApkPath_AsecGood1) { - const char *asec1 = TEST_ASEC_DIR "example.apk"; - EXPECT_EQ(0, validate_apk_path(asec1)) - << asec1 << " should be allowed as a valid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_AsecGood2) { - const char *asec2 = TEST_ASEC_DIR "com.example.asec/pkg.apk"; - EXPECT_EQ(0, validate_apk_path(asec2)) - << asec2 << " should be allowed as a valid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_EscapeFail) { - const char *badasec1 = TEST_ASEC_DIR "../example.apk"; - EXPECT_EQ(-1, validate_apk_path(badasec1)) - << badasec1 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_DoubleSlashFail) { - const char *badasec2 = TEST_ASEC_DIR "com.example.asec//pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(badasec2)) - << badasec2 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_SubdirEscapeFail) { - const char *badasec3 = TEST_ASEC_DIR "com.example.asec/../../../pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(badasec3)) - << badasec3 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_SlashEscapeFail) { - const char *badasec4 = TEST_ASEC_DIR "/../example.apk"; - EXPECT_EQ(-1, validate_apk_path(badasec4)) - << badasec4 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_CrazyDirFail) { - const char *badasec5 = TEST_ASEC_DIR ".//../.."; - EXPECT_EQ(-1, validate_apk_path(badasec5)) - << badasec5 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_SubdirEscapeSingleFail) { - const char *badasec6 = TEST_ASEC_DIR "com.example.asec/../pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(badasec6)) - << badasec6 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, IsValidApkPath_TwoSubdirFail) { - const char *badasec7 = TEST_ASEC_DIR "com.example.asec/subdir1/pkg.apk"; - EXPECT_EQ(-1, validate_apk_path(badasec7)) - << badasec7 << " should be rejected as a invalid path"; -} - -TEST_F(UtilsTest, CheckSystemApp_Dir1) { - const char *sysapp1 = TEST_SYSTEM_DIR1 "Voice.apk"; - EXPECT_EQ(0, validate_system_app_path(sysapp1)) - << sysapp1 << " should be allowed as a system path"; -} - -TEST_F(UtilsTest, CheckSystemApp_Dir2) { - const char *sysapp2 = TEST_SYSTEM_DIR2 "com.example.myapp.apk"; - EXPECT_EQ(0, validate_system_app_path(sysapp2)) - << sysapp2 << " should be allowed as a system path"; -} - -TEST_F(UtilsTest, CheckSystemApp_EscapeFail) { - const char *badapp1 = TEST_SYSTEM_DIR1 "../com.example.apk"; - EXPECT_EQ(-1, validate_system_app_path(badapp1)) - << badapp1 << " should be rejected not a system path"; -} - -TEST_F(UtilsTest, CheckSystemApp_DoubleEscapeFail) { - const char *badapp2 = TEST_SYSTEM_DIR2 "/../../com.example.apk"; - EXPECT_EQ(-1, validate_system_app_path(badapp2)) - << badapp2 << " should be rejected not a system path"; -} - -TEST_F(UtilsTest, CheckSystemApp_BadPathEscapeFail) { - const char *badapp3 = TEST_APP_DIR "/../../com.example.apk"; - EXPECT_EQ(-1, validate_system_app_path(badapp3)) - << badapp3 << " should be rejected not a system path"; -} - -TEST_F(UtilsTest, CheckSystemApp_Subdir) { - const char *sysapp = TEST_SYSTEM_DIR1 "com.example/com.example.apk"; - EXPECT_EQ(0, validate_system_app_path(sysapp)) - << sysapp << " should be allowed as a system path"; - - const char *badapp = TEST_SYSTEM_DIR1 "com.example/subdir/com.example.apk"; - EXPECT_EQ(-1, validate_system_app_path(badapp)) - << badapp << " should be rejected not a system path"; - - const char *badapp1 = TEST_SYSTEM_DIR1 "com.example/subdir/../com.example.apk"; - EXPECT_EQ(-1, validate_system_app_path(badapp1)) - << badapp1 << " should be rejected not a system path"; - - const char *badapp2 = TEST_SYSTEM_DIR1 "com.example1/../com.example2/com.example.apk"; - EXPECT_EQ(-1, validate_system_app_path(badapp2)) - << badapp2 << " should be rejected not a system path"; -} - -TEST_F(UtilsTest, GetPathFromString_NullPathFail) { - dir_rec_t test1; - EXPECT_EQ(-1, get_path_from_string(&test1, (const char *) NULL)) - << "Should not allow NULL as a path."; -} - -TEST_F(UtilsTest, GetPathFromString_EmptyPathFail) { - dir_rec_t test1; - EXPECT_EQ(-1, get_path_from_string(&test1, "")) - << "Should not allow empty paths."; -} - -TEST_F(UtilsTest, GetPathFromString_RelativePathFail) { - dir_rec_t test1; - EXPECT_EQ(-1, get_path_from_string(&test1, "mnt/asec")) - << "Should not allow relative paths."; -} - -TEST_F(UtilsTest, GetPathFromString_NonCanonical) { - dir_rec_t test1; - - EXPECT_EQ(0, get_path_from_string(&test1, "/mnt/asec")) - << "Should be able to canonicalize directory /mnt/asec"; - EXPECT_STREQ("/mnt/asec/", test1.path) - << "/mnt/asec should be canonicalized to /mnt/asec/"; - EXPECT_EQ(10, (ssize_t) test1.len) - << "path len should be equal to the length of /mnt/asec/ (10)"; - free(test1.path); -} - -TEST_F(UtilsTest, GetPathFromString_CanonicalPath) { - dir_rec_t test3; - EXPECT_EQ(0, get_path_from_string(&test3, "/data/app/")) - << "Should be able to canonicalize directory /data/app/"; - EXPECT_STREQ("/data/app/", test3.path) - << "/data/app/ should be canonicalized to /data/app/"; - EXPECT_EQ(10, (ssize_t) test3.len) - << "path len should be equal to the length of /data/app/ (10)"; - free(test3.path); -} - -TEST_F(UtilsTest, CreatePkgPath_LongPkgNameSuccess) { - char path[PKG_PATH_MAX]; - - // Create long packagename of "aaaaa..." - size_t pkgnameSize = PKG_NAME_MAX; - char pkgname[pkgnameSize + 1]; - memset(pkgname, 'a', pkgnameSize); - pkgname[pkgnameSize] = '\0'; - - EXPECT_EQ(0, create_pkg_path(path, pkgname, "", 0)) - << "Should successfully be able to create package name."; - - const char *prefix = TEST_DATA_DIR PRIMARY_USER_PREFIX; - size_t offset = strlen(prefix); - - EXPECT_STREQ(pkgname, path + offset) - << "Package path should be a really long string of a's"; -} - -TEST_F(UtilsTest, CreatePkgPath_LongPkgNameFail) { - char path[PKG_PATH_MAX]; - - // Create long packagename of "aaaaa..." - size_t pkgnameSize = PKG_NAME_MAX + 1; - char pkgname[pkgnameSize + 1]; - memset(pkgname, 'a', pkgnameSize); - pkgname[pkgnameSize] = '\0'; - - EXPECT_EQ(-1, create_pkg_path(path, pkgname, "", 0)) - << "Should return error because package name is too long."; -} - -TEST_F(UtilsTest, CreatePkgPath_LongPostfixFail) { - char path[PKG_PATH_MAX]; - - // Create long packagename of "aaaaa..." - size_t postfixSize = PKG_PATH_MAX; - char postfix[postfixSize + 1]; - memset(postfix, 'a', postfixSize); - postfix[postfixSize] = '\0'; - - EXPECT_EQ(-1, create_pkg_path(path, "com.example.package", postfix, 0)) - << "Should return error because postfix is too long."; -} - -TEST_F(UtilsTest, CreatePkgPath_PrimaryUser) { - char path[PKG_PATH_MAX]; - - EXPECT_EQ(0, create_pkg_path(path, "com.example.package", "", 0)) - << "Should return error because postfix is too long."; - - EXPECT_STREQ(TEST_DATA_DIR PRIMARY_USER_PREFIX "com.example.package", path) - << "Package path should be in /data/data/"; -} - -TEST_F(UtilsTest, CreatePkgPath_SecondaryUser) { - char path[PKG_PATH_MAX]; - - EXPECT_EQ(0, create_pkg_path(path, "com.example.package", "", 1)) - << "Should successfully create package path."; - - EXPECT_STREQ(TEST_DATA_DIR SECONDARY_USER_PREFIX "1/com.example.package", path) - << "Package path should be in /data/user/"; -} - -TEST_F(UtilsTest, CreateMovePath_Primary) { - char path[PKG_PATH_MAX]; - - EXPECT_EQ(0, create_move_path(path, "com.android.test", "shared_prefs", 0)) - << "Should be able to create move path for primary user"; - - EXPECT_STREQ("/data/data/com.android.test/shared_prefs", path) - << "Primary user package directory should be created correctly"; -} - -TEST_F(UtilsTest, CreateMovePath_Fail_AppTooLong) { - char path[PKG_PATH_MAX]; - - EXPECT_EQ(-1, create_move_path(path, REALLY_LONG_APP_NAME, "shared_prefs", 0)) - << "Should fail to create move path for primary user"; -} - -TEST_F(UtilsTest, CreateMovePath_Fail_LeafTooLong) { - char path[PKG_PATH_MAX]; - - EXPECT_EQ(-1, create_move_path(path, "com.android.test", REALLY_LONG_LEAF_NAME, 0)) - << "Should fail to create move path for primary user"; -} - -TEST_F(UtilsTest, CopyAndAppend_Normal) { - //int copy_and_append(dir_rec_t* dst, dir_rec_t* src, char* suffix) - dir_rec_t dst; - dir_rec_t src; - - src.path = (char*) "/data/"; - src.len = strlen(src.path); - - EXPECT_EQ(0, copy_and_append(&dst, &src, "app/")) - << "Should return error because postfix is too long."; - - EXPECT_STREQ("/data/app/", dst.path) - << "Appended path should be correct"; - - EXPECT_EQ(10, (ssize_t) dst.len) - << "Appended path should be length of '/data/app/' (10)"; -} - -TEST_F(UtilsTest, AppendAndIncrement_Normal) { - size_t dst_size = 10; - char dst[dst_size]; - char *dstp = dst; - const char* src = "FOO"; - - EXPECT_EQ(0, append_and_increment(&dstp, src, &dst_size)) - << "String should append successfully"; - - EXPECT_STREQ("FOO", dst) - << "String should append correctly"; - - EXPECT_EQ(0, append_and_increment(&dstp, src, &dst_size)) - << "String should append successfully again"; - - EXPECT_STREQ("FOOFOO", dst) - << "String should append correctly again"; -} - -TEST_F(UtilsTest, AppendAndIncrement_TooBig) { - size_t dst_size = 5; - char dst[dst_size]; - char *dstp = dst; - const char* src = "FOO"; - - EXPECT_EQ(0, append_and_increment(&dstp, src, &dst_size)) - << "String should append successfully"; - - EXPECT_STREQ("FOO", dst) - << "String should append correctly"; - - EXPECT_EQ(-1, append_and_increment(&dstp, src, &dst_size)) - << "String should fail because it's too large to fit"; -} - -TEST_F(UtilsTest, CreateDataPath) { - EXPECT_EQ("/data", create_data_path(nullptr)); - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b", - create_data_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b")); -} - -TEST_F(UtilsTest, CreateDataAppPath) { - EXPECT_EQ("/data/app", create_data_app_path(nullptr)); - - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/app", - create_data_app_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b")); -} - -TEST_F(UtilsTest, CreateDataUserPath) { - EXPECT_EQ("/data/data", create_data_user_path(nullptr, 0)); - EXPECT_EQ("/data/user/10", create_data_user_path(nullptr, 10)); - - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/user/0", - create_data_user_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 0)); - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/user/10", - create_data_user_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 10)); -} - -TEST_F(UtilsTest, CreateDataMediaPath) { - EXPECT_EQ("/data/media/0", create_data_media_path(nullptr, 0)); - EXPECT_EQ("/data/media/10", create_data_media_path(nullptr, 10)); - - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/media/0", - create_data_media_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 0)); - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/media/10", - create_data_media_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 10)); -} - -TEST_F(UtilsTest, CreateDataAppPackagePath) { - EXPECT_EQ("/data/app/com.example", create_data_app_package_path(nullptr, "com.example")); - - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/app/com.example", - create_data_app_package_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", "com.example")); -} - -TEST_F(UtilsTest, CreateDataUserPackagePath) { - EXPECT_EQ("/data/data/com.example", create_data_user_package_path(nullptr, 0, "com.example")); - EXPECT_EQ("/data/user/10/com.example", create_data_user_package_path(nullptr, 10, "com.example")); - - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/user/0/com.example", - create_data_user_package_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 0, "com.example")); - EXPECT_EQ("/mnt/expand/57f8f4bc-abf4-655f-bf67-946fc0f9f25b/user/10/com.example", - create_data_user_package_path("57f8f4bc-abf4-655f-bf67-946fc0f9f25b", 10, "com.example")); -} - -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/installd/utils.cpp android-platform-frameworks-native-21/cmds/installd/utils.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/installd/utils.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/installd/utils.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1184 +0,0 @@ -/* -** Copyright 2008, 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 "installd.h" - -#include -#include - -#define CACHE_NOISY(x) //x - -using android::base::StringPrintf; - -/** - * Check that given string is valid filename, and that it attempts no - * parent or child directory traversal. - */ -static bool is_valid_filename(const std::string& name) { - if (name.empty() || (name == ".") || (name == "..") - || (name.find('/') != std::string::npos)) { - return false; - } else { - return true; - } -} - -/** - * Create the path name where package app contents should be stored for - * the given volume UUID and package name. An empty UUID is assumed to - * be internal storage. - */ -std::string create_data_app_package_path(const char* volume_uuid, - const char* package_name) { - CHECK(is_valid_filename(package_name)); - CHECK(is_valid_package_name(package_name) == 0); - - return StringPrintf("%s/%s", - create_data_app_path(volume_uuid).c_str(), package_name); -} - -/** - * Create the path name where package data should be stored for the given - * volume UUID, package name, and user ID. An empty UUID is assumed to be - * internal storage. - */ -std::string create_data_user_package_path(const char* volume_uuid, - userid_t user, const char* package_name) { - CHECK(is_valid_filename(package_name)); - CHECK(is_valid_package_name(package_name) == 0); - - return StringPrintf("%s/%s", - create_data_user_path(volume_uuid, user).c_str(), package_name); -} - -int create_pkg_path(char path[PKG_PATH_MAX], const char *pkgname, - const char *postfix, userid_t userid) { - if (is_valid_package_name(pkgname) != 0) { - path[0] = '\0'; - return -1; - } - - std::string _tmp(create_data_user_package_path(nullptr, userid, pkgname) + postfix); - const char* tmp = _tmp.c_str(); - if (strlen(tmp) >= PKG_PATH_MAX) { - path[0] = '\0'; - return -1; - } else { - strcpy(path, tmp); - return 0; - } -} - -std::string create_data_path(const char* volume_uuid) { - if (volume_uuid == nullptr) { - return "/data"; - } else { - CHECK(is_valid_filename(volume_uuid)); - return StringPrintf("/mnt/expand/%s", volume_uuid); - } -} - -/** - * Create the path name for app data. - */ -std::string create_data_app_path(const char* volume_uuid) { - return StringPrintf("%s/app", create_data_path(volume_uuid).c_str()); -} - -/** - * Create the path name for user data for a certain userid. - */ -std::string create_data_user_path(const char* volume_uuid, userid_t userid) { - std::string data(create_data_path(volume_uuid)); - if (volume_uuid == nullptr) { - if (userid == 0) { - return StringPrintf("%s/data", data.c_str()); - } else { - return StringPrintf("%s/user/%u", data.c_str(), userid); - } - } else { - return StringPrintf("%s/user/%u", data.c_str(), userid); - } -} - -/** - * Create the path name for media for a certain userid. - */ -std::string create_data_media_path(const char* volume_uuid, userid_t userid) { - return StringPrintf("%s/media/%u", create_data_path(volume_uuid).c_str(), userid); -} - -std::vector get_known_users(const char* volume_uuid) { - std::vector users; - - // We always have an owner - users.push_back(0); - - std::string path(create_data_path(volume_uuid) + "/" + SECONDARY_USER_PREFIX); - DIR* dir = opendir(path.c_str()); - if (dir == NULL) { - // Unable to discover other users, but at least return owner - PLOG(ERROR) << "Failed to opendir " << path; - return users; - } - - struct dirent* ent; - while ((ent = readdir(dir))) { - if (ent->d_type != DT_DIR) { - continue; - } - - char* end; - userid_t user = strtol(ent->d_name, &end, 10); - if (*end == '\0' && user != 0) { - LOG(DEBUG) << "Found valid user " << user; - users.push_back(user); - } - } - closedir(dir); - - return users; -} - -/** - * Create the path name for config for a certain userid. - * Returns 0 on success, and -1 on failure. - */ -int create_user_config_path(char path[PATH_MAX], userid_t userid) { - if (snprintf(path, PATH_MAX, "%s%d", "/data/misc/user/", userid) > PATH_MAX) { - return -1; - } - return 0; -} - -int create_move_path(char path[PKG_PATH_MAX], - const char* pkgname, - const char* leaf, - userid_t userid __unused) -{ - if ((android_data_dir.len + strlen(PRIMARY_USER_PREFIX) + strlen(pkgname) + strlen(leaf) + 1) - >= PKG_PATH_MAX) { - return -1; - } - - sprintf(path, "%s%s%s/%s", android_data_dir.path, PRIMARY_USER_PREFIX, pkgname, leaf); - return 0; -} - -/** - * Checks whether the package name is valid. Returns -1 on error and - * 0 on success. - */ -int is_valid_package_name(const char* pkgname) { - const char *x = pkgname; - int alpha = -1; - - if (strlen(pkgname) > PKG_NAME_MAX) { - return -1; - } - - while (*x) { - if (isalnum(*x) || (*x == '_')) { - /* alphanumeric or underscore are fine */ - } else if (*x == '.') { - if ((x == pkgname) || (x[1] == '.') || (x[1] == 0)) { - /* periods must not be first, last, or doubled */ - ALOGE("invalid package name '%s'\n", pkgname); - return -1; - } - } else if (*x == '-') { - /* Suffix -X is fine to let versioning of packages. - But whatever follows should be alphanumeric.*/ - alpha = 1; - } else { - /* anything not A-Z, a-z, 0-9, _, or . is invalid */ - ALOGE("invalid package name '%s'\n", pkgname); - return -1; - } - - x++; - } - - if (alpha == 1) { - // Skip current character - x++; - while (*x) { - if (!isalnum(*x)) { - ALOGE("invalid package name '%s' should include only numbers after -\n", pkgname); - return -1; - } - x++; - } - } - - return 0; -} - -static int _delete_dir_contents(DIR *d, - int (*exclusion_predicate)(const char *name, const int is_dir)) -{ - int result = 0; - struct dirent *de; - int dfd; - - dfd = dirfd(d); - - if (dfd < 0) return -1; - - while ((de = readdir(d))) { - const char *name = de->d_name; - - /* check using the exclusion predicate, if provided */ - if (exclusion_predicate && exclusion_predicate(name, (de->d_type == DT_DIR))) { - continue; - } - - if (de->d_type == DT_DIR) { - int subfd; - DIR *subdir; - - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - - subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); - if (subfd < 0) { - ALOGE("Couldn't openat %s: %s\n", name, strerror(errno)); - result = -1; - continue; - } - subdir = fdopendir(subfd); - if (subdir == NULL) { - ALOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno)); - close(subfd); - result = -1; - continue; - } - if (_delete_dir_contents(subdir, exclusion_predicate)) { - result = -1; - } - closedir(subdir); - if (unlinkat(dfd, name, AT_REMOVEDIR) < 0) { - ALOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno)); - result = -1; - } - } else { - if (unlinkat(dfd, name, 0) < 0) { - ALOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno)); - result = -1; - } - } - } - - return result; -} - -int delete_dir_contents(const char *pathname, - int also_delete_dir, - int (*exclusion_predicate)(const char*, const int)) -{ - int res = 0; - DIR *d; - - d = opendir(pathname); - if (d == NULL) { - ALOGE("Couldn't opendir %s: %s\n", pathname, strerror(errno)); - return -errno; - } - res = _delete_dir_contents(d, exclusion_predicate); - closedir(d); - if (also_delete_dir) { - if (rmdir(pathname)) { - ALOGE("Couldn't rmdir %s: %s\n", pathname, strerror(errno)); - res = -1; - } - } - return res; -} - -int delete_dir_contents_fd(int dfd, const char *name) -{ - int fd, res; - DIR *d; - - fd = openat(dfd, name, O_RDONLY | O_DIRECTORY); - if (fd < 0) { - ALOGE("Couldn't openat %s: %s\n", name, strerror(errno)); - return -1; - } - d = fdopendir(fd); - if (d == NULL) { - ALOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno)); - close(fd); - return -1; - } - res = _delete_dir_contents(d, 0); - closedir(d); - return res; -} - -static int _copy_owner_permissions(int srcfd, int dstfd) -{ - struct stat st; - if (fstat(srcfd, &st) != 0) { - return -1; - } - if (fchmod(dstfd, st.st_mode) != 0) { - return -1; - } - return 0; -} - -static int _copy_dir_files(int sdfd, int ddfd, uid_t owner, gid_t group) -{ - int result = 0; - if (_copy_owner_permissions(sdfd, ddfd) != 0) { - ALOGE("_copy_dir_files failed to copy dir permissions\n"); - } - if (fchown(ddfd, owner, group) != 0) { - ALOGE("_copy_dir_files failed to change dir owner\n"); - } - - DIR *ds = fdopendir(sdfd); - if (ds == NULL) { - ALOGE("Couldn't fdopendir: %s\n", strerror(errno)); - return -1; - } - struct dirent *de; - while ((de = readdir(ds))) { - if (de->d_type != DT_REG) { - continue; - } - - const char *name = de->d_name; - int fsfd = openat(sdfd, name, O_RDONLY | O_NOFOLLOW | O_CLOEXEC); - int fdfd = openat(ddfd, name, O_WRONLY | O_NOFOLLOW | O_CLOEXEC | O_CREAT, 0600); - if (fsfd == -1 || fdfd == -1) { - ALOGW("Couldn't copy %s: %s\n", name, strerror(errno)); - } else { - if (_copy_owner_permissions(fsfd, fdfd) != 0) { - ALOGE("Failed to change file permissions\n"); - } - if (fchown(fdfd, owner, group) != 0) { - ALOGE("Failed to change file owner\n"); - } - - char buf[8192]; - ssize_t size; - while ((size = read(fsfd, buf, sizeof(buf))) > 0) { - write(fdfd, buf, size); - } - if (size < 0) { - ALOGW("Couldn't copy %s: %s\n", name, strerror(errno)); - result = -1; - } - } - close(fdfd); - close(fsfd); - } - - return result; -} - -int copy_dir_files(const char *srcname, - const char *dstname, - uid_t owner, - uid_t group) -{ - int res = 0; - DIR *ds = NULL; - DIR *dd = NULL; - - ds = opendir(srcname); - if (ds == NULL) { - ALOGE("Couldn't opendir %s: %s\n", srcname, strerror(errno)); - return -errno; - } - - mkdir(dstname, 0600); - dd = opendir(dstname); - if (dd == NULL) { - ALOGE("Couldn't opendir %s: %s\n", dstname, strerror(errno)); - closedir(ds); - return -errno; - } - - int sdfd = dirfd(ds); - int ddfd = dirfd(dd); - if (sdfd != -1 && ddfd != -1) { - res = _copy_dir_files(sdfd, ddfd, owner, group); - } else { - res = -errno; - } - closedir(dd); - closedir(ds); - return res; -} - -int lookup_media_dir(char basepath[PATH_MAX], const char *dir) -{ - DIR *d; - struct dirent *de; - struct stat s; - char* dirpos = basepath + strlen(basepath); - - if ((*(dirpos-1)) != '/') { - *dirpos = '/'; - dirpos++; - } - - CACHE_NOISY(ALOGI("Looking up %s in %s\n", dir, basepath)); - // Verify the path won't extend beyond our buffer, to avoid - // repeated checking later. - if ((dirpos-basepath+strlen(dir)) >= (PATH_MAX-1)) { - ALOGW("Path exceeds limit: %s%s", basepath, dir); - return -1; - } - - // First, can we find this directory with the case that is given? - strcpy(dirpos, dir); - if (stat(basepath, &s) >= 0) { - CACHE_NOISY(ALOGI("Found direct: %s\n", basepath)); - return 0; - } - - // Not found with that case... search through all entries to find - // one that matches regardless of case. - *dirpos = 0; - - d = opendir(basepath); - if (d == NULL) { - return -1; - } - - while ((de = readdir(d))) { - if (strcasecmp(de->d_name, dir) == 0) { - strcpy(dirpos, de->d_name); - closedir(d); - CACHE_NOISY(ALOGI("Found search: %s\n", basepath)); - return 0; - } - } - - ALOGW("Couldn't find %s in %s", dir, basepath); - closedir(d); - return -1; -} - -int64_t data_disk_free(const std::string& data_path) -{ - struct statfs sfs; - if (statfs(data_path.c_str(), &sfs) == 0) { - return sfs.f_bavail * sfs.f_bsize; - } else { - PLOG(ERROR) << "Couldn't statfs " << data_path; - return -1; - } -} - -cache_t* start_cache_collection() -{ - cache_t* cache = (cache_t*)calloc(1, sizeof(cache_t)); - return cache; -} - -#define CACHE_BLOCK_SIZE (512*1024) - -static void* _cache_malloc(cache_t* cache, size_t len) -{ - len = (len+3)&~3; - if (len > (CACHE_BLOCK_SIZE/2)) { - // It doesn't make sense to try to put this allocation into one - // of our blocks, because it is so big. Instead, make a new dedicated - // block for it. - int8_t* res = (int8_t*)malloc(len+sizeof(void*)); - if (res == NULL) { - return NULL; - } - CACHE_NOISY(ALOGI("Allocated large cache mem block: %p size %d", res, len)); - // Link it into our list of blocks, not disrupting the current one. - if (cache->memBlocks == NULL) { - *(void**)res = NULL; - cache->memBlocks = res; - } else { - *(void**)res = *(void**)cache->memBlocks; - *(void**)cache->memBlocks = res; - } - return res + sizeof(void*); - } - int8_t* res = cache->curMemBlockAvail; - int8_t* nextPos = res + len; - if (cache->memBlocks == NULL || nextPos > cache->curMemBlockEnd) { - int8_t* newBlock = (int8_t*) malloc(CACHE_BLOCK_SIZE); - if (newBlock == NULL) { - return NULL; - } - CACHE_NOISY(ALOGI("Allocated new cache mem block: %p", newBlock)); - *(void**)newBlock = cache->memBlocks; - cache->memBlocks = newBlock; - res = cache->curMemBlockAvail = newBlock + sizeof(void*); - cache->curMemBlockEnd = newBlock + CACHE_BLOCK_SIZE; - nextPos = res + len; - } - CACHE_NOISY(ALOGI("cache_malloc: ret %p size %d, block=%p, nextPos=%p", - res, len, cache->memBlocks, nextPos)); - cache->curMemBlockAvail = nextPos; - return res; -} - -static void* _cache_realloc(cache_t* cache, void* cur, size_t origLen, size_t len) -{ - // This isn't really a realloc, but it is good enough for our purposes here. - void* alloc = _cache_malloc(cache, len); - if (alloc != NULL && cur != NULL) { - memcpy(alloc, cur, origLen < len ? origLen : len); - } - return alloc; -} - -static void _inc_num_cache_collected(cache_t* cache) -{ - cache->numCollected++; - if ((cache->numCollected%20000) == 0) { - ALOGI("Collected cache so far: %zd directories, %zd files", - cache->numDirs, cache->numFiles); - } -} - -static cache_dir_t* _add_cache_dir_t(cache_t* cache, cache_dir_t* parent, const char *name) -{ - size_t nameLen = strlen(name); - cache_dir_t* dir = (cache_dir_t*)_cache_malloc(cache, sizeof(cache_dir_t)+nameLen+1); - if (dir != NULL) { - dir->parent = parent; - dir->childCount = 0; - dir->hiddenCount = 0; - dir->deleted = 0; - strcpy(dir->name, name); - if (cache->numDirs >= cache->availDirs) { - size_t newAvail = cache->availDirs < 1000 ? 1000 : cache->availDirs*2; - cache_dir_t** newDirs = (cache_dir_t**)_cache_realloc(cache, cache->dirs, - cache->availDirs*sizeof(cache_dir_t*), newAvail*sizeof(cache_dir_t*)); - if (newDirs == NULL) { - ALOGE("Failure growing cache dirs array for %s\n", name); - return NULL; - } - cache->availDirs = newAvail; - cache->dirs = newDirs; - } - cache->dirs[cache->numDirs] = dir; - cache->numDirs++; - if (parent != NULL) { - parent->childCount++; - } - _inc_num_cache_collected(cache); - } else { - ALOGE("Failure allocating cache_dir_t for %s\n", name); - } - return dir; -} - -static cache_file_t* _add_cache_file_t(cache_t* cache, cache_dir_t* dir, time_t modTime, - const char *name) -{ - size_t nameLen = strlen(name); - cache_file_t* file = (cache_file_t*)_cache_malloc(cache, sizeof(cache_file_t)+nameLen+1); - if (file != NULL) { - file->dir = dir; - file->modTime = modTime; - strcpy(file->name, name); - if (cache->numFiles >= cache->availFiles) { - size_t newAvail = cache->availFiles < 1000 ? 1000 : cache->availFiles*2; - cache_file_t** newFiles = (cache_file_t**)_cache_realloc(cache, cache->files, - cache->availFiles*sizeof(cache_file_t*), newAvail*sizeof(cache_file_t*)); - if (newFiles == NULL) { - ALOGE("Failure growing cache file array for %s\n", name); - return NULL; - } - cache->availFiles = newAvail; - cache->files = newFiles; - } - CACHE_NOISY(ALOGI("Setting file %p at position %d in array %p", file, - cache->numFiles, cache->files)); - cache->files[cache->numFiles] = file; - cache->numFiles++; - dir->childCount++; - _inc_num_cache_collected(cache); - } else { - ALOGE("Failure allocating cache_file_t for %s\n", name); - } - return file; -} - -static int _add_cache_files(cache_t *cache, cache_dir_t *parentDir, const char *dirName, - DIR* dir, char *pathBase, char *pathPos, size_t pathAvailLen) -{ - struct dirent *de; - cache_dir_t* cacheDir = NULL; - int dfd; - - CACHE_NOISY(ALOGI("_add_cache_files: parent=%p dirName=%s dir=%p pathBase=%s", - parentDir, dirName, dir, pathBase)); - - dfd = dirfd(dir); - - if (dfd < 0) return 0; - - // Sub-directories always get added to the data structure, so if they - // are empty we will know about them to delete them later. - cacheDir = _add_cache_dir_t(cache, parentDir, dirName); - - while ((de = readdir(dir))) { - const char *name = de->d_name; - - if (de->d_type == DT_DIR) { - int subfd; - DIR *subdir; - - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - - subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); - if (subfd < 0) { - ALOGE("Couldn't openat %s: %s\n", name, strerror(errno)); - continue; - } - subdir = fdopendir(subfd); - if (subdir == NULL) { - ALOGE("Couldn't fdopendir %s: %s\n", name, strerror(errno)); - close(subfd); - continue; - } - if (cacheDir == NULL) { - cacheDir = _add_cache_dir_t(cache, parentDir, dirName); - } - if (cacheDir != NULL) { - // Update pathBase for the new path... this may change dirName - // if that is also pointing to the path, but we are done with it - // now. - size_t finallen = snprintf(pathPos, pathAvailLen, "/%s", name); - CACHE_NOISY(ALOGI("Collecting dir %s\n", pathBase)); - if (finallen < pathAvailLen) { - _add_cache_files(cache, cacheDir, name, subdir, pathBase, - pathPos+finallen, pathAvailLen-finallen); - } else { - // Whoops, the final path is too long! We'll just delete - // this directory. - ALOGW("Cache dir %s truncated in path %s; deleting dir\n", - name, pathBase); - _delete_dir_contents(subdir, NULL); - if (unlinkat(dfd, name, AT_REMOVEDIR) < 0) { - ALOGE("Couldn't unlinkat %s: %s\n", name, strerror(errno)); - } - } - } - closedir(subdir); - } else if (de->d_type == DT_REG) { - // Skip files that start with '.'; they will be deleted if - // their entire directory is deleted. This allows for metadata - // like ".nomedia" to remain in the directory until the entire - // directory is deleted. - if (cacheDir == NULL) { - cacheDir = _add_cache_dir_t(cache, parentDir, dirName); - } - if (name[0] == '.') { - cacheDir->hiddenCount++; - continue; - } - if (cacheDir != NULL) { - // Build final full path for file... this may change dirName - // if that is also pointing to the path, but we are done with it - // now. - size_t finallen = snprintf(pathPos, pathAvailLen, "/%s", name); - CACHE_NOISY(ALOGI("Collecting file %s\n", pathBase)); - if (finallen < pathAvailLen) { - struct stat s; - if (stat(pathBase, &s) >= 0) { - _add_cache_file_t(cache, cacheDir, s.st_mtime, name); - } else { - ALOGW("Unable to stat cache file %s; deleting\n", pathBase); - if (unlink(pathBase) < 0) { - ALOGE("Couldn't unlink %s: %s\n", pathBase, strerror(errno)); - } - } - } else { - // Whoops, the final path is too long! We'll just delete - // this file. - ALOGW("Cache file %s truncated in path %s; deleting\n", - name, pathBase); - if (unlinkat(dfd, name, 0) < 0) { - *pathPos = 0; - ALOGE("Couldn't unlinkat %s in %s: %s\n", name, pathBase, - strerror(errno)); - } - } - } - } else { - cacheDir->hiddenCount++; - } - } - return 0; -} - -void add_cache_files(cache_t* cache, const char *basepath, const char *cachedir) -{ - DIR *d; - struct dirent *de; - char dirname[PATH_MAX]; - - CACHE_NOISY(ALOGI("add_cache_files: base=%s cachedir=%s\n", basepath, cachedir)); - - d = opendir(basepath); - if (d == NULL) { - return; - } - - while ((de = readdir(d))) { - if (de->d_type == DT_DIR) { - DIR* subdir; - const char *name = de->d_name; - char* pathpos; - - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) continue; - if ((name[1] == '.') && (name[2] == 0)) continue; - } - - strcpy(dirname, basepath); - pathpos = dirname + strlen(dirname); - if ((*(pathpos-1)) != '/') { - *pathpos = '/'; - pathpos++; - *pathpos = 0; - } - if (cachedir != NULL) { - snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s/%s", name, cachedir); - } else { - snprintf(pathpos, sizeof(dirname)-(pathpos-dirname), "%s", name); - } - CACHE_NOISY(ALOGI("Adding cache files from dir: %s\n", dirname)); - subdir = opendir(dirname); - if (subdir != NULL) { - size_t dirnameLen = strlen(dirname); - _add_cache_files(cache, NULL, dirname, subdir, dirname, dirname+dirnameLen, - PATH_MAX - dirnameLen); - closedir(subdir); - } - } - } - - closedir(d); -} - -static char *create_dir_path(char path[PATH_MAX], cache_dir_t* dir) -{ - char *pos = path; - if (dir->parent != NULL) { - pos = create_dir_path(path, dir->parent); - } - // Note that we don't need to worry about going beyond the buffer, - // since when we were constructing the cache entries our maximum - // buffer size for full paths was PATH_MAX. - strcpy(pos, dir->name); - pos += strlen(pos); - *pos = '/'; - pos++; - *pos = 0; - return pos; -} - -static void delete_cache_dir(char path[PATH_MAX], cache_dir_t* dir) -{ - if (dir->parent != NULL) { - create_dir_path(path, dir); - ALOGI("DEL DIR %s\n", path); - if (dir->hiddenCount <= 0) { - if (rmdir(path)) { - ALOGE("Couldn't rmdir %s: %s\n", path, strerror(errno)); - return; - } - } else { - // The directory contains hidden files so we need to delete - // them along with the directory itself. - if (delete_dir_contents(path, 1, NULL)) { - return; - } - } - dir->parent->childCount--; - dir->deleted = 1; - if (dir->parent->childCount <= 0) { - delete_cache_dir(path, dir->parent); - } - } else if (dir->hiddenCount > 0) { - // This is a root directory, but it has hidden files. Get rid of - // all of those files, but not the directory itself. - create_dir_path(path, dir); - ALOGI("DEL CONTENTS %s\n", path); - delete_dir_contents(path, 0, NULL); - } -} - -static int cache_modtime_sort(const void *lhsP, const void *rhsP) -{ - const cache_file_t *lhs = *(const cache_file_t**)lhsP; - const cache_file_t *rhs = *(const cache_file_t**)rhsP; - return lhs->modTime < rhs->modTime ? -1 : (lhs->modTime > rhs->modTime ? 1 : 0); -} - -void clear_cache_files(const std::string& data_path, cache_t* cache, int64_t free_size) -{ - size_t i; - int skip = 0; - char path[PATH_MAX]; - - ALOGI("Collected cache files: %zd directories, %zd files", - cache->numDirs, cache->numFiles); - - CACHE_NOISY(ALOGI("Sorting files...")); - qsort(cache->files, cache->numFiles, sizeof(cache_file_t*), - cache_modtime_sort); - - CACHE_NOISY(ALOGI("Cleaning empty directories...")); - for (i=cache->numDirs; i>0; i--) { - cache_dir_t* dir = cache->dirs[i-1]; - if (dir->childCount <= 0 && !dir->deleted) { - delete_cache_dir(path, dir); - } - } - - CACHE_NOISY(ALOGI("Trimming files...")); - for (i=0; inumFiles; i++) { - skip++; - if (skip > 10) { - if (data_disk_free(data_path) > free_size) { - return; - } - skip = 0; - } - cache_file_t* file = cache->files[i]; - strcpy(create_dir_path(path, file->dir), file->name); - ALOGI("DEL (mod %d) %s\n", (int)file->modTime, path); - if (unlink(path) < 0) { - ALOGE("Couldn't unlink %s: %s\n", path, strerror(errno)); - } - file->dir->childCount--; - if (file->dir->childCount <= 0) { - delete_cache_dir(path, file->dir); - } - } -} - -void finish_cache_collection(cache_t* cache) -{ - CACHE_NOISY(size_t i;) - - CACHE_NOISY(ALOGI("clear_cache_files: %d dirs, %d files\n", cache->numDirs, cache->numFiles)); - CACHE_NOISY( - for (i=0; inumDirs; i++) { - cache_dir_t* dir = cache->dirs[i]; - ALOGI("dir #%d: %p %s parent=%p\n", i, dir, dir->name, dir->parent); - }) - CACHE_NOISY( - for (i=0; inumFiles; i++) { - cache_file_t* file = cache->files[i]; - ALOGI("file #%d: %p %s time=%d dir=%p\n", i, file, file->name, - (int)file->modTime, file->dir); - }) - void* block = cache->memBlocks; - while (block != NULL) { - void* nextBlock = *(void**)block; - CACHE_NOISY(ALOGI("Freeing cache mem block: %p", block)); - free(block); - block = nextBlock; - } - free(cache); -} - -/** - * Validate that the path is valid in the context of the provided directory. - * The path is allowed to have at most one subdirectory and no indirections - * to top level directories (i.e. have ".."). - */ -static int validate_path(const dir_rec_t* dir, const char* path, int maxSubdirs) { - size_t dir_len = dir->len; - const char* subdir = strchr(path + dir_len, '/'); - - // Only allow the path to have at most one subdirectory. - if (subdir != NULL) { - ++subdir; - if ((--maxSubdirs == 0) && strchr(subdir, '/') != NULL) { - ALOGE("invalid apk path '%s' (subdir?)\n", path); - return -1; - } - } - - // Directories can't have a period directly after the directory markers to prevent "..". - if ((path[dir_len] == '.') || ((subdir != NULL) && (*subdir == '.'))) { - ALOGE("invalid apk path '%s' (trickery)\n", path); - return -1; - } - - return 0; -} - -/** - * Checks whether a path points to a system app (.apk file). Returns 0 - * if it is a system app or -1 if it is not. - */ -int validate_system_app_path(const char* path) { - size_t i; - - for (i = 0; i < android_system_dirs.count; i++) { - const size_t dir_len = android_system_dirs.dirs[i].len; - if (!strncmp(path, android_system_dirs.dirs[i].path, dir_len)) { - return validate_path(android_system_dirs.dirs + i, path, 1); - } - } - - return -1; -} - -/** - * Get the contents of a environment variable that contains a path. Caller - * owns the string that is inserted into the directory record. Returns - * 0 on success and -1 on error. - */ -int get_path_from_env(dir_rec_t* rec, const char* var) { - const char* path = getenv(var); - int ret = get_path_from_string(rec, path); - if (ret < 0) { - ALOGW("Problem finding value for environment variable %s\n", var); - } - return ret; -} - -/** - * Puts the string into the record as a directory. Appends '/' to the end - * of all paths. Caller owns the string that is inserted into the directory - * record. A null value will result in an error. - * - * Returns 0 on success and -1 on error. - */ -int get_path_from_string(dir_rec_t* rec, const char* path) { - if (path == NULL) { - return -1; - } else { - const size_t path_len = strlen(path); - if (path_len <= 0) { - return -1; - } - - // Make sure path is absolute. - if (path[0] != '/') { - return -1; - } - - if (path[path_len - 1] == '/') { - // Path ends with a forward slash. Make our own copy. - - rec->path = strdup(path); - if (rec->path == NULL) { - return -1; - } - - rec->len = path_len; - } else { - // Path does not end with a slash. Generate a new string. - char *dst; - - // Add space for slash and terminating null. - size_t dst_size = path_len + 2; - - rec->path = (char*) malloc(dst_size); - if (rec->path == NULL) { - return -1; - } - - dst = rec->path; - - if (append_and_increment(&dst, path, &dst_size) < 0 - || append_and_increment(&dst, "/", &dst_size)) { - ALOGE("Error canonicalizing path"); - return -1; - } - - rec->len = dst - rec->path; - } - } - return 0; -} - -int copy_and_append(dir_rec_t* dst, const dir_rec_t* src, const char* suffix) { - dst->len = src->len + strlen(suffix); - const size_t dstSize = dst->len + 1; - dst->path = (char*) malloc(dstSize); - - if (dst->path == NULL - || snprintf(dst->path, dstSize, "%s%s", src->path, suffix) - != (ssize_t) dst->len) { - ALOGE("Could not allocate memory to hold appended path; aborting\n"); - return -1; - } - - return 0; -} - -/** - * Check whether path points to a valid path for an APK file. The path must - * begin with a whitelisted prefix path and must be no deeper than |maxSubdirs| within - * that path. Returns -1 when an invalid path is encountered and 0 when a valid path - * is encountered. - */ -static int validate_apk_path_internal(const char *path, int maxSubdirs) { - const dir_rec_t* dir = NULL; - if (!strncmp(path, android_app_dir.path, android_app_dir.len)) { - dir = &android_app_dir; - } else if (!strncmp(path, android_app_private_dir.path, android_app_private_dir.len)) { - dir = &android_app_private_dir; - } else if (!strncmp(path, android_asec_dir.path, android_asec_dir.len)) { - dir = &android_asec_dir; - } else if (!strncmp(path, android_mnt_expand_dir.path, android_mnt_expand_dir.len)) { - dir = &android_mnt_expand_dir; - if (maxSubdirs < 2) { - maxSubdirs = 2; - } - } else { - return -1; - } - - return validate_path(dir, path, maxSubdirs); -} - -int validate_apk_path(const char* path) { - return validate_apk_path_internal(path, 1 /* maxSubdirs */); -} - -int validate_apk_path_subdirs(const char* path) { - return validate_apk_path_internal(path, 3 /* maxSubdirs */); -} - -int append_and_increment(char** dst, const char* src, size_t* dst_size) { - ssize_t ret = strlcpy(*dst, src, *dst_size); - if (ret < 0 || (size_t) ret >= *dst_size) { - return -1; - } - *dst += ret; - *dst_size -= ret; - return 0; -} - -char *build_string2(const char *s1, const char *s2) { - if (s1 == NULL || s2 == NULL) return NULL; - - int len_s1 = strlen(s1); - int len_s2 = strlen(s2); - int len = len_s1 + len_s2 + 1; - char *result = (char *) malloc(len); - if (result == NULL) return NULL; - - strcpy(result, s1); - strcpy(result + len_s1, s2); - - return result; -} - -char *build_string3(const char *s1, const char *s2, const char *s3) { - if (s1 == NULL || s2 == NULL || s3 == NULL) return NULL; - - int len_s1 = strlen(s1); - int len_s2 = strlen(s2); - int len_s3 = strlen(s3); - int len = len_s1 + len_s2 + len_s3 + 1; - char *result = (char *) malloc(len); - if (result == NULL) return NULL; - - strcpy(result, s1); - strcpy(result + len_s1, s2); - strcpy(result + len_s1 + len_s2, s3); - - return result; -} - -/* Ensure that /data/media directories are prepared for given user. */ -int ensure_media_user_dirs(const char* uuid, userid_t userid) { - std::string media_user_path(create_data_media_path(uuid, userid)); - if (fs_prepare_dir(media_user_path.c_str(), 0770, AID_MEDIA_RW, AID_MEDIA_RW) == -1) { - return -1; - } - - return 0; -} - -int ensure_config_user_dirs(userid_t userid) { - char config_user_path[PATH_MAX]; - - // writable by system, readable by any app within the same user - const int uid = multiuser_get_uid(userid, AID_SYSTEM); - const int gid = multiuser_get_uid(userid, AID_EVERYBODY); - - // Ensure /data/misc/user/ exists - create_user_config_path(config_user_path, userid); - if (fs_prepare_dir(config_user_path, 0750, uid, gid) == -1) { - return -1; - } - - return 0; -} - -int create_profile_file(const char *pkgname, gid_t gid) { - const char *profile_dir = DALVIK_CACHE_PREFIX "profiles"; - char profile_file[PKG_PATH_MAX]; - - snprintf(profile_file, sizeof(profile_file), "%s/%s", profile_dir, pkgname); - - // The 'system' user needs to be able to read the profile to determine if dex2oat - // needs to be run. This is done in dalvik.system.DexFile.isDexOptNeededInternal(). So - // we assign ownership to AID_SYSTEM and ensure it's not world-readable. - - int fd = open(profile_file, O_WRONLY | O_CREAT | O_NOFOLLOW | O_CLOEXEC, 0660); - - // Always set the uid/gid/permissions. The file could have been previously created - // with different permissions. - if (fd >= 0) { - if (fchown(fd, AID_SYSTEM, gid) < 0) { - ALOGE("cannot chown profile file '%s': %s\n", profile_file, strerror(errno)); - close(fd); - unlink(profile_file); - return -1; - } - - if (fchmod(fd, 0660) < 0) { - ALOGE("cannot chmod profile file '%s': %s\n", profile_file, strerror(errno)); - close(fd); - unlink(profile_file); - return -1; - } - close(fd); - } - return 0; -} - -void remove_profile_file(const char *pkgname) { - char profile_file[PKG_PATH_MAX]; - snprintf(profile_file, sizeof(profile_file), "%s/%s", DALVIK_CACHE_PREFIX "profiles", pkgname); - unlink(profile_file); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/ip-up-vpn/Android.mk android-platform-frameworks-native-21/cmds/ip-up-vpn/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/ip-up-vpn/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/ip-up-vpn/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -# -# 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. -# - -LOCAL_PATH := $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES := ip-up-vpn.c -LOCAL_SHARED_LIBRARIES := libcutils liblog -LOCAL_MODULE := ip-up-vpn -LOCAL_MODULE_PATH := $(TARGET_OUT_ETC)/ppp -LOCAL_MODULE_TAGS := optional - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/ip-up-vpn/ip-up-vpn.c android-platform-frameworks-native-21/cmds/ip-up-vpn/ip-up-vpn.c --- android-platform-frameworks-native-6.0.1+r16/cmds/ip-up-vpn/ip-up-vpn.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/ip-up-vpn/ip-up-vpn.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,135 +0,0 @@ -/* - * 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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#define LOG_TAG "ip-up-vpn" -#include - -#define DIR "/data/misc/vpn/" - -static const char *env(const char *name) { - const char *value = getenv(name); - return value ? value : ""; -} - -static int set_address(struct sockaddr *sa, const char *address) { - sa->sa_family = AF_INET; - errno = EINVAL; - return inet_pton(AF_INET, address, &((struct sockaddr_in *)sa)->sin_addr); -} - -/* - * The primary goal is to create a file with VPN parameters. Currently they - * are interface, addresses, routes, DNS servers, and search domains and VPN - * server address. Each parameter occupies one line in the file, and it can be - * an empty string or space-separated values. The order and the format must be - * consistent with com.android.server.connectivity.Vpn. Here is an example. - * - * ppp0 - * 192.168.1.100/24 - * 0.0.0.0/0 - * 192.168.1.1 192.168.1.2 - * example.org - * 192.0.2.1 - * - * The secondary goal is to unify the outcome of VPN. The current baseline - * is to have an interface configured with the given address and netmask - * and maybe add a host route to protect the tunnel. PPP-based VPN already - * does this, but others might not. Routes, DNS servers, and search domains - * are handled by the framework since they can be overridden by the users. - */ -int main(int argc, char **argv) -{ - FILE *state = fopen(DIR ".tmp", "wb"); - if (!state) { - ALOGE("Cannot create state: %s", strerror(errno)); - return 1; - } - - if (argc >= 6) { - /* Invoked by pppd. */ - fprintf(state, "%s\n", argv[1]); - fprintf(state, "%s/32\n", argv[4]); - fprintf(state, "0.0.0.0/0\n"); - fprintf(state, "%s %s\n", env("DNS1"), env("DNS2")); - fprintf(state, "\n"); - fprintf(state, "\n"); - } else if (argc == 2) { - /* Invoked by racoon. */ - const char *interface = env("INTERFACE"); - const char *address = env("INTERNAL_ADDR4"); - const char *routes = env("SPLIT_INCLUDE_CIDR"); - - int s = socket(AF_INET, SOCK_DGRAM, 0); - struct ifreq ifr; - memset(&ifr, 0, sizeof(ifr)); - - /* Bring up the interface. */ - ifr.ifr_flags = IFF_UP; - strncpy(ifr.ifr_name, interface, IFNAMSIZ); - if (ioctl(s, SIOCSIFFLAGS, &ifr)) { - ALOGE("Cannot bring up %s: %s", interface, strerror(errno)); - return 1; - } - - /* Set the address. */ - if (!set_address(&ifr.ifr_addr, address) || - ioctl(s, SIOCSIFADDR, &ifr)) { - ALOGE("Cannot set address: %s", strerror(errno)); - return 1; - } - - /* Set the netmask. */ - if (set_address(&ifr.ifr_netmask, env("INTERNAL_NETMASK4"))) { - if (ioctl(s, SIOCSIFNETMASK, &ifr)) { - ALOGE("Cannot set netmask: %s", strerror(errno)); - return 1; - } - } - - /* TODO: Send few packets to trigger phase 2? */ - - fprintf(state, "%s\n", interface); - fprintf(state, "%s/%s\n", address, env("INTERNAL_CIDR4")); - fprintf(state, "%s\n", routes[0] ? routes : "0.0.0.0/0"); - fprintf(state, "%s\n", env("INTERNAL_DNS4_LIST")); - fprintf(state, "%s\n", env("DEFAULT_DOMAIN")); - fprintf(state, "%s\n", env("REMOTE_ADDR")); - } else { - ALOGE("Cannot parse parameters"); - return 1; - } - - fclose(state); - if (chmod(DIR ".tmp", 0444) || rename(DIR ".tmp", DIR "state")) { - ALOGE("Cannot write state: %s", strerror(errno)); - return 1; - } - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/rawbu/Android.mk android-platform-frameworks-native-21/cmds/rawbu/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/rawbu/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/rawbu/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -# Copyright 2009 The Android Open Source Project - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= backup.cpp - -LOCAL_SHARED_LIBRARIES := libcutils libc - -LOCAL_MODULE:= rawbu - -LOCAL_MODULE_PATH := $(TARGET_OUT_OPTIONAL_EXECUTABLES) -LOCAL_MODULE_TAGS := debug - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/rawbu/backup.cpp android-platform-frameworks-native-21/cmds/rawbu/backup.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/rawbu/backup.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/rawbu/backup.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,752 +0,0 @@ -// Copyright 2009 The Android Open Source Project - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include - -#ifndef PATH_MAX -#define PATH_MAX 4096 -#endif - -// First version. -#define FILE_VERSION_1 0xffff0001 - -// Introduces backup all option to header. -#define FILE_VERSION_2 0xffff0002 - -#define FILE_VERSION FILE_VERSION_2 - -namespace android { - -static char nameBuffer[PATH_MAX]; -static struct stat statBuffer; - -static char copyBuffer[8192]; -static char *backupFilePath = NULL; - -static uint32_t inputFileVersion; - -static int opt_backupAll; - -#define SPECIAL_NO_TOUCH 0 -#define SPECIAL_NO_BACKUP 1 - -struct special_dir { - const char* path; - int type; -}; - -/* Directory paths that we will not backup/restore */ -static const struct special_dir SKIP_PATHS[] = { - { "/data/misc", SPECIAL_NO_TOUCH }, - { "/data/system/batterystats.bin", SPECIAL_NO_TOUCH }, - { "/data/system/location", SPECIAL_NO_TOUCH }, - { "/data/dalvik-cache", SPECIAL_NO_BACKUP }, - { NULL, 0 }, -}; - -/* This is just copied from the shell's built-in wipe command. */ -static int wipe (const char *path) -{ - DIR *dir; - struct dirent *de; - int ret; - int i; - - dir = opendir(path); - - if (dir == NULL) { - fprintf (stderr, "Error opendir'ing %s: %s\n", - path, strerror(errno)); - return 0; - } - - char *filenameOffset; - - strcpy(nameBuffer, path); - strcat(nameBuffer, "/"); - - filenameOffset = nameBuffer + strlen(nameBuffer); - - for (;;) { - de = readdir(dir); - - if (de == NULL) { - break; - } - - if (0 == strcmp(de->d_name, ".") - || 0 == strcmp(de->d_name, "..") - || 0 == strcmp(de->d_name, "lost+found") - ) { - continue; - } - - strcpy(filenameOffset, de->d_name); - bool noBackup = false; - - /* See if this is a path we should skip. */ - for (i = 0; SKIP_PATHS[i].path; i++) { - if (strcmp(SKIP_PATHS[i].path, nameBuffer) == 0) { - if (opt_backupAll || SKIP_PATHS[i].type == SPECIAL_NO_BACKUP) { - // In this case we didn't back up the directory -- - // we do want to wipe its contents, but not the - // directory itself, since the restore file won't - // contain the directory. - noBackup = true; - } - break; - } - } - - if (!noBackup && SKIP_PATHS[i].path != NULL) { - // This is a SPECIAL_NO_TOUCH directory. - continue; - } - - ret = lstat (nameBuffer, &statBuffer); - - if (ret != 0) { - fprintf(stderr, "warning -- stat() error on '%s': %s\n", - nameBuffer, strerror(errno)); - continue; - } - - if(S_ISDIR(statBuffer.st_mode)) { - int i; - char *newpath; - - newpath = strdup(nameBuffer); - if (wipe(newpath) == 0) { - free(newpath); - closedir(dir); - return 0; - } - - if (!noBackup) { - ret = rmdir(newpath); - if (ret != 0) { - fprintf(stderr, "warning -- rmdir() error on '%s': %s\n", - newpath, strerror(errno)); - } - } - - free(newpath); - - strcpy(nameBuffer, path); - strcat(nameBuffer, "/"); - - } else { - // Don't delete the backup file - if (backupFilePath && strcmp(backupFilePath, nameBuffer) == 0) { - continue; - } - ret = unlink(nameBuffer); - - if (ret != 0) { - fprintf(stderr, "warning -- unlink() error on '%s': %s\n", - nameBuffer, strerror(errno)); - } - } - } - - closedir(dir); - - return 1; -} - -static int write_int32(FILE* fh, int32_t val) -{ - int res = fwrite(&val, 1, sizeof(val), fh); - if (res != sizeof(val)) { - fprintf(stderr, "unable to write int32 (%d bytes): %s\n", res, strerror(errno)); - return 0; - } - - return 1; -} - -static int write_int64(FILE* fh, int64_t val) -{ - int res = fwrite(&val, 1, sizeof(val), fh); - if (res != sizeof(val)) { - fprintf(stderr, "unable to write int64 (%d bytes): %s\n", res, strerror(errno)); - return 0; - } - - return 1; -} - -static int copy_file(FILE* dest, FILE* src, off_t size, const char* destName, - const char* srcName) -{ - errno = 0; - - off_t origSize = size; - - while (size > 0) { - int amt = size > (off_t)sizeof(copyBuffer) ? sizeof(copyBuffer) : (int)size; - int readLen = fread(copyBuffer, 1, amt, src); - if (readLen <= 0) { - if (srcName != NULL) { - fprintf(stderr, "unable to read source (%d of %ld bytes) file '%s': %s\n", - amt, origSize, srcName, errno != 0 ? strerror(errno) : "unexpected EOF"); - } else { - fprintf(stderr, "unable to read buffer (%d of %ld bytes): %s\n", - amt, origSize, errno != 0 ? strerror(errno) : "unexpected EOF"); - } - return 0; - } - int writeLen = fwrite(copyBuffer, 1, readLen, dest); - if (writeLen != readLen) { - if (destName != NULL) { - fprintf(stderr, "unable to write file (%d of %d bytes) '%s': '%s'\n", - writeLen, readLen, destName, strerror(errno)); - } else { - fprintf(stderr, "unable to write buffer (%d of %d bytes): '%s'\n", - writeLen, readLen, strerror(errno)); - } - return 0; - } - size -= readLen; - } - return 1; -} - -#define TYPE_END 0 -#define TYPE_DIR 1 -#define TYPE_FILE 2 - -static int write_header(FILE* fh, int type, const char* path, const struct stat* st) -{ - int pathLen = strlen(path); - if (!write_int32(fh, type)) return 0; - if (!write_int32(fh, pathLen)) return 0; - if (fwrite(path, 1, pathLen, fh) != (size_t)pathLen) { - fprintf(stderr, "unable to write: %s\n", strerror(errno)); - return 0; - } - - if (!write_int32(fh, st->st_uid)) return 0; - if (!write_int32(fh, st->st_gid)) return 0; - if (!write_int32(fh, st->st_mode)) return 0; - if (!write_int64(fh, ((int64_t)st->st_atime)*1000*1000*1000)) return 0; - if (!write_int64(fh, ((int64_t)st->st_mtime)*1000*1000*1000)) return 0; - if (!write_int64(fh, ((int64_t)st->st_ctime)*1000*1000*1000)) return 0; - - return 1; -} - -static int backup_dir(FILE* fh, const char* srcPath) -{ - DIR *dir; - struct dirent *de; - char* fullPath = NULL; - int srcLen = strlen(srcPath); - int result = 1; - int i; - - dir = opendir(srcPath); - - if (dir == NULL) { - fprintf (stderr, "error opendir'ing '%s': %s\n", - srcPath, strerror(errno)); - return 0; - } - - for (;;) { - de = readdir(dir); - - if (de == NULL) { - break; - } - - if (0 == strcmp(de->d_name, ".") - || 0 == strcmp(de->d_name, "..") - || 0 == strcmp(de->d_name, "lost+found") - ) { - continue; - } - - if (fullPath != NULL) { - free(fullPath); - } - fullPath = (char*)malloc(srcLen + strlen(de->d_name) + 2); - strcpy(fullPath, srcPath); - fullPath[srcLen] = '/'; - strcpy(fullPath+srcLen+1, de->d_name); - - /* See if this is a path we should skip. */ - if (!opt_backupAll) { - for (i = 0; SKIP_PATHS[i].path; i++) { - if (strcmp(SKIP_PATHS[i].path, fullPath) == 0) { - break; - } - } - if (SKIP_PATHS[i].path != NULL) { - continue; - } - } - - int ret = lstat(fullPath, &statBuffer); - - if (ret != 0) { - fprintf(stderr, "stat() error on '%s': %s\n", - fullPath, strerror(errno)); - result = 0; - goto done; - } - - if(S_ISDIR(statBuffer.st_mode)) { - printf("Saving dir %s...\n", fullPath); - - if (write_header(fh, TYPE_DIR, fullPath, &statBuffer) == 0) { - result = 0; - goto done; - } - if (backup_dir(fh, fullPath) == 0) { - result = 0; - goto done; - } - } else if (S_ISREG(statBuffer.st_mode)) { - // Skip the backup file - if (backupFilePath && strcmp(fullPath, backupFilePath) == 0) { - printf("Skipping backup file %s...\n", backupFilePath); - continue; - } else { - printf("Saving file %s...\n", fullPath); - } - if (write_header(fh, TYPE_FILE, fullPath, &statBuffer) == 0) { - result = 0; - goto done; - } - - off_t size = statBuffer.st_size; - if (!write_int64(fh, size)) { - result = 0; - goto done; - } - - FILE* src = fopen(fullPath, "r"); - if (src == NULL) { - fprintf(stderr, "unable to open source file '%s': %s\n", - fullPath, strerror(errno)); - result = 0; - goto done; - } - - int copyres = copy_file(fh, src, size, NULL, fullPath); - fclose(src); - if (!copyres) { - result = 0; - goto done; - } - } - } - -done: - if (fullPath != NULL) { - free(fullPath); - } - - closedir(dir); - - return result; -} - -static int backup_data(const char* destPath) -{ - int res = -1; - - FILE* fh = fopen(destPath, "w"); - if (fh == NULL) { - fprintf(stderr, "unable to open destination '%s': %s\n", - destPath, strerror(errno)); - return -1; - } - - printf("Backing up /data to %s...\n", destPath); - - // The path that shouldn't be backed up - backupFilePath = strdup(destPath); - - if (!write_int32(fh, FILE_VERSION)) goto done; - if (!write_int32(fh, opt_backupAll)) goto done; - if (!backup_dir(fh, "/data")) goto done; - if (!write_int32(fh, 0)) goto done; - - res = 0; - -done: - if (fflush(fh) != 0) { - fprintf(stderr, "error flushing destination '%s': %s\n", - destPath, strerror(errno)); - res = -1; - goto donedone; - } - if (fsync(fileno(fh)) != 0) { - fprintf(stderr, "error syncing destination '%s': %s\n", - destPath, strerror(errno)); - res = -1; - goto donedone; - } - fclose(fh); - sync(); - -donedone: - return res; -} - -static int32_t read_int32(FILE* fh, int32_t defVal) -{ - int32_t val; - if (fread(&val, 1, sizeof(val), fh) != sizeof(val)) { - fprintf(stderr, "unable to read: %s\n", strerror(errno)); - return defVal; - } - - return val; -} - -static int64_t read_int64(FILE* fh, int64_t defVal) -{ - int64_t val; - if (fread(&val, 1, sizeof(val), fh) != sizeof(val)) { - fprintf(stderr, "unable to read: %s\n", strerror(errno)); - return defVal; - } - - return val; -} - -static int read_header(FILE* fh, int* type, char** path, struct stat* st) -{ - *type = read_int32(fh, -1); - if (*type == TYPE_END) { - return 1; - } - - if (*type < 0) { - fprintf(stderr, "bad token %d in restore file\n", *type); - return 0; - } - - int32_t pathLen = read_int32(fh, -1); - if (pathLen <= 0) { - fprintf(stderr, "bad path length %d in restore file\n", pathLen); - return 0; - } - char* readPath = (char*)malloc(pathLen+1); - if (fread(readPath, 1, pathLen, fh) != (size_t)pathLen) { - fprintf(stderr, "truncated path in restore file\n"); - free(readPath); - return 0; - } - readPath[pathLen] = 0; - *path = readPath; - - st->st_uid = read_int32(fh, -1); - if (st->st_uid == (uid_t)-1) { - fprintf(stderr, "bad uid in restore file at '%s'\n", readPath); - return 0; - } - st->st_gid = read_int32(fh, -1); - if (st->st_gid == (gid_t)-1) { - fprintf(stderr, "bad gid in restore file at '%s'\n", readPath); - return 0; - } - st->st_mode = read_int32(fh, -1); - if (st->st_mode == (mode_t)-1) { - fprintf(stderr, "bad mode in restore file at '%s'\n", readPath); - return 0; - } - int64_t ltime = read_int64(fh, -1); - if (ltime < 0) { - fprintf(stderr, "bad atime in restore file at '%s'\n", readPath); - return 0; - } - st->st_atime = (time_t)(ltime/1000/1000/1000); - ltime = read_int64(fh, -1); - if (ltime < 0) { - fprintf(stderr, "bad mtime in restore file at '%s'\n", readPath); - return 0; - } - st->st_mtime = (time_t)(ltime/1000/1000/1000); - ltime = read_int64(fh, -1); - if (ltime < 0) { - fprintf(stderr, "bad ctime in restore file at '%s'\n", readPath); - return 0; - } - st->st_ctime = (time_t)(ltime/1000/1000/1000); - - st->st_mode &= (S_IRWXU|S_IRWXG|S_IRWXO); - - return 1; -} - -static int restore_data(const char* srcPath) -{ - int res = -1; - - FILE* fh = fopen(srcPath, "r"); - if (fh == NULL) { - fprintf(stderr, "Unable to open source '%s': %s\n", - srcPath, strerror(errno)); - return -1; - } - - inputFileVersion = read_int32(fh, 0); - if (inputFileVersion < FILE_VERSION_1 || inputFileVersion > FILE_VERSION) { - fprintf(stderr, "Restore file has bad version: 0x%x\n", inputFileVersion); - goto done; - } - - if (inputFileVersion >= FILE_VERSION_2) { - opt_backupAll = read_int32(fh, 0); - } else { - opt_backupAll = 0; - } - - // The path that shouldn't be deleted - backupFilePath = strdup(srcPath); - - printf("Wiping contents of /data...\n"); - if (!wipe("/data")) { - goto done; - } - - printf("Restoring from %s to /data...\n", srcPath); - - while (1) { - int type; - char* path = NULL; - if (read_header(fh, &type, &path, &statBuffer) == 0) { - goto done; - } - if (type == 0) { - break; - } - - const char* typeName = "?"; - - if (type == TYPE_DIR) { - typeName = "dir"; - - printf("Restoring dir %s...\n", path); - - if (mkdir(path, statBuffer.st_mode) != 0) { - if (errno != EEXIST) { - fprintf(stderr, "unable to create directory '%s': %s\n", - path, strerror(errno)); - free(path); - goto done; - } - } - - } else if (type == TYPE_FILE) { - typeName = "file"; - off_t size = read_int64(fh, -1); - if (size < 0) { - fprintf(stderr, "bad file size %ld in restore file\n", size); - free(path); - goto done; - } - - printf("Restoring file %s...\n", path); - - FILE* dest = fopen(path, "w"); - if (dest == NULL) { - fprintf(stderr, "unable to open destination file '%s': %s\n", - path, strerror(errno)); - free(path); - goto done; - } - - int copyres = copy_file(dest, fh, size, path, NULL); - fclose(dest); - if (!copyres) { - free(path); - goto done; - } - - } else { - fprintf(stderr, "unknown node type %d\n", type); - goto done; - } - - // Do this even for directories, since the dir may have already existed - // so we need to make sure it gets the correct mode. - if (chmod(path, statBuffer.st_mode&(S_IRWXU|S_IRWXG|S_IRWXO)) != 0) { - fprintf(stderr, "unable to chmod destination %s '%s' to 0x%x: %s\n", - typeName, path, statBuffer.st_mode, strerror(errno)); - free(path); - goto done; - } - - if (chown(path, statBuffer.st_uid, statBuffer.st_gid) != 0) { - fprintf(stderr, "unable to chown destination %s '%s' to uid %d / gid %d: %s\n", - typeName, path, (int)statBuffer.st_uid, (int)statBuffer.st_gid, strerror(errno)); - free(path); - goto done; - } - - struct utimbuf timbuf; - timbuf.actime = statBuffer.st_atime; - timbuf.modtime = statBuffer.st_mtime; - if (utime(path, &timbuf) != 0) { - fprintf(stderr, "unable to utime destination %s '%s': %s\n", - typeName, path, strerror(errno)); - free(path); - goto done; - } - - - free(path); - } - - res = 0; - -done: - fclose(fh); - - return res; -} - -static void show_help(const char *cmd) -{ - fprintf(stderr,"Usage: %s COMMAND [options] [backup-file-path]\n", cmd); - - fprintf(stderr, "commands are:\n" - " help Show this help text.\n" - " backup Perform a backup of /data.\n" - " restore Perform a restore of /data.\n"); - fprintf(stderr, "options include:\n" - " -h Show this help text.\n" - " -a Backup all files.\n"); - fprintf(stderr, "\n backup-file-path Defaults to /sdcard/backup.dat .\n" - " On devices that emulate the sdcard, you will need to\n" - " explicitly specify the directory it is mapped to,\n" - " to avoid recursive backup or deletion of the backup file\n" - " during restore.\n\n" - " Eg. /data/media/0/backup.dat\n"); - fprintf(stderr, "\nThe %s command allows you to perform low-level\n" - "backup and restore of the /data partition. This is\n" - "where all user data is kept, allowing for a fairly\n" - "complete restore of a device's state. Note that\n" - "because this is low-level, it will only work across\n" - "builds of the same (or very similar) device software.\n", - cmd); -} - -} /* namespace android */ - -int main (int argc, char **argv) -{ - int restore = 0; - - if (getuid() != AID_ROOT) { - fprintf(stderr, "error -- %s must run as root\n", argv[0]); - exit(-1); - } - - if (argc < 2) { - fprintf(stderr, "No command specified.\n"); - android::show_help(argv[0]); - exit(-1); - } - - if (0 == strcmp(argv[1], "restore")) { - restore = 1; - } else if (0 == strcmp(argv[1], "help")) { - android::show_help(argv[0]); - exit(0); - } else if (0 != strcmp(argv[1], "backup")) { - fprintf(stderr, "Unknown command: %s\n", argv[1]); - android::show_help(argv[0]); - exit(-1); - } - - android::opt_backupAll = 0; - - optind = 2; - - for (;;) { - int ret; - - ret = getopt(argc, argv, "ah"); - - if (ret < 0) { - break; - } - - switch(ret) { - case 'a': - android::opt_backupAll = 1; - if (restore) fprintf(stderr, "Warning: -a option ignored on restore\n"); - break; - case 'h': - android::show_help(argv[0]); - exit(0); - break; - - default: - fprintf(stderr,"Unrecognized Option\n"); - android::show_help(argv[0]); - exit(-1); - break; - } - } - - const char* backupFile = "/sdcard/backup.dat"; - - if (argc > optind) { - backupFile = argv[optind]; - optind++; - if (argc != optind) { - fprintf(stderr, "Too many arguments\n"); - android::show_help(argv[0]); - exit(-1); - } - } - - printf("Stopping system...\n"); - property_set("ctl.stop", "runtime"); - property_set("ctl.stop", "zygote"); - sleep(1); - - int res; - if (restore) { - res = android::restore_data(backupFile); - if (res != 0) { - // Don't restart system, since the data partition is hosed. - return res; - } - printf("Restore complete! Restarting system, cross your fingers...\n"); - } else { - res = android::backup_data(backupFile); - if (res == 0) { - printf("Backup complete! Restarting system...\n"); - } else { - printf("Restarting system...\n"); - } - } - - property_set("ctl.start", "zygote"); - property_set("ctl.start", "runtime"); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/rawbu/NOTICE android-platform-frameworks-native-21/cmds/rawbu/NOTICE --- android-platform-frameworks-native-6.0.1+r16/cmds/rawbu/NOTICE 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/rawbu/NOTICE 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ - - Copyright (c) 2005-2008, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/service/Android.mk android-platform-frameworks-native-21/cmds/service/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/service/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/service/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,16 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - service.cpp - -LOCAL_SHARED_LIBRARIES := libutils libbinder - -ifeq ($(TARGET_OS),linux) - LOCAL_CFLAGS += -DXP_UNIX - #LOCAL_SHARED_LIBRARIES += librt -endif - -LOCAL_MODULE:= service - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/service/NOTICE android-platform-frameworks-native-21/cmds/service/NOTICE --- android-platform-frameworks-native-6.0.1+r16/cmds/service/NOTICE 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/service/NOTICE 1970-01-01 00:00:00.000000000 +0000 @@ -1,190 +0,0 @@ - - Copyright (c) 2005-2008, 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. - - 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. - - - Apache License - Version 2.0, January 2004 - http://www.apache.org/licenses/ - - TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - - 1. Definitions. - - "License" shall mean the terms and conditions for use, reproduction, - and distribution as defined by Sections 1 through 9 of this document. - - "Licensor" shall mean the copyright owner or entity authorized by - the copyright owner that is granting the License. - - "Legal Entity" shall mean the union of the acting entity and all - other entities that control, are controlled by, or are under common - control with that entity. For the purposes of this definition, - "control" means (i) the power, direct or indirect, to cause the - direction or management of such entity, whether by contract or - otherwise, or (ii) ownership of fifty percent (50%) or more of the - outstanding shares, or (iii) beneficial ownership of such entity. - - "You" (or "Your") shall mean an individual or Legal Entity - exercising permissions granted by this License. - - "Source" form shall mean the preferred form for making modifications, - including but not limited to software source code, documentation - source, and configuration files. - - "Object" form shall mean any form resulting from mechanical - transformation or translation of a Source form, including but - not limited to compiled object code, generated documentation, - and conversions to other media types. - - "Work" shall mean the work of authorship, whether in Source or - Object form, made available under the License, as indicated by a - copyright notice that is included in or attached to the work - (an example is provided in the Appendix below). - - "Derivative Works" shall mean any work, whether in Source or Object - form, that is based on (or derived from) the Work and for which the - editorial revisions, annotations, elaborations, or other modifications - represent, as a whole, an original work of authorship. For the purposes - of this License, Derivative Works shall not include works that remain - separable from, or merely link (or bind by name) to the interfaces of, - the Work and Derivative Works thereof. - - "Contribution" shall mean any work of authorship, including - the original version of the Work and any modifications or additions - to that Work or Derivative Works thereof, that is intentionally - submitted to Licensor for inclusion in the Work by the copyright owner - or by an individual or Legal Entity authorized to submit on behalf of - the copyright owner. For the purposes of this definition, "submitted" - means any form of electronic, verbal, or written communication sent - to the Licensor or its representatives, including but not limited to - communication on electronic mailing lists, source code control systems, - and issue tracking systems that are managed by, or on behalf of, the - Licensor for the purpose of discussing and improving the Work, but - excluding communication that is conspicuously marked or otherwise - designated in writing by the copyright owner as "Not a Contribution." - - "Contributor" shall mean Licensor and any individual or Legal Entity - on behalf of whom a Contribution has been received by Licensor and - subsequently incorporated within the Work. - - 2. Grant of Copyright License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - copyright license to reproduce, prepare Derivative Works of, - publicly display, publicly perform, sublicense, and distribute the - Work and such Derivative Works in Source or Object form. - - 3. Grant of Patent License. Subject to the terms and conditions of - this License, each Contributor hereby grants to You a perpetual, - worldwide, non-exclusive, no-charge, royalty-free, irrevocable - (except as stated in this section) patent license to make, have made, - use, offer to sell, sell, import, and otherwise transfer the Work, - where such license applies only to those patent claims licensable - by such Contributor that are necessarily infringed by their - Contribution(s) alone or by combination of their Contribution(s) - with the Work to which such Contribution(s) was submitted. If You - institute patent litigation against any entity (including a - cross-claim or counterclaim in a lawsuit) alleging that the Work - or a Contribution incorporated within the Work constitutes direct - or contributory patent infringement, then any patent licenses - granted to You under this License for that Work shall terminate - as of the date such litigation is filed. - - 4. Redistribution. You may reproduce and distribute copies of the - Work or Derivative Works thereof in any medium, with or without - modifications, and in Source or Object form, provided that You - meet the following conditions: - - (a) You must give any other recipients of the Work or - Derivative Works a copy of this License; and - - (b) You must cause any modified files to carry prominent notices - stating that You changed the files; and - - (c) You must retain, in the Source form of any Derivative Works - that You distribute, all copyright, patent, trademark, and - attribution notices from the Source form of the Work, - excluding those notices that do not pertain to any part of - the Derivative Works; and - - (d) If the Work includes a "NOTICE" text file as part of its - distribution, then any Derivative Works that You distribute must - include a readable copy of the attribution notices contained - within such NOTICE file, excluding those notices that do not - pertain to any part of the Derivative Works, in at least one - of the following places: within a NOTICE text file distributed - as part of the Derivative Works; within the Source form or - documentation, if provided along with the Derivative Works; or, - within a display generated by the Derivative Works, if and - wherever such third-party notices normally appear. The contents - of the NOTICE file are for informational purposes only and - do not modify the License. You may add Your own attribution - notices within Derivative Works that You distribute, alongside - or as an addendum to the NOTICE text from the Work, provided - that such additional attribution notices cannot be construed - as modifying the License. - - You may add Your own copyright statement to Your modifications and - may provide additional or different license terms and conditions - for use, reproduction, or distribution of Your modifications, or - for any such Derivative Works as a whole, provided Your use, - reproduction, and distribution of the Work otherwise complies with - the conditions stated in this License. - - 5. Submission of Contributions. Unless You explicitly state otherwise, - any Contribution intentionally submitted for inclusion in the Work - by You to the Licensor shall be under the terms and conditions of - this License, without any additional terms or conditions. - Notwithstanding the above, nothing herein shall supersede or modify - the terms of any separate license agreement you may have executed - with Licensor regarding such Contributions. - - 6. Trademarks. This License does not grant permission to use the trade - names, trademarks, service marks, or product names of the Licensor, - except as required for reasonable and customary use in describing the - origin of the Work and reproducing the content of the NOTICE file. - - 7. Disclaimer of Warranty. Unless required by applicable law or - agreed to in writing, Licensor provides the Work (and each - Contributor provides its Contributions) on an "AS IS" BASIS, - WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or - implied, including, without limitation, any warranties or conditions - of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A - PARTICULAR PURPOSE. You are solely responsible for determining the - appropriateness of using or redistributing the Work and assume any - risks associated with Your exercise of permissions under this License. - - 8. Limitation of Liability. In no event and under no legal theory, - whether in tort (including negligence), contract, or otherwise, - unless required by applicable law (such as deliberate and grossly - negligent acts) or agreed to in writing, shall any Contributor be - liable to You for damages, including any direct, indirect, special, - incidental, or consequential damages of any character arising as a - result of this License or out of the use or inability to use the - Work (including but not limited to damages for loss of goodwill, - work stoppage, computer failure or malfunction, or any and all - other commercial damages or losses), even if such Contributor - has been advised of the possibility of such damages. - - 9. Accepting Warranty or Additional Liability. While redistributing - the Work or Derivative Works thereof, You may choose to offer, - and charge a fee for, acceptance of support, warranty, indemnity, - or other liability obligations and/or rights consistent with this - License. However, in accepting such obligations, You may act only - on Your own behalf and on Your sole responsibility, not on behalf - of any other Contributor, and only if You agree to indemnify, - defend, and hold each Contributor harmless for any liability - incurred by, or claims asserted against, such Contributor by reason - of your accepting any such warranty or additional liability. - - END OF TERMS AND CONDITIONS - diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/service/service.cpp android-platform-frameworks-native-21/cmds/service/service.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/service/service.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/service/service.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,316 +0,0 @@ -/* - * Copyright 2013 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 -#include -#include -#include - -#include -#include -#include -#include -#include -#include - -using namespace android; - -void writeString16(Parcel& parcel, const char* string) -{ - if (string != NULL) - { - parcel.writeString16(String16(string)); - } - else - { - parcel.writeInt32(-1); - } -} - -// get the name of the generic interface we hold a reference to -static String16 get_interface_name(sp service) -{ - if (service != NULL) { - Parcel data, reply; - status_t err = service->transact(IBinder::INTERFACE_TRANSACTION, data, &reply); - if (err == NO_ERROR) { - return reply.readString16(); - } - } - return String16(); -} - -static String8 good_old_string(const String16& src) -{ - String8 name8; - char ch8[2]; - ch8[1] = 0; - for (unsigned j = 0; j < src.size(); j++) { - char16_t ch = src[j]; - if (ch < 128) ch8[0] = (char)ch; - name8.append(ch8); - } - return name8; -} - -int main(int argc, char* const argv[]) -{ - sp sm = defaultServiceManager(); - fflush(stdout); - if (sm == NULL) { - aerr << "service: Unable to get default service manager!" << endl; - return 20; - } - - bool wantsUsage = false; - int result = 0; - - while (1) { - int ic = getopt(argc, argv, "h?"); - if (ic < 0) - break; - - switch (ic) { - case 'h': - case '?': - wantsUsage = true; - break; - default: - aerr << "service: Unknown option -" << ic << endl; - wantsUsage = true; - result = 10; - break; - } - } - - if (optind >= argc) { - wantsUsage = true; - } else if (!wantsUsage) { - if (strcmp(argv[optind], "check") == 0) { - optind++; - if (optind < argc) { - sp service = sm->checkService(String16(argv[optind])); - aout << "Service " << argv[optind] << - (service == NULL ? ": not found" : ": found") << endl; - } else { - aerr << "service: No service specified for check" << endl; - wantsUsage = true; - result = 10; - } - } - else if (strcmp(argv[optind], "list") == 0) { - Vector services = sm->listServices(); - aout << "Found " << services.size() << " services:" << endl; - for (unsigned i = 0; i < services.size(); i++) { - String16 name = services[i]; - sp service = sm->checkService(name); - aout << i - << "\t" << good_old_string(name) - << ": [" << good_old_string(get_interface_name(service)) << "]" - << endl; - } - } else if (strcmp(argv[optind], "call") == 0) { - optind++; - if (optind+1 < argc) { - int serviceArg = optind; - sp service = sm->checkService(String16(argv[optind++])); - String16 ifName = get_interface_name(service); - int32_t code = atoi(argv[optind++]); - if (service != NULL && ifName.size() > 0) { - Parcel data, reply; - - // the interface name is first - data.writeInterfaceToken(ifName); - - // then the rest of the call arguments - while (optind < argc) { - if (strcmp(argv[optind], "i32") == 0) { - optind++; - if (optind >= argc) { - aerr << "service: no integer supplied for 'i32'" << endl; - wantsUsage = true; - result = 10; - break; - } - data.writeInt32(atoi(argv[optind++])); - } else if (strcmp(argv[optind], "i64") == 0) { - optind++; - if (optind >= argc) { - aerr << "service: no integer supplied for 'i64'" << endl; - wantsUsage = true; - result = 10; - break; - } - data.writeInt64(atoll(argv[optind++])); - } else if (strcmp(argv[optind], "s16") == 0) { - optind++; - if (optind >= argc) { - aerr << "service: no string supplied for 's16'" << endl; - wantsUsage = true; - result = 10; - break; - } - data.writeString16(String16(argv[optind++])); - } else if (strcmp(argv[optind], "f") == 0) { - optind++; - if (optind >= argc) { - aerr << "service: no number supplied for 'f'" << endl; - wantsUsage = true; - result = 10; - break; - } - data.writeFloat(atof(argv[optind++])); - } else if (strcmp(argv[optind], "d") == 0) { - optind++; - if (optind >= argc) { - aerr << "service: no number supplied for 'd'" << endl; - wantsUsage = true; - result = 10; - break; - } - data.writeDouble(atof(argv[optind++])); - } else if (strcmp(argv[optind], "null") == 0) { - optind++; - data.writeStrongBinder(NULL); - } else if (strcmp(argv[optind], "intent") == 0) { - - char* action = NULL; - char* dataArg = NULL; - char* type = NULL; - int launchFlags = 0; - char* component = NULL; - int categoryCount = 0; - char* categories[16]; - - char* context1 = NULL; - - optind++; - - while (optind < argc) - { - char* key = strtok_r(argv[optind], "=", &context1); - char* value = strtok_r(NULL, "=", &context1); - - // we have reached the end of the XXX=XXX args. - if (key == NULL) break; - - if (strcmp(key, "action") == 0) - { - action = value; - } - else if (strcmp(key, "data") == 0) - { - dataArg = value; - } - else if (strcmp(key, "type") == 0) - { - type = value; - } - else if (strcmp(key, "launchFlags") == 0) - { - launchFlags = atoi(value); - } - else if (strcmp(key, "component") == 0) - { - component = value; - } - else if (strcmp(key, "categories") == 0) - { - char* context2 = NULL; - int categoryCount = 0; - categories[categoryCount] = strtok_r(value, ",", &context2); - - while (categories[categoryCount] != NULL) - { - categoryCount++; - categories[categoryCount] = strtok_r(NULL, ",", &context2); - } - } - - optind++; - } - - writeString16(data, action); - writeString16(data, dataArg); - writeString16(data, type); - data.writeInt32(launchFlags); - writeString16(data, component); - - if (categoryCount > 0) - { - data.writeInt32(categoryCount); - for (int i = 0 ; i < categoryCount ; i++) - { - writeString16(data, categories[i]); - } - } - else - { - data.writeInt32(0); - } - - // for now just set the extra field to be null. - data.writeInt32(-1); - } else { - aerr << "service: unknown option " << argv[optind] << endl; - wantsUsage = true; - result = 10; - break; - } - } - - service->transact(code, data, &reply); - aout << "Result: " << reply << endl; - } else { - aerr << "service: Service " << argv[serviceArg] - << " does not exist" << endl; - result = 10; - } - } else { - if (optind < argc) { - aerr << "service: No service specified for call" << endl; - } else { - aerr << "service: No code specified for call" << endl; - } - wantsUsage = true; - result = 10; - } - } else { - aerr << "service: Unknown command " << argv[optind] << endl; - wantsUsage = true; - result = 10; - } - } - - if (wantsUsage) { - aout << "Usage: service [-h|-?]\n" - " service list\n" - " service check SERVICE\n" - " service call SERVICE CODE [i32 N | i64 N | f N | d N | s16 STR ] ...\n" - "Options:\n" - " i32: Write the 32-bit integer N into the send parcel.\n" - " i64: Write the 64-bit integer N into the send parcel.\n" - " f: Write the 32-bit single-precision number N into the send parcel.\n" - " d: Write the 64-bit double-precision number N into the send parcel.\n" - " s16: Write the UTF-16 string STR into the send parcel.\n"; -// " intent: Write and Intent int the send parcel. ARGS can be\n" -// " action=STR data=STR type=STR launchFlags=INT component=STR categories=STR[,STR,...]\n"; - return result; - } - - return result; -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/Android.mk android-platform-frameworks-native-21/cmds/servicemanager/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/servicemanager/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -LOCAL_PATH:= $(call my-dir) - -svc_c_flags = \ - -Wall -Wextra \ - -ifneq ($(TARGET_USES_64_BIT_BINDER),true) -ifneq ($(TARGET_IS_64_BIT),true) -svc_c_flags += -DBINDER_IPC_32BIT=1 -endif -endif - -include $(CLEAR_VARS) -LOCAL_SHARED_LIBRARIES := liblog -LOCAL_SRC_FILES := bctest.c binder.c -LOCAL_CFLAGS += $(svc_c_flags) -LOCAL_MODULE := bctest -LOCAL_MODULE_TAGS := optional -include $(BUILD_EXECUTABLE) - -include $(CLEAR_VARS) -LOCAL_SHARED_LIBRARIES := liblog libselinux -LOCAL_SRC_FILES := service_manager.c binder.c -LOCAL_CFLAGS += $(svc_c_flags) -LOCAL_MODULE := servicemanager -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/bctest.c android-platform-frameworks-native-21/cmds/servicemanager/bctest.c --- android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/bctest.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/servicemanager/bctest.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/* Copyright 2008 The Android Open Source Project - */ - -#include -#include -#include -#include - -#include "binder.h" - -uint32_t svcmgr_lookup(struct binder_state *bs, uint32_t target, const char *name) -{ - uint32_t handle; - unsigned iodata[512/4]; - struct binder_io msg, reply; - - bio_init(&msg, iodata, sizeof(iodata), 4); - bio_put_uint32(&msg, 0); // strict mode header - bio_put_string16_x(&msg, SVC_MGR_NAME); - bio_put_string16_x(&msg, name); - - if (binder_call(bs, &msg, &reply, target, SVC_MGR_CHECK_SERVICE)) - return 0; - - handle = bio_get_ref(&reply); - - if (handle) - binder_acquire(bs, handle); - - binder_done(bs, &msg, &reply); - - return handle; -} - -int svcmgr_publish(struct binder_state *bs, uint32_t target, const char *name, void *ptr) -{ - int status; - unsigned iodata[512/4]; - struct binder_io msg, reply; - - bio_init(&msg, iodata, sizeof(iodata), 4); - bio_put_uint32(&msg, 0); // strict mode header - bio_put_string16_x(&msg, SVC_MGR_NAME); - bio_put_string16_x(&msg, name); - bio_put_obj(&msg, ptr); - - if (binder_call(bs, &msg, &reply, target, SVC_MGR_ADD_SERVICE)) - return -1; - - status = bio_get_uint32(&reply); - - binder_done(bs, &msg, &reply); - - return status; -} - -unsigned token; - -int main(int argc, char **argv) -{ - int fd; - struct binder_state *bs; - uint32_t svcmgr = BINDER_SERVICE_MANAGER; - uint32_t handle; - - bs = binder_open(128*1024); - if (!bs) { - fprintf(stderr, "failed to open binder driver\n"); - return -1; - } - - argc--; - argv++; - while (argc > 0) { - if (!strcmp(argv[0],"alt")) { - handle = svcmgr_lookup(bs, svcmgr, "alt_svc_mgr"); - if (!handle) { - fprintf(stderr,"cannot find alt_svc_mgr\n"); - return -1; - } - svcmgr = handle; - fprintf(stderr,"svcmgr is via %x\n", handle); - } else if (!strcmp(argv[0],"lookup")) { - if (argc < 2) { - fprintf(stderr,"argument required\n"); - return -1; - } - handle = svcmgr_lookup(bs, svcmgr, argv[1]); - fprintf(stderr,"lookup(%s) = %x\n", argv[1], handle); - argc--; - argv++; - } else if (!strcmp(argv[0],"publish")) { - if (argc < 2) { - fprintf(stderr,"argument required\n"); - return -1; - } - svcmgr_publish(bs, svcmgr, argv[1], &token); - argc--; - argv++; - } else { - fprintf(stderr,"unknown command %s\n", argv[0]); - return -1; - } - argc--; - argv++; - } - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/binder.c android-platform-frameworks-native-21/cmds/servicemanager/binder.c --- android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/binder.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/servicemanager/binder.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,639 +0,0 @@ -/* Copyright 2008 The Android Open Source Project - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -#include "binder.h" - -#define MAX_BIO_SIZE (1 << 30) - -#define TRACE 0 - -#define LOG_TAG "Binder" -#include - -void bio_init_from_txn(struct binder_io *io, struct binder_transaction_data *txn); - -#if TRACE -void hexdump(void *_data, size_t len) -{ - unsigned char *data = _data; - size_t count; - - for (count = 0; count < len; count++) { - if ((count & 15) == 0) - fprintf(stderr,"%04zu:", count); - fprintf(stderr," %02x %c", *data, - (*data < 32) || (*data > 126) ? '.' : *data); - data++; - if ((count & 15) == 15) - fprintf(stderr,"\n"); - } - if ((count & 15) != 0) - fprintf(stderr,"\n"); -} - -void binder_dump_txn(struct binder_transaction_data *txn) -{ - struct flat_binder_object *obj; - binder_size_t *offs = (binder_size_t *)(uintptr_t)txn->data.ptr.offsets; - size_t count = txn->offsets_size / sizeof(binder_size_t); - - fprintf(stderr," target %016"PRIx64" cookie %016"PRIx64" code %08x flags %08x\n", - (uint64_t)txn->target.ptr, (uint64_t)txn->cookie, txn->code, txn->flags); - fprintf(stderr," pid %8d uid %8d data %"PRIu64" offs %"PRIu64"\n", - txn->sender_pid, txn->sender_euid, (uint64_t)txn->data_size, (uint64_t)txn->offsets_size); - hexdump((void *)(uintptr_t)txn->data.ptr.buffer, txn->data_size); - while (count--) { - obj = (struct flat_binder_object *) (((char*)(uintptr_t)txn->data.ptr.buffer) + *offs++); - fprintf(stderr," - type %08x flags %08x ptr %016"PRIx64" cookie %016"PRIx64"\n", - obj->type, obj->flags, (uint64_t)obj->binder, (uint64_t)obj->cookie); - } -} - -#define NAME(n) case n: return #n -const char *cmd_name(uint32_t cmd) -{ - switch(cmd) { - NAME(BR_NOOP); - NAME(BR_TRANSACTION_COMPLETE); - NAME(BR_INCREFS); - NAME(BR_ACQUIRE); - NAME(BR_RELEASE); - NAME(BR_DECREFS); - NAME(BR_TRANSACTION); - NAME(BR_REPLY); - NAME(BR_FAILED_REPLY); - NAME(BR_DEAD_REPLY); - NAME(BR_DEAD_BINDER); - default: return "???"; - } -} -#else -#define hexdump(a,b) do{} while (0) -#define binder_dump_txn(txn) do{} while (0) -#endif - -#define BIO_F_SHARED 0x01 /* needs to be buffer freed */ -#define BIO_F_OVERFLOW 0x02 /* ran out of space */ -#define BIO_F_IOERROR 0x04 -#define BIO_F_MALLOCED 0x08 /* needs to be free()'d */ - -struct binder_state -{ - int fd; - void *mapped; - size_t mapsize; -}; - -struct binder_state *binder_open(size_t mapsize) -{ - struct binder_state *bs; - struct binder_version vers; - - bs = malloc(sizeof(*bs)); - if (!bs) { - errno = ENOMEM; - return NULL; - } - - bs->fd = open("/dev/binder", O_RDWR); - if (bs->fd < 0) { - fprintf(stderr,"binder: cannot open device (%s)\n", - strerror(errno)); - goto fail_open; - } - - if ((ioctl(bs->fd, BINDER_VERSION, &vers) == -1) || - (vers.protocol_version != BINDER_CURRENT_PROTOCOL_VERSION)) { - fprintf(stderr, - "binder: kernel driver version (%d) differs from user space version (%d)\n", - vers.protocol_version, BINDER_CURRENT_PROTOCOL_VERSION); - goto fail_open; - } - - bs->mapsize = mapsize; - bs->mapped = mmap(NULL, mapsize, PROT_READ, MAP_PRIVATE, bs->fd, 0); - if (bs->mapped == MAP_FAILED) { - fprintf(stderr,"binder: cannot map device (%s)\n", - strerror(errno)); - goto fail_map; - } - - return bs; - -fail_map: - close(bs->fd); -fail_open: - free(bs); - return NULL; -} - -void binder_close(struct binder_state *bs) -{ - munmap(bs->mapped, bs->mapsize); - close(bs->fd); - free(bs); -} - -int binder_become_context_manager(struct binder_state *bs) -{ - return ioctl(bs->fd, BINDER_SET_CONTEXT_MGR, 0); -} - -int binder_write(struct binder_state *bs, void *data, size_t len) -{ - struct binder_write_read bwr; - int res; - - bwr.write_size = len; - bwr.write_consumed = 0; - bwr.write_buffer = (uintptr_t) data; - bwr.read_size = 0; - bwr.read_consumed = 0; - bwr.read_buffer = 0; - res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); - if (res < 0) { - fprintf(stderr,"binder_write: ioctl failed (%s)\n", - strerror(errno)); - } - return res; -} - -void binder_send_reply(struct binder_state *bs, - struct binder_io *reply, - binder_uintptr_t buffer_to_free, - int status) -{ - struct { - uint32_t cmd_free; - binder_uintptr_t buffer; - uint32_t cmd_reply; - struct binder_transaction_data txn; - } __attribute__((packed)) data; - - data.cmd_free = BC_FREE_BUFFER; - data.buffer = buffer_to_free; - data.cmd_reply = BC_REPLY; - data.txn.target.ptr = 0; - data.txn.cookie = 0; - data.txn.code = 0; - if (status) { - data.txn.flags = TF_STATUS_CODE; - data.txn.data_size = sizeof(int); - data.txn.offsets_size = 0; - data.txn.data.ptr.buffer = (uintptr_t)&status; - data.txn.data.ptr.offsets = 0; - } else { - data.txn.flags = 0; - data.txn.data_size = reply->data - reply->data0; - data.txn.offsets_size = ((char*) reply->offs) - ((char*) reply->offs0); - data.txn.data.ptr.buffer = (uintptr_t)reply->data0; - data.txn.data.ptr.offsets = (uintptr_t)reply->offs0; - } - binder_write(bs, &data, sizeof(data)); -} - -int binder_parse(struct binder_state *bs, struct binder_io *bio, - uintptr_t ptr, size_t size, binder_handler func) -{ - int r = 1; - uintptr_t end = ptr + (uintptr_t) size; - - while (ptr < end) { - uint32_t cmd = *(uint32_t *) ptr; - ptr += sizeof(uint32_t); -#if TRACE - fprintf(stderr,"%s:\n", cmd_name(cmd)); -#endif - switch(cmd) { - case BR_NOOP: - break; - case BR_TRANSACTION_COMPLETE: - break; - case BR_INCREFS: - case BR_ACQUIRE: - case BR_RELEASE: - case BR_DECREFS: -#if TRACE - fprintf(stderr," %p, %p\n", (void *)ptr, (void *)(ptr + sizeof(void *))); -#endif - ptr += sizeof(struct binder_ptr_cookie); - break; - case BR_TRANSACTION: { - struct binder_transaction_data *txn = (struct binder_transaction_data *) ptr; - if ((end - ptr) < sizeof(*txn)) { - ALOGE("parse: txn too small!\n"); - return -1; - } - binder_dump_txn(txn); - if (func) { - unsigned rdata[256/4]; - struct binder_io msg; - struct binder_io reply; - int res; - - bio_init(&reply, rdata, sizeof(rdata), 4); - bio_init_from_txn(&msg, txn); - res = func(bs, txn, &msg, &reply); - binder_send_reply(bs, &reply, txn->data.ptr.buffer, res); - } - ptr += sizeof(*txn); - break; - } - case BR_REPLY: { - struct binder_transaction_data *txn = (struct binder_transaction_data *) ptr; - if ((end - ptr) < sizeof(*txn)) { - ALOGE("parse: reply too small!\n"); - return -1; - } - binder_dump_txn(txn); - if (bio) { - bio_init_from_txn(bio, txn); - bio = 0; - } else { - /* todo FREE BUFFER */ - } - ptr += sizeof(*txn); - r = 0; - break; - } - case BR_DEAD_BINDER: { - struct binder_death *death = (struct binder_death *)(uintptr_t) *(binder_uintptr_t *)ptr; - ptr += sizeof(binder_uintptr_t); - death->func(bs, death->ptr); - break; - } - case BR_FAILED_REPLY: - r = -1; - break; - case BR_DEAD_REPLY: - r = -1; - break; - default: - ALOGE("parse: OOPS %d\n", cmd); - return -1; - } - } - - return r; -} - -void binder_acquire(struct binder_state *bs, uint32_t target) -{ - uint32_t cmd[2]; - cmd[0] = BC_ACQUIRE; - cmd[1] = target; - binder_write(bs, cmd, sizeof(cmd)); -} - -void binder_release(struct binder_state *bs, uint32_t target) -{ - uint32_t cmd[2]; - cmd[0] = BC_RELEASE; - cmd[1] = target; - binder_write(bs, cmd, sizeof(cmd)); -} - -void binder_link_to_death(struct binder_state *bs, uint32_t target, struct binder_death *death) -{ - struct { - uint32_t cmd; - struct binder_handle_cookie payload; - } __attribute__((packed)) data; - - data.cmd = BC_REQUEST_DEATH_NOTIFICATION; - data.payload.handle = target; - data.payload.cookie = (uintptr_t) death; - binder_write(bs, &data, sizeof(data)); -} - -int binder_call(struct binder_state *bs, - struct binder_io *msg, struct binder_io *reply, - uint32_t target, uint32_t code) -{ - int res; - struct binder_write_read bwr; - struct { - uint32_t cmd; - struct binder_transaction_data txn; - } __attribute__((packed)) writebuf; - unsigned readbuf[32]; - - if (msg->flags & BIO_F_OVERFLOW) { - fprintf(stderr,"binder: txn buffer overflow\n"); - goto fail; - } - - writebuf.cmd = BC_TRANSACTION; - writebuf.txn.target.handle = target; - writebuf.txn.code = code; - writebuf.txn.flags = 0; - writebuf.txn.data_size = msg->data - msg->data0; - writebuf.txn.offsets_size = ((char*) msg->offs) - ((char*) msg->offs0); - writebuf.txn.data.ptr.buffer = (uintptr_t)msg->data0; - writebuf.txn.data.ptr.offsets = (uintptr_t)msg->offs0; - - bwr.write_size = sizeof(writebuf); - bwr.write_consumed = 0; - bwr.write_buffer = (uintptr_t) &writebuf; - - hexdump(msg->data0, msg->data - msg->data0); - for (;;) { - bwr.read_size = sizeof(readbuf); - bwr.read_consumed = 0; - bwr.read_buffer = (uintptr_t) readbuf; - - res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); - - if (res < 0) { - fprintf(stderr,"binder: ioctl failed (%s)\n", strerror(errno)); - goto fail; - } - - res = binder_parse(bs, reply, (uintptr_t) readbuf, bwr.read_consumed, 0); - if (res == 0) return 0; - if (res < 0) goto fail; - } - -fail: - memset(reply, 0, sizeof(*reply)); - reply->flags |= BIO_F_IOERROR; - return -1; -} - -void binder_loop(struct binder_state *bs, binder_handler func) -{ - int res; - struct binder_write_read bwr; - uint32_t readbuf[32]; - - bwr.write_size = 0; - bwr.write_consumed = 0; - bwr.write_buffer = 0; - - readbuf[0] = BC_ENTER_LOOPER; - binder_write(bs, readbuf, sizeof(uint32_t)); - - for (;;) { - bwr.read_size = sizeof(readbuf); - bwr.read_consumed = 0; - bwr.read_buffer = (uintptr_t) readbuf; - - res = ioctl(bs->fd, BINDER_WRITE_READ, &bwr); - - if (res < 0) { - ALOGE("binder_loop: ioctl failed (%s)\n", strerror(errno)); - break; - } - - res = binder_parse(bs, 0, (uintptr_t) readbuf, bwr.read_consumed, func); - if (res == 0) { - ALOGE("binder_loop: unexpected reply?!\n"); - break; - } - if (res < 0) { - ALOGE("binder_loop: io error %d %s\n", res, strerror(errno)); - break; - } - } -} - -void bio_init_from_txn(struct binder_io *bio, struct binder_transaction_data *txn) -{ - bio->data = bio->data0 = (char *)(intptr_t)txn->data.ptr.buffer; - bio->offs = bio->offs0 = (binder_size_t *)(intptr_t)txn->data.ptr.offsets; - bio->data_avail = txn->data_size; - bio->offs_avail = txn->offsets_size / sizeof(size_t); - bio->flags = BIO_F_SHARED; -} - -void bio_init(struct binder_io *bio, void *data, - size_t maxdata, size_t maxoffs) -{ - size_t n = maxoffs * sizeof(size_t); - - if (n > maxdata) { - bio->flags = BIO_F_OVERFLOW; - bio->data_avail = 0; - bio->offs_avail = 0; - return; - } - - bio->data = bio->data0 = (char *) data + n; - bio->offs = bio->offs0 = data; - bio->data_avail = maxdata - n; - bio->offs_avail = maxoffs; - bio->flags = 0; -} - -static void *bio_alloc(struct binder_io *bio, size_t size) -{ - size = (size + 3) & (~3); - if (size > bio->data_avail) { - bio->flags |= BIO_F_OVERFLOW; - return NULL; - } else { - void *ptr = bio->data; - bio->data += size; - bio->data_avail -= size; - return ptr; - } -} - -void binder_done(struct binder_state *bs, - struct binder_io *msg, - struct binder_io *reply) -{ - struct { - uint32_t cmd; - uintptr_t buffer; - } __attribute__((packed)) data; - - if (reply->flags & BIO_F_SHARED) { - data.cmd = BC_FREE_BUFFER; - data.buffer = (uintptr_t) reply->data0; - binder_write(bs, &data, sizeof(data)); - reply->flags = 0; - } -} - -static struct flat_binder_object *bio_alloc_obj(struct binder_io *bio) -{ - struct flat_binder_object *obj; - - obj = bio_alloc(bio, sizeof(*obj)); - - if (obj && bio->offs_avail) { - bio->offs_avail--; - *bio->offs++ = ((char*) obj) - ((char*) bio->data0); - return obj; - } - - bio->flags |= BIO_F_OVERFLOW; - return NULL; -} - -void bio_put_uint32(struct binder_io *bio, uint32_t n) -{ - uint32_t *ptr = bio_alloc(bio, sizeof(n)); - if (ptr) - *ptr = n; -} - -void bio_put_obj(struct binder_io *bio, void *ptr) -{ - struct flat_binder_object *obj; - - obj = bio_alloc_obj(bio); - if (!obj) - return; - - obj->flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; - obj->type = BINDER_TYPE_BINDER; - obj->binder = (uintptr_t)ptr; - obj->cookie = 0; -} - -void bio_put_ref(struct binder_io *bio, uint32_t handle) -{ - struct flat_binder_object *obj; - - if (handle) - obj = bio_alloc_obj(bio); - else - obj = bio_alloc(bio, sizeof(*obj)); - - if (!obj) - return; - - obj->flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; - obj->type = BINDER_TYPE_HANDLE; - obj->handle = handle; - obj->cookie = 0; -} - -void bio_put_string16(struct binder_io *bio, const uint16_t *str) -{ - size_t len; - uint16_t *ptr; - - if (!str) { - bio_put_uint32(bio, 0xffffffff); - return; - } - - len = 0; - while (str[len]) len++; - - if (len >= (MAX_BIO_SIZE / sizeof(uint16_t))) { - bio_put_uint32(bio, 0xffffffff); - return; - } - - /* Note: The payload will carry 32bit size instead of size_t */ - bio_put_uint32(bio, (uint32_t) len); - len = (len + 1) * sizeof(uint16_t); - ptr = bio_alloc(bio, len); - if (ptr) - memcpy(ptr, str, len); -} - -void bio_put_string16_x(struct binder_io *bio, const char *_str) -{ - unsigned char *str = (unsigned char*) _str; - size_t len; - uint16_t *ptr; - - if (!str) { - bio_put_uint32(bio, 0xffffffff); - return; - } - - len = strlen(_str); - - if (len >= (MAX_BIO_SIZE / sizeof(uint16_t))) { - bio_put_uint32(bio, 0xffffffff); - return; - } - - /* Note: The payload will carry 32bit size instead of size_t */ - bio_put_uint32(bio, len); - ptr = bio_alloc(bio, (len + 1) * sizeof(uint16_t)); - if (!ptr) - return; - - while (*str) - *ptr++ = *str++; - *ptr++ = 0; -} - -static void *bio_get(struct binder_io *bio, size_t size) -{ - size = (size + 3) & (~3); - - if (bio->data_avail < size){ - bio->data_avail = 0; - bio->flags |= BIO_F_OVERFLOW; - return NULL; - } else { - void *ptr = bio->data; - bio->data += size; - bio->data_avail -= size; - return ptr; - } -} - -uint32_t bio_get_uint32(struct binder_io *bio) -{ - uint32_t *ptr = bio_get(bio, sizeof(*ptr)); - return ptr ? *ptr : 0; -} - -uint16_t *bio_get_string16(struct binder_io *bio, size_t *sz) -{ - size_t len; - - /* Note: The payload will carry 32bit size instead of size_t */ - len = (size_t) bio_get_uint32(bio); - if (sz) - *sz = len; - return bio_get(bio, (len + 1) * sizeof(uint16_t)); -} - -static struct flat_binder_object *_bio_get_obj(struct binder_io *bio) -{ - size_t n; - size_t off = bio->data - bio->data0; - - /* TODO: be smarter about this? */ - for (n = 0; n < bio->offs_avail; n++) { - if (bio->offs[n] == off) - return bio_get(bio, sizeof(struct flat_binder_object)); - } - - bio->data_avail = 0; - bio->flags |= BIO_F_OVERFLOW; - return NULL; -} - -uint32_t bio_get_ref(struct binder_io *bio) -{ - struct flat_binder_object *obj; - - obj = _bio_get_obj(bio); - if (!obj) - return 0; - - if (obj->type == BINDER_TYPE_HANDLE) - return obj->handle; - - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/binder.h android-platform-frameworks-native-21/cmds/servicemanager/binder.h --- android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/binder.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/servicemanager/binder.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* Copyright 2008 The Android Open Source Project - */ - -#ifndef _BINDER_H_ -#define _BINDER_H_ - -#include -#include - -struct binder_state; - -struct binder_io -{ - char *data; /* pointer to read/write from */ - binder_size_t *offs; /* array of offsets */ - size_t data_avail; /* bytes available in data buffer */ - size_t offs_avail; /* entries available in offsets array */ - - char *data0; /* start of data buffer */ - binder_size_t *offs0; /* start of offsets buffer */ - uint32_t flags; - uint32_t unused; -}; - -struct binder_death { - void (*func)(struct binder_state *bs, void *ptr); - void *ptr; -}; - -/* the one magic handle */ -#define BINDER_SERVICE_MANAGER 0U - -#define SVC_MGR_NAME "android.os.IServiceManager" - -enum { - /* Must match definitions in IBinder.h and IServiceManager.h */ - PING_TRANSACTION = B_PACK_CHARS('_','P','N','G'), - SVC_MGR_GET_SERVICE = 1, - SVC_MGR_CHECK_SERVICE, - SVC_MGR_ADD_SERVICE, - SVC_MGR_LIST_SERVICES, -}; - -typedef int (*binder_handler)(struct binder_state *bs, - struct binder_transaction_data *txn, - struct binder_io *msg, - struct binder_io *reply); - -struct binder_state *binder_open(size_t mapsize); -void binder_close(struct binder_state *bs); - -/* initiate a blocking binder call - * - returns zero on success - */ -int binder_call(struct binder_state *bs, - struct binder_io *msg, struct binder_io *reply, - uint32_t target, uint32_t code); - -/* release any state associate with the binder_io - * - call once any necessary data has been extracted from the - * binder_io after binder_call() returns - * - can safely be called even if binder_call() fails - */ -void binder_done(struct binder_state *bs, - struct binder_io *msg, struct binder_io *reply); - -/* manipulate strong references */ -void binder_acquire(struct binder_state *bs, uint32_t target); -void binder_release(struct binder_state *bs, uint32_t target); - -void binder_link_to_death(struct binder_state *bs, uint32_t target, struct binder_death *death); - -void binder_loop(struct binder_state *bs, binder_handler func); - -int binder_become_context_manager(struct binder_state *bs); - -/* allocate a binder_io, providing a stack-allocated working - * buffer, size of the working buffer, and how many object - * offset entries to reserve from the buffer - */ -void bio_init(struct binder_io *bio, void *data, - size_t maxdata, size_t maxobjects); - -void bio_put_obj(struct binder_io *bio, void *ptr); -void bio_put_ref(struct binder_io *bio, uint32_t handle); -void bio_put_uint32(struct binder_io *bio, uint32_t n); -void bio_put_string16(struct binder_io *bio, const uint16_t *str); -void bio_put_string16_x(struct binder_io *bio, const char *_str); - -uint32_t bio_get_uint32(struct binder_io *bio); -uint16_t *bio_get_string16(struct binder_io *bio, size_t *sz); -uint32_t bio_get_ref(struct binder_io *bio); - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/service_manager.c android-platform-frameworks-native-21/cmds/servicemanager/service_manager.c --- android-platform-frameworks-native-6.0.1+r16/cmds/servicemanager/service_manager.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/servicemanager/service_manager.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,387 +0,0 @@ -/* Copyright 2008 The Android Open Source Project - */ - -#include -#include -#include -#include -#include -#include - -#include - -#include -#include - -#include "binder.h" - -#if 0 -#define ALOGI(x...) fprintf(stderr, "svcmgr: " x) -#define ALOGE(x...) fprintf(stderr, "svcmgr: " x) -#else -#define LOG_TAG "ServiceManager" -#include -#endif - -const char *str8(const uint16_t *x, size_t x_len) -{ - static char buf[128]; - size_t max = 127; - char *p = buf; - - if (x_len < max) { - max = x_len; - } - - if (x) { - while ((max > 0) && (*x != '\0')) { - *p++ = *x++; - max--; - } - } - *p++ = 0; - return buf; -} - -int str16eq(const uint16_t *a, const char *b) -{ - while (*a && *b) - if (*a++ != *b++) return 0; - if (*a || *b) - return 0; - return 1; -} - -static int selinux_enabled; -static char *service_manager_context; -static struct selabel_handle* sehandle; - -static bool check_mac_perms(pid_t spid, const char *tctx, const char *perm, const char *name) -{ - char *sctx = NULL; - const char *class = "service_manager"; - bool allowed; - - if (getpidcon(spid, &sctx) < 0) { - ALOGE("SELinux: getpidcon(pid=%d) failed to retrieve pid context.\n", spid); - return false; - } - - int result = selinux_check_access(sctx, tctx, class, perm, (void *) name); - allowed = (result == 0); - - freecon(sctx); - return allowed; -} - -static bool check_mac_perms_from_getcon(pid_t spid, const char *perm) -{ - if (selinux_enabled <= 0) { - return true; - } - - return check_mac_perms(spid, service_manager_context, perm, NULL); -} - -static bool check_mac_perms_from_lookup(pid_t spid, const char *perm, const char *name) -{ - bool allowed; - char *tctx = NULL; - - if (selinux_enabled <= 0) { - return true; - } - - if (!sehandle) { - ALOGE("SELinux: Failed to find sehandle. Aborting service_manager.\n"); - abort(); - } - - if (selabel_lookup(sehandle, &tctx, name, 0) != 0) { - ALOGE("SELinux: No match for %s in service_contexts.\n", name); - return false; - } - - allowed = check_mac_perms(spid, tctx, perm, name); - freecon(tctx); - return allowed; -} - -static int svc_can_register(const uint16_t *name, size_t name_len, pid_t spid) -{ - const char *perm = "add"; - return check_mac_perms_from_lookup(spid, perm, str8(name, name_len)) ? 1 : 0; -} - -static int svc_can_list(pid_t spid) -{ - const char *perm = "list"; - return check_mac_perms_from_getcon(spid, perm) ? 1 : 0; -} - -static int svc_can_find(const uint16_t *name, size_t name_len, pid_t spid) -{ - const char *perm = "find"; - return check_mac_perms_from_lookup(spid, perm, str8(name, name_len)) ? 1 : 0; -} - -struct svcinfo -{ - struct svcinfo *next; - uint32_t handle; - struct binder_death death; - int allow_isolated; - size_t len; - uint16_t name[0]; -}; - -struct svcinfo *svclist = NULL; - -struct svcinfo *find_svc(const uint16_t *s16, size_t len) -{ - struct svcinfo *si; - - for (si = svclist; si; si = si->next) { - if ((len == si->len) && - !memcmp(s16, si->name, len * sizeof(uint16_t))) { - return si; - } - } - return NULL; -} - -void svcinfo_death(struct binder_state *bs, void *ptr) -{ - struct svcinfo *si = (struct svcinfo* ) ptr; - - ALOGI("service '%s' died\n", str8(si->name, si->len)); - if (si->handle) { - binder_release(bs, si->handle); - si->handle = 0; - } -} - -uint16_t svcmgr_id[] = { - 'a','n','d','r','o','i','d','.','o','s','.', - 'I','S','e','r','v','i','c','e','M','a','n','a','g','e','r' -}; - - -uint32_t do_find_service(struct binder_state *bs, const uint16_t *s, size_t len, uid_t uid, pid_t spid) -{ - struct svcinfo *si = find_svc(s, len); - - if (!si || !si->handle) { - return 0; - } - - if (!si->allow_isolated) { - // If this service doesn't allow access from isolated processes, - // then check the uid to see if it is isolated. - uid_t appid = uid % AID_USER; - if (appid >= AID_ISOLATED_START && appid <= AID_ISOLATED_END) { - return 0; - } - } - - if (!svc_can_find(s, len, spid)) { - return 0; - } - - return si->handle; -} - -int do_add_service(struct binder_state *bs, - const uint16_t *s, size_t len, - uint32_t handle, uid_t uid, int allow_isolated, - pid_t spid) -{ - struct svcinfo *si; - - //ALOGI("add_service('%s',%x,%s) uid=%d\n", str8(s, len), handle, - // allow_isolated ? "allow_isolated" : "!allow_isolated", uid); - - if (!handle || (len == 0) || (len > 127)) - return -1; - - if (!svc_can_register(s, len, spid)) { - ALOGE("add_service('%s',%x) uid=%d - PERMISSION DENIED\n", - str8(s, len), handle, uid); - return -1; - } - - si = find_svc(s, len); - if (si) { - if (si->handle) { - ALOGE("add_service('%s',%x) uid=%d - ALREADY REGISTERED, OVERRIDE\n", - str8(s, len), handle, uid); - svcinfo_death(bs, si); - } - si->handle = handle; - } else { - si = malloc(sizeof(*si) + (len + 1) * sizeof(uint16_t)); - if (!si) { - ALOGE("add_service('%s',%x) uid=%d - OUT OF MEMORY\n", - str8(s, len), handle, uid); - return -1; - } - si->handle = handle; - si->len = len; - memcpy(si->name, s, (len + 1) * sizeof(uint16_t)); - si->name[len] = '\0'; - si->death.func = (void*) svcinfo_death; - si->death.ptr = si; - si->allow_isolated = allow_isolated; - si->next = svclist; - svclist = si; - } - - binder_acquire(bs, handle); - binder_link_to_death(bs, handle, &si->death); - return 0; -} - -int svcmgr_handler(struct binder_state *bs, - struct binder_transaction_data *txn, - struct binder_io *msg, - struct binder_io *reply) -{ - struct svcinfo *si; - uint16_t *s; - size_t len; - uint32_t handle; - uint32_t strict_policy; - int allow_isolated; - - //ALOGI("target=%p code=%d pid=%d uid=%d\n", - // (void*) txn->target.ptr, txn->code, txn->sender_pid, txn->sender_euid); - - if (txn->target.ptr != BINDER_SERVICE_MANAGER) - return -1; - - if (txn->code == PING_TRANSACTION) - return 0; - - // Equivalent to Parcel::enforceInterface(), reading the RPC - // header with the strict mode policy mask and the interface name. - // Note that we ignore the strict_policy and don't propagate it - // further (since we do no outbound RPCs anyway). - strict_policy = bio_get_uint32(msg); - s = bio_get_string16(msg, &len); - if (s == NULL) { - return -1; - } - - if ((len != (sizeof(svcmgr_id) / 2)) || - memcmp(svcmgr_id, s, sizeof(svcmgr_id))) { - fprintf(stderr,"invalid id %s\n", str8(s, len)); - return -1; - } - - if (sehandle && selinux_status_updated() > 0) { - struct selabel_handle *tmp_sehandle = selinux_android_service_context_handle(); - if (tmp_sehandle) { - selabel_close(sehandle); - sehandle = tmp_sehandle; - } - } - - switch(txn->code) { - case SVC_MGR_GET_SERVICE: - case SVC_MGR_CHECK_SERVICE: - s = bio_get_string16(msg, &len); - if (s == NULL) { - return -1; - } - handle = do_find_service(bs, s, len, txn->sender_euid, txn->sender_pid); - if (!handle) - break; - bio_put_ref(reply, handle); - return 0; - - case SVC_MGR_ADD_SERVICE: - s = bio_get_string16(msg, &len); - if (s == NULL) { - return -1; - } - handle = bio_get_ref(msg); - allow_isolated = bio_get_uint32(msg) ? 1 : 0; - if (do_add_service(bs, s, len, handle, txn->sender_euid, - allow_isolated, txn->sender_pid)) - return -1; - break; - - case SVC_MGR_LIST_SERVICES: { - uint32_t n = bio_get_uint32(msg); - - if (!svc_can_list(txn->sender_pid)) { - ALOGE("list_service() uid=%d - PERMISSION DENIED\n", - txn->sender_euid); - return -1; - } - si = svclist; - while ((n-- > 0) && si) - si = si->next; - if (si) { - bio_put_string16(reply, si->name); - return 0; - } - return -1; - } - default: - ALOGE("unknown code %d\n", txn->code); - return -1; - } - - bio_put_uint32(reply, 0); - return 0; -} - - -static int audit_callback(void *data, security_class_t cls, char *buf, size_t len) -{ - snprintf(buf, len, "service=%s", !data ? "NULL" : (char *)data); - return 0; -} - -int main(int argc, char **argv) -{ - struct binder_state *bs; - - bs = binder_open(128*1024); - if (!bs) { - ALOGE("failed to open binder driver\n"); - return -1; - } - - if (binder_become_context_manager(bs)) { - ALOGE("cannot become context manager (%s)\n", strerror(errno)); - return -1; - } - - selinux_enabled = is_selinux_enabled(); - sehandle = selinux_android_service_context_handle(); - selinux_status_open(true); - - if (selinux_enabled > 0) { - if (sehandle == NULL) { - ALOGE("SELinux: Failed to acquire sehandle. Aborting.\n"); - abort(); - } - - if (getcon(&service_manager_context) != 0) { - ALOGE("SELinux: Failed to acquire service_manager context. Aborting.\n"); - abort(); - } - } - - union selinux_callback cb; - cb.func_audit = audit_callback; - selinux_set_callback(SELINUX_CB_AUDIT, cb); - cb.func_log = selinux_log_callback; - selinux_set_callback(SELINUX_CB_LOG, cb); - - binder_loop(bs, svcmgr_handler); - - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/surfaceflinger/Android.mk android-platform-frameworks-native-21/cmds/surfaceflinger/Android.mk --- android-platform-frameworks-native-6.0.1+r16/cmds/surfaceflinger/Android.mk 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/surfaceflinger/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,17 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + main_surfaceflinger.cpp + +LOCAL_SHARED_LIBRARIES := \ + libsurfaceflinger \ + libbinder \ + libutils + +LOCAL_C_INCLUDES := \ + $(LOCAL_PATH)/../../services/surfaceflinger + +LOCAL_MODULE:= surfaceflinger + +include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/cmds/surfaceflinger/main_surfaceflinger.cpp android-platform-frameworks-native-21/cmds/surfaceflinger/main_surfaceflinger.cpp --- android-platform-frameworks-native-6.0.1+r16/cmds/surfaceflinger/main_surfaceflinger.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/cmds/surfaceflinger/main_surfaceflinger.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,28 @@ +/* + * Copyright (C) 2010 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 +#include + +using namespace android; + +int main(int argc, char** argv) { + SurfaceFlinger::publishAndJoinThreadPool(true); + // When SF is launched in its own process, limit the number of + // binder threads to 4. + ProcessState::self()->setThreadPoolMaxThreadCount(4); + return 0; +} diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.audio.output.xml android-platform-frameworks-native-21/data/etc/android.hardware.audio.output.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.audio.output.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.audio.output.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.audio.pro.xml android-platform-frameworks-native-21/data/etc/android.hardware.audio.pro.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.audio.pro.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.audio.pro.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.bluetooth_le.xml android-platform-frameworks-native-21/data/etc/android.hardware.bluetooth_le.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.bluetooth_le.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.bluetooth_le.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.autofocus.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.autofocus.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.autofocus.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.autofocus.xml 2012-10-16 22:57:11.000000000 +0000 @@ -16,7 +16,6 @@ - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.external.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.external.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.external.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.external.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.flash-autofocus.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.flash-autofocus.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.flash-autofocus.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.flash-autofocus.xml 2012-10-16 22:57:11.000000000 +0000 @@ -17,7 +17,6 @@ - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.front.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.front.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.front.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.front.xml 2012-10-16 22:57:11.000000000 +0000 @@ -16,6 +16,5 @@ - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.full.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.full.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.full.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.full.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ - - - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.manual_postprocessing.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.manual_postprocessing.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.manual_postprocessing.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.manual_postprocessing.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.manual_sensor.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.manual_sensor.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.manual_sensor.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.manual_sensor.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.raw.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.raw.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.raw.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.raw.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.xml android-platform-frameworks-native-21/data/etc/android.hardware.camera.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.camera.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.camera.xml 2012-10-16 22:57:11.000000000 +0000 @@ -16,6 +16,5 @@ - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.consumerir.xml android-platform-frameworks-native-21/data/etc/android.hardware.consumerir.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.consumerir.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.consumerir.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.ethernet.xml android-platform-frameworks-native-21/data/etc/android.hardware.ethernet.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.ethernet.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.ethernet.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.fingerprint.xml android-platform-frameworks-native-21/data/etc/android.hardware.fingerprint.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.fingerprint.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.fingerprint.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.gamepad.xml android-platform-frameworks-native-21/data/etc/android.hardware.gamepad.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.gamepad.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.gamepad.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.hdmi.cec.xml android-platform-frameworks-native-21/data/etc/android.hardware.hdmi.cec.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.hdmi.cec.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.hdmi.cec.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.nfc.hce.xml android-platform-frameworks-native-21/data/etc/android.hardware.nfc.hce.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.nfc.hce.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.nfc.hce.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,21 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.opengles.aep.xml android-platform-frameworks-native-21/data/etc/android.hardware.opengles.aep.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.opengles.aep.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.opengles.aep.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,22 +0,0 @@ - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.screen.landscape.xml android-platform-frameworks-native-21/data/etc/android.hardware.screen.landscape.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.screen.landscape.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.screen.landscape.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.screen.portrait.xml android-platform-frameworks-native-21/data/etc/android.hardware.screen.portrait.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.screen.portrait.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.screen.portrait.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.heartrate.ecg.xml android-platform-frameworks-native-21/data/etc/android.hardware.sensor.heartrate.ecg.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.heartrate.ecg.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.sensor.heartrate.ecg.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.heartrate.xml android-platform-frameworks-native-21/data/etc/android.hardware.sensor.heartrate.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.heartrate.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.sensor.heartrate.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.hifi_sensors.xml android-platform-frameworks-native-21/data/etc/android.hardware.sensor.hifi_sensors.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.hifi_sensors.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.sensor.hifi_sensors.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.stepcounter.xml android-platform-frameworks-native-21/data/etc/android.hardware.sensor.stepcounter.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.stepcounter.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.sensor.stepcounter.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.stepdetector.xml android-platform-frameworks-native-21/data/etc/android.hardware.sensor.stepdetector.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.hardware.sensor.stepdetector.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.hardware.sensor.stepdetector.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.app_widgets.xml android-platform-frameworks-native-21/data/etc/android.software.app_widgets.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.app_widgets.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.app_widgets.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.backup.xml android-platform-frameworks-native-21/data/etc/android.software.backup.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.backup.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.backup.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.connectionservice.xml android-platform-frameworks-native-21/data/etc/android.software.connectionservice.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.connectionservice.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.connectionservice.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.device_admin.xml android-platform-frameworks-native-21/data/etc/android.software.device_admin.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.device_admin.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.device_admin.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.live_tv.xml android-platform-frameworks-native-21/data/etc/android.software.live_tv.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.live_tv.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.live_tv.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.managed_users.xml android-platform-frameworks-native-21/data/etc/android.software.managed_users.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.managed_users.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.managed_users.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.midi.xml android-platform-frameworks-native-21/data/etc/android.software.midi.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.midi.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.midi.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.print.xml android-platform-frameworks-native-21/data/etc/android.software.print.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.print.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.print.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.securely_removes_users.xml android-platform-frameworks-native-21/data/etc/android.software.securely_removes_users.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.securely_removes_users.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.securely_removes_users.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.verified_boot.xml android-platform-frameworks-native-21/data/etc/android.software.verified_boot.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.verified_boot.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.verified_boot.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.voice_recognizers.xml android-platform-frameworks-native-21/data/etc/android.software.voice_recognizers.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.voice_recognizers.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.voice_recognizers.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.webview.xml android-platform-frameworks-native-21/data/etc/android.software.webview.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/android.software.webview.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/android.software.webview.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/handheld_core_hardware.xml android-platform-frameworks-native-21/data/etc/handheld_core_hardware.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/handheld_core_hardware.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/handheld_core_hardware.xml 2012-10-16 22:57:11.000000000 +0000 @@ -4,9 +4,9 @@ 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. @@ -23,7 +23,6 @@ devices. --> - @@ -34,25 +33,9 @@ - - - - - - - - - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/tablet_core_hardware.xml android-platform-frameworks-native-21/data/etc/tablet_core_hardware.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/tablet_core_hardware.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/tablet_core_hardware.xml 2012-10-16 22:57:11.000000000 +0000 @@ -4,9 +4,9 @@ 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. @@ -23,7 +23,6 @@ devices. --> - @@ -35,25 +34,10 @@ - - - - - - - - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/data/etc/wearable_core_hardware.xml android-platform-frameworks-native-21/data/etc/wearable_core_hardware.xml --- android-platform-frameworks-native-6.0.1+r16/data/etc/wearable_core_hardware.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/data/etc/wearable_core_hardware.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libetc1-dev.install android-platform-frameworks-native-21/debian/android-libetc1-dev.install --- android-platform-frameworks-native-6.0.1+r16/debian/android-libetc1-dev.install 2016-02-11 15:15:40.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libetc1-dev.install 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -libETC1.so usr/lib/android -opengl/include/ETC1 usr/include/android \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libetc1.install android-platform-frameworks-native-21/debian/android-libetc1.install --- android-platform-frameworks-native-6.0.1+r16/debian/android-libetc1.install 2016-02-11 15:15:40.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libetc1.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -libETC1.so.0 usr/lib/android \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libutils-dev.install android-platform-frameworks-native-21/debian/android-libutils-dev.install --- android-platform-frameworks-native-6.0.1+r16/debian/android-libutils-dev.install 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libutils-dev.install 2014-11-18 13:14:56.000000000 +0000 @@ -0,0 +1,3 @@ +include/android usr/include/android/ +include/utils usr/include/android/ +libs/utils/libutils.a usr/lib/android/ diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libutils-dev.links android-platform-frameworks-native-21/debian/android-libutils-dev.links --- android-platform-frameworks-native-6.0.1+r16/debian/android-libutils-dev.links 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libutils-dev.links 2014-11-18 13:14:56.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/android/libutils.so.0.21.0 usr/lib/android/libutils.so diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libutils.install android-platform-frameworks-native-21/debian/android-libutils.install --- android-platform-frameworks-native-6.0.1+r16/debian/android-libutils.install 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libutils.install 2014-11-18 13:16:56.000000000 +0000 @@ -0,0 +1 @@ +libs/utils/libutils.so.0.21.0 usr/lib/android/ diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libutils.links android-platform-frameworks-native-21/debian/android-libutils.links --- android-platform-frameworks-native-6.0.1+r16/debian/android-libutils.links 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libutils.links 2014-11-18 13:14:56.000000000 +0000 @@ -0,0 +1 @@ +usr/lib/android/libutils.so.0.21.0 usr/lib/android/libutils.so.0 diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-libutils.lintian-overrides android-platform-frameworks-native-21/debian/android-libutils.lintian-overrides --- android-platform-frameworks-native-6.0.1+r16/debian/android-libutils.lintian-overrides 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-libutils.lintian-overrides 2014-11-18 13:14:56.000000000 +0000 @@ -0,0 +1,8 @@ +# These shlibs are stuck into /usr/lib/android because they are only meant to +# be used with Android utilities and they need to be built as one big package, +# so that everything is on the exact same version. They are registered as +# shlibs so that dh_shlibsdeps will automatically dependency generation. +# These libraries should never be used by other projects since they have no +# upstream standalone releases or versioning. +android-libutils: postinst-has-useless-call-to-ldconfig +android-libutils: postrm-has-useless-call-to-ldconfig diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/android-platform-frameworks-native-headers.install android-platform-frameworks-native-21/debian/android-platform-frameworks-native-headers.install --- android-platform-frameworks-native-6.0.1+r16/debian/android-platform-frameworks-native-headers.install 2016-01-13 22:22:21.000000000 +0000 +++ android-platform-frameworks-native-21/debian/android-platform-frameworks-native-headers.install 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -include/android usr/include/android \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/changelog android-platform-frameworks-native-21/debian/changelog --- android-platform-frameworks-native-6.0.1+r16/debian/changelog 2016-02-15 21:16:09.000000000 +0000 +++ android-platform-frameworks-native-21/debian/changelog 2016-08-10 18:36:18.000000000 +0000 @@ -1,30 +1,8 @@ -android-platform-frameworks-native (1:6.0.1+r16-1) unstable; urgency=medium +android-platform-frameworks-native (21-3~precise) precise; urgency=medium - [ Kai-Chung Yan ] - * New packages: android-libetc1, android-libetc1-dev - * d/control: Add android-platform-build-headers to Build-Depends + * backport to precise - [ Hans-Christoph Steiner ] - * New upstream release - - -- Hans-Christoph Steiner Mon, 15 Feb 2016 22:15:15 +0100 - -android-platform-frameworks-native (1:6.0.0+r26-2) unstable; urgency=medium - - * Breaks & Replaces: android-libutils-dev (<< 1:6.0.0+r26) (Closes: #812450) - - -- Kai-Chung Yan Sun, 24 Jan 2016 15:37:19 +0800 - -android-platform-frameworks-native (1:6.0.0+r26-1) experimental; urgency=low - - * New upstream release - * Change version scheme to follow upstream Android release tags - * Remove package: android-libutils(-dev) (closes: #789609) - * Add myself to Uploaders - * Use get-orig-source rule for fetching upstream - * d/control: Change priority to optional - - -- Kai-Chung Yan Tue, 01 Dec 2015 00:58:59 +0800 + -- Hans-Christoph Steiner Wed, 10 Aug 2016 20:36:10 +0200 android-platform-frameworks-native (21-3) unstable; urgency=low diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/compat android-platform-frameworks-native-21/debian/compat --- android-platform-frameworks-native-6.0.1+r16/debian/compat 2016-01-13 22:22:21.000000000 +0000 +++ android-platform-frameworks-native-21/debian/compat 2014-07-15 17:44:32.000000000 +0000 @@ -1 +1 @@ -9 \ No newline at end of file +9 diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/control android-platform-frameworks-native-21/debian/control --- android-platform-frameworks-native-6.0.1+r16/debian/control 2016-02-12 19:48:53.000000000 +0000 +++ android-platform-frameworks-native-21/debian/control 2014-11-25 11:55:42.000000000 +0000 @@ -1,42 +1,38 @@ Source: android-platform-frameworks-native Section: devel -Priority: optional +Priority: extra Maintainer: Android tools Maintainer Uploaders: Hans-Christoph Steiner , - Laszlo Boszormenyi (GCS) , - Kai-Chung Yan -Build-Depends: android-platform-build-headers (>= 1:6) [amd64 i386], - debhelper (>=9) + Laszlo Boszormenyi (GCS) +Build-Depends: dh-exec (>= 0.2), + debhelper (>=9), + android-system-dev, + android-libcutils-dev, + android-liblog-dev, + zlib1g-dev Standards-Version: 3.9.6 Homepage: https://android.googlesource.com/platform/frameworks/native -Vcs-Git: https://anonscm.debian.org/git/android-tools/android-platform-frameworks-native.git -Vcs-Browser: https://anonscm.debian.org/cgit/android-tools/android-platform-frameworks-native.git +Vcs-Git: https://alioth.debian.org/anonscm/git/android-tools/android-platform-frameworks-native.git +Vcs-Browser: http://anonscm.debian.org/cgit/android-tools/android-platform-frameworks-native.git -Package: android-platform-frameworks-native-headers -Section: libdevel -Architecture: all -Depends: ${misc:Depends} -Breaks: android-libutils-dev (<< 1:6.0.0+r26) -Replaces: android-libutils-dev (<< 1:6.0.0+r26) -Description: Headers of android-platform-frameworks-native - This package contains headers in include/android in platform/frameworks/native. - -Package: android-libetc1 +Package: android-libutils Section: libs Architecture: amd64 i386 -Depends: ${shlibs:Depends}, ${misc:Depends} -Description: ETC1 compression library - Ericsson Texture Compression (ETC) is a lossy texture compression technique - developed in collaboration with Ericsson Research in early 2005. libETC1 - provides the encoding and decoding of ETC1 compression algorithm. +Depends: ${misc:Depends}, ${shlibs:Depends} +Description: Android utility library + Library providing utility functions to Android related tools. This is needed + purely to get various Android utilities working. -Package: android-libetc1-dev +Package: android-libutils-dev Section: libdevel Architecture: amd64 i386 -Depends: android-libetc1 (= ${binary:Version}), ${misc:Depends} -Description: ETC1 compression library -Development files - Ericsson Texture Compression (ETC) is a lossy texture compression technique - developed in collaboration with Ericsson Research in early 2005. libETC1 - provides the encoding and decoding of ETC1 compression algorithm. +Depends: android-libutils (= ${binary:Version}), + ${misc:Depends}, + android-libcutils-dev +Breaks: android-libutils (<< 21-2~) +Replaces: android-libutils (<< 21-2~) +Description: Android utility library - Development files + Library providing utility functions to Android related tools. This is needed + purely to get various Android utilities working. . - This package provides the development files. \ No newline at end of file + This package contains the development files. diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/copyright android-platform-frameworks-native-21/debian/copyright --- android-platform-frameworks-native-6.0.1+r16/debian/copyright 2016-01-13 22:22:21.000000000 +0000 +++ android-platform-frameworks-native-21/debian/copyright 2014-09-25 03:26:17.000000000 +0000 @@ -1,4 +1,5 @@ -Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0 +Format: http://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: Android native frameworks Upstream-Contact: https://source.android.com/compatibility/contact-us.html Source: https://android.googlesource.com/platform/frameworks/native @@ -19,10 +20,10 @@ Copyright: 2007-2009, The Khronos Group Inc. License: MIT/X11 -Files: opengl/tests/angeles/* +Files: opengl/tests/angeles/ Copyright: 2004-2005, Jetro Lauha 2003, David Blythe -License: BSD-3-clause or LGPL-2.1+ +License: BSD or LGPL-2.1+ Files: include/media/openmax/* Copyright: 1998-2009, PacketVideo @@ -30,9 +31,7 @@ License: MIT/X11 Files: debian/* -Copyright: 2015, Hans-Christoph Steiner , - 2015, Laszlo Boszormenyi (GCS) , - 2015, Kai-Chung Yan +Copyright: android-tools team License: CC0 @@ -64,7 +63,7 @@ License version 2.1 can be found in the file `/usr/share/common-licenses/LGPL-2.1'. -License: BSD-3-clause +License: BSD Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/gbp.conf android-platform-frameworks-native-21/debian/gbp.conf --- android-platform-frameworks-native-6.0.1+r16/debian/gbp.conf 2016-02-15 21:17:57.000000000 +0000 +++ android-platform-frameworks-native-21/debian/gbp.conf 2014-11-18 13:14:56.000000000 +0000 @@ -1,3 +1,7 @@ [DEFAULT] +upstream-branch = upstream +debian-branch = master +upstream-tag = upstream/tools_r%(version)s +debian-tag = debian/%(version)s pristine-tar = True -sign-tags = True \ No newline at end of file +sign-tags = True diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/libETC1.mk android-platform-frameworks-native-21/debian/libETC1.mk --- android-platform-frameworks-native-6.0.1+r16/debian/libETC1.mk 2016-02-12 19:48:53.000000000 +0000 +++ android-platform-frameworks-native-21/debian/libETC1.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -NAME = libETC1 -SOURCES = etc1.cpp -SOURCES := $(foreach source, $(SOURCES), opengl/libs/ETC1/$(source)) -CXXFLAGS += -fPIC -CPPFLAGS += -Iopengl/include -LDFLAGS += -shared -Wl,-soname,$(NAME).so.0 - -$(NAME).so.0: $(SOURCES) - $(CXX) $^ -o $@ $(CXXFLAGS) $(CPPFLAGS) $(LDFLAGS) - ln -s $(NAME).so.0 $(NAME).so - dpkg-gensymbols -pandroid-libetc1 -v0 -e$@ -Odebian/android-libetc1.symbols - -clean: - $(RM) $(NAME).so* \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/libutils0.postinst android-platform-frameworks-native-21/debian/libutils0.postinst --- android-platform-frameworks-native-6.0.1+r16/debian/libutils0.postinst 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/libutils0.postinst 2014-11-18 13:14:56.000000000 +0000 @@ -0,0 +1,10 @@ +#!/bin/sh + +set -e + +if [ "$1" = "configure" ] +then + ldconfig +fi + +#DEBHELPER# diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/patches/libutils_makefile.patch android-platform-frameworks-native-21/debian/patches/libutils_makefile.patch --- android-platform-frameworks-native-6.0.1+r16/debian/patches/libutils_makefile.patch 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/patches/libutils_makefile.patch 2014-11-18 13:17:47.000000000 +0000 @@ -0,0 +1,63 @@ +--- /dev/null ++++ b/libs/utils/Makefile +@@ -0,0 +1,60 @@ ++#!/bin/make ++ ++CXX = g++ ++ ++SOURCES:= \ ++ BasicHashtable.cpp \ ++ BlobCache.cpp \ ++ BufferedTextOutput.cpp \ ++ Debug.cpp \ ++ FileMap.cpp \ ++ Flattenable.cpp \ ++ LinearTransform.cpp \ ++ Looper.cpp \ ++ PropertyMap.cpp \ ++ RefBase.cpp \ ++ SharedBuffer.cpp \ ++ Static.cpp \ ++ StopWatch.cpp \ ++ String8.cpp \ ++ String16.cpp \ ++ StringArray.cpp \ ++ SystemClock.cpp \ ++ TextOutput.cpp \ ++ Threads.cpp \ ++ Timers.cpp \ ++ Tokenizer.cpp \ ++ Unicode.cpp \ ++ VectorImpl.cpp \ ++ WorkQueue.cpp \ ++ ZipFileCRO.cpp \ ++ ZipFileRO.cpp \ ++ ZipUtils.cpp \ ++ misc.cpp ++ ++OBJECTS = $(SOURCES:.cpp=.o) ++ ++# Debian has gettid, but this build doesn't find it ++# -DHAVE_GETTID \ ++ ++ALL_CXXFLAGS = -O2 -fPIC -I../../include -I/usr/include/android \ ++ -include /usr/include/android/arch/linux-x86/AndroidConfig.h ++ALL_LDFLAGS = -fPIC -shared -rdynamic -Wl,-rpath=/usr/lib/android ++ALL_LIBS = -lrt -ldl -lz -lpthread -L/usr/lib/android -lcutils -llog ++ ++CXXFLAGS := $(ALL_CXXFLAGS) $(CXXFLAGS) ++LDFLAGS := $(ALL_LDFLAGS) $(LDFLAGS) ++LIBS := $(ALL_LIBS) $(LIBS) ++ ++LIBNAME = libutils ++SONAME = $(LIBNAME).so.0 ++SOFILENAME = $(SONAME).21.0 ++ ++all: $(OBJECTS) ++ $(CXX) $(LDFLAGS) -Wl,-soname,$(SONAME) -o $(SOFILENAME) $(OBJECTS) $(LIBS) ++ ar rs $(LIBNAME).a $(OBJECTS) ++ ++clean: ++ rm -f $(OBJECTS) ++ rm -f $(LIBNAME).so* $(LIBNAME).a ++ diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/patches/main_makefile.patch android-platform-frameworks-native-21/debian/patches/main_makefile.patch --- android-platform-frameworks-native-6.0.1+r16/debian/patches/main_makefile.patch 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/patches/main_makefile.patch 2014-05-25 04:24:17.000000000 +0000 @@ -0,0 +1,10 @@ +--- /dev/null 2014-05-21 22:14:08.742851277 -0400 ++++ android-platform-frameworks-native/Makefile 2014-05-21 23:43:09.000000000 -0400 +@@ -0,0 +1,7 @@ ++#!/bin/make ++ ++all: ++ make -C libs/utils ++ ++clean: ++ make -C libs/utils clean diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/patches/series android-platform-frameworks-native-21/debian/patches/series --- android-platform-frameworks-native-6.0.1+r16/debian/patches/series 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/debian/patches/series 2014-05-26 03:13:03.000000000 +0000 @@ -0,0 +1,2 @@ +libutils_makefile.patch +main_makefile.patch diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/README.debian android-platform-frameworks-native-21/debian/README.debian --- android-platform-frameworks-native-6.0.1+r16/debian/README.debian 2016-02-11 15:15:40.000000000 +0000 +++ android-platform-frameworks-native-21/debian/README.debian 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -Although libETC1 seems like a reusable library and it is highly likely that some -future packages may depend on it, we still consider it a Android SDK internal -library and place it in /usr/lib/android because: - - * It does not have ABI version in SONAME - * It does not have any version - * It barely has documentations - -If a package really needs to use it, simlpy add "-Wl,-rpath=/usr/lib/android" to -LDFLAGS. Feel free to contact us at #debian-mobile on ! - - -- Kai-Chung Yan Thu, 11 Feb 2016 21:36:38 +0800 \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/README.source android-platform-frameworks-native-21/debian/README.source --- android-platform-frameworks-native-6.0.1+r16/debian/README.source 2016-01-13 22:22:21.000000000 +0000 +++ android-platform-frameworks-native-21/debian/README.source 2014-11-18 13:14:56.000000000 +0000 @@ -26,5 +26,27 @@ A given chunk of code that is built both for "host" will have both of these lines included in the Android.mk file. - -- Hans-Christoph Steiner Thu, 18 Sep 2014 16:37:50 -0400 - -- Kai-Chung Yan Tue, 01 Dec 2015 00:58:59 +0800 \ No newline at end of file + +Structure of the package's git repository +----------------------------------------- + +The source code has been excerpted form the git repository + https://android.googlesource.com/platform/frameworks/native + +The Android project does not release tarballs of their core software. This +package source repo is configured following git-buildpackage's manual, under +"When upstream uses GIT/No upstream tarballs": + +* http://honk.sigxcpu.org/projects/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.UPSTREAM-GIT +* file:///usr/share/doc/git-buildpackage/manual-html/gbp.import.html#GBP.IMPORT.UPSTREAM-GIT + +If you want to update the source git repo for this package to a newer release, +then fetch the new commits from the upstream git repo: + + git remote add upstream https://android.googlesource.com/platform/frameworks/native + git fetch upstream + +debian/gbp.conf is set up to use upstream's release branches and build +tarballs from there. + + -- Hans-Christoph Steiner , Thu, 18 Sep 2014 16:37:50 -0400 diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/rules android-platform-frameworks-native-21/debian/rules --- android-platform-frameworks-native-6.0.1+r16/debian/rules 2016-02-12 19:48:53.000000000 +0000 +++ android-platform-frameworks-native-21/debian/rules 2014-07-15 17:51:51.000000000 +0000 @@ -1,29 +1,7 @@ #!/usr/bin/make -f -include /usr/share/dpkg/architecture.mk -include /usr/share/dpkg/pkg-info.mk - -UPSTREAM_TAG = android-$(subst +,_,$(DEB_VERSION_UPSTREAM)) - -ifeq ($(filter stage1,$(DEB_BUILD_PROFILES)),) - ifneq ($(filter amd64 i386,$(DEB_HOST_ARCH_CPU)),) - BUILD_COMMANDS = make -f debian/libETC1.mk - endif -endif - %: dh $@ -override_dh_auto_build: - $(BUILD_COMMANDS) - -override_dh_auto_clean: - dh_auto_clean - make clean -f debian/libETC1.mk - $(RM) debian/*.symbols - -get-orig-source: $(UPSTREAM_TAG).tar.gz - mk-origtargz --repack --compression xz $< - -$(UPSTREAM_TAG).tar.gz: - wget https://android.googlesource.com/platform/frameworks/native/+archive/$(UPSTREAM_TAG).tar.gz \ No newline at end of file +override_dh_shlibdeps: + dh_shlibdeps -l/usr/lib/android diff -Nru android-platform-frameworks-native-6.0.1+r16/debian/source/format android-platform-frameworks-native-21/debian/source/format --- android-platform-frameworks-native-6.0.1+r16/debian/source/format 2016-01-13 22:22:21.000000000 +0000 +++ android-platform-frameworks-native-21/debian/source/format 2014-05-18 19:48:34.000000000 +0000 @@ -1 +1 @@ -3.0 (quilt) \ No newline at end of file +3.0 (quilt) diff -Nru android-platform-frameworks-native-6.0.1+r16/docs/Doxyfile android-platform-frameworks-native-21/docs/Doxyfile --- android-platform-frameworks-native-6.0.1+r16/docs/Doxyfile 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/docs/Doxyfile 1970-01-01 00:00:00.000000000 +0000 @@ -1,1902 +0,0 @@ -# Doxyfile 1.8.3.1 - -# This file describes the settings to be used by the documentation system -# doxygen (www.doxygen.org) for a project -# -# All text after a hash (#) is considered a comment and will be ignored -# The format is: -# TAG = value [value, ...] -# For lists items can also be appended using: -# TAG += value [value, ...] -# Values that contain spaces should be placed between quotes (" ") - -#--------------------------------------------------------------------------- -# Project related configuration options -#--------------------------------------------------------------------------- - -# This tag specifies the encoding used for all characters in the config file -# that follow. The default is UTF-8 which is also the encoding used for all -# text before the first occurrence of this tag. Doxygen uses libiconv (or the -# iconv built into libc) for the transcoding. See -# http://www.gnu.org/software/libiconv for the list of possible encodings. - -DOXYFILE_ENCODING = UTF-8 - -# The PROJECT_NAME tag is a single word (or sequence of words) that should -# identify the project. Note that if you do not use Doxywizard you need -# to put quotes around the project name if it contains spaces. - -PROJECT_NAME = "NDK API" - -# The PROJECT_NUMBER tag can be used to enter a project or revision number. -# This could be handy for archiving the generated documentation or -# if some version control system is used. - -PROJECT_NUMBER = - -# Using the PROJECT_BRIEF tag one can provide an optional one line description -# for a project that appears at the top of each page and should give viewer -# a quick idea about the purpose of the project. Keep the description short. - -PROJECT_BRIEF = "" - -# With the PROJECT_LOGO tag one can specify an logo or icon that is -# included in the documentation. The maximum height of the logo should not -# exceed 55 pixels and the maximum width should not exceed 200 pixels. -# Doxygen will copy the logo to the output directory. - -PROJECT_LOGO = logo.png - -# The OUTPUT_DIRECTORY tag is used to specify the (relative or absolute) -# base path where the generated documentation will be put. -# If a relative path is entered, it will be relative to the location -# where doxygen was started. If left blank the current directory will be used. - -OUTPUT_DIRECTORY = - -# If the CREATE_SUBDIRS tag is set to YES, then doxygen will create -# 4096 sub-directories (in 2 levels) under the output directory of each output -# format and will distribute the generated files over these directories. -# Enabling this option can be useful when feeding doxygen a huge amount of -# source files, where putting all generated files in the same directory would -# otherwise cause performance problems for the file system. - -CREATE_SUBDIRS = NO - -# The OUTPUT_LANGUAGE tag is used to specify the language in which all -# documentation generated by doxygen is written. Doxygen will use this -# information to generate all constant output in the proper language. -# The default language is English, other supported languages are: -# Afrikaans, Arabic, Brazilian, Catalan, Chinese, Chinese-Traditional, -# Croatian, Czech, Danish, Dutch, Esperanto, Farsi, Finnish, French, German, -# Greek, Hungarian, Italian, Japanese, Japanese-en (Japanese with English -# messages), Korean, Korean-en, Lithuanian, Norwegian, Macedonian, Persian, -# Polish, Portuguese, Romanian, Russian, Serbian, Serbian-Cyrillic, Slovak, -# Slovene, Spanish, Swedish, Ukrainian, and Vietnamese. - -OUTPUT_LANGUAGE = English - -# If the BRIEF_MEMBER_DESC tag is set to YES (the default) Doxygen will -# include brief member descriptions after the members that are listed in -# the file and class documentation (similar to JavaDoc). -# Set to NO to disable this. - -BRIEF_MEMBER_DESC = YES - -# If the REPEAT_BRIEF tag is set to YES (the default) Doxygen will prepend -# the brief description of a member or function before the detailed description. -# Note: if both HIDE_UNDOC_MEMBERS and BRIEF_MEMBER_DESC are set to NO, the -# brief descriptions will be completely suppressed. - -REPEAT_BRIEF = YES - -# This tag implements a quasi-intelligent brief description abbreviator -# that is used to form the text in various listings. Each string -# in this list, if found as the leading text of the brief description, will be -# stripped from the text and the result after processing the whole list, is -# used as the annotated text. Otherwise, the brief description is used as-is. -# If left blank, the following values are used ("$name" is automatically -# replaced with the name of the entity): "The $name class" "The $name widget" -# "The $name file" "is" "provides" "specifies" "contains" -# "represents" "a" "an" "the" - -ABBREVIATE_BRIEF = "The $name class" \ - "The $name widget" \ - "The $name file" \ - is \ - provides \ - specifies \ - contains \ - represents \ - a \ - an \ - the - -# If the ALWAYS_DETAILED_SEC and REPEAT_BRIEF tags are both set to YES then -# Doxygen will generate a detailed section even if there is only a brief -# description. - -ALWAYS_DETAILED_SEC = NO - -# If the INLINE_INHERITED_MEMB tag is set to YES, doxygen will show all -# inherited members of a class in the documentation of that class as if those -# members were ordinary class members. Constructors, destructors and assignment -# operators of the base classes will not be shown. - -INLINE_INHERITED_MEMB = NO - -# If the FULL_PATH_NAMES tag is set to YES then Doxygen will prepend the full -# path before files name in the file list and in the header files. If set -# to NO the shortest path that makes the file name unique will be used. - -FULL_PATH_NAMES = NO - -# If the FULL_PATH_NAMES tag is set to YES then the STRIP_FROM_PATH tag -# can be used to strip a user-defined part of the path. Stripping is -# only done if one of the specified strings matches the left-hand part of -# the path. The tag can be used to show relative paths in the file list. -# If left blank the directory from which doxygen is run is used as the -# path to strip. Note that you specify absolute paths here, but also -# relative paths, which will be relative from the directory where doxygen is -# started. - -STRIP_FROM_PATH = - -# The STRIP_FROM_INC_PATH tag can be used to strip a user-defined part of -# the path mentioned in the documentation of a class, which tells -# the reader which header file to include in order to use a class. -# If left blank only the name of the header file containing the class -# definition is used. Otherwise one should specify the include paths that -# are normally passed to the compiler using the -I flag. - -STRIP_FROM_INC_PATH = - -# If the SHORT_NAMES tag is set to YES, doxygen will generate much shorter -# (but less readable) file names. This can be useful if your file system -# doesn't support long names like on DOS, Mac, or CD-ROM. - -SHORT_NAMES = NO - -# If the JAVADOC_AUTOBRIEF tag is set to YES then Doxygen -# will interpret the first line (until the first dot) of a JavaDoc-style -# comment as the brief description. If set to NO, the JavaDoc -# comments will behave just like regular Qt-style comments -# (thus requiring an explicit @brief command for a brief description.) - -JAVADOC_AUTOBRIEF = NO - -# If the QT_AUTOBRIEF tag is set to YES then Doxygen will -# interpret the first line (until the first dot) of a Qt-style -# comment as the brief description. If set to NO, the comments -# will behave just like regular Qt-style comments (thus requiring -# an explicit \brief command for a brief description.) - -QT_AUTOBRIEF = NO - -# The MULTILINE_CPP_IS_BRIEF tag can be set to YES to make Doxygen -# treat a multi-line C++ special comment block (i.e. a block of //! or /// -# comments) as a brief description. This used to be the default behaviour. -# The new default is to treat a multi-line C++ comment block as a detailed -# description. Set this tag to YES if you prefer the old behaviour instead. - -MULTILINE_CPP_IS_BRIEF = NO - -# If the INHERIT_DOCS tag is set to YES (the default) then an undocumented -# member inherits the documentation from any documented member that it -# re-implements. - -INHERIT_DOCS = YES - -# If the SEPARATE_MEMBER_PAGES tag is set to YES, then doxygen will produce -# a new page for each member. If set to NO, the documentation of a member will -# be part of the file/class/namespace that contains it. - -SEPARATE_MEMBER_PAGES = NO - -# The TAB_SIZE tag can be used to set the number of spaces in a tab. -# Doxygen uses this value to replace tabs by spaces in code fragments. - -TAB_SIZE = 4 - -# This tag can be used to specify a number of aliases that acts -# as commands in the documentation. An alias has the form "name=value". -# For example adding "sideeffect=\par Side Effects:\n" will allow you to -# put the command \sideeffect (or @sideeffect) in the documentation, which -# will result in a user-defined paragraph with heading "Side Effects:". -# You can put \n's in the value part of an alias to insert newlines. - -ALIASES = - -# This tag can be used to specify a number of word-keyword mappings (TCL only). -# A mapping has the form "name=value". For example adding -# "class=itcl::class" will allow you to use the command class in the -# itcl::class meaning. - -TCL_SUBST = - -# Set the OPTIMIZE_OUTPUT_FOR_C tag to YES if your project consists of C -# sources only. Doxygen will then generate output that is more tailored for C. -# For instance, some of the names that are used will be different. The list -# of all members will be omitted, etc. - -OPTIMIZE_OUTPUT_FOR_C = YES - -# Set the OPTIMIZE_OUTPUT_JAVA tag to YES if your project consists of Java -# sources only. Doxygen will then generate output that is more tailored for -# Java. For instance, namespaces will be presented as packages, qualified -# scopes will look different, etc. - -OPTIMIZE_OUTPUT_JAVA = NO - -# Set the OPTIMIZE_FOR_FORTRAN tag to YES if your project consists of Fortran -# sources only. Doxygen will then generate output that is more tailored for -# Fortran. - -OPTIMIZE_FOR_FORTRAN = NO - -# Set the OPTIMIZE_OUTPUT_VHDL tag to YES if your project consists of VHDL -# sources. Doxygen will then generate output that is tailored for -# VHDL. - -OPTIMIZE_OUTPUT_VHDL = NO - -# Doxygen selects the parser to use depending on the extension of the files it -# parses. With this tag you can assign which parser to use for a given -# extension. Doxygen has a built-in mapping, but you can override or extend it -# using this tag. The format is ext=language, where ext is a file extension, -# and language is one of the parsers supported by doxygen: IDL, Java, -# Javascript, CSharp, C, C++, D, PHP, Objective-C, Python, Fortran, VHDL, C, -# C++. For instance to make doxygen treat .inc files as Fortran files (default -# is PHP), and .f files as C (default is Fortran), use: inc=Fortran f=C. Note -# that for custom extensions you also need to set FILE_PATTERNS otherwise the -# files are not read by doxygen. - -EXTENSION_MAPPING = - -# If MARKDOWN_SUPPORT is enabled (the default) then doxygen pre-processes all -# comments according to the Markdown format, which allows for more readable -# documentation. See http://daringfireball.net/projects/markdown/ for details. -# The output of markdown processing is further processed by doxygen, so you -# can mix doxygen, HTML, and XML commands with Markdown formatting. -# Disable only in case of backward compatibilities issues. - -MARKDOWN_SUPPORT = YES - -# When enabled doxygen tries to link words that correspond to documented classes, -# or namespaces to their corresponding documentation. Such a link can be -# prevented in individual cases by by putting a % sign in front of the word or -# globally by setting AUTOLINK_SUPPORT to NO. - -AUTOLINK_SUPPORT = YES - -# If you use STL classes (i.e. std::string, std::vector, etc.) but do not want -# to include (a tag file for) the STL sources as input, then you should -# set this tag to YES in order to let doxygen match functions declarations and -# definitions whose arguments contain STL classes (e.g. func(std::string); v.s. -# func(std::string) {}). This also makes the inheritance and collaboration -# diagrams that involve STL classes more complete and accurate. - -BUILTIN_STL_SUPPORT = NO - -# If you use Microsoft's C++/CLI language, you should set this option to YES to -# enable parsing support. - -CPP_CLI_SUPPORT = NO - -# Set the SIP_SUPPORT tag to YES if your project consists of sip sources only. -# Doxygen will parse them like normal C++ but will assume all classes use public -# instead of private inheritance when no explicit protection keyword is present. - -SIP_SUPPORT = NO - -# For Microsoft's IDL there are propget and propput attributes to indicate -# getter and setter methods for a property. Setting this option to YES (the -# default) will make doxygen replace the get and set methods by a property in -# the documentation. This will only work if the methods are indeed getting or -# setting a simple type. If this is not the case, or you want to show the -# methods anyway, you should set this option to NO. - -IDL_PROPERTY_SUPPORT = YES - -# If member grouping is used in the documentation and the DISTRIBUTE_GROUP_DOC -# tag is set to YES, then doxygen will reuse the documentation of the first -# member in the group (if any) for the other members of the group. By default -# all members of a group must be documented explicitly. - -DISTRIBUTE_GROUP_DOC = NO - -# Set the SUBGROUPING tag to YES (the default) to allow class member groups of -# the same type (for instance a group of public functions) to be put as a -# subgroup of that type (e.g. under the Public Functions section). Set it to -# NO to prevent subgrouping. Alternatively, this can be done per class using -# the \nosubgrouping command. - -SUBGROUPING = YES - -# When the INLINE_GROUPED_CLASSES tag is set to YES, classes, structs and -# unions are shown inside the group in which they are included (e.g. using -# @ingroup) instead of on a separate page (for HTML and Man pages) or -# section (for LaTeX and RTF). - -INLINE_GROUPED_CLASSES = NO - -# When the INLINE_SIMPLE_STRUCTS tag is set to YES, structs, classes, and -# unions with only public data fields will be shown inline in the documentation -# of the scope in which they are defined (i.e. file, namespace, or group -# documentation), provided this scope is documented. If set to NO (the default), -# structs, classes, and unions are shown on a separate page (for HTML and Man -# pages) or section (for LaTeX and RTF). - -INLINE_SIMPLE_STRUCTS = NO - -# When TYPEDEF_HIDES_STRUCT is enabled, a typedef of a struct, union, or enum -# is documented as struct, union, or enum with the name of the typedef. So -# typedef struct TypeS {} TypeT, will appear in the documentation as a struct -# with name TypeT. When disabled the typedef will appear as a member of a file, -# namespace, or class. And the struct will be named TypeS. This can typically -# be useful for C code in case the coding convention dictates that all compound -# types are typedef'ed and only the typedef is referenced, never the tag name. - -TYPEDEF_HIDES_STRUCT = NO - -# The SYMBOL_CACHE_SIZE determines the size of the internal cache use to -# determine which symbols to keep in memory and which to flush to disk. -# When the cache is full, less often used symbols will be written to disk. -# For small to medium size projects (<1000 input files) the default value is -# probably good enough. For larger projects a too small cache size can cause -# doxygen to be busy swapping symbols to and from disk most of the time -# causing a significant performance penalty. -# If the system has enough physical memory increasing the cache will improve the -# performance by keeping more symbols in memory. Note that the value works on -# a logarithmic scale so increasing the size by one will roughly double the -# memory usage. The cache size is given by this formula: -# 2^(16+SYMBOL_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -SYMBOL_CACHE_SIZE = 0 - -# Similar to the SYMBOL_CACHE_SIZE the size of the symbol lookup cache can be -# set using LOOKUP_CACHE_SIZE. This cache is used to resolve symbols given -# their name and scope. Since this can be an expensive process and often the -# same symbol appear multiple times in the code, doxygen keeps a cache of -# pre-resolved symbols. If the cache is too small doxygen will become slower. -# If the cache is too large, memory is wasted. The cache size is given by this -# formula: 2^(16+LOOKUP_CACHE_SIZE). The valid range is 0..9, the default is 0, -# corresponding to a cache size of 2^16 = 65536 symbols. - -LOOKUP_CACHE_SIZE = 0 - -#--------------------------------------------------------------------------- -# Build related configuration options -#--------------------------------------------------------------------------- - -# If the EXTRACT_ALL tag is set to YES doxygen will assume all entities in -# documentation are documented, even if no documentation was available. -# Private class members and static file members will be hidden unless -# the EXTRACT_PRIVATE and EXTRACT_STATIC tags are set to YES - -EXTRACT_ALL = YES - -# If the EXTRACT_PRIVATE tag is set to YES all private members of a class -# will be included in the documentation. - -EXTRACT_PRIVATE = NO - -# If the EXTRACT_PACKAGE tag is set to YES all members with package or internal -# scope will be included in the documentation. - -EXTRACT_PACKAGE = NO - -# If the EXTRACT_STATIC tag is set to YES all static members of a file -# will be included in the documentation. - -EXTRACT_STATIC = NO - -# If the EXTRACT_LOCAL_CLASSES tag is set to YES classes (and structs) -# defined locally in source files will be included in the documentation. -# If set to NO only classes defined in header files are included. - -EXTRACT_LOCAL_CLASSES = YES - -# This flag is only useful for Objective-C code. When set to YES local -# methods, which are defined in the implementation section but not in -# the interface are included in the documentation. -# If set to NO (the default) only methods in the interface are included. - -EXTRACT_LOCAL_METHODS = NO - -# If this flag is set to YES, the members of anonymous namespaces will be -# extracted and appear in the documentation as a namespace called -# 'anonymous_namespace{file}', where file will be replaced with the base -# name of the file that contains the anonymous namespace. By default -# anonymous namespaces are hidden. - -EXTRACT_ANON_NSPACES = NO - -# If the HIDE_UNDOC_MEMBERS tag is set to YES, Doxygen will hide all -# undocumented members of documented classes, files or namespaces. -# If set to NO (the default) these members will be included in the -# various overviews, but no documentation section is generated. -# This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_MEMBERS = NO - -# If the HIDE_UNDOC_CLASSES tag is set to YES, Doxygen will hide all -# undocumented classes that are normally visible in the class hierarchy. -# If set to NO (the default) these classes will be included in the various -# overviews. This option has no effect if EXTRACT_ALL is enabled. - -HIDE_UNDOC_CLASSES = NO - -# If the HIDE_FRIEND_COMPOUNDS tag is set to YES, Doxygen will hide all -# friend (class|struct|union) declarations. -# If set to NO (the default) these declarations will be included in the -# documentation. - -HIDE_FRIEND_COMPOUNDS = NO - -# If the HIDE_IN_BODY_DOCS tag is set to YES, Doxygen will hide any -# documentation blocks found inside the body of a function. -# If set to NO (the default) these blocks will be appended to the -# function's detailed documentation block. - -HIDE_IN_BODY_DOCS = NO - -# The INTERNAL_DOCS tag determines if documentation -# that is typed after a \internal command is included. If the tag is set -# to NO (the default) then the documentation will be excluded. -# Set it to YES to include the internal documentation. - -INTERNAL_DOCS = NO - -# If the CASE_SENSE_NAMES tag is set to NO then Doxygen will only generate -# file names in lower-case letters. If set to YES upper-case letters are also -# allowed. This is useful if you have classes or files whose names only differ -# in case and if your file system supports case sensitive file names. Windows -# and Mac users are advised to set this option to NO. - -CASE_SENSE_NAMES = NO - -# If the HIDE_SCOPE_NAMES tag is set to NO (the default) then Doxygen -# will show members with their full class and namespace scopes in the -# documentation. If set to YES the scope will be hidden. - -HIDE_SCOPE_NAMES = YES - -# If the SHOW_INCLUDE_FILES tag is set to YES (the default) then Doxygen -# will put a list of the files that are included by a file in the documentation -# of that file. - -SHOW_INCLUDE_FILES = YES - -# If the FORCE_LOCAL_INCLUDES tag is set to YES then Doxygen -# will list include files with double quotes in the documentation -# rather than with sharp brackets. - -FORCE_LOCAL_INCLUDES = NO - -# If the INLINE_INFO tag is set to YES (the default) then a tag [inline] -# is inserted in the documentation for inline members. - -INLINE_INFO = YES - -# If the SORT_MEMBER_DOCS tag is set to YES (the default) then doxygen -# will sort the (detailed) documentation of file and class members -# alphabetically by member name. If set to NO the members will appear in -# declaration order. - -SORT_MEMBER_DOCS = YES - -# If the SORT_BRIEF_DOCS tag is set to YES then doxygen will sort the -# brief documentation of file, namespace and class members alphabetically -# by member name. If set to NO (the default) the members will appear in -# declaration order. - -SORT_BRIEF_DOCS = NO - -# If the SORT_MEMBERS_CTORS_1ST tag is set to YES then doxygen -# will sort the (brief and detailed) documentation of class members so that -# constructors and destructors are listed first. If set to NO (the default) -# the constructors will appear in the respective orders defined by -# SORT_MEMBER_DOCS and SORT_BRIEF_DOCS. -# This tag will be ignored for brief docs if SORT_BRIEF_DOCS is set to NO -# and ignored for detailed docs if SORT_MEMBER_DOCS is set to NO. - -SORT_MEMBERS_CTORS_1ST = NO - -# If the SORT_GROUP_NAMES tag is set to YES then doxygen will sort the -# hierarchy of group names into alphabetical order. If set to NO (the default) -# the group names will appear in their defined order. - -SORT_GROUP_NAMES = NO - -# If the SORT_BY_SCOPE_NAME tag is set to YES, the class list will be -# sorted by fully-qualified names, including namespaces. If set to -# NO (the default), the class list will be sorted only by class name, -# not including the namespace part. -# Note: This option is not very useful if HIDE_SCOPE_NAMES is set to YES. -# Note: This option applies only to the class list, not to the -# alphabetical list. - -SORT_BY_SCOPE_NAME = NO - -# If the STRICT_PROTO_MATCHING option is enabled and doxygen fails to -# do proper type resolution of all parameters of a function it will reject a -# match between the prototype and the implementation of a member function even -# if there is only one candidate or it is obvious which candidate to choose -# by doing a simple string match. By disabling STRICT_PROTO_MATCHING doxygen -# will still accept a match between prototype and implementation in such cases. - -STRICT_PROTO_MATCHING = NO - -# The GENERATE_TODOLIST tag can be used to enable (YES) or -# disable (NO) the todo list. This list is created by putting \todo -# commands in the documentation. - -GENERATE_TODOLIST = YES - -# The GENERATE_TESTLIST tag can be used to enable (YES) or -# disable (NO) the test list. This list is created by putting \test -# commands in the documentation. - -GENERATE_TESTLIST = YES - -# The GENERATE_BUGLIST tag can be used to enable (YES) or -# disable (NO) the bug list. This list is created by putting \bug -# commands in the documentation. - -GENERATE_BUGLIST = YES - -# The GENERATE_DEPRECATEDLIST tag can be used to enable (YES) or -# disable (NO) the deprecated list. This list is created by putting -# \deprecated commands in the documentation. - -GENERATE_DEPRECATEDLIST= YES - -# The ENABLED_SECTIONS tag can be used to enable conditional -# documentation sections, marked by \if section-label ... \endif -# and \cond section-label ... \endcond blocks. - -ENABLED_SECTIONS = - -# The MAX_INITIALIZER_LINES tag determines the maximum number of lines -# the initial value of a variable or macro consists of for it to appear in -# the documentation. If the initializer consists of more lines than specified -# here it will be hidden. Use a value of 0 to hide initializers completely. -# The appearance of the initializer of individual variables and macros in the -# documentation can be controlled using \showinitializer or \hideinitializer -# command in the documentation regardless of this setting. - -MAX_INITIALIZER_LINES = 26 - -# Set the SHOW_USED_FILES tag to NO to disable the list of files generated -# at the bottom of the documentation of classes and structs. If set to YES the -# list will mention the files that were used to generate the documentation. - -SHOW_USED_FILES = YES - -# Set the SHOW_FILES tag to NO to disable the generation of the Files page. -# This will remove the Files entry from the Quick Index and from the -# Folder Tree View (if specified). The default is YES. - -SHOW_FILES = YES - -# Set the SHOW_NAMESPACES tag to NO to disable the generation of the -# Namespaces page. This will remove the Namespaces entry from the Quick Index -# and from the Folder Tree View (if specified). The default is YES. - -SHOW_NAMESPACES = YES - -# The FILE_VERSION_FILTER tag can be used to specify a program or script that -# doxygen should invoke to get the current version for each file (typically from -# the version control system). Doxygen will invoke the program by executing (via -# popen()) the command , where is the value of -# the FILE_VERSION_FILTER tag, and is the name of an input file -# provided by doxygen. Whatever the program writes to standard output -# is used as the file version. See the manual for examples. - -FILE_VERSION_FILTER = - -# The LAYOUT_FILE tag can be used to specify a layout file which will be parsed -# by doxygen. The layout file controls the global structure of the generated -# output files in an output format independent way. To create the layout file -# that represents doxygen's defaults, run doxygen with the -l option. -# You can optionally specify a file name after the option, if omitted -# DoxygenLayout.xml will be used as the name of the layout file. - -LAYOUT_FILE = - -# The CITE_BIB_FILES tag can be used to specify one or more bib files -# containing the references data. This must be a list of .bib files. The -# .bib extension is automatically appended if omitted. Using this command -# requires the bibtex tool to be installed. See also -# http://en.wikipedia.org/wiki/BibTeX for more info. For LaTeX the style -# of the bibliography can be controlled using LATEX_BIB_STYLE. To use this -# feature you need bibtex and perl available in the search path. Do not use -# file names with spaces, bibtex cannot handle them. - -CITE_BIB_FILES = - -#--------------------------------------------------------------------------- -# configuration options related to warning and progress messages -#--------------------------------------------------------------------------- - -# The QUIET tag can be used to turn on/off the messages that are generated -# by doxygen. Possible values are YES and NO. If left blank NO is used. - -QUIET = NO - -# The WARNINGS tag can be used to turn on/off the warning messages that are -# generated by doxygen. Possible values are YES and NO. If left blank -# NO is used. - -WARNINGS = YES - -# If WARN_IF_UNDOCUMENTED is set to YES, then doxygen will generate warnings -# for undocumented members. If EXTRACT_ALL is set to YES then this flag will -# automatically be disabled. - -WARN_IF_UNDOCUMENTED = YES - -# If WARN_IF_DOC_ERROR is set to YES, doxygen will generate warnings for -# potential errors in the documentation, such as not documenting some -# parameters in a documented function, or documenting parameters that -# don't exist or using markup commands wrongly. - -WARN_IF_DOC_ERROR = YES - -# The WARN_NO_PARAMDOC option can be enabled to get warnings for -# functions that are documented, but have no documentation for their parameters -# or return value. If set to NO (the default) doxygen will only warn about -# wrong or incomplete parameter documentation, but not about the absence of -# documentation. - -WARN_NO_PARAMDOC = NO - -# The WARN_FORMAT tag determines the format of the warning messages that -# doxygen can produce. The string should contain the $file, $line, and $text -# tags, which will be replaced by the file and line number from which the -# warning originated and the warning text. Optionally the format may contain -# $version, which will be replaced by the version of the file (if it could -# be obtained via FILE_VERSION_FILTER) - -WARN_FORMAT = "$file:$line: $text" - -# The WARN_LOGFILE tag can be used to specify a file to which warning -# and error messages should be written. If left blank the output is written -# to stderr. - -WARN_LOGFILE = - -#--------------------------------------------------------------------------- -# configuration options related to the input files -#--------------------------------------------------------------------------- - -# The INPUT tag can be used to specify the files and/or directories that contain -# documented source files. You may enter file names like "myfile.cpp" or -# directories like "/usr/src/myproject". Separate the files or directories -# with spaces. - -INPUT = ../include/android - -# This tag can be used to specify the character encoding of the source files -# that doxygen parses. Internally doxygen uses the UTF-8 encoding, which is -# also the default input encoding. Doxygen uses libiconv (or the iconv built -# into libc) for the transcoding. See http://www.gnu.org/software/libiconv for -# the list of possible encodings. - -INPUT_ENCODING = UTF-8 - -# If the value of the INPUT tag contains directories, you can use the -# FILE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank the following patterns are tested: -# *.c *.cc *.cxx *.cpp *.c++ *.d *.java *.ii *.ixx *.ipp *.i++ *.inl *.h *.hh -# *.hxx *.hpp *.h++ *.idl *.odl *.cs *.php *.php3 *.inc *.m *.mm *.dox *.py -# *.f90 *.f *.for *.vhd *.vhdl - -FILE_PATTERNS = *.c \ - *.cc \ - *.cxx \ - *.cpp \ - *.c++ \ - *.d \ - *.java \ - *.ii \ - *.ixx \ - *.ipp \ - *.i++ \ - *.inl \ - *.h \ - *.hh \ - *.hxx \ - *.hpp \ - *.h++ \ - *.idl \ - *.odl \ - *.cs \ - *.php \ - *.php3 \ - *.inc \ - *.m \ - *.markdown \ - *.md \ - *.mm \ - *.dox \ - *.py \ - *.f90 \ - *.f \ - *.for \ - *.vhd \ - *.vhdl - -# The RECURSIVE tag can be used to turn specify whether or not subdirectories -# should be searched for input files as well. Possible values are YES and NO. -# If left blank NO is used. - -RECURSIVE = YES - -# The EXCLUDE tag can be used to specify files and/or directories that should be -# excluded from the INPUT source files. This way you can easily exclude a -# subdirectory from a directory tree whose root is specified with the INPUT tag. -# Note that relative paths are relative to the directory from which doxygen is -# run. - -EXCLUDE = - -# The EXCLUDE_SYMLINKS tag can be used to select whether or not files or -# directories that are symbolic links (a Unix file system feature) are excluded -# from the input. - -EXCLUDE_SYMLINKS = NO - -# If the value of the INPUT tag contains directories, you can use the -# EXCLUDE_PATTERNS tag to specify one or more wildcard patterns to exclude -# certain files from those directories. Note that the wildcards are matched -# against the file with absolute path, so to exclude all test directories -# for example use the pattern */test/* - -EXCLUDE_PATTERNS = - -# The EXCLUDE_SYMBOLS tag can be used to specify one or more symbol names -# (namespaces, classes, functions, etc.) that should be excluded from the -# output. The symbol name can be a fully qualified name, a word, or if the -# wildcard * is used, a substring. Examples: ANamespace, AClass, -# AClass::ANamespace, ANamespace::*Test - -EXCLUDE_SYMBOLS = - -# The EXAMPLE_PATH tag can be used to specify one or more files or -# directories that contain example code fragments that are included (see -# the \include command). - -EXAMPLE_PATH = - -# If the value of the EXAMPLE_PATH tag contains directories, you can use the -# EXAMPLE_PATTERNS tag to specify one or more wildcard pattern (like *.cpp -# and *.h) to filter out the source-files in the directories. If left -# blank all files are included. - -EXAMPLE_PATTERNS = * - -# If the EXAMPLE_RECURSIVE tag is set to YES then subdirectories will be -# searched for input files to be used with the \include or \dontinclude -# commands irrespective of the value of the RECURSIVE tag. -# Possible values are YES and NO. If left blank NO is used. - -EXAMPLE_RECURSIVE = NO - -# The IMAGE_PATH tag can be used to specify one or more files or -# directories that contain image that are included in the documentation (see -# the \image command). - -IMAGE_PATH = - -# The INPUT_FILTER tag can be used to specify a program that doxygen should -# invoke to filter for each input file. Doxygen will invoke the filter program -# by executing (via popen()) the command , where -# is the value of the INPUT_FILTER tag, and is the name of an -# input file. Doxygen will then use the output that the filter program writes -# to standard output. If FILTER_PATTERNS is specified, this tag will be -# ignored. - -INPUT_FILTER = - -# The FILTER_PATTERNS tag can be used to specify filters on a per file pattern -# basis. Doxygen will compare the file name with each pattern and apply the -# filter if there is a match. The filters are a list of the form: -# pattern=filter (like *.cpp=my_cpp_filter). See INPUT_FILTER for further -# info on how filters are used. If FILTER_PATTERNS is empty or if -# non of the patterns match the file name, INPUT_FILTER is applied. - -FILTER_PATTERNS = - -# If the FILTER_SOURCE_FILES tag is set to YES, the input filter (if set using -# INPUT_FILTER) will be used to filter the input files when producing source -# files to browse (i.e. when SOURCE_BROWSER is set to YES). - -FILTER_SOURCE_FILES = NO - -# The FILTER_SOURCE_PATTERNS tag can be used to specify source filters per file -# pattern. A pattern will override the setting for FILTER_PATTERN (if any) -# and it is also possible to disable source filtering for a specific pattern -# using *.ext= (so without naming a filter). This option only has effect when -# FILTER_SOURCE_FILES is enabled. - -FILTER_SOURCE_PATTERNS = - -# If the USE_MD_FILE_AS_MAINPAGE tag refers to the name of a markdown file that -# is part of the input, its contents will be placed on the main page (index.html). -# This can be useful if you have a project on for instance GitHub and want reuse -# the introduction page also for the doxygen output. - -USE_MDFILE_AS_MAINPAGE = - -#--------------------------------------------------------------------------- -# configuration options related to source browsing -#--------------------------------------------------------------------------- - -# If the SOURCE_BROWSER tag is set to YES then a list of source files will -# be generated. Documented entities will be cross-referenced with these sources. -# Note: To get rid of all source code in the generated output, make sure also -# VERBATIM_HEADERS is set to NO. - -SOURCE_BROWSER = NO - -# Setting the INLINE_SOURCES tag to YES will include the body -# of functions and classes directly in the documentation. - -INLINE_SOURCES = NO - -# Setting the STRIP_CODE_COMMENTS tag to YES (the default) will instruct -# doxygen to hide any special comment blocks from generated source code -# fragments. Normal C, C++ and Fortran comments will always remain visible. - -STRIP_CODE_COMMENTS = NO - -# If the REFERENCED_BY_RELATION tag is set to YES -# then for each documented function all documented -# functions referencing it will be listed. - -REFERENCED_BY_RELATION = NO - -# If the REFERENCES_RELATION tag is set to YES -# then for each documented function all documented entities -# called/used by that function will be listed. - -REFERENCES_RELATION = NO - -# If the REFERENCES_LINK_SOURCE tag is set to YES (the default) -# and SOURCE_BROWSER tag is set to YES, then the hyperlinks from -# functions in REFERENCES_RELATION and REFERENCED_BY_RELATION lists will -# link to the source code. Otherwise they will link to the documentation. - -REFERENCES_LINK_SOURCE = YES - -# If the USE_HTAGS tag is set to YES then the references to source code -# will point to the HTML generated by the htags(1) tool instead of doxygen -# built-in source browser. The htags tool is part of GNU's global source -# tagging system (see http://www.gnu.org/software/global/global.html). You -# will need version 4.8.6 or higher. - -USE_HTAGS = NO - -# If the VERBATIM_HEADERS tag is set to YES (the default) then Doxygen -# will generate a verbatim copy of the header file for each class for -# which an include is specified. Set to NO to disable this. - -VERBATIM_HEADERS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the alphabetical class index -#--------------------------------------------------------------------------- - -# If the ALPHABETICAL_INDEX tag is set to YES, an alphabetical index -# of all compounds will be generated. Enable this if the project -# contains a lot of classes, structs, unions or interfaces. - -ALPHABETICAL_INDEX = NO - -# If the alphabetical index is enabled (see ALPHABETICAL_INDEX) then -# the COLS_IN_ALPHA_INDEX tag can be used to specify the number of columns -# in which this list will be split (can be a number in the range [1..20]) - -COLS_IN_ALPHA_INDEX = 5 - -# In case all classes in a project start with a common prefix, all -# classes will be put under the same header in the alphabetical index. -# The IGNORE_PREFIX tag can be used to specify one or more prefixes that -# should be ignored while generating the index headers. - -IGNORE_PREFIX = - -#--------------------------------------------------------------------------- -# configuration options related to the HTML output -#--------------------------------------------------------------------------- - -# If the GENERATE_HTML tag is set to YES (the default) Doxygen will -# generate HTML output. - -GENERATE_HTML = YES - -# The HTML_OUTPUT tag is used to specify where the HTML docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `html' will be used as the default path. - -HTML_OUTPUT = $(HTML_OUTPUT) - -# The HTML_FILE_EXTENSION tag can be used to specify the file extension for -# each generated HTML page (for example: .htm,.php,.asp). If it is left blank -# doxygen will generate files with .html extension. - -HTML_FILE_EXTENSION = .html - -# The HTML_HEADER tag can be used to specify a personal HTML header for -# each generated HTML page. If it is left blank doxygen will generate a -# standard header. Note that when using a custom header you are responsible -# for the proper inclusion of any scripts and style sheets that doxygen -# needs, which is dependent on the configuration options used. -# It is advised to generate a default header using "doxygen -w html -# header.html footer.html stylesheet.css YourConfigFile" and then modify -# that header. Note that the header is subject to change so you typically -# have to redo this when upgrading to a newer version of doxygen or when -# changing the value of configuration settings such as GENERATE_TREEVIEW! - -HTML_HEADER = $(HTML_HEADER) - -# The HTML_FOOTER tag can be used to specify a personal HTML footer for -# each generated HTML page. If it is left blank doxygen will generate a -# standard footer. - -HTML_FOOTER = $(HTML_FOOTER) - -# The HTML_STYLESHEET tag can be used to specify a user-defined cascading -# style sheet that is used by each HTML page. It can be used to -# fine-tune the look of the HTML output. If left blank doxygen will -# generate a default style sheet. Note that it is recommended to use -# HTML_EXTRA_STYLESHEET instead of this one, as it is more robust and this -# tag will in the future become obsolete. - -HTML_STYLESHEET = - -# The HTML_EXTRA_STYLESHEET tag can be used to specify an additional -# user-defined cascading style sheet that is included after the standard -# style sheets created by doxygen. Using this option one can overrule -# certain style aspects. This is preferred over using HTML_STYLESHEET -# since it does not replace the standard style sheet and is therefor more -# robust against future updates. Doxygen will copy the style sheet file to -# the output directory. - -HTML_EXTRA_STYLESHEET = - -# The HTML_EXTRA_FILES tag can be used to specify one or more extra images or -# other source files which should be copied to the HTML output directory. Note -# that these files will be copied to the base HTML output directory. Use the -# $relpath$ marker in the HTML_HEADER and/or HTML_FOOTER files to load these -# files. In the HTML_STYLESHEET file, use the file name only. Also note that -# the files will be copied as-is; there are no commands or markers available. - -HTML_EXTRA_FILES = - -# The HTML_COLORSTYLE_HUE tag controls the color of the HTML output. -# Doxygen will adjust the colors in the style sheet and background images -# according to this color. Hue is specified as an angle on a colorwheel, -# see http://en.wikipedia.org/wiki/Hue for more information. -# For instance the value 0 represents red, 60 is yellow, 120 is green, -# 180 is cyan, 240 is blue, 300 purple, and 360 is red again. -# The allowed range is 0 to 359. - -HTML_COLORSTYLE_HUE = 220 - -# The HTML_COLORSTYLE_SAT tag controls the purity (or saturation) of -# the colors in the HTML output. For a value of 0 the output will use -# grayscales only. A value of 255 will produce the most vivid colors. - -HTML_COLORSTYLE_SAT = 0 - -# The HTML_COLORSTYLE_GAMMA tag controls the gamma correction applied to -# the luminance component of the colors in the HTML output. Values below -# 100 gradually make the output lighter, whereas values above 100 make -# the output darker. The value divided by 100 is the actual gamma applied, -# so 80 represents a gamma of 0.8, The value 220 represents a gamma of 2.2, -# and 100 does not change the gamma. - -HTML_COLORSTYLE_GAMMA = 80 - -# If the HTML_TIMESTAMP tag is set to YES then the footer of each generated HTML -# page will contain the date and time when the page was generated. Setting -# this to NO can help when comparing the output of multiple runs. - -HTML_TIMESTAMP = YES - -# If the HTML_DYNAMIC_SECTIONS tag is set to YES then the generated HTML -# documentation will contain sections that can be hidden and shown after the -# page has loaded. - -HTML_DYNAMIC_SECTIONS = NO - -# With HTML_INDEX_NUM_ENTRIES one can control the preferred number of -# entries shown in the various tree structured indices initially; the user -# can expand and collapse entries dynamically later on. Doxygen will expand -# the tree to such a level that at most the specified number of entries are -# visible (unless a fully collapsed tree already exceeds this amount). -# So setting the number of entries 1 will produce a full collapsed tree by -# default. 0 is a special value representing an infinite number of entries -# and will result in a full expanded tree by default. - -HTML_INDEX_NUM_ENTRIES = 100 - -# If the GENERATE_DOCSET tag is set to YES, additional index files -# will be generated that can be used as input for Apple's Xcode 3 -# integrated development environment, introduced with OSX 10.5 (Leopard). -# To create a documentation set, doxygen will generate a Makefile in the -# HTML output directory. Running make will produce the docset in that -# directory and running "make install" will install the docset in -# ~/Library/Developer/Shared/Documentation/DocSets so that Xcode will find -# it at startup. -# See http://developer.apple.com/tools/creatingdocsetswithdoxygen.html -# for more information. - -GENERATE_DOCSET = NO - -# When GENERATE_DOCSET tag is set to YES, this tag determines the name of the -# feed. A documentation feed provides an umbrella under which multiple -# documentation sets from a single provider (such as a company or product suite) -# can be grouped. - -DOCSET_FEEDNAME = "Doxygen generated docs" - -# When GENERATE_DOCSET tag is set to YES, this tag specifies a string that -# should uniquely identify the documentation set bundle. This should be a -# reverse domain-name style string, e.g. com.mycompany.MyDocSet. Doxygen -# will append .docset to the name. - -DOCSET_BUNDLE_ID = org.doxygen.Project - -# When GENERATE_PUBLISHER_ID tag specifies a string that should uniquely -# identify the documentation publisher. This should be a reverse domain-name -# style string, e.g. com.mycompany.MyDocSet.documentation. - -DOCSET_PUBLISHER_ID = org.doxygen.Publisher - -# The GENERATE_PUBLISHER_NAME tag identifies the documentation publisher. - -DOCSET_PUBLISHER_NAME = Publisher - -# If the GENERATE_HTMLHELP tag is set to YES, additional index files -# will be generated that can be used as input for tools like the -# Microsoft HTML help workshop to generate a compiled HTML help file (.chm) -# of the generated HTML documentation. - -GENERATE_HTMLHELP = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_FILE tag can -# be used to specify the file name of the resulting .chm file. You -# can add a path in front of the file if the result should not be -# written to the html output directory. - -CHM_FILE = - -# If the GENERATE_HTMLHELP tag is set to YES, the HHC_LOCATION tag can -# be used to specify the location (absolute path including file name) of -# the HTML help compiler (hhc.exe). If non-empty doxygen will try to run -# the HTML help compiler on the generated index.hhp. - -HHC_LOCATION = - -# If the GENERATE_HTMLHELP tag is set to YES, the GENERATE_CHI flag -# controls if a separate .chi index file is generated (YES) or that -# it should be included in the master .chm file (NO). - -GENERATE_CHI = NO - -# If the GENERATE_HTMLHELP tag is set to YES, the CHM_INDEX_ENCODING -# is used to encode HtmlHelp index (hhk), content (hhc) and project file -# content. - -CHM_INDEX_ENCODING = - -# If the GENERATE_HTMLHELP tag is set to YES, the BINARY_TOC flag -# controls whether a binary table of contents is generated (YES) or a -# normal table of contents (NO) in the .chm file. - -BINARY_TOC = NO - -# The TOC_EXPAND flag can be set to YES to add extra items for group members -# to the contents of the HTML help documentation and to the tree view. - -TOC_EXPAND = NO - -# If the GENERATE_QHP tag is set to YES and both QHP_NAMESPACE and -# QHP_VIRTUAL_FOLDER are set, an additional index file will be generated -# that can be used as input for Qt's qhelpgenerator to generate a -# Qt Compressed Help (.qch) of the generated HTML documentation. - -GENERATE_QHP = NO - -# If the QHG_LOCATION tag is specified, the QCH_FILE tag can -# be used to specify the file name of the resulting .qch file. -# The path specified is relative to the HTML output folder. - -QCH_FILE = - -# The QHP_NAMESPACE tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#namespace - -QHP_NAMESPACE = org.doxygen.Project - -# The QHP_VIRTUAL_FOLDER tag specifies the namespace to use when generating -# Qt Help Project output. For more information please see -# http://doc.trolltech.com/qthelpproject.html#virtual-folders - -QHP_VIRTUAL_FOLDER = doc - -# If QHP_CUST_FILTER_NAME is set, it specifies the name of a custom filter to -# add. For more information please see -# http://doc.trolltech.com/qthelpproject.html#custom-filters - -QHP_CUST_FILTER_NAME = - -# The QHP_CUST_FILT_ATTRS tag specifies the list of the attributes of the -# custom filter to add. For more information please see -# -# Qt Help Project / Custom Filters. - -QHP_CUST_FILTER_ATTRS = - -# The QHP_SECT_FILTER_ATTRS tag specifies the list of the attributes this -# project's -# filter section matches. -# -# Qt Help Project / Filter Attributes. - -QHP_SECT_FILTER_ATTRS = - -# If the GENERATE_QHP tag is set to YES, the QHG_LOCATION tag can -# be used to specify the location of Qt's qhelpgenerator. -# If non-empty doxygen will try to run qhelpgenerator on the generated -# .qhp file. - -QHG_LOCATION = - -# If the GENERATE_ECLIPSEHELP tag is set to YES, additional index files -# will be generated, which together with the HTML files, form an Eclipse help -# plugin. To install this plugin and make it available under the help contents -# menu in Eclipse, the contents of the directory containing the HTML and XML -# files needs to be copied into the plugins directory of eclipse. The name of -# the directory within the plugins directory should be the same as -# the ECLIPSE_DOC_ID value. After copying Eclipse needs to be restarted before -# the help appears. - -GENERATE_ECLIPSEHELP = NO - -# A unique identifier for the eclipse help plugin. When installing the plugin -# the directory name containing the HTML and XML files should also have -# this name. - -ECLIPSE_DOC_ID = org.doxygen.Project - -# The DISABLE_INDEX tag can be used to turn on/off the condensed index (tabs) -# at top of each HTML page. The value NO (the default) enables the index and -# the value YES disables it. Since the tabs have the same information as the -# navigation tree you can set this option to NO if you already set -# GENERATE_TREEVIEW to YES. - -DISABLE_INDEX = YES - -# The GENERATE_TREEVIEW tag is used to specify whether a tree-like index -# structure should be generated to display hierarchical information. -# If the tag value is set to YES, a side panel will be generated -# containing a tree-like index structure (just like the one that -# is generated for HTML Help). For this to work a browser that supports -# JavaScript, DHTML, CSS and frames is required (i.e. any modern browser). -# Windows users are probably better off using the HTML help feature. -# Since the tree basically has the same information as the tab index you -# could consider to set DISABLE_INDEX to NO when enabling this option. - -GENERATE_TREEVIEW = NO - -# The ENUM_VALUES_PER_LINE tag can be used to set the number of enum values -# (range [0,1..20]) that doxygen will group on one line in the generated HTML -# documentation. Note that a value of 0 will completely suppress the enum -# values from appearing in the overview section. - -ENUM_VALUES_PER_LINE = 4 - -# If the treeview is enabled (see GENERATE_TREEVIEW) then this tag can be -# used to set the initial width (in pixels) of the frame in which the tree -# is shown. - -TREEVIEW_WIDTH = 250 - -# When the EXT_LINKS_IN_WINDOW option is set to YES doxygen will open -# links to external symbols imported via tag files in a separate window. - -EXT_LINKS_IN_WINDOW = NO - -# Use this tag to change the font size of Latex formulas included -# as images in the HTML documentation. The default is 10. Note that -# when you change the font size after a successful doxygen run you need -# to manually remove any form_*.png images from the HTML output directory -# to force them to be regenerated. - -FORMULA_FONTSIZE = 10 - -# Use the FORMULA_TRANPARENT tag to determine whether or not the images -# generated for formulas are transparent PNGs. Transparent PNGs are -# not supported properly for IE 6.0, but are supported on all modern browsers. -# Note that when changing this option you need to delete any form_*.png files -# in the HTML output before the changes have effect. - -FORMULA_TRANSPARENT = YES - -# Enable the USE_MATHJAX option to render LaTeX formulas using MathJax -# (see http://www.mathjax.org) which uses client side Javascript for the -# rendering instead of using prerendered bitmaps. Use this if you do not -# have LaTeX installed or if you want to formulas look prettier in the HTML -# output. When enabled you may also need to install MathJax separately and -# configure the path to it using the MATHJAX_RELPATH option. - -USE_MATHJAX = NO - -# When MathJax is enabled you can set the default output format to be used for -# thA MathJax output. Supported types are HTML-CSS, NativeMML (i.e. MathML) and -# SVG. The default value is HTML-CSS, which is slower, but has the best -# compatibility. - -MATHJAX_FORMAT = HTML-CSS - -# When MathJax is enabled you need to specify the location relative to the -# HTML output directory using the MATHJAX_RELPATH option. The destination -# directory should contain the MathJax.js script. For instance, if the mathjax -# directory is located at the same level as the HTML output directory, then -# MATHJAX_RELPATH should be ../mathjax. The default value points to -# the MathJax Content Delivery Network so you can quickly see the result without -# installing MathJax. However, it is strongly recommended to install a local -# copy of MathJax from http://www.mathjax.org before deployment. - -MATHJAX_RELPATH = http://cdn.mathjax.org/mathjax/latest - -# The MATHJAX_EXTENSIONS tag can be used to specify one or MathJax extension -# names that should be enabled during MathJax rendering. - -MATHJAX_EXTENSIONS = - -# When the SEARCHENGINE tag is enabled doxygen will generate a search box -# for the HTML output. The underlying search engine uses javascript -# and DHTML and should work on any modern browser. Note that when using -# HTML help (GENERATE_HTMLHELP), Qt help (GENERATE_QHP), or docsets -# (GENERATE_DOCSET) there is already a search function so this one should -# typically be disabled. For large projects the javascript based search engine -# can be slow, then enabling SERVER_BASED_SEARCH may provide a better solution. - -SEARCHENGINE = NO - -# When the SERVER_BASED_SEARCH tag is enabled the search engine will be -# implemented using a web server instead of a web client using Javascript. -# There are two flavours of web server based search depending on the -# EXTERNAL_SEARCH setting. When disabled, doxygen will generate a PHP script for -# searching and an index file used by the script. When EXTERNAL_SEARCH is -# enabled the indexing and searching needs to be provided by external tools. -# See the manual for details. - -SERVER_BASED_SEARCH = NO - -# When EXTERNAL_SEARCH is enabled doxygen will no longer generate the PHP -# script for searching. Instead the search results are written to an XML file -# which needs to be processed by an external indexer. Doxygen will invoke an -# external search engine pointed to by the SEARCHENGINE_URL option to obtain -# the search results. Doxygen ships with an example indexer (doxyindexer) and -# search engine (doxysearch.cgi) which are based on the open source search engine -# library Xapian. See the manual for configuration details. - -EXTERNAL_SEARCH = NO - -# The SEARCHENGINE_URL should point to a search engine hosted by a web server -# which will returned the search results when EXTERNAL_SEARCH is enabled. -# Doxygen ships with an example search engine (doxysearch) which is based on -# the open source search engine library Xapian. See the manual for configuration -# details. - -SEARCHENGINE_URL = - -# When SERVER_BASED_SEARCH and EXTERNAL_SEARCH are both enabled the unindexed -# search data is written to a file for indexing by an external tool. With the -# SEARCHDATA_FILE tag the name of this file can be specified. - -SEARCHDATA_FILE = searchdata.xml - -# When SERVER_BASED_SEARCH AND EXTERNAL_SEARCH are both enabled the -# EXTERNAL_SEARCH_ID tag can be used as an identifier for the project. This is -# useful in combination with EXTRA_SEARCH_MAPPINGS to search through multiple -# projects and redirect the results back to the right project. - -EXTERNAL_SEARCH_ID = - -# The EXTRA_SEARCH_MAPPINGS tag can be used to enable searching through doxygen -# projects other than the one defined by this configuration file, but that are -# all added to the same external search index. Each project needs to have a -# unique id set via EXTERNAL_SEARCH_ID. The search mapping then maps the id -# of to a relative location where the documentation can be found. -# The format is: EXTRA_SEARCH_MAPPINGS = id1=loc1 id2=loc2 ... - -EXTRA_SEARCH_MAPPINGS = - -#--------------------------------------------------------------------------- -# configuration options related to the LaTeX output -#--------------------------------------------------------------------------- - -# If the GENERATE_LATEX tag is set to YES (the default) Doxygen will -# generate Latex output. - -GENERATE_LATEX = NO - -# The LATEX_OUTPUT tag is used to specify where the LaTeX docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `latex' will be used as the default path. - -LATEX_OUTPUT = latex - -# The LATEX_CMD_NAME tag can be used to specify the LaTeX command name to be -# invoked. If left blank `latex' will be used as the default command name. -# Note that when enabling USE_PDFLATEX this option is only used for -# generating bitmaps for formulas in the HTML output, but not in the -# Makefile that is written to the output directory. - -LATEX_CMD_NAME = latex - -# The MAKEINDEX_CMD_NAME tag can be used to specify the command name to -# generate index for LaTeX. If left blank `makeindex' will be used as the -# default command name. - -MAKEINDEX_CMD_NAME = makeindex - -# If the COMPACT_LATEX tag is set to YES Doxygen generates more compact -# LaTeX documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_LATEX = NO - -# The PAPER_TYPE tag can be used to set the paper type that is used -# by the printer. Possible values are: a4, letter, legal and -# executive. If left blank a4wide will be used. - -PAPER_TYPE = a4 - -# The EXTRA_PACKAGES tag can be to specify one or more names of LaTeX -# packages that should be included in the LaTeX output. - -EXTRA_PACKAGES = - -# The LATEX_HEADER tag can be used to specify a personal LaTeX header for -# the generated latex document. The header should contain everything until -# the first chapter. If it is left blank doxygen will generate a -# standard header. Notice: only use this tag if you know what you are doing! - -LATEX_HEADER = - -# The LATEX_FOOTER tag can be used to specify a personal LaTeX footer for -# the generated latex document. The footer should contain everything after -# the last chapter. If it is left blank doxygen will generate a -# standard footer. Notice: only use this tag if you know what you are doing! - -LATEX_FOOTER = - -# If the PDF_HYPERLINKS tag is set to YES, the LaTeX that is generated -# is prepared for conversion to pdf (using ps2pdf). The pdf file will -# contain links (just like the HTML output) instead of page references -# This makes the output suitable for online browsing using a pdf viewer. - -PDF_HYPERLINKS = YES - -# If the USE_PDFLATEX tag is set to YES, pdflatex will be used instead of -# plain latex in the generated Makefile. Set this option to YES to get a -# higher quality PDF documentation. - -USE_PDFLATEX = YES - -# If the LATEX_BATCHMODE tag is set to YES, doxygen will add the \\batchmode. -# command to the generated LaTeX files. This will instruct LaTeX to keep -# running if errors occur, instead of asking the user for help. -# This option is also used when generating formulas in HTML. - -LATEX_BATCHMODE = NO - -# If LATEX_HIDE_INDICES is set to YES then doxygen will not -# include the index chapters (such as File Index, Compound Index, etc.) -# in the output. - -LATEX_HIDE_INDICES = NO - -# If LATEX_SOURCE_CODE is set to YES then doxygen will include -# source code with syntax highlighting in the LaTeX output. -# Note that which sources are shown also depends on other settings -# such as SOURCE_BROWSER. - -LATEX_SOURCE_CODE = NO - -# The LATEX_BIB_STYLE tag can be used to specify the style to use for the -# bibliography, e.g. plainnat, or ieeetr. The default style is "plain". See -# http://en.wikipedia.org/wiki/BibTeX for more info. - -LATEX_BIB_STYLE = plain - -#--------------------------------------------------------------------------- -# configuration options related to the RTF output -#--------------------------------------------------------------------------- - -# If the GENERATE_RTF tag is set to YES Doxygen will generate RTF output -# The RTF output is optimized for Word 97 and may not look very pretty with -# other RTF readers or editors. - -GENERATE_RTF = NO - -# The RTF_OUTPUT tag is used to specify where the RTF docs will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `rtf' will be used as the default path. - -RTF_OUTPUT = rtf - -# If the COMPACT_RTF tag is set to YES Doxygen generates more compact -# RTF documents. This may be useful for small projects and may help to -# save some trees in general. - -COMPACT_RTF = NO - -# If the RTF_HYPERLINKS tag is set to YES, the RTF that is generated -# will contain hyperlink fields. The RTF file will -# contain links (just like the HTML output) instead of page references. -# This makes the output suitable for online browsing using WORD or other -# programs which support those fields. -# Note: wordpad (write) and others do not support links. - -RTF_HYPERLINKS = NO - -# Load style sheet definitions from file. Syntax is similar to doxygen's -# config file, i.e. a series of assignments. You only have to provide -# replacements, missing definitions are set to their default value. - -RTF_STYLESHEET_FILE = - -# Set optional variables used in the generation of an rtf document. -# Syntax is similar to doxygen's config file. - -RTF_EXTENSIONS_FILE = - -#--------------------------------------------------------------------------- -# configuration options related to the man page output -#--------------------------------------------------------------------------- - -# If the GENERATE_MAN tag is set to YES (the default) Doxygen will -# generate man pages - -GENERATE_MAN = NO - -# The MAN_OUTPUT tag is used to specify where the man pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `man' will be used as the default path. - -MAN_OUTPUT = man - -# The MAN_EXTENSION tag determines the extension that is added to -# the generated man pages (default is the subroutine's section .3) - -MAN_EXTENSION = .3 - -# If the MAN_LINKS tag is set to YES and Doxygen generates man output, -# then it will generate one additional man file for each entity -# documented in the real man page(s). These additional files -# only source the real man page, but without them the man command -# would be unable to find the correct page. The default is NO. - -MAN_LINKS = NO - -#--------------------------------------------------------------------------- -# configuration options related to the XML output -#--------------------------------------------------------------------------- - -# If the GENERATE_XML tag is set to YES Doxygen will -# generate an XML file that captures the structure of -# the code including all documentation. - -GENERATE_XML = NO - -# The XML_OUTPUT tag is used to specify where the XML pages will be put. -# If a relative path is entered the value of OUTPUT_DIRECTORY will be -# put in front of it. If left blank `xml' will be used as the default path. - -XML_OUTPUT = xml - -# The XML_SCHEMA tag can be used to specify an XML schema, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_SCHEMA = - -# The XML_DTD tag can be used to specify an XML DTD, -# which can be used by a validating XML parser to check the -# syntax of the XML files. - -XML_DTD = - -# If the XML_PROGRAMLISTING tag is set to YES Doxygen will -# dump the program listings (including syntax highlighting -# and cross-referencing information) to the XML output. Note that -# enabling this will significantly increase the size of the XML output. - -XML_PROGRAMLISTING = YES - -#--------------------------------------------------------------------------- -# configuration options for the AutoGen Definitions output -#--------------------------------------------------------------------------- - -# If the GENERATE_AUTOGEN_DEF tag is set to YES Doxygen will -# generate an AutoGen Definitions (see autogen.sf.net) file -# that captures the structure of the code including all -# documentation. Note that this feature is still experimental -# and incomplete at the moment. - -GENERATE_AUTOGEN_DEF = NO - -#--------------------------------------------------------------------------- -# configuration options related to the Perl module output -#--------------------------------------------------------------------------- - -# If the GENERATE_PERLMOD tag is set to YES Doxygen will -# generate a Perl module file that captures the structure of -# the code including all documentation. Note that this -# feature is still experimental and incomplete at the -# moment. - -GENERATE_PERLMOD = NO - -# If the PERLMOD_LATEX tag is set to YES Doxygen will generate -# the necessary Makefile rules, Perl scripts and LaTeX code to be able -# to generate PDF and DVI output from the Perl module output. - -PERLMOD_LATEX = NO - -# If the PERLMOD_PRETTY tag is set to YES the Perl module output will be -# nicely formatted so it can be parsed by a human reader. This is useful -# if you want to understand what is going on. On the other hand, if this -# tag is set to NO the size of the Perl module output will be much smaller -# and Perl will parse it just the same. - -PERLMOD_PRETTY = YES - -# The names of the make variables in the generated doxyrules.make file -# are prefixed with the string contained in PERLMOD_MAKEVAR_PREFIX. -# This is useful so different doxyrules.make files included by the same -# Makefile don't overwrite each other's variables. - -PERLMOD_MAKEVAR_PREFIX = - -#--------------------------------------------------------------------------- -# Configuration options related to the preprocessor -#--------------------------------------------------------------------------- - -# If the ENABLE_PREPROCESSING tag is set to YES (the default) Doxygen will -# evaluate all C-preprocessor directives found in the sources and include -# files. - -ENABLE_PREPROCESSING = YES - -# If the MACRO_EXPANSION tag is set to YES Doxygen will expand all macro -# names in the source code. If set to NO (the default) only conditional -# compilation will be performed. Macro expansion can be done in a controlled -# way by setting EXPAND_ONLY_PREDEF to YES. - -MACRO_EXPANSION = NO - -# If the EXPAND_ONLY_PREDEF and MACRO_EXPANSION tags are both set to YES -# then the macro expansion is limited to the macros specified with the -# PREDEFINED and EXPAND_AS_DEFINED tags. - -EXPAND_ONLY_PREDEF = NO - -# If the SEARCH_INCLUDES tag is set to YES (the default) the includes files -# pointed to by INCLUDE_PATH will be searched when a #include is found. - -SEARCH_INCLUDES = YES - -# The INCLUDE_PATH tag can be used to specify one or more directories that -# contain include files that are not input files but should be processed by -# the preprocessor. - -INCLUDE_PATH = - -# You can use the INCLUDE_FILE_PATTERNS tag to specify one or more wildcard -# patterns (like *.h and *.hpp) to filter out the header-files in the -# directories. If left blank, the patterns specified with FILE_PATTERNS will -# be used. - -INCLUDE_FILE_PATTERNS = - -# The PREDEFINED tag can be used to specify one or more macro names that -# are defined before the preprocessor is started (similar to the -D option of -# gcc). The argument of the tag is a list of macros of the form: name -# or name=definition (no spaces). If the definition and the = are -# omitted =1 is assumed. To prevent a macro definition from being -# undefined via #undef or recursively expanded use the := operator -# instead of the = operator. - -PREDEFINED = - -# If the MACRO_EXPANSION and EXPAND_ONLY_PREDEF tags are set to YES then -# this tag can be used to specify a list of macro names that should be expanded. -# The macro definition that is found in the sources will be used. -# Use the PREDEFINED tag if you want to use a different macro definition that -# overrules the definition found in the source code. - -EXPAND_AS_DEFINED = - -# If the SKIP_FUNCTION_MACROS tag is set to YES (the default) then -# doxygen's preprocessor will remove all references to function-like macros -# that are alone on a line, have an all uppercase name, and do not end with a -# semicolon, because these will confuse the parser if not removed. - -SKIP_FUNCTION_MACROS = YES - -#--------------------------------------------------------------------------- -# Configuration::additions related to external references -#--------------------------------------------------------------------------- - -# The TAGFILES option can be used to specify one or more tagfiles. For each -# tag file the location of the external documentation should be added. The -# format of a tag file without this location is as follows: -# TAGFILES = file1 file2 ... -# Adding location for the tag files is done as follows: -# TAGFILES = file1=loc1 "file2 = loc2" ... -# where "loc1" and "loc2" can be relative or absolute paths -# or URLs. Note that each tag file must have a unique name (where the name does -# NOT include the path). If a tag file is not located in the directory in which -# doxygen is run, you must also specify the path to the tagfile here. - -TAGFILES = - -# When a file name is specified after GENERATE_TAGFILE, doxygen will create -# a tag file that is based on the input files it reads. - -GENERATE_TAGFILE = - -# If the ALLEXTERNALS tag is set to YES all external classes will be listed -# in the class index. If set to NO only the inherited external classes -# will be listed. - -ALLEXTERNALS = NO - -# If the EXTERNAL_GROUPS tag is set to YES all external groups will be listed -# in the modules index. If set to NO, only the current project's groups will -# be listed. - -EXTERNAL_GROUPS = YES - -# The PERL_PATH should be the absolute path and name of the perl script -# interpreter (i.e. the result of `which perl'). - -PERL_PATH = /usr/bin/perl - -#--------------------------------------------------------------------------- -# Configuration options related to the dot tool -#--------------------------------------------------------------------------- - -# If the CLASS_DIAGRAMS tag is set to YES (the default) Doxygen will -# generate a inheritance diagram (in HTML, RTF and LaTeX) for classes with base -# or super classes. Setting the tag to NO turns the diagrams off. Note that -# this option also works with HAVE_DOT disabled, but it is recommended to -# install and use dot, since it yields more powerful graphs. - -CLASS_DIAGRAMS = NO - -# You can define message sequence charts within doxygen comments using the \msc -# command. Doxygen will then run the mscgen tool (see -# http://www.mcternan.me.uk/mscgen/) to produce the chart and insert it in the -# documentation. The MSCGEN_PATH tag allows you to specify the directory where -# the mscgen tool resides. If left empty the tool is assumed to be found in the -# default search path. - -MSCGEN_PATH = - -# If set to YES, the inheritance and collaboration graphs will hide -# inheritance and usage relations if the target is undocumented -# or is not a class. - -HIDE_UNDOC_RELATIONS = YES - -# If you set the HAVE_DOT tag to YES then doxygen will assume the dot tool is -# available from the path. This tool is part of Graphviz, a graph visualization -# toolkit from AT&T and Lucent Bell Labs. The other options in this section -# have no effect if this option is set to NO (the default) - -HAVE_DOT = NO - -# The DOT_NUM_THREADS specifies the number of dot invocations doxygen is -# allowed to run in parallel. When set to 0 (the default) doxygen will -# base this on the number of processors available in the system. You can set it -# explicitly to a value larger than 0 to get control over the balance -# between CPU load and processing speed. - -DOT_NUM_THREADS = 0 - -# By default doxygen will use the Helvetica font for all dot files that -# doxygen generates. When you want a differently looking font you can specify -# the font name using DOT_FONTNAME. You need to make sure dot is able to find -# the font, which can be done by putting it in a standard location or by setting -# the DOTFONTPATH environment variable or by setting DOT_FONTPATH to the -# directory containing the font. - -DOT_FONTNAME = Helvetica - -# The DOT_FONTSIZE tag can be used to set the size of the font of dot graphs. -# The default size is 10pt. - -DOT_FONTSIZE = 10 - -# By default doxygen will tell dot to use the Helvetica font. -# If you specify a different font using DOT_FONTNAME you can use DOT_FONTPATH to -# set the path where dot can find it. - -DOT_FONTPATH = - -# If the CLASS_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect inheritance relations. Setting this tag to YES will force the -# CLASS_DIAGRAMS tag to NO. - -CLASS_GRAPH = YES - -# If the COLLABORATION_GRAPH and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for each documented class showing the direct and -# indirect implementation dependencies (inheritance, containment, and -# class references variables) of the class with other documented classes. - -COLLABORATION_GRAPH = YES - -# If the GROUP_GRAPHS and HAVE_DOT tags are set to YES then doxygen -# will generate a graph for groups, showing the direct groups dependencies - -GROUP_GRAPHS = YES - -# If the UML_LOOK tag is set to YES doxygen will generate inheritance and -# collaboration diagrams in a style similar to the OMG's Unified Modeling -# Language. - -UML_LOOK = NO - -# If the UML_LOOK tag is enabled, the fields and methods are shown inside -# the class node. If there are many fields or methods and many nodes the -# graph may become too big to be useful. The UML_LIMIT_NUM_FIELDS -# threshold limits the number of items for each type to make the size more -# managable. Set this to 0 for no limit. Note that the threshold may be -# exceeded by 50% before the limit is enforced. - -UML_LIMIT_NUM_FIELDS = 10 - -# If set to YES, the inheritance and collaboration graphs will show the -# relations between templates and their instances. - -TEMPLATE_RELATIONS = NO - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDE_GRAPH, and HAVE_DOT -# tags are set to YES then doxygen will generate a graph for each documented -# file showing the direct and indirect include dependencies of the file with -# other documented files. - -INCLUDE_GRAPH = YES - -# If the ENABLE_PREPROCESSING, SEARCH_INCLUDES, INCLUDED_BY_GRAPH, and -# HAVE_DOT tags are set to YES then doxygen will generate a graph for each -# documented header file showing the documented files that directly or -# indirectly include this file. - -INCLUDED_BY_GRAPH = YES - -# If the CALL_GRAPH and HAVE_DOT options are set to YES then -# doxygen will generate a call dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable call graphs -# for selected functions only using the \callgraph command. - -CALL_GRAPH = NO - -# If the CALLER_GRAPH and HAVE_DOT tags are set to YES then -# doxygen will generate a caller dependency graph for every global function -# or class method. Note that enabling this option will significantly increase -# the time of a run. So in most cases it will be better to enable caller -# graphs for selected functions only using the \callergraph command. - -CALLER_GRAPH = NO - -# If the GRAPHICAL_HIERARCHY and HAVE_DOT tags are set to YES then doxygen -# will generate a graphical hierarchy of all classes instead of a textual one. - -GRAPHICAL_HIERARCHY = YES - -# If the DIRECTORY_GRAPH and HAVE_DOT tags are set to YES -# then doxygen will show the dependencies a directory has on other directories -# in a graphical way. The dependency relations are determined by the #include -# relations between the files in the directories. - -DIRECTORY_GRAPH = YES - -# The DOT_IMAGE_FORMAT tag can be used to set the image format of the images -# generated by dot. Possible values are svg, png, jpg, or gif. -# If left blank png will be used. If you choose svg you need to set -# HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible in IE 9+ (other browsers do not have this requirement). - -DOT_IMAGE_FORMAT = png - -# If DOT_IMAGE_FORMAT is set to svg, then this option can be set to YES to -# enable generation of interactive SVG images that allow zooming and panning. -# Note that this requires a modern browser other than Internet Explorer. -# Tested and working are Firefox, Chrome, Safari, and Opera. For IE 9+ you -# need to set HTML_FILE_EXTENSION to xhtml in order to make the SVG files -# visible. Older versions of IE do not have SVG support. - -INTERACTIVE_SVG = NO - -# The tag DOT_PATH can be used to specify the path where the dot tool can be -# found. If left blank, it is assumed the dot tool can be found in the path. - -DOT_PATH = - -# The DOTFILE_DIRS tag can be used to specify one or more directories that -# contain dot files that are included in the documentation (see the -# \dotfile command). - -DOTFILE_DIRS = - -# The MSCFILE_DIRS tag can be used to specify one or more directories that -# contain msc files that are included in the documentation (see the -# \mscfile command). - -MSCFILE_DIRS = - -# The DOT_GRAPH_MAX_NODES tag can be used to set the maximum number of -# nodes that will be shown in the graph. If the number of nodes in a graph -# becomes larger than this value, doxygen will truncate the graph, which is -# visualized by representing a node as a red box. Note that doxygen if the -# number of direct children of the root node in a graph is already larger than -# DOT_GRAPH_MAX_NODES then the graph will not be shown at all. Also note -# that the size of a graph can be further restricted by MAX_DOT_GRAPH_DEPTH. - -DOT_GRAPH_MAX_NODES = 50 - -# The MAX_DOT_GRAPH_DEPTH tag can be used to set the maximum depth of the -# graphs generated by dot. A depth value of 3 means that only nodes reachable -# from the root by following a path via at most 3 edges will be shown. Nodes -# that lay further from the root node will be omitted. Note that setting this -# option to 1 or 2 may greatly reduce the computation time needed for large -# code bases. Also note that the size of a graph can be further restricted by -# DOT_GRAPH_MAX_NODES. Using a depth of 0 means no depth restriction. - -MAX_DOT_GRAPH_DEPTH = 0 - -# Set the DOT_TRANSPARENT tag to YES to generate images with a transparent -# background. This is disabled by default, because dot on Windows does not -# seem to support this out of the box. Warning: Depending on the platform used, -# enabling this option may lead to badly anti-aliased labels on the edges of -# a graph (i.e. they become hard to read). - -DOT_TRANSPARENT = NO - -# Set the DOT_MULTI_TARGETS tag to YES allow dot to generate multiple output -# files in one run (i.e. multiple -o and -T options on the command line). This -# makes dot run faster, but since only newer versions of dot (>1.8.10) -# support this, this feature is disabled by default. - -DOT_MULTI_TARGETS = NO - -# If the GENERATE_LEGEND tag is set to YES (the default) Doxygen will -# generate a legend page explaining the meaning of the various boxes and -# arrows in the dot generated graphs. - -GENERATE_LEGEND = YES - -# If the DOT_CLEANUP tag is set to YES (the default) Doxygen will -# remove the intermediate dot files that are used to generate -# the various graphs. - -DOT_CLEANUP = YES diff -Nru android-platform-frameworks-native-6.0.1+r16/docs/header.jd android-platform-frameworks-native-21/docs/header.jd --- android-platform-frameworks-native-6.0.1+r16/docs/header.jd 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/docs/header.jd 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -page.title=$title -page.customHeadTag= -@jd:body diff -Nru android-platform-frameworks-native-6.0.1+r16/docs/Makefile android-platform-frameworks-native-21/docs/Makefile --- android-platform-frameworks-native-6.0.1+r16/docs/Makefile 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/docs/Makefile 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -HEADERS := $(wildcard ../include/android/*.h) - -all: html jd - -html: $(HEADERS) Doxyfile - mkdir -p html - doxygen - -jd: $(HEADERS) Doxyfile header.jd - mkdir -p jd - HTML_HEADER=header.jd HTML_FOOTER=footer.jd HTML_OUTPUT=jd doxygen - for file in jd/*.html; do mv "$${file}" "$${file/.html/.jd}"; done - rm -f jd/index.jd diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/asset_manager.h android-platform-frameworks-native-21/include/android/asset_manager.h --- android-platform-frameworks-native-6.0.1+r16/include/android/asset_manager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/asset_manager.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Asset - * @{ - */ - -/** - * @file asset_manager.h - */ #ifndef ANDROID_ASSET_MANAGER_H #define ANDROID_ASSET_MANAGER_H @@ -31,49 +23,19 @@ #endif struct AAssetManager; -/** - * {@link AAssetManager} provides access to an application's raw assets by - * creating {@link AAsset} objects. - * - * AAssetManager is a wrapper to the low-level native implementation - * of the java {@link AAssetManager}, a pointer can be obtained using - * AAssetManager_fromJava(). - * - * The asset hierarchy may be examined like a filesystem, using - * {@link AAssetDir} objects to peruse a single directory. - * - * A native {@link AAssetManager} pointer may be shared across multiple threads. - */ typedef struct AAssetManager AAssetManager; struct AAssetDir; -/** - * {@link AAssetDir} provides access to a chunk of the asset hierarchy as if - * it were a single directory. The contents are populated by the - * {@link AAssetManager}. - * - * The list of files will be sorted in ascending order by ASCII value. - */ typedef struct AAssetDir AAssetDir; struct AAsset; -/** - * {@link AAsset} provides access to a read-only asset. - * - * {@link AAsset} objects are NOT thread-safe, and should not be shared across - * threads. - */ typedef struct AAsset AAsset; -/** Available access modes for opening assets with {@link AAssetManager_open} */ +/* Available modes for opening assets */ enum { - /** No specific information about how data will be accessed. **/ AASSET_MODE_UNKNOWN = 0, - /** Read chunks, and seek forward and backward. */ AASSET_MODE_RANDOM = 1, - /** Read sequentially, with an occasional forward seek. */ AASSET_MODE_STREAMING = 2, - /** Caller plans to ask for a read-only buffer with all data. */ AASSET_MODE_BUFFER = 3 }; @@ -211,5 +173,3 @@ #endif #endif // ANDROID_ASSET_MANAGER_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/asset_manager_jni.h android-platform-frameworks-native-21/include/android/asset_manager_jni.h --- android-platform-frameworks-native-6.0.1+r16/include/android/asset_manager_jni.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/asset_manager_jni.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Asset - * @{ - */ - -/** - * @file asset_manager_jni.h - */ #ifndef ANDROID_ASSET_MANAGER_JNI_H #define ANDROID_ASSET_MANAGER_JNI_H @@ -46,5 +38,3 @@ #endif #endif // ANDROID_ASSET_MANAGER_JNI_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/bitmap.h android-platform-frameworks-native-21/include/android/bitmap.h --- android-platform-frameworks-native-6.0.1+r16/include/android/bitmap.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/bitmap.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,15 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Bitmap - * @{ - */ - -/** - * @file bitmap.h - */ - #ifndef ANDROID_BITMAP_H #define ANDROID_BITMAP_H @@ -33,52 +24,30 @@ extern "C" { #endif -/** AndroidBitmap functions result code. */ -enum { - /** Operation was successful. */ - ANDROID_BITMAP_RESULT_SUCCESS = 0, - /** Bad parameter. */ - ANDROID_BITMAP_RESULT_BAD_PARAMETER = -1, - /** JNI exception occured. */ - ANDROID_BITMAP_RESULT_JNI_EXCEPTION = -2, - /** Allocation failed. */ - ANDROID_BITMAP_RESULT_ALLOCATION_FAILED = -3, -}; - -/** Backward compatibility: this macro used to be misspelled. */ -#define ANDROID_BITMAP_RESUT_SUCCESS ANDROID_BITMAP_RESULT_SUCCESS +#define ANDROID_BITMAP_RESUT_SUCCESS 0 +#define ANDROID_BITMAP_RESULT_BAD_PARAMETER -1 +#define ANDROID_BITMAP_RESULT_JNI_EXCEPTION -2 +#define ANDROID_BITMAP_RESULT_ALLOCATION_FAILED -3 -/** Bitmap pixel format. */ enum AndroidBitmapFormat { - /** No format. */ ANDROID_BITMAP_FORMAT_NONE = 0, - /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Alpha: 8 bits. **/ ANDROID_BITMAP_FORMAT_RGBA_8888 = 1, - /** Red: 5 bits, Green: 6 bits, Blue: 5 bits. **/ ANDROID_BITMAP_FORMAT_RGB_565 = 4, - /** Red: 4 bits, Green: 4 bits, Blue: 4 bits, Alpha: 4 bits. **/ ANDROID_BITMAP_FORMAT_RGBA_4444 = 7, - /** Deprecated. */ ANDROID_BITMAP_FORMAT_A_8 = 8, }; -/** Bitmap info, see AndroidBitmap_getInfo(). */ typedef struct { - /** The bitmap width in pixels. */ uint32_t width; - /** The bitmap height in pixels. */ uint32_t height; - /** The number of byte per row. */ uint32_t stride; - /** The bitmap pixel format. See {@link AndroidBitmapFormat} */ int32_t format; - /** Unused. */ uint32_t flags; // 0 for now } AndroidBitmapInfo; /** - * Given a java bitmap object, fill out the AndroidBitmapInfo struct for it. - * If the call fails, the info parameter will be ignored. + * Given a java bitmap object, fill out the AndroidBitmap struct for it. + * If the call fails, the info parameter will be ignored */ int AndroidBitmap_getInfo(JNIEnv* env, jobject jbitmap, AndroidBitmapInfo* info); @@ -99,7 +68,7 @@ int AndroidBitmap_lockPixels(JNIEnv* env, jobject jbitmap, void** addrPtr); /** - * Call this to balance a successful call to AndroidBitmap_lockPixels. + * Call this to balanace a successful call to AndroidBitmap_lockPixels */ int AndroidBitmap_unlockPixels(JNIEnv* env, jobject jbitmap); @@ -108,5 +77,3 @@ #endif #endif - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/configuration.h android-platform-frameworks-native-21/include/android/configuration.h --- android-platform-frameworks-native-6.0.1+r16/include/android/configuration.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/configuration.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,15 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Configuration - * @{ - */ - -/** - * @file configuration.h - */ - #ifndef ANDROID_CONFIGURATION_H #define ANDROID_CONFIGURATION_H @@ -33,401 +24,89 @@ #endif struct AConfiguration; -/** - * {@link AConfiguration} is an opaque type used to get and set - * various subsystem configurations. - * - * A {@link AConfiguration} pointer can be obtained using: - * - AConfiguration_new() - * - AConfiguration_fromAssetManager() - */ typedef struct AConfiguration AConfiguration; - -/** - * Define flags and constants for various subsystem configurations. - */ enum { - /** Orientation: not specified. */ ACONFIGURATION_ORIENTATION_ANY = 0x0000, - /** - * Orientation: value corresponding to the - * port - * resource qualifier. - */ ACONFIGURATION_ORIENTATION_PORT = 0x0001, - /** - * Orientation: value corresponding to the - * land - * resource qualifier. - */ ACONFIGURATION_ORIENTATION_LAND = 0x0002, - /** @deprecated Not currently supported or used. */ ACONFIGURATION_ORIENTATION_SQUARE = 0x0003, - /** Touchscreen: not specified. */ ACONFIGURATION_TOUCHSCREEN_ANY = 0x0000, - /** - * Touchscreen: value corresponding to the - * notouch - * resource qualifier. - */ ACONFIGURATION_TOUCHSCREEN_NOTOUCH = 0x0001, - /** @deprecated Not currently supported or used. */ ACONFIGURATION_TOUCHSCREEN_STYLUS = 0x0002, - /** - * Touchscreen: value corresponding to the - * finger - * resource qualifier. - */ ACONFIGURATION_TOUCHSCREEN_FINGER = 0x0003, - /** Density: default density. */ ACONFIGURATION_DENSITY_DEFAULT = 0, - /** - * Density: value corresponding to the - * ldpi - * resource qualifier. - */ ACONFIGURATION_DENSITY_LOW = 120, - /** - * Density: value corresponding to the - * mdpi - * resource qualifier. - */ ACONFIGURATION_DENSITY_MEDIUM = 160, - /** - * Density: value corresponding to the - * tvdpi - * resource qualifier. - */ ACONFIGURATION_DENSITY_TV = 213, - /** - * Density: value corresponding to the - * hdpi - * resource qualifier. - */ ACONFIGURATION_DENSITY_HIGH = 240, - /** - * Density: value corresponding to the - * xhdpi - * resource qualifier. - */ ACONFIGURATION_DENSITY_XHIGH = 320, - /** - * Density: value corresponding to the - * xxhdpi - * resource qualifier. - */ ACONFIGURATION_DENSITY_XXHIGH = 480, - /** - * Density: value corresponding to the - * xxxhdpi - * resource qualifier. - */ - ACONFIGURATION_DENSITY_XXXHIGH = 640, - /** Density: any density. */ - ACONFIGURATION_DENSITY_ANY = 0xfffe, - /** Density: no density specified. */ ACONFIGURATION_DENSITY_NONE = 0xffff, - /** Keyboard: not specified. */ ACONFIGURATION_KEYBOARD_ANY = 0x0000, - /** - * Keyboard: value corresponding to the - * nokeys - * resource qualifier. - */ ACONFIGURATION_KEYBOARD_NOKEYS = 0x0001, - /** - * Keyboard: value corresponding to the - * qwerty - * resource qualifier. - */ ACONFIGURATION_KEYBOARD_QWERTY = 0x0002, - /** - * Keyboard: value corresponding to the - * 12key - * resource qualifier. - */ ACONFIGURATION_KEYBOARD_12KEY = 0x0003, - /** Navigation: not specified. */ ACONFIGURATION_NAVIGATION_ANY = 0x0000, - /** - * Navigation: value corresponding to the - * nonav - * resource qualifier. - */ ACONFIGURATION_NAVIGATION_NONAV = 0x0001, - /** - * Navigation: value corresponding to the - * dpad - * resource qualifier. - */ ACONFIGURATION_NAVIGATION_DPAD = 0x0002, - /** - * Navigation: value corresponding to the - * trackball - * resource qualifier. - */ ACONFIGURATION_NAVIGATION_TRACKBALL = 0x0003, - /** - * Navigation: value corresponding to the - * wheel - * resource qualifier. - */ ACONFIGURATION_NAVIGATION_WHEEL = 0x0004, - /** Keyboard availability: not specified. */ ACONFIGURATION_KEYSHIDDEN_ANY = 0x0000, - /** - * Keyboard availability: value corresponding to the - * keysexposed - * resource qualifier. - */ ACONFIGURATION_KEYSHIDDEN_NO = 0x0001, - /** - * Keyboard availability: value corresponding to the - * keyshidden - * resource qualifier. - */ ACONFIGURATION_KEYSHIDDEN_YES = 0x0002, - /** - * Keyboard availability: value corresponding to the - * keyssoft - * resource qualifier. - */ ACONFIGURATION_KEYSHIDDEN_SOFT = 0x0003, - /** Navigation availability: not specified. */ ACONFIGURATION_NAVHIDDEN_ANY = 0x0000, - /** - * Navigation availability: value corresponding to the - * navexposed - * resource qualifier. - */ ACONFIGURATION_NAVHIDDEN_NO = 0x0001, - /** - * Navigation availability: value corresponding to the - * navhidden - * resource qualifier. - */ ACONFIGURATION_NAVHIDDEN_YES = 0x0002, - /** Screen size: not specified. */ ACONFIGURATION_SCREENSIZE_ANY = 0x00, - /** - * Screen size: value indicating the screen is at least - * approximately 320x426 dp units, corresponding to the - * small - * resource qualifier. - */ ACONFIGURATION_SCREENSIZE_SMALL = 0x01, - /** - * Screen size: value indicating the screen is at least - * approximately 320x470 dp units, corresponding to the - * normal - * resource qualifier. - */ ACONFIGURATION_SCREENSIZE_NORMAL = 0x02, - /** - * Screen size: value indicating the screen is at least - * approximately 480x640 dp units, corresponding to the - * large - * resource qualifier. - */ ACONFIGURATION_SCREENSIZE_LARGE = 0x03, - /** - * Screen size: value indicating the screen is at least - * approximately 720x960 dp units, corresponding to the - * xlarge - * resource qualifier. - */ ACONFIGURATION_SCREENSIZE_XLARGE = 0x04, - /** Screen layout: not specified. */ ACONFIGURATION_SCREENLONG_ANY = 0x00, - /** - * Screen layout: value that corresponds to the - * notlong - * resource qualifier. - */ ACONFIGURATION_SCREENLONG_NO = 0x1, - /** - * Screen layout: value that corresponds to the - * long - * resource qualifier. - */ ACONFIGURATION_SCREENLONG_YES = 0x2, - ACONFIGURATION_SCREENROUND_ANY = 0x00, - ACONFIGURATION_SCREENROUND_NO = 0x1, - ACONFIGURATION_SCREENROUND_YES = 0x2, - - /** UI mode: not specified. */ ACONFIGURATION_UI_MODE_TYPE_ANY = 0x00, - /** - * UI mode: value that corresponds to - * no - * UI mode type resource qualifier specified. - */ ACONFIGURATION_UI_MODE_TYPE_NORMAL = 0x01, - /** - * UI mode: value that corresponds to - * desk resource qualifier specified. - */ ACONFIGURATION_UI_MODE_TYPE_DESK = 0x02, - /** - * UI mode: value that corresponds to - * car resource qualifier specified. - */ ACONFIGURATION_UI_MODE_TYPE_CAR = 0x03, - /** - * UI mode: value that corresponds to - * television resource qualifier specified. - */ ACONFIGURATION_UI_MODE_TYPE_TELEVISION = 0x04, - /** - * UI mode: value that corresponds to - * appliance resource qualifier specified. - */ ACONFIGURATION_UI_MODE_TYPE_APPLIANCE = 0x05, - /** - * UI mode: value that corresponds to - * watch resource qualifier specified. - */ - ACONFIGURATION_UI_MODE_TYPE_WATCH = 0x06, - /** UI night mode: not specified.*/ ACONFIGURATION_UI_MODE_NIGHT_ANY = 0x00, - /** - * UI night mode: value that corresponds to - * notnight resource qualifier specified. - */ ACONFIGURATION_UI_MODE_NIGHT_NO = 0x1, - /** - * UI night mode: value that corresponds to - * night resource qualifier specified. - */ ACONFIGURATION_UI_MODE_NIGHT_YES = 0x2, - /** Screen width DPI: not specified. */ ACONFIGURATION_SCREEN_WIDTH_DP_ANY = 0x0000, - /** Screen height DPI: not specified. */ ACONFIGURATION_SCREEN_HEIGHT_DP_ANY = 0x0000, - /** Smallest screen width DPI: not specified.*/ ACONFIGURATION_SMALLEST_SCREEN_WIDTH_DP_ANY = 0x0000, - /** Layout direction: not specified. */ - ACONFIGURATION_LAYOUTDIR_ANY = 0x00, - /** - * Layout direction: value that corresponds to - * ldltr resource qualifier specified. - */ - ACONFIGURATION_LAYOUTDIR_LTR = 0x01, - /** - * Layout direction: value that corresponds to - * ldrtl resource qualifier specified. - */ - ACONFIGURATION_LAYOUTDIR_RTL = 0x02, - - /** - * Bit mask for - * mcc - * configuration. - */ ACONFIGURATION_MCC = 0x0001, - /** - * Bit mask for - * mnc - * configuration. - */ ACONFIGURATION_MNC = 0x0002, - /** - * Bit mask for - * locale - * configuration. - */ ACONFIGURATION_LOCALE = 0x0004, - /** - * Bit mask for - * touchscreen - * configuration. - */ ACONFIGURATION_TOUCHSCREEN = 0x0008, - /** - * Bit mask for - * keyboard - * configuration. - */ ACONFIGURATION_KEYBOARD = 0x0010, - /** - * Bit mask for - * keyboardHidden - * configuration. - */ ACONFIGURATION_KEYBOARD_HIDDEN = 0x0020, - /** - * Bit mask for - * navigation - * configuration. - */ ACONFIGURATION_NAVIGATION = 0x0040, - /** - * Bit mask for - * orientation - * configuration. - */ ACONFIGURATION_ORIENTATION = 0x0080, - /** - * Bit mask for - * density - * configuration. - */ ACONFIGURATION_DENSITY = 0x0100, - /** - * Bit mask for - * screen size - * configuration. - */ ACONFIGURATION_SCREEN_SIZE = 0x0200, - /** - * Bit mask for - * platform version - * configuration. - */ ACONFIGURATION_VERSION = 0x0400, - /** - * Bit mask for screen layout configuration. - */ ACONFIGURATION_SCREEN_LAYOUT = 0x0800, - /** - * Bit mask for - * ui mode - * configuration. - */ ACONFIGURATION_UI_MODE = 0x1000, - /** - * Bit mask for - * smallest screen width - * configuration. - */ ACONFIGURATION_SMALLEST_SCREEN_SIZE = 0x2000, - /** - * Bit mask for - * layout direction - * configuration. - */ - ACONFIGURATION_LAYOUTDIR = 0x4000, - ACONFIGURATION_SCREEN_ROUND = 0x8000, - /** - * Constant used to to represent MNC (Mobile Network Code) zero. - * 0 cannot be used, since it is used to represent an undefined MNC. - */ - ACONFIGURATION_MNC_ZERO = 0xffff, }; /** @@ -443,7 +122,7 @@ /** * Create and return a new AConfiguration based on the current configuration in - * use in the given {@link AAssetManager}. + * use in the given AssetManager. */ void AConfiguration_fromAssetManager(AConfiguration* out, AAssetManager* am); @@ -599,16 +278,6 @@ void AConfiguration_setScreenLong(AConfiguration* config, int32_t screenLong); /** - * Return the current ACONFIGURATION_SCREENROUND_* set in the configuration. - */ -int32_t AConfiguration_getScreenRound(AConfiguration* config); - -/** - * Set the current screen round in the configuration. - */ -void AConfiguration_setScreenRound(AConfiguration* config, int32_t screenRound); - -/** * Return the current ACONFIGURATION_UI_MODE_TYPE_* set in the configuration. */ int32_t AConfiguration_getUiModeType(AConfiguration* config); @@ -662,17 +331,6 @@ void AConfiguration_setSmallestScreenWidthDp(AConfiguration* config, int32_t value); /** - * Return the configuration's layout direction, or - * ACONFIGURATION_LAYOUTDIR_ANY if not set. - */ -int32_t AConfiguration_getLayoutDirection(AConfiguration* config); - -/** - * Set the configuration's layout direction. - */ -void AConfiguration_setLayoutDirection(AConfiguration* config, int32_t value); - -/** * Perform a diff between two configurations. Returns a bit mask of * ACONFIGURATION_* constants, each bit set meaning that configuration element * is different between them. @@ -704,5 +362,3 @@ #endif #endif // ANDROID_CONFIGURATION_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/input.h android-platform-frameworks-native-21/include/android/input.h --- android-platform-frameworks-native-6.0.1+r16/include/android/input.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/input.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,15 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Input - * @{ - */ - -/** - * @file input.h - */ - #ifndef _ANDROID_INPUT_H #define _ANDROID_INPUT_H @@ -58,271 +49,247 @@ extern "C" { #endif -/** +/* * Key states (may be returned by queries about the current state of a * particular key code, scan code or switch). */ enum { - /** The key state is unknown or the requested key itself is not supported. */ + /* The key state is unknown or the requested key itself is not supported. */ AKEY_STATE_UNKNOWN = -1, - /** The key is up. */ + /* The key is up. */ AKEY_STATE_UP = 0, - /** The key is down. */ + /* The key is down. */ AKEY_STATE_DOWN = 1, - /** The key is down but is a virtual key press that is being emulated by the system. */ + /* The key is down but is a virtual key press that is being emulated by the system. */ AKEY_STATE_VIRTUAL = 2 }; -/** +/* * Meta key / modifer state. */ enum { - /** No meta keys are pressed. */ + /* No meta keys are pressed. */ AMETA_NONE = 0, - /** This mask is used to check whether one of the ALT meta keys is pressed. */ + /* This mask is used to check whether one of the ALT meta keys is pressed. */ AMETA_ALT_ON = 0x02, - /** This mask is used to check whether the left ALT meta key is pressed. */ + /* This mask is used to check whether the left ALT meta key is pressed. */ AMETA_ALT_LEFT_ON = 0x10, - /** This mask is used to check whether the right ALT meta key is pressed. */ + /* This mask is used to check whether the right ALT meta key is pressed. */ AMETA_ALT_RIGHT_ON = 0x20, - /** This mask is used to check whether one of the SHIFT meta keys is pressed. */ + /* This mask is used to check whether one of the SHIFT meta keys is pressed. */ AMETA_SHIFT_ON = 0x01, - /** This mask is used to check whether the left SHIFT meta key is pressed. */ + /* This mask is used to check whether the left SHIFT meta key is pressed. */ AMETA_SHIFT_LEFT_ON = 0x40, - /** This mask is used to check whether the right SHIFT meta key is pressed. */ + /* This mask is used to check whether the right SHIFT meta key is pressed. */ AMETA_SHIFT_RIGHT_ON = 0x80, - /** This mask is used to check whether the SYM meta key is pressed. */ + /* This mask is used to check whether the SYM meta key is pressed. */ AMETA_SYM_ON = 0x04, - /** This mask is used to check whether the FUNCTION meta key is pressed. */ + /* This mask is used to check whether the FUNCTION meta key is pressed. */ AMETA_FUNCTION_ON = 0x08, - /** This mask is used to check whether one of the CTRL meta keys is pressed. */ + /* This mask is used to check whether one of the CTRL meta keys is pressed. */ AMETA_CTRL_ON = 0x1000, - /** This mask is used to check whether the left CTRL meta key is pressed. */ + /* This mask is used to check whether the left CTRL meta key is pressed. */ AMETA_CTRL_LEFT_ON = 0x2000, - /** This mask is used to check whether the right CTRL meta key is pressed. */ + /* This mask is used to check whether the right CTRL meta key is pressed. */ AMETA_CTRL_RIGHT_ON = 0x4000, - /** This mask is used to check whether one of the META meta keys is pressed. */ + /* This mask is used to check whether one of the META meta keys is pressed. */ AMETA_META_ON = 0x10000, - /** This mask is used to check whether the left META meta key is pressed. */ + /* This mask is used to check whether the left META meta key is pressed. */ AMETA_META_LEFT_ON = 0x20000, - /** This mask is used to check whether the right META meta key is pressed. */ + /* This mask is used to check whether the right META meta key is pressed. */ AMETA_META_RIGHT_ON = 0x40000, - /** This mask is used to check whether the CAPS LOCK meta key is on. */ + /* This mask is used to check whether the CAPS LOCK meta key is on. */ AMETA_CAPS_LOCK_ON = 0x100000, - /** This mask is used to check whether the NUM LOCK meta key is on. */ + /* This mask is used to check whether the NUM LOCK meta key is on. */ AMETA_NUM_LOCK_ON = 0x200000, - /** This mask is used to check whether the SCROLL LOCK meta key is on. */ + /* This mask is used to check whether the SCROLL LOCK meta key is on. */ AMETA_SCROLL_LOCK_ON = 0x400000, }; -struct AInputEvent; -/** +/* * Input events. * * Input events are opaque structures. Use the provided accessors functions to * read their properties. */ +struct AInputEvent; typedef struct AInputEvent AInputEvent; -/** +/* * Input event types. */ enum { - /** Indicates that the input event is a key event. */ + /* Indicates that the input event is a key event. */ AINPUT_EVENT_TYPE_KEY = 1, - /** Indicates that the input event is a motion event. */ + /* Indicates that the input event is a motion event. */ AINPUT_EVENT_TYPE_MOTION = 2 }; -/** +/* * Key event actions. */ enum { - /** The key has been pressed down. */ + /* The key has been pressed down. */ AKEY_EVENT_ACTION_DOWN = 0, - /** The key has been released. */ + /* The key has been released. */ AKEY_EVENT_ACTION_UP = 1, - /** - * Multiple duplicate key events have occurred in a row, or a - * complex string is being delivered. The repeat_count property - * of the key event contains the number of times the given key - * code should be executed. + /* Multiple duplicate key events have occurred in a row, or a complex string is + * being delivered. The repeat_count property of the key event contains the number + * of times the given key code should be executed. */ AKEY_EVENT_ACTION_MULTIPLE = 2 }; -/** +/* * Key event flags. */ enum { - /** This mask is set if the device woke because of this key event. */ + /* This mask is set if the device woke because of this key event. */ AKEY_EVENT_FLAG_WOKE_HERE = 0x1, - /** This mask is set if the key event was generated by a software keyboard. */ + /* This mask is set if the key event was generated by a software keyboard. */ AKEY_EVENT_FLAG_SOFT_KEYBOARD = 0x2, - /** This mask is set if we don't want the key event to cause us to leave touch mode. */ + /* This mask is set if we don't want the key event to cause us to leave touch mode. */ AKEY_EVENT_FLAG_KEEP_TOUCH_MODE = 0x4, - /** - * This mask is set if an event was known to come from a trusted - * part of the system. That is, the event is known to come from - * the user, and could not have been spoofed by a third party - * component. - */ + /* This mask is set if an event was known to come from a trusted part + * of the system. That is, the event is known to come from the user, + * and could not have been spoofed by a third party component. */ AKEY_EVENT_FLAG_FROM_SYSTEM = 0x8, - /** - * This mask is used for compatibility, to identify enter keys that are + /* This mask is used for compatibility, to identify enter keys that are * coming from an IME whose enter key has been auto-labelled "next" or * "done". This allows TextView to dispatch these as normal enter keys * for old applications, but still do the appropriate action when - * receiving them. - */ + * receiving them. */ AKEY_EVENT_FLAG_EDITOR_ACTION = 0x10, - /** - * When associated with up key events, this indicates that the key press + /* When associated with up key events, this indicates that the key press * has been canceled. Typically this is used with virtual touch screen * keys, where the user can slide from the virtual key area on to the * display: in that case, the application will receive a canceled up * event and should not perform the action normally associated with the * key. Note that for this to work, the application can not perform an * action for a key until it receives an up or the long press timeout has - * expired. - */ + * expired. */ AKEY_EVENT_FLAG_CANCELED = 0x20, - /** - * This key event was generated by a virtual (on-screen) hard key area. + /* This key event was generated by a virtual (on-screen) hard key area. * Typically this is an area of the touchscreen, outside of the regular - * display, dedicated to "hardware" buttons. - */ + * display, dedicated to "hardware" buttons. */ AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY = 0x40, - /** - * This flag is set for the first key repeat that occurs after the - * long press timeout. - */ + /* This flag is set for the first key repeat that occurs after the + * long press timeout. */ AKEY_EVENT_FLAG_LONG_PRESS = 0x80, - /** - * Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long - * press action was executed while it was down. - */ + /* Set when a key event has AKEY_EVENT_FLAG_CANCELED set because a long + * press action was executed while it was down. */ AKEY_EVENT_FLAG_CANCELED_LONG_PRESS = 0x100, - /** - * Set for AKEY_EVENT_ACTION_UP when this event's key code is still being + /* Set for AKEY_EVENT_ACTION_UP when this event's key code is still being * tracked from its initial down. That is, somebody requested that tracking * started on the key down and a long press has not caused - * the tracking to be canceled. - */ + * the tracking to be canceled. */ AKEY_EVENT_FLAG_TRACKING = 0x200, - /** - * Set when a key event has been synthesized to implement default behavior + /* Set when a key event has been synthesized to implement default behavior * for an event that the application did not handle. * Fallback key events are generated by unhandled trackball motions * (to emulate a directional keypad) and by certain unhandled key presses * that are declared in the key map (such as special function numeric keypad - * keys when numlock is off). - */ + * keys when numlock is off). */ AKEY_EVENT_FLAG_FALLBACK = 0x400, }; -/** - * Bit shift for the action bits holding the pointer index as +/* + * Motion event actions. + */ + +/* Bit shift for the action bits holding the pointer index as * defined by AMOTION_EVENT_ACTION_POINTER_INDEX_MASK. */ #define AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT 8 -/** Motion event actions */ enum { - /** Bit mask of the parts of the action code that are the action itself. */ + /* Bit mask of the parts of the action code that are the action itself. + */ AMOTION_EVENT_ACTION_MASK = 0xff, - /** - * Bits in the action code that represent a pointer index, used with + /* Bits in the action code that represent a pointer index, used with * AMOTION_EVENT_ACTION_POINTER_DOWN and AMOTION_EVENT_ACTION_POINTER_UP. Shifting * down by AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT provides the actual pointer * index where the data for the pointer going up or down can be found. */ AMOTION_EVENT_ACTION_POINTER_INDEX_MASK = 0xff00, - /** A pressed gesture has started, the motion contains the initial starting location. */ + /* A pressed gesture has started, the motion contains the initial starting location. + */ AMOTION_EVENT_ACTION_DOWN = 0, - /** - * A pressed gesture has finished, the motion contains the final release location + /* A pressed gesture has finished, the motion contains the final release location * as well as any intermediate points since the last down or move event. */ AMOTION_EVENT_ACTION_UP = 1, - /** - * A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and + /* A change has happened during a press gesture (between AMOTION_EVENT_ACTION_DOWN and * AMOTION_EVENT_ACTION_UP). The motion contains the most recent point, as well as * any intermediate points since the last down or move event. */ AMOTION_EVENT_ACTION_MOVE = 2, - /** - * The current gesture has been aborted. + /* The current gesture has been aborted. * You will not receive any more points in it. You should treat this as * an up event, but not perform any action that you normally would. */ AMOTION_EVENT_ACTION_CANCEL = 3, - /** - * A movement has happened outside of the normal bounds of the UI element. + /* A movement has happened outside of the normal bounds of the UI element. * This does not provide a full gesture, but only the initial location of the movement/touch. */ AMOTION_EVENT_ACTION_OUTSIDE = 4, - /** - * A non-primary pointer has gone down. + /* A non-primary pointer has gone down. * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. */ AMOTION_EVENT_ACTION_POINTER_DOWN = 5, - /** - * A non-primary pointer has gone up. + /* A non-primary pointer has gone up. * The bits in AMOTION_EVENT_ACTION_POINTER_INDEX_MASK indicate which pointer changed. */ AMOTION_EVENT_ACTION_POINTER_UP = 6, - /** - * A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). + /* A change happened but the pointer is not down (unlike AMOTION_EVENT_ACTION_MOVE). * The motion contains the most recent point, as well as any intermediate points since * the last hover move event. */ AMOTION_EVENT_ACTION_HOVER_MOVE = 7, - /** - * The motion event contains relative vertical and/or horizontal scroll offsets. + /* The motion event contains relative vertical and/or horizontal scroll offsets. * Use getAxisValue to retrieve the information from AMOTION_EVENT_AXIS_VSCROLL * and AMOTION_EVENT_AXIS_HSCROLL. * The pointer may or may not be down when this event is dispatched. @@ -331,25 +298,20 @@ */ AMOTION_EVENT_ACTION_SCROLL = 8, - /** The pointer is not down but has entered the boundaries of a window or view. */ + /* The pointer is not down but has entered the boundaries of a window or view. + */ AMOTION_EVENT_ACTION_HOVER_ENTER = 9, - /** The pointer is not down but has exited the boundaries of a window or view. */ + /* The pointer is not down but has exited the boundaries of a window or view. + */ AMOTION_EVENT_ACTION_HOVER_EXIT = 10, - - /* One or more buttons have been pressed. */ - AMOTION_EVENT_ACTION_BUTTON_PRESS = 11, - - /* One or more buttons have been released. */ - AMOTION_EVENT_ACTION_BUTTON_RELEASE = 12, }; -/** +/* * Motion event flags. */ enum { - /** - * This flag indicates that the window that received this motion event is partly + /* This flag indicates that the window that received this motion event is partly * or wholly obscured by another visible window above it. This flag is set to true * even if the event did not directly pass through the obscured area. * A security sensitive application can check this flag to identify situations in which @@ -361,513 +323,168 @@ AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED = 0x1, }; -/** +/* * Motion event edge touch flags. */ enum { - /** No edges intersected. */ + /* No edges intersected */ AMOTION_EVENT_EDGE_FLAG_NONE = 0, - /** Flag indicating the motion event intersected the top edge of the screen. */ + /* Flag indicating the motion event intersected the top edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_TOP = 0x01, - /** Flag indicating the motion event intersected the bottom edge of the screen. */ + /* Flag indicating the motion event intersected the bottom edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_BOTTOM = 0x02, - /** Flag indicating the motion event intersected the left edge of the screen. */ + /* Flag indicating the motion event intersected the left edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_LEFT = 0x04, - /** Flag indicating the motion event intersected the right edge of the screen. */ + /* Flag indicating the motion event intersected the right edge of the screen. */ AMOTION_EVENT_EDGE_FLAG_RIGHT = 0x08 }; -/** +/* * Constants that identify each individual axis of a motion event. - * @anchor AMOTION_EVENT_AXIS + * Refer to the documentation on the MotionEvent class for descriptions of each axis. */ enum { - /** - * Axis constant: X axis of a motion event. - * - * - For a touch screen, reports the absolute X screen position of the center of - * the touch contact area. The units are display pixels. - * - For a touch pad, reports the absolute X surface position of the center of the touch - * contact area. The units are device-dependent. - * - For a mouse, reports the absolute X screen position of the mouse pointer. - * The units are display pixels. - * - For a trackball, reports the relative horizontal displacement of the trackball. - * The value is normalized to a range from -1.0 (left) to 1.0 (right). - * - For a joystick, reports the absolute X position of the joystick. - * The value is normalized to a range from -1.0 (left) to 1.0 (right). - */ AMOTION_EVENT_AXIS_X = 0, - /** - * Axis constant: Y axis of a motion event. - * - * - For a touch screen, reports the absolute Y screen position of the center of - * the touch contact area. The units are display pixels. - * - For a touch pad, reports the absolute Y surface position of the center of the touch - * contact area. The units are device-dependent. - * - For a mouse, reports the absolute Y screen position of the mouse pointer. - * The units are display pixels. - * - For a trackball, reports the relative vertical displacement of the trackball. - * The value is normalized to a range from -1.0 (up) to 1.0 (down). - * - For a joystick, reports the absolute Y position of the joystick. - * The value is normalized to a range from -1.0 (up or far) to 1.0 (down or near). - */ AMOTION_EVENT_AXIS_Y = 1, - /** - * Axis constant: Pressure axis of a motion event. - * - * - For a touch screen or touch pad, reports the approximate pressure applied to the surface - * by a finger or other tool. The value is normalized to a range from - * 0 (no pressure at all) to 1 (normal pressure), although values higher than 1 - * may be generated depending on the calibration of the input device. - * - For a trackball, the value is set to 1 if the trackball button is pressed - * or 0 otherwise. - * - For a mouse, the value is set to 1 if the primary mouse button is pressed - * or 0 otherwise. - */ AMOTION_EVENT_AXIS_PRESSURE = 2, - /** - * Axis constant: Size axis of a motion event. - * - * - For a touch screen or touch pad, reports the approximate size of the contact area in - * relation to the maximum detectable size for the device. The value is normalized - * to a range from 0 (smallest detectable size) to 1 (largest detectable size), - * although it is not a linear scale. This value is of limited use. - * To obtain calibrated size information, see - * {@link AMOTION_EVENT_AXIS_TOUCH_MAJOR} or {@link AMOTION_EVENT_AXIS_TOOL_MAJOR}. - */ AMOTION_EVENT_AXIS_SIZE = 3, - /** - * Axis constant: TouchMajor axis of a motion event. - * - * - For a touch screen, reports the length of the major axis of an ellipse that - * represents the touch area at the point of contact. - * The units are display pixels. - * - For a touch pad, reports the length of the major axis of an ellipse that - * represents the touch area at the point of contact. - * The units are device-dependent. - */ AMOTION_EVENT_AXIS_TOUCH_MAJOR = 4, - /** - * Axis constant: TouchMinor axis of a motion event. - * - * - For a touch screen, reports the length of the minor axis of an ellipse that - * represents the touch area at the point of contact. - * The units are display pixels. - * - For a touch pad, reports the length of the minor axis of an ellipse that - * represents the touch area at the point of contact. - * The units are device-dependent. - * - * When the touch is circular, the major and minor axis lengths will be equal to one another. - */ AMOTION_EVENT_AXIS_TOUCH_MINOR = 5, - /** - * Axis constant: ToolMajor axis of a motion event. - * - * - For a touch screen, reports the length of the major axis of an ellipse that - * represents the size of the approaching finger or tool used to make contact. - * - For a touch pad, reports the length of the major axis of an ellipse that - * represents the size of the approaching finger or tool used to make contact. - * The units are device-dependent. - * - * When the touch is circular, the major and minor axis lengths will be equal to one another. - * - * The tool size may be larger than the touch size since the tool may not be fully - * in contact with the touch sensor. - */ AMOTION_EVENT_AXIS_TOOL_MAJOR = 6, - /** - * Axis constant: ToolMinor axis of a motion event. - * - * - For a touch screen, reports the length of the minor axis of an ellipse that - * represents the size of the approaching finger or tool used to make contact. - * - For a touch pad, reports the length of the minor axis of an ellipse that - * represents the size of the approaching finger or tool used to make contact. - * The units are device-dependent. - * - * When the touch is circular, the major and minor axis lengths will be equal to one another. - * - * The tool size may be larger than the touch size since the tool may not be fully - * in contact with the touch sensor. - */ AMOTION_EVENT_AXIS_TOOL_MINOR = 7, - /** - * Axis constant: Orientation axis of a motion event. - * - * - For a touch screen or touch pad, reports the orientation of the finger - * or tool in radians relative to the vertical plane of the device. - * An angle of 0 radians indicates that the major axis of contact is oriented - * upwards, is perfectly circular or is of unknown orientation. A positive angle - * indicates that the major axis of contact is oriented to the right. A negative angle - * indicates that the major axis of contact is oriented to the left. - * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians - * (finger pointing fully right). - * - For a stylus, the orientation indicates the direction in which the stylus - * is pointing in relation to the vertical axis of the current orientation of the screen. - * The range is from -PI radians to PI radians, where 0 is pointing up, - * -PI/2 radians is pointing left, -PI or PI radians is pointing down, and PI/2 radians - * is pointing right. See also {@link AMOTION_EVENT_AXIS_TILT}. - */ AMOTION_EVENT_AXIS_ORIENTATION = 8, - /** - * Axis constant: Vertical Scroll axis of a motion event. - * - * - For a mouse, reports the relative movement of the vertical scroll wheel. - * The value is normalized to a range from -1.0 (down) to 1.0 (up). - * - * This axis should be used to scroll views vertically. - */ AMOTION_EVENT_AXIS_VSCROLL = 9, - /** - * Axis constant: Horizontal Scroll axis of a motion event. - * - * - For a mouse, reports the relative movement of the horizontal scroll wheel. - * The value is normalized to a range from -1.0 (left) to 1.0 (right). - * - * This axis should be used to scroll views horizontally. - */ AMOTION_EVENT_AXIS_HSCROLL = 10, - /** - * Axis constant: Z axis of a motion event. - * - * - For a joystick, reports the absolute Z position of the joystick. - * The value is normalized to a range from -1.0 (high) to 1.0 (low). - * On game pads with two analog joysticks, this axis is often reinterpreted - * to report the absolute X position of the second joystick instead. - */ AMOTION_EVENT_AXIS_Z = 11, - /** - * Axis constant: X Rotation axis of a motion event. - * - * - For a joystick, reports the absolute rotation angle about the X axis. - * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). - */ AMOTION_EVENT_AXIS_RX = 12, - /** - * Axis constant: Y Rotation axis of a motion event. - * - * - For a joystick, reports the absolute rotation angle about the Y axis. - * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). - */ AMOTION_EVENT_AXIS_RY = 13, - /** - * Axis constant: Z Rotation axis of a motion event. - * - * - For a joystick, reports the absolute rotation angle about the Z axis. - * The value is normalized to a range from -1.0 (counter-clockwise) to 1.0 (clockwise). - * On game pads with two analog joysticks, this axis is often reinterpreted - * to report the absolute Y position of the second joystick instead. - */ AMOTION_EVENT_AXIS_RZ = 14, - /** - * Axis constant: Hat X axis of a motion event. - * - * - For a joystick, reports the absolute X position of the directional hat control. - * The value is normalized to a range from -1.0 (left) to 1.0 (right). - */ AMOTION_EVENT_AXIS_HAT_X = 15, - /** - * Axis constant: Hat Y axis of a motion event. - * - * - For a joystick, reports the absolute Y position of the directional hat control. - * The value is normalized to a range from -1.0 (up) to 1.0 (down). - */ AMOTION_EVENT_AXIS_HAT_Y = 16, - /** - * Axis constant: Left Trigger axis of a motion event. - * - * - For a joystick, reports the absolute position of the left trigger control. - * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed). - */ AMOTION_EVENT_AXIS_LTRIGGER = 17, - /** - * Axis constant: Right Trigger axis of a motion event. - * - * - For a joystick, reports the absolute position of the right trigger control. - * The value is normalized to a range from 0.0 (released) to 1.0 (fully pressed). - */ AMOTION_EVENT_AXIS_RTRIGGER = 18, - /** - * Axis constant: Throttle axis of a motion event. - * - * - For a joystick, reports the absolute position of the throttle control. - * The value is normalized to a range from 0.0 (fully open) to 1.0 (fully closed). - */ AMOTION_EVENT_AXIS_THROTTLE = 19, - /** - * Axis constant: Rudder axis of a motion event. - * - * - For a joystick, reports the absolute position of the rudder control. - * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right). - */ AMOTION_EVENT_AXIS_RUDDER = 20, - /** - * Axis constant: Wheel axis of a motion event. - * - * - For a joystick, reports the absolute position of the steering wheel control. - * The value is normalized to a range from -1.0 (turn left) to 1.0 (turn right). - */ AMOTION_EVENT_AXIS_WHEEL = 21, - /** - * Axis constant: Gas axis of a motion event. - * - * - For a joystick, reports the absolute position of the gas (accelerator) control. - * The value is normalized to a range from 0.0 (no acceleration) - * to 1.0 (maximum acceleration). - */ AMOTION_EVENT_AXIS_GAS = 22, - /** - * Axis constant: Brake axis of a motion event. - * - * - For a joystick, reports the absolute position of the brake control. - * The value is normalized to a range from 0.0 (no braking) to 1.0 (maximum braking). - */ AMOTION_EVENT_AXIS_BRAKE = 23, - /** - * Axis constant: Distance axis of a motion event. - * - * - For a stylus, reports the distance of the stylus from the screen. - * A value of 0.0 indicates direct contact and larger values indicate increasing - * distance from the surface. - */ AMOTION_EVENT_AXIS_DISTANCE = 24, - /** - * Axis constant: Tilt axis of a motion event. - * - * - For a stylus, reports the tilt angle of the stylus in radians where - * 0 radians indicates that the stylus is being held perpendicular to the - * surface, and PI/2 radians indicates that the stylus is being held flat - * against the surface. - */ AMOTION_EVENT_AXIS_TILT = 25, - /** - * Axis constant: Generic 1 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_1 = 32, - /** - * Axis constant: Generic 2 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_2 = 33, - /** - * Axis constant: Generic 3 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_3 = 34, - /** - * Axis constant: Generic 4 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_4 = 35, - /** - * Axis constant: Generic 5 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_5 = 36, - /** - * Axis constant: Generic 6 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_6 = 37, - /** - * Axis constant: Generic 7 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_7 = 38, - /** - * Axis constant: Generic 8 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_8 = 39, - /** - * Axis constant: Generic 9 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_9 = 40, - /** - * Axis constant: Generic 10 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_10 = 41, - /** - * Axis constant: Generic 11 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_11 = 42, - /** - * Axis constant: Generic 12 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_12 = 43, - /** - * Axis constant: Generic 13 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_13 = 44, - /** - * Axis constant: Generic 14 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_14 = 45, - /** - * Axis constant: Generic 15 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_15 = 46, - /** - * Axis constant: Generic 16 axis of a motion event. - * The interpretation of a generic axis is device-specific. - */ AMOTION_EVENT_AXIS_GENERIC_16 = 47, // NOTE: If you add a new axis here you must also add it to several other files. // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list. }; -/** +/* * Constants that identify buttons that are associated with motion events. * Refer to the documentation on the MotionEvent class for descriptions of each button. */ enum { - /** primary */ AMOTION_EVENT_BUTTON_PRIMARY = 1 << 0, - /** secondary */ AMOTION_EVENT_BUTTON_SECONDARY = 1 << 1, - /** tertiary */ AMOTION_EVENT_BUTTON_TERTIARY = 1 << 2, - /** back */ AMOTION_EVENT_BUTTON_BACK = 1 << 3, - /** forward */ AMOTION_EVENT_BUTTON_FORWARD = 1 << 4, - AMOTION_EVENT_BUTTON_STYLUS_PRIMARY = 1 << 5, - AMOTION_EVENT_BUTTON_STYLUS_SECONDARY = 1 << 6, }; -/** +/* * Constants that identify tool types. * Refer to the documentation on the MotionEvent class for descriptions of each tool type. */ enum { - /** unknown */ AMOTION_EVENT_TOOL_TYPE_UNKNOWN = 0, - /** finger */ AMOTION_EVENT_TOOL_TYPE_FINGER = 1, - /** stylus */ AMOTION_EVENT_TOOL_TYPE_STYLUS = 2, - /** mouse */ AMOTION_EVENT_TOOL_TYPE_MOUSE = 3, - /** eraser */ AMOTION_EVENT_TOOL_TYPE_ERASER = 4, }; -/** - * Input source masks. +/* + * Input sources. * * Refer to the documentation on android.view.InputDevice for more details about input sources * and their correct interpretation. */ enum { - /** mask */ AINPUT_SOURCE_CLASS_MASK = 0x000000ff, - /** none */ - AINPUT_SOURCE_CLASS_NONE = 0x00000000, - /** button */ AINPUT_SOURCE_CLASS_BUTTON = 0x00000001, - /** pointer */ AINPUT_SOURCE_CLASS_POINTER = 0x00000002, - /** navigation */ AINPUT_SOURCE_CLASS_NAVIGATION = 0x00000004, - /** position */ AINPUT_SOURCE_CLASS_POSITION = 0x00000008, - /** joystick */ AINPUT_SOURCE_CLASS_JOYSTICK = 0x00000010, }; -/** - * Input sources. - */ enum { - /** unknown */ AINPUT_SOURCE_UNKNOWN = 0x00000000, - /** keyboard */ AINPUT_SOURCE_KEYBOARD = 0x00000100 | AINPUT_SOURCE_CLASS_BUTTON, - /** dpad */ AINPUT_SOURCE_DPAD = 0x00000200 | AINPUT_SOURCE_CLASS_BUTTON, - /** gamepad */ AINPUT_SOURCE_GAMEPAD = 0x00000400 | AINPUT_SOURCE_CLASS_BUTTON, - /** touchscreen */ AINPUT_SOURCE_TOUCHSCREEN = 0x00001000 | AINPUT_SOURCE_CLASS_POINTER, - /** mouse */ AINPUT_SOURCE_MOUSE = 0x00002000 | AINPUT_SOURCE_CLASS_POINTER, - /** stylus */ AINPUT_SOURCE_STYLUS = 0x00004000 | AINPUT_SOURCE_CLASS_POINTER, - /** bluetooth stylus */ - AINPUT_SOURCE_BLUETOOTH_STYLUS = 0x00008000 | AINPUT_SOURCE_STYLUS, - /** trackball */ AINPUT_SOURCE_TRACKBALL = 0x00010000 | AINPUT_SOURCE_CLASS_NAVIGATION, - /** touchpad */ AINPUT_SOURCE_TOUCHPAD = 0x00100000 | AINPUT_SOURCE_CLASS_POSITION, - /** navigation */ - AINPUT_SOURCE_TOUCH_NAVIGATION = 0x00200000 | AINPUT_SOURCE_CLASS_NONE, - /** joystick */ AINPUT_SOURCE_JOYSTICK = 0x01000000 | AINPUT_SOURCE_CLASS_JOYSTICK, - /** any */ AINPUT_SOURCE_ANY = 0xffffff00, }; -/** +/* * Keyboard types. * * Refer to the documentation on android.view.InputDevice for more details. */ enum { - /** none */ AINPUT_KEYBOARD_TYPE_NONE = 0, - /** non alphabetic */ AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC = 1, - /** alphabetic */ AINPUT_KEYBOARD_TYPE_ALPHABETIC = 2, }; -/** +/* * Constants used to retrieve information about the range of motion for a particular * coordinate of a motion event. * * Refer to the documentation on android.view.InputDevice for more details about input sources * and their correct interpretation. * - * @deprecated These constants are deprecated. Use {@link AMOTION_EVENT_AXIS AMOTION_EVENT_AXIS_*} constants instead. + * DEPRECATION NOTICE: These constants are deprecated. Use AMOTION_EVENT_AXIS_* constants instead. */ enum { - /** x */ AINPUT_MOTION_RANGE_X = AMOTION_EVENT_AXIS_X, - /** y */ AINPUT_MOTION_RANGE_Y = AMOTION_EVENT_AXIS_Y, - /** pressure */ AINPUT_MOTION_RANGE_PRESSURE = AMOTION_EVENT_AXIS_PRESSURE, - /** size */ AINPUT_MOTION_RANGE_SIZE = AMOTION_EVENT_AXIS_SIZE, - /** touch major */ AINPUT_MOTION_RANGE_TOUCH_MAJOR = AMOTION_EVENT_AXIS_TOUCH_MAJOR, - /** touch minor */ AINPUT_MOTION_RANGE_TOUCH_MINOR = AMOTION_EVENT_AXIS_TOUCH_MINOR, - /** tool major */ AINPUT_MOTION_RANGE_TOOL_MAJOR = AMOTION_EVENT_AXIS_TOOL_MAJOR, - /** tool minor */ AINPUT_MOTION_RANGE_TOOL_MINOR = AMOTION_EVENT_AXIS_TOOL_MINOR, - /** orientation */ AINPUT_MOTION_RANGE_ORIENTATION = AMOTION_EVENT_AXIS_ORIENTATION, -}; +} __attribute__ ((deprecated)); -/** +/* * Input event accessors. * * Note that most functions can only be used on input events that are of a given type. @@ -876,10 +493,10 @@ /*** Accessors for all input events. ***/ -/** Get the input event type. */ +/* Get the input event type. */ int32_t AInputEvent_getType(const AInputEvent* event); -/** Get the id for the device that an input event came from. +/* Get the id for the device that an input event came from. * * Input events can be generated by multiple different input devices. * Use the input device id to obtain information about the input @@ -891,351 +508,272 @@ */ int32_t AInputEvent_getDeviceId(const AInputEvent* event); -/** Get the input event source. */ +/* Get the input event source. */ int32_t AInputEvent_getSource(const AInputEvent* event); /*** Accessors for key events only. ***/ -/** Get the key event action. */ +/* Get the key event action. */ int32_t AKeyEvent_getAction(const AInputEvent* key_event); -/** Get the key event flags. */ +/* Get the key event flags. */ int32_t AKeyEvent_getFlags(const AInputEvent* key_event); -/** - * Get the key code of the key event. - * This is the physical key that was pressed, not the Unicode character. - */ +/* Get the key code of the key event. + * This is the physical key that was pressed, not the Unicode character. */ int32_t AKeyEvent_getKeyCode(const AInputEvent* key_event); -/** - * Get the hardware key id of this key event. - * These values are not reliable and vary from device to device. - */ +/* Get the hardware key id of this key event. + * These values are not reliable and vary from device to device. */ int32_t AKeyEvent_getScanCode(const AInputEvent* key_event); -/** Get the meta key state. */ +/* Get the meta key state. */ int32_t AKeyEvent_getMetaState(const AInputEvent* key_event); -/** - * Get the repeat count of the event. +/* Get the repeat count of the event. * For both key up an key down events, this is the number of times the key has * repeated with the first down starting at 0 and counting up from there. For - * multiple key events, this is the number of down/up pairs that have occurred. - */ + * multiple key events, this is the number of down/up pairs that have occurred. */ int32_t AKeyEvent_getRepeatCount(const AInputEvent* key_event); -/** - * Get the time of the most recent key down event, in the +/* Get the time of the most recent key down event, in the * java.lang.System.nanoTime() time base. If this is a down event, * this will be the same as eventTime. * Note that when chording keys, this value is the down time of the most recently - * pressed key, which may not be the same physical key of this event. - */ + * pressed key, which may not be the same physical key of this event. */ int64_t AKeyEvent_getDownTime(const AInputEvent* key_event); -/** - * Get the time this event occurred, in the - * java.lang.System.nanoTime() time base. - */ +/* Get the time this event occurred, in the + * java.lang.System.nanoTime() time base. */ int64_t AKeyEvent_getEventTime(const AInputEvent* key_event); /*** Accessors for motion events only. ***/ -/** Get the combined motion event action code and pointer index. */ +/* Get the combined motion event action code and pointer index. */ int32_t AMotionEvent_getAction(const AInputEvent* motion_event); -/** Get the motion event flags. */ +/* Get the motion event flags. */ int32_t AMotionEvent_getFlags(const AInputEvent* motion_event); -/** - * Get the state of any meta / modifier keys that were in effect when the - * event was generated. - */ +/* Get the state of any meta / modifier keys that were in effect when the + * event was generated. */ int32_t AMotionEvent_getMetaState(const AInputEvent* motion_event); -/** Get the button state of all buttons that are pressed. */ +/* Get the button state of all buttons that are pressed. */ int32_t AMotionEvent_getButtonState(const AInputEvent* motion_event); -/** - * Get a bitfield indicating which edges, if any, were touched by this motion event. +/* Get a bitfield indicating which edges, if any, were touched by this motion event. * For touch events, clients can use this to determine if the user's finger was - * touching the edge of the display. - */ + * touching the edge of the display. */ int32_t AMotionEvent_getEdgeFlags(const AInputEvent* motion_event); -/** - * Get the time when the user originally pressed down to start a stream of - * position events, in the java.lang.System.nanoTime() time base. - */ +/* Get the time when the user originally pressed down to start a stream of + * position events, in the java.lang.System.nanoTime() time base. */ int64_t AMotionEvent_getDownTime(const AInputEvent* motion_event); -/** - * Get the time when this specific event was generated, - * in the java.lang.System.nanoTime() time base. - */ +/* Get the time when this specific event was generated, + * in the java.lang.System.nanoTime() time base. */ int64_t AMotionEvent_getEventTime(const AInputEvent* motion_event); -/** - * Get the X coordinate offset. +/* Get the X coordinate offset. * For touch events on the screen, this is the delta that was added to the raw * screen coordinates to adjust for the absolute position of the containing windows - * and views. - */ + * and views. */ float AMotionEvent_getXOffset(const AInputEvent* motion_event); -/** - * Get the Y coordinate offset. +/* Get the precision of the Y coordinates being reported. * For touch events on the screen, this is the delta that was added to the raw * screen coordinates to adjust for the absolute position of the containing windows - * and views. - */ + * and views. */ float AMotionEvent_getYOffset(const AInputEvent* motion_event); -/** - * Get the precision of the X coordinates being reported. +/* Get the precision of the X coordinates being reported. * You can multiply this number with an X coordinate sample to find the - * actual hardware value of the X coordinate. - */ + * actual hardware value of the X coordinate. */ float AMotionEvent_getXPrecision(const AInputEvent* motion_event); -/** - * Get the precision of the Y coordinates being reported. +/* Get the precision of the Y coordinates being reported. * You can multiply this number with a Y coordinate sample to find the - * actual hardware value of the Y coordinate. - */ + * actual hardware value of the Y coordinate. */ float AMotionEvent_getYPrecision(const AInputEvent* motion_event); -/** - * Get the number of pointers of data contained in this event. - * Always >= 1. - */ +/* Get the number of pointers of data contained in this event. + * Always >= 1. */ size_t AMotionEvent_getPointerCount(const AInputEvent* motion_event); -/** - * Get the pointer identifier associated with a particular pointer +/* Get the pointer identifier associated with a particular pointer * data index in this event. The identifier tells you the actual pointer * number associated with the data, accounting for individual pointers - * going up and down since the start of the current gesture. - */ + * going up and down since the start of the current gesture. */ int32_t AMotionEvent_getPointerId(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the tool type of a pointer for the given pointer index. +/* Get the tool type of a pointer for the given pointer index. * The tool type indicates the type of tool used to make contact such as a - * finger or stylus, if known. - */ + * finger or stylus, if known. */ int32_t AMotionEvent_getToolType(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the original raw X coordinate of this event. +/* Get the original raw X coordinate of this event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window - * and views. - */ + * and views. */ float AMotionEvent_getRawX(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the original raw X coordinate of this event. +/* Get the original raw X coordinate of this event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window - * and views. - */ + * and views. */ float AMotionEvent_getRawY(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current X coordinate of this event for the given pointer index. +/* Get the current X coordinate of this event for the given pointer index. * Whole numbers are pixels; the value may have a fraction for input devices - * that are sub-pixel precise. - */ + * that are sub-pixel precise. */ float AMotionEvent_getX(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current Y coordinate of this event for the given pointer index. +/* Get the current Y coordinate of this event for the given pointer index. * Whole numbers are pixels; the value may have a fraction for input devices - * that are sub-pixel precise. - */ + * that are sub-pixel precise. */ float AMotionEvent_getY(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current pressure of this event for the given pointer index. +/* Get the current pressure of this event for the given pointer index. * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), * although values higher than 1 may be generated depending on the calibration of - * the input device. - */ + * the input device. */ float AMotionEvent_getPressure(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current scaled value of the approximate size for the given pointer index. +/* Get the current scaled value of the approximate size for the given pointer index. * This represents some approximation of the area of the screen being * pressed; the actual value in pixels corresponding to the * touch is normalized with the device specific range of values * and scaled to a value between 0 and 1. The value of size can be used to - * determine fat touch events. - */ + * determine fat touch events. */ float AMotionEvent_getSize(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current length of the major axis of an ellipse that describes the touch area - * at the point of contact for the given pointer index. - */ +/* Get the current length of the major axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index. */ float AMotionEvent_getTouchMajor(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current length of the minor axis of an ellipse that describes the touch area - * at the point of contact for the given pointer index. - */ +/* Get the current length of the minor axis of an ellipse that describes the touch area + * at the point of contact for the given pointer index. */ float AMotionEvent_getTouchMinor(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current length of the major axis of an ellipse that describes the size +/* Get the current length of the major axis of an ellipse that describes the size * of the approaching tool for the given pointer index. * The tool area represents the estimated size of the finger or pen that is - * touching the device independent of its actual touch area at the point of contact. - */ + * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getToolMajor(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current length of the minor axis of an ellipse that describes the size +/* Get the current length of the minor axis of an ellipse that describes the size * of the approaching tool for the given pointer index. * The tool area represents the estimated size of the finger or pen that is - * touching the device independent of its actual touch area at the point of contact. - */ + * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getToolMinor(const AInputEvent* motion_event, size_t pointer_index); -/** - * Get the current orientation of the touch area and tool area in radians clockwise from +/* Get the current orientation of the touch area and tool area in radians clockwise from * vertical for the given pointer index. * An angle of 0 degrees indicates that the major axis of contact is oriented * upwards, is perfectly circular or is of unknown orientation. A positive angle * indicates that the major axis of contact is oriented to the right. A negative angle * indicates that the major axis of contact is oriented to the left. * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians - * (finger pointing fully right). - */ + * (finger pointing fully right). */ float AMotionEvent_getOrientation(const AInputEvent* motion_event, size_t pointer_index); -/** Get the value of the request axis for the given pointer index. */ +/* Get the value of the request axis for the given pointer index. */ float AMotionEvent_getAxisValue(const AInputEvent* motion_event, int32_t axis, size_t pointer_index); -/** - * Get the number of historical points in this event. These are movements that +/* Get the number of historical points in this event. These are movements that * have occurred between this event and the previous event. This only applies * to AMOTION_EVENT_ACTION_MOVE events -- all other actions will have a size of 0. - * Historical samples are indexed from oldest to newest. - */ + * Historical samples are indexed from oldest to newest. */ size_t AMotionEvent_getHistorySize(const AInputEvent* motion_event); -/** - * Get the time that a historical movement occurred between this event and - * the previous event, in the java.lang.System.nanoTime() time base. - */ -int64_t AMotionEvent_getHistoricalEventTime(const AInputEvent* motion_event, +/* Get the time that a historical movement occurred between this event and + * the previous event, in the java.lang.System.nanoTime() time base. */ +int64_t AMotionEvent_getHistoricalEventTime(AInputEvent* motion_event, size_t history_index); -/** - * Get the historical raw X coordinate of this event for the given pointer index that +/* Get the historical raw X coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window * and views. * Whole numbers are pixels; the value may have a fraction for input devices - * that are sub-pixel precise. - */ + * that are sub-pixel precise. */ float AMotionEvent_getHistoricalRawX(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical raw Y coordinate of this event for the given pointer index that +/* Get the historical raw Y coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * For touch events on the screen, this is the original location of the event * on the screen, before it had been adjusted for the containing window * and views. * Whole numbers are pixels; the value may have a fraction for input devices - * that are sub-pixel precise. - */ + * that are sub-pixel precise. */ float AMotionEvent_getHistoricalRawY(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical X coordinate of this event for the given pointer index that +/* Get the historical X coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * Whole numbers are pixels; the value may have a fraction for input devices - * that are sub-pixel precise. - */ -float AMotionEvent_getHistoricalX(const AInputEvent* motion_event, size_t pointer_index, + * that are sub-pixel precise. */ +float AMotionEvent_getHistoricalX(AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical Y coordinate of this event for the given pointer index that +/* Get the historical Y coordinate of this event for the given pointer index that * occurred between this event and the previous motion event. * Whole numbers are pixels; the value may have a fraction for input devices - * that are sub-pixel precise. - */ -float AMotionEvent_getHistoricalY(const AInputEvent* motion_event, size_t pointer_index, + * that are sub-pixel precise. */ +float AMotionEvent_getHistoricalY(AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical pressure of this event for the given pointer index that +/* Get the historical pressure of this event for the given pointer index that * occurred between this event and the previous motion event. * The pressure generally ranges from 0 (no pressure at all) to 1 (normal pressure), * although values higher than 1 may be generated depending on the calibration of - * the input device. - */ -float AMotionEvent_getHistoricalPressure(const AInputEvent* motion_event, size_t pointer_index, + * the input device. */ +float AMotionEvent_getHistoricalPressure(AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the current scaled value of the approximate size for the given pointer index that +/* Get the current scaled value of the approximate size for the given pointer index that * occurred between this event and the previous motion event. * This represents some approximation of the area of the screen being * pressed; the actual value in pixels corresponding to the * touch is normalized with the device specific range of values * and scaled to a value between 0 and 1. The value of size can be used to - * determine fat touch events. - */ -float AMotionEvent_getHistoricalSize(const AInputEvent* motion_event, size_t pointer_index, + * determine fat touch events. */ +float AMotionEvent_getHistoricalSize(AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical length of the major axis of an ellipse that describes the touch area +/* Get the historical length of the major axis of an ellipse that describes the touch area * at the point of contact for the given pointer index that - * occurred between this event and the previous motion event. - */ + * occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalTouchMajor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical length of the minor axis of an ellipse that describes the touch area +/* Get the historical length of the minor axis of an ellipse that describes the touch area * at the point of contact for the given pointer index that - * occurred between this event and the previous motion event. - */ + * occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalTouchMinor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical length of the major axis of an ellipse that describes the size +/* Get the historical length of the major axis of an ellipse that describes the size * of the approaching tool for the given pointer index that * occurred between this event and the previous motion event. * The tool area represents the estimated size of the finger or pen that is - * touching the device independent of its actual touch area at the point of contact. - */ + * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getHistoricalToolMajor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical length of the minor axis of an ellipse that describes the size +/* Get the historical length of the minor axis of an ellipse that describes the size * of the approaching tool for the given pointer index that * occurred between this event and the previous motion event. * The tool area represents the estimated size of the finger or pen that is - * touching the device independent of its actual touch area at the point of contact. - */ + * touching the device independent of its actual touch area at the point of contact. */ float AMotionEvent_getHistoricalToolMinor(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical orientation of the touch area and tool area in radians clockwise from +/* Get the historical orientation of the touch area and tool area in radians clockwise from * vertical for the given pointer index that * occurred between this event and the previous motion event. * An angle of 0 degrees indicates that the major axis of contact is oriented @@ -1243,54 +781,51 @@ * indicates that the major axis of contact is oriented to the right. A negative angle * indicates that the major axis of contact is oriented to the left. * The full range is from -PI/2 radians (finger pointing fully left) to PI/2 radians - * (finger pointing fully right). - */ + * (finger pointing fully right). */ float AMotionEvent_getHistoricalOrientation(const AInputEvent* motion_event, size_t pointer_index, size_t history_index); -/** - * Get the historical value of the request axis for the given pointer index - * that occurred between this event and the previous motion event. - */ +/* Get the historical value of the request axis for the given pointer index + * that occurred between this event and the previous motion event. */ float AMotionEvent_getHistoricalAxisValue(const AInputEvent* motion_event, int32_t axis, size_t pointer_index, size_t history_index); -struct AInputQueue; -/** +/* * Input queue * * An input queue is the facility through which you retrieve input * events. */ +struct AInputQueue; typedef struct AInputQueue AInputQueue; -/** +/* * Add this input queue to a looper for processing. See * ALooper_addFd() for information on the ident, callback, and data params. */ void AInputQueue_attachLooper(AInputQueue* queue, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data); -/** +/* * Remove the input queue from the looper it is currently attached to. */ void AInputQueue_detachLooper(AInputQueue* queue); -/** +/* * Returns true if there are one or more events available in the * input queue. Returns 1 if the queue has events; 0 if * it does not have events; and a negative value if there is an error. */ int32_t AInputQueue_hasEvents(AInputQueue* queue); -/** +/* * Returns the next available event from the queue. Returns a negative * value if no events are available or an error has occurred. */ int32_t AInputQueue_getEvent(AInputQueue* queue, AInputEvent** outEvent); -/** +/* * Sends the key for standard pre-dispatching -- that is, possibly deliver * it to the current IME to be consumed before the app. Returns 0 if it * was not pre-dispatched, meaning you can process it right now. If non-zero @@ -1300,7 +835,7 @@ */ int32_t AInputQueue_preDispatchEvent(AInputQueue* queue, AInputEvent* event); -/** +/* * Report that dispatching has finished with the given event. * This must be called after receiving an event with AInputQueue_get_event(). */ @@ -1311,5 +846,3 @@ #endif #endif // _ANDROID_INPUT_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/keycodes.h android-platform-frameworks-native-21/include/android/keycodes.h --- android-platform-frameworks-native-6.0.1+r16/include/android/keycodes.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/keycodes.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,15 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Input - * @{ - */ - -/** - * @file keycodes.h - */ - #ifndef _ANDROID_KEYCODES_H #define _ANDROID_KEYCODES_H @@ -48,681 +39,230 @@ extern "C" { #endif -/** +/* * Key codes. */ enum { - /** Unknown key code. */ AKEYCODE_UNKNOWN = 0, - /** Soft Left key. - * Usually situated below the display on phones and used as a multi-function - * feature key for selecting a software defined function shown on the bottom left - * of the display. */ AKEYCODE_SOFT_LEFT = 1, - /** Soft Right key. - * Usually situated below the display on phones and used as a multi-function - * feature key for selecting a software defined function shown on the bottom right - * of the display. */ AKEYCODE_SOFT_RIGHT = 2, - /** Home key. - * This key is handled by the framework and is never delivered to applications. */ AKEYCODE_HOME = 3, - /** Back key. */ AKEYCODE_BACK = 4, - /** Call key. */ AKEYCODE_CALL = 5, - /** End Call key. */ AKEYCODE_ENDCALL = 6, - /** '0' key. */ AKEYCODE_0 = 7, - /** '1' key. */ AKEYCODE_1 = 8, - /** '2' key. */ AKEYCODE_2 = 9, - /** '3' key. */ AKEYCODE_3 = 10, - /** '4' key. */ AKEYCODE_4 = 11, - /** '5' key. */ AKEYCODE_5 = 12, - /** '6' key. */ AKEYCODE_6 = 13, - /** '7' key. */ AKEYCODE_7 = 14, - /** '8' key. */ AKEYCODE_8 = 15, - /** '9' key. */ AKEYCODE_9 = 16, - /** '*' key. */ AKEYCODE_STAR = 17, - /** '#' key. */ AKEYCODE_POUND = 18, - /** Directional Pad Up key. - * May also be synthesized from trackball motions. */ AKEYCODE_DPAD_UP = 19, - /** Directional Pad Down key. - * May also be synthesized from trackball motions. */ AKEYCODE_DPAD_DOWN = 20, - /** Directional Pad Left key. - * May also be synthesized from trackball motions. */ AKEYCODE_DPAD_LEFT = 21, - /** Directional Pad Right key. - * May also be synthesized from trackball motions. */ AKEYCODE_DPAD_RIGHT = 22, - /** Directional Pad Center key. - * May also be synthesized from trackball motions. */ AKEYCODE_DPAD_CENTER = 23, - /** Volume Up key. - * Adjusts the speaker volume up. */ AKEYCODE_VOLUME_UP = 24, - /** Volume Down key. - * Adjusts the speaker volume down. */ AKEYCODE_VOLUME_DOWN = 25, - /** Power key. */ AKEYCODE_POWER = 26, - /** Camera key. - * Used to launch a camera application or take pictures. */ AKEYCODE_CAMERA = 27, - /** Clear key. */ AKEYCODE_CLEAR = 28, - /** 'A' key. */ AKEYCODE_A = 29, - /** 'B' key. */ AKEYCODE_B = 30, - /** 'C' key. */ AKEYCODE_C = 31, - /** 'D' key. */ AKEYCODE_D = 32, - /** 'E' key. */ AKEYCODE_E = 33, - /** 'F' key. */ AKEYCODE_F = 34, - /** 'G' key. */ AKEYCODE_G = 35, - /** 'H' key. */ AKEYCODE_H = 36, - /** 'I' key. */ AKEYCODE_I = 37, - /** 'J' key. */ AKEYCODE_J = 38, - /** 'K' key. */ AKEYCODE_K = 39, - /** 'L' key. */ AKEYCODE_L = 40, - /** 'M' key. */ AKEYCODE_M = 41, - /** 'N' key. */ AKEYCODE_N = 42, - /** 'O' key. */ AKEYCODE_O = 43, - /** 'P' key. */ AKEYCODE_P = 44, - /** 'Q' key. */ AKEYCODE_Q = 45, - /** 'R' key. */ AKEYCODE_R = 46, - /** 'S' key. */ AKEYCODE_S = 47, - /** 'T' key. */ AKEYCODE_T = 48, - /** 'U' key. */ AKEYCODE_U = 49, - /** 'V' key. */ AKEYCODE_V = 50, - /** 'W' key. */ AKEYCODE_W = 51, - /** 'X' key. */ AKEYCODE_X = 52, - /** 'Y' key. */ AKEYCODE_Y = 53, - /** 'Z' key. */ AKEYCODE_Z = 54, - /** ',' key. */ AKEYCODE_COMMA = 55, - /** '.' key. */ AKEYCODE_PERIOD = 56, - /** Left Alt modifier key. */ AKEYCODE_ALT_LEFT = 57, - /** Right Alt modifier key. */ AKEYCODE_ALT_RIGHT = 58, - /** Left Shift modifier key. */ AKEYCODE_SHIFT_LEFT = 59, - /** Right Shift modifier key. */ AKEYCODE_SHIFT_RIGHT = 60, - /** Tab key. */ AKEYCODE_TAB = 61, - /** Space key. */ AKEYCODE_SPACE = 62, - /** Symbol modifier key. - * Used to enter alternate symbols. */ AKEYCODE_SYM = 63, - /** Explorer special function key. - * Used to launch a browser application. */ AKEYCODE_EXPLORER = 64, - /** Envelope special function key. - * Used to launch a mail application. */ AKEYCODE_ENVELOPE = 65, - /** Enter key. */ AKEYCODE_ENTER = 66, - /** Backspace key. - * Deletes characters before the insertion point, unlike {@link AKEYCODE_FORWARD_DEL}. */ AKEYCODE_DEL = 67, - /** '`' (backtick) key. */ AKEYCODE_GRAVE = 68, - /** '-'. */ AKEYCODE_MINUS = 69, - /** '=' key. */ AKEYCODE_EQUALS = 70, - /** '[' key. */ AKEYCODE_LEFT_BRACKET = 71, - /** ']' key. */ AKEYCODE_RIGHT_BRACKET = 72, - /** '\' key. */ AKEYCODE_BACKSLASH = 73, - /** ';' key. */ AKEYCODE_SEMICOLON = 74, - /** ''' (apostrophe) key. */ AKEYCODE_APOSTROPHE = 75, - /** '/' key. */ AKEYCODE_SLASH = 76, - /** '@' key. */ AKEYCODE_AT = 77, - /** Number modifier key. - * Used to enter numeric symbols. - * This key is not {@link AKEYCODE_NUM_LOCK}; it is more like {@link AKEYCODE_ALT_LEFT}. */ AKEYCODE_NUM = 78, - /** Headset Hook key. - * Used to hang up calls and stop media. */ AKEYCODE_HEADSETHOOK = 79, - /** Camera Focus key. - * Used to focus the camera. */ - AKEYCODE_FOCUS = 80, - /** '+' key. */ + AKEYCODE_FOCUS = 80, // *Camera* focus AKEYCODE_PLUS = 81, - /** Menu key. */ AKEYCODE_MENU = 82, - /** Notification key. */ AKEYCODE_NOTIFICATION = 83, - /** Search key. */ AKEYCODE_SEARCH = 84, - /** Play/Pause media key. */ AKEYCODE_MEDIA_PLAY_PAUSE= 85, - /** Stop media key. */ AKEYCODE_MEDIA_STOP = 86, - /** Play Next media key. */ AKEYCODE_MEDIA_NEXT = 87, - /** Play Previous media key. */ AKEYCODE_MEDIA_PREVIOUS = 88, - /** Rewind media key. */ AKEYCODE_MEDIA_REWIND = 89, - /** Fast Forward media key. */ AKEYCODE_MEDIA_FAST_FORWARD = 90, - /** Mute key. - * Mutes the microphone, unlike {@link AKEYCODE_VOLUME_MUTE}. */ AKEYCODE_MUTE = 91, - /** Page Up key. */ AKEYCODE_PAGE_UP = 92, - /** Page Down key. */ AKEYCODE_PAGE_DOWN = 93, - /** Picture Symbols modifier key. - * Used to switch symbol sets (Emoji, Kao-moji). */ AKEYCODE_PICTSYMBOLS = 94, - /** Switch Charset modifier key. - * Used to switch character sets (Kanji, Katakana). */ AKEYCODE_SWITCH_CHARSET = 95, - /** A Button key. - * On a game controller, the A button should be either the button labeled A - * or the first button on the bottom row of controller buttons. */ AKEYCODE_BUTTON_A = 96, - /** B Button key. - * On a game controller, the B button should be either the button labeled B - * or the second button on the bottom row of controller buttons. */ AKEYCODE_BUTTON_B = 97, - /** C Button key. - * On a game controller, the C button should be either the button labeled C - * or the third button on the bottom row of controller buttons. */ AKEYCODE_BUTTON_C = 98, - /** X Button key. - * On a game controller, the X button should be either the button labeled X - * or the first button on the upper row of controller buttons. */ AKEYCODE_BUTTON_X = 99, - /** Y Button key. - * On a game controller, the Y button should be either the button labeled Y - * or the second button on the upper row of controller buttons. */ AKEYCODE_BUTTON_Y = 100, - /** Z Button key. - * On a game controller, the Z button should be either the button labeled Z - * or the third button on the upper row of controller buttons. */ AKEYCODE_BUTTON_Z = 101, - /** L1 Button key. - * On a game controller, the L1 button should be either the button labeled L1 (or L) - * or the top left trigger button. */ AKEYCODE_BUTTON_L1 = 102, - /** R1 Button key. - * On a game controller, the R1 button should be either the button labeled R1 (or R) - * or the top right trigger button. */ AKEYCODE_BUTTON_R1 = 103, - /** L2 Button key. - * On a game controller, the L2 button should be either the button labeled L2 - * or the bottom left trigger button. */ AKEYCODE_BUTTON_L2 = 104, - /** R2 Button key. - * On a game controller, the R2 button should be either the button labeled R2 - * or the bottom right trigger button. */ AKEYCODE_BUTTON_R2 = 105, - /** Left Thumb Button key. - * On a game controller, the left thumb button indicates that the left (or only) - * joystick is pressed. */ AKEYCODE_BUTTON_THUMBL = 106, - /** Right Thumb Button key. - * On a game controller, the right thumb button indicates that the right - * joystick is pressed. */ AKEYCODE_BUTTON_THUMBR = 107, - /** Start Button key. - * On a game controller, the button labeled Start. */ AKEYCODE_BUTTON_START = 108, - /** Select Button key. - * On a game controller, the button labeled Select. */ AKEYCODE_BUTTON_SELECT = 109, - /** Mode Button key. - * On a game controller, the button labeled Mode. */ AKEYCODE_BUTTON_MODE = 110, - /** Escape key. */ AKEYCODE_ESCAPE = 111, - /** Forward Delete key. - * Deletes characters ahead of the insertion point, unlike {@link AKEYCODE_DEL}. */ AKEYCODE_FORWARD_DEL = 112, - /** Left Control modifier key. */ AKEYCODE_CTRL_LEFT = 113, - /** Right Control modifier key. */ AKEYCODE_CTRL_RIGHT = 114, - /** Caps Lock key. */ AKEYCODE_CAPS_LOCK = 115, - /** Scroll Lock key. */ AKEYCODE_SCROLL_LOCK = 116, - /** Left Meta modifier key. */ AKEYCODE_META_LEFT = 117, - /** Right Meta modifier key. */ AKEYCODE_META_RIGHT = 118, - /** Function modifier key. */ AKEYCODE_FUNCTION = 119, - /** System Request / Print Screen key. */ AKEYCODE_SYSRQ = 120, - /** Break / Pause key. */ AKEYCODE_BREAK = 121, - /** Home Movement key. - * Used for scrolling or moving the cursor around to the start of a line - * or to the top of a list. */ AKEYCODE_MOVE_HOME = 122, - /** End Movement key. - * Used for scrolling or moving the cursor around to the end of a line - * or to the bottom of a list. */ AKEYCODE_MOVE_END = 123, - /** Insert key. - * Toggles insert / overwrite edit mode. */ AKEYCODE_INSERT = 124, - /** Forward key. - * Navigates forward in the history stack. Complement of {@link AKEYCODE_BACK}. */ AKEYCODE_FORWARD = 125, - /** Play media key. */ AKEYCODE_MEDIA_PLAY = 126, - /** Pause media key. */ AKEYCODE_MEDIA_PAUSE = 127, - /** Close media key. - * May be used to close a CD tray, for example. */ AKEYCODE_MEDIA_CLOSE = 128, - /** Eject media key. - * May be used to eject a CD tray, for example. */ AKEYCODE_MEDIA_EJECT = 129, - /** Record media key. */ AKEYCODE_MEDIA_RECORD = 130, - /** F1 key. */ AKEYCODE_F1 = 131, - /** F2 key. */ AKEYCODE_F2 = 132, - /** F3 key. */ AKEYCODE_F3 = 133, - /** F4 key. */ AKEYCODE_F4 = 134, - /** F5 key. */ AKEYCODE_F5 = 135, - /** F6 key. */ AKEYCODE_F6 = 136, - /** F7 key. */ AKEYCODE_F7 = 137, - /** F8 key. */ AKEYCODE_F8 = 138, - /** F9 key. */ AKEYCODE_F9 = 139, - /** F10 key. */ AKEYCODE_F10 = 140, - /** F11 key. */ AKEYCODE_F11 = 141, - /** F12 key. */ AKEYCODE_F12 = 142, - /** Num Lock key. - * This is the Num Lock key; it is different from {@link AKEYCODE_NUM}. - * This key alters the behavior of other keys on the numeric keypad. */ AKEYCODE_NUM_LOCK = 143, - /** Numeric keypad '0' key. */ AKEYCODE_NUMPAD_0 = 144, - /** Numeric keypad '1' key. */ AKEYCODE_NUMPAD_1 = 145, - /** Numeric keypad '2' key. */ AKEYCODE_NUMPAD_2 = 146, - /** Numeric keypad '3' key. */ AKEYCODE_NUMPAD_3 = 147, - /** Numeric keypad '4' key. */ AKEYCODE_NUMPAD_4 = 148, - /** Numeric keypad '5' key. */ AKEYCODE_NUMPAD_5 = 149, - /** Numeric keypad '6' key. */ AKEYCODE_NUMPAD_6 = 150, - /** Numeric keypad '7' key. */ AKEYCODE_NUMPAD_7 = 151, - /** Numeric keypad '8' key. */ AKEYCODE_NUMPAD_8 = 152, - /** Numeric keypad '9' key. */ AKEYCODE_NUMPAD_9 = 153, - /** Numeric keypad '/' key (for division). */ AKEYCODE_NUMPAD_DIVIDE = 154, - /** Numeric keypad '*' key (for multiplication). */ AKEYCODE_NUMPAD_MULTIPLY = 155, - /** Numeric keypad '-' key (for subtraction). */ AKEYCODE_NUMPAD_SUBTRACT = 156, - /** Numeric keypad '+' key (for addition). */ AKEYCODE_NUMPAD_ADD = 157, - /** Numeric keypad '.' key (for decimals or digit grouping). */ AKEYCODE_NUMPAD_DOT = 158, - /** Numeric keypad ',' key (for decimals or digit grouping). */ AKEYCODE_NUMPAD_COMMA = 159, - /** Numeric keypad Enter key. */ AKEYCODE_NUMPAD_ENTER = 160, - /** Numeric keypad '=' key. */ AKEYCODE_NUMPAD_EQUALS = 161, - /** Numeric keypad '(' key. */ AKEYCODE_NUMPAD_LEFT_PAREN = 162, - /** Numeric keypad ')' key. */ AKEYCODE_NUMPAD_RIGHT_PAREN = 163, - /** Volume Mute key. - * Mutes the speaker, unlike {@link AKEYCODE_MUTE}. - * This key should normally be implemented as a toggle such that the first press - * mutes the speaker and the second press restores the original volume. */ AKEYCODE_VOLUME_MUTE = 164, - /** Info key. - * Common on TV remotes to show additional information related to what is - * currently being viewed. */ AKEYCODE_INFO = 165, - /** Channel up key. - * On TV remotes, increments the television channel. */ AKEYCODE_CHANNEL_UP = 166, - /** Channel down key. - * On TV remotes, decrements the television channel. */ AKEYCODE_CHANNEL_DOWN = 167, - /** Zoom in key. */ AKEYCODE_ZOOM_IN = 168, - /** Zoom out key. */ AKEYCODE_ZOOM_OUT = 169, - /** TV key. - * On TV remotes, switches to viewing live TV. */ AKEYCODE_TV = 170, - /** Window key. - * On TV remotes, toggles picture-in-picture mode or other windowing functions. */ AKEYCODE_WINDOW = 171, - /** Guide key. - * On TV remotes, shows a programming guide. */ AKEYCODE_GUIDE = 172, - /** DVR key. - * On some TV remotes, switches to a DVR mode for recorded shows. */ AKEYCODE_DVR = 173, - /** Bookmark key. - * On some TV remotes, bookmarks content or web pages. */ AKEYCODE_BOOKMARK = 174, - /** Toggle captions key. - * Switches the mode for closed-captioning text, for example during television shows. */ AKEYCODE_CAPTIONS = 175, - /** Settings key. - * Starts the system settings activity. */ AKEYCODE_SETTINGS = 176, - /** TV power key. - * On TV remotes, toggles the power on a television screen. */ AKEYCODE_TV_POWER = 177, - /** TV input key. - * On TV remotes, switches the input on a television screen. */ AKEYCODE_TV_INPUT = 178, - /** Set-top-box power key. - * On TV remotes, toggles the power on an external Set-top-box. */ AKEYCODE_STB_POWER = 179, - /** Set-top-box input key. - * On TV remotes, switches the input mode on an external Set-top-box. */ AKEYCODE_STB_INPUT = 180, - /** A/V Receiver power key. - * On TV remotes, toggles the power on an external A/V Receiver. */ AKEYCODE_AVR_POWER = 181, - /** A/V Receiver input key. - * On TV remotes, switches the input mode on an external A/V Receiver. */ AKEYCODE_AVR_INPUT = 182, - /** Red "programmable" key. - * On TV remotes, acts as a contextual/programmable key. */ AKEYCODE_PROG_RED = 183, - /** Green "programmable" key. - * On TV remotes, actsas a contextual/programmable key. */ AKEYCODE_PROG_GREEN = 184, - /** Yellow "programmable" key. - * On TV remotes, acts as a contextual/programmable key. */ AKEYCODE_PROG_YELLOW = 185, - /** Blue "programmable" key. - * On TV remotes, acts as a contextual/programmable key. */ AKEYCODE_PROG_BLUE = 186, - /** App switch key. - * Should bring up the application switcher dialog. */ AKEYCODE_APP_SWITCH = 187, - /** Generic Game Pad Button #1.*/ AKEYCODE_BUTTON_1 = 188, - /** Generic Game Pad Button #2.*/ AKEYCODE_BUTTON_2 = 189, - /** Generic Game Pad Button #3.*/ AKEYCODE_BUTTON_3 = 190, - /** Generic Game Pad Button #4.*/ AKEYCODE_BUTTON_4 = 191, - /** Generic Game Pad Button #5.*/ AKEYCODE_BUTTON_5 = 192, - /** Generic Game Pad Button #6.*/ AKEYCODE_BUTTON_6 = 193, - /** Generic Game Pad Button #7.*/ AKEYCODE_BUTTON_7 = 194, - /** Generic Game Pad Button #8.*/ AKEYCODE_BUTTON_8 = 195, - /** Generic Game Pad Button #9.*/ AKEYCODE_BUTTON_9 = 196, - /** Generic Game Pad Button #10.*/ AKEYCODE_BUTTON_10 = 197, - /** Generic Game Pad Button #11.*/ AKEYCODE_BUTTON_11 = 198, - /** Generic Game Pad Button #12.*/ AKEYCODE_BUTTON_12 = 199, - /** Generic Game Pad Button #13.*/ AKEYCODE_BUTTON_13 = 200, - /** Generic Game Pad Button #14.*/ AKEYCODE_BUTTON_14 = 201, - /** Generic Game Pad Button #15.*/ AKEYCODE_BUTTON_15 = 202, - /** Generic Game Pad Button #16.*/ AKEYCODE_BUTTON_16 = 203, - /** Language Switch key. - * Toggles the current input language such as switching between English and Japanese on - * a QWERTY keyboard. On some devices, the same function may be performed by - * pressing Shift+Spacebar. */ AKEYCODE_LANGUAGE_SWITCH = 204, - /** Manner Mode key. - * Toggles silent or vibrate mode on and off to make the device behave more politely - * in certain settings such as on a crowded train. On some devices, the key may only - * operate when long-pressed. */ AKEYCODE_MANNER_MODE = 205, - /** 3D Mode key. - * Toggles the display between 2D and 3D mode. */ AKEYCODE_3D_MODE = 206, - /** Contacts special function key. - * Used to launch an address book application. */ AKEYCODE_CONTACTS = 207, - /** Calendar special function key. - * Used to launch a calendar application. */ AKEYCODE_CALENDAR = 208, - /** Music special function key. - * Used to launch a music player application. */ AKEYCODE_MUSIC = 209, - /** Calculator special function key. - * Used to launch a calculator application. */ AKEYCODE_CALCULATOR = 210, - /** Japanese full-width / half-width key. */ AKEYCODE_ZENKAKU_HANKAKU = 211, - /** Japanese alphanumeric key. */ AKEYCODE_EISU = 212, - /** Japanese non-conversion key. */ AKEYCODE_MUHENKAN = 213, - /** Japanese conversion key. */ AKEYCODE_HENKAN = 214, - /** Japanese katakana / hiragana key. */ AKEYCODE_KATAKANA_HIRAGANA = 215, - /** Japanese Yen key. */ AKEYCODE_YEN = 216, - /** Japanese Ro key. */ AKEYCODE_RO = 217, - /** Japanese kana key. */ AKEYCODE_KANA = 218, - /** Assist key. - * Launches the global assist activity. Not delivered to applications. */ AKEYCODE_ASSIST = 219, - /** Brightness Down key. - * Adjusts the screen brightness down. */ - AKEYCODE_BRIGHTNESS_DOWN = 220, - /** Brightness Up key. - * Adjusts the screen brightness up. */ - AKEYCODE_BRIGHTNESS_UP = 221, - /** Audio Track key. - * Switches the audio tracks. */ - AKEYCODE_MEDIA_AUDIO_TRACK = 222, - /** Sleep key. - * Puts the device to sleep. Behaves somewhat like {@link AKEYCODE_POWER} but it - * has no effect if the device is already asleep. */ - AKEYCODE_SLEEP = 223, - /** Wakeup key. - * Wakes up the device. Behaves somewhat like {@link AKEYCODE_POWER} but it - * has no effect if the device is already awake. */ - AKEYCODE_WAKEUP = 224, - /** Pairing key. - * Initiates peripheral pairing mode. Useful for pairing remote control - * devices or game controllers, especially if no other input mode is - * available. */ - AKEYCODE_PAIRING = 225, - /** Media Top Menu key. - * Goes to the top of media menu. */ - AKEYCODE_MEDIA_TOP_MENU = 226, - /** '11' key. */ - AKEYCODE_11 = 227, - /** '12' key. */ - AKEYCODE_12 = 228, - /** Last Channel key. - * Goes to the last viewed channel. */ - AKEYCODE_LAST_CHANNEL = 229, - /** TV data service key. - * Displays data services like weather, sports. */ - AKEYCODE_TV_DATA_SERVICE = 230, - /** Voice Assist key. - * Launches the global voice assist activity. Not delivered to applications. */ - AKEYCODE_VOICE_ASSIST = 231, - /** Radio key. - * Toggles TV service / Radio service. */ - AKEYCODE_TV_RADIO_SERVICE = 232, - /** Teletext key. - * Displays Teletext service. */ - AKEYCODE_TV_TELETEXT = 233, - /** Number entry key. - * Initiates to enter multi-digit channel nubmber when each digit key is assigned - * for selecting separate channel. Corresponds to Number Entry Mode (0x1D) of CEC - * User Control Code. */ - AKEYCODE_TV_NUMBER_ENTRY = 234, - /** Analog Terrestrial key. - * Switches to analog terrestrial broadcast service. */ - AKEYCODE_TV_TERRESTRIAL_ANALOG = 235, - /** Digital Terrestrial key. - * Switches to digital terrestrial broadcast service. */ - AKEYCODE_TV_TERRESTRIAL_DIGITAL = 236, - /** Satellite key. - * Switches to digital satellite broadcast service. */ - AKEYCODE_TV_SATELLITE = 237, - /** BS key. - * Switches to BS digital satellite broadcasting service available in Japan. */ - AKEYCODE_TV_SATELLITE_BS = 238, - /** CS key. - * Switches to CS digital satellite broadcasting service available in Japan. */ - AKEYCODE_TV_SATELLITE_CS = 239, - /** BS/CS key. - * Toggles between BS and CS digital satellite services. */ - AKEYCODE_TV_SATELLITE_SERVICE = 240, - /** Toggle Network key. - * Toggles selecting broacast services. */ - AKEYCODE_TV_NETWORK = 241, - /** Antenna/Cable key. - * Toggles broadcast input source between antenna and cable. */ - AKEYCODE_TV_ANTENNA_CABLE = 242, - /** HDMI #1 key. - * Switches to HDMI input #1. */ - AKEYCODE_TV_INPUT_HDMI_1 = 243, - /** HDMI #2 key. - * Switches to HDMI input #2. */ - AKEYCODE_TV_INPUT_HDMI_2 = 244, - /** HDMI #3 key. - * Switches to HDMI input #3. */ - AKEYCODE_TV_INPUT_HDMI_3 = 245, - /** HDMI #4 key. - * Switches to HDMI input #4. */ - AKEYCODE_TV_INPUT_HDMI_4 = 246, - /** Composite #1 key. - * Switches to composite video input #1. */ - AKEYCODE_TV_INPUT_COMPOSITE_1 = 247, - /** Composite #2 key. - * Switches to composite video input #2. */ - AKEYCODE_TV_INPUT_COMPOSITE_2 = 248, - /** Component #1 key. - * Switches to component video input #1. */ - AKEYCODE_TV_INPUT_COMPONENT_1 = 249, - /** Component #2 key. - * Switches to component video input #2. */ - AKEYCODE_TV_INPUT_COMPONENT_2 = 250, - /** VGA #1 key. - * Switches to VGA (analog RGB) input #1. */ - AKEYCODE_TV_INPUT_VGA_1 = 251, - /** Audio description key. - * Toggles audio description off / on. */ - AKEYCODE_TV_AUDIO_DESCRIPTION = 252, - /** Audio description mixing volume up key. - * Louden audio description volume as compared with normal audio volume. */ - AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_UP = 253, - /** Audio description mixing volume down key. - * Lessen audio description volume as compared with normal audio volume. */ - AKEYCODE_TV_AUDIO_DESCRIPTION_MIX_DOWN = 254, - /** Zoom mode key. - * Changes Zoom mode (Normal, Full, Zoom, Wide-zoom, etc.) */ - AKEYCODE_TV_ZOOM_MODE = 255, - /** Contents menu key. - * Goes to the title list. Corresponds to Contents Menu (0x0B) of CEC User Control - * Code */ - AKEYCODE_TV_CONTENTS_MENU = 256, - /** Media context menu key. - * Goes to the context menu of media contents. Corresponds to Media Context-sensitive - * Menu (0x11) of CEC User Control Code. */ - AKEYCODE_TV_MEDIA_CONTEXT_MENU = 257, - /** Timer programming key. - * Goes to the timer recording menu. Corresponds to Timer Programming (0x54) of - * CEC User Control Code. */ - AKEYCODE_TV_TIMER_PROGRAMMING = 258, - /** Help key. */ - AKEYCODE_HELP = 259, - AKEYCODE_NAVIGATE_PREVIOUS = 260, - AKEYCODE_NAVIGATE_NEXT = 261, - AKEYCODE_NAVIGATE_IN = 262, - AKEYCODE_NAVIGATE_OUT = 263 // NOTE: If you add a new keycode here you must also add it to several other files. // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. @@ -733,5 +273,3 @@ #endif #endif // _ANDROID_KEYCODES_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/looper.h android-platform-frameworks-native-21/include/android/looper.h --- android-platform-frameworks-native-6.0.1+r16/include/android/looper.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/looper.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Looper - * @{ - */ - -/** - * @file looper.h - */ #ifndef ANDROID_LOOPER_H #define ANDROID_LOOPER_H @@ -30,7 +22,6 @@ extern "C" { #endif -struct ALooper; /** * ALooper * @@ -44,6 +35,7 @@ * * A thread can have only one ALooper associated with it. */ +struct ALooper; typedef struct ALooper ALooper; /** @@ -52,14 +44,13 @@ */ ALooper* ALooper_forThread(); -/** Option for for ALooper_prepare(). */ enum { /** - * This looper will accept calls to ALooper_addFd() that do not - * have a callback (that is provide NULL for the callback). In - * this case the caller of ALooper_pollOnce() or ALooper_pollAll() - * MUST check the return from these functions to discover when - * data is available on such fds and process it. + * Option for ALooper_prepare: this looper will accept calls to + * ALooper_addFd() that do not have a callback (that is provide NULL + * for the callback). In this case the caller of ALooper_pollOnce() + * or ALooper_pollAll() MUST check the return from these functions to + * discover when data is available on such fds and process it. */ ALOOPER_PREPARE_ALLOW_NON_CALLBACKS = 1<<0 }; @@ -73,9 +64,9 @@ */ ALooper* ALooper_prepare(int opts); -/** Result from ALooper_pollOnce() and ALooper_pollAll(). */ enum { /** + * Result from ALooper_pollOnce() and ALooper_pollAll(): * The poll was awoken using wake() before the timeout expired * and no callbacks were executed and no other file descriptors were ready. */ @@ -185,12 +176,10 @@ * * Returns ALOOPER_POLL_ERROR if an error occurred. * - * Returns a value >= 0 containing an identifier (the same identifier - * `ident` passed to ALooper_addFd()) if its file descriptor has data - * and it has no callback function (requiring the caller here to - * handle it). In this (and only this) case outFd, outEvents and - * outData will contain the poll events and data associated with the - * fd, otherwise they will be set to NULL. + * Returns a value >= 0 containing an identifier if its file descriptor has data + * and it has no callback function (requiring the caller here to handle it). + * In this (and only this) case outFd, outEvents and outData will contain the poll + * events and data associated with the fd, otherwise they will be set to NULL. * * This method does not return until it has finished invoking the appropriate callbacks * for all file descriptors that were signalled. @@ -264,6 +253,4 @@ }; #endif -#endif // ANDROID_LOOPER_H - -/** @} */ +#endif // ANDROID_NATIVE_WINDOW_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/multinetwork.h android-platform-frameworks-native-21/include/android/multinetwork.h --- android-platform-frameworks-native-6.0.1+r16/include/android/multinetwork.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/multinetwork.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -#ifndef ANDROID_MULTINETWORK_H -#define ANDROID_MULTINETWORK_H - -#include -#include -#include - -__BEGIN_DECLS - -/** - * The corresponding C type for android.net.Network#getNetworkHandle() return - * values. The Java signed long value can be safely cast to a net_handle_t: - * - * [C] ((net_handle_t) java_long_network_handle) - * [C++] static_cast(java_long_network_handle) - * - * as appropriate. - */ -typedef uint64_t net_handle_t; - -/** - * The value NETWORK_UNSPECIFIED indicates no specific network. - * - * For some functions (documented below), a previous binding may be cleared - * by an invocation with NETWORK_UNSPECIFIED. - * - * Depending on the context it may indicate an error. It is expressly - * not used to indicate some notion of the "current default network". - */ -#define NETWORK_UNSPECIFIED ((net_handle_t)0) - - -/** - * All functions below that return an int return 0 on success or -1 - * on failure with an appropriate errno value set. - */ - - -/** - * Set the network to be used by the given socket file descriptor. - * - * To clear a previous socket binding invoke with NETWORK_UNSPECIFIED. - * - * This is the equivalent of: - * - * [ android.net.Network#bindSocket() ] - * https://developer.android.com/reference/android/net/Network.html#bindSocket(java.net.Socket) - */ -int android_setsocknetwork(net_handle_t network, int fd); - - -/** - * Binds the current process to |network|. All sockets created in the future - * (and not explicitly bound via android_setsocknetwork()) will be bound to - * |network|. All host name resolutions will be limited to |network| as well. - * Note that if the network identified by |network| ever disconnects, all - * sockets created in this way will cease to work and all host name - * resolutions will fail. This is by design so an application doesn't - * accidentally use sockets it thinks are still bound to a particular network. - * - * To clear a previous process binding invoke with NETWORK_UNSPECIFIED. - * - * This is the equivalent of: - * - * [ android.net.ConnectivityManager#setProcessDefaultNetwork() ] - * https://developer.android.com/reference/android/net/ConnectivityManager.html#setProcessDefaultNetwork(android.net.Network) - */ -int android_setprocnetwork(net_handle_t network); - - -/** - * Perform hostname resolution via the DNS servers associated with |network|. - * - * All arguments (apart from |network|) are used identically as those passed - * to getaddrinfo(3). Return and error values are identical to those of - * getaddrinfo(3), and in particular gai_strerror(3) can be used as expected. - * Similar to getaddrinfo(3): - * - |hints| may be NULL (in which case man page documented defaults apply) - * - either |node| or |service| may be NULL, but not both - * - |res| must not be NULL - * - * This is the equivalent of: - * - * [ android.net.Network#getAllByName() ] - * https://developer.android.com/reference/android/net/Network.html#getAllByName(java.lang.String) - */ -int android_getaddrinfofornetwork(net_handle_t network, - const char *node, const char *service, - const struct addrinfo *hints, struct addrinfo **res); - -__END_DECLS - -#endif // ANDROID_MULTINETWORK_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/native_activity.h android-platform-frameworks-native-21/include/android/native_activity.h --- android-platform-frameworks-native-6.0.1+r16/include/android/native_activity.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/native_activity.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup NativeActivity Native Activity - * @{ - */ - -/** - * @file native_activity.h - */ #ifndef ANDROID_NATIVE_ACTIVITY_H #define ANDROID_NATIVE_ACTIVITY_H @@ -39,9 +31,6 @@ extern "C" { #endif -/** - * {@link ANativeActivityCallbacks} - */ struct ANativeActivityCallbacks; /** @@ -86,17 +75,17 @@ * Path to this application's internal data directory. */ const char* internalDataPath; - + /** * Path to this application's external (removable/mountable) data directory. */ const char* externalDataPath; - + /** * The platform's SDK version code. */ int32_t sdkVersion; - + /** * This is the native instance of the application. It is not used by * the framework, but can be set by the application to its own instance @@ -130,13 +119,13 @@ * for more information. */ void (*onStart)(ANativeActivity* activity); - + /** * NativeActivity has resumed. See Java documentation for Activity.onResume() * for more information. */ void (*onResume)(ANativeActivity* activity); - + /** * Framework is asking NativeActivity to save its current instance state. * See Java documentation for Activity.onSaveInstanceState() for more @@ -147,19 +136,19 @@ * entities (pointers to memory, file descriptors, etc). */ void* (*onSaveInstanceState)(ANativeActivity* activity, size_t* outSize); - + /** * NativeActivity has paused. See Java documentation for Activity.onPause() * for more information. */ void (*onPause)(ANativeActivity* activity); - + /** * NativeActivity has stopped. See Java documentation for Activity.onStop() * for more information. */ void (*onStop)(ANativeActivity* activity); - + /** * NativeActivity is being destroyed. See Java documentation for Activity.onDestroy() * for more information. @@ -171,7 +160,7 @@ * for example, to pause a game when it loses input focus. */ void (*onWindowFocusChanged)(ANativeActivity* activity, int hasFocus); - + /** * The drawing window for this native activity has been created. You * can use the given native window object to start drawing. @@ -202,13 +191,13 @@ * returning from here. */ void (*onNativeWindowDestroyed)(ANativeActivity* activity, ANativeWindow* window); - + /** * The input queue for this native activity's window has been created. * You can use the given input queue to start retrieving input events. */ void (*onInputQueueCreated)(ANativeActivity* activity, AInputQueue* queue); - + /** * The input queue for this native activity's window is being destroyed. * You should no longer try to reference this object upon returning from this @@ -284,17 +273,7 @@ * API for documentation. */ enum { - /** - * Implicit request to show the input window, not as the result - * of a direct request by the user. - */ ANATIVEACTIVITY_SHOW_SOFT_INPUT_IMPLICIT = 0x0001, - - /** - * The user has forced the input method open (such as by - * long-pressing menu) so it should not be closed until they - * explicitly do so. - */ ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED = 0x0002, }; @@ -311,15 +290,7 @@ * API for documentation. */ enum { - /** - * The soft input window should only be hidden if it was not - * explicitly shown by the user. - */ ANATIVEACTIVITY_HIDE_SOFT_INPUT_IMPLICIT_ONLY = 0x0001, - /** - * The soft input window should normally be hidden, unless it was - * originally shown with {@link ANATIVEACTIVITY_SHOW_SOFT_INPUT_FORCED}. - */ ANATIVEACTIVITY_HIDE_SOFT_INPUT_NOT_ALWAYS = 0x0002, }; @@ -337,4 +308,3 @@ #endif // ANDROID_NATIVE_ACTIVITY_H -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/native_window.h android-platform-frameworks-native-21/include/android/native_window.h --- android-platform-frameworks-native-6.0.1+r16/include/android/native_window.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/native_window.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,15 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup NativeActivity Native Activity - * @{ - */ - -/** - * @file native_window.h - */ - #ifndef ANDROID_NATIVE_WINDOW_H #define ANDROID_NATIVE_WINDOW_H @@ -32,31 +23,18 @@ extern "C" { #endif -/** +/* * Pixel formats that a window can use. */ enum { - /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Alpha: 8 bits. **/ WINDOW_FORMAT_RGBA_8888 = 1, - /** Red: 8 bits, Green: 8 bits, Blue: 8 bits, Unused: 8 bits. **/ WINDOW_FORMAT_RGBX_8888 = 2, - /** Red: 5 bits, Green: 6 bits, Blue: 5 bits. **/ WINDOW_FORMAT_RGB_565 = 4, }; struct ANativeWindow; -/** - * {@link ANativeWindow} is opaque type that provides access to a native window. - * - * A pointer can be obtained using ANativeWindow_fromSurface(). - */ typedef struct ANativeWindow ANativeWindow; -/** - * {@link ANativeWindow} is a struct that represents a windows buffer. - * - * A pointer can be obtained using ANativeWindow_lock(). - */ typedef struct ANativeWindow_Buffer { // The number of pixels that are show horizontally. int32_t width; @@ -73,7 +51,7 @@ // The actual bits. void* bits; - + // Do not touch. uint32_t reserved[6]; } ANativeWindow_Buffer; @@ -89,25 +67,25 @@ */ void ANativeWindow_release(ANativeWindow* window); -/** +/* * Return the current width in pixels of the window surface. Returns a * negative value on error. */ int32_t ANativeWindow_getWidth(ANativeWindow* window); -/** +/* * Return the current height in pixels of the window surface. Returns a * negative value on error. */ int32_t ANativeWindow_getHeight(ANativeWindow* window); -/** +/* * Return the current pixel format of the window surface. Returns a * negative value on error. */ int32_t ANativeWindow_getFormat(ANativeWindow* window); -/** +/* * Change the format and size of the window buffers. * * The width and height control the number of pixels in the buffers, not the @@ -146,5 +124,3 @@ #endif #endif // ANDROID_NATIVE_WINDOW_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/native_window_jni.h android-platform-frameworks-native-21/include/android/native_window_jni.h --- android-platform-frameworks-native-6.0.1+r16/include/android/native_window_jni.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/native_window_jni.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,15 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup NativeActivity Native Activity - * @{ - */ - -/** - * @file native_window_jni.h - */ - #ifndef ANDROID_NATIVE_WINDOW_JNI_H #define ANDROID_NATIVE_WINDOW_JNI_H @@ -47,5 +38,3 @@ #endif #endif // ANDROID_NATIVE_WINDOW_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/obb.h android-platform-frameworks-native-21/include/android/obb.h --- android-platform-frameworks-native-6.0.1+r16/include/android/obb.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/obb.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Storage - * @{ - */ - -/** - * @file obb.h - */ #ifndef ANDROID_OBB_H #define ANDROID_OBB_H @@ -33,12 +25,9 @@ #endif struct AObbInfo; -/** {@link AObbInfo} is an opaque type representing information for obb storage. */ typedef struct AObbInfo AObbInfo; -/** Flag for an obb file, returned by AObbInfo_getFlags(). */ enum { - /** overlay */ AOBBINFO_OVERLAY = 0x0001, }; @@ -72,5 +61,3 @@ #endif #endif // ANDROID_OBB_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/rect.h android-platform-frameworks-native-21/include/android/rect.h --- android-platform-frameworks-native-6.0.1+r16/include/android/rect.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/rect.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup NativeActivity Native Activity - * @{ - */ - -/** - * @file rect.h - */ #ifndef ANDROID_RECT_H #define ANDROID_RECT_H @@ -32,24 +24,13 @@ extern "C" { #endif -/** - * {@link ARect} is a struct that represents a rectangular window area. - * - * It is used with {@link - * ANativeActivityCallbacks::onContentRectChanged} event callback and - * ANativeWindow_lock() function. - */ typedef struct ARect { #ifdef __cplusplus typedef int32_t value_type; #endif - /** left position */ int32_t left; - /** top position */ int32_t top; - /** left position */ int32_t right; - /** bottom position */ int32_t bottom; } ARect; @@ -58,5 +39,3 @@ #endif #endif // ANDROID_RECT_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/sensor.h android-platform-frameworks-native-21/include/android/sensor.h --- android-platform-frameworks-native-6.0.1+r16/include/android/sensor.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/sensor.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Sensor - * @{ - */ - -/** - * @file sensor.h - */ #ifndef ANDROID_SENSOR_H #define ANDROID_SENSOR_H @@ -42,7 +34,7 @@ * - DO NOT CHANGE THE LAYOUT OR SIZE OF STRUCTURES */ -/** +/* * Structures and functions to receive and process sensor events in * native code. * @@ -57,97 +49,41 @@ #endif -/** - * Sensor types. +/* + * Sensor types * (keep in sync with hardware/sensor.h) */ + enum { - /** - * {@link ASENSOR_TYPE_ACCELEROMETER} - * reporting-mode: continuous - * - * All values are in SI units (m/s^2) and measure the acceleration of the - * device minus the force of gravity. - */ ASENSOR_TYPE_ACCELEROMETER = 1, - /** - * {@link ASENSOR_TYPE_MAGNETIC_FIELD} - * reporting-mode: continuous - * - * All values are in micro-Tesla (uT) and measure the geomagnetic - * field in the X, Y and Z axis. - */ ASENSOR_TYPE_MAGNETIC_FIELD = 2, - /** - * {@link ASENSOR_TYPE_GYROSCOPE} - * reporting-mode: continuous - * - * All values are in radians/second and measure the rate of rotation - * around the X, Y and Z axis. - */ ASENSOR_TYPE_GYROSCOPE = 4, - /** - * {@link ASENSOR_TYPE_LIGHT} - * reporting-mode: on-change - * - * The light sensor value is returned in SI lux units. - */ ASENSOR_TYPE_LIGHT = 5, - /** - * {@link ASENSOR_TYPE_PROXIMITY} - * reporting-mode: on-change - * - * The proximity sensor which turns the screen off and back on during calls is the - * wake-up proximity sensor. Implement wake-up proximity sensor before implementing - * a non wake-up proximity sensor. For the wake-up proximity sensor set the flag - * SENSOR_FLAG_WAKE_UP. - * The value corresponds to the distance to the nearest object in centimeters. - */ ASENSOR_TYPE_PROXIMITY = 8 }; -/** - * Sensor accuracy measure. +/* + * Sensor accuracy measure */ enum { - /** no contact */ - ASENSOR_STATUS_NO_CONTACT = -1, - /** unreliable */ ASENSOR_STATUS_UNRELIABLE = 0, - /** low accuracy */ ASENSOR_STATUS_ACCURACY_LOW = 1, - /** medium accuracy */ ASENSOR_STATUS_ACCURACY_MEDIUM = 2, - /** high accuracy */ ASENSOR_STATUS_ACCURACY_HIGH = 3 }; -/** - * Sensor Reporting Modes. - */ -enum { - /** continuous reporting */ - AREPORTING_MODE_CONTINUOUS = 0, - /** reporting on change */ - AREPORTING_MODE_ON_CHANGE = 1, - /** on shot reporting */ - AREPORTING_MODE_ONE_SHOT = 2, - /** special trigger reporting */ - AREPORTING_MODE_SPECIAL_TRIGGER = 3 -}; - /* * A few useful constants */ -/** Earth's gravity in m/s^2 */ +/* Earth's gravity in m/s^2 */ #define ASENSOR_STANDARD_GRAVITY (9.80665f) -/** Maximum magnetic field on Earth's surface in uT */ +/* Maximum magnetic field on Earth's surface in uT */ #define ASENSOR_MAGNETIC_FIELD_EARTH_MAX (60.0f) -/** Minimum magnetic field on Earth's surface in uT*/ +/* Minimum magnetic field on Earth's surface in uT*/ #define ASENSOR_MAGNETIC_FIELD_EARTH_MIN (30.0f) -/** +/* * A sensor event. */ @@ -170,35 +106,6 @@ uint8_t reserved[3]; } ASensorVector; -typedef struct AMetaDataEvent { - int32_t what; - int32_t sensor; -} AMetaDataEvent; - -typedef struct AUncalibratedEvent { - union { - float uncalib[3]; - struct { - float x_uncalib; - float y_uncalib; - float z_uncalib; - }; - }; - union { - float bias[3]; - struct { - float x_bias; - float y_bias; - float z_bias; - }; - }; -} AUncalibratedEvent; - -typedef struct AHeartRateEvent { - float bpm; - int8_t status; -} AHeartRateEvent; - /* NOTE: Must match hardware/sensors.h */ typedef struct ASensorEvent { int32_t version; /* sizeof(struct ASensorEvent) */ @@ -207,160 +114,61 @@ int32_t reserved0; int64_t timestamp; union { - union { - float data[16]; - ASensorVector vector; - ASensorVector acceleration; - ASensorVector magnetic; - float temperature; - float distance; - float light; - float pressure; - float relative_humidity; - AUncalibratedEvent uncalibrated_gyro; - AUncalibratedEvent uncalibrated_magnetic; - AMetaDataEvent meta_data; - AHeartRateEvent heart_rate; - }; - union { - uint64_t data[8]; - uint64_t step_counter; - } u64; + float data[16]; + ASensorVector vector; + ASensorVector acceleration; + ASensorVector magnetic; + float temperature; + float distance; + float light; + float pressure; }; - - uint32_t flags; - int32_t reserved1[3]; + int32_t reserved1[4]; } ASensorEvent; + struct ASensorManager; -/** - * {@link ASensorManager} is an opaque type to manage sensors and - * events queues. - * - * {@link ASensorManager} is a singleton that can be obtained using - * ASensorManager_getInstance(). - * - * This file provides a set of functions that uses {@link - * ASensorManager} to access and list hardware sensors, and - * create and destroy event queues: - * - ASensorManager_getSensorList() - * - ASensorManager_getDefaultSensor() - * - ASensorManager_getDefaultSensorEx() - * - ASensorManager_createEventQueue() - * - ASensorManager_destroyEventQueue() - */ typedef struct ASensorManager ASensorManager; - struct ASensorEventQueue; -/** - * {@link ASensorEventQueue} is an opaque type that provides access to - * {@link ASensorEvent} from hardware sensors. - * - * A new {@link ASensorEventQueue} can be obtained using ASensorManager_createEventQueue(). - * - * This file provides a set of functions to enable and disable - * sensors, check and get events, and set event rates on a {@link - * ASensorEventQueue}. - * - ASensorEventQueue_enableSensor() - * - ASensorEventQueue_disableSensor() - * - ASensorEventQueue_hasEvents() - * - ASensorEventQueue_getEvents() - * - ASensorEventQueue_setEventRate() - */ typedef struct ASensorEventQueue ASensorEventQueue; struct ASensor; -/** - * {@link ASensor} is an opaque type that provides information about - * an hardware sensors. - * - * A {@link ASensor} pointer can be obtained using - * ASensorManager_getDefaultSensor(), - * ASensorManager_getDefaultSensorEx() or from a {@link ASensorList}. - * - * This file provides a set of functions to access properties of a - * {@link ASensor}: - * - ASensor_getName() - * - ASensor_getVendor() - * - ASensor_getType() - * - ASensor_getResolution() - * - ASensor_getMinDelay() - * - ASensor_getFifoMaxEventCount() - * - ASensor_getFifoReservedEventCount() - * - ASensor_getStringType() - * - ASensor_getReportingMode() - * - ASensor_isWakeUpSensor() - */ typedef struct ASensor ASensor; -/** - * {@link ASensorRef} is a type for constant pointers to {@link ASensor}. - * - * This is used to define entry in {@link ASensorList} arrays. - */ typedef ASensor const* ASensorRef; -/** - * {@link ASensorList} is an array of reference to {@link ASensor}. - * - * A {@link ASensorList} can be initialized using ASensorManager_getSensorList(). - */ typedef ASensorRef const* ASensorList; /*****************************************************************************/ -/** - * Get a reference to the sensor manager. ASensorManager is a singleton - * per package as different packages may have access to different sensors. - * - * Deprecated: Use ASensorManager_getInstanceForPackage(const char*) instead. +/* + * Get a reference to the sensor manager. ASensorManager is a singleton. * * Example: * * ASensorManager* sensorManager = ASensorManager_getInstance(); * */ -__attribute__ ((deprecated)) ASensorManager* ASensorManager_getInstance(); +ASensorManager* ASensorManager_getInstance(); -/* - * Get a reference to the sensor manager. ASensorManager is a singleton - * per package as different packages may have access to different sensors. - * - * Example: - * - * ASensorManager* sensorManager = ASensorManager_getInstanceForPackage("foo.bar.baz"); - * - */ -ASensorManager* ASensorManager_getInstanceForPackage(const char* packageName); -/** +/* * Returns the list of available sensors. */ int ASensorManager_getSensorList(ASensorManager* manager, ASensorList* list); -/** +/* * Returns the default sensor for the given type, or NULL if no sensor - * of that type exists. + * of that type exist. */ ASensor const* ASensorManager_getDefaultSensor(ASensorManager* manager, int type); -/** - * Returns the default sensor with the given type and wakeUp properties or NULL if no sensor - * of this type and wakeUp properties exists. - */ -ASensor const* ASensorManager_getDefaultSensorEx(ASensorManager* manager, int type, - bool wakeUp); - -/** +/* * Creates a new sensor event queue and associate it with a looper. - * - * "ident" is a identifier for the events that will be returned when - * calling ALooper_pollOnce(). The identifier must be >= 0, or - * ALOOPER_POLL_CALLBACK if providing a non-NULL callback. */ ASensorEventQueue* ASensorManager_createEventQueue(ASensorManager* manager, ALooper* looper, int ident, ALooper_callbackFunc callback, void* data); -/** +/* * Destroys the event queue and free all resources associated to it. */ int ASensorManager_destroyEventQueue(ASensorManager* manager, ASensorEventQueue* queue); @@ -368,17 +176,17 @@ /*****************************************************************************/ -/** +/* * Enable the selected sensor. Returns a negative error code on failure. */ int ASensorEventQueue_enableSensor(ASensorEventQueue* queue, ASensor const* sensor); -/** +/* * Disable the selected sensor. Returns a negative error code on failure. */ int ASensorEventQueue_disableSensor(ASensorEventQueue* queue, ASensor const* sensor); -/** +/* * Sets the delivery rate of events in microseconds for the given sensor. * Note that this is a hint only, generally event will arrive at a higher * rate. It is an error to set a rate inferior to the value returned by @@ -387,14 +195,14 @@ */ int ASensorEventQueue_setEventRate(ASensorEventQueue* queue, ASensor const* sensor, int32_t usec); -/** +/* * Returns true if there are one or more events available in the * sensor queue. Returns 1 if the queue has events; 0 if * it does not have events; and a negative value if there is an error. */ int ASensorEventQueue_hasEvents(ASensorEventQueue* queue); -/** +/* * Returns the next available events from the queue. Returns a negative * value if no events are available or an error has occurred, otherwise * the number of events returned. @@ -413,63 +221,36 @@ /*****************************************************************************/ -/** +/* * Returns this sensor's name (non localized) */ const char* ASensor_getName(ASensor const* sensor); -/** +/* * Returns this sensor's vendor's name (non localized) */ const char* ASensor_getVendor(ASensor const* sensor); -/** +/* * Return this sensor's type */ int ASensor_getType(ASensor const* sensor); -/** +/* * Returns this sensors's resolution */ float ASensor_getResolution(ASensor const* sensor); -/** +/* * Returns the minimum delay allowed between events in microseconds. * A value of zero means that this sensor doesn't report events at a * constant rate, but rather only when a new data is available. */ int ASensor_getMinDelay(ASensor const* sensor); -/** - * Returns the maximum size of batches for this sensor. Batches will often be - * smaller, as the hardware fifo might be used for other sensors. - */ -int ASensor_getFifoMaxEventCount(ASensor const* sensor); - -/** - * Returns the hardware batch fifo size reserved to this sensor. - */ -int ASensor_getFifoReservedEventCount(ASensor const* sensor); - -/** - * Returns this sensor's string type. - */ -const char* ASensor_getStringType(ASensor const* sensor); - -/** - * Returns the reporting mode for this sensor. One of AREPORTING_MODE_* constants. - */ -int ASensor_getReportingMode(ASensor const* sensor); - -/** - * Returns true if this is a wake up sensor, false otherwise. - */ -bool ASensor_isWakeUpSensor(ASensor const* sensor); #ifdef __cplusplus }; #endif #endif // ANDROID_SENSOR_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/storage_manager.h android-platform-frameworks-native-21/include/android/storage_manager.h --- android-platform-frameworks-native-6.0.1+r16/include/android/storage_manager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/storage_manager.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup Storage - * @{ - */ - -/** - * @file storage_manager.h - */ #ifndef ANDROID_STORAGE_MANAGER_H #define ANDROID_STORAGE_MANAGER_H @@ -33,62 +25,55 @@ #endif struct AStorageManager; -/** - * {@link AStorageManager} manages application OBB storage, a pointer - * can be obtained with AStorageManager_new(). - */ typedef struct AStorageManager AStorageManager; -/** - * The different states of a OBB storage passed to AStorageManager_obbCallbackFunc(). - */ enum { - /** + /* * The OBB container is now mounted and ready for use. Can be returned * as the status for callbacks made during asynchronous OBB actions. */ AOBB_STATE_MOUNTED = 1, - /** + /* * The OBB container is now unmounted and not usable. Can be returned * as the status for callbacks made during asynchronous OBB actions. */ AOBB_STATE_UNMOUNTED = 2, - /** + /* * There was an internal system error encountered while trying to * mount the OBB. Can be returned as the status for callbacks made * during asynchronous OBB actions. */ AOBB_STATE_ERROR_INTERNAL = 20, - /** + /* * The OBB could not be mounted by the system. Can be returned as the * status for callbacks made during asynchronous OBB actions. */ AOBB_STATE_ERROR_COULD_NOT_MOUNT = 21, - /** + /* * The OBB could not be unmounted. This most likely indicates that a * file is in use on the OBB. Can be returned as the status for * callbacks made during asynchronous OBB actions. */ AOBB_STATE_ERROR_COULD_NOT_UNMOUNT = 22, - /** + /* * A call was made to unmount the OBB when it was not mounted. Can be * returned as the status for callbacks made during asynchronous OBB * actions. */ AOBB_STATE_ERROR_NOT_MOUNTED = 23, - /** + /* * The OBB has already been mounted. Can be returned as the status for * callbacks made during asynchronous OBB actions. */ AOBB_STATE_ERROR_ALREADY_MOUNTED = 24, - /** + /* * The current application does not have permission to use this OBB. * This could be because the OBB indicates it's owned by a different * package. Can be returned as the status for callbacks made during @@ -109,16 +94,6 @@ /** * Callback function for asynchronous calls made on OBB files. - * - * "state" is one of the following constants: - * - {@link AOBB_STATE_MOUNTED} - * - {@link AOBB_STATE_UNMOUNTED} - * - {@link AOBB_STATE_ERROR_INTERNAL} - * - {@link AOBB_STATE_ERROR_COULD_NOT_MOUNT} - * - {@link AOBB_STATE_ERROR_COULD_NOT_UNMOUNT} - * - {@link AOBB_STATE_ERROR_NOT_MOUNTED} - * - {@link AOBB_STATE_ERROR_ALREADY_MOUNTED} - * - {@link AOBB_STATE_ERROR_PERMISSION_DENIED} */ typedef void (*AStorageManager_obbCallbackFunc)(const char* filename, const int32_t state, void* data); @@ -150,5 +125,3 @@ #endif #endif // ANDROID_STORAGE_MANAGER_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/trace.h android-platform-frameworks-native-21/include/android/trace.h --- android-platform-frameworks-native-6.0.1+r16/include/android/trace.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/trace.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - - -#ifndef ANDROID_NATIVE_TRACE_H -#define ANDROID_NATIVE_TRACE_H - -#include - -#ifdef __cplusplus -extern "C" { -#endif - -/** - * Returns true if tracing is enabled. Use this signal to avoid expensive computation only necessary - * when tracing is enabled. - */ -bool ATrace_isEnabled(); - -/** - * Writes a tracing message to indicate that the given section of code has begun. This call must be - * followed by a corresponding call to endSection() on the same thread. - * - * Note: At this time the vertical bar character '|' and newline character '\n' are used internally - * by the tracing mechanism. If sectionName contains these characters they will be replaced with a - * space character in the trace. - */ -void ATrace_beginSection(const char* sectionName); - -/** - * Writes a tracing message to indicate that a given section of code has ended. This call must be - * preceeded by a corresponding call to beginSection(char*) on the same thread. Calling this method - * will mark the end of the most recently begun section of code, so care must be taken to ensure - * that beginSection / endSection pairs are properly nested and called from the same thread. - */ -void ATrace_endSection(); - -#ifdef __cplusplus -}; -#endif - -#endif // ANDROID_NATIVE_TRACE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/android/window.h android-platform-frameworks-native-21/include/android/window.h --- android-platform-frameworks-native-6.0.1+r16/include/android/window.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/android/window.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,14 +14,6 @@ * limitations under the License. */ -/** - * @addtogroup NativeActivity Native Activity - * @{ - */ - -/** - * @file window.h - */ #ifndef ANDROID_WINDOW_H #define ANDROID_WINDOW_H @@ -34,184 +26,28 @@ * Window flags, as per the Java API at android.view.WindowManager.LayoutParams. */ enum { - /** - * As long as this window is visible to the user, allow the lock - * screen to activate while the screen is on. This can be used - * independently, or in combination with {@link - * AWINDOW_FLAG_KEEP_SCREEN_ON} and/or {@link - * AWINDOW_FLAG_SHOW_WHEN_LOCKED} - */ AWINDOW_FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001, - /** Everything behind this window will be dimmed. */ AWINDOW_FLAG_DIM_BEHIND = 0x00000002, - /** - * Blur everything behind this window. - * @deprecated Blurring is no longer supported. - */ AWINDOW_FLAG_BLUR_BEHIND = 0x00000004, - /** - * This window won't ever get key input focus, so the - * user can not send key or other button events to it. Those will - * instead go to whatever focusable window is behind it. This flag - * will also enable {@link AWINDOW_FLAG_NOT_TOUCH_MODAL} whether or not that - * is explicitly set. - * - * Setting this flag also implies that the window will not need to - * interact with - * a soft input method, so it will be Z-ordered and positioned - * independently of any active input method (typically this means it - * gets Z-ordered on top of the input method, so it can use the full - * screen for its content and cover the input method if needed. You - * can use {@link AWINDOW_FLAG_ALT_FOCUSABLE_IM} to modify this behavior. - */ AWINDOW_FLAG_NOT_FOCUSABLE = 0x00000008, - /** this window can never receive touch events. */ AWINDOW_FLAG_NOT_TOUCHABLE = 0x00000010, - /** - * Even when this window is focusable (its - * {@link AWINDOW_FLAG_NOT_FOCUSABLE} is not set), allow any pointer events - * outside of the window to be sent to the windows behind it. Otherwise - * it will consume all pointer events itself, regardless of whether they - * are inside of the window. - */ AWINDOW_FLAG_NOT_TOUCH_MODAL = 0x00000020, - /** - * When set, if the device is asleep when the touch - * screen is pressed, you will receive this first touch event. Usually - * the first touch event is consumed by the system since the user can - * not see what they are pressing on. - * - * @deprecated This flag has no effect. - */ AWINDOW_FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040, - /** - * As long as this window is visible to the user, keep - * the device's screen turned on and bright. - */ AWINDOW_FLAG_KEEP_SCREEN_ON = 0x00000080, - /** - * Place the window within the entire screen, ignoring - * decorations around the border (such as the status bar). The - * window must correctly position its contents to take the screen - * decoration into account. - */ AWINDOW_FLAG_LAYOUT_IN_SCREEN = 0x00000100, - /** allow window to extend outside of the screen. */ AWINDOW_FLAG_LAYOUT_NO_LIMITS = 0x00000200, - /** - * Hide all screen decorations (such as the status - * bar) while this window is displayed. This allows the window to - * use the entire display space for itself -- the status bar will - * be hidden when an app window with this flag set is on the top - * layer. A fullscreen window will ignore a value of {@link - * AWINDOW_SOFT_INPUT_ADJUST_RESIZE}; the window will stay - * fullscreen and will not resize. - */ AWINDOW_FLAG_FULLSCREEN = 0x00000400, - /** - * Override {@link AWINDOW_FLAG_FULLSCREEN} and force the - * screen decorations (such as the status bar) to be shown. - */ AWINDOW_FLAG_FORCE_NOT_FULLSCREEN = 0x00000800, - /** - * Turn on dithering when compositing this window to - * the screen. - * @deprecated This flag is no longer used. - */ AWINDOW_FLAG_DITHER = 0x00001000, - /** - * Treat the content of the window as secure, preventing - * it from appearing in screenshots or from being viewed on non-secure - * displays. - */ AWINDOW_FLAG_SECURE = 0x00002000, - /** - * A special mode where the layout parameters are used - * to perform scaling of the surface when it is composited to the - * screen. - */ AWINDOW_FLAG_SCALED = 0x00004000, - /** - * Intended for windows that will often be used when the user is - * holding the screen against their face, it will aggressively - * filter the event stream to prevent unintended presses in this - * situation that may not be desired for a particular window, when - * such an event stream is detected, the application will receive - * a {@link AMOTION_EVENT_ACTION_CANCEL} to indicate this so - * applications can handle this accordingly by taking no action on - * the event until the finger is released. - */ AWINDOW_FLAG_IGNORE_CHEEK_PRESSES = 0x00008000, - /** - * A special option only for use in combination with - * {@link AWINDOW_FLAG_LAYOUT_IN_SCREEN}. When requesting layout in the - * screen your window may appear on top of or behind screen decorations - * such as the status bar. By also including this flag, the window - * manager will report the inset rectangle needed to ensure your - * content is not covered by screen decorations. - */ AWINDOW_FLAG_LAYOUT_INSET_DECOR = 0x00010000, - /** - * Invert the state of {@link AWINDOW_FLAG_NOT_FOCUSABLE} with - * respect to how this window interacts with the current method. - * That is, if FLAG_NOT_FOCUSABLE is set and this flag is set, - * then the window will behave as if it needs to interact with the - * input method and thus be placed behind/away from it; if {@link - * AWINDOW_FLAG_NOT_FOCUSABLE} is not set and this flag is set, - * then the window will behave as if it doesn't need to interact - * with the input method and can be placed to use more space and - * cover the input method. - */ AWINDOW_FLAG_ALT_FOCUSABLE_IM = 0x00020000, - /** - * If you have set {@link AWINDOW_FLAG_NOT_TOUCH_MODAL}, you - * can set this flag to receive a single special MotionEvent with - * the action - * {@link AMOTION_EVENT_ACTION_OUTSIDE} for - * touches that occur outside of your window. Note that you will not - * receive the full down/move/up gesture, only the location of the - * first down as an {@link AMOTION_EVENT_ACTION_OUTSIDE}. - */ AWINDOW_FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000, - /** - * Special flag to let windows be shown when the screen - * is locked. This will let application windows take precedence over - * key guard or any other lock screens. Can be used with - * {@link AWINDOW_FLAG_KEEP_SCREEN_ON} to turn screen on and display windows - * directly before showing the key guard window. Can be used with - * {@link AWINDOW_FLAG_DISMISS_KEYGUARD} to automatically fully dismisss - * non-secure keyguards. This flag only applies to the top-most - * full-screen window. - */ AWINDOW_FLAG_SHOW_WHEN_LOCKED = 0x00080000, - /** - * Ask that the system wallpaper be shown behind - * your window. The window surface must be translucent to be able - * to actually see the wallpaper behind it; this flag just ensures - * that the wallpaper surface will be there if this window actually - * has translucent regions. - */ AWINDOW_FLAG_SHOW_WALLPAPER = 0x00100000, - /** - * When set as a window is being added or made - * visible, once the window has been shown then the system will - * poke the power manager's user activity (as if the user had woken - * up the device) to turn the screen on. - */ AWINDOW_FLAG_TURN_SCREEN_ON = 0x00200000, - /** - * When set the window will cause the keyguard to - * be dismissed, only if it is not a secure lock keyguard. Because such - * a keyguard is not needed for security, it will never re-appear if - * the user navigates to another window (in contrast to - * {@link AWINDOW_FLAG_SHOW_WHEN_LOCKED}, which will only temporarily - * hide both secure and non-secure keyguards but ensure they reappear - * when the user moves to another UI that doesn't hide them). - * If the keyguard is currently active and is secure (requires an - * unlock pattern) than the user will still need to confirm it before - * seeing this window, unless {@link AWINDOW_FLAG_SHOW_WHEN_LOCKED} has - * also been set. - */ AWINDOW_FLAG_DISMISS_KEYGUARD = 0x00400000, }; @@ -220,5 +56,3 @@ #endif #endif // ANDROID_WINDOW_H - -/** @} */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/batteryservice/BatteryService.h android-platform-frameworks-native-21/include/batteryservice/BatteryService.h --- android-platform-frameworks-native-6.0.1+r16/include/batteryservice/BatteryService.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/batteryservice/BatteryService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,82 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_BATTERYSERVICE_H -#define ANDROID_BATTERYSERVICE_H - -#include -#include -#include -#include - -namespace android { - -// must be kept in sync with definitions in BatteryManager.java -enum { - BATTERY_STATUS_UNKNOWN = 1, // equals BatteryManager.BATTERY_STATUS_UNKNOWN constant - BATTERY_STATUS_CHARGING = 2, // equals BatteryManager.BATTERY_STATUS_CHARGING constant - BATTERY_STATUS_DISCHARGING = 3, // equals BatteryManager.BATTERY_STATUS_DISCHARGING constant - BATTERY_STATUS_NOT_CHARGING = 4, // equals BatteryManager.BATTERY_STATUS_NOT_CHARGING constant - BATTERY_STATUS_FULL = 5, // equals BatteryManager.BATTERY_STATUS_FULL constant -}; - -// must be kept in sync with definitions in BatteryManager.java -enum { - BATTERY_HEALTH_UNKNOWN = 1, // equals BatteryManager.BATTERY_HEALTH_UNKNOWN constant - BATTERY_HEALTH_GOOD = 2, // equals BatteryManager.BATTERY_HEALTH_GOOD constant - BATTERY_HEALTH_OVERHEAT = 3, // equals BatteryManager.BATTERY_HEALTH_OVERHEAT constant - BATTERY_HEALTH_DEAD = 4, // equals BatteryManager.BATTERY_HEALTH_DEAD constant - BATTERY_HEALTH_OVER_VOLTAGE = 5, // equals BatteryManager.BATTERY_HEALTH_OVER_VOLTAGE constant - BATTERY_HEALTH_UNSPECIFIED_FAILURE = 6, // equals BatteryManager.BATTERY_HEALTH_UNSPECIFIED_FAILURE constant - BATTERY_HEALTH_COLD = 7, // equals BatteryManager.BATTERY_HEALTH_COLD constant -}; - -// must be kept in sync with definitions in BatteryProperty.java -enum { - BATTERY_PROP_CHARGE_COUNTER = 1, // equals BatteryProperty.CHARGE_COUNTER constant - BATTERY_PROP_CURRENT_NOW = 2, // equals BatteryProperty.CURRENT_NOW constant - BATTERY_PROP_CURRENT_AVG = 3, // equals BatteryProperty.CURRENT_AVG constant - BATTERY_PROP_CAPACITY = 4, // equals BatteryProperty.CAPACITY constant - BATTERY_PROP_ENERGY_COUNTER = 5, // equals BatteryProperty.ENERGY_COUNTER constant -}; - -struct BatteryProperties { - bool chargerAcOnline; - bool chargerUsbOnline; - bool chargerWirelessOnline; - int maxChargingCurrent; - int batteryStatus; - int batteryHealth; - bool batteryPresent; - int batteryLevel; - int batteryVoltage; - int batteryTemperature; - String8 batteryTechnology; - - status_t writeToParcel(Parcel* parcel) const; - status_t readFromParcel(Parcel* parcel); -}; - -struct BatteryProperty { - int64_t valueInt64; - - status_t writeToParcel(Parcel* parcel) const; - status_t readFromParcel(Parcel* parcel); -}; - -}; // namespace android - -#endif // ANDROID_BATTERYSERVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/batteryservice/IBatteryPropertiesListener.h android-platform-frameworks-native-21/include/batteryservice/IBatteryPropertiesListener.h --- android-platform-frameworks-native-6.0.1+r16/include/batteryservice/IBatteryPropertiesListener.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/batteryservice/IBatteryPropertiesListener.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_IBATTERYPROPERTIESLISTENER_H -#define ANDROID_IBATTERYPROPERTIESLISTENER_H - -#include -#include - -#include - -namespace android { - -// must be kept in sync with interface defined in IBatteryPropertiesListener.aidl -enum { - TRANSACT_BATTERYPROPERTIESCHANGED = IBinder::FIRST_CALL_TRANSACTION, -}; - -// ---------------------------------------------------------------------------- - -class IBatteryPropertiesListener : public IInterface { -public: - DECLARE_META_INTERFACE(BatteryPropertiesListener); - - virtual void batteryPropertiesChanged(struct BatteryProperties props) = 0; -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IBATTERYPROPERTIESLISTENER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/batteryservice/IBatteryPropertiesRegistrar.h android-platform-frameworks-native-21/include/batteryservice/IBatteryPropertiesRegistrar.h --- android-platform-frameworks-native-6.0.1+r16/include/batteryservice/IBatteryPropertiesRegistrar.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/batteryservice/IBatteryPropertiesRegistrar.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_IBATTERYPROPERTIESREGISTRAR_H -#define ANDROID_IBATTERYPROPERTIESREGISTRAR_H - -#include -#include - -namespace android { - -// must be kept in sync with interface defined in IBatteryPropertiesRegistrar.aidl -enum { - REGISTER_LISTENER = IBinder::FIRST_CALL_TRANSACTION, - UNREGISTER_LISTENER, - GET_PROPERTY, -}; - -class IBatteryPropertiesRegistrar : public IInterface { -public: - DECLARE_META_INTERFACE(BatteryPropertiesRegistrar); - - virtual void registerListener(const sp& listener) = 0; - virtual void unregisterListener(const sp& listener) = 0; - virtual status_t getProperty(int id, struct BatteryProperty *val) = 0; -}; - -class BnBatteryPropertiesRegistrar : public BnInterface { -public: - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); -}; - -}; // namespace android - -#endif // ANDROID_IBATTERYPROPERTIESREGISTRAR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/AppOpsManager.h android-platform-frameworks-native-21/include/binder/AppOpsManager.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/AppOpsManager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/AppOpsManager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_APP_OPS_MANAGER_H -#define ANDROID_APP_OPS_MANAGER_H - -#include - -#include - -// --------------------------------------------------------------------------- -namespace android { - -class AppOpsManager -{ -public: - enum { - MODE_ALLOWED = IAppOpsService::MODE_ALLOWED, - MODE_IGNORED = IAppOpsService::MODE_IGNORED, - MODE_ERRORED = IAppOpsService::MODE_ERRORED - }; - - enum { - OP_NONE = -1, - OP_COARSE_LOCATION = 0, - OP_FINE_LOCATION = 1, - OP_GPS = 2, - OP_VIBRATE = 3, - OP_READ_CONTACTS = 4, - OP_WRITE_CONTACTS = 5, - OP_READ_CALL_LOG = 6, - OP_WRITE_CALL_LOG = 7, - OP_READ_CALENDAR = 8, - OP_WRITE_CALENDAR = 9, - OP_WIFI_SCAN = 10, - OP_POST_NOTIFICATION = 11, - OP_NEIGHBORING_CELLS = 12, - OP_CALL_PHONE = 13, - OP_READ_SMS = 14, - OP_WRITE_SMS = 15, - OP_RECEIVE_SMS = 16, - OP_RECEIVE_EMERGECY_SMS = 17, - OP_RECEIVE_MMS = 18, - OP_RECEIVE_WAP_PUSH = 19, - OP_SEND_SMS = 20, - OP_READ_ICC_SMS = 21, - OP_WRITE_ICC_SMS = 22, - OP_WRITE_SETTINGS = 23, - OP_SYSTEM_ALERT_WINDOW = 24, - OP_ACCESS_NOTIFICATIONS = 25, - OP_CAMERA = 26, - OP_RECORD_AUDIO = 27, - OP_PLAY_AUDIO = 28, - OP_READ_CLIPBOARD = 29, - OP_WRITE_CLIPBOARD = 30, - OP_TAKE_MEDIA_BUTTONS = 31, - OP_TAKE_AUDIO_FOCUS = 32, - OP_AUDIO_MASTER_VOLUME = 33, - OP_AUDIO_VOICE_VOLUME = 34, - OP_AUDIO_RING_VOLUME = 35, - OP_AUDIO_MEDIA_VOLUME = 36, - OP_AUDIO_ALARM_VOLUME = 37, - OP_AUDIO_NOTIFICATION_VOLUME = 38, - OP_AUDIO_BLUETOOTH_VOLUME = 39, - OP_WAKE_LOCK = 40, - OP_MONITOR_LOCATION = 41, - OP_MONITOR_HIGH_POWER_LOCATION = 42, - OP_GET_USAGE_STATS = 43, - OP_MUTE_MICROPHONE = 44, - OP_TOAST_WINDOW = 45, - OP_PROJECT_MEDIA = 46, - OP_ACTIVATE_VPN = 47, - OP_WRITE_WALLPAPER = 48, - OP_ASSIST_STRUCTURE = 49, - OP_ASSIST_SCREENSHOT = 50, - OP_READ_PHONE_STATE = 51, - OP_ADD_VOICEMAIL = 52, - OP_USE_SIP = 53, - OP_PROCESS_OUTGOING_CALLS = 54, - OP_USE_FINGERPRINT = 55, - OP_BODY_SENSORS = 56 - }; - - AppOpsManager(); - - int32_t checkOp(int32_t op, int32_t uid, const String16& callingPackage); - int32_t noteOp(int32_t op, int32_t uid, const String16& callingPackage); - int32_t startOp(int32_t op, int32_t uid, const String16& callingPackage); - void finishOp(int32_t op, int32_t uid, const String16& callingPackage); - void startWatchingMode(int32_t op, const String16& packageName, - const sp& callback); - void stopWatchingMode(const sp& callback); - int32_t permissionToOpCode(const String16& permission); - -private: - Mutex mLock; - sp mService; - - sp getService(); -}; - - -}; // namespace android -// --------------------------------------------------------------------------- -#endif // ANDROID_APP_OPS_MANAGER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/Binder.h android-platform-frameworks-native-21/include/binder/Binder.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/Binder.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/Binder.h 2012-10-16 22:57:11.000000000 +0000 @@ -17,8 +17,6 @@ #ifndef ANDROID_BINDER_H #define ANDROID_BINDER_H -#include -#include #include // --------------------------------------------------------------------------- @@ -71,7 +69,7 @@ class Extras; - atomic_uintptr_t mExtras; // should be atomic + Extras* mExtras; void* mReserved0; }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/BinderService.h android-platform-frameworks-native-21/include/binder/BinderService.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/BinderService.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/BinderService.h 2012-10-16 22:57:11.000000000 +0000 @@ -36,26 +36,20 @@ public: static status_t publish(bool allowIsolated = false) { sp sm(defaultServiceManager()); - return sm->addService( - String16(SERVICE::getServiceName()), - new SERVICE(), allowIsolated); + return sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated); } static void publishAndJoinThreadPool(bool allowIsolated = false) { - publish(allowIsolated); - joinThreadPool(); + sp sm(defaultServiceManager()); + sm->addService(String16(SERVICE::getServiceName()), new SERVICE(), allowIsolated); + ProcessState::self()->startThreadPool(); + IPCThreadState::self()->joinThreadPool(); } static void instantiate() { publish(); } - static status_t shutdown() { return NO_ERROR; } - -private: - static void joinThreadPool() { - sp ps(ProcessState::self()); - ps->startThreadPool(); - ps->giveThreadPoolName(); - IPCThreadState::self()->joinThreadPool(); + static status_t shutdown() { + return NO_ERROR; } }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/BufferedTextOutput.h android-platform-frameworks-native-21/include/binder/BufferedTextOutput.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/BufferedTextOutput.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/BufferedTextOutput.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2006 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. - */ - -#ifndef ANDROID_BUFFEREDTEXTOUTPUT_H -#define ANDROID_BUFFEREDTEXTOUTPUT_H - -#include -#include -#include - -// --------------------------------------------------------------------------- -namespace android { - -class BufferedTextOutput : public TextOutput -{ -public: - //** Flags for constructor */ - enum { - MULTITHREADED = 0x0001 - }; - - BufferedTextOutput(uint32_t flags = 0); - virtual ~BufferedTextOutput(); - - virtual status_t print(const char* txt, size_t len); - virtual void moveIndent(int delta); - - virtual void pushBundle(); - virtual void popBundle(); - -protected: - virtual status_t writeLines(const struct iovec& vec, size_t N) = 0; - -private: - struct BufferState; - struct ThreadState; - - static ThreadState*getThreadState(); - static void threadDestructor(void *st); - - BufferState*getBuffer() const; - - uint32_t mFlags; - const int32_t mSeq; - const int32_t mIndex; - - Mutex mLock; - BufferState* mGlobalState; -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_BUFFEREDTEXTOUTPUT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/Debug.h android-platform-frameworks-native-21/include/binder/Debug.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/Debug.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/Debug.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright (C) 2005 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. - */ - -#ifndef ANDROID_BINDER_DEBUG_H -#define ANDROID_BINDER_DEBUG_H - -#include -#include - -namespace android { -// --------------------------------------------------------------------------- - -#ifdef __cplusplus -extern "C" { -#endif - -const char* stringForIndent(int32_t indentLevel); - -typedef void (*debugPrintFunc)(void* cookie, const char* txt); - -void printTypeCode(uint32_t typeCode, - debugPrintFunc func = 0, void* cookie = 0); - -void printHexData(int32_t indent, const void *buf, size_t length, - size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, - size_t alignment=0, bool cArrayStyle=false, - debugPrintFunc func = 0, void* cookie = 0); - -#ifdef __cplusplus -} -#endif - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_BINDER_DEBUG_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IAppOpsCallback.h android-platform-frameworks-native-21/include/binder/IAppOpsCallback.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IAppOpsCallback.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IAppOpsCallback.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -// -#ifndef ANDROID_IAPP_OPS_CALLBACK_H -#define ANDROID_IAPP_OPS_CALLBACK_H - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class IAppOpsCallback : public IInterface -{ -public: - DECLARE_META_INTERFACE(AppOpsCallback); - - virtual void opChanged(int32_t op, const String16& packageName) = 0; - - enum { - OP_CHANGED_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION - }; -}; - -// ---------------------------------------------------------------------- - -class BnAppOpsCallback : public BnInterface -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IAPP_OPS_CALLBACK_H - diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IAppOpsService.h android-platform-frameworks-native-21/include/binder/IAppOpsService.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IAppOpsService.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IAppOpsService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -// -#ifndef ANDROID_IAPP_OPS_SERVICE_H -#define ANDROID_IAPP_OPS_SERVICE_H - -#include -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class IAppOpsService : public IInterface -{ -public: - DECLARE_META_INTERFACE(AppOpsService); - - virtual int32_t checkOperation(int32_t code, int32_t uid, const String16& packageName) = 0; - virtual int32_t noteOperation(int32_t code, int32_t uid, const String16& packageName) = 0; - virtual int32_t startOperation(const sp& token, int32_t code, int32_t uid, - const String16& packageName) = 0; - virtual void finishOperation(const sp& token, int32_t code, int32_t uid, - const String16& packageName) = 0; - virtual void startWatchingMode(int32_t op, const String16& packageName, - const sp& callback) = 0; - virtual void stopWatchingMode(const sp& callback) = 0; - virtual sp getToken(const sp& clientToken) = 0; - virtual int32_t permissionToOpCode(const String16& permission) = 0; - - enum { - CHECK_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, - NOTE_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+1, - START_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+2, - FINISH_OPERATION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+3, - START_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+4, - STOP_WATCHING_MODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+5, - GET_TOKEN_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+6, - PERMISSION_TO_OP_CODE_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION+7, - }; - - enum { - MODE_ALLOWED = 0, - MODE_IGNORED = 1, - MODE_ERRORED = 2 - }; -}; - -// ---------------------------------------------------------------------- - -class BnAppOpsService : public BnInterface -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IAPP_OPS_SERVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IBatteryStats.h android-platform-frameworks-native-21/include/binder/IBatteryStats.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IBatteryStats.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IBatteryStats.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_IBATTERYSTATS_H -#define ANDROID_IBATTERYSTATS_H - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class IBatteryStats : public IInterface -{ -public: - DECLARE_META_INTERFACE(BatteryStats); - - virtual void noteStartSensor(int uid, int sensor) = 0; - virtual void noteStopSensor(int uid, int sensor) = 0; - virtual void noteStartVideo(int uid) = 0; - virtual void noteStopVideo(int uid) = 0; - virtual void noteStartAudio(int uid) = 0; - virtual void noteStopAudio(int uid) = 0; - virtual void noteResetVideo() = 0; - virtual void noteResetAudio() = 0; - virtual void noteFlashlightOn(int uid) = 0; - virtual void noteFlashlightOff(int uid) = 0; - virtual void noteStartCamera(int uid) = 0; - virtual void noteStopCamera(int uid) = 0; - virtual void noteResetCamera() = 0; - virtual void noteResetFlashlight() = 0; - - enum { - NOTE_START_SENSOR_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, - NOTE_STOP_SENSOR_TRANSACTION, - NOTE_START_VIDEO_TRANSACTION, - NOTE_STOP_VIDEO_TRANSACTION, - NOTE_START_AUDIO_TRANSACTION, - NOTE_STOP_AUDIO_TRANSACTION, - NOTE_RESET_VIDEO_TRANSACTION, - NOTE_RESET_AUDIO_TRANSACTION, - NOTE_FLASHLIGHT_ON_TRANSACTION, - NOTE_FLASHLIGHT_OFF_TRANSACTION, - NOTE_START_CAMERA_TRANSACTION, - NOTE_STOP_CAMERA_TRANSACTION, - NOTE_RESET_CAMERA_TRANSACTION, - NOTE_RESET_FLASHLIGHT_TRANSACTION - }; -}; - -// ---------------------------------------------------------------------- - -class BnBatteryStats : public BnInterface -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_IBATTERYSTATS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IBinder.h android-platform-frameworks-native-21/include/binder/IBinder.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IBinder.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IBinder.h 2012-10-16 22:57:11.000000000 +0000 @@ -81,6 +81,14 @@ Parcel* reply, uint32_t flags = 0) = 0; + /** + * This method allows you to add data that is transported through + * IPC along with your IBinder pointer. When implementing a Binder + * object, override it to write your desired data in to @a outData. + * You can then call getConstantData() on your IBinder to retrieve + * that data, from any process. You MUST return the number of bytes + * written in to the parcel (including padding). + */ class DeathRecipient : public virtual RefBase { public: diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IInterface.h android-platform-frameworks-native-21/include/binder/IInterface.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IInterface.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IInterface.h 2012-10-16 22:57:11.000000000 +0000 @@ -28,9 +28,9 @@ { public: IInterface(); - static sp asBinder(const IInterface*); - static sp asBinder(const sp&); - + sp asBinder(); + sp asBinder() const; + protected: virtual ~IInterface(); virtual IBinder* onAsBinder() = 0; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IPCThreadState.h android-platform-frameworks-native-21/include/binder/IPCThreadState.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IPCThreadState.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IPCThreadState.h 2012-10-16 22:57:11.000000000 +0000 @@ -22,7 +22,7 @@ #include #include -#if defined(_WIN32) +#ifdef HAVE_WIN32_PROC typedef int uid_t; #endif @@ -39,8 +39,9 @@ status_t clearLastError(); - pid_t getCallingPid() const; - uid_t getCallingUid() const; + int getCallingPid(); + int getCallingUid(); + int getOrigCallingUid(); void setStrictModePolicy(int32_t policy); int32_t getStrictModePolicy() const; @@ -51,8 +52,6 @@ int64_t clearCallingIdentity(); void restoreCallingIdentity(int64_t token); - int setupPolling(int* fd); - status_t handlePolledCommands(); void flushCommands(); void joinThreadPool(bool isMain = true); @@ -76,18 +75,14 @@ BpBinder* proxy); static void shutdown(); - + // Call this to disable switching threads to background scheduling when // receiving incoming IPC calls. This is specifically here for the // Android system process, since it expects to have background apps calling // in to it but doesn't want to acquire locks in its services while in // the background. static void disableBackgroundScheduling(bool disable); - - // Call blocks until the number of executing binder threads is less than - // the maximum number of binder threads threads allowed for this process. - void blockUntilThreadAvailable(); - + private: IPCThreadState(); ~IPCThreadState(); @@ -102,28 +97,27 @@ uint32_t code, const Parcel& data, status_t* statusBuffer); - status_t getAndExecuteCommand(); status_t executeCommand(int32_t command); - void processPendingDerefs(); - + void clearCaller(); - + static void threadDestructor(void *st); static void freeBuffer(Parcel* parcel, const uint8_t* data, size_t dataSize, - const binder_size_t* objects, size_t objectsSize, + const size_t* objects, size_t objectsSize, void* cookie); const sp mProcess; const pid_t mMyThreadId; Vector mPendingStrongDerefs; Vector mPendingWeakDerefs; - + Parcel mIn; Parcel mOut; status_t mLastError; pid_t mCallingPid; uid_t mCallingUid; + uid_t mOrigCallingUid; int32_t mStrictModePolicy; int32_t mLastTransactionBinderFlags; }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IPermissionController.h android-platform-frameworks-native-21/include/binder/IPermissionController.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IPermissionController.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IPermissionController.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,6 @@ #define ANDROID_IPERMISSION_CONTROLLER_H #include -#include namespace android { @@ -30,16 +29,11 @@ public: DECLARE_META_INTERFACE(PermissionController); - virtual bool checkPermission(const String16& permission, int32_t pid, int32_t uid) = 0; - - virtual void getPackagesForUid(const uid_t uid, Vector &packages) = 0; - - virtual bool isRuntimePermission(const String16& permission) = 0; - + virtual bool checkPermission(const String16& permission, + int32_t pid, int32_t uid) = 0; + enum { - CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, - GET_PACKAGES_FOR_UID_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION + 1, - IS_RUNTIME_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION + 2 + CHECK_PERMISSION_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION }; }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/IProcessInfoService.h android-platform-frameworks-native-21/include/binder/IProcessInfoService.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/IProcessInfoService.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/IProcessInfoService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright 2015 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. - */ - -#ifndef ANDROID_I_PROCESS_INFO_SERVICE_H -#define ANDROID_I_PROCESS_INFO_SERVICE_H - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class IProcessInfoService : public IInterface { -public: - DECLARE_META_INTERFACE(ProcessInfoService); - - virtual status_t getProcessStatesFromPids( size_t length, - /*in*/ int32_t* pids, - /*out*/ int32_t* states) = 0; - - enum { - GET_PROCESS_STATES_FROM_PIDS = IBinder::FIRST_CALL_TRANSACTION, - }; -}; - -// ---------------------------------------------------------------------- - -class BnProcessInfoService : public BnInterface { -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_I_PROCESS_INFO_SERVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/MemoryDealer.h android-platform-frameworks-native-21/include/binder/MemoryDealer.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/MemoryDealer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/MemoryDealer.h 2012-10-16 22:57:11.000000000 +0000 @@ -34,8 +34,7 @@ class MemoryDealer : public RefBase { public: - MemoryDealer(size_t size, const char* name = 0, - uint32_t flags = 0 /* or bits such as MemoryHeapBase::READ_ONLY */ ); + MemoryDealer(size_t size, const char* name = 0); virtual sp allocate(size_t size); virtual void deallocate(size_t offset); diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/MemoryHeapBase.h android-platform-frameworks-native-21/include/binder/MemoryHeapBase.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/MemoryHeapBase.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/MemoryHeapBase.h 2012-10-16 22:57:11.000000000 +0000 @@ -58,13 +58,10 @@ /* implement IMemoryHeap interface */ virtual int getHeapID() const; - - /* virtual address of the heap. returns MAP_FAILED in case of error */ virtual void* getBase() const; - virtual size_t getSize() const; virtual uint32_t getFlags() const; - virtual uint32_t getOffset() const; + virtual uint32_t getOffset() const; const char* getDevice() const; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/Parcel.h android-platform-frameworks-native-21/include/binder/Parcel.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/Parcel.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/Parcel.h 2012-10-16 22:57:11.000000000 +0000 @@ -22,22 +22,21 @@ #include #include #include -#include -#include // --------------------------------------------------------------------------- namespace android { -template class Flattenable; -template class LightFlattenable; +class Flattenable; class IBinder; class IPCThreadState; class ProcessState; class String8; class TextOutput; -class Parcel { - friend class IPCThreadState; +struct flat_binder_object; // defined in support_p/binder_module.h + +class Parcel +{ public: class ReadableBlob; class WritableBlob; @@ -60,7 +59,6 @@ status_t appendFrom(const Parcel *parcel, size_t start, size_t len); - bool allowFds() const; bool pushAllowFds(bool allowFds); void restoreAllowFds(bool lastValue); @@ -82,10 +80,7 @@ void freeData(); -private: - const binder_size_t* objects() const; - -public: + const size_t* objects() const; size_t objectsCount() const; status_t errorCheck() const; @@ -95,26 +90,17 @@ void* writeInplace(size_t len); status_t writeUnpadded(const void* data, size_t len); status_t writeInt32(int32_t val); - status_t writeUint32(uint32_t val); status_t writeInt64(int64_t val); - status_t writeUint64(uint64_t val); status_t writeFloat(float val); status_t writeDouble(double val); + status_t writeIntPtr(intptr_t val); status_t writeCString(const char* str); status_t writeString8(const String8& str); status_t writeString16(const String16& str); status_t writeString16(const char16_t* str, size_t len); status_t writeStrongBinder(const sp& val); status_t writeWeakBinder(const wp& val); - status_t writeInt32Array(size_t len, const int32_t *val); - status_t writeByteArray(size_t len, const uint8_t *val); - - template - status_t write(const Flattenable& val); - - template - status_t write(const LightFlattenable& val); - + status_t write(const Flattenable& val); // Place a native_handle into the parcel (the native_handle's file- // descriptors are dup'ed, so it is safe to delete the native_handle @@ -133,16 +119,9 @@ // Writes a blob to the parcel. // If the blob is small, then it is stored in-place, otherwise it is - // transferred by way of an anonymous shared memory region. Prefer sending - // immutable blobs if possible since they may be subsequently transferred between - // processes without further copying whereas mutable blobs always need to be copied. + // transferred by way of an anonymous shared memory region. // The caller should call release() on the blob after writing its contents. - status_t writeBlob(size_t len, bool mutableCopy, WritableBlob* outBlob); - - // Write an existing immutable blob file descriptor to the parcel. - // This allows the client to send the same blob to multiple processes - // as long as it keeps a dup of the blob file descriptor handy for later. - status_t writeDupImmutableBlobFileDescriptor(int fd); + status_t writeBlob(size_t len, WritableBlob* outBlob); status_t writeObject(const flat_binder_object& val, bool nullMetaData); @@ -157,12 +136,8 @@ const void* readInplace(size_t len) const; int32_t readInt32() const; status_t readInt32(int32_t *pArg) const; - uint32_t readUint32() const; - status_t readUint32(uint32_t *pArg) const; int64_t readInt64() const; status_t readInt64(int64_t *pArg) const; - uint64_t readUint64() const; - status_t readUint64(uint64_t *pArg) const; float readFloat() const; status_t readFloat(float *pArg) const; double readDouble() const; @@ -176,12 +151,7 @@ const char16_t* readString16Inplace(size_t* outLen) const; sp readStrongBinder() const; wp readWeakBinder() const; - - template - status_t read(Flattenable& val) const; - - template - status_t read(LightFlattenable& val) const; + status_t read(Flattenable& val) const; // Like Parcel.java's readExceptionCode(). Reads the first int32 // off of a Parcel's header, returning 0 or the negative error @@ -209,26 +179,20 @@ // Explicitly close all file descriptors in the parcel. void closeFileDescriptors(); - - // Debugging: get metrics on current allocations. - static size_t getGlobalAllocSize(); - static size_t getGlobalAllocCount(); - -private: + typedef void (*release_func)(Parcel* parcel, const uint8_t* data, size_t dataSize, - const binder_size_t* objects, size_t objectsSize, + const size_t* objects, size_t objectsSize, void* cookie); - uintptr_t ipcData() const; + const uint8_t* ipcData() const; size_t ipcDataSize() const; - uintptr_t ipcObjects() const; + const size_t* ipcObjects() const; size_t ipcObjectsCount() const; void ipcSetDataReference(const uint8_t* data, size_t dataSize, - const binder_size_t* objects, size_t objectsCount, + const size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie); -public: void print(TextOutput& to, uint32_t flags = 0) const; private: @@ -241,9 +205,6 @@ status_t growData(size_t len); status_t restartWrite(size_t desired); status_t continueWrite(size_t desired); - status_t writePointer(uintptr_t val); - status_t readPointer(uintptr_t *pArg) const; - uintptr_t readPointer() const; void freeDataNoInit(); void initState(); void scanForFds() const; @@ -261,7 +222,7 @@ size_t mDataSize; size_t mDataCapacity; mutable size_t mDataPos; - binder_size_t* mObjects; + size_t* mObjects; size_t mObjectsSize; size_t mObjectsCapacity; mutable size_t mNextObjectHint; @@ -278,60 +239,23 @@ Blob(); ~Blob(); - void clear(); void release(); inline size_t size() const { return mSize; } - inline int fd() const { return mFd; }; - inline bool isMutable() const { return mMutable; } protected: - void init(int fd, void* data, size_t size, bool isMutable); + void init(bool mapped, void* data, size_t size); + void clear(); - int mFd; // owned by parcel so not closed when released + bool mMapped; void* mData; size_t mSize; - bool mMutable; }; - class FlattenableHelperInterface { - protected: - ~FlattenableHelperInterface() { } - public: - virtual size_t getFlattenedSize() const = 0; - virtual size_t getFdCount() const = 0; - virtual status_t flatten(void* buffer, size_t size, int* fds, size_t count) const = 0; - virtual status_t unflatten(void const* buffer, size_t size, int const* fds, size_t count) = 0; - }; - - template - class FlattenableHelper : public FlattenableHelperInterface { - friend class Parcel; - const Flattenable& val; - explicit FlattenableHelper(const Flattenable& val) : val(val) { } - - public: - virtual size_t getFlattenedSize() const { - return val.getFlattenedSize(); - } - virtual size_t getFdCount() const { - return val.getFdCount(); - } - virtual status_t flatten(void* buffer, size_t size, int* fds, size_t count) const { - return val.flatten(buffer, size, fds, count); - } - virtual status_t unflatten(void const* buffer, size_t size, int const* fds, size_t count) { - return const_cast&>(val).unflatten(buffer, size, fds, count); - } - }; - status_t write(const FlattenableHelperInterface& val); - status_t read(FlattenableHelperInterface& val) const; - public: class ReadableBlob : public Blob { friend class Parcel; public: inline const void* data() const { return mData; } - inline void* mutableData() { return isMutable() ? mData : NULL; } }; class WritableBlob : public Blob { @@ -339,71 +263,10 @@ public: inline void* data() { return mData; } }; - -private: - size_t mOpenAshmemSize; - -public: - // TODO: Remove once ABI can be changed. - size_t getBlobAshmemSize() const; - size_t getOpenAshmemSize() const; }; // --------------------------------------------------------------------------- -template -status_t Parcel::write(const Flattenable& val) { - const FlattenableHelper helper(val); - return write(helper); -} - -template -status_t Parcel::write(const LightFlattenable& val) { - size_t size(val.getFlattenedSize()); - if (!val.isFixedSize()) { - status_t err = writeInt32(size); - if (err != NO_ERROR) { - return err; - } - } - if (size) { - void* buffer = writeInplace(size); - if (buffer == NULL) - return NO_MEMORY; - return val.flatten(buffer, size); - } - return NO_ERROR; -} - -template -status_t Parcel::read(Flattenable& val) const { - FlattenableHelper helper(val); - return read(helper); -} - -template -status_t Parcel::read(LightFlattenable& val) const { - size_t size; - if (val.isFixedSize()) { - size = val.getFlattenedSize(); - } else { - int32_t s; - status_t err = readInt32(&s); - if (err != NO_ERROR) { - return err; - } - size = s; - } - if (size) { - void const* buffer = readInplace(size); - return buffer == NULL ? NO_MEMORY : - val.unflatten(buffer, size); - } - return NO_ERROR; -} - -// --------------------------------------------------------------------------- - inline TextOutput& operator<<(TextOutput& to, const Parcel& parcel) { parcel.print(to); diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/PermissionCache.h android-platform-frameworks-native-21/include/binder/PermissionCache.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/PermissionCache.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/PermissionCache.h 2012-10-16 22:57:11.000000000 +0000 @@ -22,7 +22,6 @@ #include #include -#include namespace android { // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/ProcessInfoService.h android-platform-frameworks-native-21/include/binder/ProcessInfoService.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/ProcessInfoService.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/ProcessInfoService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2015 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. - */ - -#ifndef ANDROID_PROCESS_INFO_SERVICE_H -#define ANDROID_PROCESS_INFO_SERVICE_H - -#include -#include -#include -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class ProcessInfoService : public Singleton { - - friend class Singleton; - sp mProcessInfoService; - Mutex mProcessInfoLock; - - ProcessInfoService(); - - status_t getProcessStatesImpl(size_t length, /*in*/ int32_t* pids, /*out*/ int32_t* states); - void updateBinderLocked(); - - static const int BINDER_ATTEMPT_LIMIT = 5; - -public: - - /** - * For each PID in the given "pids" input array, write the current process state - * for that process into the "states" output array, or - * ActivityManager.PROCESS_STATE_NONEXISTENT * to indicate that no process with the given PID - * exists. - * - * Returns NO_ERROR if this operation was successful, or a negative error code otherwise. - */ - static status_t getProcessStatesFromPids(size_t length, /*in*/ int32_t* pids, - /*out*/ int32_t* states) { - return ProcessInfoService::getInstance().getProcessStatesImpl(length, /*in*/ pids, - /*out*/ states); - } - -}; - -// ---------------------------------------------------------------------- - -}; // namespace android - -#endif // ANDROID_PROCESS_INFO_SERVICE_H - diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/ProcessState.h android-platform-frameworks-native-21/include/binder/ProcessState.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/ProcessState.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/ProcessState.h 2012-10-16 22:57:11.000000000 +0000 @@ -24,11 +24,14 @@ #include -#include - // --------------------------------------------------------------------------- namespace android { +// Global variables +extern int mArgC; +extern const char* const* mArgV; +extern int mArgLen; + class IPCThreadState; class ProcessState : public virtual RefBase @@ -59,10 +62,15 @@ wp getWeakProxyForHandle(int32_t handle); void expungeHandle(int32_t handle, IBinder* binder); + void setArgs(int argc, const char* const argv[]); + int getArgC() const; + const char* const* getArgV() const; + + void setArgV0(const char* txt); + void spawnPooledThread(bool isMain); status_t setThreadPoolMaxThreadCount(size_t maxThreads); - void giveThreadPoolName(); private: friend class IPCThreadState; @@ -72,34 +80,25 @@ ProcessState(const ProcessState& o); ProcessState& operator=(const ProcessState& o); - String8 makeBinderThreadName(); - + struct handle_entry { IBinder* binder; RefBase::weakref_type* refs; }; - + handle_entry* lookupHandleLocked(int32_t handle); int mDriverFD; void* mVMStart; - - // Protects thread count variable below. - pthread_mutex_t mThreadCountLock; - pthread_cond_t mThreadCountDecrement; - // Number of binder threads current executing a command. - size_t mExecutingThreadsCount; - // Maximum number for binder threads allowed for this process. - size_t mMaxThreads; - + mutable Mutex mLock; // protects everything below. - + VectormHandleToObject; bool mManagesContexts; context_check_func mBinderContextCheckFunc; void* mBinderContextUserData; - + KeyedVector > mContexts; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/binder/TextOutput.h android-platform-frameworks-native-21/include/binder/TextOutput.h --- android-platform-frameworks-native-6.0.1+r16/include/binder/TextOutput.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/binder/TextOutput.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,195 +0,0 @@ -/* - * Copyright (C) 2006 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. - */ - -#ifndef ANDROID_TEXTOUTPUT_H -#define ANDROID_TEXTOUTPUT_H - -#include - -#include -#include - -// --------------------------------------------------------------------------- -namespace android { - -class String8; -class String16; - -class TextOutput -{ -public: - TextOutput(); - virtual ~TextOutput(); - - virtual status_t print(const char* txt, size_t len) = 0; - virtual void moveIndent(int delta) = 0; - - class Bundle { - public: - inline Bundle(TextOutput& to) : mTO(to) { to.pushBundle(); } - inline ~Bundle() { mTO.popBundle(); } - private: - TextOutput& mTO; - }; - - virtual void pushBundle() = 0; - virtual void popBundle() = 0; -}; - -// --------------------------------------------------------------------------- - -// Text output stream for printing to the log (via utils/Log.h). -extern TextOutput& alog; - -// Text output stream for printing to stdout. -extern TextOutput& aout; - -// Text output stream for printing to stderr. -extern TextOutput& aerr; - -typedef TextOutput& (*TextOutputManipFunc)(TextOutput&); - -TextOutput& endl(TextOutput& to); -TextOutput& indent(TextOutput& to); -TextOutput& dedent(TextOutput& to); - -TextOutput& operator<<(TextOutput& to, const char* str); -TextOutput& operator<<(TextOutput& to, char); // writes raw character -TextOutput& operator<<(TextOutput& to, bool); -TextOutput& operator<<(TextOutput& to, int); -TextOutput& operator<<(TextOutput& to, long); -TextOutput& operator<<(TextOutput& to, unsigned int); -TextOutput& operator<<(TextOutput& to, unsigned long); -TextOutput& operator<<(TextOutput& to, long long); -TextOutput& operator<<(TextOutput& to, unsigned long long); -TextOutput& operator<<(TextOutput& to, float); -TextOutput& operator<<(TextOutput& to, double); -TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func); -TextOutput& operator<<(TextOutput& to, const void*); -TextOutput& operator<<(TextOutput& to, const String8& val); -TextOutput& operator<<(TextOutput& to, const String16& val); - -class TypeCode -{ -public: - inline TypeCode(uint32_t code); - inline ~TypeCode(); - - inline uint32_t typeCode() const; - -private: - uint32_t mCode; -}; - -TextOutput& operator<<(TextOutput& to, const TypeCode& val); - -class HexDump -{ -public: - HexDump(const void *buf, size_t size, size_t bytesPerLine=16); - inline ~HexDump(); - - inline HexDump& setBytesPerLine(size_t bytesPerLine); - inline HexDump& setSingleLineCutoff(int32_t bytes); - inline HexDump& setAlignment(size_t alignment); - inline HexDump& setCArrayStyle(bool enabled); - - inline const void* buffer() const; - inline size_t size() const; - inline size_t bytesPerLine() const; - inline int32_t singleLineCutoff() const; - inline size_t alignment() const; - inline bool carrayStyle() const; - -private: - const void* mBuffer; - size_t mSize; - size_t mBytesPerLine; - int32_t mSingleLineCutoff; - size_t mAlignment; - bool mCArrayStyle; -}; - -TextOutput& operator<<(TextOutput& to, const HexDump& val); - -// --------------------------------------------------------------------------- -// No user servicable parts below. - -inline TextOutput& endl(TextOutput& to) -{ - to.print("\n", 1); - return to; -} - -inline TextOutput& indent(TextOutput& to) -{ - to.moveIndent(1); - return to; -} - -inline TextOutput& dedent(TextOutput& to) -{ - to.moveIndent(-1); - return to; -} - -inline TextOutput& operator<<(TextOutput& to, const char* str) -{ - to.print(str, strlen(str)); - return to; -} - -inline TextOutput& operator<<(TextOutput& to, char c) -{ - to.print(&c, 1); - return to; -} - -inline TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func) -{ - return (*func)(to); -} - -inline TypeCode::TypeCode(uint32_t code) : mCode(code) { } -inline TypeCode::~TypeCode() { } -inline uint32_t TypeCode::typeCode() const { return mCode; } - -inline HexDump::~HexDump() { } - -inline HexDump& HexDump::setBytesPerLine(size_t bytesPerLine) { - mBytesPerLine = bytesPerLine; return *this; -} -inline HexDump& HexDump::setSingleLineCutoff(int32_t bytes) { - mSingleLineCutoff = bytes; return *this; -} -inline HexDump& HexDump::setAlignment(size_t alignment) { - mAlignment = alignment; return *this; -} -inline HexDump& HexDump::setCArrayStyle(bool enabled) { - mCArrayStyle = enabled; return *this; -} - -inline const void* HexDump::buffer() const { return mBuffer; } -inline size_t HexDump::size() const { return mSize; } -inline size_t HexDump::bytesPerLine() const { return mBytesPerLine; } -inline int32_t HexDump::singleLineCutoff() const { return mSingleLineCutoff; } -inline size_t HexDump::alignment() const { return mAlignment; } -inline bool HexDump::carrayStyle() const { return mCArrayStyle; } - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_TEXTOUTPUT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/cpustats/CentralTendencyStatistics.h android-platform-frameworks-native-21/include/cpustats/CentralTendencyStatistics.h --- android-platform-frameworks-native-6.0.1+r16/include/cpustats/CentralTendencyStatistics.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/cpustats/CentralTendencyStatistics.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,75 @@ +/* + * 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. + */ + +#ifndef _CENTRAL_TENDENCY_STATISTICS_H +#define _CENTRAL_TENDENCY_STATISTICS_H + +#include + +// Not multithread safe +class CentralTendencyStatistics { + +public: + + CentralTendencyStatistics() : + mMean(NAN), mMedian(NAN), mMinimum(INFINITY), mMaximum(-INFINITY), mN(0), mM2(0), + mVariance(NAN), mVarianceKnownForN(0), mStddev(NAN), mStddevKnownForN(0) { } + + ~CentralTendencyStatistics() { } + + // add x to the set of samples + void sample(double x); + + // return the arithmetic mean of all samples so far + double mean() const { return mMean; } + + // return the minimum of all samples so far + double minimum() const { return mMinimum; } + + // return the maximum of all samples so far + double maximum() const { return mMaximum; } + + // return the variance of all samples so far + double variance() const; + + // return the standard deviation of all samples so far + double stddev() const; + + // return the number of samples added so far + unsigned n() const { return mN; } + + // reset the set of samples to be empty + void reset(); + +private: + double mMean; + double mMedian; + double mMinimum; + double mMaximum; + unsigned mN; // number of samples so far + double mM2; + + // cached variance, and n at time of caching + mutable double mVariance; + mutable unsigned mVarianceKnownForN; + + // cached standard deviation, and n at time of caching + mutable double mStddev; + mutable unsigned mStddevKnownForN; + +}; + +#endif // _CENTRAL_TENDENCY_STATISTICS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/cpustats/README.txt android-platform-frameworks-native-21/include/cpustats/README.txt --- android-platform-frameworks-native-6.0.1+r16/include/cpustats/README.txt 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/cpustats/README.txt 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,6 @@ +This is a static library of CPU usage statistics, originally written +for audio but most are not actually specific to audio. + +Requirements to be here: + * should be related to CPU usage statistics + * should be portable to host; avoid Android OS dependencies without a conditional diff -Nru android-platform-frameworks-native-6.0.1+r16/include/cpustats/ThreadCpuUsage.h android-platform-frameworks-native-21/include/cpustats/ThreadCpuUsage.h --- android-platform-frameworks-native-6.0.1+r16/include/cpustats/ThreadCpuUsage.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/cpustats/ThreadCpuUsage.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,140 @@ +/* + * 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. + */ + +#ifndef _THREAD_CPU_USAGE_H +#define _THREAD_CPU_USAGE_H + +#include +#include + +namespace android { + +// Track CPU usage for the current thread. +// Units are in per-thread CPU ns, as reported by +// clock_gettime(CLOCK_THREAD_CPUTIME_ID). Simple usage: for cyclic +// threads where you want to measure the execution time of the whole +// cycle, just call sampleAndEnable() at the start of each cycle. +// For acyclic threads, or for cyclic threads where you want to measure/track +// only part of each cycle, call enable(), disable(), and/or setEnabled() +// to demarcate the region(s) of interest, and then call sample() periodically. +// This class is not thread-safe for concurrent calls from multiple threads; +// the methods of this class may only be called by the current thread +// which constructed the object. + +class ThreadCpuUsage +{ + +public: + ThreadCpuUsage() : + mIsEnabled(false), + mWasEverEnabled(false), + mAccumulator(0), + // mPreviousTs + // mMonotonicTs + mMonotonicKnown(false) + { + (void) pthread_once(&sOnceControl, &init); + for (int i = 0; i < sKernelMax; ++i) { + mCurrentkHz[i] = (uint32_t) ~0; // unknown + } + } + + ~ThreadCpuUsage() { } + + // Return whether currently tracking CPU usage by current thread + bool isEnabled() const { return mIsEnabled; } + + // Enable tracking of CPU usage by current thread; + // any CPU used from this point forward will be tracked. + // Returns the previous enabled status. + bool enable() { return setEnabled(true); } + + // Disable tracking of CPU usage by current thread; + // any CPU used from this point forward will be ignored. + // Returns the previous enabled status. + bool disable() { return setEnabled(false); } + + // Set the enabled status and return the previous enabled status. + // This method is intended to be used for safe nested enable/disabling. + bool setEnabled(bool isEnabled); + + // Add a sample point, and also enable tracking if needed. + // If tracking has never been enabled, then this call enables tracking but + // does _not_ add a sample -- it is not possible to add a sample the + // first time because there is no previous point to subtract from. + // Otherwise, if tracking is enabled, + // then adds a sample for tracked CPU ns since the previous + // sample, or since the first call to sampleAndEnable(), enable(), or + // setEnabled(true). If there was a previous sample but tracking is + // now disabled, then adds a sample for the tracked CPU ns accumulated + // up until the most recent disable(), resets this accumulator, and then + // enables tracking. Calling this method rather than enable() followed + // by sample() avoids a race condition for the first sample. + // Returns true if the sample 'ns' is valid, or false if invalid. + // Note that 'ns' is an output parameter passed by reference. + // The caller does not need to initialize this variable. + // The units are CPU nanoseconds consumed by current thread. + bool sampleAndEnable(double& ns); + + // Add a sample point, but do not + // change the tracking enabled status. If tracking has either never been + // enabled, or has never been enabled since the last sample, then log a warning + // and don't add sample. Otherwise, adds a sample for tracked CPU ns since + // the previous sample or since the first call to sampleAndEnable(), + // enable(), or setEnabled(true) if no previous sample. + // Returns true if the sample is valid, or false if invalid. + // Note that 'ns' is an output parameter passed by reference. + // The caller does not need to initialize this variable. + // The units are CPU nanoseconds consumed by current thread. + bool sample(double& ns); + + // Return the elapsed delta wall clock ns since initial enable or reset, + // as reported by clock_gettime(CLOCK_MONOTONIC). + long long elapsed() const; + + // Reset elapsed wall clock. Has no effect on tracking or accumulator. + void resetElapsed(); + + // Return current clock frequency for specified CPU, in kHz. + // You can get your CPU number using sched_getcpu(2). Note that, unless CPU affinity + // has been configured appropriately, the CPU number can change. + // Also note that, unless the CPU governor has been configured appropriately, + // the CPU frequency can change. And even if the CPU frequency is locked down + // to a particular value, that the frequency might still be adjusted + // to prevent thermal overload. Therefore you should poll for your thread's + // current CPU number and clock frequency periodically. + uint32_t getCpukHz(int cpuNum); + +private: + bool mIsEnabled; // whether tracking is currently enabled + bool mWasEverEnabled; // whether tracking was ever enabled + long long mAccumulator; // accumulated thread CPU time since last sample, in ns + struct timespec mPreviousTs; // most recent thread CPU time, valid only if mIsEnabled is true + struct timespec mMonotonicTs; // most recent monotonic time + bool mMonotonicKnown; // whether mMonotonicTs has been set + + static const int MAX_CPU = 8; + static int sScalingFds[MAX_CPU];// file descriptor per CPU for reading scaling_cur_freq + uint32_t mCurrentkHz[MAX_CPU]; // current CPU frequency in kHz, not static to avoid a race + static pthread_once_t sOnceControl; + static int sKernelMax; // like MAX_CPU, but determined at runtime == cpu/kernel_max + 1 + static void init(); // called once at first ThreadCpuUsage construction + static pthread_mutex_t sMutex; // protects sScalingFds[] after initialization +}; + +} // namespace android + +#endif // _THREAD_CPU_USAGE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/diskusage/dirsize.h android-platform-frameworks-native-21/include/diskusage/dirsize.h --- android-platform-frameworks-native-6.0.1+r16/include/diskusage/dirsize.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/diskusage/dirsize.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -/* - * - * Copyright (C) 2010 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. - */ - -#ifndef __LIBDISKUSAGE_DIRSIZE_H -#define __LIBDISKUSAGE_DIRSIZE_H - -#include - -__BEGIN_DECLS - -int64_t stat_size(struct stat *s); -int64_t calculate_dir_size(int dfd); - -__END_DECLS - -#endif /* __LIBDISKUSAGE_DIRSIZE_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BitTube.h android-platform-frameworks-native-21/include/gui/BitTube.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BitTube.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BitTube.h 2012-10-16 22:57:11.000000000 +0000 @@ -33,52 +33,30 @@ { public: - // creates a BitTube with a default (4KB) send buffer - BitTube(); - - // creates a BitTube with a a specified send and receive buffer size - explicit BitTube(size_t bufsize); - - explicit BitTube(const Parcel& data); + BitTube(); + BitTube(const Parcel& data); virtual ~BitTube(); - // check state after construction status_t initCheck() const; - - // get receive file-descriptor int getFd() const; + ssize_t write(void const* vaddr, size_t size); + ssize_t read(void* vaddr, size_t size); - // get the send file-descriptor. - int getSendFd() const; + status_t writeToParcel(Parcel* reply) const; - // send objects (sized blobs). All objects are guaranteed to be written or the call fails. template static ssize_t sendObjects(const sp& tube, T const* events, size_t count) { return sendObjects(tube, events, count, sizeof(T)); } - // receive objects (sized blobs). If the receiving buffer isn't large enough, - // excess messages are silently discarded. template static ssize_t recvObjects(const sp& tube, T* events, size_t count) { return recvObjects(tube, events, count, sizeof(T)); } - // parcels this BitTube - status_t writeToParcel(Parcel* reply) const; - private: - void init(size_t rcvbuf, size_t sndbuf); - - // send a message. The write is guaranteed to send the whole message or fail. - ssize_t write(void const* vaddr, size_t size); - - // receive a message. the passed buffer must be at least as large as the - // write call used to send the message, excess data is silently discarded. - ssize_t read(void* vaddr, size_t size); - int mSendFd; mutable int mReceiveFd; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferItemConsumer.h android-platform-frameworks-native-21/include/gui/BufferItemConsumer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferItemConsumer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferItemConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_GUI_BUFFERITEMCONSUMER_H -#define ANDROID_GUI_BUFFERITEMCONSUMER_H - -#include - -#include - -#include -#include -#include - -#define ANDROID_GRAPHICS_BUFFERITEMCONSUMER_JNI_ID "mBufferItemConsumer" - -namespace android { - -class BufferQueue; - -/** - * BufferItemConsumer is a BufferQueue consumer endpoint that allows clients - * access to the whole BufferItem entry from BufferQueue. Multiple buffers may - * be acquired at once, to be used concurrently by the client. This consumer can - * operate either in synchronous or asynchronous mode. - */ -class BufferItemConsumer: public ConsumerBase -{ - public: - typedef ConsumerBase::FrameAvailableListener FrameAvailableListener; - - enum { DEFAULT_MAX_BUFFERS = -1 }; - enum { INVALID_BUFFER_SLOT = BufferQueue::INVALID_BUFFER_SLOT }; - enum { NO_BUFFER_AVAILABLE = BufferQueue::NO_BUFFER_AVAILABLE }; - - // Create a new buffer item consumer. The consumerUsage parameter determines - // the consumer usage flags passed to the graphics allocator. The - // bufferCount parameter specifies how many buffers can be locked for user - // access at the same time. - // controlledByApp tells whether this consumer is controlled by the - // application. - BufferItemConsumer(const sp& consumer, - uint32_t consumerUsage, int bufferCount = DEFAULT_MAX_BUFFERS, - bool controlledByApp = false); - - virtual ~BufferItemConsumer(); - - // set the name of the BufferItemConsumer that will be used to identify it in - // log messages. - void setName(const String8& name); - - // Gets the next graphics buffer from the producer, filling out the - // passed-in BufferItem structure. Returns NO_BUFFER_AVAILABLE if the queue - // of buffers is empty, and INVALID_OPERATION if the maximum number of - // buffers is already acquired. - // - // Only a fixed number of buffers can be acquired at a time, determined by - // the construction-time bufferCount parameter. If INVALID_OPERATION is - // returned by acquireBuffer, then old buffers must be returned to the - // queue by calling releaseBuffer before more buffers can be acquired. - // - // If waitForFence is true, and the acquired BufferItem has a valid fence object, - // acquireBuffer will wait on the fence with no timeout before returning. - status_t acquireBuffer(BufferItem* item, nsecs_t presentWhen, - bool waitForFence = true); - - // Returns an acquired buffer to the queue, allowing it to be reused. Since - // only a fixed number of buffers may be acquired at a time, old buffers - // must be released by calling releaseBuffer to ensure new buffers can be - // acquired by acquireBuffer. Once a BufferItem is released, the caller must - // not access any members of the BufferItem, and should immediately remove - // all of its references to the BufferItem itself. - status_t releaseBuffer(const BufferItem &item, - const sp& releaseFence = Fence::NO_FENCE); - -}; - -} // namespace android - -#endif // ANDROID_GUI_CPUCONSUMER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferItem.h android-platform-frameworks-native-21/include/gui/BufferItem.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferItem.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferItem.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_BUFFERITEM_H -#define ANDROID_GUI_BUFFERITEM_H - -#include -#include - -#include -#include - -#include - -#include -#include - -namespace android { - -class Fence; -class GraphicBuffer; - -class BufferItem : public Flattenable { - friend class Flattenable; - size_t getPodSize() const; - size_t getFlattenedSize() const; - size_t getFdCount() const; - status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const; - status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count); - - public: - // The default value of mBuf, used to indicate this doesn't correspond to a slot. - enum { INVALID_BUFFER_SLOT = -1 }; - BufferItem(); - ~BufferItem(); - - static const char* scalingModeName(uint32_t scalingMode); - - // mGraphicBuffer points to the buffer allocated for this slot, or is NULL - // if the buffer in this slot has been acquired in the past (see - // BufferSlot.mAcquireCalled). - sp mGraphicBuffer; - - // mFence is a fence that will signal when the buffer is idle. - sp mFence; - - // mCrop is the current crop rectangle for this buffer slot. - Rect mCrop; - - // mTransform is the current transform flags for this buffer slot. - // refer to NATIVE_WINDOW_TRANSFORM_* in - uint32_t mTransform; - - // mScalingMode is the current scaling mode for this buffer slot. - // refer to NATIVE_WINDOW_SCALING_* in - uint32_t mScalingMode; - - // mTimestamp is the current timestamp for this buffer slot. This gets - // to set by queueBuffer each time this slot is queued. This value - // is guaranteed to be monotonically increasing for each newly - // acquired buffer. - union { - int64_t mTimestamp; - struct { - uint32_t mTimestampLo; - uint32_t mTimestampHi; - }; - }; - - // mIsAutoTimestamp indicates whether mTimestamp was generated - // automatically when the buffer was queued. - bool mIsAutoTimestamp; - - // mDataSpace is the current dataSpace value for this buffer slot. This gets - // set by queueBuffer each time this slot is queued. The meaning of the - // dataSpace is format-dependent. - android_dataspace mDataSpace; - - // mFrameNumber is the number of the queued frame for this slot. - union { - uint64_t mFrameNumber; - struct { - uint32_t mFrameNumberLo; - uint32_t mFrameNumberHi; - }; - }; - - union { - // mSlot is the slot index of this buffer (default INVALID_BUFFER_SLOT). - int mSlot; - - // mBuf is the former name for mSlot - int mBuf; - }; - - // mIsDroppable whether this buffer was queued with the - // property that it can be replaced by a new buffer for the purpose of - // making sure dequeueBuffer() won't block. - // i.e.: was the BufferQueue in "mDequeueBufferCannotBlock" when this buffer - // was queued. - bool mIsDroppable; - - // Indicates whether this buffer has been seen by a consumer yet - bool mAcquireCalled; - - // Indicates this buffer must be transformed by the inverse transform of the screen - // it is displayed onto. This is applied after mTransform. - bool mTransformToDisplayInverse; - - // Describes the portion of the surface that has been modified since the - // previous frame - Region mSurfaceDamage; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueConsumer.h android-platform-frameworks-native-21/include/gui/BufferQueueConsumer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueConsumer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferQueueConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,187 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_BUFFERQUEUECONSUMER_H -#define ANDROID_GUI_BUFFERQUEUECONSUMER_H - -#include -#include - -#include -#include - -namespace android { - -class BufferQueueCore; - -class BufferQueueConsumer : public BnGraphicBufferConsumer { - -public: - BufferQueueConsumer(const sp& core); - virtual ~BufferQueueConsumer(); - - // acquireBuffer attempts to acquire ownership of the next pending buffer in - // the BufferQueue. If no buffer is pending then it returns - // NO_BUFFER_AVAILABLE. If a buffer is successfully acquired, the - // information about the buffer is returned in BufferItem. If the buffer - // returned had previously been acquired then the BufferItem::mGraphicBuffer - // field of buffer is set to NULL and it is assumed that the consumer still - // holds a reference to the buffer. - // - // If expectedPresent is nonzero, it indicates the time when the buffer - // will be displayed on screen. If the buffer's timestamp is farther in the - // future, the buffer won't be acquired, and PRESENT_LATER will be - // returned. The presentation time is in nanoseconds, and the time base - // is CLOCK_MONOTONIC. - virtual status_t acquireBuffer(BufferItem* outBuffer, - nsecs_t expectedPresent, uint64_t maxFrameNumber = 0) override; - - // See IGraphicBufferConsumer::detachBuffer - virtual status_t detachBuffer(int slot); - - // See IGraphicBufferConsumer::attachBuffer - virtual status_t attachBuffer(int* slot, const sp& buffer); - - // releaseBuffer releases a buffer slot from the consumer back to the - // BufferQueue. This may be done while the buffer's contents are still - // being accessed. The fence will signal when the buffer is no longer - // in use. frameNumber is used to indentify the exact buffer returned. - // - // If releaseBuffer returns STALE_BUFFER_SLOT, then the consumer must free - // any references to the just-released buffer that it might have, as if it - // had received a onBuffersReleased() call with a mask set for the released - // buffer. - // - // Note that the dependencies on EGL will be removed once we switch to using - // the Android HW Sync HAL. - virtual status_t releaseBuffer(int slot, uint64_t frameNumber, - const sp& releaseFence, EGLDisplay display, - EGLSyncKHR fence); - - // connect connects a consumer to the BufferQueue. Only one - // consumer may be connected, and when that consumer disconnects the - // BufferQueue is placed into the "abandoned" state, causing most - // interactions with the BufferQueue by the producer to fail. - // controlledByApp indicates whether the consumer is controlled by - // the application. - // - // consumerListener may not be NULL. - virtual status_t connect(const sp& consumerListener, - bool controlledByApp); - - // disconnect disconnects a consumer from the BufferQueue. All - // buffers will be freed and the BufferQueue is placed in the "abandoned" - // state, causing most interactions with the BufferQueue by the producer to - // fail. - virtual status_t disconnect(); - - // getReleasedBuffers sets the value pointed to by outSlotMask to a bit mask - // indicating which buffer slots have been released by the BufferQueue - // but have not yet been released by the consumer. - // - // This should be called from the onBuffersReleased() callback. - virtual status_t getReleasedBuffers(uint64_t* outSlotMask); - - // setDefaultBufferSize is used to set the size of buffers returned by - // dequeueBuffer when a width and height of zero is requested. Default - // is 1x1. - virtual status_t setDefaultBufferSize(uint32_t width, uint32_t height); - - // setDefaultMaxBufferCount sets the default value for the maximum buffer - // count (the initial default is 2). If the producer has requested a - // buffer count using setBufferCount, the default buffer count will only - // take effect if the producer sets the count back to zero. - // - // The count must be between 2 and NUM_BUFFER_SLOTS, inclusive. - virtual status_t setDefaultMaxBufferCount(int bufferCount); - - // disableAsyncBuffer disables the extra buffer used in async mode - // (when both producer and consumer have set their "isControlledByApp" - // flag) and has dequeueBuffer() return WOULD_BLOCK instead. - // - // This can only be called before connect(). - virtual status_t disableAsyncBuffer(); - - // setMaxAcquiredBufferCount sets the maximum number of buffers that can - // be acquired by the consumer at one time (default 1). This call will - // fail if a producer is connected to the BufferQueue. - virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers); - - // setConsumerName sets the name used in logging - virtual void setConsumerName(const String8& name); - - // setDefaultBufferFormat allows the BufferQueue to create - // GraphicBuffers of a defaultFormat if no format is specified - // in dequeueBuffer. The initial default is HAL_PIXEL_FORMAT_RGBA_8888. - virtual status_t setDefaultBufferFormat(PixelFormat defaultFormat); - - // setDefaultBufferDataSpace allows the BufferQueue to create - // GraphicBuffers of a defaultDataSpace if no data space is specified - // in queueBuffer. - // The initial default is HAL_DATASPACE_UNKNOWN - virtual status_t setDefaultBufferDataSpace( - android_dataspace defaultDataSpace); - - // setConsumerUsageBits will turn on additional usage bits for dequeueBuffer. - // These are merged with the bits passed to dequeueBuffer. The values are - // enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER; the default is 0. - virtual status_t setConsumerUsageBits(uint32_t usage); - - // setTransformHint bakes in rotation to buffers so overlays can be used. - // The values are enumerated in window.h, e.g. - // NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0 (no transform). - virtual status_t setTransformHint(uint32_t hint); - - // Retrieve the sideband buffer stream, if any. - virtual sp getSidebandStream() const; - - // dump our state in a String - virtual void dump(String8& result, const char* prefix) const; - - // Functions required for backwards compatibility. - // These will be modified/renamed in IGraphicBufferConsumer and will be - // removed from this class at that time. See b/13306289. - - virtual status_t releaseBuffer(int buf, uint64_t frameNumber, - EGLDisplay display, EGLSyncKHR fence, - const sp& releaseFence) { - return releaseBuffer(buf, frameNumber, releaseFence, display, fence); - } - - virtual status_t consumerConnect(const sp& consumer, - bool controlledByApp) { - return connect(consumer, controlledByApp); - } - - virtual status_t consumerDisconnect() { return disconnect(); } - - // End functions required for backwards compatibility - -private: - sp mCore; - - // This references mCore->mSlots. Lock mCore->mMutex while accessing. - BufferQueueDefs::SlotsType& mSlots; - - // This is a cached copy of the name stored in the BufferQueueCore. - // It's updated during setConsumerName. - String8 mConsumerName; - -}; // class BufferQueueConsumer - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueCore.h android-platform-frameworks-native-21/include/gui/BufferQueueCore.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueCore.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferQueueCore.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,287 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_BUFFERQUEUECORE_H -#define ANDROID_GUI_BUFFERQUEUECORE_H - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -#define BQ_LOGV(x, ...) ALOGV("[%s] " x, mConsumerName.string(), ##__VA_ARGS__) -#define BQ_LOGD(x, ...) ALOGD("[%s] " x, mConsumerName.string(), ##__VA_ARGS__) -#define BQ_LOGI(x, ...) ALOGI("[%s] " x, mConsumerName.string(), ##__VA_ARGS__) -#define BQ_LOGW(x, ...) ALOGW("[%s] " x, mConsumerName.string(), ##__VA_ARGS__) -#define BQ_LOGE(x, ...) ALOGE("[%s] " x, mConsumerName.string(), ##__VA_ARGS__) - -#define ATRACE_BUFFER_INDEX(index) \ - if (ATRACE_ENABLED()) { \ - char ___traceBuf[1024]; \ - snprintf(___traceBuf, 1024, "%s: %d", \ - mCore->mConsumerName.string(), (index)); \ - android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); \ - } - -namespace android { - -class IConsumerListener; -class IGraphicBufferAlloc; -class IProducerListener; - -class BufferQueueCore : public virtual RefBase { - - friend class BufferQueueProducer; - friend class BufferQueueConsumer; - -public: - // Used as a placeholder slot number when the value isn't pointing to an - // existing buffer. - enum { INVALID_BUFFER_SLOT = BufferItem::INVALID_BUFFER_SLOT }; - - // We reserve two slots in order to guarantee that the producer and - // consumer can run asynchronously. - enum { MAX_MAX_ACQUIRED_BUFFERS = BufferQueueDefs::NUM_BUFFER_SLOTS - 2 }; - - // The default API number used to indicate that no producer is connected - enum { NO_CONNECTED_API = 0 }; - - typedef Vector Fifo; - - // BufferQueueCore manages a pool of gralloc memory slots to be used by - // producers and consumers. allocator is used to allocate all the needed - // gralloc buffers. - BufferQueueCore(const sp& allocator = NULL); - virtual ~BufferQueueCore(); - -private: - // Dump our state in a string - void dump(String8& result, const char* prefix) const; - - // getMinUndequeuedBufferCountLocked returns the minimum number of buffers - // that must remain in a state other than DEQUEUED. The async parameter - // tells whether we're in asynchronous mode. - int getMinUndequeuedBufferCountLocked(bool async) const; - - // getMinMaxBufferCountLocked returns the minimum number of buffers allowed - // given the current BufferQueue state. The async parameter tells whether - // we're in asynchonous mode. - int getMinMaxBufferCountLocked(bool async) const; - - // getMaxBufferCountLocked returns the maximum number of buffers that can be - // allocated at once. This value depends on the following member variables: - // - // mDequeueBufferCannotBlock - // mMaxAcquiredBufferCount - // mDefaultMaxBufferCount - // mOverrideMaxBufferCount - // async parameter - // - // Any time one of these member variables is changed while a producer is - // connected, mDequeueCondition must be broadcast. - int getMaxBufferCountLocked(bool async) const; - - // setDefaultMaxBufferCountLocked sets the maximum number of buffer slots - // that will be used if the producer does not override the buffer slot - // count. The count must be between 2 and NUM_BUFFER_SLOTS, inclusive. The - // initial default is 2. - status_t setDefaultMaxBufferCountLocked(int count); - - // freeBufferLocked frees the GraphicBuffer and sync resources for the - // given slot. - void freeBufferLocked(int slot); - - // freeAllBuffersLocked frees the GraphicBuffer and sync resources for - // all slots. - void freeAllBuffersLocked(); - - // stillTracking returns true iff the buffer item is still being tracked - // in one of the slots. - bool stillTracking(const BufferItem* item) const; - - // waitWhileAllocatingLocked blocks until mIsAllocating is false. - void waitWhileAllocatingLocked() const; - - // validateConsistencyLocked ensures that the free lists are in sync with - // the information stored in mSlots - void validateConsistencyLocked() const; - - // mAllocator is the connection to SurfaceFlinger that is used to allocate - // new GraphicBuffer objects. - sp mAllocator; - - // mMutex is the mutex used to prevent concurrent access to the member - // variables of BufferQueueCore objects. It must be locked whenever any - // member variable is accessed. - mutable Mutex mMutex; - - // mIsAbandoned indicates that the BufferQueue will no longer be used to - // consume image buffers pushed to it using the IGraphicBufferProducer - // interface. It is initialized to false, and set to true in the - // consumerDisconnect method. A BufferQueue that is abandoned will return - // the NO_INIT error from all IGraphicBufferProducer methods capable of - // returning an error. - bool mIsAbandoned; - - // mConsumerControlledByApp indicates whether the connected consumer is - // controlled by the application. - bool mConsumerControlledByApp; - - // mConsumerName is a string used to identify the BufferQueue in log - // messages. It is set by the IGraphicBufferConsumer::setConsumerName - // method. - String8 mConsumerName; - - // mConsumerListener is used to notify the connected consumer of - // asynchronous events that it may wish to react to. It is initially - // set to NULL and is written by consumerConnect and consumerDisconnect. - sp mConsumerListener; - - // mConsumerUsageBits contains flags that the consumer wants for - // GraphicBuffers. - uint32_t mConsumerUsageBits; - - // mConnectedApi indicates the producer API that is currently connected - // to this BufferQueue. It defaults to NO_CONNECTED_API, and gets updated - // by the connect and disconnect methods. - int mConnectedApi; - - // mConnectedProducerToken is used to set a binder death notification on - // the producer. - sp mConnectedProducerListener; - - // mSlots is an array of buffer slots that must be mirrored on the producer - // side. This allows buffer ownership to be transferred between the producer - // and consumer without sending a GraphicBuffer over Binder. The entire - // array is initialized to NULL at construction time, and buffers are - // allocated for a slot when requestBuffer is called with that slot's index. - BufferQueueDefs::SlotsType mSlots; - - // mQueue is a FIFO of queued buffers used in synchronous mode. - Fifo mQueue; - - // mFreeSlots contains all of the slots which are FREE and do not currently - // have a buffer attached - std::set mFreeSlots; - - // mFreeBuffers contains all of the slots which are FREE and currently have - // a buffer attached - std::list mFreeBuffers; - - // mOverrideMaxBufferCount is the limit on the number of buffers that will - // be allocated at one time. This value is set by the producer by calling - // setBufferCount. The default is 0, which means that the producer doesn't - // care about the number of buffers in the pool. In that case, - // mDefaultMaxBufferCount is used as the limit. - int mOverrideMaxBufferCount; - - // mDequeueCondition is a condition variable used for dequeueBuffer in - // synchronous mode. - mutable Condition mDequeueCondition; - - // mUseAsyncBuffer indicates whether an extra buffer is used in async mode - // to prevent dequeueBuffer from blocking. - bool mUseAsyncBuffer; - - // mDequeueBufferCannotBlock indicates whether dequeueBuffer is allowed to - // block. This flag is set during connect when both the producer and - // consumer are controlled by the application. - bool mDequeueBufferCannotBlock; - - // mDefaultBufferFormat can be set so it will override the buffer format - // when it isn't specified in dequeueBuffer. - PixelFormat mDefaultBufferFormat; - - // mDefaultWidth holds the default width of allocated buffers. It is used - // in dequeueBuffer if a width and height of 0 are specified. - uint32_t mDefaultWidth; - - // mDefaultHeight holds the default height of allocated buffers. It is used - // in dequeueBuffer if a width and height of 0 are specified. - uint32_t mDefaultHeight; - - // mDefaultBufferDataSpace holds the default dataSpace of queued buffers. - // It is used in queueBuffer if a dataspace of 0 (HAL_DATASPACE_UNKNOWN) - // is specified. - android_dataspace mDefaultBufferDataSpace; - - // mDefaultMaxBufferCount is the default limit on the number of buffers that - // will be allocated at one time. This default limit is set by the consumer. - // The limit (as opposed to the default limit) may be overriden by the - // producer. - int mDefaultMaxBufferCount; - - // mMaxAcquiredBufferCount is the number of buffers that the consumer may - // acquire at one time. It defaults to 1, and can be changed by the consumer - // via setMaxAcquiredBufferCount, but this may only be done while no - // producer is connected to the BufferQueue. This value is used to derive - // the value returned for the MIN_UNDEQUEUED_BUFFERS query to the producer. - int mMaxAcquiredBufferCount; - - // mBufferHasBeenQueued is true once a buffer has been queued. It is reset - // when something causes all buffers to be freed (e.g., changing the buffer - // count). - bool mBufferHasBeenQueued; - - // mFrameCounter is the free running counter, incremented on every - // successful queueBuffer call and buffer allocation. - uint64_t mFrameCounter; - - // mTransformHint is used to optimize for screen rotations. - uint32_t mTransformHint; - - // mSidebandStream is a handle to the sideband buffer stream, if any - sp mSidebandStream; - - // mIsAllocating indicates whether a producer is currently trying to allocate buffers (which - // releases mMutex while doing the allocation proper). Producers should not modify any of the - // FREE slots while this is true. mIsAllocatingCondition is signaled when this value changes to - // false. - bool mIsAllocating; - - // mIsAllocatingCondition is a condition variable used by producers to wait until mIsAllocating - // becomes false. - mutable Condition mIsAllocatingCondition; - - // mAllowAllocation determines whether dequeueBuffer is allowed to allocate - // new buffers - bool mAllowAllocation; - - // mBufferAge tracks the age of the contents of the most recently dequeued - // buffer as the number of frames that have elapsed since it was last queued - uint64_t mBufferAge; - - // mGenerationNumber stores the current generation number of the attached - // producer. Any attempt to attach a buffer with a different generation - // number will fail. - uint32_t mGenerationNumber; - -}; // class BufferQueueCore - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueDefs.h android-platform-frameworks-native-21/include/gui/BufferQueueDefs.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueDefs.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferQueueDefs.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,35 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_BUFFERQUEUECOREDEFS_H -#define ANDROID_GUI_BUFFERQUEUECOREDEFS_H - -#include - -namespace android { - class BufferQueueCore; - - namespace BufferQueueDefs { - // BufferQueue will keep track of at most this value of buffers. - // Attempts at runtime to increase the number of buffers past this - // will fail. - enum { NUM_BUFFER_SLOTS = 64 }; - - typedef BufferSlot SlotsType[NUM_BUFFER_SLOTS]; - } // namespace BufferQueueDefs -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueue.h android-platform-frameworks-native-21/include/gui/BufferQueue.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueue.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferQueue.h 2012-10-16 22:57:11.000000000 +0000 @@ -17,37 +17,54 @@ #ifndef ANDROID_GUI_BUFFERQUEUE_H #define ANDROID_GUI_BUFFERQUEUE_H -#include -#include -#include -#include -#include +#include +#include -// These are only required to keep other parts of the framework with incomplete -// dependencies building successfully #include +#include + +#include + +#include +#include +#include namespace android { +// ---------------------------------------------------------------------------- -class BufferQueue { +class BufferQueue : public BnSurfaceTexture { public: - // BufferQueue will keep track of at most this value of buffers. - // Attempts at runtime to increase the number of buffers past this will fail. - enum { NUM_BUFFER_SLOTS = BufferQueueDefs::NUM_BUFFER_SLOTS }; - // Used as a placeholder slot# when the value isn't pointing to an existing buffer. - enum { INVALID_BUFFER_SLOT = BufferItem::INVALID_BUFFER_SLOT }; - // Alias to -- please scope from there in future code! - enum { - NO_BUFFER_AVAILABLE = IGraphicBufferConsumer::NO_BUFFER_AVAILABLE, - PRESENT_LATER = IGraphicBufferConsumer::PRESENT_LATER, - }; + enum { MIN_UNDEQUEUED_BUFFERS = 2 }; + enum { NUM_BUFFER_SLOTS = 32 }; + enum { NO_CONNECTED_API = 0 }; + enum { INVALID_BUFFER_SLOT = -1 }; + enum { STALE_BUFFER_SLOT = 1, NO_BUFFER_AVAILABLE }; - // When in async mode we reserve two slots in order to guarantee that the - // producer and consumer can run asynchronously. - enum { MAX_MAX_ACQUIRED_BUFFERS = NUM_BUFFER_SLOTS - 2 }; + // ConsumerListener is the interface through which the BufferQueue notifies + // the consumer of events that the consumer may wish to react to. Because + // the consumer will generally have a mutex that is locked during calls from + // teh consumer to the BufferQueue, these calls from the BufferQueue to the + // consumer *MUST* be called only when the BufferQueue mutex is NOT locked. + struct ConsumerListener : public virtual RefBase { + // onFrameAvailable is called from queueBuffer each time an additional + // frame becomes available for consumption. This means that frames that + // are queued while in asynchronous mode only trigger the callback if no + // previous frames are pending. Frames queued while in synchronous mode + // always trigger the callback. + // + // This is called without any lock held and can be called concurrently + // by multiple threads. + virtual void onFrameAvailable() = 0; - // for backward source compatibility - typedef ::android::ConsumerListener ConsumerListener; + // onBuffersReleased is called to notify the buffer consumer that the + // BufferQueue has released its references to one or more GraphicBuffers + // contained in its slots. The buffer consumer should then call + // BufferQueue::getReleasedBuffers to retrieve the list of buffers + // + // This is called without any lock held and can be called concurrently + // by multiple threads. + virtual void onBuffersReleased() = 0; + }; // ProxyConsumerListener is a ConsumerListener implementation that keeps a weak // reference to the actual consumer object. It forwards all calls to that @@ -58,29 +75,413 @@ // reference in the BufferQueue class is because we're planning to expose the // consumer side of a BufferQueue as a binder interface, which doesn't support // weak references. - class ProxyConsumerListener : public BnConsumerListener { + class ProxyConsumerListener : public BufferQueue::ConsumerListener { public: - ProxyConsumerListener(const wp& consumerListener); + + ProxyConsumerListener(const wp& consumerListener); virtual ~ProxyConsumerListener(); - virtual void onFrameAvailable(const BufferItem& item) override; - virtual void onFrameReplaced(const BufferItem& item) override; - virtual void onBuffersReleased() override; - virtual void onSidebandStreamChanged() override; + virtual void onFrameAvailable(); + virtual void onBuffersReleased(); + private: - // mConsumerListener is a weak reference to the IConsumerListener. This is + + // mConsumerListener is a weak reference to the ConsumerListener. This is // the raison d'etre of ProxyConsumerListener. - wp mConsumerListener; + wp mConsumerListener; }; - // BufferQueue manages a pool of gralloc memory slots to be used by - // producers and consumers. allocator is used to allocate all the - // needed gralloc buffers. - static void createBufferQueue(sp* outProducer, - sp* outConsumer, - const sp& allocator = NULL); + + // BufferQueue manages a pool of gralloc memory slots to be used + // by producers and consumers. + // allowSynchronousMode specifies whether or not synchronous mode can be + // enabled. + // bufferCount sets the minimum number of undequeued buffers for this queue + BufferQueue( bool allowSynchronousMode = true, int bufferCount = MIN_UNDEQUEUED_BUFFERS); + virtual ~BufferQueue(); + + virtual int query(int what, int* value); + + // setBufferCount updates the number of available buffer slots. After + // calling this all buffer slots are both unallocated and owned by the + // BufferQueue object (i.e. they are not owned by the client). + virtual status_t setBufferCount(int bufferCount); + + virtual status_t requestBuffer(int slot, sp* buf); + + // dequeueBuffer gets the next buffer slot index for the client to use. If a + // buffer slot is available then that slot index is written to the location + // pointed to by the buf argument and a status of OK is returned. If no + // slot is available then a status of -EBUSY is returned and buf is + // unmodified. + // The width and height parameters must be no greater than the minimum of + // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). + // An error due to invalid dimensions might not be reported until + // updateTexImage() is called. + virtual status_t dequeueBuffer(int *buf, uint32_t width, uint32_t height, + uint32_t format, uint32_t usage); + + // queueBuffer returns a filled buffer to the BufferQueue. In addition, a + // timestamp must be provided for the buffer. The timestamp is in + // nanoseconds, and must be monotonically increasing. Its other semantics + // (zero point, etc) are client-dependent and should be documented by the + // client. + virtual status_t queueBuffer(int buf, + const QueueBufferInput& input, QueueBufferOutput* output); + + virtual void cancelBuffer(int buf); + + // setSynchronousMode set whether dequeueBuffer is synchronous or + // asynchronous. In synchronous mode, dequeueBuffer blocks until + // a buffer is available, the currently bound buffer can be dequeued and + // queued buffers will be retired in order. + // The default mode is asynchronous. + virtual status_t setSynchronousMode(bool enabled); + + // connect attempts to connect a producer client API to the BufferQueue. + // This must be called before any other ISurfaceTexture methods are called + // except for getAllocator. + // + // This method will fail if the connect was previously called on the + // BufferQueue and no corresponding disconnect call was made. + virtual status_t connect(int api, QueueBufferOutput* output); + + // disconnect attempts to disconnect a producer client API from the + // BufferQueue. Calling this method will cause any subsequent calls to other + // ISurfaceTexture methods to fail except for getAllocator and connect. + // Successfully calling connect after this will allow the other methods to + // succeed again. + // + // This method will fail if the the BufferQueue is not currently + // connected to the specified client API. + virtual status_t disconnect(int api); + + // dump our state in a String + virtual void dump(String8& result) const; + virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; + + // public facing structure for BufferSlot + struct BufferItem { + + BufferItem() + : + mTransform(0), + mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), + mTimestamp(0), + mFrameNumber(0), + mBuf(INVALID_BUFFER_SLOT) { + mCrop.makeInvalid(); + } + // mGraphicBuffer points to the buffer allocated for this slot or is NULL + // if no buffer has been allocated. + sp mGraphicBuffer; + + // mCrop is the current crop rectangle for this buffer slot. + Rect mCrop; + + // mTransform is the current transform flags for this buffer slot. + uint32_t mTransform; + + // mScalingMode is the current scaling mode for this buffer slot. + uint32_t mScalingMode; + + // mTimestamp is the current timestamp for this buffer slot. This gets + // to set by queueBuffer each time this slot is queued. + int64_t mTimestamp; + + // mFrameNumber is the number of the queued frame for this slot. + uint64_t mFrameNumber; + + // mBuf is the slot index of this buffer + int mBuf; + }; + + // The following public functions is the consumer facing interface + + // acquireBuffer attempts to acquire ownership of the next pending buffer in + // the BufferQueue. If no buffer is pending then it returns -EINVAL. If a + // buffer is successfully acquired, the information about the buffer is + // returned in BufferItem. If the buffer returned had previously been + // acquired then the BufferItem::mGraphicBuffer field of buffer is set to + // NULL and it is assumed that the consumer still holds a reference to the + // buffer. + status_t acquireBuffer(BufferItem *buffer); + + // releaseBuffer releases a buffer slot from the consumer back to the + // BufferQueue pending a fence sync. + // + // Note that the dependencies on EGL will be removed once we switch to using + // the Android HW Sync HAL. + status_t releaseBuffer(int buf, EGLDisplay display, EGLSyncKHR fence); + + // consumerConnect connects a consumer to the BufferQueue. Only one + // consumer may be connected, and when that consumer disconnects the + // BufferQueue is placed into the "abandoned" state, causing most + // interactions with the BufferQueue by the producer to fail. + status_t consumerConnect(const sp& consumer); + + // consumerDisconnect disconnects a consumer from the BufferQueue. All + // buffers will be freed and the BufferQueue is placed in the "abandoned" + // state, causing most interactions with the BufferQueue by the producer to + // fail. + status_t consumerDisconnect(); + + // getReleasedBuffers sets the value pointed to by slotMask to a bit mask + // indicating which buffer slots the have been released by the BufferQueue + // but have not yet been released by the consumer. + status_t getReleasedBuffers(uint32_t* slotMask); + + // setDefaultBufferSize is used to set the size of buffers returned by + // requestBuffers when a with and height of zero is requested. + status_t setDefaultBufferSize(uint32_t w, uint32_t h); + + // setBufferCountServer set the buffer count. If the client has requested + // a buffer count using setBufferCount, the server-buffer count will + // take effect once the client sets the count back to zero. + status_t setBufferCountServer(int bufferCount); + + // isSynchronousMode returns whether the SurfaceTexture is currently in + // synchronous mode. + bool isSynchronousMode() const; + + // setConsumerName sets the name used in logging + void setConsumerName(const String8& name); + + // setDefaultBufferFormat allows the BufferQueue to create + // GraphicBuffers of a defaultFormat if no format is specified + // in dequeueBuffer + status_t setDefaultBufferFormat(uint32_t defaultFormat); + + // setConsumerUsageBits will turn on additional usage bits for dequeueBuffer + status_t setConsumerUsageBits(uint32_t usage); + + // setTransformHint bakes in rotation to buffers so overlays can be used + status_t setTransformHint(uint32_t hint); private: - BufferQueue(); // Create through createBufferQueue + // freeBufferLocked frees the resources (both GraphicBuffer and EGLImage) + // for the given slot. + void freeBufferLocked(int index); + + // freeAllBuffersLocked frees the resources (both GraphicBuffer and + // EGLImage) for all slots. + void freeAllBuffersLocked(); + + // freeAllBuffersExceptHeadLocked frees the resources (both GraphicBuffer + // and EGLImage) for all slots except the head of mQueue + void freeAllBuffersExceptHeadLocked(); + + // drainQueueLocked drains the buffer queue if we're in synchronous mode + // returns immediately otherwise. It returns NO_INIT if the BufferQueue + // became abandoned or disconnected during this call. + status_t drainQueueLocked(); + + // drainQueueAndFreeBuffersLocked drains the buffer queue if we're in + // synchronous mode and free all buffers. In asynchronous mode, all buffers + // are freed except the current buffer. + status_t drainQueueAndFreeBuffersLocked(); + + status_t setBufferCountServerLocked(int bufferCount); + + struct BufferSlot { + + BufferSlot() + : mEglDisplay(EGL_NO_DISPLAY), + mBufferState(BufferSlot::FREE), + mRequestBufferCalled(false), + mTransform(0), + mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), + mTimestamp(0), + mFrameNumber(0), + mFence(EGL_NO_SYNC_KHR), + mAcquireCalled(false), + mNeedsCleanupOnRelease(false) { + mCrop.makeInvalid(); + } + + // mGraphicBuffer points to the buffer allocated for this slot or is NULL + // if no buffer has been allocated. + sp mGraphicBuffer; + + // mEglDisplay is the EGLDisplay used to create mEglImage. + EGLDisplay mEglDisplay; + + // BufferState represents the different states in which a buffer slot + // can be. + enum BufferState { + // FREE indicates that the buffer is not currently being used and + // will not be used in the future until it gets dequeued and + // subsequently queued by the client. + // aka "owned by BufferQueue, ready to be dequeued" + FREE = 0, + + // DEQUEUED indicates that the buffer has been dequeued by the + // client, but has not yet been queued or canceled. The buffer is + // considered 'owned' by the client, and the server should not use + // it for anything. + // + // Note that when in synchronous-mode (mSynchronousMode == true), + // the buffer that's currently attached to the texture may be + // dequeued by the client. That means that the current buffer can + // be in either the DEQUEUED or QUEUED state. In asynchronous mode, + // however, the current buffer is always in the QUEUED state. + // aka "owned by producer, ready to be queued" + DEQUEUED = 1, + + // QUEUED indicates that the buffer has been queued by the client, + // and has not since been made available for the client to dequeue. + // Attaching the buffer to the texture does NOT transition the + // buffer away from the QUEUED state. However, in Synchronous mode + // the current buffer may be dequeued by the client under some + // circumstances. See the note about the current buffer in the + // documentation for DEQUEUED. + // aka "owned by BufferQueue, ready to be acquired" + QUEUED = 2, + + // aka "owned by consumer, ready to be released" + ACQUIRED = 3 + }; + + // mBufferState is the current state of this buffer slot. + BufferState mBufferState; + + // mRequestBufferCalled is used for validating that the client did + // call requestBuffer() when told to do so. Technically this is not + // needed but useful for debugging and catching client bugs. + bool mRequestBufferCalled; + + // mCrop is the current crop rectangle for this buffer slot. + Rect mCrop; + + // mTransform is the current transform flags for this buffer slot. + uint32_t mTransform; + + // mScalingMode is the current scaling mode for this buffer slot. + uint32_t mScalingMode; + + // mTimestamp is the current timestamp for this buffer slot. This gets + // to set by queueBuffer each time this slot is queued. + int64_t mTimestamp; + + // mFrameNumber is the number of the queued frame for this slot. + uint64_t mFrameNumber; + + // mFence is the EGL sync object that must signal before the buffer + // associated with this buffer slot may be dequeued. It is initialized + // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based + // on a compile-time option) set to a new sync object in updateTexImage. + EGLSyncKHR mFence; + + // Indicates whether this buffer has been seen by a consumer yet + bool mAcquireCalled; + + // Indicates whether this buffer needs to be cleaned up by consumer + bool mNeedsCleanupOnRelease; + }; + + // mSlots is the array of buffer slots that must be mirrored on the client + // side. This allows buffer ownership to be transferred between the client + // and server without sending a GraphicBuffer over binder. The entire array + // is initialized to NULL at construction time, and buffers are allocated + // for a slot when requestBuffer is called with that slot's index. + BufferSlot mSlots[NUM_BUFFER_SLOTS]; + + // mDefaultWidth holds the default width of allocated buffers. It is used + // in requestBuffers() if a width and height of zero is specified. + uint32_t mDefaultWidth; + + // mDefaultHeight holds the default height of allocated buffers. It is used + // in requestBuffers() if a width and height of zero is specified. + uint32_t mDefaultHeight; + + // mPixelFormat holds the pixel format of allocated buffers. It is used + // in requestBuffers() if a format of zero is specified. + uint32_t mPixelFormat; + + // mMinUndequeuedBuffers is a constraint on the number of buffers + // not dequeued at any time + int mMinUndequeuedBuffers; + + // mMinAsyncBufferSlots is a constraint on the minimum mBufferCount + // when this BufferQueue is in asynchronous mode + int mMinAsyncBufferSlots; + + // mMinSyncBufferSlots is a constraint on the minimum mBufferCount + // when this BufferQueue is in synchronous mode + int mMinSyncBufferSlots; + + // mBufferCount is the number of buffer slots that the client and server + // must maintain. It defaults to MIN_ASYNC_BUFFER_SLOTS and can be changed + // by calling setBufferCount or setBufferCountServer + int mBufferCount; + + // mClientBufferCount is the number of buffer slots requested by the client. + // The default is zero, which means the client doesn't care how many buffers + // there is. + int mClientBufferCount; + + // mServerBufferCount buffer count requested by the server-side + int mServerBufferCount; + + // mGraphicBufferAlloc is the connection to SurfaceFlinger that is used to + // allocate new GraphicBuffer objects. + sp mGraphicBufferAlloc; + + // mConsumerListener is used to notify the connected consumer of + // asynchronous events that it may wish to react to. It is initially set + // to NULL and is written by consumerConnect and consumerDisconnect. + sp mConsumerListener; + + // mSynchronousMode whether we're in synchronous mode or not + bool mSynchronousMode; + + // mAllowSynchronousMode whether we allow synchronous mode or not + const bool mAllowSynchronousMode; + + // mConnectedApi indicates the API that is currently connected to this + // BufferQueue. It defaults to NO_CONNECTED_API (= 0), and gets updated + // by the connect and disconnect methods. + int mConnectedApi; + + // mDequeueCondition condition used for dequeueBuffer in synchronous mode + mutable Condition mDequeueCondition; + + // mQueue is a FIFO of queued buffers used in synchronous mode + typedef Vector Fifo; + Fifo mQueue; + + // mAbandoned indicates that the BufferQueue will no longer be used to + // consume images buffers pushed to it using the ISurfaceTexture interface. + // It is initialized to false, and set to true in the abandon method. A + // BufferQueue that has been abandoned will return the NO_INIT error from + // all ISurfaceTexture methods capable of returning an error. + bool mAbandoned; + + // mName is a string used to identify the BufferQueue in log messages. + // It is set by the setName method. + String8 mConsumerName; + + // mMutex is the mutex used to prevent concurrent access to the member + // variables of BufferQueue objects. It must be locked whenever the + // member variables are accessed. + mutable Mutex mMutex; + + // mFrameCounter is the free running counter, incremented for every buffer queued + // with the surface Texture. + uint64_t mFrameCounter; + + // mBufferHasBeenQueued is true once a buffer has been queued. It is reset + // by changing the buffer count. + bool mBufferHasBeenQueued; + + // mDefaultBufferFormat can be set so it will override + // the buffer format when it isn't specified in dequeueBuffer + uint32_t mDefaultBufferFormat; + + // mConsumerUsageBits contains flags the consumer wants for GraphicBuffers + uint32_t mConsumerUsageBits; + + // mTransformHint is used to optimize for screen rotations + uint32_t mTransformHint; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueProducer.h android-platform-frameworks-native-21/include/gui/BufferQueueProducer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferQueueProducer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferQueueProducer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,228 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_BUFFERQUEUEPRODUCER_H -#define ANDROID_GUI_BUFFERQUEUEPRODUCER_H - -#include -#include - -namespace android { - -class BufferSlot; - -class BufferQueueProducer : public BnGraphicBufferProducer, - private IBinder::DeathRecipient { -public: - friend class BufferQueue; // Needed to access binderDied - - BufferQueueProducer(const sp& core); - virtual ~BufferQueueProducer(); - - // requestBuffer returns the GraphicBuffer for slot N. - // - // In normal operation, this is called the first time slot N is returned - // by dequeueBuffer. It must be called again if dequeueBuffer returns - // flags indicating that previously-returned buffers are no longer valid. - virtual status_t requestBuffer(int slot, sp* buf); - - // setBufferCount updates the number of available buffer slots. If this - // method succeeds, buffer slots will be both unallocated and owned by - // the BufferQueue object (i.e. they are not owned by the producer or - // consumer). - // - // This will fail if the producer has dequeued any buffers, or if - // bufferCount is invalid. bufferCount must generally be a value - // between the minimum undequeued buffer count (exclusive) and NUM_BUFFER_SLOTS - // (inclusive). It may also be set to zero (the default) to indicate - // that the producer does not wish to set a value. The minimum value - // can be obtained by calling query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, - // ...). - // - // This may only be called by the producer. The consumer will be told - // to discard buffers through the onBuffersReleased callback. - virtual status_t setBufferCount(int bufferCount); - - // dequeueBuffer gets the next buffer slot index for the producer to use. - // If a buffer slot is available then that slot index is written to the - // location pointed to by the buf argument and a status of OK is returned. - // If no slot is available then a status of -EBUSY is returned and buf is - // unmodified. - // - // The outFence parameter will be updated to hold the fence associated with - // the buffer. The contents of the buffer must not be overwritten until the - // fence signals. If the fence is Fence::NO_FENCE, the buffer may be - // written immediately. - // - // The width and height parameters must be no greater than the minimum of - // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). - // An error due to invalid dimensions might not be reported until - // updateTexImage() is called. If width and height are both zero, the - // default values specified by setDefaultBufferSize() are used instead. - // - // If the format is 0, the default format will be used. - // - // The usage argument specifies gralloc buffer usage flags. The values - // are enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER. These - // will be merged with the usage flags specified by setConsumerUsageBits. - // - // The return value may be a negative error value or a non-negative - // collection of flags. If the flags are set, the return values are - // valid, but additional actions must be performed. - // - // If IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION is set, the - // producer must discard cached GraphicBuffer references for the slot - // returned in buf. - // If IGraphicBufferProducer::RELEASE_ALL_BUFFERS is set, the producer - // must discard cached GraphicBuffer references for all slots. - // - // In both cases, the producer will need to call requestBuffer to get a - // GraphicBuffer handle for the returned slot. - virtual status_t dequeueBuffer(int *outSlot, sp* outFence, - bool async, uint32_t width, uint32_t height, PixelFormat format, - uint32_t usage); - - // See IGraphicBufferProducer::detachBuffer - virtual status_t detachBuffer(int slot); - - // See IGraphicBufferProducer::detachNextBuffer - virtual status_t detachNextBuffer(sp* outBuffer, - sp* outFence); - - // See IGraphicBufferProducer::attachBuffer - virtual status_t attachBuffer(int* outSlot, const sp& buffer); - - // queueBuffer returns a filled buffer to the BufferQueue. - // - // Additional data is provided in the QueueBufferInput struct. Notably, - // a timestamp must be provided for the buffer. The timestamp is in - // nanoseconds, and must be monotonically increasing. Its other semantics - // (zero point, etc) are producer-specific and should be documented by the - // producer. - // - // The caller may provide a fence that signals when all rendering - // operations have completed. Alternatively, NO_FENCE may be used, - // indicating that the buffer is ready immediately. - // - // Some values are returned in the output struct: the current settings - // for default width and height, the current transform hint, and the - // number of queued buffers. - virtual status_t queueBuffer(int slot, - const QueueBufferInput& input, QueueBufferOutput* output); - - // cancelBuffer returns a dequeued buffer to the BufferQueue, but doesn't - // queue it for use by the consumer. - // - // The buffer will not be overwritten until the fence signals. The fence - // will usually be the one obtained from dequeueBuffer. - virtual void cancelBuffer(int slot, const sp& fence); - - // Query native window attributes. The "what" values are enumerated in - // window.h (e.g. NATIVE_WINDOW_FORMAT). - virtual int query(int what, int* outValue); - - // connect attempts to connect a producer API to the BufferQueue. This - // must be called before any other IGraphicBufferProducer methods are - // called except for getAllocator. A consumer must already be connected. - // - // This method will fail if connect was previously called on the - // BufferQueue and no corresponding disconnect call was made (i.e. if - // it's still connected to a producer). - // - // APIs are enumerated in window.h (e.g. NATIVE_WINDOW_API_CPU). - virtual status_t connect(const sp& listener, - int api, bool producerControlledByApp, QueueBufferOutput* output); - - // disconnect attempts to disconnect a producer API from the BufferQueue. - // Calling this method will cause any subsequent calls to other - // IGraphicBufferProducer methods to fail except for getAllocator and connect. - // Successfully calling connect after this will allow the other methods to - // succeed again. - // - // This method will fail if the the BufferQueue is not currently - // connected to the specified producer API. - virtual status_t disconnect(int api); - - // Attaches a sideband buffer stream to the IGraphicBufferProducer. - // - // A sideband stream is a device-specific mechanism for passing buffers - // from the producer to the consumer without using dequeueBuffer/ - // queueBuffer. If a sideband stream is present, the consumer can choose - // whether to acquire buffers from the sideband stream or from the queued - // buffers. - // - // Passing NULL or a different stream handle will detach the previous - // handle if any. - virtual status_t setSidebandStream(const sp& stream); - - // See IGraphicBufferProducer::allocateBuffers - virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - PixelFormat format, uint32_t usage); - - // See IGraphicBufferProducer::allowAllocation - virtual status_t allowAllocation(bool allow); - - // See IGraphicBufferProducer::setGenerationNumber - virtual status_t setGenerationNumber(uint32_t generationNumber); - - // See IGraphicBufferProducer::getConsumerName - virtual String8 getConsumerName() const override; - -private: - // This is required by the IBinder::DeathRecipient interface - virtual void binderDied(const wp& who); - - // waitForFreeSlotThenRelock finds the oldest slot in the FREE state. It may - // block if there are no available slots and we are not in non-blocking - // mode (producer and consumer controlled by the application). If it blocks, - // it will release mCore->mMutex while blocked so that other operations on - // the BufferQueue may succeed. - status_t waitForFreeSlotThenRelock(const char* caller, bool async, - int* found, status_t* returnFlags) const; - - sp mCore; - - // This references mCore->mSlots. Lock mCore->mMutex while accessing. - BufferQueueDefs::SlotsType& mSlots; - - // This is a cached copy of the name stored in the BufferQueueCore. - // It's updated during connect and dequeueBuffer (which should catch - // most updates). - String8 mConsumerName; - - uint32_t mStickyTransform; - - // This saves the fence from the last queueBuffer, such that the - // next queueBuffer call can throttle buffer production. The prior - // queueBuffer's fence is not nessessarily available elsewhere, - // since the previous buffer might have already been acquired. - sp mLastQueueBufferFence; - - // Take-a-ticket system for ensuring that onFrame* callbacks are called in - // the order that frames are queued. While the BufferQueue lock - // (mCore->mMutex) is held, a ticket is retained by the producer. After - // dropping the BufferQueue lock, the producer must wait on the condition - // variable until the current callback ticket matches its retained ticket. - Mutex mCallbackMutex; - int mNextCallbackTicket; // Protected by mCore->mMutex - int mCurrentCallbackTicket; // Protected by mCallbackMutex - Condition mCallbackCondition; - -}; // class BufferQueueProducer - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/BufferSlot.h android-platform-frameworks-native-21/include/gui/BufferSlot.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/BufferSlot.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/BufferSlot.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,142 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_BUFFERSLOT_H -#define ANDROID_GUI_BUFFERSLOT_H - -#include -#include - -#include -#include - -#include - -namespace android { - -class Fence; - -struct BufferSlot { - - BufferSlot() - : mEglDisplay(EGL_NO_DISPLAY), - mBufferState(BufferSlot::FREE), - mRequestBufferCalled(false), - mFrameNumber(0), - mEglFence(EGL_NO_SYNC_KHR), - mAcquireCalled(false), - mNeedsCleanupOnRelease(false), - mAttachedByConsumer(false) { - } - - // mGraphicBuffer points to the buffer allocated for this slot or is NULL - // if no buffer has been allocated. - sp mGraphicBuffer; - - // mEglDisplay is the EGLDisplay used to create EGLSyncKHR objects. - EGLDisplay mEglDisplay; - - // BufferState represents the different states in which a buffer slot - // can be. All slots are initially FREE. - enum BufferState { - // FREE indicates that the buffer is available to be dequeued - // by the producer. The buffer may be in use by the consumer for - // a finite time, so the buffer must not be modified until the - // associated fence is signaled. - // - // The slot is "owned" by BufferQueue. It transitions to DEQUEUED - // when dequeueBuffer is called. - FREE = 0, - - // DEQUEUED indicates that the buffer has been dequeued by the - // producer, but has not yet been queued or canceled. The - // producer may modify the buffer's contents as soon as the - // associated ready fence is signaled. - // - // The slot is "owned" by the producer. It can transition to - // QUEUED (via queueBuffer) or back to FREE (via cancelBuffer). - DEQUEUED = 1, - - // QUEUED indicates that the buffer has been filled by the - // producer and queued for use by the consumer. The buffer - // contents may continue to be modified for a finite time, so - // the contents must not be accessed until the associated fence - // is signaled. - // - // The slot is "owned" by BufferQueue. It can transition to - // ACQUIRED (via acquireBuffer) or to FREE (if another buffer is - // queued in asynchronous mode). - QUEUED = 2, - - // ACQUIRED indicates that the buffer has been acquired by the - // consumer. As with QUEUED, the contents must not be accessed - // by the consumer until the fence is signaled. - // - // The slot is "owned" by the consumer. It transitions to FREE - // when releaseBuffer is called. - ACQUIRED = 3 - }; - - static const char* bufferStateName(BufferState state); - - // mBufferState is the current state of this buffer slot. - BufferState mBufferState; - - // mRequestBufferCalled is used for validating that the producer did - // call requestBuffer() when told to do so. Technically this is not - // needed but useful for debugging and catching producer bugs. - bool mRequestBufferCalled; - - // mFrameNumber is the number of the queued frame for this slot. This - // is used to dequeue buffers in LRU order (useful because buffers - // may be released before their release fence is signaled). - uint64_t mFrameNumber; - - // mEglFence is the EGL sync object that must signal before the buffer - // associated with this buffer slot may be dequeued. It is initialized - // to EGL_NO_SYNC_KHR when the buffer is created and may be set to a - // new sync object in releaseBuffer. (This is deprecated in favor of - // mFence, below.) - EGLSyncKHR mEglFence; - - // mFence is a fence which will signal when work initiated by the - // previous owner of the buffer is finished. When the buffer is FREE, - // the fence indicates when the consumer has finished reading - // from the buffer, or when the producer has finished writing if it - // called cancelBuffer after queueing some writes. When the buffer is - // QUEUED, it indicates when the producer has finished filling the - // buffer. When the buffer is DEQUEUED or ACQUIRED, the fence has been - // passed to the consumer or producer along with ownership of the - // buffer, and mFence is set to NO_FENCE. - sp mFence; - - // Indicates whether this buffer has been seen by a consumer yet - bool mAcquireCalled; - - // Indicates whether this buffer needs to be cleaned up by the - // consumer. This is set when a buffer in ACQUIRED state is freed. - // It causes releaseBuffer to return STALE_BUFFER_SLOT. - bool mNeedsCleanupOnRelease; - - // Indicates whether the buffer was attached on the consumer side. - // If so, it needs to set the BUFFER_NEEDS_REALLOCATION flag when dequeued - // to prevent the producer from using a stale cached buffer. - bool mAttachedByConsumer; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ConsumerBase.h android-platform-frameworks-native-21/include/gui/ConsumerBase.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ConsumerBase.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ConsumerBase.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_GUI_CONSUMERBASE_H -#define ANDROID_GUI_CONSUMERBASE_H - -#include - -#include - -#include -#include -#include -#include - -namespace android { -// ---------------------------------------------------------------------------- - -class String8; - -// ConsumerBase is a base class for BufferQueue consumer end-points. It -// handles common tasks like management of the connection to the BufferQueue -// and the buffer pool. -class ConsumerBase : public virtual RefBase, - protected ConsumerListener { -public: - struct FrameAvailableListener : public virtual RefBase { - // See IConsumerListener::onFrame{Available,Replaced} - virtual void onFrameAvailable(const BufferItem& item) = 0; - virtual void onFrameReplaced(const BufferItem& /* item */) {} - }; - - virtual ~ConsumerBase(); - - // abandon frees all the buffers and puts the ConsumerBase into the - // 'abandoned' state. Once put in this state the ConsumerBase can never - // leave it. When in the 'abandoned' state, all methods of the - // IGraphicBufferProducer interface will fail with the NO_INIT error. - // - // Note that while calling this method causes all the buffers to be freed - // from the perspective of the the ConsumerBase, if there are additional - // references on the buffers (e.g. if a buffer is referenced by a client - // or by OpenGL ES as a texture) then those buffer will remain allocated. - void abandon(); - - // Returns true if the ConsumerBase is in the 'abandoned' state - bool isAbandoned(); - - // set the name of the ConsumerBase that will be used to identify it in - // log messages. - void setName(const String8& name); - - // dump writes the current state to a string. Child classes should add - // their state to the dump by overriding the dumpLocked method, which is - // called by these methods after locking the mutex. - void dump(String8& result) const; - void dump(String8& result, const char* prefix) const; - - // setFrameAvailableListener sets the listener object that will be notified - // when a new frame becomes available. - void setFrameAvailableListener(const wp& listener); - - // See IGraphicBufferConsumer::detachBuffer - status_t detachBuffer(int slot); - - // See IGraphicBufferConsumer::setDefaultBufferSize - status_t setDefaultBufferSize(uint32_t width, uint32_t height); - - // See IGraphicBufferConsumer::setDefaultBufferFormat - status_t setDefaultBufferFormat(PixelFormat defaultFormat); - - // See IGraphicBufferConsumer::setDefaultBufferDataSpace - status_t setDefaultBufferDataSpace(android_dataspace defaultDataSpace); - -private: - ConsumerBase(const ConsumerBase&); - void operator=(const ConsumerBase&); - -protected: - // ConsumerBase constructs a new ConsumerBase object to consume image - // buffers from the given IGraphicBufferConsumer. - // The controlledByApp flag indicates that this consumer is under the application's - // control. - ConsumerBase(const sp& consumer, bool controlledByApp = false); - - // onLastStrongRef gets called by RefBase just before the dtor of the most - // derived class. It is used to clean up the buffers so that ConsumerBase - // can coordinate the clean-up by calling into virtual methods implemented - // by the derived classes. This would not be possible from the - // ConsuemrBase dtor because by the time that gets called the derived - // classes have already been destructed. - // - // This methods should not need to be overridden by derived classes, but - // if they are overridden the ConsumerBase implementation must be called - // from the derived class. - virtual void onLastStrongRef(const void* id); - - // Implementation of the IConsumerListener interface. These - // calls are used to notify the ConsumerBase of asynchronous events in the - // BufferQueue. The onFrameAvailable, onFrameReplaced, and - // onBuffersReleased methods should not need to be overridden by derived - // classes, but if they are overridden the ConsumerBase implementation must - // be called from the derived class. The ConsumerBase version of - // onSidebandStreamChanged does nothing and can be overriden by derived - // classes if they want the notification. - virtual void onFrameAvailable(const BufferItem& item) override; - virtual void onFrameReplaced(const BufferItem& item) override; - virtual void onBuffersReleased() override; - virtual void onSidebandStreamChanged() override; - - // freeBufferLocked frees up the given buffer slot. If the slot has been - // initialized this will release the reference to the GraphicBuffer in that - // slot. Otherwise it has no effect. - // - // Derived classes should override this method to clean up any state they - // keep per slot. If it is overridden, the derived class's implementation - // must call ConsumerBase::freeBufferLocked. - // - // This method must be called with mMutex locked. - virtual void freeBufferLocked(int slotIndex); - - // abandonLocked puts the BufferQueue into the abandoned state, causing - // all future operations on it to fail. This method rather than the public - // abandon method should be overridden by child classes to add abandon- - // time behavior. - // - // Derived classes should override this method to clean up any object - // state they keep (as opposed to per-slot state). If it is overridden, - // the derived class's implementation must call ConsumerBase::abandonLocked. - // - // This method must be called with mMutex locked. - virtual void abandonLocked(); - - // dumpLocked dumps the current state of the ConsumerBase object to the - // result string. Each line is prefixed with the string pointed to by the - // prefix argument. The buffer argument points to a buffer that may be - // used for intermediate formatting data, and the size of that buffer is - // indicated by the size argument. - // - // Derived classes should override this method to dump their internal - // state. If this method is overridden the derived class's implementation - // should call ConsumerBase::dumpLocked. - // - // This method must be called with mMutex locked. - virtual void dumpLocked(String8& result, const char* prefix) const; - - // acquireBufferLocked fetches the next buffer from the BufferQueue and - // updates the buffer slot for the buffer returned. - // - // Derived classes should override this method to perform any - // initialization that must take place the first time a buffer is assigned - // to a slot. If it is overridden the derived class's implementation must - // call ConsumerBase::acquireBufferLocked. - virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen, - uint64_t maxFrameNumber = 0); - - // releaseBufferLocked relinquishes control over a buffer, returning that - // control to the BufferQueue. - // - // Derived classes should override this method to perform any cleanup that - // must take place when a buffer is released back to the BufferQueue. If - // it is overridden the derived class's implementation must call - // ConsumerBase::releaseBufferLocked.e - virtual status_t releaseBufferLocked(int slot, - const sp graphicBuffer, - EGLDisplay display, EGLSyncKHR eglFence); - - // returns true iff the slot still has the graphicBuffer in it. - bool stillTracking(int slot, const sp graphicBuffer); - - // addReleaseFence* adds the sync points associated with a fence to the set - // of sync points that must be reached before the buffer in the given slot - // may be used after the slot has been released. This should be called by - // derived classes each time some asynchronous work is kicked off that - // references the buffer. - status_t addReleaseFence(int slot, - const sp graphicBuffer, const sp& fence); - status_t addReleaseFenceLocked(int slot, - const sp graphicBuffer, const sp& fence); - - // Slot contains the information and object references that - // ConsumerBase maintains about a BufferQueue buffer slot. - struct Slot { - // mGraphicBuffer is the Gralloc buffer store in the slot or NULL if - // no Gralloc buffer is in the slot. - sp mGraphicBuffer; - - // mFence is a fence which will signal when the buffer associated with - // this buffer slot is no longer being used by the consumer and can be - // overwritten. The buffer can be dequeued before the fence signals; - // the producer is responsible for delaying writes until it signals. - sp mFence; - - // the frame number of the last acquired frame for this slot - uint64_t mFrameNumber; - }; - - // mSlots stores the buffers that have been allocated by the BufferQueue - // for each buffer slot. It is initialized to null pointers, and gets - // filled in with the result of BufferQueue::acquire when the - // client dequeues a buffer from a - // slot that has not yet been used. The buffer allocated to a slot will also - // be replaced if the requested buffer usage or geometry differs from that - // of the buffer allocated to a slot. - Slot mSlots[BufferQueue::NUM_BUFFER_SLOTS]; - - // mAbandoned indicates that the BufferQueue will no longer be used to - // consume images buffers pushed to it using the IGraphicBufferProducer - // interface. It is initialized to false, and set to true in the abandon - // method. A BufferQueue that has been abandoned will return the NO_INIT - // error from all IConsumerBase methods capable of returning an error. - bool mAbandoned; - - // mName is a string used to identify the ConsumerBase in log messages. - // It can be set by the setName method. - String8 mName; - - // mFrameAvailableListener is the listener object that will be called when a - // new frame becomes available. If it is not NULL it will be called from - // queueBuffer. - wp mFrameAvailableListener; - - // The ConsumerBase has-a BufferQueue and is responsible for creating this object - // if none is supplied - sp mConsumer; - - // mMutex is the mutex used to prevent concurrent access to the member - // variables of ConsumerBase objects. It must be locked whenever the - // member variables are accessed or when any of the *Locked methods are - // called. - // - // This mutex is intended to be locked by derived classes. - mutable Mutex mMutex; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_CONSUMERBASE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/CpuConsumer.h android-platform-frameworks-native-21/include/gui/CpuConsumer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/CpuConsumer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/CpuConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,131 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_GUI_CPUCONSUMER_H -#define ANDROID_GUI_CPUCONSUMER_H - -#include - -#include - -#include -#include -#include - - -namespace android { - -class BufferQueue; - -/** - * CpuConsumer is a BufferQueue consumer endpoint that allows direct CPU - * access to the underlying gralloc buffers provided by BufferQueue. Multiple - * buffers may be acquired by it at once, to be used concurrently by the - * CpuConsumer owner. Sets gralloc usage flags to be software-read-only. - * This queue is synchronous by default. - */ - -class CpuConsumer : public ConsumerBase -{ - public: - typedef ConsumerBase::FrameAvailableListener FrameAvailableListener; - - struct LockedBuffer { - uint8_t *data; - uint32_t width; - uint32_t height; - PixelFormat format; - uint32_t stride; - Rect crop; - uint32_t transform; - uint32_t scalingMode; - int64_t timestamp; - android_dataspace dataSpace; - uint64_t frameNumber; - // this is the same as format, except for formats that are compatible with - // a flexible format (e.g. HAL_PIXEL_FORMAT_YCbCr_420_888). In the latter - // case this contains that flexible format - PixelFormat flexFormat; - // Values below are only valid when using HAL_PIXEL_FORMAT_YCbCr_420_888 - // or compatible format, in which case LockedBuffer::data - // contains the Y channel, and stride is the Y channel stride. For other - // formats, these will all be 0. - uint8_t *dataCb; - uint8_t *dataCr; - uint32_t chromaStride; - uint32_t chromaStep; - }; - - // Create a new CPU consumer. The maxLockedBuffers parameter specifies - // how many buffers can be locked for user access at the same time. - CpuConsumer(const sp& bq, - size_t maxLockedBuffers, bool controlledByApp = false); - - virtual ~CpuConsumer(); - - // set the name of the CpuConsumer that will be used to identify it in - // log messages. - void setName(const String8& name); - - // Gets the next graphics buffer from the producer and locks it for CPU use, - // filling out the passed-in locked buffer structure with the native pointer - // and metadata. Returns BAD_VALUE if no new buffer is available, and - // NOT_ENOUGH_DATA if the maximum number of buffers is already locked. - // - // Only a fixed number of buffers can be locked at a time, determined by the - // construction-time maxLockedBuffers parameter. If INVALID_OPERATION is - // returned by lockNextBuffer, then old buffers must be returned to the queue - // by calling unlockBuffer before more buffers can be acquired. - status_t lockNextBuffer(LockedBuffer *nativeBuffer); - - // Returns a locked buffer to the queue, allowing it to be reused. Since - // only a fixed number of buffers may be locked at a time, old buffers must - // be released by calling unlockBuffer to ensure new buffers can be acquired by - // lockNextBuffer. - status_t unlockBuffer(const LockedBuffer &nativeBuffer); - - private: - // Maximum number of buffers that can be locked at a time - size_t mMaxLockedBuffers; - - status_t releaseAcquiredBufferLocked(size_t lockedIdx); - - virtual void freeBufferLocked(int slotIndex); - - // Tracking for buffers acquired by the user - struct AcquiredBuffer { - // Need to track the original mSlot index and the buffer itself because - // the mSlot entry may be freed/reused before the acquired buffer is - // released. - int mSlot; - sp mGraphicBuffer; - void *mBufferPointer; - - AcquiredBuffer() : - mSlot(BufferQueue::INVALID_BUFFER_SLOT), - mBufferPointer(NULL) { - } - }; - Vector mAcquiredBuffers; - - // Count of currently locked buffers - size_t mCurrentLockedBuffers; - -}; - -} // namespace android - -#endif // ANDROID_GUI_CPUCONSUMER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/DisplayEventReceiver.h android-platform-frameworks-native-21/include/gui/DisplayEventReceiver.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/DisplayEventReceiver.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/DisplayEventReceiver.h 2012-10-16 22:57:11.000000000 +0000 @@ -40,30 +40,23 @@ class DisplayEventReceiver { public: enum { - DISPLAY_EVENT_VSYNC = 'vsyn', - DISPLAY_EVENT_HOTPLUG = 'plug' + DISPLAY_EVENT_VSYNC = 'vsyn' }; struct Event { struct Header { uint32_t type; - uint32_t id; - nsecs_t timestamp __attribute__((aligned(8))); + nsecs_t timestamp; }; struct VSync { uint32_t count; }; - struct Hotplug { - bool connected; - }; - Header header; union { VSync vsync; - Hotplug hotplug; }; }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/DummyConsumer.h android-platform-frameworks-native-21/include/gui/DummyConsumer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/DummyConsumer.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/DummyConsumer.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * Copyright (C) 2012 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. + */ + +#ifndef ANDROID_GUI_DUMMYCONSUMER_H +#define ANDROID_GUI_DUMMYCONSUMER_H + +#include + +namespace android { +// ---------------------------------------------------------------------------- + + +// The DummyConsumer does not keep a reference to BufferQueue +// unlike SurfaceTexture. This prevents a circular reference from +// forming without having to use a ProxyConsumerListener +class DummyConsumer : public BufferQueue::ConsumerListener { +public: + DummyConsumer(); + virtual ~DummyConsumer(); +protected: + + // Implementation of the BufferQueue::ConsumerListener interface. These + // calls are used to notify the SurfaceTexture of asynchronous events in the + // BufferQueue. + virtual void onFrameAvailable(); + virtual void onBuffersReleased(); + +}; + +// ---------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_GUI_DUMMYCONSUMER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/GLConsumer.h android-platform-frameworks-native-21/include/gui/GLConsumer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/GLConsumer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/GLConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,488 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_GUI_CONSUMER_H -#define ANDROID_GUI_CONSUMER_H - -#include -#include - -#include -#include -#include - -#include - -#include -#include -#include - -namespace android { -// ---------------------------------------------------------------------------- - - -class String8; - -/* - * GLConsumer consumes buffers of graphics data from a BufferQueue, - * and makes them available to OpenGL as a texture. - * - * A typical usage pattern is to set up the GLConsumer with the - * desired options, and call updateTexImage() when a new frame is desired. - * If a new frame is available, the texture will be updated. If not, - * the previous contents are retained. - * - * By default, the texture is attached to the GL_TEXTURE_EXTERNAL_OES - * texture target, in the EGL context of the first thread that calls - * updateTexImage(). - * - * This class was previously called SurfaceTexture. - */ -class GLConsumer : public ConsumerBase { -public: - enum { TEXTURE_EXTERNAL = 0x8D65 }; // GL_TEXTURE_EXTERNAL_OES - typedef ConsumerBase::FrameAvailableListener FrameAvailableListener; - - // GLConsumer constructs a new GLConsumer object. If the constructor with - // the tex parameter is used, tex indicates the name of the OpenGL ES - // texture to which images are to be streamed. texTarget specifies the - // OpenGL ES texture target to which the texture will be bound in - // updateTexImage. useFenceSync specifies whether fences should be used to - // synchronize access to buffers if that behavior is enabled at - // compile-time. - // - // A GLConsumer may be detached from one OpenGL ES context and then - // attached to a different context using the detachFromContext and - // attachToContext methods, respectively. The intention of these methods is - // purely to allow a GLConsumer to be transferred from one consumer - // context to another. If such a transfer is not needed there is no - // requirement that either of these methods be called. - // - // If the constructor with the tex parameter is used, the GLConsumer is - // created in a state where it is considered attached to an OpenGL ES - // context for the purposes of the attachToContext and detachFromContext - // methods. However, despite being considered "attached" to a context, the - // specific OpenGL ES context doesn't get latched until the first call to - // updateTexImage. After that point, all calls to updateTexImage must be - // made with the same OpenGL ES context current. - // - // If the constructor without the tex parameter is used, the GLConsumer is - // created in a detached state, and attachToContext must be called before - // calls to updateTexImage. - GLConsumer(const sp& bq, - uint32_t tex, uint32_t texureTarget, bool useFenceSync, - bool isControlledByApp); - - GLConsumer(const sp& bq, uint32_t texureTarget, - bool useFenceSync, bool isControlledByApp); - - // updateTexImage acquires the most recently queued buffer, and sets the - // image contents of the target texture to it. - // - // This call may only be made while the OpenGL ES context to which the - // target texture belongs is bound to the calling thread. - // - // This calls doGLFenceWait to ensure proper synchronization. - status_t updateTexImage(); - - // releaseTexImage releases the texture acquired in updateTexImage(). - // This is intended to be used in single buffer mode. - // - // This call may only be made while the OpenGL ES context to which the - // target texture belongs is bound to the calling thread. - status_t releaseTexImage(); - - // setReleaseFence stores a fence that will signal when the current buffer - // is no longer being read. This fence will be returned to the producer - // when the current buffer is released by updateTexImage(). Multiple - // fences can be set for a given buffer; they will be merged into a single - // union fence. - void setReleaseFence(const sp& fence); - - // setDefaultMaxBufferCount sets the default limit on the maximum number - // of buffers that will be allocated at one time. The image producer may - // override the limit. - status_t setDefaultMaxBufferCount(int bufferCount); - - // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix - // associated with the texture image set by the most recent call to - // updateTexImage. - // - // This transform matrix maps 2D homogeneous texture coordinates of the form - // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture - // coordinate that should be used to sample that location from the texture. - // Sampling the texture outside of the range of this transform is undefined. - // - // This transform is necessary to compensate for transforms that the stream - // content producer may implicitly apply to the content. By forcing users of - // a GLConsumer to apply this transform we avoid performing an extra - // copy of the data that would be needed to hide the transform from the - // user. - // - // The matrix is stored in column-major order so that it may be passed - // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv - // functions. - void getTransformMatrix(float mtx[16]); - - // getTimestamp retrieves the timestamp associated with the texture image - // set by the most recent call to updateTexImage. - // - // The timestamp is in nanoseconds, and is monotonically increasing. Its - // other semantics (zero point, etc) are source-dependent and should be - // documented by the source. - int64_t getTimestamp(); - - // getFrameNumber retrieves the frame number associated with the texture - // image set by the most recent call to updateTexImage. - // - // The frame number is an incrementing counter set to 0 at the creation of - // the BufferQueue associated with this consumer. - uint64_t getFrameNumber(); - - // setDefaultBufferSize is used to set the size of buffers returned by - // requestBuffers when a with and height of zero is requested. - // A call to setDefaultBufferSize() may trigger requestBuffers() to - // be called from the client. - // The width and height parameters must be no greater than the minimum of - // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). - // An error due to invalid dimensions might not be reported until - // updateTexImage() is called. - status_t setDefaultBufferSize(uint32_t width, uint32_t height); - - // setFilteringEnabled sets whether the transform matrix should be computed - // for use with bilinear filtering. - void setFilteringEnabled(bool enabled); - - // getCurrentBuffer returns the buffer associated with the current image. - sp getCurrentBuffer() const; - - // getCurrentTextureTarget returns the texture target of the current - // texture as returned by updateTexImage(). - uint32_t getCurrentTextureTarget() const; - - // getCurrentCrop returns the cropping rectangle of the current buffer. - Rect getCurrentCrop() const; - - // getCurrentTransform returns the transform of the current buffer. - uint32_t getCurrentTransform() const; - - // getCurrentScalingMode returns the scaling mode of the current buffer. - uint32_t getCurrentScalingMode() const; - - // getCurrentFence returns the fence indicating when the current buffer is - // ready to be read from. - sp getCurrentFence() const; - - // doGLFenceWait inserts a wait command into the OpenGL ES command stream - // to ensure that it is safe for future OpenGL ES commands to access the - // current texture buffer. - status_t doGLFenceWait() const; - - // set the name of the GLConsumer that will be used to identify it in - // log messages. - void setName(const String8& name); - - // These functions call the corresponding BufferQueue implementation - // so the refactoring can proceed smoothly - status_t setDefaultBufferFormat(PixelFormat defaultFormat); - status_t setDefaultBufferDataSpace(android_dataspace defaultDataSpace); - status_t setConsumerUsageBits(uint32_t usage); - status_t setTransformHint(uint32_t hint); - - // detachFromContext detaches the GLConsumer from the calling thread's - // current OpenGL ES context. This context must be the same as the context - // that was current for previous calls to updateTexImage. - // - // Detaching a GLConsumer from an OpenGL ES context will result in the - // deletion of the OpenGL ES texture object into which the images were being - // streamed. After a GLConsumer has been detached from the OpenGL ES - // context calls to updateTexImage will fail returning INVALID_OPERATION - // until the GLConsumer is attached to a new OpenGL ES context using the - // attachToContext method. - status_t detachFromContext(); - - // attachToContext attaches a GLConsumer that is currently in the - // 'detached' state to the current OpenGL ES context. A GLConsumer is - // in the 'detached' state iff detachFromContext has successfully been - // called and no calls to attachToContext have succeeded since the last - // detachFromContext call. Calls to attachToContext made on a - // GLConsumer that is not in the 'detached' state will result in an - // INVALID_OPERATION error. - // - // The tex argument specifies the OpenGL ES texture object name in the - // new context into which the image contents will be streamed. A successful - // call to attachToContext will result in this texture object being bound to - // the texture target and populated with the image contents that were - // current at the time of the last call to detachFromContext. - status_t attachToContext(uint32_t tex); - -protected: - - // abandonLocked overrides the ConsumerBase method to clear - // mCurrentTextureImage in addition to the ConsumerBase behavior. - virtual void abandonLocked(); - - // dumpLocked overrides the ConsumerBase method to dump GLConsumer- - // specific info in addition to the ConsumerBase behavior. - virtual void dumpLocked(String8& result, const char* prefix) const; - - // acquireBufferLocked overrides the ConsumerBase method to update the - // mEglSlots array in addition to the ConsumerBase behavior. - virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen, - uint64_t maxFrameNumber = 0) override; - - // releaseBufferLocked overrides the ConsumerBase method to update the - // mEglSlots array in addition to the ConsumerBase. - virtual status_t releaseBufferLocked(int slot, - const sp graphicBuffer, - EGLDisplay display, EGLSyncKHR eglFence); - - status_t releaseBufferLocked(int slot, - const sp graphicBuffer, EGLSyncKHR eglFence) { - return releaseBufferLocked(slot, graphicBuffer, mEglDisplay, eglFence); - } - - static bool isExternalFormat(PixelFormat format); - - // This releases the buffer in the slot referenced by mCurrentTexture, - // then updates state to refer to the BufferItem, which must be a - // newly-acquired buffer. - status_t updateAndReleaseLocked(const BufferItem& item); - - // Binds mTexName and the current buffer to mTexTarget. Uses - // mCurrentTexture if it's set, mCurrentTextureImage if not. If the - // bind succeeds, this calls doGLFenceWait. - status_t bindTextureImageLocked(); - - // Gets the current EGLDisplay and EGLContext values, and compares them - // to mEglDisplay and mEglContext. If the fields have been previously - // set, the values must match; if not, the fields are set to the current - // values. - // The contextCheck argument is used to ensure that a GL context is - // properly set; when set to false, the check is not performed. - status_t checkAndUpdateEglStateLocked(bool contextCheck = false); - -private: - // EglImage is a utility class for tracking and creating EGLImageKHRs. There - // is primarily just one image per slot, but there is also special cases: - // - For releaseTexImage, we use a debug image (mReleasedTexImage) - // - After freeBuffer, we must still keep the current image/buffer - // Reference counting EGLImages lets us handle all these cases easily while - // also only creating new EGLImages from buffers when required. - class EglImage : public LightRefBase { - public: - EglImage(sp graphicBuffer); - - // createIfNeeded creates an EGLImage if required (we haven't created - // one yet, or the EGLDisplay or crop-rect has changed). - status_t createIfNeeded(EGLDisplay display, - const Rect& cropRect, - bool forceCreate = false); - - // This calls glEGLImageTargetTexture2DOES to bind the image to the - // texture in the specified texture target. - void bindToTextureTarget(uint32_t texTarget); - - const sp& graphicBuffer() { return mGraphicBuffer; } - const native_handle* graphicBufferHandle() { - return mGraphicBuffer == NULL ? NULL : mGraphicBuffer->handle; - } - - private: - // Only allow instantiation using ref counting. - friend class LightRefBase; - virtual ~EglImage(); - - // createImage creates a new EGLImage from a GraphicBuffer. - EGLImageKHR createImage(EGLDisplay dpy, - const sp& graphicBuffer, const Rect& crop); - - // Disallow copying - EglImage(const EglImage& rhs); - void operator = (const EglImage& rhs); - - // mGraphicBuffer is the buffer that was used to create this image. - sp mGraphicBuffer; - - // mEglImage is the EGLImage created from mGraphicBuffer. - EGLImageKHR mEglImage; - - // mEGLDisplay is the EGLDisplay that was used to create mEglImage. - EGLDisplay mEglDisplay; - - // mCropRect is the crop rectangle passed to EGL when mEglImage - // was created. - Rect mCropRect; - }; - - // freeBufferLocked frees up the given buffer slot. If the slot has been - // initialized this will release the reference to the GraphicBuffer in that - // slot and destroy the EGLImage in that slot. Otherwise it has no effect. - // - // This method must be called with mMutex locked. - virtual void freeBufferLocked(int slotIndex); - - // computeCurrentTransformMatrixLocked computes the transform matrix for the - // current texture. It uses mCurrentTransform and the current GraphicBuffer - // to compute this matrix and stores it in mCurrentTransformMatrix. - // mCurrentTextureImage must not be NULL. - void computeCurrentTransformMatrixLocked(); - - // doGLFenceWaitLocked inserts a wait command into the OpenGL ES command - // stream to ensure that it is safe for future OpenGL ES commands to - // access the current texture buffer. - status_t doGLFenceWaitLocked() const; - - // syncForReleaseLocked performs the synchronization needed to release the - // current slot from an OpenGL ES context. If needed it will set the - // current slot's fence to guard against a producer accessing the buffer - // before the outstanding accesses have completed. - status_t syncForReleaseLocked(EGLDisplay dpy); - - // returns a graphic buffer used when the texture image has been released - static sp getDebugTexImageBuffer(); - - // The default consumer usage flags that GLConsumer always sets on its - // BufferQueue instance; these will be OR:d with any additional flags passed - // from the GLConsumer user. In particular, GLConsumer will always - // consume buffers as hardware textures. - static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE; - - // mCurrentTextureImage is the EglImage/buffer of the current texture. It's - // possible that this buffer is not associated with any buffer slot, so we - // must track it separately in order to support the getCurrentBuffer method. - sp mCurrentTextureImage; - - // mCurrentCrop is the crop rectangle that applies to the current texture. - // It gets set each time updateTexImage is called. - Rect mCurrentCrop; - - // mCurrentTransform is the transform identifier for the current texture. It - // gets set each time updateTexImage is called. - uint32_t mCurrentTransform; - - // mCurrentScalingMode is the scaling mode for the current texture. It gets - // set each time updateTexImage is called. - uint32_t mCurrentScalingMode; - - // mCurrentFence is the fence received from BufferQueue in updateTexImage. - sp mCurrentFence; - - // mCurrentTransformMatrix is the transform matrix for the current texture. - // It gets computed by computeTransformMatrix each time updateTexImage is - // called. - float mCurrentTransformMatrix[16]; - - // mCurrentTimestamp is the timestamp for the current texture. It - // gets set each time updateTexImage is called. - int64_t mCurrentTimestamp; - - // mCurrentFrameNumber is the frame counter for the current texture. - // It gets set each time updateTexImage is called. - uint64_t mCurrentFrameNumber; - - uint32_t mDefaultWidth, mDefaultHeight; - - // mFilteringEnabled indicates whether the transform matrix is computed for - // use with bilinear filtering. It defaults to true and is changed by - // setFilteringEnabled(). - bool mFilteringEnabled; - - // mTexName is the name of the OpenGL texture to which streamed images will - // be bound when updateTexImage is called. It is set at construction time - // and can be changed with a call to attachToContext. - uint32_t mTexName; - - // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync - // extension should be used to prevent buffers from being dequeued before - // it's safe for them to be written. It gets set at construction time and - // never changes. - const bool mUseFenceSync; - - // mTexTarget is the GL texture target with which the GL texture object is - // associated. It is set in the constructor and never changed. It is - // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android - // Browser. In that case it is set to GL_TEXTURE_2D to allow - // glCopyTexSubImage to read from the texture. This is a hack to work - // around a GL driver limitation on the number of FBO attachments, which the - // browser's tile cache exceeds. - const uint32_t mTexTarget; - - // EGLSlot contains the information and object references that - // GLConsumer maintains about a BufferQueue buffer slot. - struct EglSlot { - EglSlot() : mEglFence(EGL_NO_SYNC_KHR) {} - - // mEglImage is the EGLImage created from mGraphicBuffer. - sp mEglImage; - - // mFence is the EGL sync object that must signal before the buffer - // associated with this buffer slot may be dequeued. It is initialized - // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based - // on a compile-time option) set to a new sync object in updateTexImage. - EGLSyncKHR mEglFence; - }; - - // mEglDisplay is the EGLDisplay with which this GLConsumer is currently - // associated. It is intialized to EGL_NO_DISPLAY and gets set to the - // current display when updateTexImage is called for the first time and when - // attachToContext is called. - EGLDisplay mEglDisplay; - - // mEglContext is the OpenGL ES context with which this GLConsumer is - // currently associated. It is initialized to EGL_NO_CONTEXT and gets set - // to the current GL context when updateTexImage is called for the first - // time and when attachToContext is called. - EGLContext mEglContext; - - // mEGLSlots stores the buffers that have been allocated by the BufferQueue - // for each buffer slot. It is initialized to null pointers, and gets - // filled in with the result of BufferQueue::acquire when the - // client dequeues a buffer from a - // slot that has not yet been used. The buffer allocated to a slot will also - // be replaced if the requested buffer usage or geometry differs from that - // of the buffer allocated to a slot. - EglSlot mEglSlots[BufferQueue::NUM_BUFFER_SLOTS]; - - // mCurrentTexture is the buffer slot index of the buffer that is currently - // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT, - // indicating that no buffer slot is currently bound to the texture. Note, - // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean - // that no buffer is bound to the texture. A call to setBufferCount will - // reset mCurrentTexture to INVALID_BUFFER_SLOT. - int mCurrentTexture; - - // mAttached indicates whether the ConsumerBase is currently attached to - // an OpenGL ES context. For legacy reasons, this is initialized to true, - // indicating that the ConsumerBase is considered to be attached to - // whatever context is current at the time of the first updateTexImage call. - // It is set to false by detachFromContext, and then set to true again by - // attachToContext. - bool mAttached; - - // protects static initialization - static Mutex sStaticInitLock; - - // mReleasedTexImageBuffer is a dummy buffer used when in single buffer - // mode and releaseTexImage() has been called - static sp sReleasedTexImageBuffer; - sp mReleasedTexImage; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_CONSUMER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/GraphicBufferAlloc.h android-platform-frameworks-native-21/include/gui/GraphicBufferAlloc.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/GraphicBufferAlloc.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/GraphicBufferAlloc.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_SF_GRAPHIC_BUFFER_ALLOC_H -#define ANDROID_SF_GRAPHIC_BUFFER_ALLOC_H - -#include -#include - -#include -#include -#include - -namespace android { -// --------------------------------------------------------------------------- - -class GraphicBuffer; - -class GraphicBufferAlloc : public BnGraphicBufferAlloc { -public: - GraphicBufferAlloc(); - virtual ~GraphicBufferAlloc(); - virtual sp createGraphicBuffer(uint32_t width, - uint32_t height, PixelFormat format, uint32_t usage, - status_t* error); -}; - - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SF_GRAPHIC_BUFFER_ALLOC_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/GuiConfig.h android-platform-frameworks-native-21/include/gui/GuiConfig.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/GuiConfig.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/GuiConfig.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_GUI_CONFIG_H -#define ANDROID_GUI_CONFIG_H - -#include - -namespace android { - -// Append the libgui configuration details to configStr. -void appendGuiConfigString(String8& configStr); - -}; // namespace android - -#endif /*ANDROID_GUI_CONFIG_H*/ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/IConsumerListener.h android-platform-frameworks-native-21/include/gui/IConsumerListener.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/IConsumerListener.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/IConsumerListener.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_GUI_ICONSUMERLISTENER_H -#define ANDROID_GUI_ICONSUMERLISTENER_H - -#include -#include - -#include -#include - -#include - -namespace android { -// ---------------------------------------------------------------------------- - -class BufferItem; - -// ConsumerListener is the interface through which the BufferQueue notifies -// the consumer of events that the consumer may wish to react to. Because -// the consumer will generally have a mutex that is locked during calls from -// the consumer to the BufferQueue, these calls from the BufferQueue to the -// consumer *MUST* be called only when the BufferQueue mutex is NOT locked. - -class ConsumerListener : public virtual RefBase { -public: - ConsumerListener() { } - virtual ~ConsumerListener() { } - - // onFrameAvailable is called from queueBuffer each time an additional - // frame becomes available for consumption. This means that frames that - // are queued while in asynchronous mode only trigger the callback if no - // previous frames are pending. Frames queued while in synchronous mode - // always trigger the callback. The item passed to the callback will contain - // all of the information about the queued frame except for its - // GraphicBuffer pointer, which will always be null. - // - // This is called without any lock held and can be called concurrently - // by multiple threads. - virtual void onFrameAvailable(const BufferItem& item) = 0; /* Asynchronous */ - - // onFrameReplaced is called from queueBuffer if the frame being queued is - // replacing an existing slot in the queue. Any call to queueBuffer that - // doesn't call onFrameAvailable will call this callback instead. The item - // passed to the callback will contain all of the information about the - // queued frame except for its GraphicBuffer pointer, which will always be - // null. - // - // This is called without any lock held and can be called concurrently - // by multiple threads. - virtual void onFrameReplaced(const BufferItem& /* item */) {} /* Asynchronous */ - - // onBuffersReleased is called to notify the buffer consumer that the - // BufferQueue has released its references to one or more GraphicBuffers - // contained in its slots. The buffer consumer should then call - // BufferQueue::getReleasedBuffers to retrieve the list of buffers - // - // This is called without any lock held and can be called concurrently - // by multiple threads. - virtual void onBuffersReleased() = 0; /* Asynchronous */ - - // onSidebandStreamChanged is called to notify the buffer consumer that the - // BufferQueue's sideband buffer stream has changed. This is called when a - // stream is first attached and when it is either detached or replaced by a - // different stream. - virtual void onSidebandStreamChanged() = 0; /* Asynchronous */ -}; - - -class IConsumerListener : public ConsumerListener, public IInterface -{ -public: - DECLARE_META_INTERFACE(ConsumerListener); -}; - -// ---------------------------------------------------------------------------- - -class BnConsumerListener : public BnInterface -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_ICONSUMERLISTENER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/IGraphicBufferAlloc.h android-platform-frameworks-native-21/include/gui/IGraphicBufferAlloc.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/IGraphicBufferAlloc.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/IGraphicBufferAlloc.h 2012-10-16 22:57:11.000000000 +0000 @@ -45,10 +45,10 @@ class BnGraphicBufferAlloc : public BnInterface { public: - virtual status_t onTransact(uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/IGraphicBufferConsumer.h android-platform-frameworks-native-21/include/gui/IGraphicBufferConsumer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/IGraphicBufferConsumer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/IGraphicBufferConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,280 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_GUI_IGRAPHICBUFFERCONSUMER_H -#define ANDROID_GUI_IGRAPHICBUFFERCONSUMER_H - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include -#include - -namespace android { -// ---------------------------------------------------------------------------- - -class BufferItem; -class Fence; -class GraphicBuffer; -class IConsumerListener; -class NativeHandle; - -class IGraphicBufferConsumer : public IInterface { - -public: - enum { - // Returned by releaseBuffer, after which the consumer must - // free any references to the just-released buffer that it might have. - STALE_BUFFER_SLOT = 1, - // Returned by dequeueBuffer if there are no pending buffers available. - NO_BUFFER_AVAILABLE, - // Returned by dequeueBuffer if it's too early for the buffer to be acquired. - PRESENT_LATER, - }; - - // acquireBuffer attempts to acquire ownership of the next pending buffer in - // the BufferQueue. If no buffer is pending then it returns - // NO_BUFFER_AVAILABLE. If a buffer is successfully acquired, the - // information about the buffer is returned in BufferItem. - // - // If the buffer returned had previously been - // acquired then the BufferItem::mGraphicBuffer field of buffer is set to - // NULL and it is assumed that the consumer still holds a reference to the - // buffer. - // - // If presentWhen is non-zero, it indicates the time when the buffer will - // be displayed on screen. If the buffer's timestamp is farther in the - // future, the buffer won't be acquired, and PRESENT_LATER will be - // returned. The presentation time is in nanoseconds, and the time base - // is CLOCK_MONOTONIC. - // - // If maxFrameNumber is non-zero, it indicates that acquireBuffer should - // only return a buffer with a frame number less than or equal to - // maxFrameNumber. If no such frame is available (such as when a buffer has - // been replaced but the consumer has not received the onFrameReplaced - // callback), then PRESENT_LATER will be returned. - // - // Return of NO_ERROR means the operation completed as normal. - // - // Return of a positive value means the operation could not be completed - // at this time, but the user should try again later: - // * NO_BUFFER_AVAILABLE - no buffer is pending (nothing queued by producer) - // * PRESENT_LATER - the buffer's timestamp is farther in the future - // - // Return of a negative value means an error has occurred: - // * INVALID_OPERATION - too many buffers have been acquired - virtual status_t acquireBuffer(BufferItem* buffer, nsecs_t presentWhen, - uint64_t maxFrameNumber = 0) = 0; - - // detachBuffer attempts to remove all ownership of the buffer in the given - // slot from the buffer queue. If this call succeeds, the slot will be - // freed, and there will be no way to obtain the buffer from this interface. - // The freed slot will remain unallocated until either it is selected to - // hold a freshly allocated buffer in dequeueBuffer or a buffer is attached - // to the slot. The buffer must have already been acquired. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - the given slot number is invalid, either because it is - // out of the range [0, NUM_BUFFER_SLOTS) or because the slot - // it refers to is not currently acquired. - virtual status_t detachBuffer(int slot) = 0; - - // attachBuffer attempts to transfer ownership of a buffer to the buffer - // queue. If this call succeeds, it will be as if this buffer was acquired - // from the returned slot number. As such, this call will fail if attaching - // this buffer would cause too many buffers to be simultaneously acquired. - // - // If the buffer is successfully attached, its frameNumber is initialized - // to 0. This must be passed into the releaseBuffer call or else the buffer - // will be deallocated as stale. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - outSlot or buffer were NULL, or the generation number of - // the buffer did not match the buffer queue. - // * INVALID_OPERATION - cannot attach the buffer because it would cause too - // many buffers to be acquired. - // * NO_MEMORY - no free slots available - virtual status_t attachBuffer(int *outSlot, - const sp& buffer) = 0; - - // releaseBuffer releases a buffer slot from the consumer back to the - // BufferQueue. This may be done while the buffer's contents are still - // being accessed. The fence will signal when the buffer is no longer - // in use. frameNumber is used to indentify the exact buffer returned. - // - // If releaseBuffer returns STALE_BUFFER_SLOT, then the consumer must free - // any references to the just-released buffer that it might have, as if it - // had received a onBuffersReleased() call with a mask set for the released - // buffer. - // - // Note that the dependencies on EGL will be removed once we switch to using - // the Android HW Sync HAL. - // - // Return of NO_ERROR means the operation completed as normal. - // - // Return of a positive value means the operation could not be completed - // at this time, but the user should try again later: - // * STALE_BUFFER_SLOT - see above (second paragraph) - // - // Return of a negative value means an error has occurred: - // * BAD_VALUE - one of the following could've happened: - // * the buffer slot was invalid - // * the fence was NULL - // * the buffer slot specified is not in the acquired state - virtual status_t releaseBuffer(int buf, uint64_t frameNumber, - EGLDisplay display, EGLSyncKHR fence, - const sp& releaseFence) = 0; - - // consumerConnect connects a consumer to the BufferQueue. Only one - // consumer may be connected, and when that consumer disconnects the - // BufferQueue is placed into the "abandoned" state, causing most - // interactions with the BufferQueue by the producer to fail. - // controlledByApp indicates whether the consumer is controlled by - // the application. - // - // consumer may not be NULL. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned - // * BAD_VALUE - a NULL consumer was provided - virtual status_t consumerConnect(const sp& consumer, bool controlledByApp) = 0; - - // consumerDisconnect disconnects a consumer from the BufferQueue. All - // buffers will be freed and the BufferQueue is placed in the "abandoned" - // state, causing most interactions with the BufferQueue by the producer to - // fail. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - no consumer is currently connected - virtual status_t consumerDisconnect() = 0; - - // getReleasedBuffers sets the value pointed to by slotMask to a bit set. - // Each bit index with a 1 corresponds to a released buffer slot with that - // index value. In particular, a released buffer is one that has - // been released by the BufferQueue but have not yet been released by the consumer. - // - // This should be called from the onBuffersReleased() callback. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - virtual status_t getReleasedBuffers(uint64_t* slotMask) = 0; - - // setDefaultBufferSize is used to set the size of buffers returned by - // dequeueBuffer when a width and height of zero is requested. Default - // is 1x1. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - either w or h was zero - virtual status_t setDefaultBufferSize(uint32_t w, uint32_t h) = 0; - - // setDefaultMaxBufferCount sets the default value for the maximum buffer - // count (the initial default is 2). If the producer has requested a - // buffer count using setBufferCount, the default buffer count will only - // take effect if the producer sets the count back to zero. - // - // The count must be between 2 and NUM_BUFFER_SLOTS, inclusive. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - bufferCount was out of range (see above). - virtual status_t setDefaultMaxBufferCount(int bufferCount) = 0; - - // disableAsyncBuffer disables the extra buffer used in async mode - // (when both producer and consumer have set their "isControlledByApp" - // flag) and has dequeueBuffer() return WOULD_BLOCK instead. - // - // This can only be called before consumerConnect(). - // - // Return of a value other than NO_ERROR means an error has occurred: - // * INVALID_OPERATION - attempting to call this after consumerConnect. - virtual status_t disableAsyncBuffer() = 0; - - // setMaxAcquiredBufferCount sets the maximum number of buffers that can - // be acquired by the consumer at one time (default 1). This call will - // fail if a producer is connected to the BufferQueue. - // - // maxAcquiredBuffers must be (inclusive) between 1 and MAX_MAX_ACQUIRED_BUFFERS. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - maxAcquiredBuffers was out of range (see above). - // * INVALID_OPERATION - attempting to call this after a producer connected. - virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers) = 0; - - // setConsumerName sets the name used in logging - virtual void setConsumerName(const String8& name) = 0; - - // setDefaultBufferFormat allows the BufferQueue to create - // GraphicBuffers of a defaultFormat if no format is specified - // in dequeueBuffer. - // The initial default is PIXEL_FORMAT_RGBA_8888. - // - // Return of a value other than NO_ERROR means an unknown error has occurred. - virtual status_t setDefaultBufferFormat(PixelFormat defaultFormat) = 0; - - // setDefaultBufferDataSpace is a request to the producer to provide buffers - // of the indicated dataSpace. The producer may ignore this request. - // The initial default is HAL_DATASPACE_UNKNOWN. - // - // Return of a value other than NO_ERROR means an unknown error has occurred. - virtual status_t setDefaultBufferDataSpace( - android_dataspace defaultDataSpace) = 0; - - // setConsumerUsageBits will turn on additional usage bits for dequeueBuffer. - // These are merged with the bits passed to dequeueBuffer. The values are - // enumerated in gralloc.h, e.g. GRALLOC_USAGE_HW_RENDER; the default is 0. - // - // Return of a value other than NO_ERROR means an unknown error has occurred. - virtual status_t setConsumerUsageBits(uint32_t usage) = 0; - - // setTransformHint bakes in rotation to buffers so overlays can be used. - // The values are enumerated in window.h, e.g. - // NATIVE_WINDOW_TRANSFORM_ROT_90. The default is 0 (no transform). - // - // Return of a value other than NO_ERROR means an unknown error has occurred. - virtual status_t setTransformHint(uint32_t hint) = 0; - - // Retrieve the sideband buffer stream, if any. - virtual sp getSidebandStream() const = 0; - - // dump state into a string - virtual void dump(String8& result, const char* prefix) const = 0; - -public: - DECLARE_META_INTERFACE(GraphicBufferConsumer); -}; - -// ---------------------------------------------------------------------------- - -class BnGraphicBufferConsumer : public BnInterface -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_IGRAPHICBUFFERCONSUMER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/IGraphicBufferProducer.h android-platform-frameworks-native-21/include/gui/IGraphicBufferProducer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/IGraphicBufferProducer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/IGraphicBufferProducer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,502 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H -#define ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H - -#include -#include - -#include -#include - -#include - -#include -#include -#include -#include - -namespace android { -// ---------------------------------------------------------------------------- - -class IProducerListener; -class NativeHandle; -class Surface; - -/* - * This class defines the Binder IPC interface for the producer side of - * a queue of graphics buffers. It's used to send graphics data from one - * component to another. For example, a class that decodes video for - * playback might use this to provide frames. This is typically done - * indirectly, through Surface. - * - * The underlying mechanism is a BufferQueue, which implements - * BnGraphicBufferProducer. In normal operation, the producer calls - * dequeueBuffer() to get an empty buffer, fills it with data, then - * calls queueBuffer() to make it available to the consumer. - * - * This class was previously called ISurfaceTexture. - */ -class IGraphicBufferProducer : public IInterface -{ -public: - DECLARE_META_INTERFACE(GraphicBufferProducer); - - enum { - // A flag returned by dequeueBuffer when the client needs to call - // requestBuffer immediately thereafter. - BUFFER_NEEDS_REALLOCATION = 0x1, - // A flag returned by dequeueBuffer when all mirrored slots should be - // released by the client. This flag should always be processed first. - RELEASE_ALL_BUFFERS = 0x2, - }; - - // requestBuffer requests a new buffer for the given index. The server (i.e. - // the IGraphicBufferProducer implementation) assigns the newly created - // buffer to the given slot index, and the client is expected to mirror the - // slot->buffer mapping so that it's not necessary to transfer a - // GraphicBuffer for every dequeue operation. - // - // The slot must be in the range of [0, NUM_BUFFER_SLOTS). - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - one of the two conditions occurred: - // * slot was out of range (see above) - // * buffer specified by the slot is not dequeued - virtual status_t requestBuffer(int slot, sp* buf) = 0; - - // setBufferCount sets the number of buffer slots available. Calling this - // will also cause all buffer slots to be emptied. The caller should empty - // its mirrored copy of the buffer slots when calling this method. - // - // This function should not be called when there are any dequeued buffer - // slots, doing so will result in a BAD_VALUE error returned. - // - // The buffer count should be at most NUM_BUFFER_SLOTS (inclusive), but at least - // the minimum undequeued buffer count (exclusive). The minimum value - // can be obtained by calling query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS). - // In particular the range is (minUndequeudBuffers, NUM_BUFFER_SLOTS]. - // - // The buffer count may also be set to 0 (the default), to indicate that - // the producer does not wish to set a value. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - one of the below conditions occurred: - // * bufferCount was out of range (see above) - // * client has one or more buffers dequeued - virtual status_t setBufferCount(int bufferCount) = 0; - - // dequeueBuffer requests a new buffer slot for the client to use. Ownership - // of the slot is transfered to the client, meaning that the server will not - // use the contents of the buffer associated with that slot. - // - // The slot index returned may or may not contain a buffer (client-side). - // If the slot is empty the client should call requestBuffer to assign a new - // buffer to that slot. - // - // Once the client is done filling this buffer, it is expected to transfer - // buffer ownership back to the server with either cancelBuffer on - // the dequeued slot or to fill in the contents of its associated buffer - // contents and call queueBuffer. - // - // If dequeueBuffer returns the BUFFER_NEEDS_REALLOCATION flag, the client is - // expected to call requestBuffer immediately. - // - // If dequeueBuffer returns the RELEASE_ALL_BUFFERS flag, the client is - // expected to release all of the mirrored slot->buffer mappings. - // - // The fence parameter will be updated to hold the fence associated with - // the buffer. The contents of the buffer must not be overwritten until the - // fence signals. If the fence is Fence::NO_FENCE, the buffer may be written - // immediately. - // - // The async parameter sets whether we're in asynchronous mode for this - // dequeueBuffer() call. - // - // The width and height parameters must be no greater than the minimum of - // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). - // An error due to invalid dimensions might not be reported until - // updateTexImage() is called. If width and height are both zero, the - // default values specified by setDefaultBufferSize() are used instead. - // - // If the format is 0, the default format will be used. - // - // The usage argument specifies gralloc buffer usage flags. The values - // are enumerated in , e.g. GRALLOC_USAGE_HW_RENDER. These - // will be merged with the usage flags specified by - // IGraphicBufferConsumer::setConsumerUsageBits. - // - // This call will block until a buffer is available to be dequeued. If - // both the producer and consumer are controlled by the app, then this call - // can never block and will return WOULD_BLOCK if no buffer is available. - // - // A non-negative value with flags set (see above) will be returned upon - // success. - // - // Return of a negative means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - both in async mode and buffer count was less than the - // max numbers of buffers that can be allocated at once. - // * INVALID_OPERATION - cannot attach the buffer because it would cause - // too many buffers to be dequeued, either because - // the producer already has a single buffer dequeued - // and did not set a buffer count, or because a - // buffer count was set and this call would cause - // it to be exceeded. - // * WOULD_BLOCK - no buffer is currently available, and blocking is disabled - // since both the producer/consumer are controlled by app - // * NO_MEMORY - out of memory, cannot allocate the graphics buffer. - // - // All other negative values are an unknown error returned downstream - // from the graphics allocator (typically errno). - virtual status_t dequeueBuffer(int* slot, sp* fence, bool async, - uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) = 0; - - // detachBuffer attempts to remove all ownership of the buffer in the given - // slot from the buffer queue. If this call succeeds, the slot will be - // freed, and there will be no way to obtain the buffer from this interface. - // The freed slot will remain unallocated until either it is selected to - // hold a freshly allocated buffer in dequeueBuffer or a buffer is attached - // to the slot. The buffer must have already been dequeued, and the caller - // must already possesses the sp (i.e., must have called - // requestBuffer). - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - the given slot number is invalid, either because it is - // out of the range [0, NUM_BUFFER_SLOTS), or because the slot - // it refers to is not currently dequeued and requested. - virtual status_t detachBuffer(int slot) = 0; - - // detachNextBuffer is equivalent to calling dequeueBuffer, requestBuffer, - // and detachBuffer in sequence, except for two things: - // - // 1) It is unnecessary to know the dimensions, format, or usage of the - // next buffer. - // 2) It will not block, since if it cannot find an appropriate buffer to - // return, it will return an error instead. - // - // Only slots that are free but still contain a GraphicBuffer will be - // considered, and the oldest of those will be returned. outBuffer is - // equivalent to outBuffer from the requestBuffer call, and outFence is - // equivalent to fence from the dequeueBuffer call. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - either outBuffer or outFence were NULL. - // * NO_MEMORY - no slots were found that were both free and contained a - // GraphicBuffer. - virtual status_t detachNextBuffer(sp* outBuffer, - sp* outFence) = 0; - - // attachBuffer attempts to transfer ownership of a buffer to the buffer - // queue. If this call succeeds, it will be as if this buffer was dequeued - // from the returned slot number. As such, this call will fail if attaching - // this buffer would cause too many buffers to be simultaneously dequeued. - // - // If attachBuffer returns the RELEASE_ALL_BUFFERS flag, the caller is - // expected to release all of the mirrored slot->buffer mappings. - // - // A non-negative value with flags set (see above) will be returned upon - // success. - // - // Return of a negative value means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - outSlot or buffer were NULL, invalid combination of - // async mode and buffer count override, or the generation - // number of the buffer did not match the buffer queue. - // * INVALID_OPERATION - cannot attach the buffer because it would cause - // too many buffers to be dequeued, either because - // the producer already has a single buffer dequeued - // and did not set a buffer count, or because a - // buffer count was set and this call would cause - // it to be exceeded. - // * WOULD_BLOCK - no buffer slot is currently available, and blocking is - // disabled since both the producer/consumer are - // controlled by the app. - virtual status_t attachBuffer(int* outSlot, - const sp& buffer) = 0; - - // queueBuffer indicates that the client has finished filling in the - // contents of the buffer associated with slot and transfers ownership of - // that slot back to the server. - // - // It is not valid to call queueBuffer on a slot that is not owned - // by the client or one for which a buffer associated via requestBuffer - // (an attempt to do so will fail with a return value of BAD_VALUE). - // - // In addition, the input must be described by the client (as documented - // below). Any other properties (zero point, etc) - // are client-dependent, and should be documented by the client. - // - // The slot must be in the range of [0, NUM_BUFFER_SLOTS). - // - // Upon success, the output will be filled with meaningful values - // (refer to the documentation below). - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - one of the below conditions occurred: - // * fence was NULL - // * scaling mode was unknown - // * both in async mode and buffer count was less than the - // max numbers of buffers that can be allocated at once - // * slot index was out of range (see above). - // * the slot was not in the dequeued state - // * the slot was enqueued without requesting a buffer - // * crop rect is out of bounds of the buffer dimensions - - struct QueueBufferInput : public Flattenable { - friend class Flattenable; - inline QueueBufferInput(const Parcel& parcel); - // timestamp - a monotonically increasing value in nanoseconds - // isAutoTimestamp - if the timestamp was synthesized at queue time - // dataSpace - description of the contents, interpretation depends on format - // crop - a crop rectangle that's used as a hint to the consumer - // scalingMode - a set of flags from NATIVE_WINDOW_SCALING_* in - // transform - a set of flags from NATIVE_WINDOW_TRANSFORM_* in - // async - if the buffer is queued in asynchronous mode - // fence - a fence that the consumer must wait on before reading the buffer, - // set this to Fence::NO_FENCE if the buffer is ready immediately - // sticky - the sticky transform set in Surface (only used by the LEGACY - // camera mode). - inline QueueBufferInput(int64_t timestamp, bool isAutoTimestamp, - android_dataspace dataSpace, const Rect& crop, int scalingMode, - uint32_t transform, bool async, const sp& fence, - uint32_t sticky = 0) - : timestamp(timestamp), isAutoTimestamp(isAutoTimestamp), - dataSpace(dataSpace), crop(crop), scalingMode(scalingMode), - transform(transform), stickyTransform(sticky), - async(async), fence(fence), surfaceDamage() { } - inline void deflate(int64_t* outTimestamp, bool* outIsAutoTimestamp, - android_dataspace* outDataSpace, - Rect* outCrop, int* outScalingMode, - uint32_t* outTransform, bool* outAsync, sp* outFence, - uint32_t* outStickyTransform = NULL) const { - *outTimestamp = timestamp; - *outIsAutoTimestamp = bool(isAutoTimestamp); - *outDataSpace = dataSpace; - *outCrop = crop; - *outScalingMode = scalingMode; - *outTransform = transform; - *outAsync = bool(async); - *outFence = fence; - if (outStickyTransform != NULL) { - *outStickyTransform = stickyTransform; - } - } - - // Flattenable protocol - size_t getFlattenedSize() const; - size_t getFdCount() const; - status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const; - status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count); - - const Region& getSurfaceDamage() const { return surfaceDamage; } - void setSurfaceDamage(const Region& damage) { surfaceDamage = damage; } - - private: - int64_t timestamp; - int isAutoTimestamp; - android_dataspace dataSpace; - Rect crop; - int scalingMode; - uint32_t transform; - uint32_t stickyTransform; - int async; - sp fence; - Region surfaceDamage; - }; - - // QueueBufferOutput must be a POD structure - struct __attribute__ ((__packed__)) QueueBufferOutput { - inline QueueBufferOutput() { } - // outWidth - filled with default width applied to the buffer - // outHeight - filled with default height applied to the buffer - // outTransformHint - filled with default transform applied to the buffer - // outNumPendingBuffers - num buffers queued that haven't yet been acquired - // (counting the currently queued buffer) - inline void deflate(uint32_t* outWidth, - uint32_t* outHeight, - uint32_t* outTransformHint, - uint32_t* outNumPendingBuffers) const { - *outWidth = width; - *outHeight = height; - *outTransformHint = transformHint; - *outNumPendingBuffers = numPendingBuffers; - } - inline void inflate(uint32_t inWidth, uint32_t inHeight, - uint32_t inTransformHint, uint32_t inNumPendingBuffers) { - width = inWidth; - height = inHeight; - transformHint = inTransformHint; - numPendingBuffers = inNumPendingBuffers; - } - private: - uint32_t width; - uint32_t height; - uint32_t transformHint; - uint32_t numPendingBuffers; - }; - - virtual status_t queueBuffer(int slot, - const QueueBufferInput& input, QueueBufferOutput* output) = 0; - - // cancelBuffer indicates that the client does not wish to fill in the - // buffer associated with slot and transfers ownership of the slot back to - // the server. - // - // The buffer is not queued for use by the consumer. - // - // The buffer will not be overwritten until the fence signals. The fence - // will usually be the one obtained from dequeueBuffer. - virtual void cancelBuffer(int slot, const sp& fence) = 0; - - // query retrieves some information for this surface - // 'what' tokens allowed are that of NATIVE_WINDOW_* in - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - the buffer queue has been abandoned. - // * BAD_VALUE - what was out of range - virtual int query(int what, int* value) = 0; - - // connect attempts to connect a client API to the IGraphicBufferProducer. - // This must be called before any other IGraphicBufferProducer methods are - // called except for getAllocator. A consumer must be already connected. - // - // This method will fail if the connect was previously called on the - // IGraphicBufferProducer and no corresponding disconnect call was made. - // - // The listener is an optional binder callback object that can be used if - // the producer wants to be notified when the consumer releases a buffer - // back to the BufferQueue. It is also used to detect the death of the - // producer. If only the latter functionality is desired, there is a - // DummyProducerListener class in IProducerListener.h that can be used. - // - // The api should be one of the NATIVE_WINDOW_API_* values in - // - // The producerControlledByApp should be set to true if the producer is hosted - // by an untrusted process (typically app_process-forked processes). If both - // the producer and the consumer are app-controlled then all buffer queues - // will operate in async mode regardless of the async flag. - // - // Upon success, the output will be filled with meaningful data - // (refer to QueueBufferOutput documentation above). - // - // Return of a value other than NO_ERROR means an error has occurred: - // * NO_INIT - one of the following occurred: - // * the buffer queue was abandoned - // * no consumer has yet connected - // * BAD_VALUE - one of the following has occurred: - // * the producer is already connected - // * api was out of range (see above). - // * output was NULL. - // * DEAD_OBJECT - the token is hosted by an already-dead process - // - // Additional negative errors may be returned by the internals, they - // should be treated as opaque fatal unrecoverable errors. - virtual status_t connect(const sp& listener, - int api, bool producerControlledByApp, QueueBufferOutput* output) = 0; - - // disconnect attempts to disconnect a client API from the - // IGraphicBufferProducer. Calling this method will cause any subsequent - // calls to other IGraphicBufferProducer methods to fail except for - // getAllocator and connect. Successfully calling connect after this will - // allow the other methods to succeed again. - // - // This method will fail if the the IGraphicBufferProducer is not currently - // connected to the specified client API. - // - // The api should be one of the NATIVE_WINDOW_API_* values in - // - // Disconnecting from an abandoned IGraphicBufferProducer is legal and - // is considered a no-op. - // - // Return of a value other than NO_ERROR means an error has occurred: - // * BAD_VALUE - one of the following has occurred: - // * the api specified does not match the one that was connected - // * api was out of range (see above). - // * DEAD_OBJECT - the token is hosted by an already-dead process - virtual status_t disconnect(int api) = 0; - - // Attaches a sideband buffer stream to the IGraphicBufferProducer. - // - // A sideband stream is a device-specific mechanism for passing buffers - // from the producer to the consumer without using dequeueBuffer/ - // queueBuffer. If a sideband stream is present, the consumer can choose - // whether to acquire buffers from the sideband stream or from the queued - // buffers. - // - // Passing NULL or a different stream handle will detach the previous - // handle if any. - virtual status_t setSidebandStream(const sp& stream) = 0; - - // Allocates buffers based on the given dimensions/format. - // - // This function will allocate up to the maximum number of buffers - // permitted by the current BufferQueue configuration. It will use the - // given format, dimensions, and usage bits, which are interpreted in the - // same way as for dequeueBuffer, and the async flag must be set the same - // way as for dequeueBuffer to ensure that the correct number of buffers are - // allocated. This is most useful to avoid an allocation delay during - // dequeueBuffer. If there are already the maximum number of buffers - // allocated, this function has no effect. - virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - PixelFormat format, uint32_t usage) = 0; - - // Sets whether dequeueBuffer is allowed to allocate new buffers. - // - // Normally dequeueBuffer does not discriminate between free slots which - // already have an allocated buffer and those which do not, and will - // allocate a new buffer if the slot doesn't have a buffer or if the slot's - // buffer doesn't match the requested size, format, or usage. This method - // allows the producer to restrict the eligible slots to those which already - // have an allocated buffer of the correct size, format, and usage. If no - // eligible slot is available, dequeueBuffer will block or return an error - // as usual. - virtual status_t allowAllocation(bool allow) = 0; - - // Sets the current generation number of the BufferQueue. - // - // This generation number will be inserted into any buffers allocated by the - // BufferQueue, and any attempts to attach a buffer with a different - // generation number will fail. Buffers already in the queue are not - // affected and will retain their current generation number. The generation - // number defaults to 0. - virtual status_t setGenerationNumber(uint32_t generationNumber) = 0; - - // Returns the name of the connected consumer. - virtual String8 getConsumerName() const = 0; -}; - -// ---------------------------------------------------------------------------- - -class BnGraphicBufferProducer : public BnInterface -{ -public: - virtual status_t onTransact( uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags = 0); -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_IGRAPHICBUFFERPRODUCER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/IProducerListener.h android-platform-frameworks-native-21/include/gui/IProducerListener.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/IProducerListener.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/IProducerListener.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_IPRODUCERLISTENER_H -#define ANDROID_GUI_IPRODUCERLISTENER_H - -#include - -#include - -namespace android { - -// ProducerListener is the interface through which the BufferQueue notifies the -// producer of events that the producer may wish to react to. Because the -// producer will generally have a mutex that is locked during calls from the -// producer to the BufferQueue, these calls from the BufferQueue to the -// producer *MUST* be called only when the BufferQueue mutex is NOT locked. - -class ProducerListener : public virtual RefBase -{ -public: - ProducerListener() {} - virtual ~ProducerListener() {} - - // onBufferReleased is called from IGraphicBufferConsumer::releaseBuffer to - // notify the producer that a new buffer is free and ready to be dequeued. - // - // This is called without any lock held and can be called concurrently by - // multiple threads. - virtual void onBufferReleased() = 0; // Asynchronous -}; - -class IProducerListener : public ProducerListener, public IInterface -{ -public: - DECLARE_META_INTERFACE(ProducerListener) -}; - -class BnProducerListener : public BnInterface -{ -public: - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); -}; - -class DummyProducerListener : public BnProducerListener -{ -public: - virtual void onBufferReleased() {} -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ISensorEventConnection.h android-platform-frameworks-native-21/include/gui/ISensorEventConnection.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ISensorEventConnection.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ISensorEventConnection.h 2012-10-16 22:57:11.000000000 +0000 @@ -36,10 +36,8 @@ DECLARE_META_INTERFACE(SensorEventConnection); virtual sp getSensorChannel() const = 0; - virtual status_t enableDisable(int handle, bool enabled, nsecs_t samplingPeriodNs, - nsecs_t maxBatchReportLatencyNs, int reservedFlags) = 0; + virtual status_t enableDisable(int handle, bool enabled) = 0; virtual status_t setEventRate(int handle, nsecs_t ns) = 0; - virtual status_t flush() = 0; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ISensorServer.h android-platform-frameworks-native-21/include/gui/ISensorServer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ISensorServer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ISensorServer.h 2012-10-16 22:57:11.000000000 +0000 @@ -30,17 +30,14 @@ class Sensor; class ISensorEventConnection; -class String8; class ISensorServer : public IInterface { public: DECLARE_META_INTERFACE(SensorServer); - virtual Vector getSensorList(const String16& opPackageName) = 0; - virtual sp createSensorEventConnection(const String8& packageName, - int mode, const String16& opPackageName) = 0; - virtual int32_t isDataInjectionEnabled() = 0; + virtual Vector getSensorList() = 0; + virtual sp createSensorEventConnection() = 0; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ISurfaceComposerClient.h android-platform-frameworks-native-21/include/gui/ISurfaceComposerClient.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ISurfaceComposerClient.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ISurfaceComposerClient.h 2012-10-16 22:57:11.000000000 +0000 @@ -25,66 +25,56 @@ #include -#include #include +#include + namespace android { + // ---------------------------------------------------------------------------- -class IGraphicBufferProducer; +typedef int32_t DisplayID; + +// ---------------------------------------------------------------------------- class ISurfaceComposerClient : public IInterface { public: DECLARE_META_INTERFACE(SurfaceComposerClient); - // flags for createSurface() - enum { // (keep in sync with Surface.java) - eHidden = 0x00000004, - eDestroyBackbuffer = 0x00000020, - eSecure = 0x00000080, - eNonPremultiplied = 0x00000100, - eOpaque = 0x00000400, - eProtectedByApp = 0x00000800, - eProtectedByDRM = 0x00001000, - eCursorWindow = 0x00002000, - - eFXSurfaceNormal = 0x00000000, - eFXSurfaceDim = 0x00020000, - eFXSurfaceMask = 0x000F0000, + struct surface_data_t { + int32_t token; + int32_t identity; + status_t readFromParcel(const Parcel& parcel); + status_t writeToParcel(Parcel* parcel) const; }; /* * Requires ACCESS_SURFACE_FLINGER permission */ - virtual status_t createSurface( - const String8& name, uint32_t w, uint32_t h, - PixelFormat format, uint32_t flags, - sp* handle, - sp* gbp) = 0; + virtual sp createSurface( surface_data_t* data, + const String8& name, + DisplayID display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) = 0; /* * Requires ACCESS_SURFACE_FLINGER permission */ - virtual status_t destroySurface(const sp& handle) = 0; - - /* - * Requires ACCESS_SURFACE_FLINGER permission - */ - virtual status_t clearLayerFrameStats(const sp& handle) const = 0; - - /* - * Requires ACCESS_SURFACE_FLINGER permission - */ - virtual status_t getLayerFrameStats(const sp& handle, FrameStats* outStats) const = 0; + virtual status_t destroySurface(SurfaceID sid) = 0; }; // ---------------------------------------------------------------------------- -class BnSurfaceComposerClient: public BnInterface { +class BnSurfaceComposerClient : public BnInterface +{ public: - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ISurfaceComposer.h android-platform-frameworks-native-21/include/gui/ISurfaceComposer.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ISurfaceComposer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ISurfaceComposer.h 2012-10-16 22:57:11.000000000 +0000 @@ -22,12 +22,10 @@ #include #include -#include -#include #include -#include +#include #include #include @@ -36,37 +34,70 @@ // ---------------------------------------------------------------------------- class ComposerState; -class DisplayState; -struct DisplayInfo; -struct DisplayStatInfo; class IDisplayEventConnection; class IMemoryHeap; -class Rect; -/* - * This class defines the Binder IPC interface for accessing various - * SurfaceFlinger features. - */ -class ISurfaceComposer: public IInterface { +class ISurfaceComposer : public IInterface +{ public: DECLARE_META_INTERFACE(SurfaceComposer); - // flags for setTransactionState() + enum { // (keep in sync with Surface.java) + eHidden = 0x00000004, + eDestroyBackbuffer = 0x00000020, + eSecure = 0x00000080, + eNonPremultiplied = 0x00000100, + eOpaque = 0x00000400, + eProtectedByApp = 0x00000800, + eProtectedByDRM = 0x00001000, + + eFXSurfaceNormal = 0x00000000, + eFXSurfaceBlur = 0x00010000, + eFXSurfaceDim = 0x00020000, + eFXSurfaceScreenshot= 0x00030000, + eFXSurfaceMask = 0x000F0000, + }; + + enum { + ePositionChanged = 0x00000001, + eLayerChanged = 0x00000002, + eSizeChanged = 0x00000004, + eAlphaChanged = 0x00000008, + eMatrixChanged = 0x00000010, + eTransparentRegionChanged = 0x00000020, + eVisibilityChanged = 0x00000040, + eFreezeTintChanged = 0x00000080, + eCropChanged = 0x00000100, + }; + + enum { + eLayerHidden = 0x01, + eLayerFrozen = 0x02, + eLayerDither = 0x04, + eLayerFilter = 0x08, + eLayerBlurFreeze = 0x10 + }; + + enum { + eOrientationDefault = 0, + eOrientation90 = 1, + eOrientation180 = 2, + eOrientation270 = 3, + eOrientationUnchanged = 4, + eOrientationSwapMask = 0x01 + }; + enum { - eSynchronous = 0x01, - eAnimation = 0x02, + eSynchronous = 0x01, }; enum { - eDisplayIdMain = 0, - eDisplayIdHdmi = 1 + eElectronBeamAnimationOn = 0x01, + eElectronBeamAnimationOff = 0x10 }; - enum Rotation { - eRotateNone = 0, - eRotate90 = 1, - eRotate180 = 2, - eRotate270 = 3 + enum { + eDisplayIdMain = 0 }; /* create connection with surface flinger, requires @@ -78,90 +109,46 @@ */ virtual sp createGraphicBufferAlloc() = 0; - /* return an IDisplayEventConnection */ - virtual sp createDisplayEventConnection() = 0; - - /* create a virtual display - * requires ACCESS_SURFACE_FLINGER permission. - */ - virtual sp createDisplay(const String8& displayName, - bool secure) = 0; - - /* destroy a virtual display - * requires ACCESS_SURFACE_FLINGER permission. - */ - virtual void destroyDisplay(const sp& display) = 0; - - /* get the token for the existing default displays. possible values - * for id are eDisplayIdMain and eDisplayIdHdmi. - */ - virtual sp getBuiltInDisplay(int32_t id) = 0; + /* retrieve the control block */ + virtual sp getCblk() const = 0; /* open/close transactions. requires ACCESS_SURFACE_FLINGER permission */ virtual void setTransactionState(const Vector& state, - const Vector& displays, uint32_t flags) = 0; + int orientation, uint32_t flags) = 0; /* signal that we're done booting. * Requires ACCESS_SURFACE_FLINGER permission */ virtual void bootFinished() = 0; - /* verify that an IGraphicBufferProducer was created by SurfaceFlinger. + /* Capture the specified screen. requires READ_FRAME_BUFFER permission + * This function will fail if there is a secure window on screen. */ - virtual bool authenticateSurfaceTexture( - const sp& surface) const = 0; + virtual status_t captureScreen(DisplayID dpy, + sp* heap, + uint32_t* width, uint32_t* height, PixelFormat* format, + uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ) = 0; - /* set display power mode. depending on the mode, it can either trigger - * screen on, off or low power mode and wait for it to complete. - * requires ACCESS_SURFACE_FLINGER permission. - */ - virtual void setPowerMode(const sp& display, int mode) = 0; + /* triggers screen off animation */ + virtual status_t turnElectronBeamOff(int32_t mode) = 0; - /* returns information for each configuration of the given display - * intended to be used to get information about built-in displays */ - virtual status_t getDisplayConfigs(const sp& display, - Vector* configs) = 0; - - /* returns display statistics for a given display - * intended to be used by the media framework to properly schedule - * video frames */ - virtual status_t getDisplayStats(const sp& display, - DisplayStatInfo* stats) = 0; - - /* indicates which of the configurations returned by getDisplayInfo is - * currently active */ - virtual int getActiveConfig(const sp& display) = 0; - - /* specifies which configuration (of those returned by getDisplayInfo) - * should be used */ - virtual status_t setActiveConfig(const sp& display, int id) = 0; + /* triggers screen on animation */ + virtual status_t turnElectronBeamOn(int32_t mode) = 0; - /* Capture the specified screen. requires READ_FRAME_BUFFER permission - * This function will fail if there is a secure window on screen. - */ - virtual status_t captureScreen(const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, - Rotation rotation = eRotateNone) = 0; - - /* Clears the frame statistics for animations. - * - * Requires the ACCESS_SURFACE_FLINGER permission. + /* verify that an ISurfaceTexture was created by SurfaceFlinger. */ - virtual status_t clearAnimationFrameStats() = 0; + virtual bool authenticateSurfaceTexture( + const sp& surface) const = 0; - /* Gets the frame statistics for animations. - * - * Requires the ACCESS_SURFACE_FLINGER permission. - */ - virtual status_t getAnimationFrameStats(FrameStats* outStats) const = 0; + /* return an IDisplayEventConnection */ + virtual sp createDisplayEventConnection() = 0; }; // ---------------------------------------------------------------------------- -class BnSurfaceComposer: public BnInterface { +class BnSurfaceComposer : public BnInterface +{ public: enum { // Note: BOOT_FINISHED must remain this value, it is called from @@ -169,25 +156,20 @@ BOOT_FINISHED = IBinder::FIRST_CALL_TRANSACTION, CREATE_CONNECTION, CREATE_GRAPHIC_BUFFER_ALLOC, - CREATE_DISPLAY_EVENT_CONNECTION, - CREATE_DISPLAY, - DESTROY_DISPLAY, - GET_BUILT_IN_DISPLAY, + GET_CBLK, SET_TRANSACTION_STATE, - AUTHENTICATE_SURFACE, - GET_DISPLAY_CONFIGS, - GET_ACTIVE_CONFIG, - SET_ACTIVE_CONFIG, - CONNECT_DISPLAY, + SET_ORIENTATION, CAPTURE_SCREEN, - CLEAR_ANIMATION_FRAME_STATS, - GET_ANIMATION_FRAME_STATS, - SET_POWER_MODE, - GET_DISPLAY_STATS, + TURN_ELECTRON_BEAM_OFF, + TURN_ELECTRON_BEAM_ON, + AUTHENTICATE_SURFACE, + CREATE_DISPLAY_EVENT_CONNECTION, }; - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ISurface.h android-platform-frameworks-native-21/include/gui/ISurface.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ISurface.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ISurface.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_GUI_ISURFACE_H +#define ANDROID_GUI_ISURFACE_H + +#include +#include + +#include +#include + +#include + +#include + +namespace android { + +typedef int32_t SurfaceID; + +class ISurfaceTexture; + +class ISurface : public IInterface +{ +protected: + enum { + GET_SURFACE_TEXTURE = IBinder::FIRST_CALL_TRANSACTION, + }; + +public: + DECLARE_META_INTERFACE(Surface); + + virtual sp getSurfaceTexture() const = 0; +}; + +// ---------------------------------------------------------------------------- + +class BnSurface : public BnInterface +{ +public: + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); +}; + +// ---------------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_GUI_ISURFACE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/ISurfaceTexture.h android-platform-frameworks-native-21/include/gui/ISurfaceTexture.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/ISurfaceTexture.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/ISurfaceTexture.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,188 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_GUI_ISURFACETEXTURE_H +#define ANDROID_GUI_ISURFACETEXTURE_H + +#include +#include + +#include +#include + +#include + +#include +#include + +namespace android { +// ---------------------------------------------------------------------------- + +class SurfaceTextureClient; + +class ISurfaceTexture : public IInterface +{ +public: + DECLARE_META_INTERFACE(SurfaceTexture); + +protected: + friend class SurfaceTextureClient; + + enum { + BUFFER_NEEDS_REALLOCATION = 0x1, + RELEASE_ALL_BUFFERS = 0x2, + }; + + // requestBuffer requests a new buffer for the given index. The server (i.e. + // the ISurfaceTexture implementation) assigns the newly created buffer to + // the given slot index, and the client is expected to mirror the + // slot->buffer mapping so that it's not necessary to transfer a + // GraphicBuffer for every dequeue operation. + virtual status_t requestBuffer(int slot, sp* buf) = 0; + + // setBufferCount sets the number of buffer slots available. Calling this + // will also cause all buffer slots to be emptied. The caller should empty + // its mirrored copy of the buffer slots when calling this method. + virtual status_t setBufferCount(int bufferCount) = 0; + + // dequeueBuffer requests a new buffer slot for the client to use. Ownership + // of the slot is transfered to the client, meaning that the server will not + // use the contents of the buffer associated with that slot. The slot index + // returned may or may not contain a buffer. If the slot is empty the client + // should call requestBuffer to assign a new buffer to that slot. The client + // is expected to either call cancelBuffer on the dequeued slot or to fill + // in the contents of its associated buffer contents and call queueBuffer. + // If dequeueBuffer return BUFFER_NEEDS_REALLOCATION, the client is + // expected to call requestBuffer immediately. + virtual status_t dequeueBuffer(int *slot, uint32_t w, uint32_t h, + uint32_t format, uint32_t usage) = 0; + + // queueBuffer indicates that the client has finished filling in the + // contents of the buffer associated with slot and transfers ownership of + // that slot back to the server. It is not valid to call queueBuffer on a + // slot that is not owned by the client or one for which a buffer associated + // via requestBuffer. In addition, a timestamp must be provided by the + // client for this buffer. The timestamp is measured in nanoseconds, and + // must be monotonically increasing. Its other properties (zero point, etc) + // are client-dependent, and should be documented by the client. + // + // outWidth, outHeight and outTransform are filled with the default width + // and height of the window and current transform applied to buffers, + // respectively. + + // QueueBufferInput must be a POD structure + struct QueueBufferInput { + inline QueueBufferInput(int64_t timestamp, + const Rect& crop, int scalingMode, uint32_t transform) + : timestamp(timestamp), crop(crop), scalingMode(scalingMode), + transform(transform) { } + inline void deflate(int64_t* outTimestamp, Rect* outCrop, + int* outScalingMode, uint32_t* outTransform) const { + *outTimestamp = timestamp; + *outCrop = crop; + *outScalingMode = scalingMode; + *outTransform = transform; + } + private: + int64_t timestamp; + Rect crop; + int scalingMode; + uint32_t transform; + }; + + // QueueBufferOutput must be a POD structure + struct QueueBufferOutput { + inline QueueBufferOutput() { } + inline void deflate(uint32_t* outWidth, + uint32_t* outHeight, + uint32_t* outTransformHint, + uint32_t* outNumPendingBuffers) const { + *outWidth = width; + *outHeight = height; + *outTransformHint = transformHint; + *outNumPendingBuffers = numPendingBuffers; + } + inline void inflate(uint32_t inWidth, uint32_t inHeight, + uint32_t inTransformHint, uint32_t inNumPendingBuffers) { + width = inWidth; + height = inHeight; + transformHint = inTransformHint; + numPendingBuffers = inNumPendingBuffers; + } + private: + uint32_t width; + uint32_t height; + uint32_t transformHint; + uint32_t numPendingBuffers; + }; + + virtual status_t queueBuffer(int slot, + const QueueBufferInput& input, QueueBufferOutput* output) = 0; + + // cancelBuffer indicates that the client does not wish to fill in the + // buffer associated with slot and transfers ownership of the slot back to + // the server. + virtual void cancelBuffer(int slot) = 0; + + // query retrieves some information for this surface + // 'what' tokens allowed are that of android_natives.h + virtual int query(int what, int* value) = 0; + + // setSynchronousMode set whether dequeueBuffer is synchronous or + // asynchronous. In synchronous mode, dequeueBuffer blocks until + // a buffer is available, the currently bound buffer can be dequeued and + // queued buffers will be retired in order. + // The default mode is asynchronous. + virtual status_t setSynchronousMode(bool enabled) = 0; + + // connect attempts to connect a client API to the SurfaceTexture. This + // must be called before any other ISurfaceTexture methods are called except + // for getAllocator. + // + // This method will fail if the connect was previously called on the + // SurfaceTexture and no corresponding disconnect call was made. + // + // outWidth, outHeight and outTransform are filled with the default width + // and height of the window and current transform applied to buffers, + // respectively. + virtual status_t connect(int api, QueueBufferOutput* output) = 0; + + // disconnect attempts to disconnect a client API from the SurfaceTexture. + // Calling this method will cause any subsequent calls to other + // ISurfaceTexture methods to fail except for getAllocator and connect. + // Successfully calling connect after this will allow the other methods to + // succeed again. + // + // This method will fail if the the SurfaceTexture is not currently + // connected to the specified client API. + virtual status_t disconnect(int api) = 0; +}; + +// ---------------------------------------------------------------------------- + +class BnSurfaceTexture : public BnInterface +{ +public: + virtual status_t onTransact( uint32_t code, + const Parcel& data, + Parcel* reply, + uint32_t flags = 0); +}; + +// ---------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_GUI_ISURFACETEXTURE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/SensorEventQueue.h android-platform-frameworks-native-21/include/gui/SensorEventQueue.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/SensorEventQueue.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/SensorEventQueue.h 2012-10-16 22:57:11.000000000 +0000 @@ -23,12 +23,11 @@ #include #include #include -#include #include // ---------------------------------------------------------------------------- -#define WAKE_UP_SENSOR_EVENT_NEEDS_ACK (1U << 31) + struct ALooper; struct ASensorEvent; @@ -50,10 +49,7 @@ class SensorEventQueue : public ASensorEventQueue, public RefBase { public: - - enum { MAX_RECEIVE_BUFFER_EVENT_COUNT = 256 }; - - SensorEventQueue(const sp& connection); + SensorEventQueue(const sp& connection); virtual ~SensorEventQueue(); virtual void onFirstRef(); @@ -72,24 +68,15 @@ status_t setEventRate(Sensor const* sensor, nsecs_t ns) const; // these are here only to support SensorManager.java - status_t enableSensor(int32_t handle, int32_t samplingPeriodUs, int maxBatchReportLatencyUs, - int reservedFlags) const; + status_t enableSensor(int32_t handle, int32_t us) const; status_t disableSensor(int32_t handle) const; - status_t flush() const; - // Send an ack for every wake_up sensor event that is set to WAKE_UP_SENSOR_EVENT_NEEDS_ACK. - void sendAck(const ASensorEvent* events, int count); - status_t injectSensorEvent(const ASensorEvent& event); private: sp getLooper() const; sp mSensorEventConnection; sp mSensorChannel; mutable Mutex mLock; mutable sp mLooper; - ASensorEvent* mRecBuffer; - size_t mAvailable; - size_t mConsumed; - uint32_t mNumAcksToSend; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/Sensor.h android-platform-frameworks-native-21/include/gui/Sensor.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/Sensor.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/Sensor.h 2012-10-16 22:57:11.000000000 +0000 @@ -41,7 +41,7 @@ // ---------------------------------------------------------------------------- -class Sensor : public ASensor, public LightFlattenable +class Sensor : public ASensor, public Flattenable { public: enum { @@ -53,8 +53,8 @@ }; Sensor(); - Sensor(struct sensor_t const* hwSensor, int halVersion = 0); - ~Sensor(); + Sensor(struct sensor_t const* hwSensor); + virtual ~Sensor(); const String8& getName() const; const String8& getVendor() const; @@ -67,22 +67,14 @@ int32_t getMinDelay() const; nsecs_t getMinDelayNs() const; int32_t getVersion() const; - uint32_t getFifoReservedEventCount() const; - uint32_t getFifoMaxEventCount() const; - const String8& getStringType() const; - const String8& getRequiredPermission() const; - bool isRequiredPermissionRuntime() const; - int32_t getRequiredAppOp() const; - int32_t getMaxDelay() const; - uint32_t getFlags() const; - bool isWakeUpSensor() const; - int32_t getReportingMode() const; - - // LightFlattenable protocol - inline bool isFixedSize() const { return false; } - size_t getFlattenedSize() const; - status_t flatten(void* buffer, size_t size) const; - status_t unflatten(void const* buffer, size_t size); + + // Flattenable interface + virtual size_t getFlattenedSize() const; + virtual size_t getFdCount() const; + virtual status_t flatten(void* buffer, size_t size, + int fds[], size_t count) const; + virtual status_t unflatten(void const* buffer, size_t size, + int fds[], size_t count); private: String8 mName; @@ -95,16 +87,6 @@ float mPower; int32_t mMinDelay; int32_t mVersion; - uint32_t mFifoReservedEventCount; - uint32_t mFifoMaxEventCount; - String8 mStringType; - String8 mRequiredPermission; - bool mRequiredPermissionRuntime = false; - int32_t mRequiredAppOp; - int32_t mMaxDelay; - uint32_t mFlags; - static void flattenString8(void*& buffer, size_t& size, const String8& string8); - static bool unflattenString8(void const*& buffer, size_t& size, String8& outputString8); }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/SensorManager.h android-platform-frameworks-native-21/include/gui/SensorManager.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/SensorManager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/SensorManager.h 2012-10-16 22:57:11.000000000 +0000 @@ -17,20 +17,15 @@ #ifndef ANDROID_GUI_SENSOR_MANAGER_H #define ANDROID_GUI_SENSOR_MANAGER_H -#include - #include #include #include -#include -#include #include #include #include #include -#include #include @@ -45,37 +40,33 @@ class ISensorServer; class Sensor; class SensorEventQueue; + // ---------------------------------------------------------------------------- class SensorManager : - public ASensorManager + public ASensorManager, + public Singleton { public: - static SensorManager& getInstanceForPackage(const String16& packageName); + SensorManager(); ~SensorManager(); ssize_t getSensorList(Sensor const* const** list) const; Sensor const* getDefaultSensor(int type); - sp createEventQueue(String8 packageName = String8(""), int mode = 0); - bool isDataInjectionEnabled(); + sp createEventQueue(); private: // DeathRecipient interface void sensorManagerDied(); - SensorManager(const String16& opPackageName); status_t assertStateLocked() const; private: - static Mutex sLock; - static std::map sPackageInstances; - mutable Mutex mLock; mutable sp mSensorServer; mutable Sensor const** mSensorList; mutable Vector mSensors; mutable sp mDeathObserver; - const String16 mOpPackageName; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/StreamSplitter.h android-platform-frameworks-native-21/include/gui/StreamSplitter.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/StreamSplitter.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/StreamSplitter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,184 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_GUI_STREAMSPLITTER_H -#define ANDROID_GUI_STREAMSPLITTER_H - -#include -#include - -#include -#include -#include -#include - -namespace android { - -class GraphicBuffer; -class IGraphicBufferConsumer; -class IGraphicBufferProducer; - -// StreamSplitter is an autonomous class that manages one input BufferQueue -// and multiple output BufferQueues. By using the buffer attach and detach logic -// in BufferQueue, it is able to present the illusion of a single split -// BufferQueue, where each buffer queued to the input is available to be -// acquired by each of the outputs, and is able to be dequeued by the input -// again only once all of the outputs have released it. -class StreamSplitter : public BnConsumerListener { -public: - // createSplitter creates a new splitter, outSplitter, using inputQueue as - // the input BufferQueue. Output BufferQueues must be added using addOutput - // before queueing any buffers to the input. - // - // A return value other than NO_ERROR means that an error has occurred and - // outSplitter has not been modified. BAD_VALUE is returned if inputQueue or - // outSplitter is NULL. See IGraphicBufferConsumer::consumerConnect for - // explanations of other error codes. - static status_t createSplitter(const sp& inputQueue, - sp* outSplitter); - - // addOutput adds an output BufferQueue to the splitter. The splitter - // connects to outputQueue as a CPU producer, and any buffers queued - // to the input will be queued to each output. It is assumed that all of the - // outputs are added before any buffers are queued on the input. If any - // output is abandoned by its consumer, the splitter will abandon its input - // queue (see onAbandoned). - // - // A return value other than NO_ERROR means that an error has occurred and - // outputQueue has not been added to the splitter. BAD_VALUE is returned if - // outputQueue is NULL. See IGraphicBufferProducer::connect for explanations - // of other error codes. - status_t addOutput(const sp& outputQueue); - - // setName sets the consumer name of the input queue - void setName(const String8& name); - -private: - // From IConsumerListener - // - // During this callback, we store some tracking information, detach the - // buffer from the input, and attach it to each of the outputs. This call - // can block if there are too many outstanding buffers. If it blocks, it - // will resume when onBufferReleasedByOutput releases a buffer back to the - // input. - virtual void onFrameAvailable(const BufferItem& item); - - // From IConsumerListener - // We don't care about released buffers because we detach each buffer as - // soon as we acquire it. See the comment for onBufferReleased below for - // some clarifying notes about the name. - virtual void onBuffersReleased() {} - - // From IConsumerListener - // We don't care about sideband streams, since we won't be splitting them - virtual void onSidebandStreamChanged() {} - - // This is the implementation of the onBufferReleased callback from - // IProducerListener. It gets called from an OutputListener (see below), and - // 'from' is which producer interface from which the callback was received. - // - // During this callback, we detach the buffer from the output queue that - // generated the callback, update our state tracking to see if this is the - // last output releasing the buffer, and if so, release it to the input. - // If we release the buffer to the input, we allow a blocked - // onFrameAvailable call to proceed. - void onBufferReleasedByOutput(const sp& from); - - // When this is called, the splitter disconnects from (i.e., abandons) its - // input queue and signals any waiting onFrameAvailable calls to wake up. - // It still processes callbacks from other outputs, but only detaches their - // buffers so they can continue operating until they run out of buffers to - // acquire. This must be called with mMutex locked. - void onAbandonedLocked(); - - // This is a thin wrapper class that lets us determine which BufferQueue - // the IProducerListener::onBufferReleased callback is associated with. We - // create one of these per output BufferQueue, and then pass the producer - // into onBufferReleasedByOutput above. - class OutputListener : public BnProducerListener, - public IBinder::DeathRecipient { - public: - OutputListener(const sp& splitter, - const sp& output); - virtual ~OutputListener(); - - // From IProducerListener - virtual void onBufferReleased(); - - // From IBinder::DeathRecipient - virtual void binderDied(const wp& who); - - private: - sp mSplitter; - sp mOutput; - }; - - class BufferTracker : public LightRefBase { - public: - BufferTracker(const sp& buffer); - - const sp& getBuffer() const { return mBuffer; } - const sp& getMergedFence() const { return mMergedFence; } - - void mergeFence(const sp& with); - - // Returns the new value - // Only called while mMutex is held - size_t incrementReleaseCountLocked() { return ++mReleaseCount; } - - private: - // Only destroy through LightRefBase - friend LightRefBase; - ~BufferTracker(); - - // Disallow copying - BufferTracker(const BufferTracker& other); - BufferTracker& operator=(const BufferTracker& other); - - sp mBuffer; // One instance that holds this native handle - sp mMergedFence; - size_t mReleaseCount; - }; - - // Only called from createSplitter - StreamSplitter(const sp& inputQueue); - - // Must be accessed through RefBase - virtual ~StreamSplitter(); - - static const int MAX_OUTSTANDING_BUFFERS = 2; - - // mIsAbandoned is set to true when an output dies. Once the StreamSplitter - // has been abandoned, it will continue to detach buffers from other - // outputs, but it will disconnect from the input and not attempt to - // communicate with it further. - bool mIsAbandoned; - - Mutex mMutex; - Condition mReleaseCondition; - int mOutstandingBuffers; - sp mInput; - Vector > mOutputs; - - // Map of GraphicBuffer IDs (GraphicBuffer::getId()) to buffer tracking - // objects (which are mostly for counting how many outputs have released the - // buffer, but also contain merged release fences). - KeyedVector > mBuffers; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceComposerClient.h android-platform-frameworks-native-21/include/gui/SurfaceComposerClient.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceComposerClient.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/SurfaceComposerClient.h 2012-10-16 22:57:11.000000000 +0000 @@ -21,18 +21,15 @@ #include #include -#include #include #include #include #include -#include #include -#include -#include +#include namespace android { @@ -40,8 +37,8 @@ class DisplayInfo; class Composer; +class IMemoryHeap; class ISurfaceComposerClient; -class IGraphicBufferProducer; class Region; // --------------------------------------------------------------------------- @@ -49,7 +46,7 @@ class SurfaceComposerClient : public RefBase { friend class Composer; -public: +public: SurfaceComposerClient(); virtual ~SurfaceComposerClient(); @@ -58,110 +55,88 @@ // Return the connection of this client sp connection() const; - + // Forcibly remove connection before all references have gone away. void dispose(); - // callback when the composer is dies - status_t linkToComposerDeath(const sp& recipient, - void* cookie = NULL, uint32_t flags = 0); - - // Get a list of supported configurations for a given display - static status_t getDisplayConfigs(const sp& display, - Vector* configs); - - // Get the DisplayInfo for the currently-active configuration - static status_t getDisplayInfo(const sp& display, - DisplayInfo* info); - - // Get the index of the current active configuration (relative to the list - // returned by getDisplayInfo) - static int getActiveConfig(const sp& display); - - // Set a new active configuration using an index relative to the list - // returned by getDisplayInfo - static status_t setActiveConfig(const sp& display, int id); - - /* Triggers screen on/off or low power mode and waits for it to complete */ - static void setDisplayPowerMode(const sp& display, int mode); - // ------------------------------------------------------------------------ // surface creation / destruction //! Create a surface sp createSurface( const String8& name,// name of the surface + DisplayID display, // Display to create this surface on uint32_t w, // width in pixel uint32_t h, // height in pixel PixelFormat format, // pixel-format desired uint32_t flags = 0 // usage flags ); - //! Create a virtual display - static sp createDisplay(const String8& displayName, bool secure); - - //! Destroy a virtual display - static void destroyDisplay(const sp& display); + sp createSurface( + DisplayID display, // Display to create this surface on + uint32_t w, // width in pixel + uint32_t h, // height in pixel + PixelFormat format, // pixel-format desired + uint32_t flags = 0 // usage flags + ); - //! Get the token for the existing default displays. - //! Possible values for id are eDisplayIdMain and eDisplayIdHdmi. - static sp getBuiltInDisplay(int32_t id); // ------------------------------------------------------------------------ // Composer parameters // All composer parameters must be changed within a transaction // several surfaces can be updated in one transaction, all changes are // committed at once when the transaction is closed. - // closeGlobalTransaction() requires an IPC with the server. + // closeGlobalTransaction() usually requires an IPC with the server. //! Open a composer transaction on all active SurfaceComposerClients. static void openGlobalTransaction(); - + //! Close a composer transaction on all active SurfaceComposerClients. static void closeGlobalTransaction(bool synchronous = false); + + //! Freeze the specified display but not transactions. + static status_t freezeDisplay(DisplayID dpy, uint32_t flags = 0); + + //! Resume updates on the specified display. + static status_t unfreezeDisplay(DisplayID dpy, uint32_t flags = 0); + + //! Set the orientation of the given display + static int setOrientation(DisplayID dpy, int orientation, uint32_t flags); + + // Query the number of displays + static ssize_t getNumberOfDisplays(); + + // Get information about a display + static status_t getDisplayInfo(DisplayID dpy, DisplayInfo* info); + static ssize_t getDisplayWidth(DisplayID dpy); + static ssize_t getDisplayHeight(DisplayID dpy); + static ssize_t getDisplayOrientation(DisplayID dpy); + + static inline sp getBuiltInDisplay(int32_t dpy) { + return NULL; + } + + static inline status_t getDisplayInfo(const sp& dpy, DisplayInfo* info) { + return getDisplayInfo(0, info); + } - //! Flag the currently open transaction as an animation transaction. - static void setAnimationTransaction(); + status_t linkToComposerDeath(const sp& recipient, + void* cookie = NULL, uint32_t flags = 0); - status_t hide(const sp& id); - status_t show(const sp& id); - status_t setFlags(const sp& id, uint32_t flags, uint32_t mask); - status_t setTransparentRegionHint(const sp& id, const Region& transparent); - status_t setLayer(const sp& id, uint32_t layer); - status_t setAlpha(const sp& id, float alpha=1.0f); - status_t setMatrix(const sp& id, float dsdx, float dtdx, float dsdy, float dtdy); - status_t setPosition(const sp& id, float x, float y); - status_t setSize(const sp& id, uint32_t w, uint32_t h); - status_t setCrop(const sp& id, const Rect& crop); - status_t setLayerStack(const sp& id, uint32_t layerStack); - status_t destroySurface(const sp& id); - - status_t clearLayerFrameStats(const sp& token) const; - status_t getLayerFrameStats(const sp& token, FrameStats* outStats) const; - - static status_t clearAnimationFrameStats(); - static status_t getAnimationFrameStats(FrameStats* outStats); - - static void setDisplaySurface(const sp& token, - const sp& bufferProducer); - static void setDisplayLayerStack(const sp& token, - uint32_t layerStack); - static void setDisplaySize(const sp& token, uint32_t width, uint32_t height); - - /* setDisplayProjection() defines the projection of layer stacks - * to a given display. - * - * - orientation defines the display's orientation. - * - layerStackRect defines which area of the window manager coordinate - * space will be used. - * - displayRect defines where on the display will layerStackRect be - * mapped to. displayRect is specified post-orientation, that is - * it uses the orientation seen by the end-user. - */ - static void setDisplayProjection(const sp& token, - uint32_t orientation, - const Rect& layerStackRect, - const Rect& displayRect); + status_t hide(SurfaceID id); + status_t show(SurfaceID id, int32_t layer = -1); + status_t freeze(SurfaceID id); + status_t unfreeze(SurfaceID id); + status_t setFlags(SurfaceID id, uint32_t flags, uint32_t mask); + status_t setTransparentRegionHint(SurfaceID id, const Region& transparent); + status_t setLayer(SurfaceID id, int32_t layer); + status_t setAlpha(SurfaceID id, float alpha=1.0f); + status_t setFreezeTint(SurfaceID id, uint32_t tint); + status_t setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy); + status_t setPosition(SurfaceID id, float x, float y); + status_t setSize(SurfaceID id, uint32_t w, uint32_t h); + status_t setCrop(SurfaceID id, const Rect& crop); + status_t destroySurface(SurfaceID sid); private: virtual void onFirstRef(); @@ -177,44 +152,18 @@ class ScreenshotClient { -public: - // if cropping isn't required, callers may pass in a default Rect, e.g.: - // capture(display, producer, Rect(), reqWidth, ...); - static status_t capture( - const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform); - -private: - mutable sp mCpuConsumer; - mutable sp mProducer; - CpuConsumer::LockedBuffer mBuffer; - bool mHaveBuffer; - + sp mHeap; + uint32_t mWidth; + uint32_t mHeight; + PixelFormat mFormat; public: ScreenshotClient(); - ~ScreenshotClient(); - - // frees the previous screenshot and captures a new one - // if cropping isn't required, callers may pass in a default Rect, e.g.: - // update(display, Rect(), useIdentityTransform); - status_t update(const sp& display, - Rect sourceCrop, bool useIdentityTransform); - status_t update(const sp& display, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - bool useIdentityTransform); - status_t update(const sp& display, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform); - status_t update(const sp& display, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, uint32_t rotation); - sp getCpuConsumer() const; + // frees the previous screenshot and capture a new one + status_t update(); + status_t update(uint32_t reqWidth, uint32_t reqHeight); + status_t update(uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ); // release memory occupied by the screenshot void release(); diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceControl.h android-platform-frameworks-native-21/include/gui/SurfaceControl.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceControl.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/SurfaceControl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef ANDROID_GUI_SURFACE_CONTROL_H -#define ANDROID_GUI_SURFACE_CONTROL_H - -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -namespace android { - -// --------------------------------------------------------------------------- - -class IGraphicBufferProducer; -class Surface; -class SurfaceComposerClient; - -// --------------------------------------------------------------------------- - -class SurfaceControl : public RefBase -{ -public: - static bool isValid(const sp& surface) { - return (surface != 0) && surface->isValid(); - } - - bool isValid() { - return mHandle!=0 && mClient!=0; - } - - static bool isSameSurface( - const sp& lhs, const sp& rhs); - - // release surface data from java - void clear(); - - status_t setLayerStack(uint32_t layerStack); - status_t setLayer(uint32_t layer); - status_t setPosition(float x, float y); - status_t setSize(uint32_t w, uint32_t h); - status_t hide(); - status_t show(); - status_t setFlags(uint32_t flags, uint32_t mask); - status_t setTransparentRegionHint(const Region& transparent); - status_t setAlpha(float alpha=1.0f); - status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy); - status_t setCrop(const Rect& crop); - - static status_t writeSurfaceToParcel( - const sp& control, Parcel* parcel); - - sp getSurface() const; - - status_t clearLayerFrameStats() const; - status_t getLayerFrameStats(FrameStats* outStats) const; - -private: - // can't be copied - SurfaceControl& operator = (SurfaceControl& rhs); - SurfaceControl(const SurfaceControl& rhs); - - friend class SurfaceComposerClient; - friend class Surface; - - SurfaceControl( - const sp& client, - const sp& handle, - const sp& gbp); - - ~SurfaceControl(); - - status_t validate() const; - void destroy(); - - sp mClient; - sp mHandle; - sp mGraphicBufferProducer; - mutable Mutex mLock; - mutable sp mSurfaceData; -}; - -}; // namespace android - -#endif // ANDROID_GUI_SURFACE_CONTROL_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/Surface.h android-platform-frameworks-native-21/include/gui/Surface.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/Surface.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/Surface.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 The Android Open Source Project + * Copyright (C) 2007 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. @@ -17,308 +17,160 @@ #ifndef ANDROID_GUI_SURFACE_H #define ANDROID_GUI_SURFACE_H -#include -#include - -#include -#include +#include +#include +#include #include #include -#include -struct ANativeWindow_Buffer; +#include +#include + +#include +#include +#include + +#define ANDROID_VIEW_SURFACE_JNI_ID "mNativeSurface" namespace android { -/* - * An implementation of ANativeWindow that feeds graphics buffers into a - * BufferQueue. - * - * This is typically used by programs that want to render frames through - * some means (maybe OpenGL, a software renderer, or a hardware decoder) - * and have the frames they create forwarded to SurfaceFlinger for - * compositing. For example, a video decoder could render a frame and call - * eglSwapBuffers(), which invokes ANativeWindow callbacks defined by - * Surface. Surface then forwards the buffers through Binder IPC - * to the BufferQueue's producer interface, providing the new frame to a - * consumer such as GLConsumer. - */ -class Surface - : public ANativeObjectBase -{ -public: +// --------------------------------------------------------------------------- - /* - * creates a Surface from the given IGraphicBufferProducer (which concrete - * implementation is a BufferQueue). - * - * Surface is mainly state-less while it's disconnected, it can be - * viewed as a glorified IGraphicBufferProducer holder. It's therefore - * safe to create other Surfaces from the same IGraphicBufferProducer. - * - * However, once a Surface is connected, it'll prevent other Surfaces - * referring to the same IGraphicBufferProducer to become connected and - * therefore prevent them to be used as actual producers of buffers. - * - * the controlledByApp flag indicates that this Surface (producer) is - * controlled by the application. This flag is used at connect time. - */ - Surface(const sp& bufferProducer, bool controlledByApp = false); +class ISurfaceTexture; +class Surface; +class SurfaceComposerClient; - /* getIGraphicBufferProducer() returns the IGraphicBufferProducer this - * Surface was created with. Usually it's an error to use the - * IGraphicBufferProducer while the Surface is connected. - */ - sp getIGraphicBufferProducer() const; +// --------------------------------------------------------------------------- - /* convenience function to check that the given surface is non NULL as - * well as its IGraphicBufferProducer */ - static bool isValid(const sp& surface) { - return surface != NULL && surface->getIGraphicBufferProducer() != NULL; +class SurfaceControl : public RefBase +{ +public: + static bool isValid(const sp& surface) { + return (surface != 0) && surface->isValid(); + } + bool isValid() { + return mToken>=0 && mClient!=0; } + static bool isSameSurface( + const sp& lhs, const sp& rhs); + + uint32_t getIdentity() const { return mIdentity; } + + // release surface data from java + void clear(); + + status_t setLayer(int32_t layer); + status_t setPosition(int32_t x, int32_t y); + status_t setSize(uint32_t w, uint32_t h); + status_t hide(); + status_t show(int32_t layer = -1); + status_t freeze(); + status_t unfreeze(); + status_t setFlags(uint32_t flags, uint32_t mask); + status_t setTransparentRegionHint(const Region& transparent); + status_t setAlpha(float alpha=1.0f); + status_t setMatrix(float dsdx, float dtdx, float dsdy, float dtdy); + status_t setFreezeTint(uint32_t tint); + status_t setCrop(const Rect& crop); - /* Attaches a sideband buffer stream to the Surface's IGraphicBufferProducer. - * - * A sideband stream is a device-specific mechanism for passing buffers - * from the producer to the consumer without using dequeueBuffer/ - * queueBuffer. If a sideband stream is present, the consumer can choose - * whether to acquire buffers from the sideband stream or from the queued - * buffers. - * - * Passing NULL or a different stream handle will detach the previous - * handle if any. - */ - void setSidebandStream(const sp& stream); + static status_t writeSurfaceToParcel( + const sp& control, Parcel* parcel); - /* Allocates buffers based on the current dimensions/format. - * - * This function will allocate up to the maximum number of buffers - * permitted by the current BufferQueue configuration. It will use the - * default format and dimensions. This is most useful to avoid an allocation - * delay during dequeueBuffer. If there are already the maximum number of - * buffers allocated, this function has no effect. - */ - void allocateBuffers(); + sp getSurface() const; - /* Sets the generation number on the IGraphicBufferProducer and updates the - * generation number on any buffers attached to the Surface after this call. - * See IGBP::setGenerationNumber for more information. */ - status_t setGenerationNumber(uint32_t generationNumber); +private: + // can't be copied + SurfaceControl& operator = (SurfaceControl& rhs); + SurfaceControl(const SurfaceControl& rhs); - // See IGraphicBufferProducer::getConsumerName - String8 getConsumerName() const; + friend class SurfaceComposerClient; + friend class Surface; -protected: - virtual ~Surface(); + SurfaceControl( + const sp& client, + const sp& surface, + const ISurfaceComposerClient::surface_data_t& data); + + ~SurfaceControl(); + + status_t validate() const; + void destroy(); + + sp mClient; + sp mSurface; + SurfaceID mToken; + uint32_t mIdentity; + mutable Mutex mLock; + + mutable sp mSurfaceData; +}; + +// --------------------------------------------------------------------------- -private: - // can't be copied - Surface& operator = (const Surface& rhs); - Surface(const Surface& rhs); +class Surface : public SurfaceTextureClient +{ +public: + struct SurfaceInfo { + uint32_t w; + uint32_t h; + uint32_t s; + uint32_t usage; + PixelFormat format; + void* bits; + uint32_t reserved[2]; + }; - // ANativeWindow hooks - static int hook_cancelBuffer(ANativeWindow* window, - ANativeWindowBuffer* buffer, int fenceFd); - static int hook_dequeueBuffer(ANativeWindow* window, - ANativeWindowBuffer** buffer, int* fenceFd); - static int hook_perform(ANativeWindow* window, int operation, ...); - static int hook_query(const ANativeWindow* window, int what, int* value); - static int hook_queueBuffer(ANativeWindow* window, - ANativeWindowBuffer* buffer, int fenceFd); - static int hook_setSwapInterval(ANativeWindow* window, int interval); - - static int hook_cancelBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer* buffer); - static int hook_dequeueBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer** buffer); - static int hook_lockBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer* buffer); - static int hook_queueBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer* buffer); - - int dispatchConnect(va_list args); - int dispatchDisconnect(va_list args); - int dispatchSetBufferCount(va_list args); - int dispatchSetBuffersGeometry(va_list args); - int dispatchSetBuffersDimensions(va_list args); - int dispatchSetBuffersUserDimensions(va_list args); - int dispatchSetBuffersFormat(va_list args); - int dispatchSetScalingMode(va_list args); - int dispatchSetBuffersTransform(va_list args); - int dispatchSetBuffersStickyTransform(va_list args); - int dispatchSetBuffersTimestamp(va_list args); - int dispatchSetCrop(va_list args); - int dispatchSetPostTransformCrop(va_list args); - int dispatchSetUsage(va_list args); - int dispatchLock(va_list args); - int dispatchUnlockAndPost(va_list args); - int dispatchSetSidebandStream(va_list args); - int dispatchSetBuffersDataSpace(va_list args); - int dispatchSetSurfaceDamage(va_list args); - -protected: - virtual int dequeueBuffer(ANativeWindowBuffer** buffer, int* fenceFd); - virtual int cancelBuffer(ANativeWindowBuffer* buffer, int fenceFd); - virtual int queueBuffer(ANativeWindowBuffer* buffer, int fenceFd); - virtual int perform(int operation, va_list args); - virtual int query(int what, int* value) const; - virtual int setSwapInterval(int interval); + explicit Surface(const sp& st); - virtual int lockBuffer_DEPRECATED(ANativeWindowBuffer* buffer); + static status_t writeToParcel(const sp& control, Parcel* parcel); - virtual int connect(int api); - virtual int disconnect(int api); - virtual int setBufferCount(int bufferCount); - virtual int setBuffersDimensions(uint32_t width, uint32_t height); - virtual int setBuffersUserDimensions(uint32_t width, uint32_t height); - virtual int setBuffersFormat(PixelFormat format); - virtual int setScalingMode(int mode); - virtual int setBuffersTransform(uint32_t transform); - virtual int setBuffersStickyTransform(uint32_t transform); - virtual int setBuffersTimestamp(int64_t timestamp); - virtual int setBuffersDataSpace(android_dataspace dataSpace); - virtual int setCrop(Rect const* rect); - virtual int setUsage(uint32_t reqUsage); - virtual void setSurfaceDamage(android_native_rect_t* rects, size_t numRects); + static sp readFromParcel(const Parcel& data); + static bool isValid(const sp& surface) { + return (surface != 0) && surface->isValid(); + } -public: - virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); - virtual int unlockAndPost(); + bool isValid(); + uint32_t getIdentity() const { return mIdentity; } + sp getSurfaceTexture(); + + // the lock/unlock APIs must be used from the same thread + status_t lock(SurfaceInfo* info, Region* dirty = NULL); + status_t unlockAndPost(); - virtual int connect(int api, const sp& listener); - virtual int detachNextBuffer(sp* outBuffer, - sp* outFence); - virtual int attachBuffer(ANativeWindowBuffer*); - -protected: - enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; - enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; + sp asBinder() const; private: - void freeAllBuffers(); - int getSlotFromBufferLocked(android_native_buffer_t* buffer) const; + // this is just to be able to write some unit tests + friend class Test; + friend class SurfaceControl; - struct BufferSlot { - sp buffer; - Region dirtyRegion; - }; + // can't be copied + Surface& operator = (Surface& rhs); + Surface(const Surface& rhs); + + explicit Surface(const sp& control); + Surface(const Parcel& data, const sp& ref); + ~Surface(); + + /* + * private stuff... + */ + void init(const sp& surfaceTexture); + + static void cleanCachedSurfacesLocked(); + + virtual int query(int what, int* value) const; - // mSurfaceTexture is the interface to the surface texture server. All - // operations on the surface texture client ultimately translate into - // interactions with the server using this interface. - // TODO: rename to mBufferProducer - sp mGraphicBufferProducer; - - // mSlots stores the buffers that have been allocated for each buffer slot. - // It is initialized to null pointers, and gets filled in with the result of - // IGraphicBufferProducer::requestBuffer when the client dequeues a buffer from a - // slot that has not yet been used. The buffer allocated to a slot will also - // be replaced if the requested buffer usage or geometry differs from that - // of the buffer allocated to a slot. - BufferSlot mSlots[NUM_BUFFER_SLOTS]; - - // mReqWidth is the buffer width that will be requested at the next dequeue - // operation. It is initialized to 1. - uint32_t mReqWidth; - - // mReqHeight is the buffer height that will be requested at the next - // dequeue operation. It is initialized to 1. - uint32_t mReqHeight; - - // mReqFormat is the buffer pixel format that will be requested at the next - // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888. - PixelFormat mReqFormat; - - // mReqUsage is the set of buffer usage flags that will be requested - // at the next deuque operation. It is initialized to 0. - uint32_t mReqUsage; - - // mTimestamp is the timestamp that will be used for the next buffer queue - // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that - // a timestamp is auto-generated when queueBuffer is called. - int64_t mTimestamp; - - // mDataSpace is the buffer dataSpace that will be used for the next buffer - // queue operation. It defaults to HAL_DATASPACE_UNKNOWN, which - // means that the buffer contains some type of color data. - android_dataspace mDataSpace; - - // mCrop is the crop rectangle that will be used for the next buffer - // that gets queued. It is set by calling setCrop. - Rect mCrop; - - // mScalingMode is the scaling mode that will be used for the next - // buffers that get queued. It is set by calling setScalingMode. - int mScalingMode; - - // mTransform is the transform identifier that will be used for the next - // buffer that gets queued. It is set by calling setTransform. - uint32_t mTransform; - - // mStickyTransform is a transform that is applied on top of mTransform - // in each buffer that is queued. This is typically used to force the - // compositor to apply a transform, and will prevent the transform hint - // from being set by the compositor. - uint32_t mStickyTransform; - - // mDefaultWidth is default width of the buffers, regardless of the - // native_window_set_buffers_dimensions call. - uint32_t mDefaultWidth; - - // mDefaultHeight is default height of the buffers, regardless of the - // native_window_set_buffers_dimensions call. - uint32_t mDefaultHeight; - - // mUserWidth, if non-zero, is an application-specified override - // of mDefaultWidth. This is lower priority than the width set by - // native_window_set_buffers_dimensions. - uint32_t mUserWidth; - - // mUserHeight, if non-zero, is an application-specified override - // of mDefaultHeight. This is lower priority than the height set - // by native_window_set_buffers_dimensions. - uint32_t mUserHeight; - - // mTransformHint is the transform probably applied to buffers of this - // window. this is only a hint, actual transform may differ. - uint32_t mTransformHint; - - // mProducerControlledByApp whether this buffer producer is controlled - // by the application - bool mProducerControlledByApp; - - // mSwapIntervalZero set if we should drop buffers at queue() time to - // achieve an asynchronous swap interval - bool mSwapIntervalZero; - - // mConsumerRunningBehind whether the consumer is running more than - // one buffer behind the producer. - mutable bool mConsumerRunningBehind; - - // mMutex is the mutex used to prevent concurrent access to the member - // variables of Surface objects. It must be locked whenever the - // member variables are accessed. - mutable Mutex mMutex; - - // must be used from the lock/unlock thread - sp mLockedBuffer; - sp mPostedBuffer; - bool mConnectedToCpu; - - // When a CPU producer is attached, this reflects the region that the - // producer wished to update as well as whether the Surface was able to copy - // the previous buffer back to allow a partial update. - // - // When a non-CPU producer is attached, this reflects the surface damage - // (the change since the previous frame) passed in by the producer. - Region mDirtyRegion; - - // Stores the current generation number. See setGenerationNumber and - // IGraphicBufferProducer::setGenerationNumber for more information. - uint32_t mGenerationNumber; + // constants + sp mSurface; + uint32_t mIdentity; + + // A cache of Surface objects that have been deserialized into this process. + static Mutex sCachedSurfacesLock; + static DefaultKeyedVector, wp > sCachedSurfaces; }; }; // namespace android -#endif // ANDROID_GUI_SURFACE_H +#endif // ANDROID_GUI_SURFACE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceTextureClient.h android-platform-frameworks-native-21/include/gui/SurfaceTextureClient.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceTextureClient.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/SurfaceTextureClient.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,211 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_GUI_SURFACETEXTURECLIENT_H +#define ANDROID_GUI_SURFACETEXTURECLIENT_H + +#include +#include +#include + +#include +#include + +#include +#include +#include + +struct ANativeWindow_Buffer; + +namespace android { + +class Surface; + +class SurfaceTextureClient + : public ANativeObjectBase +{ +public: + + SurfaceTextureClient(const sp& surfaceTexture); + + // SurfaceTextureClient is overloaded to assist in refactoring ST and BQ. + // SurfaceTexture is no longer an ISurfaceTexture, so client code + // calling the original constructor will fail. Thus this convenience method + // passes in the surfaceTexture's bufferQueue to the init method. + SurfaceTextureClient(const sp& surfaceTexture); + + sp getISurfaceTexture() const; + +protected: + SurfaceTextureClient(); + virtual ~SurfaceTextureClient(); + void setISurfaceTexture(const sp& surfaceTexture); + +private: + // can't be copied + SurfaceTextureClient& operator = (const SurfaceTextureClient& rhs); + SurfaceTextureClient(const SurfaceTextureClient& rhs); + void init(); + + // ANativeWindow hooks + static int hook_cancelBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); + static int hook_dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer); + static int hook_lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); + static int hook_perform(ANativeWindow* window, int operation, ...); + static int hook_query(const ANativeWindow* window, int what, int* value); + static int hook_queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); + static int hook_setSwapInterval(ANativeWindow* window, int interval); + + int dispatchConnect(va_list args); + int dispatchDisconnect(va_list args); + int dispatchSetBufferCount(va_list args); + int dispatchSetBuffersGeometry(va_list args); + int dispatchSetBuffersDimensions(va_list args); + int dispatchSetBuffersUserDimensions(va_list args); + int dispatchSetBuffersFormat(va_list args); + int dispatchSetScalingMode(va_list args); + int dispatchSetBuffersTransform(va_list args); + int dispatchSetBuffersTimestamp(va_list args); + int dispatchSetCrop(va_list args); + int dispatchSetPostTransformCrop(va_list args); + int dispatchSetUsage(va_list args); + int dispatchLock(va_list args); + int dispatchUnlockAndPost(va_list args); + +protected: + virtual int cancelBuffer(ANativeWindowBuffer* buffer); + virtual int dequeueBuffer(ANativeWindowBuffer** buffer); + virtual int lockBuffer(ANativeWindowBuffer* buffer); + virtual int perform(int operation, va_list args); + virtual int query(int what, int* value) const; + virtual int queueBuffer(ANativeWindowBuffer* buffer); + virtual int setSwapInterval(int interval); + + virtual int connect(int api); + virtual int disconnect(int api); + virtual int setBufferCount(int bufferCount); + virtual int setBuffersDimensions(int w, int h); + virtual int setBuffersUserDimensions(int w, int h); + virtual int setBuffersFormat(int format); + virtual int setScalingMode(int mode); + virtual int setBuffersTransform(int transform); + virtual int setBuffersTimestamp(int64_t timestamp); + virtual int setCrop(Rect const* rect); + virtual int setUsage(uint32_t reqUsage); + virtual int lock(ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds); + virtual int unlockAndPost(); + + enum { NUM_BUFFER_SLOTS = BufferQueue::NUM_BUFFER_SLOTS }; + enum { DEFAULT_FORMAT = PIXEL_FORMAT_RGBA_8888 }; + +private: + void freeAllBuffers(); + int getSlotFromBufferLocked(android_native_buffer_t* buffer) const; + + struct BufferSlot { + sp buffer; + Region dirtyRegion; + }; + + // mSurfaceTexture is the interface to the surface texture server. All + // operations on the surface texture client ultimately translate into + // interactions with the server using this interface. + sp mSurfaceTexture; + + // mSlots stores the buffers that have been allocated for each buffer slot. + // It is initialized to null pointers, and gets filled in with the result of + // ISurfaceTexture::requestBuffer when the client dequeues a buffer from a + // slot that has not yet been used. The buffer allocated to a slot will also + // be replaced if the requested buffer usage or geometry differs from that + // of the buffer allocated to a slot. + BufferSlot mSlots[NUM_BUFFER_SLOTS]; + + // mReqWidth is the buffer width that will be requested at the next dequeue + // operation. It is initialized to 1. + uint32_t mReqWidth; + + // mReqHeight is the buffer height that will be requested at the next + // dequeue operation. It is initialized to 1. + uint32_t mReqHeight; + + // mReqFormat is the buffer pixel format that will be requested at the next + // deuque operation. It is initialized to PIXEL_FORMAT_RGBA_8888. + uint32_t mReqFormat; + + // mReqUsage is the set of buffer usage flags that will be requested + // at the next deuque operation. It is initialized to 0. + uint32_t mReqUsage; + + // mTimestamp is the timestamp that will be used for the next buffer queue + // operation. It defaults to NATIVE_WINDOW_TIMESTAMP_AUTO, which means that + // a timestamp is auto-generated when queueBuffer is called. + int64_t mTimestamp; + + // mCrop is the crop rectangle that will be used for the next buffer + // that gets queued. It is set by calling setCrop. + Rect mCrop; + + // mScalingMode is the scaling mode that will be used for the next + // buffers that get queued. It is set by calling setScalingMode. + int mScalingMode; + + // mTransform is the transform identifier that will be used for the next + // buffer that gets queued. It is set by calling setTransform. + uint32_t mTransform; + + // mDefaultWidth is default width of the buffers, regardless of the + // native_window_set_buffers_dimensions call. + uint32_t mDefaultWidth; + + // mDefaultHeight is default height of the buffers, regardless of the + // native_window_set_buffers_dimensions call. + uint32_t mDefaultHeight; + + // mUserWidth, if non-zero, is an application-specified override + // of mDefaultWidth. This is lower priority than the width set by + // native_window_set_buffers_dimensions. + uint32_t mUserWidth; + + // mUserHeight, if non-zero, is an application-specified override + // of mDefaultHeight. This is lower priority than the height set + // by native_window_set_buffers_dimensions. + uint32_t mUserHeight; + + // mTransformHint is the transform probably applied to buffers of this + // window. this is only a hint, actual transform may differ. + uint32_t mTransformHint; + + // mConsumerRunningBehind whether the consumer is running more than + // one buffer behind the producer. + mutable bool mConsumerRunningBehind; + + // mMutex is the mutex used to prevent concurrent access to the member + // variables of SurfaceTexture objects. It must be locked whenever the + // member variables are accessed. + mutable Mutex mMutex; + + // must be used from the lock/unlock thread + sp mLockedBuffer; + sp mPostedBuffer; + bool mConnectedToCpu; + + // must be accessed from lock/unlock thread only + Region mDirtyRegion; +}; + +}; // namespace android + +#endif // ANDROID_GUI_SURFACETEXTURECLIENT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceTexture.h android-platform-frameworks-native-21/include/gui/SurfaceTexture.h --- android-platform-frameworks-native-6.0.1+r16/include/gui/SurfaceTexture.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/gui/SurfaceTexture.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,420 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_GUI_SURFACETEXTURE_H +#define ANDROID_GUI_SURFACETEXTURE_H + +#include +#include +#include +#include + +#include +#include + +#include + +#include +#include +#include + +#define ANDROID_GRAPHICS_SURFACETEXTURE_JNI_ID "mSurfaceTexture" + +namespace android { +// ---------------------------------------------------------------------------- + + +class String8; + +class SurfaceTexture : public virtual RefBase, + protected BufferQueue::ConsumerListener { +public: + struct FrameAvailableListener : public virtual RefBase { + // onFrameAvailable() is called each time an additional frame becomes + // available for consumption. This means that frames that are queued + // while in asynchronous mode only trigger the callback if no previous + // frames are pending. Frames queued while in synchronous mode always + // trigger the callback. + // + // This is called without any lock held and can be called concurrently + // by multiple threads. + virtual void onFrameAvailable() = 0; + }; + + // SurfaceTexture constructs a new SurfaceTexture object. tex indicates the + // name of the OpenGL ES texture to which images are to be streamed. + // allowSynchronousMode specifies whether or not synchronous mode can be + // enabled. texTarget specifies the OpenGL ES texture target to which the + // texture will be bound in updateTexImage. useFenceSync specifies whether + // fences should be used to synchronize access to buffers if that behavior + // is enabled at compile-time. A custom bufferQueue can be specified + // if behavior for queue/dequeue/connect etc needs to be customized. + // Otherwise a default BufferQueue will be created and used. + // + // For legacy reasons, the SurfaceTexture is created in a state where it is + // considered attached to an OpenGL ES context for the purposes of the + // attachToContext and detachFromContext methods. However, despite being + // considered "attached" to a context, the specific OpenGL ES context + // doesn't get latched until the first call to updateTexImage. After that + // point, all calls to updateTexImage must be made with the same OpenGL ES + // context current. + // + // A SurfaceTexture may be detached from one OpenGL ES context and then + // attached to a different context using the detachFromContext and + // attachToContext methods, respectively. The intention of these methods is + // purely to allow a SurfaceTexture to be transferred from one consumer + // context to another. If such a transfer is not needed there is no + // requirement that either of these methods be called. + SurfaceTexture(GLuint tex, bool allowSynchronousMode = true, + GLenum texTarget = GL_TEXTURE_EXTERNAL_OES, bool useFenceSync = true, + const sp &bufferQueue = 0); + + virtual ~SurfaceTexture(); + + // updateTexImage sets the image contents of the target texture to that of + // the most recently queued buffer. + // + // This call may only be made while the OpenGL ES context to which the + // target texture belongs is bound to the calling thread. + status_t updateTexImage(); + + // setBufferCountServer set the buffer count. If the client has requested + // a buffer count using setBufferCount, the server-buffer count will + // take effect once the client sets the count back to zero. + status_t setBufferCountServer(int bufferCount); + + // getTransformMatrix retrieves the 4x4 texture coordinate transform matrix + // associated with the texture image set by the most recent call to + // updateTexImage. + // + // This transform matrix maps 2D homogeneous texture coordinates of the form + // (s, t, 0, 1) with s and t in the inclusive range [0, 1] to the texture + // coordinate that should be used to sample that location from the texture. + // Sampling the texture outside of the range of this transform is undefined. + // + // This transform is necessary to compensate for transforms that the stream + // content producer may implicitly apply to the content. By forcing users of + // a SurfaceTexture to apply this transform we avoid performing an extra + // copy of the data that would be needed to hide the transform from the + // user. + // + // The matrix is stored in column-major order so that it may be passed + // directly to OpenGL ES via the glLoadMatrixf or glUniformMatrix4fv + // functions. + void getTransformMatrix(float mtx[16]); + + // getTimestamp retrieves the timestamp associated with the texture image + // set by the most recent call to updateTexImage. + // + // The timestamp is in nanoseconds, and is monotonically increasing. Its + // other semantics (zero point, etc) are source-dependent and should be + // documented by the source. + int64_t getTimestamp(); + + // setFrameAvailableListener sets the listener object that will be notified + // when a new frame becomes available. + void setFrameAvailableListener(const sp& listener); + + // getAllocator retrieves the binder object that must be referenced as long + // as the GraphicBuffers dequeued from this SurfaceTexture are referenced. + // Holding this binder reference prevents SurfaceFlinger from freeing the + // buffers before the client is done with them. + sp getAllocator(); + + // setDefaultBufferSize is used to set the size of buffers returned by + // requestBuffers when a with and height of zero is requested. + // A call to setDefaultBufferSize() may trigger requestBuffers() to + // be called from the client. + // The width and height parameters must be no greater than the minimum of + // GL_MAX_VIEWPORT_DIMS and GL_MAX_TEXTURE_SIZE (see: glGetIntegerv). + // An error due to invalid dimensions might not be reported until + // updateTexImage() is called. + status_t setDefaultBufferSize(uint32_t width, uint32_t height); + + // setFilteringEnabled sets whether the transform matrix should be computed + // for use with bilinear filtering. + void setFilteringEnabled(bool enabled); + + // getCurrentBuffer returns the buffer associated with the current image. + sp getCurrentBuffer() const; + + // getCurrentTextureTarget returns the texture target of the current + // texture as returned by updateTexImage(). + GLenum getCurrentTextureTarget() const; + + // getCurrentCrop returns the cropping rectangle of the current buffer. + Rect getCurrentCrop() const; + + // getCurrentTransform returns the transform of the current buffer. + uint32_t getCurrentTransform() const; + + // getCurrentScalingMode returns the scaling mode of the current buffer. + uint32_t getCurrentScalingMode() const; + + // isSynchronousMode returns whether the SurfaceTexture is currently in + // synchronous mode. + bool isSynchronousMode() const; + + // abandon frees all the buffers and puts the SurfaceTexture into the + // 'abandoned' state. Once put in this state the SurfaceTexture can never + // leave it. When in the 'abandoned' state, all methods of the + // ISurfaceTexture interface will fail with the NO_INIT error. + // + // Note that while calling this method causes all the buffers to be freed + // from the perspective of the the SurfaceTexture, if there are additional + // references on the buffers (e.g. if a buffer is referenced by a client or + // by OpenGL ES as a texture) then those buffer will remain allocated. + void abandon(); + + // set the name of the SurfaceTexture that will be used to identify it in + // log messages. + void setName(const String8& name); + + // These functions call the corresponding BufferQueue implementation + // so the refactoring can proceed smoothly + status_t setDefaultBufferFormat(uint32_t defaultFormat); + status_t setConsumerUsageBits(uint32_t usage); + status_t setTransformHint(uint32_t hint); + virtual status_t setSynchronousMode(bool enabled); + + // getBufferQueue returns the BufferQueue object to which this + // SurfaceTexture is connected. + sp getBufferQueue() const; + + // detachFromContext detaches the SurfaceTexture from the calling thread's + // current OpenGL ES context. This context must be the same as the context + // that was current for previous calls to updateTexImage. + // + // Detaching a SurfaceTexture from an OpenGL ES context will result in the + // deletion of the OpenGL ES texture object into which the images were being + // streamed. After a SurfaceTexture has been detached from the OpenGL ES + // context calls to updateTexImage will fail returning INVALID_OPERATION + // until the SurfaceTexture is attached to a new OpenGL ES context using the + // attachToContext method. + status_t detachFromContext(); + + // attachToContext attaches a SurfaceTexture that is currently in the + // 'detached' state to the current OpenGL ES context. A SurfaceTexture is + // in the 'detached' state iff detachFromContext has successfully been + // called and no calls to attachToContext have succeeded since the last + // detachFromContext call. Calls to attachToContext made on a + // SurfaceTexture that is not in the 'detached' state will result in an + // INVALID_OPERATION error. + // + // The tex argument specifies the OpenGL ES texture object name in the + // new context into which the image contents will be streamed. A successful + // call to attachToContext will result in this texture object being bound to + // the texture target and populated with the image contents that were + // current at the time of the last call to detachFromContext. + status_t attachToContext(GLuint tex); + + // dump our state in a String + virtual void dump(String8& result) const; + virtual void dump(String8& result, const char* prefix, char* buffer, size_t SIZE) const; + +protected: + + // Implementation of the BufferQueue::ConsumerListener interface. These + // calls are used to notify the SurfaceTexture of asynchronous events in the + // BufferQueue. + virtual void onFrameAvailable(); + virtual void onBuffersReleased(); + + static bool isExternalFormat(uint32_t format); + +private: + // this version of updateTexImage() takes a functor used to reject or not + // the newly acquired buffer. + // this API is TEMPORARY and intended to be used by SurfaceFlinger only, + // which is why class Layer is made a friend of SurfaceTexture below. + class BufferRejecter { + friend class SurfaceTexture; + virtual bool reject(const sp& buf, + const BufferQueue::BufferItem& item) = 0; + protected: + virtual ~BufferRejecter() { } + }; + friend class Layer; + status_t updateTexImage(BufferRejecter* rejecter); + + // createImage creates a new EGLImage from a GraphicBuffer. + EGLImageKHR createImage(EGLDisplay dpy, + const sp& graphicBuffer); + + // freeBufferLocked frees up the given buffer slot. If the slot has been + // initialized this will release the reference to the GraphicBuffer in that + // slot and destroy the EGLImage in that slot. Otherwise it has no effect. + // + // This method must be called with mMutex locked. + void freeBufferLocked(int slotIndex); + + // computeCurrentTransformMatrix computes the transform matrix for the + // current texture. It uses mCurrentTransform and the current GraphicBuffer + // to compute this matrix and stores it in mCurrentTransformMatrix. + void computeCurrentTransformMatrix(); + + // syncForReleaseLocked performs the synchronization needed to release the + // current slot from an OpenGL ES context. If needed it will set the + // current slot's fence to guard against a producer accessing the buffer + // before the outstanding accesses have completed. + status_t syncForReleaseLocked(EGLDisplay dpy); + + // The default consumer usage flags that SurfaceTexture always sets on its + // BufferQueue instance; these will be OR:d with any additional flags passed + // from the SurfaceTexture user. In particular, SurfaceTexture will always + // consume buffers as hardware textures. + static const uint32_t DEFAULT_USAGE_FLAGS = GraphicBuffer::USAGE_HW_TEXTURE; + + // mCurrentTextureBuf is the graphic buffer of the current texture. It's + // possible that this buffer is not associated with any buffer slot, so we + // must track it separately in order to support the getCurrentBuffer method. + sp mCurrentTextureBuf; + + // mCurrentCrop is the crop rectangle that applies to the current texture. + // It gets set each time updateTexImage is called. + Rect mCurrentCrop; + + // mCurrentTransform is the transform identifier for the current texture. It + // gets set each time updateTexImage is called. + uint32_t mCurrentTransform; + + // mCurrentScalingMode is the scaling mode for the current texture. It gets + // set to each time updateTexImage is called. + uint32_t mCurrentScalingMode; + + // mCurrentTransformMatrix is the transform matrix for the current texture. + // It gets computed by computeTransformMatrix each time updateTexImage is + // called. + float mCurrentTransformMatrix[16]; + + // mCurrentTimestamp is the timestamp for the current texture. It + // gets set each time updateTexImage is called. + int64_t mCurrentTimestamp; + + uint32_t mDefaultWidth, mDefaultHeight; + + // mFilteringEnabled indicates whether the transform matrix is computed for + // use with bilinear filtering. It defaults to true and is changed by + // setFilteringEnabled(). + bool mFilteringEnabled; + + // mTexName is the name of the OpenGL texture to which streamed images will + // be bound when updateTexImage is called. It is set at construction time + // and can be changed with a call to attachToContext. + GLuint mTexName; + + // mUseFenceSync indicates whether creation of the EGL_KHR_fence_sync + // extension should be used to prevent buffers from being dequeued before + // it's safe for them to be written. It gets set at construction time and + // never changes. + const bool mUseFenceSync; + + // mTexTarget is the GL texture target with which the GL texture object is + // associated. It is set in the constructor and never changed. It is + // almost always GL_TEXTURE_EXTERNAL_OES except for one use case in Android + // Browser. In that case it is set to GL_TEXTURE_2D to allow + // glCopyTexSubImage to read from the texture. This is a hack to work + // around a GL driver limitation on the number of FBO attachments, which the + // browser's tile cache exceeds. + const GLenum mTexTarget; + + // EGLSlot contains the information and object references that + // SurfaceTexture maintains about a BufferQueue buffer slot. + struct EGLSlot { + EGLSlot() + : mEglImage(EGL_NO_IMAGE_KHR), + mFence(EGL_NO_SYNC_KHR) { + } + + sp mGraphicBuffer; + + // mEglImage is the EGLImage created from mGraphicBuffer. + EGLImageKHR mEglImage; + + // mFence is the EGL sync object that must signal before the buffer + // associated with this buffer slot may be dequeued. It is initialized + // to EGL_NO_SYNC_KHR when the buffer is created and (optionally, based + // on a compile-time option) set to a new sync object in updateTexImage. + EGLSyncKHR mFence; + }; + + // mEglDisplay is the EGLDisplay with which this SurfaceTexture is currently + // associated. It is intialized to EGL_NO_DISPLAY and gets set to the + // current display when updateTexImage is called for the first time and when + // attachToContext is called. + EGLDisplay mEglDisplay; + + // mEglContext is the OpenGL ES context with which this SurfaceTexture is + // currently associated. It is initialized to EGL_NO_CONTEXT and gets set + // to the current GL context when updateTexImage is called for the first + // time and when attachToContext is called. + EGLContext mEglContext; + + // mEGLSlots stores the buffers that have been allocated by the BufferQueue + // for each buffer slot. It is initialized to null pointers, and gets + // filled in with the result of BufferQueue::acquire when the + // client dequeues a buffer from a + // slot that has not yet been used. The buffer allocated to a slot will also + // be replaced if the requested buffer usage or geometry differs from that + // of the buffer allocated to a slot. + EGLSlot mEGLSlots[BufferQueue::NUM_BUFFER_SLOTS]; + + // mAbandoned indicates that the BufferQueue will no longer be used to + // consume images buffers pushed to it using the ISurfaceTexture interface. + // It is initialized to false, and set to true in the abandon method. A + // BufferQueue that has been abandoned will return the NO_INIT error from + // all ISurfaceTexture methods capable of returning an error. + bool mAbandoned; + + // mName is a string used to identify the SurfaceTexture in log messages. + // It can be set by the setName method. + String8 mName; + + // mFrameAvailableListener is the listener object that will be called when a + // new frame becomes available. If it is not NULL it will be called from + // queueBuffer. + sp mFrameAvailableListener; + + // mCurrentTexture is the buffer slot index of the buffer that is currently + // bound to the OpenGL texture. It is initialized to INVALID_BUFFER_SLOT, + // indicating that no buffer slot is currently bound to the texture. Note, + // however, that a value of INVALID_BUFFER_SLOT does not necessarily mean + // that no buffer is bound to the texture. A call to setBufferCount will + // reset mCurrentTexture to INVALID_BUFFER_SLOT. + int mCurrentTexture; + + // The SurfaceTexture has-a BufferQueue and is responsible for creating this object + // if none is supplied + sp mBufferQueue; + + // mAttached indicates whether the SurfaceTexture is currently attached to + // an OpenGL ES context. For legacy reasons, this is initialized to true, + // indicating that the SurfaceTexture is considered to be attached to + // whatever context is current at the time of the first updateTexImage call. + // It is set to false by detachFromContext, and then set to true again by + // attachToContext. + bool mAttached; + + // mMutex is the mutex used to prevent concurrent access to the member + // variables of SurfaceTexture objects. It must be locked whenever the + // member variables are accessed. + mutable Mutex mMutex; +}; + +// ---------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_GUI_SURFACETEXTURE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/IInputFlinger.h android-platform-frameworks-native-21/include/input/IInputFlinger.h --- android-platform-frameworks-native-6.0.1+r16/include/input/IInputFlinger.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/IInputFlinger.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef _LIBINPUT_IINPUT_FLINGER_H -#define _LIBINPUT_IINPUT_FLINGER_H - -#include -#include - -#include - -namespace android { - -/* - * This class defines the Binder IPC interface for accessing various - * InputFlinger features. - */ -class IInputFlinger : public IInterface { -public: - DECLARE_META_INTERFACE(InputFlinger); -}; - - -/** - * Binder implementation. - */ -class BnInputFlinger : public BnInterface { -public: - enum { - DO_SOMETHING_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, - }; - - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags = 0); -}; - -} // namespace android - -#endif // _LIBINPUT_IINPUT_FLINGER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/InputDevice.h android-platform-frameworks-native-21/include/input/InputDevice.h --- android-platform-frameworks-native-6.0.1+r16/include/input/InputDevice.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/InputDevice.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,170 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef _LIBINPUT_INPUT_DEVICE_H -#define _LIBINPUT_INPUT_DEVICE_H - -#include -#include - -namespace android { - -/* - * Identifies a device. - */ -struct InputDeviceIdentifier { - inline InputDeviceIdentifier() : - bus(0), vendor(0), product(0), version(0) { - } - - // Information provided by the kernel. - String8 name; - String8 location; - String8 uniqueId; - uint16_t bus; - uint16_t vendor; - uint16_t product; - uint16_t version; - - // A composite input device descriptor string that uniquely identifies the device - // even across reboots or reconnections. The value of this field is used by - // upper layers of the input system to associate settings with individual devices. - // It is hashed from whatever kernel provided information is available. - // Ideally, the way this value is computed should not change between Android releases - // because that would invalidate persistent settings that rely on it. - String8 descriptor; - - // A value added to uniquely identify a device in the absence of a unique id. This - // is intended to be a minimum way to distinguish from other active devices and may - // reuse values that are not associated with an input anymore. - uint16_t nonce; -}; - -/* - * Describes the characteristics and capabilities of an input device. - */ -class InputDeviceInfo { -public: - InputDeviceInfo(); - InputDeviceInfo(const InputDeviceInfo& other); - ~InputDeviceInfo(); - - struct MotionRange { - int32_t axis; - uint32_t source; - float min; - float max; - float flat; - float fuzz; - float resolution; - }; - - void initialize(int32_t id, int32_t generation, int32_t controllerNumber, - const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal, - bool hasMic); - - inline int32_t getId() const { return mId; } - inline int32_t getControllerNumber() const { return mControllerNumber; } - inline int32_t getGeneration() const { return mGeneration; } - inline const InputDeviceIdentifier& getIdentifier() const { return mIdentifier; } - inline const String8& getAlias() const { return mAlias; } - inline const String8& getDisplayName() const { - return mAlias.isEmpty() ? mIdentifier.name : mAlias; - } - inline bool isExternal() const { return mIsExternal; } - inline bool hasMic() const { return mHasMic; } - inline uint32_t getSources() const { return mSources; } - - const MotionRange* getMotionRange(int32_t axis, uint32_t source) const; - - void addSource(uint32_t source); - void addMotionRange(int32_t axis, uint32_t source, - float min, float max, float flat, float fuzz, float resolution); - void addMotionRange(const MotionRange& range); - - inline void setKeyboardType(int32_t keyboardType) { mKeyboardType = keyboardType; } - inline int32_t getKeyboardType() const { return mKeyboardType; } - - inline void setKeyCharacterMap(const sp& value) { - mKeyCharacterMap = value; - } - - inline sp getKeyCharacterMap() const { - return mKeyCharacterMap; - } - - inline void setVibrator(bool hasVibrator) { mHasVibrator = hasVibrator; } - inline bool hasVibrator() const { return mHasVibrator; } - - inline void setButtonUnderPad(bool hasButton) { mHasButtonUnderPad = hasButton; } - inline bool hasButtonUnderPad() const { return mHasButtonUnderPad; } - - inline const Vector& getMotionRanges() const { - return mMotionRanges; - } - -private: - int32_t mId; - int32_t mGeneration; - int32_t mControllerNumber; - InputDeviceIdentifier mIdentifier; - String8 mAlias; - bool mIsExternal; - bool mHasMic; - uint32_t mSources; - int32_t mKeyboardType; - sp mKeyCharacterMap; - bool mHasVibrator; - bool mHasButtonUnderPad; - - Vector mMotionRanges; -}; - -/* Types of input device configuration files. */ -enum InputDeviceConfigurationFileType { - INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION = 0, /* .idc file */ - INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_LAYOUT = 1, /* .kl file */ - INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_CHARACTER_MAP = 2, /* .kcm file */ -}; - -/* - * Gets the path of an input device configuration file, if one is available. - * Considers both system provided and user installed configuration files. - * - * The device identifier is used to construct several default configuration file - * names to try based on the device name, vendor, product, and version. - * - * Returns an empty string if not found. - */ -extern String8 getInputDeviceConfigurationFilePathByDeviceIdentifier( - const InputDeviceIdentifier& deviceIdentifier, - InputDeviceConfigurationFileType type); - -/* - * Gets the path of an input device configuration file, if one is available. - * Considers both system provided and user installed configuration files. - * - * The name is case-sensitive and is used to construct the filename to resolve. - * All characters except 'a'-'z', 'A'-'Z', '0'-'9', '-', and '_' are replaced by underscores. - * - * Returns an empty string if not found. - */ -extern String8 getInputDeviceConfigurationFilePathByName( - const String8& name, InputDeviceConfigurationFileType type); - -} // namespace android - -#endif // _LIBINPUT_INPUT_DEVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/InputEventLabels.h android-platform-frameworks-native-21/include/input/InputEventLabels.h --- android-platform-frameworks-native-6.0.1+r16/include/input/InputEventLabels.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/InputEventLabels.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,437 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef _LIBINPUT_INPUT_EVENT_LABELS_H -#define _LIBINPUT_INPUT_EVENT_LABELS_H - -#include -#include - -#define DEFINE_KEYCODE(key) { #key, AKEYCODE_##key } -#define DEFINE_AXIS(axis) { #axis, AMOTION_EVENT_AXIS_##axis } -#define DEFINE_LED(led) { #led, ALED_##led } -#define DEFINE_FLAG(flag) { #flag, POLICY_FLAG_##flag } - -namespace android { - -template -size_t size(T (&)[N]) { return N; } - -struct InputEventLabel { - const char *literal; - int value; -}; - - -static const InputEventLabel KEYCODES[] = { - // NOTE: If you add a new keycode here you must also add it to several other files. - // Refer to frameworks/base/core/java/android/view/KeyEvent.java for the full list. - DEFINE_KEYCODE(UNKNOWN), - DEFINE_KEYCODE(SOFT_LEFT), - DEFINE_KEYCODE(SOFT_RIGHT), - DEFINE_KEYCODE(HOME), - DEFINE_KEYCODE(BACK), - DEFINE_KEYCODE(CALL), - DEFINE_KEYCODE(ENDCALL), - DEFINE_KEYCODE(0), - DEFINE_KEYCODE(1), - DEFINE_KEYCODE(2), - DEFINE_KEYCODE(3), - DEFINE_KEYCODE(4), - DEFINE_KEYCODE(5), - DEFINE_KEYCODE(6), - DEFINE_KEYCODE(7), - DEFINE_KEYCODE(8), - DEFINE_KEYCODE(9), - DEFINE_KEYCODE(STAR), - DEFINE_KEYCODE(POUND), - DEFINE_KEYCODE(DPAD_UP), - DEFINE_KEYCODE(DPAD_DOWN), - DEFINE_KEYCODE(DPAD_LEFT), - DEFINE_KEYCODE(DPAD_RIGHT), - DEFINE_KEYCODE(DPAD_CENTER), - DEFINE_KEYCODE(VOLUME_UP), - DEFINE_KEYCODE(VOLUME_DOWN), - DEFINE_KEYCODE(POWER), - DEFINE_KEYCODE(CAMERA), - DEFINE_KEYCODE(CLEAR), - DEFINE_KEYCODE(A), - DEFINE_KEYCODE(B), - DEFINE_KEYCODE(C), - DEFINE_KEYCODE(D), - DEFINE_KEYCODE(E), - DEFINE_KEYCODE(F), - DEFINE_KEYCODE(G), - DEFINE_KEYCODE(H), - DEFINE_KEYCODE(I), - DEFINE_KEYCODE(J), - DEFINE_KEYCODE(K), - DEFINE_KEYCODE(L), - DEFINE_KEYCODE(M), - DEFINE_KEYCODE(N), - DEFINE_KEYCODE(O), - DEFINE_KEYCODE(P), - DEFINE_KEYCODE(Q), - DEFINE_KEYCODE(R), - DEFINE_KEYCODE(S), - DEFINE_KEYCODE(T), - DEFINE_KEYCODE(U), - DEFINE_KEYCODE(V), - DEFINE_KEYCODE(W), - DEFINE_KEYCODE(X), - DEFINE_KEYCODE(Y), - DEFINE_KEYCODE(Z), - DEFINE_KEYCODE(COMMA), - DEFINE_KEYCODE(PERIOD), - DEFINE_KEYCODE(ALT_LEFT), - DEFINE_KEYCODE(ALT_RIGHT), - DEFINE_KEYCODE(SHIFT_LEFT), - DEFINE_KEYCODE(SHIFT_RIGHT), - DEFINE_KEYCODE(TAB), - DEFINE_KEYCODE(SPACE), - DEFINE_KEYCODE(SYM), - DEFINE_KEYCODE(EXPLORER), - DEFINE_KEYCODE(ENVELOPE), - DEFINE_KEYCODE(ENTER), - DEFINE_KEYCODE(DEL), - DEFINE_KEYCODE(GRAVE), - DEFINE_KEYCODE(MINUS), - DEFINE_KEYCODE(EQUALS), - DEFINE_KEYCODE(LEFT_BRACKET), - DEFINE_KEYCODE(RIGHT_BRACKET), - DEFINE_KEYCODE(BACKSLASH), - DEFINE_KEYCODE(SEMICOLON), - DEFINE_KEYCODE(APOSTROPHE), - DEFINE_KEYCODE(SLASH), - DEFINE_KEYCODE(AT), - DEFINE_KEYCODE(NUM), - DEFINE_KEYCODE(HEADSETHOOK), - DEFINE_KEYCODE(FOCUS), // *Camera* focus - DEFINE_KEYCODE(PLUS), - DEFINE_KEYCODE(MENU), - DEFINE_KEYCODE(NOTIFICATION), - DEFINE_KEYCODE(SEARCH), - DEFINE_KEYCODE(MEDIA_PLAY_PAUSE), - DEFINE_KEYCODE(MEDIA_STOP), - DEFINE_KEYCODE(MEDIA_NEXT), - DEFINE_KEYCODE(MEDIA_PREVIOUS), - DEFINE_KEYCODE(MEDIA_REWIND), - DEFINE_KEYCODE(MEDIA_FAST_FORWARD), - DEFINE_KEYCODE(MUTE), - DEFINE_KEYCODE(PAGE_UP), - DEFINE_KEYCODE(PAGE_DOWN), - DEFINE_KEYCODE(PICTSYMBOLS), - DEFINE_KEYCODE(SWITCH_CHARSET), - DEFINE_KEYCODE(BUTTON_A), - DEFINE_KEYCODE(BUTTON_B), - DEFINE_KEYCODE(BUTTON_C), - DEFINE_KEYCODE(BUTTON_X), - DEFINE_KEYCODE(BUTTON_Y), - DEFINE_KEYCODE(BUTTON_Z), - DEFINE_KEYCODE(BUTTON_L1), - DEFINE_KEYCODE(BUTTON_R1), - DEFINE_KEYCODE(BUTTON_L2), - DEFINE_KEYCODE(BUTTON_R2), - DEFINE_KEYCODE(BUTTON_THUMBL), - DEFINE_KEYCODE(BUTTON_THUMBR), - DEFINE_KEYCODE(BUTTON_START), - DEFINE_KEYCODE(BUTTON_SELECT), - DEFINE_KEYCODE(BUTTON_MODE), - DEFINE_KEYCODE(ESCAPE), - DEFINE_KEYCODE(FORWARD_DEL), - DEFINE_KEYCODE(CTRL_LEFT), - DEFINE_KEYCODE(CTRL_RIGHT), - DEFINE_KEYCODE(CAPS_LOCK), - DEFINE_KEYCODE(SCROLL_LOCK), - DEFINE_KEYCODE(META_LEFT), - DEFINE_KEYCODE(META_RIGHT), - DEFINE_KEYCODE(FUNCTION), - DEFINE_KEYCODE(SYSRQ), - DEFINE_KEYCODE(BREAK), - DEFINE_KEYCODE(MOVE_HOME), - DEFINE_KEYCODE(MOVE_END), - DEFINE_KEYCODE(INSERT), - DEFINE_KEYCODE(FORWARD), - DEFINE_KEYCODE(MEDIA_PLAY), - DEFINE_KEYCODE(MEDIA_PAUSE), - DEFINE_KEYCODE(MEDIA_CLOSE), - DEFINE_KEYCODE(MEDIA_EJECT), - DEFINE_KEYCODE(MEDIA_RECORD), - DEFINE_KEYCODE(F1), - DEFINE_KEYCODE(F2), - DEFINE_KEYCODE(F3), - DEFINE_KEYCODE(F4), - DEFINE_KEYCODE(F5), - DEFINE_KEYCODE(F6), - DEFINE_KEYCODE(F7), - DEFINE_KEYCODE(F8), - DEFINE_KEYCODE(F9), - DEFINE_KEYCODE(F10), - DEFINE_KEYCODE(F11), - DEFINE_KEYCODE(F12), - DEFINE_KEYCODE(NUM_LOCK), - DEFINE_KEYCODE(NUMPAD_0), - DEFINE_KEYCODE(NUMPAD_1), - DEFINE_KEYCODE(NUMPAD_2), - DEFINE_KEYCODE(NUMPAD_3), - DEFINE_KEYCODE(NUMPAD_4), - DEFINE_KEYCODE(NUMPAD_5), - DEFINE_KEYCODE(NUMPAD_6), - DEFINE_KEYCODE(NUMPAD_7), - DEFINE_KEYCODE(NUMPAD_8), - DEFINE_KEYCODE(NUMPAD_9), - DEFINE_KEYCODE(NUMPAD_DIVIDE), - DEFINE_KEYCODE(NUMPAD_MULTIPLY), - DEFINE_KEYCODE(NUMPAD_SUBTRACT), - DEFINE_KEYCODE(NUMPAD_ADD), - DEFINE_KEYCODE(NUMPAD_DOT), - DEFINE_KEYCODE(NUMPAD_COMMA), - DEFINE_KEYCODE(NUMPAD_ENTER), - DEFINE_KEYCODE(NUMPAD_EQUALS), - DEFINE_KEYCODE(NUMPAD_LEFT_PAREN), - DEFINE_KEYCODE(NUMPAD_RIGHT_PAREN), - DEFINE_KEYCODE(VOLUME_MUTE), - DEFINE_KEYCODE(INFO), - DEFINE_KEYCODE(CHANNEL_UP), - DEFINE_KEYCODE(CHANNEL_DOWN), - DEFINE_KEYCODE(ZOOM_IN), - DEFINE_KEYCODE(ZOOM_OUT), - DEFINE_KEYCODE(TV), - DEFINE_KEYCODE(WINDOW), - DEFINE_KEYCODE(GUIDE), - DEFINE_KEYCODE(DVR), - DEFINE_KEYCODE(BOOKMARK), - DEFINE_KEYCODE(CAPTIONS), - DEFINE_KEYCODE(SETTINGS), - DEFINE_KEYCODE(TV_POWER), - DEFINE_KEYCODE(TV_INPUT), - DEFINE_KEYCODE(STB_POWER), - DEFINE_KEYCODE(STB_INPUT), - DEFINE_KEYCODE(AVR_POWER), - DEFINE_KEYCODE(AVR_INPUT), - DEFINE_KEYCODE(PROG_RED), - DEFINE_KEYCODE(PROG_GREEN), - DEFINE_KEYCODE(PROG_YELLOW), - DEFINE_KEYCODE(PROG_BLUE), - DEFINE_KEYCODE(APP_SWITCH), - DEFINE_KEYCODE(BUTTON_1), - DEFINE_KEYCODE(BUTTON_2), - DEFINE_KEYCODE(BUTTON_3), - DEFINE_KEYCODE(BUTTON_4), - DEFINE_KEYCODE(BUTTON_5), - DEFINE_KEYCODE(BUTTON_6), - DEFINE_KEYCODE(BUTTON_7), - DEFINE_KEYCODE(BUTTON_8), - DEFINE_KEYCODE(BUTTON_9), - DEFINE_KEYCODE(BUTTON_10), - DEFINE_KEYCODE(BUTTON_11), - DEFINE_KEYCODE(BUTTON_12), - DEFINE_KEYCODE(BUTTON_13), - DEFINE_KEYCODE(BUTTON_14), - DEFINE_KEYCODE(BUTTON_15), - DEFINE_KEYCODE(BUTTON_16), - DEFINE_KEYCODE(LANGUAGE_SWITCH), - DEFINE_KEYCODE(MANNER_MODE), - DEFINE_KEYCODE(3D_MODE), - DEFINE_KEYCODE(CONTACTS), - DEFINE_KEYCODE(CALENDAR), - DEFINE_KEYCODE(MUSIC), - DEFINE_KEYCODE(CALCULATOR), - DEFINE_KEYCODE(ZENKAKU_HANKAKU), - DEFINE_KEYCODE(EISU), - DEFINE_KEYCODE(MUHENKAN), - DEFINE_KEYCODE(HENKAN), - DEFINE_KEYCODE(KATAKANA_HIRAGANA), - DEFINE_KEYCODE(YEN), - DEFINE_KEYCODE(RO), - DEFINE_KEYCODE(KANA), - DEFINE_KEYCODE(ASSIST), - DEFINE_KEYCODE(BRIGHTNESS_DOWN), - DEFINE_KEYCODE(BRIGHTNESS_UP), - DEFINE_KEYCODE(MEDIA_AUDIO_TRACK), - DEFINE_KEYCODE(SLEEP), - DEFINE_KEYCODE(WAKEUP), - DEFINE_KEYCODE(PAIRING), - DEFINE_KEYCODE(MEDIA_TOP_MENU), - DEFINE_KEYCODE(11), - DEFINE_KEYCODE(12), - DEFINE_KEYCODE(LAST_CHANNEL), - DEFINE_KEYCODE(TV_DATA_SERVICE), - DEFINE_KEYCODE(VOICE_ASSIST), - DEFINE_KEYCODE(TV_RADIO_SERVICE), - DEFINE_KEYCODE(TV_TELETEXT), - DEFINE_KEYCODE(TV_NUMBER_ENTRY), - DEFINE_KEYCODE(TV_TERRESTRIAL_ANALOG), - DEFINE_KEYCODE(TV_TERRESTRIAL_DIGITAL), - DEFINE_KEYCODE(TV_SATELLITE), - DEFINE_KEYCODE(TV_SATELLITE_BS), - DEFINE_KEYCODE(TV_SATELLITE_CS), - DEFINE_KEYCODE(TV_SATELLITE_SERVICE), - DEFINE_KEYCODE(TV_NETWORK), - DEFINE_KEYCODE(TV_ANTENNA_CABLE), - DEFINE_KEYCODE(TV_INPUT_HDMI_1), - DEFINE_KEYCODE(TV_INPUT_HDMI_2), - DEFINE_KEYCODE(TV_INPUT_HDMI_3), - DEFINE_KEYCODE(TV_INPUT_HDMI_4), - DEFINE_KEYCODE(TV_INPUT_COMPOSITE_1), - DEFINE_KEYCODE(TV_INPUT_COMPOSITE_2), - DEFINE_KEYCODE(TV_INPUT_COMPONENT_1), - DEFINE_KEYCODE(TV_INPUT_COMPONENT_2), - DEFINE_KEYCODE(TV_INPUT_VGA_1), - DEFINE_KEYCODE(TV_AUDIO_DESCRIPTION), - DEFINE_KEYCODE(TV_AUDIO_DESCRIPTION_MIX_UP), - DEFINE_KEYCODE(TV_AUDIO_DESCRIPTION_MIX_DOWN), - DEFINE_KEYCODE(TV_ZOOM_MODE), - DEFINE_KEYCODE(TV_CONTENTS_MENU), - DEFINE_KEYCODE(TV_MEDIA_CONTEXT_MENU), - DEFINE_KEYCODE(TV_TIMER_PROGRAMMING), - DEFINE_KEYCODE(HELP), - DEFINE_KEYCODE(NAVIGATE_PREVIOUS), - DEFINE_KEYCODE(NAVIGATE_NEXT), - DEFINE_KEYCODE(NAVIGATE_IN), - DEFINE_KEYCODE(NAVIGATE_OUT), - - { NULL, 0 } -}; - -static const InputEventLabel AXES[] = { - DEFINE_AXIS(X), - DEFINE_AXIS(Y), - DEFINE_AXIS(PRESSURE), - DEFINE_AXIS(SIZE), - DEFINE_AXIS(TOUCH_MAJOR), - DEFINE_AXIS(TOUCH_MINOR), - DEFINE_AXIS(TOOL_MAJOR), - DEFINE_AXIS(TOOL_MINOR), - DEFINE_AXIS(ORIENTATION), - DEFINE_AXIS(VSCROLL), - DEFINE_AXIS(HSCROLL), - DEFINE_AXIS(Z), - DEFINE_AXIS(RX), - DEFINE_AXIS(RY), - DEFINE_AXIS(RZ), - DEFINE_AXIS(HAT_X), - DEFINE_AXIS(HAT_Y), - DEFINE_AXIS(LTRIGGER), - DEFINE_AXIS(RTRIGGER), - DEFINE_AXIS(THROTTLE), - DEFINE_AXIS(RUDDER), - DEFINE_AXIS(WHEEL), - DEFINE_AXIS(GAS), - DEFINE_AXIS(BRAKE), - DEFINE_AXIS(DISTANCE), - DEFINE_AXIS(TILT), - DEFINE_AXIS(GENERIC_1), - DEFINE_AXIS(GENERIC_2), - DEFINE_AXIS(GENERIC_3), - DEFINE_AXIS(GENERIC_4), - DEFINE_AXIS(GENERIC_5), - DEFINE_AXIS(GENERIC_6), - DEFINE_AXIS(GENERIC_7), - DEFINE_AXIS(GENERIC_8), - DEFINE_AXIS(GENERIC_9), - DEFINE_AXIS(GENERIC_10), - DEFINE_AXIS(GENERIC_11), - DEFINE_AXIS(GENERIC_12), - DEFINE_AXIS(GENERIC_13), - DEFINE_AXIS(GENERIC_14), - DEFINE_AXIS(GENERIC_15), - DEFINE_AXIS(GENERIC_16), - - // NOTE: If you add a new axis here you must also add it to several other files. - // Refer to frameworks/base/core/java/android/view/MotionEvent.java for the full list. - { NULL, 0 } -}; - -static const InputEventLabel LEDS[] = { - DEFINE_LED(NUM_LOCK), - DEFINE_LED(CAPS_LOCK), - DEFINE_LED(SCROLL_LOCK), - DEFINE_LED(COMPOSE), - DEFINE_LED(KANA), - DEFINE_LED(SLEEP), - DEFINE_LED(SUSPEND), - DEFINE_LED(MUTE), - DEFINE_LED(MISC), - DEFINE_LED(MAIL), - DEFINE_LED(CHARGING), - DEFINE_LED(CONTROLLER_1), - DEFINE_LED(CONTROLLER_2), - DEFINE_LED(CONTROLLER_3), - DEFINE_LED(CONTROLLER_4), - - // NOTE: If you add new LEDs here, you must also add them to Input.h - { NULL, 0 } -}; - -static const InputEventLabel FLAGS[] = { - DEFINE_FLAG(VIRTUAL), - DEFINE_FLAG(FUNCTION), - DEFINE_FLAG(GESTURE), - - { NULL, 0 } -}; - -static int lookupValueByLabel(const char* literal, const InputEventLabel *list) { - while (list->literal) { - if (strcmp(literal, list->literal) == 0) { - return list->value; - } - list++; - } - return list->value; -} - -static const char* lookupLabelByValue(int value, const InputEventLabel* list) { - while (list->literal) { - if (list->value == value) { - return list->literal; - } - list++; - } - return NULL; -} - -static int32_t getKeyCodeByLabel(const char* label) { - return int32_t(lookupValueByLabel(label, KEYCODES)); -} - -static const char* getLabelByKeyCode(int32_t keyCode) { - if (keyCode >= 0 && keyCode < size(KEYCODES)) { - return KEYCODES[keyCode].literal; - } - return NULL; -} - -static uint32_t getKeyFlagByLabel(const char* label) { - return uint32_t(lookupValueByLabel(label, FLAGS)); -} - -static int32_t getAxisByLabel(const char* label) { - return int32_t(lookupValueByLabel(label, AXES)); -} - -static const char* getAxisLabel(int32_t axisId) { - return lookupLabelByValue(axisId, AXES); -} - -static int32_t getLedByLabel(const char* label) { - return int32_t(lookupValueByLabel(label, LEDS)); -} - - -} // namespace android -#endif // _LIBINPUT_INPUT_EVENT_LABELS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/Input.h android-platform-frameworks-native-21/include/input/Input.h --- android-platform-frameworks-native-6.0.1+r16/include/input/Input.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/Input.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,668 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _LIBINPUT_INPUT_H -#define _LIBINPUT_INPUT_H - -/** - * Native input event structures. - */ - -#include -#include -#include -#include -#include -#include -#include -#include - -/* - * Additional private constants not defined in ndk/ui/input.h. - */ -enum { - /* Signifies that the key is being predispatched */ - AKEY_EVENT_FLAG_PREDISPATCH = 0x20000000, - - /* Private control to determine when an app is tracking a key sequence. */ - AKEY_EVENT_FLAG_START_TRACKING = 0x40000000, - - /* Key event is inconsistent with previously sent key events. */ - AKEY_EVENT_FLAG_TAINTED = 0x80000000, -}; - -enum { - /* Motion event is inconsistent with previously sent motion events. */ - AMOTION_EVENT_FLAG_TAINTED = 0x80000000, -}; - -enum { - /* Used when a motion event is not associated with any display. - * Typically used for non-pointer events. */ - ADISPLAY_ID_NONE = -1, - - /* The default display id. */ - ADISPLAY_ID_DEFAULT = 0, -}; - -enum { - /* - * Indicates that an input device has switches. - * This input source flag is hidden from the API because switches are only used by the system - * and applications have no way to interact with them. - */ - AINPUT_SOURCE_SWITCH = 0x80000000, -}; - -enum { - /** - * Constants for LEDs. Hidden from the API since we don't actually expose a way to interact - * with LEDs to developers - * - * NOTE: If you add LEDs here, you must also add them to InputEventLabels.h - */ - - ALED_NUM_LOCK = 0x00, - ALED_CAPS_LOCK = 0x01, - ALED_SCROLL_LOCK = 0x02, - ALED_COMPOSE = 0x03, - ALED_KANA = 0x04, - ALED_SLEEP = 0x05, - ALED_SUSPEND = 0x06, - ALED_MUTE = 0x07, - ALED_MISC = 0x08, - ALED_MAIL = 0x09, - ALED_CHARGING = 0x0a, - ALED_CONTROLLER_1 = 0x10, - ALED_CONTROLLER_2 = 0x11, - ALED_CONTROLLER_3 = 0x12, - ALED_CONTROLLER_4 = 0x13, -}; - -/* Maximum number of controller LEDs we support */ -#define MAX_CONTROLLER_LEDS 4 - -/* - * SystemUiVisibility constants from View. - */ -enum { - ASYSTEM_UI_VISIBILITY_STATUS_BAR_VISIBLE = 0, - ASYSTEM_UI_VISIBILITY_STATUS_BAR_HIDDEN = 0x00000001, -}; - -/* - * Maximum number of pointers supported per motion event. - * Smallest number of pointers is 1. - * (We want at least 10 but some touch controllers obstensibly configured for 10 pointers - * will occasionally emit 11. There is not much harm making this constant bigger.) - */ -#define MAX_POINTERS 16 - -/* - * Maximum number of samples supported per motion event. - */ -#define MAX_SAMPLES UINT16_MAX - -/* - * Maximum pointer id value supported in a motion event. - * Smallest pointer id is 0. - * (This is limited by our use of BitSet32 to track pointer assignments.) - */ -#define MAX_POINTER_ID 31 - -/* - * Declare a concrete type for the NDK's input event forward declaration. - */ -struct AInputEvent { - virtual ~AInputEvent() { } -}; - -/* - * Declare a concrete type for the NDK's input device forward declaration. - */ -struct AInputDevice { - virtual ~AInputDevice() { } -}; - - -namespace android { - -#ifdef HAVE_ANDROID_OS -class Parcel; -#endif - -/* - * Flags that flow alongside events in the input dispatch system to help with certain - * policy decisions such as waking from device sleep. - * - * These flags are also defined in frameworks/base/core/java/android/view/WindowManagerPolicy.java. - */ -enum { - /* These flags originate in RawEvents and are generally set in the key map. - * NOTE: If you want a flag to be able to set in a keylayout file, then you must add it to - * InputEventLabels.h as well. */ - - // Indicates that the event should wake the device. - POLICY_FLAG_WAKE = 0x00000001, - - // Indicates that the key is virtual, such as a capacitive button, and should - // generate haptic feedback. Virtual keys may be suppressed for some time - // after a recent touch to prevent accidental activation of virtual keys adjacent - // to the touch screen during an edge swipe. - POLICY_FLAG_VIRTUAL = 0x00000002, - - // Indicates that the key is the special function modifier. - POLICY_FLAG_FUNCTION = 0x00000004, - - // Indicates that the key represents a special gesture that has been detected by - // the touch firmware or driver. Causes touch events from the same device to be canceled. - POLICY_FLAG_GESTURE = 0x00000008, - - POLICY_FLAG_RAW_MASK = 0x0000ffff, - - /* These flags are set by the input dispatcher. */ - - // Indicates that the input event was injected. - POLICY_FLAG_INJECTED = 0x01000000, - - // Indicates that the input event is from a trusted source such as a directly attached - // input device or an application with system-wide event injection permission. - POLICY_FLAG_TRUSTED = 0x02000000, - - // Indicates that the input event has passed through an input filter. - POLICY_FLAG_FILTERED = 0x04000000, - - // Disables automatic key repeating behavior. - POLICY_FLAG_DISABLE_KEY_REPEAT = 0x08000000, - - /* These flags are set by the input reader policy as it intercepts each event. */ - - // Indicates that the device was in an interactive state when the - // event was intercepted. - POLICY_FLAG_INTERACTIVE = 0x20000000, - - // Indicates that the event should be dispatched to applications. - // The input event should still be sent to the InputDispatcher so that it can see all - // input events received include those that it will not deliver. - POLICY_FLAG_PASS_TO_USER = 0x40000000, -}; - -/* - * Pointer coordinate data. - */ -struct PointerCoords { - enum { MAX_AXES = 30 }; // 30 so that sizeof(PointerCoords) == 128 - - // Bitfield of axes that are present in this structure. - uint64_t bits __attribute__((aligned(8))); - - // Values of axes that are stored in this structure packed in order by axis id - // for each axis that is present in the structure according to 'bits'. - float values[MAX_AXES]; - - inline void clear() { - BitSet64::clear(bits); - } - - bool isEmpty() const { - return BitSet64::isEmpty(bits); - } - - float getAxisValue(int32_t axis) const; - status_t setAxisValue(int32_t axis, float value); - - void scale(float scale); - void applyOffset(float xOffset, float yOffset); - - inline float getX() const { - return getAxisValue(AMOTION_EVENT_AXIS_X); - } - - inline float getY() const { - return getAxisValue(AMOTION_EVENT_AXIS_Y); - } - -#ifdef HAVE_ANDROID_OS - status_t readFromParcel(Parcel* parcel); - status_t writeToParcel(Parcel* parcel) const; -#endif - - bool operator==(const PointerCoords& other) const; - inline bool operator!=(const PointerCoords& other) const { - return !(*this == other); - } - - void copyFrom(const PointerCoords& other); - -private: - void tooManyAxes(int axis); -}; - -/* - * Pointer property data. - */ -struct PointerProperties { - // The id of the pointer. - int32_t id; - - // The pointer tool type. - int32_t toolType; - - inline void clear() { - id = -1; - toolType = 0; - } - - bool operator==(const PointerProperties& other) const; - inline bool operator!=(const PointerProperties& other) const { - return !(*this == other); - } - - void copyFrom(const PointerProperties& other); -}; - -/* - * Input events. - */ -class InputEvent : public AInputEvent { -public: - virtual ~InputEvent() { } - - virtual int32_t getType() const = 0; - - inline int32_t getDeviceId() const { return mDeviceId; } - - inline int32_t getSource() const { return mSource; } - - inline void setSource(int32_t source) { mSource = source; } - -protected: - void initialize(int32_t deviceId, int32_t source); - void initialize(const InputEvent& from); - - int32_t mDeviceId; - int32_t mSource; -}; - -/* - * Key events. - */ -class KeyEvent : public InputEvent { -public: - virtual ~KeyEvent() { } - - virtual int32_t getType() const { return AINPUT_EVENT_TYPE_KEY; } - - inline int32_t getAction() const { return mAction; } - - inline int32_t getFlags() const { return mFlags; } - - inline void setFlags(int32_t flags) { mFlags = flags; } - - inline int32_t getKeyCode() const { return mKeyCode; } - - inline int32_t getScanCode() const { return mScanCode; } - - inline int32_t getMetaState() const { return mMetaState; } - - inline int32_t getRepeatCount() const { return mRepeatCount; } - - inline nsecs_t getDownTime() const { return mDownTime; } - - inline nsecs_t getEventTime() const { return mEventTime; } - - static const char* getLabel(int32_t keyCode); - static int32_t getKeyCodeFromLabel(const char* label); - - void initialize( - int32_t deviceId, - int32_t source, - int32_t action, - int32_t flags, - int32_t keyCode, - int32_t scanCode, - int32_t metaState, - int32_t repeatCount, - nsecs_t downTime, - nsecs_t eventTime); - void initialize(const KeyEvent& from); - -protected: - int32_t mAction; - int32_t mFlags; - int32_t mKeyCode; - int32_t mScanCode; - int32_t mMetaState; - int32_t mRepeatCount; - nsecs_t mDownTime; - nsecs_t mEventTime; -}; - -/* - * Motion events. - */ -class MotionEvent : public InputEvent { -public: - virtual ~MotionEvent() { } - - virtual int32_t getType() const { return AINPUT_EVENT_TYPE_MOTION; } - - inline int32_t getAction() const { return mAction; } - - inline int32_t getActionMasked() const { return mAction & AMOTION_EVENT_ACTION_MASK; } - - inline int32_t getActionIndex() const { - return (mAction & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) - >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; - } - - inline void setAction(int32_t action) { mAction = action; } - - inline int32_t getFlags() const { return mFlags; } - - inline void setFlags(int32_t flags) { mFlags = flags; } - - inline int32_t getEdgeFlags() const { return mEdgeFlags; } - - inline void setEdgeFlags(int32_t edgeFlags) { mEdgeFlags = edgeFlags; } - - inline int32_t getMetaState() const { return mMetaState; } - - inline void setMetaState(int32_t metaState) { mMetaState = metaState; } - - inline int32_t getButtonState() const { return mButtonState; } - - inline int32_t setButtonState(int32_t buttonState) { mButtonState = buttonState; } - - inline int32_t getActionButton() const { return mActionButton; } - - inline void setActionButton(int32_t button) { mActionButton = button; } - - inline float getXOffset() const { return mXOffset; } - - inline float getYOffset() const { return mYOffset; } - - inline float getXPrecision() const { return mXPrecision; } - - inline float getYPrecision() const { return mYPrecision; } - - inline nsecs_t getDownTime() const { return mDownTime; } - - inline void setDownTime(nsecs_t downTime) { mDownTime = downTime; } - - inline size_t getPointerCount() const { return mPointerProperties.size(); } - - inline const PointerProperties* getPointerProperties(size_t pointerIndex) const { - return &mPointerProperties[pointerIndex]; - } - - inline int32_t getPointerId(size_t pointerIndex) const { - return mPointerProperties[pointerIndex].id; - } - - inline int32_t getToolType(size_t pointerIndex) const { - return mPointerProperties[pointerIndex].toolType; - } - - inline nsecs_t getEventTime() const { return mSampleEventTimes[getHistorySize()]; } - - const PointerCoords* getRawPointerCoords(size_t pointerIndex) const; - - float getRawAxisValue(int32_t axis, size_t pointerIndex) const; - - inline float getRawX(size_t pointerIndex) const { - return getRawAxisValue(AMOTION_EVENT_AXIS_X, pointerIndex); - } - - inline float getRawY(size_t pointerIndex) const { - return getRawAxisValue(AMOTION_EVENT_AXIS_Y, pointerIndex); - } - - float getAxisValue(int32_t axis, size_t pointerIndex) const; - - inline float getX(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_X, pointerIndex); - } - - inline float getY(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_Y, pointerIndex); - } - - inline float getPressure(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pointerIndex); - } - - inline float getSize(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_SIZE, pointerIndex); - } - - inline float getTouchMajor(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, pointerIndex); - } - - inline float getTouchMinor(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, pointerIndex); - } - - inline float getToolMajor(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, pointerIndex); - } - - inline float getToolMinor(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, pointerIndex); - } - - inline float getOrientation(size_t pointerIndex) const { - return getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, pointerIndex); - } - - inline size_t getHistorySize() const { return mSampleEventTimes.size() - 1; } - - inline nsecs_t getHistoricalEventTime(size_t historicalIndex) const { - return mSampleEventTimes[historicalIndex]; - } - - const PointerCoords* getHistoricalRawPointerCoords( - size_t pointerIndex, size_t historicalIndex) const; - - float getHistoricalRawAxisValue(int32_t axis, size_t pointerIndex, - size_t historicalIndex) const; - - inline float getHistoricalRawX(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalRawAxisValue( - AMOTION_EVENT_AXIS_X, pointerIndex, historicalIndex); - } - - inline float getHistoricalRawY(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalRawAxisValue( - AMOTION_EVENT_AXIS_Y, pointerIndex, historicalIndex); - } - - float getHistoricalAxisValue(int32_t axis, size_t pointerIndex, size_t historicalIndex) const; - - inline float getHistoricalX(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_X, pointerIndex, historicalIndex); - } - - inline float getHistoricalY(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_Y, pointerIndex, historicalIndex); - } - - inline float getHistoricalPressure(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_PRESSURE, pointerIndex, historicalIndex); - } - - inline float getHistoricalSize(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_SIZE, pointerIndex, historicalIndex); - } - - inline float getHistoricalTouchMajor(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_TOUCH_MAJOR, pointerIndex, historicalIndex); - } - - inline float getHistoricalTouchMinor(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_TOUCH_MINOR, pointerIndex, historicalIndex); - } - - inline float getHistoricalToolMajor(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_TOOL_MAJOR, pointerIndex, historicalIndex); - } - - inline float getHistoricalToolMinor(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_TOOL_MINOR, pointerIndex, historicalIndex); - } - - inline float getHistoricalOrientation(size_t pointerIndex, size_t historicalIndex) const { - return getHistoricalAxisValue( - AMOTION_EVENT_AXIS_ORIENTATION, pointerIndex, historicalIndex); - } - - ssize_t findPointerIndex(int32_t pointerId) const; - - void initialize( - int32_t deviceId, - int32_t source, - int32_t action, - int32_t actionButton, - int32_t flags, - int32_t edgeFlags, - int32_t metaState, - int32_t buttonState, - float xOffset, - float yOffset, - float xPrecision, - float yPrecision, - nsecs_t downTime, - nsecs_t eventTime, - size_t pointerCount, - const PointerProperties* pointerProperties, - const PointerCoords* pointerCoords); - - void copyFrom(const MotionEvent* other, bool keepHistory); - - void addSample( - nsecs_t eventTime, - const PointerCoords* pointerCoords); - - void offsetLocation(float xOffset, float yOffset); - - void scale(float scaleFactor); - - // Apply 3x3 perspective matrix transformation. - // Matrix is in row-major form and compatible with SkMatrix. - void transform(const float matrix[9]); - -#ifdef HAVE_ANDROID_OS - status_t readFromParcel(Parcel* parcel); - status_t writeToParcel(Parcel* parcel) const; -#endif - - static bool isTouchEvent(int32_t source, int32_t action); - inline bool isTouchEvent() const { - return isTouchEvent(mSource, mAction); - } - - // Low-level accessors. - inline const PointerProperties* getPointerProperties() const { - return mPointerProperties.array(); - } - inline const nsecs_t* getSampleEventTimes() const { return mSampleEventTimes.array(); } - inline const PointerCoords* getSamplePointerCoords() const { - return mSamplePointerCoords.array(); - } - - static const char* getLabel(int32_t axis); - static int32_t getAxisFromLabel(const char* label); - -protected: - int32_t mAction; - int32_t mActionButton; - int32_t mFlags; - int32_t mEdgeFlags; - int32_t mMetaState; - int32_t mButtonState; - float mXOffset; - float mYOffset; - float mXPrecision; - float mYPrecision; - nsecs_t mDownTime; - Vector mPointerProperties; - Vector mSampleEventTimes; - Vector mSamplePointerCoords; -}; - -/* - * Input event factory. - */ -class InputEventFactoryInterface { -protected: - virtual ~InputEventFactoryInterface() { } - -public: - InputEventFactoryInterface() { } - - virtual KeyEvent* createKeyEvent() = 0; - virtual MotionEvent* createMotionEvent() = 0; -}; - -/* - * A simple input event factory implementation that uses a single preallocated instance - * of each type of input event that are reused for each request. - */ -class PreallocatedInputEventFactory : public InputEventFactoryInterface { -public: - PreallocatedInputEventFactory() { } - virtual ~PreallocatedInputEventFactory() { } - - virtual KeyEvent* createKeyEvent() { return & mKeyEvent; } - virtual MotionEvent* createMotionEvent() { return & mMotionEvent; } - -private: - KeyEvent mKeyEvent; - MotionEvent mMotionEvent; -}; - -/* - * An input event factory implementation that maintains a pool of input events. - */ -class PooledInputEventFactory : public InputEventFactoryInterface { -public: - PooledInputEventFactory(size_t maxPoolSize = 20); - virtual ~PooledInputEventFactory(); - - virtual KeyEvent* createKeyEvent(); - virtual MotionEvent* createMotionEvent(); - - void recycle(InputEvent* event); - -private: - const size_t mMaxPoolSize; - - Vector mKeyEventPool; - Vector mMotionEventPool; -}; - -} // namespace android - -#endif // _LIBINPUT_INPUT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/InputTransport.h android-platform-frameworks-native-21/include/input/InputTransport.h --- android-platform-frameworks-native-6.0.1+r16/include/input/InputTransport.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/InputTransport.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,453 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _LIBINPUT_INPUT_TRANSPORT_H -#define _LIBINPUT_INPUT_TRANSPORT_H - -/** - * Native input transport. - * - * The InputChannel provides a mechanism for exchanging InputMessage structures across processes. - * - * The InputPublisher and InputConsumer each handle one end-point of an input channel. - * The InputPublisher is used by the input dispatcher to send events to the application. - * The InputConsumer is used by the application to receive events from the input dispatcher. - */ - -#include -#include -#include -#include -#include -#include -#include - -namespace android { - -/* - * Intermediate representation used to send input events and related signals. - * - * Note that this structure is used for IPCs so its layout must be identical - * on 64 and 32 bit processes. This is tested in StructLayout_test.cpp. - */ -struct InputMessage { - enum { - TYPE_KEY = 1, - TYPE_MOTION = 2, - TYPE_FINISHED = 3, - }; - - struct Header { - uint32_t type; - // We don't need this field in order to align the body below but we - // leave it here because InputMessage::size() and other functions - // compute the size of this structure as sizeof(Header) + sizeof(Body). - uint32_t padding; - } header; - - // Body *must* be 8 byte aligned. - union Body { - struct Key { - uint32_t seq; - nsecs_t eventTime __attribute__((aligned(8))); - int32_t deviceId; - int32_t source; - int32_t action; - int32_t flags; - int32_t keyCode; - int32_t scanCode; - int32_t metaState; - int32_t repeatCount; - nsecs_t downTime __attribute__((aligned(8))); - - inline size_t size() const { - return sizeof(Key); - } - } key; - - struct Motion { - uint32_t seq; - nsecs_t eventTime __attribute__((aligned(8))); - int32_t deviceId; - int32_t source; - int32_t action; - int32_t actionButton; - int32_t flags; - int32_t metaState; - int32_t buttonState; - int32_t edgeFlags; - nsecs_t downTime __attribute__((aligned(8))); - float xOffset; - float yOffset; - float xPrecision; - float yPrecision; - uint32_t pointerCount; - // Note that PointerCoords requires 8 byte alignment. - struct Pointer { - PointerProperties properties; - PointerCoords coords; - } pointers[MAX_POINTERS]; - - int32_t getActionId() const { - uint32_t index = (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) - >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; - return pointers[index].properties.id; - } - - inline size_t size() const { - return sizeof(Motion) - sizeof(Pointer) * MAX_POINTERS - + sizeof(Pointer) * pointerCount; - } - } motion; - - struct Finished { - uint32_t seq; - bool handled; - - inline size_t size() const { - return sizeof(Finished); - } - } finished; - } __attribute__((aligned(8))) body; - - bool isValid(size_t actualSize) const; - size_t size() const; -}; - -/* - * An input channel consists of a local unix domain socket used to send and receive - * input messages across processes. Each channel has a descriptive name for debugging purposes. - * - * Each endpoint has its own InputChannel object that specifies its file descriptor. - * - * The input channel is closed when all references to it are released. - */ -class InputChannel : public RefBase { -protected: - virtual ~InputChannel(); - -public: - InputChannel(const String8& name, int fd); - - /* Creates a pair of input channels. - * - * Returns OK on success. - */ - static status_t openInputChannelPair(const String8& name, - sp& outServerChannel, sp& outClientChannel); - - inline String8 getName() const { return mName; } - inline int getFd() const { return mFd; } - - /* Sends a message to the other endpoint. - * - * If the channel is full then the message is guaranteed not to have been sent at all. - * Try again after the consumer has sent a finished signal indicating that it has - * consumed some of the pending messages from the channel. - * - * Returns OK on success. - * Returns WOULD_BLOCK if the channel is full. - * Returns DEAD_OBJECT if the channel's peer has been closed. - * Other errors probably indicate that the channel is broken. - */ - status_t sendMessage(const InputMessage* msg); - - /* Receives a message sent by the other endpoint. - * - * If there is no message present, try again after poll() indicates that the fd - * is readable. - * - * Returns OK on success. - * Returns WOULD_BLOCK if there is no message present. - * Returns DEAD_OBJECT if the channel's peer has been closed. - * Other errors probably indicate that the channel is broken. - */ - status_t receiveMessage(InputMessage* msg); - - /* Returns a new object that has a duplicate of this channel's fd. */ - sp dup() const; - -private: - String8 mName; - int mFd; -}; - -/* - * Publishes input events to an input channel. - */ -class InputPublisher { -public: - /* Creates a publisher associated with an input channel. */ - explicit InputPublisher(const sp& channel); - - /* Destroys the publisher and releases its input channel. */ - ~InputPublisher(); - - /* Gets the underlying input channel. */ - inline sp getChannel() { return mChannel; } - - /* Publishes a key event to the input channel. - * - * Returns OK on success. - * Returns WOULD_BLOCK if the channel is full. - * Returns DEAD_OBJECT if the channel's peer has been closed. - * Returns BAD_VALUE if seq is 0. - * Other errors probably indicate that the channel is broken. - */ - status_t publishKeyEvent( - uint32_t seq, - int32_t deviceId, - int32_t source, - int32_t action, - int32_t flags, - int32_t keyCode, - int32_t scanCode, - int32_t metaState, - int32_t repeatCount, - nsecs_t downTime, - nsecs_t eventTime); - - /* Publishes a motion event to the input channel. - * - * Returns OK on success. - * Returns WOULD_BLOCK if the channel is full. - * Returns DEAD_OBJECT if the channel's peer has been closed. - * Returns BAD_VALUE if seq is 0 or if pointerCount is less than 1 or greater than MAX_POINTERS. - * Other errors probably indicate that the channel is broken. - */ - status_t publishMotionEvent( - uint32_t seq, - int32_t deviceId, - int32_t source, - int32_t action, - int32_t actionButton, - int32_t flags, - int32_t edgeFlags, - int32_t metaState, - int32_t buttonState, - float xOffset, - float yOffset, - float xPrecision, - float yPrecision, - nsecs_t downTime, - nsecs_t eventTime, - uint32_t pointerCount, - const PointerProperties* pointerProperties, - const PointerCoords* pointerCoords); - - /* Receives the finished signal from the consumer in reply to the original dispatch signal. - * If a signal was received, returns the message sequence number, - * and whether the consumer handled the message. - * - * The returned sequence number is never 0 unless the operation failed. - * - * Returns OK on success. - * Returns WOULD_BLOCK if there is no signal present. - * Returns DEAD_OBJECT if the channel's peer has been closed. - * Other errors probably indicate that the channel is broken. - */ - status_t receiveFinishedSignal(uint32_t* outSeq, bool* outHandled); - -private: - sp mChannel; -}; - -/* - * Consumes input events from an input channel. - */ -class InputConsumer { -public: - /* Creates a consumer associated with an input channel. */ - explicit InputConsumer(const sp& channel); - - /* Destroys the consumer and releases its input channel. */ - ~InputConsumer(); - - /* Gets the underlying input channel. */ - inline sp getChannel() { return mChannel; } - - /* Consumes an input event from the input channel and copies its contents into - * an InputEvent object created using the specified factory. - * - * Tries to combine a series of move events into larger batches whenever possible. - * - * If consumeBatches is false, then defers consuming pending batched events if it - * is possible for additional samples to be added to them later. Call hasPendingBatch() - * to determine whether a pending batch is available to be consumed. - * - * If consumeBatches is true, then events are still batched but they are consumed - * immediately as soon as the input channel is exhausted. - * - * The frameTime parameter specifies the time when the current display frame started - * rendering in the CLOCK_MONOTONIC time base, or -1 if unknown. - * - * The returned sequence number is never 0 unless the operation failed. - * - * Returns OK on success. - * Returns WOULD_BLOCK if there is no event present. - * Returns DEAD_OBJECT if the channel's peer has been closed. - * Returns NO_MEMORY if the event could not be created. - * Other errors probably indicate that the channel is broken. - */ - status_t consume(InputEventFactoryInterface* factory, bool consumeBatches, - nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent); - - /* Sends a finished signal to the publisher to inform it that the message - * with the specified sequence number has finished being process and whether - * the message was handled by the consumer. - * - * Returns OK on success. - * Returns BAD_VALUE if seq is 0. - * Other errors probably indicate that the channel is broken. - */ - status_t sendFinishedSignal(uint32_t seq, bool handled); - - /* Returns true if there is a deferred event waiting. - * - * Should be called after calling consume() to determine whether the consumer - * has a deferred event to be processed. Deferred events are somewhat special in - * that they have already been removed from the input channel. If the input channel - * becomes empty, the client may need to do extra work to ensure that it processes - * the deferred event despite the fact that the input channel's file descriptor - * is not readable. - * - * One option is simply to call consume() in a loop until it returns WOULD_BLOCK. - * This guarantees that all deferred events will be processed. - * - * Alternately, the caller can call hasDeferredEvent() to determine whether there is - * a deferred event waiting and then ensure that its event loop wakes up at least - * one more time to consume the deferred event. - */ - bool hasDeferredEvent() const; - - /* Returns true if there is a pending batch. - * - * Should be called after calling consume() with consumeBatches == false to determine - * whether consume() should be called again later on with consumeBatches == true. - */ - bool hasPendingBatch() const; - -private: - // True if touch resampling is enabled. - const bool mResampleTouch; - - // The input channel. - sp mChannel; - - // The current input message. - InputMessage mMsg; - - // True if mMsg contains a valid input message that was deferred from the previous - // call to consume and that still needs to be handled. - bool mMsgDeferred; - - // Batched motion events per device and source. - struct Batch { - Vector samples; - }; - Vector mBatches; - - // Touch state per device and source, only for sources of class pointer. - struct History { - nsecs_t eventTime; - BitSet32 idBits; - int32_t idToIndex[MAX_POINTER_ID + 1]; - PointerCoords pointers[MAX_POINTERS]; - - void initializeFrom(const InputMessage* msg) { - eventTime = msg->body.motion.eventTime; - idBits.clear(); - for (uint32_t i = 0; i < msg->body.motion.pointerCount; i++) { - uint32_t id = msg->body.motion.pointers[i].properties.id; - idBits.markBit(id); - idToIndex[id] = i; - pointers[i].copyFrom(msg->body.motion.pointers[i].coords); - } - } - - const PointerCoords& getPointerById(uint32_t id) const { - return pointers[idToIndex[id]]; - } - }; - struct TouchState { - int32_t deviceId; - int32_t source; - size_t historyCurrent; - size_t historySize; - History history[2]; - History lastResample; - - void initialize(int32_t deviceId, int32_t source) { - this->deviceId = deviceId; - this->source = source; - historyCurrent = 0; - historySize = 0; - lastResample.eventTime = 0; - lastResample.idBits.clear(); - } - - void addHistory(const InputMessage* msg) { - historyCurrent ^= 1; - if (historySize < 2) { - historySize += 1; - } - history[historyCurrent].initializeFrom(msg); - } - - const History* getHistory(size_t index) const { - return &history[(historyCurrent + index) & 1]; - } - }; - Vector mTouchStates; - - // Chain of batched sequence numbers. When multiple input messages are combined into - // a batch, we append a record here that associates the last sequence number in the - // batch with the previous one. When the finished signal is sent, we traverse the - // chain to individually finish all input messages that were part of the batch. - struct SeqChain { - uint32_t seq; // sequence number of batched input message - uint32_t chain; // sequence number of previous batched input message - }; - Vector mSeqChains; - - status_t consumeBatch(InputEventFactoryInterface* factory, - nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent); - status_t consumeSamples(InputEventFactoryInterface* factory, - Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent); - - void updateTouchState(InputMessage* msg); - void rewriteMessage(const TouchState& state, InputMessage* msg); - void resampleTouchState(nsecs_t frameTime, MotionEvent* event, - const InputMessage *next); - - ssize_t findBatch(int32_t deviceId, int32_t source) const; - ssize_t findTouchState(int32_t deviceId, int32_t source) const; - - status_t sendUnchainedFinishedSignal(uint32_t seq, bool handled); - - static void initializeKeyEvent(KeyEvent* event, const InputMessage* msg); - static void initializeMotionEvent(MotionEvent* event, const InputMessage* msg); - static void addSample(MotionEvent* event, const InputMessage* msg); - static bool canAddSample(const Batch& batch, const InputMessage* msg); - static ssize_t findSampleNoLaterThan(const Batch& batch, nsecs_t time); - static bool shouldResampleTool(int32_t toolType); - - static bool isTouchResamplingEnabled(); -}; - -} // namespace android - -#endif // _LIBINPUT_INPUT_TRANSPORT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/Keyboard.h android-platform-frameworks-native-21/include/input/Keyboard.h --- android-platform-frameworks-native-6.0.1+r16/include/input/Keyboard.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/Keyboard.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,104 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _LIBINPUT_KEYBOARD_H -#define _LIBINPUT_KEYBOARD_H - -#include -#include -#include -#include -#include -#include - -namespace android { - -enum { - /* Device id of the built in keyboard. */ - DEVICE_ID_BUILT_IN_KEYBOARD = 0, - - /* Device id of a generic virtual keyboard with a full layout that can be used - * to synthesize key events. */ - DEVICE_ID_VIRTUAL_KEYBOARD = -1, -}; - -class KeyLayoutMap; -class KeyCharacterMap; - -/** - * Loads the key layout map and key character map for a keyboard device. - */ -class KeyMap { -public: - String8 keyLayoutFile; - sp keyLayoutMap; - - String8 keyCharacterMapFile; - sp keyCharacterMap; - - KeyMap(); - ~KeyMap(); - - status_t load(const InputDeviceIdentifier& deviceIdenfier, - const PropertyMap* deviceConfiguration); - - inline bool haveKeyLayout() const { - return !keyLayoutFile.isEmpty(); - } - - inline bool haveKeyCharacterMap() const { - return !keyCharacterMapFile.isEmpty(); - } - - inline bool isComplete() const { - return haveKeyLayout() && haveKeyCharacterMap(); - } - -private: - bool probeKeyMap(const InputDeviceIdentifier& deviceIdentifier, const String8& name); - status_t loadKeyLayout(const InputDeviceIdentifier& deviceIdentifier, const String8& name); - status_t loadKeyCharacterMap(const InputDeviceIdentifier& deviceIdentifier, - const String8& name); - String8 getPath(const InputDeviceIdentifier& deviceIdentifier, - const String8& name, InputDeviceConfigurationFileType type); -}; - -/** - * Returns true if the keyboard is eligible for use as a built-in keyboard. - */ -extern bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentifier, - const PropertyMap* deviceConfiguration, const KeyMap* keyMap); - -/** - * Updates a meta state field when a key is pressed or released. - */ -extern int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState); - -/** - * Normalizes the meta state such that if either the left or right modifier - * meta state bits are set then the result will also include the universal - * bit for that modifier. - */ -extern int32_t normalizeMetaState(int32_t oldMetaState); - -/** - * Returns true if a key is a meta key like ALT or CAPS_LOCK. - */ -extern bool isMetaKey(int32_t keyCode); - -} // namespace android - -#endif // _LIBINPUT_KEYBOARD_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/KeyCharacterMap.h android-platform-frameworks-native-21/include/input/KeyCharacterMap.h --- android-platform-frameworks-native-6.0.1+r16/include/input/KeyCharacterMap.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/KeyCharacterMap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,265 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef _LIBINPUT_KEY_CHARACTER_MAP_H -#define _LIBINPUT_KEY_CHARACTER_MAP_H - -#include - -#if HAVE_ANDROID_OS -#include -#endif - -#include -#include -#include -#include -#include -#include -#include - -namespace android { - -/** - * Describes a mapping from Android key codes to characters. - * Also specifies other functions of the keyboard such as the keyboard type - * and key modifier semantics. - * - * This object is immutable after it has been loaded. - */ -class KeyCharacterMap : public RefBase { -public: - enum KeyboardType { - KEYBOARD_TYPE_UNKNOWN = 0, - KEYBOARD_TYPE_NUMERIC = 1, - KEYBOARD_TYPE_PREDICTIVE = 2, - KEYBOARD_TYPE_ALPHA = 3, - KEYBOARD_TYPE_FULL = 4, - KEYBOARD_TYPE_SPECIAL_FUNCTION = 5, - KEYBOARD_TYPE_OVERLAY = 6, - }; - - enum Format { - // Base keyboard layout, may contain device-specific options, such as "type" declaration. - FORMAT_BASE = 0, - // Overlay keyboard layout, more restrictive, may be published by applications, - // cannot override device-specific options. - FORMAT_OVERLAY = 1, - // Either base or overlay layout ok. - FORMAT_ANY = 2, - }; - - // Substitute key code and meta state for fallback action. - struct FallbackAction { - int32_t keyCode; - int32_t metaState; - }; - - /* Loads a key character map from a file. */ - static status_t load(const String8& filename, Format format, sp* outMap); - - /* Loads a key character map from its string contents. */ - static status_t loadContents(const String8& filename, - const char* contents, Format format, sp* outMap); - - /* Combines a base key character map and an overlay. */ - static sp combine(const sp& base, - const sp& overlay); - - /* Returns an empty key character map. */ - static sp empty(); - - /* Gets the keyboard type. */ - int32_t getKeyboardType() const; - - /* Gets the primary character for this key as in the label physically printed on it. - * Returns 0 if none (eg. for non-printing keys). */ - char16_t getDisplayLabel(int32_t keyCode) const; - - /* Gets the Unicode character for the number or symbol generated by the key - * when the keyboard is used as a dialing pad. - * Returns 0 if no number or symbol is generated. - */ - char16_t getNumber(int32_t keyCode) const; - - /* Gets the Unicode character generated by the key and meta key modifiers. - * Returns 0 if no character is generated. - */ - char16_t getCharacter(int32_t keyCode, int32_t metaState) const; - - /* Gets the fallback action to use by default if the application does not - * handle the specified key. - * Returns true if an action was available, false if none. - */ - bool getFallbackAction(int32_t keyCode, int32_t metaState, - FallbackAction* outFallbackAction) const; - - /* Gets the first matching Unicode character that can be generated by the key, - * preferring the one with the specified meta key modifiers. - * Returns 0 if no matching character is generated. - */ - char16_t getMatch(int32_t keyCode, const char16_t* chars, - size_t numChars, int32_t metaState) const; - - /* Gets a sequence of key events that could plausibly generate the specified - * character sequence. Returns false if some of the characters cannot be generated. - */ - bool getEvents(int32_t deviceId, const char16_t* chars, size_t numChars, - Vector& outEvents) const; - - /* Maps a scan code and usage code to a key code, in case this key map overrides - * the mapping in some way. */ - status_t mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode) const; - - /* Tries to find a replacement key code for a given key code and meta state - * in character map. */ - void tryRemapKey(int32_t scanCode, int32_t metaState, - int32_t* outKeyCode, int32_t* outMetaState) const; - -#if HAVE_ANDROID_OS - /* Reads a key map from a parcel. */ - static sp readFromParcel(Parcel* parcel); - - /* Writes a key map to a parcel. */ - void writeToParcel(Parcel* parcel) const; -#endif - -protected: - virtual ~KeyCharacterMap(); - -private: - struct Behavior { - Behavior(); - Behavior(const Behavior& other); - - /* The next behavior in the list, or NULL if none. */ - Behavior* next; - - /* The meta key modifiers for this behavior. */ - int32_t metaState; - - /* The character to insert. */ - char16_t character; - - /* The fallback keycode if the key is not handled. */ - int32_t fallbackKeyCode; - - /* The replacement keycode if the key has to be replaced outright. */ - int32_t replacementKeyCode; - }; - - struct Key { - Key(); - Key(const Key& other); - ~Key(); - - /* The single character label printed on the key, or 0 if none. */ - char16_t label; - - /* The number or symbol character generated by the key, or 0 if none. */ - char16_t number; - - /* The list of key behaviors sorted from most specific to least specific - * meta key binding. */ - Behavior* firstBehavior; - }; - - class Parser { - enum State { - STATE_TOP = 0, - STATE_KEY = 1, - }; - - enum { - PROPERTY_LABEL = 1, - PROPERTY_NUMBER = 2, - PROPERTY_META = 3, - }; - - struct Property { - inline Property(int32_t property = 0, int32_t metaState = 0) : - property(property), metaState(metaState) { } - - int32_t property; - int32_t metaState; - }; - - KeyCharacterMap* mMap; - Tokenizer* mTokenizer; - Format mFormat; - State mState; - int32_t mKeyCode; - - public: - Parser(KeyCharacterMap* map, Tokenizer* tokenizer, Format format); - ~Parser(); - status_t parse(); - - private: - status_t parseType(); - status_t parseMap(); - status_t parseMapKey(); - status_t parseKey(); - status_t parseKeyProperty(); - status_t finishKey(Key* key); - status_t parseModifier(const String8& token, int32_t* outMetaState); - status_t parseCharacterLiteral(char16_t* outCharacter); - }; - - static sp sEmpty; - - KeyedVector mKeys; - int mType; - - KeyedVector mKeysByScanCode; - KeyedVector mKeysByUsageCode; - - KeyCharacterMap(); - KeyCharacterMap(const KeyCharacterMap& other); - - bool getKey(int32_t keyCode, const Key** outKey) const; - bool getKeyBehavior(int32_t keyCode, int32_t metaState, - const Key** outKey, const Behavior** outBehavior) const; - static bool matchesMetaState(int32_t eventMetaState, int32_t behaviorMetaState); - - bool findKey(char16_t ch, int32_t* outKeyCode, int32_t* outMetaState) const; - - static status_t load(Tokenizer* tokenizer, Format format, sp* outMap); - - static void addKey(Vector& outEvents, - int32_t deviceId, int32_t keyCode, int32_t metaState, bool down, nsecs_t time); - static void addMetaKeys(Vector& outEvents, - int32_t deviceId, int32_t metaState, bool down, nsecs_t time, - int32_t* currentMetaState); - static bool addSingleEphemeralMetaKey(Vector& outEvents, - int32_t deviceId, int32_t metaState, bool down, nsecs_t time, - int32_t keyCode, int32_t keyMetaState, - int32_t* currentMetaState); - static void addDoubleEphemeralMetaKey(Vector& outEvents, - int32_t deviceId, int32_t metaState, bool down, nsecs_t time, - int32_t leftKeyCode, int32_t leftKeyMetaState, - int32_t rightKeyCode, int32_t rightKeyMetaState, - int32_t eitherKeyMetaState, - int32_t* currentMetaState); - static void addLockedMetaKey(Vector& outEvents, - int32_t deviceId, int32_t metaState, nsecs_t time, - int32_t keyCode, int32_t keyMetaState, - int32_t* currentMetaState); -}; - -} // namespace android - -#endif // _LIBINPUT_KEY_CHARACTER_MAP_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/KeyLayoutMap.h android-platform-frameworks-native-21/include/input/KeyLayoutMap.h --- android-platform-frameworks-native-6.0.1+r16/include/input/KeyLayoutMap.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/KeyLayoutMap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#ifndef _LIBINPUT_KEY_LAYOUT_MAP_H -#define _LIBINPUT_KEY_LAYOUT_MAP_H - -#include -#include -#include -#include -#include - -namespace android { - -struct AxisInfo { - enum Mode { - // Axis value is reported directly. - MODE_NORMAL = 0, - // Axis value should be inverted before reporting. - MODE_INVERT = 1, - // Axis value should be split into two axes - MODE_SPLIT = 2, - }; - - // Axis mode. - Mode mode; - - // Axis id. - // When split, this is the axis used for values smaller than the split position. - int32_t axis; - - // When split, this is the axis used for values after higher than the split position. - int32_t highAxis; - - // The split value, or 0 if not split. - int32_t splitValue; - - // The flat value, or -1 if none. - int32_t flatOverride; - - AxisInfo() : mode(MODE_NORMAL), axis(-1), highAxis(-1), splitValue(0), flatOverride(-1) { - } -}; - -/** - * Describes a mapping from keyboard scan codes and joystick axes to Android key codes and axes. - * - * This object is immutable after it has been loaded. - */ -class KeyLayoutMap : public RefBase { -public: - static status_t load(const String8& filename, sp* outMap); - - status_t mapKey(int32_t scanCode, int32_t usageCode, - int32_t* outKeyCode, uint32_t* outFlags) const; - status_t findScanCodesForKey(int32_t keyCode, Vector* outScanCodes) const; - status_t findScanCodeForLed(int32_t ledCode, int32_t* outScanCode) const; - status_t findUsageCodeForLed(int32_t ledCode, int32_t* outUsageCode) const; - - status_t mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const; - -protected: - virtual ~KeyLayoutMap(); - -private: - struct Key { - int32_t keyCode; - uint32_t flags; - }; - - struct Led { - int32_t ledCode; - }; - - - KeyedVector mKeysByScanCode; - KeyedVector mKeysByUsageCode; - KeyedVector mAxes; - KeyedVector mLedsByScanCode; - KeyedVector mLedsByUsageCode; - - KeyLayoutMap(); - - const Key* getKey(int32_t scanCode, int32_t usageCode) const; - - class Parser { - KeyLayoutMap* mMap; - Tokenizer* mTokenizer; - - public: - Parser(KeyLayoutMap* map, Tokenizer* tokenizer); - ~Parser(); - status_t parse(); - - private: - status_t parseKey(); - status_t parseAxis(); - status_t parseLed(); - }; -}; - -} // namespace android - -#endif // _LIBINPUT_KEY_LAYOUT_MAP_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/VelocityControl.h android-platform-frameworks-native-21/include/input/VelocityControl.h --- android-platform-frameworks-native-6.0.1+r16/include/input/VelocityControl.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/VelocityControl.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,107 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef _LIBINPUT_VELOCITY_CONTROL_H -#define _LIBINPUT_VELOCITY_CONTROL_H - -#include -#include -#include - -namespace android { - -/* - * Specifies parameters that govern pointer or wheel acceleration. - */ -struct VelocityControlParameters { - // A scale factor that is multiplied with the raw velocity deltas - // prior to applying any other velocity control factors. The scale - // factor should be used to adapt the input device resolution - // (eg. counts per inch) to the output device resolution (eg. pixels per inch). - // - // Must be a positive value. - // Default is 1.0 (no scaling). - float scale; - - // The scaled speed at which acceleration begins to be applied. - // This value establishes the upper bound of a low speed regime for - // small precise motions that are performed without any acceleration. - // - // Must be a non-negative value. - // Default is 0.0 (no low threshold). - float lowThreshold; - - // The scaled speed at which maximum acceleration is applied. - // The difference between highThreshold and lowThreshold controls - // the range of speeds over which the acceleration factor is interpolated. - // The wider the range, the smoother the acceleration. - // - // Must be a non-negative value greater than or equal to lowThreshold. - // Default is 0.0 (no high threshold). - float highThreshold; - - // The acceleration factor. - // When the speed is above the low speed threshold, the velocity will scaled - // by an interpolated value between 1.0 and this amount. - // - // Must be a positive greater than or equal to 1.0. - // Default is 1.0 (no acceleration). - float acceleration; - - VelocityControlParameters() : - scale(1.0f), lowThreshold(0.0f), highThreshold(0.0f), acceleration(1.0f) { - } - - VelocityControlParameters(float scale, float lowThreshold, - float highThreshold, float acceleration) : - scale(scale), lowThreshold(lowThreshold), - highThreshold(highThreshold), acceleration(acceleration) { - } -}; - -/* - * Implements mouse pointer and wheel speed control and acceleration. - */ -class VelocityControl { -public: - VelocityControl(); - - /* Sets the various parameters. */ - void setParameters(const VelocityControlParameters& parameters); - - /* Resets the current movement counters to zero. - * This has the effect of nullifying any acceleration. */ - void reset(); - - /* Translates a raw movement delta into an appropriately - * scaled / accelerated delta based on the current velocity. */ - void move(nsecs_t eventTime, float* deltaX, float* deltaY); - -private: - // If no movements are received within this amount of time, - // we assume the movement has stopped and reset the movement counters. - static const nsecs_t STOP_TIME = 500 * 1000000; // 500 ms - - VelocityControlParameters mParameters; - - nsecs_t mLastMovementTime; - VelocityTracker::Position mRawPosition; - VelocityTracker mVelocityTracker; -}; - -} // namespace android - -#endif // _LIBINPUT_VELOCITY_CONTROL_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/VelocityTracker.h android-platform-frameworks-native-21/include/input/VelocityTracker.h --- android-platform-frameworks-native-6.0.1+r16/include/input/VelocityTracker.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/VelocityTracker.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,269 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef _LIBINPUT_VELOCITY_TRACKER_H -#define _LIBINPUT_VELOCITY_TRACKER_H - -#include -#include -#include - -namespace android { - -class VelocityTrackerStrategy; - -/* - * Calculates the velocity of pointer movements over time. - */ -class VelocityTracker { -public: - struct Position { - float x, y; - }; - - struct Estimator { - static const size_t MAX_DEGREE = 4; - - // Estimator time base. - nsecs_t time; - - // Polynomial coefficients describing motion in X and Y. - float xCoeff[MAX_DEGREE + 1], yCoeff[MAX_DEGREE + 1]; - - // Polynomial degree (number of coefficients), or zero if no information is - // available. - uint32_t degree; - - // Confidence (coefficient of determination), between 0 (no fit) and 1 (perfect fit). - float confidence; - - inline void clear() { - time = 0; - degree = 0; - confidence = 0; - for (size_t i = 0; i <= MAX_DEGREE; i++) { - xCoeff[i] = 0; - yCoeff[i] = 0; - } - } - }; - - // Creates a velocity tracker using the specified strategy. - // If strategy is NULL, uses the default strategy for the platform. - VelocityTracker(const char* strategy = NULL); - - ~VelocityTracker(); - - // Resets the velocity tracker state. - void clear(); - - // Resets the velocity tracker state for specific pointers. - // Call this method when some pointers have changed and may be reusing - // an id that was assigned to a different pointer earlier. - void clearPointers(BitSet32 idBits); - - // Adds movement information for a set of pointers. - // The idBits bitfield specifies the pointer ids of the pointers whose positions - // are included in the movement. - // The positions array contains position information for each pointer in order by - // increasing id. Its size should be equal to the number of one bits in idBits. - void addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions); - - // Adds movement information for all pointers in a MotionEvent, including historical samples. - void addMovement(const MotionEvent* event); - - // Gets the velocity of the specified pointer id in position units per second. - // Returns false and sets the velocity components to zero if there is - // insufficient movement information for the pointer. - bool getVelocity(uint32_t id, float* outVx, float* outVy) const; - - // Gets an estimator for the recent movements of the specified pointer id. - // Returns false and clears the estimator if there is no information available - // about the pointer. - bool getEstimator(uint32_t id, Estimator* outEstimator) const; - - // Gets the active pointer id, or -1 if none. - inline int32_t getActivePointerId() const { return mActivePointerId; } - - // Gets a bitset containing all pointer ids from the most recent movement. - inline BitSet32 getCurrentPointerIdBits() const { return mCurrentPointerIdBits; } - -private: - static const char* DEFAULT_STRATEGY; - - nsecs_t mLastEventTime; - BitSet32 mCurrentPointerIdBits; - int32_t mActivePointerId; - VelocityTrackerStrategy* mStrategy; - - bool configureStrategy(const char* strategy); - - static VelocityTrackerStrategy* createStrategy(const char* strategy); -}; - - -/* - * Implements a particular velocity tracker algorithm. - */ -class VelocityTrackerStrategy { -protected: - VelocityTrackerStrategy() { } - -public: - virtual ~VelocityTrackerStrategy() { } - - virtual void clear() = 0; - virtual void clearPointers(BitSet32 idBits) = 0; - virtual void addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions) = 0; - virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const = 0; -}; - - -/* - * Velocity tracker algorithm based on least-squares linear regression. - */ -class LeastSquaresVelocityTrackerStrategy : public VelocityTrackerStrategy { -public: - enum Weighting { - // No weights applied. All data points are equally reliable. - WEIGHTING_NONE, - - // Weight by time delta. Data points clustered together are weighted less. - WEIGHTING_DELTA, - - // Weight such that points within a certain horizon are weighed more than those - // outside of that horizon. - WEIGHTING_CENTRAL, - - // Weight such that points older than a certain amount are weighed less. - WEIGHTING_RECENT, - }; - - // Degree must be no greater than Estimator::MAX_DEGREE. - LeastSquaresVelocityTrackerStrategy(uint32_t degree, Weighting weighting = WEIGHTING_NONE); - virtual ~LeastSquaresVelocityTrackerStrategy(); - - virtual void clear(); - virtual void clearPointers(BitSet32 idBits); - virtual void addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions); - virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const; - -private: - // Sample horizon. - // We don't use too much history by default since we want to react to quick - // changes in direction. - static const nsecs_t HORIZON = 100 * 1000000; // 100 ms - - // Number of samples to keep. - static const uint32_t HISTORY_SIZE = 20; - - struct Movement { - nsecs_t eventTime; - BitSet32 idBits; - VelocityTracker::Position positions[MAX_POINTERS]; - - inline const VelocityTracker::Position& getPosition(uint32_t id) const { - return positions[idBits.getIndexOfBit(id)]; - } - }; - - float chooseWeight(uint32_t index) const; - - const uint32_t mDegree; - const Weighting mWeighting; - uint32_t mIndex; - Movement mMovements[HISTORY_SIZE]; -}; - - -/* - * Velocity tracker algorithm that uses an IIR filter. - */ -class IntegratingVelocityTrackerStrategy : public VelocityTrackerStrategy { -public: - // Degree must be 1 or 2. - IntegratingVelocityTrackerStrategy(uint32_t degree); - ~IntegratingVelocityTrackerStrategy(); - - virtual void clear(); - virtual void clearPointers(BitSet32 idBits); - virtual void addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions); - virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const; - -private: - // Current state estimate for a particular pointer. - struct State { - nsecs_t updateTime; - uint32_t degree; - - float xpos, xvel, xaccel; - float ypos, yvel, yaccel; - }; - - const uint32_t mDegree; - BitSet32 mPointerIdBits; - State mPointerState[MAX_POINTER_ID + 1]; - - void initState(State& state, nsecs_t eventTime, float xpos, float ypos) const; - void updateState(State& state, nsecs_t eventTime, float xpos, float ypos) const; - void populateEstimator(const State& state, VelocityTracker::Estimator* outEstimator) const; -}; - - -/* - * Velocity tracker strategy used prior to ICS. - */ -class LegacyVelocityTrackerStrategy : public VelocityTrackerStrategy { -public: - LegacyVelocityTrackerStrategy(); - virtual ~LegacyVelocityTrackerStrategy(); - - virtual void clear(); - virtual void clearPointers(BitSet32 idBits); - virtual void addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions); - virtual bool getEstimator(uint32_t id, VelocityTracker::Estimator* outEstimator) const; - -private: - // Oldest sample to consider when calculating the velocity. - static const nsecs_t HORIZON = 200 * 1000000; // 100 ms - - // Number of samples to keep. - static const uint32_t HISTORY_SIZE = 20; - - // The minimum duration between samples when estimating velocity. - static const nsecs_t MIN_DURATION = 10 * 1000000; // 10 ms - - struct Movement { - nsecs_t eventTime; - BitSet32 idBits; - VelocityTracker::Position positions[MAX_POINTERS]; - - inline const VelocityTracker::Position& getPosition(uint32_t id) const { - return positions[idBits.getIndexOfBit(id)]; - } - }; - - uint32_t mIndex; - Movement mMovements[HISTORY_SIZE]; -}; - -} // namespace android - -#endif // _LIBINPUT_VELOCITY_TRACKER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/input/VirtualKeyMap.h android-platform-frameworks-native-21/include/input/VirtualKeyMap.h --- android-platform-frameworks-native-6.0.1+r16/include/input/VirtualKeyMap.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/input/VirtualKeyMap.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _LIBINPUT_VIRTUAL_KEY_MAP_H -#define _LIBINPUT_VIRTUAL_KEY_MAP_H - -#include - -#include -#include -#include -#include -#include -#include - -namespace android { - -/* Describes a virtual key. */ -struct VirtualKeyDefinition { - int32_t scanCode; - - // configured position data, specified in display coords - int32_t centerX; - int32_t centerY; - int32_t width; - int32_t height; -}; - - -/** - * Describes a collection of virtual keys on a touch screen in terms of - * virtual scan codes and hit rectangles. - * - * This object is immutable after it has been loaded. - */ -class VirtualKeyMap { -public: - ~VirtualKeyMap(); - - static status_t load(const String8& filename, VirtualKeyMap** outMap); - - inline const Vector& getVirtualKeys() const { - return mVirtualKeys; - } - -private: - class Parser { - VirtualKeyMap* mMap; - Tokenizer* mTokenizer; - - public: - Parser(VirtualKeyMap* map, Tokenizer* tokenizer); - ~Parser(); - status_t parse(); - - private: - bool consumeFieldDelimiterAndSkipWhitespace(); - bool parseNextIntField(int32_t* outValue); - }; - - Vector mVirtualKeys; - - VirtualKeyMap(); -}; - -} // namespace android - -#endif // _LIBINPUT_KEY_CHARACTER_MAP_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/drm/DrmAPI.h android-platform-frameworks-native-21/include/media/drm/DrmAPI.h --- android-platform-frameworks-native-6.0.1+r16/include/media/drm/DrmAPI.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/drm/DrmAPI.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,419 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef DRM_API_H_ -#define DRM_API_H_ - -#include -#include -#include -#include -#include -#include -#include - -// Loadable DrmEngine shared libraries should define the entry points -// createDrmFactory and createCryptoFactory as shown below: -// -// extern "C" { -// extern android::DrmFactory *createDrmFactory(); -// extern android::CryptoFactory *createCryptoFactory(); -// } - -namespace android { - - class DrmPlugin; - class DrmPluginListener; - - // DRMs are implemented in DrmEngine plugins, which are dynamically - // loadable shared libraries that implement the entry points - // createDrmFactory and createCryptoFactory. createDrmFactory - // constructs and returns an instance of a DrmFactory object. Similarly, - // createCryptoFactory creates an instance of a CryptoFactory object. - // When a MediaCrypto or MediaDrm object needs to be constructed, all - // available DrmEngines present in the plugins directory on the device - // are scanned for a matching DrmEngine that can support the crypto - // scheme. When a match is found, the DrmEngine's createCryptoPlugin and - // createDrmPlugin methods are used to create CryptoPlugin or - // DrmPlugin instances to support that DRM scheme. - - class DrmFactory { - public: - DrmFactory() {} - virtual ~DrmFactory() {} - - // DrmFactory::isCryptoSchemeSupported can be called to determine - // if the plugin factory is able to construct plugins that support a - // given crypto scheme, which is specified by a UUID. - virtual bool isCryptoSchemeSupported(const uint8_t uuid[16]) = 0; - - // DrmFactory::isContentTypeSupported can be called to determine - // if the plugin factory is able to construct plugins that support a - // given media container format specified by mimeType - virtual bool isContentTypeSupported(const String8 &mimeType) = 0; - - // Construct a DrmPlugin for the crypto scheme specified by UUID. - virtual status_t createDrmPlugin( - const uint8_t uuid[16], DrmPlugin **plugin) = 0; - - private: - DrmFactory(const DrmFactory &); - DrmFactory &operator=(const DrmFactory &); - }; - - class DrmPlugin { - public: - enum EventType { - kDrmPluginEventProvisionRequired = 1, - kDrmPluginEventKeyNeeded, - kDrmPluginEventKeyExpired, - kDrmPluginEventVendorDefined, - kDrmPluginEventSessionReclaimed, - kDrmPluginEventExpirationUpdate, - kDrmPluginEventKeysChange, - }; - - // Drm keys can be for offline content or for online streaming. - // Offline keys are persisted on the device and may be used when the device - // is disconnected from the network. The Release type is used to request - // that offline keys be no longer restricted to offline use. - enum KeyType { - kKeyType_Offline, - kKeyType_Streaming, - kKeyType_Release - }; - - // Enumerate KeyRequestTypes to allow an app to determine the - // type of a key request returned from getKeyRequest. - enum KeyRequestType { - kKeyRequestType_Unknown, - kKeyRequestType_Initial, - kKeyRequestType_Renewal, - kKeyRequestType_Release - }; - - // Enumerate KeyStatusTypes which indicate the state of a key - enum KeyStatusType - { - kKeyStatusType_Usable, - kKeyStatusType_Expired, - kKeyStatusType_OutputNotAllowed, - kKeyStatusType_StatusPending, - kKeyStatusType_InternalError - }; - - // Used by sendKeysChange to report the usability status of each - // key to the app. - struct KeyStatus - { - Vector mKeyId; - KeyStatusType mType; - }; - - DrmPlugin() {} - virtual ~DrmPlugin() {} - - // Open a new session with the DrmPlugin object. A session ID is returned - // in the sessionId parameter. - virtual status_t openSession(Vector &sessionId) = 0; - - // Close a session on the DrmPlugin object. - virtual status_t closeSession(Vector const &sessionId) = 0; - - // A key request/response exchange occurs between the app and a License - // Server to obtain the keys required to decrypt the content. getKeyRequest() - // is used to obtain an opaque key request blob that is delivered to the - // license server. - // - // The scope parameter may be a sessionId or a keySetId, depending on the - // specified keyType. When the keyType is kKeyType_Offline or - // kKeyType_Streaming, scope should be set to the sessionId the keys will be - // provided to. When the keyType is kKeyType_Release, scope should be set to - // the keySetId of the keys being released. Releasing keys from a device - // invalidates them for all sessions. - // - // The init data passed to getKeyRequest is container-specific and its - // meaning is interpreted based on the mime type provided in the mimeType - // parameter to getKeyRequest. It could contain, for example, the content - // ID, key ID or other data obtained from the content metadata that is required - // in generating the key request. Init may be null when keyType is - // kKeyType_Release. - // - // mimeType identifies the mime type of the content - // - // keyType specifies if the keys are to be used for streaming or offline content - // - // optionalParameters are included in the key request message to allow a - // client application to provide additional message parameters to the server. - // - // If successful, the opaque key request blob is returned to the caller. - virtual status_t - getKeyRequest(Vector const &scope, - Vector const &initData, - String8 const &mimeType, KeyType keyType, - KeyedVector const &optionalParameters, - Vector &request, String8 &defaultUrl, - KeyRequestType *keyRequestType) = 0; - - // - // After a key response is received by the app, it is provided to the - // Drm plugin using provideKeyResponse. - // - // scope may be a sessionId or a keySetId depending on the type of the - // response. Scope should be set to the sessionId when the response is - // for either streaming or offline key requests. Scope should be set to the - // keySetId when the response is for a release request. - // - // When the response is for an offline key request, a keySetId is returned - // in the keySetId vector parameter that can be used to later restore the - // keys to a new session with the method restoreKeys. When the response is - // for a streaming or release request, no keySetId is returned. - // - virtual status_t provideKeyResponse(Vector const &scope, - Vector const &response, - Vector &keySetId) = 0; - - // Remove the current keys from a session - virtual status_t removeKeys(Vector const &sessionId) = 0; - - // Restore persisted offline keys into a new session. keySetId identifies - // the keys to load, obtained from a prior call to provideKeyResponse(). - virtual status_t restoreKeys(Vector const &sessionId, - Vector const &keySetId) = 0; - - // Request an informative description of the license for the session. The status - // is in the form of {name, value} pairs. Since DRM license policies vary by - // vendor, the specific status field names are determined by each DRM vendor. - // Refer to your DRM provider documentation for definitions of the field names - // for a particular DrmEngine. - virtual status_t - queryKeyStatus(Vector const &sessionId, - KeyedVector &infoMap) const = 0; - - // A provision request/response exchange occurs between the app and a - // provisioning server to retrieve a device certificate. getProvisionRequest - // is used to obtain an opaque key request blob that is delivered to the - // provisioning server. - // - // If successful, the opaque provision request blob is returned to the caller. - virtual status_t getProvisionRequest(String8 const &cert_type, - String8 const &cert_authority, - Vector &request, - String8 &defaultUrl) = 0; - - // After a provision response is received by the app, it is provided to the - // Drm plugin using provideProvisionResponse. - virtual status_t provideProvisionResponse(Vector const &response, - Vector &certificate, - Vector &wrapped_key) = 0; - - // Remove device provisioning. - virtual status_t unprovisionDevice() = 0; - - // A means of enforcing the contractual requirement for a concurrent stream - // limit per subscriber across devices is provided via SecureStop. SecureStop - // is a means of securely monitoring the lifetime of sessions. Since playback - // on a device can be interrupted due to reboot, power failure, etc. a means - // of persisting the lifetime information on the device is needed. - // - // A signed version of the sessionID is written to persistent storage on the - // device when each MediaCrypto object is created. The sessionID is signed by - // the device private key to prevent tampering. - // - // In the normal case, playback will be completed, the session destroyed and - // the Secure Stops will be queried. The App queries secure stops and forwards - // the secure stop message to the server which verifies the signature and - // notifies the server side database that the session destruction has been - // confirmed. The persisted record on the client is only removed after positive - // confirmation that the server received the message using releaseSecureStops(). - virtual status_t getSecureStops(List > &secureStops) = 0; - virtual status_t getSecureStop(Vector const &ssid, Vector &secureStop) = 0; - virtual status_t releaseSecureStops(Vector const &ssRelease) = 0; - virtual status_t releaseAllSecureStops() = 0; - - // Read a property value given the device property string. There are a few forms - // of property access methods, depending on the data type returned. - // Since DRM plugin properties may vary, additional field names may be defined - // by each DRM vendor. Refer to your DRM provider documentation for definitions - // of its additional field names. - // - // Standard values are: - // "vendor" [string] identifies the maker of the plugin - // "version" [string] identifies the version of the plugin - // "description" [string] describes the plugin - // 'deviceUniqueId' [byte array] The device unique identifier is established - // during device provisioning and provides a means of uniquely identifying - // each device. - virtual status_t getPropertyString(String8 const &name, String8 &value ) const = 0; - virtual status_t getPropertyByteArray(String8 const &name, - Vector &value ) const = 0; - - // Write a property value given the device property string. There are a few forms - // of property setting methods, depending on the data type. - // Since DRM plugin properties may vary, additional field names may be defined - // by each DRM vendor. Refer to your DRM provider documentation for definitions - // of its field names. - virtual status_t setPropertyString(String8 const &name, - String8 const &value ) = 0; - virtual status_t setPropertyByteArray(String8 const &name, - Vector const &value ) = 0; - - // The following methods implement operations on a CryptoSession to support - // encrypt, decrypt, sign verify operations on operator-provided - // session keys. - - // - // The algorithm string conforms to JCA Standard Names for Cipher - // Transforms and is case insensitive. For example "AES/CBC/PKCS5Padding". - // - // Return OK if the algorithm is supported, otherwise return BAD_VALUE - // - virtual status_t setCipherAlgorithm(Vector const &sessionId, - String8 const &algorithm) = 0; - - // - // The algorithm string conforms to JCA Standard Names for Mac - // Algorithms and is case insensitive. For example "HmacSHA256". - // - // Return OK if the algorithm is supported, otherwise return BAD_VALUE - // - virtual status_t setMacAlgorithm(Vector const &sessionId, - String8 const &algorithm) = 0; - - // Encrypt the provided input buffer with the cipher algorithm - // specified by setCipherAlgorithm and the key selected by keyId, - // and return the encrypted data. - virtual status_t encrypt(Vector const &sessionId, - Vector const &keyId, - Vector const &input, - Vector const &iv, - Vector &output) = 0; - - // Decrypt the provided input buffer with the cipher algorithm - // specified by setCipherAlgorithm and the key selected by keyId, - // and return the decrypted data. - virtual status_t decrypt(Vector const &sessionId, - Vector const &keyId, - Vector const &input, - Vector const &iv, - Vector &output) = 0; - - // Compute a signature on the provided message using the mac algorithm - // specified by setMacAlgorithm and the key selected by keyId, - // and return the signature. - virtual status_t sign(Vector const &sessionId, - Vector const &keyId, - Vector const &message, - Vector &signature) = 0; - - // Compute a signature on the provided message using the mac algorithm - // specified by setMacAlgorithm and the key selected by keyId, - // and compare with the expected result. Set result to true or - // false depending on the outcome. - virtual status_t verify(Vector const &sessionId, - Vector const &keyId, - Vector const &message, - Vector const &signature, - bool &match) = 0; - - - // Compute an RSA signature on the provided message using the algorithm - // specified by algorithm. - virtual status_t signRSA(Vector const &sessionId, - String8 const &algorithm, - Vector const &message, - Vector const &wrapped_key, - Vector &signature) = 0; - - - status_t setListener(const sp& listener) { - Mutex::Autolock lock(mEventLock); - mListener = listener; - return OK; - } - - protected: - // Plugins call these methods to deliver events to the java app - void sendEvent(EventType eventType, int extra, - Vector const *sessionId, - Vector const *data); - - void sendExpirationUpdate(Vector const *sessionId, - int64_t expiryTimeInMS); - - void sendKeysChange(Vector const *sessionId, - Vector const *keyStatusList, - bool hasNewUsableKey); - - private: - Mutex mEventLock; - sp mListener; - - DISALLOW_EVIL_CONSTRUCTORS(DrmPlugin); - }; - - class DrmPluginListener: virtual public RefBase - { - public: - virtual void sendEvent(DrmPlugin::EventType eventType, int extra, - Vector const *sessionId, - Vector const *data) = 0; - - virtual void sendExpirationUpdate(Vector const *sessionId, - int64_t expiryTimeInMS) = 0; - - virtual void sendKeysChange(Vector const *sessionId, - Vector const *keyStatusList, - bool hasNewUsableKey) = 0; - }; - - inline void DrmPlugin::sendEvent(EventType eventType, int extra, - Vector const *sessionId, - Vector const *data) { - mEventLock.lock(); - sp listener = mListener; - mEventLock.unlock(); - - if (listener != NULL) { - listener->sendEvent(eventType, extra, sessionId, data); - } - } - - inline void DrmPlugin::sendExpirationUpdate(Vector const *sessionId, - int64_t expiryTimeInMS) { - mEventLock.lock(); - sp listener = mListener; - mEventLock.unlock(); - - if (listener != NULL) { - listener->sendExpirationUpdate(sessionId, expiryTimeInMS); - } - } - - inline void DrmPlugin::sendKeysChange(Vector const *sessionId, - Vector const *keyStatusList, - bool hasNewUsableKey) { - mEventLock.lock(); - sp listener = mListener; - mEventLock.unlock(); - - if (listener != NULL) { - listener->sendKeysChange(sessionId, keyStatusList, hasNewUsableKey); - } - } -} // namespace android - -#endif // DRM_API_H_ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/hardware/CryptoAPI.h android-platform-frameworks-native-21/include/media/hardware/CryptoAPI.h --- android-platform-frameworks-native-6.0.1+r16/include/media/hardware/CryptoAPI.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/hardware/CryptoAPI.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,9 +14,7 @@ * limitations under the License. */ -#include #include -#include #ifndef CRYPTO_API_H_ @@ -53,8 +51,8 @@ }; struct SubSample { - uint32_t mNumBytesOfClearData; - uint32_t mNumBytesOfEncryptedData; + size_t mNumBytesOfClearData; + size_t mNumBytesOfEncryptedData; }; CryptoPlugin() {} @@ -66,23 +64,6 @@ // media data of the given mime type. virtual bool requiresSecureDecoderComponent(const char *mime) const = 0; - // To implement resolution constraints, the crypto plugin needs to know - // the resolution of the video being decrypted. The media player should - // call this method when the resolution is determined and any time it - // is subsequently changed. - - virtual void notifyResolution(uint32_t /* width */, uint32_t /* height */) {} - - // A MediaDrm session may be associated with a MediaCrypto session. The - // associated MediaDrm session is used to load decryption keys - // into the crypto/drm plugin. The keys are then referenced by key-id - // in the 'key' parameter to the decrypt() method. - // Should return NO_ERROR on success, ERROR_DRM_SESSION_NOT_OPENED if - // the session is not opened and a code from MediaErrors.h otherwise. - virtual status_t setMediaDrmSession(const Vector & /*sessionId */) { - return ERROR_UNSUPPORTED; - } - // If the error returned falls into the range // ERROR_DRM_VENDOR_MIN..ERROR_DRM_VENDOR_MAX, errorDetailMsg should be // filled in with an appropriate string. diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/hardware/HardwareAPI.h android-platform-frameworks-native-21/include/media/hardware/HardwareAPI.h --- android-platform-frameworks-native-6.0.1+r16/include/media/hardware/HardwareAPI.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/hardware/HardwareAPI.h 2012-10-16 22:57:11.000000000 +0000 @@ -18,8 +18,7 @@ #define HARDWARE_API_H_ -#include -#include +#include #include #include @@ -38,13 +37,9 @@ // // When Android native buffer use has been enabled for a given port, the video // color format for the port is to be interpreted as an Android pixel format -// rather than an OMX color format. Enabling Android native buffers may also -// change how the component receives the native buffers. If store-metadata-mode -// is enabled on the port, the component will receive the buffers as specified -// in the section below. Otherwise, unless the node supports the -// 'OMX.google.android.index.useAndroidNativeBuffer2' extension, it should -// expect to receive UseAndroidNativeBuffer calls (via OMX_SetParameter) rather -// than UseBuffer calls for that port. +// rather than an OMX color format. The node should then expect to receive +// UseAndroidNativeBuffer calls (via OMX_SetParameter) rather than UseBuffer +// calls for that port. struct EnableAndroidNativeBuffersParams { OMX_U32 nSize; OMX_VERSIONTYPE nVersion; @@ -52,9 +47,9 @@ OMX_BOOL enable; }; -// A pointer to this struct is passed to OMX_SetParameter() when the extension index -// "OMX.google.android.index.storeMetaDataInBuffers" or -// "OMX.google.android.index.storeANWBufferInMetadata" is given. +// A pointer to this struct is passed to OMX_SetParameter() when the extension +// index "OMX.google.android.index.storeMetaDataInBuffers" +// is given. // // When meta data is stored in the video buffers passed between OMX clients // and OMX components, interpretation of the buffer data is up to the @@ -62,33 +57,15 @@ // some information helpful for the receiver to locate the actual data. // The buffer receiver thus needs to know how to interpret what is stored // in these buffers, with mechanisms pre-determined externally. How to -// interpret the meta data is outside of the scope of this parameter. -// -// Currently, this is used to pass meta data from video source (camera component, for instance) to -// video encoder to avoid memcpying of input video frame data, as well as to pass dynamic output -// buffer to video decoder. To do this, bStoreMetaData is set to OMX_TRUE. -// -// If bStoreMetaData is set to false, real YUV frame data will be stored in input buffers, and -// the output buffers contain either real YUV frame data, or are themselves native handles as -// directed by enable/use-android-native-buffer parameter settings. -// In addition, if no OMX_SetParameter() call is made on a port with the corresponding extension -// index, the component should not assume that the client is not using metadata mode for the port. -// -// If the component supports this using the "OMX.google.android.index.storeANWBufferInMetadata" -// extension and bStoreMetaData is set to OMX_TRUE, data is passed using the VideoNativeMetadata -// layout as defined below. Each buffer will be accompanied by a fence. The fence must signal -// before the buffer can be used (e.g. read from or written into). When returning such buffer to -// the client, component must provide a new fence that must signal before the returned buffer can -// be used (e.g. read from or written into). The component owns the incoming fenceFd, and must close -// it when fence has signaled. The client will own and close the returned fence file descriptor. -// -// If the component supports this using the "OMX.google.android.index.storeMetaDataInBuffers" -// extension and bStoreMetaData is set to OMX_TRUE, data is passed using VideoGrallocMetadata -// (the layout of which is the VideoGrallocMetadata defined below). Camera input can be also passed -// as "CameraSource", the layout of which is vendor dependent. +// interpret the meta data is outside of the scope of this method. // -// Metadata buffers are registered with the component using UseBuffer calls, or can be allocated -// by the component for encoder-metadata-output buffers. +// Currently, this is specifically used to pass meta data from video source +// (camera component, for instance) to video encoder to avoid memcpying of +// input video frame data. To do this, bStoreMetaDta is set to OMX_TRUE. +// If bStoreMetaData is set to false, real YUV frame data will be stored +// in the buffers. In addition, if no OMX_SetParameter() call is made +// with the corresponding extension index, real YUV data is stored +// in the buffers. struct StoreMetaDataInBuffersParams { OMX_U32 nSize; OMX_VERSIONTYPE nVersion; @@ -96,55 +73,6 @@ OMX_BOOL bStoreMetaData; }; -// Meta data buffer layout used to transport output frames to the decoder for -// dynamic buffer handling. -struct VideoGrallocMetadata { - MetadataBufferType eType; // must be kMetadataBufferTypeGrallocSource -#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS - OMX_PTR pHandle; -#else - buffer_handle_t pHandle; -#endif -}; - -// Legacy name for VideoGrallocMetadata struct. -struct VideoDecoderOutputMetaData : public VideoGrallocMetadata {}; - -struct VideoNativeMetadata { - MetadataBufferType eType; // must be kMetadataBufferTypeANWBuffer -#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS - OMX_PTR pBuffer; -#else - struct ANativeWindowBuffer* pBuffer; -#endif - int nFenceFd; // -1 if unused -}; - -// A pointer to this struct is passed to OMX_SetParameter() when the extension -// index "OMX.google.android.index.prepareForAdaptivePlayback" is given. -// -// This method is used to signal a video decoder, that the user has requested -// seamless resolution change support (if bEnable is set to OMX_TRUE). -// nMaxFrameWidth and nMaxFrameHeight are the dimensions of the largest -// anticipated frames in the video. If bEnable is OMX_FALSE, no resolution -// change is expected, and the nMaxFrameWidth/Height fields are unused. -// -// If the decoder supports dynamic output buffers, it may ignore this -// request. Otherwise, it shall request resources in such a way so that it -// avoids full port-reconfiguration (due to output port-definition change) -// during resolution changes. -// -// DO NOT USE THIS STRUCTURE AS IT WILL BE REMOVED. INSTEAD, IMPLEMENT -// METADATA SUPPORT FOR VIDEO DECODERS. -struct PrepareForAdaptivePlaybackParams { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_BOOL bEnable; - OMX_U32 nMaxFrameWidth; - OMX_U32 nMaxFrameHeight; -}; - // A pointer to this struct is passed to OMX_SetParameter when the extension // index for the 'OMX.google.android.index.useAndroidNativeBuffer' extension is // given. This call will only be performed if a prior call was made with the @@ -177,109 +105,6 @@ // colorformat will be relayed by the GRalloc Buffers. // OMX_COLOR_FormatAndroidOpaque = 0x7F000001, -// A pointer to this struct is passed to OMX_SetParameter when the extension -// index for the 'OMX.google.android.index.prependSPSPPSToIDRFrames' extension -// is given. -// A successful result indicates that future IDR frames will be prefixed by -// SPS/PPS. -struct PrependSPSPPSToIDRFramesParams { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_BOOL bEnable; -}; - -// Structure describing a media image (frame) -// Currently only supporting YUV -struct MediaImage { - enum Type { - MEDIA_IMAGE_TYPE_UNKNOWN = 0, - MEDIA_IMAGE_TYPE_YUV, - }; - - enum PlaneIndex { - Y = 0, - U, - V, - MAX_NUM_PLANES - }; - - Type mType; - uint32_t mNumPlanes; // number of planes - uint32_t mWidth; // width of largest plane (unpadded, as in nFrameWidth) - uint32_t mHeight; // height of largest plane (unpadded, as in nFrameHeight) - uint32_t mBitDepth; // useable bit depth - struct PlaneInfo { - uint32_t mOffset; // offset of first pixel of the plane in bytes - // from buffer offset - uint32_t mColInc; // column increment in bytes - uint32_t mRowInc; // row increment in bytes - uint32_t mHorizSubsampling; // subsampling compared to the largest plane - uint32_t mVertSubsampling; // subsampling compared to the largest plane - }; - PlaneInfo mPlane[MAX_NUM_PLANES]; -}; - -// A pointer to this struct is passed to OMX_GetParameter when the extension -// index for the 'OMX.google.android.index.describeColorFormat' -// extension is given. This method can be called from any component state -// other than invalid. The color-format, frame width/height, and stride/ -// slice-height parameters are ones that are associated with a raw video -// port (input or output), but the stride/slice height parameters may be -// incorrect. bUsingNativeBuffers is OMX_TRUE if native android buffers will -// be used (while specifying this color format). -// -// The component shall fill out the MediaImage structure that -// corresponds to the described raw video format, and the potentially corrected -// stride and slice-height info. -// -// The behavior is slightly different if bUsingNativeBuffers is OMX_TRUE, -// though most implementations can ignore this difference. When using native buffers, -// the component may change the configured color format to an optimized format. -// Additionally, when allocating these buffers for flexible usecase, the framework -// will set the SW_READ/WRITE_OFTEN usage flags. In this case (if bUsingNativeBuffers -// is OMX_TRUE), the component shall fill out the MediaImage information for the -// scenario when these SW-readable/writable buffers are locked using gralloc_lock. -// Note, that these buffers may also be locked using gralloc_lock_ycbcr, which must -// be supported for vendor-specific formats. -// -// For non-YUV packed planar/semiplanar image formats, or if bUsingNativeBuffers -// is OMX_TRUE and the component does not support this color format with native -// buffers, the component shall set mNumPlanes to 0, and mType to MEDIA_IMAGE_TYPE_UNKNOWN. -struct DescribeColorFormatParams { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - // input: parameters from OMX_VIDEO_PORTDEFINITIONTYPE - OMX_COLOR_FORMATTYPE eColorFormat; - OMX_U32 nFrameWidth; - OMX_U32 nFrameHeight; - OMX_U32 nStride; - OMX_U32 nSliceHeight; - OMX_BOOL bUsingNativeBuffers; - - // output: fill out the MediaImage fields - MediaImage sMediaImage; -}; - -// A pointer to this struct is passed to OMX_SetParameter or OMX_GetParameter -// when the extension index for the -// 'OMX.google.android.index.configureVideoTunnelMode' extension is given. -// If the extension is supported then tunneled playback mode should be supported -// by the codec. If bTunneled is set to OMX_TRUE then the video decoder should -// operate in "tunneled" mode and output its decoded frames directly to the -// sink. In this case nAudioHwSync is the HW SYNC ID of the audio HAL Output -// stream to sync the video with. If bTunneled is set to OMX_FALSE, "tunneled" -// mode should be disabled and nAudioHwSync should be ignored. -// OMX_GetParameter is used to query tunneling configuration. bTunneled should -// return whether decoder is operating in tunneled mode, and if it is, -// pSidebandWindow should contain the codec allocated sideband window handle. -struct ConfigureVideoTunnelModeParams { - OMX_U32 nSize; // IN - OMX_VERSIONTYPE nVersion; // IN - OMX_U32 nPortIndex; // IN - OMX_BOOL bTunneled; // IN/OUT - OMX_U32 nAudioHwSync; // IN - OMX_PTR pSidebandWindow; // OUT -}; } // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/hardware/HDCPAPI.h android-platform-frameworks-native-21/include/media/hardware/HDCPAPI.h --- android-platform-frameworks-native-6.0.1+r16/include/media/hardware/HDCPAPI.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/hardware/HDCPAPI.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef HDCP_API_H_ - -#define HDCP_API_H_ - -#include -#include - -namespace android { - -// Two different kinds of modules are covered under the same HDCPModule -// structure below, a module either implements decryption or encryption. -struct HDCPModule { - typedef void (*ObserverFunc)(void *cookie, int msg, int ext1, int ext2); - - // The msg argument in calls to the observer notification function. - enum { - // Sent in response to a call to "HDCPModule::initAsync" once - // initialization has either been successfully completed, - // i.e. the HDCP session is now fully setup (AKE, Locality Check, - // SKE and any authentication with repeaters completed) or failed. - // ext1 should be a suitable error code (status_t), ext2 is - // unused for ENCRYPTION and in the case of HDCP_INITIALIZATION_COMPLETE - // holds the local TCP port the module is listening on. - HDCP_INITIALIZATION_COMPLETE, - HDCP_INITIALIZATION_FAILED, - - // Sent upon completion of a call to "HDCPModule::shutdownAsync". - // ext1 should be a suitable error code, ext2 is unused. - HDCP_SHUTDOWN_COMPLETE, - HDCP_SHUTDOWN_FAILED, - - HDCP_UNAUTHENTICATED_CONNECTION, - HDCP_UNAUTHORIZED_CONNECTION, - HDCP_REVOKED_CONNECTION, - HDCP_TOPOLOGY_EXECEEDED, - HDCP_UNKNOWN_ERROR, - - // DECRYPTION only: Indicates that a client has successfully connected, - // a secure session established and the module is ready to accept - // future calls to "decrypt". - HDCP_SESSION_ESTABLISHED, - }; - - // HDCPModule capability bit masks - enum { - // HDCP_CAPS_ENCRYPT: mandatory, meaning the HDCP module can encrypt - // from an input byte-array buffer to an output byte-array buffer - HDCP_CAPS_ENCRYPT = (1 << 0), - // HDCP_CAPS_ENCRYPT_NATIVE: the HDCP module supports encryption from - // a native buffer to an output byte-array buffer. The format of the - // input native buffer is specific to vendor's encoder implementation. - // It is the same format as that used by the encoder when - // "storeMetaDataInBuffers" extension is enabled on its output port. - HDCP_CAPS_ENCRYPT_NATIVE = (1 << 1), - }; - - // Module can call the notification function to signal completion/failure - // of asynchronous operations (such as initialization) or out of band - // events. - HDCPModule(void *cookie, ObserverFunc observerNotify) {}; - - virtual ~HDCPModule() {}; - - // ENCRYPTION: Request to setup an HDCP session with the host specified - // by addr and listening on the specified port. - // DECRYPTION: Request to setup an HDCP session, addr is the interface - // address the module should bind its socket to. port will be 0. - // The module will pick the port to listen on itself and report its choice - // in the "ext2" argument of the HDCP_INITIALIZATION_COMPLETE callback. - virtual status_t initAsync(const char *addr, unsigned port) = 0; - - // Request to shutdown the active HDCP session. - virtual status_t shutdownAsync() = 0; - - // Returns the capability bitmask of this HDCP session. - virtual uint32_t getCaps() { - return HDCP_CAPS_ENCRYPT; - } - - // ENCRYPTION only: - // Encrypt data according to the HDCP spec. "size" bytes of data are - // available at "inData" (virtual address), "size" may not be a multiple - // of 128 bits (16 bytes). An equal number of encrypted bytes should be - // written to the buffer at "outData" (virtual address). - // This operation is to be synchronous, i.e. this call does not return - // until outData contains size bytes of encrypted data. - // streamCTR will be assigned by the caller (to 0 for the first PES stream, - // 1 for the second and so on) - // inputCTR _will_be_maintained_by_the_callee_ for each PES stream. - virtual status_t encrypt( - const void *inData, size_t size, uint32_t streamCTR, - uint64_t *outInputCTR, void *outData) { - return INVALID_OPERATION; - } - - // Encrypt data according to the HDCP spec. "size" bytes of data starting - // at location "offset" are available in "buffer" (buffer handle). "size" - // may not be a multiple of 128 bits (16 bytes). An equal number of - // encrypted bytes should be written to the buffer at "outData" (virtual - // address). This operation is to be synchronous, i.e. this call does not - // return until outData contains size bytes of encrypted data. - // streamCTR will be assigned by the caller (to 0 for the first PES stream, - // 1 for the second and so on) - // inputCTR _will_be_maintained_by_the_callee_ for each PES stream. - virtual status_t encryptNative( - buffer_handle_t buffer, size_t offset, size_t size, - uint32_t streamCTR, uint64_t *outInputCTR, void *outData) { - return INVALID_OPERATION; - } - // DECRYPTION only: - // Decrypt data according to the HDCP spec. - // "size" bytes of encrypted data are available at "inData" - // (virtual address), "size" may not be a multiple of 128 bits (16 bytes). - // An equal number of decrypted bytes should be written to the buffer - // at "outData" (virtual address). - // This operation is to be synchronous, i.e. this call does not return - // until outData contains size bytes of decrypted data. - // Both streamCTR and inputCTR will be provided by the caller. - virtual status_t decrypt( - const void *inData, size_t size, - uint32_t streamCTR, uint64_t inputCTR, - void *outData) { - return INVALID_OPERATION; - } - -private: - HDCPModule(const HDCPModule &); - HDCPModule &operator=(const HDCPModule &); -}; - -} // namespace android - -// A shared library exporting the following methods should be included to -// support HDCP functionality. The shared library must be called -// "libstagefright_hdcp.so", it will be dynamically loaded into the -// mediaserver process. -extern "C" { - // Create a module for ENCRYPTION. - extern android::HDCPModule *createHDCPModule( - void *cookie, android::HDCPModule::ObserverFunc); - - // Create a module for DECRYPTION. - extern android::HDCPModule *createHDCPModuleForDecryption( - void *cookie, android::HDCPModule::ObserverFunc); -} - -#endif // HDCP_API_H_ - diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/hardware/MetadataBufferType.h android-platform-frameworks-native-21/include/media/hardware/MetadataBufferType.h --- android-platform-frameworks-native-6.0.1+r16/include/media/hardware/MetadataBufferType.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/hardware/MetadataBufferType.h 2012-10-16 22:57:11.000000000 +0000 @@ -77,44 +77,11 @@ * GRalloc buffer. The encoder needs to interpret this GRalloc handle * and encode the frames. * -------------------------------------------------------------- - * | kMetadataBufferTypeGrallocSource | buffer_handle_t buffer | + * | kMetadataBufferTypeGrallocSource | sizeof(buffer_handle_t) | * -------------------------------------------------------------- - * - * See the VideoGrallocMetadata structure. */ kMetadataBufferTypeGrallocSource = 1, - /* - * kMetadataBufferTypeGraphicBuffer is used to indicate that - * the payload of the metadata buffers can be interpreted as - * an ANativeWindowBuffer, and that a fence is provided. - * - * In this case, the metadata will have a byte stream that consists of three parts: - * 1. First, there is an integer indicating that the metadata - * contains an ANativeWindowBuffer (kMetadataBufferTypeANWBuffer) - * 2. This is followed by the pointer to the ANativeWindowBuffer. - * Codec must not free this buffer as it does not actually own this buffer. - * 3. Finally, there is an integer containing a fence file descriptor. - * The codec must wait on the fence before encoding or decoding into this - * buffer. When the buffer is returned, codec must replace this file descriptor - * with a new fence, that will be waited on before the buffer is replaced - * (encoder) or read (decoder). - * --------------------------------- - * | kMetadataBufferTypeANWBuffer | - * --------------------------------- - * | ANativeWindowBuffer *buffer | - * --------------------------------- - * | int fenceFd | - * --------------------------------- - * - * See the VideoNativeMetadata structure. - */ - kMetadataBufferTypeANWBuffer = 2, - - /* This value is used by framework, but is never used inside a metadata buffer */ - kMetadataBufferTypeInvalid = -1, - - // Add more here... } MetadataBufferType; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_AsString.h android-platform-frameworks-native-21/include/media/openmax/OMX_AsString.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_AsString.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_AsString.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,947 +0,0 @@ -/* - * Copyright 2014 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. - */ - -/* NOTE: This file contains several sections for individual OMX include files. - Each section has its own include guard. This file should be included AFTER - the OMX include files. */ - -#ifdef OMX_Audio_h -/* asString definitions if media/openmax/OMX_Audio.h was included */ - -#ifndef AS_STRING_FOR_OMX_AUDIO_H -#define AS_STRING_FOR_OMX_AUDIO_H - -inline static const char *asString(OMX_AUDIO_CODINGTYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_CodingUnused: return "Unused"; // unused - case OMX_AUDIO_CodingAutoDetect: return "AutoDetect"; // unused - case OMX_AUDIO_CodingPCM: return "PCM"; - case OMX_AUDIO_CodingADPCM: return "ADPCM"; // unused - case OMX_AUDIO_CodingAMR: return "AMR"; - case OMX_AUDIO_CodingGSMFR: return "GSMFR"; - case OMX_AUDIO_CodingGSMEFR: return "GSMEFR"; // unused - case OMX_AUDIO_CodingGSMHR: return "GSMHR"; // unused - case OMX_AUDIO_CodingPDCFR: return "PDCFR"; // unused - case OMX_AUDIO_CodingPDCEFR: return "PDCEFR"; // unused - case OMX_AUDIO_CodingPDCHR: return "PDCHR"; // unused - case OMX_AUDIO_CodingTDMAFR: return "TDMAFR"; // unused - case OMX_AUDIO_CodingTDMAEFR: return "TDMAEFR"; // unused - case OMX_AUDIO_CodingQCELP8: return "QCELP8"; // unused - case OMX_AUDIO_CodingQCELP13: return "QCELP13"; // unused - case OMX_AUDIO_CodingEVRC: return "EVRC"; // unused - case OMX_AUDIO_CodingSMV: return "SMV"; // unused - case OMX_AUDIO_CodingG711: return "G711"; - case OMX_AUDIO_CodingG723: return "G723"; // unused - case OMX_AUDIO_CodingG726: return "G726"; // unused - case OMX_AUDIO_CodingG729: return "G729"; // unused - case OMX_AUDIO_CodingAAC: return "AAC"; - case OMX_AUDIO_CodingMP3: return "MP3"; - case OMX_AUDIO_CodingSBC: return "SBC"; // unused - case OMX_AUDIO_CodingVORBIS: return "VORBIS"; - case OMX_AUDIO_CodingWMA: return "WMA"; // unused - case OMX_AUDIO_CodingRA: return "RA"; // unused - case OMX_AUDIO_CodingMIDI: return "MIDI"; // unused - case OMX_AUDIO_CodingFLAC: return "FLAC"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_PCMMODETYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_PCMModeLinear: return "Linear"; - case OMX_AUDIO_PCMModeALaw: return "ALaw"; - case OMX_AUDIO_PCMModeMULaw: return "MULaw"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_CHANNELTYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_ChannelNone: return "None"; // unused - case OMX_AUDIO_ChannelLF: return "LF"; - case OMX_AUDIO_ChannelRF: return "RF"; - case OMX_AUDIO_ChannelCF: return "CF"; - case OMX_AUDIO_ChannelLS: return "LS"; - case OMX_AUDIO_ChannelRS: return "RS"; - case OMX_AUDIO_ChannelLFE: return "LFE"; - case OMX_AUDIO_ChannelCS: return "CS"; - case OMX_AUDIO_ChannelLR: return "LR"; - case OMX_AUDIO_ChannelRR: return "RR"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_CHANNELMODETYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_ChannelModeStereo: return "Stereo"; -// case OMX_AUDIO_ChannelModeJointStereo: return "JointStereo"; -// case OMX_AUDIO_ChannelModeDual: return "Dual"; - case OMX_AUDIO_ChannelModeMono: return "Mono"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_AACSTREAMFORMATTYPE i, const char *def = "??") { - switch (i) { -// case OMX_AUDIO_AACStreamFormatMP2ADTS: return "MP2ADTS"; - case OMX_AUDIO_AACStreamFormatMP4ADTS: return "MP4ADTS"; -// case OMX_AUDIO_AACStreamFormatMP4LOAS: return "MP4LOAS"; -// case OMX_AUDIO_AACStreamFormatMP4LATM: return "MP4LATM"; -// case OMX_AUDIO_AACStreamFormatADIF: return "ADIF"; - case OMX_AUDIO_AACStreamFormatMP4FF: return "MP4FF"; -// case OMX_AUDIO_AACStreamFormatRAW: return "RAW"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_AMRFRAMEFORMATTYPE i, const char *def = "??") { - switch (i) { -// case OMX_AUDIO_AMRFrameFormatConformance: return "Conformance"; -// case OMX_AUDIO_AMRFrameFormatIF1: return "IF1"; -// case OMX_AUDIO_AMRFrameFormatIF2: return "IF2"; - case OMX_AUDIO_AMRFrameFormatFSF: return "FSF"; -// case OMX_AUDIO_AMRFrameFormatRTPPayload: return "RTPPayload"; -// case OMX_AUDIO_AMRFrameFormatITU: return "ITU"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_AMRBANDMODETYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_AMRBandModeUnused: return "Unused"; - case OMX_AUDIO_AMRBandModeNB0: return "NB0"; - case OMX_AUDIO_AMRBandModeNB1: return "NB1"; - case OMX_AUDIO_AMRBandModeNB2: return "NB2"; - case OMX_AUDIO_AMRBandModeNB3: return "NB3"; - case OMX_AUDIO_AMRBandModeNB4: return "NB4"; - case OMX_AUDIO_AMRBandModeNB5: return "NB5"; - case OMX_AUDIO_AMRBandModeNB6: return "NB6"; - case OMX_AUDIO_AMRBandModeNB7: return "NB7"; - case OMX_AUDIO_AMRBandModeWB0: return "WB0"; - case OMX_AUDIO_AMRBandModeWB1: return "WB1"; - case OMX_AUDIO_AMRBandModeWB2: return "WB2"; - case OMX_AUDIO_AMRBandModeWB3: return "WB3"; - case OMX_AUDIO_AMRBandModeWB4: return "WB4"; - case OMX_AUDIO_AMRBandModeWB5: return "WB5"; - case OMX_AUDIO_AMRBandModeWB6: return "WB6"; - case OMX_AUDIO_AMRBandModeWB7: return "WB7"; - case OMX_AUDIO_AMRBandModeWB8: return "WB8"; - default: return def; - } -} - -inline static const char *asString(OMX_AUDIO_AMRDTXMODETYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_AMRDTXModeOff: return "ModeOff"; -// case OMX_AUDIO_AMRDTXModeOnVAD1: return "ModeOnVAD1"; -// case OMX_AUDIO_AMRDTXModeOnVAD2: return "ModeOnVAD2"; -// case OMX_AUDIO_AMRDTXModeOnAuto: return "ModeOnAuto"; -// case OMX_AUDIO_AMRDTXasEFR: return "asEFR"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_AUDIO_H - -#endif // OMX_Audio_h - -#ifdef OMX_AudioExt_h -/* asString definitions if media/openmax/OMX_AudioExt.h was included */ - -#ifndef AS_STRING_FOR_OMX_AUDIOEXT_H -#define AS_STRING_FOR_OMX_AUDIOEXT_H - -inline static const char *asString(OMX_AUDIO_CODINGEXTTYPE i, const char *def = "??") { - switch (i) { - case OMX_AUDIO_CodingAndroidAC3: return "AndroidAC3"; - case OMX_AUDIO_CodingAndroidOPUS: return "AndroidOPUS"; - default: return asString((OMX_AUDIO_CODINGTYPE)i, def); - } -} - -#endif // AS_STRING_FOR_OMX_AUDIOEXT_H - -#endif // OMX_AudioExt_h - -#ifdef OMX_Component_h -/* asString definitions if media/openmax/OMX_Component.h was included */ - -#ifndef AS_STRING_FOR_OMX_COMPONENT_H -#define AS_STRING_FOR_OMX_COMPONENT_H - -inline static const char *asString(OMX_PORTDOMAINTYPE i, const char *def = "??") { - switch (i) { - case OMX_PortDomainAudio: return "Audio"; - case OMX_PortDomainVideo: return "Video"; - case OMX_PortDomainImage: return "Image"; -// case OMX_PortDomainOther: return "Other"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_COMPONENT_H - -#endif // OMX_Component_h - -#ifdef OMX_Core_h -/* asString definitions if media/openmax/OMX_Core.h was included */ - -#ifndef AS_STRING_FOR_OMX_CORE_H -#define AS_STRING_FOR_OMX_CORE_H - -inline static const char *asString(OMX_COMMANDTYPE i, const char *def = "??") { - switch (i) { - case OMX_CommandStateSet: return "StateSet"; - case OMX_CommandFlush: return "Flush"; - case OMX_CommandPortDisable: return "PortDisable"; - case OMX_CommandPortEnable: return "PortEnable"; -// case OMX_CommandMarkBuffer: return "MarkBuffer"; - default: return def; - } -} - -inline static const char *asString(OMX_STATETYPE i, const char *def = "??") { - switch (i) { - case OMX_StateInvalid: return "Invalid"; - case OMX_StateLoaded: return "Loaded"; - case OMX_StateIdle: return "Idle"; - case OMX_StateExecuting: return "Executing"; -// case OMX_StatePause: return "Pause"; -// case OMX_StateWaitForResources: return "WaitForResources"; - default: return def; - } -} - -inline static const char *asString(OMX_ERRORTYPE i, const char *def = "??") { - switch (i) { - case OMX_ErrorNone: return "None"; - case OMX_ErrorInsufficientResources: return "InsufficientResources"; - case OMX_ErrorUndefined: return "Undefined"; - case OMX_ErrorInvalidComponentName: return "InvalidComponentName"; - case OMX_ErrorComponentNotFound: return "ComponentNotFound"; - case OMX_ErrorInvalidComponent: return "InvalidComponent"; // unused - case OMX_ErrorBadParameter: return "BadParameter"; - case OMX_ErrorNotImplemented: return "NotImplemented"; - case OMX_ErrorUnderflow: return "Underflow"; // unused - case OMX_ErrorOverflow: return "Overflow"; // unused - case OMX_ErrorHardware: return "Hardware"; // unused - case OMX_ErrorInvalidState: return "InvalidState"; - case OMX_ErrorStreamCorrupt: return "StreamCorrupt"; - case OMX_ErrorPortsNotCompatible: return "PortsNotCompatible"; // unused - case OMX_ErrorResourcesLost: return "ResourcesLost"; - case OMX_ErrorNoMore: return "NoMore"; - case OMX_ErrorVersionMismatch: return "VersionMismatch"; // unused - case OMX_ErrorNotReady: return "NotReady"; // unused - case OMX_ErrorTimeout: return "Timeout"; // unused - case OMX_ErrorSameState: return "SameState"; // unused - case OMX_ErrorResourcesPreempted: return "ResourcesPreempted"; // unused - case OMX_ErrorPortUnresponsiveDuringAllocation: - return "PortUnresponsiveDuringAllocation"; // unused - case OMX_ErrorPortUnresponsiveDuringDeallocation: - return "PortUnresponsiveDuringDeallocation"; // unused - case OMX_ErrorPortUnresponsiveDuringStop: - return "PortUnresponsiveDuringStop"; // unused - case OMX_ErrorIncorrectStateTransition: - return "IncorrectStateTransition"; // unused - case OMX_ErrorIncorrectStateOperation: - return "IncorrectStateOperation"; // unused - case OMX_ErrorUnsupportedSetting: return "UnsupportedSetting"; - case OMX_ErrorUnsupportedIndex: return "UnsupportedIndex"; - case OMX_ErrorBadPortIndex: return "BadPortIndex"; - case OMX_ErrorPortUnpopulated: return "PortUnpopulated"; // unused - case OMX_ErrorComponentSuspended: return "ComponentSuspended"; // unused - case OMX_ErrorDynamicResourcesUnavailable: - return "DynamicResourcesUnavailable"; // unused - case OMX_ErrorMbErrorsInFrame: return "MbErrorsInFrame"; // unused - case OMX_ErrorFormatNotDetected: return "FormatNotDetected"; // unused - case OMX_ErrorContentPipeOpenFailed: return "ContentPipeOpenFailed"; // unused - case OMX_ErrorContentPipeCreationFailed: - return "ContentPipeCreationFailed"; // unused - case OMX_ErrorSeperateTablesUsed: return "SeperateTablesUsed"; // unused - case OMX_ErrorTunnelingUnsupported: return "TunnelingUnsupported"; // unused - default: return def; - } -} - -inline static const char *asString(OMX_EVENTTYPE i, const char *def = "??") { - switch (i) { - case OMX_EventCmdComplete: return "CmdComplete"; - case OMX_EventError: return "Error"; -// case OMX_EventMark: return "Mark"; - case OMX_EventPortSettingsChanged: return "PortSettingsChanged"; - case OMX_EventBufferFlag: return "BufferFlag"; -// case OMX_EventResourcesAcquired: return "ResourcesAcquired"; -// case OMX_EventComponentResumed: return "ComponentResumed"; -// case OMX_EventDynamicResourcesAvailable: return "DynamicResourcesAvailable"; -// case OMX_EventPortFormatDetected: return "PortFormatDetected"; - case OMX_EventOutputRendered: return "OutputRendered"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_CORE_H - -#endif // OMX_Core_h - -#ifdef OMX_Image_h -/* asString definitions if media/openmax/OMX_Image.h was included */ - -#ifndef AS_STRING_FOR_OMX_IMAGE_H -#define AS_STRING_FOR_OMX_IMAGE_H - -inline static const char *asString(OMX_IMAGE_CODINGTYPE i, const char *def = "??") { - switch (i) { - case OMX_IMAGE_CodingUnused: return "Unused"; - case OMX_IMAGE_CodingAutoDetect: return "AutoDetect"; // unused - case OMX_IMAGE_CodingJPEG: return "JPEG"; - case OMX_IMAGE_CodingJPEG2K: return "JPEG2K"; // unused - case OMX_IMAGE_CodingEXIF: return "EXIF"; // unused - case OMX_IMAGE_CodingTIFF: return "TIFF"; // unused - case OMX_IMAGE_CodingGIF: return "GIF"; // unused - case OMX_IMAGE_CodingPNG: return "PNG"; // unused - case OMX_IMAGE_CodingLZW: return "LZW"; // unused - case OMX_IMAGE_CodingBMP: return "BMP"; // unused - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_IMAGE_H - -#endif // OMX_Image_h - -#ifdef OMX_Index_h -/* asString definitions if media/openmax/OMX_Index.h was included */ - -#ifndef AS_STRING_FOR_OMX_INDEX_H -#define AS_STRING_FOR_OMX_INDEX_H - -inline static const char *asString(OMX_INDEXTYPE i, const char *def = "??") { - switch (i) { -// case OMX_IndexParamPriorityMgmt: return "ParamPriorityMgmt"; -// case OMX_IndexParamAudioInit: return "ParamAudioInit"; -// case OMX_IndexParamImageInit: return "ParamImageInit"; -// case OMX_IndexParamVideoInit: return "ParamVideoInit"; -// case OMX_IndexParamOtherInit: return "ParamOtherInit"; -// case OMX_IndexParamNumAvailableStreams: return "ParamNumAvailableStreams"; -// case OMX_IndexParamActiveStream: return "ParamActiveStream"; -// case OMX_IndexParamSuspensionPolicy: return "ParamSuspensionPolicy"; -// case OMX_IndexParamComponentSuspended: return "ParamComponentSuspended"; -// case OMX_IndexConfigCapturing: return "ConfigCapturing"; -// case OMX_IndexConfigCaptureMode: return "ConfigCaptureMode"; -// case OMX_IndexAutoPauseAfterCapture: return "AutoPauseAfterCapture"; -// case OMX_IndexParamContentURI: return "ParamContentURI"; -// case OMX_IndexParamCustomContentPipe: return "ParamCustomContentPipe"; -// case OMX_IndexParamDisableResourceConcealment: -// return "ParamDisableResourceConcealment"; -// case OMX_IndexConfigMetadataItemCount: return "ConfigMetadataItemCount"; -// case OMX_IndexConfigContainerNodeCount: return "ConfigContainerNodeCount"; -// case OMX_IndexConfigMetadataItem: return "ConfigMetadataItem"; -// case OMX_IndexConfigCounterNodeID: return "ConfigCounterNodeID"; -// case OMX_IndexParamMetadataFilterType: return "ParamMetadataFilterType"; -// case OMX_IndexParamMetadataKeyFilter: return "ParamMetadataKeyFilter"; -// case OMX_IndexConfigPriorityMgmt: return "ConfigPriorityMgmt"; - case OMX_IndexParamStandardComponentRole: return "ParamStandardComponentRole"; - case OMX_IndexParamPortDefinition: return "ParamPortDefinition"; -// case OMX_IndexParamCompBufferSupplier: return "ParamCompBufferSupplier"; - case OMX_IndexParamAudioPortFormat: return "ParamAudioPortFormat"; - case OMX_IndexParamAudioPcm: return "ParamAudioPcm"; - case OMX_IndexParamAudioAac: return "ParamAudioAac"; -// case OMX_IndexParamAudioRa: return "ParamAudioRa"; - case OMX_IndexParamAudioMp3: return "ParamAudioMp3"; -// case OMX_IndexParamAudioAdpcm: return "ParamAudioAdpcm"; -// case OMX_IndexParamAudioG723: return "ParamAudioG723"; -// case OMX_IndexParamAudioG729: return "ParamAudioG729"; - case OMX_IndexParamAudioAmr: return "ParamAudioAmr"; -// case OMX_IndexParamAudioWma: return "ParamAudioWma"; -// case OMX_IndexParamAudioSbc: return "ParamAudioSbc"; -// case OMX_IndexParamAudioMidi: return "ParamAudioMidi"; -// case OMX_IndexParamAudioGsm_FR: return "ParamAudioGsm_FR"; -// case OMX_IndexParamAudioMidiLoadUserSound: return "ParamAudioMidiLoadUserSound"; -// case OMX_IndexParamAudioG726: return "ParamAudioG726"; -// case OMX_IndexParamAudioGsm_EFR: return "ParamAudioGsm_EFR"; -// case OMX_IndexParamAudioGsm_HR: return "ParamAudioGsm_HR"; -// case OMX_IndexParamAudioPdc_FR: return "ParamAudioPdc_FR"; -// case OMX_IndexParamAudioPdc_EFR: return "ParamAudioPdc_EFR"; -// case OMX_IndexParamAudioPdc_HR: return "ParamAudioPdc_HR"; -// case OMX_IndexParamAudioTdma_FR: return "ParamAudioTdma_FR"; -// case OMX_IndexParamAudioTdma_EFR: return "ParamAudioTdma_EFR"; -// case OMX_IndexParamAudioQcelp8: return "ParamAudioQcelp8"; -// case OMX_IndexParamAudioQcelp13: return "ParamAudioQcelp13"; -// case OMX_IndexParamAudioEvrc: return "ParamAudioEvrc"; -// case OMX_IndexParamAudioSmv: return "ParamAudioSmv"; - case OMX_IndexParamAudioVorbis: return "ParamAudioVorbis"; - case OMX_IndexParamAudioFlac: return "ParamAudioFlac"; -// case OMX_IndexConfigAudioMidiImmediateEvent: return "ConfigAudioMidiImmediateEvent"; -// case OMX_IndexConfigAudioMidiControl: return "ConfigAudioMidiControl"; -// case OMX_IndexConfigAudioMidiSoundBankProgram: -// return "ConfigAudioMidiSoundBankProgram"; -// case OMX_IndexConfigAudioMidiStatus: return "ConfigAudioMidiStatus"; -// case OMX_IndexConfigAudioMidiMetaEvent: return "ConfigAudioMidiMetaEvent"; -// case OMX_IndexConfigAudioMidiMetaEventData: return "ConfigAudioMidiMetaEventData"; -// case OMX_IndexConfigAudioVolume: return "ConfigAudioVolume"; -// case OMX_IndexConfigAudioBalance: return "ConfigAudioBalance"; -// case OMX_IndexConfigAudioChannelMute: return "ConfigAudioChannelMute"; -// case OMX_IndexConfigAudioMute: return "ConfigAudioMute"; -// case OMX_IndexConfigAudioLoudness: return "ConfigAudioLoudness"; -// case OMX_IndexConfigAudioEchoCancelation: return "ConfigAudioEchoCancelation"; -// case OMX_IndexConfigAudioNoiseReduction: return "ConfigAudioNoiseReduction"; -// case OMX_IndexConfigAudioBass: return "ConfigAudioBass"; -// case OMX_IndexConfigAudioTreble: return "ConfigAudioTreble"; -// case OMX_IndexConfigAudioStereoWidening: return "ConfigAudioStereoWidening"; -// case OMX_IndexConfigAudioChorus: return "ConfigAudioChorus"; -// case OMX_IndexConfigAudioEqualizer: return "ConfigAudioEqualizer"; -// case OMX_IndexConfigAudioReverberation: return "ConfigAudioReverberation"; -// case OMX_IndexConfigAudioChannelVolume: return "ConfigAudioChannelVolume"; -// case OMX_IndexParamImagePortFormat: return "ParamImagePortFormat"; -// case OMX_IndexParamFlashControl: return "ParamFlashControl"; -// case OMX_IndexConfigFocusControl: return "ConfigFocusControl"; -// case OMX_IndexParamQFactor: return "ParamQFactor"; -// case OMX_IndexParamQuantizationTable: return "ParamQuantizationTable"; -// case OMX_IndexParamHuffmanTable: return "ParamHuffmanTable"; -// case OMX_IndexConfigFlashControl: return "ConfigFlashControl"; - case OMX_IndexParamVideoPortFormat: return "ParamVideoPortFormat"; -// case OMX_IndexParamVideoQuantization: return "ParamVideoQuantization"; -// case OMX_IndexParamVideoFastUpdate: return "ParamVideoFastUpdate"; - case OMX_IndexParamVideoBitrate: return "ParamVideoBitrate"; -// case OMX_IndexParamVideoMotionVector: return "ParamVideoMotionVector"; - case OMX_IndexParamVideoIntraRefresh: return "ParamVideoIntraRefresh"; - case OMX_IndexParamVideoErrorCorrection: return "ParamVideoErrorCorrection"; -// case OMX_IndexParamVideoVBSMC: return "ParamVideoVBSMC"; -// case OMX_IndexParamVideoMpeg2: return "ParamVideoMpeg2"; - case OMX_IndexParamVideoMpeg4: return "ParamVideoMpeg4"; -// case OMX_IndexParamVideoWmv: return "ParamVideoWmv"; -// case OMX_IndexParamVideoRv: return "ParamVideoRv"; - case OMX_IndexParamVideoAvc: return "ParamVideoAvc"; - case OMX_IndexParamVideoH263: return "ParamVideoH263"; - case OMX_IndexParamVideoProfileLevelQuerySupported: - return "ParamVideoProfileLevelQuerySupported"; - case OMX_IndexParamVideoProfileLevelCurrent: return "ParamVideoProfileLevelCurrent"; - case OMX_IndexConfigVideoBitrate: return "ConfigVideoBitrate"; -// case OMX_IndexConfigVideoFramerate: return "ConfigVideoFramerate"; - case OMX_IndexConfigVideoIntraVOPRefresh: return "ConfigVideoIntraVOPRefresh"; -// case OMX_IndexConfigVideoIntraMBRefresh: return "ConfigVideoIntraMBRefresh"; -// case OMX_IndexConfigVideoMBErrorReporting: return "ConfigVideoMBErrorReporting"; -// case OMX_IndexParamVideoMacroblocksPerFrame: return "ParamVideoMacroblocksPerFrame"; -// case OMX_IndexConfigVideoMacroBlockErrorMap: return "ConfigVideoMacroBlockErrorMap"; -// case OMX_IndexParamVideoSliceFMO: return "ParamVideoSliceFMO"; -// case OMX_IndexConfigVideoAVCIntraPeriod: return "ConfigVideoAVCIntraPeriod"; -// case OMX_IndexConfigVideoNalSize: return "ConfigVideoNalSize"; -// case OMX_IndexParamCommonDeblocking: return "ParamCommonDeblocking"; -// case OMX_IndexParamCommonSensorMode: return "ParamCommonSensorMode"; -// case OMX_IndexParamCommonInterleave: return "ParamCommonInterleave"; -// case OMX_IndexConfigCommonColorFormatConversion: -// return "ConfigCommonColorFormatConversion"; - case OMX_IndexConfigCommonScale: return "ConfigCommonScale"; -// case OMX_IndexConfigCommonImageFilter: return "ConfigCommonImageFilter"; -// case OMX_IndexConfigCommonColorEnhancement: return "ConfigCommonColorEnhancement"; -// case OMX_IndexConfigCommonColorKey: return "ConfigCommonColorKey"; -// case OMX_IndexConfigCommonColorBlend: return "ConfigCommonColorBlend"; -// case OMX_IndexConfigCommonFrameStabilisation: return "ConfigCommonFrameStabilisation"; -// case OMX_IndexConfigCommonRotate: return "ConfigCommonRotate"; -// case OMX_IndexConfigCommonMirror: return "ConfigCommonMirror"; -// case OMX_IndexConfigCommonOutputPosition: return "ConfigCommonOutputPosition"; - case OMX_IndexConfigCommonInputCrop: return "ConfigCommonInputCrop"; - case OMX_IndexConfigCommonOutputCrop: return "ConfigCommonOutputCrop"; -// case OMX_IndexConfigCommonDigitalZoom: return "ConfigCommonDigitalZoom"; -// case OMX_IndexConfigCommonOpticalZoom: return "ConfigCommonOpticalZoom"; -// case OMX_IndexConfigCommonWhiteBalance: return "ConfigCommonWhiteBalance"; -// case OMX_IndexConfigCommonExposure: return "ConfigCommonExposure"; -// case OMX_IndexConfigCommonContrast: return "ConfigCommonContrast"; -// case OMX_IndexConfigCommonBrightness: return "ConfigCommonBrightness"; -// case OMX_IndexConfigCommonBacklight: return "ConfigCommonBacklight"; -// case OMX_IndexConfigCommonGamma: return "ConfigCommonGamma"; -// case OMX_IndexConfigCommonSaturation: return "ConfigCommonSaturation"; -// case OMX_IndexConfigCommonLightness: return "ConfigCommonLightness"; -// case OMX_IndexConfigCommonExclusionRect: return "ConfigCommonExclusionRect"; -// case OMX_IndexConfigCommonDithering: return "ConfigCommonDithering"; -// case OMX_IndexConfigCommonPlaneBlend: return "ConfigCommonPlaneBlend"; -// case OMX_IndexConfigCommonExposureValue: return "ConfigCommonExposureValue"; -// case OMX_IndexConfigCommonOutputSize: return "ConfigCommonOutputSize"; -// case OMX_IndexParamCommonExtraQuantData: return "ParamCommonExtraQuantData"; -// case OMX_IndexConfigCommonFocusRegion: return "ConfigCommonFocusRegion"; -// case OMX_IndexConfigCommonFocusStatus: return "ConfigCommonFocusStatus"; -// case OMX_IndexConfigCommonTransitionEffect: return "ConfigCommonTransitionEffect"; -// case OMX_IndexParamOtherPortFormat: return "ParamOtherPortFormat"; -// case OMX_IndexConfigOtherPower: return "ConfigOtherPower"; -// case OMX_IndexConfigOtherStats: return "ConfigOtherStats"; -// case OMX_IndexConfigTimeScale: return "ConfigTimeScale"; -// case OMX_IndexConfigTimeClockState: return "ConfigTimeClockState"; -// case OMX_IndexConfigTimeActiveRefClock: return "ConfigTimeActiveRefClock"; -// case OMX_IndexConfigTimeCurrentMediaTime: return "ConfigTimeCurrentMediaTime"; -// case OMX_IndexConfigTimeCurrentWallTime: return "ConfigTimeCurrentWallTime"; -// case OMX_IndexConfigTimeCurrentAudioReference: -// return "ConfigTimeCurrentAudioReference"; -// case OMX_IndexConfigTimeCurrentVideoReference: -// return "ConfigTimeCurrentVideoReference"; -// case OMX_IndexConfigTimeMediaTimeRequest: return "ConfigTimeMediaTimeRequest"; -// case OMX_IndexConfigTimeClientStartTime: return "ConfigTimeClientStartTime"; -// case OMX_IndexConfigTimePosition: return "ConfigTimePosition"; -// case OMX_IndexConfigTimeSeekMode: return "ConfigTimeSeekMode"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_INDEX_H - -#endif // OMX_Index_h - -#ifdef OMX_IndexExt_h -/* asString definitions if media/openmax/OMX_IndexExt.h was included */ - -#ifndef AS_STRING_FOR_OMX_INDEXEXT_H -#define AS_STRING_FOR_OMX_INDEXEXT_H - -inline static const char *asString(OMX_INDEXEXTTYPE i, const char *def = "??") { - switch (i) { -// case OMX_IndexConfigCallbackRequest: return "ConfigCallbackRequest"; -// case OMX_IndexConfigCommitMode: return "ConfigCommitMode"; -// case OMX_IndexConfigCommit: return "ConfigCommit"; - case OMX_IndexParamAudioAndroidAc3: return "ParamAudioAndroidAc3"; - case OMX_IndexParamAudioAndroidOpus: return "ParamAudioAndroidOpus"; - case OMX_IndexParamAudioAndroidAacPresentation: return "ParamAudioAndroidAacPresentation"; -// case OMX_IndexParamNalStreamFormatSupported: return "ParamNalStreamFormatSupported"; -// case OMX_IndexParamNalStreamFormat: return "ParamNalStreamFormat"; -// case OMX_IndexParamNalStreamFormatSelect: return "ParamNalStreamFormatSelect"; - case OMX_IndexParamVideoVp8: return "ParamVideoVp8"; -// case OMX_IndexConfigVideoVp8ReferenceFrame: return "ConfigVideoVp8ReferenceFrame"; -// case OMX_IndexConfigVideoVp8ReferenceFrameType: return "ConfigVideoVp8ReferenceFrameType"; - case OMX_IndexParamVideoAndroidVp8Encoder: return "ParamVideoAndroidVp8Encoder"; - case OMX_IndexParamVideoHevc: return "ParamVideoHevc"; -// case OMX_IndexParamSliceSegments: return "ParamSliceSegments"; - case OMX_IndexConfigAutoFramerateConversion: return "ConfigAutoFramerateConversion"; - case OMX_IndexConfigPriority: return "ConfigPriority"; - case OMX_IndexConfigOperatingRate: return "ConfigOperatingRate"; - case OMX_IndexParamConsumerUsageBits: return "ParamConsumerUsageBits"; - default: return asString((OMX_INDEXTYPE)i, def); - } -} - -#endif // AS_STRING_FOR_OMX_INDEXEXT_H - -#endif // OMX_IndexExt_h - -#ifdef OMX_IVCommon_h -/* asString definitions if media/openmax/OMX_IVCommon.h was included */ - -#ifndef AS_STRING_FOR_OMX_IVCOMMON_H -#define AS_STRING_FOR_OMX_IVCOMMON_H - -inline static const char *asString(OMX_COLOR_FORMATTYPE i, const char *def = "??") { - switch (i) { - case OMX_COLOR_FormatUnused: - return "COLOR_FormatUnused"; - case OMX_COLOR_FormatMonochrome: - return "COLOR_FormatMonochrome"; - case OMX_COLOR_Format8bitRGB332: - return "COLOR_Format8bitRGB332"; - case OMX_COLOR_Format12bitRGB444: - return "COLOR_Format12bitRGB444"; - case OMX_COLOR_Format16bitARGB4444: - return "COLOR_Format16bitARGB4444"; - case OMX_COLOR_Format16bitARGB1555: - return "COLOR_Format16bitARGB1555"; - case OMX_COLOR_Format16bitRGB565: - return "COLOR_Format16bitRGB565"; - case OMX_COLOR_Format16bitBGR565: - return "COLOR_Format16bitBGR565"; - case OMX_COLOR_Format18bitRGB666: - return "COLOR_Format18bitRGB666"; - case OMX_COLOR_Format18bitARGB1665: - return "COLOR_Format18bitARGB1665"; - case OMX_COLOR_Format19bitARGB1666: - return "COLOR_Format19bitARGB1666"; - case OMX_COLOR_Format24bitRGB888: - return "COLOR_Format24bitRGB888"; - case OMX_COLOR_Format24bitBGR888: - return "COLOR_Format24bitBGR888"; - case OMX_COLOR_Format24bitARGB1887: - return "COLOR_Format24bitARGB1887"; - case OMX_COLOR_Format25bitARGB1888: - return "COLOR_Format25bitARGB1888"; - case OMX_COLOR_Format32bitBGRA8888: - return "COLOR_Format32bitBGRA8888"; - case OMX_COLOR_Format32bitARGB8888: - return "COLOR_Format32bitARGB8888"; - case OMX_COLOR_FormatYUV411Planar: - return "COLOR_FormatYUV411Planar"; - case OMX_COLOR_FormatYUV411PackedPlanar: - return "COLOR_FormatYUV411PackedPlanar"; - case OMX_COLOR_FormatYUV420Planar: - return "COLOR_FormatYUV420Planar"; - case OMX_COLOR_FormatYUV420PackedPlanar: - return "COLOR_FormatYUV420PackedPlanar"; - case OMX_COLOR_FormatYUV420SemiPlanar: - return "COLOR_FormatYUV420SemiPlanar"; - case OMX_COLOR_FormatYUV422Planar: - return "COLOR_FormatYUV422Planar"; - case OMX_COLOR_FormatYUV422PackedPlanar: - return "COLOR_FormatYUV422PackedPlanar"; - case OMX_COLOR_FormatYUV422SemiPlanar: - return "COLOR_FormatYUV422SemiPlanar"; - case OMX_COLOR_FormatYCbYCr: - return "COLOR_FormatYCbYCr"; - case OMX_COLOR_FormatYCrYCb: - return "COLOR_FormatYCrYCb"; - case OMX_COLOR_FormatCbYCrY: - return "COLOR_FormatCbYCrY"; - case OMX_COLOR_FormatCrYCbY: - return "COLOR_FormatCrYCbY"; - case OMX_COLOR_FormatYUV444Interleaved: - return "COLOR_FormatYUV444Interleaved"; - case OMX_COLOR_FormatRawBayer8bit: - return "COLOR_FormatRawBayer8bit"; - case OMX_COLOR_FormatRawBayer10bit: - return "COLOR_FormatRawBayer10bit"; - case OMX_COLOR_FormatRawBayer8bitcompressed: - return "COLOR_FormatRawBayer8bitcompressed"; - case OMX_COLOR_FormatL2: - return "COLOR_FormatL2"; - case OMX_COLOR_FormatL4: - return "COLOR_FormatL4"; - case OMX_COLOR_FormatL8: - return "COLOR_FormatL8"; - case OMX_COLOR_FormatL16: - return "COLOR_FormatL16"; - case OMX_COLOR_FormatL24: - return "COLOR_FormatL24"; - case OMX_COLOR_FormatL32: - return "COLOR_FormatL32"; - case OMX_COLOR_FormatYUV420PackedSemiPlanar: - return "COLOR_FormatYUV420PackedSemiPlanar"; - case OMX_COLOR_FormatYUV422PackedSemiPlanar: - return "COLOR_FormatYUV422PackedSemiPlanar"; - case OMX_COLOR_Format18BitBGR666: - return "COLOR_Format18BitBGR666"; - case OMX_COLOR_Format24BitARGB6666: - return "COLOR_Format24BitARGB6666"; - case OMX_COLOR_Format24BitABGR6666: - return "COLOR_Format24BitABGR6666"; - case OMX_COLOR_FormatAndroidOpaque: - return "COLOR_FormatAndroidOpaque"; - case OMX_COLOR_FormatYUV420Flexible: - return "COLOR_FormatYUV420Flexible"; - case OMX_TI_COLOR_FormatYUV420PackedSemiPlanar: - return "TI_COLOR_FormatYUV420PackedSemiPlanar"; - case OMX_QCOM_COLOR_FormatYVU420SemiPlanar: - return "QCOM_COLOR_FormatYVU420SemiPlanar"; -// case OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka: -// return "QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka"; -// case OMX_SEC_COLOR_FormatNV12Tiled: -// return "SEC_COLOR_FormatNV12Tiled"; -// case OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m: -// return "QCOM_COLOR_FormatYUV420PackedSemiPlanar32m"; - default: - return def; - } -} - -#endif // AS_STRING_FOR_OMX_IVCOMMON_H - -#endif // OMX_IVCommon_h - -#ifdef OMX_Types_h -/* asString definitions if media/openmax/OMX_Types.h was included */ - -#ifndef AS_STRING_FOR_OMX_TYPES_H -#define AS_STRING_FOR_OMX_TYPES_H - -inline static const char *asString(OMX_BOOL i, const char *def = "??") { - switch (i) { - case OMX_FALSE: return "FALSE"; - case OMX_TRUE: return "TRUE"; - default: return def; - } -} - -inline static const char *asString(OMX_DIRTYPE i, const char *def = "??") { - switch (i) { - case OMX_DirInput: return "Input"; - case OMX_DirOutput: return "Output"; - default: return def; - } -} - -inline static const char *asString(OMX_ENDIANTYPE i, const char *def = "??") { - switch (i) { - case OMX_EndianBig: return "Big"; -// case OMX_EndianLittle: return "Little"; - default: return def; - } -} - -inline static const char *asString(OMX_NUMERICALDATATYPE i, const char *def = "??") { - switch (i) { - case OMX_NumericalDataSigned: return "Signed"; -// case OMX_NumericalDataUnsigned: return "Unsigned"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_TYPES_H - -#endif // OMX_Types_h - -#ifdef OMX_Video_h -/* asString definitions if media/openmax/OMX_Video.h was included */ - -#ifndef AS_STRING_FOR_OMX_VIDEO_H -#define AS_STRING_FOR_OMX_VIDEO_H - -inline static const char *asString(OMX_VIDEO_CODINGTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_CodingUnused: return "Unused"; - case OMX_VIDEO_CodingAutoDetect: return "AutoDetect"; // unused - case OMX_VIDEO_CodingMPEG2: return "MPEG2"; - case OMX_VIDEO_CodingH263: return "H263"; - case OMX_VIDEO_CodingMPEG4: return "MPEG4"; - case OMX_VIDEO_CodingWMV: return "WMV"; // unused - case OMX_VIDEO_CodingRV: return "RV"; // unused - case OMX_VIDEO_CodingAVC: return "AVC"; - case OMX_VIDEO_CodingMJPEG: return "MJPEG"; // unused - case OMX_VIDEO_CodingVP8: return "VP8"; - case OMX_VIDEO_CodingVP9: return "VP9"; - case OMX_VIDEO_CodingHEVC: return "HEVC"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_CONTROLRATETYPE i, const char *def = "??") { - switch (i) { -// case OMX_Video_ControlRateDisable: return "Disable"; - case OMX_Video_ControlRateVariable: return "Variable"; - case OMX_Video_ControlRateConstant: return "Constant"; -// case OMX_Video_ControlRateVariableSkipFrames: return "VariableSkipFrames"; -// case OMX_Video_ControlRateConstantSkipFrames: return "ConstantSkipFrames"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_INTRAREFRESHTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_IntraRefreshCyclic: return "Cyclic"; - case OMX_VIDEO_IntraRefreshAdaptive: return "Adaptive"; - case OMX_VIDEO_IntraRefreshBoth: return "Both"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_H263PROFILETYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_H263ProfileBaseline: return "Baseline"; - case OMX_VIDEO_H263ProfileH320Coding: return "H320Coding"; - case OMX_VIDEO_H263ProfileBackwardCompatible: return "BackwardCompatible"; - case OMX_VIDEO_H263ProfileISWV2: return "ISWV2"; - case OMX_VIDEO_H263ProfileISWV3: return "ISWV3"; - case OMX_VIDEO_H263ProfileHighCompression: return "HighCompression"; - case OMX_VIDEO_H263ProfileInternet: return "Internet"; - case OMX_VIDEO_H263ProfileInterlace: return "Interlace"; - case OMX_VIDEO_H263ProfileHighLatency: return "HighLatency"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_H263LEVELTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_H263Level10: return "Level10"; - case OMX_VIDEO_H263Level20: return "Level20"; - case OMX_VIDEO_H263Level30: return "Level30"; - case OMX_VIDEO_H263Level40: return "Level40"; - case OMX_VIDEO_H263Level45: return "Level45"; - case OMX_VIDEO_H263Level50: return "Level50"; - case OMX_VIDEO_H263Level60: return "Level60"; - case OMX_VIDEO_H263Level70: return "Level70"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_PICTURETYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_PictureTypeI: return "I"; - case OMX_VIDEO_PictureTypeP: return "P"; - case OMX_VIDEO_PictureTypeB: return "B"; -// case OMX_VIDEO_PictureTypeSI: return "SI"; -// case OMX_VIDEO_PictureTypeSP: return "SP"; -// case OMX_VIDEO_PictureTypeEI: return "EI"; -// case OMX_VIDEO_PictureTypeEP: return "EP"; -// case OMX_VIDEO_PictureTypeS: return "S"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_MPEG4PROFILETYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_MPEG4ProfileSimple: return "Simple"; - case OMX_VIDEO_MPEG4ProfileSimpleScalable: return "SimpleScalable"; - case OMX_VIDEO_MPEG4ProfileCore: return "Core"; - case OMX_VIDEO_MPEG4ProfileMain: return "Main"; - case OMX_VIDEO_MPEG4ProfileNbit: return "Nbit"; - case OMX_VIDEO_MPEG4ProfileScalableTexture: return "ScalableTexture"; - case OMX_VIDEO_MPEG4ProfileSimpleFace: return "SimpleFace"; - case OMX_VIDEO_MPEG4ProfileSimpleFBA: return "SimpleFBA"; - case OMX_VIDEO_MPEG4ProfileBasicAnimated: return "BasicAnimated"; - case OMX_VIDEO_MPEG4ProfileHybrid: return "Hybrid"; - case OMX_VIDEO_MPEG4ProfileAdvancedRealTime: return "AdvancedRealTime"; - case OMX_VIDEO_MPEG4ProfileCoreScalable: return "CoreScalable"; - case OMX_VIDEO_MPEG4ProfileAdvancedCoding: return "AdvancedCoding"; - case OMX_VIDEO_MPEG4ProfileAdvancedCore: return "AdvancedCore"; - case OMX_VIDEO_MPEG4ProfileAdvancedScalable: return "AdvancedScalable"; - case OMX_VIDEO_MPEG4ProfileAdvancedSimple: return "AdvancedSimple"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_MPEG4LEVELTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_MPEG4Level0: return "Level0"; - case OMX_VIDEO_MPEG4Level0b: return "Level0b"; - case OMX_VIDEO_MPEG4Level1: return "Level1"; - case OMX_VIDEO_MPEG4Level2: return "Level2"; - case OMX_VIDEO_MPEG4Level3: return "Level3"; - case OMX_VIDEO_MPEG4Level4: return "Level4"; - case OMX_VIDEO_MPEG4Level4a: return "Level4a"; - case OMX_VIDEO_MPEG4Level5: return "Level5"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_AVCPROFILETYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_AVCProfileBaseline: return "Baseline"; - case OMX_VIDEO_AVCProfileMain: return "Main"; - case OMX_VIDEO_AVCProfileExtended: return "Extended"; - case OMX_VIDEO_AVCProfileHigh: return "High"; - case OMX_VIDEO_AVCProfileHigh10: return "High10"; - case OMX_VIDEO_AVCProfileHigh422: return "High422"; - case OMX_VIDEO_AVCProfileHigh444: return "High444"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_AVCLEVELTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_AVCLevel1: return "Level1"; - case OMX_VIDEO_AVCLevel1b: return "Level1b"; - case OMX_VIDEO_AVCLevel11: return "Level11"; - case OMX_VIDEO_AVCLevel12: return "Level12"; - case OMX_VIDEO_AVCLevel13: return "Level13"; - case OMX_VIDEO_AVCLevel2: return "Level2"; - case OMX_VIDEO_AVCLevel21: return "Level21"; - case OMX_VIDEO_AVCLevel22: return "Level22"; - case OMX_VIDEO_AVCLevel3: return "Level3"; - case OMX_VIDEO_AVCLevel31: return "Level31"; - case OMX_VIDEO_AVCLevel32: return "Level32"; - case OMX_VIDEO_AVCLevel4: return "Level4"; - case OMX_VIDEO_AVCLevel41: return "Level41"; - case OMX_VIDEO_AVCLevel42: return "Level42"; - case OMX_VIDEO_AVCLevel5: return "Level5"; - case OMX_VIDEO_AVCLevel51: return "Level51"; - case OMX_VIDEO_AVCLevel52: return "Level52"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_AVCLOOPFILTERTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_AVCLoopFilterEnable: return "Enable"; -// case OMX_VIDEO_AVCLoopFilterDisable: return "Disable"; -// case OMX_VIDEO_AVCLoopFilterDisableSliceBoundary: return "DisableSliceBoundary"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_VIDEO_H - -#endif // OMX_Video_h - -#ifdef OMX_VideoExt_h -/* asString definitions if media/openmax/OMX_VideoExt.h was included */ - -#ifndef AS_STRING_FOR_OMX_VIDEOEXT_H -#define AS_STRING_FOR_OMX_VIDEOEXT_H - -inline static const char *asString(OMX_VIDEO_VP8PROFILETYPE i, const char *def = "!!") { - switch (i) { - case OMX_VIDEO_VP8ProfileMain: return "Main"; - case OMX_VIDEO_VP8ProfileUnknown: return "Unknown"; // unused - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_VP8LEVELTYPE i, const char *def = "!!") { - switch (i) { - case OMX_VIDEO_VP8Level_Version0: return "_Version0"; - case OMX_VIDEO_VP8Level_Version1: return "_Version1"; - case OMX_VIDEO_VP8Level_Version2: return "_Version2"; - case OMX_VIDEO_VP8Level_Version3: return "_Version3"; - case OMX_VIDEO_VP8LevelUnknown: return "Unknown"; // unused - default: return def; - } -} - -inline static const char *asString( - OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE i, const char *def = "??") { - switch (i) { - case OMX_VIDEO_VPXTemporalLayerPatternNone: return "VPXTemporalLayerPatternNone"; - case OMX_VIDEO_VPXTemporalLayerPatternWebRTC: return "VPXTemporalLayerPatternWebRTC"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_HEVCPROFILETYPE i, const char *def = "!!") { - switch (i) { - case OMX_VIDEO_HEVCProfileUnknown: return "Unknown"; // unused - case OMX_VIDEO_HEVCProfileMain: return "Main"; - case OMX_VIDEO_HEVCProfileMain10: return "Main10"; - default: return def; - } -} - -inline static const char *asString(OMX_VIDEO_HEVCLEVELTYPE i, const char *def = "!!") { - switch (i) { - case OMX_VIDEO_HEVCLevelUnknown: return "LevelUnknown"; // unused - case OMX_VIDEO_HEVCMainTierLevel1: return "MainTierLevel1"; - case OMX_VIDEO_HEVCHighTierLevel1: return "HighTierLevel1"; - case OMX_VIDEO_HEVCMainTierLevel2: return "MainTierLevel2"; - case OMX_VIDEO_HEVCHighTierLevel2: return "HighTierLevel2"; - case OMX_VIDEO_HEVCMainTierLevel21: return "MainTierLevel21"; - case OMX_VIDEO_HEVCHighTierLevel21: return "HighTierLevel21"; - case OMX_VIDEO_HEVCMainTierLevel3: return "MainTierLevel3"; - case OMX_VIDEO_HEVCHighTierLevel3: return "HighTierLevel3"; - case OMX_VIDEO_HEVCMainTierLevel31: return "MainTierLevel31"; - case OMX_VIDEO_HEVCHighTierLevel31: return "HighTierLevel31"; - case OMX_VIDEO_HEVCMainTierLevel4: return "MainTierLevel4"; - case OMX_VIDEO_HEVCHighTierLevel4: return "HighTierLevel4"; - case OMX_VIDEO_HEVCMainTierLevel41: return "MainTierLevel41"; - case OMX_VIDEO_HEVCHighTierLevel41: return "HighTierLevel41"; - case OMX_VIDEO_HEVCMainTierLevel5: return "MainTierLevel5"; - case OMX_VIDEO_HEVCHighTierLevel5: return "HighTierLevel5"; - case OMX_VIDEO_HEVCMainTierLevel51: return "MainTierLevel51"; - case OMX_VIDEO_HEVCHighTierLevel51: return "HighTierLevel51"; - case OMX_VIDEO_HEVCMainTierLevel52: return "MainTierLevel52"; - case OMX_VIDEO_HEVCHighTierLevel52: return "HighTierLevel52"; - case OMX_VIDEO_HEVCMainTierLevel6: return "MainTierLevel6"; - case OMX_VIDEO_HEVCHighTierLevel6: return "HighTierLevel6"; - case OMX_VIDEO_HEVCMainTierLevel61: return "MainTierLevel61"; - case OMX_VIDEO_HEVCHighTierLevel61: return "HighTierLevel61"; - case OMX_VIDEO_HEVCMainTierLevel62: return "MainTierLevel62"; - case OMX_VIDEO_HEVCHighTierLevel62: return "HighTierLevel62"; - default: return def; - } -} - -#endif // AS_STRING_FOR_OMX_VIDEOEXT_H - -#endif // OMX_VideoExt_h diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_AudioExt.h android-platform-frameworks-native-21/include/media/openmax/OMX_AudioExt.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_AudioExt.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_AudioExt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright (c) 2010 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -/** OMX_AudioExt.h - OpenMax IL version 1.1.2 - * The OMX_AudioExt header file contains extensions to the - * definitions used by both the application and the component to - * access video items. - */ - -#ifndef OMX_AudioExt_h -#define OMX_AudioExt_h - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Each OMX header shall include all required header files to allow the - * header to compile without errors. The includes below are required - * for this header file to compile successfully - */ -#include - -#define OMX_AUDIO_AACToolAndroidSSBR (OMX_AUDIO_AACToolVendor << 0) /**< SSBR: MPEG-4 Single-rate (downsampled) Spectral Band Replication tool allowed or active */ -#define OMX_AUDIO_AACToolAndroidDSBR (OMX_AUDIO_AACToolVendor << 1) /**< DSBR: MPEG-4 Dual-rate Spectral Band Replication tool allowed or active */ - -typedef enum OMX_AUDIO_CODINGEXTTYPE { - OMX_AUDIO_CodingAndroidUnused = OMX_AUDIO_CodingKhronosExtensions + 0x00100000, - OMX_AUDIO_CodingAndroidAC3, /**< AC3 encoded data */ - OMX_AUDIO_CodingAndroidOPUS, /**< OPUS encoded data */ - OMX_AUDIO_CodingAndroidEAC3, /**< EAC3 encoded data */ -} OMX_AUDIO_CODINGEXTTYPE; - -typedef struct OMX_AUDIO_PARAM_ANDROID_AC3TYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels */ - OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for - variable or unknown sampling rate. */ -} OMX_AUDIO_PARAM_ANDROID_AC3TYPE; - -typedef struct OMX_AUDIO_PARAM_ANDROID_EAC3TYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels */ - OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for - variable or unknown sampling rate. */ -} OMX_AUDIO_PARAM_ANDROID_EAC3TYPE; - -typedef struct OMX_AUDIO_PARAM_ANDROID_OPUSTYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels */ - OMX_U32 nBitRate; /**< Bit rate of the encoded data data. Use 0 for variable - rate or unknown bit rates. Encoding is set to the - bitrate closest to specified value (in bps) */ - OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for - variable or unknown sampling rate. */ - OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should - limit the audio signal. Use 0 to let encoder decide */ -} OMX_AUDIO_PARAM_ANDROID_OPUSTYPE; - -typedef struct OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_S32 nMaxOutputChannels; /**< Maximum channel count to be output, -1 if unspecified, 0 if downmixing disabled */ - OMX_S32 nDrcCut; /**< The DRC attenuation factor, between 0 and 127, -1 if unspecified */ - OMX_S32 nDrcBoost; /**< The DRC amplification factor, between 0 and 127, -1 if unspecified */ - OMX_S32 nHeavyCompression; /**< 0 for light compression, 1 for heavy compression, -1 if unspecified */ - OMX_S32 nTargetReferenceLevel; /**< Target reference level, between 0 and 127, -1 if unspecified */ - OMX_S32 nEncodedTargetLevel; /**< Target reference level assumed at the encoder, between 0 and 127, -1 if unspecified */ - OMX_S32 nPCMLimiterEnable; /**< Signal level limiting, 0 for disable, 1 for enable, -1 if unspecified */ -} OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* OMX_AudioExt_h */ -/* File EOF */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Audio.h android-platform-frameworks-native-21/include/media/openmax/OMX_Audio.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Audio.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Audio.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,25 +16,25 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -50,9 +50,10 @@ extern "C" { #endif /* __cplusplus */ + /* Each OMX header must include all required header files to allow the * header to compile without errors. The includes below are required - * for this header file to compile successfully + * for this header file to compile successfully */ #include @@ -60,7 +61,7 @@ /** @defgroup midi MIDI * @ingroup audio */ - + /** @defgroup effects Audio effects * @ingroup audio */ @@ -70,10 +71,10 @@ * @{ */ -/** Enumeration used to define the possible audio codings. - * If "OMX_AUDIO_CodingUnused" is selected, the coding selection must - * be done in a vendor specific way. Since this is for an audio - * processing element this enum is relevant. However, for another +/** Enumeration used to define the possible audio codings. + * If "OMX_AUDIO_CodingUnused" is selected, the coding selection must + * be done in a vendor specific way. Since this is for an audio + * processing element this enum is relevant. However, for another * type of component other enums would be in this area. */ typedef enum OMX_AUDIO_CODINGTYPE { @@ -106,14 +107,14 @@ OMX_AUDIO_CodingRA, /**< Any variant of RA encoded data */ OMX_AUDIO_CodingMIDI, /**< Any variant of MIDI encoded data */ OMX_AUDIO_CodingFLAC, /**< Any variant of FLAC encoded data */ - OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_CodingMax = 0x7FFFFFFF } OMX_AUDIO_CODINGTYPE; -/** The PortDefinition structure is used to define all of the parameters - * necessary for the compliant component to setup an input or an output audio +/** The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output audio * path. If additional information is needed to define the parameters of the * port (such as frequency), additional structures must be sent such as the * OMX_AUDIO_PARAM_PCMMODETYPE structure to supply the extra parameters for the port. @@ -121,11 +122,11 @@ typedef struct OMX_AUDIO_PORTDEFINITIONTYPE { OMX_STRING cMIMEType; /**< MIME type of data for the port */ OMX_NATIVE_DEVICETYPE pNativeRender; /** < platform specific reference - for an output device, + for an output device, otherwise this field is 0 */ - OMX_BOOL bFlagErrorConcealment; /**< Turns on error concealment if it is + OMX_BOOL bFlagErrorConcealment; /**< Turns on error concealment if it is supported by the OMX component */ - OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this + OMX_AUDIO_CODINGTYPE eEncoding; /**< Type of data expected for this port (e.g. PCM, AMR, MP3, etc) */ } OMX_AUDIO_PORTDEFINITIONTYPE; @@ -142,15 +143,15 @@ } OMX_AUDIO_PARAM_PORTFORMATTYPE; -/** PCM mode type */ -typedef enum OMX_AUDIO_PCMMODETYPE { - OMX_AUDIO_PCMModeLinear = 0, /**< Linear PCM encoded data */ - OMX_AUDIO_PCMModeALaw, /**< A law PCM encoded data (G.711) */ - OMX_AUDIO_PCMModeMULaw, /**< Mu law PCM encoded data (G.711) */ - OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ +/** PCM mode type */ +typedef enum OMX_AUDIO_PCMMODETYPE { + OMX_AUDIO_PCMModeLinear = 0, /**< Linear PCM encoded data */ + OMX_AUDIO_PCMModeALaw, /**< A law PCM encoded data (G.711) */ + OMX_AUDIO_PCMModeMULaw, /**< Mu law PCM encoded data (G.711) */ + OMX_AUDIO_PCMModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_PCMModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_AUDIO_PCMModeMax = 0x7FFFFFFF -} OMX_AUDIO_PCMMODETYPE; + OMX_AUDIO_PCMModeMax = 0x7FFFFFFF +} OMX_AUDIO_PCMMODETYPE; typedef enum OMX_AUDIO_CHANNELTYPE { @@ -164,45 +165,45 @@ OMX_AUDIO_ChannelCS = 0x7, /**< Back surround */ OMX_AUDIO_ChannelLR = 0x8, /**< Left rear. */ OMX_AUDIO_ChannelRR = 0x9, /**< Right rear. */ - OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_ChannelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_ChannelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_AUDIO_ChannelMax = 0x7FFFFFFF + OMX_AUDIO_ChannelMax = 0x7FFFFFFF } OMX_AUDIO_CHANNELTYPE; #define OMX_AUDIO_MAXCHANNELS 16 /**< maximum number distinct audio channels that a buffer may contain */ #define OMX_MIN_PCMPAYLOAD_MSEC 5 /**< Minimum audio buffer payload size for uncompressed (PCM) audio */ -/** PCM format description */ -typedef struct OMX_AUDIO_PARAM_PCMMODETYPE { - OMX_U32 nSize; /**< Size of this structure, in Bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels (e.g. 2 for stereo) */ - OMX_NUMERICALDATATYPE eNumData; /**< indicates PCM data as signed or unsigned */ - OMX_ENDIANTYPE eEndian; /**< indicates PCM data as little or big endian */ - OMX_BOOL bInterleaved; /**< True for normal interleaved data; false for - non-interleaved data (e.g. block data) */ - OMX_U32 nBitPerSample; /**< Bit per sample */ - OMX_U32 nSamplingRate; /**< Sampling rate of the source data. Use 0 for - variable or unknown sampling rate. */ - OMX_AUDIO_PCMMODETYPE ePCMMode; /**< PCM mode enumeration */ +/** PCM format description */ +typedef struct OMX_AUDIO_PARAM_PCMMODETYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels (e.g. 2 for stereo) */ + OMX_NUMERICALDATATYPE eNumData; /**< indicates PCM data as signed or unsigned */ + OMX_ENDIANTYPE eEndian; /**< indicates PCM data as little or big endian */ + OMX_BOOL bInterleaved; /**< True for normal interleaved data; false for + non-interleaved data (e.g. block data) */ + OMX_U32 nBitPerSample; /**< Bit per sample */ + OMX_U32 nSamplingRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ + OMX_AUDIO_PCMMODETYPE ePCMMode; /**< PCM mode enumeration */ OMX_AUDIO_CHANNELTYPE eChannelMapping[OMX_AUDIO_MAXCHANNELS]; /**< Slot i contains channel defined by eChannelMap[i] */ -} OMX_AUDIO_PARAM_PCMMODETYPE; +} OMX_AUDIO_PARAM_PCMMODETYPE; /** Audio channel mode. This is used by both AAC and MP3, although the names are more appropriate - * for the MP3. For example, JointStereo for MP3 is CouplingChannels for AAC. + * for the MP3. For example, JointStereo for MP3 is CouplingChannels for AAC. */ typedef enum OMX_AUDIO_CHANNELMODETYPE { - OMX_AUDIO_ChannelModeStereo = 0, /**< 2 channels, the bitrate allocation between those + OMX_AUDIO_ChannelModeStereo = 0, /**< 2 channels, the bitrate allocation between those two channels changes accordingly to each channel information */ - OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between + OMX_AUDIO_ChannelModeJointStereo, /**< mode that takes advantage of what is common between 2 channels for higher compression gain */ - OMX_AUDIO_ChannelModeDual, /**< 2 mono-channels, each channel is encoded with half + OMX_AUDIO_ChannelModeDual, /**< 2 mono-channels, each channel is encoded with half the bitrate of the overall bitrate */ OMX_AUDIO_ChannelModeMono, /**< Mono channel mode */ - OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_ChannelModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_ChannelModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_ChannelModeMax = 0x7FFFFFFF } OMX_AUDIO_CHANNELMODETYPE; @@ -212,7 +213,7 @@ OMX_AUDIO_MP3StreamFormatMP1Layer3 = 0, /**< MP3 Audio MPEG 1 Layer 3 Stream format */ OMX_AUDIO_MP3StreamFormatMP2Layer3, /**< MP3 Audio MPEG 2 Layer 3 Stream format */ OMX_AUDIO_MP3StreamFormatMP2_5Layer3, /**< MP3 Audio MPEG2.5 Layer 3 Stream format */ - OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MP3StreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_MP3StreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_MP3StreamFormatMax = 0x7FFFFFFF } OMX_AUDIO_MP3STREAMFORMATTYPE; @@ -242,7 +243,7 @@ OMX_AUDIO_AACStreamFormatADIF, /**< AAC Audio Data Interchange Format */ OMX_AUDIO_AACStreamFormatMP4FF, /**< AAC inside MPEG-4/ISO File Format */ OMX_AUDIO_AACStreamFormatRAW, /**< AAC Raw Format */ - OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AACStreamFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_AACStreamFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_AACStreamFormatMax = 0x7FFFFFFF } OMX_AUDIO_AACSTREAMFORMATTYPE; @@ -277,7 +278,6 @@ #define OMX_AUDIO_AACToolTNS 0x00000004 /**< TNS: Temporal Noise Shaping tool allowed or active */ #define OMX_AUDIO_AACToolPNS 0x00000008 /**< PNS: MPEG-4 Perceptual Noise substitution tool allowed or active */ #define OMX_AUDIO_AACToolLTP 0x00000010 /**< LTP: MPEG-4 Long Term Prediction tool allowed or active */ -#define OMX_AUDIO_AACToolVendor 0x00010000 /**< NOT A KHRONOS VALUE, offset for vendor-specific additions */ #define OMX_AUDIO_AACToolAll 0x7FFFFFFF /**< all AAC tools allowed or active (*/ /** MPEG-4 AAC error resilience (ER) tool usage (for nAACERtools in OMX_AUDIO_PARAM_AACPROFILETYPE). @@ -328,16 +328,16 @@ variable or unknown sampling rate. */ OMX_U32 nAudioBandWidth; /**< Audio band width (in Hz) to which an encoder should limit the audio signal. Use 0 to let encoder decide */ - OMX_S32 nQuality; /**< Sets encoding quality to n, between -1 (low) and 10 (high). + OMX_S32 nQuality; /**< Sets encoding quality to n, between -1 (low) and 10 (high). In the default mode of operation, teh quality level is 3. Normal quality range is 0 - 10. */ - OMX_BOOL bManaged; /**< Set bitrate management mode. This turns off the + OMX_BOOL bManaged; /**< Set bitrate management mode. This turns off the normal VBR encoding, but allows hard or soft bitrate constraints to be enforced by the encoder. This mode can be slower, and may also be lower quality. It is primarily useful for streaming. */ - OMX_BOOL bDownmix; /**< Downmix input from stereo to mono (has no effect on - non-stereo streams). Useful for lower-bitrate encoding. */ + OMX_BOOL bDownmix; /**< Downmix input from stereo to mono (has no effect on + non-stereo streams). Useful for lower-bitrate encoding. */ } OMX_AUDIO_PARAM_VORBISTYPE; @@ -360,7 +360,7 @@ OMX_AUDIO_WMAFormat7, /**< Windows Media Audio format 7 */ OMX_AUDIO_WMAFormat8, /**< Windows Media Audio format 8 */ OMX_AUDIO_WMAFormat9, /**< Windows Media Audio format 9 */ - OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_WMAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_WMAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_WMAFormatMax = 0x7FFFFFFF } OMX_AUDIO_WMAFORMATTYPE; @@ -372,7 +372,7 @@ OMX_AUDIO_WMAProfileL1, /**< Windows Media audio version 9 profile L1 */ OMX_AUDIO_WMAProfileL2, /**< Windows Media audio version 9 profile L2 */ OMX_AUDIO_WMAProfileL3, /**< Windows Media audio version 9 profile L3 */ - OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_WMAProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_WMAProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_WMAProfileMax = 0x7FFFFFFF } OMX_AUDIO_WMAPROFILETYPE; @@ -387,14 +387,14 @@ OMX_U32 nBitRate; /**< Bit rate of the input data. Use 0 for variable rate or unknown bit rates */ OMX_AUDIO_WMAFORMATTYPE eFormat; /**< Version of WMA stream / data */ - OMX_AUDIO_WMAPROFILETYPE eProfile; /**< Profile of WMA stream / data */ + OMX_AUDIO_WMAPROFILETYPE eProfile; /**< Profile of WMA stream / data */ OMX_U32 nSamplingRate; /**< Sampling rate of the source data */ OMX_U16 nBlockAlign; /**< is the block alignment, or block size, in bytes of the audio codec */ OMX_U16 nEncodeOptions; /**< WMA Type-specific data */ OMX_U32 nSuperBlockAlign; /**< WMA Type-specific data */ } OMX_AUDIO_PARAM_WMATYPE; -/** +/** * RealAudio format */ typedef enum OMX_AUDIO_RAFORMATTYPE { @@ -406,32 +406,32 @@ OMX_AUDIO_RA10_LOSSLESS, /**< RealAudio Lossless */ OMX_AUDIO_RA10_MULTICHANNEL, /**< RealAudio Multichannel */ OMX_AUDIO_RA10_VOICE, /**< RealAudio Voice for bitrates below 15 kbps */ - OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_RAFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_RAFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_RAFormatMax = 0x7FFFFFFF } OMX_AUDIO_RAFORMATTYPE; -/** RA (Real Audio) params */ -typedef struct OMX_AUDIO_PARAM_RATYPE { - OMX_U32 nSize; /**< Size of this structure, in Bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< Port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels */ - OMX_U32 nSamplingRate; /**< is the sampling rate of the source data */ - OMX_U32 nBitsPerFrame; /**< is the value for bits per frame */ - OMX_U32 nSamplePerFrame; /**< is the value for samples per frame */ - OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */ - OMX_U32 nCouplingStartRegion; /**< is the coupling start region in the stream */ - OMX_U32 nNumRegions; /**< is the number of regions value */ +/** RA (Real Audio) params */ +typedef struct OMX_AUDIO_PARAM_RATYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< Port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels */ + OMX_U32 nSamplingRate; /**< is the sampling rate of the source data */ + OMX_U32 nBitsPerFrame; /**< is the value for bits per frame */ + OMX_U32 nSamplePerFrame; /**< is the value for samples per frame */ + OMX_U32 nCouplingQuantBits; /**< is the number of coupling quantization bits in the stream */ + OMX_U32 nCouplingStartRegion; /**< is the coupling start region in the stream */ + OMX_U32 nNumRegions; /**< is the number of regions value */ OMX_AUDIO_RAFORMATTYPE eFormat; /**< is the RealAudio audio format */ -} OMX_AUDIO_PARAM_RATYPE; +} OMX_AUDIO_PARAM_RATYPE; /** SBC Allocation Method Type */ typedef enum OMX_AUDIO_SBCALLOCMETHODTYPE { OMX_AUDIO_SBCAllocMethodLoudness, /**< Loudness allocation method */ OMX_AUDIO_SBCAllocMethodSNR, /**< SNR allocation method */ - OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_SBCAllocMethodKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_SBCAllocMethodVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_SBCAllocMethodMax = 0x7FFFFFFF } OMX_AUDIO_SBCALLOCMETHODTYPE; @@ -456,18 +456,18 @@ } OMX_AUDIO_PARAM_SBCTYPE; -/** ADPCM stream format parameters */ -typedef struct OMX_AUDIO_PARAM_ADPCMTYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels in the data stream (not - necessarily the same as the number of channels - to be rendered. */ - OMX_U32 nBitsPerSample; /**< Number of bits in each sample */ - OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for - variable or unknown sampling rate. */ -} OMX_AUDIO_PARAM_ADPCMTYPE; +/** ADPCM stream format parameters */ +typedef struct OMX_AUDIO_PARAM_ADPCMTYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_U32 nBitsPerSample; /**< Number of bits in each sample */ + OMX_U32 nSampleRate; /**< Sampling rate of the source data. Use 0 for + variable or unknown sampling rate. */ +} OMX_AUDIO_PARAM_ADPCMTYPE; /** G723 rate */ @@ -475,25 +475,25 @@ OMX_AUDIO_G723ModeUnused = 0, /**< AMRNB Mode unused / unknown */ OMX_AUDIO_G723ModeLow, /**< 5300 bps */ OMX_AUDIO_G723ModeHigh, /**< 6300 bps */ - OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_G723ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_G723ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_G723ModeMax = 0x7FFFFFFF } OMX_AUDIO_G723RATE; /** G723 - Sample rate must be 8 KHz */ -typedef struct OMX_AUDIO_PARAM_G723TYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels in the data stream (not - necessarily the same as the number of channels - to be rendered. */ - OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ +typedef struct OMX_AUDIO_PARAM_G723TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ + OMX_BOOL bDTX; /**< Enable Discontinuous Transmisssion */ OMX_AUDIO_G723RATE eBitRate; /**< todo: Should this be moved to a config? */ - OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ - OMX_BOOL bPostFilter; /**< Enable Post Filter */ -} OMX_AUDIO_PARAM_G723TYPE; + OMX_BOOL bHiPassFilter; /**< Enable High Pass Filter */ + OMX_BOOL bPostFilter; /**< Enable Post Filter */ +} OMX_AUDIO_PARAM_G723TYPE; /** ITU G726 (ADPCM) rate */ @@ -503,22 +503,22 @@ OMX_AUDIO_G726Mode24, /**< 24 kbps */ OMX_AUDIO_G726Mode32, /**< 32 kbps, most common rate, also G721 */ OMX_AUDIO_G726Mode40, /**< 40 kbps */ - OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_G726ModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_G726ModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_G726ModeMax = 0x7FFFFFFF } OMX_AUDIO_G726MODE; -/** G.726 stream format parameters - must be at 8KHz */ -typedef struct OMX_AUDIO_PARAM_G726TYPE { - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannels; /**< Number of channels in the data stream (not - necessarily the same as the number of channels - to be rendered. */ +/** G.726 stream format parameters - must be at 8KHz */ +typedef struct OMX_AUDIO_PARAM_G726TYPE { + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nChannels; /**< Number of channels in the data stream (not + necessarily the same as the number of channels + to be rendered. */ OMX_AUDIO_G726MODE eG726Mode; -} OMX_AUDIO_PARAM_G726TYPE; +} OMX_AUDIO_PARAM_G726TYPE; /** G729 coder type */ @@ -527,7 +527,7 @@ OMX_AUDIO_G729A, /**< ITU G.729 annex A encoded data */ OMX_AUDIO_G729B, /**< ITU G.729 with annex B encoded data */ OMX_AUDIO_G729AB, /**< ITU G.729 annexes A and B encoded data */ - OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_G729KhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_G729VendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_G729Max = 0x7FFFFFFF } OMX_AUDIO_G729TYPE; @@ -546,23 +546,23 @@ } OMX_AUDIO_PARAM_G729TYPE; -/** AMR Frame format */ -typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE { - OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance - (Standard) Format */ - OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface - Format 1 */ - OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface - Format 2*/ - OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage - Format */ - OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time - Transport Protocol Payload Format */ - OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */ - OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ +/** AMR Frame format */ +typedef enum OMX_AUDIO_AMRFRAMEFORMATTYPE { + OMX_AUDIO_AMRFrameFormatConformance = 0, /**< Frame Format is AMR Conformance + (Standard) Format */ + OMX_AUDIO_AMRFrameFormatIF1, /**< Frame Format is AMR Interface + Format 1 */ + OMX_AUDIO_AMRFrameFormatIF2, /**< Frame Format is AMR Interface + Format 2*/ + OMX_AUDIO_AMRFrameFormatFSF, /**< Frame Format is AMR File Storage + Format */ + OMX_AUDIO_AMRFrameFormatRTPPayload, /**< Frame Format is AMR Real-Time + Transport Protocol Payload Format */ + OMX_AUDIO_AMRFrameFormatITU, /**< Frame Format is ITU Format (added at Motorola request) */ + OMX_AUDIO_AMRFrameFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_AMRFrameFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF -} OMX_AUDIO_AMRFRAMEFORMATTYPE; + OMX_AUDIO_AMRFrameFormatMax = 0x7FFFFFFF +} OMX_AUDIO_AMRFRAMEFORMATTYPE; /** AMR band mode */ @@ -570,7 +570,7 @@ OMX_AUDIO_AMRBandModeUnused = 0, /**< AMRNB Mode unused / unknown */ OMX_AUDIO_AMRBandModeNB0, /**< AMRNB Mode 0 = 4750 bps */ OMX_AUDIO_AMRBandModeNB1, /**< AMRNB Mode 1 = 5150 bps */ - OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */ + OMX_AUDIO_AMRBandModeNB2, /**< AMRNB Mode 2 = 5900 bps */ OMX_AUDIO_AMRBandModeNB3, /**< AMRNB Mode 3 = 6700 bps */ OMX_AUDIO_AMRBandModeNB4, /**< AMRNB Mode 4 = 7400 bps */ OMX_AUDIO_AMRBandModeNB5, /**< AMRNB Mode 5 = 7950 bps */ @@ -578,36 +578,36 @@ OMX_AUDIO_AMRBandModeNB7, /**< AMRNB Mode 7 = 12200 bps */ OMX_AUDIO_AMRBandModeWB0, /**< AMRWB Mode 0 = 6600 bps */ OMX_AUDIO_AMRBandModeWB1, /**< AMRWB Mode 1 = 8850 bps */ - OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */ - OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */ + OMX_AUDIO_AMRBandModeWB2, /**< AMRWB Mode 2 = 12650 bps */ + OMX_AUDIO_AMRBandModeWB3, /**< AMRWB Mode 3 = 14250 bps */ OMX_AUDIO_AMRBandModeWB4, /**< AMRWB Mode 4 = 15850 bps */ OMX_AUDIO_AMRBandModeWB5, /**< AMRWB Mode 5 = 18250 bps */ OMX_AUDIO_AMRBandModeWB6, /**< AMRWB Mode 6 = 19850 bps */ OMX_AUDIO_AMRBandModeWB7, /**< AMRWB Mode 7 = 23050 bps */ - OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */ - OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AMRBandModeWB8, /**< AMRWB Mode 8 = 23850 bps */ + OMX_AUDIO_AMRBandModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_AMRBandModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_AMRBandModeMax = 0x7FFFFFFF } OMX_AUDIO_AMRBANDMODETYPE; + - -/** AMR Discontinuous Transmission mode */ -typedef enum OMX_AUDIO_AMRDTXMODETYPE { - OMX_AUDIO_AMRDTXModeOff = 0, /**< AMR Discontinuous Transmission Mode is disabled */ - OMX_AUDIO_AMRDTXModeOnVAD1, /**< AMR Discontinuous Transmission Mode using - Voice Activity Detector 1 (VAD1) is enabled */ - OMX_AUDIO_AMRDTXModeOnVAD2, /**< AMR Discontinuous Transmission Mode using - Voice Activity Detector 2 (VAD2) is enabled */ - OMX_AUDIO_AMRDTXModeOnAuto, /**< The codec will automatically select between - Off, VAD1 or VAD2 modes */ +/** AMR Discontinuous Transmission mode */ +typedef enum OMX_AUDIO_AMRDTXMODETYPE { + OMX_AUDIO_AMRDTXModeOff = 0, /**< AMR Discontinuous Transmission Mode is disabled */ + OMX_AUDIO_AMRDTXModeOnVAD1, /**< AMR Discontinuous Transmission Mode using + Voice Activity Detector 1 (VAD1) is enabled */ + OMX_AUDIO_AMRDTXModeOnVAD2, /**< AMR Discontinuous Transmission Mode using + Voice Activity Detector 2 (VAD2) is enabled */ + OMX_AUDIO_AMRDTXModeOnAuto, /**< The codec will automatically select between + Off, VAD1 or VAD2 modes */ OMX_AUDIO_AMRDTXasEFR, /**< DTX as EFR instead of AMR standard (3GPP 26.101, frame type =8,9,10) */ - OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_AMRDTXModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_AMRDTXModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF -} OMX_AUDIO_AMRDTXMODETYPE; - + OMX_AUDIO_AMRDTXModeMax = 0x7FFFFFFF +} OMX_AUDIO_AMRDTXMODETYPE; + /** AMR params */ typedef struct OMX_AUDIO_PARAM_AMRTYPE { @@ -616,7 +616,7 @@ OMX_U32 nPortIndex; /**< port that this structure applies to */ OMX_U32 nChannels; /**< Number of channels */ OMX_U32 nBitRate; /**< Bit rate read only field */ - OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ + OMX_AUDIO_AMRBANDMODETYPE eAMRBandMode; /**< AMR Band Mode enumeration */ OMX_AUDIO_AMRDTXMODETYPE eAMRDTXMode; /**< AMR DTX Mode enumeration */ OMX_AUDIO_AMRFRAMEFORMATTYPE eAMRFrameFormat; /**< AMR frame format enumeration */ } OMX_AUDIO_PARAM_AMRTYPE; @@ -724,7 +724,7 @@ OMX_AUDIO_CDMARateQuarter, /**< CDMA encoded frame in quarter rate */ OMX_AUDIO_CDMARateEighth, /**< CDMA encoded frame in eighth rate (DTX)*/ OMX_AUDIO_CDMARateErasure, /**< CDMA erasure frame */ - OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_CDMARateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_CDMARateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_CDMARateMax = 0x7FFFFFFF } OMX_AUDIO_CDMARATETYPE; @@ -796,7 +796,7 @@ } OMX_AUDIO_PARAM_SMVTYPE; -/** MIDI Format +/** MIDI Format * @ingroup midi */ typedef enum OMX_AUDIO_MIDIFORMATTYPE @@ -809,33 +809,33 @@ OMX_AUDIO_MIDIFormatXMF0, /**< eXtensible Music Format type 0 */ OMX_AUDIO_MIDIFormatXMF1, /**< eXtensible Music Format type 1 */ OMX_AUDIO_MIDIFormatMobileXMF, /**< Mobile XMF (eXtensible Music Format type 2) */ - OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDIFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_MIDIFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_MIDIFormatMax = 0x7FFFFFFF } OMX_AUDIO_MIDIFORMATTYPE; -/** MIDI params +/** MIDI params * @ingroup midi */ typedef struct OMX_AUDIO_PARAM_MIDITYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nFileSize; /**< size of the MIDI file in bytes, where the entire - MIDI file passed in, otherwise if 0x0, the MIDI data - is merged and streamed (instead of passed as an + OMX_U32 nFileSize; /**< size of the MIDI file in bytes, where the entire + MIDI file passed in, otherwise if 0x0, the MIDI data + is merged and streamed (instead of passed as an entire MIDI file) */ - OMX_BU32 sMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic - voices. A value of zero indicates that the default - polyphony of the device is used */ - OMX_BOOL bLoadDefaultSound; /**< Whether to load default sound + OMX_BU32 sMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic + voices. A value of zero indicates that the default + polyphony of the device is used */ + OMX_BOOL bLoadDefaultSound; /**< Whether to load default sound bank at initialization */ - OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */ + OMX_AUDIO_MIDIFORMATTYPE eMidiFormat; /**< Version of the MIDI file */ } OMX_AUDIO_PARAM_MIDITYPE; -/** Type of the MIDI sound bank +/** Type of the MIDI sound bank * @ingroup midi */ typedef enum OMX_AUDIO_MIDISOUNDBANKTYPE { @@ -844,13 +844,13 @@ OMX_AUDIO_MIDISoundBankDLS2, /**< DLS version 2 */ OMX_AUDIO_MIDISoundBankMobileDLSBase, /**< Mobile DLS, using the base functionality */ OMX_AUDIO_MIDISoundBankMobileDLSPlusOptions, /**< Mobile DLS, using the specification-defined optional feature set */ - OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDISoundBankKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_MIDISoundBankVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_MIDISoundBankMax = 0x7FFFFFFF } OMX_AUDIO_MIDISOUNDBANKTYPE; -/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank +/** Bank Layout describes how bank MSB & LSB are used in the DLS instrument definitions sound bank * @ingroup midi */ typedef enum OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE { @@ -858,13 +858,13 @@ OMX_AUDIO_MIDISoundBankLayoutGM, /**< GS layout (based on bank MSB 0x00) */ OMX_AUDIO_MIDISoundBankLayoutGM2, /**< General MIDI 2 layout (using MSB 0x78/0x79, LSB 0x00) */ OMX_AUDIO_MIDISoundBankLayoutUser, /**< Does not conform to any bank numbering standards */ - OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDISoundBankLayoutKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_MIDISoundBankLayoutVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_MIDISoundBankLayoutMax = 0x7FFFFFFF } OMX_AUDIO_MIDISOUNDBANKLAYOUTTYPE; -/** MIDI params to load/unload user soundbank +/** MIDI params to load/unload user soundbank * @ingroup midi */ typedef struct OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE { @@ -879,8 +879,8 @@ } OMX_AUDIO_PARAM_MIDILOADUSERSOUNDTYPE; -/** Structure for Live MIDI events and MIP messages. - * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.) +/** Structure for Live MIDI events and MIP messages. + * (MIP = Maximum Instantaneous Polyphony; part of the SP-MIDI standard.) * @ingroup midi */ typedef struct OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE { @@ -889,12 +889,12 @@ OMX_U32 nPortIndex; /**< Port that this structure applies to */ OMX_U32 nMidiEventSize; /**< Size of immediate MIDI events or MIP message in bytes */ OMX_U8 nMidiEvents[1]; /**< MIDI event array to be rendered immediately, or an - array for the MIP message buffer, where the size is + array for the MIP message buffer, where the size is indicated by nMidiEventSize */ } OMX_AUDIO_CONFIG_MIDIIMMEDIATEEVENTTYPE; -/** MIDI sound bank/ program pair in a given channel +/** MIDI sound bank/ program pair in a given channel * @ingroup midi */ typedef struct OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE { @@ -904,29 +904,29 @@ OMX_U32 nChannel; /**< Valid channel values range from 1 to 16 */ OMX_U16 nIDProgram; /**< Valid program ID range is 1 to 128 */ OMX_U16 nIDSoundBank; /**< Sound bank ID */ - OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks + OMX_U32 nUserSoundBankIndex;/**< User soundbank index, easier to access soundbanks by index if multiple banks are present */ } OMX_AUDIO_CONFIG_MIDISOUNDBANKPROGRAMTYPE; -/** MIDI control +/** MIDI control * @ingroup midi */ typedef struct OMX_AUDIO_CONFIG_MIDICONTROLTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10 + OMX_BS32 sPitchTransposition; /**< Pitch transposition in semitones, stored as Q22.10 format based on JAVA MMAPI (JSR-135) requirement */ OMX_BU32 sPlayBackRate; /**< Relative playback rate, stored as Q14.17 fixed-point number based on JSR-135 requirement */ - OMX_BU32 sTempo ; /**< Tempo in beats per minute (BPM), stored as Q22.10 + OMX_BU32 sTempo ; /**< Tempo in beats per minute (BPM), stored as Q22.10 fixed-point number based on JSR-135 requirement */ - OMX_U32 nMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic - voices. A value of zero indicates that the default + OMX_U32 nMaxPolyphony; /**< Specifies the maximum simultaneous polyphonic + voices. A value of zero indicates that the default polyphony of the device is used */ OMX_U32 nNumRepeat; /**< Number of times to repeat playback */ - OMX_U32 nStopTime; /**< Time in milliseconds to indicate when playback + OMX_U32 nStopTime; /**< Time in milliseconds to indicate when playback will stop automatically. Set to zero if not used */ OMX_U16 nChannelMuteMask; /**< 16 bit mask for channel mute status */ OMX_U16 nChannelSoloMask; /**< 16 bit mask for channel solo status */ @@ -938,22 +938,22 @@ } OMX_AUDIO_CONFIG_MIDICONTROLTYPE; -/** MIDI Playback States +/** MIDI Playback States * @ingroup midi */ typedef enum OMX_AUDIO_MIDIPLAYBACKSTATETYPE { - OMX_AUDIO_MIDIPlayBackStateUnknown = 0, /**< Unknown state or state does not map to - other defined states */ - OMX_AUDIO_MIDIPlayBackStateClosedEngaged, /**< No MIDI resource is currently open. - The MIDI engine is currently processing + OMX_AUDIO_MIDIPlayBackStateUnknown = 0, /**< Unknown state or state does not map to + other defined states */ + OMX_AUDIO_MIDIPlayBackStateClosedEngaged, /**< No MIDI resource is currently open. + The MIDI engine is currently processing MIDI events. */ - OMX_AUDIO_MIDIPlayBackStateParsing, /**< A MIDI resource is open and is being - primed. The MIDI engine is currently + OMX_AUDIO_MIDIPlayBackStateParsing, /**< A MIDI resource is open and is being + primed. The MIDI engine is currently processing MIDI events. */ - OMX_AUDIO_MIDIPlayBackStateOpenEngaged, /**< A MIDI resource is open and primed but + OMX_AUDIO_MIDIPlayBackStateOpenEngaged, /**< A MIDI resource is open and primed but not playing. The MIDI engine is currently processing MIDI events. The transition to - this state is only possible from the + this state is only possible from the OMX_AUDIO_MIDIPlayBackStatePlaying state, when the 'playback head' reaches the end of media data or the playback stops due @@ -968,95 +968,95 @@ no audible MIDI content during playback currently. The situation may change if resources are freed later.*/ - OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_MIDIPlayBackStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_MIDIPlayBackStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_MIDIPlayBackStateMax = 0x7FFFFFFF } OMX_AUDIO_MIDIPLAYBACKSTATETYPE; -/** MIDI status +/** MIDI status * @ingroup midi */ typedef struct OMX_AUDIO_CONFIG_MIDISTATUSTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U16 nNumTracks; /**< Number of MIDI tracks in the file, read only field. - NOTE: May not return a meaningful value until the entire + OMX_U16 nNumTracks; /**< Number of MIDI tracks in the file, read only field. + NOTE: May not return a meaningful value until the entire file is parsed and buffered. */ - OMX_U32 nDuration; /**< The length of the currently open MIDI resource - in milliseconds. NOTE: May not return a meaningful value - until the entire file is parsed and buffered. */ - OMX_U32 nPosition; /**< Current Position of the MIDI resource being played + OMX_U32 nDuration; /**< The length of the currently open MIDI resource + in milliseconds. NOTE: May not return a meaningful value + until the entire file is parsed and buffered. */ + OMX_U32 nPosition; /**< Current Position of the MIDI resource being played in milliseconds */ - OMX_BOOL bVibra; /**< Does Vibra track exist? NOTE: May not return a meaningful + OMX_BOOL bVibra; /**< Does Vibra track exist? NOTE: May not return a meaningful value until the entire file is parsed and buffered. */ - OMX_U32 nNumMetaEvents; /**< Total number of MIDI Meta Events in the currently - open MIDI resource. NOTE: May not return a meaningful value + OMX_U32 nNumMetaEvents; /**< Total number of MIDI Meta Events in the currently + open MIDI resource. NOTE: May not return a meaningful value until the entire file is parsed and buffered. */ - OMX_U32 nNumActiveVoices; /**< Number of active voices in the currently playing - MIDI resource. NOTE: May not return a meaningful value until + OMX_U32 nNumActiveVoices; /**< Number of active voices in the currently playing + MIDI resource. NOTE: May not return a meaningful value until the entire file is parsed and buffered. */ OMX_AUDIO_MIDIPLAYBACKSTATETYPE eMIDIPlayBackState; /**< MIDI playback state enumeration, read only field */ } OMX_AUDIO_CONFIG_MIDISTATUSTYPE; /** MIDI Meta Event structure one per Meta Event. - * MIDI Meta Events are like audio metadata, except that they are interspersed - * with the MIDI content throughout the file and are not localized in the header. - * As such, it is necessary to retrieve information about these Meta Events from - * the engine, as it encounters these Meta Events within the MIDI content. - * For example, SMF files can have up to 14 types of MIDI Meta Events (copyright, - * author, default tempo, etc.) scattered throughout the file. + * MIDI Meta Events are like audio metadata, except that they are interspersed + * with the MIDI content throughout the file and are not localized in the header. + * As such, it is necessary to retrieve information about these Meta Events from + * the engine, as it encounters these Meta Events within the MIDI content. + * For example, SMF files can have up to 14 types of MIDI Meta Events (copyright, + * author, default tempo, etc.) scattered throughout the file. * @ingroup midi */ -typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{ - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nIndex; /**< Index of Meta Event */ - OMX_U8 nMetaEventType; /**< Meta Event Type, 7bits (i.e. 0 - 127) */ - OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ +typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE{ + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nIndex; /**< Index of Meta Event */ + OMX_U8 nMetaEventType; /**< Meta Event Type, 7bits (i.e. 0 - 127) */ + OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ OMX_U32 nTrack; /**< track number for the meta event */ OMX_U32 nPosition; /**< Position of the meta-event in milliseconds */ -} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE; +} OMX_AUDIO_CONFIG_MIDIMETAEVENTTYPE; -/** MIDI Meta Event Data structure - one per Meta Event. +/** MIDI Meta Event Data structure - one per Meta Event. * @ingroup midi - */ -typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{ - OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nIndex; /**< Index of Meta Event */ - OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ - OMX_U8 nData[1]; /**< array of one or more bytes of meta data - as indicated by the nMetaEventSize field */ -} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE; + */ +typedef struct OMX_AUDIO_CONFIG_MIDIMETAEVENTDATATYPE{ + OMX_U32 nSize; /**< size of the structure in bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_U32 nIndex; /**< Index of Meta Event */ + OMX_U32 nMetaEventSize; /**< size of the Meta Event in bytes */ + OMX_U8 nData[1]; /**< array of one or more bytes of meta data + as indicated by the nMetaEventSize field */ +} OMX_AUDIO_CONFIG__MIDIMETAEVENTDATATYPE; /** Audio Volume adjustment for a port */ typedef struct OMX_AUDIO_CONFIG_VOLUMETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< Port index indicating which port to - set. Select the input port to set - just that port's volume. Select the - output port to adjust the master + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's volume. Select the + output port to adjust the master volume. */ - OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) + OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or logarithmic scale (mB) */ OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR Volume logarithmic setting for this port. The values for volume are in mB (millibels = 1/100 dB) relative - to a gain of 1 (e.g. the output is the same as the - input level). Values are in mB from nMax + to a gain of 1 (e.g. the output is the same as the + input level). Values are in mB from nMax (maximum volume) to nMin mB (typically negative). Since the volume is "voltage" and not a "power", it takes a setting of -600 mB to decrease the volume by 1/2. If - a component cannot accurately set the + a component cannot accurately set the volume to the requested value, it must set the volume to the closest value BELOW the requested value. When getting the @@ -1069,27 +1069,27 @@ typedef struct OMX_AUDIO_CONFIG_CHANNELVOLUMETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< Port index indicating which port to - set. Select the input port to set - just that port's volume. Select the - output port to adjust the master + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's volume. Select the + output port to adjust the master volume. */ - OMX_U32 nChannel; /**< channel to select from 0 to N-1, + OMX_U32 nChannel; /**< channel to select from 0 to N-1, using OMX_ALL to apply volume settings to all channels */ - OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or + OMX_BOOL bLinear; /**< Is the volume to be set in linear (0.100) or logarithmic scale (mB) */ OMX_BS32 sVolume; /**< Volume linear setting in the 0..100 range, OR - Volume logarithmic setting for this port. - The values for volume are in mB + Volume logarithmic setting for this port. + The values for volume are in mB (millibels = 1/100 dB) relative to a gain - of 1 (e.g. the output is the same as the - input level). Values are in mB from nMax - (maximum volume) to nMin mB (typically negative). + of 1 (e.g. the output is the same as the + input level). Values are in mB from nMax + (maximum volume) to nMin mB (typically negative). Since the volume is "voltage" and not a "power", it takes a setting of -600 mB to decrease the volume by 1/2. If - a component cannot accurately set the + a component cannot accurately set the volume to the requested value, it must set the volume to the closest value BELOW the requested value. When getting the @@ -1104,12 +1104,12 @@ typedef struct OMX_AUDIO_CONFIG_BALANCETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< Port index indicating which port to - set. Select the input port to set - just that port's balance. Select the - output port to adjust the master + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's balance. Select the + output port to adjust the master balance. */ - OMX_S32 nBalance; /**< balance setting for this port + OMX_S32 nBalance; /**< balance setting for this port (-100 to 100, where -100 indicates all left, and no right */ } OMX_AUDIO_CONFIG_BALANCETYPE; @@ -1119,10 +1119,10 @@ typedef struct OMX_AUDIO_CONFIG_MUTETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< Port index indicating which port to - set. Select the input port to set - just that port's mute. Select the - output port to adjust the master + OMX_U32 nPortIndex; /**< Port index indicating which port to + set. Select the input port to set + just that port's mute. Select the + output port to adjust the master mute. */ OMX_BOOL bMute; /**< Mute setting for this port */ } OMX_AUDIO_CONFIG_MUTETYPE; @@ -1133,20 +1133,20 @@ OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_U32 nChannel; /**< channel to select from 0 to N-1, + OMX_U32 nChannel; /**< channel to select from 0 to N-1, using OMX_ALL to apply mute settings to all channels */ OMX_BOOL bMute; /**< Mute setting for this channel */ OMX_BOOL bIsMIDI; /**< TRUE if nChannel refers to a MIDI channel, - FALSE otherwise */ + FALSE otherwise */ } OMX_AUDIO_CONFIG_CHANNELMUTETYPE; -/** Enable / Disable for loudness control, which boosts bass and to a +/** Enable / Disable for loudness control, which boosts bass and to a * smaller extent high end frequencies to compensate for hearing * ability at the extreme ends of the audio spectrum - */ + */ typedef struct OMX_AUDIO_CONFIG_LOUDNESSTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ @@ -1156,33 +1156,33 @@ /** Enable / Disable for bass, which controls low frequencies - */ + */ typedef struct OMX_AUDIO_CONFIG_BASSTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ OMX_BOOL bEnable; /**< Enable/disable for bass control */ - OMX_S32 nBass; /**< bass setting for the port, as a - continuous value from -100 to 100 + OMX_S32 nBass; /**< bass setting for the port, as a + continuous value from -100 to 100 (0 means no change in bass level)*/ } OMX_AUDIO_CONFIG_BASSTYPE; /** Enable / Disable for treble, which controls high frequencies tones - */ + */ typedef struct OMX_AUDIO_CONFIG_TREBLETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ OMX_BOOL bEnable; /**< Enable/disable for treble control */ OMX_S32 nTreble; /**< treble setting for the port, as a - continuous value from -100 to 100 + continuous value from -100 to 100 (0 means no change in treble level) */ } OMX_AUDIO_CONFIG_TREBLETYPE; -/** An equalizer is typically used for two reasons: to compensate for an - * sub-optimal frequency response of a system to make it sound more natural +/** An equalizer is typically used for two reasons: to compensate for an + * sub-optimal frequency response of a system to make it sound more natural * or to create intentionally some unnatural coloring to the sound to create * an effect. * @ingroup effects @@ -1192,33 +1192,33 @@ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ OMX_BOOL bEnable; /**< Enable/disable for equalizer */ - OMX_BU32 sBandIndex; /**< Band number to be set. Upper Limit is + OMX_BU32 sBandIndex; /**< Band number to be set. Upper Limit is N-1, where N is the number of bands, lower limit is 0 */ OMX_BU32 sCenterFreq; /**< Center frequecies in Hz. This is a - read only element and is used to determine - the lower, center and upper frequency of + read only element and is used to determine + the lower, center and upper frequency of this band. */ OMX_BS32 sBandLevel; /**< band level in millibels */ } OMX_AUDIO_CONFIG_EQUALIZERTYPE; -/** Stereo widening mode type +/** Stereo widening mode type * @ingroup effects - */ + */ typedef enum OMX_AUDIO_STEREOWIDENINGTYPE { OMX_AUDIO_StereoWideningHeadphones, /**< Stereo widening for loudspeakers */ OMX_AUDIO_StereoWideningLoudspeakers, /**< Stereo widening for closely spaced loudspeakers */ - OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_StereoWideningKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_StereoWideningVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_StereoWideningMax = 0x7FFFFFFF } OMX_AUDIO_STEREOWIDENINGTYPE; /** Control for stereo widening, which is a special 2-channel - * case of the audio virtualizer effect. For example, for 5.1-channel - * output, it translates to virtual surround sound. + * case of the audio virtualizer effect. For example, for 5.1-channel + * output, it translates to virtual surround sound. * @ingroup effects - */ + */ typedef struct OMX_AUDIO_CONFIG_STEREOWIDENINGTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ @@ -1231,10 +1231,10 @@ /** The chorus effect (or ``choralizer'') is any signal processor which makes - * one sound source (such as a voice) sound like many such sources singing - * (or playing) in unison. Since performance in unison is never exact, chorus - * effects simulate this by making independently modified copies of the input - * signal. Modifications may include (1) delay, (2) frequency shift, and + * one sound source (such as a voice) sound like many such sources singing + * (or playing) in unison. Since performance in unison is never exact, chorus + * effects simulate this by making independently modified copies of the input + * signal. Modifications may include (1) delay, (2) frequency shift, and * (3) amplitude modulation. * @ingroup effects */ @@ -1245,16 +1245,16 @@ OMX_BOOL bEnable; /**< Enable/disable for chorus */ OMX_BU32 sDelay; /**< average delay in milliseconds */ OMX_BU32 sModulationRate; /**< rate of modulation in millihertz */ - OMX_U32 nModulationDepth; /**< depth of modulation as a percentage of + OMX_U32 nModulationDepth; /**< depth of modulation as a percentage of delay (i.e. 0 to 100) */ OMX_BU32 nFeedback; /**< Feedback from chorus output to input in percentage */ } OMX_AUDIO_CONFIG_CHORUSTYPE; -/** Reverberation is part of the reflected sound that follows the early - * reflections. In a typical room, this consists of a dense succession of - * echoes whose energy decays exponentially. The reverberation effect structure - * as defined here includes both (early) reflections as well as (late) reverberations. +/** Reverberation is part of the reflected sound that follows the early + * reflections. In a typical room, this consists of a dense succession of + * echoes whose energy decays exponentially. The reverberation effect structure + * as defined here includes both (early) reflections as well as (late) reverberations. * @ingroup effects */ typedef struct OMX_AUDIO_CONFIG_REVERBERATIONTYPE { @@ -1262,48 +1262,48 @@ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ OMX_BOOL bEnable; /**< Enable/disable for reverberation control */ - OMX_BS32 sRoomLevel; /**< Intensity level for the whole room effect - (i.e. both early reflections and late + OMX_BS32 sRoomLevel; /**< Intensity level for the whole room effect + (i.e. both early reflections and late reverberation) in millibels */ OMX_BS32 sRoomHighFreqLevel; /**< Attenuation at high frequencies relative to the intensity at low frequencies in millibels */ OMX_BS32 sReflectionsLevel; /**< Intensity level of early reflections (relative to room value), in millibels */ - OMX_BU32 sReflectionsDelay; /**< Delay time of the first reflection relative + OMX_BU32 sReflectionsDelay; /**< Delay time of the first reflection relative to the direct path, in milliseconds */ OMX_BS32 sReverbLevel; /**< Intensity level of late reverberation relative to room level, in millibels */ - OMX_BU32 sReverbDelay; /**< Time delay from the first early reflection - to the beginning of the late reverberation + OMX_BU32 sReverbDelay; /**< Time delay from the first early reflection + to the beginning of the late reverberation section, in milliseconds */ OMX_BU32 sDecayTime; /**< Late reverberation decay time at low frequencies, in milliseconds */ - OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative + OMX_BU32 nDecayHighFreqRatio; /**< Ratio of high frequency decay time relative to low frequency decay time in percent */ OMX_U32 nDensity; /**< Modal density in the late reverberation decay, in percent (i.e. 0 - 100) */ OMX_U32 nDiffusion; /**< Echo density in the late reverberation decay, in percent (i.e. 0 - 100) */ - OMX_BU32 sReferenceHighFreq; /**< Reference high frequency in Hertz. This is - the frequency used as the reference for all + OMX_BU32 sReferenceHighFreq; /**< Reference high frequency in Hertz. This is + the frequency used as the reference for all the high-frequency settings above */ } OMX_AUDIO_CONFIG_REVERBERATIONTYPE; -/** Possible settings for the Echo Cancelation structure to use +/** Possible settings for the Echo Cancelation structure to use * @ingroup effects */ typedef enum OMX_AUDIO_ECHOCANTYPE { OMX_AUDIO_EchoCanOff = 0, /**< Echo Cancellation is disabled */ - OMX_AUDIO_EchoCanNormal, /**< Echo Cancellation normal operation - + OMX_AUDIO_EchoCanNormal, /**< Echo Cancellation normal operation - echo from plastics and face */ - OMX_AUDIO_EchoCanHFree, /**< Echo Cancellation optimized for + OMX_AUDIO_EchoCanHFree, /**< Echo Cancellation optimized for Hands Free operation */ - OMX_AUDIO_EchoCanCarKit, /**< Echo Cancellation optimized for + OMX_AUDIO_EchoCanCarKit, /**< Echo Cancellation optimized for Car Kit (longer echo) */ - OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_AUDIO_EchoCanKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_AUDIO_EchoCanVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_AUDIO_EchoCanMax = 0x7FFFFFFF } OMX_AUDIO_ECHOCANTYPE; @@ -1312,7 +1312,7 @@ /** Enable / Disable for echo cancelation, which removes undesired echo's * from the audio * @ingroup effects - */ + */ typedef struct OMX_AUDIO_CONFIG_ECHOCANCELATIONTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ @@ -1324,7 +1324,7 @@ /** Enable / Disable for noise reduction, which undesired noise from * the audio * @ingroup effects - */ + */ typedef struct OMX_AUDIO_CONFIG_NOISEREDUCTIONTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Component.h android-platform-frameworks-native-21/include/media/openmax/OMX_Component.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Component.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Component.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,25 +16,25 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -55,7 +55,7 @@ /* Each OMX header must include all required header files to allow the * header to compile without errors. The includes below are required - * for this header file to compile successfully + * for this header file to compile successfully */ #include @@ -64,12 +64,12 @@ #include /** @ingroup comp */ -typedef enum OMX_PORTDOMAINTYPE { - OMX_PortDomainAudio, - OMX_PortDomainVideo, - OMX_PortDomainImage, +typedef enum OMX_PORTDOMAINTYPE { + OMX_PortDomainAudio, + OMX_PortDomainVideo, + OMX_PortDomainImage, OMX_PortDomainOther, - OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_PortDomainKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_PortDomainVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_PortDomainMax = 0x7ffffff } OMX_PORTDOMAINTYPE; @@ -88,7 +88,7 @@ When disabled a port is unpopulated. A disabled port is not populated with buffers on a transition to IDLE. */ OMX_BOOL bPopulated; /**< Port is populated with all of its buffers as indicated by - nBufferCountActual. A disabled port is always unpopulated. + nBufferCountActual. A disabled port is always unpopulated. An enabled port is populated on a transition to OMX_StateIdle and unpopulated on a transition to loaded. */ OMX_PORTDOMAINTYPE eDomain; /**< Domain of the port. Determines the contents of metadata below. */ @@ -103,26 +103,26 @@ } OMX_PARAM_PORTDEFINITIONTYPE; /** @ingroup comp */ -typedef struct OMX_PARAM_U32TYPE { - OMX_U32 nSize; /**< Size of this structure, in Bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ +typedef struct OMX_PARAM_U32TYPE { + OMX_U32 nSize; /**< Size of this structure, in Bytes */ + OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ + OMX_U32 nPortIndex; /**< port that this structure applies to */ OMX_U32 nU32; /**< U32 value */ } OMX_PARAM_U32TYPE; /** @ingroup rpm */ typedef enum OMX_SUSPENSIONPOLICYTYPE { OMX_SuspensionDisabled, /**< No suspension; v1.0 behavior */ - OMX_SuspensionEnabled, /**< Suspension allowed */ - OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_SuspensionEnabled, /**< Suspension allowed */ + OMX_SuspensionPolicyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_SuspensionPolicyStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_SuspensionPolicyMax = 0x7fffffff } OMX_SUSPENSIONPOLICYTYPE; /** @ingroup rpm */ typedef struct OMX_PARAM_SUSPENSIONPOLICYTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; OMX_SUSPENSIONPOLICYTYPE ePolicy; } OMX_PARAM_SUSPENSIONPOLICYTYPE; @@ -130,22 +130,22 @@ typedef enum OMX_SUSPENSIONTYPE { OMX_NotSuspended, /**< component is not suspended */ OMX_Suspended, /**< component is suspended */ - OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_SuspensionKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_SuspensionVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_SuspendMax = 0x7FFFFFFF } OMX_SUSPENSIONTYPE; /** @ingroup rpm */ typedef struct OMX_PARAM_SUSPENSIONTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_SUSPENSIONTYPE eType; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_SUSPENSIONTYPE eType; } OMX_PARAM_SUSPENSIONTYPE ; typedef struct OMX_CONFIG_BOOLEANTYPE { OMX_U32 nSize; OMX_VERSIONTYPE nVersion; - OMX_BOOL bEnabled; + OMX_BOOL bEnabled; } OMX_CONFIG_BOOLEANTYPE; /* Parameter specifying the content uri to use. */ @@ -171,9 +171,9 @@ typedef struct OMX_RESOURCECONCEALMENTTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment - methods (like degrading algorithm quality to - lower resource consumption or functional bypass) + OMX_BOOL bResourceConcealmentForbidden; /**< disallow the use of resource concealment + methods (like degrading algorithm quality to + lower resource consumption or functional bypass) on a component as a resolution to resource conflicts. */ } OMX_RESOURCECONCEALMENTTYPE; @@ -188,7 +188,7 @@ OMX_MetadataCharsetJavaConformantUTF8, OMX_MetadataCharsetUTF7, OMX_MetadataCharsetImapUTF7, - OMX_MetadataCharsetUTF16LE, + OMX_MetadataCharsetUTF16LE, OMX_MetadataCharsetUTF16BE, OMX_MetadataCharsetGB12345, OMX_MetadataCharsetHZGB2312, @@ -214,7 +214,7 @@ OMX_MetadataCharsetISO2022JP1, OMX_MetadataCharsetISOEUCJP, OMX_MetadataCharsetSMS7Bit, - OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_MetadataCharsetKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_MetadataCharsetVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_MetadataCharsetTypeMax= 0x7FFFFFFF } OMX_METADATACHARSETTYPE; @@ -226,7 +226,7 @@ OMX_MetadataScopeTopLevel, OMX_MetadataScopePortLevel, OMX_MetadataScopeNodeLevel, - OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_MetadataScopeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_MetadataScopeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_MetadataScopeTypeMax = 0x7fffffff } OMX_METADATASCOPETYPE; @@ -237,7 +237,7 @@ OMX_MetadataSearchValueSizeByIndex, OMX_MetadataSearchItemByIndex, OMX_MetadataSearchNextItemByKey, - OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_MetadataSearchKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_MetadataSearchVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_MetadataSearchTypeMax = 0x7fffffff } OMX_METADATASEARCHMODETYPE; @@ -258,7 +258,7 @@ OMX_VERSIONTYPE nVersion; OMX_METADATASCOPETYPE eScopeMode; OMX_U32 nScopeSpecifier; - OMX_U32 nMetadataItemIndex; + OMX_U32 nMetadataItemIndex; OMX_METADATASEARCHMODETYPE eSearchMode; OMX_METADATACHARSETTYPE eKeyCharset; OMX_U8 nKeySizeUsed; @@ -287,30 +287,30 @@ OMX_VERSIONTYPE nVersion; OMX_BOOL bAllKeys; OMX_U32 nParentNodeID; - OMX_U32 nNodeIndex; - OMX_U32 nNodeID; + OMX_U32 nNodeIndex; + OMX_U32 nNodeID; OMX_STRING cNodeName; OMX_BOOL bIsLeafType; } OMX_CONFIG_CONTAINERNODEIDTYPE; /** @ingroup metadata */ -typedef struct OMX_PARAM_METADATAFILTERTYPE -{ - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and +typedef struct OMX_PARAM_METADATAFILTERTYPE +{ + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_BOOL bAllKeys; /* if true then this structure refers to all keys and * the three key fields below are ignored */ OMX_METADATACHARSETTYPE eKeyCharset; - OMX_U32 nKeySizeUsed; - OMX_U8 nKey [128]; + OMX_U32 nKeySizeUsed; + OMX_U8 nKey [128]; OMX_U32 nLanguageCountrySizeUsed; OMX_U8 nLanguageCountry[128]; - OMX_BOOL bEnabled; /* if true then key is part of filter (e.g. + OMX_BOOL bEnabled; /* if true then key is part of filter (e.g. * retained for query later). If false then * key is not part of filter */ -} OMX_PARAM_METADATAFILTERTYPE; +} OMX_PARAM_METADATAFILTERTYPE; -/** The OMX_HANDLETYPE structure defines the component handle. The component +/** The OMX_HANDLETYPE structure defines the component handle. The component * handle is used to access all of the component's public methods and also * contains pointers to the component's private data area. The component * handle is initialized by the OMX core (with help from the component) @@ -318,7 +318,7 @@ * successfully loaded, the application can safely access any of the * component's public functions (although some may return an error because * the state is inappropriate for the access). - * + * * @ingroup comp */ typedef struct OMX_COMPONENTTYPE @@ -329,26 +329,26 @@ function will fill in this value. */ OMX_U32 nSize; - /** nVersion is the version of the OMX specification that the structure - is built against. It is the responsibility of the creator of this - structure to initialize this value and every user of this structure - should verify that it knows how to use the exact version of + /** nVersion is the version of the OMX specification that the structure + is built against. It is the responsibility of the creator of this + structure to initialize this value and every user of this structure + should verify that it knows how to use the exact version of this structure found herein. */ OMX_VERSIONTYPE nVersion; - /** pComponentPrivate is a pointer to the component private data area. - This member is allocated and initialized by the component when the - component is first loaded. The application should not access this + /** pComponentPrivate is a pointer to the component private data area. + This member is allocated and initialized by the component when the + component is first loaded. The application should not access this data area. */ OMX_PTR pComponentPrivate; - /** pApplicationPrivate is a pointer that is a parameter to the - OMX_GetHandle method, and contains an application private value - provided by the IL client. This application private data is + /** pApplicationPrivate is a pointer that is a parameter to the + OMX_GetHandle method, and contains an application private value + provided by the IL client. This application private data is returned to the IL Client by OMX in all callbacks */ OMX_PTR pApplicationPrivate; - /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL + /** refer to OMX_GetComponentVersion in OMX_core.h or the OMX IL specification for details on the GetComponentVersion method. */ OMX_ERRORTYPE (*GetComponentVersion)( @@ -358,7 +358,7 @@ OMX_OUT OMX_VERSIONTYPE* pSpecVersion, OMX_OUT OMX_UUIDTYPE* pComponentUUID); - /** refer to OMX_SendCommand in OMX_core.h or the OMX IL + /** refer to OMX_SendCommand in OMX_core.h or the OMX IL specification for details on the SendCommand method. */ OMX_ERRORTYPE (*SendCommand)( @@ -367,43 +367,43 @@ OMX_IN OMX_U32 nParam1, OMX_IN OMX_PTR pCmdData); - /** refer to OMX_GetParameter in OMX_core.h or the OMX IL + /** refer to OMX_GetParameter in OMX_core.h or the OMX IL specification for details on the GetParameter method. */ OMX_ERRORTYPE (*GetParameter)( - OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nParamIndex, + OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_INDEXTYPE nParamIndex, OMX_INOUT OMX_PTR pComponentParameterStructure); - /** refer to OMX_SetParameter in OMX_core.h or the OMX IL + /** refer to OMX_SetParameter in OMX_core.h or the OMX IL specification for details on the SetParameter method. */ OMX_ERRORTYPE (*SetParameter)( - OMX_IN OMX_HANDLETYPE hComponent, + OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentParameterStructure); - /** refer to OMX_GetConfig in OMX_core.h or the OMX IL + /** refer to OMX_GetConfig in OMX_core.h or the OMX IL specification for details on the GetConfig method. */ OMX_ERRORTYPE (*GetConfig)( OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_INDEXTYPE nIndex, OMX_INOUT OMX_PTR pComponentConfigStructure); - /** refer to OMX_SetConfig in OMX_core.h or the OMX IL + /** refer to OMX_SetConfig in OMX_core.h or the OMX IL specification for details on the SetConfig method. */ OMX_ERRORTYPE (*SetConfig)( OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_INDEXTYPE nIndex, + OMX_IN OMX_INDEXTYPE nIndex, OMX_IN OMX_PTR pComponentConfigStructure); - /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL + /** refer to OMX_GetExtensionIndex in OMX_core.h or the OMX IL specification for details on the GetExtensionIndex method. */ OMX_ERRORTYPE (*GetExtensionIndex)( @@ -412,50 +412,50 @@ OMX_OUT OMX_INDEXTYPE* pIndexType); - /** refer to OMX_GetState in OMX_core.h or the OMX IL + /** refer to OMX_GetState in OMX_core.h or the OMX IL specification for details on the GetState method. */ OMX_ERRORTYPE (*GetState)( OMX_IN OMX_HANDLETYPE hComponent, OMX_OUT OMX_STATETYPE* pState); - + /** The ComponentTunnelRequest method will interact with another OMX component to determine if tunneling is possible and to setup the - tunneling. The return codes for this method can be used to + tunneling. The return codes for this method can be used to determine if tunneling is not possible, or if tunneling is not - supported. - + supported. + Base profile components (i.e. non-interop) do not support this - method and should return OMX_ErrorNotImplemented + method and should return OMX_ErrorNotImplemented - The interop profile component MUST support tunneling to another - interop profile component with a compatible port parameters. + The interop profile component MUST support tunneling to another + interop profile component with a compatible port parameters. A component may also support proprietary communication. - - If proprietary communication is supported the negotiation of - proprietary communication is done outside of OMX in a vendor - specific way. It is only required that the proper result be - returned and the details of how the setup is done is left - to the component implementation. - + + If proprietary communication is supported the negotiation of + proprietary communication is done outside of OMX in a vendor + specific way. It is only required that the proper result be + returned and the details of how the setup is done is left + to the component implementation. + When this method is invoked when nPort in an output port, the component will: - 1. Populate the pTunnelSetup structure with the output port's + 1. Populate the pTunnelSetup structure with the output port's requirements and constraints for the tunnel. When this method is invoked when nPort in an input port, the component will: - 1. Query the necessary parameters from the output port to + 1. Query the necessary parameters from the output port to determine if the ports are compatible for tunneling 2. If the ports are compatible, the component should store the tunnel step provided by the output port 3. Determine which port (either input or output) is the buffer supplier, and call OMX_SetParameter on the output port to indicate this selection. - + The component will return from this call within 5 msec. - + @param [in] hComp Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle method. @@ -463,7 +463,7 @@ nPort is used to select the port on the component to be used for tunneling. @param [in] hTunneledComp - Handle of the component to tunnel with. This is the component + Handle of the component to tunnel with. This is the component handle returned by the call to the OMX_GetHandle method. When this parameter is 0x0 the component should setup the port for communication with the application / IL Client. @@ -486,9 +486,9 @@ OMX_IN OMX_U32 nPort, OMX_IN OMX_HANDLETYPE hTunneledComp, OMX_IN OMX_U32 nTunneledPort, - OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup); + OMX_INOUT OMX_TUNNELSETUPTYPE* pTunnelSetup); - /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL + /** refer to OMX_UseBuffer in OMX_core.h or the OMX IL specification for details on the UseBuffer method. @ingroup buf */ @@ -500,7 +500,7 @@ OMX_IN OMX_U32 nSizeBytes, OMX_IN OMX_U8* pBuffer); - /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL + /** refer to OMX_AllocateBuffer in OMX_core.h or the OMX IL specification for details on the AllocateBuffer method. @ingroup buf */ @@ -511,7 +511,7 @@ OMX_IN OMX_PTR pAppPrivate, OMX_IN OMX_U32 nSizeBytes); - /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL + /** refer to OMX_FreeBuffer in OMX_core.h or the OMX IL specification for details on the FreeBuffer method. @ingroup buf */ @@ -520,7 +520,7 @@ OMX_IN OMX_U32 nPortIndex, OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); - /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL + /** refer to OMX_EmptyThisBuffer in OMX_core.h or the OMX IL specification for details on the EmptyThisBuffer method. @ingroup buf */ @@ -528,7 +528,7 @@ OMX_IN OMX_HANDLETYPE hComponent, OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); - /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL + /** refer to OMX_FillThisBuffer in OMX_core.h or the OMX IL specification for details on the FillThisBuffer method. @ingroup buf */ @@ -543,10 +543,10 @@ Handle of the component to be accessed. This is the component handle returned by the call to the GetHandle function. @param [in] pCallbacks - pointer to an OMX_CALLBACKTYPE structure used to provide the + pointer to an OMX_CALLBACKTYPE structure used to provide the callback information to the component @param [in] pAppData - pointer to an application defined value. It is anticipated that + pointer to an application defined value. It is anticipated that the application will pass a pointer to a data structure or a "this pointer" in this area to allow the callback (in the application) to determine the context of the call @@ -556,7 +556,7 @@ */ OMX_ERRORTYPE (*SetCallbacks)( OMX_IN OMX_HANDLETYPE hComponent, - OMX_IN OMX_CALLBACKTYPE* pCallbacks, + OMX_IN OMX_CALLBACKTYPE* pCallbacks, OMX_IN OMX_PTR pAppData); /** ComponentDeInit method is used to deinitialize the component @@ -583,8 +583,8 @@ OMX_ERRORTYPE (*ComponentRoleEnum)( OMX_IN OMX_HANDLETYPE hComponent, - OMX_OUT OMX_U8 *cRole, - OMX_IN OMX_U32 nIndex); + OMX_OUT OMX_U8 *cRole, + OMX_IN OMX_U32 nIndex); } OMX_COMPONENTTYPE; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_ContentPipe.h android-platform-frameworks-native-21/include/media/openmax/OMX_ContentPipe.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_ContentPipe.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_ContentPipe.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,25 +16,25 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -81,83 +81,83 @@ /** Map types from OMX standard types only here so interface is as generic as possible. */ typedef OMX_U32 CPresult; -typedef char * CPstring; +typedef char * CPstring; typedef void * CPhandle; typedef OMX_U32 CPuint; -typedef OMX_S32 CPint; -typedef char CPbyte; +typedef OMX_S32 CPint; +typedef char CPbyte; typedef OMX_BOOL CPbool; -/** enumeration of origin types used in the CP_PIPETYPE's Seek function +/** enumeration of origin types used in the CP_PIPETYPE's Seek function * @ingroup cp */ typedef enum CP_ORIGINTYPE { - CP_OriginBegin, - CP_OriginCur, - CP_OriginEnd, - CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_OriginBegin, + CP_OriginCur, + CP_OriginEnd, + CP_OriginKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ CP_OriginVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ CP_OriginMax = 0X7FFFFFFF } CP_ORIGINTYPE; -/** enumeration of contact access types used in the CP_PIPETYPE's Open function +/** enumeration of contact access types used in the CP_PIPETYPE's Open function * @ingroup cp */ typedef enum CP_ACCESSTYPE { - CP_AccessRead, - CP_AccessWrite, - CP_AccessReadWrite, - CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_AccessRead, + CP_AccessWrite, + CP_AccessReadWrite , + CP_AccessKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ CP_AccessVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ CP_AccessMax = 0X7FFFFFFF } CP_ACCESSTYPE; -/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function +/** enumeration of results returned by the CP_PIPETYPE's CheckAvailableBytes function * @ingroup cp */ typedef enum CP_CHECKBYTESRESULTTYPE { - CP_CheckBytesOk, /**< There are at least the request number + CP_CheckBytesOk, /**< There are at least the request number of bytes available */ - CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes - and presently lacks sufficient bytes. - Client will be called when they are + CP_CheckBytesNotReady, /**< The pipe is still retrieving bytes + and presently lacks sufficient bytes. + Client will be called when they are sufficient bytes are available. */ - CP_CheckBytesInsufficientBytes, /**< The pipe has retrieved all bytes - but those available are less than those + CP_CheckBytesInsufficientBytes , /**< The pipe has retrieved all bytes + but those available are less than those requested */ CP_CheckBytesAtEndOfStream, /**< The pipe has reached the end of stream and no more bytes are available. */ CP_CheckBytesOutOfBuffers, /**< All read/write buffers are currently in use. */ - CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_CheckBytesKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ CP_CheckBytesVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ CP_CheckBytesMax = 0X7FFFFFFF } CP_CHECKBYTESRESULTTYPE; -/** enumeration of content pipe events sent to the client callback. +/** enumeration of content pipe events sent to the client callback. * @ingroup cp */ typedef enum CP_EVENTTYPE{ - CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/ - CP_Overflow, /** enumeration of content pipe events sent to the client callback*/ - CP_PipeDisconnected, /** enumeration of content pipe events sent to the client callback*/ - CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + CP_BytesAvailable, /** bytes requested in a CheckAvailableBytes call are now available*/ + CP_Overflow, /** enumeration of content pipe events sent to the client callback*/ + CP_PipeDisconnected , /** enumeration of content pipe events sent to the client callback*/ + CP_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ CP_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ CP_EventMax = 0X7FFFFFFF } CP_EVENTTYPE; -/** content pipe definition +/** content pipe definition * @ingroup cp */ typedef struct CP_PIPETYPE { - /** Open a content stream for reading or writing. */ + /** Open a content stream for reading or writing. */ CPresult (*Open)( CPhandle* hContent, CPstring szURI, CP_ACCESSTYPE eAccess ); - /** Close a content stream. */ + /** Close a content stream. */ CPresult (*Close)( CPhandle hContent ); - /** Create a content source and open it for writing. */ + /** Create a content source and open it for writing. */ CPresult (*Create)( CPhandle *hContent, CPstring szURI ); /** Check the that specified number of bytes are available for reading or writing (depending on access type).*/ @@ -171,19 +171,19 @@ /** Retrieve data of the specified size from the content stream (advance content pointer by size of data). Note: pipe client provides pointer. This function is appropriate for small high frequency reads. */ - CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); + CPresult (*Read)( CPhandle hContent, CPbyte *pData, CPuint nSize); - /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes. + /** Retrieve a buffer allocated by the pipe that contains the requested number of bytes. Buffer contains the next block of bytes, as specified by nSize, of the content. nSize also - returns the size of the block actually read. Content pointer advances the by the returned size. - Note: pipe provides pointer. This function is appropriate for large reads. The client must call - ReleaseReadBuffer when done with buffer. + returns the size of the block actually read. Content pointer advances the by the returned size. + Note: pipe provides pointer. This function is appropriate for large reads. The client must call + ReleaseReadBuffer when done with buffer. In some cases the requested block may not reside in contiguous memory within the - pipe implementation. For instance if the pipe leverages a circular buffer then the requested - block may straddle the boundary of the circular buffer. By default a pipe implementation + pipe implementation. For instance if the pipe leverages a circular buffer then the requested + block may straddle the boundary of the circular buffer. By default a pipe implementation performs a copy in this case to provide the block to the pipe client in one contiguous buffer. - If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory + If, however, the client sets bForbidCopy, then the pipe returns only those bytes preceding the memory boundary. Here the client may retrieve the data in segments over successive calls. */ CPresult (*ReadBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint *nSize, CPbool bForbidCopy); @@ -192,14 +192,14 @@ /** Write data of the specified size to the content (advance content pointer by size of data). Note: pipe client provides pointer. This function is appropriate for small high frequency writes. */ - CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); + CPresult (*Write)( CPhandle hContent, CPbyte *data, CPuint nSize); - /** Retrieve a buffer allocated by the pipe used to write data to the content. + /** Retrieve a buffer allocated by the pipe used to write data to the content. Client will fill buffer with output data. Note: pipe provides pointer. This function is appropriate for large writes. The client must call WriteBuffer when done it has filled the buffer with data.*/ CPresult (*GetWriteBuffer)( CPhandle hContent, CPbyte **ppBuffer, CPuint nSize); - /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the + /** Deliver a buffer obtained via GetWriteBuffer to the pipe. Pipe will write the the contents of the buffer to content and advance content pointer by the size of the buffer */ CPresult (*WriteBuffer)( CPhandle hContent, CPbyte *pBuffer, CPuint nFilledSize); diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Core.h android-platform-frameworks-native-21/include/media/openmax/OMX_Core.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Core.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Core.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,25 +16,25 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -53,14 +53,14 @@ /* Each OMX header shall include all required header files to allow the * header to compile without errors. The includes below are required - * for this header file to compile successfully + * for this header file to compile successfully */ #include /** The OMX_COMMANDTYPE enumeration is used to specify the action in the - * OMX_SendCommand macro. + * OMX_SendCommand macro. * @ingroup core */ typedef enum OMX_COMMANDTYPE @@ -70,7 +70,7 @@ OMX_CommandPortDisable, /**< Disable a port on a component. */ OMX_CommandPortEnable, /**< Enable a port on a component. */ OMX_CommandMarkBuffer, /**< Mark a component/buffer for observation */ - OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_CommandKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_CommandVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_CommandMax = 0X7FFFFFFF } OMX_COMMANDTYPE; @@ -93,28 +93,28 @@ * specified configuration and will transition to the idle state if the * allocation is successful. If the component cannot successfully * transition to the idle state for any reason, the state of the component - * shall be fully rolled back to the Loaded state (e.g. all allocated + * shall be fully rolled back to the Loaded state (e.g. all allocated * resources shall be released). When the component receives the command * to go to the Executing state, it shall begin processing buffers by * sending all input buffers it holds to the application. While * the component is in the Idle state, the application may also send the * Pause command. If the component receives the pause command while in the - * Idle state, the component shall send all input buffers it holds to the + * Idle state, the component shall send all input buffers it holds to the * application, but shall not begin processing buffers. This will allow the * application to prefill buffers. - * + * * @ingroup comp */ typedef enum OMX_STATETYPE { - OMX_StateInvalid, /**< component has detected that it's internal data + OMX_StateInvalid, /**< component has detected that it's internal data structures are corrupted to the point that it cannot determine it's state properly */ OMX_StateLoaded, /**< component has been loaded but has not completed initialization. The OMX_SetParameter macro - and the OMX_GetParameter macro are the only - valid macros allowed to be sent to the + and the OMX_GetParameter macro are the only + valid macros allowed to be sent to the component in this state. */ OMX_StateIdle, /**< component initialization has been completed successfully and the component is ready to @@ -122,17 +122,17 @@ OMX_StateExecuting, /**< component has accepted the start command and is processing data (if data is available) */ OMX_StatePause, /**< component has received pause command */ - OMX_StateWaitForResources, /**< component is waiting for resources, either after + OMX_StateWaitForResources, /**< component is waiting for resources, either after preemption or before it gets the resources requested. See specification for complete details. */ - OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_StateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_StateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_StateMax = 0X7FFFFFFF } OMX_STATETYPE; -/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These - * errors should cover most of the common failure cases. However, - * vendors are free to add additional error messages of their own as +/** The OMX_ERRORTYPE enumeration defines the standard OMX Errors. These + * errors should cover most of the common failure cases. However, + * vendors are free to add additional error messages of their own as * long as they follow these rules: * 1. Vendor error messages shall be in the range of 0x90000000 to * 0x9000FFFF. @@ -203,25 +203,25 @@ /** This error occurs when trying to transition into the state you are already in */ OMX_ErrorSameState = (OMX_S32) 0x80001012, - /** Resources allocated to an executing or paused component have been + /** Resources allocated to an executing or paused component have been preempted, causing the component to return to the idle state */ - OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, + OMX_ErrorResourcesPreempted = (OMX_S32) 0x80001013, - /** A non-supplier port sends this error to the IL client (via the EventHandler callback) + /** A non-supplier port sends this error to the IL client (via the EventHandler callback) during the allocation of buffers (on a transition from the LOADED to the IDLE state or - on a port restart) when it deems that it has waited an unusually long time for the supplier + on a port restart) when it deems that it has waited an unusually long time for the supplier to send it an allocated buffer via a UseBuffer call. */ OMX_ErrorPortUnresponsiveDuringAllocation = (OMX_S32) 0x80001014, - /** A non-supplier port sends this error to the IL client (via the EventHandler callback) - during the deallocation of buffers (on a transition from the IDLE to LOADED state or - on a port stop) when it deems that it has waited an unusually long time for the supplier + /** A non-supplier port sends this error to the IL client (via the EventHandler callback) + during the deallocation of buffers (on a transition from the IDLE to LOADED state or + on a port stop) when it deems that it has waited an unusually long time for the supplier to request the deallocation of a buffer header via a FreeBuffer call. */ OMX_ErrorPortUnresponsiveDuringDeallocation = (OMX_S32) 0x80001015, - /** A supplier port sends this error to the IL client (via the EventHandler callback) - during the stopping of a port (either on a transition from the IDLE to LOADED - state or a port stop) when it deems that it has waited an unusually long time for + /** A supplier port sends this error to the IL client (via the EventHandler callback) + during the stopping of a port (either on a transition from the IDLE to LOADED + state or a port stop) when it deems that it has waited an unusually long time for the non-supplier to return a buffer via an EmptyThisBuffer or FillThisBuffer call. */ OMX_ErrorPortUnresponsiveDuringStop = (OMX_S32) 0x80001016, @@ -229,7 +229,7 @@ OMX_ErrorIncorrectStateTransition = (OMX_S32) 0x80001017, /* Attempting a command that is not allowed during the present state. */ - OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, + OMX_ErrorIncorrectStateOperation = (OMX_S32) 0x80001018, /** The values encapsulated in the parameter or config structure are not supported. */ OMX_ErrorUnsupportedSetting = (OMX_S32) 0x80001019, @@ -249,12 +249,12 @@ /** Component suspended due to an inability to acquire dynamic resources */ OMX_ErrorDynamicResourcesUnavailable = (OMX_S32) 0x8000101E, - /** When the macroblock error reporting is enabled the component returns new error + /** When the macroblock error reporting is enabled the component returns new error for every frame that has errors */ OMX_ErrorMbErrorsInFrame = (OMX_S32) 0x8000101F, /** A component reports this error when it cannot parse or determine the format of an input stream. */ - OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, + OMX_ErrorFormatNotDetected = (OMX_S32) 0x80001020, /** The content open operation failed. */ OMX_ErrorContentPipeOpenFailed = (OMX_S32) 0x80001021, @@ -268,7 +268,7 @@ /** Tunneling is unsupported by the component*/ OMX_ErrorTunnelingUnsupported = (OMX_S32) 0x80001024, - OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_ErrorKhronosExtensions = (OMX_S32)0x8F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_ErrorVendorStartUnused = (OMX_S32)0x90000000, /**< Reserved region for introducing Vendor Extensions */ OMX_ErrorMax = 0x7FFFFFFF } OMX_ERRORTYPE; @@ -304,69 +304,69 @@ OMX_U8 cRole[OMX_MAX_STRINGNAME_SIZE]; /**< name of standard component which defines component role */ } OMX_PARAM_COMPONENTROLETYPE; -/** End of Stream Buffer Flag: +/** End of Stream Buffer Flag: * - * A component sets EOS when it has no more data to emit on a particular - * output port. Thus an output port shall set EOS on the last buffer it - * emits. A component's determination of when an output port should + * A component sets EOS when it has no more data to emit on a particular + * output port. Thus an output port shall set EOS on the last buffer it + * emits. A component's determination of when an output port should * cease sending data is implemenation specific. * @ingroup buf */ -#define OMX_BUFFERFLAG_EOS 0x00000001 +#define OMX_BUFFERFLAG_EOS 0x00000001 -/** Start Time Buffer Flag: +/** Start Time Buffer Flag: * * The source of a stream (e.g. a demux component) sets the STARTTIME * flag on the buffer that contains the starting timestamp for the * stream. The starting timestamp corresponds to the first data that * should be displayed at startup or after a seek. * The first timestamp of the stream is not necessarily the start time. - * For instance, in the case of a seek to a particular video frame, - * the target frame may be an interframe. Thus the first buffer of + * For instance, in the case of a seek to a particular video frame, + * the target frame may be an interframe. Thus the first buffer of * the stream will be the intra-frame preceding the target frame and * the starttime will occur with the target frame (with any other * required frames required to reconstruct the target intervening). * - * The STARTTIME flag is directly associated with the buffer's - * timestamp ' thus its association to buffer data and its + * The STARTTIME flag is directly associated with the buffer's + * timestamp ' thus its association to buffer data and its * propagation is identical to the timestamp's. * - * When a Sync Component client receives a buffer with the - * STARTTIME flag it shall perform a SetConfig on its sync port + * When a Sync Component client receives a buffer with the + * STARTTIME flag it shall perform a SetConfig on its sync port * using OMX_ConfigTimeClientStartTime and passing the buffer's * timestamp. - * + * * @ingroup buf */ #define OMX_BUFFERFLAG_STARTTIME 0x00000002 + - -/** Decode Only Buffer Flag: +/** Decode Only Buffer Flag: * * The source of a stream (e.g. a demux component) sets the DECODEONLY * flag on any buffer that should shall be decoded but should not be - * displayed. This flag is used, for instance, when a source seeks to - * a target interframe that requires the decode of frames preceding the - * target to facilitate the target's reconstruction. In this case the - * source would emit the frames preceding the target downstream + * displayed. This flag is used, for instance, when a source seeks to + * a target interframe that requires the decode of frames preceding the + * target to facilitate the target's reconstruction. In this case the + * source would emit the frames preceding the target downstream * but mark them as decode only. * - * The DECODEONLY is associated with buffer data and propagated in a + * The DECODEONLY is associated with buffer data and propagated in a * manner identical to the buffer timestamp. * - * A component that renders data should ignore all buffers with + * A component that renders data should ignore all buffers with * the DECODEONLY flag set. - * + * * @ingroup buf */ #define OMX_BUFFERFLAG_DECODEONLY 0x00000004 -/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt +/* Data Corrupt Flag: This flag is set when the IL client believes the data in the associated buffer is corrupt * @ingroup buf */ @@ -374,29 +374,29 @@ /* End of Frame: The buffer contains exactly one end of frame and no data * occurs after the end of frame. This flag is an optional hint. The absence - * of this flag does not imply the absence of an end of frame within the buffer. + * of this flag does not imply the absence of an end of frame within the buffer. * @ingroup buf */ #define OMX_BUFFERFLAG_ENDOFFRAME 0x00000010 -/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' - * a frame that has no dependency on any other frame information +/* Sync Frame Flag: This flag is set when the buffer content contains a coded sync frame ' + * a frame that has no dependency on any other frame information * @ingroup buf */ #define OMX_BUFFERFLAG_SYNCFRAME 0x00000020 /* Extra data present flag: there is extra data appended to the data stream - * residing in the buffer - * @ingroup buf + * residing in the buffer + * @ingroup buf */ #define OMX_BUFFERFLAG_EXTRADATA 0x00000040 -/** Codec Config Buffer Flag: +/** Codec Config Buffer Flag: * OMX_BUFFERFLAG_CODECCONFIG is an optional flag that is set by an * output port when all bytes in the buffer form part or all of a set of * codec specific configuration data. Examples include SPS/PPS nal units * for OMX_VIDEO_CodingAVC or AudioSpecificConfig data for -* OMX_AUDIO_CodingAAC. Any component that for a given stream sets +* OMX_AUDIO_CodingAAC. Any component that for a given stream sets * OMX_BUFFERFLAG_CODECCONFIG shall not mix codec configuration bytes * with frame data in the same buffer, and shall send all buffers * containing codec configuration bytes before any buffers containing @@ -416,50 +416,50 @@ { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U8* pBuffer; /**< Pointer to actual block of memory + OMX_U8* pBuffer; /**< Pointer to actual block of memory that is acting as the buffer */ OMX_U32 nAllocLen; /**< size of the buffer allocated, in bytes */ - OMX_U32 nFilledLen; /**< number of bytes currently in the + OMX_U32 nFilledLen; /**< number of bytes currently in the buffer */ OMX_U32 nOffset; /**< start offset of valid data in bytes from the start of the buffer */ OMX_PTR pAppPrivate; /**< pointer to any data the application wants to associate with this buffer */ OMX_PTR pPlatformPrivate; /**< pointer to any data the platform - wants to associate with this buffer */ + wants to associate with this buffer */ OMX_PTR pInputPortPrivate; /**< pointer to any data the input port wants to associate with this buffer */ OMX_PTR pOutputPortPrivate; /**< pointer to any data the output port wants to associate with this buffer */ - OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a + OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will generate a mark event upon processing this buffer. */ - OMX_PTR pMarkData; /**< Application specific data associated with - the mark sent on a mark event to disambiguate + OMX_PTR pMarkData; /**< Application specific data associated with + the mark sent on a mark event to disambiguate this mark from others. */ OMX_U32 nTickCount; /**< Optional entry that the component and application can update with a tick count when they access the component. This value should be in microseconds. Since this is a value relative to an arbitrary - starting point, this value cannot be used + starting point, this value cannot be used to determine absolute time. This is an optional entry and not all components will update it.*/ - OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample - starting at the first logical sample - boundary in the buffer. Timestamps of + OMX_TICKS nTimeStamp; /**< Timestamp corresponding to the sample + starting at the first logical sample + boundary in the buffer. Timestamps of successive samples within the buffer may - be inferred by adding the duration of the + be inferred by adding the duration of the of the preceding buffer to the timestamp of the preceding buffer.*/ OMX_U32 nFlags; /**< buffer specific flags */ - OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using + OMX_U32 nOutputPortIndex; /**< The index of the output port (if any) using this buffer */ OMX_U32 nInputPortIndex; /**< The index of the input port (if any) using this buffer */ } OMX_BUFFERHEADERTYPE; -/** The OMX_EXTRADATATYPE enumeration is used to define the +/** The OMX_EXTRADATATYPE enumeration is used to define the * possible extra data payload types. * NB: this enum is binary backwards compatible with the previous * OMX_EXTRADATA_QUANT define. This should be replaced with @@ -467,9 +467,9 @@ */ typedef enum OMX_EXTRADATATYPE { - OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */ + OMX_ExtraDataNone = 0, /**< Indicates that no more extra data sections follow */ OMX_ExtraDataQuantization, /**< The data payload contains quantization data */ - OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_ExtraDataKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_ExtraDataVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_ExtraDataMax = 0x7FFFFFFF } OMX_EXTRADATATYPE; @@ -477,7 +477,7 @@ typedef struct OMX_OTHER_EXTRADATATYPE { OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; + OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_EXTRADATATYPE eType; /* Extra Data type */ OMX_U32 nDataSize; /* Size of the supporting data to follow */ @@ -490,7 +490,7 @@ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPorts; /**< The number of ports for this component */ OMX_U32 nStartPortNumber; /** first port number for this type of port */ -} OMX_PORT_PARAM_TYPE; +} OMX_PORT_PARAM_TYPE; /** @ingroup comp */ typedef enum OMX_EVENTTYPE @@ -499,32 +499,16 @@ OMX_EventError, /**< component has detected an error condition */ OMX_EventMark, /**< component has detected a buffer mark */ OMX_EventPortSettingsChanged, /**< component is reported a port settings change */ - OMX_EventBufferFlag, /**< component has detected an EOS */ + OMX_EventBufferFlag, /**< component has detected an EOS */ OMX_EventResourcesAcquired, /**< component has been granted resources and is automatically starting the state change from OMX_StateWaitForResources to OMX_StateIdle. */ - OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */ - OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */ - OMX_EventPortFormatDetected, /**< Component has detected a supported format. */ - OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ - OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - - /** Event when tunneled decoder has rendered an output or reached EOS - * nData1 must contain the number of timestamps returned - * pEventData must point to an array of the OMX_VIDEO_RENDEREVENTTYPE structs containing the - * render-timestamps of each frame. Component may batch rendered timestamps using this event, - * but must signal the event no more than 40ms after the first frame in the batch. The frames - * must be ordered by system timestamp inside and across batches. - * - * If component is doing frame-rate conversion, it must signal the render time of each - * converted frame, and must interpolate media timestamps for in-between frames. - * - * When the component reached EOS, it must signal an EOS timestamp using the same mechanism. - * This is in addition to the timestamp of the last rendered frame, and should follow that - * frame. - */ - OMX_EventOutputRendered = 0x7F000001, - OMX_EventMax = 0x7FFFFFFF + OMX_EventComponentResumed, /**< Component resumed due to reacquisition of resources */ + OMX_EventDynamicResourcesAvailable, /**< Component has acquired previously unavailable dynamic resources */ + OMX_EventPortFormatDetected, /**< Component has detected a supported format. */ + OMX_EventKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_EventVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ + OMX_EventMax = 0x7FFFFFFF } OMX_EVENTTYPE; typedef struct OMX_CALLBACKTYPE @@ -533,7 +517,7 @@ event of interest occurs. Events are defined in the OMX_EVENTTYPE enumeration. Please see that enumeration for details of what will be returned for each type of event. Callbacks should not return - an error to the component, so if an error occurs, the application + an error to the component, so if an error occurs, the application shall handle it internally. This is a blocking call. The application should return from this call within 5 msec to avoid @@ -543,14 +527,14 @@ handle of the component to access. This is the component handle returned by the call to the GetHandle function. @param pAppData - pointer to an application defined value that was provided in the + pointer to an application defined value that was provided in the pAppData parameter to the OMX_GetHandle method for the component. - This application defined value is provided so that the application + This application defined value is provided so that the application can have a component specific context when receiving the callback. @param eEvent Event that the component wants to notify the application about. @param nData1 - nData will be the OMX_ERRORTYPE for an error event and will be + nData will be the OMX_ERRORTYPE for an error event and will be an OMX_COMMANDTYPE for a command complete event and OMX_INDEXTYPE for a OMX_PortSettingsChanged event. @param nData2 nData2 will hold further information related to the event. Can be OMX_STATETYPE for @@ -569,21 +553,21 @@ OMX_IN OMX_PTR pEventData); /** The EmptyBufferDone method is used to return emptied buffers from an - input port back to the application for reuse. This is a blocking call + input port back to the application for reuse. This is a blocking call so the application should not attempt to refill the buffers during this call, but should queue them and refill them in another thread. There is no error return, so the application shall handle any errors generated - internally. - + internally. + The application should return from this call within 5 msec. - + @param hComponent handle of the component to access. This is the component handle returned by the call to the GetHandle function. @param pAppData - pointer to an application defined value that was provided in the + pointer to an application defined value that was provided in the pAppData parameter to the OMX_GetHandle method for the component. - This application defined value is provided so that the application + This application defined value is provided so that the application can have a component specific context when receiving the callback. @param pBuffer pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer @@ -596,23 +580,23 @@ OMX_IN OMX_BUFFERHEADERTYPE* pBuffer); /** The FillBufferDone method is used to return filled buffers from an - output port back to the application for emptying and then reuse. - This is a blocking call so the application should not attempt to - empty the buffers during this call, but should queue the buffers - and empty them in another thread. There is no error return, so - the application shall handle any errors generated internally. The + output port back to the application for emptying and then reuse. + This is a blocking call so the application should not attempt to + empty the buffers during this call, but should queue the buffers + and empty them in another thread. There is no error return, so + the application shall handle any errors generated internally. The application shall also update the buffer header to indicate the - number of bytes placed into the buffer. + number of bytes placed into the buffer. The application should return from this call within 5 msec. - + @param hComponent handle of the component to access. This is the component handle returned by the call to the GetHandle function. @param pAppData - pointer to an application defined value that was provided in the + pointer to an application defined value that was provided in the pAppData parameter to the OMX_GetHandle method for the component. - This application defined value is provided so that the application + This application defined value is provided so that the application can have a component specific context when receiving the callback. @param pBuffer pointer to an OMX_BUFFERHEADERTYPE structure allocated with UseBuffer @@ -636,13 +620,13 @@ or don't care */ OMX_BufferSupplyInput, /**< input port supplies the buffers */ OMX_BufferSupplyOutput, /**< output port supplies the buffers */ - OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_BufferSupplyKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_BufferSupplyVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_BufferSupplyMax = 0x7FFFFFFF } OMX_BUFFERSUPPLIERTYPE; -/** buffer supplier parameter +/** buffer supplier parameter * @ingroup tun */ typedef struct OMX_PARAM_BUFFERSUPPLIERTYPE { @@ -653,61 +637,61 @@ } OMX_PARAM_BUFFERSUPPLIERTYPE; -/**< indicates that buffers received by an input port of a tunnel - may not modify the data in the buffers +/**< indicates that buffers received by an input port of a tunnel + may not modify the data in the buffers @ingroup tun */ -#define OMX_PORTTUNNELFLAG_READONLY 0x00000001 +#define OMX_PORTTUNNELFLAG_READONLY 0x00000001 /** The OMX_TUNNELSETUPTYPE structure is used to pass data from an output port to an input port as part the two ComponentTunnelRequest calls - resulting from a OMX_SetupTunnel call from the IL Client. + resulting from a OMX_SetupTunnel call from the IL Client. @ingroup tun - */ + */ typedef struct OMX_TUNNELSETUPTYPE { OMX_U32 nTunnelFlags; /**< bit flags for tunneling */ OMX_BUFFERSUPPLIERTYPE eSupplier; /**< supplier preference */ -} OMX_TUNNELSETUPTYPE; +} OMX_TUNNELSETUPTYPE; /* OMX Component headers is included to enable the core to use - macros for functions into the component for OMX release 1.0. + macros for functions into the component for OMX release 1.0. Developers should not access any structures or data from within the component header directly */ /* TO BE REMOVED - #include */ -/** GetComponentVersion will return information about the component. +/** GetComponentVersion will return information about the component. This is a blocking call. This macro will go directly from the application to the component (via a core macro). The component will return from this call within 5 msec. @param [in] hComponent handle of component to execute the command @param [out] pComponentName - pointer to an empty string of length 128 bytes. The component - will write its name into this string. The name will be - terminated by a single zero byte. The name of a component will - be 127 bytes or less to leave room for the trailing zero byte. + pointer to an empty string of length 128 bytes. The component + will write its name into this string. The name will be + terminated by a single zero byte. The name of a component will + be 127 bytes or less to leave room for the trailing zero byte. An example of a valid component name is "OMX.ABC.ChannelMixer\0". @param [out] pComponentVersion - pointer to an OMX Version structure that the component will fill - in. The component will fill in a value that indicates the - component version. NOTE: the component version is NOT the same - as the OMX Specification version (found in all structures). The - component version is defined by the vendor of the component and + pointer to an OMX Version structure that the component will fill + in. The component will fill in a value that indicates the + component version. NOTE: the component version is NOT the same + as the OMX Specification version (found in all structures). The + component version is defined by the vendor of the component and its value is entirely up to the component vendor. @param [out] pSpecVersion - pointer to an OMX Version structure that the component will fill - in. The SpecVersion is the version of the specification that the - component was built against. Please note that this value may or - may not match the structure's version. For example, if the - component was built against the 2.0 specification, but the - application (which creates the structure is built against the + pointer to an OMX Version structure that the component will fill + in. The SpecVersion is the version of the specification that the + component was built against. Please note that this value may or + may not match the structure's version. For example, if the + component was built against the 2.0 specification, but the + application (which creates the structure is built against the 1.0 specification the versions would be different. @param [out] pComponentUUID - pointer to the UUID of the component which will be filled in by - the component. The UUID is a unique identifier that is set at - RUN time for the component and is unique to each instantion of + pointer to the UUID of the component which will be filled in by + the component. The UUID is a unique identifier that is set at + RUN time for the component and is unique to each instantion of the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be @@ -730,46 +714,46 @@ /** Send a command to the component. This call is a non-blocking call. The component should check the parameters and then queue the command - to the component thread to be executed. The component thread shall - send the EventHandler() callback at the conclusion of the command. + to the component thread to be executed. The component thread shall + send the EventHandler() callback at the conclusion of the command. This macro will go directly from the application to the component (via a core macro). The component will return from this call within 5 msec. - + When the command is "OMX_CommandStateSet" the component will queue a state transition to the new state idenfied in nParam. - + When the command is "OMX_CommandFlush", to flush a port's buffer queues, - the command will force the component to return all buffers NOT CURRENTLY - BEING PROCESSED to the application, in the order in which the buffers + the command will force the component to return all buffers NOT CURRENTLY + BEING PROCESSED to the application, in the order in which the buffers were received. - - When the command is "OMX_CommandPortDisable" or + + When the command is "OMX_CommandPortDisable" or "OMX_CommandPortEnable", the component's port (given by the value of - nParam) will be stopped or restarted. - + nParam) will be stopped or restarted. + When the command "OMX_CommandMarkBuffer" is used to mark a buffer, the pCmdData will point to a OMX_MARKTYPE structure containing the component handle of the component to examine the buffer chain for the mark. nParam1 contains the index of the port on which the buffer mark is applied. - Specification text for more details. - + Specification text for more details. + @param [in] hComponent handle of component to execute the command @param [in] Cmd Command for the component to execute @param [in] nParam - Parameter for the command to be executed. When Cmd has the value - OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has - the value OMX_CommandFlush, value of nParam indicates which port(s) - to flush. -1 is used to flush all ports a single port index will + Parameter for the command to be executed. When Cmd has the value + OMX_CommandStateSet, value is a member of OMX_STATETYPE. When Cmd has + the value OMX_CommandFlush, value of nParam indicates which port(s) + to flush. -1 is used to flush all ports a single port index will only flush that port. When Cmd has the value "OMX_CommandPortDisable" - or "OMX_CommandPortEnable", the component's port is given by + or "OMX_CommandPortEnable", the component's port is given by the value of nParam. When Cmd has the value "OMX_CommandMarkBuffer" the components pot is given by the value of nParam. @param [in] pCmdData Parameter pointing to the OMX_MARKTYPE structure when Cmd has the value - "OMX_CommandMarkBuffer". + "OMX_CommandMarkBuffer". @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @@ -787,21 +771,21 @@ pCmdData) /* Macro End */ -/** The OMX_GetParameter macro will get one of the current parameter - settings from the component. This macro cannot only be invoked when +/** The OMX_GetParameter macro will get one of the current parameter + settings from the component. This macro cannot only be invoked when the component is in the OMX_StateInvalid state. The nParamIndex parameter is used to indicate which structure is being requested from - the component. The application shall allocate the correct structure - and shall fill in the structure size and version information before + the component. The application shall allocate the correct structure + and shall fill in the structure size and version information before invoking this macro. When the parameter applies to a port, the caller shall fill in the appropriate nPortIndex value indicating the - port on which the parameter applies. If the component has not had - any settings changed, then the component should return a set of - valid DEFAULT parameters for the component. This is a blocking - call. - + port on which the parameter applies. If the component has not had + any settings changed, then the component should return a set of + valid DEFAULT parameters for the component. This is a blocking + call. + The component should return from this call within 20 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -809,7 +793,7 @@ Index of the structure to be filled. This value is from the OMX_INDEXTYPE enumeration. @param [in,out] pComponentParameterStructure - Pointer to application allocated structure to be filled by the + Pointer to application allocated structure to be filled by the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be @@ -830,17 +814,17 @@ structure to a component. Each structure shall be sent one at a time, in a separate invocation of the macro. This macro can only be invoked when the component is in the OMX_StateLoaded state, or the - port is disabled (when the parameter applies to a port). The + port is disabled (when the parameter applies to a port). The nParamIndex parameter is used to indicate which structure is being - passed to the component. The application shall allocate the - correct structure and shall fill in the structure size and version + passed to the component. The application shall allocate the + correct structure and shall fill in the structure size and version information (as well as the actual data) before invoking this macro. The application is free to dispose of this structure after the call - as the component is required to copy any data it shall retain. This - is a blocking call. - + as the component is required to copy any data it shall retain. This + is a blocking call. + The component should return from this call within 20 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -865,18 +849,18 @@ pComponentParameterStructure) /* Macro End */ -/** The OMX_GetConfig macro will get one of the configuration structures - from a component. This macro can be invoked anytime after the - component has been loaded. The nParamIndex call parameter is used to - indicate which structure is being requested from the component. The - application shall allocate the correct structure and shall fill in the - structure size and version information before invoking this macro. - If the component has not had this configuration parameter sent before, - then the component should return a set of valid DEFAULT values for the - component. This is a blocking call. - +/** The OMX_GetConfig macro will get one of the configuration structures + from a component. This macro can be invoked anytime after the + component has been loaded. The nParamIndex call parameter is used to + indicate which structure is being requested from the component. The + application shall allocate the correct structure and shall fill in the + structure size and version information before invoking this macro. + If the component has not had this configuration parameter sent before, + then the component should return a set of valid DEFAULT values for the + component. This is a blocking call. + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -884,13 +868,13 @@ Index of the structure to be filled. This value is from the OMX_INDEXTYPE enumeration. @param [in,out] pComponentConfigStructure - pointer to application allocated structure to be filled by the + pointer to application allocated structure to be filled by the component. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp -*/ +*/ #define OMX_GetConfig( \ hComponent, \ nConfigIndex, \ @@ -901,18 +885,18 @@ pComponentConfigStructure) /* Macro End */ -/** The OMX_SetConfig macro will send one of the configuration +/** The OMX_SetConfig macro will send one of the configuration structures to a component. Each structure shall be sent one at a time, - each in a separate invocation of the macro. This macro can be invoked - anytime after the component has been loaded. The application shall - allocate the correct structure and shall fill in the structure size - and version information (as well as the actual data) before invoking - this macro. The application is free to dispose of this structure after - the call as the component is required to copy any data it shall retain. - This is a blocking call. - + each in a separate invocation of the macro. This macro can be invoked + anytime after the component has been loaded. The application shall + allocate the correct structure and shall fill in the structure size + and version information (as well as the actual data) before invoking + this macro. The application is free to dispose of this structure after + the call as the component is required to copy any data it shall retain. + This is a blocking call. + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -937,22 +921,22 @@ pComponentConfigStructure) /* Macro End */ -/** The OMX_GetExtensionIndex macro will invoke a component to translate - a vendor specific configuration or parameter string into an OMX - structure index. There is no requirement for the vendor to support - this command for the indexes already found in the OMX_INDEXTYPE - enumeration (this is done to save space in small components). The +/** The OMX_GetExtensionIndex macro will invoke a component to translate + a vendor specific configuration or parameter string into an OMX + structure index. There is no requirement for the vendor to support + this command for the indexes already found in the OMX_INDEXTYPE + enumeration (this is done to save space in small components). The component shall support all vendor supplied extension indexes not found - in the master OMX_INDEXTYPE enumeration. This is a blocking call. - + in the master OMX_INDEXTYPE enumeration. This is a blocking call. + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the GetHandle function. @param [in] cParameterName OMX_STRING that shall be less than 128 characters long including - the trailing null byte. This is the string that will get + the trailing null byte. This is the string that will get translated by the component into a configuration index. @param [out] pIndexType a pointer to a OMX_INDEXTYPE to receive the index value. @@ -971,18 +955,18 @@ pIndexType) /* Macro End */ -/** The OMX_GetState macro will invoke the component to get the current +/** The OMX_GetState macro will invoke the component to get the current state of the component and place the state value into the location - pointed to by pState. - + pointed to by pState. + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [out] pState pointer to the location to receive the state. The value returned - is one of the OMX_STATETYPE members + is one of the OMX_STATETYPE members @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @@ -997,17 +981,17 @@ /** The OMX_UseBuffer macro will request that the component use - a buffer (and allocate its own buffer header) already allocated - by another component, or by the IL Client. This is a blocking + a buffer (and allocate its own buffer header) already allocated + by another component, or by the IL Client. This is a blocking call. - + The component should return from this call within 20 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [out] ppBuffer - pointer to an OMX_BUFFERHEADERTYPE structure used to receive the + pointer to an OMX_BUFFERHEADERTYPE structure used to receive the pointer to the buffer header @return OMX_ERRORTYPE If the command successfully executes, the return code will be @@ -1031,25 +1015,25 @@ pBuffer) -/** The OMX_AllocateBuffer macro will request that the component allocate - a new buffer and buffer header. The component will allocate the - buffer and the buffer header and return a pointer to the buffer +/** The OMX_AllocateBuffer macro will request that the component allocate + a new buffer and buffer header. The component will allocate the + buffer and the buffer header and return a pointer to the buffer header. This is a blocking call. - + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [out] ppBuffer - pointer to an OMX_BUFFERHEADERTYPE structure used to receive + pointer to an OMX_BUFFERHEADERTYPE structure used to receive the pointer to the buffer header @param [in] nPortIndex nPortIndex is used to select the port on the component the buffer will be used with. The port can be found by using the nPortIndex value as an index into the Port Definition array of the component. @param [in] pAppPrivate - pAppPrivate is used to initialize the pAppPrivate member of the + pAppPrivate is used to initialize the pAppPrivate member of the buffer header structure. @param [in] nSizeBytes size of the buffer to allocate. Used when bAllocateNew is true. @@ -1057,7 +1041,7 @@ If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup comp buf - */ + */ #define OMX_AllocateBuffer( \ hComponent, \ ppBuffer, \ @@ -1073,13 +1057,13 @@ /** The OMX_FreeBuffer macro will release a buffer header from the component - which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If - the component allocated the buffer (see the OMX_UseBuffer macro) then - the component shall free the buffer and buffer header. This is a - blocking call. - + which was allocated using either OMX_AllocateBuffer or OMX_UseBuffer. If + the component allocated the buffer (see the OMX_UseBuffer macro) then + the component shall free the buffer and buffer header. This is a + blocking call. + The component should return from this call within 20 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -1104,17 +1088,17 @@ pBuffer) /* Macro End */ -/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an +/** The OMX_EmptyThisBuffer macro will send a buffer full of data to an input port of a component. The buffer will be emptied by the component and returned to the application via the EmptyBufferDone call back. This is a non-blocking call in that the component will record the buffer - and return immediately and then empty the buffer, later, at the proper - time. As expected, this macro may be invoked only while the component + and return immediately and then empty the buffer, later, at the proper + time. As expected, this macro may be invoked only while the component is in the OMX_StateExecuting. If nPortIndex does not specify an input - port, the component shall return an error. - + port, the component shall return an error. + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -1134,17 +1118,17 @@ pBuffer) /* Macro End */ -/** The OMX_FillThisBuffer macro will send an empty buffer to an +/** The OMX_FillThisBuffer macro will send an empty buffer to an output port of a component. The buffer will be filled by the component and returned to the application via the FillBufferDone call back. This is a non-blocking call in that the component will record the buffer - and return immediately and then fill the buffer, later, at the proper - time. As expected, this macro may be invoked only while the component + and return immediately and then fill the buffer, later, at the proper + time. As expected, this macro may be invoked only while the component is in the OMX_ExecutingState. If nPortIndex does not specify an output - port, the component shall return an error. - + port, the component shall return an error. + The component should return from this call within 5 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @@ -1168,14 +1152,14 @@ /** The OMX_UseEGLImage macro will request that the component use a EGLImage provided by EGL (and allocate its own buffer header) This is a blocking call. - + The component should return from this call within 20 msec. - + @param [in] hComponent Handle of the component to be accessed. This is the component handle returned by the call to the OMX_GetHandle function. @param [out] ppBuffer - pointer to an OMX_BUFFERHEADERTYPE structure used to receive the + pointer to an OMX_BUFFERHEADERTYPE structure used to receive the pointer to the buffer header. Note that the memory location used for this buffer is NOT visible to the IL Client. @param [in] nPortIndex @@ -1183,13 +1167,13 @@ be used with. The port can be found by using the nPortIndex value as an index into the Port Definition array of the component. @param [in] pAppPrivate - pAppPrivate is used to initialize the pAppPrivate member of the + pAppPrivate is used to initialize the pAppPrivate member of the buffer header structure. @param [in] eglImage eglImage contains the handle of the EGLImage to use as a buffer on the - specified port. The component is expected to validate properties of + specified port. The component is expected to validate properties of the EGLImage against the configuration of the port to ensure the component - can use the EGLImage as a buffer. + can use the EGLImage as a buffer. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @@ -1210,8 +1194,8 @@ /** The OMX_Init method is used to initialize the OMX core. It shall be the first call made into OMX and it should only be executed one time without - an interviening OMX_Deinit call. - + an interviening OMX_Deinit call. + The core should return from this call within 20 msec. @return OMX_ERRORTYPE @@ -1222,13 +1206,13 @@ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_Init(void); -/** The OMX_Deinit method is used to deinitialize the OMX core. It shall be - the last call made into OMX. In the event that the core determines that - thare are components loaded when this call is made, the core may return +/** The OMX_Deinit method is used to deinitialize the OMX core. It shall be + the last call made into OMX. In the event that the core determines that + thare are components loaded when this call is made, the core may return with an error rather than try to unload the components. - + The core should return from this call within 20 msec. - + @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @@ -1245,23 +1229,23 @@ installation of new components, it is only requried to detect newly installed components when the first call to enumerate component names is made (i.e. when nIndex is 0x0). - + The core should return from this call in 20 msec. - + @param [out] cComponentName pointer to a null terminated string with the component name. The names of the components are strings less than 127 bytes in length - plus the trailing null for a maximum size of 128 bytes. An example - of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are - assigned by the vendor, but shall start with "OMX." and then have + plus the trailing null for a maximum size of 128 bytes. An example + of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are + assigned by the vendor, but shall start with "OMX." and then have the Vendor designation next. @param [in] nNameLength - number of characters in the cComponentName string. With all - component name strings restricted to less than 128 characters + number of characters in the cComponentName string. With all + component name strings restricted to less than 128 characters (including the trailing null) it is recomended that the caller provide a input string for the cComponentName of 128 characters. @param [in] nIndex - number containing the enumeration index for the component. + number containing the enumeration index for the component. Multiple calls to OMX_ComponentNameEnum with increasing values of nIndex will enumerate through the component names in the system until OMX_ErrorNoMore is returned. The value of nIndex @@ -1269,7 +1253,7 @@ in the system. @return OMX_ERRORTYPE If the command successfully executes, the return code will be - OMX_ErrorNone. When the value of nIndex exceeds the number of + OMX_ErrorNone. When the value of nIndex exceeds the number of components in the system minus 1, OMX_ErrorNoMore will be returned. Otherwise the appropriate OMX error will be returned. @ingroup core @@ -1282,18 +1266,18 @@ /** The OMX_GetHandle method will locate the component specified by the component name given, load that component into memory and then invoke - the component's methods to create an instance of the component. - + the component's methods to create an instance of the component. + The core should return from this call within 20 msec. - + @param [out] pHandle pointer to an OMX_HANDLETYPE pointer to be filled in by this method. @param [in] cComponentName pointer to a null terminated string with the component name. The names of the components are strings less than 127 bytes in length - plus the trailing null for a maximum size of 128 bytes. An example - of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are - assigned by the vendor, but shall start with "OMX." and then have + plus the trailing null for a maximum size of 128 bytes. An example + of a valid component name is "OMX.TI.AUDIO.DSP.MIXER\0". Names are + assigned by the vendor, but shall start with "OMX." and then have the Vendor designation next. @param [in] pAppData pointer to an application defined value that will be returned @@ -1301,24 +1285,24 @@ of the callback. @param [in] pCallBacks pointer to a OMX_CALLBACKTYPE structure that will be passed to the - component to initialize it with. + component to initialize it with. @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. @ingroup core */ OMX_API OMX_ERRORTYPE OMX_APIENTRY OMX_GetHandle( - OMX_OUT OMX_HANDLETYPE* pHandle, + OMX_OUT OMX_HANDLETYPE* pHandle, OMX_IN OMX_STRING cComponentName, OMX_IN OMX_PTR pAppData, OMX_IN OMX_CALLBACKTYPE* pCallBacks); -/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle +/** The OMX_FreeHandle method will free a handle allocated by the OMX_GetHandle method. If the component reference count goes to zero, the component will - be unloaded from memory. - - The core should return from this call within 20 msec when the component is + be unloaded from memory. + + The core should return from this call within 20 msec when the component is in the OMX_StateLoaded state. @param [in] hComponent @@ -1337,34 +1321,34 @@ /** The OMX_SetupTunnel method will handle the necessary calls to the components to setup the specified tunnel the two components. NOTE: This is an actual method (not a #define macro). This method will make calls into - the component ComponentTunnelRequest method to do the actual tunnel - connection. + the component ComponentTunnelRequest method to do the actual tunnel + connection. - The ComponentTunnelRequest method on both components will be called. - This method shall not be called unless the component is in the + The ComponentTunnelRequest method on both components will be called. + This method shall not be called unless the component is in the OMX_StateLoaded state except when the ports used for the tunnel are disabled. In this case, the component may be in the OMX_StateExecuting, - OMX_StatePause, or OMX_StateIdle states. + OMX_StatePause, or OMX_StateIdle states. The core should return from this call within 20 msec. - + @param [in] hOutput Handle of the component to be accessed. Also this is the handle of the component whose port, specified in the nPortOutput parameter will be used the source for the tunnel. This is the component handle - returned by the call to the OMX_GetHandle function. There is a + returned by the call to the OMX_GetHandle function. There is a requirement that hOutput be the source for the data when tunelling (i.e. nPortOutput is an output port). If 0x0, the component specified in hInput will have it's port specified in nPortInput setup for communication with the application / IL client. @param [in] nPortOutput nPortOutput is used to select the source port on component to be - used in the tunnel. + used in the tunnel. @param [in] hInput This is the component to setup the tunnel with. This is the handle of the component whose port, specified in the nPortInput parameter will be used the destination for the tunnel. This is the component handle - returned by the call to the OMX_GetHandle function. There is a + returned by the call to the OMX_GetHandle function. There is a requirement that hInput be the destination for the data when tunelling (i.e. nPortInut is an input port). If 0x0, the component specified in hOutput will have it's port specified in nPortPOutput @@ -1375,9 +1359,9 @@ @return OMX_ERRORTYPE If the command successfully executes, the return code will be OMX_ErrorNone. Otherwise the appropriate OMX error will be returned. - When OMX_ErrorNotImplemented is returned, one or both components is + When OMX_ErrorNotImplemented is returned, one or both components is a non-interop component and does not support tunneling. - + On failure, the ports of both components are setup for communication with the application / IL Client. @ingroup core tun @@ -1387,50 +1371,50 @@ OMX_IN OMX_U32 nPortOutput, OMX_IN OMX_HANDLETYPE hInput, OMX_IN OMX_U32 nPortInput); - + /** @ingroup cp */ OMX_API OMX_ERRORTYPE OMX_GetContentPipe( OMX_OUT OMX_HANDLETYPE *hPipe, OMX_IN OMX_STRING szURI); /** The OMX_GetComponentsOfRole method will return the number of components that support the given - role and (if the compNames field is non-NULL) the names of those components. The call will fail if + role and (if the compNames field is non-NULL) the names of those components. The call will fail if an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the client should: * first call this function with the compNames field NULL to determine the number of component names - * second call this function with the compNames field pointing to an array of names allocated + * second call this function with the compNames field pointing to an array of names allocated according to the number returned by the first call. The core should return from this call within 5 msec. - + @param [in] role - This is generic standard component name consisting only of component class + This is generic standard component name consisting only of component class name and the type within that class (e.g. 'audio_decoder.aac'). @param [inout] pNumComps - This is used both as input and output. - + This is used both as input and output. + If compNames is NULL, the input is ignored and the output specifies how many components support the given role. - - If compNames is not NULL, on input it bounds the size of the input structure and + + If compNames is not NULL, on input it bounds the size of the input structure and on output, it specifies the number of components string names listed within the compNames parameter. @param [inout] compNames - If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts - a list of the names of all physical components that implement the specified standard component name. + If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings which accepts + a list of the names of all physical components that implement the specified standard component name. Each name is NULL terminated. numComps indicates the number of names. @ingroup core */ -OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( - OMX_IN OMX_STRING role, +OMX_API OMX_ERRORTYPE OMX_GetComponentsOfRole ( + OMX_IN OMX_STRING role, OMX_INOUT OMX_U32 *pNumComps, OMX_INOUT OMX_U8 **compNames); /** The OMX_GetRolesOfComponent method will return the number of roles supported by the given - component and (if the roles field is non-NULL) the names of those roles. The call will fail if + component and (if the roles field is non-NULL) the names of those roles. The call will fail if an insufficiently sized array of names is supplied. To ensure the array is sufficiently sized the client should: * first call this function with the roles field NULL to determine the number of role names - * second call this function with the roles field pointing to an array of names allocated + * second call this function with the roles field pointing to an array of names allocated according to the number returned by the first call. The core should return from this call within 5 msec. @@ -1438,20 +1422,20 @@ @param [in] compName This is the name of the component being queried about. @param [inout] pNumRoles - This is used both as input and output. - + This is used both as input and output. + If roles is NULL, the input is ignored and the output specifies how many roles the component supports. - - If compNames is not NULL, on input it bounds the size of the input structure and + + If compNames is not NULL, on input it bounds the size of the input structure and on output, it specifies the number of roles string names listed within the roles parameter. @param [out] roles - If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings - which accepts a list of the names of all standard components roles implemented on the + If NULL this field is ignored. If non-NULL this points to an array of 128-byte strings + which accepts a list of the names of all standard components roles implemented on the specified component name. numComps indicates the number of names. @ingroup core */ -OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( - OMX_IN OMX_STRING compName, +OMX_API OMX_ERRORTYPE OMX_GetRolesOfComponent ( + OMX_IN OMX_STRING compName, OMX_INOUT OMX_U32 *pNumRoles, OMX_OUT OMX_U8 **roles); diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Image.h android-platform-frameworks-native-21/include/media/openmax/OMX_Image.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Image.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Image.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,30 +16,30 @@ * ------------------------------------------------------------------- */ /** - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. */ -/** +/** * @file OMX_Image.h - OpenMax IL version 1.1.2 - * The structures needed by Image components to exchange parameters and + * The structures needed by Image components to exchange parameters and * configuration data with the components. */ #ifndef OMX_Image_h @@ -51,9 +51,9 @@ /** - * Each OMX header must include all required header files to allow the - * header to compile without errors. The includes below are required - * for this header file to compile successfully + * Each OMX header must include all required header files to allow the + * header to compile without errors. The includes below are required + * for this header file to compile successfully */ #include @@ -64,8 +64,8 @@ * @{ */ -/** - * Enumeration used to define the possible image compression coding. +/** + * Enumeration used to define the possible image compression coding. */ typedef enum OMX_IMAGE_CODINGTYPE { OMX_IMAGE_CodingUnused, /**< Value when format is N/A */ @@ -78,59 +78,59 @@ OMX_IMAGE_CodingPNG, /**< PNG image format */ OMX_IMAGE_CodingLZW, /**< LZW image format */ OMX_IMAGE_CodingBMP, /**< Windows Bitmap format */ - OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_IMAGE_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_IMAGE_CodingMax = 0x7FFFFFFF } OMX_IMAGE_CODINGTYPE; /** - * Data structure used to define an image path. The number of image paths - * for input and output will vary by type of the image component. - * + * Data structure used to define an image path. The number of image paths + * for input and output will vary by type of the image component. + * * Input (aka Source) : Zero Inputs, one Output, * Splitter : One Input, 2 or more Outputs, * Processing Element : One Input, one output, * Mixer : 2 or more inputs, one output, * Output (aka Sink) : One Input, zero outputs. - * - * The PortDefinition structure is used to define all of the parameters - * necessary for the compliant component to setup an input or an output - * image path. If additional vendor specific data is required, it should - * be transmitted to the component using the CustomCommand function. - * Compliant components will prepopulate this structure with optimal + * + * The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output + * image path. If additional vendor specific data is required, it should + * be transmitted to the component using the CustomCommand function. + * Compliant components will prepopulate this structure with optimal * values during the OMX_GetParameter() command. * * STRUCT MEMBERS: * cMIMEType : MIME type of data for the port - * pNativeRender : Platform specific reference for a display if a + * pNativeRender : Platform specific reference for a display if a * sync, otherwise this field is 0 - * nFrameWidth : Width of frame to be used on port if - * uncompressed format is used. Use 0 for + * nFrameWidth : Width of frame to be used on port if + * uncompressed format is used. Use 0 for * unknown, don't care or variable - * nFrameHeight : Height of frame to be used on port if - * uncompressed format is used. Use 0 for + * nFrameHeight : Height of frame to be used on port if + * uncompressed format is used. Use 0 for * unknown, don't care or variable - * nStride : Number of bytes per span of an image (i.e. + * nStride : Number of bytes per span of an image (i.e. * indicates the number of bytes to get from - * span N to span N+1, where negative stride + * span N to span N+1, where negative stride * indicates the image is bottom up * nSliceHeight : Height used when encoding in slices - * bFlagErrorConcealment : Turns on error concealment if it is supported by + * bFlagErrorConcealment : Turns on error concealment if it is supported by * the OMX component - * eCompressionFormat : Compression format used in this instance of - * the component. When OMX_IMAGE_CodingUnused is + * eCompressionFormat : Compression format used in this instance of + * the component. When OMX_IMAGE_CodingUnused is * specified, eColorFormat is valid * eColorFormat : Decompressed format used by this component - * pNativeWindow : Platform specific reference for a window object if a - * display sink , otherwise this field is 0x0. + * pNativeWindow : Platform specific reference for a window object if a + * display sink , otherwise this field is 0x0. */ typedef struct OMX_IMAGE_PORTDEFINITIONTYPE { OMX_STRING cMIMEType; OMX_NATIVE_DEVICETYPE pNativeRender; - OMX_U32 nFrameWidth; + OMX_U32 nFrameWidth; OMX_U32 nFrameHeight; - OMX_S32 nStride; + OMX_S32 nStride; OMX_U32 nSliceHeight; OMX_BOOL bFlagErrorConcealment; OMX_IMAGE_CODINGTYPE eCompressionFormat; @@ -139,18 +139,18 @@ } OMX_IMAGE_PORTDEFINITIONTYPE; -/** - * Port format parameter. This structure is used to enumerate the various +/** + * Port format parameter. This structure is used to enumerate the various * data input/output format supported by the port. - * + * * STRUCT MEMBERS: * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Indicates which port to set - * nIndex : Indicates the enumeration index for the format from + * nIndex : Indicates the enumeration index for the format from * 0x0 to N-1 - * eCompressionFormat : Compression format used in this instance of the - * component. When OMX_IMAGE_CodingUnused is specified, + * eCompressionFormat : Compression format used in this instance of the + * component. When OMX_IMAGE_CodingUnused is specified, * eColorFormat is valid * eColorFormat : Decompressed format used by this component */ @@ -164,8 +164,8 @@ } OMX_IMAGE_PARAM_PORTFORMATTYPE; -/** - * Flash control type +/** + * Flash control type * * ENUMS * Torch : Flash forced constantly on @@ -177,14 +177,14 @@ OMX_IMAGE_FlashControlRedEyeReduction, OMX_IMAGE_FlashControlFillin, OMX_IMAGE_FlashControlTorch, - OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_FlashControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_IMAGE_FlashControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_IMAGE_FlashControlMax = 0x7FFFFFFF } OMX_IMAGE_FLASHCONTROLTYPE; -/** - * Flash control configuration +/** + * Flash control configuration * * STRUCT MEMBERS: * nSize : Size of the structure in bytes @@ -200,29 +200,29 @@ } OMX_IMAGE_PARAM_FLASHCONTROLTYPE; -/** - * Focus control type +/** + * Focus control type */ typedef enum OMX_IMAGE_FOCUSCONTROLTYPE { OMX_IMAGE_FocusControlOn = 0, OMX_IMAGE_FocusControlOff, OMX_IMAGE_FocusControlAuto, OMX_IMAGE_FocusControlAutoLock, - OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_FocusControlKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_IMAGE_FocusControlVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_IMAGE_FocusControlMax = 0x7FFFFFFF } OMX_IMAGE_FOCUSCONTROLTYPE; - -/** - * Focus control configuration + +/** + * Focus control configuration * * STRUCT MEMBERS: * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * eFocusControl : Focus control - * nFocusSteps : Focus can take on values from 0 mm to infinity. + * nFocusSteps : Focus can take on values from 0 mm to infinity. * Interest is only in number of steps over this range. * nFocusStepIndex : Current focus step index */ @@ -236,30 +236,30 @@ } OMX_IMAGE_CONFIG_FOCUSCONTROLTYPE; -/** +/** * Q Factor for JPEG compression, which controls the tradeoff between image * quality and size. Q Factor provides a more simple means of controlling * JPEG compression quality, without directly programming Quantization - * tables for chroma and luma + * tables for chroma and luma * * STRUCT MEMBERS: - * nSize : Size of the structure in bytes - * nVersion : OMX specification version information - * nPortIndex : Port that this structure applies to - * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1 - * produces the smallest, worst quality images, and a factor - * of 100 produces the largest, best quality images. A - * typical default is 75 for small good quality images + * nSize : Size of the structure in bytes + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to + * nQFactor : JPEG Q factor value in the range of 1-100. A factor of 1 + * produces the smallest, worst quality images, and a factor + * of 100 produces the largest, best quality images. A + * typical default is 75 for small good quality images */ typedef struct OMX_IMAGE_PARAM_QFACTORTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_U32 nQFactor; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nQFactor; } OMX_IMAGE_PARAM_QFACTORTYPE; -/** - * Quantization table type +/** + * Quantization table type */ typedef enum OMX_IMAGE_QUANTIZATIONTABLETYPE { @@ -267,27 +267,27 @@ OMX_IMAGE_QuantizationTableChroma, OMX_IMAGE_QuantizationTableChromaCb, OMX_IMAGE_QuantizationTableChromaCr, - OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_QuantizationTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_IMAGE_QuantizationTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_IMAGE_QuantizationTableMax = 0x7FFFFFFF } OMX_IMAGE_QUANTIZATIONTABLETYPE; -/** +/** * JPEG quantization tables are used to determine DCT compression for - * YUV data, as an alternative to specifying Q factor, providing exact - * control of compression + * YUV data, as an alternative to specifying Q factor, providing exact + * control of compression * * STRUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version information + * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * eQuantizationTable : Quantization table type - * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored - * in increasing columns then by rows of data (i.e. - * row 1, ... row 8). Quantization values are in + * nQuantizationMatrix[64] : JPEG quantization table of coefficients stored + * in increasing columns then by rows of data (i.e. + * row 1, ... row 8). Quantization values are in * the range 0-255 and stored in linear order - * (i.e. the component will zig-zag the - * quantization table data if required internally) + * (i.e. the component will zig-zag the + * quantization table data if required internally) */ typedef struct OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE { OMX_U32 nSize; @@ -298,9 +298,9 @@ } OMX_IMAGE_PARAM_QUANTIZATIONTABLETYPE; -/** - * Huffman table type, the same Huffman table is applied for chroma and - * luma component +/** + * Huffman table type, the same Huffman table is applied for chroma and + * luma component */ typedef enum OMX_IMAGE_HUFFMANTABLETYPE { OMX_IMAGE_HuffmanTableAC = 0, @@ -309,23 +309,23 @@ OMX_IMAGE_HuffmanTableACChroma, OMX_IMAGE_HuffmanTableDCLuma, OMX_IMAGE_HuffmanTableDCChroma, - OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IMAGE_HuffmanTableKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_IMAGE_HuffmanTableVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_IMAGE_HuffmanTableMax = 0x7FFFFFFF } OMX_IMAGE_HUFFMANTABLETYPE; -/** - * JPEG Huffman table +/** + * JPEG Huffman table * * STRUCT MEMBERS: * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * eHuffmanTable : Huffman table type - * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each + * nNumberOfHuffmanCodeOfLength[16] : 0-16, number of Huffman codes of each * possible length - * nHuffmanTable[256] : 0-255, the size used for AC and DC - * HuffmanTable are 16 and 162 + * nHuffmanTable[256] : 0-255, the size used for AC and DC + * HuffmanTable are 16 and 162 */ typedef struct OMX_IMAGE_PARAM_HUFFMANTTABLETYPE { OMX_U32 nSize; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_IndexExt.h android-platform-frameworks-native-21/include/media/openmax/OMX_IndexExt.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_IndexExt.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_IndexExt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,101 +0,0 @@ -/* - * Copyright (c) 2010 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -/** @file OMX_IndexExt.h - OpenMax IL version 1.1.2 - * The OMX_IndexExt header file contains extensions to the definitions - * for both applications and components . - */ - -#ifndef OMX_IndexExt_h -#define OMX_IndexExt_h - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Each OMX header shall include all required header files to allow the - * header to compile without errors. The includes below are required - * for this header file to compile successfully - */ -#include - - -/** Khronos standard extension indices. - -This enum lists the current Khronos extension indices to OpenMAX IL. -*/ -typedef enum OMX_INDEXEXTTYPE { - - /* Component parameters and configurations */ - OMX_IndexExtComponentStartUnused = OMX_IndexKhronosExtensions + 0x00100000, - OMX_IndexConfigCallbackRequest, /**< reference: OMX_CONFIG_CALLBACKREQUESTTYPE */ - OMX_IndexConfigCommitMode, /**< reference: OMX_CONFIG_COMMITMODETYPE */ - OMX_IndexConfigCommit, /**< reference: OMX_CONFIG_COMMITTYPE */ - - /* Port parameters and configurations */ - OMX_IndexExtPortStartUnused = OMX_IndexKhronosExtensions + 0x00200000, - - /* Audio parameters and configurations */ - OMX_IndexExtAudioStartUnused = OMX_IndexKhronosExtensions + 0x00400000, - OMX_IndexParamAudioAndroidAc3, /**< reference: OMX_AUDIO_PARAM_ANDROID_AC3TYPE */ - OMX_IndexParamAudioAndroidOpus, /**< reference: OMX_AUDIO_PARAM_ANDROID_OPUSTYPE */ - OMX_IndexParamAudioAndroidAacPresentation, /**< reference: OMX_AUDIO_PARAM_ANDROID_AACPRESENTATIONTYPE */ - OMX_IndexParamAudioAndroidEac3, /**< reference: OMX_AUDIO_PARAM_ANDROID_EAC3TYPE */ - - /* Image parameters and configurations */ - OMX_IndexExtImageStartUnused = OMX_IndexKhronosExtensions + 0x00500000, - - /* Video parameters and configurations */ - OMX_IndexExtVideoStartUnused = OMX_IndexKhronosExtensions + 0x00600000, - OMX_IndexParamNalStreamFormatSupported, /**< reference: OMX_NALSTREAMFORMATTYPE */ - OMX_IndexParamNalStreamFormat, /**< reference: OMX_NALSTREAMFORMATTYPE */ - OMX_IndexParamNalStreamFormatSelect, /**< reference: OMX_NALSTREAMFORMATTYPE */ - OMX_IndexParamVideoVp8, /**< reference: OMX_VIDEO_PARAM_VP8TYPE */ - OMX_IndexConfigVideoVp8ReferenceFrame, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMETYPE */ - OMX_IndexConfigVideoVp8ReferenceFrameType, /**< reference: OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE */ - OMX_IndexParamVideoAndroidVp8Encoder, /**< reference: OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE */ - OMX_IndexParamVideoHevc, /**< reference: OMX_VIDEO_PARAM_HEVCTYPE */ - OMX_IndexParamSliceSegments, /**< reference: OMX_VIDEO_SLICESEGMENTSTYPE */ - - /* Image & Video common configurations */ - OMX_IndexExtCommonStartUnused = OMX_IndexKhronosExtensions + 0x00700000, - - /* Other configurations */ - OMX_IndexExtOtherStartUnused = OMX_IndexKhronosExtensions + 0x00800000, - OMX_IndexConfigAutoFramerateConversion, /**< reference: OMX_CONFIG_BOOLEANTYPE */ - OMX_IndexConfigPriority, /**< reference: OMX_PARAM_U32TYPE */ - OMX_IndexConfigOperatingRate, /**< reference: OMX_PARAM_U32TYPE in Q16 format for video and in Hz for audio */ - OMX_IndexParamConsumerUsageBits, /**< reference: OMX_PARAM_U32TYPE */ - - /* Time configurations */ - OMX_IndexExtTimeStartUnused = OMX_IndexKhronosExtensions + 0x00900000, - - OMX_IndexExtMax = 0x7FFFFFFF -} OMX_INDEXEXTTYPE; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* OMX_IndexExt_h */ -/* File EOF */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Index.h android-platform-frameworks-native-21/include/media/openmax/OMX_Index.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Index.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Index.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,25 +16,25 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -51,23 +51,25 @@ extern "C" { #endif /* __cplusplus */ + /* Each OMX header must include all required header files to allow the * header to compile without errors. The includes below are required - * for this header file to compile successfully + * for this header file to compile successfully */ #include + /** The OMX_INDEXTYPE enumeration is used to select a structure when either - * getting or setting parameters and/or configuration data. Each entry in - * this enumeration maps to an OMX specified structure. When the + * getting or setting parameters and/or configuration data. Each entry in + * this enumeration maps to an OMX specified structure. When the * OMX_GetParameter, OMX_SetParameter, OMX_GetConfig or OMX_SetConfig methods * are used, the second parameter will always be an entry from this enumeration * and the third entry will be the structure shown in the comments for the entry. - * For example, if the application is initializing a cropping function, the - * OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter - * and would send a pointer to an initialized OMX_RECTTYPE structure as the + * For example, if the application is initializing a cropping function, the + * OMX_SetConfig command would have OMX_IndexConfigCommonInputCrop as the second parameter + * and would send a pointer to an initialized OMX_RECTTYPE structure as the * third parameter. - * + * * The enumeration entries named with the OMX_Config prefix are sent using * the OMX_SetConfig command and the enumeration entries named with the * OMX_PARAM_ prefix are sent using the OMX_SetParameter command. @@ -84,11 +86,11 @@ OMX_IndexParamActiveStream, /**< reference: OMX_PARAM_U32TYPE */ OMX_IndexParamSuspensionPolicy, /**< reference: OMX_PARAM_SUSPENSIONPOLICYTYPE */ OMX_IndexParamComponentSuspended, /**< reference: OMX_PARAM_SUSPENSIONTYPE */ - OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */ - OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */ - OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */ + OMX_IndexConfigCapturing, /**< reference: OMX_CONFIG_BOOLEANTYPE */ + OMX_IndexConfigCaptureMode, /**< reference: OMX_CONFIG_CAPTUREMODETYPE */ + OMX_IndexAutoPauseAfterCapture, /**< reference: OMX_CONFIG_BOOLEANTYPE */ OMX_IndexParamContentURI, /**< reference: OMX_PARAM_CONTENTURITYPE */ - OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */ + OMX_IndexParamCustomContentPipe, /**< reference: OMX_PARAM_CONTENTPIPETYPE */ OMX_IndexParamDisableResourceConcealment, /**< reference: OMX_RESOURCECONCEALMENTTYPE */ OMX_IndexConfigMetadataItemCount, /**< reference: OMX_CONFIG_METADATAITEMCOUNTTYPE */ OMX_IndexConfigContainerNodeCount, /**< reference: OMX_CONFIG_CONTAINERNODECOUNTTYPE */ @@ -101,7 +103,7 @@ OMX_IndexPortStartUnused = 0x02000000, OMX_IndexParamPortDefinition, /**< reference: OMX_PARAM_PORTDEFINITIONTYPE */ - OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */ + OMX_IndexParamCompBufferSupplier, /**< reference: OMX_PARAM_BUFFERSUPPLIERTYPE */ OMX_IndexReservedStartUnused = 0x03000000, /* Audio parameters and configurations */ @@ -254,10 +256,10 @@ OMX_IndexConfigTimeSeekMode, /**< reference: OMX_TIME_CONFIG_SEEKMODETYPE */ - OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_IndexKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ /* Vendor specific area */ OMX_IndexVendorStartUnused = 0x7F000000, - /* Vendor specific structures should be in the range of 0x7F000000 + /* Vendor specific structures should be in the range of 0x7F000000 to 0x7FFFFFFE. This range is not broken out by vendor, so private indexes are not guaranteed unique and therefore should only be sent to the appropriate component. */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_IVCommon.h android-platform-frameworks-native-21/include/media/openmax/OMX_IVCommon.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_IVCommon.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_IVCommon.h 2012-10-16 22:57:11.000000000 +0000 @@ -157,19 +157,8 @@ * an acceptable range once that is done. * */ OMX_COLOR_FormatAndroidOpaque = 0x7F000789, - OMX_COLOR_Format32BitRGBA8888 = 0x7F00A000, - /** Flexible 8-bit YUV format. Codec should report this format - * as being supported if it supports any YUV420 packed planar - * or semiplanar formats. When port is set to use this format, - * codec can substitute any YUV420 packed planar or semiplanar - * format for it. */ - OMX_COLOR_FormatYUV420Flexible = 0x7F420888, - OMX_TI_COLOR_FormatYUV420PackedSemiPlanar = 0x7F000100, OMX_QCOM_COLOR_FormatYVU420SemiPlanar = 0x7FA30C00, - OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar64x32Tile2m8ka = 0x7FA30C03, - OMX_SEC_COLOR_FormatNV12Tiled = 0x7FC00002, - OMX_QCOM_COLOR_FormatYUV420PackedSemiPlanar32m = 0x7FA30C04, OMX_COLOR_FormatMax = 0x7FFFFFFF } OMX_COLOR_FORMATTYPE; @@ -846,7 +835,7 @@ typedef enum OMX_METERINGTYPE { OMX_MeteringModeAverage, /**< Center-weighted average metering. */ - OMX_MeteringModeSpot, /**< Spot (partial) metering. */ + OMX_MeteringModeSpot, /**< Spot (partial) metering. */ OMX_MeteringModeMatrix, /**< Matrix or evaluative metering. */ OMX_MeteringKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ @@ -861,11 +850,11 @@ OMX_METERINGTYPE eMetering; OMX_S32 xEVCompensation; /**< Fixed point value stored as Q16 */ OMX_U32 nApertureFNumber; /**< e.g. nApertureFNumber = 2 implies "f/2" - Q16 format */ - OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */ + OMX_BOOL bAutoAperture; /**< Whether aperture number is defined automatically */ OMX_U32 nShutterSpeedMsec; /**< Shutterspeed in milliseconds */ - OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */ + OMX_BOOL bAutoShutterSpeed; /**< Whether shutter speed is defined automatically */ OMX_U32 nSensitivity; /**< e.g. nSensitivity = 100 implies "ISO 100" */ - OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */ + OMX_BOOL bAutoSensitivity; /**< Whether sensitivity is defined automatically */ } OMX_CONFIG_EXPOSUREVALUETYPE; /** diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Other.h android-platform-frameworks-native-21/include/media/openmax/OMX_Other.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Other.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Other.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,25 +16,25 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ @@ -53,46 +53,46 @@ /* Each OMX header must include all required header files to allow the * header to compile without errors. The includes below are required - * for this header file to compile successfully + * for this header file to compile successfully */ #include -/** +/** * Enumeration of possible data types which match to multiple domains or no * domain at all. For types which are vendor specific, a value above * OMX_OTHER_VENDORTSTART should be used. */ typedef enum OMX_OTHER_FORMATTYPE { - OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, + OMX_OTHER_FormatTime = 0, /**< Transmission of various timestamps, elapsed time, time deltas, etc */ - OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power + OMX_OTHER_FormatPower, /**< Perhaps used for enabling/disabling power management, setting clocks? */ - OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames + OMX_OTHER_FormatStats, /**< Could be things such as frame rate, frames dropped, etc */ OMX_OTHER_FormatBinary, /**< Arbitrary binary data */ - OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific + OMX_OTHER_FormatVendorReserved = 1000, /**< Starting value for vendor specific formats */ - OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_OTHER_FormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_OTHER_FormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_OTHER_FormatMax = 0x7FFFFFFF } OMX_OTHER_FORMATTYPE; -/** +/** * Enumeration of seek modes. */ typedef enum OMX_TIME_SEEKMODETYPE { OMX_TIME_SeekModeFast = 0, /**< Prefer seeking to an approximation - * of the requested seek position over + * of the requested seek position over * the actual seek position if it * results in a faster seek. */ - OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek + OMX_TIME_SeekModeAccurate, /**< Prefer seeking to the actual seek * position over an approximation * of the requested seek position even * if it results in a slower seek. */ - OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_SeekModeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_TIME_SeekModeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_TIME_SeekModeMax = 0x7FFFFFFF } OMX_TIME_SEEKMODETYPE; @@ -104,42 +104,42 @@ OMX_TIME_SEEKMODETYPE eType; /**< The seek mode */ } OMX_TIME_CONFIG_SEEKMODETYPE; -/** Structure representing a time stamp used with the following configs +/** Structure representing a time stamp used with the following configs * on the Clock Component (CC): - * - * OMX_IndexConfigTimeCurrentWallTime: query of the CC's current wall + * + * OMX_IndexConfigTimeCurrentWallTime: query of the CC’s current wall * time - * OMX_IndexConfigTimeCurrentMediaTime: query of the CC's current media + * OMX_IndexConfigTimeCurrentMediaTime: query of the CC’s current media * time - * OMX_IndexConfigTimeCurrentAudioReference and - * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference + * OMX_IndexConfigTimeCurrentAudioReference and + * OMX_IndexConfigTimeCurrentVideoReference: audio/video reference * clock sending SC its reference time - * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends - * this structure to the Clock Component via a SetConfig on its + * OMX_IndexConfigTimeClientStartTime: a Clock Component client sends + * this structure to the Clock Component via a SetConfig on its * client port when it receives a buffer with * OMX_BUFFERFLAG_STARTTIME set. It must use the timestamp - * specified by that buffer for nStartTimestamp. + * specified by that buffer for nStartTimestamp. * - * It's also used with the following config on components in general: + * It’s also used with the following config on components in general: * - * OMX_IndexConfigTimePosition: IL client querying component position + * OMX_IndexConfigTimePosition: IL client querying component position * (GetConfig) or commanding a component to seek to the given location * (SetConfig) - */ + */ typedef struct OMX_TIME_CONFIG_TIMESTAMPTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version * information */ - OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_TICKS nTimestamp; /**< timestamp .*/ -} OMX_TIME_CONFIG_TIMESTAMPTYPE; + OMX_U32 nPortIndex; /**< port that this structure applies to */ + OMX_TICKS nTimestamp; /**< timestamp .*/ +} OMX_TIME_CONFIG_TIMESTAMPTYPE; /** Enumeration of possible reference clocks to the media time. */ typedef enum OMX_TIME_UPDATETYPE { OMX_TIME_UpdateRequestFulfillment, /**< Update is the fulfillment of a media time request. */ - OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */ + OMX_TIME_UpdateScaleChanged, /**< Update was generated because the scale chagned. */ OMX_TIME_UpdateClockStateChanged, /**< Update was generated because the clock state changed. */ - OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_UpdateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_TIME_UpdateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_TIME_UpdateMax = 0x7FFFFFFF } OMX_TIME_UPDATETYPE; @@ -147,9 +147,9 @@ /** Enumeration of possible reference clocks to the media time. */ typedef enum OMX_TIME_REFCLOCKTYPE { OMX_TIME_RefClockNone, /**< Use no references. */ - OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */ + OMX_TIME_RefClockAudio, /**< Use references sent through OMX_IndexConfigTimeCurrentAudioReference */ OMX_TIME_RefClockVideo, /**< Use references sent through OMX_IndexConfigTimeCurrentVideoReference */ - OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_RefClockKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_TIME_RefClockVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_TIME_RefClockMax = 0x7FFFFFFF } OMX_TIME_REFCLOCKTYPE; @@ -157,11 +157,11 @@ /** Enumeration of clock states. */ typedef enum OMX_TIME_CLOCKSTATE { OMX_TIME_ClockStateRunning, /**< Clock running. */ - OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the + OMX_TIME_ClockStateWaitingForStartTime, /**< Clock waiting until the * prescribed clients emit their * start time. */ OMX_TIME_ClockStateStopped, /**< Clock stopped. */ - OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_TIME_ClockStateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_TIME_ClockStateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_TIME_ClockStateMax = 0x7FFFFFFF } OMX_TIME_CLOCKSTATE; @@ -171,18 +171,18 @@ * A client component sends this structure to the Clock Component via a SetConfig * on its client port to specify a media timestamp the Clock Component * should emit. The Clock Component should fulfill the request by sending a - * OMX_TIME_MEDIATIMETYPE when its media clock matches the requested + * OMX_TIME_MEDIATIMETYPE when its media clock matches the requested * timestamp. * * The client may require a media time request be fulfilled slightly - * earlier than the media time specified. In this case the client specifies - * an offset which is equal to the difference between wall time corresponding - * to the requested media time and the wall time when it will be - * fulfilled. + * earlier than the media time specified. In this case the client specifies + * an offset which is equal to the difference between wall time corresponding + * to the requested media time and the wall time when it will be + * fulfilled. * * A client component may uses these requests and the OMX_TIME_MEDIATIMETYPE to * time events according to timestamps. If a client must perform an operation O at - * a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a + * a time T (e.g. deliver a video frame at its corresponding timestamp), it makes a * media time request at T (perhaps specifying an offset to ensure the request fulfillment * is a little early). When the clock component passes the resulting OMX_TIME_MEDIATIMETYPE * structure back to the client component, the client may perform operation O (perhaps having @@ -193,52 +193,52 @@ OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_U32 nPortIndex; /**< port that this structure applies to */ - OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time - * from others (e.g. the number of the frame to deliver). - * Duplicated in the media time structure that fulfills - * this request. A value of zero is reserved for time scale + OMX_PTR pClientPrivate; /**< Client private data to disabiguate this media time + * from others (e.g. the number of the frame to deliver). + * Duplicated in the media time structure that fulfills + * this request. A value of zero is reserved for time scale * updates. */ - OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/ + OMX_TICKS nMediaTimestamp; /**< Media timestamp requested.*/ OMX_TICKS nOffset; /**< Amount of wall clock time by which this * request should be fulfilled early */ } OMX_TIME_CONFIG_MEDIATIMEREQUESTTYPE; -/**< Structure sent from the clock component client either when fulfilling - * a media time request or when the time scale has changed. +/**< Structure sent from the clock component client either when fulfilling + * a media time request or when the time scale has changed. * - * In the former case the Clock Component fills this structure and times its emission - * to a client component (via the client port) according to the corresponding media + * In the former case the Clock Component fills this structure and times its emission + * to a client component (via the client port) according to the corresponding media * time request sent by the client. The Clock Component should time the emission to occur - * when the requested timestamp matches the Clock Component's media time but also the - * prescribed offset early. + * when the requested timestamp matches the Clock Component's media time but also the + * prescribed offset early. * * Upon scale changes the clock component clears the nClientPrivate data, sends the current - * media time and sets the nScale to the new scale via the client port. It emits a - * OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to - * alter processing to accomodate scaling. For instance a video component might skip inter-frames - * in the case of extreme fastforward. Likewise an audio component might add or remove samples - * from an audio frame to scale audio data. + * media time and sets the nScale to the new scale via the client port. It emits a + * OMX_TIME_MEDIATIMETYPE to all clients independent of any requests. This allows clients to + * alter processing to accomodate scaling. For instance a video component might skip inter-frames + * in the case of extreme fastforward. Likewise an audio component might add or remove samples + * from an audio frame to scale audio data. * * It is expected that some clock components may not be able to fulfill requests - * at exactly the prescribed time. This is acceptable so long as the request is - * fulfilled at least as early as described and not later. This structure provides + * at exactly the prescribed time. This is acceptable so long as the request is + * fulfilled at least as early as described and not later. This structure provides * fields the client may use to wait for the remaining time. * - * The client may use either the nOffset or nWallTimeAtMedia fields to determine the + * The client may use either the nOffset or nWallTimeAtMedia fields to determine the * wall time until the nMediaTimestamp actually occurs. In the latter case the * client can get a more accurate value for offset by getting the current wall - * from the cloc component and subtracting it from nWallTimeAtMedia. + * from the cloc component and subtracting it from nWallTimeAtMedia. */ typedef struct OMX_TIME_MEDIATIMETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time - * from others. Copied from the media time request. + OMX_U32 nClientPrivate; /**< Client private data to disabiguate this media time + * from others. Copied from the media time request. * A value of zero is reserved for time scale updates. */ OMX_TIME_UPDATETYPE eUpdateType; /**< Reason for the update */ - OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was - * requested then this is the current media time. */ + OMX_TICKS nMediaTimestamp; /**< Media time requested. If no media time was + * requested then this is the current media time. */ OMX_TICKS nOffset; /**< Amount of wall clock time by which this * request was actually fulfilled early */ @@ -250,21 +250,21 @@ OMX_S32 xScale; /**< Current media time scale in Q16 format. */ OMX_TIME_CLOCKSTATE eState; /* Seeking Change. Added 7/12.*/ /**< State of the media time. */ -} OMX_TIME_MEDIATIMETYPE; +} OMX_TIME_MEDIATIMETYPE; -/** Structure representing the current media time scale factor. Applicable only to clock +/** Structure representing the current media time scale factor. Applicable only to clock * component, other components see scale changes via OMX_TIME_MEDIATIMETYPE buffers sent via - * the clock component client ports. Upon recieving this config the clock component changes - * the rate by which the media time increases or decreases effectively implementing trick modes. - */ + * the clock component client ports. Upon recieving this config the clock component changes + * the rate by which the media time increases or decreases effectively implementing trick modes. + */ typedef struct OMX_TIME_CONFIG_SCALETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ OMX_S32 xScale; /**< This is a value in Q16 format which is used for * scaling the media time */ } OMX_TIME_CONFIG_SCALETYPE; - -/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPE's nWaitMask field */ + +/** Bits used to identify a clock port. Used in OMX_TIME_CONFIG_CLOCKSTATETYPE’s nWaitMask field */ #define OMX_CLOCKPORT0 0x00000001 #define OMX_CLOCKPORT1 0x00000002 #define OMX_CLOCKPORT2 0x00000004 @@ -274,38 +274,38 @@ #define OMX_CLOCKPORT6 0x00000040 #define OMX_CLOCKPORT7 0x00000080 -/** Structure representing the current mode of the media clock. - * IL Client uses this config to change or query the mode of the +/** Structure representing the current mode of the media clock. + * IL Client uses this config to change or query the mode of the * media clock of the clock component. Applicable only to clock - * component. - * + * component. + * * On a SetConfig if eState is OMX_TIME_ClockStateRunning media time * starts immediately at the prescribed start time. If * OMX_TIME_ClockStateWaitingForStartTime the Clock Component ignores - * the given nStartTime and waits for all clients specified in the - * nWaitMask to send starttimes (via - * OMX_IndexConfigTimeClientStartTime). The Clock Component then starts - * the media clock using the earliest start time supplied. */ + * the given nStartTime and waits for all clients specified in the + * nWaitMask to send starttimes (via + * OMX_IndexConfigTimeClientStartTime). The Clock Component then starts + * the media clock using the earliest start time supplied. */ typedef struct OMX_TIME_CONFIG_CLOCKSTATETYPE { OMX_U32 nSize; /**< size of the structure in bytes */ - OMX_VERSIONTYPE nVersion; /**< OMX specification version + OMX_VERSIONTYPE nVersion; /**< OMX specification version * information */ OMX_TIME_CLOCKSTATE eState; /**< State of the media time. */ OMX_TICKS nStartTime; /**< Start time of the media time. */ - OMX_TICKS nOffset; /**< Time to offset the media time by + OMX_TICKS nOffset; /**< Time to offset the media time by * (e.g. preroll). Media time will be - * reported to be nOffset ticks earlier. + * reported to be nOffset ticks earlier. */ OMX_U32 nWaitMask; /**< Mask of OMX_CLOCKPORT values. */ } OMX_TIME_CONFIG_CLOCKSTATETYPE; /** Structure representing the reference clock currently being used to - * compute media time. IL client uses this config to change or query the + * compute media time. IL client uses this config to change or query the * clock component's active reference clock */ typedef struct OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE { OMX_U32 nSize; /**< size of the structure in bytes */ OMX_VERSIONTYPE nVersion; /**< OMX specification version information */ - OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */ + OMX_TIME_REFCLOCKTYPE eClock; /**< Reference clock used to compute media time */ } OMX_TIME_CONFIG_ACTIVEREFCLOCKTYPE; /** Descriptor for setting specifics of power type. @@ -327,8 +327,8 @@ /** - * The PortDefinition structure is used to define all of the parameters - * necessary for the compliant component to setup an input or an output other + * The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output other * path. */ typedef struct OMX_OTHER_PORTDEFINITIONTYPE { @@ -344,7 +344,7 @@ OMX_U32 nPortIndex; /**< Indicates which port to set */ OMX_U32 nIndex; /**< Indicates the enumeration index for the format from 0x0 to N-1 */ OMX_OTHER_FORMATTYPE eFormat; /**< Type of data expected for this channel */ -} OMX_OTHER_PARAM_PORTFORMATTYPE; +} OMX_OTHER_PARAM_PORTFORMATTYPE; #ifdef __cplusplus } diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Types.h android-platform-frameworks-native-21/include/media/openmax/OMX_Types.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Types.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Types.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,40 +16,38 @@ * ------------------------------------------------------------------- */ /* - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ /** OMX_Types.h - OpenMax IL version 1.1.2 - * The OMX_Types header file contains the primitive type definitions used by + * The OMX_Types header file contains the primitive type definitions used by * the core, the application and the component. This file may need to be - * modified to be used on systems that do not have "char" set to 8 bits, + * modified to be used on systems that do not have "char" set to 8 bits, * "short" set to 16 bits and "long" set to 32 bits. */ #ifndef OMX_Types_h #define OMX_Types_h -#include - #ifdef __cplusplus extern "C" { #endif /* __cplusplus */ @@ -57,12 +55,12 @@ /** The OMX_API and OMX_APIENTRY are platform specific definitions used * to declare OMX function prototypes. They are modified to meet the * requirements for a particular platform */ -#ifdef __SYMBIAN32__ +#ifdef __SYMBIAN32__ # ifdef __OMX_EXPORTS # define OMX_API __declspec(dllexport) # else # ifdef _WIN32 -# define OMX_API __declspec(dllexport) +# define OMX_API __declspec(dllexport) # else # define OMX_API __declspec(dllimport) # endif @@ -85,18 +83,18 @@ #endif #ifndef OMX_APIENTRY -#define OMX_APIENTRY -#endif +#define OMX_APIENTRY +#endif -/** OMX_IN is used to identify inputs to an OMX function. This designation - will also be used in the case of a pointer that points to a parameter +/** OMX_IN is used to identify inputs to an OMX function. This designation + will also be used in the case of a pointer that points to a parameter that is used as an output. */ #ifndef OMX_IN #define OMX_IN #endif -/** OMX_OUT is used to identify outputs from an OMX function. This - designation will also be used in the case of a pointer that points +/** OMX_OUT is used to identify outputs from an OMX function. This + designation will also be used in the case of a pointer that points to a parameter that is used as an input. */ #ifndef OMX_OUT #define OMX_OUT @@ -104,8 +102,8 @@ /** OMX_INOUT is used to identify parameters that may be either inputs or - outputs from an OMX function at the same time. This designation will - also be used in the case of a pointer that points to a parameter that + outputs from an OMX function at the same time. This designation will + also be used in the case of a pointer that points to a parameter that is used both as an input and an output. */ #ifndef OMX_INOUT #define OMX_INOUT @@ -123,31 +121,31 @@ /** @defgroup core OpenMAX IL core * Functions and structure related to the OMX IL core */ - + /** @defgroup comp OpenMAX IL component * Functions and structure related to the OMX IL component */ - -/** @defgroup rpm Resource and Policy Management + +/** @defgroup rpm Resource and Policy Management * Structures for resource and policy management of components */ /** @defgroup buf Buffer Management * Buffer handling functions and structures */ - + /** @defgroup tun Tunneling * @ingroup core comp * Structures and functions to manage tunnels among component ports */ - + /** @defgroup cp Content Pipes * @ingroup core */ - + /** @defgroup metadata Metadata handling - * - */ + * + */ /** OMX_U8 is an 8 bit unsigned quantity that is byte aligned */ typedef unsigned char OMX_U8; @@ -162,14 +160,14 @@ typedef signed short OMX_S16; /** OMX_U32 is a 32 bit unsigned quantity that is 32 bit word aligned */ -typedef uint32_t OMX_U32; +typedef unsigned long OMX_U32; /** OMX_S32 is a 32 bit signed quantity that is 32 bit word aligned */ -typedef int32_t OMX_S32; +typedef signed long OMX_S32; /* Users with compilers that cannot accept the "long long" designation should - define the OMX_SKIP64BIT macro. It should be noted that this may cause + define the OMX_SKIP64BIT macro. It should be noted that this may cause some components to fail to compile if the component was written to require 64 bit integral types. However, these components would NOT compile anyway since the compiler does not support the way the component was written. @@ -184,7 +182,7 @@ #elif defined(WIN32) -/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ +/** OMX_U64 is a 64 bit unsigned quantity that is 64 bit word aligned */ typedef unsigned __int64 OMX_U64; /** OMX_S64 is a 64 bit signed quantity that is 64 bit word aligned */ @@ -202,7 +200,7 @@ #endif -/** The OMX_BOOL type is intended to be used to represent a true or a false +/** The OMX_BOOL type is intended to be used to represent a true or a false value when passing parameters to and from the OMX core and components. The OMX_BOOL is a 32 bit quantity and is aligned on a 32 bit word boundary. */ @@ -210,26 +208,8 @@ OMX_FALSE = 0, OMX_TRUE = !OMX_FALSE, OMX_BOOL_MAX = 0x7FFFFFFF -} OMX_BOOL; - -/* - * Temporary Android 64 bit modification - * - * #define OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS - * overrides all OMX pointer types to be uint32_t. - * - * After this change, OMX codecs will work in 32 bit only, so 64 bit processes - * must communicate to a remote 32 bit process for OMX to work. - */ - -#ifdef OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS - -typedef uint32_t OMX_PTR; -typedef OMX_PTR OMX_STRING; -typedef OMX_PTR OMX_BYTE; - -#else /* OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS */ - +} OMX_BOOL; + /** The OMX_PTR type is intended to be used to pass pointers between the OMX applications and the OMX Core and components. This is a 32 bit pointer and is aligned on a 32 bit boundary. @@ -237,21 +217,19 @@ typedef void* OMX_PTR; /** The OMX_STRING type is intended to be used to pass "C" type strings between - the application and the core and component. The OMX_STRING type is a 32 - bit pointer to a zero terminated string. The pointer is word aligned and - the string is byte aligned. + the application and the core and component. The OMX_STRING type is a 32 + bit pointer to a zero terminated string. The pointer is word aligned and + the string is byte aligned. */ typedef char* OMX_STRING; /** The OMX_BYTE type is intended to be used to pass arrays of bytes such as - buffers between the application and the component and core. The OMX_BYTE + buffers between the application and the component and core. The OMX_BYTE type is a 32 bit pointer to a zero terminated string. The pointer is word aligned and the string is byte aligned. */ typedef unsigned char* OMX_BYTE; -#endif /* OMX_ANDROID_COMPILE_AS_32BIT_ON_64BIT_PLATFORMS */ - /** OMX_UUIDTYPE is a very long unique identifier to uniquely identify at runtime. This identifier should be generated by a component in a way that guarantees that every instance of the identifier running on the system @@ -259,7 +237,7 @@ typedef unsigned char OMX_UUIDTYPE[128]; /** The OMX_DIRTYPE enumeration is used to indicate if a port is an input or - an output port. This enumeration is common across all component types. + an output port. This enumeration is common across all component types. */ typedef enum OMX_DIRTYPE { @@ -268,8 +246,8 @@ OMX_DirMax = 0x7FFFFFFF } OMX_DIRTYPE; -/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering - for numerical data (i.e. big endian, or little endian). +/** The OMX_ENDIANTYPE enumeration is used to indicate the bit ordering + for numerical data (i.e. big endian, or little endian). */ typedef enum OMX_ENDIANTYPE { @@ -279,7 +257,7 @@ } OMX_ENDIANTYPE; -/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data +/** The OMX_NUMERICALDATATYPE enumeration is used to indicate if data is signed or unsigned */ typedef enum OMX_NUMERICALDATATYPE @@ -307,16 +285,16 @@ /** Structure representing some time or duration in microseconds. This structure - * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate - * negative deltas and preroll scenarios. The quantity is represented in microseconds + * must be interpreted as a signed 64 bit value. The quantity is signed to accommodate + * negative deltas and preroll scenarios. The quantity is represented in microseconds * to accomodate high resolution timestamps (e.g. DVD presentation timestamps based - * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g. - * individual audio samples delivered at 192 kHz). The quantity is 64 bit to + * on a 90kHz clock) and to allow more accurate and synchronized delivery (e.g. + * individual audio samples delivered at 192 kHz). The quantity is 64 bit to * accommodate a large dynamic range (signed 32 bit values would allow only for plus * or minus 35 minutes). * - * Implementations with limited precision may convert the signed 64 bit value to - * a signed 32 bit value internally but risk loss of precision. + * Implementations with limited precision may convert the signed 64 bit value to + * a signed 32 bit value internally but risk loss of precision. */ #ifndef OMX_SKIP64BIT typedef OMX_S64 OMX_TICKS; @@ -332,32 +310,32 @@ /** Define the public interface for the OMX Handle. The core will not use this value internally, but the application should only use this value. */ -typedef OMX_PTR OMX_HANDLETYPE; +typedef void* OMX_HANDLETYPE; typedef struct OMX_MARKTYPE { - OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will - generate a mark event upon + OMX_HANDLETYPE hMarkTargetComponent; /**< The component that will + generate a mark event upon processing the mark. */ - OMX_PTR pMarkData; /**< Application specific data associated with - the mark sent on a mark event to disambiguate + OMX_PTR pMarkData; /**< Application specific data associated with + the mark sent on a mark event to disambiguate this mark from others. */ } OMX_MARKTYPE; /** OMX_NATIVE_DEVICETYPE is used to map a OMX video port to the - * platform & operating specific object used to reference the display + * platform & operating specific object used to reference the display * or can be used by a audio port for native audio rendering */ -typedef OMX_PTR OMX_NATIVE_DEVICETYPE; +typedef void* OMX_NATIVE_DEVICETYPE; /** OMX_NATIVE_WINDOWTYPE is used to map a OMX video port to the * platform & operating specific object used to reference the window */ -typedef OMX_PTR OMX_NATIVE_WINDOWTYPE; +typedef void* OMX_NATIVE_WINDOWTYPE; /** The OMX_VERSIONTYPE union is used to specify the version for a structure or component. For a component, the version is entirely specified by the component vendor. Components doing the same function - from different vendors may or may not have the same version. For + from different vendors may or may not have the same version. For structures, the version shall be set by the entity that allocates the structure. For structures specified in the OMX 1.1 specification, the value of the version shall be set to 1.1.0.0 in all cases. Access to the diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_VideoExt.h android-platform-frameworks-native-21/include/media/openmax/OMX_VideoExt.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_VideoExt.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_VideoExt.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,224 +0,0 @@ -/* - * Copyright (c) 2010 The Khronos Group Inc. - * - * Permission is hereby granted, free of charge, to any person obtaining - * a copy of this software and associated documentation files (the - * "Software"), to deal in the Software without restriction, including - * without limitation the rights to use, copy, modify, merge, publish, - * distribute, sublicense, and/or sell copies of the Software, and to - * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: - * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * - * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS - * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF - * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. - * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY - * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, - * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. - * - */ - -/** OMX_VideoExt.h - OpenMax IL version 1.1.2 - * The OMX_VideoExt header file contains extensions to the - * definitions used by both the application and the component to - * access video items. - */ - -#ifndef OMX_VideoExt_h -#define OMX_VideoExt_h - -#ifdef __cplusplus -extern "C" { -#endif /* __cplusplus */ - -/* Each OMX header shall include all required header files to allow the - * header to compile without errors. The includes below are required - * for this header file to compile successfully - */ -#include - -/** NALU Formats */ -typedef enum OMX_NALUFORMATSTYPE { - OMX_NaluFormatStartCodes = 1, - OMX_NaluFormatOneNaluPerBuffer = 2, - OMX_NaluFormatOneByteInterleaveLength = 4, - OMX_NaluFormatTwoByteInterleaveLength = 8, - OMX_NaluFormatFourByteInterleaveLength = 16, - OMX_NaluFormatCodingMax = 0x7FFFFFFF -} OMX_NALUFORMATSTYPE; - -/** NAL Stream Format */ -typedef struct OMX_NALSTREAMFORMATTYPE{ - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_NALUFORMATSTYPE eNaluFormat; -} OMX_NALSTREAMFORMATTYPE; - -/** VP8 profiles */ -typedef enum OMX_VIDEO_VP8PROFILETYPE { - OMX_VIDEO_VP8ProfileMain = 0x01, - OMX_VIDEO_VP8ProfileUnknown = 0x6EFFFFFF, - OMX_VIDEO_VP8ProfileMax = 0x7FFFFFFF -} OMX_VIDEO_VP8PROFILETYPE; - -/** VP8 levels */ -typedef enum OMX_VIDEO_VP8LEVELTYPE { - OMX_VIDEO_VP8Level_Version0 = 0x01, - OMX_VIDEO_VP8Level_Version1 = 0x02, - OMX_VIDEO_VP8Level_Version2 = 0x04, - OMX_VIDEO_VP8Level_Version3 = 0x08, - OMX_VIDEO_VP8LevelUnknown = 0x6EFFFFFF, - OMX_VIDEO_VP8LevelMax = 0x7FFFFFFF -} OMX_VIDEO_VP8LEVELTYPE; - -/** VP8 Param */ -typedef struct OMX_VIDEO_PARAM_VP8TYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_VIDEO_VP8PROFILETYPE eProfile; - OMX_VIDEO_VP8LEVELTYPE eLevel; - OMX_U32 nDCTPartitions; - OMX_BOOL bErrorResilientMode; -} OMX_VIDEO_PARAM_VP8TYPE; - -/** Structure for configuring VP8 reference frames */ -typedef struct OMX_VIDEO_VP8REFERENCEFRAMETYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_BOOL bPreviousFrameRefresh; - OMX_BOOL bGoldenFrameRefresh; - OMX_BOOL bAlternateFrameRefresh; - OMX_BOOL bUsePreviousFrame; - OMX_BOOL bUseGoldenFrame; - OMX_BOOL bUseAlternateFrame; -} OMX_VIDEO_VP8REFERENCEFRAMETYPE; - -/** Structure for querying VP8 reference frame type */ -typedef struct OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_BOOL bIsIntraFrame; - OMX_BOOL bIsGoldenOrAlternateFrame; -} OMX_VIDEO_VP8REFERENCEFRAMEINFOTYPE; - -/** Maximum number of VP8 temporal layers */ -#define OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS 3 - -/** VP8 temporal layer patterns */ -typedef enum OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE { - OMX_VIDEO_VPXTemporalLayerPatternNone = 0, - OMX_VIDEO_VPXTemporalLayerPatternWebRTC = 1, - OMX_VIDEO_VPXTemporalLayerPatternMax = 0x7FFFFFFF -} OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE; - -/** - * Android specific VP8 encoder params - * - * STRUCT MEMBERS: - * nSize : Size of the structure in bytes - * nVersion : OMX specification version information - * nPortIndex : Port that this structure applies to - * nKeyFrameInterval : Key frame interval in frames - * eTemporalPattern : Type of temporal layer pattern - * nTemporalLayerCount : Number of temporal coding layers - * nTemporalLayerBitrateRatio : Bitrate ratio allocation between temporal - * streams in percentage - * nMinQuantizer : Minimum (best quality) quantizer - * nMaxQuantizer : Maximum (worst quality) quantizer - */ -typedef struct OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_U32 nKeyFrameInterval; - OMX_VIDEO_ANDROID_VPXTEMPORALLAYERPATTERNTYPE eTemporalPattern; - OMX_U32 nTemporalLayerCount; - OMX_U32 nTemporalLayerBitrateRatio[OMX_VIDEO_ANDROID_MAXVP8TEMPORALLAYERS]; - OMX_U32 nMinQuantizer; - OMX_U32 nMaxQuantizer; -} OMX_VIDEO_PARAM_ANDROID_VP8ENCODERTYPE; - -/** HEVC Profile enum type */ -typedef enum OMX_VIDEO_HEVCPROFILETYPE { - OMX_VIDEO_HEVCProfileUnknown = 0x0, - OMX_VIDEO_HEVCProfileMain = 0x1, - OMX_VIDEO_HEVCProfileMain10 = 0x2, - OMX_VIDEO_HEVCProfileMax = 0x7FFFFFFF -} OMX_VIDEO_HEVCPROFILETYPE; - -/** HEVC Level enum type */ -typedef enum OMX_VIDEO_HEVCLEVELTYPE { - OMX_VIDEO_HEVCLevelUnknown = 0x0, - OMX_VIDEO_HEVCMainTierLevel1 = 0x1, - OMX_VIDEO_HEVCHighTierLevel1 = 0x2, - OMX_VIDEO_HEVCMainTierLevel2 = 0x4, - OMX_VIDEO_HEVCHighTierLevel2 = 0x8, - OMX_VIDEO_HEVCMainTierLevel21 = 0x10, - OMX_VIDEO_HEVCHighTierLevel21 = 0x20, - OMX_VIDEO_HEVCMainTierLevel3 = 0x40, - OMX_VIDEO_HEVCHighTierLevel3 = 0x80, - OMX_VIDEO_HEVCMainTierLevel31 = 0x100, - OMX_VIDEO_HEVCHighTierLevel31 = 0x200, - OMX_VIDEO_HEVCMainTierLevel4 = 0x400, - OMX_VIDEO_HEVCHighTierLevel4 = 0x800, - OMX_VIDEO_HEVCMainTierLevel41 = 0x1000, - OMX_VIDEO_HEVCHighTierLevel41 = 0x2000, - OMX_VIDEO_HEVCMainTierLevel5 = 0x4000, - OMX_VIDEO_HEVCHighTierLevel5 = 0x8000, - OMX_VIDEO_HEVCMainTierLevel51 = 0x10000, - OMX_VIDEO_HEVCHighTierLevel51 = 0x20000, - OMX_VIDEO_HEVCMainTierLevel52 = 0x40000, - OMX_VIDEO_HEVCHighTierLevel52 = 0x80000, - OMX_VIDEO_HEVCMainTierLevel6 = 0x100000, - OMX_VIDEO_HEVCHighTierLevel6 = 0x200000, - OMX_VIDEO_HEVCMainTierLevel61 = 0x400000, - OMX_VIDEO_HEVCHighTierLevel61 = 0x800000, - OMX_VIDEO_HEVCMainTierLevel62 = 0x1000000, - OMX_VIDEO_HEVCHighTierLevel62 = 0x2000000, - OMX_VIDEO_HEVCHighTiermax = 0x7FFFFFFF -} OMX_VIDEO_HEVCLEVELTYPE; - -/** Structure for controlling HEVC video encoding and decoding */ -typedef struct OMX_VIDEO_PARAM_HEVCTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_VIDEO_HEVCPROFILETYPE eProfile; - OMX_VIDEO_HEVCLEVELTYPE eLevel; -} OMX_VIDEO_PARAM_HEVCTYPE; - -/** Structure to define if dependent slice segments should be used */ -typedef struct OMX_VIDEO_SLICESEGMENTSTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_BOOL bDepedentSegments; - OMX_BOOL bEnableLoopFilterAcrossSlices; -} OMX_VIDEO_SLICESEGMENTSTYPE; - -/** Structure to return timestamps of rendered output frames as well as EOS - * for tunneled components. - */ -typedef struct OMX_VIDEO_RENDEREVENTTYPE { - OMX_S64 nMediaTimeUs; // timestamp of rendered video frame - OMX_S64 nSystemTimeNs; // system monotonic time at the time frame was rendered - // Use INT64_MAX for nMediaTimeUs to signal that the EOS - // has been reached. In this case, nSystemTimeNs MUST be - // the system time when the last frame was rendered. - // This MUST be done in addition to returning (and - // following) the render information for the last frame. -} OMX_VIDEO_RENDEREVENTTYPE; - -#ifdef __cplusplus -} -#endif /* __cplusplus */ - -#endif /* OMX_VideoExt_h */ -/* File EOF */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Video.h android-platform-frameworks-native-21/include/media/openmax/OMX_Video.h --- android-platform-frameworks-native-6.0.1+r16/include/media/openmax/OMX_Video.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/media/openmax/OMX_Video.h 2012-10-16 22:57:11.000000000 +0000 @@ -16,31 +16,31 @@ * ------------------------------------------------------------------- */ /** - * Copyright (c) 2008 The Khronos Group Inc. - * + * Copyright (c) 2008 The Khronos Group Inc. + * * Permission is hereby granted, free of charge, to any person obtaining * a copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sublicense, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject - * to the following conditions: + * to the following conditions: * The above copyright notice and this permission notice shall be included - * in all copies or substantial portions of the Software. - * + * in all copies or substantial portions of the Software. + * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS * OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. * IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY * CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE - * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + * SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. * */ -/** +/** * @file OMX_Video.h - OpenMax IL version 1.1.2 - * The structures is needed by Video components to exchange parameters + * The structures is needed by Video components to exchange parameters * and configuration data with OMX components. */ #ifndef OMX_Video_h @@ -60,19 +60,19 @@ /** * Each OMX header must include all required header files to allow the * header to compile without errors. The includes below are required - * for this header file to compile successfully + * for this header file to compile successfully */ #include /** - * Enumeration used to define the possible video compression codings. - * NOTE: This essentially refers to file extensions. If the coding is - * being used to specify the ENCODE type, then additional work - * must be done to configure the exact flavor of the compression - * to be used. For decode cases where the user application can - * not differentiate between MPEG-4 and H.264 bit streams, it is + * Enumeration used to define the possible video compression codings. + * NOTE: This essentially refers to file extensions. If the coding is + * being used to specify the ENCODE type, then additional work + * must be done to configure the exact flavor of the compression + * to be used. For decode cases where the user application can + * not differentiate between MPEG-4 and H.264 bit streams, it is * up to the codec to handle this. */ typedef enum OMX_VIDEO_CODINGTYPE { @@ -85,61 +85,59 @@ OMX_VIDEO_CodingRV, /**< all versions of Real Video */ OMX_VIDEO_CodingAVC, /**< H.264/AVC */ OMX_VIDEO_CodingMJPEG, /**< Motion JPEG */ - OMX_VIDEO_CodingVP8, /**< Google VP8, formerly known as On2 VP8 */ - OMX_VIDEO_CodingVP9, /**< Google VP9 */ - OMX_VIDEO_CodingHEVC, /**< ITU H.265/HEVC */ - OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_CodingVPX, /**< Google VPX, formerly known as On2 VP8 */ + OMX_VIDEO_CodingKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_CodingVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_CodingMax = 0x7FFFFFFF } OMX_VIDEO_CODINGTYPE; /** - * Data structure used to define a video path. The number of Video paths for - * input and output will vary by type of the Video component. - * + * Data structure used to define a video path. The number of Video paths for + * input and output will vary by type of the Video component. + * * Input (aka Source) : zero Inputs, one Output, * Splitter : one Input, 2 or more Outputs, * Processing Element : one Input, one output, * Mixer : 2 or more inputs, one output, * Output (aka Sink) : one Input, zero outputs. - * - * The PortDefinition structure is used to define all of the parameters - * necessary for the compliant component to setup an input or an output video - * path. If additional vendor specific data is required, it should be - * transmitted to the component using the CustomCommand function. Compliant - * components will prepopulate this structure with optimal values during the + * + * The PortDefinition structure is used to define all of the parameters + * necessary for the compliant component to setup an input or an output video + * path. If additional vendor specific data is required, it should be + * transmitted to the component using the CustomCommand function. Compliant + * components will prepopulate this structure with optimal values during the * GetDefaultInitParams command. * * STRUCT MEMBERS: * cMIMEType : MIME type of data for the port - * pNativeRender : Platform specific reference for a display if a + * pNativeRender : Platform specific reference for a display if a * sync, otherwise this field is 0 - * nFrameWidth : Width of frame to be used on channel if + * nFrameWidth : Width of frame to be used on channel if * uncompressed format is used. Use 0 for unknown, * don't care or variable - * nFrameHeight : Height of frame to be used on channel if + * nFrameHeight : Height of frame to be used on channel if * uncompressed format is used. Use 0 for unknown, * don't care or variable - * nStride : Number of bytes per span of an image + * nStride : Number of bytes per span of an image * (i.e. indicates the number of bytes to get * from span N to span N+1, where negative stride * indicates the image is bottom up * nSliceHeight : Height used when encoding in slices - * nBitrate : Bit rate of frame to be used on channel if - * compressed format is used. Use 0 for unknown, + * nBitrate : Bit rate of frame to be used on channel if + * compressed format is used. Use 0 for unknown, * don't care or variable - * xFramerate : Frame rate to be used on channel if uncompressed - * format is used. Use 0 for unknown, don't care or + * xFramerate : Frame rate to be used on channel if uncompressed + * format is used. Use 0 for unknown, don't care or * variable. Units are Q16 frames per second. - * bFlagErrorConcealment : Turns on error concealment if it is supported by + * bFlagErrorConcealment : Turns on error concealment if it is supported by * the OMX component - * eCompressionFormat : Compression format used in this instance of the - * component. When OMX_VIDEO_CodingUnused is + * eCompressionFormat : Compression format used in this instance of the + * component. When OMX_VIDEO_CodingUnused is * specified, eColorFormat is used * eColorFormat : Decompressed format used by this component - * pNativeWindow : Platform specific reference for a window object if a - * display sink , otherwise this field is 0x0. + * pNativeWindow : Platform specific reference for a window object if a + * display sink , otherwise this field is 0x0. */ typedef struct OMX_VIDEO_PORTDEFINITIONTYPE { OMX_STRING cMIMEType; @@ -156,19 +154,19 @@ OMX_NATIVE_WINDOWTYPE pNativeWindow; } OMX_VIDEO_PORTDEFINITIONTYPE; -/** - * Port format parameter. This structure is used to enumerate the various +/** + * Port format parameter. This structure is used to enumerate the various * data input/output format supported by the port. - * + * * STRUCT MEMBERS: * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Indicates which port to set - * nIndex : Indicates the enumeration index for the format from + * nIndex : Indicates the enumeration index for the format from * 0x0 to N-1 - * eCompressionFormat : Compression format used in this instance of the - * component. When OMX_VIDEO_CodingUnused is specified, - * eColorFormat is used + * eCompressionFormat : Compression format used in this instance of the + * component. When OMX_VIDEO_CodingUnused is specified, + * eColorFormat is used * eColorFormat : Decompressed format used by this component * xFrameRate : Indicates the video frame rate in Q16 format */ @@ -177,14 +175,14 @@ OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_U32 nIndex; - OMX_VIDEO_CODINGTYPE eCompressionFormat; + OMX_VIDEO_CODINGTYPE eCompressionFormat; OMX_COLOR_FORMATTYPE eColorFormat; OMX_U32 xFramerate; } OMX_VIDEO_PARAM_PORTFORMATTYPE; /** - * This is a structure for configuring video compression quantization + * This is a structure for configuring video compression quantization * parameter values. Codecs may support different QP values for different * frame types. * @@ -194,10 +192,10 @@ * nPortIndex : Port that this structure applies to * nQpI : QP value to use for index frames * nQpP : QP value to use for P frames - * nQpB : QP values to use for bidirectional frames + * nQpB : QP values to use for bidirectional frames */ typedef struct OMX_VIDEO_PARAM_QUANTIZATIONTYPE { - OMX_U32 nSize; + OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_U32 nQpI; @@ -206,32 +204,32 @@ } OMX_VIDEO_PARAM_QUANTIZATIONTYPE; -/** - * Structure for configuration of video fast update parameters. - * +/** + * Structure for configuration of video fast update parameters. + * * STRUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version info + * nVersion : OMX specification version info * nPortIndex : Port that this structure applies to * bEnableVFU : Enable/Disable video fast update * nFirstGOB : Specifies the number of the first macroblock row * nFirstMB : specifies the first MB relative to the specified first GOB - * nNumMBs : Specifies the number of MBs to be refreshed from nFirstGOB + * nNumMBs : Specifies the number of MBs to be refreshed from nFirstGOB * and nFirstMB */ typedef struct OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_BOOL bEnableVFU; - OMX_U32 nFirstGOB; - OMX_U32 nFirstMB; - OMX_U32 nNumMBs; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL bEnableVFU; + OMX_U32 nFirstGOB; + OMX_U32 nFirstMB; + OMX_U32 nNumMBs; } OMX_VIDEO_PARAM_VIDEOFASTUPDATETYPE; -/** - * Enumeration of possible bitrate control types +/** + * Enumeration of possible bitrate control types */ typedef enum OMX_VIDEO_CONTROLRATETYPE { OMX_Video_ControlRateDisable, @@ -239,14 +237,14 @@ OMX_Video_ControlRateConstant, OMX_Video_ControlRateVariableSkipFrames, OMX_Video_ControlRateConstantSkipFrames, - OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_Video_ControlRateKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_Video_ControlRateVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_Video_ControlRateMax = 0x7FFFFFFF } OMX_VIDEO_CONTROLRATETYPE; -/** - * Structure for configuring bitrate mode of a codec. +/** + * Structure for configuring bitrate mode of a codec. * * STRUCT MEMBERS: * nSize : Size of the struct in bytes @@ -256,23 +254,23 @@ * nTargetBitrate : Target bitrate to encode with */ typedef struct OMX_VIDEO_PARAM_BITRATETYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_VIDEO_CONTROLRATETYPE eControlRate; - OMX_U32 nTargetBitrate; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_VIDEO_CONTROLRATETYPE eControlRate; + OMX_U32 nTargetBitrate; } OMX_VIDEO_PARAM_BITRATETYPE; -/** - * Enumeration of possible motion vector (MV) types +/** + * Enumeration of possible motion vector (MV) types */ typedef enum OMX_VIDEO_MOTIONVECTORTYPE { OMX_Video_MotionVectorPixel, OMX_Video_MotionVectorHalfPel, OMX_Video_MotionVectorQuarterPel, OMX_Video_MotionVectorEighthPel, - OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_Video_MotionVectorKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_Video_MotionVectorVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_Video_MotionVectorMax = 0x7FFFFFFF } OMX_VIDEO_MOTIONVECTORTYPE; @@ -281,7 +279,7 @@ /** * Structure for configuring the number of motion vectors used as well * as their accuracy. - * + * * STRUCT MEMBERS: * nSize : Size of the struct in bytes * nVersion : OMX spec version info @@ -304,32 +302,32 @@ } OMX_VIDEO_PARAM_MOTIONVECTORTYPE; -/** - * Enumeration of possible methods to use for Intra Refresh +/** + * Enumeration of possible methods to use for Intra Refresh */ typedef enum OMX_VIDEO_INTRAREFRESHTYPE { OMX_VIDEO_IntraRefreshCyclic, OMX_VIDEO_IntraRefreshAdaptive, OMX_VIDEO_IntraRefreshBoth, - OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_IntraRefreshKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_IntraRefreshVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_IntraRefreshMax = 0x7FFFFFFF } OMX_VIDEO_INTRAREFRESHTYPE; /** - * Structure for configuring intra refresh mode - * + * Structure for configuring intra refresh mode + * * STRUCT MEMBERS: * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * eRefreshMode : Cyclic, Adaptive, or Both - * nAirMBs : Number of intra macroblocks to refresh in a frame when + * nAirMBs : Number of intra macroblocks to refresh in a frame when * AIR is enabled - * nAirRef : Number of times a motion marked macroblock has to be + * nAirRef : Number of times a motion marked macroblock has to be * intra coded - * nCirMBs : Number of consecutive macroblocks to be coded as "intra" + * nCirMBs : Number of consecutive macroblocks to be coded as "intra" * when CIR is enabled */ typedef struct OMX_VIDEO_PARAM_INTRAREFRESHTYPE { @@ -344,19 +342,19 @@ /** - * Structure for enabling various error correction methods for video + * Structure for enabling various error correction methods for video * compression. * * STRUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version information - * nPortIndex : Port that this structure applies to + * nVersion : OMX specification version information + * nPortIndex : Port that this structure applies to * bEnableHEC : Enable/disable header extension codes (HEC) * bEnableResync : Enable/disable resynchronization markers - * nResynchMarkerSpacing : Resynch markers interval (in bits) to be - * applied in the stream - * bEnableDataPartitioning : Enable/disable data partitioning - * bEnableRVLC : Enable/disable reversible variable length + * nResynchMarkerSpacing : Resynch markers interval (in bits) to be + * applied in the stream + * bEnableDataPartitioning : Enable/disable data partitioning + * bEnableRVLC : Enable/disable reversible variable length * coding */ typedef struct OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE { @@ -371,12 +369,12 @@ } OMX_VIDEO_PARAM_ERRORCORRECTIONTYPE; -/** - * Configuration of variable block-size motion compensation (VBSMC) - * +/** + * Configuration of variable block-size motion compensation (VBSMC) + * * STRUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version information + * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * b16x16 : Enable inter block search 16x16 * b16x8 : Enable inter block search 16x8 @@ -387,11 +385,11 @@ * b4x4 : Enable inter block search 4x4 */ typedef struct OMX_VIDEO_PARAM_VBSMCTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_BOOL b16x16; - OMX_BOOL b16x8; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_BOOL b16x16; + OMX_BOOL b16x8; OMX_BOOL b8x16; OMX_BOOL b8x8; OMX_BOOL b8x4; @@ -400,67 +398,67 @@ } OMX_VIDEO_PARAM_VBSMCTYPE; -/** - * H.263 profile types, each profile indicates support for various +/** + * H.263 profile types, each profile indicates support for various * performance bounds and different annexes. * * ENUMS: - * Baseline : Baseline Profile: H.263 (V1), no optional modes - * H320 Coding : H.320 Coding Efficiency Backward Compatibility + * Baseline : Baseline Profile: H.263 (V1), no optional modes + * H320 Coding : H.320 Coding Efficiency Backward Compatibility * Profile: H.263+ (V2), includes annexes I, J, L.4 * and T - * BackwardCompatible : Backward Compatibility Profile: H.263 (V1), - * includes annex F - * ISWV2 : Interactive Streaming Wireless Profile: H.263+ - * (V2), includes annexes I, J, K and T - * ISWV3 : Interactive Streaming Wireless Profile: H.263++ - * (V3), includes profile 3 and annexes V and W.6.3.8 - * HighCompression : Conversational High Compression Profile: H.263++ - * (V3), includes profiles 1 & 2 and annexes D and U - * Internet : Conversational Internet Profile: H.263++ (V3), - * includes profile 5 and annex K - * Interlace : Conversational Interlace Profile: H.263++ (V3), - * includes profile 5 and annex W.6.3.11 - * HighLatency : High Latency Profile: H.263++ (V3), includes - * profile 6 and annexes O.1 and P.5 + * BackwardCompatible : Backward Compatibility Profile: H.263 (V1), + * includes annex F + * ISWV2 : Interactive Streaming Wireless Profile: H.263+ + * (V2), includes annexes I, J, K and T + * ISWV3 : Interactive Streaming Wireless Profile: H.263++ + * (V3), includes profile 3 and annexes V and W.6.3.8 + * HighCompression : Conversational High Compression Profile: H.263++ + * (V3), includes profiles 1 & 2 and annexes D and U + * Internet : Conversational Internet Profile: H.263++ (V3), + * includes profile 5 and annex K + * Interlace : Conversational Interlace Profile: H.263++ (V3), + * includes profile 5 and annex W.6.3.11 + * HighLatency : High Latency Profile: H.263++ (V3), includes + * profile 6 and annexes O.1 and P.5 */ typedef enum OMX_VIDEO_H263PROFILETYPE { - OMX_VIDEO_H263ProfileBaseline = 0x01, - OMX_VIDEO_H263ProfileH320Coding = 0x02, - OMX_VIDEO_H263ProfileBackwardCompatible = 0x04, - OMX_VIDEO_H263ProfileISWV2 = 0x08, - OMX_VIDEO_H263ProfileISWV3 = 0x10, - OMX_VIDEO_H263ProfileHighCompression = 0x20, - OMX_VIDEO_H263ProfileInternet = 0x40, - OMX_VIDEO_H263ProfileInterlace = 0x80, - OMX_VIDEO_H263ProfileHighLatency = 0x100, - OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_H263ProfileBaseline = 0x01, + OMX_VIDEO_H263ProfileH320Coding = 0x02, + OMX_VIDEO_H263ProfileBackwardCompatible = 0x04, + OMX_VIDEO_H263ProfileISWV2 = 0x08, + OMX_VIDEO_H263ProfileISWV3 = 0x10, + OMX_VIDEO_H263ProfileHighCompression = 0x20, + OMX_VIDEO_H263ProfileInternet = 0x40, + OMX_VIDEO_H263ProfileInterlace = 0x80, + OMX_VIDEO_H263ProfileHighLatency = 0x100, + OMX_VIDEO_H263ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_H263ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_H263ProfileMax = 0x7FFFFFFF + OMX_VIDEO_H263ProfileMax = 0x7FFFFFFF } OMX_VIDEO_H263PROFILETYPE; -/** - * H.263 level types, each level indicates support for various frame sizes, +/** + * H.263 level types, each level indicates support for various frame sizes, * bit rates, decoder frame rates. */ typedef enum OMX_VIDEO_H263LEVELTYPE { - OMX_VIDEO_H263Level10 = 0x01, - OMX_VIDEO_H263Level20 = 0x02, - OMX_VIDEO_H263Level30 = 0x04, - OMX_VIDEO_H263Level40 = 0x08, - OMX_VIDEO_H263Level45 = 0x10, - OMX_VIDEO_H263Level50 = 0x20, - OMX_VIDEO_H263Level60 = 0x40, - OMX_VIDEO_H263Level70 = 0x80, - OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_H263Level10 = 0x01, + OMX_VIDEO_H263Level20 = 0x02, + OMX_VIDEO_H263Level30 = 0x04, + OMX_VIDEO_H263Level40 = 0x08, + OMX_VIDEO_H263Level45 = 0x10, + OMX_VIDEO_H263Level50 = 0x20, + OMX_VIDEO_H263Level60 = 0x40, + OMX_VIDEO_H263Level70 = 0x80, + OMX_VIDEO_H263LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_H263LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_H263LevelMax = 0x7FFFFFFF + OMX_VIDEO_H263LevelMax = 0x7FFFFFFF } OMX_VIDEO_H263LEVELTYPE; -/** - * Specifies the picture type. These values should be OR'd to signal all +/** + * Specifies the picture type. These values should be OR'd to signal all * pictures types which are allowed. * * ENUMS: @@ -478,36 +476,36 @@ OMX_VIDEO_PictureTypeEI = 0x11, OMX_VIDEO_PictureTypeEP = 0x12, OMX_VIDEO_PictureTypeS = 0x14, - OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_PictureTypeKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_PictureTypeVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_PictureTypeMax = 0x7FFFFFFF } OMX_VIDEO_PICTURETYPE; -/** - * H.263 Params +/** + * H.263 Params * * STRUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version information + * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * nPFrames : Number of P frames between each I frame * nBFrames : Number of B frames between each I frame * eProfile : H.263 profile(s) to use * eLevel : H.263 level(s) to use - * bPLUSPTYPEAllowed : Indicating that it is allowed to use PLUSPTYPE - * (specified in the 1998 version of H.263) to - * indicate custom picture sizes or clock - * frequencies - * nAllowedPictureTypes : Specifies the picture types allowed in the + * bPLUSPTYPEAllowed : Indicating that it is allowed to use PLUSPTYPE + * (specified in the 1998 version of H.263) to + * indicate custom picture sizes or clock + * frequencies + * nAllowedPictureTypes : Specifies the picture types allowed in the * bitstream - * bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is - * not constrained. It is recommended to change - * the value of the RTYPE bit for each reference + * bForceRoundingTypeToZero : value of the RTYPE bit (bit 6 of MPPTYPE) is + * not constrained. It is recommended to change + * the value of the RTYPE bit for each reference * picture in error-free communication - * nPictureHeaderRepetition : Specifies the frequency of picture header + * nPictureHeaderRepetition : Specifies the frequency of picture header * repetition - * nGOBHeaderInterval : Specifies the interval of non-empty GOB + * nGOBHeaderInterval : Specifies the interval of non-empty GOB * headers in units of GOBs */ typedef struct OMX_VIDEO_PARAM_H263TYPE { @@ -517,7 +515,7 @@ OMX_U32 nPFrames; OMX_U32 nBFrames; OMX_VIDEO_H263PROFILETYPE eProfile; - OMX_VIDEO_H263LEVELTYPE eLevel; + OMX_VIDEO_H263LEVELTYPE eLevel; OMX_BOOL bPLUSPTYPEAllowed; OMX_U32 nAllowedPictureTypes; OMX_BOOL bForceRoundingTypeToZero; @@ -526,8 +524,8 @@ } OMX_VIDEO_PARAM_H263TYPE; -/** - * MPEG-2 profile types, each profile indicates support for various +/** + * MPEG-2 profile types, each profile indicates support for various * performance bounds and different annexes. */ typedef enum OMX_VIDEO_MPEG2PROFILETYPE { @@ -537,29 +535,29 @@ OMX_VIDEO_MPEG2ProfileSNR, /**< SNR Profile */ OMX_VIDEO_MPEG2ProfileSpatial, /**< Spatial Profile */ OMX_VIDEO_MPEG2ProfileHigh, /**< High Profile */ - OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG2ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_MPEG2ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF + OMX_VIDEO_MPEG2ProfileMax = 0x7FFFFFFF } OMX_VIDEO_MPEG2PROFILETYPE; -/** - * MPEG-2 level types, each level indicates support for various frame - * sizes, bit rates, decoder frame rates. No need +/** + * MPEG-2 level types, each level indicates support for various frame + * sizes, bit rates, decoder frame rates. No need */ typedef enum OMX_VIDEO_MPEG2LEVELTYPE { - OMX_VIDEO_MPEG2LevelLL = 0, /**< Low Level */ - OMX_VIDEO_MPEG2LevelML, /**< Main Level */ - OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */ - OMX_VIDEO_MPEG2LevelHL, /**< High Level */ - OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG2LevelLL = 0, /**< Low Level */ + OMX_VIDEO_MPEG2LevelML, /**< Main Level */ + OMX_VIDEO_MPEG2LevelH14, /**< High 1440 */ + OMX_VIDEO_MPEG2LevelHL, /**< High Level */ + OMX_VIDEO_MPEG2LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_MPEG2LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF + OMX_VIDEO_MPEG2LevelMax = 0x7FFFFFFF } OMX_VIDEO_MPEG2LEVELTYPE; -/** - * MPEG-2 params +/** + * MPEG-2 params * * STRUCT MEMBERS: * nSize : Size of the structure in bytes @@ -571,20 +569,20 @@ * eLevel : MPEG-2 levels(s) to use */ typedef struct OMX_VIDEO_PARAM_MPEG2TYPE { - OMX_U32 nSize; + OMX_U32 nSize; OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_U32 nPFrames; - OMX_U32 nBFrames; + OMX_U32 nPortIndex; + OMX_U32 nPFrames; + OMX_U32 nBFrames; OMX_VIDEO_MPEG2PROFILETYPE eProfile; - OMX_VIDEO_MPEG2LEVELTYPE eLevel; + OMX_VIDEO_MPEG2LEVELTYPE eLevel; } OMX_VIDEO_PARAM_MPEG2TYPE; -/** - * MPEG-4 profile types, each profile indicates support for various +/** + * MPEG-4 profile types, each profile indicates support for various * performance bounds and different annexes. - * + * * ENUMS: * - Simple Profile, Levels 1-3 * - Simple Scalable Profile, Levels 1-2 @@ -603,48 +601,48 @@ * - Advanced Scalable Texture, Levels 2-3 */ typedef enum OMX_VIDEO_MPEG4PROFILETYPE { - OMX_VIDEO_MPEG4ProfileSimple = 0x01, - OMX_VIDEO_MPEG4ProfileSimpleScalable = 0x02, - OMX_VIDEO_MPEG4ProfileCore = 0x04, - OMX_VIDEO_MPEG4ProfileMain = 0x08, - OMX_VIDEO_MPEG4ProfileNbit = 0x10, - OMX_VIDEO_MPEG4ProfileScalableTexture = 0x20, - OMX_VIDEO_MPEG4ProfileSimpleFace = 0x40, - OMX_VIDEO_MPEG4ProfileSimpleFBA = 0x80, - OMX_VIDEO_MPEG4ProfileBasicAnimated = 0x100, - OMX_VIDEO_MPEG4ProfileHybrid = 0x200, - OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400, - OMX_VIDEO_MPEG4ProfileCoreScalable = 0x800, - OMX_VIDEO_MPEG4ProfileAdvancedCoding = 0x1000, - OMX_VIDEO_MPEG4ProfileAdvancedCore = 0x2000, + OMX_VIDEO_MPEG4ProfileSimple = 0x01, + OMX_VIDEO_MPEG4ProfileSimpleScalable = 0x02, + OMX_VIDEO_MPEG4ProfileCore = 0x04, + OMX_VIDEO_MPEG4ProfileMain = 0x08, + OMX_VIDEO_MPEG4ProfileNbit = 0x10, + OMX_VIDEO_MPEG4ProfileScalableTexture = 0x20, + OMX_VIDEO_MPEG4ProfileSimpleFace = 0x40, + OMX_VIDEO_MPEG4ProfileSimpleFBA = 0x80, + OMX_VIDEO_MPEG4ProfileBasicAnimated = 0x100, + OMX_VIDEO_MPEG4ProfileHybrid = 0x200, + OMX_VIDEO_MPEG4ProfileAdvancedRealTime = 0x400, + OMX_VIDEO_MPEG4ProfileCoreScalable = 0x800, + OMX_VIDEO_MPEG4ProfileAdvancedCoding = 0x1000, + OMX_VIDEO_MPEG4ProfileAdvancedCore = 0x2000, OMX_VIDEO_MPEG4ProfileAdvancedScalable = 0x4000, OMX_VIDEO_MPEG4ProfileAdvancedSimple = 0x8000, - OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG4ProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_MPEG4ProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_MPEG4ProfileMax = 0x7FFFFFFF + OMX_VIDEO_MPEG4ProfileMax = 0x7FFFFFFF } OMX_VIDEO_MPEG4PROFILETYPE; -/** - * MPEG-4 level types, each level indicates support for various frame - * sizes, bit rates, decoder frame rates. No need +/** + * MPEG-4 level types, each level indicates support for various frame + * sizes, bit rates, decoder frame rates. No need */ typedef enum OMX_VIDEO_MPEG4LEVELTYPE { - OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */ - OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */ - OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */ - OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */ - OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */ - OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */ - OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */ - OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */ - OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_MPEG4Level0 = 0x01, /**< Level 0 */ + OMX_VIDEO_MPEG4Level0b = 0x02, /**< Level 0b */ + OMX_VIDEO_MPEG4Level1 = 0x04, /**< Level 1 */ + OMX_VIDEO_MPEG4Level2 = 0x08, /**< Level 2 */ + OMX_VIDEO_MPEG4Level3 = 0x10, /**< Level 3 */ + OMX_VIDEO_MPEG4Level4 = 0x20, /**< Level 4 */ + OMX_VIDEO_MPEG4Level4a = 0x40, /**< Level 4a */ + OMX_VIDEO_MPEG4Level5 = 0x80, /**< Level 5 */ + OMX_VIDEO_MPEG4LevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_MPEG4LevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF + OMX_VIDEO_MPEG4LevelMax = 0x7FFFFFFF } OMX_VIDEO_MPEG4LEVELTYPE; -/** +/** * MPEG-4 configuration. This structure handles configuration options * which are specific to MPEG4 algorithms * @@ -652,24 +650,24 @@ * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to - * nSliceHeaderSpacing : Number of macroblocks between slice header (H263+ + * nSliceHeaderSpacing : Number of macroblocks between slice header (H263+ * Annex K). Put zero if not used * bSVH : Enable Short Video Header mode * bGov : Flag to enable GOV - * nPFrames : Number of P frames between each I frame (also called + * nPFrames : Number of P frames between each I frame (also called * GOV period) * nBFrames : Number of B frames between each I frame * nIDCVLCThreshold : Value of intra DC VLC threshold * bACPred : Flag to use ac prediction * nMaxPacketSize : Maximum size of packet in bytes. - * nTimeIncRes : Used to pass VOP time increment resolution for MPEG4. + * nTimeIncRes : Used to pass VOP time increment resolution for MPEG4. * Interpreted as described in MPEG4 standard. * eProfile : MPEG-4 profile(s) to use. * eLevel : MPEG-4 level(s) to use. * nAllowedPictureTypes : Specifies the picture types allowed in the bitstream * nHeaderExtension : Specifies the number of consecutive video packet * headers within a VOP - * bReversibleVLC : Specifies whether reversible variable length coding + * bReversibleVLC : Specifies whether reversible variable length coding * is in use */ typedef struct OMX_VIDEO_PARAM_MPEG4TYPE { @@ -693,22 +691,22 @@ } OMX_VIDEO_PARAM_MPEG4TYPE; -/** - * WMV Versions +/** + * WMV Versions */ typedef enum OMX_VIDEO_WMVFORMATTYPE { OMX_VIDEO_WMVFormatUnused = 0x01, /**< Format unused or unknown */ OMX_VIDEO_WMVFormat7 = 0x02, /**< Windows Media Video format 7 */ OMX_VIDEO_WMVFormat8 = 0x04, /**< Windows Media Video format 8 */ OMX_VIDEO_WMVFormat9 = 0x08, /**< Windows Media Video format 9 */ - OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_WMFFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_WMFFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_WMVFormatMax = 0x7FFFFFFF } OMX_VIDEO_WMVFORMATTYPE; -/** - * WMV Params +/** + * WMV Params * * STRUCT MEMBERS: * nSize : Size of the structure in bytes @@ -717,33 +715,33 @@ * eFormat : Version of WMV stream / data */ typedef struct OMX_VIDEO_PARAM_WMVTYPE { - OMX_U32 nSize; + OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_VIDEO_WMVFORMATTYPE eFormat; } OMX_VIDEO_PARAM_WMVTYPE; -/** - * Real Video Version +/** + * Real Video Version */ typedef enum OMX_VIDEO_RVFORMATTYPE { OMX_VIDEO_RVFormatUnused = 0, /**< Format unused or unknown */ OMX_VIDEO_RVFormat8, /**< Real Video format 8 */ OMX_VIDEO_RVFormat9, /**< Real Video format 9 */ OMX_VIDEO_RVFormatG2, /**< Real Video Format G2 */ - OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_RVFormatKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_RVFormatVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_RVFormatMax = 0x7FFFFFFF } OMX_VIDEO_RVFORMATTYPE; -/** - * Real Video Params +/** + * Real Video Params * * STUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version information + * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * eFormat : Version of RV stream / data * nBitsPerPixel : Bits per pixel coded in the frame @@ -755,11 +753,11 @@ * nMaxEncodeFrameSize: Max encoded frame size * bEnablePostFilter : Turn on/off post filter * bEnableTemporalInterpolation : Turn on/off temporal interpolation - * bEnableLatencyMode : When enabled, the decoder does not display a decoded - * frame until it has detected that no enhancement layer - * frames or dependent B frames will be coming. This - * detection usually occurs when a subsequent non-B - * frame is encountered + * bEnableLatencyMode : When enabled, the decoder does not display a decoded + * frame until it has detected that no enhancement layer + * frames or dependent B frames will be coming. This + * detection usually occurs when a subsequent non-B + * frame is encountered */ typedef struct OMX_VIDEO_PARAM_RVTYPE { OMX_U32 nSize; @@ -779,8 +777,8 @@ } OMX_VIDEO_PARAM_RVTYPE; -/** - * AVC profile types, each profile indicates support for various +/** + * AVC profile types, each profile indicates support for various * performance bounds and different annexes. */ typedef enum OMX_VIDEO_AVCPROFILETYPE { @@ -791,15 +789,15 @@ OMX_VIDEO_AVCProfileHigh10 = 0x10, /**< High 10 profile */ OMX_VIDEO_AVCProfileHigh422 = 0x20, /**< High 4:2:2 profile */ OMX_VIDEO_AVCProfileHigh444 = 0x40, /**< High 4:4:4 profile */ - OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_AVCProfileKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_AVCProfileVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_AVCProfileMax = 0x7FFFFFFF + OMX_VIDEO_AVCProfileMax = 0x7FFFFFFF } OMX_VIDEO_AVCPROFILETYPE; -/** - * AVC level types, each level indicates support for various frame sizes, - * bit rates, decoder frame rates. No need +/** + * AVC level types, each level indicates support for various frame sizes, + * bit rates, decoder frame rates. No need */ typedef enum OMX_VIDEO_AVCLEVELTYPE { OMX_VIDEO_AVCLevel1 = 0x01, /**< Level 1 */ @@ -818,15 +816,14 @@ OMX_VIDEO_AVCLevel42 = 0x2000, /**< Level 4.2 */ OMX_VIDEO_AVCLevel5 = 0x4000, /**< Level 5 */ OMX_VIDEO_AVCLevel51 = 0x8000, /**< Level 5.1 */ - OMX_VIDEO_AVCLevel52 = 0x10000, /**< Level 5.2 */ - OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_AVCLevelKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_AVCLevelVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ - OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF + OMX_VIDEO_AVCLevelMax = 0x7FFFFFFF } OMX_VIDEO_AVCLEVELTYPE; -/** - * AVC loop filter modes +/** + * AVC loop filter modes * * OMX_VIDEO_AVCLoopFilterEnable : Enable * OMX_VIDEO_AVCLoopFilterDisable : Disable @@ -836,20 +833,20 @@ OMX_VIDEO_AVCLoopFilterEnable = 0, OMX_VIDEO_AVCLoopFilterDisable, OMX_VIDEO_AVCLoopFilterDisableSliceBoundary, - OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_AVCLoopFilterKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_AVCLoopFilterVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_AVCLoopFilterMax = 0x7FFFFFFF } OMX_VIDEO_AVCLOOPFILTERTYPE; -/** - * AVC params +/** + * AVC params * * STRUCT MEMBERS: * nSize : Size of the structure in bytes * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to - * nSliceHeaderSpacing : Number of macroblocks between slice header, put + * nSliceHeaderSpacing : Number of macroblocks between slice header, put * zero if not used * nPFrames : Number of P frames between each I frame * nBFrames : Number of B frames between each I frame @@ -862,85 +859,85 @@ * nRefIdxForward : Pic param set ref frame index (index into ref * frame buffer of forward frames list), B frame * support - * bEnableUEP : Enable/disable unequal error protection. This + * bEnableUEP : Enable/disable unequal error protection. This * is only valid of data partitioning is enabled. * bEnableFMO : Enable/disable flexible macroblock ordering * bEnableASO : Enable/disable arbitrary slice ordering * bEnableRS : Enable/disable sending of redundant slices * eProfile : AVC profile(s) to use * eLevel : AVC level(s) to use - * nAllowedPictureTypes : Specifies the picture types allowed in the + * nAllowedPictureTypes : Specifies the picture types allowed in the * bitstream - * bFrameMBsOnly : specifies that every coded picture of the - * coded video sequence is a coded frame + * bFrameMBsOnly : specifies that every coded picture of the + * coded video sequence is a coded frame * containing only frame macroblocks - * bMBAFF : Enable/disable switching between frame and + * bMBAFF : Enable/disable switching between frame and * field macroblocks within a picture - * bEntropyCodingCABAC : Entropy decoding method to be applied for the - * syntax elements for which two descriptors appear + * bEntropyCodingCABAC : Entropy decoding method to be applied for the + * syntax elements for which two descriptors appear * in the syntax tables - * bWeightedPPrediction : Enable/disable weighted prediction shall not + * bWeightedPPrediction : Enable/disable weighted prediction shall not * be applied to P and SP slices - * nWeightedBipredicitonMode : Default weighted prediction is applied to B - * slices + * nWeightedBipredicitonMode : Default weighted prediction is applied to B + * slices * bconstIpred : Enable/disable intra prediction - * bDirect8x8Inference : Specifies the method used in the derivation - * process for luma motion vectors for B_Skip, - * B_Direct_16x16 and B_Direct_8x8 as specified - * in subclause 8.4.1.2 of the AVC spec + * bDirect8x8Inference : Specifies the method used in the derivation + * process for luma motion vectors for B_Skip, + * B_Direct_16x16 and B_Direct_8x8 as specified + * in subclause 8.4.1.2 of the AVC spec * bDirectSpatialTemporal : Flag indicating spatial or temporal direct - * mode used in B slice coding (related to - * bDirect8x8Inference) . Spatial direct mode is + * mode used in B slice coding (related to + * bDirect8x8Inference) . Spatial direct mode is * more common and should be the default. * nCabacInitIdx : Index used to init CABAC contexts * eLoopFilterMode : Enable/disable loop filter */ typedef struct OMX_VIDEO_PARAM_AVCTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_U32 nSliceHeaderSpacing; - OMX_U32 nPFrames; - OMX_U32 nBFrames; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nSliceHeaderSpacing; + OMX_U32 nPFrames; + OMX_U32 nBFrames; OMX_BOOL bUseHadamard; - OMX_U32 nRefFrames; - OMX_U32 nRefIdx10ActiveMinus1; - OMX_U32 nRefIdx11ActiveMinus1; - OMX_BOOL bEnableUEP; - OMX_BOOL bEnableFMO; - OMX_BOOL bEnableASO; - OMX_BOOL bEnableRS; + OMX_U32 nRefFrames; + OMX_U32 nRefIdx10ActiveMinus1; + OMX_U32 nRefIdx11ActiveMinus1; + OMX_BOOL bEnableUEP; + OMX_BOOL bEnableFMO; + OMX_BOOL bEnableASO; + OMX_BOOL bEnableRS; OMX_VIDEO_AVCPROFILETYPE eProfile; - OMX_VIDEO_AVCLEVELTYPE eLevel; - OMX_U32 nAllowedPictureTypes; - OMX_BOOL bFrameMBsOnly; - OMX_BOOL bMBAFF; - OMX_BOOL bEntropyCodingCABAC; - OMX_BOOL bWeightedPPrediction; - OMX_U32 nWeightedBipredicitonMode; + OMX_VIDEO_AVCLEVELTYPE eLevel; + OMX_U32 nAllowedPictureTypes; + OMX_BOOL bFrameMBsOnly; + OMX_BOOL bMBAFF; + OMX_BOOL bEntropyCodingCABAC; + OMX_BOOL bWeightedPPrediction; + OMX_U32 nWeightedBipredicitonMode; OMX_BOOL bconstIpred ; - OMX_BOOL bDirect8x8Inference; - OMX_BOOL bDirectSpatialTemporal; - OMX_U32 nCabacInitIdc; - OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode; + OMX_BOOL bDirect8x8Inference; + OMX_BOOL bDirectSpatialTemporal; + OMX_U32 nCabacInitIdc; + OMX_VIDEO_AVCLOOPFILTERTYPE eLoopFilterMode; } OMX_VIDEO_PARAM_AVCTYPE; typedef struct OMX_VIDEO_PARAM_PROFILELEVELTYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_U32 eProfile; /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 eProfile; /**< type is OMX_VIDEO_AVCPROFILETYPE, OMX_VIDEO_H263PROFILETYPE, or OMX_VIDEO_MPEG4PROFILETYPE depending on context */ - OMX_U32 eLevel; /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, + OMX_U32 eLevel; /**< type is OMX_VIDEO_AVCLEVELTYPE, OMX_VIDEO_H263LEVELTYPE, or OMX_VIDEO_MPEG4PROFILETYPE depending on context */ OMX_U32 nProfileIndex; /**< Used to query for individual profile support information, - This parameter is valid only for + This parameter is valid only for OMX_IndexParamVideoProfileLevelQuerySupported index, For all other indices this parameter is to be ignored. */ } OMX_VIDEO_PARAM_PROFILELEVELTYPE; -/** - * Structure for dynamically configuring bitrate mode of a codec. +/** + * Structure for dynamically configuring bitrate mode of a codec. * * STRUCT MEMBERS: * nSize : Size of the struct in bytes @@ -949,18 +946,18 @@ * nEncodeBitrate : Target average bitrate to be generated in bps */ typedef struct OMX_VIDEO_CONFIG_BITRATETYPE { - OMX_U32 nSize; - OMX_VERSIONTYPE nVersion; - OMX_U32 nPortIndex; - OMX_U32 nEncodeBitrate; + OMX_U32 nSize; + OMX_VERSIONTYPE nVersion; + OMX_U32 nPortIndex; + OMX_U32 nEncodeBitrate; } OMX_VIDEO_CONFIG_BITRATETYPE; -/** +/** * Defines Encoder Frame Rate setting * * STRUCT MEMBERS: * nSize : Size of the structure in bytes - * nVersion : OMX specification version information + * nVersion : OMX specification version information * nPortIndex : Port that this structure applies to * xEncodeFramerate : Encoding framerate represented in Q16 format */ @@ -1000,8 +997,8 @@ OMX_U32 nMacroblocks; } OMX_PARAM_MACROBLOCKSTYPE; -/** - * AVC Slice Mode modes +/** + * AVC Slice Mode modes * * OMX_VIDEO_SLICEMODE_AVCDefault : Normal frame encoding, one slice per frame * OMX_VIDEO_SLICEMODE_AVCMBSlice : NAL mode, number of MBs per frame @@ -1011,13 +1008,13 @@ OMX_VIDEO_SLICEMODE_AVCDefault = 0, OMX_VIDEO_SLICEMODE_AVCMBSlice, OMX_VIDEO_SLICEMODE_AVCByteSlice, - OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ + OMX_VIDEO_SLICEMODE_AVCKhronosExtensions = 0x6F000000, /**< Reserved region for introducing Khronos Standard Extensions */ OMX_VIDEO_SLICEMODE_AVCVendorStartUnused = 0x7F000000, /**< Reserved region for introducing Vendor Extensions */ OMX_VIDEO_SLICEMODE_AVCLevelMax = 0x7FFFFFFF } OMX_VIDEO_AVCSLICEMODETYPE; -/** - * AVC FMO Slice Mode Params +/** + * AVC FMO Slice Mode Params * * STRUCT MEMBERS: * nSize : Size of the structure in bytes @@ -1028,7 +1025,7 @@ * eSliceMode : Specifies the type of slice */ typedef struct OMX_VIDEO_PARAM_AVCSLICEFMO { - OMX_U32 nSize; + OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_U8 nNumSliceGroups; @@ -1036,7 +1033,7 @@ OMX_VIDEO_AVCSLICEMODETYPE eSliceMode; } OMX_VIDEO_PARAM_AVCSLICEFMO; -/** +/** * AVC IDR Period Configs * * STRUCT MEMBERS: @@ -1047,14 +1044,14 @@ * nPFrames : Specifies internal of coding Intra frames */ typedef struct OMX_VIDEO_CONFIG_AVCINTRAPERIOD { - OMX_U32 nSize; + OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_U32 nIDRPeriod; OMX_U32 nPFrames; } OMX_VIDEO_CONFIG_AVCINTRAPERIOD; -/** +/** * AVC NAL Size Configs * * STRUCT MEMBERS: @@ -1064,7 +1061,7 @@ * nNaluBytes : Specifies the NAL unit size */ typedef struct OMX_VIDEO_CONFIG_NALSIZE { - OMX_U32 nSize; + OMX_U32 nSize; OMX_VERSIONTYPE nVersion; OMX_U32 nPortIndex; OMX_U32 nNaluBytes; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/powermanager/IPowerManager.h android-platform-frameworks-native-21/include/powermanager/IPowerManager.h --- android-platform-frameworks-native-6.0.1+r16/include/powermanager/IPowerManager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/powermanager/IPowerManager.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,6 @@ #include #include -#include namespace android { @@ -31,16 +30,8 @@ public: DECLARE_META_INTERFACE(PowerManager); - // FIXME remove the bool isOneWay parameters as they are not oneway in the .aidl - virtual status_t acquireWakeLock(int flags, const sp& lock, const String16& tag, - const String16& packageName, bool isOneWay = false) = 0; - virtual status_t acquireWakeLockWithUid(int flags, const sp& lock, const String16& tag, - const String16& packageName, int uid, bool isOneWay = false) = 0; - virtual status_t releaseWakeLock(const sp& lock, int flags, bool isOneWay = false) = 0; - virtual status_t updateWakeLockUids(const sp& lock, int len, const int *uids, - bool isOneWay = false) = 0; - // oneway in the .aidl - virtual status_t powerHint(int hintId, int data) = 0; + virtual status_t acquireWakeLock(int flags, const sp& lock, const String16& tag) = 0; + virtual status_t releaseWakeLock(const sp& lock, int flags) = 0; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/powermanager/PowerManager.h android-platform-frameworks-native-21/include/powermanager/PowerManager.h --- android-platform-frameworks-native-6.0.1+r16/include/powermanager/PowerManager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/powermanager/PowerManager.h 2012-10-16 22:57:11.000000000 +0000 @@ -24,14 +24,6 @@ POWERMANAGER_PARTIAL_WAKE_LOCK = 1, // equals PowerManager.PARTIAL_WAKE_LOCK constant }; -enum { - USER_ACTIVITY_EVENT_OTHER = 0, - USER_ACTIVITY_EVENT_BUTTON = 1, - USER_ACTIVITY_EVENT_TOUCH = 2, - - USER_ACTIVITY_EVENT_LAST = USER_ACTIVITY_EVENT_TOUCH, // Last valid event code. -}; - }; // namespace android #endif // ANDROID_POWERMANAGER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/binder/Static.h android-platform-frameworks-native-21/include/private/binder/Static.h --- android-platform-frameworks-native-6.0.1+r16/include/private/binder/Static.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/binder/Static.h 2012-10-16 22:57:11.000000000 +0000 @@ -27,14 +27,11 @@ namespace android { -// For TextStream.cpp -extern Vector gTextBuffers; - // For ProcessState.cpp extern Mutex gProcessMutex; extern sp gProcess; -// For IServiceManager.cpp +// For ServiceManager.cpp extern Mutex gDefaultServiceManagerLock; extern sp gDefaultServiceManager; extern sp gPermissionController; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/gui/ComposerService.h android-platform-frameworks-native-21/include/private/gui/ComposerService.h --- android-platform-frameworks-native-6.0.1+r16/include/private/gui/ComposerService.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/gui/ComposerService.h 2012-10-16 22:57:11.000000000 +0000 @@ -30,30 +30,21 @@ class IMemoryHeap; class ISurfaceComposer; +class surface_flinger_cblk_t; // --------------------------------------------------------------------------- -// This holds our connection to the composer service (i.e. SurfaceFlinger). -// If the remote side goes away, we will re-establish the connection. -// Users of this class should not retain the value from -// getComposerService() for an extended period. -// -// (It's not clear that using Singleton is useful here anymore.) class ComposerService : public Singleton { + // these are constants sp mComposerService; - sp mDeathObserver; - Mutex mLock; - + sp mServerCblkMemory; + surface_flinger_cblk_t volatile* mServerCblk; ComposerService(); - void connectLocked(); - void composerServiceDied(); friend class Singleton; public: - - // Get a connection to the Composer Service. This will block until - // a connection is established. static sp getComposerService(); + static surface_flinger_cblk_t const volatile * getControlBlock(); }; // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/gui/LayerState.h android-platform-frameworks-native-21/include/private/gui/LayerState.h --- android-platform-frameworks-native-6.0.1+r16/include/private/gui/LayerState.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/gui/LayerState.h 2012-10-16 22:57:11.000000000 +0000 @@ -24,40 +24,19 @@ #include #include +#include namespace android { class Parcel; class ISurfaceComposerClient; -/* - * Used to communicate layer information between SurfaceFlinger and its clients. - */ struct layer_state_t { - - enum { - eLayerHidden = 0x01, // SURFACE_HIDDEN in SurfaceControl.java - eLayerOpaque = 0x02, // SURFACE_OPAQUE - eLayerSecure = 0x80, // SECURE - }; - - enum { - ePositionChanged = 0x00000001, - eLayerChanged = 0x00000002, - eSizeChanged = 0x00000004, - eAlphaChanged = 0x00000008, - eMatrixChanged = 0x00000010, - eTransparentRegionChanged = 0x00000020, - eFlagsChanged = 0x00000040, - eLayerStackChanged = 0x00000080, - eCropChanged = 0x00000100, - }; - layer_state_t() - : what(0), - x(0), y(0), z(0), w(0), h(0), layerStack(0), - alpha(0), flags(0), mask(0), + : surface(0), what(0), + x(0), y(0), z(0), w(0), h(0), + alpha(0), tint(0), flags(0), mask(0), reserved(0) { matrix.dsdx = matrix.dtdy = 1.0f; @@ -74,15 +53,15 @@ float dsdy; float dtdy; }; - sp surface; + SurfaceID surface; uint32_t what; float x; float y; uint32_t z; uint32_t w; uint32_t h; - uint32_t layerStack; float alpha; + uint32_t tint; uint8_t flags; uint8_t mask; uint8_t reserved; @@ -99,36 +78,6 @@ status_t read(const Parcel& input); }; -struct DisplayState { - - enum { - eOrientationDefault = 0, - eOrientation90 = 1, - eOrientation180 = 2, - eOrientation270 = 3, - eOrientationUnchanged = 4, - eOrientationSwapMask = 0x01 - }; - - enum { - eSurfaceChanged = 0x01, - eLayerStackChanged = 0x02, - eDisplayProjectionChanged = 0x04, - eDisplaySizeChanged = 0x08 - }; - - uint32_t what; - sp token; - sp surface; - uint32_t layerStack; - uint32_t orientation; - Rect viewport; - Rect frame; - uint32_t width, height; - status_t write(Parcel& output) const; - status_t read(const Parcel& input); -}; - }; // namespace android #endif // ANDROID_SF_LAYER_STATE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/gui/SharedBufferStack.h android-platform-frameworks-native-21/include/private/gui/SharedBufferStack.h --- android-platform-frameworks-native-6.0.1+r16/include/private/gui/SharedBufferStack.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/gui/SharedBufferStack.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,59 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_SF_SHARED_BUFFER_STACK_H +#define ANDROID_SF_SHARED_BUFFER_STACK_H + +#include +#include + +#include + +namespace android { +// --------------------------------------------------------------------------- + +#define NUM_DISPLAY_MAX 4 + +struct display_cblk_t +{ + uint16_t w; + uint16_t h; + uint8_t format; + uint8_t orientation; + uint8_t reserved[2]; + float fps; + float density; + float xdpi; + float ydpi; + uint32_t pad[2]; +}; + +struct surface_flinger_cblk_t // 4KB max +{ + uint8_t connected; + uint8_t reserved[3]; + uint32_t pad[7]; + display_cblk_t displays[NUM_DISPLAY_MAX]; +}; + +// --------------------------------------------------------------------------- + +COMPILE_TIME_ASSERT(sizeof(surface_flinger_cblk_t) <= 4096) + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif /* ANDROID_SF_SHARED_BUFFER_STACK_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/gui/SyncFeatures.h android-platform-frameworks-native-21/include/private/gui/SyncFeatures.h --- android-platform-frameworks-native-6.0.1+r16/include/private/gui/SyncFeatures.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/gui/SyncFeatures.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,45 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_GUI_SYNC_FEATURES_H -#define ANDROID_GUI_SYNC_FEATURES_H - -#include -#include - - -namespace android { -// ---------------------------------------------------------------------------- - -class SyncFeatures : public Singleton { - friend class Singleton; - bool mHasNativeFenceSync; - bool mHasFenceSync; - bool mHasWaitSync; - String8 mString; - SyncFeatures(); - -public: - bool useNativeFenceSync() const; - bool useFenceSync() const; - bool useWaitSync() const; - String8 toString() const; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GUI_SYNC_FEATURES_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/ui/RegionHelper.h android-platform-frameworks-native-21/include/private/ui/RegionHelper.h --- android-platform-frameworks-native-6.0.1+r16/include/private/ui/RegionHelper.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/ui/RegionHelper.h 2012-10-16 22:57:11.000000000 +0000 @@ -26,10 +26,10 @@ template class region_operator { -public: typedef typename RECT::value_type TYPE; static const TYPE max_value = 0x7FFFFFF; +public: /* * Common boolean operations: * value is computed as 0b101 op 0b110 diff -Nru android-platform-frameworks-native-6.0.1+r16/include/private/utils/Static.h android-platform-frameworks-native-21/include/private/utils/Static.h --- android-platform-frameworks-native-6.0.1+r16/include/private/utils/Static.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/private/utils/Static.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,35 @@ +/* + * Copyright (C) 2008 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. + */ + +// All static variables go here, to control initialization and +// destruction order in the library. + +#include +#include + +namespace android { +// For TextStream.cpp +extern Vector gTextBuffers; + +// For String8.cpp +extern void initialize_string8(); +extern void terminate_string8(); + +// For String16.cpp +extern void initialize_string16(); +extern void terminate_string16(); + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/DisplayInfo.h android-platform-frameworks-native-21/include/ui/DisplayInfo.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/DisplayInfo.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/DisplayInfo.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,29 +14,27 @@ * limitations under the License. */ + #ifndef ANDROID_UI_DISPLAY_INFO_H #define ANDROID_UI_DISPLAY_INFO_H #include #include -#include #include namespace android { struct DisplayInfo { - uint32_t w; - uint32_t h; - float xdpi; - float ydpi; - float fps; - float density; - uint8_t orientation; - bool secure; - nsecs_t appVsyncOffset; - nsecs_t presentationDeadline; - int colorTransform; + uint32_t w; + uint32_t h; + PixelFormatInfo pixelFormatInfo; + uint8_t orientation; + uint8_t reserved[3]; + float fps; + float density; + float xdpi; + float ydpi; }; /* Display orientations as defined in Surface.java and ISurfaceComposer.h. */ @@ -47,6 +45,8 @@ DISPLAY_ORIENTATION_270 = 3 }; + }; // namespace android #endif // ANDROID_COMPOSER_DISPLAY_INFO_H + diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/DisplayStatInfo.h android-platform-frameworks-native-21/include/ui/DisplayStatInfo.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/DisplayStatInfo.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/DisplayStatInfo.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_UI_DISPLAY_STAT_INFO_H -#define ANDROID_UI_DISPLAY_STAT_INFO_H - -#include - -namespace android { - -struct DisplayStatInfo { - nsecs_t vsyncTime; - nsecs_t vsyncPeriod; -}; - -}; // namespace android - -#endif // ANDROID_COMPOSER_DISPLAY_STAT_INFO_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/Fence.h android-platform-frameworks-native-21/include/ui/Fence.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/Fence.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/Fence.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_FENCE_H -#define ANDROID_FENCE_H - -#include -#include - -#include -#include -#include -#include -#include -#include - -struct ANativeWindowBuffer; - -namespace android { - -// =========================================================================== -// Fence -// =========================================================================== - -class Fence - : public LightRefBase, public Flattenable -{ -public: - static const sp NO_FENCE; - - // TIMEOUT_NEVER may be passed to the wait method to indicate that it - // should wait indefinitely for the fence to signal. - enum { TIMEOUT_NEVER = -1 }; - - // Construct a new Fence object with an invalid file descriptor. This - // should be done when the Fence object will be set up by unflattening - // serialized data. - Fence(); - - // Construct a new Fence object to manage a given fence file descriptor. - // When the new Fence object is destructed the file descriptor will be - // closed. - Fence(int fenceFd); - - // Check whether the Fence has an open fence file descriptor. Most Fence - // methods treat an invalid file descriptor just like a valid fence that - // is already signalled, so using this is usually not necessary. - bool isValid() const { return mFenceFd != -1; } - - // wait waits for up to timeout milliseconds for the fence to signal. If - // the fence signals then NO_ERROR is returned. If the timeout expires - // before the fence signals then -ETIME is returned. A timeout of - // TIMEOUT_NEVER may be used to indicate that the call should wait - // indefinitely for the fence to signal. - status_t wait(int timeout); - - // waitForever is a convenience function for waiting forever for a fence to - // signal (just like wait(TIMEOUT_NEVER)), but issuing an error to the - // system log and fence state to the kernel log if the wait lasts longer - // than a warning timeout. - // The logname argument should be a string identifying - // the caller and will be included in the log message. - status_t waitForever(const char* logname); - - // merge combines two Fence objects, creating a new Fence object that - // becomes signaled when both f1 and f2 are signaled (even if f1 or f2 is - // destroyed before it becomes signaled). The name argument specifies the - // human-readable name to associated with the new Fence object. - static sp merge(const String8& name, const sp& f1, - const sp& f2); - - // Return a duplicate of the fence file descriptor. The caller is - // responsible for closing the returned file descriptor. On error, -1 will - // be returned and errno will indicate the problem. - int dup() const; - - // getSignalTime returns the system monotonic clock time at which the - // fence transitioned to the signaled state. If the fence is not signaled - // then INT64_MAX is returned. If the fence is invalid or if an error - // occurs then -1 is returned. - nsecs_t getSignalTime() const; - - // Flattenable interface - size_t getFlattenedSize() const; - size_t getFdCount() const; - status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const; - status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count); - -private: - // Only allow instantiation using ref counting. - friend class LightRefBase; - ~Fence(); - - // Disallow copying - Fence(const Fence& rhs); - Fence& operator = (const Fence& rhs); - const Fence& operator = (const Fence& rhs) const; - - int mFenceFd; -}; - -}; // namespace android - -#endif // ANDROID_FENCE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/FramebufferNativeWindow.h android-platform-frameworks-native-21/include/ui/FramebufferNativeWindow.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/FramebufferNativeWindow.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/FramebufferNativeWindow.h 2012-10-16 22:57:11.000000000 +0000 @@ -14,10 +14,6 @@ * limitations under the License. */ -#ifndef INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP -#warning "FramebufferNativeWindow is deprecated" -#endif - #ifndef ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H #define ANDROID_FRAMEBUFFER_NATIVE_WINDOW_H @@ -32,8 +28,7 @@ #include #include -#define MIN_NUM_FRAME_BUFFERS 2 -#define MAX_NUM_FRAME_BUFFERS 3 +#define NUM_FRAME_BUFFERS 2 extern "C" EGLNativeWindowType android_createDisplaySurface(void); @@ -70,19 +65,16 @@ friend class LightRefBase; ~FramebufferNativeWindow(); // this class cannot be overloaded static int setSwapInterval(ANativeWindow* window, int interval); - static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer, int* fenceFd); - static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer, int fenceFd); + static int dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer); + static int lockBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); + static int queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer); static int query(const ANativeWindow* window, int what, int* value); static int perform(ANativeWindow* window, int operation, ...); - - static int dequeueBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer** buffer); - static int queueBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer* buffer); - static int lockBuffer_DEPRECATED(ANativeWindow* window, ANativeWindowBuffer* buffer); - + framebuffer_device_t* fbDev; alloc_device_t* grDev; - sp buffers[MAX_NUM_FRAME_BUFFERS]; + sp buffers[NUM_FRAME_BUFFERS]; sp front; mutable Mutex mutex; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/FrameStats.h android-platform-frameworks-native-21/include/ui/FrameStats.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/FrameStats.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/FrameStats.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,63 +0,0 @@ -/* - * Copyright (C) 2014 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. - */ - -#ifndef ANDROID_UI_FRAME_STATS_H -#define ANDROID_UI_FRAME_STATS_H - -#include -#include -#include - -namespace android { - -class FrameStats : public LightFlattenable { -public: - - /* - * Approximate refresh time, in nanoseconds. - */ - nsecs_t refreshPeriodNano; - - /* - * The times in nanoseconds for when the frame contents were posted by the producer (e.g. - * the application). They are either explicitly set or defaulted to the time when - * Surface::queueBuffer() was called. - */ - Vector desiredPresentTimesNano; - - /* - * The times in milliseconds for when the frame contents were presented on the screen. - */ - Vector actualPresentTimesNano; - - /* - * The times in nanoseconds for when the frame contents were ready to be presented. Note that - * a frame can be posted and still it contents being rendered asynchronously in GL. In such a - * case these are the times when the frame contents were completely rendered (i.e. their fences - * signaled). - */ - Vector frameReadyTimesNano; - - // LightFlattenable - bool isFixedSize() const; - size_t getFlattenedSize() const; - status_t flatten(void* buffer, size_t size) const; - status_t unflatten(void const* buffer, size_t size); -}; - -}; // namespace android - -#endif // ANDROID_UI_FRAME_STATS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/GraphicBufferAllocator.h android-platform-frameworks-native-21/include/ui/GraphicBufferAllocator.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/GraphicBufferAllocator.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/GraphicBufferAllocator.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,17 +1,17 @@ -/* +/* ** ** Copyright 2009, 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 +** 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 +** 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 +** 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. */ @@ -45,14 +45,14 @@ USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY, USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN, USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK, - + USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER, USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, USAGE_SW_WRITE_MASK = GRALLOC_USAGE_SW_WRITE_MASK, - + USAGE_SOFTWARE_MASK = USAGE_SW_READ_MASK|USAGE_SW_WRITE_MASK, - + USAGE_HW_TEXTURE = GRALLOC_USAGE_HW_TEXTURE, USAGE_HW_RENDER = GRALLOC_USAGE_HW_RENDER, USAGE_HW_2D = GRALLOC_USAGE_HW_2D, @@ -60,9 +60,10 @@ }; static inline GraphicBufferAllocator& get() { return getInstance(); } + - status_t alloc(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, - buffer_handle_t* handle, uint32_t* stride); + status_t alloc(uint32_t w, uint32_t h, PixelFormat format, int usage, + buffer_handle_t* handle, int32_t* stride); status_t free(buffer_handle_t handle); @@ -71,21 +72,21 @@ private: struct alloc_rec_t { - uint32_t width; - uint32_t height; - uint32_t stride; + uint32_t w; + uint32_t h; + uint32_t s; PixelFormat format; uint32_t usage; size_t size; }; - + static Mutex sLock; static KeyedVector sAllocList; - + friend class Singleton; GraphicBufferAllocator(); ~GraphicBufferAllocator(); - + alloc_device_t *mAllocDev; }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/GraphicBuffer.h android-platform-frameworks-native-21/include/ui/GraphicBuffer.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/GraphicBuffer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/GraphicBuffer.h 2012-10-16 22:57:11.000000000 +0000 @@ -24,7 +24,6 @@ #include #include #include -#include struct ANativeWindowBuffer; @@ -38,10 +37,11 @@ // =========================================================================== class GraphicBuffer - : public ANativeObjectBase< ANativeWindowBuffer, GraphicBuffer, RefBase >, - public Flattenable + : public ANativeObjectBase< + ANativeWindowBuffer, + GraphicBuffer, + LightRefBase >, public Flattenable { - friend class Flattenable; public: enum { @@ -49,7 +49,7 @@ USAGE_SW_READ_RARELY = GRALLOC_USAGE_SW_READ_RARELY, USAGE_SW_READ_OFTEN = GRALLOC_USAGE_SW_READ_OFTEN, USAGE_SW_READ_MASK = GRALLOC_USAGE_SW_READ_MASK, - + USAGE_SW_WRITE_NEVER = GRALLOC_USAGE_SW_WRITE_NEVER, USAGE_SW_WRITE_RARELY = GRALLOC_USAGE_SW_WRITE_RARELY, USAGE_SW_WRITE_OFTEN = GRALLOC_USAGE_SW_WRITE_OFTEN, @@ -64,21 +64,17 @@ USAGE_HW_2D = GRALLOC_USAGE_HW_2D, USAGE_HW_COMPOSER = GRALLOC_USAGE_HW_COMPOSER, USAGE_HW_VIDEO_ENCODER = GRALLOC_USAGE_HW_VIDEO_ENCODER, - USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK, - - USAGE_CURSOR = GRALLOC_USAGE_CURSOR, + USAGE_HW_MASK = GRALLOC_USAGE_HW_MASK }; GraphicBuffer(); // creates w * h buffer - GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, - uint32_t inUsage); + GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage); // create a buffer from an existing handle - GraphicBuffer(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, - uint32_t inUsage, uint32_t inStride, native_handle_t* inHandle, - bool keepOwnership); + GraphicBuffer(uint32_t w, uint32_t h, PixelFormat format, uint32_t usage, + uint32_t stride, native_handle_t* handle, bool keepOwnership); // create a buffer from an existing ANativeWindowBuffer GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership); @@ -86,54 +82,29 @@ // return status status_t initCheck() const; - uint32_t getWidth() const { return static_cast(width); } - uint32_t getHeight() const { return static_cast(height); } - uint32_t getStride() const { return static_cast(stride); } - uint32_t getUsage() const { return static_cast(usage); } + uint32_t getWidth() const { return width; } + uint32_t getHeight() const { return height; } + uint32_t getStride() const { return stride; } + uint32_t getUsage() const { return usage; } PixelFormat getPixelFormat() const { return format; } Rect getBounds() const { return Rect(width, height); } - uint64_t getId() const { return mId; } - - uint32_t getGenerationNumber() const { return mGenerationNumber; } - void setGenerationNumber(uint32_t generation) { - mGenerationNumber = generation; - } + + status_t reallocate(uint32_t w, uint32_t h, PixelFormat f, uint32_t usage); - status_t reallocate(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage); - - bool needsReallocation(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage); - - status_t lock(uint32_t inUsage, void** vaddr); - status_t lock(uint32_t inUsage, const Rect& rect, void** vaddr); - // For HAL_PIXEL_FORMAT_YCbCr_420_888 - status_t lockYCbCr(uint32_t inUsage, android_ycbcr *ycbcr); - status_t lockYCbCr(uint32_t inUsage, const Rect& rect, - android_ycbcr *ycbcr); + status_t lock(uint32_t usage, void** vaddr); + status_t lock(uint32_t usage, const Rect& rect, void** vaddr); status_t unlock(); - status_t lockAsync(uint32_t inUsage, void** vaddr, int fenceFd); - status_t lockAsync(uint32_t inUsage, const Rect& rect, void** vaddr, - int fenceFd); - status_t lockAsyncYCbCr(uint32_t inUsage, android_ycbcr *ycbcr, - int fenceFd); - status_t lockAsyncYCbCr(uint32_t inUsage, const Rect& rect, - android_ycbcr *ycbcr, int fenceFd); - status_t unlockAsync(int *fenceFd); ANativeWindowBuffer* getNativeBuffer() const; + + void setIndex(int index); + int getIndex() const; // for debugging static void dumpAllocationsToSystemLog(); - // Flattenable protocol - size_t getFlattenedSize() const; - size_t getFdCount() const; - status_t flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const; - status_t unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count); - private: - ~GraphicBuffer(); + virtual ~GraphicBuffer(); enum { ownNone = 0, @@ -153,29 +124,33 @@ friend class Surface; friend class BpSurface; friend class BnSurface; + friend class SurfaceTextureClient; friend class LightRefBase; GraphicBuffer(const GraphicBuffer& rhs); GraphicBuffer& operator = (const GraphicBuffer& rhs); const GraphicBuffer& operator = (const GraphicBuffer& rhs) const; - status_t initSize(uint32_t inWidth, uint32_t inHeight, PixelFormat inFormat, - uint32_t inUsage); + status_t initSize(uint32_t w, uint32_t h, PixelFormat format, + uint32_t usage); void free_handle(); + // Flattenable interface + size_t getFlattenedSize() const; + size_t getFdCount() const; + status_t flatten(void* buffer, size_t size, + int fds[], size_t count) const; + status_t unflatten(void const* buffer, size_t size, + int fds[], size_t count); + + GraphicBufferMapper& mBufferMapper; ssize_t mInitCheck; + int mIndex; // If we're wrapping another buffer then this reference will make sure it // doesn't get freed. sp mWrappedBuffer; - - uint64_t mId; - - // Stores the generation number of this buffer. If this number does not - // match the BufferQueue's internal generation number (set through - // IGBP::setGenerationNumber), attempts to attach the buffer will fail. - uint32_t mGenerationNumber; }; }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/GraphicBufferMapper.h android-platform-frameworks-native-21/include/ui/GraphicBufferMapper.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/GraphicBufferMapper.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/GraphicBufferMapper.h 2012-10-16 22:57:11.000000000 +0000 @@ -41,24 +41,12 @@ status_t registerBuffer(buffer_handle_t handle); status_t unregisterBuffer(buffer_handle_t handle); - + status_t lock(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, void** vaddr); - - status_t lockYCbCr(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr); + int usage, const Rect& bounds, void** vaddr); status_t unlock(buffer_handle_t handle); - - status_t lockAsync(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, void** vaddr, int fenceFd); - - status_t lockAsyncYCbCr(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr, - int fenceFd); - - status_t unlockAsync(buffer_handle_t handle, int *fenceFd); - + // dumps information about the mapping of this handle void dump(buffer_handle_t handle); diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/mat4.h android-platform-frameworks-native-21/include/ui/mat4.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/mat4.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/mat4.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,395 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef UI_MAT4_H -#define UI_MAT4_H - -#include -#include - -#include -#include - -#define TMAT_IMPLEMENTATION -#include - -#define PURE __attribute__((pure)) - -namespace android { -// ------------------------------------------------------------------------------------- - -template -class tmat44 : public TVecUnaryOperators, - public TVecComparisonOperators, - public TVecAddOperators, - public TMatProductOperators, - public TMatSquareFunctions, - public TMatDebug -{ -public: - enum no_init { NO_INIT }; - typedef T value_type; - typedef T& reference; - typedef T const& const_reference; - typedef size_t size_type; - typedef tvec4 col_type; - typedef tvec4 row_type; - - // size of a column (i.e.: number of rows) - enum { COL_SIZE = col_type::SIZE }; - static inline size_t col_size() { return COL_SIZE; } - - // size of a row (i.e.: number of columns) - enum { ROW_SIZE = row_type::SIZE }; - static inline size_t row_size() { return ROW_SIZE; } - static inline size_t size() { return row_size(); } // for TVec*<> - -private: - - /* - * <-- N columns --> - * - * a00 a10 a20 ... aN0 ^ - * a01 a11 a21 ... aN1 | - * a02 a12 a22 ... aN2 M rows - * ... | - * a0M a1M a2M ... aNM v - * - * COL_SIZE = M - * ROW_SIZE = N - * m[0] = [a00 a01 a02 ... a01M] - */ - - col_type mValue[ROW_SIZE]; - -public: - // array access - inline col_type const& operator [] (size_t i) const { return mValue[i]; } - inline col_type& operator [] (size_t i) { return mValue[i]; } - - T const* asArray() const { return &mValue[0][0]; } - - // ----------------------------------------------------------------------- - // we don't provide copy-ctor and operator= on purpose - // because we want the compiler generated versions - - /* - * constructors - */ - - // leaves object uninitialized. use with caution. - explicit tmat44(no_init) { } - - // initialize to identity - tmat44(); - - // initialize to Identity*scalar. - template - explicit tmat44(U v); - - // sets the diagonal to the passed vector - template - explicit tmat44(const tvec4& rhs); - - // construct from another matrix of the same size - template - explicit tmat44(const tmat44& rhs); - - // construct from 4 column vectors - template - tmat44(const tvec4& v0, const tvec4& v1, const tvec4& v2, const tvec4& v3); - - // construct from 16 scalars - template < - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, - typename I, typename J, typename K, typename L, - typename M, typename N, typename O, typename P> - tmat44( A m00, B m01, C m02, D m03, - E m10, F m11, G m12, H m13, - I m20, J m21, K m22, L m23, - M m30, N m31, O m32, P m33); - - // construct from a C array - template - explicit tmat44(U const* rawArray); - - /* - * helpers - */ - - static tmat44 ortho(T left, T right, T bottom, T top, T near, T far); - - static tmat44 frustum(T left, T right, T bottom, T top, T near, T far); - - template - static tmat44 lookAt(const tvec3& eye, const tvec3& center, const tvec3& up); - - template - static tmat44 translate(const tvec4& t); - - template - static tmat44 scale(const tvec4& s); - - template - static tmat44 rotate(A radian, const tvec3& about); -}; - -// ---------------------------------------------------------------------------------------- -// Constructors -// ---------------------------------------------------------------------------------------- - -/* - * Since the matrix code could become pretty big quickly, we don't inline most - * operations. - */ - -template -tmat44::tmat44() { - mValue[0] = col_type(1,0,0,0); - mValue[1] = col_type(0,1,0,0); - mValue[2] = col_type(0,0,1,0); - mValue[3] = col_type(0,0,0,1); -} - -template -template -tmat44::tmat44(U v) { - mValue[0] = col_type(v,0,0,0); - mValue[1] = col_type(0,v,0,0); - mValue[2] = col_type(0,0,v,0); - mValue[3] = col_type(0,0,0,v); -} - -template -template -tmat44::tmat44(const tvec4& v) { - mValue[0] = col_type(v.x,0,0,0); - mValue[1] = col_type(0,v.y,0,0); - mValue[2] = col_type(0,0,v.z,0); - mValue[3] = col_type(0,0,0,v.w); -} - -// construct from 16 scalars -template -template < - typename A, typename B, typename C, typename D, - typename E, typename F, typename G, typename H, - typename I, typename J, typename K, typename L, - typename M, typename N, typename O, typename P> -tmat44::tmat44( A m00, B m01, C m02, D m03, - E m10, F m11, G m12, H m13, - I m20, J m21, K m22, L m23, - M m30, N m31, O m32, P m33) { - mValue[0] = col_type(m00, m01, m02, m03); - mValue[1] = col_type(m10, m11, m12, m13); - mValue[2] = col_type(m20, m21, m22, m23); - mValue[3] = col_type(m30, m31, m32, m33); -} - -template -template -tmat44::tmat44(const tmat44& rhs) { - for (size_t r=0 ; r -template -tmat44::tmat44(const tvec4& v0, const tvec4& v1, const tvec4& v2, const tvec4& v3) { - mValue[0] = v0; - mValue[1] = v1; - mValue[2] = v2; - mValue[3] = v3; -} - -template -template -tmat44::tmat44(U const* rawArray) { - for (size_t r=0 ; r -tmat44 tmat44::ortho(T left, T right, T bottom, T top, T near, T far) { - tmat44 m; - m[0][0] = 2 / (right - left); - m[1][1] = 2 / (top - bottom); - m[2][2] = -2 / (far - near); - m[3][0] = -(right + left) / (right - left); - m[3][1] = -(top + bottom) / (top - bottom); - m[3][2] = -(far + near) / (far - near); - return m; -} - -template -tmat44 tmat44::frustum(T left, T right, T bottom, T top, T near, T far) { - tmat44 m; - T A = (right + left) / (right - left); - T B = (top + bottom) / (top - bottom); - T C = (far + near) / (far - near); - T D = (2 * far * near) / (far - near); - m[0][0] = (2 * near) / (right - left); - m[1][1] = (2 * near) / (top - bottom); - m[2][0] = A; - m[2][1] = B; - m[2][2] = C; - m[2][3] =-1; - m[3][2] = D; - m[3][3] = 0; - return m; -} - -template -template -tmat44 tmat44::lookAt(const tvec3& eye, const tvec3& center, const tvec3& up) { - tvec3 L(normalize(center - eye)); - tvec3 S(normalize( cross(L, up) )); - tvec3 U(cross(S, L)); - return tmat44( - tvec4( S, 0), - tvec4( U, 0), - tvec4(-L, 0), - tvec4(-eye, 1)); -} - -template -template -tmat44 tmat44::translate(const tvec4& t) { - tmat44 r; - r[3] = t; - return r; -} - -template -template -tmat44 tmat44::scale(const tvec4& s) { - tmat44 r; - r[0][0] = s[0]; - r[1][1] = s[1]; - r[2][2] = s[2]; - r[3][3] = s[3]; - return r; -} - -template -template -tmat44 tmat44::rotate(A radian, const tvec3& about) { - tmat44 rotation; - T* r = const_cast(rotation.asArray()); - T c = cos(radian); - T s = sin(radian); - if (about.x==1 && about.y==0 && about.z==0) { - r[5] = c; r[10]= c; - r[6] = s; r[9] = -s; - } else if (about.x==0 && about.y==1 && about.z==0) { - r[0] = c; r[10]= c; - r[8] = s; r[2] = -s; - } else if (about.x==0 && about.y==0 && about.z==1) { - r[0] = c; r[5] = c; - r[1] = s; r[4] = -s; - } else { - tvec3 nabout = normalize(about); - B x = nabout.x; - B y = nabout.y; - B z = nabout.z; - T nc = 1 - c; - T xy = x * y; - T yz = y * z; - T zx = z * x; - T xs = x * s; - T ys = y * s; - T zs = z * s; - r[ 0] = x*x*nc + c; r[ 4] = xy*nc - zs; r[ 8] = zx*nc + ys; - r[ 1] = xy*nc + zs; r[ 5] = y*y*nc + c; r[ 9] = yz*nc - xs; - r[ 2] = zx*nc - ys; r[ 6] = yz*nc + xs; r[10] = z*z*nc + c; - } - return rotation; -} - -// ---------------------------------------------------------------------------------------- -// Arithmetic operators outside of class -// ---------------------------------------------------------------------------------------- - -/* We use non-friend functions here to prevent the compiler from using - * implicit conversions, for instance of a scalar to a vector. The result would - * not be what the caller expects. - * - * Also note that the order of the arguments in the inner loop is important since - * it determines the output type (only relevant when T != U). - */ - -// matrix * vector, result is a vector of the same type than the input vector -template -typename tmat44::col_type PURE operator *(const tmat44& lv, const tvec4& rv) { - typename tmat44::col_type result; - for (size_t r=0 ; r::row_size() ; r++) - result += rv[r]*lv[r]; - return result; -} - -// vector * matrix, result is a vector of the same type than the input vector -template -typename tmat44::row_type PURE operator *(const tvec4& rv, const tmat44& lv) { - typename tmat44::row_type result(tmat44::row_type::NO_INIT); - for (size_t r=0 ; r::row_size() ; r++) - result[r] = dot(rv, lv[r]); - return result; -} - -// matrix * scalar, result is a matrix of the same type than the input matrix -template -tmat44 PURE operator *(const tmat44& lv, U rv) { - tmat44 result(tmat44::NO_INIT); - for (size_t r=0 ; r::row_size() ; r++) - result[r] = lv[r]*rv; - return result; -} - -// scalar * matrix, result is a matrix of the same type than the input matrix -template -tmat44 PURE operator *(U rv, const tmat44& lv) { - tmat44 result(tmat44::NO_INIT); - for (size_t r=0 ; r::row_size() ; r++) - result[r] = lv[r]*rv; - return result; -} - -// ---------------------------------------------------------------------------------------- - -/* FIXME: this should go into TMatSquareFunctions<> but for some reason - * BASE::col_type is not accessible from there (???) - */ -template -typename tmat44::col_type PURE diag(const tmat44& m) { - return matrix::diag(m); -} - -// ---------------------------------------------------------------------------------------- - -typedef tmat44 mat4; - -// ---------------------------------------------------------------------------------------- -}; // namespace android - -#undef PURE - -#endif /* UI_MAT4_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/PixelFormat.h android-platform-frameworks-native-21/include/ui/PixelFormat.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/PixelFormat.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/PixelFormat.h 2012-10-16 22:57:11.000000000 +0000 @@ -25,6 +25,9 @@ #ifndef UI_PIXELFORMAT_H #define UI_PIXELFORMAT_H +#include +#include +#include #include namespace android { @@ -53,19 +56,72 @@ // real pixel formats supported for rendering ----------------------------- - PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA - PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0 - PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB - PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB - PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA - PIXEL_FORMAT_RGBA_5551 = 6, // 16-bit ARGB - PIXEL_FORMAT_RGBA_4444 = 7, // 16-bit ARGB + PIXEL_FORMAT_RGBA_8888 = HAL_PIXEL_FORMAT_RGBA_8888, // 4x8-bit RGBA + PIXEL_FORMAT_RGBX_8888 = HAL_PIXEL_FORMAT_RGBX_8888, // 4x8-bit RGB0 + PIXEL_FORMAT_RGB_888 = HAL_PIXEL_FORMAT_RGB_888, // 3x8-bit RGB + PIXEL_FORMAT_RGB_565 = HAL_PIXEL_FORMAT_RGB_565, // 16-bit RGB + PIXEL_FORMAT_BGRA_8888 = HAL_PIXEL_FORMAT_BGRA_8888, // 4x8-bit BGRA + PIXEL_FORMAT_RGBA_5551 = HAL_PIXEL_FORMAT_RGBA_5551, // 16-bit ARGB + PIXEL_FORMAT_RGBA_4444 = HAL_PIXEL_FORMAT_RGBA_4444, // 16-bit ARGB + PIXEL_FORMAT_A_8 = 8, // 8-bit A }; typedef int32_t PixelFormat; -uint32_t bytesPerPixel(PixelFormat format); -uint32_t bitsPerPixel(PixelFormat format); +struct PixelFormatInfo { + enum { + INDEX_ALPHA = 0, + INDEX_RED = 1, + INDEX_GREEN = 2, + INDEX_BLUE = 3 + }; + + enum { // components + ALPHA = 1, + RGB = 2, + RGBA = 3, + L = 4, + LA = 5, + OTHER = 0xFF + }; + + struct szinfo { + uint8_t h; + uint8_t l; + }; + + inline PixelFormatInfo() : version(sizeof(PixelFormatInfo)) { } + size_t getScanlineSize(unsigned int width) const; + size_t getSize(size_t ci) const { + return (ci <= 3) ? (cinfo[ci].h - cinfo[ci].l) : 0; + } + size_t version; + PixelFormat format; + size_t bytesPerPixel; + size_t bitsPerPixel; + union { + szinfo cinfo[4]; + struct { + uint8_t h_alpha; + uint8_t l_alpha; + uint8_t h_red; + uint8_t l_red; + uint8_t h_green; + uint8_t l_green; + uint8_t h_blue; + uint8_t l_blue; + }; + }; + uint8_t components; + uint8_t reserved0[3]; + uint32_t reserved1; +}; + +// Consider caching the results of these functions are they're not +// guaranteed to be fast. +ssize_t bytesPerPixel(PixelFormat format); +ssize_t bitsPerPixel(PixelFormat format); +status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info); }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/Point.h android-platform-frameworks-native-21/include/ui/Point.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/Point.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/Point.h 2012-10-16 22:57:11.000000000 +0000 @@ -17,12 +17,11 @@ #ifndef ANDROID_UI_POINT #define ANDROID_UI_POINT -#include #include namespace android { -class Point : public LightFlattenablePod +class Point { public: int x; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/Rect.h android-platform-frameworks-native-21/include/ui/Rect.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/Rect.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/Rect.h 2012-10-16 22:57:11.000000000 +0000 @@ -17,8 +17,6 @@ #ifndef ANDROID_UI_RECT #define ANDROID_UI_RECT -#include -#include #include #include @@ -26,54 +24,24 @@ namespace android { -class Rect : public ARect, public LightFlattenablePod +class Rect : public ARect { public: typedef ARect::value_type value_type; - static const Rect INVALID_RECT; - // we don't provide copy-ctor and operator= on purpose // because we want the compiler generated versions inline Rect() { - left = right = top = bottom = 0; } - inline Rect(int32_t w, int32_t h) { - left = top = 0; - right = w; - bottom = h; - } - - inline Rect(uint32_t w, uint32_t h) { - if (w > INT32_MAX) { - ALOG(LOG_WARN, "Rect", - "Width %u too large for Rect class, clamping", w); - w = INT32_MAX; - } - if (h > INT32_MAX) { - ALOG(LOG_WARN, "Rect", - "Height %u too large for Rect class, clamping", h); - h = INT32_MAX; - } - left = top = 0; - right = w; - bottom = h; + left = top = 0; right = w; bottom = h; } - inline Rect(int32_t l, int32_t t, int32_t r, int32_t b) { - left = l; - top = t; - right = r; - bottom = b; + left = l; top = t; right = r; bottom = b; } - inline Rect(const Point& lt, const Point& rb) { - left = lt.x; - top = lt.y; - right = rb.x; - bottom = rb.y; + left = lt.x; top = lt.y; right = rb.x; bottom = rb.y; } void makeInvalid(); @@ -84,36 +52,43 @@ // a valid rectangle has a non negative width and height inline bool isValid() const { - return (getWidth() >= 0) && (getHeight() >= 0); + return (width()>=0) && (height()>=0); } // an empty rect has a zero width or height, or is invalid inline bool isEmpty() const { - return (getWidth() <= 0) || (getHeight() <= 0); + return (width()<=0) || (height()<=0); + } + + inline void set(const Rect& rhs) { + operator = (rhs); } // rectangle's width inline int32_t getWidth() const { - return right - left; + return right-left; } - + // rectangle's height inline int32_t getHeight() const { - return bottom - top; + return bottom-top; } inline Rect getBounds() const { - return Rect(right - left, bottom - top); + return Rect(right-left, bottom-top); } + inline int32_t width() const { return getWidth(); } + inline int32_t height() const { return getHeight(); } + void setLeftTop(const Point& lt) { left = lt.x; - top = lt.y; + top = lt.y; } void setRightBottom(const Point& rb) { right = rb.x; - bottom = rb.y; + bottom = rb.y; } // the following 4 functions return the 4 corners of the rect as Point @@ -144,16 +119,6 @@ // vectors. bool operator < (const Rect& rhs) const; - const Rect operator + (const Point& rhs) const; - const Rect operator - (const Point& rhs) const; - - Rect& operator += (const Point& rhs) { - return offsetBy(rhs.x, rhs.y); - } - Rect& operator -= (const Point& rhs) { - return offsetBy(-rhs.x, -rhs.y); - } - Rect& offsetToOrigin() { right -= left; bottom -= top; @@ -166,11 +131,22 @@ Rect& offsetBy(const Point& dp) { return offsetBy(dp.x, dp.y); } + Rect& operator += (const Point& rhs) { + return offsetBy(rhs.x, rhs.y); + } + Rect& operator -= (const Point& rhs) { + return offsetBy(-rhs.x, -rhs.y); + } + const Rect operator + (const Point& rhs) const; + const Rect operator - (const Point& rhs) const; - Rect& offsetTo(int32_t x, int32_t y); - Rect& offsetBy(int32_t x, int32_t y); + void translate(int32_t dx, int32_t dy) { // legacy, don't use. + offsetBy(dx, dy); + } - bool intersect(const Rect& with, Rect* result) const; + Rect& offsetTo(int32_t x, int32_t y); + Rect& offsetBy(int32_t x, int32_t y); + bool intersect(const Rect& with, Rect* result) const; // Create a new Rect by transforming this one using a graphics HAL // transform. This rectangle is defined in a coordinate space starting at @@ -179,15 +155,6 @@ // (height, width). Otherwise the output rectangle is in the same space as // the input. Rect transform(uint32_t xform, int32_t width, int32_t height) const; - - // this calculates (Region(*this) - exclude).bounds() efficiently - Rect reduce(const Rect& exclude) const; - - - // for backward compatibility - inline int32_t width() const { return getWidth(); } - inline int32_t height() const { return getHeight(); } - inline void set(const Rect& rhs) { operator = (rhs); } }; ANDROID_BASIC_TYPES_TRAITS(Rect) diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/Region.h android-platform-frameworks-native-21/include/ui/Region.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/Region.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/Region.h 2012-10-16 22:57:11.000000000 +0000 @@ -23,46 +23,37 @@ #include #include -#include namespace android { // --------------------------------------------------------------------------- -class SharedBuffer; class String8; // --------------------------------------------------------------------------- -class Region : public LightFlattenable +class Region { public: - static const Region INVALID_REGION; - Region(); Region(const Region& rhs); explicit Region(const Rect& rhs); + explicit Region(const void* buffer); ~Region(); - - static Region createTJunctionFreeRegion(const Region& r); - + Region& operator = (const Region& rhs); - inline bool isEmpty() const { return getBounds().isEmpty(); } - inline bool isRect() const { return mStorage.size() == 1; } + inline bool isEmpty() const { return mBounds.isEmpty(); } + inline bool isRect() const { return mStorage.isEmpty(); } - inline Rect getBounds() const { return mStorage[mStorage.size() - 1]; } + inline Rect getBounds() const { return mBounds; } inline Rect bounds() const { return getBounds(); } - bool contains(const Point& point) const; - bool contains(int x, int y) const; - // the region becomes its bounds Region& makeBoundsSelf(); - + void clear(); void set(const Rect& r); - void set(int32_t w, int32_t h); void set(uint32_t w, uint32_t h); - + Region& orSelf(const Rect& rhs); Region& xorSelf(const Rect& rhs); Region& andSelf(const Rect& rhs); @@ -113,38 +104,30 @@ inline Region& operator -= (const Region& rhs); inline Region& operator += (const Point& pt); - - // returns true if the regions share the same underlying storage - bool isTriviallyEqual(const Region& region) const; - - + /* various ways to access the rectangle list */ - - - // STL-like iterators + typedef Rect const* const_iterator; - const_iterator begin() const; - const_iterator end() const; - - // returns an array of rect which has the same life-time has this - // Region object. - Rect const* getArray(size_t* count) const; - - // returns a SharedBuffer as well as the number of rects. - // ownership is transfered to the caller. - // the caller must call SharedBuffer::release() to free the memory. - SharedBuffer const* getSharedBuffer(size_t* count) const; + + const_iterator begin() const; + const_iterator end() const; /* no user serviceable parts here... */ + + size_t getRects(Vector& rectList) const; + Rect const* getArray(size_t* count) const; + // add a rectangle to the internal list. This rectangle must // be sorted in Y and X and must not make the region invalid. void addRectUnchecked(int l, int t, int r, int b); - inline bool isFixedSize() const { return false; } - size_t getFlattenedSize() const; - status_t flatten(void* buffer, size_t size) const; - status_t unflatten(void const* buffer, size_t size); + // flatten/unflatten a region to/from a raw buffer + ssize_t write(void* buffer, size_t size) const; + static ssize_t writeEmpty(void* buffer, size_t size); + + ssize_t read(const void* buffer); + static bool isEmpty(void* buffer); void dump(String8& out, const char* what, uint32_t flags=0) const; void dump(const char* what, uint32_t flags=0) const; @@ -152,7 +135,7 @@ private: class rasterizer; friend class rasterizer; - + Region& operationSelf(const Rect& r, int op); Region& operationSelf(const Region& r, int op); Region& operationSelf(const Region& r, int dx, int dy, int op); @@ -173,14 +156,10 @@ static void translate(Region& reg, int dx, int dy); static void translate(Region& dst, const Region& reg, int dx, int dy); - static bool validate(const Region& reg, - const char* name, bool silent = false); - - // mStorage is a (manually) sorted array of Rects describing the region - // with an extra Rect as the last element which is set to the - // bounds of the region. However, if the region is - // a simple Rect then mStorage contains only that rect. - Vector mStorage; + static bool validate(const Region& reg, const char* name); + + Rect mBounds; + Vector mStorage; }; diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/TMatHelpers.h android-platform-frameworks-native-21/include/ui/TMatHelpers.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/TMatHelpers.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/TMatHelpers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,257 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef TMAT_IMPLEMENTATION -#error "Don't include TMatHelpers.h directly. use ui/mat*.h instead" -#else -#undef TMAT_IMPLEMENTATION -#endif - - -#ifndef UI_TMAT_HELPERS_H -#define UI_TMAT_HELPERS_H - -#include -#include -#include -#include -#include - -#define PURE __attribute__((pure)) - -namespace android { -// ------------------------------------------------------------------------------------- - -/* - * No user serviceable parts here. - * - * Don't use this file directly, instead include ui/mat*.h - */ - - -/* - * Matrix utilities - */ - -namespace matrix { - -inline int PURE transpose(int v) { return v; } -inline float PURE transpose(float v) { return v; } -inline double PURE transpose(double v) { return v; } - -inline int PURE trace(int v) { return v; } -inline float PURE trace(float v) { return v; } -inline double PURE trace(double v) { return v; } - -template -MATRIX PURE inverse(const MATRIX& src) { - - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::COL_SIZE == MATRIX::ROW_SIZE ); - - typename MATRIX::value_type t; - const size_t N = MATRIX::col_size(); - size_t swap; - MATRIX tmp(src); - MATRIX inverse(1); - - for (size_t i=0 ; i fabs(tmp[i][i])) { - swap = j; - } - } - - if (swap != i) { - /* swap rows. */ - for (size_t k=0 ; k -MATRIX_R PURE multiply(const MATRIX_A& lhs, const MATRIX_B& rhs) { - // pre-requisite: - // lhs : D columns, R rows - // rhs : C columns, D rows - // res : C columns, R rows - - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX_A::ROW_SIZE == MATRIX_B::COL_SIZE ); - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX_R::ROW_SIZE == MATRIX_B::ROW_SIZE ); - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX_R::COL_SIZE == MATRIX_A::COL_SIZE ); - - MATRIX_R res(MATRIX_R::NO_INIT); - for (size_t r=0 ; r -MATRIX PURE transpose(const MATRIX& m) { - // for now we only handle square matrix transpose - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::ROW_SIZE == MATRIX::COL_SIZE ); - MATRIX result(MATRIX::NO_INIT); - for (size_t r=0 ; r -typename MATRIX::value_type PURE trace(const MATRIX& m) { - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::ROW_SIZE == MATRIX::COL_SIZE ); - typename MATRIX::value_type result(0); - for (size_t r=0 ; r -typename MATRIX::col_type PURE diag(const MATRIX& m) { - COMPILE_TIME_ASSERT_FUNCTION_SCOPE( MATRIX::ROW_SIZE == MATRIX::COL_SIZE ); - typename MATRIX::col_type result(MATRIX::col_type::NO_INIT); - for (size_t r=0 ; r -String8 asString(const MATRIX& m) { - String8 s; - for (size_t c=0 ; c. - * - * BASE only needs to implement operator[] and size(). - * By simply inheriting from TMatProductOperators BASE will automatically - * get all the functionality here. - */ - -template class BASE, typename T> -class TMatProductOperators { -public: - // multiply by a scalar - BASE& operator *= (T v) { - BASE& lhs(static_cast< BASE& >(*this)); - for (size_t r=0 ; r& operator /= (T v) { - BASE& lhs(static_cast< BASE& >(*this)); - for (size_t r=0 ; r - friend BASE PURE operator *(const BASE& lhs, const BASE& rhs) { - return matrix::multiply >(lhs, rhs); - } -}; - - -/* - * TMatSquareFunctions implements functions on a matrix of type BASE. - * - * BASE only needs to implement: - * - operator[] - * - col_type - * - row_type - * - COL_SIZE - * - ROW_SIZE - * - * By simply inheriting from TMatSquareFunctions BASE will automatically - * get all the functionality here. - */ - -template class BASE, typename T> -class TMatSquareFunctions { -public: - /* - * NOTE: the functions below ARE NOT member methods. They are friend functions - * with they definition inlined with their declaration. This makes these - * template functions available to the compiler when (and only when) this class - * is instantiated, at which point they're only templated on the 2nd parameter - * (the first one, BASE being known). - */ - friend BASE PURE inverse(const BASE& m) { return matrix::inverse(m); } - friend BASE PURE transpose(const BASE& m) { return matrix::transpose(m); } - friend T PURE trace(const BASE& m) { return matrix::trace(m); } -}; - -template class BASE, typename T> -class TMatDebug { -public: - String8 asString() const { - return matrix::asString( static_cast< const BASE& >(*this) ); - } -}; - -// ------------------------------------------------------------------------------------- -}; // namespace android - -#undef PURE - -#endif /* UI_TMAT_HELPERS_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/TVecHelpers.h android-platform-frameworks-native-21/include/ui/TVecHelpers.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/TVecHelpers.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/TVecHelpers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,381 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef TVEC_IMPLEMENTATION -#error "Don't include TVecHelpers.h directly. use ui/vec*.h instead" -#else -#undef TVEC_IMPLEMENTATION -#endif - - -#ifndef UI_TVEC_HELPERS_H -#define UI_TVEC_HELPERS_H - -#include -#include - -#define PURE __attribute__((pure)) - -namespace android { -// ------------------------------------------------------------------------------------- - -/* - * No user serviceable parts here. - * - * Don't use this file directly, instead include ui/vec{2|3|4}.h - */ - -/* - * This class casts itself into anything and assign itself from anything! - * Use with caution! - */ -template -struct Impersonator { - Impersonator& operator = (const TYPE& rhs) { - reinterpret_cast(*this) = rhs; - return *this; - } - operator TYPE& () { - return reinterpret_cast(*this); - } - operator TYPE const& () const { - return reinterpret_cast(*this); - } -}; - -/* - * TVec{Add|Product}Operators implements basic arithmetic and basic compound assignments - * operators on a vector of type BASE. - * - * BASE only needs to implement operator[] and size(). - * By simply inheriting from TVec{Add|Product}Operators BASE will automatically - * get all the functionality here. - */ - -template class BASE, typename T> -class TVecAddOperators { -public: - /* compound assignment from a another vector of the same size but different - * element type. - */ - template - BASE& operator += (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] += v[i]; - } - return rhs; - } - template - BASE& operator -= (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] -= v[i]; - } - return rhs; - } - - /* compound assignment from a another vector of the same type. - * These operators can be used for implicit conversion and handle operations - * like "vector *= scalar" by letting the compiler implicitly convert a scalar - * to a vector (assuming the BASE allows it). - */ - BASE& operator += (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] += v[i]; - } - return rhs; - } - BASE& operator -= (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] -= v[i]; - } - return rhs; - } - - /* - * NOTE: the functions below ARE NOT member methods. They are friend functions - * with they definition inlined with their declaration. This makes these - * template functions available to the compiler when (and only when) this class - * is instantiated, at which point they're only templated on the 2nd parameter - * (the first one, BASE being known). - */ - - /* The operators below handle operation between vectors of the same side - * but of a different element type. - */ - template - friend inline - BASE PURE operator +(const BASE& lv, const BASE& rv) { - return BASE(lv) += rv; - } - template - friend inline - BASE PURE operator -(const BASE& lv, const BASE& rv) { - return BASE(lv) -= rv; - } - - /* The operators below (which are not templates once this class is instanced, - * i.e.: BASE is known) can be used for implicit conversion on both sides. - * These handle operations like "vector * scalar" and "scalar * vector" by - * letting the compiler implicitly convert a scalar to a vector (assuming - * the BASE allows it). - */ - friend inline - BASE PURE operator +(const BASE& lv, const BASE& rv) { - return BASE(lv) += rv; - } - friend inline - BASE PURE operator -(const BASE& lv, const BASE& rv) { - return BASE(lv) -= rv; - } -}; - -template class BASE, typename T> -class TVecProductOperators { -public: - /* compound assignment from a another vector of the same size but different - * element type. - */ - template - BASE& operator *= (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] *= v[i]; - } - return rhs; - } - template - BASE& operator /= (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] /= v[i]; - } - return rhs; - } - - /* compound assignment from a another vector of the same type. - * These operators can be used for implicit conversion and handle operations - * like "vector *= scalar" by letting the compiler implicitly convert a scalar - * to a vector (assuming the BASE allows it). - */ - BASE& operator *= (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] *= v[i]; - } - return rhs; - } - BASE& operator /= (const BASE& v) { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - rhs[i] /= v[i]; - } - return rhs; - } - - /* - * NOTE: the functions below ARE NOT member methods. They are friend functions - * with they definition inlined with their declaration. This makes these - * template functions available to the compiler when (and only when) this class - * is instantiated, at which point they're only templated on the 2nd parameter - * (the first one, BASE being known). - */ - - /* The operators below handle operation between vectors of the same side - * but of a different element type. - */ - template - friend inline - BASE PURE operator *(const BASE& lv, const BASE& rv) { - return BASE(lv) *= rv; - } - template - friend inline - BASE PURE operator /(const BASE& lv, const BASE& rv) { - return BASE(lv) /= rv; - } - - /* The operators below (which are not templates once this class is instanced, - * i.e.: BASE is known) can be used for implicit conversion on both sides. - * These handle operations like "vector * scalar" and "scalar * vector" by - * letting the compiler implicitly convert a scalar to a vector (assuming - * the BASE allows it). - */ - friend inline - BASE PURE operator *(const BASE& lv, const BASE& rv) { - return BASE(lv) *= rv; - } - friend inline - BASE PURE operator /(const BASE& lv, const BASE& rv) { - return BASE(lv) /= rv; - } -}; - -/* - * TVecUnaryOperators implements unary operators on a vector of type BASE. - * - * BASE only needs to implement operator[] and size(). - * By simply inheriting from TVecUnaryOperators BASE will automatically - * get all the functionality here. - * - * These operators are implemented as friend functions of TVecUnaryOperators - */ -template class BASE, typename T> -class TVecUnaryOperators { -public: - BASE& operator ++ () { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - ++rhs[i]; - } - return rhs; - } - BASE& operator -- () { - BASE& rhs = static_cast&>(*this); - for (size_t i=0 ; i::size() ; i++) { - --rhs[i]; - } - return rhs; - } - BASE operator - () const { - BASE r(BASE::NO_INIT); - BASE const& rv(static_cast const&>(*this)); - for (size_t i=0 ; i::size() ; i++) { - r[i] = -rv[i]; - } - return r; - } -}; - - -/* - * TVecComparisonOperators implements relational/comparison operators - * on a vector of type BASE. - * - * BASE only needs to implement operator[] and size(). - * By simply inheriting from TVecComparisonOperators BASE will automatically - * get all the functionality here. - */ -template class BASE, typename T> -class TVecComparisonOperators { -public: - /* - * NOTE: the functions below ARE NOT member methods. They are friend functions - * with they definition inlined with their declaration. This makes these - * template functions available to the compiler when (and only when) this class - * is instantiated, at which point they're only templated on the 2nd parameter - * (the first one, BASE being known). - */ - template - friend inline - bool PURE operator ==(const BASE& lv, const BASE& rv) { - for (size_t i = 0; i < BASE::size(); i++) - if (lv[i] != rv[i]) - return false; - return true; - } - - template - friend inline - bool PURE operator !=(const BASE& lv, const BASE& rv) { - return !operator ==(lv, rv); - } - - template - friend inline - bool PURE operator >(const BASE& lv, const BASE& rv) { - for (size_t i = 0; i < BASE::size(); i++) - if (lv[i] <= rv[i]) - return false; - return true; - } - - template - friend inline - bool PURE operator <=(const BASE& lv, const BASE& rv) { - return !(lv > rv); - } - - template - friend inline - bool PURE operator <(const BASE& lv, const BASE& rv) { - for (size_t i = 0; i < BASE::size(); i++) - if (lv[i] >= rv[i]) - return false; - return true; - } - - template - friend inline - bool PURE operator >=(const BASE& lv, const BASE& rv) { - return !(lv < rv); - } -}; - - -/* - * TVecFunctions implements functions on a vector of type BASE. - * - * BASE only needs to implement operator[] and size(). - * By simply inheriting from TVecFunctions BASE will automatically - * get all the functionality here. - */ -template class BASE, typename T> -class TVecFunctions { -public: - /* - * NOTE: the functions below ARE NOT member methods. They are friend functions - * with they definition inlined with their declaration. This makes these - * template functions available to the compiler when (and only when) this class - * is instantiated, at which point they're only templated on the 2nd parameter - * (the first one, BASE being known). - */ - template - friend inline - T PURE dot(const BASE& lv, const BASE& rv) { - T r(0); - for (size_t i = 0; i < BASE::size(); i++) - r += lv[i]*rv[i]; - return r; - } - - friend inline - T PURE length(const BASE& lv) { - return sqrt( dot(lv, lv) ); - } - - template - friend inline - T PURE distance(const BASE& lv, const BASE& rv) { - return length(rv - lv); - } - - friend inline - BASE PURE normalize(const BASE& lv) { - return lv * (1 / length(lv)); - } -}; - -#undef PURE - -// ------------------------------------------------------------------------------------- -}; // namespace android - - -#endif /* UI_TVEC_HELPERS_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/UiConfig.h android-platform-frameworks-native-21/include/ui/UiConfig.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/UiConfig.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/UiConfig.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,29 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_UI_CONFIG_H -#define ANDROID_UI_CONFIG_H - -#include - -namespace android { - -// Append the libui configuration details to configStr. -void appendUiConfigString(String8& configStr); - -}; // namespace android - -#endif /*ANDROID_UI_CONFIG_H*/ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/vec2.h android-platform-frameworks-native-21/include/ui/vec2.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/vec2.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/vec2.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,91 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef UI_VEC2_H -#define UI_VEC2_H - -#include -#include - -#define TVEC_IMPLEMENTATION -#include - -namespace android { -// ------------------------------------------------------------------------------------- - -template -class tvec2 : public TVecProductOperators, - public TVecAddOperators, - public TVecUnaryOperators, - public TVecComparisonOperators, - public TVecFunctions -{ -public: - enum no_init { NO_INIT }; - typedef T value_type; - typedef T& reference; - typedef T const& const_reference; - typedef size_t size_type; - - union { - struct { T x, y; }; - struct { T s, t; }; - struct { T r, g; }; - }; - - enum { SIZE = 2 }; - inline static size_type size() { return SIZE; } - - // array access - inline T const& operator [] (size_t i) const { return (&x)[i]; } - inline T& operator [] (size_t i) { return (&x)[i]; } - - // ----------------------------------------------------------------------- - // we don't provide copy-ctor and operator= on purpose - // because we want the compiler generated versions - - // constructors - - // leaves object uninitialized. use with caution. - explicit tvec2(no_init) { } - - // default constructor - tvec2() : x(0), y(0) { } - - // handles implicit conversion to a tvec4. must not be explicit. - template - tvec2(A v) : x(v), y(v) { } - - template - tvec2(A x, B y) : x(x), y(y) { } - - template - explicit tvec2(const tvec2& v) : x(v.x), y(v.y) { } - - template - tvec2(const Impersonator< tvec2 >& v) - : x(((const tvec2&)v).x), - y(((const tvec2&)v).y) { } -}; - -// ---------------------------------------------------------------------------------------- - -typedef tvec2 vec2; - -// ---------------------------------------------------------------------------------------- -}; // namespace android - -#endif /* UI_VEC4_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/vec3.h android-platform-frameworks-native-21/include/ui/vec3.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/vec3.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/vec3.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,113 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef UI_VEC3_H -#define UI_VEC3_H - -#include -#include - -#include - -namespace android { -// ------------------------------------------------------------------------------------- - -template -class tvec3 : public TVecProductOperators, - public TVecAddOperators, - public TVecUnaryOperators, - public TVecComparisonOperators, - public TVecFunctions -{ -public: - enum no_init { NO_INIT }; - typedef T value_type; - typedef T& reference; - typedef T const& const_reference; - typedef size_t size_type; - - union { - struct { T x, y, z; }; - struct { T s, t, p; }; - struct { T r, g, b; }; - Impersonator< tvec2 > xy; - Impersonator< tvec2 > st; - Impersonator< tvec2 > rg; - }; - - enum { SIZE = 3 }; - inline static size_type size() { return SIZE; } - - // array access - inline T const& operator [] (size_t i) const { return (&x)[i]; } - inline T& operator [] (size_t i) { return (&x)[i]; } - - // ----------------------------------------------------------------------- - // we don't provide copy-ctor and operator= on purpose - // because we want the compiler generated versions - - // constructors - // leaves object uninitialized. use with caution. - explicit tvec3(no_init) { } - - // default constructor - tvec3() : x(0), y(0), z(0) { } - - // handles implicit conversion to a tvec4. must not be explicit. - template - tvec3(A v) : x(v), y(v), z(v) { } - - template - tvec3(A x, B y, C z) : x(x), y(y), z(z) { } - - template - tvec3(const tvec2& v, B z) : x(v.x), y(v.y), z(z) { } - - template - explicit tvec3(const tvec3& v) : x(v.x), y(v.y), z(v.z) { } - - template - tvec3(const Impersonator< tvec3 >& v) - : x(((const tvec3&)v).x), - y(((const tvec3&)v).y), - z(((const tvec3&)v).z) { } - - template - tvec3(const Impersonator< tvec2 >& v, B z) - : x(((const tvec2&)v).x), - y(((const tvec2&)v).y), - z(z) { } - - // cross product works only on vectors of size 3 - template - friend inline - tvec3 __attribute__((pure)) cross(const tvec3& u, const tvec3& v) { - return tvec3( - u.y*v.z - u.z*v.y, - u.z*v.x - u.x*v.z, - u.x*v.y - u.y*v.x); - } -}; - - -// ---------------------------------------------------------------------------------------- - -typedef tvec3 vec3; - -// ---------------------------------------------------------------------------------------- -}; // namespace android - -#endif /* UI_VEC4_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/ui/vec4.h android-platform-frameworks-native-21/include/ui/vec4.h --- android-platform-frameworks-native-6.0.1+r16/include/ui/vec4.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/include/ui/vec4.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef UI_VEC4_H -#define UI_VEC4_H - -#include -#include - -#include - -namespace android { -// ------------------------------------------------------------------------------------- - -template -class tvec4 : public TVecProductOperators, - public TVecAddOperators, - public TVecUnaryOperators, - public TVecComparisonOperators, - public TVecFunctions -{ -public: - enum no_init { NO_INIT }; - typedef T value_type; - typedef T& reference; - typedef T const& const_reference; - typedef size_t size_type; - - union { - struct { T x, y, z, w; }; - struct { T s, t, p, q; }; - struct { T r, g, b, a; }; - Impersonator< tvec2 > xy; - Impersonator< tvec2 > st; - Impersonator< tvec2 > rg; - Impersonator< tvec3 > xyz; - Impersonator< tvec3 > stp; - Impersonator< tvec3 > rgb; - }; - - enum { SIZE = 4 }; - inline static size_type size() { return SIZE; } - - // array access - inline T const& operator [] (size_t i) const { return (&x)[i]; } - inline T& operator [] (size_t i) { return (&x)[i]; } - - // ----------------------------------------------------------------------- - // we don't provide copy-ctor and operator= on purpose - // because we want the compiler generated versions - - // constructors - - // leaves object uninitialized. use with caution. - explicit tvec4(no_init) { } - - // default constructor - tvec4() : x(0), y(0), z(0), w(0) { } - - // handles implicit conversion to a tvec4. must not be explicit. - template - tvec4(A v) : x(v), y(v), z(v), w(v) { } - - template - tvec4(A x, B y, C z, D w) : x(x), y(y), z(z), w(w) { } - - template - tvec4(const tvec2& v, B z, C w) : x(v.x), y(v.y), z(z), w(w) { } - - template - tvec4(const tvec3& v, B w) : x(v.x), y(v.y), z(v.z), w(w) { } - - template - explicit tvec4(const tvec4& v) : x(v.x), y(v.y), z(v.z), w(v.w) { } - - template - tvec4(const Impersonator< tvec4 >& v) - : x(((const tvec4&)v).x), - y(((const tvec4&)v).y), - z(((const tvec4&)v).z), - w(((const tvec4&)v).w) { } - - template - tvec4(const Impersonator< tvec3 >& v, B w) - : x(((const tvec3&)v).x), - y(((const tvec3&)v).y), - z(((const tvec3&)v).z), - w(w) { } - - template - tvec4(const Impersonator< tvec2 >& v, B z, C w) - : x(((const tvec2&)v).x), - y(((const tvec2&)v).y), - z(z), - w(w) { } -}; - -// ---------------------------------------------------------------------------------------- - -typedef tvec4 vec4; - -// ---------------------------------------------------------------------------------------- -}; // namespace android - -#endif /* UI_VEC4_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/AndroidThreads.h android-platform-frameworks-native-21/include/utils/AndroidThreads.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/AndroidThreads.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/AndroidThreads.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,125 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_ANDROID_THREADS_H +#define _LIBS_UTILS_ANDROID_THREADS_H + +#include +#include + +#if defined(HAVE_PTHREADS) +# include +#endif + +#include + +// --------------------------------------------------------------------------- +// C API + +#ifdef __cplusplus +extern "C" { +#endif + +// Create and run a new thread. +extern int androidCreateThread(android_thread_func_t, void *); + +// Create thread with lots of parameters +extern int androidCreateThreadEtc(android_thread_func_t entryFunction, + void *userData, + const char* threadName, + int32_t threadPriority, + size_t threadStackSize, + android_thread_id_t *threadId); + +// Get some sort of unique identifier for the current thread. +extern android_thread_id_t androidGetThreadId(); + +// Low-level thread creation -- never creates threads that can +// interact with the Java VM. +extern int androidCreateRawThreadEtc(android_thread_func_t entryFunction, + void *userData, + const char* threadName, + int32_t threadPriority, + size_t threadStackSize, + android_thread_id_t *threadId); + +// Used by the Java Runtime to control how threads are created, so that +// they can be proper and lovely Java threads. +typedef int (*android_create_thread_fn)(android_thread_func_t entryFunction, + void *userData, + const char* threadName, + int32_t threadPriority, + size_t threadStackSize, + android_thread_id_t *threadId); + +extern void androidSetCreateThreadFunc(android_create_thread_fn func); + +// ------------------------------------------------------------------ +// Extra functions working with raw pids. + +// Get pid for the current thread. +extern pid_t androidGetTid(); + +#ifdef HAVE_ANDROID_OS +// Change the priority AND scheduling group of a particular thread. The priority +// should be one of the ANDROID_PRIORITY constants. Returns INVALID_OPERATION +// if the priority set failed, else another value if just the group set failed; +// in either case errno is set. Thread ID zero means current thread. +extern int androidSetThreadPriority(pid_t tid, int prio); + +// Get the current priority of a particular thread. Returns one of the +// ANDROID_PRIORITY constants or a negative result in case of error. +extern int androidGetThreadPriority(pid_t tid); +#endif + +#ifdef __cplusplus +} // extern "C" +#endif + +// ---------------------------------------------------------------------------- +// C++ API +#ifdef __cplusplus +namespace android { +// ---------------------------------------------------------------------------- + +// Create and run a new thread. +inline bool createThread(thread_func_t f, void *a) { + return androidCreateThread(f, a) ? true : false; +} + +// Create thread with lots of parameters +inline bool createThreadEtc(thread_func_t entryFunction, + void *userData, + const char* threadName = "android:unnamed_thread", + int32_t threadPriority = PRIORITY_DEFAULT, + size_t threadStackSize = 0, + thread_id_t *threadId = 0) +{ + return androidCreateThreadEtc(entryFunction, userData, threadName, + threadPriority, threadStackSize, threadId) ? true : false; +} + +// Get some sort of unique identifier for the current thread. +inline thread_id_t getThreadId() { + return androidGetThreadId(); +} + +// ---------------------------------------------------------------------------- +}; // namespace android +#endif // __cplusplus +// ---------------------------------------------------------------------------- + +#endif // _LIBS_UTILS_ANDROID_THREADS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/ashmem.h android-platform-frameworks-native-21/include/utils/ashmem.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/ashmem.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/ashmem.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,41 @@ +/* utils/ashmem.h + ** + ** Copyright 2008 The Android Open Source Project + ** + ** This file is dual licensed. It may be redistributed and/or modified + ** under the terms of the Apache 2.0 License OR version 2 of the GNU + ** General Public License. + */ + +#ifndef _UTILS_ASHMEM_H +#define _UTILS_ASHMEM_H + +#include +#include + +#define ASHMEM_NAME_LEN 256 + +#define ASHMEM_NAME_DEF "dev/ashmem" + +/* Return values from ASHMEM_PIN: Was the mapping purged while unpinned? */ +#define ASHMEM_NOT_REAPED 0 +#define ASHMEM_WAS_REAPED 1 + +/* Return values from ASHMEM_UNPIN: Is the mapping now pinned or unpinned? */ +#define ASHMEM_NOW_UNPINNED 0 +#define ASHMEM_NOW_PINNED 1 + +#define __ASHMEMIOC 0x77 + +#define ASHMEM_SET_NAME _IOW(__ASHMEMIOC, 1, char[ASHMEM_NAME_LEN]) +#define ASHMEM_GET_NAME _IOR(__ASHMEMIOC, 2, char[ASHMEM_NAME_LEN]) +#define ASHMEM_SET_SIZE _IOW(__ASHMEMIOC, 3, size_t) +#define ASHMEM_GET_SIZE _IO(__ASHMEMIOC, 4) +#define ASHMEM_SET_PROT_MASK _IOW(__ASHMEMIOC, 5, unsigned long) +#define ASHMEM_GET_PROT_MASK _IO(__ASHMEMIOC, 6) +#define ASHMEM_PIN _IO(__ASHMEMIOC, 7) +#define ASHMEM_UNPIN _IO(__ASHMEMIOC, 8) +#define ASHMEM_ISPINNED _IO(__ASHMEMIOC, 9) +#define ASHMEM_PURGE_ALL_CACHES _IO(__ASHMEMIOC, 10) + +#endif /* _UTILS_ASHMEM_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Atomic.h android-platform-frameworks-native-21/include/utils/Atomic.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Atomic.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Atomic.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,22 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_UTILS_ATOMIC_H +#define ANDROID_UTILS_ATOMIC_H + +#include + +#endif // ANDROID_UTILS_ATOMIC_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/BasicHashtable.h android-platform-frameworks-native-21/include/utils/BasicHashtable.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/BasicHashtable.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/BasicHashtable.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,393 @@ +/* + * 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. + */ + +#ifndef ANDROID_BASIC_HASHTABLE_H +#define ANDROID_BASIC_HASHTABLE_H + +#include +#include +#include +#include + +namespace android { + +/* Implementation type. Nothing to see here. */ +class BasicHashtableImpl { +protected: + struct Bucket { + // The collision flag indicates that the bucket is part of a collision chain + // such that at least two entries both hash to this bucket. When true, we + // may need to seek further along the chain to find the entry. + static const uint32_t COLLISION = 0x80000000UL; + + // The present flag indicates that the bucket contains an initialized entry value. + static const uint32_t PRESENT = 0x40000000UL; + + // Mask for 30 bits worth of the hash code that are stored within the bucket to + // speed up lookups and rehashing by eliminating the need to recalculate the + // hash code of the entry's key. + static const uint32_t HASH_MASK = 0x3fffffffUL; + + // Combined value that stores the collision and present flags as well as + // a 30 bit hash code. + uint32_t cookie; + + // Storage for the entry begins here. + char entry[0]; + }; + + BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor, + size_t minimumInitialCapacity, float loadFactor); + BasicHashtableImpl(const BasicHashtableImpl& other); + + void dispose(); + + inline void edit() { + if (mBuckets && !SharedBuffer::bufferFromData(mBuckets)->onlyOwner()) { + clone(); + } + } + + void setTo(const BasicHashtableImpl& other); + void clear(); + + ssize_t next(ssize_t index) const; + ssize_t find(ssize_t index, hash_t hash, const void* __restrict__ key) const; + size_t add(hash_t hash, const void* __restrict__ entry); + void removeAt(size_t index); + void rehash(size_t minimumCapacity, float loadFactor); + + const size_t mBucketSize; // number of bytes per bucket including the entry + const bool mHasTrivialDestructor; // true if the entry type does not require destruction + size_t mCapacity; // number of buckets that can be filled before exceeding load factor + float mLoadFactor; // load factor + size_t mSize; // number of elements actually in the table + size_t mFilledBuckets; // number of buckets for which collision or present is true + size_t mBucketCount; // number of slots in the mBuckets array + void* mBuckets; // array of buckets, as a SharedBuffer + + inline const Bucket& bucketAt(const void* __restrict__ buckets, size_t index) const { + return *reinterpret_cast( + static_cast(buckets) + index * mBucketSize); + } + + inline Bucket& bucketAt(void* __restrict__ buckets, size_t index) const { + return *reinterpret_cast(static_cast(buckets) + index * mBucketSize); + } + + virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const = 0; + virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const = 0; + virtual void destroyBucketEntry(Bucket& bucket) const = 0; + +private: + void clone(); + + // Allocates a bucket array as a SharedBuffer. + void* allocateBuckets(size_t count) const; + + // Releases a bucket array's associated SharedBuffer. + void releaseBuckets(void* __restrict__ buckets, size_t count) const; + + // Destroys the contents of buckets (invokes destroyBucketEntry for each + // populated bucket if needed). + void destroyBuckets(void* __restrict__ buckets, size_t count) const; + + // Copies the content of buckets (copies the cookie and invokes copyBucketEntry + // for each populated bucket if needed). + void copyBuckets(const void* __restrict__ fromBuckets, + void* __restrict__ toBuckets, size_t count) const; + + // Determines the appropriate size of a bucket array to store a certain minimum + // number of entries and returns its effective capacity. + static void determineCapacity(size_t minimumCapacity, float loadFactor, + size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity); + + // Trim a hash code to 30 bits to match what we store in the bucket's cookie. + inline static hash_t trimHash(hash_t hash) { + return (hash & Bucket::HASH_MASK) ^ (hash >> 30); + } + + // Returns the index of the first bucket that is in the collision chain + // for the specified hash code, given the total number of buckets. + // (Primary hash) + inline static size_t chainStart(hash_t hash, size_t count) { + return hash % count; + } + + // Returns the increment to add to a bucket index to seek to the next bucket + // in the collision chain for the specified hash code, given the total number of buckets. + // (Secondary hash) + inline static size_t chainIncrement(hash_t hash, size_t count) { + return ((hash >> 7) | (hash << 25)) % (count - 1) + 1; + } + + // Returns the index of the next bucket that is in the collision chain + // that is defined by the specified increment, given the total number of buckets. + inline static size_t chainSeek(size_t index, size_t increment, size_t count) { + return (index + increment) % count; + } +}; + +/* + * A BasicHashtable stores entries that are indexed by hash code in place + * within an array. The basic operations are finding entries by key, + * adding new entries and removing existing entries. + * + * This class provides a very limited set of operations with simple semantics. + * It is intended to be used as a building block to construct more complex + * and interesting data structures such as HashMap. Think very hard before + * adding anything extra to BasicHashtable, it probably belongs at a + * higher level of abstraction. + * + * TKey: The key type. + * TEntry: The entry type which is what is actually stored in the array. + * + * TKey must support the following contract: + * bool operator==(const TKey& other) const; // return true if equal + * bool operator!=(const TKey& other) const; // return true if unequal + * + * TEntry must support the following contract: + * const TKey& getKey() const; // get the key from the entry + * + * This class supports storing entries with duplicate keys. Of course, it can't + * tell them apart during removal so only the first entry will be removed. + * We do this because it means that operations like add() can't fail. + */ +template +class BasicHashtable : private BasicHashtableImpl { +public: + /* Creates a hashtable with the specified minimum initial capacity. + * The underlying array will be created when the first entry is added. + * + * minimumInitialCapacity: The minimum initial capacity for the hashtable. + * Default is 0. + * loadFactor: The desired load factor for the hashtable, between 0 and 1. + * Default is 0.75. + */ + BasicHashtable(size_t minimumInitialCapacity = 0, float loadFactor = 0.75f); + + /* Copies a hashtable. + * The underlying storage is shared copy-on-write. + */ + BasicHashtable(const BasicHashtable& other); + + /* Clears and destroys the hashtable. + */ + virtual ~BasicHashtable(); + + /* Making this hashtable a copy of the other hashtable. + * The underlying storage is shared copy-on-write. + * + * other: The hashtable to copy. + */ + inline BasicHashtable& operator =(const BasicHashtable & other) { + setTo(other); + return *this; + } + + /* Returns the number of entries in the hashtable. + */ + inline size_t size() const { + return mSize; + } + + /* Returns the capacity of the hashtable, which is the number of elements that can + * added to the hashtable without requiring it to be grown. + */ + inline size_t capacity() const { + return mCapacity; + } + + /* Returns the number of buckets that the hashtable has, which is the size of its + * underlying array. + */ + inline size_t bucketCount() const { + return mBucketCount; + } + + /* Returns the load factor of the hashtable. */ + inline float loadFactor() const { + return mLoadFactor; + }; + + /* Returns a const reference to the entry at the specified index. + * + * index: The index of the entry to retrieve. Must be a valid index within + * the bounds of the hashtable. + */ + inline const TEntry& entryAt(size_t index) const { + return entryFor(bucketAt(mBuckets, index)); + } + + /* Returns a non-const reference to the entry at the specified index. + * + * index: The index of the entry to edit. Must be a valid index within + * the bounds of the hashtable. + */ + inline TEntry& editEntryAt(size_t index) { + edit(); + return entryFor(bucketAt(mBuckets, index)); + } + + /* Clears the hashtable. + * All entries in the hashtable are destroyed immediately. + * If you need to do something special with the entries in the hashtable then iterate + * over them and do what you need before clearing the hashtable. + */ + inline void clear() { + BasicHashtableImpl::clear(); + } + + /* Returns the index of the next entry in the hashtable given the index of a previous entry. + * If the given index is -1, then returns the index of the first entry in the hashtable, + * if there is one, or -1 otherwise. + * If the given index is not -1, then returns the index of the next entry in the hashtable, + * in strictly increasing order, or -1 if there are none left. + * + * index: The index of the previous entry that was iterated, or -1 to begin + * iteration at the beginning of the hashtable. + */ + inline ssize_t next(ssize_t index) const { + return BasicHashtableImpl::next(index); + } + + /* Finds the index of an entry with the specified key. + * If the given index is -1, then returns the index of the first matching entry, + * otherwise returns the index of the next matching entry. + * If the hashtable contains multiple entries with keys that match the requested + * key, then the sequence of entries returned is arbitrary. + * Returns -1 if no entry was found. + * + * index: The index of the previous entry with the specified key, or -1 to + * find the first matching entry. + * hash: The hashcode of the key. + * key: The key. + */ + inline ssize_t find(ssize_t index, hash_t hash, const TKey& key) const { + return BasicHashtableImpl::find(index, hash, &key); + } + + /* Adds the entry to the hashtable. + * Returns the index of the newly added entry. + * If an entry with the same key already exists, then a duplicate entry is added. + * If the entry will not fit, then the hashtable's capacity is increased and + * its contents are rehashed. See rehash(). + * + * hash: The hashcode of the key. + * entry: The entry to add. + */ + inline size_t add(hash_t hash, const TEntry& entry) { + return BasicHashtableImpl::add(hash, &entry); + } + + /* Removes the entry with the specified index from the hashtable. + * The entry is destroyed immediately. + * The index must be valid. + * + * The hashtable is not compacted after an item is removed, so it is legal + * to continue iterating over the hashtable using next() or find(). + * + * index: The index of the entry to remove. Must be a valid index within the + * bounds of the hashtable, and it must refer to an existing entry. + */ + inline void removeAt(size_t index) { + BasicHashtableImpl::removeAt(index); + } + + /* Rehashes the contents of the hashtable. + * Grows the hashtable to at least the specified minimum capacity or the + * current number of elements, whichever is larger. + * + * Rehashing causes all entries to be copied and the entry indices may change. + * Although the hash codes are cached by the hashtable, rehashing can be an + * expensive operation and should be avoided unless the hashtable's size + * needs to be changed. + * + * Rehashing is the only way to change the capacity or load factor of the + * hashtable once it has been created. It can be used to compact the + * hashtable by choosing a minimum capacity that is smaller than the current + * capacity (such as 0). + * + * minimumCapacity: The desired minimum capacity after rehashing. + * loadFactor: The desired load factor after rehashing. + */ + inline void rehash(size_t minimumCapacity, float loadFactor) { + BasicHashtableImpl::rehash(minimumCapacity, loadFactor); + } + +protected: + static inline const TEntry& entryFor(const Bucket& bucket) { + return reinterpret_cast(bucket.entry); + } + + static inline TEntry& entryFor(Bucket& bucket) { + return reinterpret_cast(bucket.entry); + } + + virtual bool compareBucketKey(const Bucket& bucket, const void* __restrict__ key) const; + virtual void initializeBucketEntry(Bucket& bucket, const void* __restrict__ entry) const; + virtual void destroyBucketEntry(Bucket& bucket) const; + +private: + // For dumping the raw contents of a hashtable during testing. + friend class BasicHashtableTest; + inline uint32_t cookieAt(size_t index) const { + return bucketAt(mBuckets, index).cookie; + } +}; + +template +BasicHashtable::BasicHashtable(size_t minimumInitialCapacity, float loadFactor) : + BasicHashtableImpl(sizeof(TEntry), traits::has_trivial_dtor, + minimumInitialCapacity, loadFactor) { +} + +template +BasicHashtable::BasicHashtable(const BasicHashtable& other) : + BasicHashtableImpl(other) { +} + +template +BasicHashtable::~BasicHashtable() { + dispose(); +} + +template +bool BasicHashtable::compareBucketKey(const Bucket& bucket, + const void* __restrict__ key) const { + return entryFor(bucket).getKey() == *static_cast(key); +} + +template +void BasicHashtable::initializeBucketEntry(Bucket& bucket, + const void* __restrict__ entry) const { + if (!traits::has_trivial_copy) { + new (&entryFor(bucket)) TEntry(*(static_cast(entry))); + } else { + memcpy(&entryFor(bucket), entry, sizeof(TEntry)); + } +} + +template +void BasicHashtable::destroyBucketEntry(Bucket& bucket) const { + if (!traits::has_trivial_dtor) { + entryFor(bucket).~TEntry(); + } +} + +}; // namespace android + +#endif // ANDROID_BASIC_HASHTABLE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/BitSet.h android-platform-frameworks-native-21/include/utils/BitSet.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/BitSet.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/BitSet.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,110 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef UTILS_BITSET_H +#define UTILS_BITSET_H + +#include +#include + +/* + * Contains some bit manipulation helpers. + */ + +namespace android { + +// A simple set of 32 bits that can be individually marked or cleared. +struct BitSet32 { + uint32_t value; + + inline BitSet32() : value(0) { } + explicit inline BitSet32(uint32_t value) : value(value) { } + + // Gets the value associated with a particular bit index. + static inline uint32_t valueForBit(uint32_t n) { return 0x80000000 >> n; } + + // Clears the bit set. + inline void clear() { value = 0; } + + // Returns the number of marked bits in the set. + inline uint32_t count() const { return __builtin_popcount(value); } + + // Returns true if the bit set does not contain any marked bits. + inline bool isEmpty() const { return ! value; } + + // Returns true if the bit set does not contain any unmarked bits. + inline bool isFull() const { return value == 0xffffffff; } + + // Returns true if the specified bit is marked. + inline bool hasBit(uint32_t n) const { return value & valueForBit(n); } + + // Marks the specified bit. + inline void markBit(uint32_t n) { value |= valueForBit(n); } + + // Clears the specified bit. + inline void clearBit(uint32_t n) { value &= ~ valueForBit(n); } + + // Finds the first marked bit in the set. + // Result is undefined if all bits are unmarked. + inline uint32_t firstMarkedBit() const { return __builtin_clz(value); } + + // Finds the first unmarked bit in the set. + // Result is undefined if all bits are marked. + inline uint32_t firstUnmarkedBit() const { return __builtin_clz(~ value); } + + // Finds the last marked bit in the set. + // Result is undefined if all bits are unmarked. + inline uint32_t lastMarkedBit() const { return 31 - __builtin_ctz(value); } + + // Finds the first marked bit in the set and clears it. Returns the bit index. + // Result is undefined if all bits are unmarked. + inline uint32_t clearFirstMarkedBit() { + uint32_t n = firstMarkedBit(); + clearBit(n); + return n; + } + + // Finds the first unmarked bit in the set and marks it. Returns the bit index. + // Result is undefined if all bits are marked. + inline uint32_t markFirstUnmarkedBit() { + uint32_t n = firstUnmarkedBit(); + markBit(n); + return n; + } + + // Finds the last marked bit in the set and clears it. Returns the bit index. + // Result is undefined if all bits are unmarked. + inline uint32_t clearLastMarkedBit() { + uint32_t n = lastMarkedBit(); + clearBit(n); + return n; + } + + // Gets the index of the specified bit in the set, which is the number of + // marked bits that appear before the specified bit. + inline uint32_t getIndexOfBit(uint32_t n) const { + return __builtin_popcount(value & ~(0xffffffffUL >> n)); + } + + inline bool operator== (const BitSet32& other) const { return value == other.value; } + inline bool operator!= (const BitSet32& other) const { return value != other.value; } +}; + +ANDROID_BASIC_TYPES_TRAITS(BitSet32) + +} // namespace android + +#endif // UTILS_BITSET_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/BlobCache.h android-platform-frameworks-native-21/include/utils/BlobCache.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/BlobCache.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/BlobCache.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,251 @@ +/* + ** Copyright 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. + */ + +#ifndef ANDROID_BLOB_CACHE_H +#define ANDROID_BLOB_CACHE_H + +#include + +#include +#include +#include +#include + +namespace android { + +// A BlobCache is an in-memory cache for binary key/value pairs. A BlobCache +// does NOT provide any thread-safety guarantees. +// +// The cache contents can be serialized to an in-memory buffer or mmap'd file +// and then reloaded in a subsequent execution of the program. This +// serialization is non-portable and the data should only be used by the device +// that generated it. +class BlobCache : public RefBase, public Flattenable { +public: + + // Create an empty blob cache. The blob cache will cache key/value pairs + // with key and value sizes less than or equal to maxKeySize and + // maxValueSize, respectively. The total combined size of ALL cache entries + // (key sizes plus value sizes) will not exceed maxTotalSize. + BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize); + + // set inserts a new binary value into the cache and associates it with the + // given binary key. If the key or value are too large for the cache then + // the cache remains unchanged. This includes the case where a different + // value was previously associated with the given key - the old value will + // remain in the cache. If the given key and value are small enough to be + // put in the cache (based on the maxKeySize, maxValueSize, and maxTotalSize + // values specified to the BlobCache constructor), then the key/value pair + // will be in the cache after set returns. Note, however, that a subsequent + // call to set may evict old key/value pairs from the cache. + // + // Preconditions: + // key != NULL + // 0 < keySize + // value != NULL + // 0 < valueSize + void set(const void* key, size_t keySize, const void* value, + size_t valueSize); + + // get retrieves from the cache the binary value associated with a given + // binary key. If the key is present in the cache then the length of the + // binary value associated with that key is returned. If the value argument + // is non-NULL and the size of the cached value is less than valueSize bytes + // then the cached value is copied into the buffer pointed to by the value + // argument. If the key is not present in the cache then 0 is returned and + // the buffer pointed to by the value argument is not modified. + // + // Note that when calling get multiple times with the same key, the later + // calls may fail, returning 0, even if earlier calls succeeded. The return + // value must be checked for each call. + // + // Preconditions: + // key != NULL + // 0 < keySize + // 0 <= valueSize + size_t get(const void* key, size_t keySize, void* value, size_t valueSize); + + // getFlattenedSize returns the number of bytes needed to store the entire + // serialized cache. + virtual size_t getFlattenedSize() const; + + // getFdCount returns the number of file descriptors that will result from + // flattening the cache. This will always return 0 so as to allow the + // flattened cache to be saved to disk and then later restored. + virtual size_t getFdCount() const; + + // flatten serializes the current contents of the cache into the memory + // pointed to by 'buffer'. The serialized cache contents can later be + // loaded into a BlobCache object using the unflatten method. The contents + // of the BlobCache object will not be modified. + // + // Preconditions: + // size >= this.getFlattenedSize() + // count == 0 + virtual status_t flatten(void* buffer, size_t size, int fds[], + size_t count) const; + + // unflatten replaces the contents of the cache with the serialized cache + // contents in the memory pointed to by 'buffer'. The previous contents of + // the BlobCache will be evicted from the cache. If an error occurs while + // unflattening the serialized cache contents then the BlobCache will be + // left in an empty state. + // + // Preconditions: + // count == 0 + virtual status_t unflatten(void const* buffer, size_t size, int fds[], + size_t count); + +private: + // Copying is disallowed. + BlobCache(const BlobCache&); + void operator=(const BlobCache&); + + // A random function helper to get around MinGW not having nrand48() + long int blob_random(); + + // clean evicts a randomly chosen set of entries from the cache such that + // the total size of all remaining entries is less than mMaxTotalSize/2. + void clean(); + + // isCleanable returns true if the cache is full enough for the clean method + // to have some effect, and false otherwise. + bool isCleanable() const; + + // A Blob is an immutable sized unstructured data blob. + class Blob : public RefBase { + public: + Blob(const void* data, size_t size, bool copyData); + ~Blob(); + + bool operator<(const Blob& rhs) const; + + const void* getData() const; + size_t getSize() const; + + private: + // Copying is not allowed. + Blob(const Blob&); + void operator=(const Blob&); + + // mData points to the buffer containing the blob data. + const void* mData; + + // mSize is the size of the blob data in bytes. + size_t mSize; + + // mOwnsData indicates whether or not this Blob object should free the + // memory pointed to by mData when the Blob gets destructed. + bool mOwnsData; + }; + + // A CacheEntry is a single key/value pair in the cache. + class CacheEntry { + public: + CacheEntry(); + CacheEntry(const sp& key, const sp& value); + CacheEntry(const CacheEntry& ce); + + bool operator<(const CacheEntry& rhs) const; + const CacheEntry& operator=(const CacheEntry&); + + sp getKey() const; + sp getValue() const; + + void setValue(const sp& value); + + private: + + // mKey is the key that identifies the cache entry. + sp mKey; + + // mValue is the cached data associated with the key. + sp mValue; + }; + + // A Header is the header for the entire BlobCache serialization format. No + // need to make this portable, so we simply write the struct out. + struct Header { + // mMagicNumber is the magic number that identifies the data as + // serialized BlobCache contents. It must always contain 'Blb$'. + uint32_t mMagicNumber; + + // mBlobCacheVersion is the serialization format version. + uint32_t mBlobCacheVersion; + + // mDeviceVersion is the device-specific version of the cache. This can + // be used to invalidate the cache. + uint32_t mDeviceVersion; + + // mNumEntries is number of cache entries following the header in the + // data. + size_t mNumEntries; + }; + + // An EntryHeader is the header for a serialized cache entry. No need to + // make this portable, so we simply write the struct out. Each EntryHeader + // is followed imediately by the key data and then the value data. + // + // The beginning of each serialized EntryHeader is 4-byte aligned, so the + // number of bytes that a serialized cache entry will occupy is: + // + // ((sizeof(EntryHeader) + keySize + valueSize) + 3) & ~3 + // + struct EntryHeader { + // mKeySize is the size of the entry key in bytes. + size_t mKeySize; + + // mValueSize is the size of the entry value in bytes. + size_t mValueSize; + + // mData contains both the key and value data for the cache entry. The + // key comes first followed immediately by the value. + uint8_t mData[]; + }; + + // mMaxKeySize is the maximum key size that will be cached. Calls to + // BlobCache::set with a keySize parameter larger than mMaxKeySize will + // simply not add the key/value pair to the cache. + const size_t mMaxKeySize; + + // mMaxValueSize is the maximum value size that will be cached. Calls to + // BlobCache::set with a valueSize parameter larger than mMaxValueSize will + // simply not add the key/value pair to the cache. + const size_t mMaxValueSize; + + // mMaxTotalSize is the maximum size that all cache entries can occupy. This + // includes space for both keys and values. When a call to BlobCache::set + // would otherwise cause this limit to be exceeded, either the key/value + // pair passed to BlobCache::set will not be cached or other cache entries + // will be evicted from the cache to make room for the new entry. + const size_t mMaxTotalSize; + + // mTotalSize is the total combined size of all keys and values currently in + // the cache. + size_t mTotalSize; + + // mRandState is the pseudo-random number generator state. It is passed to + // nrand48 to generate random numbers when needed. + unsigned short mRandState[3]; + + // mCacheEntries stores all the cache entries that are resident in memory. + // Cache entries are added to it by the 'set' method. + SortedVector mCacheEntries; +}; + +} + +#endif // ANDROID_BLOB_CACHE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/BufferedTextOutput.h android-platform-frameworks-native-21/include/utils/BufferedTextOutput.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/BufferedTextOutput.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/BufferedTextOutput.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2006 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. + */ + +#ifndef ANDROID_BUFFEREDTEXTOUTPUT_H +#define ANDROID_BUFFEREDTEXTOUTPUT_H + +#include +#include +#include + +// --------------------------------------------------------------------------- +namespace android { + +class BufferedTextOutput : public TextOutput +{ +public: + //** Flags for constructor */ + enum { + MULTITHREADED = 0x0001 + }; + + BufferedTextOutput(uint32_t flags = 0); + virtual ~BufferedTextOutput(); + + virtual status_t print(const char* txt, size_t len); + virtual void moveIndent(int delta); + + virtual void pushBundle(); + virtual void popBundle(); + +protected: + virtual status_t writeLines(const struct iovec& vec, size_t N) = 0; + +private: + struct BufferState; + struct ThreadState; + + static ThreadState*getThreadState(); + static void threadDestructor(void *st); + + BufferState*getBuffer() const; + + uint32_t mFlags; + const int32_t mSeq; + const int32_t mIndex; + + Mutex mLock; + BufferState* mGlobalState; +}; + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_BUFFEREDTEXTOUTPUT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/ByteOrder.h android-platform-frameworks-native-21/include/utils/ByteOrder.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/ByteOrder.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/ByteOrder.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,81 @@ +/* + * Copyright (C) 2006 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. + */ + +// + +#ifndef _LIBS_UTILS_BYTE_ORDER_H +#define _LIBS_UTILS_BYTE_ORDER_H + +#include +#include +#ifdef HAVE_WINSOCK +#include +#else +#include +#endif + +/* + * These macros are like the hton/ntoh byte swapping macros, + * except they allow you to swap to and from the "device" byte + * order. The device byte order is the endianness of the target + * device -- for the ARM CPUs we use today, this is little endian. + * + * Note that the byte swapping functions have not been optimized + * much; performance is currently not an issue for them since the + * intent is to allow us to avoid byte swapping on the device. + */ + +static inline uint32_t android_swap_long(uint32_t v) +{ + return (v<<24) | ((v<<8)&0x00FF0000) | ((v>>8)&0x0000FF00) | (v>>24); +} + +static inline uint16_t android_swap_short(uint16_t v) +{ + return (v<<8) | (v>>8); +} + +#define DEVICE_BYTE_ORDER LITTLE_ENDIAN + +#if BYTE_ORDER == DEVICE_BYTE_ORDER + +#define dtohl(x) (x) +#define dtohs(x) (x) +#define htodl(x) (x) +#define htods(x) (x) + +#else + +#define dtohl(x) (android_swap_long(x)) +#define dtohs(x) (android_swap_short(x)) +#define htodl(x) (android_swap_long(x)) +#define htods(x) (android_swap_short(x)) + +#endif + +#if BYTE_ORDER == LITTLE_ENDIAN +#define fromlel(x) (x) +#define fromles(x) (x) +#define tolel(x) (x) +#define toles(x) (x) +#else +#define fromlel(x) (android_swap_long(x)) +#define fromles(x) (android_swap_short(x)) +#define tolel(x) (android_swap_long(x)) +#define toles(x) (android_swap_short(x)) +#endif + +#endif // _LIBS_UTILS_BYTE_ORDER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/CallStack.h android-platform-frameworks-native-21/include/utils/CallStack.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/CallStack.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/CallStack.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,74 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_CALLSTACK_H +#define ANDROID_CALLSTACK_H + +#include +#include + +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +class CallStack +{ +public: + enum { + MAX_DEPTH = 31 + }; + + CallStack(); + CallStack(const CallStack& rhs); + ~CallStack(); + + CallStack& operator = (const CallStack& rhs); + + bool operator == (const CallStack& rhs) const; + bool operator != (const CallStack& rhs) const; + bool operator < (const CallStack& rhs) const; + bool operator >= (const CallStack& rhs) const; + bool operator > (const CallStack& rhs) const; + bool operator <= (const CallStack& rhs) const; + + const void* operator [] (int index) const; + + void clear(); + + void update(int32_t ignoreDepth=1, int32_t maxDepth=MAX_DEPTH); + + // Dump a stack trace to the log + void dump(const char* prefix = 0) const; + + // Return a string (possibly very long) containing the complete stack trace + String8 toString(const char* prefix = 0) const; + + size_t size() const { return mCount; } + +private: + size_t mCount; + backtrace_frame_t mStack[MAX_DEPTH]; +}; + +}; // namespace android + + +// --------------------------------------------------------------------------- + +#endif // ANDROID_CALLSTACK_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Compat.h android-platform-frameworks-native-21/include/utils/Compat.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Compat.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Compat.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef __LIB_UTILS_COMPAT_H +#define __LIB_UTILS_COMPAT_H + +#include + +/* Compatibility definitions for non-Linux (i.e., BSD-based) hosts. */ +#ifndef HAVE_OFF64_T +#if _FILE_OFFSET_BITS < 64 +#error "_FILE_OFFSET_BITS < 64; large files are not supported on this platform" +#endif /* _FILE_OFFSET_BITS < 64 */ + +typedef off_t off64_t; + +static inline off64_t lseek64(int fd, off64_t offset, int whence) { + return lseek(fd, offset, whence); +} + +#ifdef HAVE_PREAD +static inline ssize_t pread64(int fd, void* buf, size_t nbytes, off64_t offset) { + return pread(fd, buf, nbytes, offset); +} +#endif + +#endif /* !HAVE_OFF64_T */ + +#if HAVE_PRINTF_ZD +# define ZD "%zd" +# define ZD_TYPE ssize_t +#else +# define ZD "%ld" +# define ZD_TYPE long +#endif + +/* + * TEMP_FAILURE_RETRY is defined by some, but not all, versions of + * . (Alas, it is not as standard as we'd hoped!) So, if it's + * not already defined, then define it here. + */ +#ifndef TEMP_FAILURE_RETRY +/* Used to retry syscalls that can return EINTR. */ +#define TEMP_FAILURE_RETRY(exp) ({ \ + typeof (exp) _rc; \ + do { \ + _rc = (exp); \ + } while (_rc == -1 && errno == EINTR); \ + _rc; }) +#endif + +#endif /* __LIB_UTILS_COMPAT_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Condition.h android-platform-frameworks-native-21/include/utils/Condition.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Condition.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Condition.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,134 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_CONDITION_H +#define _LIBS_UTILS_CONDITION_H + +#include +#include +#include + +#if defined(HAVE_PTHREADS) +# include +#endif + +#include +#include +#include + +// --------------------------------------------------------------------------- +namespace android { +// --------------------------------------------------------------------------- + +/* + * Condition variable class. The implementation is system-dependent. + * + * Condition variables are paired up with mutexes. Lock the mutex, + * call wait(), then either re-wait() if things aren't quite what you want, + * or unlock the mutex and continue. All threads calling wait() must + * use the same mutex for a given Condition. + */ +class Condition { +public: + enum { + PRIVATE = 0, + SHARED = 1 + }; + + Condition(); + Condition(int type); + ~Condition(); + // Wait on the condition variable. Lock the mutex before calling. + status_t wait(Mutex& mutex); + // same with relative timeout + status_t waitRelative(Mutex& mutex, nsecs_t reltime); + // Signal the condition variable, allowing one thread to continue. + void signal(); + // Signal the condition variable, allowing all threads to continue. + void broadcast(); + +private: +#if defined(HAVE_PTHREADS) + pthread_cond_t mCond; +#else + void* mState; +#endif +}; + +// --------------------------------------------------------------------------- + +#if defined(HAVE_PTHREADS) + +inline Condition::Condition() { + pthread_cond_init(&mCond, NULL); +} +inline Condition::Condition(int type) { + if (type == SHARED) { + pthread_condattr_t attr; + pthread_condattr_init(&attr); + pthread_condattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_cond_init(&mCond, &attr); + pthread_condattr_destroy(&attr); + } else { + pthread_cond_init(&mCond, NULL); + } +} +inline Condition::~Condition() { + pthread_cond_destroy(&mCond); +} +inline status_t Condition::wait(Mutex& mutex) { + return -pthread_cond_wait(&mCond, &mutex.mMutex); +} +inline status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) { +#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE) + struct timespec ts; + ts.tv_sec = reltime/1000000000; + ts.tv_nsec = reltime%1000000000; + return -pthread_cond_timedwait_relative_np(&mCond, &mutex.mMutex, &ts); +#else // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE + struct timespec ts; +#if defined(HAVE_POSIX_CLOCKS) + clock_gettime(CLOCK_REALTIME, &ts); +#else // HAVE_POSIX_CLOCKS + // we don't support the clocks here. + struct timeval t; + gettimeofday(&t, NULL); + ts.tv_sec = t.tv_sec; + ts.tv_nsec= t.tv_usec*1000; +#endif // HAVE_POSIX_CLOCKS + ts.tv_sec += reltime/1000000000; + ts.tv_nsec+= reltime%1000000000; + if (ts.tv_nsec >= 1000000000) { + ts.tv_nsec -= 1000000000; + ts.tv_sec += 1; + } + return -pthread_cond_timedwait(&mCond, &mutex.mMutex, &ts); +#endif // HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE +} +inline void Condition::signal() { + pthread_cond_signal(&mCond); +} +inline void Condition::broadcast() { + pthread_cond_broadcast(&mCond); +} + +#endif // HAVE_PTHREADS + +// --------------------------------------------------------------------------- +}; // namespace android +// --------------------------------------------------------------------------- + +#endif // _LIBS_UTILS_CONDITON_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Debug.h android-platform-frameworks-native-21/include/utils/Debug.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Debug.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Debug.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,70 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_DEBUG_H +#define ANDROID_DEBUG_H + +#include +#include + +namespace android { +// --------------------------------------------------------------------------- + +#ifdef __cplusplus +template struct CompileTimeAssert; +template<> struct CompileTimeAssert {}; +#define COMPILE_TIME_ASSERT(_exp) \ + template class CompileTimeAssert< (_exp) >; +#endif +#define COMPILE_TIME_ASSERT_FUNCTION_SCOPE(_exp) \ + CompileTimeAssert<( _exp )>(); + +// --------------------------------------------------------------------------- + +#ifdef __cplusplus +template struct CompileTimeIfElse; +template +struct CompileTimeIfElse { typedef LHS TYPE; }; +template +struct CompileTimeIfElse { typedef RHS TYPE; }; +#endif + +// --------------------------------------------------------------------------- + +#ifdef __cplusplus +extern "C" { +#endif + +const char* stringForIndent(int32_t indentLevel); + +typedef void (*debugPrintFunc)(void* cookie, const char* txt); + +void printTypeCode(uint32_t typeCode, + debugPrintFunc func = 0, void* cookie = 0); + +void printHexData(int32_t indent, const void *buf, size_t length, + size_t bytesPerLine=16, int32_t singleLineBytesCutoff=16, + size_t alignment=0, bool cArrayStyle=false, + debugPrintFunc func = 0, void* cookie = 0); + +#ifdef __cplusplus +} +#endif + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_DEBUG_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Endian.h android-platform-frameworks-native-21/include/utils/Endian.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Endian.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Endian.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,40 @@ +/* + * Copyright (C) 2005 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. + */ + +// +// Android endian-ness defines. +// +#ifndef _LIBS_UTILS_ENDIAN_H +#define _LIBS_UTILS_ENDIAN_H + +#if defined(HAVE_ENDIAN_H) + +#include + +#else /*not HAVE_ENDIAN_H*/ + +#define __BIG_ENDIAN 0x1000 +#define __LITTLE_ENDIAN 0x0001 + +#if defined(HAVE_LITTLE_ENDIAN) +# define __BYTE_ORDER __LITTLE_ENDIAN +#else +# define __BYTE_ORDER __BIG_ENDIAN +#endif + +#endif /*not HAVE_ENDIAN_H*/ + +#endif /*_LIBS_UTILS_ENDIAN_H*/ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Errors.h android-platform-frameworks-native-21/include/utils/Errors.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Errors.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Errors.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_ERRORS_H +#define ANDROID_ERRORS_H + +#include +#include + +namespace android { + +// use this type to return error codes +#ifdef HAVE_MS_C_RUNTIME +typedef int status_t; +#else +typedef int32_t status_t; +#endif + +/* the MS C runtime lacks a few error codes */ + +/* + * Error codes. + * All error codes are negative values. + */ + +// Win32 #defines NO_ERROR as well. It has the same value, so there's no +// real conflict, though it's a bit awkward. +#ifdef _WIN32 +# undef NO_ERROR +#endif + +enum { + OK = 0, // Everything's swell. + NO_ERROR = 0, // No errors. + + UNKNOWN_ERROR = 0x80000000, + + NO_MEMORY = -ENOMEM, + INVALID_OPERATION = -ENOSYS, + BAD_VALUE = -EINVAL, + BAD_TYPE = 0x80000001, + NAME_NOT_FOUND = -ENOENT, + PERMISSION_DENIED = -EPERM, + NO_INIT = -ENODEV, + ALREADY_EXISTS = -EEXIST, + DEAD_OBJECT = -EPIPE, + FAILED_TRANSACTION = 0x80000002, + JPARKS_BROKE_IT = -EPIPE, +#if !defined(HAVE_MS_C_RUNTIME) + BAD_INDEX = -EOVERFLOW, + NOT_ENOUGH_DATA = -ENODATA, + WOULD_BLOCK = -EWOULDBLOCK, + TIMED_OUT = -ETIMEDOUT, + UNKNOWN_TRANSACTION = -EBADMSG, +#else + BAD_INDEX = -E2BIG, + NOT_ENOUGH_DATA = 0x80000003, + WOULD_BLOCK = 0x80000004, + TIMED_OUT = 0x80000005, + UNKNOWN_TRANSACTION = 0x80000006, +#endif + FDS_NOT_ALLOWED = 0x80000007, +}; + +// Restore define; enumeration is in "android" namespace, so the value defined +// there won't work for Win32 code in a different namespace. +#ifdef _WIN32 +# define NO_ERROR 0L +#endif + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_ERRORS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/FileMap.h android-platform-frameworks-native-21/include/utils/FileMap.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/FileMap.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/FileMap.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2006 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. + */ + +// +// Encapsulate a shared file mapping. +// +#ifndef __LIBS_FILE_MAP_H +#define __LIBS_FILE_MAP_H + +#include + +#include + +#ifdef HAVE_WIN32_FILEMAP +#include +#endif + +namespace android { + +/* + * This represents a memory-mapped file. It might be the entire file or + * only part of it. This requires a little bookkeeping because the mapping + * needs to be aligned on page boundaries, and in some cases we'd like to + * have multiple references to the mapped area without creating additional + * maps. + * + * This always uses MAP_SHARED. + * + * TODO: we should be able to create a new FileMap that is a subset of + * an existing FileMap and shares the underlying mapped pages. Requires + * completing the refcounting stuff and possibly introducing the notion + * of a FileMap hierarchy. + */ +class FileMap { +public: + FileMap(void); + + /* + * Create a new mapping on an open file. + * + * Closing the file descriptor does not unmap the pages, so we don't + * claim ownership of the fd. + * + * Returns "false" on failure. + */ + bool create(const char* origFileName, int fd, + off64_t offset, size_t length, bool readOnly); + + /* + * Return the name of the file this map came from, if known. + */ + const char* getFileName(void) const { return mFileName; } + + /* + * Get a pointer to the piece of the file we requested. + */ + void* getDataPtr(void) const { return mDataPtr; } + + /* + * Get the length we requested. + */ + size_t getDataLength(void) const { return mDataLength; } + + /* + * Get the data offset used to create this map. + */ + off64_t getDataOffset(void) const { return mDataOffset; } + + /* + * Get a "copy" of the object. + */ + FileMap* acquire(void) { mRefCount++; return this; } + + /* + * Call this when mapping is no longer needed. + */ + void release(void) { + if (--mRefCount <= 0) + delete this; + } + + /* + * This maps directly to madvise() values, but allows us to avoid + * including everywhere. + */ + enum MapAdvice { + NORMAL, RANDOM, SEQUENTIAL, WILLNEED, DONTNEED + }; + + /* + * Apply an madvise() call to the entire file. + * + * Returns 0 on success, -1 on failure. + */ + int advise(MapAdvice advice); + +protected: + // don't delete objects; call release() + ~FileMap(void); + +private: + // these are not implemented + FileMap(const FileMap& src); + const FileMap& operator=(const FileMap& src); + + int mRefCount; // reference count + char* mFileName; // original file name, if known + void* mBasePtr; // base of mmap area; page aligned + size_t mBaseLength; // length, measured from "mBasePtr" + off64_t mDataOffset; // offset used when map was created + void* mDataPtr; // start of requested data, offset from base + size_t mDataLength; // length, measured from "mDataPtr" +#ifdef HAVE_WIN32_FILEMAP + HANDLE mFileHandle; // Win32 file handle + HANDLE mFileMapping; // Win32 file mapping handle +#endif + + static long mPageSize; +}; + +}; // namespace android + +#endif // __LIBS_FILE_MAP_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Flattenable.h android-platform-frameworks-native-21/include/utils/Flattenable.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Flattenable.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Flattenable.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_UTILS_FLATTENABLE_H +#define ANDROID_UTILS_FLATTENABLE_H + + +#include +#include +#include + +namespace android { + +class Flattenable +{ +public: + // size in bytes of the flattened object + virtual size_t getFlattenedSize() const = 0; + + // number of file descriptors to flatten + virtual size_t getFdCount() const = 0; + + // flattens the object into buffer. + // size should be at least of getFlattenedSize() + // file descriptors are written in the fds[] array but ownership is + // not transfered (ie: they must be dupped by the caller of + // flatten() if needed). + virtual status_t flatten(void* buffer, size_t size, + int fds[], size_t count) const = 0; + + // unflattens the object from buffer. + // size should be equal to the value of getFlattenedSize() when the + // object was flattened. + // unflattened file descriptors are found in the fds[] array and + // don't need to be dupped(). ie: the caller of unflatten doesn't + // keep ownership. If a fd is not retained by unflatten() it must be + // explicitly closed. + virtual status_t unflatten(void const* buffer, size_t size, + int fds[], size_t count) = 0; + +protected: + virtual ~Flattenable() = 0; + +}; + +}; // namespace android + + +#endif /* ANDROID_UTILS_FLATTENABLE_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Functor.h android-platform-frameworks-native-21/include/utils/Functor.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Functor.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Functor.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,33 @@ +/* + * 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. + */ + +#ifndef ANDROID_FUNCTOR_H +#define ANDROID_FUNCTOR_H + +#include + +namespace android { + +class Functor { +public: + Functor() {} + virtual ~Functor() {} + virtual status_t operator ()(int what, void* data) { return NO_ERROR; } +}; + +}; // namespace android + +#endif // ANDROID_FUNCTOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/GenerationCache.h android-platform-frameworks-native-21/include/utils/GenerationCache.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/GenerationCache.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/GenerationCache.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,247 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_UTILS_GENERATION_CACHE_H +#define ANDROID_UTILS_GENERATION_CACHE_H + +#include +#include + +namespace android { + +/** + * GenerationCache callback used when an item is removed + */ +template +class OnEntryRemoved { +public: + virtual ~OnEntryRemoved() { }; + virtual void operator()(EntryKey& key, EntryValue& value) = 0; +}; // class OnEntryRemoved + +template +struct Entry: public LightRefBase > { + Entry(const Entry& e) : + key(e.key), value(e.value), + parent(e.parent), child(e.child) { } + Entry(const EntryKey& key, const EntryValue& value) : + key(key), value(value) { } + + EntryKey key; + EntryValue value; + + sp > parent; // next older entry + sp > child; // next younger entry +}; // struct Entry + +/** + * A LRU type cache + */ +template +class GenerationCache { +public: + GenerationCache(uint32_t maxCapacity); + virtual ~GenerationCache(); + + enum Capacity { + kUnlimitedCapacity, + }; + + void setOnEntryRemovedListener(OnEntryRemoved* listener); + + size_t size() const; + + void clear(); + + bool contains(const K& key) const; + const K& getKeyAt(size_t index) const; + const V& getValueAt(size_t index) const; + + const V& get(const K& key); + bool put(const K& key, const V& value); + + void removeAt(ssize_t index); + bool remove(const K& key); + bool removeOldest(); + +private: + KeyedVector > > mCache; + uint32_t mMaxCapacity; + + OnEntryRemoved* mListener; + + sp > mOldest; + sp > mYoungest; + + void attachToCache(const sp >& entry); + void detachFromCache(const sp >& entry); + + const V mNullValue; +}; // class GenerationCache + +template +GenerationCache::GenerationCache(uint32_t maxCapacity): mMaxCapacity(maxCapacity), + mListener(NULL), mNullValue(NULL) { +}; + +template +GenerationCache::~GenerationCache() { + clear(); +}; + +template +uint32_t GenerationCache::size() const { + return mCache.size(); +} + +/** + * Should be set by the user of the Cache so that the callback is called whenever an item is + * removed from the cache + */ +template +void GenerationCache::setOnEntryRemovedListener(OnEntryRemoved* listener) { + mListener = listener; +} + +template +void GenerationCache::clear() { + if (mListener) { + for (uint32_t i = 0; i < mCache.size(); i++) { + sp > entry = mCache.valueAt(i); + if (mListener) { + (*mListener)(entry->key, entry->value); + } + } + } + mCache.clear(); + mYoungest.clear(); + mOldest.clear(); +} + +template +bool GenerationCache::contains(const K& key) const { + return mCache.indexOfKey(key) >= 0; +} + +template +const K& GenerationCache::getKeyAt(size_t index) const { + return mCache.keyAt(index); +} + +template +const V& GenerationCache::getValueAt(size_t index) const { + return mCache.valueAt(index)->value; +} + +template +const V& GenerationCache::get(const K& key) { + ssize_t index = mCache.indexOfKey(key); + if (index >= 0) { + const sp >& entry = mCache.valueAt(index); + detachFromCache(entry); + attachToCache(entry); + return entry->value; + } + + return mNullValue; +} + +template +bool GenerationCache::put(const K& key, const V& value) { + if (mMaxCapacity != kUnlimitedCapacity && mCache.size() >= mMaxCapacity) { + removeOldest(); + } + + ssize_t index = mCache.indexOfKey(key); + if (index < 0) { + sp > entry = new Entry(key, value); + mCache.add(key, entry); + attachToCache(entry); + return true; + } + + return false; +} + +template +bool GenerationCache::remove(const K& key) { + ssize_t index = mCache.indexOfKey(key); + if (index >= 0) { + removeAt(index); + return true; + } + + return false; +} + +template +void GenerationCache::removeAt(ssize_t index) { + sp > entry = mCache.valueAt(index); + if (mListener) { + (*mListener)(entry->key, entry->value); + } + mCache.removeItemsAt(index, 1); + detachFromCache(entry); +} + +template +bool GenerationCache::removeOldest() { + if (mOldest.get()) { + ssize_t index = mCache.indexOfKey(mOldest->key); + if (index >= 0) { + removeAt(index); + return true; + } + ALOGE("GenerationCache: removeOldest failed to find the item in the cache " + "with the given key, but we know it must be in there. " + "Is the key comparator kaput?"); + } + + return false; +} + +template +void GenerationCache::attachToCache(const sp >& entry) { + if (!mYoungest.get()) { + mYoungest = mOldest = entry; + } else { + entry->parent = mYoungest; + mYoungest->child = entry; + mYoungest = entry; + } +} + +template +void GenerationCache::detachFromCache(const sp >& entry) { + if (entry->parent.get()) { + entry->parent->child = entry->child; + } else { + mOldest = entry->child; + } + + if (entry->child.get()) { + entry->child->parent = entry->parent; + } else { + mYoungest = entry->parent; + } + + entry->parent.clear(); + entry->child.clear(); +} + +}; // namespace android + +#endif // ANDROID_UTILS_GENERATION_CACHE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/KeyedVector.h android-platform-frameworks-native-21/include/utils/KeyedVector.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/KeyedVector.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/KeyedVector.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,208 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_KEYED_VECTOR_H +#define ANDROID_KEYED_VECTOR_H + +#include +#include +#include + +#include +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +template +class KeyedVector +{ +public: + typedef KEY key_type; + typedef VALUE value_type; + + inline KeyedVector(); + + /* + * empty the vector + */ + + inline void clear() { mVector.clear(); } + + /*! + * vector stats + */ + + //! returns number of items in the vector + inline size_t size() const { return mVector.size(); } + //! returns wether or not the vector is empty + inline bool isEmpty() const { return mVector.isEmpty(); } + //! returns how many items can be stored without reallocating the backing store + inline size_t capacity() const { return mVector.capacity(); } + //! setst the capacity. capacity can never be reduced less than size() + inline ssize_t setCapacity(size_t size) { return mVector.setCapacity(size); } + + /*! + * accessors + */ + const VALUE& valueFor(const KEY& key) const; + const VALUE& valueAt(size_t index) const; + const KEY& keyAt(size_t index) const; + ssize_t indexOfKey(const KEY& key) const; + + /*! + * modifying the array + */ + + VALUE& editValueFor(const KEY& key); + VALUE& editValueAt(size_t index); + + /*! + * add/insert/replace items + */ + + ssize_t add(const KEY& key, const VALUE& item); + ssize_t replaceValueFor(const KEY& key, const VALUE& item); + ssize_t replaceValueAt(size_t index, const VALUE& item); + + /*! + * remove items + */ + + ssize_t removeItem(const KEY& key); + ssize_t removeItemsAt(size_t index, size_t count = 1); + +private: + SortedVector< key_value_pair_t > mVector; +}; + +// KeyedVector can be trivially moved using memcpy() because its +// underlying SortedVector can be trivially moved. +template struct trait_trivial_move > { + enum { value = trait_trivial_move > >::value }; +}; + + +// --------------------------------------------------------------------------- + +/** + * Variation of KeyedVector that holds a default value to return when + * valueFor() is called with a key that doesn't exist. + */ +template +class DefaultKeyedVector : public KeyedVector +{ +public: + inline DefaultKeyedVector(const VALUE& defValue = VALUE()); + const VALUE& valueFor(const KEY& key) const; + +private: + VALUE mDefault; +}; + +// --------------------------------------------------------------------------- + +template inline +KeyedVector::KeyedVector() +{ +} + +template inline +ssize_t KeyedVector::indexOfKey(const KEY& key) const { + return mVector.indexOf( key_value_pair_t(key) ); +} + +template inline +const VALUE& KeyedVector::valueFor(const KEY& key) const { + ssize_t i = this->indexOfKey(key); + assert(i>=0); + return mVector.itemAt(i).value; +} + +template inline +const VALUE& KeyedVector::valueAt(size_t index) const { + return mVector.itemAt(index).value; +} + +template inline +const KEY& KeyedVector::keyAt(size_t index) const { + return mVector.itemAt(index).key; +} + +template inline +VALUE& KeyedVector::editValueFor(const KEY& key) { + ssize_t i = this->indexOfKey(key); + assert(i>=0); + return mVector.editItemAt(i).value; +} + +template inline +VALUE& KeyedVector::editValueAt(size_t index) { + return mVector.editItemAt(index).value; +} + +template inline +ssize_t KeyedVector::add(const KEY& key, const VALUE& value) { + return mVector.add( key_value_pair_t(key, value) ); +} + +template inline +ssize_t KeyedVector::replaceValueFor(const KEY& key, const VALUE& value) { + key_value_pair_t pair(key, value); + mVector.remove(pair); + return mVector.add(pair); +} + +template inline +ssize_t KeyedVector::replaceValueAt(size_t index, const VALUE& item) { + if (index inline +ssize_t KeyedVector::removeItem(const KEY& key) { + return mVector.remove(key_value_pair_t(key)); +} + +template inline +ssize_t KeyedVector::removeItemsAt(size_t index, size_t count) { + return mVector.removeItemsAt(index, count); +} + +// --------------------------------------------------------------------------- + +template inline +DefaultKeyedVector::DefaultKeyedVector(const VALUE& defValue) + : mDefault(defValue) +{ +} + +template inline +const VALUE& DefaultKeyedVector::valueFor(const KEY& key) const { + ssize_t i = this->indexOfKey(key); + return i >= 0 ? KeyedVector::valueAt(i) : mDefault; +} + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_KEYED_VECTOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/LinearTransform.h android-platform-frameworks-native-21/include/utils/LinearTransform.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/LinearTransform.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/LinearTransform.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#ifndef _LIBS_UTILS_LINEAR_TRANSFORM_H +#define _LIBS_UTILS_LINEAR_TRANSFORM_H + +#include + +namespace android { + +// LinearTransform defines a structure which hold the definition of a +// transformation from single dimensional coordinate system A into coordinate +// system B (and back again). Values in A and in B are 64 bit, the linear +// scale factor is expressed as a rational number using two 32 bit values. +// +// Specifically, let +// f(a) = b +// F(b) = f^-1(b) = a +// then +// +// f(a) = (((a - a_zero) * a_to_b_numer) / a_to_b_denom) + b_zero; +// +// and +// +// F(b) = (((b - b_zero) * a_to_b_denom) / a_to_b_numer) + a_zero; +// +struct LinearTransform { + int64_t a_zero; + int64_t b_zero; + int32_t a_to_b_numer; + uint32_t a_to_b_denom; + + // Transform from A->B + // Returns true on success, or false in the case of a singularity or an + // overflow. + bool doForwardTransform(int64_t a_in, int64_t* b_out) const; + + // Transform from B->A + // Returns true on success, or false in the case of a singularity or an + // overflow. + bool doReverseTransform(int64_t b_in, int64_t* a_out) const; + + // Helpers which will reduce the fraction N/D using Euclid's method. + template static void reduce(T* N, T* D); + static void reduce(int32_t* N, uint32_t* D); +}; + + +} + +#endif // _LIBS_UTILS_LINEAR_TRANSFORM_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/List.h android-platform-frameworks-native-21/include/utils/List.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/List.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/List.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,332 @@ +/* + * Copyright (C) 2005 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. + */ + +// +// Templated list class. Normally we'd use STL, but we don't have that. +// This class mimics STL's interfaces. +// +// Objects are copied into the list with the '=' operator or with copy- +// construction, so if the compiler's auto-generated versions won't work for +// you, define your own. +// +// The only class you want to use from here is "List". +// +#ifndef _LIBS_UTILS_LIST_H +#define _LIBS_UTILS_LIST_H + +#include +#include + +namespace android { + +/* + * Doubly-linked list. Instantiate with "List myList". + * + * Objects added to the list are copied using the assignment operator, + * so this must be defined. + */ +template +class List +{ +protected: + /* + * One element in the list. + */ + class _Node { + public: + explicit _Node(const T& val) : mVal(val) {} + ~_Node() {} + inline T& getRef() { return mVal; } + inline const T& getRef() const { return mVal; } + inline _Node* getPrev() const { return mpPrev; } + inline _Node* getNext() const { return mpNext; } + inline void setVal(const T& val) { mVal = val; } + inline void setPrev(_Node* ptr) { mpPrev = ptr; } + inline void setNext(_Node* ptr) { mpNext = ptr; } + private: + friend class List; + friend class _ListIterator; + T mVal; + _Node* mpPrev; + _Node* mpNext; + }; + + /* + * Iterator for walking through the list. + */ + + template + struct CONST_ITERATOR { + typedef _Node const * NodePtr; + typedef const TYPE Type; + }; + + template + struct NON_CONST_ITERATOR { + typedef _Node* NodePtr; + typedef TYPE Type; + }; + + template< + typename U, + template class Constness + > + class _ListIterator { + typedef _ListIterator _Iter; + typedef typename Constness::NodePtr _NodePtr; + typedef typename Constness::Type _Type; + + explicit _ListIterator(_NodePtr ptr) : mpNode(ptr) {} + + public: + _ListIterator() {} + _ListIterator(const _Iter& rhs) : mpNode(rhs.mpNode) {} + ~_ListIterator() {} + + // this will handle conversions from iterator to const_iterator + // (and also all convertible iterators) + // Here, in this implementation, the iterators can be converted + // if the nodes can be converted + template explicit + _ListIterator(const V& rhs) : mpNode(rhs.mpNode) {} + + + /* + * Dereference operator. Used to get at the juicy insides. + */ + _Type& operator*() const { return mpNode->getRef(); } + _Type* operator->() const { return &(mpNode->getRef()); } + + /* + * Iterator comparison. + */ + inline bool operator==(const _Iter& right) const { + return mpNode == right.mpNode; } + + inline bool operator!=(const _Iter& right) const { + return mpNode != right.mpNode; } + + /* + * handle comparisons between iterator and const_iterator + */ + template + inline bool operator==(const OTHER& right) const { + return mpNode == right.mpNode; } + + template + inline bool operator!=(const OTHER& right) const { + return mpNode != right.mpNode; } + + /* + * Incr/decr, used to move through the list. + */ + inline _Iter& operator++() { // pre-increment + mpNode = mpNode->getNext(); + return *this; + } + const _Iter operator++(int) { // post-increment + _Iter tmp(*this); + mpNode = mpNode->getNext(); + return tmp; + } + inline _Iter& operator--() { // pre-increment + mpNode = mpNode->getPrev(); + return *this; + } + const _Iter operator--(int) { // post-increment + _Iter tmp(*this); + mpNode = mpNode->getPrev(); + return tmp; + } + + inline _NodePtr getNode() const { return mpNode; } + + _NodePtr mpNode; /* should be private, but older gcc fails */ + private: + friend class List; + }; + +public: + List() { + prep(); + } + List(const List& src) { // copy-constructor + prep(); + insert(begin(), src.begin(), src.end()); + } + virtual ~List() { + clear(); + delete[] (unsigned char*) mpMiddle; + } + + typedef _ListIterator iterator; + typedef _ListIterator const_iterator; + + List& operator=(const List& right); + + /* returns true if the list is empty */ + inline bool empty() const { return mpMiddle->getNext() == mpMiddle; } + + /* return #of elements in list */ + size_t size() const { + return size_t(distance(begin(), end())); + } + + /* + * Return the first element or one past the last element. The + * _Node* we're returning is converted to an "iterator" by a + * constructor in _ListIterator. + */ + inline iterator begin() { + return iterator(mpMiddle->getNext()); + } + inline const_iterator begin() const { + return const_iterator(const_cast<_Node const*>(mpMiddle->getNext())); + } + inline iterator end() { + return iterator(mpMiddle); + } + inline const_iterator end() const { + return const_iterator(const_cast<_Node const*>(mpMiddle)); + } + + /* add the object to the head or tail of the list */ + void push_front(const T& val) { insert(begin(), val); } + void push_back(const T& val) { insert(end(), val); } + + /* insert before the current node; returns iterator at new node */ + iterator insert(iterator posn, const T& val) + { + _Node* newNode = new _Node(val); // alloc & copy-construct + newNode->setNext(posn.getNode()); + newNode->setPrev(posn.getNode()->getPrev()); + posn.getNode()->getPrev()->setNext(newNode); + posn.getNode()->setPrev(newNode); + return iterator(newNode); + } + + /* insert a range of elements before the current node */ + void insert(iterator posn, const_iterator first, const_iterator last) { + for ( ; first != last; ++first) + insert(posn, *first); + } + + /* remove one entry; returns iterator at next node */ + iterator erase(iterator posn) { + _Node* pNext = posn.getNode()->getNext(); + _Node* pPrev = posn.getNode()->getPrev(); + pPrev->setNext(pNext); + pNext->setPrev(pPrev); + delete posn.getNode(); + return iterator(pNext); + } + + /* remove a range of elements */ + iterator erase(iterator first, iterator last) { + while (first != last) + erase(first++); // don't erase than incr later! + return iterator(last); + } + + /* remove all contents of the list */ + void clear() { + _Node* pCurrent = mpMiddle->getNext(); + _Node* pNext; + + while (pCurrent != mpMiddle) { + pNext = pCurrent->getNext(); + delete pCurrent; + pCurrent = pNext; + } + mpMiddle->setPrev(mpMiddle); + mpMiddle->setNext(mpMiddle); + } + + /* + * Measure the distance between two iterators. On exist, "first" + * will be equal to "last". The iterators must refer to the same + * list. + * + * FIXME: This is actually a generic iterator function. It should be a + * template function at the top-level with specializations for things like + * vector<>, which can just do pointer math). Here we limit it to + * _ListIterator of the same type but different constness. + */ + template< + typename U, + template class CL, + template class CR + > + ptrdiff_t distance( + _ListIterator first, _ListIterator last) const + { + ptrdiff_t count = 0; + while (first != last) { + ++first; + ++count; + } + return count; + } + +private: + /* + * I want a _Node but don't need it to hold valid data. More + * to the point, I don't want T's constructor to fire, since it + * might have side-effects or require arguments. So, we do this + * slightly uncouth storage alloc. + */ + void prep() { + mpMiddle = (_Node*) new unsigned char[sizeof(_Node)]; + mpMiddle->setPrev(mpMiddle); + mpMiddle->setNext(mpMiddle); + } + + /* + * This node plays the role of "pointer to head" and "pointer to tail". + * It sits in the middle of a circular list of nodes. The iterator + * runs around the circle until it encounters this one. + */ + _Node* mpMiddle; +}; + +/* + * Assignment operator. + * + * The simplest way to do this would be to clear out the target list and + * fill it with the source. However, we can speed things along by + * re-using existing elements. + */ +template +List& List::operator=(const List& right) +{ + if (this == &right) + return *this; // self-assignment + iterator firstDst = begin(); + iterator lastDst = end(); + const_iterator firstSrc = right.begin(); + const_iterator lastSrc = right.end(); + while (firstSrc != lastSrc && firstDst != lastDst) + *firstDst++ = *firstSrc++; + if (firstSrc == lastSrc) // ran out of elements in source? + erase(firstDst, lastDst); // yes, erase any extras + else + insert(lastDst, firstSrc, lastSrc); // copy remaining over + return *this; +} + +}; // namespace android + +#endif // _LIBS_UTILS_LIST_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Log.h android-platform-frameworks-native-21/include/utils/Log.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Log.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Log.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,33 @@ +/* + * Copyright (C) 2005 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. + */ + +// +// C/C++ logging functions. See the logging documentation for API details. +// +// We'd like these to be available from C code (in case we import some from +// somewhere), so this has a C interface. +// +// The output will be correct when the log file is shared between multiple +// threads and/or multiple processes so long as the operating system +// supports O_APPEND. These calls have mutex-protected data structures +// and so are NOT reentrant. Do not use LOG in a signal handler. +// +#ifndef _LIBS_UTILS_LOG_H +#define _LIBS_UTILS_LOG_H + +#include + +#endif // _LIBS_UTILS_LOG_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Looper.h android-platform-frameworks-native-21/include/utils/Looper.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Looper.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Looper.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,377 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef UTILS_LOOPER_H +#define UTILS_LOOPER_H + +#include +#include +#include +#include + +#include + +#include + +/* + * Declare a concrete type for the NDK's looper forward declaration. + */ +struct ALooper { +}; + +namespace android { + +/** + * A message that can be posted to a Looper. + */ +struct Message { + Message() : what(0) { } + Message(int what) : what(what) { } + + /* The message type. (interpretation is left up to the handler) */ + int what; +}; + + +/** + * Interface for a Looper message handler. + * + * The Looper holds a strong reference to the message handler whenever it has + * a message to deliver to it. Make sure to call Looper::removeMessages + * to remove any pending messages destined for the handler so that the handler + * can be destroyed. + */ +class MessageHandler : public virtual RefBase { +protected: + virtual ~MessageHandler() { } + +public: + /** + * Handles a message. + */ + virtual void handleMessage(const Message& message) = 0; +}; + + +/** + * A simple proxy that holds a weak reference to a message handler. + */ +class WeakMessageHandler : public MessageHandler { +protected: + virtual ~WeakMessageHandler(); + +public: + WeakMessageHandler(const wp& handler); + virtual void handleMessage(const Message& message); + +private: + wp mHandler; +}; + + +/** + * A looper callback. + */ +class LooperCallback : public virtual RefBase { +protected: + virtual ~LooperCallback() { } + +public: + /** + * Handles a poll event for the given file descriptor. + * It is given the file descriptor it is associated with, + * a bitmask of the poll events that were triggered (typically ALOOPER_EVENT_INPUT), + * and the data pointer that was originally supplied. + * + * Implementations should return 1 to continue receiving callbacks, or 0 + * to have this file descriptor and callback unregistered from the looper. + */ + virtual int handleEvent(int fd, int events, void* data) = 0; +}; + + +/** + * Wraps a ALooper_callbackFunc function pointer. + */ +class SimpleLooperCallback : public LooperCallback { +protected: + virtual ~SimpleLooperCallback(); + +public: + SimpleLooperCallback(ALooper_callbackFunc callback); + virtual int handleEvent(int fd, int events, void* data); + +private: + ALooper_callbackFunc mCallback; +}; + + +/** + * A polling loop that supports monitoring file descriptor events, optionally + * using callbacks. The implementation uses epoll() internally. + * + * A looper can be associated with a thread although there is no requirement that it must be. + */ +class Looper : public ALooper, public RefBase { +protected: + virtual ~Looper(); + +public: + /** + * Creates a looper. + * + * If allowNonCallbaks is true, the looper will allow file descriptors to be + * registered without associated callbacks. This assumes that the caller of + * pollOnce() is prepared to handle callback-less events itself. + */ + Looper(bool allowNonCallbacks); + + /** + * Returns whether this looper instance allows the registration of file descriptors + * using identifiers instead of callbacks. + */ + bool getAllowNonCallbacks() const; + + /** + * Waits for events to be available, with optional timeout in milliseconds. + * Invokes callbacks for all file descriptors on which an event occurred. + * + * If the timeout is zero, returns immediately without blocking. + * If the timeout is negative, waits indefinitely until an event appears. + * + * Returns ALOOPER_POLL_WAKE if the poll was awoken using wake() before + * the timeout expired and no callbacks were invoked and no other file + * descriptors were ready. + * + * Returns ALOOPER_POLL_CALLBACK if one or more callbacks were invoked. + * + * Returns ALOOPER_POLL_TIMEOUT if there was no data before the given + * timeout expired. + * + * Returns ALOOPER_POLL_ERROR if an error occurred. + * + * Returns a value >= 0 containing an identifier if its file descriptor has data + * and it has no callback function (requiring the caller here to handle it). + * In this (and only this) case outFd, outEvents and outData will contain the poll + * events and data associated with the fd, otherwise they will be set to NULL. + * + * This method does not return until it has finished invoking the appropriate callbacks + * for all file descriptors that were signalled. + */ + int pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData); + inline int pollOnce(int timeoutMillis) { + return pollOnce(timeoutMillis, NULL, NULL, NULL); + } + + /** + * Like pollOnce(), but performs all pending callbacks until all + * data has been consumed or a file descriptor is available with no callback. + * This function will never return ALOOPER_POLL_CALLBACK. + */ + int pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData); + inline int pollAll(int timeoutMillis) { + return pollAll(timeoutMillis, NULL, NULL, NULL); + } + + /** + * Wakes the poll asynchronously. + * + * This method can be called on any thread. + * This method returns immediately. + */ + void wake(); + + /** + * Adds a new file descriptor to be polled by the looper. + * If the same file descriptor was previously added, it is replaced. + * + * "fd" is the file descriptor to be added. + * "ident" is an identifier for this event, which is returned from pollOnce(). + * The identifier must be >= 0, or ALOOPER_POLL_CALLBACK if providing a non-NULL callback. + * "events" are the poll events to wake up on. Typically this is ALOOPER_EVENT_INPUT. + * "callback" is the function to call when there is an event on the file descriptor. + * "data" is a private data pointer to supply to the callback. + * + * There are two main uses of this function: + * + * (1) If "callback" is non-NULL, then this function will be called when there is + * data on the file descriptor. It should execute any events it has pending, + * appropriately reading from the file descriptor. The 'ident' is ignored in this case. + * + * (2) If "callback" is NULL, the 'ident' will be returned by ALooper_pollOnce + * when its file descriptor has data available, requiring the caller to take + * care of processing it. + * + * Returns 1 if the file descriptor was added, 0 if the arguments were invalid. + * + * This method can be called on any thread. + * This method may block briefly if it needs to wake the poll. + * + * The callback may either be specified as a bare function pointer or as a smart + * pointer callback object. The smart pointer should be preferred because it is + * easier to avoid races when the callback is removed from a different thread. + * See removeFd() for details. + */ + int addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data); + int addFd(int fd, int ident, int events, const sp& callback, void* data); + + /** + * Removes a previously added file descriptor from the looper. + * + * When this method returns, it is safe to close the file descriptor since the looper + * will no longer have a reference to it. However, it is possible for the callback to + * already be running or for it to run one last time if the file descriptor was already + * signalled. Calling code is responsible for ensuring that this case is safely handled. + * For example, if the callback takes care of removing itself during its own execution either + * by returning 0 or by calling this method, then it can be guaranteed to not be invoked + * again at any later time unless registered anew. + * + * A simple way to avoid this problem is to use the version of addFd() that takes + * a sp instead of a bare function pointer. The LooperCallback will + * be released at the appropriate time by the Looper. + * + * Returns 1 if the file descriptor was removed, 0 if none was previously registered. + * + * This method can be called on any thread. + * This method may block briefly if it needs to wake the poll. + */ + int removeFd(int fd); + + /** + * Enqueues a message to be processed by the specified handler. + * + * The handler must not be null. + * This method can be called on any thread. + */ + void sendMessage(const sp& handler, const Message& message); + + /** + * Enqueues a message to be processed by the specified handler after all pending messages + * after the specified delay. + * + * The time delay is specified in uptime nanoseconds. + * The handler must not be null. + * This method can be called on any thread. + */ + void sendMessageDelayed(nsecs_t uptimeDelay, const sp& handler, + const Message& message); + + /** + * Enqueues a message to be processed by the specified handler after all pending messages + * at the specified time. + * + * The time is specified in uptime nanoseconds. + * The handler must not be null. + * This method can be called on any thread. + */ + void sendMessageAtTime(nsecs_t uptime, const sp& handler, + const Message& message); + + /** + * Removes all messages for the specified handler from the queue. + * + * The handler must not be null. + * This method can be called on any thread. + */ + void removeMessages(const sp& handler); + + /** + * Removes all messages of a particular type for the specified handler from the queue. + * + * The handler must not be null. + * This method can be called on any thread. + */ + void removeMessages(const sp& handler, int what); + + /** + * Prepares a looper associated with the calling thread, and returns it. + * If the thread already has a looper, it is returned. Otherwise, a new + * one is created, associated with the thread, and returned. + * + * The opts may be ALOOPER_PREPARE_ALLOW_NON_CALLBACKS or 0. + */ + static sp prepare(int opts); + + /** + * Sets the given looper to be associated with the calling thread. + * If another looper is already associated with the thread, it is replaced. + * + * If "looper" is NULL, removes the currently associated looper. + */ + static void setForThread(const sp& looper); + + /** + * Returns the looper associated with the calling thread, or NULL if + * there is not one. + */ + static sp getForThread(); + +private: + struct Request { + int fd; + int ident; + sp callback; + void* data; + }; + + struct Response { + int events; + Request request; + }; + + struct MessageEnvelope { + MessageEnvelope() : uptime(0) { } + + MessageEnvelope(nsecs_t uptime, const sp handler, + const Message& message) : uptime(uptime), handler(handler), message(message) { + } + + nsecs_t uptime; + sp handler; + Message message; + }; + + const bool mAllowNonCallbacks; // immutable + + int mWakeReadPipeFd; // immutable + int mWakeWritePipeFd; // immutable + Mutex mLock; + + Vector mMessageEnvelopes; // guarded by mLock + bool mSendingMessage; // guarded by mLock + + int mEpollFd; // immutable + + // Locked list of file descriptor monitoring requests. + KeyedVector mRequests; // guarded by mLock + + // This state is only used privately by pollOnce and does not require a lock since + // it runs on a single thread. + Vector mResponses; + size_t mResponseIndex; + nsecs_t mNextMessageUptime; // set to LLONG_MAX when none + + int pollInner(int timeoutMillis); + void awoken(); + void pushResponse(int events, const Request& request); + + static void initTLSKey(); + static void threadDestructor(void *st); +}; + +} // namespace android + +#endif // UTILS_LOOPER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/misc.h android-platform-frameworks-native-21/include/utils/misc.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/misc.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/misc.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,97 @@ +/* + * Copyright (C) 2005 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. + */ + +// +// Handy utility functions and portability code. +// +#ifndef _LIBS_UTILS_MISC_H +#define _LIBS_UTILS_MISC_H + +#include +#include + +namespace android { + +/* get #of elements in a static array */ +#ifndef NELEM +# define NELEM(x) ((int) (sizeof(x) / sizeof((x)[0]))) +#endif + +/* + * Make a copy of the string, using "new[]" instead of "malloc". Free the + * string with delete[]. + * + * Returns NULL if "str" is NULL. + */ +char* strdupNew(const char* str); + +/* + * Concatenate an argument vector into a single string. If argc is >= 0 + * it will be used; if it's < 0 then the last element in the arg vector + * must be NULL. + * + * This inserts a space between each argument. + * + * This does not automatically add double quotes around arguments with + * spaces in them. This practice is necessary for Win32, because Win32's + * CreateProcess call is stupid. + * + * The caller should delete[] the returned string. + */ +char* concatArgv(int argc, const char* const argv[]); + +/* + * Count up the number of arguments in "argv". The count does not include + * the final NULL entry. + */ +int countArgv(const char* const argv[]); + +/* + * Some utility functions for working with files. These could be made + * part of a "File" class. + */ +typedef enum FileType { + kFileTypeUnknown = 0, + kFileTypeNonexistent, // i.e. ENOENT + kFileTypeRegular, + kFileTypeDirectory, + kFileTypeCharDev, + kFileTypeBlockDev, + kFileTypeFifo, + kFileTypeSymlink, + kFileTypeSocket, +} FileType; +/* get the file's type; follows symlinks */ +FileType getFileType(const char* fileName); +/* get the file's modification date; returns -1 w/errno set on failure */ +time_t getFileModDate(const char* fileName); + +/* + * Round up to the nearest power of 2. Handy for hash tables. + */ +unsigned int roundUpPower2(unsigned int val); + +void strreverse(char* begin, char* end); +void k_itoa(int value, char* str, int base); +char* itoa(int val, int base); + +typedef void (*sysprop_change_callback)(void); +void add_sysprop_change_callback(sysprop_change_callback cb, int priority); +void report_sysprop_change(); + +}; // namespace android + +#endif // _LIBS_UTILS_MISC_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Mutex.h android-platform-frameworks-native-21/include/utils/Mutex.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Mutex.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Mutex.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_MUTEX_H +#define _LIBS_UTILS_MUTEX_H + +#include +#include +#include + +#if defined(HAVE_PTHREADS) +# include +#endif + +#include + +// --------------------------------------------------------------------------- +namespace android { +// --------------------------------------------------------------------------- + +class Condition; + +/* + * Simple mutex class. The implementation is system-dependent. + * + * The mutex must be unlocked by the thread that locked it. They are not + * recursive, i.e. the same thread can't lock it multiple times. + */ +class Mutex { +public: + enum { + PRIVATE = 0, + SHARED = 1 + }; + + Mutex(); + Mutex(const char* name); + Mutex(int type, const char* name = NULL); + ~Mutex(); + + // lock or unlock the mutex + status_t lock(); + void unlock(); + + // lock if possible; returns 0 on success, error otherwise + status_t tryLock(); + + // Manages the mutex automatically. It'll be locked when Autolock is + // constructed and released when Autolock goes out of scope. + class Autolock { + public: + inline Autolock(Mutex& mutex) : mLock(mutex) { mLock.lock(); } + inline Autolock(Mutex* mutex) : mLock(*mutex) { mLock.lock(); } + inline ~Autolock() { mLock.unlock(); } + private: + Mutex& mLock; + }; + +private: + friend class Condition; + + // A mutex cannot be copied + Mutex(const Mutex&); + Mutex& operator = (const Mutex&); + +#if defined(HAVE_PTHREADS) + pthread_mutex_t mMutex; +#else + void _init(); + void* mState; +#endif +}; + +// --------------------------------------------------------------------------- + +#if defined(HAVE_PTHREADS) + +inline Mutex::Mutex() { + pthread_mutex_init(&mMutex, NULL); +} +inline Mutex::Mutex(const char* name) { + pthread_mutex_init(&mMutex, NULL); +} +inline Mutex::Mutex(int type, const char* name) { + if (type == SHARED) { + pthread_mutexattr_t attr; + pthread_mutexattr_init(&attr); + pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_mutex_init(&mMutex, &attr); + pthread_mutexattr_destroy(&attr); + } else { + pthread_mutex_init(&mMutex, NULL); + } +} +inline Mutex::~Mutex() { + pthread_mutex_destroy(&mMutex); +} +inline status_t Mutex::lock() { + return -pthread_mutex_lock(&mMutex); +} +inline void Mutex::unlock() { + pthread_mutex_unlock(&mMutex); +} +inline status_t Mutex::tryLock() { + return -pthread_mutex_trylock(&mMutex); +} + +#endif // HAVE_PTHREADS + +// --------------------------------------------------------------------------- + +/* + * Automatic mutex. Declare one of these at the top of a function. + * When the function returns, it will go out of scope, and release the + * mutex. + */ + +typedef Mutex::Autolock AutoMutex; + +// --------------------------------------------------------------------------- +}; // namespace android +// --------------------------------------------------------------------------- + +#endif // _LIBS_UTILS_MUTEX_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/PropertyMap.h android-platform-frameworks-native-21/include/utils/PropertyMap.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/PropertyMap.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/PropertyMap.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,106 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef _UTILS_PROPERTY_MAP_H +#define _UTILS_PROPERTY_MAP_H + +#include +#include +#include +#include + +namespace android { + +/* + * Provides a mechanism for passing around string-based property key / value pairs + * and loading them from property files. + * + * The property files have the following simple structure: + * + * # Comment + * key = value + * + * Keys and values are any sequence of printable ASCII characters. + * The '=' separates the key from the value. + * The key and value may not contain whitespace. + * + * The '\' character is reserved for escape sequences and is not currently supported. + * The '"" character is reserved for quoting and is not currently supported. + * Files that contain the '\' or '"' character will fail to parse. + * + * The file must not contain duplicate keys. + * + * TODO Support escape sequences and quoted values when needed. + */ +class PropertyMap { +public: + /* Creates an empty property map. */ + PropertyMap(); + ~PropertyMap(); + + /* Clears the property map. */ + void clear(); + + /* Adds a property. + * Replaces the property with the same key if it is already present. + */ + void addProperty(const String8& key, const String8& value); + + /* Returns true if the property map contains the specified key. */ + bool hasProperty(const String8& key) const; + + /* Gets the value of a property and parses it. + * Returns true and sets outValue if the key was found and its value was parsed successfully. + * Otherwise returns false and does not modify outValue. (Also logs a warning.) + */ + bool tryGetProperty(const String8& key, String8& outValue) const; + bool tryGetProperty(const String8& key, bool& outValue) const; + bool tryGetProperty(const String8& key, int32_t& outValue) const; + bool tryGetProperty(const String8& key, float& outValue) const; + + /* Adds all values from the specified property map. */ + void addAll(const PropertyMap* map); + + /* Gets the underlying property map. */ + inline const KeyedVector& getProperties() const { return mProperties; } + + /* Loads a property map from a file. */ + static status_t load(const String8& filename, PropertyMap** outMap); + +private: + class Parser { + PropertyMap* mMap; + Tokenizer* mTokenizer; + + public: + Parser(PropertyMap* map, Tokenizer* tokenizer); + ~Parser(); + status_t parse(); + + private: + status_t parseType(); + status_t parseKey(); + status_t parseKeyProperty(); + status_t parseModifier(const String8& token, int32_t* outMetaState); + status_t parseCharacterLiteral(char16_t* outCharacter); + }; + + KeyedVector mProperties; +}; + +} // namespace android + +#endif // _UTILS_PROPERTY_MAP_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/RefBase.h android-platform-frameworks-native-21/include/utils/RefBase.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/RefBase.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/RefBase.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,529 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_REF_BASE_H +#define ANDROID_REF_BASE_H + +#include + +#include +#include +#include +#include + +#include +#include + +// --------------------------------------------------------------------------- +namespace android { + +class TextOutput; +TextOutput& printWeakPointer(TextOutput& to, const void* val); + +// --------------------------------------------------------------------------- + +#define COMPARE_WEAK(_op_) \ +inline bool operator _op_ (const sp& o) const { \ + return m_ptr _op_ o.m_ptr; \ +} \ +inline bool operator _op_ (const T* o) const { \ + return m_ptr _op_ o; \ +} \ +template \ +inline bool operator _op_ (const sp& o) const { \ + return m_ptr _op_ o.m_ptr; \ +} \ +template \ +inline bool operator _op_ (const U* o) const { \ + return m_ptr _op_ o; \ +} + +// --------------------------------------------------------------------------- +class ReferenceMover; +class ReferenceConverterBase { +public: + virtual size_t getReferenceTypeSize() const = 0; + virtual void* getReferenceBase(void const*) const = 0; + inline virtual ~ReferenceConverterBase() { } +}; + +// --------------------------------------------------------------------------- + +class RefBase +{ +public: + void incStrong(const void* id) const; + void decStrong(const void* id) const; + + void forceIncStrong(const void* id) const; + + //! DEBUGGING ONLY: Get current strong ref count. + int32_t getStrongCount() const; + + class weakref_type + { + public: + RefBase* refBase() const; + + void incWeak(const void* id); + void decWeak(const void* id); + + // acquires a strong reference if there is already one. + bool attemptIncStrong(const void* id); + + // acquires a weak reference if there is already one. + // This is not always safe. see ProcessState.cpp and BpBinder.cpp + // for proper use. + bool attemptIncWeak(const void* id); + + //! DEBUGGING ONLY: Get current weak ref count. + int32_t getWeakCount() const; + + //! DEBUGGING ONLY: Print references held on object. + void printRefs() const; + + //! DEBUGGING ONLY: Enable tracking for this object. + // enable -- enable/disable tracking + // retain -- when tracking is enable, if true, then we save a stack trace + // for each reference and dereference; when retain == false, we + // match up references and dereferences and keep only the + // outstanding ones. + + void trackMe(bool enable, bool retain); + }; + + weakref_type* createWeak(const void* id) const; + + weakref_type* getWeakRefs() const; + + //! DEBUGGING ONLY: Print references held on object. + inline void printRefs() const { getWeakRefs()->printRefs(); } + + //! DEBUGGING ONLY: Enable tracking of object. + inline void trackMe(bool enable, bool retain) + { + getWeakRefs()->trackMe(enable, retain); + } + + typedef RefBase basetype; + +protected: + RefBase(); + virtual ~RefBase(); + + //! Flags for extendObjectLifetime() + enum { + OBJECT_LIFETIME_STRONG = 0x0000, + OBJECT_LIFETIME_WEAK = 0x0001, + OBJECT_LIFETIME_MASK = 0x0001 + }; + + void extendObjectLifetime(int32_t mode); + + //! Flags for onIncStrongAttempted() + enum { + FIRST_INC_STRONG = 0x0001 + }; + + virtual void onFirstRef(); + virtual void onLastStrongRef(const void* id); + virtual bool onIncStrongAttempted(uint32_t flags, const void* id); + virtual void onLastWeakRef(const void* id); + +private: + friend class ReferenceMover; + static void moveReferences(void* d, void const* s, size_t n, + const ReferenceConverterBase& caster); + +private: + friend class weakref_type; + class weakref_impl; + + RefBase(const RefBase& o); + RefBase& operator=(const RefBase& o); + + weakref_impl* const mRefs; +}; + +// --------------------------------------------------------------------------- + +template +class LightRefBase +{ +public: + inline LightRefBase() : mCount(0) { } + inline void incStrong(const void* id) const { + android_atomic_inc(&mCount); + } + inline void decStrong(const void* id) const { + if (android_atomic_dec(&mCount) == 1) { + delete static_cast(this); + } + } + //! DEBUGGING ONLY: Get current strong ref count. + inline int32_t getStrongCount() const { + return mCount; + } + + typedef LightRefBase basetype; + +protected: + inline ~LightRefBase() { } + +private: + friend class ReferenceMover; + inline static void moveReferences(void* d, void const* s, size_t n, + const ReferenceConverterBase& caster) { } + +private: + mutable volatile int32_t mCount; +}; + +// --------------------------------------------------------------------------- + +template +class wp +{ +public: + typedef typename RefBase::weakref_type weakref_type; + + inline wp() : m_ptr(0) { } + + wp(T* other); + wp(const wp& other); + wp(const sp& other); + template wp(U* other); + template wp(const sp& other); + template wp(const wp& other); + + ~wp(); + + // Assignment + + wp& operator = (T* other); + wp& operator = (const wp& other); + wp& operator = (const sp& other); + + template wp& operator = (U* other); + template wp& operator = (const wp& other); + template wp& operator = (const sp& other); + + void set_object_and_refs(T* other, weakref_type* refs); + + // promotion to sp + + sp promote() const; + + // Reset + + void clear(); + + // Accessors + + inline weakref_type* get_refs() const { return m_refs; } + + inline T* unsafe_get() const { return m_ptr; } + + // Operators + + COMPARE_WEAK(==) + COMPARE_WEAK(!=) + COMPARE_WEAK(>) + COMPARE_WEAK(<) + COMPARE_WEAK(<=) + COMPARE_WEAK(>=) + + inline bool operator == (const wp& o) const { + return (m_ptr == o.m_ptr) && (m_refs == o.m_refs); + } + template + inline bool operator == (const wp& o) const { + return m_ptr == o.m_ptr; + } + + inline bool operator > (const wp& o) const { + return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); + } + template + inline bool operator > (const wp& o) const { + return (m_ptr == o.m_ptr) ? (m_refs > o.m_refs) : (m_ptr > o.m_ptr); + } + + inline bool operator < (const wp& o) const { + return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); + } + template + inline bool operator < (const wp& o) const { + return (m_ptr == o.m_ptr) ? (m_refs < o.m_refs) : (m_ptr < o.m_ptr); + } + inline bool operator != (const wp& o) const { return m_refs != o.m_refs; } + template inline bool operator != (const wp& o) const { return !operator == (o); } + inline bool operator <= (const wp& o) const { return !operator > (o); } + template inline bool operator <= (const wp& o) const { return !operator > (o); } + inline bool operator >= (const wp& o) const { return !operator < (o); } + template inline bool operator >= (const wp& o) const { return !operator < (o); } + +private: + template friend class sp; + template friend class wp; + + T* m_ptr; + weakref_type* m_refs; +}; + +template +TextOutput& operator<<(TextOutput& to, const wp& val); + +#undef COMPARE_WEAK + +// --------------------------------------------------------------------------- +// No user serviceable parts below here. + +template +wp::wp(T* other) + : m_ptr(other) +{ + if (other) m_refs = other->createWeak(this); +} + +template +wp::wp(const wp& other) + : m_ptr(other.m_ptr), m_refs(other.m_refs) +{ + if (m_ptr) m_refs->incWeak(this); +} + +template +wp::wp(const sp& other) + : m_ptr(other.m_ptr) +{ + if (m_ptr) { + m_refs = m_ptr->createWeak(this); + } +} + +template template +wp::wp(U* other) + : m_ptr(other) +{ + if (other) m_refs = other->createWeak(this); +} + +template template +wp::wp(const wp& other) + : m_ptr(other.m_ptr) +{ + if (m_ptr) { + m_refs = other.m_refs; + m_refs->incWeak(this); + } +} + +template template +wp::wp(const sp& other) + : m_ptr(other.m_ptr) +{ + if (m_ptr) { + m_refs = m_ptr->createWeak(this); + } +} + +template +wp::~wp() +{ + if (m_ptr) m_refs->decWeak(this); +} + +template +wp& wp::operator = (T* other) +{ + weakref_type* newRefs = + other ? other->createWeak(this) : 0; + if (m_ptr) m_refs->decWeak(this); + m_ptr = other; + m_refs = newRefs; + return *this; +} + +template +wp& wp::operator = (const wp& other) +{ + weakref_type* otherRefs(other.m_refs); + T* otherPtr(other.m_ptr); + if (otherPtr) otherRefs->incWeak(this); + if (m_ptr) m_refs->decWeak(this); + m_ptr = otherPtr; + m_refs = otherRefs; + return *this; +} + +template +wp& wp::operator = (const sp& other) +{ + weakref_type* newRefs = + other != NULL ? other->createWeak(this) : 0; + T* otherPtr(other.m_ptr); + if (m_ptr) m_refs->decWeak(this); + m_ptr = otherPtr; + m_refs = newRefs; + return *this; +} + +template template +wp& wp::operator = (U* other) +{ + weakref_type* newRefs = + other ? other->createWeak(this) : 0; + if (m_ptr) m_refs->decWeak(this); + m_ptr = other; + m_refs = newRefs; + return *this; +} + +template template +wp& wp::operator = (const wp& other) +{ + weakref_type* otherRefs(other.m_refs); + U* otherPtr(other.m_ptr); + if (otherPtr) otherRefs->incWeak(this); + if (m_ptr) m_refs->decWeak(this); + m_ptr = otherPtr; + m_refs = otherRefs; + return *this; +} + +template template +wp& wp::operator = (const sp& other) +{ + weakref_type* newRefs = + other != NULL ? other->createWeak(this) : 0; + U* otherPtr(other.m_ptr); + if (m_ptr) m_refs->decWeak(this); + m_ptr = otherPtr; + m_refs = newRefs; + return *this; +} + +template +void wp::set_object_and_refs(T* other, weakref_type* refs) +{ + if (other) refs->incWeak(this); + if (m_ptr) m_refs->decWeak(this); + m_ptr = other; + m_refs = refs; +} + +template +sp wp::promote() const +{ + sp result; + if (m_ptr && m_refs->attemptIncStrong(&result)) { + result.set_pointer(m_ptr); + } + return result; +} + +template +void wp::clear() +{ + if (m_ptr) { + m_refs->decWeak(this); + m_ptr = 0; + } +} + +template +inline TextOutput& operator<<(TextOutput& to, const wp& val) +{ + return printWeakPointer(to, val.unsafe_get()); +} + +// --------------------------------------------------------------------------- + +// this class just serves as a namespace so TYPE::moveReferences can stay +// private. + +class ReferenceMover { + // StrongReferenceCast and WeakReferenceCast do the impedance matching + // between the generic (void*) implementation in Refbase and the strongly typed + // template specializations below. + + template + struct StrongReferenceCast : public ReferenceConverterBase { + virtual size_t getReferenceTypeSize() const { return sizeof( sp ); } + virtual void* getReferenceBase(void const* p) const { + sp const* sptr(reinterpret_cast const*>(p)); + return static_cast(sptr->get()); + } + }; + + template + struct WeakReferenceCast : public ReferenceConverterBase { + virtual size_t getReferenceTypeSize() const { return sizeof( wp ); } + virtual void* getReferenceBase(void const* p) const { + wp const* sptr(reinterpret_cast const*>(p)); + return static_cast(sptr->unsafe_get()); + } + }; + +public: + template static inline + void move_references(sp* d, sp const* s, size_t n) { + memmove(d, s, n*sizeof(sp)); + StrongReferenceCast caster; + TYPE::moveReferences(d, s, n, caster); + } + template static inline + void move_references(wp* d, wp const* s, size_t n) { + memmove(d, s, n*sizeof(wp)); + WeakReferenceCast caster; + TYPE::moveReferences(d, s, n, caster); + } +}; + +// specialization for moving sp<> and wp<> types. +// these are used by the [Sorted|Keyed]Vector<> implementations +// sp<> and wp<> need to be handled specially, because they do not +// have trivial copy operation in the general case (see RefBase.cpp +// when DEBUG ops are enabled), but can be implemented very +// efficiently in most cases. + +template inline +void move_forward_type(sp* d, sp const* s, size_t n) { + ReferenceMover::move_references(d, s, n); +} + +template inline +void move_backward_type(sp* d, sp const* s, size_t n) { + ReferenceMover::move_references(d, s, n); +} + +template inline +void move_forward_type(wp* d, wp const* s, size_t n) { + ReferenceMover::move_references(d, s, n); +} + +template inline +void move_backward_type(wp* d, wp const* s, size_t n) { + ReferenceMover::move_references(d, s, n); +} + + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_REF_BASE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/RWLock.h android-platform-frameworks-native-21/include/utils/RWLock.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/RWLock.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/RWLock.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,126 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_RWLOCK_H +#define _LIBS_UTILS_RWLOCK_H + +#include +#include + +#if defined(HAVE_PTHREADS) +# include +#endif + +#include +#include + +// --------------------------------------------------------------------------- +namespace android { +// --------------------------------------------------------------------------- + +#if defined(HAVE_PTHREADS) + +/* + * Simple mutex class. The implementation is system-dependent. + * + * The mutex must be unlocked by the thread that locked it. They are not + * recursive, i.e. the same thread can't lock it multiple times. + */ +class RWLock { +public: + enum { + PRIVATE = 0, + SHARED = 1 + }; + + RWLock(); + RWLock(const char* name); + RWLock(int type, const char* name = NULL); + ~RWLock(); + + status_t readLock(); + status_t tryReadLock(); + status_t writeLock(); + status_t tryWriteLock(); + void unlock(); + + class AutoRLock { + public: + inline AutoRLock(RWLock& rwlock) : mLock(rwlock) { mLock.readLock(); } + inline ~AutoRLock() { mLock.unlock(); } + private: + RWLock& mLock; + }; + + class AutoWLock { + public: + inline AutoWLock(RWLock& rwlock) : mLock(rwlock) { mLock.writeLock(); } + inline ~AutoWLock() { mLock.unlock(); } + private: + RWLock& mLock; + }; + +private: + // A RWLock cannot be copied + RWLock(const RWLock&); + RWLock& operator = (const RWLock&); + + pthread_rwlock_t mRWLock; +}; + +inline RWLock::RWLock() { + pthread_rwlock_init(&mRWLock, NULL); +} +inline RWLock::RWLock(const char* name) { + pthread_rwlock_init(&mRWLock, NULL); +} +inline RWLock::RWLock(int type, const char* name) { + if (type == SHARED) { + pthread_rwlockattr_t attr; + pthread_rwlockattr_init(&attr); + pthread_rwlockattr_setpshared(&attr, PTHREAD_PROCESS_SHARED); + pthread_rwlock_init(&mRWLock, &attr); + pthread_rwlockattr_destroy(&attr); + } else { + pthread_rwlock_init(&mRWLock, NULL); + } +} +inline RWLock::~RWLock() { + pthread_rwlock_destroy(&mRWLock); +} +inline status_t RWLock::readLock() { + return -pthread_rwlock_rdlock(&mRWLock); +} +inline status_t RWLock::tryReadLock() { + return -pthread_rwlock_tryrdlock(&mRWLock); +} +inline status_t RWLock::writeLock() { + return -pthread_rwlock_wrlock(&mRWLock); +} +inline status_t RWLock::tryWriteLock() { + return -pthread_rwlock_trywrlock(&mRWLock); +} +inline void RWLock::unlock() { + pthread_rwlock_unlock(&mRWLock); +} + +#endif // HAVE_PTHREADS + +// --------------------------------------------------------------------------- +}; // namespace android +// --------------------------------------------------------------------------- + +#endif // _LIBS_UTILS_RWLOCK_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/SharedBuffer.h android-platform-frameworks-native-21/include/utils/SharedBuffer.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/SharedBuffer.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/SharedBuffer.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,146 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_SHARED_BUFFER_H +#define ANDROID_SHARED_BUFFER_H + +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +class SharedBuffer +{ +public: + + /* flags to use with release() */ + enum { + eKeepStorage = 0x00000001 + }; + + /*! allocate a buffer of size 'size' and acquire() it. + * call release() to free it. + */ + static SharedBuffer* alloc(size_t size); + + /*! free the memory associated with the SharedBuffer. + * Fails if there are any users associated with this SharedBuffer. + * In other words, the buffer must have been release by all its + * users. + */ + static ssize_t dealloc(const SharedBuffer* released); + + //! get the SharedBuffer from the data pointer + static inline const SharedBuffer* sharedBuffer(const void* data); + + //! access the data for read + inline const void* data() const; + + //! access the data for read/write + inline void* data(); + + //! get size of the buffer + inline size_t size() const; + + //! get back a SharedBuffer object from its data + static inline SharedBuffer* bufferFromData(void* data); + + //! get back a SharedBuffer object from its data + static inline const SharedBuffer* bufferFromData(const void* data); + + //! get the size of a SharedBuffer object from its data + static inline size_t sizeFromData(const void* data); + + //! edit the buffer (get a writtable, or non-const, version of it) + SharedBuffer* edit() const; + + //! edit the buffer, resizing if needed + SharedBuffer* editResize(size_t size) const; + + //! like edit() but fails if a copy is required + SharedBuffer* attemptEdit() const; + + //! resize and edit the buffer, loose it's content. + SharedBuffer* reset(size_t size) const; + + //! acquire/release a reference on this buffer + void acquire() const; + + /*! release a reference on this buffer, with the option of not + * freeing the memory associated with it if it was the last reference + * returns the previous reference count + */ + int32_t release(uint32_t flags = 0) const; + + //! returns wether or not we're the only owner + inline bool onlyOwner() const; + + +private: + inline SharedBuffer() { } + inline ~SharedBuffer() { } + inline SharedBuffer(const SharedBuffer&); + + // 16 bytes. must be sized to preserve correct alingment. + mutable int32_t mRefs; + size_t mSize; + uint32_t mReserved[2]; +}; + +// --------------------------------------------------------------------------- + +const SharedBuffer* SharedBuffer::sharedBuffer(const void* data) { + return data ? reinterpret_cast(data)-1 : 0; +} + +const void* SharedBuffer::data() const { + return this + 1; +} + +void* SharedBuffer::data() { + return this + 1; +} + +size_t SharedBuffer::size() const { + return mSize; +} + +SharedBuffer* SharedBuffer::bufferFromData(void* data) +{ + return ((SharedBuffer*)data)-1; +} + +const SharedBuffer* SharedBuffer::bufferFromData(const void* data) +{ + return ((const SharedBuffer*)data)-1; +} + +size_t SharedBuffer::sizeFromData(const void* data) +{ + return (((const SharedBuffer*)data)-1)->mSize; +} + +bool SharedBuffer::onlyOwner() const { + return (mRefs == 1); +} + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_VECTOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Singleton.h android-platform-frameworks-native-21/include/utils/Singleton.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Singleton.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Singleton.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,77 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_UTILS_SINGLETON_H +#define ANDROID_UTILS_SINGLETON_H + +#include +#include +#include +#include + +namespace android { +// --------------------------------------------------------------------------- + +template +class ANDROID_API Singleton +{ +public: + static TYPE& getInstance() { + Mutex::Autolock _l(sLock); + TYPE* instance = sInstance; + if (instance == 0) { + instance = new TYPE(); + sInstance = instance; + } + return *instance; + } + + static bool hasInstance() { + Mutex::Autolock _l(sLock); + return sInstance != 0; + } + +protected: + ~Singleton() { }; + Singleton() { }; + +private: + Singleton(const Singleton&); + Singleton& operator = (const Singleton&); + static Mutex sLock; + static TYPE* sInstance; +}; + +/* + * use ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) in your implementation file + * (eg: .cpp) to create the static instance of Singleton<>'s attributes, + * and avoid to have a copy of them in each compilation units Singleton + * is used. + * NOTE: we use a version of Mutex ctor that takes a parameter, because + * for some unknown reason using the default ctor doesn't emit the variable! + */ + +#define ANDROID_SINGLETON_STATIC_INSTANCE(TYPE) \ + template<> Mutex Singleton< TYPE >::sLock(Mutex::PRIVATE); \ + template<> TYPE* Singleton< TYPE >::sInstance(0); \ + template class Singleton< TYPE >; + + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_UTILS_SINGLETON_H + diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/SortedVector.h android-platform-frameworks-native-21/include/utils/SortedVector.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/SortedVector.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/SortedVector.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,286 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_SORTED_VECTOR_H +#define ANDROID_SORTED_VECTOR_H + +#include +#include +#include + +#include +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +template +class SortedVector : private SortedVectorImpl +{ + friend class Vector; + +public: + typedef TYPE value_type; + + /*! + * Constructors and destructors + */ + + SortedVector(); + SortedVector(const SortedVector& rhs); + virtual ~SortedVector(); + + /*! copy operator */ + const SortedVector& operator = (const SortedVector& rhs) const; + SortedVector& operator = (const SortedVector& rhs); + + /* + * empty the vector + */ + + inline void clear() { VectorImpl::clear(); } + + /*! + * vector stats + */ + + //! returns number of items in the vector + inline size_t size() const { return VectorImpl::size(); } + //! returns wether or not the vector is empty + inline bool isEmpty() const { return VectorImpl::isEmpty(); } + //! returns how many items can be stored without reallocating the backing store + inline size_t capacity() const { return VectorImpl::capacity(); } + //! setst the capacity. capacity can never be reduced less than size() + inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); } + + /*! + * C-style array access + */ + + //! read-only C-style access + inline const TYPE* array() const; + + //! read-write C-style access. BE VERY CAREFUL when modifying the array + //! you ust keep it sorted! You usually don't use this function. + TYPE* editArray(); + + //! finds the index of an item + ssize_t indexOf(const TYPE& item) const; + + //! finds where this item should be inserted + size_t orderOf(const TYPE& item) const; + + + /*! + * accessors + */ + + //! read-only access to an item at a given index + inline const TYPE& operator [] (size_t index) const; + //! alternate name for operator [] + inline const TYPE& itemAt(size_t index) const; + //! stack-usage of the vector. returns the top of the stack (last element) + const TYPE& top() const; + //! same as operator [], but allows to access the vector backward (from the end) with a negative index + const TYPE& mirrorItemAt(ssize_t index) const; + + /*! + * modifing the array + */ + + //! add an item in the right place (and replace the one that is there) + ssize_t add(const TYPE& item); + + //! editItemAt() MUST NOT change the order of this item + TYPE& editItemAt(size_t index) { + return *( static_cast(VectorImpl::editItemLocation(index)) ); + } + + //! merges a vector into this one + ssize_t merge(const Vector& vector); + ssize_t merge(const SortedVector& vector); + + //! removes an item + ssize_t remove(const TYPE&); + + //! remove several items + inline ssize_t removeItemsAt(size_t index, size_t count = 1); + //! remove one item + inline ssize_t removeAt(size_t index) { return removeItemsAt(index); } + +protected: + virtual void do_construct(void* storage, size_t num) const; + virtual void do_destroy(void* storage, size_t num) const; + virtual void do_copy(void* dest, const void* from, size_t num) const; + virtual void do_splat(void* dest, const void* item, size_t num) const; + virtual void do_move_forward(void* dest, const void* from, size_t num) const; + virtual void do_move_backward(void* dest, const void* from, size_t num) const; + virtual int do_compare(const void* lhs, const void* rhs) const; +}; + +// SortedVector can be trivially moved using memcpy() because moving does not +// require any change to the underlying SharedBuffer contents or reference count. +template struct trait_trivial_move > { enum { value = true }; }; + +// --------------------------------------------------------------------------- +// No user serviceable parts from here... +// --------------------------------------------------------------------------- + +template inline +SortedVector::SortedVector() + : SortedVectorImpl(sizeof(TYPE), + ((traits::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0) + |(traits::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0) + |(traits::has_trivial_copy ? HAS_TRIVIAL_COPY : 0)) + ) +{ +} + +template inline +SortedVector::SortedVector(const SortedVector& rhs) + : SortedVectorImpl(rhs) { +} + +template inline +SortedVector::~SortedVector() { + finish_vector(); +} + +template inline +SortedVector& SortedVector::operator = (const SortedVector& rhs) { + SortedVectorImpl::operator = (rhs); + return *this; +} + +template inline +const SortedVector& SortedVector::operator = (const SortedVector& rhs) const { + SortedVectorImpl::operator = (rhs); + return *this; +} + +template inline +const TYPE* SortedVector::array() const { + return static_cast(arrayImpl()); +} + +template inline +TYPE* SortedVector::editArray() { + return static_cast(editArrayImpl()); +} + + +template inline +const TYPE& SortedVector::operator[](size_t index) const { + assert( index inline +const TYPE& SortedVector::itemAt(size_t index) const { + return operator[](index); +} + +template inline +const TYPE& SortedVector::mirrorItemAt(ssize_t index) const { + assert( (index>0 ? index : -index) inline +const TYPE& SortedVector::top() const { + return *(array() + size() - 1); +} + +template inline +ssize_t SortedVector::add(const TYPE& item) { + return SortedVectorImpl::add(&item); +} + +template inline +ssize_t SortedVector::indexOf(const TYPE& item) const { + return SortedVectorImpl::indexOf(&item); +} + +template inline +size_t SortedVector::orderOf(const TYPE& item) const { + return SortedVectorImpl::orderOf(&item); +} + +template inline +ssize_t SortedVector::merge(const Vector& vector) { + return SortedVectorImpl::merge(reinterpret_cast(vector)); +} + +template inline +ssize_t SortedVector::merge(const SortedVector& vector) { + return SortedVectorImpl::merge(reinterpret_cast(vector)); +} + +template inline +ssize_t SortedVector::remove(const TYPE& item) { + return SortedVectorImpl::remove(&item); +} + +template inline +ssize_t SortedVector::removeItemsAt(size_t index, size_t count) { + return VectorImpl::removeItemsAt(index, count); +} + +// --------------------------------------------------------------------------- + +template +void SortedVector::do_construct(void* storage, size_t num) const { + construct_type( reinterpret_cast(storage), num ); +} + +template +void SortedVector::do_destroy(void* storage, size_t num) const { + destroy_type( reinterpret_cast(storage), num ); +} + +template +void SortedVector::do_copy(void* dest, const void* from, size_t num) const { + copy_type( reinterpret_cast(dest), reinterpret_cast(from), num ); +} + +template +void SortedVector::do_splat(void* dest, const void* item, size_t num) const { + splat_type( reinterpret_cast(dest), reinterpret_cast(item), num ); +} + +template +void SortedVector::do_move_forward(void* dest, const void* from, size_t num) const { + move_forward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); +} + +template +void SortedVector::do_move_backward(void* dest, const void* from, size_t num) const { + move_backward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); +} + +template +int SortedVector::do_compare(const void* lhs, const void* rhs) const { + return compare_type( *reinterpret_cast(lhs), *reinterpret_cast(rhs) ); +} + +}; // namespace android + + +// --------------------------------------------------------------------------- + +#endif // ANDROID_SORTED_VECTOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/StopWatch.h android-platform-frameworks-native-21/include/utils/StopWatch.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/StopWatch.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/StopWatch.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_STOPWATCH_H +#define ANDROID_STOPWATCH_H + +#include +#include + +#include + +// --------------------------------------------------------------------------- + +namespace android { + +class StopWatch +{ +public: + StopWatch( const char *name, + int clock = SYSTEM_TIME_MONOTONIC, + uint32_t flags = 0); + ~StopWatch(); + + const char* name() const; + nsecs_t lap(); + nsecs_t elapsedTime() const; + + void reset(); + +private: + const char* mName; + int mClock; + uint32_t mFlags; + + struct lap_t { + nsecs_t soFar; + nsecs_t thisLap; + }; + + nsecs_t mStartTime; + lap_t mLaps[8]; + int mNumLaps; +}; + + +}; // namespace android + + +// --------------------------------------------------------------------------- + +#endif // ANDROID_STOPWATCH_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/String16.h android-platform-frameworks-native-21/include/utils/String16.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/String16.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/String16.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_STRING16_H +#define ANDROID_STRING16_H + +#include +#include +#include +#include + +// --------------------------------------------------------------------------- + +extern "C" { + +} + +// --------------------------------------------------------------------------- + +namespace android { + +// --------------------------------------------------------------------------- + +class String8; +class TextOutput; + +//! This is a string holding UTF-16 characters. +class String16 +{ +public: + String16(); + String16(const String16& o); + String16(const String16& o, + size_t len, + size_t begin=0); + explicit String16(const char16_t* o); + explicit String16(const char16_t* o, size_t len); + explicit String16(const String8& o); + explicit String16(const char* o); + explicit String16(const char* o, size_t len); + + ~String16(); + + inline const char16_t* string() const; + inline size_t size() const; + + inline const SharedBuffer* sharedBuffer() const; + + void setTo(const String16& other); + status_t setTo(const char16_t* other); + status_t setTo(const char16_t* other, size_t len); + status_t setTo(const String16& other, + size_t len, + size_t begin=0); + + status_t append(const String16& other); + status_t append(const char16_t* other, size_t len); + + inline String16& operator=(const String16& other); + + inline String16& operator+=(const String16& other); + inline String16 operator+(const String16& other) const; + + status_t insert(size_t pos, const char16_t* chrs); + status_t insert(size_t pos, + const char16_t* chrs, size_t len); + + ssize_t findFirst(char16_t c) const; + ssize_t findLast(char16_t c) const; + + bool startsWith(const String16& prefix) const; + bool startsWith(const char16_t* prefix) const; + + status_t makeLower(); + + status_t replaceAll(char16_t replaceThis, + char16_t withThis); + + status_t remove(size_t len, size_t begin=0); + + inline int compare(const String16& other) const; + + inline bool operator<(const String16& other) const; + inline bool operator<=(const String16& other) const; + inline bool operator==(const String16& other) const; + inline bool operator!=(const String16& other) const; + inline bool operator>=(const String16& other) const; + inline bool operator>(const String16& other) const; + + inline bool operator<(const char16_t* other) const; + inline bool operator<=(const char16_t* other) const; + inline bool operator==(const char16_t* other) const; + inline bool operator!=(const char16_t* other) const; + inline bool operator>=(const char16_t* other) const; + inline bool operator>(const char16_t* other) const; + + inline operator const char16_t*() const; + +private: + const char16_t* mString; +}; + +// String16 can be trivially moved using memcpy() because moving does not +// require any change to the underlying SharedBuffer contents or reference count. +ANDROID_TRIVIAL_MOVE_TRAIT(String16) + +TextOutput& operator<<(TextOutput& to, const String16& val); + +// --------------------------------------------------------------------------- +// No user servicable parts below. + +inline int compare_type(const String16& lhs, const String16& rhs) +{ + return lhs.compare(rhs); +} + +inline int strictly_order_type(const String16& lhs, const String16& rhs) +{ + return compare_type(lhs, rhs) < 0; +} + +inline const char16_t* String16::string() const +{ + return mString; +} + +inline size_t String16::size() const +{ + return SharedBuffer::sizeFromData(mString)/sizeof(char16_t)-1; +} + +inline const SharedBuffer* String16::sharedBuffer() const +{ + return SharedBuffer::bufferFromData(mString); +} + +inline String16& String16::operator=(const String16& other) +{ + setTo(other); + return *this; +} + +inline String16& String16::operator+=(const String16& other) +{ + append(other); + return *this; +} + +inline String16 String16::operator+(const String16& other) const +{ + String16 tmp(*this); + tmp += other; + return tmp; +} + +inline int String16::compare(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()); +} + +inline bool String16::operator<(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()) < 0; +} + +inline bool String16::operator<=(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()) <= 0; +} + +inline bool String16::operator==(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()) == 0; +} + +inline bool String16::operator!=(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()) != 0; +} + +inline bool String16::operator>=(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()) >= 0; +} + +inline bool String16::operator>(const String16& other) const +{ + return strzcmp16(mString, size(), other.mString, other.size()) > 0; +} + +inline bool String16::operator<(const char16_t* other) const +{ + return strcmp16(mString, other) < 0; +} + +inline bool String16::operator<=(const char16_t* other) const +{ + return strcmp16(mString, other) <= 0; +} + +inline bool String16::operator==(const char16_t* other) const +{ + return strcmp16(mString, other) == 0; +} + +inline bool String16::operator!=(const char16_t* other) const +{ + return strcmp16(mString, other) != 0; +} + +inline bool String16::operator>=(const char16_t* other) const +{ + return strcmp16(mString, other) >= 0; +} + +inline bool String16::operator>(const char16_t* other) const +{ + return strcmp16(mString, other) > 0; +} + +inline String16::operator const char16_t*() const +{ + return mString; +} + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_STRING16_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/String8.h android-platform-frameworks-native-21/include/utils/String8.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/String8.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/String8.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,388 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_STRING8_H +#define ANDROID_STRING8_H + +#include +#include +#include +#include + +#include // for strcmp +#include + +// --------------------------------------------------------------------------- + +namespace android { + +class String16; +class TextOutput; + +//! This is a string holding UTF-8 characters. Does not allow the value more +// than 0x10FFFF, which is not valid unicode codepoint. +class String8 +{ +public: + String8(); + String8(const String8& o); + explicit String8(const char* o); + explicit String8(const char* o, size_t numChars); + + explicit String8(const String16& o); + explicit String8(const char16_t* o); + explicit String8(const char16_t* o, size_t numChars); + explicit String8(const char32_t* o); + explicit String8(const char32_t* o, size_t numChars); + ~String8(); + + static inline const String8 empty(); + + static String8 format(const char* fmt, ...) __attribute__((format (printf, 1, 2))); + static String8 formatV(const char* fmt, va_list args); + + inline const char* string() const; + inline size_t size() const; + inline size_t length() const; + inline size_t bytes() const; + inline bool isEmpty() const; + + inline const SharedBuffer* sharedBuffer() const; + + void clear(); + + void setTo(const String8& other); + status_t setTo(const char* other); + status_t setTo(const char* other, size_t numChars); + status_t setTo(const char16_t* other, size_t numChars); + status_t setTo(const char32_t* other, + size_t length); + + status_t append(const String8& other); + status_t append(const char* other); + status_t append(const char* other, size_t numChars); + + status_t appendFormat(const char* fmt, ...) + __attribute__((format (printf, 2, 3))); + status_t appendFormatV(const char* fmt, va_list args); + + // Note that this function takes O(N) time to calculate the value. + // No cache value is stored. + size_t getUtf32Length() const; + int32_t getUtf32At(size_t index, + size_t *next_index) const; + void getUtf32(char32_t* dst) const; + + inline String8& operator=(const String8& other); + inline String8& operator=(const char* other); + + inline String8& operator+=(const String8& other); + inline String8 operator+(const String8& other) const; + + inline String8& operator+=(const char* other); + inline String8 operator+(const char* other) const; + + inline int compare(const String8& other) const; + + inline bool operator<(const String8& other) const; + inline bool operator<=(const String8& other) const; + inline bool operator==(const String8& other) const; + inline bool operator!=(const String8& other) const; + inline bool operator>=(const String8& other) const; + inline bool operator>(const String8& other) const; + + inline bool operator<(const char* other) const; + inline bool operator<=(const char* other) const; + inline bool operator==(const char* other) const; + inline bool operator!=(const char* other) const; + inline bool operator>=(const char* other) const; + inline bool operator>(const char* other) const; + + inline operator const char*() const; + + char* lockBuffer(size_t size); + void unlockBuffer(); + status_t unlockBuffer(size_t size); + + // return the index of the first byte of other in this at or after + // start, or -1 if not found + ssize_t find(const char* other, size_t start = 0) const; + + void toLower(); + void toLower(size_t start, size_t numChars); + void toUpper(); + void toUpper(size_t start, size_t numChars); + + /* + * These methods operate on the string as if it were a path name. + */ + + /* + * Set the filename field to a specific value. + * + * Normalizes the filename, removing a trailing '/' if present. + */ + void setPathName(const char* name); + void setPathName(const char* name, size_t numChars); + + /* + * Get just the filename component. + * + * "/tmp/foo/bar.c" --> "bar.c" + */ + String8 getPathLeaf(void) const; + + /* + * Remove the last (file name) component, leaving just the directory + * name. + * + * "/tmp/foo/bar.c" --> "/tmp/foo" + * "/tmp" --> "" // ????? shouldn't this be "/" ???? XXX + * "bar.c" --> "" + */ + String8 getPathDir(void) const; + + /* + * Retrieve the front (root dir) component. Optionally also return the + * remaining components. + * + * "/tmp/foo/bar.c" --> "tmp" (remain = "foo/bar.c") + * "/tmp" --> "tmp" (remain = "") + * "bar.c" --> "bar.c" (remain = "") + */ + String8 walkPath(String8* outRemains = NULL) const; + + /* + * Return the filename extension. This is the last '.' and any number + * of characters that follow it. The '.' is included in case we + * decide to expand our definition of what constitutes an extension. + * + * "/tmp/foo/bar.c" --> ".c" + * "/tmp" --> "" + * "/tmp/foo.bar/baz" --> "" + * "foo.jpeg" --> ".jpeg" + * "foo." --> "" + */ + String8 getPathExtension(void) const; + + /* + * Return the path without the extension. Rules for what constitutes + * an extension are described in the comment for getPathExtension(). + * + * "/tmp/foo/bar.c" --> "/tmp/foo/bar" + */ + String8 getBasePath(void) const; + + /* + * Add a component to the pathname. We guarantee that there is + * exactly one path separator between the old path and the new. + * If there is no existing name, we just copy the new name in. + * + * If leaf is a fully qualified path (i.e. starts with '/', it + * replaces whatever was there before. + */ + String8& appendPath(const char* leaf); + String8& appendPath(const String8& leaf) { return appendPath(leaf.string()); } + + /* + * Like appendPath(), but does not affect this string. Returns a new one instead. + */ + String8 appendPathCopy(const char* leaf) const + { String8 p(*this); p.appendPath(leaf); return p; } + String8 appendPathCopy(const String8& leaf) const { return appendPathCopy(leaf.string()); } + + /* + * Converts all separators in this string to /, the default path separator. + * + * If the default OS separator is backslash, this converts all + * backslashes to slashes, in-place. Otherwise it does nothing. + * Returns self. + */ + String8& convertToResPath(); + +private: + status_t real_append(const char* other, size_t numChars); + char* find_extension(void) const; + + const char* mString; +}; + +// String8 can be trivially moved using memcpy() because moving does not +// require any change to the underlying SharedBuffer contents or reference count. +ANDROID_TRIVIAL_MOVE_TRAIT(String8) + +TextOutput& operator<<(TextOutput& to, const String16& val); + +// --------------------------------------------------------------------------- +// No user servicable parts below. + +inline int compare_type(const String8& lhs, const String8& rhs) +{ + return lhs.compare(rhs); +} + +inline int strictly_order_type(const String8& lhs, const String8& rhs) +{ + return compare_type(lhs, rhs) < 0; +} + +inline const String8 String8::empty() { + return String8(); +} + +inline const char* String8::string() const +{ + return mString; +} + +inline size_t String8::length() const +{ + return SharedBuffer::sizeFromData(mString)-1; +} + +inline size_t String8::size() const +{ + return length(); +} + +inline bool String8::isEmpty() const +{ + return length() == 0; +} + +inline size_t String8::bytes() const +{ + return SharedBuffer::sizeFromData(mString)-1; +} + +inline const SharedBuffer* String8::sharedBuffer() const +{ + return SharedBuffer::bufferFromData(mString); +} + +inline String8& String8::operator=(const String8& other) +{ + setTo(other); + return *this; +} + +inline String8& String8::operator=(const char* other) +{ + setTo(other); + return *this; +} + +inline String8& String8::operator+=(const String8& other) +{ + append(other); + return *this; +} + +inline String8 String8::operator+(const String8& other) const +{ + String8 tmp(*this); + tmp += other; + return tmp; +} + +inline String8& String8::operator+=(const char* other) +{ + append(other); + return *this; +} + +inline String8 String8::operator+(const char* other) const +{ + String8 tmp(*this); + tmp += other; + return tmp; +} + +inline int String8::compare(const String8& other) const +{ + return strcmp(mString, other.mString); +} + +inline bool String8::operator<(const String8& other) const +{ + return strcmp(mString, other.mString) < 0; +} + +inline bool String8::operator<=(const String8& other) const +{ + return strcmp(mString, other.mString) <= 0; +} + +inline bool String8::operator==(const String8& other) const +{ + return strcmp(mString, other.mString) == 0; +} + +inline bool String8::operator!=(const String8& other) const +{ + return strcmp(mString, other.mString) != 0; +} + +inline bool String8::operator>=(const String8& other) const +{ + return strcmp(mString, other.mString) >= 0; +} + +inline bool String8::operator>(const String8& other) const +{ + return strcmp(mString, other.mString) > 0; +} + +inline bool String8::operator<(const char* other) const +{ + return strcmp(mString, other) < 0; +} + +inline bool String8::operator<=(const char* other) const +{ + return strcmp(mString, other) <= 0; +} + +inline bool String8::operator==(const char* other) const +{ + return strcmp(mString, other) == 0; +} + +inline bool String8::operator!=(const char* other) const +{ + return strcmp(mString, other) != 0; +} + +inline bool String8::operator>=(const char* other) const +{ + return strcmp(mString, other) >= 0; +} + +inline bool String8::operator>(const char* other) const +{ + return strcmp(mString, other) > 0; +} + +inline String8::operator const char*() const +{ + return mString; +} + +} // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_STRING8_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/StringArray.h android-platform-frameworks-native-21/include/utils/StringArray.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/StringArray.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/StringArray.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,83 @@ +/* + * Copyright (C) 2009 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. + */ + +// +// Sortable array of strings. STL-ish, but STL-free. +// +#ifndef _LIBS_UTILS_STRING_ARRAY_H +#define _LIBS_UTILS_STRING_ARRAY_H + +#include +#include + +namespace android { + +// +// An expanding array of strings. Add, get, sort, delete. +// +class StringArray { +public: + StringArray(); + virtual ~StringArray(); + + // + // Add a string. A copy of the string is made. + // + bool push_back(const char* str); + + // + // Delete an entry. + // + void erase(int idx); + + // + // Sort the array. + // + void sort(int (*compare)(const void*, const void*)); + + // + // Pass this to the sort routine to do an ascending alphabetical sort. + // + static int cmpAscendingAlpha(const void* pstr1, const void* pstr2); + + // + // Get the #of items in the array. + // + inline int size(void) const { return mCurrent; } + + // + // Return entry N. + // [should use operator[] here] + // + const char* getEntry(int idx) const { + return (unsigned(idx) >= unsigned(mCurrent)) ? NULL : mArray[idx]; + } + + // + // Set entry N to specified string. + // [should use operator[] here] + // + void setEntry(int idx, const char* str); + +private: + int mMax; + int mCurrent; + char** mArray; +}; + +}; // namespace android + +#endif // _LIBS_UTILS_STRING_ARRAY_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/StrongPointer.h android-platform-frameworks-native-21/include/utils/StrongPointer.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/StrongPointer.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/StrongPointer.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,220 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_STRONG_POINTER_H +#define ANDROID_STRONG_POINTER_H + +#include + +#include +#include +#include + +// --------------------------------------------------------------------------- +namespace android { + +class TextOutput; +TextOutput& printStrongPointer(TextOutput& to, const void* val); + +template class wp; + +// --------------------------------------------------------------------------- + +#define COMPARE(_op_) \ +inline bool operator _op_ (const sp& o) const { \ + return m_ptr _op_ o.m_ptr; \ +} \ +inline bool operator _op_ (const T* o) const { \ + return m_ptr _op_ o; \ +} \ +template \ +inline bool operator _op_ (const sp& o) const { \ + return m_ptr _op_ o.m_ptr; \ +} \ +template \ +inline bool operator _op_ (const U* o) const { \ + return m_ptr _op_ o; \ +} \ +inline bool operator _op_ (const wp& o) const { \ + return m_ptr _op_ o.m_ptr; \ +} \ +template \ +inline bool operator _op_ (const wp& o) const { \ + return m_ptr _op_ o.m_ptr; \ +} + +// --------------------------------------------------------------------------- + +template +class sp +{ +public: + inline sp() : m_ptr(0) { } + + sp(T* other); + sp(const sp& other); + template sp(U* other); + template sp(const sp& other); + + ~sp(); + + // Assignment + + sp& operator = (T* other); + sp& operator = (const sp& other); + + template sp& operator = (const sp& other); + template sp& operator = (U* other); + + //! Special optimization for use by ProcessState (and nobody else). + void force_set(T* other); + + // Reset + + void clear(); + + // Accessors + + inline T& operator* () const { return *m_ptr; } + inline T* operator-> () const { return m_ptr; } + inline T* get() const { return m_ptr; } + + // Operators + + COMPARE(==) + COMPARE(!=) + COMPARE(>) + COMPARE(<) + COMPARE(<=) + COMPARE(>=) + +private: + template friend class sp; + template friend class wp; + void set_pointer(T* ptr); + T* m_ptr; +}; + +#undef COMPARE + +template +TextOutput& operator<<(TextOutput& to, const sp& val); + +// --------------------------------------------------------------------------- +// No user serviceable parts below here. + +template +sp::sp(T* other) +: m_ptr(other) + { + if (other) other->incStrong(this); + } + +template +sp::sp(const sp& other) +: m_ptr(other.m_ptr) + { + if (m_ptr) m_ptr->incStrong(this); + } + +template template +sp::sp(U* other) : m_ptr(other) +{ + if (other) ((T*)other)->incStrong(this); +} + +template template +sp::sp(const sp& other) +: m_ptr(other.m_ptr) + { + if (m_ptr) m_ptr->incStrong(this); + } + +template +sp::~sp() +{ + if (m_ptr) m_ptr->decStrong(this); +} + +template +sp& sp::operator = (const sp& other) { + T* otherPtr(other.m_ptr); + if (otherPtr) otherPtr->incStrong(this); + if (m_ptr) m_ptr->decStrong(this); + m_ptr = otherPtr; + return *this; +} + +template +sp& sp::operator = (T* other) +{ + if (other) other->incStrong(this); + if (m_ptr) m_ptr->decStrong(this); + m_ptr = other; + return *this; +} + +template template +sp& sp::operator = (const sp& other) +{ + T* otherPtr(other.m_ptr); + if (otherPtr) otherPtr->incStrong(this); + if (m_ptr) m_ptr->decStrong(this); + m_ptr = otherPtr; + return *this; +} + +template template +sp& sp::operator = (U* other) +{ + if (other) ((T*)other)->incStrong(this); + if (m_ptr) m_ptr->decStrong(this); + m_ptr = other; + return *this; +} + +template +void sp::force_set(T* other) +{ + other->forceIncStrong(this); + m_ptr = other; +} + +template +void sp::clear() +{ + if (m_ptr) { + m_ptr->decStrong(this); + m_ptr = 0; + } +} + +template +void sp::set_pointer(T* ptr) { + m_ptr = ptr; +} + +template +inline TextOutput& operator<<(TextOutput& to, const sp& val) +{ + return printStrongPointer(to, val.get()); +} + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_STRONG_POINTER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/SystemClock.h android-platform-frameworks-native-21/include/utils/SystemClock.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/SystemClock.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/SystemClock.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,32 @@ +/* + * Copyright (C) 2008 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. + */ + +#ifndef ANDROID_UTILS_SYSTEMCLOCK_H +#define ANDROID_UTILS_SYSTEMCLOCK_H + +#include +#include + +namespace android { + +int setCurrentTimeMillis(int64_t millis); +int64_t uptimeMillis(); +int64_t elapsedRealtime(); + +}; // namespace android + +#endif // ANDROID_UTILS_SYSTEMCLOCK_H + diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/TextOutput.h android-platform-frameworks-native-21/include/utils/TextOutput.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/TextOutput.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/TextOutput.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,190 @@ +/* + * Copyright (C) 2006 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. + */ + +#ifndef ANDROID_TEXTOUTPUT_H +#define ANDROID_TEXTOUTPUT_H + +#include + +#include +#include + +// --------------------------------------------------------------------------- +namespace android { + +class TextOutput +{ +public: + TextOutput(); + virtual ~TextOutput(); + + virtual status_t print(const char* txt, size_t len) = 0; + virtual void moveIndent(int delta) = 0; + + class Bundle { + public: + inline Bundle(TextOutput& to) : mTO(to) { to.pushBundle(); } + inline ~Bundle() { mTO.popBundle(); } + private: + TextOutput& mTO; + }; + + virtual void pushBundle() = 0; + virtual void popBundle() = 0; +}; + +// --------------------------------------------------------------------------- + +// Text output stream for printing to the log (via utils/Log.h). +extern TextOutput& alog; + +// Text output stream for printing to stdout. +extern TextOutput& aout; + +// Text output stream for printing to stderr. +extern TextOutput& aerr; + +typedef TextOutput& (*TextOutputManipFunc)(TextOutput&); + +TextOutput& endl(TextOutput& to); +TextOutput& indent(TextOutput& to); +TextOutput& dedent(TextOutput& to); + +TextOutput& operator<<(TextOutput& to, const char* str); +TextOutput& operator<<(TextOutput& to, char); // writes raw character +TextOutput& operator<<(TextOutput& to, bool); +TextOutput& operator<<(TextOutput& to, int); +TextOutput& operator<<(TextOutput& to, long); +TextOutput& operator<<(TextOutput& to, unsigned int); +TextOutput& operator<<(TextOutput& to, unsigned long); +TextOutput& operator<<(TextOutput& to, long long); +TextOutput& operator<<(TextOutput& to, unsigned long long); +TextOutput& operator<<(TextOutput& to, float); +TextOutput& operator<<(TextOutput& to, double); +TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func); +TextOutput& operator<<(TextOutput& to, const void*); + +class TypeCode +{ +public: + inline TypeCode(uint32_t code); + inline ~TypeCode(); + + inline uint32_t typeCode() const; + +private: + uint32_t mCode; +}; + +TextOutput& operator<<(TextOutput& to, const TypeCode& val); + +class HexDump +{ +public: + HexDump(const void *buf, size_t size, size_t bytesPerLine=16); + inline ~HexDump(); + + inline HexDump& setBytesPerLine(size_t bytesPerLine); + inline HexDump& setSingleLineCutoff(int32_t bytes); + inline HexDump& setAlignment(size_t alignment); + inline HexDump& setCArrayStyle(bool enabled); + + inline const void* buffer() const; + inline size_t size() const; + inline size_t bytesPerLine() const; + inline int32_t singleLineCutoff() const; + inline size_t alignment() const; + inline bool carrayStyle() const; + +private: + const void* mBuffer; + size_t mSize; + size_t mBytesPerLine; + int32_t mSingleLineCutoff; + size_t mAlignment; + bool mCArrayStyle; +}; + +TextOutput& operator<<(TextOutput& to, const HexDump& val); + +// --------------------------------------------------------------------------- +// No user servicable parts below. + +inline TextOutput& endl(TextOutput& to) +{ + to.print("\n", 1); + return to; +} + +inline TextOutput& indent(TextOutput& to) +{ + to.moveIndent(1); + return to; +} + +inline TextOutput& dedent(TextOutput& to) +{ + to.moveIndent(-1); + return to; +} + +inline TextOutput& operator<<(TextOutput& to, const char* str) +{ + to.print(str, strlen(str)); + return to; +} + +inline TextOutput& operator<<(TextOutput& to, char c) +{ + to.print(&c, 1); + return to; +} + +inline TextOutput& operator<<(TextOutput& to, TextOutputManipFunc func) +{ + return (*func)(to); +} + +inline TypeCode::TypeCode(uint32_t code) : mCode(code) { } +inline TypeCode::~TypeCode() { } +inline uint32_t TypeCode::typeCode() const { return mCode; } + +inline HexDump::~HexDump() { } + +inline HexDump& HexDump::setBytesPerLine(size_t bytesPerLine) { + mBytesPerLine = bytesPerLine; return *this; +} +inline HexDump& HexDump::setSingleLineCutoff(int32_t bytes) { + mSingleLineCutoff = bytes; return *this; +} +inline HexDump& HexDump::setAlignment(size_t alignment) { + mAlignment = alignment; return *this; +} +inline HexDump& HexDump::setCArrayStyle(bool enabled) { + mCArrayStyle = enabled; return *this; +} + +inline const void* HexDump::buffer() const { return mBuffer; } +inline size_t HexDump::size() const { return mSize; } +inline size_t HexDump::bytesPerLine() const { return mBytesPerLine; } +inline int32_t HexDump::singleLineCutoff() const { return mSingleLineCutoff; } +inline size_t HexDump::alignment() const { return mAlignment; } +inline bool HexDump::carrayStyle() const { return mCArrayStyle; } + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_TEXTOUTPUT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/ThreadDefs.h android-platform-frameworks-native-21/include/utils/ThreadDefs.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/ThreadDefs.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/ThreadDefs.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,116 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_THREAD_DEFS_H +#define _LIBS_UTILS_THREAD_DEFS_H + +#include +#include +#include + +// --------------------------------------------------------------------------- +// C API + +#ifdef __cplusplus +extern "C" { +#endif + +typedef void* android_thread_id_t; + +typedef int (*android_thread_func_t)(void*); + +enum { + /* + * *********************************************** + * ** Keep in sync with android.os.Process.java ** + * *********************************************** + * + * This maps directly to the "nice" priorities we use in Android. + * A thread priority should be chosen inverse-proportionally to + * the amount of work the thread is expected to do. The more work + * a thread will do, the less favorable priority it should get so that + * it doesn't starve the system. Threads not behaving properly might + * be "punished" by the kernel. + * Use the levels below when appropriate. Intermediate values are + * acceptable, preferably use the {MORE|LESS}_FAVORABLE constants below. + */ + ANDROID_PRIORITY_LOWEST = 19, + + /* use for background tasks */ + ANDROID_PRIORITY_BACKGROUND = 10, + + /* most threads run at normal priority */ + ANDROID_PRIORITY_NORMAL = 0, + + /* threads currently running a UI that the user is interacting with */ + ANDROID_PRIORITY_FOREGROUND = -2, + + /* the main UI thread has a slightly more favorable priority */ + ANDROID_PRIORITY_DISPLAY = -4, + + /* ui service treads might want to run at a urgent display (uncommon) */ + ANDROID_PRIORITY_URGENT_DISPLAY = HAL_PRIORITY_URGENT_DISPLAY, + + /* all normal audio threads */ + ANDROID_PRIORITY_AUDIO = -16, + + /* service audio threads (uncommon) */ + ANDROID_PRIORITY_URGENT_AUDIO = -19, + + /* should never be used in practice. regular process might not + * be allowed to use this level */ + ANDROID_PRIORITY_HIGHEST = -20, + + ANDROID_PRIORITY_DEFAULT = ANDROID_PRIORITY_NORMAL, + ANDROID_PRIORITY_MORE_FAVORABLE = -1, + ANDROID_PRIORITY_LESS_FAVORABLE = +1, +}; + +#ifdef __cplusplus +} // extern "C" +#endif + +// --------------------------------------------------------------------------- +// C++ API +#ifdef __cplusplus +namespace android { +// --------------------------------------------------------------------------- + +typedef android_thread_id_t thread_id_t; +typedef android_thread_func_t thread_func_t; + +enum { + PRIORITY_LOWEST = ANDROID_PRIORITY_LOWEST, + PRIORITY_BACKGROUND = ANDROID_PRIORITY_BACKGROUND, + PRIORITY_NORMAL = ANDROID_PRIORITY_NORMAL, + PRIORITY_FOREGROUND = ANDROID_PRIORITY_FOREGROUND, + PRIORITY_DISPLAY = ANDROID_PRIORITY_DISPLAY, + PRIORITY_URGENT_DISPLAY = ANDROID_PRIORITY_URGENT_DISPLAY, + PRIORITY_AUDIO = ANDROID_PRIORITY_AUDIO, + PRIORITY_URGENT_AUDIO = ANDROID_PRIORITY_URGENT_AUDIO, + PRIORITY_HIGHEST = ANDROID_PRIORITY_HIGHEST, + PRIORITY_DEFAULT = ANDROID_PRIORITY_DEFAULT, + PRIORITY_MORE_FAVORABLE = ANDROID_PRIORITY_MORE_FAVORABLE, + PRIORITY_LESS_FAVORABLE = ANDROID_PRIORITY_LESS_FAVORABLE, +}; + +// --------------------------------------------------------------------------- +}; // namespace android +#endif // __cplusplus +// --------------------------------------------------------------------------- + + +#endif // _LIBS_UTILS_THREAD_DEFS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Thread.h android-platform-frameworks-native-21/include/utils/Thread.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Thread.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Thread.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_THREAD_H +#define _LIBS_UTILS_THREAD_H + +#include +#include +#include + +#if defined(HAVE_PTHREADS) +# include +#endif + +#include +#include +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +namespace android { +// --------------------------------------------------------------------------- + +class Thread : virtual public RefBase +{ +public: + // Create a Thread object, but doesn't create or start the associated + // thread. See the run() method. + Thread(bool canCallJava = true); + virtual ~Thread(); + + // Start the thread in threadLoop() which needs to be implemented. + virtual status_t run( const char* name = 0, + int32_t priority = PRIORITY_DEFAULT, + size_t stack = 0); + + // Ask this object's thread to exit. This function is asynchronous, when the + // function returns the thread might still be running. Of course, this + // function can be called from a different thread. + virtual void requestExit(); + + // Good place to do one-time initializations + virtual status_t readyToRun(); + + // Call requestExit() and wait until this object's thread exits. + // BE VERY CAREFUL of deadlocks. In particular, it would be silly to call + // this function from this object's thread. Will return WOULD_BLOCK in + // that case. + status_t requestExitAndWait(); + + // Wait until this object's thread exits. Returns immediately if not yet running. + // Do not call from this object's thread; will return WOULD_BLOCK in that case. + status_t join(); + +#ifdef HAVE_ANDROID_OS + // Return the thread's kernel ID, same as the thread itself calling gettid() or + // androidGetTid(), or -1 if the thread is not running. + pid_t getTid() const; +#endif + +protected: + // exitPending() returns true if requestExit() has been called. + bool exitPending() const; + +private: + // Derived class must implement threadLoop(). The thread starts its life + // here. There are two ways of using the Thread object: + // 1) loop: if threadLoop() returns true, it will be called again if + // requestExit() wasn't called. + // 2) once: if threadLoop() returns false, the thread will exit upon return. + virtual bool threadLoop() = 0; + +private: + Thread& operator=(const Thread&); + static int _threadLoop(void* user); + const bool mCanCallJava; + // always hold mLock when reading or writing + thread_id_t mThread; + mutable Mutex mLock; + Condition mThreadExitedCondition; + status_t mStatus; + // note that all accesses of mExitPending and mRunning need to hold mLock + volatile bool mExitPending; + volatile bool mRunning; + sp mHoldSelf; +#ifdef HAVE_ANDROID_OS + // legacy for debugging, not used by getTid() as it is set by the child thread + // and so is not initialized until the child reaches that point + pid_t mTid; +#endif +}; + + +}; // namespace android + +// --------------------------------------------------------------------------- +#endif // _LIBS_UTILS_THREAD_H +// --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/threads.h android-platform-frameworks-native-21/include/utils/threads.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/threads.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/threads.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,38 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef _LIBS_UTILS_THREADS_H +#define _LIBS_UTILS_THREADS_H + +/* + * Please, DO NOT USE! + * + * This file is here only for legacy reasons. Instead, include directly + * the headers you need below. + * + */ + +#include + +#ifdef __cplusplus +#include +#include +#include +#include +#include +#endif + +#endif // _LIBS_UTILS_THREADS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Timers.h android-platform-frameworks-native-21/include/utils/Timers.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Timers.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Timers.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,144 @@ +/* + * Copyright (C) 2005 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. + */ + +// +// Timer functions. +// +#ifndef _LIBS_UTILS_TIMERS_H +#define _LIBS_UTILS_TIMERS_H + +#include +#include +#include + +// ------------------------------------------------------------------ +// C API + +#ifdef __cplusplus +extern "C" { +#endif + +typedef int64_t nsecs_t; // nano-seconds + +static inline nsecs_t seconds_to_nanoseconds(nsecs_t secs) +{ + return secs*1000000000; +} + +static inline nsecs_t milliseconds_to_nanoseconds(nsecs_t secs) +{ + return secs*1000000; +} + +static inline nsecs_t microseconds_to_nanoseconds(nsecs_t secs) +{ + return secs*1000; +} + +static inline nsecs_t nanoseconds_to_seconds(nsecs_t secs) +{ + return secs/1000000000; +} + +static inline nsecs_t nanoseconds_to_milliseconds(nsecs_t secs) +{ + return secs/1000000; +} + +static inline nsecs_t nanoseconds_to_microseconds(nsecs_t secs) +{ + return secs/1000; +} + +static inline nsecs_t s2ns(nsecs_t v) {return seconds_to_nanoseconds(v);} +static inline nsecs_t ms2ns(nsecs_t v) {return milliseconds_to_nanoseconds(v);} +static inline nsecs_t us2ns(nsecs_t v) {return microseconds_to_nanoseconds(v);} +static inline nsecs_t ns2s(nsecs_t v) {return nanoseconds_to_seconds(v);} +static inline nsecs_t ns2ms(nsecs_t v) {return nanoseconds_to_milliseconds(v);} +static inline nsecs_t ns2us(nsecs_t v) {return nanoseconds_to_microseconds(v);} + +static inline nsecs_t seconds(nsecs_t v) { return s2ns(v); } +static inline nsecs_t milliseconds(nsecs_t v) { return ms2ns(v); } +static inline nsecs_t microseconds(nsecs_t v) { return us2ns(v); } + +enum { + SYSTEM_TIME_REALTIME = 0, // system-wide realtime clock + SYSTEM_TIME_MONOTONIC = 1, // monotonic time since unspecified starting point + SYSTEM_TIME_PROCESS = 2, // high-resolution per-process clock + SYSTEM_TIME_THREAD = 3 // high-resolution per-thread clock +}; + +// return the system-time according to the specified clock +#ifdef __cplusplus +nsecs_t systemTime(int clock = SYSTEM_TIME_MONOTONIC); +#else +nsecs_t systemTime(int clock); +#endif // def __cplusplus + +/** + * Returns the number of milliseconds to wait between the reference time and the timeout time. + * If the timeout is in the past relative to the reference time, returns 0. + * If the timeout is more than INT_MAX milliseconds in the future relative to the reference time, + * such as when timeoutTime == LLONG_MAX, returns -1 to indicate an infinite timeout delay. + * Otherwise, returns the difference between the reference time and timeout time + * rounded up to the next millisecond. + */ +int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime); + +#ifdef __cplusplus +} // extern "C" +#endif + +// ------------------------------------------------------------------ +// C++ API + +#ifdef __cplusplus + +namespace android { +/* + * Time the duration of something. + * + * Includes some timeval manipulation functions. + */ +class DurationTimer { +public: + DurationTimer() {} + ~DurationTimer() {} + + // Start the timer. + void start(); + // Stop the timer. + void stop(); + // Get the duration in microseconds. + long long durationUsecs() const; + + // Subtract two timevals. Returns the difference (ptv1-ptv2) in + // microseconds. + static long long subtractTimevals(const struct timeval* ptv1, + const struct timeval* ptv2); + + // Add the specified amount of time to the timeval. + static void addToTimeval(struct timeval* ptv, long usec); + +private: + struct timeval mStartWhen; + struct timeval mStopWhen; +}; + +}; // android +#endif // def __cplusplus + +#endif // _LIBS_UTILS_TIMERS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Tokenizer.h android-platform-frameworks-native-21/include/utils/Tokenizer.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Tokenizer.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Tokenizer.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef _UTILS_TOKENIZER_H +#define _UTILS_TOKENIZER_H + +#include +#include +#include +#include + +namespace android { + +/** + * A simple tokenizer for loading and parsing ASCII text files line by line. + */ +class Tokenizer { + Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, + bool ownBuffer, size_t length); + +public: + ~Tokenizer(); + + /** + * Opens a file and maps it into memory. + * + * Returns NO_ERROR and a tokenizer for the file, if successful. + * Otherwise returns an error and sets outTokenizer to NULL. + */ + static status_t open(const String8& filename, Tokenizer** outTokenizer); + + /** + * Prepares to tokenize the contents of a string. + * + * Returns NO_ERROR and a tokenizer for the string, if successful. + * Otherwise returns an error and sets outTokenizer to NULL. + */ + static status_t fromContents(const String8& filename, + const char* contents, Tokenizer** outTokenizer); + + /** + * Returns true if at the end of the file. + */ + inline bool isEof() const { return mCurrent == getEnd(); } + + /** + * Returns true if at the end of the line or end of the file. + */ + inline bool isEol() const { return isEof() || *mCurrent == '\n'; } + + /** + * Gets the name of the file. + */ + inline String8 getFilename() const { return mFilename; } + + /** + * Gets a 1-based line number index for the current position. + */ + inline int32_t getLineNumber() const { return mLineNumber; } + + /** + * Formats a location string consisting of the filename and current line number. + * Returns a string like "MyFile.txt:33". + */ + String8 getLocation() const; + + /** + * Gets the character at the current position. + * Returns null at end of file. + */ + inline char peekChar() const { return isEof() ? '\0' : *mCurrent; } + + /** + * Gets the remainder of the current line as a string, excluding the newline character. + */ + String8 peekRemainderOfLine() const; + + /** + * Gets the character at the current position and advances past it. + * Returns null at end of file. + */ + inline char nextChar() { return isEof() ? '\0' : *(mCurrent++); } + + /** + * Gets the next token on this line stopping at the specified delimiters + * or the end of the line whichever comes first and advances past it. + * Also stops at embedded nulls. + * Returns the token or an empty string if the current character is a delimiter + * or is at the end of the line. + */ + String8 nextToken(const char* delimiters); + + /** + * Advances to the next line. + * Does nothing if already at the end of the file. + */ + void nextLine(); + + /** + * Skips over the specified delimiters in the line. + * Also skips embedded nulls. + */ + void skipDelimiters(const char* delimiters); + +private: + Tokenizer(const Tokenizer& other); // not copyable + + String8 mFilename; + FileMap* mFileMap; + char* mBuffer; + bool mOwnBuffer; + size_t mLength; + + const char* mCurrent; + int32_t mLineNumber; + + inline const char* getEnd() const { return mBuffer + mLength; } + +}; + +} // namespace android + +#endif // _UTILS_TOKENIZER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Trace.h android-platform-frameworks-native-21/include/utils/Trace.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Trace.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Trace.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,187 @@ +/* + * Copyright (C) 2012 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. + */ + +#ifndef ANDROID_TRACE_H +#define ANDROID_TRACE_H + +#include +#include +#include +#include +#include +#include +#include + +#include +#include + +// The ATRACE_TAG macro can be defined before including this header to trace +// using one of the tags defined below. It must be defined to one of the +// following ATRACE_TAG_* macros. The trace tag is used to filter tracing in +// userland to avoid some of the runtime cost of tracing when it is not desired. +// +// Defining ATRACE_TAG to be ATRACE_TAG_ALWAYS will result in the tracing always +// being enabled - this should ONLY be done for debug code, as userland tracing +// has a performance cost even when the trace is not being recorded. Defining +// ATRACE_TAG to be ATRACE_TAG_NEVER or leaving ATRACE_TAG undefined will result +// in the tracing always being disabled. +// +// These tags must be kept in sync with frameworks/base/core/java/android/os/Trace.java. +#define ATRACE_TAG_NEVER 0 // The "never" tag is never enabled. +#define ATRACE_TAG_ALWAYS (1<<0) // The "always" tag is always enabled. +#define ATRACE_TAG_GRAPHICS (1<<1) +#define ATRACE_TAG_INPUT (1<<2) +#define ATRACE_TAG_VIEW (1<<3) +#define ATRACE_TAG_WEBVIEW (1<<4) +#define ATRACE_TAG_WINDOW_MANAGER (1<<5) +#define ATRACE_TAG_ACTIVITY_MANAGER (1<<6) +#define ATRACE_TAG_SYNC_MANAGER (1<<7) +#define ATRACE_TAG_AUDIO (1<<8) +#define ATRACE_TAG_VIDEO (1<<9) +#define ATRACE_TAG_LAST ATRACE_TAG_VIDEO + +#define ATRACE_TAG_VALID_MASK ((ATRACE_TAG_LAST - 1) | ATRACE_TAG_LAST) + +#ifndef ATRACE_TAG +#define ATRACE_TAG ATRACE_TAG_NEVER +#elif ATRACE_TAG > ATRACE_TAG_LAST +#error ATRACE_TAG must be defined to be one of the tags defined in utils/Trace.h +#endif + +// ATRACE_CALL traces the beginning and end of the current function. To trace +// the correct start and end times this macro should be the first line of the +// function body. +#define ATRACE_CALL() android::ScopedTrace ___tracer(ATRACE_TAG, __FUNCTION__) + +// ATRACE_INT traces a named integer value. This can be used to track how the +// value changes over time in a trace. +#define ATRACE_INT(name, value) android::Tracer::traceCounter(ATRACE_TAG, name, value) + +// ATRACE_ENABLED returns true if the trace tag is enabled. It can be used as a +// guard condition around more expensive trace calculations. +#define ATRACE_ENABLED() android::Tracer::isTagEnabled(ATRACE_TAG) + +namespace android { + +class Tracer { + +public: + + static uint64_t getEnabledTags() { + initIfNeeded(); + return sEnabledTags; + } + + static inline bool isTagEnabled(uint64_t tag) { + initIfNeeded(); + return sEnabledTags & tag; + } + + static inline void traceCounter(uint64_t tag, const char* name, + int32_t value) { + if (CC_UNLIKELY(isTagEnabled(tag))) { + char buf[1024]; + snprintf(buf, 1024, "C|%d|%s|%d", getpid(), name, value); + write(sTraceFD, buf, strlen(buf)); + } + } + + static inline void traceBegin(uint64_t tag, const char* name) { + if (CC_UNLIKELY(isTagEnabled(tag))) { + char buf[1024]; + size_t len = snprintf(buf, 1024, "B|%d|%s", getpid(), name); + write(sTraceFD, buf, len); + } + } + + static inline void traceEnd(uint64_t tag) { + if (CC_UNLIKELY(isTagEnabled(tag))) { + char buf = 'E'; + write(sTraceFD, &buf, 1); + } + } + +private: + + static inline void initIfNeeded() { + if (!android_atomic_acquire_load(&sIsReady)) { + init(); + } + } + + static void changeCallback(); + + // init opens the trace marker file for writing and reads the + // atrace.tags.enableflags system property. It does this only the first + // time it is run, using sMutex for synchronization. + static void init(); + + // retrieve the current value of the system property. + static void loadSystemProperty(); + + // sIsReady is a boolean value indicating whether a call to init() has + // completed in this process. It is initialized to 0 and set to 1 when the + // first init() call completes. It is set to 1 even if a failure occurred + // in init (e.g. the trace marker file couldn't be opened). + // + // This should be checked by all tracing functions using an atomic acquire + // load operation before calling init(). This check avoids the need to lock + // a mutex each time a trace function gets called. + static volatile int32_t sIsReady; + + // sTraceFD is the file descriptor used to write to the kernel's trace + // buffer. It is initialized to -1 and set to an open file descriptor in + // init() while a lock on sMutex is held. + // + // This should only be used by a trace function after init() has + // successfully completed. + static int sTraceFD; + + // sEnabledTags is the set of tag bits for which tracing is currently + // enabled. It is initialized to 0 and set based on the + // atrace.tags.enableflags system property in init() while a lock on sMutex + // is held. + // + // This should only be used by a trace function after init() has + // successfully completed. + // + // This value is only ever non-zero when tracing is initialized and sTraceFD is not -1. + static uint64_t sEnabledTags; + + // sMutex is used to protect the execution of init(). + static Mutex sMutex; +}; + +class ScopedTrace { + +public: + inline ScopedTrace(uint64_t tag, const char* name) : + mTag(tag) { + Tracer::traceBegin(mTag, name); + } + + inline ~ScopedTrace() { + Tracer::traceEnd(mTag); + } + +private: + + uint64_t mTag; +}; + +}; // namespace android + +#endif // ANDROID_TRACE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/TypeHelpers.h android-platform-frameworks-native-21/include/utils/TypeHelpers.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/TypeHelpers.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/TypeHelpers.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,302 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_TYPE_HELPERS_H +#define ANDROID_TYPE_HELPERS_H + +#include +#include +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +/* + * Types traits + */ + +template struct trait_trivial_ctor { enum { value = false }; }; +template struct trait_trivial_dtor { enum { value = false }; }; +template struct trait_trivial_copy { enum { value = false }; }; +template struct trait_trivial_move { enum { value = false }; }; +template struct trait_pointer { enum { value = false }; }; +template struct trait_pointer { enum { value = true }; }; + +template +struct traits { + enum { + // whether this type is a pointer + is_pointer = trait_pointer::value, + // whether this type's constructor is a no-op + has_trivial_ctor = is_pointer || trait_trivial_ctor::value, + // whether this type's destructor is a no-op + has_trivial_dtor = is_pointer || trait_trivial_dtor::value, + // whether this type type can be copy-constructed with memcpy + has_trivial_copy = is_pointer || trait_trivial_copy::value, + // whether this type can be moved with memmove + has_trivial_move = is_pointer || trait_trivial_move::value + }; +}; + +template +struct aggregate_traits { + enum { + is_pointer = false, + has_trivial_ctor = + traits::has_trivial_ctor && traits::has_trivial_ctor, + has_trivial_dtor = + traits::has_trivial_dtor && traits::has_trivial_dtor, + has_trivial_copy = + traits::has_trivial_copy && traits::has_trivial_copy, + has_trivial_move = + traits::has_trivial_move && traits::has_trivial_move + }; +}; + +#define ANDROID_TRIVIAL_CTOR_TRAIT( T ) \ + template<> struct trait_trivial_ctor< T > { enum { value = true }; }; + +#define ANDROID_TRIVIAL_DTOR_TRAIT( T ) \ + template<> struct trait_trivial_dtor< T > { enum { value = true }; }; + +#define ANDROID_TRIVIAL_COPY_TRAIT( T ) \ + template<> struct trait_trivial_copy< T > { enum { value = true }; }; + +#define ANDROID_TRIVIAL_MOVE_TRAIT( T ) \ + template<> struct trait_trivial_move< T > { enum { value = true }; }; + +#define ANDROID_BASIC_TYPES_TRAITS( T ) \ + ANDROID_TRIVIAL_CTOR_TRAIT( T ) \ + ANDROID_TRIVIAL_DTOR_TRAIT( T ) \ + ANDROID_TRIVIAL_COPY_TRAIT( T ) \ + ANDROID_TRIVIAL_MOVE_TRAIT( T ) + +// --------------------------------------------------------------------------- + +/* + * basic types traits + */ + +ANDROID_BASIC_TYPES_TRAITS( void ) +ANDROID_BASIC_TYPES_TRAITS( bool ) +ANDROID_BASIC_TYPES_TRAITS( char ) +ANDROID_BASIC_TYPES_TRAITS( unsigned char ) +ANDROID_BASIC_TYPES_TRAITS( short ) +ANDROID_BASIC_TYPES_TRAITS( unsigned short ) +ANDROID_BASIC_TYPES_TRAITS( int ) +ANDROID_BASIC_TYPES_TRAITS( unsigned int ) +ANDROID_BASIC_TYPES_TRAITS( long ) +ANDROID_BASIC_TYPES_TRAITS( unsigned long ) +ANDROID_BASIC_TYPES_TRAITS( long long ) +ANDROID_BASIC_TYPES_TRAITS( unsigned long long ) +ANDROID_BASIC_TYPES_TRAITS( float ) +ANDROID_BASIC_TYPES_TRAITS( double ) + +// --------------------------------------------------------------------------- + + +/* + * compare and order types + */ + +template inline +int strictly_order_type(const TYPE& lhs, const TYPE& rhs) { + return (lhs < rhs) ? 1 : 0; +} + +template inline +int compare_type(const TYPE& lhs, const TYPE& rhs) { + return strictly_order_type(rhs, lhs) - strictly_order_type(lhs, rhs); +} + +/* + * create, destroy, copy and move types... + */ + +template inline +void construct_type(TYPE* p, size_t n) { + if (!traits::has_trivial_ctor) { + while (n--) { + new(p++) TYPE; + } + } +} + +template inline +void destroy_type(TYPE* p, size_t n) { + if (!traits::has_trivial_dtor) { + while (n--) { + p->~TYPE(); + p++; + } + } +} + +template inline +void copy_type(TYPE* d, const TYPE* s, size_t n) { + if (!traits::has_trivial_copy) { + while (n--) { + new(d) TYPE(*s); + d++, s++; + } + } else { + memcpy(d,s,n*sizeof(TYPE)); + } +} + +template inline +void splat_type(TYPE* where, const TYPE* what, size_t n) { + if (!traits::has_trivial_copy) { + while (n--) { + new(where) TYPE(*what); + where++; + } + } else { + while (n--) { + *where++ = *what; + } + } +} + +template inline +void move_forward_type(TYPE* d, const TYPE* s, size_t n = 1) { + if ((traits::has_trivial_dtor && traits::has_trivial_copy) + || traits::has_trivial_move) + { + memmove(d,s,n*sizeof(TYPE)); + } else { + d += n; + s += n; + while (n--) { + --d, --s; + if (!traits::has_trivial_copy) { + new(d) TYPE(*s); + } else { + *d = *s; + } + if (!traits::has_trivial_dtor) { + s->~TYPE(); + } + } + } +} + +template inline +void move_backward_type(TYPE* d, const TYPE* s, size_t n = 1) { + if ((traits::has_trivial_dtor && traits::has_trivial_copy) + || traits::has_trivial_move) + { + memmove(d,s,n*sizeof(TYPE)); + } else { + while (n--) { + if (!traits::has_trivial_copy) { + new(d) TYPE(*s); + } else { + *d = *s; + } + if (!traits::has_trivial_dtor) { + s->~TYPE(); + } + d++, s++; + } + } +} + +// --------------------------------------------------------------------------- + +/* + * a key/value pair + */ + +template +struct key_value_pair_t { + typedef KEY key_t; + typedef VALUE value_t; + + KEY key; + VALUE value; + key_value_pair_t() { } + key_value_pair_t(const key_value_pair_t& o) : key(o.key), value(o.value) { } + key_value_pair_t(const KEY& k, const VALUE& v) : key(k), value(v) { } + key_value_pair_t(const KEY& k) : key(k) { } + inline bool operator < (const key_value_pair_t& o) const { + return strictly_order_type(key, o.key); + } + inline const KEY& getKey() const { + return key; + } + inline const VALUE& getValue() const { + return value; + } +}; + +template +struct trait_trivial_ctor< key_value_pair_t > +{ enum { value = aggregate_traits::has_trivial_ctor }; }; +template +struct trait_trivial_dtor< key_value_pair_t > +{ enum { value = aggregate_traits::has_trivial_dtor }; }; +template +struct trait_trivial_copy< key_value_pair_t > +{ enum { value = aggregate_traits::has_trivial_copy }; }; +template +struct trait_trivial_move< key_value_pair_t > +{ enum { value = aggregate_traits::has_trivial_move }; }; + +// --------------------------------------------------------------------------- + +/* + * Hash codes. + */ +typedef uint32_t hash_t; + +template +hash_t hash_type(const TKey& key); + +/* Built-in hash code specializations. + * Assumes pointers are 32bit. */ +#define ANDROID_INT32_HASH(T) \ + template <> inline hash_t hash_type(const T& value) { return hash_t(value); } +#define ANDROID_INT64_HASH(T) \ + template <> inline hash_t hash_type(const T& value) { \ + return hash_t((value >> 32) ^ value); } +#define ANDROID_REINTERPRET_HASH(T, R) \ + template <> inline hash_t hash_type(const T& value) { \ + return hash_type(*reinterpret_cast(&value)); } + +ANDROID_INT32_HASH(bool) +ANDROID_INT32_HASH(int8_t) +ANDROID_INT32_HASH(uint8_t) +ANDROID_INT32_HASH(int16_t) +ANDROID_INT32_HASH(uint16_t) +ANDROID_INT32_HASH(int32_t) +ANDROID_INT32_HASH(uint32_t) +ANDROID_INT64_HASH(int64_t) +ANDROID_INT64_HASH(uint64_t) +ANDROID_REINTERPRET_HASH(float, uint32_t) +ANDROID_REINTERPRET_HASH(double, uint64_t) + +template inline hash_t hash_type(const T*& value) { + return hash_type(uintptr_t(value)); +} + +}; // namespace android + +// --------------------------------------------------------------------------- + +#endif // ANDROID_TYPE_HELPERS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Unicode.h android-platform-frameworks-native-21/include/utils/Unicode.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Unicode.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Unicode.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,168 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_UNICODE_H +#define ANDROID_UNICODE_H + +#include +#include + +extern "C" { + +typedef uint32_t char32_t; +typedef uint16_t char16_t; + +// Standard string functions on char16_t strings. +int strcmp16(const char16_t *, const char16_t *); +int strncmp16(const char16_t *s1, const char16_t *s2, size_t n); +size_t strlen16(const char16_t *); +size_t strnlen16(const char16_t *, size_t); +char16_t *strcpy16(char16_t *, const char16_t *); +char16_t *strncpy16(char16_t *, const char16_t *, size_t); + +// Version of comparison that supports embedded nulls. +// This is different than strncmp() because we don't stop +// at a nul character and consider the strings to be different +// if the lengths are different (thus we need to supply the +// lengths of both strings). This can also be used when +// your string is not nul-terminated as it will have the +// equivalent result as strcmp16 (unlike strncmp16). +int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2); + +// Version of strzcmp16 for comparing strings in different endianness. +int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2); + +// Standard string functions on char32_t strings. +size_t strlen32(const char32_t *); +size_t strnlen32(const char32_t *, size_t); + +/** + * Measure the length of a UTF-32 string in UTF-8. If the string is invalid + * such as containing a surrogate character, -1 will be returned. + */ +ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len); + +/** + * Stores a UTF-8 string converted from "src" in "dst", if "dst_length" is not + * large enough to store the string, the part of the "src" string is stored + * into "dst" as much as possible. See the examples for more detail. + * Returns the size actually used for storing the string. + * dst" is not null-terminated when dst_len is fully used (like strncpy). + * + * Example 1 + * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84) + * "src_len" == 2 + * "dst_len" >= 7 + * -> + * Returned value == 6 + * "dst" becomes \xE3\x81\x82\xE3\x81\x84\0 + * (note that "dst" is null-terminated) + * + * Example 2 + * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84) + * "src_len" == 2 + * "dst_len" == 5 + * -> + * Returned value == 3 + * "dst" becomes \xE3\x81\x82\0 + * (note that "dst" is null-terminated, but \u3044 is not stored in "dst" + * since "dst" does not have enough size to store the character) + * + * Example 3 + * "src" == \u3042\u3044 (\xE3\x81\x82\xE3\x81\x84) + * "src_len" == 2 + * "dst_len" == 6 + * -> + * Returned value == 6 + * "dst" becomes \xE3\x81\x82\xE3\x81\x84 + * (note that "dst" is NOT null-terminated, like strncpy) + */ +void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst); + +/** + * Returns the unicode value at "index". + * Returns -1 when the index is invalid (equals to or more than "src_len"). + * If returned value is positive, it is able to be converted to char32_t, which + * is unsigned. Then, if "next_index" is not NULL, the next index to be used is + * stored in "next_index". "next_index" can be NULL. + */ +int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index); + + +/** + * Returns the UTF-8 length of UTF-16 string "src". + */ +ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len); + +/** + * Converts a UTF-16 string to UTF-8. The destination buffer must be large + * enough to fit the UTF-16 as measured by utf16_to_utf8_length with an added + * NULL terminator. + */ +void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst); + +/** + * Returns the length of "src" when "src" is valid UTF-8 string. + * Returns 0 if src is NULL or 0-length string. Returns -1 when the source + * is an invalid string. + * + * This function should be used to determine whether "src" is valid UTF-8 + * characters with valid unicode codepoints. "src" must be null-terminated. + * + * If you are going to use other utf8_to_... functions defined in this header + * with string which may not be valid UTF-8 with valid codepoint (form 0 to + * 0x10FFFF), you should use this function before calling others, since the + * other functions do not check whether the string is valid UTF-8 or not. + * + * If you do not care whether "src" is valid UTF-8 or not, you should use + * strlen() as usual, which should be much faster. + */ +ssize_t utf8_length(const char *src); + +/** + * Measure the length of a UTF-32 string. + */ +size_t utf8_to_utf32_length(const char *src, size_t src_len); + +/** + * Stores a UTF-32 string converted from "src" in "dst". "dst" must be large + * enough to store the entire converted string as measured by + * utf8_to_utf32_length plus space for a NULL terminator. + */ +void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst); + +/** + * Returns the UTF-16 length of UTF-8 string "src". + */ +ssize_t utf8_to_utf16_length(const uint8_t* src, size_t srcLen); + +/** + * Convert UTF-8 to UTF-16 including surrogate pairs. + * Returns a pointer to the end of the string (where a null terminator might go + * if you wanted to add one). + */ +char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* src, size_t srcLen, char16_t* dst); + +/** + * Convert UTF-8 to UTF-16 including surrogate pairs. The destination buffer + * must be large enough to hold the result as measured by utf8_to_utf16_length + * plus an added NULL terminator. + */ +void utf8_to_utf16(const uint8_t* src, size_t srcLen, char16_t* dst); + +} + +#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/UniquePtr.h android-platform-frameworks-native-21/include/utils/UniquePtr.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/UniquePtr.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/UniquePtr.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,239 @@ +/* + * Copyright (C) 2010 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. + */ + +/* === NOTE === NOTE === NOTE === NOTE === NOTE === NOTE === NOTE === NOTE === + * + * THIS IS A COPY OF libcore/include/UniquePtr.h AND AS SUCH THAT IS THE + * CANONICAL SOURCE OF THIS FILE. PLEASE KEEP THEM IN SYNC. + * + * === NOTE === NOTE === NOTE === NOTE === NOTE === NOTE === NOTE === NOTE === + */ + +#ifndef UNIQUE_PTR_H_included +#define UNIQUE_PTR_H_included + +#include // For NULL. + +// Default deleter for pointer types. +template +struct DefaultDelete { + enum { type_must_be_complete = sizeof(T) }; + DefaultDelete() {} + void operator()(T* p) const { + delete p; + } +}; + +// Default deleter for array types. +template +struct DefaultDelete { + enum { type_must_be_complete = sizeof(T) }; + void operator()(T* p) const { + delete[] p; + } +}; + +// A smart pointer that deletes the given pointer on destruction. +// Equivalent to C++0x's std::unique_ptr (a combination of boost::scoped_ptr +// and boost::scoped_array). +// Named to be in keeping with Android style but also to avoid +// collision with any other implementation, until we can switch over +// to unique_ptr. +// Use thus: +// UniquePtr c(new C); +template > +class UniquePtr { +public: + // Construct a new UniquePtr, taking ownership of the given raw pointer. + explicit UniquePtr(T* ptr = NULL) : mPtr(ptr) { + } + + ~UniquePtr() { + reset(); + } + + // Accessors. + T& operator*() const { return *mPtr; } + T* operator->() const { return mPtr; } + T* get() const { return mPtr; } + + // Returns the raw pointer and hands over ownership to the caller. + // The pointer will not be deleted by UniquePtr. + T* release() __attribute__((warn_unused_result)) { + T* result = mPtr; + mPtr = NULL; + return result; + } + + // Takes ownership of the given raw pointer. + // If this smart pointer previously owned a different raw pointer, that + // raw pointer will be freed. + void reset(T* ptr = NULL) { + if (ptr != mPtr) { + D()(mPtr); + mPtr = ptr; + } + } + +private: + // The raw pointer. + T* mPtr; + + // Comparing unique pointers is probably a mistake, since they're unique. + template bool operator==(const UniquePtr& p) const; + template bool operator!=(const UniquePtr& p) const; + + // Disallow copy and assignment. + UniquePtr(const UniquePtr&); + void operator=(const UniquePtr&); +}; + +// Partial specialization for array types. Like std::unique_ptr, this removes +// operator* and operator-> but adds operator[]. +template +class UniquePtr { +public: + explicit UniquePtr(T* ptr = NULL) : mPtr(ptr) { + } + + ~UniquePtr() { + reset(); + } + + T& operator[](size_t i) const { + return mPtr[i]; + } + T* get() const { return mPtr; } + + T* release() __attribute__((warn_unused_result)) { + T* result = mPtr; + mPtr = NULL; + return result; + } + + void reset(T* ptr = NULL) { + if (ptr != mPtr) { + D()(mPtr); + mPtr = ptr; + } + } + +private: + T* mPtr; + + // Disallow copy and assignment. + UniquePtr(const UniquePtr&); + void operator=(const UniquePtr&); +}; + +#if UNIQUE_PTR_TESTS + +// Run these tests with: +// g++ -g -DUNIQUE_PTR_TESTS -x c++ UniquePtr.h && ./a.out + +#include + +static void assert(bool b) { + if (!b) { + fprintf(stderr, "FAIL\n"); + abort(); + } + fprintf(stderr, "OK\n"); +} +static int cCount = 0; +struct C { + C() { ++cCount; } + ~C() { --cCount; } +}; +static bool freed = false; +struct Freer { + void operator()(int* p) { + assert(*p == 123); + free(p); + freed = true; + } +}; + +int main(int argc, char* argv[]) { + // + // UniquePtr tests... + // + + // Can we free a single object? + { + UniquePtr c(new C); + assert(cCount == 1); + } + assert(cCount == 0); + // Does release work? + C* rawC; + { + UniquePtr c(new C); + assert(cCount == 1); + rawC = c.release(); + } + assert(cCount == 1); + delete rawC; + // Does reset work? + { + UniquePtr c(new C); + assert(cCount == 1); + c.reset(new C); + assert(cCount == 1); + } + assert(cCount == 0); + + // + // UniquePtr tests... + // + + // Can we free an array? + { + UniquePtr cs(new C[4]); + assert(cCount == 4); + } + assert(cCount == 0); + // Does release work? + { + UniquePtr c(new C[4]); + assert(cCount == 4); + rawC = c.release(); + } + assert(cCount == 4); + delete[] rawC; + // Does reset work? + { + UniquePtr c(new C[4]); + assert(cCount == 4); + c.reset(new C[2]); + assert(cCount == 2); + } + assert(cCount == 0); + + // + // Custom deleter tests... + // + assert(!freed); + { + UniquePtr i(reinterpret_cast(malloc(sizeof(int)))); + *i = 123; + } + assert(freed); + return 0; +} +#endif + +#endif // UNIQUE_PTR_H_included diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/Vector.h android-platform-frameworks-native-21/include/utils/Vector.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/Vector.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/Vector.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,424 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_VECTOR_H +#define ANDROID_VECTOR_H + +#include +#include +#include + +#include +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +template +class SortedVector; + +/*! + * The main templated vector class ensuring type safety + * while making use of VectorImpl. + * This is the class users want to use. + */ + +template +class Vector : private VectorImpl +{ +public: + typedef TYPE value_type; + + /*! + * Constructors and destructors + */ + + Vector(); + Vector(const Vector& rhs); + explicit Vector(const SortedVector& rhs); + virtual ~Vector(); + + /*! copy operator */ + const Vector& operator = (const Vector& rhs) const; + Vector& operator = (const Vector& rhs); + + const Vector& operator = (const SortedVector& rhs) const; + Vector& operator = (const SortedVector& rhs); + + /* + * empty the vector + */ + + inline void clear() { VectorImpl::clear(); } + + /*! + * vector stats + */ + + //! returns number of items in the vector + inline size_t size() const { return VectorImpl::size(); } + //! returns wether or not the vector is empty + inline bool isEmpty() const { return VectorImpl::isEmpty(); } + //! returns how many items can be stored without reallocating the backing store + inline size_t capacity() const { return VectorImpl::capacity(); } + //! setst the capacity. capacity can never be reduced less than size() + inline ssize_t setCapacity(size_t size) { return VectorImpl::setCapacity(size); } + + /*! + * C-style array access + */ + + //! read-only C-style access + inline const TYPE* array() const; + //! read-write C-style access + TYPE* editArray(); + + /*! + * accessors + */ + + //! read-only access to an item at a given index + inline const TYPE& operator [] (size_t index) const; + //! alternate name for operator [] + inline const TYPE& itemAt(size_t index) const; + //! stack-usage of the vector. returns the top of the stack (last element) + const TYPE& top() const; + //! same as operator [], but allows to access the vector backward (from the end) with a negative index + const TYPE& mirrorItemAt(ssize_t index) const; + + /*! + * modifing the array + */ + + //! copy-on write support, grants write access to an item + TYPE& editItemAt(size_t index); + //! grants right acces to the top of the stack (last element) + TYPE& editTop(); + + /*! + * append/insert another vector + */ + + //! insert another vector at a given index + ssize_t insertVectorAt(const Vector& vector, size_t index); + + //! append another vector at the end of this one + ssize_t appendVector(const Vector& vector); + + + //! insert an array at a given index + ssize_t insertArrayAt(const TYPE* array, size_t index, size_t length); + + //! append an array at the end of this vector + ssize_t appendArray(const TYPE* array, size_t length); + + /*! + * add/insert/replace items + */ + + //! insert one or several items initialized with their default constructor + inline ssize_t insertAt(size_t index, size_t numItems = 1); + //! insert one or several items initialized from a prototype item + ssize_t insertAt(const TYPE& prototype_item, size_t index, size_t numItems = 1); + //! pop the top of the stack (removes the last element). No-op if the stack's empty + inline void pop(); + //! pushes an item initialized with its default constructor + inline void push(); + //! pushes an item on the top of the stack + void push(const TYPE& item); + //! same as push() but returns the index the item was added at (or an error) + inline ssize_t add(); + //! same as push() but returns the index the item was added at (or an error) + ssize_t add(const TYPE& item); + //! replace an item with a new one initialized with its default constructor + inline ssize_t replaceAt(size_t index); + //! replace an item with a new one + ssize_t replaceAt(const TYPE& item, size_t index); + + /*! + * remove items + */ + + //! remove several items + inline ssize_t removeItemsAt(size_t index, size_t count = 1); + //! remove one item + inline ssize_t removeAt(size_t index) { return removeItemsAt(index); } + + /*! + * sort (stable) the array + */ + + typedef int (*compar_t)(const TYPE* lhs, const TYPE* rhs); + typedef int (*compar_r_t)(const TYPE* lhs, const TYPE* rhs, void* state); + + inline status_t sort(compar_t cmp); + inline status_t sort(compar_r_t cmp, void* state); + + // for debugging only + inline size_t getItemSize() const { return itemSize(); } + + + /* + * these inlines add some level of compatibility with STL. eventually + * we should probably turn things around. + */ + typedef TYPE* iterator; + typedef TYPE const* const_iterator; + + inline iterator begin() { return editArray(); } + inline iterator end() { return editArray() + size(); } + inline const_iterator begin() const { return array(); } + inline const_iterator end() const { return array() + size(); } + inline void reserve(size_t n) { setCapacity(n); } + inline bool empty() const{ return isEmpty(); } + inline void push_back(const TYPE& item) { insertAt(item, size(), 1); } + inline void push_front(const TYPE& item) { insertAt(item, 0, 1); } + inline iterator erase(iterator pos) { + return begin() + removeItemsAt(pos-array()); + } + +protected: + virtual void do_construct(void* storage, size_t num) const; + virtual void do_destroy(void* storage, size_t num) const; + virtual void do_copy(void* dest, const void* from, size_t num) const; + virtual void do_splat(void* dest, const void* item, size_t num) const; + virtual void do_move_forward(void* dest, const void* from, size_t num) const; + virtual void do_move_backward(void* dest, const void* from, size_t num) const; +}; + +// Vector can be trivially moved using memcpy() because moving does not +// require any change to the underlying SharedBuffer contents or reference count. +template struct trait_trivial_move > { enum { value = true }; }; + +// --------------------------------------------------------------------------- +// No user serviceable parts from here... +// --------------------------------------------------------------------------- + +template inline +Vector::Vector() + : VectorImpl(sizeof(TYPE), + ((traits::has_trivial_ctor ? HAS_TRIVIAL_CTOR : 0) + |(traits::has_trivial_dtor ? HAS_TRIVIAL_DTOR : 0) + |(traits::has_trivial_copy ? HAS_TRIVIAL_COPY : 0)) + ) +{ +} + +template inline +Vector::Vector(const Vector& rhs) + : VectorImpl(rhs) { +} + +template inline +Vector::Vector(const SortedVector& rhs) + : VectorImpl(static_cast(rhs)) { +} + +template inline +Vector::~Vector() { + finish_vector(); +} + +template inline +Vector& Vector::operator = (const Vector& rhs) { + VectorImpl::operator = (rhs); + return *this; +} + +template inline +const Vector& Vector::operator = (const Vector& rhs) const { + VectorImpl::operator = (static_cast(rhs)); + return *this; +} + +template inline +Vector& Vector::operator = (const SortedVector& rhs) { + VectorImpl::operator = (static_cast(rhs)); + return *this; +} + +template inline +const Vector& Vector::operator = (const SortedVector& rhs) const { + VectorImpl::operator = (rhs); + return *this; +} + +template inline +const TYPE* Vector::array() const { + return static_cast(arrayImpl()); +} + +template inline +TYPE* Vector::editArray() { + return static_cast(editArrayImpl()); +} + + +template inline +const TYPE& Vector::operator[](size_t index) const { + LOG_FATAL_IF( index>=size(), + "itemAt: index %d is past size %d", (int)index, (int)size() ); + return *(array() + index); +} + +template inline +const TYPE& Vector::itemAt(size_t index) const { + return operator[](index); +} + +template inline +const TYPE& Vector::mirrorItemAt(ssize_t index) const { + LOG_FATAL_IF( (index>0 ? index : -index)>=size(), + "mirrorItemAt: index %d is past size %d", + (int)index, (int)size() ); + return *(array() + ((index<0) ? (size()-index) : index)); +} + +template inline +const TYPE& Vector::top() const { + return *(array() + size() - 1); +} + +template inline +TYPE& Vector::editItemAt(size_t index) { + return *( static_cast(editItemLocation(index)) ); +} + +template inline +TYPE& Vector::editTop() { + return *( static_cast(editItemLocation(size()-1)) ); +} + +template inline +ssize_t Vector::insertVectorAt(const Vector& vector, size_t index) { + return VectorImpl::insertVectorAt(reinterpret_cast(vector), index); +} + +template inline +ssize_t Vector::appendVector(const Vector& vector) { + return VectorImpl::appendVector(reinterpret_cast(vector)); +} + +template inline +ssize_t Vector::insertArrayAt(const TYPE* array, size_t index, size_t length) { + return VectorImpl::insertArrayAt(array, index, length); +} + +template inline +ssize_t Vector::appendArray(const TYPE* array, size_t length) { + return VectorImpl::appendArray(array, length); +} + +template inline +ssize_t Vector::insertAt(const TYPE& item, size_t index, size_t numItems) { + return VectorImpl::insertAt(&item, index, numItems); +} + +template inline +void Vector::push(const TYPE& item) { + return VectorImpl::push(&item); +} + +template inline +ssize_t Vector::add(const TYPE& item) { + return VectorImpl::add(&item); +} + +template inline +ssize_t Vector::replaceAt(const TYPE& item, size_t index) { + return VectorImpl::replaceAt(&item, index); +} + +template inline +ssize_t Vector::insertAt(size_t index, size_t numItems) { + return VectorImpl::insertAt(index, numItems); +} + +template inline +void Vector::pop() { + VectorImpl::pop(); +} + +template inline +void Vector::push() { + VectorImpl::push(); +} + +template inline +ssize_t Vector::add() { + return VectorImpl::add(); +} + +template inline +ssize_t Vector::replaceAt(size_t index) { + return VectorImpl::replaceAt(index); +} + +template inline +ssize_t Vector::removeItemsAt(size_t index, size_t count) { + return VectorImpl::removeItemsAt(index, count); +} + +template inline +status_t Vector::sort(Vector::compar_t cmp) { + return VectorImpl::sort((VectorImpl::compar_t)cmp); +} + +template inline +status_t Vector::sort(Vector::compar_r_t cmp, void* state) { + return VectorImpl::sort((VectorImpl::compar_r_t)cmp, state); +} + +// --------------------------------------------------------------------------- + +template +void Vector::do_construct(void* storage, size_t num) const { + construct_type( reinterpret_cast(storage), num ); +} + +template +void Vector::do_destroy(void* storage, size_t num) const { + destroy_type( reinterpret_cast(storage), num ); +} + +template +void Vector::do_copy(void* dest, const void* from, size_t num) const { + copy_type( reinterpret_cast(dest), reinterpret_cast(from), num ); +} + +template +void Vector::do_splat(void* dest, const void* item, size_t num) const { + splat_type( reinterpret_cast(dest), reinterpret_cast(item), num ); +} + +template +void Vector::do_move_forward(void* dest, const void* from, size_t num) const { + move_forward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); +} + +template +void Vector::do_move_backward(void* dest, const void* from, size_t num) const { + move_backward_type( reinterpret_cast(dest), reinterpret_cast(from), num ); +} + +}; // namespace android + + +// --------------------------------------------------------------------------- + +#endif // ANDROID_VECTOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/VectorImpl.h android-platform-frameworks-native-21/include/utils/VectorImpl.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/VectorImpl.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/VectorImpl.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,202 @@ +/* + * Copyright (C) 2005 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. + */ + +#ifndef ANDROID_VECTOR_IMPL_H +#define ANDROID_VECTOR_IMPL_H + +#include +#include +#include +#include + +// --------------------------------------------------------------------------- +// No user serviceable parts in here... +// --------------------------------------------------------------------------- + +namespace android { + +/*! + * Implementation of the guts of the vector<> class + * this ensures backward binary compatibility and + * reduces code size. + * For performance reasons, we expose mStorage and mCount + * so these fields are set in stone. + * + */ + +class VectorImpl +{ +public: + enum { // flags passed to the ctor + HAS_TRIVIAL_CTOR = 0x00000001, + HAS_TRIVIAL_DTOR = 0x00000002, + HAS_TRIVIAL_COPY = 0x00000004, + }; + + VectorImpl(size_t itemSize, uint32_t flags); + VectorImpl(const VectorImpl& rhs); + virtual ~VectorImpl(); + + /*! must be called from subclasses destructor */ + void finish_vector(); + + VectorImpl& operator = (const VectorImpl& rhs); + + /*! C-style array access */ + inline const void* arrayImpl() const { return mStorage; } + void* editArrayImpl(); + + /*! vector stats */ + inline size_t size() const { return mCount; } + inline bool isEmpty() const { return mCount == 0; } + size_t capacity() const; + ssize_t setCapacity(size_t size); + + /*! append/insert another vector or array */ + ssize_t insertVectorAt(const VectorImpl& vector, size_t index); + ssize_t appendVector(const VectorImpl& vector); + ssize_t insertArrayAt(const void* array, size_t index, size_t length); + ssize_t appendArray(const void* array, size_t length); + + /*! add/insert/replace items */ + ssize_t insertAt(size_t where, size_t numItems = 1); + ssize_t insertAt(const void* item, size_t where, size_t numItems = 1); + void pop(); + void push(); + void push(const void* item); + ssize_t add(); + ssize_t add(const void* item); + ssize_t replaceAt(size_t index); + ssize_t replaceAt(const void* item, size_t index); + + /*! remove items */ + ssize_t removeItemsAt(size_t index, size_t count = 1); + void clear(); + + const void* itemLocation(size_t index) const; + void* editItemLocation(size_t index); + + typedef int (*compar_t)(const void* lhs, const void* rhs); + typedef int (*compar_r_t)(const void* lhs, const void* rhs, void* state); + status_t sort(compar_t cmp); + status_t sort(compar_r_t cmp, void* state); + +protected: + size_t itemSize() const; + void release_storage(); + + virtual void do_construct(void* storage, size_t num) const = 0; + virtual void do_destroy(void* storage, size_t num) const = 0; + virtual void do_copy(void* dest, const void* from, size_t num) const = 0; + virtual void do_splat(void* dest, const void* item, size_t num) const = 0; + virtual void do_move_forward(void* dest, const void* from, size_t num) const = 0; + virtual void do_move_backward(void* dest, const void* from, size_t num) const = 0; + + // take care of FBC... + virtual void reservedVectorImpl1(); + virtual void reservedVectorImpl2(); + virtual void reservedVectorImpl3(); + virtual void reservedVectorImpl4(); + virtual void reservedVectorImpl5(); + virtual void reservedVectorImpl6(); + virtual void reservedVectorImpl7(); + virtual void reservedVectorImpl8(); + +private: + void* _grow(size_t where, size_t amount); + void _shrink(size_t where, size_t amount); + + inline void _do_construct(void* storage, size_t num) const; + inline void _do_destroy(void* storage, size_t num) const; + inline void _do_copy(void* dest, const void* from, size_t num) const; + inline void _do_splat(void* dest, const void* item, size_t num) const; + inline void _do_move_forward(void* dest, const void* from, size_t num) const; + inline void _do_move_backward(void* dest, const void* from, size_t num) const; + + // These 2 fields are exposed in the inlines below, + // so they're set in stone. + void * mStorage; // base address of the vector + size_t mCount; // number of items + + const uint32_t mFlags; + const size_t mItemSize; +}; + + + +class SortedVectorImpl : public VectorImpl +{ +public: + SortedVectorImpl(size_t itemSize, uint32_t flags); + SortedVectorImpl(const VectorImpl& rhs); + virtual ~SortedVectorImpl(); + + SortedVectorImpl& operator = (const SortedVectorImpl& rhs); + + //! finds the index of an item + ssize_t indexOf(const void* item) const; + + //! finds where this item should be inserted + size_t orderOf(const void* item) const; + + //! add an item in the right place (or replaces it if there is one) + ssize_t add(const void* item); + + //! merges a vector into this one + ssize_t merge(const VectorImpl& vector); + ssize_t merge(const SortedVectorImpl& vector); + + //! removes an item + ssize_t remove(const void* item); + +protected: + virtual int do_compare(const void* lhs, const void* rhs) const = 0; + + // take care of FBC... + virtual void reservedSortedVectorImpl1(); + virtual void reservedSortedVectorImpl2(); + virtual void reservedSortedVectorImpl3(); + virtual void reservedSortedVectorImpl4(); + virtual void reservedSortedVectorImpl5(); + virtual void reservedSortedVectorImpl6(); + virtual void reservedSortedVectorImpl7(); + virtual void reservedSortedVectorImpl8(); + +private: + ssize_t _indexOrderOf(const void* item, size_t* order = 0) const; + + // these are made private, because they can't be used on a SortedVector + // (they don't have an implementation either) + ssize_t add(); + void pop(); + void push(); + void push(const void* item); + ssize_t insertVectorAt(const VectorImpl& vector, size_t index); + ssize_t appendVector(const VectorImpl& vector); + ssize_t insertArrayAt(const void* array, size_t index, size_t length); + ssize_t appendArray(const void* array, size_t length); + ssize_t insertAt(size_t where, size_t numItems = 1); + ssize_t insertAt(const void* item, size_t where, size_t numItems = 1); + ssize_t replaceAt(size_t index); + ssize_t replaceAt(const void* item, size_t index); +}; + +}; // namespace android + + +// --------------------------------------------------------------------------- + +#endif // ANDROID_VECTOR_IMPL_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/WorkQueue.h android-platform-frameworks-native-21/include/utils/WorkQueue.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/WorkQueue.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/WorkQueue.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,119 @@ +/*] + * Copyright (C) 2012 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. + */ + +#ifndef _LIBS_UTILS_WORK_QUEUE_H +#define _LIBS_UTILS_WORK_QUEUE_H + +#include +#include +#include + +namespace android { + +/* + * A threaded work queue. + * + * This class is designed to make it easy to run a bunch of isolated work + * units in parallel, using up to the specified number of threads. + * To use it, write a loop to post work units to the work queue, then synchronize + * on the queue at the end. + */ +class WorkQueue { +public: + class WorkUnit { + public: + WorkUnit() { } + virtual ~WorkUnit() { } + + /* + * Runs the work unit. + * If the result is 'true' then the work queue continues scheduling work as usual. + * If the result is 'false' then the work queue is canceled. + */ + virtual bool run() = 0; + }; + + /* Creates a work queue with the specified maximum number of work threads. */ + WorkQueue(size_t maxThreads, bool canCallJava = true); + + /* Destroys the work queue. + * Cancels pending work and waits for all remaining threads to complete. + */ + ~WorkQueue(); + + /* Posts a work unit to run later. + * If the work queue has been canceled or is already finished, returns INVALID_OPERATION + * and does not take ownership of the work unit (caller must destroy it itself). + * Otherwise, returns OK and takes ownership of the work unit (the work queue will + * destroy it automatically). + * + * For flow control, this method blocks when the size of the pending work queue is more + * 'backlog' times the number of threads. This condition reduces the rate of entry into + * the pending work queue and prevents it from growing much more rapidly than the + * work threads can actually handle. + * + * If 'backlog' is 0, then no throttle is applied. + */ + status_t schedule(WorkUnit* workUnit, size_t backlog = 2); + + /* Cancels all pending work. + * If the work queue is already finished, returns INVALID_OPERATION. + * If the work queue is already canceled, returns OK and does nothing else. + * Otherwise, returns OK, discards all pending work units and prevents additional + * work units from being scheduled. + * + * Call finish() after cancel() to wait for all remaining work to complete. + */ + status_t cancel(); + + /* Waits for all work to complete. + * If the work queue is already finished, returns INVALID_OPERATION. + * Otherwise, waits for all work to complete and returns OK. + */ + status_t finish(); + +private: + class WorkThread : public Thread { + public: + WorkThread(WorkQueue* workQueue, bool canCallJava); + virtual ~WorkThread(); + + private: + virtual bool threadLoop(); + + WorkQueue* const mWorkQueue; + }; + + status_t cancelLocked(); + bool threadLoop(); // called from each work thread + + const size_t mMaxThreads; + const bool mCanCallJava; + + Mutex mLock; + Condition mWorkChangedCondition; + Condition mWorkDequeuedCondition; + + bool mCanceled; + bool mFinished; + size_t mIdleThreads; + Vector > mWorkThreads; + Vector mWorkUnits; +}; + +}; // namespace android + +#endif // _LIBS_UTILS_WORK_QUEUE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/ZipFileCRO.h android-platform-frameworks-native-21/include/utils/ZipFileCRO.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/ZipFileCRO.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/ZipFileCRO.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,61 @@ +/* + * Copyright (C) 2008 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. + */ + +// +// C API for ead-only access to Zip archives, with minimal heap allocation. +// +#ifndef __LIBS_ZIPFILECRO_H +#define __LIBS_ZIPFILECRO_H + +#include +#include +#include + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +/* + * Trivial typedef to ensure that ZipFileCRO is not treated as a simple integer. + */ +typedef void* ZipFileCRO; + +/* + * Trivial typedef to ensure that ZipEntryCRO is not treated as a simple + * integer. We use NULL to indicate an invalid value. + */ +typedef void* ZipEntryCRO; + +extern ZipFileCRO ZipFileXRO_open(const char* path); + +extern void ZipFileCRO_destroy(ZipFileCRO zip); + +extern ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zip, + const char* fileName); + +extern bool ZipFileCRO_getEntryInfo(ZipFileCRO zip, ZipEntryCRO entry, + int* pMethod, size_t* pUncompLen, + size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32); + +extern bool ZipFileCRO_uncompressEntry(ZipFileCRO zip, ZipEntryCRO entry, int fd); + +#ifdef __cplusplus +} +#endif + +#endif /*__LIBS_ZIPFILECRO_H*/ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/ZipFileRO.h android-platform-frameworks-native-21/include/utils/ZipFileRO.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/ZipFileRO.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/ZipFileRO.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,262 @@ +/* + * Copyright (C) 2007 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. + */ + +/* + * Read-only access to Zip archives, with minimal heap allocation. + * + * This is similar to the more-complete ZipFile class, but no attempt + * has been made to make them interchangeable. This class operates under + * a very different set of assumptions and constraints. + * + * One such assumption is that if you're getting file descriptors for + * use with this class as a child of a fork() operation, you must be on + * a pread() to guarantee correct operation. This is because pread() can + * atomically read at a file offset without worrying about a lock around an + * lseek() + read() pair. + */ +#ifndef __LIBS_ZIPFILERO_H +#define __LIBS_ZIPFILERO_H + +#include +#include +#include +#include + +#include +#include +#include +#include + +namespace android { + +/* + * Trivial typedef to ensure that ZipEntryRO is not treated as a simple + * integer. We use NULL to indicate an invalid value. + */ +typedef void* ZipEntryRO; + +/* + * Open a Zip archive for reading. + * + * We want "open" and "find entry by name" to be fast operations, and we + * want to use as little memory as possible. We memory-map the file, + * and load a hash table with pointers to the filenames (which aren't + * null-terminated). The other fields are at a fixed offset from the + * filename, so we don't need to extract those (but we do need to byte-read + * and endian-swap them every time we want them). + * + * To speed comparisons when doing a lookup by name, we could make the mapping + * "private" (copy-on-write) and null-terminate the filenames after verifying + * the record structure. However, this requires a private mapping of + * every page that the Central Directory touches. Easier to tuck a copy + * of the string length into the hash table entry. + * + * NOTE: If this is used on file descriptors inherited from a fork() operation, + * you must be on a platform that implements pread() to guarantee correctness + * on the shared file descriptors. + */ +class ZipFileRO { +public: + ZipFileRO() + : mFd(-1), mFileName(NULL), mFileLength(-1), + mDirectoryMap(NULL), + mNumEntries(-1), mDirectoryOffset(-1), + mHashTableSize(-1), mHashTable(NULL) + {} + + ~ZipFileRO(); + + /* + * Open an archive. + */ + status_t open(const char* zipFileName); + + /* + * Find an entry, by name. Returns the entry identifier, or NULL if + * not found. + * + * If two entries have the same name, one will be chosen at semi-random. + */ + ZipEntryRO findEntryByName(const char* fileName) const; + + /* + * Return the #of entries in the Zip archive. + */ + int getNumEntries(void) const { + return mNumEntries; + } + + /* + * Return the Nth entry. Zip file entries are not stored in sorted + * order, and updated entries may appear at the end, so anyone walking + * the archive needs to avoid making ordering assumptions. We take + * that further by returning the Nth non-empty entry in the hash table + * rather than the Nth entry in the archive. + * + * Valid values are [0..numEntries). + * + * [This is currently O(n). If it needs to be fast we can allocate an + * additional data structure or provide an iterator interface.] + */ + ZipEntryRO findEntryByIndex(int idx) const; + + /* + * Copy the filename into the supplied buffer. Returns 0 on success, + * -1 if "entry" is invalid, or the filename length if it didn't fit. The + * length, and the returned string, include the null-termination. + */ + int getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) const; + + /* + * Get the vital stats for an entry. Pass in NULL pointers for anything + * you don't need. + * + * "*pOffset" holds the Zip file offset of the entry's data. + * + * Returns "false" if "entry" is bogus or if the data in the Zip file + * appears to be bad. + */ + bool getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, + size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const; + + /* + * Create a new FileMap object that maps a subset of the archive. For + * an uncompressed entry this effectively provides a pointer to the + * actual data, for a compressed entry this provides the input buffer + * for inflate(). + */ + FileMap* createEntryFileMap(ZipEntryRO entry) const; + + /* + * Uncompress the data into a buffer. Depending on the compression + * format, this is either an "inflate" operation or a memcpy. + * + * Use "uncompLen" from getEntryInfo() to determine the required + * buffer size. + * + * Returns "true" on success. + */ + bool uncompressEntry(ZipEntryRO entry, void* buffer) const; + + /* + * Uncompress the data to an open file descriptor. + */ + bool uncompressEntry(ZipEntryRO entry, int fd) const; + + /* Zip compression methods we support */ + enum { + kCompressStored = 0, // no compression + kCompressDeflated = 8, // standard deflate + }; + + /* + * Utility function: uncompress deflated data, buffer to buffer. + */ + static bool inflateBuffer(void* outBuf, const void* inBuf, + size_t uncompLen, size_t compLen); + + /* + * Utility function: uncompress deflated data, buffer to fd. + */ + static bool inflateBuffer(int fd, const void* inBuf, + size_t uncompLen, size_t compLen); + + /* + * Utility function to convert ZIP's time format to a timespec struct. + */ + static inline void zipTimeToTimespec(long when, struct tm* timespec) { + const long date = when >> 16; + timespec->tm_year = ((date >> 9) & 0x7F) + 80; // Zip is years since 1980 + timespec->tm_mon = (date >> 5) & 0x0F; + timespec->tm_mday = date & 0x1F; + + timespec->tm_hour = (when >> 11) & 0x1F; + timespec->tm_min = (when >> 5) & 0x3F; + timespec->tm_sec = (when & 0x1F) << 1; + } + + /* + * Some basic functions for raw data manipulation. "LE" means + * Little Endian. + */ + static inline unsigned short get2LE(const unsigned char* buf) { + return buf[0] | (buf[1] << 8); + } + static inline unsigned long get4LE(const unsigned char* buf) { + return buf[0] | (buf[1] << 8) | (buf[2] << 16) | (buf[3] << 24); + } + +private: + /* these are private and not defined */ + ZipFileRO(const ZipFileRO& src); + ZipFileRO& operator=(const ZipFileRO& src); + + /* locate and parse the central directory */ + bool mapCentralDirectory(void); + + /* parse the archive, prepping internal structures */ + bool parseZipArchive(void); + + /* add a new entry to the hash table */ + void addToHash(const char* str, int strLen, unsigned int hash); + + /* compute string hash code */ + static unsigned int computeHash(const char* str, int len); + + /* convert a ZipEntryRO back to a hash table index */ + int entryToIndex(const ZipEntryRO entry) const; + + /* + * One entry in the hash table. + */ + typedef struct HashEntry { + const char* name; + unsigned short nameLen; + //unsigned int hash; + } HashEntry; + + /* open Zip archive */ + int mFd; + + /* Lock for handling the file descriptor (seeks, etc) */ + mutable Mutex mFdLock; + + /* zip file name */ + char* mFileName; + + /* length of file */ + size_t mFileLength; + + /* mapped file */ + FileMap* mDirectoryMap; + + /* number of entries in the Zip archive */ + int mNumEntries; + + /* CD directory offset in the Zip archive */ + off64_t mDirectoryOffset; + + /* + * We know how many entries are in the Zip archive, so we have a + * fixed-size hash table. We probe for an empty slot. + */ + int mHashTableSize; + HashEntry* mHashTable; +}; + +}; // namespace android + +#endif /*__LIBS_ZIPFILERO_H*/ diff -Nru android-platform-frameworks-native-6.0.1+r16/include/utils/ZipUtils.h android-platform-frameworks-native-21/include/utils/ZipUtils.h --- android-platform-frameworks-native-6.0.1+r16/include/utils/ZipUtils.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/include/utils/ZipUtils.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,67 @@ +/* + * Copyright (C) 2007 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. + */ + +// +// Miscellaneous zip/gzip utility functions. +// +#ifndef __LIBS_ZIPUTILS_H +#define __LIBS_ZIPUTILS_H + +#include + +namespace android { + +/* + * Container class for utility functions, primarily for namespace reasons. + */ +class ZipUtils { +public: + /* + * General utility function for uncompressing "deflate" data from a file + * to a buffer. + */ + static bool inflateToBuffer(int fd, void* buf, long uncompressedLen, + long compressedLen); + static bool inflateToBuffer(FILE* fp, void* buf, long uncompressedLen, + long compressedLen); + + /* + * Someday we might want to make this generic and handle bzip2 ".bz2" + * files too. + * + * We could declare gzip to be a sub-class of zip that has exactly + * one always-compressed entry, but we currently want to treat Zip + * and gzip as distinct, so there's no value. + * + * The zlib library has some gzip utilities, but it has no interface + * for extracting the uncompressed length of the file (you do *not* + * want to gzseek to the end). + * + * Pass in a seeked file pointer for the gzip file. If this is a gzip + * file, we set our return values appropriately and return "true" with + * the file seeked to the start of the compressed data. + */ + static bool examineGzip(FILE* fp, int* pCompressionMethod, + long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32); + +private: + ZipUtils() {} + ~ZipUtils() {} +}; + +}; // namespace android + +#endif /*__LIBS_ZIPUTILS_H*/ diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/Android.mk android-platform-frameworks-native-21/libs/binder/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/binder/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -14,20 +14,12 @@ # we have the common sources, plus some device-specific stuff sources := \ - AppOpsManager.cpp \ Binder.cpp \ BpBinder.cpp \ - BufferedTextOutput.cpp \ - Debug.cpp \ - IAppOpsCallback.cpp \ - IAppOpsService.cpp \ - IBatteryStats.cpp \ IInterface.cpp \ IMemory.cpp \ IPCThreadState.cpp \ IPermissionController.cpp \ - IProcessInfoService.cpp \ - ProcessInfoService.cpp \ IServiceManager.cpp \ MemoryDealer.cpp \ MemoryBase.cpp \ @@ -35,31 +27,19 @@ Parcel.cpp \ PermissionCache.cpp \ ProcessState.cpp \ - Static.cpp \ - TextOutput.cpp \ + Static.cpp LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) +LOCAL_LDLIBS += -lpthread LOCAL_MODULE := libbinder LOCAL_SHARED_LIBRARIES := liblog libcutils libutils LOCAL_SRC_FILES := $(sources) -ifneq ($(TARGET_USES_64_BIT_BINDER),true) -ifneq ($(TARGET_IS_64_BIT),true) -LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -endif -endif -LOCAL_CFLAGS += -Werror include $(BUILD_SHARED_LIBRARY) include $(CLEAR_VARS) +LOCAL_LDLIBS += -lpthread LOCAL_MODULE := libbinder -LOCAL_STATIC_LIBRARIES += libutils LOCAL_SRC_FILES := $(sources) -ifneq ($(TARGET_USES_64_BIT_BINDER),true) -ifneq ($(TARGET_IS_64_BIT),true) -LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -endif -endif -LOCAL_CFLAGS += -Werror include $(BUILD_STATIC_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/AppOpsManager.cpp android-platform-frameworks-native-21/libs/binder/AppOpsManager.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/AppOpsManager.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/AppOpsManager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include -#include - -#include - -namespace android { - -static String16 _appops("appops"); -static pthread_mutex_t gTokenMutex = PTHREAD_MUTEX_INITIALIZER; -static sp gToken; - -static const sp& getToken(const sp& service) { - pthread_mutex_lock(&gTokenMutex); - if (gToken == NULL) { - gToken = service->getToken(new BBinder()); - } - pthread_mutex_unlock(&gTokenMutex); - return gToken; -} - -AppOpsManager::AppOpsManager() -{ -} - -sp AppOpsManager::getService() -{ - int64_t startTime = 0; - mLock.lock(); - sp service = mService; - while (service == NULL || !IInterface::asBinder(service)->isBinderAlive()) { - sp binder = defaultServiceManager()->checkService(_appops); - if (binder == NULL) { - // Wait for the app ops service to come back... - if (startTime == 0) { - startTime = uptimeMillis(); - ALOGI("Waiting for app ops service"); - } else if ((uptimeMillis()-startTime) > 10000) { - ALOGW("Waiting too long for app ops service, giving up"); - return NULL; - } - sleep(1); - } else { - service = interface_cast(binder); - mService = service; - } - } - mLock.unlock(); - return service; -} - -int32_t AppOpsManager::checkOp(int32_t op, int32_t uid, const String16& callingPackage) -{ - sp service = getService(); - return service != NULL ? service->checkOperation(op, uid, callingPackage) : MODE_IGNORED; -} - -int32_t AppOpsManager::noteOp(int32_t op, int32_t uid, const String16& callingPackage) { - sp service = getService(); - return service != NULL ? service->noteOperation(op, uid, callingPackage) : MODE_IGNORED; -} - -int32_t AppOpsManager::startOp(int32_t op, int32_t uid, const String16& callingPackage) { - sp service = getService(); - return service != NULL ? service->startOperation(getToken(service), op, uid, callingPackage) - : MODE_IGNORED; -} - -void AppOpsManager::finishOp(int32_t op, int32_t uid, const String16& callingPackage) { - sp service = getService(); - if (service != NULL) { - service->finishOperation(getToken(service), op, uid, callingPackage); - } -} - -void AppOpsManager::startWatchingMode(int32_t op, const String16& packageName, - const sp& callback) { - sp service = getService(); - if (service != NULL) { - service->startWatchingMode(op, packageName, callback); - } -} - -void AppOpsManager::stopWatchingMode(const sp& callback) { - sp service = getService(); - if (service != NULL) { - service->stopWatchingMode(callback); - } -} - -int32_t AppOpsManager::permissionToOpCode(const String16& permission) { - sp service = getService(); - if (service != NULL) { - return service->permissionToOpCode(permission); - } - return -1; -} - - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/Binder.cpp android-platform-frameworks-native-21/libs/binder/Binder.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/Binder.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/Binder.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,7 +16,7 @@ #include -#include +#include #include #include #include @@ -39,7 +39,7 @@ // --------------------------------------------------------------------------- -sp IBinder::queryLocalInterface(const String16& /*descriptor*/) +sp IBinder::queryLocalInterface(const String16& descriptor) { return NULL; } @@ -71,8 +71,8 @@ // --------------------------------------------------------------------------- BBinder::BBinder() + : mExtras(NULL) { - atomic_init(&mExtras, static_cast(0)); } bool BBinder::isBinderAlive() const @@ -117,20 +117,19 @@ } status_t BBinder::linkToDeath( - const sp& /*recipient*/, void* /*cookie*/, - uint32_t /*flags*/) + const sp& recipient, void* cookie, uint32_t flags) { return INVALID_OPERATION; } status_t BBinder::unlinkToDeath( - const wp& /*recipient*/, void* /*cookie*/, - uint32_t /*flags*/, wp* /*outRecipient*/) + const wp& recipient, void* cookie, uint32_t flags, + wp* outRecipient) { return INVALID_OPERATION; } - status_t BBinder::dump(int /*fd*/, const Vector& /*args*/) +status_t BBinder::dump(int fd, const Vector& args) { return NO_ERROR; } @@ -139,19 +138,14 @@ const void* objectID, void* object, void* cleanupCookie, object_cleanup_func func) { - Extras* e = reinterpret_cast( - atomic_load_explicit(&mExtras, memory_order_acquire)); + Extras* e = mExtras; if (!e) { e = new Extras; - uintptr_t expected = 0; - if (!atomic_compare_exchange_strong_explicit( - &mExtras, &expected, - reinterpret_cast(e), - memory_order_release, - memory_order_acquire)) { + if (android_atomic_cmpxchg(0, reinterpret_cast(e), + reinterpret_cast(&mExtras)) != 0) { delete e; - e = reinterpret_cast(expected); // Filled in by CAS + e = mExtras; } if (e == 0) return; // out of memory } @@ -160,18 +154,9 @@ e->mObjects.attach(objectID, object, cleanupCookie, func); } -// The C11 standard doesn't allow atomic loads from const fields, -// though C++11 does. Fudge it until standards get straightened out. -static inline uintptr_t load_const_atomic(const atomic_uintptr_t* p, - memory_order mo) { - atomic_uintptr_t* non_const_p = const_cast(p); - return atomic_load_explicit(non_const_p, mo); -} - void* BBinder::findObject(const void* objectID) const { - Extras* e = reinterpret_cast( - load_const_atomic(&mExtras, memory_order_acquire)); + Extras* e = mExtras; if (!e) return NULL; AutoMutex _l(e->mLock); @@ -180,8 +165,7 @@ void BBinder::detachObject(const void* objectID) { - Extras* e = reinterpret_cast( - atomic_load_explicit(&mExtras, memory_order_acquire)); + Extras* e = mExtras; if (!e) return; AutoMutex _l(e->mLock); @@ -195,14 +179,12 @@ BBinder::~BBinder() { - Extras* e = reinterpret_cast( - atomic_load_explicit(&mExtras, memory_order_relaxed)); - if (e) delete e; + if (mExtras) delete mExtras; } status_t BBinder::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t /*flags*/) + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { switch (code) { case INTERFACE_TRANSACTION: @@ -264,14 +246,14 @@ android_atomic_or(kRemoteAcquired, &mState); } -void BpRefBase::onLastStrongRef(const void* /*id*/) +void BpRefBase::onLastStrongRef(const void* id) { if (mRemote) { mRemote->decStrong(this); } } -bool BpRefBase::onIncStrongAttempted(uint32_t /*flags*/, const void* /*id*/) +bool BpRefBase::onIncStrongAttempted(uint32_t flags, const void* id) { return mRemote ? mRefs->attemptIncStrong(this) : false; } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/BpBinder.cpp android-platform-frameworks-native-21/libs/binder/BpBinder.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/BpBinder.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/BpBinder.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -73,7 +73,7 @@ void BpBinder::ObjectManager::kill() { const size_t N = mObjects.size(); - ALOGV("Killing %zu objects in manager %p", N, this); + ALOGV("Killing %d objects in manager %p", N, this); for (size_t i=0; iitemAt(i).recipient; } @@ -259,8 +260,8 @@ mObitsSent = 1; mLock.unlock(); - ALOGV("Reporting death of proxy %p for %zu recipients\n", - this, obits ? obits->size() : 0U); + ALOGV("Reporting death of proxy %p for %d recipients\n", + this, obits ? obits->size() : 0); if (obits != NULL) { const size_t N = obits->size(); @@ -342,7 +343,7 @@ if (ipc) ipc->incStrongHandle(mHandle); } -void BpBinder::onLastStrongRef(const void* /*id*/) +void BpBinder::onLastStrongRef(const void* id) { ALOGV("onLastStrongRef BpBinder %p handle %d\n", this, mHandle); IF_ALOGV() { @@ -352,7 +353,7 @@ if (ipc) ipc->decStrongHandle(mHandle); } -bool BpBinder::onIncStrongAttempted(uint32_t /*flags*/, const void* /*id*/) +bool BpBinder::onIncStrongAttempted(uint32_t flags, const void* id) { ALOGV("onIncStrongAttempted BpBinder %p handle %d\n", this, mHandle); IPCThreadState* ipc = IPCThreadState::self(); diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/BufferedTextOutput.cpp android-platform-frameworks-native-21/libs/binder/BufferedTextOutput.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/BufferedTextOutput.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/BufferedTextOutput.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,282 +0,0 @@ -/* - * Copyright (C) 2006 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 -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include - -// --------------------------------------------------------------------------- - -namespace android { - -struct BufferedTextOutput::BufferState : public RefBase -{ - BufferState(int32_t _seq) - : seq(_seq) - , buffer(NULL) - , bufferPos(0) - , bufferSize(0) - , atFront(true) - , indent(0) - , bundle(0) { - } - ~BufferState() { - free(buffer); - } - - status_t append(const char* txt, size_t len) { - if ((len+bufferPos) > bufferSize) { - size_t newSize = ((len+bufferPos)*3)/2; - if (newSize < (len+bufferPos)) return NO_MEMORY; // overflow - void* b = realloc(buffer, newSize); - if (!b) return NO_MEMORY; - buffer = (char*)b; - bufferSize = newSize; - } - memcpy(buffer+bufferPos, txt, len); - bufferPos += len; - return NO_ERROR; - } - - void restart() { - bufferPos = 0; - atFront = true; - if (bufferSize > 256) { - void* b = realloc(buffer, 256); - if (b) { - buffer = (char*)b; - bufferSize = 256; - } - } - } - - const int32_t seq; - char* buffer; - size_t bufferPos; - size_t bufferSize; - bool atFront; - int32_t indent; - int32_t bundle; -}; - -struct BufferedTextOutput::ThreadState -{ - Vector > states; -}; - -static mutex_t gMutex; - -static thread_store_t tls; - -BufferedTextOutput::ThreadState* BufferedTextOutput::getThreadState() -{ - ThreadState* ts = (ThreadState*) thread_store_get( &tls ); - if (ts) return ts; - ts = new ThreadState; - thread_store_set( &tls, ts, threadDestructor ); - return ts; -} - -void BufferedTextOutput::threadDestructor(void *st) -{ - delete ((ThreadState*)st); -} - -static volatile int32_t gSequence = 0; - -static volatile int32_t gFreeBufferIndex = -1; - -static int32_t allocBufferIndex() -{ - int32_t res = -1; - - mutex_lock(&gMutex); - - if (gFreeBufferIndex >= 0) { - res = gFreeBufferIndex; - gFreeBufferIndex = gTextBuffers[res]; - gTextBuffers.editItemAt(res) = -1; - - } else { - res = gTextBuffers.size(); - gTextBuffers.add(-1); - } - - mutex_unlock(&gMutex); - - return res; -} - -static void freeBufferIndex(int32_t idx) -{ - mutex_lock(&gMutex); - gTextBuffers.editItemAt(idx) = gFreeBufferIndex; - gFreeBufferIndex = idx; - mutex_unlock(&gMutex); -} - -// --------------------------------------------------------------------------- - -BufferedTextOutput::BufferedTextOutput(uint32_t flags) - : mFlags(flags) - , mSeq(android_atomic_inc(&gSequence)) - , mIndex(allocBufferIndex()) -{ - mGlobalState = new BufferState(mSeq); - if (mGlobalState) mGlobalState->incStrong(this); -} - -BufferedTextOutput::~BufferedTextOutput() -{ - if (mGlobalState) mGlobalState->decStrong(this); - freeBufferIndex(mIndex); -} - -status_t BufferedTextOutput::print(const char* txt, size_t len) -{ - //printf("BufferedTextOutput: printing %d\n", len); - - AutoMutex _l(mLock); - BufferState* b = getBuffer(); - - const char* const end = txt+len; - - status_t err; - - while (txt < end) { - // Find the next line. - const char* first = txt; - while (txt < end && *txt != '\n') txt++; - - // Include this and all following empty lines. - while (txt < end && *txt == '\n') txt++; - - // Special cases for first data on a line. - if (b->atFront) { - if (b->indent > 0) { - // If this is the start of a line, add the indent. - const char* prefix = stringForIndent(b->indent); - err = b->append(prefix, strlen(prefix)); - if (err != NO_ERROR) return err; - - } else if (*(txt-1) == '\n' && !b->bundle) { - // Fast path: if we are not indenting or bundling, and - // have been given one or more complete lines, just write - // them out without going through the buffer. - - // Slurp up all of the lines. - const char* lastLine = txt+1; - while (txt < end) { - if (*txt++ == '\n') lastLine = txt; - } - struct iovec vec; - vec.iov_base = (void*)first; - vec.iov_len = lastLine-first; - //printf("Writing %d bytes of data!\n", vec.iov_len); - writeLines(vec, 1); - txt = lastLine; - continue; - } - } - - // Append the new text to the buffer. - err = b->append(first, txt-first); - if (err != NO_ERROR) return err; - b->atFront = *(txt-1) == '\n'; - - // If we have finished a line and are not bundling, write - // it out. - //printf("Buffer is now %d bytes\n", b->bufferPos); - if (b->atFront && !b->bundle) { - struct iovec vec; - vec.iov_base = b->buffer; - vec.iov_len = b->bufferPos; - //printf("Writing %d bytes of data!\n", vec.iov_len); - writeLines(vec, 1); - b->restart(); - } - } - - return NO_ERROR; -} - -void BufferedTextOutput::moveIndent(int delta) -{ - AutoMutex _l(mLock); - BufferState* b = getBuffer(); - b->indent += delta; - if (b->indent < 0) b->indent = 0; -} - -void BufferedTextOutput::pushBundle() -{ - AutoMutex _l(mLock); - BufferState* b = getBuffer(); - b->bundle++; -} - -void BufferedTextOutput::popBundle() -{ - AutoMutex _l(mLock); - BufferState* b = getBuffer(); - b->bundle--; - LOG_FATAL_IF(b->bundle < 0, - "TextOutput::popBundle() called more times than pushBundle()"); - if (b->bundle < 0) b->bundle = 0; - - if (b->bundle == 0) { - // Last bundle, write out data if it is complete. If it is not - // complete, don't write until the last line is done... this may - // or may not be the write thing to do, but it's the easiest. - if (b->bufferPos > 0 && b->atFront) { - struct iovec vec; - vec.iov_base = b->buffer; - vec.iov_len = b->bufferPos; - writeLines(vec, 1); - b->restart(); - } - } -} - -BufferedTextOutput::BufferState* BufferedTextOutput::getBuffer() const -{ - if ((mFlags&MULTITHREADED) != 0) { - ThreadState* ts = getThreadState(); - if (ts) { - while (ts->states.size() <= (size_t)mIndex) ts->states.add(NULL); - BufferState* bs = ts->states[mIndex].get(); - if (bs != NULL && bs->seq == mSeq) return bs; - - ts->states.editItemAt(mIndex) = new BufferState(mIndex); - bs = ts->states[mIndex].get(); - if (bs != NULL) return bs; - } - } - - return mGlobalState; -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/Debug.cpp android-platform-frameworks-native-21/libs/binder/Debug.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/Debug.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/Debug.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,299 +0,0 @@ -/* - * Copyright (C) 2005 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 - -#include - -#include -#include -#include - -namespace android { - -// --------------------------------------------------------------------- - -static const char indentStr[] = -" " -" "; - -const char* stringForIndent(int32_t indentLevel) -{ - ssize_t off = sizeof(indentStr)-1-(indentLevel*2); - return indentStr + (off < 0 ? 0 : off); -} - -// --------------------------------------------------------------------- - -static void defaultPrintFunc(void* /*cookie*/, const char* txt) -{ - printf("%s", txt); -} - -// --------------------------------------------------------------------- - -static inline int isident(int c) -{ - return isalnum(c) || c == '_'; -} - -static inline bool isasciitype(char c) -{ - if( c >= ' ' && c < 127 && c != '\'' && c != '\\' ) return true; - return false; -} - -static inline char makehexdigit(uint32_t val) -{ - return "0123456789abcdef"[val&0xF]; -} - -static char* appendhexnum(uint32_t val, char* out) -{ - for( int32_t i=28; i>=0; i-=4 ) { - *out++ = makehexdigit( val>>i ); - } - *out = 0; - return out; -} - -static char* appendcharornum(char c, char* out, bool skipzero = true) -{ - if (skipzero && c == 0) return out; - - if (isasciitype(c)) { - *out++ = c; - return out; - } - - *out++ = '\\'; - *out++ = 'x'; - *out++ = makehexdigit(c>>4); - *out++ = makehexdigit(c); - return out; -} - -static char* typetostring(uint32_t type, char* out, - bool fullContext = true, - bool strict = false) -{ - char* pos = out; - char c[4]; - c[0] = (char)((type>>24)&0xFF); - c[1] = (char)((type>>16)&0xFF); - c[2] = (char)((type>>8)&0xFF); - c[3] = (char)(type&0xFF); - bool valid; - if( !strict ) { - // now even less strict! - // valid = isasciitype(c[3]); - valid = true; - int32_t i = 0; - bool zero = true; - while (valid && i<3) { - if (c[i] == 0) { - if (!zero) valid = false; - } else { - zero = false; - //if (!isasciitype(c[i])) valid = false; - } - i++; - } - // if all zeros, not a valid type code. - if (zero) valid = false; - } else { - valid = isident(c[3]) ? true : false; - int32_t i = 0; - bool zero = true; - while (valid && i<3) { - if (c[i] == 0) { - if (!zero) valid = false; - } else { - zero = false; - if (!isident(c[i])) valid = false; - } - i++; - } - } - if( valid && (!fullContext || c[0] != '0' || c[1] != 'x') ) { - if( fullContext ) *pos++ = '\''; - pos = appendcharornum(c[0], pos); - pos = appendcharornum(c[1], pos); - pos = appendcharornum(c[2], pos); - pos = appendcharornum(c[3], pos); - if( fullContext ) *pos++ = '\''; - *pos = 0; - return pos; - } - - if( fullContext ) { - *pos++ = '0'; - *pos++ = 'x'; - } - return appendhexnum(type, pos); -} - -void printTypeCode(uint32_t typeCode, debugPrintFunc func, void* cookie) -{ - char buffer[32]; - char* end = typetostring(typeCode, buffer); - *end = 0; - func ? (*func)(cookie, buffer) : defaultPrintFunc(cookie, buffer); -} - -void printHexData(int32_t indent, const void *buf, size_t length, - size_t bytesPerLine, int32_t singleLineBytesCutoff, - size_t alignment, bool cStyle, - debugPrintFunc func, void* cookie) -{ - if (alignment == 0) { - if (bytesPerLine >= 16) alignment = 4; - else if (bytesPerLine >= 8) alignment = 2; - else alignment = 1; - } - if (func == NULL) func = defaultPrintFunc; - - size_t offset; - - unsigned char *pos = (unsigned char *)buf; - - if (pos == NULL) { - if (singleLineBytesCutoff < 0) func(cookie, "\n"); - func(cookie, "(NULL)"); - return; - } - - if (length == 0) { - if (singleLineBytesCutoff < 0) func(cookie, "\n"); - func(cookie, "(empty)"); - return; - } - - if ((int32_t)length < 0) { - if (singleLineBytesCutoff < 0) func(cookie, "\n"); - char buf[64]; - sprintf(buf, "(bad length: %zu)", length); - func(cookie, buf); - return; - } - - char buffer[256]; - static const size_t maxBytesPerLine = (sizeof(buffer)-1-11-4)/(3+1); - - if (bytesPerLine > maxBytesPerLine) bytesPerLine = maxBytesPerLine; - - const bool oneLine = (int32_t)length <= singleLineBytesCutoff; - bool newLine = false; - if (cStyle) { - indent++; - func(cookie, "{\n"); - newLine = true; - } else if (!oneLine) { - func(cookie, "\n"); - newLine = true; - } - - for (offset = 0; ; offset += bytesPerLine, pos += bytesPerLine) { - long remain = length; - - char* c = buffer; - if (!oneLine && !cStyle) { - sprintf(c, "0x%08x: ", (int)offset); - c += 12; - } - - size_t index; - size_t word; - - for (word = 0; word < bytesPerLine; ) { - - const size_t startIndex = word+(alignment-(alignment?1:0)); - const ssize_t dir = -1; - - for (index = 0; index < alignment || (alignment == 0 && index < bytesPerLine); index++) { - - if (!cStyle) { - if (index == 0 && word > 0 && alignment > 0) { - *c++ = ' '; - } - - if (remain-- > 0) { - const unsigned char val = *(pos+startIndex+(index*dir)); - *c++ = makehexdigit(val>>4); - *c++ = makehexdigit(val); - } else if (!oneLine) { - *c++ = ' '; - *c++ = ' '; - } - } else { - if (remain > 0) { - if (index == 0 && word > 0) { - *c++ = ','; - *c++ = ' '; - } - if (index == 0) { - *c++ = '0'; - *c++ = 'x'; - } - const unsigned char val = *(pos+startIndex+(index*dir)); - *c++ = makehexdigit(val>>4); - *c++ = makehexdigit(val); - remain--; - } - } - } - - word += index; - } - - if (!cStyle) { - remain = length; - *c++ = ' '; - *c++ = '\''; - for (index = 0; index < bytesPerLine; index++) { - - if (remain-- > 0) { - const unsigned char val = pos[index]; - *c++ = (val >= ' ' && val < 127) ? val : '.'; - } else if (!oneLine) { - *c++ = ' '; - } - } - - *c++ = '\''; - if (length > bytesPerLine) *c++ = '\n'; - } else { - if (remain > 0) *c++ = ','; - *c++ = '\n'; - } - - if (newLine && indent) func(cookie, stringForIndent(indent)); - *c = 0; - func(cookie, buffer); - newLine = true; - - if (length <= bytesPerLine) break; - length -= bytesPerLine; - } - - if (cStyle) { - if (indent > 0) func(cookie, stringForIndent(indent-1)); - func(cookie, "};"); - } -} - -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IAppOpsCallback.cpp android-platform-frameworks-native-21/libs/binder/IAppOpsCallback.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IAppOpsCallback.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IAppOpsCallback.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,69 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define LOG_TAG "AppOpsCallback" - -#include - -#include -#include -#include - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class BpAppOpsCallback : public BpInterface -{ -public: - BpAppOpsCallback(const sp& impl) - : BpInterface(impl) - { - } - - virtual void opChanged(int32_t op, const String16& packageName) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsCallback::getInterfaceDescriptor()); - data.writeInt32(op); - data.writeString16(packageName); - remote()->transact(OP_CHANGED_TRANSACTION, data, &reply); - } -}; - -IMPLEMENT_META_INTERFACE(AppOpsCallback, "com.android.internal.app.IAppOpsCallback"); - -// ---------------------------------------------------------------------- - -status_t BnAppOpsCallback::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case OP_CHANGED_TRANSACTION: { - CHECK_INTERFACE(IAppOpsCallback, data, reply); - int32_t op = data.readInt32(); - String16 packageName = data.readString16(); - opChanged(op, packageName); - reply->writeNoException(); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IAppOpsService.cpp android-platform-frameworks-native-21/libs/binder/IAppOpsService.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IAppOpsService.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IAppOpsService.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,214 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define LOG_TAG "AppOpsService" - -#include - -#include -#include -#include - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class BpAppOpsService : public BpInterface -{ -public: - BpAppOpsService(const sp& impl) - : BpInterface(impl) - { - } - - virtual int32_t checkOperation(int32_t code, int32_t uid, const String16& packageName) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeInt32(code); - data.writeInt32(uid); - data.writeString16(packageName); - remote()->transact(CHECK_OPERATION_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) return MODE_ERRORED; - return reply.readInt32(); - } - - virtual int32_t noteOperation(int32_t code, int32_t uid, const String16& packageName) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeInt32(code); - data.writeInt32(uid); - data.writeString16(packageName); - remote()->transact(NOTE_OPERATION_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) return MODE_ERRORED; - return reply.readInt32(); - } - - virtual int32_t startOperation(const sp& token, int32_t code, int32_t uid, - const String16& packageName) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeStrongBinder(token); - data.writeInt32(code); - data.writeInt32(uid); - data.writeString16(packageName); - remote()->transact(START_OPERATION_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) return MODE_ERRORED; - return reply.readInt32(); - } - - virtual void finishOperation(const sp& token, int32_t code, int32_t uid, - const String16& packageName) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeStrongBinder(token); - data.writeInt32(code); - data.writeInt32(uid); - data.writeString16(packageName); - remote()->transact(FINISH_OPERATION_TRANSACTION, data, &reply); - } - - virtual void startWatchingMode(int32_t op, const String16& packageName, - const sp& callback) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeInt32(op); - data.writeString16(packageName); - data.writeStrongBinder(IInterface::asBinder(callback)); - remote()->transact(START_WATCHING_MODE_TRANSACTION, data, &reply); - } - - virtual void stopWatchingMode(const sp& callback) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(callback)); - remote()->transact(STOP_WATCHING_MODE_TRANSACTION, data, &reply); - } - - virtual sp getToken(const sp& clientToken) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeStrongBinder(clientToken); - remote()->transact(GET_TOKEN_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) return NULL; - return reply.readStrongBinder(); - } - - - virtual int32_t permissionToOpCode(const String16& permission) { - Parcel data, reply; - data.writeInterfaceToken(IAppOpsService::getInterfaceDescriptor()); - data.writeString16(permission); - remote()->transact(PERMISSION_TO_OP_CODE_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) return -1; - return reply.readInt32(); - } -}; - -IMPLEMENT_META_INTERFACE(AppOpsService, "com.android.internal.app.IAppOpsService"); - -// ---------------------------------------------------------------------- - -status_t BnAppOpsService::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - //printf("AppOpsService received: "); data.print(); - switch(code) { - case CHECK_OPERATION_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - int32_t code = data.readInt32(); - int32_t uid = data.readInt32(); - String16 packageName = data.readString16(); - int32_t res = checkOperation(code, uid, packageName); - reply->writeNoException(); - reply->writeInt32(res); - return NO_ERROR; - } break; - case NOTE_OPERATION_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - int32_t code = data.readInt32(); - int32_t uid = data.readInt32(); - String16 packageName = data.readString16(); - int32_t res = noteOperation(code, uid, packageName); - reply->writeNoException(); - reply->writeInt32(res); - return NO_ERROR; - } break; - case START_OPERATION_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - sp token = data.readStrongBinder(); - int32_t code = data.readInt32(); - int32_t uid = data.readInt32(); - String16 packageName = data.readString16(); - int32_t res = startOperation(token, code, uid, packageName); - reply->writeNoException(); - reply->writeInt32(res); - return NO_ERROR; - } break; - case FINISH_OPERATION_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - sp token = data.readStrongBinder(); - int32_t code = data.readInt32(); - int32_t uid = data.readInt32(); - String16 packageName = data.readString16(); - finishOperation(token, code, uid, packageName); - reply->writeNoException(); - return NO_ERROR; - } break; - case START_WATCHING_MODE_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - int32_t op = data.readInt32(); - String16 packageName = data.readString16(); - sp callback = interface_cast(data.readStrongBinder()); - startWatchingMode(op, packageName, callback); - reply->writeNoException(); - return NO_ERROR; - } break; - case STOP_WATCHING_MODE_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - sp callback = interface_cast(data.readStrongBinder()); - stopWatchingMode(callback); - reply->writeNoException(); - return NO_ERROR; - } break; - case GET_TOKEN_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - sp clientToken = data.readStrongBinder(); - sp token = getToken(clientToken); - reply->writeNoException(); - reply->writeStrongBinder(token); - return NO_ERROR; - } break; - case PERMISSION_TO_OP_CODE_TRANSACTION: { - CHECK_INTERFACE(IAppOpsService, data, reply); - String16 permission = data.readString16(); - const int32_t opCode = permissionToOpCode(permission); - reply->writeNoException(); - reply->writeInt32(opCode); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IBatteryStats.cpp android-platform-frameworks-native-21/libs/binder/IBatteryStats.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IBatteryStats.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IBatteryStats.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,244 +0,0 @@ -/* - * Copyright (C) 2013 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 - -#include -#include -#include - -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class BpBatteryStats : public BpInterface -{ -public: - BpBatteryStats(const sp& impl) - : BpInterface(impl) - { - } - - virtual void noteStartSensor(int uid, int sensor) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - data.writeInt32(sensor); - remote()->transact(NOTE_START_SENSOR_TRANSACTION, data, &reply); - } - - virtual void noteStopSensor(int uid, int sensor) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - data.writeInt32(sensor); - remote()->transact(NOTE_STOP_SENSOR_TRANSACTION, data, &reply); - } - - virtual void noteStartVideo(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_START_VIDEO_TRANSACTION, data, &reply); - } - - virtual void noteStopVideo(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_STOP_VIDEO_TRANSACTION, data, &reply); - } - - virtual void noteStartAudio(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_START_AUDIO_TRANSACTION, data, &reply); - } - - virtual void noteStopAudio(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_STOP_AUDIO_TRANSACTION, data, &reply); - } - - virtual void noteResetVideo() { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - remote()->transact(NOTE_RESET_VIDEO_TRANSACTION, data, &reply); - } - - virtual void noteResetAudio() { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - remote()->transact(NOTE_RESET_AUDIO_TRANSACTION, data, &reply); - } - - virtual void noteFlashlightOn(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_FLASHLIGHT_ON_TRANSACTION, data, &reply); - } - - virtual void noteFlashlightOff(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_FLASHLIGHT_OFF_TRANSACTION, data, &reply); - } - - virtual void noteStartCamera(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_START_CAMERA_TRANSACTION, data, &reply); - } - - virtual void noteStopCamera(int uid) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(NOTE_STOP_CAMERA_TRANSACTION, data, &reply); - } - - virtual void noteResetCamera() { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - remote()->transact(NOTE_RESET_CAMERA_TRANSACTION, data, &reply); - } - - virtual void noteResetFlashlight() { - Parcel data, reply; - data.writeInterfaceToken(IBatteryStats::getInterfaceDescriptor()); - remote()->transact(NOTE_RESET_FLASHLIGHT_TRANSACTION, data, &reply); - } - -}; - -IMPLEMENT_META_INTERFACE(BatteryStats, "com.android.internal.app.IBatteryStats"); - -// ---------------------------------------------------------------------- - -status_t BnBatteryStats::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case NOTE_START_SENSOR_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - int sensor = data.readInt32(); - noteStartSensor(uid, sensor); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_STOP_SENSOR_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - int sensor = data.readInt32(); - noteStopSensor(uid, sensor); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_START_VIDEO_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteStartVideo(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_STOP_VIDEO_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteStopVideo(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_START_AUDIO_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteStartAudio(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_STOP_AUDIO_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteStopAudio(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_RESET_VIDEO_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - noteResetVideo(); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_RESET_AUDIO_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - noteResetAudio(); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_FLASHLIGHT_ON_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteFlashlightOn(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_FLASHLIGHT_OFF_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteFlashlightOff(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_START_CAMERA_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteStartCamera(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_STOP_CAMERA_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - int uid = data.readInt32(); - noteStopCamera(uid); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_RESET_CAMERA_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - noteResetCamera(); - reply->writeNoException(); - return NO_ERROR; - } break; - case NOTE_RESET_FLASHLIGHT_TRANSACTION: { - CHECK_INTERFACE(IBatteryStats, data, reply); - noteResetFlashlight(); - reply->writeNoException(); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IInterface.cpp android-platform-frameworks-native-21/libs/binder/IInterface.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IInterface.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IInterface.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -14,8 +14,6 @@ * limitations under the License. */ -#define LOG_TAG "IInterface" -#include #include namespace android { @@ -29,39 +27,16 @@ IInterface::~IInterface() { } -// static -sp IInterface::asBinder(const IInterface* iface) +sp IInterface::asBinder() { - if (iface == NULL) return NULL; - return const_cast(iface)->onAsBinder(); + return this ? onAsBinder() : NULL; } -// static -sp IInterface::asBinder(const sp& iface) +sp IInterface::asBinder() const { - if (iface == NULL) return NULL; - return iface->onAsBinder(); + return this ? const_cast(this)->onAsBinder() : NULL; } - // --------------------------------------------------------------------------- }; // namespace android - -extern "C" { - -void _ZN7android10IInterface8asBinderEv(void *retval, void* self) { - ALOGW("deprecated asBinder call, please update your code"); - //ALOGI("self: %p, retval: %p", self, retval); - android::sp *ret = new(retval) android::sp; - *ret = android::IInterface::asBinder((android::IInterface*)self); -} - -void _ZNK7android10IInterface8asBinderEv(void *retval, void *self) { - ALOGW("deprecated asBinder call, please update your code"); - //ALOGI("self: %p, retval: %p", self, retval); - android::sp *ret = new(retval) android::sp; - *ret = android::IInterface::asBinder((android::IInterface*)self); -} - -} // extern "C" diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IMemory.cpp android-platform-frameworks-native-21/libs/binder/IMemory.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IMemory.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IMemory.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -216,7 +216,7 @@ CHECK_INTERFACE(IMemory, data, reply); ssize_t offset; size_t size; - reply->writeStrongBinder( IInterface::asBinder(getMemory(&offset, &size)) ); + reply->writeStrongBinder( getMemory(&offset, &size)->asBinder() ); reply->writeInt32(offset); reply->writeInt32(size); return NO_ERROR; @@ -241,19 +241,21 @@ if (mRealHeap) { // by construction we're the last one if (mBase != MAP_FAILED) { - sp binder = IInterface::asBinder(this); + sp binder = const_cast(this)->asBinder(); if (VERBOSE) { - ALOGD("UNMAPPING binder=%p, heap=%p, size=%zu, fd=%d", + ALOGD("UNMAPPING binder=%p, heap=%p, size=%d, fd=%d", binder.get(), this, mSize, mHeapId); - CallStack stack(LOG_TAG); + CallStack stack; + stack.update(); + stack.dump("callstack"); } munmap(mBase, mSize); } } else { // remove from list only if it was mapped before - sp binder = IInterface::asBinder(this); + sp binder = const_cast(this)->asBinder(); free_heap(binder); } } @@ -262,7 +264,7 @@ void BpMemoryHeap::assertMapped() const { if (mHeapId == -1) { - sp binder(IInterface::asBinder(const_cast(this))); + sp binder(const_cast(this)->asBinder()); sp heap(static_cast(find_heap(binder).get())); heap->assertReallyMapped(); if (heap->mBase != MAP_FAILED) { @@ -296,12 +298,11 @@ uint32_t flags = reply.readInt32(); uint32_t offset = reply.readInt32(); - ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%zd, err=%d (%s)", - IInterface::asBinder(this).get(), - parcel_fd, size, err, strerror(-err)); + ALOGE_IF(err, "binder=%p transaction failed fd=%d, size=%ld, err=%d (%s)", + asBinder().get(), parcel_fd, size, err, strerror(-err)); int fd = dup( parcel_fd ); - ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%zd, err=%d (%s)", + ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%ld, err=%d (%s)", parcel_fd, size, err, strerror(errno)); int access = PROT_READ; @@ -314,8 +315,8 @@ mRealHeap = true; mBase = mmap(0, size, access, MAP_SHARED, fd, offset); if (mBase == MAP_FAILED) { - ALOGE("cannot map BpMemoryHeap (binder=%p), size=%zd, fd=%d (%s)", - IInterface::asBinder(this).get(), size, fd, strerror(errno)); + ALOGE("cannot map BpMemoryHeap (binder=%p), size=%ld, fd=%d (%s)", + asBinder().get(), size, fd, strerror(errno)); close(fd); } else { mSize = size; @@ -403,7 +404,7 @@ if (i>=0) { heap_info_t& info = mHeapCache.editValueAt(i); ALOGD_IF(VERBOSE, - "found binder=%p, heap=%p, size=%zu, fd=%d, count=%d", + "found binder=%p, heap=%p, size=%d, fd=%d, count=%d", binder.get(), info.heap.get(), static_cast(info.heap.get())->mSize, static_cast(info.heap.get())->mHeapId, @@ -436,7 +437,7 @@ int32_t c = android_atomic_dec(&info.count); if (c == 1) { ALOGD_IF(VERBOSE, - "removing binder=%p, heap=%p, size=%zu, fd=%d, count=%d", + "removing binder=%p, heap=%p, size=%d, fd=%d, count=%d", binder.unsafe_get(), info.heap.get(), static_cast(info.heap.get())->mSize, static_cast(info.heap.get())->mHeapId, @@ -467,7 +468,7 @@ for (int i=0 ; i(info.heap.get())); - ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%zu)", + ALOGD("hey=%p, heap=%p, count=%d, (fd=%d, base=%p, size=%d)", mHeapCache.keyAt(i).unsafe_get(), info.heap.get(), info.count, h->mHeapId, h->mBase, h->mSize); diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IPCThreadState.cpp android-platform-frameworks-native-21/libs/binder/IPCThreadState.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IPCThreadState.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IPCThreadState.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -20,23 +20,30 @@ #include #include -#include - #include +#include #include +#include #include #include #include +#include +#include #include +#include +#include + +#ifdef HAVE_PTHREADS #include #include -#include -#include -#include #include -#include +#endif +#ifdef HAVE_WIN32_THREADS +#include +#endif + #if LOG_NDEBUG @@ -63,11 +70,13 @@ namespace android { static const char* getReturnString(size_t idx); +static const char* getCommandString(size_t idx); static const void* printReturnCommand(TextOutput& out, const void* _cmd); static const void* printCommand(TextOutput& out, const void* _cmd); -// Static const and functions will be optimized out if not used, -// when LOG_NDEBUG and references in IF_LOG_COMMANDS() are optimized out. +// This will result in a missing symbol failure if the IF_LOG_COMMANDS() +// conditionals don't get stripped... but that is probably what we want. +#if !LOG_NDEBUG static const char *kReturnStrings[] = { "BR_ERROR", "BR_OK", @@ -117,6 +126,14 @@ return "unknown"; } +static const char* getCommandString(size_t idx) +{ + if (idx < sizeof(kCommandStrings) / sizeof(kCommandStrings[0])) + return kCommandStrings[idx]; + else + return "unknown"; +} + static const void* printBinderTransactionData(TextOutput& out, const void* data) { const binder_transaction_data* btd = @@ -128,7 +145,7 @@ out << "target.ptr=" << btd->target.ptr; } out << " (cookie " << btd->cookie << ")" << endl - << "code=" << TypeCode(btd->code) << ", flags=" << (void*)(long)btd->flags << endl + << "code=" << TypeCode(btd->code) << ", flags=" << (void*)btd->flags << endl << "data=" << btd->data.ptr.buffer << " (" << (void*)btd->data_size << " bytes)" << endl << "offsets=" << btd->data.ptr.offsets << " (" << (void*)btd->offsets_size @@ -140,10 +157,10 @@ { static const size_t N = sizeof(kReturnStrings)/sizeof(kReturnStrings[0]); const int32_t* cmd = (const int32_t*)_cmd; - uint32_t code = (uint32_t)*cmd++; + int32_t code = *cmd++; size_t cmdIndex = code & 0xff; - if (code == BR_ERROR) { - out << "BR_ERROR: " << (void*)(long)(*cmd++) << endl; + if (code == (int32_t) BR_ERROR) { + out << "BR_ERROR: " << (void*)(*cmd++) << endl; return cmd; } else if (cmdIndex >= N) { out << "Unknown reply: " << code << endl; @@ -170,21 +187,21 @@ case BR_DECREFS: { const int32_t b = *cmd++; const int32_t c = *cmd++; - out << ": target=" << (void*)(long)b << " (cookie " << (void*)(long)c << ")"; + out << ": target=" << (void*)b << " (cookie " << (void*)c << ")"; } break; case BR_ATTEMPT_ACQUIRE: { const int32_t p = *cmd++; const int32_t b = *cmd++; const int32_t c = *cmd++; - out << ": target=" << (void*)(long)b << " (cookie " << (void*)(long)c + out << ": target=" << (void*)b << " (cookie " << (void*)c << "), pri=" << p; } break; case BR_DEAD_BINDER: case BR_CLEAR_DEATH_NOTIFICATION_DONE: { const int32_t c = *cmd++; - out << ": death cookie " << (void*)(long)c; + out << ": death cookie " << (void*)c; } break; default: @@ -201,7 +218,7 @@ { static const size_t N = sizeof(kCommandStrings)/sizeof(kCommandStrings[0]); const int32_t* cmd = (const int32_t*)_cmd; - uint32_t code = (uint32_t)*cmd++; + int32_t code = *cmd++; size_t cmdIndex = code & 0xff; if (cmdIndex >= N) { @@ -225,7 +242,7 @@ case BC_FREE_BUFFER: { const int32_t buf = *cmd++; - out << ": buffer=" << (void*)(long)buf; + out << ": buffer=" << (void*)buf; } break; case BC_INCREFS: @@ -240,7 +257,7 @@ case BC_ACQUIRE_DONE: { const int32_t b = *cmd++; const int32_t c = *cmd++; - out << ": target=" << (void*)(long)b << " (cookie " << (void*)(long)c << ")"; + out << ": target=" << (void*)b << " (cookie " << (void*)c << ")"; } break; case BC_ATTEMPT_ACQUIRE: { @@ -253,12 +270,12 @@ case BC_CLEAR_DEATH_NOTIFICATION: { const int32_t h = *cmd++; const int32_t c = *cmd++; - out << ": handle=" << h << " (death cookie " << (void*)(long)c << ")"; + out << ": handle=" << h << " (death cookie " << (void*)c << ")"; } break; case BC_DEAD_BINDER_DONE: { const int32_t c = *cmd++; - out << ": death cookie " << (void*)(long)c; + out << ": death cookie " << (void*)c; } break; default: @@ -270,6 +287,7 @@ out << endl; return cmd; } +#endif static pthread_mutex_t gTLSMutex = PTHREAD_MUTEX_INITIALIZER; static bool gHaveTLS = false; @@ -343,16 +361,21 @@ return err; } -pid_t IPCThreadState::getCallingPid() const +int IPCThreadState::getCallingPid() { return mCallingPid; } -uid_t IPCThreadState::getCallingUid() const +int IPCThreadState::getCallingUid() { return mCallingUid; } +int IPCThreadState::getOrigCallingUid() +{ + return mOrigCallingUid; +} + int64_t IPCThreadState::clearCallingIdentity() { int64_t token = ((int64_t)mCallingUid<<32) | mCallingPid; @@ -399,81 +422,6 @@ talkWithDriver(false); } -void IPCThreadState::blockUntilThreadAvailable() -{ - pthread_mutex_lock(&mProcess->mThreadCountLock); - while (mProcess->mExecutingThreadsCount >= mProcess->mMaxThreads) { - ALOGW("Waiting for thread to be free. mExecutingThreadsCount=%lu mMaxThreads=%lu\n", - static_cast(mProcess->mExecutingThreadsCount), - static_cast(mProcess->mMaxThreads)); - pthread_cond_wait(&mProcess->mThreadCountDecrement, &mProcess->mThreadCountLock); - } - pthread_mutex_unlock(&mProcess->mThreadCountLock); -} - -status_t IPCThreadState::getAndExecuteCommand() -{ - status_t result; - int32_t cmd; - - result = talkWithDriver(); - if (result >= NO_ERROR) { - size_t IN = mIn.dataAvail(); - if (IN < sizeof(int32_t)) return result; - cmd = mIn.readInt32(); - IF_LOG_COMMANDS() { - alog << "Processing top-level Command: " - << getReturnString(cmd) << endl; - } - - pthread_mutex_lock(&mProcess->mThreadCountLock); - mProcess->mExecutingThreadsCount++; - pthread_mutex_unlock(&mProcess->mThreadCountLock); - - result = executeCommand(cmd); - - pthread_mutex_lock(&mProcess->mThreadCountLock); - mProcess->mExecutingThreadsCount--; - pthread_cond_broadcast(&mProcess->mThreadCountDecrement); - pthread_mutex_unlock(&mProcess->mThreadCountLock); - - // After executing the command, ensure that the thread is returned to the - // foreground cgroup before rejoining the pool. The driver takes care of - // restoring the priority, but doesn't do anything with cgroups so we - // need to take care of that here in userspace. Note that we do make - // sure to go in the foreground after executing a transaction, but - // there are other callbacks into user code that could have changed - // our group so we want to make absolutely sure it is put back. - set_sched_policy(mMyThreadId, SP_FOREGROUND); - } - - return result; -} - -// When we've cleared the incoming command queue, process any pending derefs -void IPCThreadState::processPendingDerefs() -{ - if (mIn.dataPosition() >= mIn.dataSize()) { - size_t numPending = mPendingWeakDerefs.size(); - if (numPending > 0) { - for (size_t i = 0; i < numPending; i++) { - RefBase::weakref_type* refs = mPendingWeakDerefs[i]; - refs->decWeak(mProcess.get()); - } - mPendingWeakDerefs.clear(); - } - - numPending = mPendingStrongDerefs.size(); - if (numPending > 0) { - for (size_t i = 0; i < numPending; i++) { - BBinder* obj = mPendingStrongDerefs[i]; - obj->decStrong(mProcess.get()); - } - mPendingStrongDerefs.clear(); - } - } -} - void IPCThreadState::joinThreadPool(bool isMain) { LOG_THREADPOOL("**** THREAD %p (PID %d) IS JOINING THE THREAD POOL\n", (void*)pthread_self(), getpid()); @@ -487,16 +435,53 @@ status_t result; do { - processPendingDerefs(); + int32_t cmd; + + // When we've cleared the incoming command queue, process any pending derefs + if (mIn.dataPosition() >= mIn.dataSize()) { + size_t numPending = mPendingWeakDerefs.size(); + if (numPending > 0) { + for (size_t i = 0; i < numPending; i++) { + RefBase::weakref_type* refs = mPendingWeakDerefs[i]; + refs->decWeak(mProcess.get()); + } + mPendingWeakDerefs.clear(); + } + + numPending = mPendingStrongDerefs.size(); + if (numPending > 0) { + for (size_t i = 0; i < numPending; i++) { + BBinder* obj = mPendingStrongDerefs[i]; + obj->decStrong(mProcess.get()); + } + mPendingStrongDerefs.clear(); + } + } + // now get the next command to be processed, waiting if necessary - result = getAndExecuteCommand(); + result = talkWithDriver(); + if (result >= NO_ERROR) { + size_t IN = mIn.dataAvail(); + if (IN < sizeof(int32_t)) continue; + cmd = mIn.readInt32(); + IF_LOG_COMMANDS() { + alog << "Processing top-level Command: " + << getReturnString(cmd) << endl; + } + - if (result < NO_ERROR && result != TIMED_OUT && result != -ECONNREFUSED && result != -EBADF) { - ALOGE("getAndExecuteCommand(fd=%d) returned unexpected error %d, aborting", - mProcess->mDriverFD, result); - abort(); + result = executeCommand(cmd); } + // After executing the command, ensure that the thread is returned to the + // foreground cgroup before rejoining the pool. The driver takes care of + // restoring the priority, but doesn't do anything with cgroups so we + // need to take care of that here in userspace. Note that we do make + // sure to go in the foreground after executing a transaction, but + // there are other callbacks into user code that could have changed + // our group so we want to make absolutely sure it is put back. + set_sched_policy(mMyThreadId, SP_FOREGROUND); + // Let this thread exit the thread pool if it is no longer // needed and it is not the main process thread. if(result == TIMED_OUT && !isMain) { @@ -511,31 +496,7 @@ talkWithDriver(false); } -int IPCThreadState::setupPolling(int* fd) -{ - if (mProcess->mDriverFD <= 0) { - return -EBADF; - } - - mOut.writeInt32(BC_ENTER_LOOPER); - *fd = mProcess->mDriverFD; - return 0; -} - -status_t IPCThreadState::handlePolledCommands() -{ - status_t result; - - do { - result = getAndExecuteCommand(); - } while (mIn.dataPosition() < mIn.dataSize()); - - processPendingDerefs(); - flushCommands(); - return result; -} - -void IPCThreadState::stopProcess(bool /*immediate*/) +void IPCThreadState::stopProcess(bool immediate) { //ALOGI("**** STOPPING PROCESS"); flushCommands(); @@ -637,7 +598,6 @@ status_t IPCThreadState::attemptIncStrongHandle(int32_t handle) { -#if HAS_BC_ATTEMPT_ACQUIRE LOG_REMOTEREFS("IPCThreadState::attemptIncStrongHandle(%d)\n", handle); mOut.writeInt32(BC_ATTEMPT_ACQUIRE); mOut.writeInt32(0); // xxx was thread priority @@ -652,11 +612,6 @@ #endif return result; -#else - (void)handle; - ALOGE("%s(%d): Not supported\n", __func__, handle); - return INVALID_OPERATION; -#endif } void IPCThreadState::expungeHandle(int32_t handle, IBinder* binder) @@ -671,7 +626,7 @@ { mOut.writeInt32(BC_REQUEST_DEATH_NOTIFICATION); mOut.writeInt32((int32_t)handle); - mOut.writePointer((uintptr_t)proxy); + mOut.writeInt32((int32_t)proxy); return NO_ERROR; } @@ -679,18 +634,19 @@ { mOut.writeInt32(BC_CLEAR_DEATH_NOTIFICATION); mOut.writeInt32((int32_t)handle); - mOut.writePointer((uintptr_t)proxy); + mOut.writeInt32((int32_t)proxy); return NO_ERROR; } IPCThreadState::IPCThreadState() : mProcess(ProcessState::self()), - mMyThreadId(gettid()), + mMyThreadId(androidGetTid()), mStrictModePolicy(0), mLastTransactionBinderFlags(0) { pthread_setspecific(gTLS, this); clearCaller(); + mOrigCallingUid = mCallingUid; mIn.setDataCapacity(256); mOut.setDataCapacity(256); } @@ -711,7 +667,7 @@ status_t IPCThreadState::waitForResponse(Parcel *reply, status_t *acquireResult) { - uint32_t cmd; + int32_t cmd; int32_t err; while (1) { @@ -720,7 +676,7 @@ if (err < NO_ERROR) break; if (mIn.dataAvail() == 0) continue; - cmd = (uint32_t)mIn.readInt32(); + cmd = mIn.readInt32(); IF_LOG_COMMANDS() { alog << "Processing waitForResponse Command: " @@ -761,23 +717,23 @@ reply->ipcSetDataReference( reinterpret_cast(tr.data.ptr.buffer), tr.data_size, - reinterpret_cast(tr.data.ptr.offsets), - tr.offsets_size/sizeof(binder_size_t), + reinterpret_cast(tr.data.ptr.offsets), + tr.offsets_size/sizeof(size_t), freeBuffer, this); } else { - err = *reinterpret_cast(tr.data.ptr.buffer); + err = *static_cast(tr.data.ptr.buffer); freeBuffer(NULL, reinterpret_cast(tr.data.ptr.buffer), tr.data_size, - reinterpret_cast(tr.data.ptr.offsets), - tr.offsets_size/sizeof(binder_size_t), this); + reinterpret_cast(tr.data.ptr.offsets), + tr.offsets_size/sizeof(size_t), this); } } else { freeBuffer(NULL, reinterpret_cast(tr.data.ptr.buffer), tr.data_size, - reinterpret_cast(tr.data.ptr.offsets), - tr.offsets_size/sizeof(binder_size_t), this); + reinterpret_cast(tr.data.ptr.offsets), + tr.offsets_size/sizeof(size_t), this); continue; } } @@ -817,12 +773,12 @@ const size_t outAvail = (!doReceive || needRead) ? mOut.dataSize() : 0; bwr.write_size = outAvail; - bwr.write_buffer = (uintptr_t)mOut.data(); + bwr.write_buffer = (long unsigned int)mOut.data(); // This is what we'll read. if (doReceive && needRead) { bwr.read_size = mIn.dataCapacity(); - bwr.read_buffer = (uintptr_t)mIn.data(); + bwr.read_buffer = (long unsigned int)mIn.data(); } else { bwr.read_size = 0; bwr.read_buffer = 0; @@ -869,14 +825,14 @@ } while (err == -EINTR); IF_LOG_COMMANDS() { - alog << "Our err: " << (void*)(intptr_t)err << ", write consumed: " + alog << "Our err: " << (void*)err << ", write consumed: " << bwr.write_consumed << " (of " << mOut.dataSize() - << "), read consumed: " << bwr.read_consumed << endl; + << "), read consumed: " << bwr.read_consumed << endl; } if (err >= NO_ERROR) { if (bwr.write_consumed > 0) { - if (bwr.write_consumed < mOut.dataSize()) + if (bwr.write_consumed < (ssize_t)mOut.dataSize()) mOut.remove(0, bwr.write_consumed); else mOut.setDataSize(0); @@ -906,7 +862,6 @@ { binder_transaction_data tr; - tr.target.ptr = 0; /* Don't pass uninitialized stack data to a remote process */ tr.target.handle = handle; tr.code = code; tr.flags = binderFlags; @@ -918,15 +873,15 @@ if (err == NO_ERROR) { tr.data_size = data.ipcDataSize(); tr.data.ptr.buffer = data.ipcData(); - tr.offsets_size = data.ipcObjectsCount()*sizeof(binder_size_t); + tr.offsets_size = data.ipcObjectsCount()*sizeof(size_t); tr.data.ptr.offsets = data.ipcObjects(); } else if (statusBuffer) { tr.flags |= TF_STATUS_CODE; *statusBuffer = err; tr.data_size = sizeof(status_t); - tr.data.ptr.buffer = reinterpret_cast(statusBuffer); + tr.data.ptr.buffer = statusBuffer; tr.offsets_size = 0; - tr.data.ptr.offsets = 0; + tr.data.ptr.offsets = NULL; } else { return (mLastError = err); } @@ -950,7 +905,7 @@ RefBase::weakref_type* refs; status_t result = NO_ERROR; - switch ((uint32_t)cmd) { + switch (cmd) { case BR_ERROR: result = mIn.readInt32(); break; @@ -959,8 +914,8 @@ break; case BR_ACQUIRE: - refs = (RefBase::weakref_type*)mIn.readPointer(); - obj = (BBinder*)mIn.readPointer(); + refs = (RefBase::weakref_type*)mIn.readInt32(); + obj = (BBinder*)mIn.readInt32(); ALOG_ASSERT(refs->refBase() == obj, "BR_ACQUIRE: object %p does not match cookie %p (expected %p)", refs, obj, refs->refBase()); @@ -970,13 +925,13 @@ obj->printRefs(); } mOut.writeInt32(BC_ACQUIRE_DONE); - mOut.writePointer((uintptr_t)refs); - mOut.writePointer((uintptr_t)obj); + mOut.writeInt32((int32_t)refs); + mOut.writeInt32((int32_t)obj); break; case BR_RELEASE: - refs = (RefBase::weakref_type*)mIn.readPointer(); - obj = (BBinder*)mIn.readPointer(); + refs = (RefBase::weakref_type*)mIn.readInt32(); + obj = (BBinder*)mIn.readInt32(); ALOG_ASSERT(refs->refBase() == obj, "BR_RELEASE: object %p does not match cookie %p (expected %p)", refs, obj, refs->refBase()); @@ -988,17 +943,17 @@ break; case BR_INCREFS: - refs = (RefBase::weakref_type*)mIn.readPointer(); - obj = (BBinder*)mIn.readPointer(); + refs = (RefBase::weakref_type*)mIn.readInt32(); + obj = (BBinder*)mIn.readInt32(); refs->incWeak(mProcess.get()); mOut.writeInt32(BC_INCREFS_DONE); - mOut.writePointer((uintptr_t)refs); - mOut.writePointer((uintptr_t)obj); + mOut.writeInt32((int32_t)refs); + mOut.writeInt32((int32_t)obj); break; case BR_DECREFS: - refs = (RefBase::weakref_type*)mIn.readPointer(); - obj = (BBinder*)mIn.readPointer(); + refs = (RefBase::weakref_type*)mIn.readInt32(); + obj = (BBinder*)mIn.readInt32(); // NOTE: This assertion is not valid, because the object may no // longer exist (thus the (BBinder*)cast above resulting in a different // memory address). @@ -1009,8 +964,8 @@ break; case BR_ATTEMPT_ACQUIRE: - refs = (RefBase::weakref_type*)mIn.readPointer(); - obj = (BBinder*)mIn.readPointer(); + refs = (RefBase::weakref_type*)mIn.readInt32(); + obj = (BBinder*)mIn.readInt32(); { const bool success = refs->attemptIncStrong(mProcess.get()); @@ -1035,18 +990,16 @@ buffer.ipcSetDataReference( reinterpret_cast(tr.data.ptr.buffer), tr.data_size, - reinterpret_cast(tr.data.ptr.offsets), - tr.offsets_size/sizeof(binder_size_t), freeBuffer, this); + reinterpret_cast(tr.data.ptr.offsets), + tr.offsets_size/sizeof(size_t), freeBuffer, this); const pid_t origPid = mCallingPid; const uid_t origUid = mCallingUid; - const int32_t origStrictModePolicy = mStrictModePolicy; - const int32_t origTransactionBinderFlags = mLastTransactionBinderFlags; - + mCallingPid = tr.sender_pid; mCallingUid = tr.sender_euid; - mLastTransactionBinderFlags = tr.flags; - + mOrigCallingUid = tr.sender_euid; + int curPrio = getpriority(PRIO_PROCESS, mMyThreadId); if (gDisableBackgroundScheduling) { if (curPrio > ANDROID_PRIORITY_NORMAL) { @@ -1068,9 +1021,8 @@ } //ALOGI(">>>> TRANSACT from pid %d uid %d\n", mCallingPid, mCallingUid); - + Parcel reply; - status_t error; IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); alog << "BR_TRANSACTION thr " << (void*)pthread_self() @@ -1084,18 +1036,19 @@ } if (tr.target.ptr) { sp b((BBinder*)tr.cookie); - error = b->transact(tr.code, buffer, &reply, tr.flags); + const status_t error = b->transact(tr.code, buffer, &reply, tr.flags); + if (error < NO_ERROR) reply.setError(error); } else { - error = the_context_object->transact(tr.code, buffer, &reply, tr.flags); + const status_t error = the_context_object->transact(tr.code, buffer, &reply, tr.flags); + if (error < NO_ERROR) reply.setError(error); } - + //ALOGI("<<<< TRANSACT from pid %d restore pid %d uid %d\n", // mCallingPid, origPid, origUid); if ((tr.flags & TF_ONE_WAY) == 0) { LOG_ONEWAY("Sending reply to %d!", mCallingPid); - if (error < NO_ERROR) reply.setError(error); sendReply(reply, 0); } else { LOG_ONEWAY("NOT sending reply to %d!", mCallingPid); @@ -1103,8 +1056,7 @@ mCallingPid = origPid; mCallingUid = origUid; - mStrictModePolicy = origStrictModePolicy; - mLastTransactionBinderFlags = origTransactionBinderFlags; + mOrigCallingUid = origUid; IF_LOG_TRANSACTIONS() { TextOutput::Bundle _b(alog); @@ -1117,15 +1069,15 @@ case BR_DEAD_BINDER: { - BpBinder *proxy = (BpBinder*)mIn.readPointer(); + BpBinder *proxy = (BpBinder*)mIn.readInt32(); proxy->sendObituary(); mOut.writeInt32(BC_DEAD_BINDER_DONE); - mOut.writePointer((uintptr_t)proxy); + mOut.writeInt32((int32_t)proxy); } break; case BR_CLEAR_DEATH_NOTIFICATION_DONE: { - BpBinder *proxy = (BpBinder*)mIn.readPointer(); + BpBinder *proxy = (BpBinder*)mIn.readInt32(); proxy->getWeakRefs()->decWeak(proxy); } break; @@ -1155,23 +1107,22 @@ void IPCThreadState::threadDestructor(void *st) { - IPCThreadState* const self = static_cast(st); - if (self) { - self->flushCommands(); + IPCThreadState* const self = static_cast(st); + if (self) { + self->flushCommands(); #if defined(HAVE_ANDROID_OS) if (self->mProcess->mDriverFD > 0) { ioctl(self->mProcess->mDriverFD, BINDER_THREAD_EXIT, 0); } #endif - delete self; - } + delete self; + } } -void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, - size_t /*dataSize*/, - const binder_size_t* /*objects*/, - size_t /*objectsSize*/, void* /*cookie*/) +void IPCThreadState::freeBuffer(Parcel* parcel, const uint8_t* data, size_t dataSize, + const size_t* objects, size_t objectsSize, + void* cookie) { //ALOGI("Freeing parcel %p", &parcel); IF_LOG_COMMANDS() { @@ -1181,7 +1132,7 @@ if (parcel != NULL) parcel->closeFileDescriptors(); IPCThreadState* state = self(); state->mOut.writeInt32(BC_FREE_BUFFER); - state->mOut.writePointer((uintptr_t)data); + state->mOut.writeInt32((int32_t)data); } }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IPermissionController.cpp android-platform-frameworks-native-21/libs/binder/IPermissionController.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IPermissionController.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IPermissionController.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -48,36 +49,6 @@ if (reply.readExceptionCode() != 0) return 0; return reply.readInt32() != 0; } - - virtual void getPackagesForUid(const uid_t uid, Vector& packages) - { - Parcel data, reply; - data.writeInterfaceToken(IPermissionController::getInterfaceDescriptor()); - data.writeInt32(uid); - remote()->transact(GET_PACKAGES_FOR_UID_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) { - return; - } - const int32_t size = reply.readInt32(); - if (size <= 0) { - return; - } - for (int i = 0; i < size; i++) { - packages.push(reply.readString16()); - } - } - - virtual bool isRuntimePermission(const String16& permission) - { - Parcel data, reply; - data.writeInterfaceToken(IPermissionController::getInterfaceDescriptor()); - data.writeString16(permission); - remote()->transact(IS_RUNTIME_PERMISSION_TRANSACTION, data, &reply); - // fail on exception - if (reply.readExceptionCode() != 0) return false; - return reply.readInt32() != 0; - } }; IMPLEMENT_META_INTERFACE(PermissionController, "android.os.IPermissionController"); @@ -87,6 +58,7 @@ status_t BnPermissionController::onTransact( uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { + //printf("PermissionController received: "); data.print(); switch(code) { case CHECK_PERMISSION_TRANSACTION: { CHECK_INTERFACE(IPermissionController, data, reply); @@ -98,30 +70,6 @@ reply->writeInt32(res ? 1 : 0); return NO_ERROR; } break; - - case GET_PACKAGES_FOR_UID_TRANSACTION: { - CHECK_INTERFACE(IPermissionController, data, reply); - int32_t uid = data.readInt32(); - Vector packages; - getPackagesForUid(uid, packages); - reply->writeNoException(); - size_t size = packages.size(); - reply->writeInt32(size); - for (size_t i = 0; i < size; i++) { - reply->writeString16(packages[i]); - } - return NO_ERROR; - } break; - - case IS_RUNTIME_PERMISSION_TRANSACTION: { - CHECK_INTERFACE(IPermissionController, data, reply); - String16 permission = data.readString16(); - const bool res = isRuntimePermission(permission); - reply->writeNoException(); - reply->writeInt32(res ? 1 : 0); - return NO_ERROR; - } break; - default: return BBinder::onTransact(code, data, reply, flags); } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IProcessInfoService.cpp android-platform-frameworks-native-21/libs/binder/IProcessInfoService.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IProcessInfoService.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IProcessInfoService.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright 2015 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 -#include -#include -#include - -namespace android { - -// ---------------------------------------------------------------------- - -class BpProcessInfoService : public BpInterface { -public: - BpProcessInfoService(const sp& impl) - : BpInterface(impl) {} - - virtual status_t getProcessStatesFromPids(size_t length, /*in*/ int32_t* pids, - /*out*/ int32_t* states) - { - Parcel data, reply; - data.writeInterfaceToken(IProcessInfoService::getInterfaceDescriptor()); - data.writeInt32Array(length, pids); - data.writeInt32(length); // write length of output array, used by java AIDL stubs - status_t err = remote()->transact(GET_PROCESS_STATES_FROM_PIDS, data, &reply); - if (err != NO_ERROR || ((err = reply.readExceptionCode()) != NO_ERROR)) { - return err; - } - int32_t replyLen = reply.readInt32(); - if (static_cast(replyLen) != length) { - return NOT_ENOUGH_DATA; - } - if (replyLen > 0 && (err = reply.read(states, length * sizeof(*states))) != NO_ERROR) { - return err; - } - return reply.readInt32(); - } - -}; - -IMPLEMENT_META_INTERFACE(ProcessInfoService, "android.os.IProcessInfoService"); - -// ---------------------------------------------------------------------- - -status_t BnProcessInfoService::onTransact( uint32_t code, const Parcel& data, Parcel* reply, - uint32_t flags) { - switch(code) { - case GET_PROCESS_STATES_FROM_PIDS: { - CHECK_INTERFACE(IProcessInfoService, data, reply); - int32_t arrayLen = data.readInt32(); - if (arrayLen <= 0) { - reply->writeNoException(); - reply->writeInt32(0); - reply->writeInt32(NOT_ENOUGH_DATA); - return NO_ERROR; - } - - size_t len = static_cast(arrayLen); - int32_t pids[len]; - status_t res = data.read(pids, len * sizeof(*pids)); - - // Ignore output array length returned in the parcel here, as the states array must - // always be the same length as the input PIDs array. - int32_t states[len]; - for (size_t i = 0; i < len; i++) states[i] = -1; - if (res == NO_ERROR) { - res = getProcessStatesFromPids(len, /*in*/ pids, /*out*/ states); - } - reply->writeNoException(); - reply->writeInt32Array(len, states); - reply->writeInt32(res); - return NO_ERROR; - } break; - default: - return BBinder::onTransact(code, data, reply, flags); - } -} - -// ---------------------------------------------------------------------- - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/IServiceManager.cpp android-platform-frameworks-native-21/libs/binder/IServiceManager.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/IServiceManager.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/IServiceManager.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -18,6 +18,7 @@ #include +#include #include #include #include @@ -36,11 +37,9 @@ { AutoMutex _l(gDefaultServiceManagerLock); - while (gDefaultServiceManager == NULL) { + if (gDefaultServiceManager == NULL) { gDefaultServiceManager = interface_cast( ProcessState::self()->getContextObject(NULL)); - if (gDefaultServiceManager == NULL) - sleep(1); } } @@ -87,7 +86,7 @@ } // Is this a permission failure, or did the controller go away? - if (IInterface::asBinder(pc)->isBinderAlive()) { + if (pc->asBinder()->isBinderAlive()) { ALOGW("Permission failure: %s from uid=%d pid=%d", String8(permission).string(), uid, pid); return false; diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/MemoryDealer.cpp android-platform-frameworks-native-21/libs/binder/MemoryDealer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/MemoryDealer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/MemoryDealer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -210,7 +210,7 @@ #ifdef MADV_REMOVE if (size) { int err = madvise(start_ptr, size, MADV_REMOVE); - ALOGW_IF(err, "madvise(%p, %zu, MADV_REMOVE) returned %s", + ALOGW_IF(err, "madvise(%p, %u, MADV_REMOVE) returned %s", start_ptr, size, err<0 ? strerror(errno) : "Ok"); } #endif @@ -225,8 +225,8 @@ // ---------------------------------------------------------------------------- -MemoryDealer::MemoryDealer(size_t size, const char* name, uint32_t flags) - : mHeap(new MemoryHeapBase(size, flags, name)), +MemoryDealer::MemoryDealer(size_t size, const char* name) + : mHeap(new MemoryHeapBase(size, 0, name)), mAllocator(new SimpleBestFitAllocator(size)) { } @@ -445,8 +445,8 @@ int np = ((cur->next) && cur->next->prev != cur) ? 1 : 0; int pn = ((cur->prev) && cur->prev->next != cur) ? 2 : 0; - snprintf(buffer, SIZE, " %3u: %p | 0x%08X | 0x%08X | %s %s\n", - i, cur, int(cur->start*kMemoryAlign), + snprintf(buffer, SIZE, " %3u: %08x | 0x%08X | 0x%08X | %s %s\n", + i, int(cur), int(cur->start*kMemoryAlign), int(cur->size*kMemoryAlign), int(cur->free) ? "F" : "A", errs[np|pn]); diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/MemoryHeapBase.cpp android-platform-frameworks-native-21/libs/binder/MemoryHeapBase.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/MemoryHeapBase.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/MemoryHeapBase.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -31,6 +31,11 @@ #include +#ifdef HAVE_ANDROID_OS +#include +#endif + + namespace android { // --------------------------------------------------------------------------- @@ -103,9 +108,18 @@ { if (size == 0) { // try to figure out the size automatically - struct stat sb; - if (fstat(fd, &sb) == 0) - size = sb.st_size; +#ifdef HAVE_ANDROID_OS + // first try the PMEM ioctl + pmem_region reg; + int err = ioctl(fd, PMEM_GET_TOTAL_SIZE, ®); + if (err == 0) + size = reg.len; +#endif + if (size == 0) { // try fstat + struct stat sb; + if (fstat(fd, &sb) == 0) + size = sb.st_size; + } // if it didn't work, let mmap() fail. } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/Parcel.cpp android-platform-frameworks-native-21/libs/binder/Parcel.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/Parcel.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/Parcel.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -22,22 +22,18 @@ #include #include #include -#include -#include - -#include #include +#include #include #include #include +#include #include #include #include #include -#include -#include #include #include #include @@ -49,29 +45,20 @@ #define LOG_REFS(...) //#define LOG_REFS(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) -#define LOG_ALLOC(...) -//#define LOG_ALLOC(...) ALOG(LOG_DEBUG, "Parcel", __VA_ARGS__) // --------------------------------------------------------------------------- -// This macro should never be used at runtime, as a too large value -// of s could cause an integer overflow. Instead, you should always -// use the wrapper function pad_size() -#define PAD_SIZE_UNSAFE(s) (((s)+3)&~3) - -static size_t pad_size(size_t s) { - if (s > (SIZE_T_MAX - 3)) { - abort(); - } - return PAD_SIZE_UNSAFE(s); -} +#define PAD_SIZE(s) (((s)+3)&~3) // Note: must be kept in sync with android/os/StrictMode.java's PENALTY_GATHER -#define STRICT_MODE_PENALTY_GATHER (0x40 << 16) +#define STRICT_MODE_PENALTY_GATHER 0x100 // Note: must be kept in sync with android/os/Parcel.java's EX_HAS_REPLY_HEADER #define EX_HAS_REPLY_HEADER -128 +// Maximum size of a blob to transfer in-place. +static const size_t IN_PLACE_BLOB_LIMIT = 40 * 1024; + // XXX This can be made public if we want to provide // support for typed data. struct small_flat_data @@ -82,32 +69,19 @@ namespace android { -static pthread_mutex_t gParcelGlobalAllocSizeLock = PTHREAD_MUTEX_INITIALIZER; -static size_t gParcelGlobalAllocSize = 0; -static size_t gParcelGlobalAllocCount = 0; - -// Maximum size of a blob to transfer in-place. -static const size_t BLOB_INPLACE_LIMIT = 16 * 1024; - -enum { - BLOB_INPLACE = 0, - BLOB_ASHMEM_IMMUTABLE = 1, - BLOB_ASHMEM_MUTABLE = 2, -}; - void acquire_object(const sp& proc, - const flat_binder_object& obj, const void* who, size_t* outAshmemSize) + const flat_binder_object& obj, const void* who) { switch (obj.type) { case BINDER_TYPE_BINDER: if (obj.binder) { LOG_REFS("Parcel %p acquiring reference on local %p", who, obj.cookie); - reinterpret_cast(obj.cookie)->incStrong(who); + static_cast(obj.cookie)->incStrong(who); } return; case BINDER_TYPE_WEAK_BINDER: if (obj.binder) - reinterpret_cast(obj.binder)->incWeak(who); + static_cast(obj.binder)->incWeak(who); return; case BINDER_TYPE_HANDLE: { const sp b = proc->getStrongProxyForHandle(obj.handle); @@ -123,41 +97,28 @@ return; } case BINDER_TYPE_FD: { - if (obj.cookie != 0) { - if (outAshmemSize != NULL) { - // If we own an ashmem fd, keep track of how much memory it refers to. - int size = ashmem_get_size_region(obj.handle); - if (size > 0) { - *outAshmemSize += size; - } - } - } + // intentionally blank -- nothing to do to acquire this, but we do + // recognize it as a legitimate object type. return; } } - ALOGD("Invalid object type 0x%08x", obj.type); + ALOGD("Invalid object type 0x%08lx", obj.type); } -void acquire_object(const sp& proc, +void release_object(const sp& proc, const flat_binder_object& obj, const void* who) { - acquire_object(proc, obj, who, NULL); -} - -static void release_object(const sp& proc, - const flat_binder_object& obj, const void* who, size_t* outAshmemSize) -{ switch (obj.type) { case BINDER_TYPE_BINDER: if (obj.binder) { LOG_REFS("Parcel %p releasing reference on local %p", who, obj.cookie); - reinterpret_cast(obj.cookie)->decStrong(who); + static_cast(obj.cookie)->decStrong(who); } return; case BINDER_TYPE_WEAK_BINDER: if (obj.binder) - reinterpret_cast(obj.binder)->decWeak(who); + static_cast(obj.binder)->decWeak(who); return; case BINDER_TYPE_HANDLE: { const sp b = proc->getStrongProxyForHandle(obj.handle); @@ -173,40 +134,25 @@ return; } case BINDER_TYPE_FD: { - if (outAshmemSize != NULL) { - if (obj.cookie != 0) { - int size = ashmem_get_size_region(obj.handle); - if (size > 0) { - *outAshmemSize -= size; - } - - close(obj.handle); - } - } + if (obj.cookie != (void*)0) close(obj.handle); return; } } - ALOGE("Invalid object type 0x%08x", obj.type); -} - -void release_object(const sp& proc, - const flat_binder_object& obj, const void* who) -{ - release_object(proc, obj, who, NULL); + ALOGE("Invalid object type 0x%08lx", obj.type); } inline static status_t finish_flatten_binder( - const sp& /*binder*/, const flat_binder_object& flat, Parcel* out) + const sp& binder, const flat_binder_object& flat, Parcel* out) { return out->writeObject(flat, false); } -status_t flatten_binder(const sp& /*proc*/, +status_t flatten_binder(const sp& proc, const sp& binder, Parcel* out) { flat_binder_object obj; - + obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; if (binder != NULL) { IBinder *local = binder->localBinder(); @@ -217,28 +163,27 @@ } const int32_t handle = proxy ? proxy->handle() : 0; obj.type = BINDER_TYPE_HANDLE; - obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */ obj.handle = handle; - obj.cookie = 0; + obj.cookie = NULL; } else { obj.type = BINDER_TYPE_BINDER; - obj.binder = reinterpret_cast(local->getWeakRefs()); - obj.cookie = reinterpret_cast(local); + obj.binder = local->getWeakRefs(); + obj.cookie = local; } } else { obj.type = BINDER_TYPE_BINDER; - obj.binder = 0; - obj.cookie = 0; + obj.binder = NULL; + obj.cookie = NULL; } - + return finish_flatten_binder(binder, obj, out); } -status_t flatten_binder(const sp& /*proc*/, +status_t flatten_binder(const sp& proc, const wp& binder, Parcel* out) { flat_binder_object obj; - + obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; if (binder != NULL) { sp real = binder.promote(); @@ -251,17 +196,16 @@ } const int32_t handle = proxy ? proxy->handle() : 0; obj.type = BINDER_TYPE_WEAK_HANDLE; - obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */ obj.handle = handle; - obj.cookie = 0; + obj.cookie = NULL; } else { obj.type = BINDER_TYPE_WEAK_BINDER; - obj.binder = reinterpret_cast(binder.get_refs()); - obj.cookie = reinterpret_cast(binder.unsafe_get()); + obj.binder = binder.get_refs(); + obj.cookie = binder.unsafe_get(); } return finish_flatten_binder(real, obj, out); } - + // XXX How to deal? In order to flatten the given binder, // we need to probe it for information, which requires a primary // reference... but we don't have one. @@ -271,40 +215,39 @@ // implementation we are using. ALOGE("Unable to unflatten Binder weak reference!"); obj.type = BINDER_TYPE_BINDER; - obj.binder = 0; - obj.cookie = 0; + obj.binder = NULL; + obj.cookie = NULL; return finish_flatten_binder(NULL, obj, out); - + } else { obj.type = BINDER_TYPE_BINDER; - obj.binder = 0; - obj.cookie = 0; + obj.binder = NULL; + obj.cookie = NULL; return finish_flatten_binder(NULL, obj, out); } } inline static status_t finish_unflatten_binder( - BpBinder* /*proxy*/, const flat_binder_object& /*flat*/, - const Parcel& /*in*/) + BpBinder* proxy, const flat_binder_object& flat, const Parcel& in) { return NO_ERROR; } - + status_t unflatten_binder(const sp& proc, const Parcel& in, sp* out) { const flat_binder_object* flat = in.readObject(false); - + if (flat) { switch (flat->type) { case BINDER_TYPE_BINDER: - *out = reinterpret_cast(flat->cookie); + *out = static_cast(flat->cookie); return finish_unflatten_binder(NULL, *flat, in); case BINDER_TYPE_HANDLE: *out = proc->getStrongProxyForHandle(flat->handle); return finish_unflatten_binder( static_cast(out->get()), *flat, in); - } + } } return BAD_TYPE; } @@ -313,17 +256,17 @@ const Parcel& in, wp* out) { const flat_binder_object* flat = in.readObject(false); - + if (flat) { switch (flat->type) { case BINDER_TYPE_BINDER: - *out = reinterpret_cast(flat->cookie); + *out = static_cast(flat->cookie); return finish_unflatten_binder(NULL, *flat, in); case BINDER_TYPE_WEAK_BINDER: - if (flat->binder != 0) { + if (flat->binder != NULL) { out->set_object_and_refs( - reinterpret_cast(flat->cookie), - reinterpret_cast(flat->binder)); + static_cast(flat->cookie), + static_cast(flat->binder)); } else { *out = NULL; } @@ -342,28 +285,12 @@ Parcel::Parcel() { - LOG_ALLOC("Parcel %p: constructing", this); initState(); } Parcel::~Parcel() { freeDataNoInit(); - LOG_ALLOC("Parcel %p: destroyed", this); -} - -size_t Parcel::getGlobalAllocSize() { - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - size_t size = gParcelGlobalAllocSize; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); - return size; -} - -size_t Parcel::getGlobalAllocCount() { - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - size_t count = gParcelGlobalAllocCount; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); - return count; } const uint8_t* Parcel::data() const @@ -399,53 +326,29 @@ status_t Parcel::setDataSize(size_t size) { - if (size > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - status_t err; err = continueWrite(size); if (err == NO_ERROR) { mDataSize = size; - ALOGV("setDataSize Setting data size of %p to %zu", this, mDataSize); + ALOGV("setDataSize Setting data size of %p to %d\n", this, mDataSize); } return err; } void Parcel::setDataPosition(size_t pos) const { - if (pos > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - abort(); - } - mDataPos = pos; mNextObjectHint = 0; } status_t Parcel::setDataCapacity(size_t size) { - if (size > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - if (size > mDataCapacity) return continueWrite(size); return NO_ERROR; } status_t Parcel::setData(const uint8_t* buffer, size_t len) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - status_t err = restartWrite(len); if (err == NO_ERROR) { memcpy(const_cast(data()), buffer, len); @@ -460,7 +363,7 @@ const sp proc(ProcessState::self()); status_t err; const uint8_t *data = parcel->mData; - const binder_size_t *objects = parcel->mObjects; + const size_t *objects = parcel->mObjects; size_t size = parcel->mObjectsSize; int startPos = mDataPos; int firstIndex = -1, lastIndex = -2; @@ -469,12 +372,6 @@ return NO_ERROR; } - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - // range checks against the source parcel size if ((offset > parcel->mDataSize) || (len > parcel->mDataSize) @@ -485,7 +382,7 @@ // Count objects in range for (int i = 0; i < (int) size; i++) { size_t off = objects[i]; - if ((off >= offset) && (off + sizeof(flat_binder_object) <= offset + len)) { + if ((off >= offset) && (off < offset + len)) { if (firstIndex == -1) { firstIndex = i; } @@ -512,17 +409,16 @@ if (numObjects > 0) { // grow objects if (mObjectsCapacity < mObjectsSize + numObjects) { - size_t newSize = ((mObjectsSize + numObjects)*3)/2; - if (newSize < mObjectsSize) return NO_MEMORY; // overflow - binder_size_t *objects = - (binder_size_t*)realloc(mObjects, newSize*sizeof(binder_size_t)); - if (objects == (binder_size_t*)0) { + int newSize = ((mObjectsSize + numObjects)*3)/2; + size_t *objects = + (size_t*)realloc(mObjects, newSize*sizeof(size_t)); + if (objects == (size_t*)0) { return NO_MEMORY; } mObjects = objects; mObjectsCapacity = newSize; } - + // append and acquire objects int idx = mObjectsSize; for (int i = firstIndex; i <= lastIndex; i++) { @@ -532,14 +428,14 @@ flat_binder_object* flat = reinterpret_cast(mData + off); - acquire_object(proc, *flat, this, &mOpenAshmemSize); + acquire_object(proc, *flat, this); if (flat->type == BINDER_TYPE_FD) { // If this is a file descriptor, we need to dup it so the // new Parcel now owns its own fd, and can declare that we // officially know we have fds. flat->handle = dup(flat->handle); - flat->cookie = 1; + flat->cookie = (void*)1; mHasFds = mFdsKnown = true; if (!mAllowFds) { err = FDS_NOT_ALLOWED; @@ -551,11 +447,6 @@ return err; } -bool Parcel::allowFds() const -{ - return mAllowFds; -} - bool Parcel::pushAllowFds(bool allowFds) { const bool origValue = mAllowFds; @@ -613,13 +504,13 @@ if (str == interface) { return true; } else { - ALOGW("**** enforceInterface() expected '%s' but read '%s'", + ALOGW("**** enforceInterface() expected '%s' but read '%s'\n", String8(interface).string(), String8(str).string()); return false; } } -const binder_size_t* Parcel::objects() const +const size_t* Parcel::objects() const { return mObjects; } @@ -641,18 +532,12 @@ status_t Parcel::finishWrite(size_t len) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - //printf("Finish write of %d\n", len); mDataPos += len; - ALOGV("finishWrite Setting data pos of %p to %zu", this, mDataPos); + ALOGV("finishWrite Setting data pos of %p to %d\n", this, mDataPos); if (mDataPos > mDataSize) { mDataSize = mDataPos; - ALOGV("finishWrite Setting data size of %p to %zu", this, mDataSize); + ALOGV("finishWrite Setting data size of %p to %d\n", this, mDataSize); } //printf("New pos=%d, size=%d\n", mDataPos, mDataSize); return NO_ERROR; @@ -660,12 +545,6 @@ status_t Parcel::writeUnpadded(const void* data, size_t len) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - size_t end = mDataPos + len; if (end < mDataPos) { // integer overflow @@ -685,12 +564,6 @@ status_t Parcel::write(const void* data, size_t len) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - void* const d = writeInplace(len); if (d) { memcpy(d, data, len); @@ -701,13 +574,7 @@ void* Parcel::writeInplace(size_t len) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return NULL; - } - - const size_t padded = pad_size(len); + const size_t padded = PAD_SIZE(len); // sanity check for integer overflow if (mDataPos+padded < mDataPos) { @@ -750,85 +617,26 @@ return writeAligned(val); } -status_t Parcel::writeUint32(uint32_t val) -{ - return writeAligned(val); -} - -status_t Parcel::writeInt32Array(size_t len, const int32_t *val) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - - if (!val) { - return writeInt32(-1); - } - status_t ret = writeInt32(static_cast(len)); - if (ret == NO_ERROR) { - ret = write(val, len * sizeof(*val)); - } - return ret; -} -status_t Parcel::writeByteArray(size_t len, const uint8_t *val) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - - if (!val) { - return writeInt32(-1); - } - status_t ret = writeInt32(static_cast(len)); - if (ret == NO_ERROR) { - ret = write(val, len * sizeof(*val)); - } - return ret; -} - status_t Parcel::writeInt64(int64_t val) { return writeAligned(val); } -status_t Parcel::writeUint64(uint64_t val) -{ - return writeAligned(val); -} - -status_t Parcel::writePointer(uintptr_t val) -{ - return writeAligned(val); -} - status_t Parcel::writeFloat(float val) { return writeAligned(val); } -#if defined(__mips__) && defined(__mips_hard_float) - status_t Parcel::writeDouble(double val) { - union { - double d; - unsigned long long ll; - } u; - u.d = val; - return writeAligned(u.ll); + return writeAligned(val); } -#else - -status_t Parcel::writeDouble(double val) +status_t Parcel::writeIntPtr(intptr_t val) { return writeAligned(val); } -#endif - status_t Parcel::writeCString(const char* str) { return write(str, strlen(str)+1); @@ -854,7 +662,7 @@ status_t Parcel::writeString16(const char16_t* str, size_t len) { if (str == NULL) return writeInt32(-1); - + status_t err = writeInt32(len); if (err == NO_ERROR) { len *= sizeof(char16_t); @@ -907,9 +715,8 @@ flat_binder_object obj; obj.type = BINDER_TYPE_FD; obj.flags = 0x7f | FLAT_BINDER_FLAG_ACCEPTS_FDS; - obj.binder = 0; /* Don't pass uninitialized stack data to a remote process */ obj.handle = fd; - obj.cookie = takeOwnership ? 1 : 0; + obj.cookie = (void*) (takeOwnership ? 1 : 0); return writeObject(obj, true); } @@ -926,24 +733,19 @@ return err; } -status_t Parcel::writeBlob(size_t len, bool mutableCopy, WritableBlob* outBlob) +status_t Parcel::writeBlob(size_t len, WritableBlob* outBlob) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - status_t status; - if (!mAllowFds || len <= BLOB_INPLACE_LIMIT) { + + if (!mAllowFds || len <= IN_PLACE_BLOB_LIMIT) { ALOGV("writeBlob: write in place"); - status = writeInt32(BLOB_INPLACE); + status = writeInt32(0); if (status) return status; void* ptr = writeInplace(len); if (!ptr) return NO_MEMORY; - outBlob->init(-1, ptr, len, false); + outBlob->init(false /*mapped*/, ptr, len); return NO_ERROR; } @@ -959,17 +761,15 @@ if (ptr == MAP_FAILED) { status = -errno; } else { - if (!mutableCopy) { - result = ashmem_set_prot_region(fd, PROT_READ); - } + result = ashmem_set_prot_region(fd, PROT_READ); if (result < 0) { status = result; } else { - status = writeInt32(mutableCopy ? BLOB_ASHMEM_MUTABLE : BLOB_ASHMEM_IMMUTABLE); + status = writeInt32(1); if (!status) { status = writeFileDescriptor(fd, true /*takeOwnership*/); if (!status) { - outBlob->init(fd, ptr, len, mutableCopy); + outBlob->init(true /*mapped*/, ptr, len); return NO_ERROR; } } @@ -981,28 +781,13 @@ return status; } -status_t Parcel::writeDupImmutableBlobFileDescriptor(int fd) -{ - // Must match up with what's done in writeBlob. - if (!mAllowFds) return FDS_NOT_ALLOWED; - status_t status = writeInt32(BLOB_ASHMEM_IMMUTABLE); - if (status) return status; - return writeDupFileDescriptor(fd); -} - -status_t Parcel::write(const FlattenableHelperInterface& val) +status_t Parcel::write(const Flattenable& val) { status_t err; // size if needed - const size_t len = val.getFlattenedSize(); - const size_t fd_count = val.getFdCount(); - - if ((len > INT32_MAX) || (fd_count > INT32_MAX)) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } + size_t len = val.getFlattenedSize(); + size_t fd_count = val.getFdCount(); err = this->writeInt32(len); if (err) return err; @@ -1011,7 +796,7 @@ if (err) return err; // payload - void* const buf = this->writeInplace(pad_size(len)); + void* buf = this->writeInplace(PAD_SIZE(len)); if (buf == NULL) return BAD_VALUE; @@ -1039,23 +824,22 @@ if (enoughData && enoughObjects) { restart_write: *reinterpret_cast(mData+mDataPos) = val; - + + // Need to write meta-data? + if (nullMetaData || val.binder != NULL) { + mObjects[mObjectsSize] = mDataPos; + acquire_object(ProcessState::self(), val, this); + mObjectsSize++; + } + // remember if it's a file descriptor if (val.type == BINDER_TYPE_FD) { if (!mAllowFds) { - // fail before modifying our object index return FDS_NOT_ALLOWED; } mHasFds = mFdsKnown = true; } - // Need to write meta-data? - if (nullMetaData || val.binder != 0) { - mObjects[mObjectsSize] = mDataPos; - acquire_object(ProcessState::self(), val, this, &mOpenAshmemSize); - mObjectsSize++; - } - return finishWrite(sizeof(flat_binder_object)); } @@ -1065,13 +849,12 @@ } if (!enoughObjects) { size_t newSize = ((mObjectsSize+2)*3)/2; - if (newSize < mObjectsSize) return NO_MEMORY; // overflow - binder_size_t* objects = (binder_size_t*)realloc(mObjects, newSize*sizeof(binder_size_t)); + size_t* objects = (size_t*)realloc(mObjects, newSize*sizeof(size_t)); if (objects == NULL) return NO_MEMORY; mObjects = objects; mObjectsCapacity = newSize; } - + goto restart_write; } @@ -1080,24 +863,17 @@ return writeInt32(0); } -void Parcel::remove(size_t /*start*/, size_t /*amt*/) +void Parcel::remove(size_t start, size_t amt) { LOG_ALWAYS_FATAL("Parcel::remove() not yet implemented!"); } status_t Parcel::read(void* outData, size_t len) const { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - - if ((mDataPos+pad_size(len)) >= mDataPos && (mDataPos+pad_size(len)) <= mDataSize - && len <= pad_size(len)) { + if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { memcpy(outData, mData+mDataPos, len); - mDataPos += pad_size(len); - ALOGV("read Setting data pos of %p to %zu", this, mDataPos); + mDataPos += PAD_SIZE(len); + ALOGV("read Setting data pos of %p to %d\n", this, mDataPos); return NO_ERROR; } return NOT_ENOUGH_DATA; @@ -1105,17 +881,10 @@ const void* Parcel::readInplace(size_t len) const { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return NULL; - } - - if ((mDataPos+pad_size(len)) >= mDataPos && (mDataPos+pad_size(len)) <= mDataSize - && len <= pad_size(len)) { + if ((mDataPos+PAD_SIZE(len)) >= mDataPos && (mDataPos+PAD_SIZE(len)) <= mDataSize) { const void* data = mData+mDataPos; - mDataPos += pad_size(len); - ALOGV("readInplace Setting data pos of %p to %zu", this, mDataPos); + mDataPos += PAD_SIZE(len); + ALOGV("readInplace Setting data pos of %p to %d\n", this, mDataPos); return data; } return NULL; @@ -1123,7 +892,7 @@ template status_t Parcel::readAligned(T *pArg) const { - COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE_UNSAFE(sizeof(T)) == sizeof(T)); + COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T)); if ((mDataPos+sizeof(T)) <= mDataSize) { const void* data = mData+mDataPos; @@ -1147,7 +916,7 @@ template status_t Parcel::writeAligned(T val) { - COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE_UNSAFE(sizeof(T)) == sizeof(T)); + COMPILE_TIME_ASSERT_FUNCTION_SCOPE(PAD_SIZE(sizeof(T)) == sizeof(T)); if ((mDataPos+sizeof(val)) <= mDataCapacity) { restart_write: @@ -1170,15 +939,6 @@ return readAligned(); } -status_t Parcel::readUint32(uint32_t *pArg) const -{ - return readAligned(pArg); -} - -uint32_t Parcel::readUint32() const -{ - return readAligned(); -} status_t Parcel::readInt64(int64_t *pArg) const { @@ -1191,32 +951,6 @@ return readAligned(); } -status_t Parcel::readUint64(uint64_t *pArg) const -{ - return readAligned(pArg); -} - -uint64_t Parcel::readUint64() const -{ - return readAligned(); -} - -status_t Parcel::readPointer(uintptr_t *pArg) const -{ - status_t ret; - binder_uintptr_t ptr; - ret = readAligned(&ptr); - if (!ret) - *pArg = ptr; - return ret; -} - -uintptr_t Parcel::readPointer() const -{ - return readAligned(); -} - - status_t Parcel::readFloat(float *pArg) const { return readAligned(pArg); @@ -1228,45 +962,17 @@ return readAligned(); } -#if defined(__mips__) && defined(__mips_hard_float) - -status_t Parcel::readDouble(double *pArg) const -{ - union { - double d; - unsigned long long ll; - } u; - u.d = 0; - status_t status; - status = readAligned(&u.ll); - *pArg = u.d; - return status; -} - -double Parcel::readDouble() const -{ - union { - double d; - unsigned long long ll; - } u; - u.ll = readAligned(); - return u.d; -} - -#else - status_t Parcel::readDouble(double *pArg) const { return readAligned(pArg); } + double Parcel::readDouble() const { return readAligned(); } -#endif - status_t Parcel::readIntPtr(intptr_t *pArg) const { return readAligned(pArg); @@ -1288,8 +994,8 @@ const char* eos = reinterpret_cast(memchr(str, 0, avail)); if (eos) { const size_t len = eos - str; - mDataPos += pad_size(len+1); - ALOGV("readCString Setting data pos of %p to %zu", this, mDataPos); + mDataPos += PAD_SIZE(len+1); + ALOGV("readCString Setting data pos of %p to %d\n", this, mDataPos); return str; } } @@ -1371,10 +1077,6 @@ if (err != NO_ERROR) return 0; native_handle* h = native_handle_create(numFds, numInts); - if (!h) { - return 0; - } - for (int i=0 ; err==NO_ERROR && idata[i] = dup(readFileDescriptor()); if (h->data[i] < 0) err = BAD_VALUE; @@ -1395,55 +1097,47 @@ if (flat) { switch (flat->type) { case BINDER_TYPE_FD: - //ALOGI("Returning file descriptor %ld from parcel %p", flat->handle, this); + //ALOGI("Returning file descriptor %ld from parcel %p\n", flat->handle, this); return flat->handle; - } + } } return BAD_TYPE; } status_t Parcel::readBlob(size_t len, ReadableBlob* outBlob) const { - int32_t blobType; - status_t status = readInt32(&blobType); + int32_t useAshmem; + status_t status = readInt32(&useAshmem); if (status) return status; - if (blobType == BLOB_INPLACE) { + if (!useAshmem) { ALOGV("readBlob: read in place"); const void* ptr = readInplace(len); if (!ptr) return BAD_VALUE; - outBlob->init(-1, const_cast(ptr), len, false); + outBlob->init(false /*mapped*/, const_cast(ptr), len); return NO_ERROR; } ALOGV("readBlob: read from ashmem"); - bool isMutable = (blobType == BLOB_ASHMEM_MUTABLE); int fd = readFileDescriptor(); if (fd == int(BAD_TYPE)) return BAD_VALUE; - void* ptr = ::mmap(NULL, len, isMutable ? PROT_READ | PROT_WRITE : PROT_READ, - MAP_SHARED, fd, 0); - if (ptr == MAP_FAILED) return NO_MEMORY; + void* ptr = ::mmap(NULL, len, PROT_READ, MAP_SHARED, fd, 0); + if (!ptr) return NO_MEMORY; - outBlob->init(fd, ptr, len, isMutable); + outBlob->init(true /*mapped*/, ptr, len); return NO_ERROR; } -status_t Parcel::read(FlattenableHelperInterface& val) const +status_t Parcel::read(Flattenable& val) const { // size const size_t len = this->readInt32(); const size_t fd_count = this->readInt32(); - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - // payload - void const* const buf = this->readInplace(pad_size(len)); + void const* buf = this->readInplace(PAD_SIZE(len)); if (buf == NULL) return BAD_VALUE; @@ -1455,11 +1149,7 @@ status_t err = NO_ERROR; for (size_t i=0 ; ireadFileDescriptor()); - if (fds[i] < 0) { - err = BAD_VALUE; - ALOGE("dup() failed in Parcel::read, i is %zu, fds[i] is %d, fd_count is %zu, error: %s", - i, fds[i], fd_count, strerror(errno)); - } + if (fds[i] < 0) err = BAD_VALUE; } if (err == NO_ERROR) { @@ -1479,23 +1169,23 @@ const flat_binder_object* obj = reinterpret_cast(mData+DPOS); mDataPos = DPOS + sizeof(flat_binder_object); - if (!nullMetaData && (obj->cookie == 0 && obj->binder == 0)) { + if (!nullMetaData && (obj->cookie == NULL && obj->binder == NULL)) { // When transferring a NULL object, we don't write it into // the object list, so we don't want to check for it when // reading. - ALOGV("readObject Setting data pos of %p to %zu", this, mDataPos); + ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } - + // Ensure that this object is valid... - binder_size_t* const OBJS = mObjects; + size_t* const OBJS = mObjects; const size_t N = mObjectsSize; size_t opos = mNextObjectHint; - + if (N > 0) { - ALOGV("Parcel %p looking for obj at %zu, hint=%zu", + ALOGV("Parcel %p looking for obj at %d, hint=%d\n", this, DPOS, opos); - + // Start at the current hint position, looking for an object at // the current data position. if (opos < N) { @@ -1507,27 +1197,27 @@ } if (OBJS[opos] == DPOS) { // Found it! - ALOGV("Parcel %p found obj %zu at index %zu with forward search", + ALOGV("Parcel found obj %d at index %d with forward search", this, DPOS, opos); mNextObjectHint = opos+1; - ALOGV("readObject Setting data pos of %p to %zu", this, mDataPos); + ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } - + // Look backwards for it... while (opos > 0 && OBJS[opos] > DPOS) { opos--; } if (OBJS[opos] == DPOS) { // Found it! - ALOGV("Parcel %p found obj %zu at index %zu with backward search", + ALOGV("Parcel found obj %d at index %d with backward search", this, DPOS, opos); mNextObjectHint = opos+1; - ALOGV("readObject Setting data pos of %p to %zu", this, mDataPos); + ALOGV("readObject Setting data pos of %p to %d\n", this, mDataPos); return obj; } } - ALOGW("Attempt to read object from Parcel %p at offset %zu that is not in the object list", + ALOGW("Attempt to read object from Parcel %p at offset %d that is not in the object list", this, DPOS); } return NULL; @@ -1537,22 +1227,22 @@ { size_t i = mObjectsSize; if (i > 0) { - //ALOGI("Closing file descriptors for %zu objects...", i); + //ALOGI("Closing file descriptors for %d objects...", mObjectsSize); } while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(mData+mObjects[i]); if (flat->type == BINDER_TYPE_FD) { - //ALOGI("Closing fd: %ld", flat->handle); + //ALOGI("Closing fd: %ld\n", flat->handle); close(flat->handle); } } } -uintptr_t Parcel::ipcData() const +const uint8_t* Parcel::ipcData() const { - return reinterpret_cast(mData); + return mData; } size_t Parcel::ipcDataSize() const @@ -1560,9 +1250,9 @@ return (mDataSize > mDataPos ? mDataSize : mDataPos); } -uintptr_t Parcel::ipcObjects() const +const size_t* Parcel::ipcObjects() const { - return reinterpret_cast(mObjects); + return mObjects; } size_t Parcel::ipcObjectsCount() const @@ -1571,45 +1261,34 @@ } void Parcel::ipcSetDataReference(const uint8_t* data, size_t dataSize, - const binder_size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie) + const size_t* objects, size_t objectsCount, release_func relFunc, void* relCookie) { - binder_size_t minOffset = 0; freeDataNoInit(); mError = NO_ERROR; mData = const_cast(data); mDataSize = mDataCapacity = dataSize; - //ALOGI("setDataReference Setting data size of %p to %lu (pid=%d)", this, mDataSize, getpid()); + //ALOGI("setDataReference Setting data size of %p to %lu (pid=%d)\n", this, mDataSize, getpid()); mDataPos = 0; - ALOGV("setDataReference Setting data pos of %p to %zu", this, mDataPos); - mObjects = const_cast(objects); + ALOGV("setDataReference Setting data pos of %p to %d\n", this, mDataPos); + mObjects = const_cast(objects); mObjectsSize = mObjectsCapacity = objectsCount; mNextObjectHint = 0; mOwner = relFunc; mOwnerCookie = relCookie; - for (size_t i = 0; i < mObjectsSize; i++) { - binder_size_t offset = mObjects[i]; - if (offset < minOffset) { - ALOGE("%s: bad object offset %" PRIu64 " < %" PRIu64 "\n", - __func__, (uint64_t)offset, (uint64_t)minOffset); - mObjectsSize = 0; - break; - } - minOffset = offset + sizeof(flat_binder_object); - } scanForFds(); } -void Parcel::print(TextOutput& to, uint32_t /*flags*/) const +void Parcel::print(TextOutput& to, uint32_t flags) const { to << "Parcel("; - + if (errorCheck() != NO_ERROR) { const status_t err = errorCheck(); - to << "Error: " << (void*)(intptr_t)err << " \"" << strerror(-err) << "\""; + to << "Error: " << (void*)err << " \"" << strerror(-err) << "\""; } else if (dataSize() > 0) { const uint8_t* DATA = data(); to << indent << HexDump(DATA, dataSize()) << dedent; - const binder_size_t* OBJS = objects(); + const size_t* OBJS = objects(); const size_t N = objectsCount(); for (size_t i=0; i proc(ProcessState::self()); size_t i = mObjectsSize; uint8_t* const data = mData; - binder_size_t* const objects = mObjects; + size_t* const objects = mObjects; while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(data+objects[i]); - release_object(proc, *flat, this, &mOpenAshmemSize); + release_object(proc, *flat, this); } } @@ -1644,12 +1323,12 @@ const sp proc(ProcessState::self()); size_t i = mObjectsSize; uint8_t* const data = mData; - binder_size_t* const objects = mObjects; + size_t* const objects = mObjects; while (i > 0) { i--; const flat_binder_object* flat = reinterpret_cast(data+objects[i]); - acquire_object(proc, *flat, this, &mOpenAshmemSize); + acquire_object(proc, *flat, this); } } @@ -1662,32 +1341,17 @@ void Parcel::freeDataNoInit() { if (mOwner) { - LOG_ALLOC("Parcel %p: freeing other owner data", this); - //ALOGI("Freeing data ref of %p (pid=%d)", this, getpid()); + //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); } else { - LOG_ALLOC("Parcel %p: freeing allocated data", this); releaseObjects(); - if (mData) { - LOG_ALLOC("Parcel %p: freeing with %zu capacity", this, mDataCapacity); - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - gParcelGlobalAllocSize -= mDataCapacity; - gParcelGlobalAllocCount--; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); - free(mData); - } + if (mData) free(mData); if (mObjects) free(mObjects); } } status_t Parcel::growData(size_t len) { - if (len > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - size_t newSize = ((mDataSize+len)*3)/2; return (newSize <= mDataSize) ? (status_t) NO_MEMORY @@ -1696,39 +1360,28 @@ status_t Parcel::restartWrite(size_t desired) { - if (desired > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - if (mOwner) { freeData(); return continueWrite(desired); } - + uint8_t* data = (uint8_t*)realloc(mData, desired); if (!data && desired > mDataCapacity) { mError = NO_MEMORY; return NO_MEMORY; } - + releaseObjects(); - + if (data) { - LOG_ALLOC("Parcel %p: restart from %zu to %zu capacity", this, mDataCapacity, desired); - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - gParcelGlobalAllocSize += desired; - gParcelGlobalAllocSize -= mDataCapacity; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); mData = data; mDataCapacity = desired; } - + mDataSize = mDataPos = 0; - ALOGV("restartWrite Setting data size of %p to %zu", this, mDataSize); - ALOGV("restartWrite Setting data pos of %p to %zu", this, mDataPos); - + ALOGV("restartWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("restartWrite Setting data pos of %p to %d\n", this, mDataPos); + free(mObjects); mObjects = NULL; mObjectsSize = mObjectsCapacity = 0; @@ -1736,18 +1389,12 @@ mHasFds = false; mFdsKnown = true; mAllowFds = true; - + return NO_ERROR; } status_t Parcel::continueWrite(size_t desired) { - if (desired > INT32_MAX) { - // don't accept size_t values which may have come from an - // inadvertent conversion from a negative int. - return BAD_VALUE; - } - // If shrinking, first adjust for any objects that appear // after the new data size. size_t objectsSize = mObjectsSize; @@ -1762,7 +1409,7 @@ } } } - + if (mOwner) { // If the size is going to zero, just release the owner's data. if (desired == 0) { @@ -1777,13 +1424,11 @@ mError = NO_MEMORY; return NO_MEMORY; } - binder_size_t* objects = NULL; - + size_t* objects = NULL; + if (objectsSize) { - objects = (binder_size_t*)calloc(objectsSize, sizeof(binder_size_t)); + objects = (size_t*)malloc(objectsSize*sizeof(size_t)); if (!objects) { - free(data); - mError = NO_MEMORY; return NO_MEMORY; } @@ -1795,27 +1440,21 @@ acquireObjects(); mObjectsSize = oldObjectsSize; } - + if (mData) { memcpy(data, mData, mDataSize < desired ? mDataSize : desired); } if (objects && mObjects) { - memcpy(objects, mObjects, objectsSize*sizeof(binder_size_t)); + memcpy(objects, mObjects, objectsSize*sizeof(size_t)); } - //ALOGI("Freeing data ref of %p (pid=%d)", this, getpid()); + //ALOGI("Freeing data ref of %p (pid=%d)\n", this, getpid()); mOwner(this, mData, mDataSize, mObjects, mObjectsSize, mOwnerCookie); mOwner = NULL; - LOG_ALLOC("Parcel %p: taking ownership of %zu capacity", this, desired); - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - gParcelGlobalAllocSize += desired; - gParcelGlobalAllocCount++; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); - mData = data; mObjects = objects; mDataSize = (mDataSize < desired) ? mDataSize : desired; - ALOGV("continueWrite Setting data size of %p to %zu", this, mDataSize); + ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); mDataCapacity = desired; mObjectsSize = mObjectsCapacity = objectsSize; mNextObjectHint = 0; @@ -1831,10 +1470,10 @@ // will need to rescan because we may have lopped off the only FDs mFdsKnown = false; } - release_object(proc, *flat, this, &mOpenAshmemSize); + release_object(proc, *flat, this); } - binder_size_t* objects = - (binder_size_t*)realloc(mObjects, objectsSize*sizeof(binder_size_t)); + size_t* objects = + (size_t*)realloc(mObjects, objectsSize*sizeof(size_t)); if (objects) { mObjects = objects; } @@ -1846,12 +1485,6 @@ if (desired > mDataCapacity) { uint8_t* data = (uint8_t*)realloc(mData, desired); if (data) { - LOG_ALLOC("Parcel %p: continue from %zu to %zu capacity", this, mDataCapacity, - desired); - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - gParcelGlobalAllocSize += desired; - gParcelGlobalAllocSize -= mDataCapacity; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); mData = data; mDataCapacity = desired; } else if (desired > mDataCapacity) { @@ -1861,14 +1494,14 @@ } else { if (mDataSize > desired) { mDataSize = desired; - ALOGV("continueWrite Setting data size of %p to %zu", this, mDataSize); + ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); } if (mDataPos > desired) { mDataPos = desired; - ALOGV("continueWrite Setting data pos of %p to %zu", this, mDataPos); + ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); } } - + } else { // This is the first data. Easy! uint8_t* data = (uint8_t*)malloc(desired); @@ -1876,22 +1509,16 @@ mError = NO_MEMORY; return NO_MEMORY; } - + if(!(mDataCapacity == 0 && mObjects == NULL && mObjectsCapacity == 0)) { - ALOGE("continueWrite: %zu/%p/%zu/%zu", mDataCapacity, mObjects, mObjectsCapacity, desired); + ALOGE("continueWrite: %d/%p/%d/%d", mDataCapacity, mObjects, mObjectsCapacity, desired); } - - LOG_ALLOC("Parcel %p: allocating with %zu capacity", this, desired); - pthread_mutex_lock(&gParcelGlobalAllocSizeLock); - gParcelGlobalAllocSize += desired; - gParcelGlobalAllocCount++; - pthread_mutex_unlock(&gParcelGlobalAllocSizeLock); - + mData = data; mDataSize = mDataPos = 0; - ALOGV("continueWrite Setting data size of %p to %zu", this, mDataSize); - ALOGV("continueWrite Setting data pos of %p to %zu", this, mDataPos); + ALOGV("continueWrite Setting data size of %p to %d\n", this, mDataSize); + ALOGV("continueWrite Setting data pos of %p to %d\n", this, mDataPos); mDataCapacity = desired; } @@ -1900,14 +1527,13 @@ void Parcel::initState() { - LOG_ALLOC("Parcel %p: initState", this); mError = NO_ERROR; mData = 0; mDataSize = 0; mDataCapacity = 0; mDataPos = 0; - ALOGV("initState Setting data size of %p to %zu", this, mDataSize); - ALOGV("initState Setting data pos of %p to %zu", this, mDataPos); + ALOGV("initState Setting data size of %p to %d\n", this, mDataSize); + ALOGV("initState Setting data pos of %p to %d\n", this, mDataPos); mObjects = NULL; mObjectsSize = 0; mObjectsCapacity = 0; @@ -1916,7 +1542,6 @@ mFdsKnown = true; mAllowFds = true; mOwner = NULL; - mOpenAshmemSize = 0; } void Parcel::scanForFds() const @@ -1934,23 +1559,10 @@ mFdsKnown = true; } -size_t Parcel::getBlobAshmemSize() const -{ - // This used to return the size of all blobs that were written to ashmem, now we're returning - // the ashmem currently referenced by this Parcel, which should be equivalent. - // TODO: Remove method once ABI can be changed. - return mOpenAshmemSize; -} - -size_t Parcel::getOpenAshmemSize() const -{ - return mOpenAshmemSize; -} - // --- Parcel::Blob --- Parcel::Blob::Blob() : - mFd(-1), mData(NULL), mSize(0), mMutable(false) { + mMapped(false), mData(NULL), mSize(0) { } Parcel::Blob::~Blob() { @@ -1958,24 +1570,22 @@ } void Parcel::Blob::release() { - if (mFd != -1 && mData) { + if (mMapped && mData) { ::munmap(mData, mSize); } clear(); } -void Parcel::Blob::init(int fd, void* data, size_t size, bool isMutable) { - mFd = fd; +void Parcel::Blob::init(bool mapped, void* data, size_t size) { + mMapped = mapped; mData = data; mSize = size; - mMutable = isMutable; } void Parcel::Blob::clear() { - mFd = -1; + mMapped = false; mData = NULL; mSize = 0; - mMutable = false; } }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/ProcessInfoService.cpp android-platform-frameworks-native-21/libs/binder/ProcessInfoService.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/ProcessInfoService.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/ProcessInfoService.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright 2015 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 -#include - -#include -#include - -namespace android { - -ProcessInfoService::ProcessInfoService() { - updateBinderLocked(); -} - -status_t ProcessInfoService::getProcessStatesImpl(size_t length, /*in*/ int32_t* pids, - /*out*/ int32_t* states) { - status_t err = NO_ERROR; - sp pis; - mProcessInfoLock.lock(); - pis = mProcessInfoService; - mProcessInfoLock.unlock(); - - for (int i = 0; i < BINDER_ATTEMPT_LIMIT; i++) { - - if (pis != NULL) { - err = pis->getProcessStatesFromPids(length, /*in*/ pids, /*out*/ states); - if (err == NO_ERROR) return NO_ERROR; // success - if (IInterface::asBinder(pis)->isBinderAlive()) return err; - } - sleep(1); - - mProcessInfoLock.lock(); - if (pis == mProcessInfoService) { - updateBinderLocked(); - } - pis = mProcessInfoService; - mProcessInfoLock.unlock(); - } - - ALOGW("%s: Could not retrieve process states from ProcessInfoService after %d retries.", - __FUNCTION__, BINDER_ATTEMPT_LIMIT); - - return TIMED_OUT; -} - -void ProcessInfoService::updateBinderLocked() { - const sp sm(defaultServiceManager()); - if (sm != NULL) { - const String16 name("processinfo"); - mProcessInfoService = interface_cast(sm->checkService(name)); - } -} - -ANDROID_SINGLETON_STATIC_INSTANCE(ProcessInfoService); - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/ProcessState.cpp android-platform-frameworks-native-21/libs/binder/ProcessState.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/ProcessState.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/ProcessState.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -42,12 +42,16 @@ #include #define BINDER_VM_SIZE ((1*1024*1024) - (4096 *2)) -#define DEFAULT_MAX_BINDER_THREADS 15 // --------------------------------------------------------------------------- namespace android { + +// Global variables +int mArgC; +const char* const* mArgV; +int mArgLen; class PoolThread : public Thread { @@ -82,7 +86,7 @@ setContextObject(object, String16("default")); } -sp ProcessState::getContextObject(const sp& /*caller*/) +sp ProcessState::getContextObject(const sp& caller) { return getStrongProxyForHandle(0); } @@ -190,33 +194,6 @@ // in getWeakProxyForHandle() for more info about this. IBinder* b = e->binder; if (b == NULL || !e->refs->attemptIncWeak(this)) { - if (handle == 0) { - // Special case for context manager... - // The context manager is the only object for which we create - // a BpBinder proxy without already holding a reference. - // Perform a dummy transaction to ensure the context manager - // is registered before we create the first local reference - // to it (which will occur when creating the BpBinder). - // If a local reference is created for the BpBinder when the - // context manager is not present, the driver will fail to - // provide a reference to the context manager, but the - // driver API does not return status. - // - // Note that this is not race-free if the context manager - // dies while this code runs. - // - // TODO: add a driver API to wait for context manager, or - // stop special casing handle 0 for context manager and add - // a driver API to get a handle to the context manager with - // proper reference counting. - - Parcel data; - status_t status = IPCThreadState::self()->transact( - 0, IBinder::PING_TRANSACTION, data, NULL, 0); - if (status == DEAD_OBJECT) - return NULL; - } - b = new BpBinder(handle); e->binder = b; if (b) e->refs = b->getWeakRefs(); @@ -276,44 +253,63 @@ if (e && e->binder == binder) e->binder = NULL; } -String8 ProcessState::makeBinderThreadName() { - int32_t s = android_atomic_add(1, &mThreadPoolSeq); - String8 name; - name.appendFormat("Binder_%X", s); - return name; +void ProcessState::setArgs(int argc, const char* const argv[]) +{ + mArgC = argc; + mArgV = (const char **)argv; + + mArgLen = 0; + for (int i=0; i t = new PoolThread(isMain); - t->run(name.string()); + t->run(buf); } } status_t ProcessState::setThreadPoolMaxThreadCount(size_t maxThreads) { status_t result = NO_ERROR; - if (ioctl(mDriverFD, BINDER_SET_MAX_THREADS, &maxThreads) != -1) { - mMaxThreads = maxThreads; - } else { + if (ioctl(mDriverFD, BINDER_SET_MAX_THREADS, &maxThreads) == -1) { result = -errno; ALOGE("Binder ioctl to set max threads failed: %s", strerror(-result)); } return result; } -void ProcessState::giveThreadPoolName() { - androidSetThreadName( makeBinderThreadName().string() ); -} - static int open_driver() { int fd = open("/dev/binder", O_RDWR); if (fd >= 0) { fcntl(fd, F_SETFD, FD_CLOEXEC); - int vers = 0; + int vers; status_t result = ioctl(fd, BINDER_VERSION, &vers); if (result == -1) { ALOGE("Binder ioctl to obtain version failed: %s", strerror(errno)); @@ -325,7 +321,7 @@ close(fd); fd = -1; } - size_t maxThreads = DEFAULT_MAX_BINDER_THREADS; + size_t maxThreads = 15; result = ioctl(fd, BINDER_SET_MAX_THREADS, &maxThreads); if (result == -1) { ALOGE("Binder ioctl to set max threads failed: %s", strerror(errno)); @@ -339,10 +335,6 @@ ProcessState::ProcessState() : mDriverFD(open_driver()) , mVMStart(MAP_FAILED) - , mThreadCountLock(PTHREAD_MUTEX_INITIALIZER) - , mThreadCountDecrement(PTHREAD_COND_INITIALIZER) - , mExecutingThreadsCount(0) - , mMaxThreads(DEFAULT_MAX_BINDER_THREADS) , mManagesContexts(false) , mBinderContextCheckFunc(NULL) , mBinderContextUserData(NULL) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/Static.cpp android-platform-frameworks-native-21/libs/binder/Static.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/Static.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/Static.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -19,78 +19,32 @@ #include -#include #include #include namespace android { -// ------------ Text output streams - -Vector gTextBuffers; - -class LogTextOutput : public BufferedTextOutput -{ -public: - LogTextOutput() : BufferedTextOutput(MULTITHREADED) { } - virtual ~LogTextOutput() { }; - -protected: - virtual status_t writeLines(const struct iovec& vec, size_t N) - { - //android_writevLog(&vec, N); <-- this is now a no-op - if (N != 1) ALOGI("WARNING: writeLines N=%zu\n", N); - ALOGI("%.*s", (int)vec.iov_len, (const char*) vec.iov_base); - return NO_ERROR; - } -}; - -class FdTextOutput : public BufferedTextOutput -{ -public: - FdTextOutput(int fd) : BufferedTextOutput(MULTITHREADED), mFD(fd) { } - virtual ~FdTextOutput() { }; - -protected: - virtual status_t writeLines(const struct iovec& vec, size_t N) - { - writev(mFD, &vec, N); - return NO_ERROR; - } - -private: - int mFD; -}; - -static LogTextOutput gLogTextOutput; -static FdTextOutput gStdoutTextOutput(STDOUT_FILENO); -static FdTextOutput gStderrTextOutput(STDERR_FILENO); - -TextOutput& alog(gLogTextOutput); -TextOutput& aout(gStdoutTextOutput); -TextOutput& aerr(gStderrTextOutput); - // ------------ ProcessState.cpp Mutex gProcessMutex; sp gProcess; -class LibBinderIPCtStatics +class LibUtilsIPCtStatics { public: - LibBinderIPCtStatics() + LibUtilsIPCtStatics() { } - ~LibBinderIPCtStatics() + ~LibUtilsIPCtStatics() { IPCThreadState::shutdown(); } }; -static LibBinderIPCtStatics gIPCStatics; +static LibUtilsIPCtStatics gIPCStatics; -// ------------ IServiceManager.cpp +// ------------ ServiceManager.cpp Mutex gDefaultServiceManagerLock; sp gDefaultServiceManager; diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/tests/Android.mk android-platform-frameworks-native-21/libs/binder/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/binder/tests/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,34 +0,0 @@ -# -# Copyright (C) 2014 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. -# - -LOCAL_PATH:= $(call my-dir) - -include $(CLEAR_VARS) -ifneq ($(TARGET_USES_64_BIT_BINDER),true) -ifneq ($(TARGET_IS_64_BIT),true) -LOCAL_CFLAGS += -DBINDER_IPC_32BIT=1 -endif -endif - -LOCAL_MODULE := binderDriverInterfaceTest -LOCAL_SRC_FILES := binderDriverInterfaceTest.cpp -include $(BUILD_NATIVE_TEST) - -include $(CLEAR_VARS) -LOCAL_MODULE := binderLibTest -LOCAL_SRC_FILES := binderLibTest.cpp -LOCAL_SHARED_LIBRARIES := libbinder libutils -include $(BUILD_NATIVE_TEST) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/tests/binderDriverInterfaceTest.cpp android-platform-frameworks-native-21/libs/binder/tests/binderDriverInterfaceTest.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/tests/binderDriverInterfaceTest.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/tests/binderDriverInterfaceTest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,353 +0,0 @@ -/* - * Copyright (C) 2014 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 -#include -#include -#include - -#include -#include -#include -#include -#include - -#define BINDER_DEV_NAME "/dev/binder" - -testing::Environment* binder_env; - -class BinderDriverInterfaceTestEnv : public ::testing::Environment { - virtual void SetUp() { - int ret; - uint32_t max_threads = 0; - - m_binderFd = open(BINDER_DEV_NAME, O_RDWR | O_NONBLOCK); - ASSERT_GE(m_binderFd, 0); - m_buffer = mmap(NULL, 64*1024, PROT_READ, MAP_SHARED, m_binderFd, 0); - ASSERT_NE(m_buffer, (void *)NULL); - ret = ioctl(m_binderFd, BINDER_SET_MAX_THREADS, &max_threads); - EXPECT_EQ(0, ret); - EnterLooper(); - } - virtual void TearDown() { - close(m_binderFd); - } - private: - int m_binderFd; - void *m_buffer; - public: - int getBinderFd(void) { - return m_binderFd; - } - void EnterLooper(void) { - int ret; - const uint32_t bc[] = { - BC_ENTER_LOOPER, - }; - struct binder_write_read bwr = binder_write_read(); - bwr.write_buffer = (uintptr_t)bc; - bwr.write_size = sizeof(bc); - ret = ioctl(m_binderFd, BINDER_WRITE_READ, &bwr); - EXPECT_EQ(0, ret); - if (ret < 0) { - EXPECT_EQ(0, errno); - } - EXPECT_EQ(sizeof(bc), bwr.write_consumed); - } -}; - -class BinderDriverInterfaceTest : public ::testing::Test { - public: - virtual void SetUp() { - m_binderFd = static_cast(binder_env)->getBinderFd(); - } - virtual void TearDown() { - } - protected: - void binderTestIoctlRetErr2(int cmd, void *arg, int expect_ret, int expect_errno, int accept_errno) { - int ret; - - ret = ioctl(m_binderFd, cmd, arg); - EXPECT_EQ(expect_ret, ret); - if (ret < 0) { - if (errno != accept_errno) - EXPECT_EQ(expect_errno, errno); - } - } - void binderTestIoctlErr2(int cmd, void *arg, int expect_errno, int accept_errno) { - binderTestIoctlRetErr2(cmd, arg, -1, expect_errno, accept_errno); - } - void binderTestIoctlErr1(int cmd, void *arg, int expect_errno) { - binderTestIoctlErr2(cmd, arg, expect_errno, expect_errno); - } - void binderTestIoctl(int cmd, void *arg) { - binderTestIoctlRetErr2(cmd, arg, 0, 0, 0); - } - void binderTestIoctlUnimplemented(int cmd, void *arg) { - int ret; - - ret = ioctl(m_binderFd, cmd, arg); - if (ret < 0) { - /* Not currently implmented. Allow ret == -1, errno == EINVAL */ - EXPECT_EQ(-1, ret); - EXPECT_EQ(EINVAL, errno); - } - } - void binderTestReadEmpty(void) { - size_t i; - uint32_t br[32]; - struct binder_write_read bwr = binder_write_read(); - SCOPED_TRACE("TestReadEmpty"); - bwr.read_buffer = (uintptr_t)br; - bwr.read_size = sizeof(br); - binderTestIoctlErr1(BINDER_WRITE_READ, &bwr, EAGAIN); - EXPECT_EQ(0u, bwr.read_consumed); - for (i = 0; i * sizeof(uint32_t) < bwr.read_consumed; i++) { - SCOPED_TRACE(testing::Message() << "i = " << i); - EXPECT_EQ(BR_NOOP, br[i]); - } - } - void binderWaitForReadData(int timeout_ms) { - int ret; - pollfd pfd = pollfd(); - - pfd.fd = m_binderFd; - pfd.events = POLLIN; - ret = poll(&pfd, 1, timeout_ms); - EXPECT_EQ(1, ret); - } - private: - int m_binderFd; -}; - -TEST_F(BinderDriverInterfaceTest, Version) { - struct binder_version version; - binderTestIoctl(BINDER_VERSION, &version); - ASSERT_EQ(BINDER_CURRENT_PROTOCOL_VERSION, version.protocol_version); -} - -TEST_F(BinderDriverInterfaceTest, WriteReadNull) { - binderTestIoctlErr1(BINDER_WRITE_READ, NULL, EFAULT); -} - -TEST_F(BinderDriverInterfaceTest, SetIdleTimeoutNull) { - binderTestIoctlErr2(BINDER_SET_IDLE_TIMEOUT, NULL, EFAULT, EINVAL); -} - -TEST_F(BinderDriverInterfaceTest, SetMaxThreadsNull) { - binderTestIoctlErr2(BINDER_SET_MAX_THREADS, NULL, EFAULT, EINVAL); /* TODO: don't accept EINVAL */ -} - -TEST_F(BinderDriverInterfaceTest, SetIdlePriorityNull) { - binderTestIoctlErr2(BINDER_SET_IDLE_PRIORITY, NULL, EFAULT, EINVAL); -} - -TEST_F(BinderDriverInterfaceTest, VersionNull) { - binderTestIoctlErr2(BINDER_VERSION, NULL, EFAULT, EINVAL); /* TODO: don't accept EINVAL */ -} - -TEST_F(BinderDriverInterfaceTest, SetIdleTimeoutNoTest) { - int64_t idle_timeout = 100000; - binderTestIoctlUnimplemented(BINDER_SET_IDLE_TIMEOUT, &idle_timeout); -} - -TEST_F(BinderDriverInterfaceTest, SetMaxThreads) { - uint32_t max_threads = 0; - binderTestIoctl(BINDER_SET_MAX_THREADS, &max_threads); -} - -TEST_F(BinderDriverInterfaceTest, SetIdlePriorityNoTest) { - int idle_priority = 0; - binderTestIoctlUnimplemented(BINDER_SET_IDLE_PRIORITY, &idle_priority); -} - -TEST_F(BinderDriverInterfaceTest, SetContextMgrBusy) { - int32_t dummy = 0; - binderTestIoctlErr1(BINDER_SET_CONTEXT_MGR, &dummy, EBUSY); -} - -TEST_F(BinderDriverInterfaceTest, ThreadExit) { - int32_t dummy = 0; - binderTestIoctl(BINDER_THREAD_EXIT, &dummy); - static_cast(binder_env)->EnterLooper(); -} - -TEST_F(BinderDriverInterfaceTest, WriteReadEmpty) { - struct binder_write_read bwr = binder_write_read(); - binderTestIoctl(BINDER_WRITE_READ, &bwr); -} - -TEST_F(BinderDriverInterfaceTest, Read) { - binderTestReadEmpty(); -} - -TEST_F(BinderDriverInterfaceTest, IncRefsAcquireReleaseDecRefs) { - const uint32_t bc[] = { - BC_INCREFS, - 0, - BC_ACQUIRE, - 0, - BC_RELEASE, - 0, - BC_DECREFS, - 0, - }; - struct binder_write_read bwr = binder_write_read(); - bwr.write_buffer = (uintptr_t)bc; - bwr.write_size = sizeof(bc); - binderTestIoctl(BINDER_WRITE_READ, &bwr); - EXPECT_EQ(sizeof(bc), bwr.write_consumed); - binderTestReadEmpty(); -} - -TEST_F(BinderDriverInterfaceTest, Transaction) { - binder_uintptr_t cookie = 1234; - struct { - uint32_t cmd1; - struct binder_transaction_data arg1; - } __attribute__((packed)) bc1 = { - .cmd1 = BC_TRANSACTION, - .arg1 = { - .target = { 0 }, - .cookie = 0, - .code = android::IBinder::PING_TRANSACTION, - .flags = 0, - .sender_pid = 0, - .sender_euid = 0, - .data_size = 0, - .offsets_size = 0, - .data = {0, 0}, - }, - }; - struct { - uint32_t cmd0; - uint32_t cmd1; - uint32_t cmd2; - binder_transaction_data arg2; - uint32_t pad[16]; - } __attribute__((packed)) br; - struct binder_write_read bwr = binder_write_read(); - - bwr.write_buffer = (uintptr_t)&bc1; - bwr.write_size = sizeof(bc1); - bwr.read_buffer = (uintptr_t)&br; - bwr.read_size = sizeof(br); - - { - SCOPED_TRACE("1st WriteRead"); - binderTestIoctl(BINDER_WRITE_READ, &bwr); - } - EXPECT_EQ(sizeof(bc1), bwr.write_consumed); - if (bwr.read_consumed < offsetof(typeof(br), pad)) { - SCOPED_TRACE("2nd WriteRead"); - binderWaitForReadData(10000); - binderTestIoctl(BINDER_WRITE_READ, &bwr); - } - EXPECT_EQ(offsetof(typeof(br), pad), bwr.read_consumed); - if (bwr.read_consumed > offsetof(typeof(br), cmd0)) - EXPECT_EQ(BR_NOOP, br.cmd0); - if (bwr.read_consumed > offsetof(typeof(br), cmd1)) - EXPECT_EQ(BR_TRANSACTION_COMPLETE, br.cmd1); - if (bwr.read_consumed > offsetof(typeof(br), cmd2)) - EXPECT_EQ(BR_REPLY, br.cmd2); - if (bwr.read_consumed >= offsetof(typeof(br), pad)) { - EXPECT_EQ(0u, br.arg2.target.ptr); - EXPECT_EQ(0u, br.arg2.cookie); - EXPECT_EQ(0u, br.arg2.code); - EXPECT_EQ(0u, br.arg2.flags); - EXPECT_EQ(0u, br.arg2.data_size); - EXPECT_EQ(0u, br.arg2.offsets_size); - - SCOPED_TRACE("3rd WriteRead"); - - binderTestReadEmpty(); - - struct { - uint32_t cmd1; - binder_uintptr_t arg1; - } __attribute__((packed)) bc2 = { - .cmd1 = BC_FREE_BUFFER, - .arg1 = br.arg2.data.ptr.buffer, - }; - - bwr.write_buffer = (uintptr_t)&bc2; - bwr.write_size = sizeof(bc2); - bwr.write_consumed = 0; - bwr.read_size = 0; - - binderTestIoctl(BINDER_WRITE_READ, &bwr); - EXPECT_EQ(sizeof(bc2), bwr.write_consumed); - } - binderTestReadEmpty(); -} - -TEST_F(BinderDriverInterfaceTest, RequestDeathNotification) { - binder_uintptr_t cookie = 1234; - struct { - uint32_t cmd0; - uint32_t arg0; - uint32_t cmd1; - struct binder_handle_cookie arg1; - uint32_t cmd2; - struct binder_handle_cookie arg2; - uint32_t cmd3; - uint32_t arg3; - } __attribute__((packed)) bc = { - .cmd0 = BC_INCREFS, - .arg0 = 0, - .cmd1 = BC_REQUEST_DEATH_NOTIFICATION, - .arg1 = { - .handle = 0, - .cookie = cookie, - }, - .cmd2 = BC_CLEAR_DEATH_NOTIFICATION, - .arg2 = { - .handle = 0, - .cookie = cookie, - }, - .cmd3 = BC_DECREFS, - .arg3 = 0, - }; - struct { - uint32_t cmd0; - uint32_t cmd1; - binder_uintptr_t arg1; - uint32_t pad[16]; - } __attribute__((packed)) br; - struct binder_write_read bwr = binder_write_read(); - - bwr.write_buffer = (uintptr_t)&bc; - bwr.write_size = sizeof(bc); - bwr.read_buffer = (uintptr_t)&br; - bwr.read_size = sizeof(br); - - binderTestIoctl(BINDER_WRITE_READ, &bwr); - EXPECT_EQ(sizeof(bc), bwr.write_consumed); - EXPECT_EQ(sizeof(br) - sizeof(br.pad), bwr.read_consumed); - EXPECT_EQ(BR_NOOP, br.cmd0); - EXPECT_EQ(BR_CLEAR_DEATH_NOTIFICATION_DONE, br.cmd1); - EXPECT_EQ(cookie, br.arg1); - binderTestReadEmpty(); -} - -int main(int argc, char **argv) { - ::testing::InitGoogleTest(&argc, argv); - - binder_env = AddGlobalTestEnvironment(new BinderDriverInterfaceTestEnv()); - - return RUN_ALL_TESTS(); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/tests/binderLibTest.cpp android-platform-frameworks-native-21/libs/binder/tests/binderLibTest.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/tests/binderLibTest.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/tests/binderLibTest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,954 +0,0 @@ -/* - * Copyright (C) 2014 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 -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#define ARRAY_SIZE(array) (sizeof array / sizeof array[0]) - -using namespace android; - -static testing::Environment* binder_env; -static char *binderservername; -static char binderserverarg[] = "--binderserver"; - -static String16 binderLibTestServiceName = String16("test.binderLib"); - -enum BinderLibTestTranscationCode { - BINDER_LIB_TEST_NOP_TRANSACTION = IBinder::FIRST_CALL_TRANSACTION, - BINDER_LIB_TEST_REGISTER_SERVER, - BINDER_LIB_TEST_ADD_SERVER, - BINDER_LIB_TEST_CALL_BACK, - BINDER_LIB_TEST_NOP_CALL_BACK, - BINDER_LIB_TEST_GET_ID_TRANSACTION, - BINDER_LIB_TEST_INDIRECT_TRANSACTION, - BINDER_LIB_TEST_SET_ERROR_TRANSACTION, - BINDER_LIB_TEST_GET_STATUS_TRANSACTION, - BINDER_LIB_TEST_ADD_STRONG_REF_TRANSACTION, - BINDER_LIB_TEST_LINK_DEATH_TRANSACTION, - BINDER_LIB_TEST_WRITE_FILE_TRANSACTION, - BINDER_LIB_TEST_PROMOTE_WEAK_REF_TRANSACTION, - BINDER_LIB_TEST_EXIT_TRANSACTION, - BINDER_LIB_TEST_DELAYED_EXIT_TRANSACTION, - BINDER_LIB_TEST_GET_PTR_SIZE_TRANSACTION, -}; - -pid_t start_server_process(int arg2) -{ - int ret; - pid_t pid; - status_t status; - int pipefd[2]; - char stri[16]; - char strpipefd1[16]; - char *childargv[] = { - binderservername, - binderserverarg, - stri, - strpipefd1, - NULL - }; - - ret = pipe(pipefd); - if (ret < 0) - return ret; - - snprintf(stri, sizeof(stri), "%d", arg2); - snprintf(strpipefd1, sizeof(strpipefd1), "%d", pipefd[1]); - - pid = fork(); - if (pid == -1) - return pid; - if (pid == 0) { - close(pipefd[0]); - execv(binderservername, childargv); - status = -errno; - write(pipefd[1], &status, sizeof(status)); - fprintf(stderr, "execv failed, %s\n", strerror(errno)); - _exit(EXIT_FAILURE); - } - close(pipefd[1]); - ret = read(pipefd[0], &status, sizeof(status)); - //printf("pipe read returned %d, status %d\n", ret, status); - close(pipefd[0]); - if (ret == sizeof(status)) { - ret = status; - } else { - kill(pid, SIGKILL); - if (ret >= 0) { - ret = NO_INIT; - } - } - if (ret < 0) { - wait(NULL); - return ret; - } - return pid; -} - -class BinderLibTestEnv : public ::testing::Environment { - public: - BinderLibTestEnv() {} - sp getServer(void) { - return m_server; - } - - private: - virtual void SetUp() { - m_serverpid = start_server_process(0); - //printf("m_serverpid %d\n", m_serverpid); - ASSERT_GT(m_serverpid, 0); - - sp sm = defaultServiceManager(); - //printf("%s: pid %d, get service\n", __func__, m_pid); - m_server = sm->getService(binderLibTestServiceName); - ASSERT_TRUE(m_server != NULL); - //printf("%s: pid %d, get service done\n", __func__, m_pid); - } - virtual void TearDown() { - status_t ret; - Parcel data, reply; - int exitStatus; - pid_t pid; - - //printf("%s: pid %d\n", __func__, m_pid); - if (m_server != NULL) { - ret = m_server->transact(BINDER_LIB_TEST_GET_STATUS_TRANSACTION, data, &reply); - EXPECT_EQ(0, ret); - ret = m_server->transact(BINDER_LIB_TEST_EXIT_TRANSACTION, data, &reply, TF_ONE_WAY); - EXPECT_EQ(0, ret); - } - if (m_serverpid > 0) { - //printf("wait for %d\n", m_pids[i]); - pid = wait(&exitStatus); - EXPECT_EQ(m_serverpid, pid); - EXPECT_TRUE(WIFEXITED(exitStatus)); - EXPECT_EQ(0, WEXITSTATUS(exitStatus)); - } - } - - pid_t m_serverpid; - sp m_server; -}; - -class BinderLibTest : public ::testing::Test { - public: - virtual void SetUp() { - m_server = static_cast(binder_env)->getServer(); - } - virtual void TearDown() { - } - protected: - sp addServer(int32_t *idPtr = NULL) - { - int ret; - int32_t id; - Parcel data, reply; - sp binder; - - ret = m_server->transact(BINDER_LIB_TEST_ADD_SERVER, data, &reply); - EXPECT_EQ(NO_ERROR, ret); - - EXPECT_FALSE(binder != NULL); - binder = reply.readStrongBinder(); - EXPECT_TRUE(binder != NULL); - ret = reply.readInt32(&id); - EXPECT_EQ(NO_ERROR, ret); - if (idPtr) - *idPtr = id; - return binder; - } - void waitForReadData(int fd, int timeout_ms) { - int ret; - pollfd pfd = pollfd(); - - pfd.fd = fd; - pfd.events = POLLIN; - ret = poll(&pfd, 1, timeout_ms); - EXPECT_EQ(1, ret); - } - - sp m_server; -}; - -class BinderLibTestBundle : public Parcel -{ - public: - BinderLibTestBundle(void) {} - BinderLibTestBundle(const Parcel *source) : m_isValid(false) { - int32_t mark; - int32_t bundleLen; - size_t pos; - - if (source->readInt32(&mark)) - return; - if (mark != MARK_START) - return; - if (source->readInt32(&bundleLen)) - return; - pos = source->dataPosition(); - if (Parcel::appendFrom(source, pos, bundleLen)) - return; - source->setDataPosition(pos + bundleLen); - if (source->readInt32(&mark)) - return; - if (mark != MARK_END) - return; - m_isValid = true; - setDataPosition(0); - } - void appendTo(Parcel *dest) { - dest->writeInt32(MARK_START); - dest->writeInt32(dataSize()); - dest->appendFrom(this, 0, dataSize()); - dest->writeInt32(MARK_END); - }; - bool isValid(void) { - return m_isValid; - } - private: - enum { - MARK_START = B_PACK_CHARS('B','T','B','S'), - MARK_END = B_PACK_CHARS('B','T','B','E'), - }; - bool m_isValid; -}; - -class BinderLibTestEvent -{ - public: - BinderLibTestEvent(void) - : m_eventTriggered(false) - { - pthread_mutex_init(&m_waitMutex, NULL); - pthread_cond_init(&m_waitCond, NULL); - } - int waitEvent(int timeout_s) - { - int ret; - pthread_mutex_lock(&m_waitMutex); - if (!m_eventTriggered) { -#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE) - pthread_cond_timeout_np(&m_waitCond, &m_waitMutex, timeout_s * 1000); -#else - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += timeout_s; - pthread_cond_timedwait(&m_waitCond, &m_waitMutex, &ts); -#endif - } - ret = m_eventTriggered ? NO_ERROR : TIMED_OUT; - pthread_mutex_unlock(&m_waitMutex); - return ret; - } - protected: - void triggerEvent(void) { - pthread_mutex_lock(&m_waitMutex); - pthread_cond_signal(&m_waitCond); - m_eventTriggered = true; - pthread_mutex_unlock(&m_waitMutex); - }; - private: - pthread_mutex_t m_waitMutex; - pthread_cond_t m_waitCond; - bool m_eventTriggered; -}; - -class BinderLibTestCallBack : public BBinder, public BinderLibTestEvent -{ - public: - BinderLibTestCallBack() - : m_result(NOT_ENOUGH_DATA) - { - } - status_t getResult(void) - { - return m_result; - } - - private: - virtual status_t onTransact(uint32_t code, - const Parcel& data, Parcel* reply, - uint32_t flags = 0) - { - (void)reply; - (void)flags; - switch(code) { - case BINDER_LIB_TEST_CALL_BACK: - m_result = data.readInt32(); - triggerEvent(); - return NO_ERROR; - default: - return UNKNOWN_TRANSACTION; - } - } - - status_t m_result; -}; - -class TestDeathRecipient : public IBinder::DeathRecipient, public BinderLibTestEvent -{ - private: - virtual void binderDied(const wp& who) { - (void)who; - triggerEvent(); - }; -}; - -TEST_F(BinderLibTest, NopTransaction) { - status_t ret; - Parcel data, reply; - ret = m_server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data, &reply); - EXPECT_EQ(NO_ERROR, ret); -} - -TEST_F(BinderLibTest, SetError) { - int32_t testValue[] = { 0, -123, 123 }; - for (size_t i = 0; i < ARRAY_SIZE(testValue); i++) { - status_t ret; - Parcel data, reply; - data.writeInt32(testValue[i]); - ret = m_server->transact(BINDER_LIB_TEST_SET_ERROR_TRANSACTION, data, &reply); - EXPECT_EQ(testValue[i], ret); - } -} - -TEST_F(BinderLibTest, GetId) { - status_t ret; - int32_t id; - Parcel data, reply; - ret = m_server->transact(BINDER_LIB_TEST_GET_ID_TRANSACTION, data, &reply); - EXPECT_EQ(NO_ERROR, ret); - ret = reply.readInt32(&id); - EXPECT_EQ(NO_ERROR, ret); - EXPECT_EQ(0, id); -} - -TEST_F(BinderLibTest, PtrSize) { - status_t ret; - int32_t ptrsize; - Parcel data, reply; - sp server = addServer(); - ASSERT_TRUE(server != NULL); - ret = server->transact(BINDER_LIB_TEST_GET_PTR_SIZE_TRANSACTION, data, &reply); - EXPECT_EQ(NO_ERROR, ret); - ret = reply.readInt32(&ptrsize); - EXPECT_EQ(NO_ERROR, ret); - RecordProperty("TestPtrSize", sizeof(void *)); - RecordProperty("ServerPtrSize", sizeof(void *)); -} - -TEST_F(BinderLibTest, IndirectGetId2) -{ - status_t ret; - int32_t id; - int32_t count; - Parcel data, reply; - int32_t serverId[3]; - - data.writeInt32(ARRAY_SIZE(serverId)); - for (size_t i = 0; i < ARRAY_SIZE(serverId); i++) { - sp server; - BinderLibTestBundle datai; - - server = addServer(&serverId[i]); - ASSERT_TRUE(server != NULL); - data.writeStrongBinder(server); - data.writeInt32(BINDER_LIB_TEST_GET_ID_TRANSACTION); - datai.appendTo(&data); - } - - ret = m_server->transact(BINDER_LIB_TEST_INDIRECT_TRANSACTION, data, &reply); - ASSERT_EQ(NO_ERROR, ret); - - ret = reply.readInt32(&id); - ASSERT_EQ(NO_ERROR, ret); - EXPECT_EQ(0, id); - - ret = reply.readInt32(&count); - ASSERT_EQ(NO_ERROR, ret); - EXPECT_EQ(ARRAY_SIZE(serverId), count); - - for (size_t i = 0; i < (size_t)count; i++) { - BinderLibTestBundle replyi(&reply); - EXPECT_TRUE(replyi.isValid()); - ret = replyi.readInt32(&id); - EXPECT_EQ(NO_ERROR, ret); - EXPECT_EQ(serverId[i], id); - EXPECT_EQ(replyi.dataSize(), replyi.dataPosition()); - } - - EXPECT_EQ(reply.dataSize(), reply.dataPosition()); -} - -TEST_F(BinderLibTest, IndirectGetId3) -{ - status_t ret; - int32_t id; - int32_t count; - Parcel data, reply; - int32_t serverId[3]; - - data.writeInt32(ARRAY_SIZE(serverId)); - for (size_t i = 0; i < ARRAY_SIZE(serverId); i++) { - sp server; - BinderLibTestBundle datai; - BinderLibTestBundle datai2; - - server = addServer(&serverId[i]); - ASSERT_TRUE(server != NULL); - data.writeStrongBinder(server); - data.writeInt32(BINDER_LIB_TEST_INDIRECT_TRANSACTION); - - datai.writeInt32(1); - datai.writeStrongBinder(m_server); - datai.writeInt32(BINDER_LIB_TEST_GET_ID_TRANSACTION); - datai2.appendTo(&datai); - - datai.appendTo(&data); - } - - ret = m_server->transact(BINDER_LIB_TEST_INDIRECT_TRANSACTION, data, &reply); - ASSERT_EQ(NO_ERROR, ret); - - ret = reply.readInt32(&id); - ASSERT_EQ(NO_ERROR, ret); - EXPECT_EQ(0, id); - - ret = reply.readInt32(&count); - ASSERT_EQ(NO_ERROR, ret); - EXPECT_EQ(ARRAY_SIZE(serverId), count); - - for (size_t i = 0; i < (size_t)count; i++) { - int32_t counti; - - BinderLibTestBundle replyi(&reply); - EXPECT_TRUE(replyi.isValid()); - ret = replyi.readInt32(&id); - EXPECT_EQ(NO_ERROR, ret); - EXPECT_EQ(serverId[i], id); - - ret = replyi.readInt32(&counti); - ASSERT_EQ(NO_ERROR, ret); - EXPECT_EQ(1, counti); - - BinderLibTestBundle replyi2(&replyi); - EXPECT_TRUE(replyi2.isValid()); - ret = replyi2.readInt32(&id); - EXPECT_EQ(NO_ERROR, ret); - EXPECT_EQ(0, id); - EXPECT_EQ(replyi2.dataSize(), replyi2.dataPosition()); - - EXPECT_EQ(replyi.dataSize(), replyi.dataPosition()); - } - - EXPECT_EQ(reply.dataSize(), reply.dataPosition()); -} - -TEST_F(BinderLibTest, CallBack) -{ - status_t ret; - Parcel data, reply; - sp callBack = new BinderLibTestCallBack(); - data.writeStrongBinder(callBack); - ret = m_server->transact(BINDER_LIB_TEST_NOP_CALL_BACK, data, &reply, TF_ONE_WAY); - EXPECT_EQ(NO_ERROR, ret); - ret = callBack->waitEvent(5); - EXPECT_EQ(NO_ERROR, ret); - ret = callBack->getResult(); - EXPECT_EQ(NO_ERROR, ret); -} - -TEST_F(BinderLibTest, AddServer) -{ - sp server = addServer(); - ASSERT_TRUE(server != NULL); -} - -TEST_F(BinderLibTest, DeathNotificationNoRefs) -{ - status_t ret; - - sp testDeathRecipient = new TestDeathRecipient(); - - { - sp binder = addServer(); - ASSERT_TRUE(binder != NULL); - ret = binder->linkToDeath(testDeathRecipient); - EXPECT_EQ(NO_ERROR, ret); - } - IPCThreadState::self()->flushCommands(); - ret = testDeathRecipient->waitEvent(5); - EXPECT_EQ(NO_ERROR, ret); -#if 0 /* Is there an unlink api that does not require a strong reference? */ - ret = binder->unlinkToDeath(testDeathRecipient); - EXPECT_EQ(NO_ERROR, ret); -#endif -} - -TEST_F(BinderLibTest, DeathNotificationWeakRef) -{ - status_t ret; - wp wbinder; - - sp testDeathRecipient = new TestDeathRecipient(); - - { - sp binder = addServer(); - ASSERT_TRUE(binder != NULL); - ret = binder->linkToDeath(testDeathRecipient); - EXPECT_EQ(NO_ERROR, ret); - wbinder = binder; - } - IPCThreadState::self()->flushCommands(); - ret = testDeathRecipient->waitEvent(5); - EXPECT_EQ(NO_ERROR, ret); -#if 0 /* Is there an unlink api that does not require a strong reference? */ - ret = binder->unlinkToDeath(testDeathRecipient); - EXPECT_EQ(NO_ERROR, ret); -#endif -} - -TEST_F(BinderLibTest, DeathNotificationStrongRef) -{ - status_t ret; - sp sbinder; - - sp testDeathRecipient = new TestDeathRecipient(); - - { - sp binder = addServer(); - ASSERT_TRUE(binder != NULL); - ret = binder->linkToDeath(testDeathRecipient); - EXPECT_EQ(NO_ERROR, ret); - sbinder = binder; - } - { - Parcel data, reply; - ret = sbinder->transact(BINDER_LIB_TEST_EXIT_TRANSACTION, data, &reply, TF_ONE_WAY); - EXPECT_EQ(0, ret); - } - IPCThreadState::self()->flushCommands(); - ret = testDeathRecipient->waitEvent(5); - EXPECT_EQ(NO_ERROR, ret); - ret = sbinder->unlinkToDeath(testDeathRecipient); - EXPECT_EQ(DEAD_OBJECT, ret); -} - -TEST_F(BinderLibTest, DeathNotificationMultiple) -{ - status_t ret; - const int clientcount = 2; - sp target; - sp linkedclient[clientcount]; - sp callBack[clientcount]; - sp passiveclient[clientcount]; - - target = addServer(); - ASSERT_TRUE(target != NULL); - for (int i = 0; i < clientcount; i++) { - { - Parcel data, reply; - - linkedclient[i] = addServer(); - ASSERT_TRUE(linkedclient[i] != NULL); - callBack[i] = new BinderLibTestCallBack(); - data.writeStrongBinder(target); - data.writeStrongBinder(callBack[i]); - ret = linkedclient[i]->transact(BINDER_LIB_TEST_LINK_DEATH_TRANSACTION, data, &reply, TF_ONE_WAY); - EXPECT_EQ(NO_ERROR, ret); - } - { - Parcel data, reply; - - passiveclient[i] = addServer(); - ASSERT_TRUE(passiveclient[i] != NULL); - data.writeStrongBinder(target); - ret = passiveclient[i]->transact(BINDER_LIB_TEST_ADD_STRONG_REF_TRANSACTION, data, &reply, TF_ONE_WAY); - EXPECT_EQ(NO_ERROR, ret); - } - } - { - Parcel data, reply; - ret = target->transact(BINDER_LIB_TEST_EXIT_TRANSACTION, data, &reply, TF_ONE_WAY); - EXPECT_EQ(0, ret); - } - - for (int i = 0; i < clientcount; i++) { - ret = callBack[i]->waitEvent(5); - EXPECT_EQ(NO_ERROR, ret); - ret = callBack[i]->getResult(); - EXPECT_EQ(NO_ERROR, ret); - } -} - -TEST_F(BinderLibTest, PassFile) { - int ret; - int pipefd[2]; - uint8_t buf[1] = { 0 }; - uint8_t write_value = 123; - - ret = pipe2(pipefd, O_NONBLOCK); - ASSERT_EQ(0, ret); - - { - Parcel data, reply; - uint8_t writebuf[1] = { write_value }; - - ret = data.writeFileDescriptor(pipefd[1], true); - EXPECT_EQ(NO_ERROR, ret); - - ret = data.writeInt32(sizeof(writebuf)); - EXPECT_EQ(NO_ERROR, ret); - - ret = data.write(writebuf, sizeof(writebuf)); - EXPECT_EQ(NO_ERROR, ret); - - ret = m_server->transact(BINDER_LIB_TEST_WRITE_FILE_TRANSACTION, data, &reply); - EXPECT_EQ(NO_ERROR, ret); - } - - ret = read(pipefd[0], buf, sizeof(buf)); - EXPECT_EQ(sizeof(buf), ret); - EXPECT_EQ(write_value, buf[0]); - - waitForReadData(pipefd[0], 5000); /* wait for other proccess to close pipe */ - - ret = read(pipefd[0], buf, sizeof(buf)); - EXPECT_EQ(0, ret); - - close(pipefd[0]); -} - -TEST_F(BinderLibTest, PromoteLocal) { - sp strong = new BBinder(); - wp weak = strong; - sp strong_from_weak = weak.promote(); - EXPECT_TRUE(strong != NULL); - EXPECT_EQ(strong, strong_from_weak); - strong = NULL; - strong_from_weak = NULL; - strong_from_weak = weak.promote(); - EXPECT_TRUE(strong_from_weak == NULL); -} - -TEST_F(BinderLibTest, PromoteRemote) { - int ret; - Parcel data, reply; - sp strong = new BBinder(); - sp server = addServer(); - - ASSERT_TRUE(server != NULL); - ASSERT_TRUE(strong != NULL); - - ret = data.writeWeakBinder(strong); - EXPECT_EQ(NO_ERROR, ret); - - ret = server->transact(BINDER_LIB_TEST_PROMOTE_WEAK_REF_TRANSACTION, data, &reply); - EXPECT_GE(ret, 0); -} - -class BinderLibTestService : public BBinder -{ - public: - BinderLibTestService(int32_t id) - : m_id(id) - , m_nextServerId(id + 1) - , m_serverStartRequested(false) - { - pthread_mutex_init(&m_serverWaitMutex, NULL); - pthread_cond_init(&m_serverWaitCond, NULL); - } - ~BinderLibTestService() - { - exit(EXIT_SUCCESS); - } - virtual status_t onTransact(uint32_t code, - const Parcel& data, Parcel* reply, - uint32_t flags = 0) { - //printf("%s: code %d\n", __func__, code); - (void)flags; - - if (getuid() != (uid_t)IPCThreadState::self()->getCallingUid()) { - return PERMISSION_DENIED; - } - switch (code) { - case BINDER_LIB_TEST_REGISTER_SERVER: { - int32_t id; - sp binder; - id = data.readInt32(); - binder = data.readStrongBinder(); - if (binder == NULL) { - return BAD_VALUE; - } - - if (m_id != 0) - return INVALID_OPERATION; - - pthread_mutex_lock(&m_serverWaitMutex); - if (m_serverStartRequested) { - m_serverStartRequested = false; - m_serverStarted = binder; - pthread_cond_signal(&m_serverWaitCond); - } - pthread_mutex_unlock(&m_serverWaitMutex); - return NO_ERROR; - } - case BINDER_LIB_TEST_ADD_SERVER: { - int ret; - uint8_t buf[1] = { 0 }; - int serverid; - - if (m_id != 0) { - return INVALID_OPERATION; - } - pthread_mutex_lock(&m_serverWaitMutex); - if (m_serverStartRequested) { - ret = -EBUSY; - } else { - serverid = m_nextServerId++; - m_serverStartRequested = true; - - pthread_mutex_unlock(&m_serverWaitMutex); - ret = start_server_process(serverid); - pthread_mutex_lock(&m_serverWaitMutex); - } - if (ret > 0) { - if (m_serverStartRequested) { -#if defined(HAVE_PTHREAD_COND_TIMEDWAIT_RELATIVE) - ret = pthread_cond_timeout_np(&m_serverWaitCond, &m_serverWaitMutex, 5000); -#else - struct timespec ts; - clock_gettime(CLOCK_REALTIME, &ts); - ts.tv_sec += 5; - ret = pthread_cond_timedwait(&m_serverWaitCond, &m_serverWaitMutex, &ts); -#endif - } - if (m_serverStartRequested) { - m_serverStartRequested = false; - ret = -ETIMEDOUT; - } else { - reply->writeStrongBinder(m_serverStarted); - reply->writeInt32(serverid); - m_serverStarted = NULL; - ret = NO_ERROR; - } - } else if (ret >= 0) { - m_serverStartRequested = false; - ret = UNKNOWN_ERROR; - } - pthread_mutex_unlock(&m_serverWaitMutex); - return ret; - } - case BINDER_LIB_TEST_NOP_TRANSACTION: - return NO_ERROR; - case BINDER_LIB_TEST_NOP_CALL_BACK: { - Parcel data2, reply2; - sp binder; - binder = data.readStrongBinder(); - if (binder == NULL) { - return BAD_VALUE; - } - reply2.writeInt32(NO_ERROR); - binder->transact(BINDER_LIB_TEST_CALL_BACK, data2, &reply2); - return NO_ERROR; - } - case BINDER_LIB_TEST_GET_ID_TRANSACTION: - reply->writeInt32(m_id); - return NO_ERROR; - case BINDER_LIB_TEST_INDIRECT_TRANSACTION: { - int32_t count; - uint32_t indirect_code; - sp binder; - - count = data.readInt32(); - reply->writeInt32(m_id); - reply->writeInt32(count); - for (int i = 0; i < count; i++) { - binder = data.readStrongBinder(); - if (binder == NULL) { - return BAD_VALUE; - } - indirect_code = data.readInt32(); - BinderLibTestBundle data2(&data); - if (!data2.isValid()) { - return BAD_VALUE; - } - BinderLibTestBundle reply2; - binder->transact(indirect_code, data2, &reply2); - reply2.appendTo(reply); - } - return NO_ERROR; - } - case BINDER_LIB_TEST_SET_ERROR_TRANSACTION: - reply->setError(data.readInt32()); - return NO_ERROR; - case BINDER_LIB_TEST_GET_PTR_SIZE_TRANSACTION: - reply->writeInt32(sizeof(void *)); - return NO_ERROR; - case BINDER_LIB_TEST_GET_STATUS_TRANSACTION: - return NO_ERROR; - case BINDER_LIB_TEST_ADD_STRONG_REF_TRANSACTION: - m_strongRef = data.readStrongBinder(); - return NO_ERROR; - case BINDER_LIB_TEST_LINK_DEATH_TRANSACTION: { - int ret; - Parcel data2, reply2; - sp testDeathRecipient = new TestDeathRecipient(); - sp target; - sp callback; - - target = data.readStrongBinder(); - if (target == NULL) { - return BAD_VALUE; - } - callback = data.readStrongBinder(); - if (callback == NULL) { - return BAD_VALUE; - } - ret = target->linkToDeath(testDeathRecipient); - if (ret == NO_ERROR) - ret = testDeathRecipient->waitEvent(5); - data2.writeInt32(ret); - callback->transact(BINDER_LIB_TEST_CALL_BACK, data2, &reply2); - return NO_ERROR; - } - case BINDER_LIB_TEST_WRITE_FILE_TRANSACTION: { - int ret; - int32_t size; - const void *buf; - int fd; - - fd = data.readFileDescriptor(); - if (fd < 0) { - return BAD_VALUE; - } - ret = data.readInt32(&size); - if (ret != NO_ERROR) { - return ret; - } - buf = data.readInplace(size); - if (buf == NULL) { - return BAD_VALUE; - } - ret = write(fd, buf, size); - if (ret != size) - return UNKNOWN_ERROR; - return NO_ERROR; - } - case BINDER_LIB_TEST_PROMOTE_WEAK_REF_TRANSACTION: { - int ret; - wp weak; - sp strong; - Parcel data2, reply2; - sp sm = defaultServiceManager(); - sp server = sm->getService(binderLibTestServiceName); - - weak = data.readWeakBinder(); - if (weak == NULL) { - return BAD_VALUE; - } - strong = weak.promote(); - - ret = server->transact(BINDER_LIB_TEST_NOP_TRANSACTION, data2, &reply2); - if (ret != NO_ERROR) - exit(EXIT_FAILURE); - - if (strong == NULL) { - reply->setError(1); - } - return NO_ERROR; - } - case BINDER_LIB_TEST_DELAYED_EXIT_TRANSACTION: - alarm(10); - return NO_ERROR; - case BINDER_LIB_TEST_EXIT_TRANSACTION: - while (wait(NULL) != -1 || errno != ECHILD) - ; - exit(EXIT_SUCCESS); - default: - return UNKNOWN_TRANSACTION; - }; - } - private: - int32_t m_id; - int32_t m_nextServerId; - pthread_mutex_t m_serverWaitMutex; - pthread_cond_t m_serverWaitCond; - bool m_serverStartRequested; - sp m_serverStarted; - sp m_strongRef; -}; - -int run_server(int index, int readypipefd) -{ - status_t ret; - sp sm = defaultServiceManager(); - { - sp testService = new BinderLibTestService(index); - if (index == 0) { - ret = sm->addService(binderLibTestServiceName, testService); - } else { - sp server = sm->getService(binderLibTestServiceName); - Parcel data, reply; - data.writeInt32(index); - data.writeStrongBinder(testService); - - ret = server->transact(BINDER_LIB_TEST_REGISTER_SERVER, data, &reply); - } - } - write(readypipefd, &ret, sizeof(ret)); - close(readypipefd); - //printf("%s: ret %d\n", __func__, ret); - if (ret) - return 1; - //printf("%s: joinThreadPool\n", __func__); - ProcessState::self()->startThreadPool(); - IPCThreadState::self()->joinThreadPool(); - //printf("%s: joinThreadPool returned\n", __func__); - return 1; /* joinThreadPool should not return */ -} - -int main(int argc, char **argv) { - int ret; - - if (argc == 3 && !strcmp(argv[1], "--servername")) { - binderservername = argv[2]; - } else { - binderservername = argv[0]; - } - - if (argc == 4 && !strcmp(argv[1], binderserverarg)) { - return run_server(atoi(argv[2]), atoi(argv[3])); - } - - ::testing::InitGoogleTest(&argc, argv); - binder_env = AddGlobalTestEnvironment(new BinderLibTestEnv()); - ProcessState::self()->startThreadPool(); - return RUN_ALL_TESTS(); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/binder/TextOutput.cpp android-platform-frameworks-native-21/libs/binder/TextOutput.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/binder/TextOutput.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/binder/TextOutput.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,169 +0,0 @@ -/* - * Copyright (C) 2005 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 - -#include - -#include -#include - -#include -#include -#include - -namespace android { - -// --------------------------------------------------------------------------- - -TextOutput::TextOutput() { -} - -TextOutput::~TextOutput() { -} - -// --------------------------------------------------------------------------- - -TextOutput& operator<<(TextOutput& to, bool val) -{ - if (val) to.print("true", 4); - else to.print("false", 5); - return to; -} - -TextOutput& operator<<(TextOutput& to, int val) -{ - char buf[16]; - sprintf(buf, "%d", val); - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, long val) -{ - char buf[16]; - sprintf(buf, "%ld", val); - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, unsigned int val) -{ - char buf[16]; - sprintf(buf, "%u", val); - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, unsigned long val) -{ - char buf[16]; - sprintf(buf, "%lu", val); - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, long long val) -{ - char buf[32]; - sprintf(buf, "%Ld", val); - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, unsigned long long val) -{ - char buf[32]; - sprintf(buf, "%Lu", val); - to.print(buf, strlen(buf)); - return to; -} - -static TextOutput& print_float(TextOutput& to, double value) -{ - char buf[64]; - sprintf(buf, "%g", value); - if( !strchr(buf, '.') && !strchr(buf, 'e') && - !strchr(buf, 'E') ) { - strncat(buf, ".0", sizeof(buf)-1); - } - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, float val) -{ - return print_float(to,val); -} - -TextOutput& operator<<(TextOutput& to, double val) -{ - return print_float(to,val); -} - -TextOutput& operator<<(TextOutput& to, const void* val) -{ - char buf[32]; - snprintf(buf, sizeof(buf), "%p", val); - to.print(buf, strlen(buf)); - return to; -} - -TextOutput& operator<<(TextOutput& to, const String8& val) -{ - to << val.string(); - return to; -} - -TextOutput& operator<<(TextOutput& to, const String16& val) -{ - to << String8(val).string(); - return to; -} - -static void textOutputPrinter(void* cookie, const char* txt) -{ - ((TextOutput*)cookie)->print(txt, strlen(txt)); -} - -TextOutput& operator<<(TextOutput& to, const TypeCode& val) -{ - printTypeCode(val.typeCode(), textOutputPrinter, (void*)&to); - return to; -} - -HexDump::HexDump(const void *buf, size_t size, size_t bytesPerLine) - : mBuffer(buf) - , mSize(size) - , mBytesPerLine(bytesPerLine) - , mSingleLineCutoff(16) - , mAlignment(4) - , mCArrayStyle(false) -{ - if (bytesPerLine >= 16) mAlignment = 4; - else if (bytesPerLine >= 8) mAlignment = 2; - else mAlignment = 1; -} - -TextOutput& operator<<(TextOutput& to, const HexDump& val) -{ - printHexData(0, val.buffer(), val.size(), val.bytesPerLine(), - val.singleLineCutoff(), val.alignment(), val.carrayStyle(), - textOutputPrinter, (void*)&to); - return to; -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/cpustats/Android.mk android-platform-frameworks-native-21/libs/cpustats/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/cpustats/Android.mk 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/cpustats/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,11 @@ +LOCAL_PATH:= $(call my-dir) + +include $(CLEAR_VARS) + +LOCAL_SRC_FILES := \ + CentralTendencyStatistics.cpp \ + ThreadCpuUsage.cpp + +LOCAL_MODULE := libcpustats + +include $(BUILD_STATIC_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/cpustats/CentralTendencyStatistics.cpp android-platform-frameworks-native-21/libs/cpustats/CentralTendencyStatistics.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/cpustats/CentralTendencyStatistics.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/cpustats/CentralTendencyStatistics.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,81 @@ +/* + * 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 + +#include + +void CentralTendencyStatistics::sample(double x) +{ + // update min and max + if (x < mMinimum) + mMinimum = x; + if (x > mMaximum) + mMaximum = x; + // Knuth + if (mN == 0) { + mMean = 0; + } + ++mN; + double delta = x - mMean; + mMean += delta / mN; + mM2 += delta * (x - mMean); +} + +void CentralTendencyStatistics::reset() +{ + mMean = NAN; + mMedian = NAN; + mMinimum = INFINITY; + mMaximum = -INFINITY; + mN = 0; + mM2 = 0; + mVariance = NAN; + mVarianceKnownForN = 0; + mStddev = NAN; + mStddevKnownForN = 0; +} + +double CentralTendencyStatistics::variance() const +{ + double variance; + if (mVarianceKnownForN != mN) { + if (mN > 1) { + // double variance_n = M2/n; + variance = mM2 / (mN - 1); + } else { + variance = NAN; + } + mVariance = variance; + mVarianceKnownForN = mN; + } else { + variance = mVariance; + } + return variance; +} + +double CentralTendencyStatistics::stddev() const +{ + double stddev; + if (mStddevKnownForN != mN) { + stddev = sqrt(variance()); + mStddev = stddev; + mStddevKnownForN = mN; + } else { + stddev = mStddev; + } + return stddev; +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/cpustats/ThreadCpuUsage.cpp android-platform-frameworks-native-21/libs/cpustats/ThreadCpuUsage.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/cpustats/ThreadCpuUsage.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/cpustats/ThreadCpuUsage.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,255 @@ +/* + * 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. + */ + +#define LOG_TAG "ThreadCpuUsage" +//#define LOG_NDEBUG 0 + +#include +#include +#include + +#include +#include + +#include + +namespace android { + +bool ThreadCpuUsage::setEnabled(bool isEnabled) +{ + bool wasEnabled = mIsEnabled; + // only do something if there is a change + if (isEnabled != wasEnabled) { + ALOGV("setEnabled(%d)", isEnabled); + int rc; + // enabling + if (isEnabled) { + rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &mPreviousTs); + if (rc) { + ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno); + isEnabled = false; + } else { + mWasEverEnabled = true; + // record wall clock time at first enable + if (!mMonotonicKnown) { + rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs); + if (rc) { + ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno); + } else { + mMonotonicKnown = true; + } + } + } + // disabling + } else { + struct timespec ts; + rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); + if (rc) { + ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno); + } else { + long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL + + (ts.tv_nsec - mPreviousTs.tv_nsec); + mAccumulator += delta; +#if 0 + mPreviousTs = ts; +#endif + } + } + mIsEnabled = isEnabled; + } + return wasEnabled; +} + +bool ThreadCpuUsage::sampleAndEnable(double& ns) +{ + bool ret; + bool wasEverEnabled = mWasEverEnabled; + if (enable()) { + // already enabled, so add a new sample relative to previous + return sample(ns); + } else if (wasEverEnabled) { + // was disabled, but add sample for accumulated time while enabled + ns = (double) mAccumulator; + mAccumulator = 0; + ALOGV("sampleAndEnable %.0f", ns); + return true; + } else { + // first time called + ns = 0.0; + ALOGV("sampleAndEnable false"); + return false; + } +} + +bool ThreadCpuUsage::sample(double &ns) +{ + if (mWasEverEnabled) { + if (mIsEnabled) { + struct timespec ts; + int rc; + rc = clock_gettime(CLOCK_THREAD_CPUTIME_ID, &ts); + if (rc) { + ALOGE("clock_gettime(CLOCK_THREAD_CPUTIME_ID) errno=%d", errno); + ns = 0.0; + return false; + } else { + long long delta = (ts.tv_sec - mPreviousTs.tv_sec) * 1000000000LL + + (ts.tv_nsec - mPreviousTs.tv_nsec); + mAccumulator += delta; + mPreviousTs = ts; + } + } else { + mWasEverEnabled = false; + } + ns = (double) mAccumulator; + ALOGV("sample %.0f", ns); + mAccumulator = 0; + return true; + } else { + ALOGW("Can't add sample because measurements have never been enabled"); + ns = 0.0; + return false; + } +} + +long long ThreadCpuUsage::elapsed() const +{ + long long elapsed; + if (mMonotonicKnown) { + struct timespec ts; + int rc; + rc = clock_gettime(CLOCK_MONOTONIC, &ts); + if (rc) { + ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno); + elapsed = 0; + } else { + // mMonotonicTs is updated only at first enable and resetStatistics + elapsed = (ts.tv_sec - mMonotonicTs.tv_sec) * 1000000000LL + + (ts.tv_nsec - mMonotonicTs.tv_nsec); + } + } else { + ALOGW("Can't compute elapsed time because measurements have never been enabled"); + elapsed = 0; + } + ALOGV("elapsed %lld", elapsed); + return elapsed; +} + +void ThreadCpuUsage::resetElapsed() +{ + ALOGV("resetElapsed"); + if (mMonotonicKnown) { + int rc; + rc = clock_gettime(CLOCK_MONOTONIC, &mMonotonicTs); + if (rc) { + ALOGE("clock_gettime(CLOCK_MONOTONIC) errno=%d", errno); + mMonotonicKnown = false; + } + } +} + +/*static*/ +int ThreadCpuUsage::sScalingFds[ThreadCpuUsage::MAX_CPU]; +pthread_once_t ThreadCpuUsage::sOnceControl = PTHREAD_ONCE_INIT; +int ThreadCpuUsage::sKernelMax; +pthread_mutex_t ThreadCpuUsage::sMutex = PTHREAD_MUTEX_INITIALIZER; + +/*static*/ +void ThreadCpuUsage::init() +{ + // read the number of CPUs + sKernelMax = 1; + int fd = open("/sys/devices/system/cpu/kernel_max", O_RDONLY); + if (fd >= 0) { +#define KERNEL_MAX_SIZE 12 + char kernelMax[KERNEL_MAX_SIZE]; + ssize_t actual = read(fd, kernelMax, sizeof(kernelMax)); + if (actual >= 2 && kernelMax[actual-1] == '\n') { + sKernelMax = atoi(kernelMax); + if (sKernelMax >= MAX_CPU - 1) { + ALOGW("kernel_max %d but MAX_CPU %d", sKernelMax, MAX_CPU); + sKernelMax = MAX_CPU; + } else if (sKernelMax < 0) { + ALOGW("kernel_max invalid %d", sKernelMax); + sKernelMax = 1; + } else { + ++sKernelMax; + ALOGV("number of CPUs %d", sKernelMax); + } + } else { + ALOGW("Can't read number of CPUs"); + } + (void) close(fd); + } else { + ALOGW("Can't open number of CPUs"); + } + int i; + for (i = 0; i < MAX_CPU; ++i) { + sScalingFds[i] = -1; + } +} + +uint32_t ThreadCpuUsage::getCpukHz(int cpuNum) +{ + if (cpuNum < 0 || cpuNum >= MAX_CPU) { + ALOGW("getCpukHz called with invalid CPU %d", cpuNum); + return 0; + } + // double-checked locking idiom is not broken for atomic values such as fd + int fd = sScalingFds[cpuNum]; + if (fd < 0) { + // some kernels can't open a scaling file until hot plug complete + pthread_mutex_lock(&sMutex); + fd = sScalingFds[cpuNum]; + if (fd < 0) { +#define FREQ_SIZE 64 + char freq_path[FREQ_SIZE]; +#define FREQ_DIGIT 27 + COMPILE_TIME_ASSERT_FUNCTION_SCOPE(MAX_CPU <= 10); +#define FREQ_PATH "/sys/devices/system/cpu/cpu?/cpufreq/scaling_cur_freq" + strlcpy(freq_path, FREQ_PATH, sizeof(freq_path)); + freq_path[FREQ_DIGIT] = cpuNum + '0'; + fd = open(freq_path, O_RDONLY | O_CLOEXEC); + // keep this fd until process exit or exec + sScalingFds[cpuNum] = fd; + } + pthread_mutex_unlock(&sMutex); + if (fd < 0) { + ALOGW("getCpukHz can't open CPU %d", cpuNum); + return 0; + } + } +#define KHZ_SIZE 12 + char kHz[KHZ_SIZE]; // kHz base 10 + ssize_t actual = pread(fd, kHz, sizeof(kHz), (off_t) 0); + uint32_t ret; + if (actual >= 2 && kHz[actual-1] == '\n') { + ret = atoi(kHz); + } else { + ret = 0; + } + if (ret != mCurrentkHz[cpuNum]) { + if (ret > 0) { + ALOGV("CPU %d frequency %u kHz", cpuNum, ret); + } else { + ALOGW("Can't read CPU %d frequency", cpuNum); + } + mCurrentkHz[cpuNum] = ret; + } + return ret; +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/diskusage/Android.mk android-platform-frameworks-native-21/libs/diskusage/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/diskusage/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/diskusage/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -# Copyright (C) 2010 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_MODULE := libdiskusage - -LOCAL_MODULE_TAGS := optional - -LOCAL_SRC_FILES := dirsize.c - -include $(BUILD_STATIC_LIBRARY) \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/diskusage/dirsize.c android-platform-frameworks-native-21/libs/diskusage/dirsize.c --- android-platform-frameworks-native-6.0.1+r16/libs/diskusage/dirsize.c 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/diskusage/dirsize.c 1970-01-01 00:00:00.000000000 +0000 @@ -1,76 +0,0 @@ -/* - * - * Copyright (C) 2008, 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 -#include -#include -#include - -#include - -int64_t stat_size(struct stat *s) -{ - int64_t blksize = s->st_blksize; - // count actual blocks used instead of nominal file size - int64_t size = s->st_blocks * 512; - - if (blksize) { - /* round up to filesystem block size */ - size = (size + blksize - 1) & (~(blksize - 1)); - } - - return size; -} - -int64_t calculate_dir_size(int dfd) -{ - int64_t size = 0; - struct stat s; - DIR *d; - struct dirent *de; - - d = fdopendir(dfd); - if (d == NULL) { - close(dfd); - return 0; - } - - while ((de = readdir(d))) { - const char *name = de->d_name; - if (fstatat(dfd, name, &s, AT_SYMLINK_NOFOLLOW) == 0) { - size += stat_size(&s); - } - if (de->d_type == DT_DIR) { - int subfd; - - /* always skip "." and ".." */ - if (name[0] == '.') { - if (name[1] == 0) - continue; - if ((name[1] == '.') && (name[2] == 0)) - continue; - } - - subfd = openat(dfd, name, O_RDONLY | O_DIRECTORY); - if (subfd >= 0) { - size += calculate_dir_size(subfd); - } - } - } - closedir(d); - return size; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/Android.mk android-platform-frameworks-native-21/libs/gui/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/gui/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,94 +1,54 @@ -# Copyright 2010 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. - -LOCAL_PATH := $(call my-dir) +LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_CLANG := true -LOCAL_CPPFLAGS := -std=c++1y -Weverything -Werror - -# The static constructors and destructors in this library have not been noted to -# introduce significant overheads -LOCAL_CPPFLAGS += -Wno-exit-time-destructors -LOCAL_CPPFLAGS += -Wno-global-constructors - -# We only care about compiling as C++14 -LOCAL_CPPFLAGS += -Wno-c++98-compat-pedantic - -# We don't need to enumerate every case in a switch as long as a default case -# is present -LOCAL_CPPFLAGS += -Wno-switch-enum - -# Allow calling variadic macros without a __VA_ARGS__ list -LOCAL_CPPFLAGS += -Wno-gnu-zero-variadic-macro-arguments - -# Don't warn about struct padding -LOCAL_CPPFLAGS += -Wno-padded - -LOCAL_SRC_FILES := \ - IGraphicBufferConsumer.cpp \ - IConsumerListener.cpp \ +LOCAL_SRC_FILES:= \ BitTube.cpp \ - BufferItem.cpp \ - BufferItemConsumer.cpp \ BufferQueue.cpp \ - BufferQueueConsumer.cpp \ - BufferQueueCore.cpp \ - BufferQueueProducer.cpp \ - BufferSlot.cpp \ - ConsumerBase.cpp \ - CpuConsumer.cpp \ DisplayEventReceiver.cpp \ - GLConsumer.cpp \ - GraphicBufferAlloc.cpp \ - GuiConfig.cpp \ IDisplayEventConnection.cpp \ - IGraphicBufferAlloc.cpp \ - IGraphicBufferProducer.cpp \ - IProducerListener.cpp \ ISensorEventConnection.cpp \ ISensorServer.cpp \ - ISurfaceComposer.cpp \ - ISurfaceComposerClient.cpp \ - LayerState.cpp \ + ISurfaceTexture.cpp \ Sensor.cpp \ SensorEventQueue.cpp \ SensorManager.cpp \ - StreamSplitter.cpp \ + SurfaceTexture.cpp \ + SurfaceTextureClient.cpp \ + ISurfaceComposer.cpp \ + ISurface.cpp \ + ISurfaceComposerClient.cpp \ + IGraphicBufferAlloc.cpp \ + LayerState.cpp \ Surface.cpp \ - SurfaceControl.cpp \ SurfaceComposerClient.cpp \ - SyncFeatures.cpp \ + DummyConsumer.cpp LOCAL_SHARED_LIBRARIES := \ - libbinder \ libcutils \ + libutils \ + libbinder \ + libhardware \ + libhardware_legacy \ + libui \ libEGL \ libGLESv2 \ - libsync \ - libui \ - libutils \ - liblog -LOCAL_MODULE := libgui +LOCAL_MODULE:= libgui -ifeq ($(TARGET_BOARD_PLATFORM), tegra) - LOCAL_CFLAGS += -DDONT_USE_FENCE_SYNC +ifeq ($(TARGET_BOARD_PLATFORM), omap4) + LOCAL_CFLAGS += -DUSE_FENCE_SYNC +endif +ifeq ($(TARGET_BOARD_PLATFORM), s5pc110) + LOCAL_CFLAGS += -DUSE_FENCE_SYNC +endif +ifneq ($(filter generic%,$(TARGET_DEVICE)),) + # Emulator build + LOCAL_CFLAGS += -DUSE_FENCE_SYNC endif -ifeq ($(TARGET_BOARD_PLATFORM), tegra3) - LOCAL_CFLAGS += -DDONT_USE_FENCE_SYNC + +ifeq ($(TARGET_BOARD_PLATFORM), tegra) + LOCAL_CFLAGS += -DALLOW_DEQUEUE_CURRENT_BUFFER endif include $(BUILD_SHARED_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BitTube.cpp android-platform-frameworks-native-21/libs/gui/BitTube.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BitTube.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BitTube.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -32,26 +32,39 @@ // Socket buffer size. The default is typically about 128KB, which is much larger than // we really need. So we make it smaller. -static const size_t DEFAULT_SOCKET_BUFFER_SIZE = 4 * 1024; +static const size_t SOCKET_BUFFER_SIZE = 4 * 1024; BitTube::BitTube() : mSendFd(-1), mReceiveFd(-1) { - init(DEFAULT_SOCKET_BUFFER_SIZE, DEFAULT_SOCKET_BUFFER_SIZE); -} - -BitTube::BitTube(size_t bufsize) - : mSendFd(-1), mReceiveFd(-1) -{ - init(bufsize, bufsize); + int sockets[2]; + if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets) == 0) { + int size = SOCKET_BUFFER_SIZE; + setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); + setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); + setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); + setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); + fcntl(sockets[0], F_SETFL, O_NONBLOCK); + fcntl(sockets[1], F_SETFL, O_NONBLOCK); + mReceiveFd = sockets[0]; + mSendFd = sockets[1]; + } else { + mReceiveFd = -errno; + ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd)); + } } BitTube::BitTube(const Parcel& data) : mSendFd(-1), mReceiveFd(-1) { mReceiveFd = dup(data.readFileDescriptor()); - if (mReceiveFd < 0) { + if (mReceiveFd >= 0) { + int size = SOCKET_BUFFER_SIZE; + setsockopt(mReceiveFd, SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); + setsockopt(mReceiveFd, SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); + fcntl(mReceiveFd, F_SETFL, O_NONBLOCK); + } else { mReceiveFd = -errno; ALOGE("BitTube(Parcel): can't dup filedescriptor (%s)", strerror(-mReceiveFd)); @@ -67,25 +80,6 @@ close(mReceiveFd); } -void BitTube::init(size_t rcvbuf, size_t sndbuf) { - int sockets[2]; - if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets) == 0) { - size_t size = DEFAULT_SOCKET_BUFFER_SIZE; - setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &rcvbuf, sizeof(rcvbuf)); - setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &sndbuf, sizeof(sndbuf)); - // sine we don't use the "return channel", we keep it small... - setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &size, sizeof(size)); - setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &size, sizeof(size)); - fcntl(sockets[0], F_SETFL, O_NONBLOCK); - fcntl(sockets[1], F_SETFL, O_NONBLOCK); - mReceiveFd = sockets[0]; - mSendFd = sockets[1]; - } else { - mReceiveFd = -errno; - ALOGE("BitTube: pipe creation failed (%s)", strerror(-mReceiveFd)); - } -} - status_t BitTube::initCheck() const { if (mReceiveFd < 0) { @@ -99,20 +93,15 @@ return mReceiveFd; } -int BitTube::getSendFd() const -{ - return mSendFd; -} - ssize_t BitTube::write(void const* vaddr, size_t size) { ssize_t err, len; do { len = ::send(mSendFd, vaddr, size, MSG_DONTWAIT | MSG_NOSIGNAL); - // cannot return less than size, since we're using SOCK_SEQPACKET err = len < 0 ? errno : 0; } while (err == EINTR); return err == 0 ? len : -err; + } ssize_t BitTube::read(void* vaddr, size_t size) @@ -145,31 +134,39 @@ ssize_t BitTube::sendObjects(const sp& tube, void const* events, size_t count, size_t objSize) { - const char* vaddr = reinterpret_cast(events); - ssize_t size = tube->write(vaddr, count*objSize); - - // should never happen because of SOCK_SEQPACKET - LOG_ALWAYS_FATAL_IF((size >= 0) && (size % static_cast(objSize)), - "BitTube::sendObjects(count=%zu, size=%zu), res=%zd (partial events were sent!)", - count, objSize, size); - - //ALOGE_IF(size<0, "error %d sending %d events", size, count); - return size < 0 ? size : size / static_cast(objSize); + ssize_t numObjects = 0; + for (size_t i=0 ; i(events) + objSize * i; + ssize_t size = tube->write(vaddr, objSize); + if (size < 0) { + // error occurred + return size; + } else if (size == 0) { + // no more space + break; + } + numObjects++; + } + return numObjects; } ssize_t BitTube::recvObjects(const sp& tube, void* events, size_t count, size_t objSize) { - char* vaddr = reinterpret_cast(events); - ssize_t size = tube->read(vaddr, count*objSize); - - // should never happen because of SOCK_SEQPACKET - LOG_ALWAYS_FATAL_IF((size >= 0) && (size % static_cast(objSize)), - "BitTube::recvObjects(count=%zu, size=%zu), res=%zd (partial events were received!)", - count, objSize, size); - - //ALOGE_IF(size<0, "error %d receiving %d events", size, count); - return size < 0 ? size : size / static_cast(objSize); + ssize_t numObjects = 0; + for (size_t i=0 ; i(events) + objSize * i; + ssize_t size = tube->read(vaddr, objSize); + if (size < 0) { + // error occurred + return size; + } else if (size == 0) { + // no more messages + break; + } + numObjects++; + } + return numObjects; } // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferItemConsumer.cpp android-platform-frameworks-native-21/libs/gui/BufferItemConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferItemConsumer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferItemConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,103 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "BufferItemConsumer" -//#define ATRACE_TAG ATRACE_TAG_GRAPHICS -#include - -#include -#include - -//#define BI_LOGV(x, ...) ALOGV("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define BI_LOGD(x, ...) ALOGD("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define BI_LOGI(x, ...) ALOGI("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define BI_LOGW(x, ...) ALOGW("[%s] " x, mName.string(), ##__VA_ARGS__) -#define BI_LOGE(x, ...) ALOGE("[%s] " x, mName.string(), ##__VA_ARGS__) - -namespace android { - -BufferItemConsumer::BufferItemConsumer( - const sp& consumer, uint32_t consumerUsage, - int bufferCount, bool controlledByApp) : - ConsumerBase(consumer, controlledByApp) -{ - status_t err = mConsumer->setConsumerUsageBits(consumerUsage); - LOG_ALWAYS_FATAL_IF(err != OK, - "Failed to set consumer usage bits to %#x", consumerUsage); - if (bufferCount != DEFAULT_MAX_BUFFERS) { - err = mConsumer->setMaxAcquiredBufferCount(bufferCount); - LOG_ALWAYS_FATAL_IF(err != OK, - "Failed to set max acquired buffer count to %d", bufferCount); - } -} - -BufferItemConsumer::~BufferItemConsumer() {} - -void BufferItemConsumer::setName(const String8& name) { - Mutex::Autolock _l(mMutex); - mName = name; - mConsumer->setConsumerName(name); -} - -status_t BufferItemConsumer::acquireBuffer(BufferItem *item, - nsecs_t presentWhen, bool waitForFence) { - status_t err; - - if (!item) return BAD_VALUE; - - Mutex::Autolock _l(mMutex); - - err = acquireBufferLocked(item, presentWhen); - if (err != OK) { - if (err != NO_BUFFER_AVAILABLE) { - BI_LOGE("Error acquiring buffer: %s (%d)", strerror(err), err); - } - return err; - } - - if (waitForFence) { - err = item->mFence->waitForever("BufferItemConsumer::acquireBuffer"); - if (err != OK) { - BI_LOGE("Failed to wait for fence of acquired buffer: %s (%d)", - strerror(-err), err); - return err; - } - } - - item->mGraphicBuffer = mSlots[item->mBuf].mGraphicBuffer; - - return OK; -} - -status_t BufferItemConsumer::releaseBuffer(const BufferItem &item, - const sp& releaseFence) { - status_t err; - - Mutex::Autolock _l(mMutex); - - err = addReleaseFenceLocked(item.mBuf, item.mGraphicBuffer, releaseFence); - - err = releaseBufferLocked(item.mBuf, item.mGraphicBuffer, EGL_NO_DISPLAY, - EGL_NO_SYNC_KHR); - if (err != OK) { - BI_LOGE("Failed to release buffer: %s (%d)", - strerror(-err), err); - } - return err; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferItem.cpp android-platform-frameworks-native-21/libs/gui/BufferItem.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferItem.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferItem.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,217 +0,0 @@ -/* - * Copyright 2014 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 - -#include -#include - -#include - -namespace android { - -BufferItem::BufferItem() : - mTransform(0), - mScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), - mTimestamp(0), - mIsAutoTimestamp(false), - mDataSpace(HAL_DATASPACE_UNKNOWN), - mFrameNumber(0), - mSlot(INVALID_BUFFER_SLOT), - mIsDroppable(false), - mAcquireCalled(false), - mTransformToDisplayInverse(false) { - mCrop.makeInvalid(); -} - -BufferItem::~BufferItem() {} - -template -static void addAligned(size_t& size, T /* value */) { - size = FlattenableUtils::align(size); - size += sizeof(T); -} - -size_t BufferItem::getPodSize() const { - size_t size = 0; - addAligned(size, mCrop); - addAligned(size, mTransform); - addAligned(size, mScalingMode); - addAligned(size, mTimestampLo); - addAligned(size, mTimestampHi); - addAligned(size, mIsAutoTimestamp); - addAligned(size, mDataSpace); - addAligned(size, mFrameNumberLo); - addAligned(size, mFrameNumberHi); - addAligned(size, mSlot); - addAligned(size, mIsDroppable); - addAligned(size, mAcquireCalled); - addAligned(size, mTransformToDisplayInverse); - return size; -} - -size_t BufferItem::getFlattenedSize() const { - size_t size = sizeof(uint32_t); // Flags - if (mGraphicBuffer != 0) { - size += mGraphicBuffer->getFlattenedSize(); - FlattenableUtils::align<4>(size); - } - if (mFence != 0) { - size += mFence->getFlattenedSize(); - FlattenableUtils::align<4>(size); - } - size += mSurfaceDamage.getFlattenedSize(); - size = FlattenableUtils::align<8>(size); - return size + getPodSize(); -} - -size_t BufferItem::getFdCount() const { - size_t count = 0; - if (mGraphicBuffer != 0) { - count += mGraphicBuffer->getFdCount(); - } - if (mFence != 0) { - count += mFence->getFdCount(); - } - return count; -} - -template -static void writeAligned(void*& buffer, size_t& size, T value) { - size -= FlattenableUtils::align(buffer); - FlattenableUtils::write(buffer, size, value); -} - -status_t BufferItem::flatten( - void*& buffer, size_t& size, int*& fds, size_t& count) const { - - // make sure we have enough space - if (size < BufferItem::getFlattenedSize()) { - return NO_MEMORY; - } - - // content flags are stored first - uint32_t& flags = *static_cast(buffer); - - // advance the pointer - FlattenableUtils::advance(buffer, size, sizeof(uint32_t)); - - flags = 0; - if (mGraphicBuffer != 0) { - status_t err = mGraphicBuffer->flatten(buffer, size, fds, count); - if (err) return err; - size -= FlattenableUtils::align<4>(buffer); - flags |= 1; - } - if (mFence != 0) { - status_t err = mFence->flatten(buffer, size, fds, count); - if (err) return err; - size -= FlattenableUtils::align<4>(buffer); - flags |= 2; - } - - status_t err = mSurfaceDamage.flatten(buffer, size); - if (err) return err; - FlattenableUtils::advance(buffer, size, mSurfaceDamage.getFlattenedSize()); - - // Check we still have enough space - if (size < getPodSize()) { - return NO_MEMORY; - } - - writeAligned(buffer, size, mCrop); - writeAligned(buffer, size, mTransform); - writeAligned(buffer, size, mScalingMode); - writeAligned(buffer, size, mTimestampLo); - writeAligned(buffer, size, mTimestampHi); - writeAligned(buffer, size, mIsAutoTimestamp); - writeAligned(buffer, size, mDataSpace); - writeAligned(buffer, size, mFrameNumberLo); - writeAligned(buffer, size, mFrameNumberHi); - writeAligned(buffer, size, mSlot); - writeAligned(buffer, size, mIsDroppable); - writeAligned(buffer, size, mAcquireCalled); - writeAligned(buffer, size, mTransformToDisplayInverse); - - return NO_ERROR; -} - -template -static void readAligned(const void*& buffer, size_t& size, T& value) { - size -= FlattenableUtils::align(buffer); - FlattenableUtils::read(buffer, size, value); -} - -status_t BufferItem::unflatten( - void const*& buffer, size_t& size, int const*& fds, size_t& count) { - - if (size < sizeof(uint32_t)) { - return NO_MEMORY; - } - - uint32_t flags = 0; - FlattenableUtils::read(buffer, size, flags); - - if (flags & 1) { - mGraphicBuffer = new GraphicBuffer(); - status_t err = mGraphicBuffer->unflatten(buffer, size, fds, count); - if (err) return err; - size -= FlattenableUtils::align<4>(buffer); - } - - if (flags & 2) { - mFence = new Fence(); - status_t err = mFence->unflatten(buffer, size, fds, count); - if (err) return err; - size -= FlattenableUtils::align<4>(buffer); - } - - status_t err = mSurfaceDamage.unflatten(buffer, size); - if (err) return err; - FlattenableUtils::advance(buffer, size, mSurfaceDamage.getFlattenedSize()); - - // Check we still have enough space - if (size < getPodSize()) { - return NO_MEMORY; - } - - readAligned(buffer, size, mCrop); - readAligned(buffer, size, mTransform); - readAligned(buffer, size, mScalingMode); - readAligned(buffer, size, mTimestampLo); - readAligned(buffer, size, mTimestampHi); - readAligned(buffer, size, mIsAutoTimestamp); - readAligned(buffer, size, mDataSpace); - readAligned(buffer, size, mFrameNumberLo); - readAligned(buffer, size, mFrameNumberHi); - readAligned(buffer, size, mSlot); - readAligned(buffer, size, mIsDroppable); - readAligned(buffer, size, mAcquireCalled); - readAligned(buffer, size, mTransformToDisplayInverse); - - return NO_ERROR; -} - -const char* BufferItem::scalingModeName(uint32_t scalingMode) { - switch (scalingMode) { - case NATIVE_WINDOW_SCALING_MODE_FREEZE: return "FREEZE"; - case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: return "SCALE_TO_WINDOW"; - case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: return "SCALE_CROP"; - default: return "Unknown"; - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueueConsumer.cpp android-platform-frameworks-native-21/libs/gui/BufferQueueConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueueConsumer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferQueueConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,578 +0,0 @@ -/* - * Copyright 2014 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 - -#define LOG_TAG "BufferQueueConsumer" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#include -#include -#include -#include -#include - -namespace android { - -BufferQueueConsumer::BufferQueueConsumer(const sp& core) : - mCore(core), - mSlots(core->mSlots), - mConsumerName() {} - -BufferQueueConsumer::~BufferQueueConsumer() {} - -status_t BufferQueueConsumer::acquireBuffer(BufferItem* outBuffer, - nsecs_t expectedPresent, uint64_t maxFrameNumber) { - ATRACE_CALL(); - - int numDroppedBuffers = 0; - sp listener; - { - Mutex::Autolock lock(mCore->mMutex); - - // Check that the consumer doesn't currently have the maximum number of - // buffers acquired. We allow the max buffer count to be exceeded by one - // buffer so that the consumer can successfully set up the newly acquired - // buffer before releasing the old one. - int numAcquiredBuffers = 0; - for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - if (mSlots[s].mBufferState == BufferSlot::ACQUIRED) { - ++numAcquiredBuffers; - } - } - if (numAcquiredBuffers >= mCore->mMaxAcquiredBufferCount + 1) { - BQ_LOGE("acquireBuffer: max acquired buffer count reached: %d (max %d)", - numAcquiredBuffers, mCore->mMaxAcquiredBufferCount); - return INVALID_OPERATION; - } - - // Check if the queue is empty. - // In asynchronous mode the list is guaranteed to be one buffer deep, - // while in synchronous mode we use the oldest buffer. - if (mCore->mQueue.empty()) { - return NO_BUFFER_AVAILABLE; - } - - BufferQueueCore::Fifo::iterator front(mCore->mQueue.begin()); - - // If expectedPresent is specified, we may not want to return a buffer yet. - // If it's specified and there's more than one buffer queued, we may want - // to drop a buffer. - if (expectedPresent != 0) { - const int MAX_REASONABLE_NSEC = 1000000000ULL; // 1 second - - // The 'expectedPresent' argument indicates when the buffer is expected - // to be presented on-screen. If the buffer's desired present time is - // earlier (less) than expectedPresent -- meaning it will be displayed - // on time or possibly late if we show it as soon as possible -- we - // acquire and return it. If we don't want to display it until after the - // expectedPresent time, we return PRESENT_LATER without acquiring it. - // - // To be safe, we don't defer acquisition if expectedPresent is more - // than one second in the future beyond the desired present time - // (i.e., we'd be holding the buffer for a long time). - // - // NOTE: Code assumes monotonic time values from the system clock - // are positive. - - // Start by checking to see if we can drop frames. We skip this check if - // the timestamps are being auto-generated by Surface. If the app isn't - // generating timestamps explicitly, it probably doesn't want frames to - // be discarded based on them. - while (mCore->mQueue.size() > 1 && !mCore->mQueue[0].mIsAutoTimestamp) { - const BufferItem& bufferItem(mCore->mQueue[1]); - - // If dropping entry[0] would leave us with a buffer that the - // consumer is not yet ready for, don't drop it. - if (maxFrameNumber && bufferItem.mFrameNumber > maxFrameNumber) { - break; - } - - // If entry[1] is timely, drop entry[0] (and repeat). We apply an - // additional criterion here: we only drop the earlier buffer if our - // desiredPresent falls within +/- 1 second of the expected present. - // Otherwise, bogus desiredPresent times (e.g., 0 or a small - // relative timestamp), which normally mean "ignore the timestamp - // and acquire immediately", would cause us to drop frames. - // - // We may want to add an additional criterion: don't drop the - // earlier buffer if entry[1]'s fence hasn't signaled yet. - nsecs_t desiredPresent = bufferItem.mTimestamp; - if (desiredPresent < expectedPresent - MAX_REASONABLE_NSEC || - desiredPresent > expectedPresent) { - // This buffer is set to display in the near future, or - // desiredPresent is garbage. Either way we don't want to drop - // the previous buffer just to get this on the screen sooner. - BQ_LOGV("acquireBuffer: nodrop desire=%" PRId64 " expect=%" - PRId64 " (%" PRId64 ") now=%" PRId64, - desiredPresent, expectedPresent, - desiredPresent - expectedPresent, - systemTime(CLOCK_MONOTONIC)); - break; - } - - BQ_LOGV("acquireBuffer: drop desire=%" PRId64 " expect=%" PRId64 - " size=%zu", - desiredPresent, expectedPresent, mCore->mQueue.size()); - if (mCore->stillTracking(front)) { - // Front buffer is still in mSlots, so mark the slot as free - mSlots[front->mSlot].mBufferState = BufferSlot::FREE; - mCore->mFreeBuffers.push_back(front->mSlot); - listener = mCore->mConnectedProducerListener; - ++numDroppedBuffers; - } - mCore->mQueue.erase(front); - front = mCore->mQueue.begin(); - } - - // See if the front buffer is ready to be acquired - nsecs_t desiredPresent = front->mTimestamp; - bool bufferIsDue = desiredPresent <= expectedPresent || - desiredPresent > expectedPresent + MAX_REASONABLE_NSEC; - bool consumerIsReady = maxFrameNumber > 0 ? - front->mFrameNumber <= maxFrameNumber : true; - if (!bufferIsDue || !consumerIsReady) { - BQ_LOGV("acquireBuffer: defer desire=%" PRId64 " expect=%" PRId64 - " (%" PRId64 ") now=%" PRId64 " frame=%" PRIu64 - " consumer=%" PRIu64, - desiredPresent, expectedPresent, - desiredPresent - expectedPresent, - systemTime(CLOCK_MONOTONIC), - front->mFrameNumber, maxFrameNumber); - return PRESENT_LATER; - } - - BQ_LOGV("acquireBuffer: accept desire=%" PRId64 " expect=%" PRId64 " " - "(%" PRId64 ") now=%" PRId64, desiredPresent, expectedPresent, - desiredPresent - expectedPresent, - systemTime(CLOCK_MONOTONIC)); - } - - int slot = front->mSlot; - *outBuffer = *front; - ATRACE_BUFFER_INDEX(slot); - - BQ_LOGV("acquireBuffer: acquiring { slot=%d/%" PRIu64 " buffer=%p }", - slot, front->mFrameNumber, front->mGraphicBuffer->handle); - // If the front buffer is still being tracked, update its slot state - if (mCore->stillTracking(front)) { - mSlots[slot].mAcquireCalled = true; - mSlots[slot].mNeedsCleanupOnRelease = false; - mSlots[slot].mBufferState = BufferSlot::ACQUIRED; - mSlots[slot].mFence = Fence::NO_FENCE; - } - - // If the buffer has previously been acquired by the consumer, set - // mGraphicBuffer to NULL to avoid unnecessarily remapping this buffer - // on the consumer side - if (outBuffer->mAcquireCalled) { - outBuffer->mGraphicBuffer = NULL; - } - - mCore->mQueue.erase(front); - - // We might have freed a slot while dropping old buffers, or the producer - // may be blocked waiting for the number of buffers in the queue to - // decrease. - mCore->mDequeueCondition.broadcast(); - - ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size()); - - mCore->validateConsistencyLocked(); - } - - if (listener != NULL) { - for (int i = 0; i < numDroppedBuffers; ++i) { - listener->onBufferReleased(); - } - } - - return NO_ERROR; -} - -status_t BufferQueueConsumer::detachBuffer(int slot) { - ATRACE_CALL(); - ATRACE_BUFFER_INDEX(slot); - BQ_LOGV("detachBuffer(C): slot %d", slot); - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("detachBuffer(C): BufferQueue has been abandoned"); - return NO_INIT; - } - - if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { - BQ_LOGE("detachBuffer(C): slot index %d out of range [0, %d)", - slot, BufferQueueDefs::NUM_BUFFER_SLOTS); - return BAD_VALUE; - } else if (mSlots[slot].mBufferState != BufferSlot::ACQUIRED) { - BQ_LOGE("detachBuffer(C): slot %d is not owned by the consumer " - "(state = %d)", slot, mSlots[slot].mBufferState); - return BAD_VALUE; - } - - mCore->freeBufferLocked(slot); - mCore->mDequeueCondition.broadcast(); - mCore->validateConsistencyLocked(); - - return NO_ERROR; -} - -status_t BufferQueueConsumer::attachBuffer(int* outSlot, - const sp& buffer) { - ATRACE_CALL(); - - if (outSlot == NULL) { - BQ_LOGE("attachBuffer(P): outSlot must not be NULL"); - return BAD_VALUE; - } else if (buffer == NULL) { - BQ_LOGE("attachBuffer(P): cannot attach NULL buffer"); - return BAD_VALUE; - } - - Mutex::Autolock lock(mCore->mMutex); - - // Make sure we don't have too many acquired buffers - int numAcquiredBuffers = 0; - for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - if (mSlots[s].mBufferState == BufferSlot::ACQUIRED) { - ++numAcquiredBuffers; - } - } - - if (numAcquiredBuffers >= mCore->mMaxAcquiredBufferCount + 1) { - BQ_LOGE("attachBuffer(P): max acquired buffer count reached: %d " - "(max %d)", numAcquiredBuffers, - mCore->mMaxAcquiredBufferCount); - return INVALID_OPERATION; - } - - if (buffer->getGenerationNumber() != mCore->mGenerationNumber) { - BQ_LOGE("attachBuffer: generation number mismatch [buffer %u] " - "[queue %u]", buffer->getGenerationNumber(), - mCore->mGenerationNumber); - return BAD_VALUE; - } - - // Find a free slot to put the buffer into - int found = BufferQueueCore::INVALID_BUFFER_SLOT; - if (!mCore->mFreeSlots.empty()) { - auto slot = mCore->mFreeSlots.begin(); - found = *slot; - mCore->mFreeSlots.erase(slot); - } else if (!mCore->mFreeBuffers.empty()) { - found = mCore->mFreeBuffers.front(); - mCore->mFreeBuffers.remove(found); - } - if (found == BufferQueueCore::INVALID_BUFFER_SLOT) { - BQ_LOGE("attachBuffer(P): could not find free buffer slot"); - return NO_MEMORY; - } - - *outSlot = found; - ATRACE_BUFFER_INDEX(*outSlot); - BQ_LOGV("attachBuffer(C): returning slot %d", *outSlot); - - mSlots[*outSlot].mGraphicBuffer = buffer; - mSlots[*outSlot].mBufferState = BufferSlot::ACQUIRED; - mSlots[*outSlot].mAttachedByConsumer = true; - mSlots[*outSlot].mNeedsCleanupOnRelease = false; - mSlots[*outSlot].mFence = Fence::NO_FENCE; - mSlots[*outSlot].mFrameNumber = 0; - - // mAcquireCalled tells BufferQueue that it doesn't need to send a valid - // GraphicBuffer pointer on the next acquireBuffer call, which decreases - // Binder traffic by not un/flattening the GraphicBuffer. However, it - // requires that the consumer maintain a cached copy of the slot <--> buffer - // mappings, which is why the consumer doesn't need the valid pointer on - // acquire. - // - // The StreamSplitter is one of the primary users of the attach/detach - // logic, and while it is running, all buffers it acquires are immediately - // detached, and all buffers it eventually releases are ones that were - // attached (as opposed to having been obtained from acquireBuffer), so it - // doesn't make sense to maintain the slot/buffer mappings, which would - // become invalid for every buffer during detach/attach. By setting this to - // false, the valid GraphicBuffer pointer will always be sent with acquire - // for attached buffers. - mSlots[*outSlot].mAcquireCalled = false; - - mCore->validateConsistencyLocked(); - - return NO_ERROR; -} - -status_t BufferQueueConsumer::releaseBuffer(int slot, uint64_t frameNumber, - const sp& releaseFence, EGLDisplay eglDisplay, - EGLSyncKHR eglFence) { - ATRACE_CALL(); - ATRACE_BUFFER_INDEX(slot); - - if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS || - releaseFence == NULL) { - BQ_LOGE("releaseBuffer: slot %d out of range or fence %p NULL", slot, - releaseFence.get()); - return BAD_VALUE; - } - - sp listener; - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - - // If the frame number has changed because the buffer has been reallocated, - // we can ignore this releaseBuffer for the old buffer - if (frameNumber != mSlots[slot].mFrameNumber) { - return STALE_BUFFER_SLOT; - } - - // Make sure this buffer hasn't been queued while acquired by the consumer - BufferQueueCore::Fifo::iterator current(mCore->mQueue.begin()); - while (current != mCore->mQueue.end()) { - if (current->mSlot == slot) { - BQ_LOGE("releaseBuffer: buffer slot %d pending release is " - "currently queued", slot); - return BAD_VALUE; - } - ++current; - } - - if (mSlots[slot].mBufferState == BufferSlot::ACQUIRED) { - mSlots[slot].mEglDisplay = eglDisplay; - mSlots[slot].mEglFence = eglFence; - mSlots[slot].mFence = releaseFence; - mSlots[slot].mBufferState = BufferSlot::FREE; - mCore->mFreeBuffers.push_back(slot); - listener = mCore->mConnectedProducerListener; - BQ_LOGV("releaseBuffer: releasing slot %d", slot); - } else if (mSlots[slot].mNeedsCleanupOnRelease) { - BQ_LOGV("releaseBuffer: releasing a stale buffer slot %d " - "(state = %d)", slot, mSlots[slot].mBufferState); - mSlots[slot].mNeedsCleanupOnRelease = false; - return STALE_BUFFER_SLOT; - } else { - BQ_LOGE("releaseBuffer: attempted to release buffer slot %d " - "but its state was %d", slot, mSlots[slot].mBufferState); - return BAD_VALUE; - } - - mCore->mDequeueCondition.broadcast(); - mCore->validateConsistencyLocked(); - } // Autolock scope - - // Call back without lock held - if (listener != NULL) { - listener->onBufferReleased(); - } - - return NO_ERROR; -} - -status_t BufferQueueConsumer::connect( - const sp& consumerListener, bool controlledByApp) { - ATRACE_CALL(); - - if (consumerListener == NULL) { - BQ_LOGE("connect(C): consumerListener may not be NULL"); - return BAD_VALUE; - } - - BQ_LOGV("connect(C): controlledByApp=%s", - controlledByApp ? "true" : "false"); - - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("connect(C): BufferQueue has been abandoned"); - return NO_INIT; - } - - mCore->mConsumerListener = consumerListener; - mCore->mConsumerControlledByApp = controlledByApp; - - return NO_ERROR; -} - -status_t BufferQueueConsumer::disconnect() { - ATRACE_CALL(); - - BQ_LOGV("disconnect(C)"); - - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mConsumerListener == NULL) { - BQ_LOGE("disconnect(C): no consumer is connected"); - return BAD_VALUE; - } - - mCore->mIsAbandoned = true; - mCore->mConsumerListener = NULL; - mCore->mQueue.clear(); - mCore->freeAllBuffersLocked(); - mCore->mDequeueCondition.broadcast(); - return NO_ERROR; -} - -status_t BufferQueueConsumer::getReleasedBuffers(uint64_t *outSlotMask) { - ATRACE_CALL(); - - if (outSlotMask == NULL) { - BQ_LOGE("getReleasedBuffers: outSlotMask may not be NULL"); - return BAD_VALUE; - } - - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("getReleasedBuffers: BufferQueue has been abandoned"); - return NO_INIT; - } - - uint64_t mask = 0; - for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - if (!mSlots[s].mAcquireCalled) { - mask |= (1ULL << s); - } - } - - // Remove from the mask queued buffers for which acquire has been called, - // since the consumer will not receive their buffer addresses and so must - // retain their cached information - BufferQueueCore::Fifo::iterator current(mCore->mQueue.begin()); - while (current != mCore->mQueue.end()) { - if (current->mAcquireCalled) { - mask &= ~(1ULL << current->mSlot); - } - ++current; - } - - BQ_LOGV("getReleasedBuffers: returning mask %#" PRIx64, mask); - *outSlotMask = mask; - return NO_ERROR; -} - -status_t BufferQueueConsumer::setDefaultBufferSize(uint32_t width, - uint32_t height) { - ATRACE_CALL(); - - if (width == 0 || height == 0) { - BQ_LOGV("setDefaultBufferSize: dimensions cannot be 0 (width=%u " - "height=%u)", width, height); - return BAD_VALUE; - } - - BQ_LOGV("setDefaultBufferSize: width=%u height=%u", width, height); - - Mutex::Autolock lock(mCore->mMutex); - mCore->mDefaultWidth = width; - mCore->mDefaultHeight = height; - return NO_ERROR; -} - -status_t BufferQueueConsumer::setDefaultMaxBufferCount(int bufferCount) { - ATRACE_CALL(); - Mutex::Autolock lock(mCore->mMutex); - return mCore->setDefaultMaxBufferCountLocked(bufferCount); -} - -status_t BufferQueueConsumer::disableAsyncBuffer() { - ATRACE_CALL(); - - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mConsumerListener != NULL) { - BQ_LOGE("disableAsyncBuffer: consumer already connected"); - return INVALID_OPERATION; - } - - BQ_LOGV("disableAsyncBuffer"); - mCore->mUseAsyncBuffer = false; - return NO_ERROR; -} - -status_t BufferQueueConsumer::setMaxAcquiredBufferCount( - int maxAcquiredBuffers) { - ATRACE_CALL(); - - if (maxAcquiredBuffers < 1 || - maxAcquiredBuffers > BufferQueueCore::MAX_MAX_ACQUIRED_BUFFERS) { - BQ_LOGE("setMaxAcquiredBufferCount: invalid count %d", - maxAcquiredBuffers); - return BAD_VALUE; - } - - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mConnectedApi != BufferQueueCore::NO_CONNECTED_API) { - BQ_LOGE("setMaxAcquiredBufferCount: producer is already connected"); - return INVALID_OPERATION; - } - - BQ_LOGV("setMaxAcquiredBufferCount: %d", maxAcquiredBuffers); - mCore->mMaxAcquiredBufferCount = maxAcquiredBuffers; - return NO_ERROR; -} - -void BufferQueueConsumer::setConsumerName(const String8& name) { - ATRACE_CALL(); - BQ_LOGV("setConsumerName: '%s'", name.string()); - Mutex::Autolock lock(mCore->mMutex); - mCore->mConsumerName = name; - mConsumerName = name; -} - -status_t BufferQueueConsumer::setDefaultBufferFormat(PixelFormat defaultFormat) { - ATRACE_CALL(); - BQ_LOGV("setDefaultBufferFormat: %u", defaultFormat); - Mutex::Autolock lock(mCore->mMutex); - mCore->mDefaultBufferFormat = defaultFormat; - return NO_ERROR; -} - -status_t BufferQueueConsumer::setDefaultBufferDataSpace( - android_dataspace defaultDataSpace) { - ATRACE_CALL(); - BQ_LOGV("setDefaultBufferDataSpace: %u", defaultDataSpace); - Mutex::Autolock lock(mCore->mMutex); - mCore->mDefaultBufferDataSpace = defaultDataSpace; - return NO_ERROR; -} - -status_t BufferQueueConsumer::setConsumerUsageBits(uint32_t usage) { - ATRACE_CALL(); - BQ_LOGV("setConsumerUsageBits: %#x", usage); - Mutex::Autolock lock(mCore->mMutex); - mCore->mConsumerUsageBits = usage; - return NO_ERROR; -} - -status_t BufferQueueConsumer::setTransformHint(uint32_t hint) { - ATRACE_CALL(); - BQ_LOGV("setTransformHint: %#x", hint); - Mutex::Autolock lock(mCore->mMutex); - mCore->mTransformHint = hint; - return NO_ERROR; -} - -sp BufferQueueConsumer::getSidebandStream() const { - return mCore->mSidebandStream; -} - -void BufferQueueConsumer::dump(String8& result, const char* prefix) const { - mCore->dump(result, prefix); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueueCore.cpp android-platform-frameworks-native-21/libs/gui/BufferQueueCore.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueueCore.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferQueueCore.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,301 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#define LOG_TAG "BufferQueueCore" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#define EGL_EGLEXT_PROTOTYPES - -#include - -#include -#include -#include -#include -#include -#include -#include - -template -static inline T max(T a, T b) { return a > b ? a : b; } - -namespace android { - -static String8 getUniqueName() { - static volatile int32_t counter = 0; - return String8::format("unnamed-%d-%d", getpid(), - android_atomic_inc(&counter)); -} - -BufferQueueCore::BufferQueueCore(const sp& allocator) : - mAllocator(allocator), - mMutex(), - mIsAbandoned(false), - mConsumerControlledByApp(false), - mConsumerName(getUniqueName()), - mConsumerListener(), - mConsumerUsageBits(0), - mConnectedApi(NO_CONNECTED_API), - mConnectedProducerListener(), - mSlots(), - mQueue(), - mFreeSlots(), - mFreeBuffers(), - mOverrideMaxBufferCount(0), - mDequeueCondition(), - mUseAsyncBuffer(true), - mDequeueBufferCannotBlock(false), - mDefaultBufferFormat(PIXEL_FORMAT_RGBA_8888), - mDefaultWidth(1), - mDefaultHeight(1), - mDefaultBufferDataSpace(HAL_DATASPACE_UNKNOWN), - mDefaultMaxBufferCount(2), - mMaxAcquiredBufferCount(1), - mBufferHasBeenQueued(false), - mFrameCounter(0), - mTransformHint(0), - mIsAllocating(false), - mIsAllocatingCondition(), - mAllowAllocation(true), - mBufferAge(0), - mGenerationNumber(0) -{ - if (allocator == NULL) { - sp composer(ComposerService::getComposerService()); - mAllocator = composer->createGraphicBufferAlloc(); - if (mAllocator == NULL) { - BQ_LOGE("createGraphicBufferAlloc failed"); - } - } - for (int slot = 0; slot < BufferQueueDefs::NUM_BUFFER_SLOTS; ++slot) { - mFreeSlots.insert(slot); - } -} - -BufferQueueCore::~BufferQueueCore() {} - -void BufferQueueCore::dump(String8& result, const char* prefix) const { - Mutex::Autolock lock(mMutex); - - String8 fifo; - Fifo::const_iterator current(mQueue.begin()); - while (current != mQueue.end()) { - fifo.appendFormat("%02d:%p crop=[%d,%d,%d,%d], " - "xform=0x%02x, time=%#" PRIx64 ", scale=%s\n", - current->mSlot, current->mGraphicBuffer.get(), - current->mCrop.left, current->mCrop.top, current->mCrop.right, - current->mCrop.bottom, current->mTransform, current->mTimestamp, - BufferItem::scalingModeName(current->mScalingMode)); - ++current; - } - - result.appendFormat("%s-BufferQueue mMaxAcquiredBufferCount=%d, " - "mDequeueBufferCannotBlock=%d, default-size=[%dx%d], " - "default-format=%d, transform-hint=%02x, FIFO(%zu)={%s}\n", - prefix, mMaxAcquiredBufferCount, mDequeueBufferCannotBlock, - mDefaultWidth, mDefaultHeight, mDefaultBufferFormat, mTransformHint, - mQueue.size(), fifo.string()); - - // Trim the free buffers so as to not spam the dump - int maxBufferCount = 0; - for (int s = BufferQueueDefs::NUM_BUFFER_SLOTS - 1; s >= 0; --s) { - const BufferSlot& slot(mSlots[s]); - if (slot.mBufferState != BufferSlot::FREE || - slot.mGraphicBuffer != NULL) { - maxBufferCount = s + 1; - break; - } - } - - for (int s = 0; s < maxBufferCount; ++s) { - const BufferSlot& slot(mSlots[s]); - const sp& buffer(slot.mGraphicBuffer); - result.appendFormat("%s%s[%02d:%p] state=%-8s", prefix, - (slot.mBufferState == BufferSlot::ACQUIRED) ? ">" : " ", - s, buffer.get(), - BufferSlot::bufferStateName(slot.mBufferState)); - - if (buffer != NULL) { - result.appendFormat(", %p [%4ux%4u:%4u,%3X]", buffer->handle, - buffer->width, buffer->height, buffer->stride, - buffer->format); - } - - result.append("\n"); - } -} - -int BufferQueueCore::getMinUndequeuedBufferCountLocked(bool async) const { - // If dequeueBuffer is allowed to error out, we don't have to add an - // extra buffer. - if (!mUseAsyncBuffer) { - return mMaxAcquiredBufferCount; - } - - if (mDequeueBufferCannotBlock || async) { - return mMaxAcquiredBufferCount + 1; - } - - return mMaxAcquiredBufferCount; -} - -int BufferQueueCore::getMinMaxBufferCountLocked(bool async) const { - return getMinUndequeuedBufferCountLocked(async) + 1; -} - -int BufferQueueCore::getMaxBufferCountLocked(bool async) const { - int minMaxBufferCount = getMinMaxBufferCountLocked(async); - - int maxBufferCount = max(mDefaultMaxBufferCount, minMaxBufferCount); - if (mOverrideMaxBufferCount != 0) { - assert(mOverrideMaxBufferCount >= minMaxBufferCount); - maxBufferCount = mOverrideMaxBufferCount; - } - - // Any buffers that are dequeued by the producer or sitting in the queue - // waiting to be consumed need to have their slots preserved. Such buffers - // will temporarily keep the max buffer count up until the slots no longer - // need to be preserved. - for (int s = maxBufferCount; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - BufferSlot::BufferState state = mSlots[s].mBufferState; - if (state == BufferSlot::QUEUED || state == BufferSlot::DEQUEUED) { - maxBufferCount = s + 1; - } - } - - return maxBufferCount; -} - -status_t BufferQueueCore::setDefaultMaxBufferCountLocked(int count) { - const int minBufferCount = mUseAsyncBuffer ? 2 : 1; - if (count < minBufferCount || count > BufferQueueDefs::NUM_BUFFER_SLOTS) { - BQ_LOGV("setDefaultMaxBufferCount: invalid count %d, should be in " - "[%d, %d]", - count, minBufferCount, BufferQueueDefs::NUM_BUFFER_SLOTS); - return BAD_VALUE; - } - - BQ_LOGV("setDefaultMaxBufferCount: setting count to %d", count); - mDefaultMaxBufferCount = count; - mDequeueCondition.broadcast(); - - return NO_ERROR; -} - -void BufferQueueCore::freeBufferLocked(int slot) { - BQ_LOGV("freeBufferLocked: slot %d", slot); - bool hadBuffer = mSlots[slot].mGraphicBuffer != NULL; - mSlots[slot].mGraphicBuffer.clear(); - if (mSlots[slot].mBufferState == BufferSlot::ACQUIRED) { - mSlots[slot].mNeedsCleanupOnRelease = true; - } - if (mSlots[slot].mBufferState != BufferSlot::FREE) { - mFreeSlots.insert(slot); - } else if (hadBuffer) { - // If the slot was FREE, but we had a buffer, we need to move this slot - // from the free buffers list to the the free slots list - mFreeBuffers.remove(slot); - mFreeSlots.insert(slot); - } - mSlots[slot].mBufferState = BufferSlot::FREE; - mSlots[slot].mAcquireCalled = false; - mSlots[slot].mFrameNumber = 0; - - // Destroy fence as BufferQueue now takes ownership - if (mSlots[slot].mEglFence != EGL_NO_SYNC_KHR) { - eglDestroySyncKHR(mSlots[slot].mEglDisplay, mSlots[slot].mEglFence); - mSlots[slot].mEglFence = EGL_NO_SYNC_KHR; - } - mSlots[slot].mFence = Fence::NO_FENCE; - validateConsistencyLocked(); -} - -void BufferQueueCore::freeAllBuffersLocked() { - mBufferHasBeenQueued = false; - for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - freeBufferLocked(s); - } -} - -bool BufferQueueCore::stillTracking(const BufferItem* item) const { - const BufferSlot& slot = mSlots[item->mSlot]; - - BQ_LOGV("stillTracking: item { slot=%d/%" PRIu64 " buffer=%p } " - "slot { slot=%d/%" PRIu64 " buffer=%p }", - item->mSlot, item->mFrameNumber, - (item->mGraphicBuffer.get() ? item->mGraphicBuffer->handle : 0), - item->mSlot, slot.mFrameNumber, - (slot.mGraphicBuffer.get() ? slot.mGraphicBuffer->handle : 0)); - - // Compare item with its original buffer slot. We can check the slot as - // the buffer would not be moved to a different slot by the producer. - return (slot.mGraphicBuffer != NULL) && - (item->mGraphicBuffer->handle == slot.mGraphicBuffer->handle); -} - -void BufferQueueCore::waitWhileAllocatingLocked() const { - ATRACE_CALL(); - while (mIsAllocating) { - mIsAllocatingCondition.wait(mMutex); - } -} - -void BufferQueueCore::validateConsistencyLocked() const { - static const useconds_t PAUSE_TIME = 0; - for (int slot = 0; slot < BufferQueueDefs::NUM_BUFFER_SLOTS; ++slot) { - bool isInFreeSlots = mFreeSlots.count(slot) != 0; - bool isInFreeBuffers = - std::find(mFreeBuffers.cbegin(), mFreeBuffers.cend(), slot) != - mFreeBuffers.cend(); - if (mSlots[slot].mBufferState == BufferSlot::FREE) { - if (mSlots[slot].mGraphicBuffer == NULL) { - if (!isInFreeSlots) { - BQ_LOGE("Slot %d is FREE but is not in mFreeSlots", slot); - usleep(PAUSE_TIME); - } - if (isInFreeBuffers) { - BQ_LOGE("Slot %d is in mFreeSlots " - "but is also in mFreeBuffers", slot); - usleep(PAUSE_TIME); - } - } else { - if (!isInFreeBuffers) { - BQ_LOGE("Slot %d is FREE but is not in mFreeBuffers", slot); - usleep(PAUSE_TIME); - } - if (isInFreeSlots) { - BQ_LOGE("Slot %d is in mFreeBuffers " - "but is also in mFreeSlots", slot); - usleep(PAUSE_TIME); - } - } - } else { - if (isInFreeSlots) { - BQ_LOGE("Slot %d is in mFreeSlots but is not FREE (%d)", - slot, mSlots[slot].mBufferState); - usleep(PAUSE_TIME); - } - if (isInFreeBuffers) { - BQ_LOGE("Slot %d is in mFreeBuffers but is not FREE (%d)", - slot, mSlots[slot].mBufferState); - usleep(PAUSE_TIME); - } - } - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueue.cpp android-platform-frameworks-native-21/libs/gui/BufferQueue.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueue.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferQueue.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -18,71 +18,1040 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS //#define LOG_NDEBUG 0 +#define GL_GLEXT_PROTOTYPES +#define EGL_EGLEXT_PROTOTYPES + +#include +#include + #include -#include -#include -#include +#include +#include + +#include +#include +#include + +// This compile option causes SurfaceTexture to return the buffer that is currently +// attached to the GL texture from dequeueBuffer when no other buffers are +// available. It requires the drivers (Gralloc, GL, OMX IL, and Camera) to do +// implicit cross-process synchronization to prevent the buffer from being +// written to before the buffer has (a) been detached from the GL texture and +// (b) all GL reads from the buffer have completed. + +// During refactoring, do not support dequeuing the current buffer +#undef ALLOW_DEQUEUE_CURRENT_BUFFER + +#ifdef ALLOW_DEQUEUE_CURRENT_BUFFER +#define FLAG_ALLOW_DEQUEUE_CURRENT_BUFFER true +#warning "ALLOW_DEQUEUE_CURRENT_BUFFER enabled" +#else +#define FLAG_ALLOW_DEQUEUE_CURRENT_BUFFER false +#endif + +// Macros for including the BufferQueue name in log messages +#define ST_LOGV(x, ...) ALOGV("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) +#define ST_LOGD(x, ...) ALOGD("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) +#define ST_LOGI(x, ...) ALOGI("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) +#define ST_LOGW(x, ...) ALOGW("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) +#define ST_LOGE(x, ...) ALOGE("[%s] "x, mConsumerName.string(), ##__VA_ARGS__) + +#define ATRACE_BUFFER_INDEX(index) \ + if (ATRACE_ENABLED()) { \ + char ___traceBuf[1024]; \ + snprintf(___traceBuf, 1024, "%s: %d", mConsumerName.string(), \ + (index)); \ + android::ScopedTrace ___bufTracer(ATRACE_TAG, ___traceBuf); \ + } namespace android { -BufferQueue::ProxyConsumerListener::ProxyConsumerListener( - const wp& consumerListener): - mConsumerListener(consumerListener) {} +// Get an ID that's unique within this process. +static int32_t createProcessUniqueId() { + static volatile int32_t globalCounter = 0; + return android_atomic_inc(&globalCounter); +} -BufferQueue::ProxyConsumerListener::~ProxyConsumerListener() {} +static const char* scalingModeName(int scalingMode) { + switch (scalingMode) { + case NATIVE_WINDOW_SCALING_MODE_FREEZE: return "FREEZE"; + case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: return "SCALE_TO_WINDOW"; + case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: return "SCALE_CROP"; + default: return "Unknown"; + } +} -void BufferQueue::ProxyConsumerListener::onFrameAvailable( - const BufferItem& item) { - sp listener(mConsumerListener.promote()); - if (listener != NULL) { - listener->onFrameAvailable(item); +BufferQueue::BufferQueue( bool allowSynchronousMode, int bufferCount ) : + mDefaultWidth(1), + mDefaultHeight(1), + mPixelFormat(PIXEL_FORMAT_RGBA_8888), + mMinUndequeuedBuffers(bufferCount), + mMinAsyncBufferSlots(bufferCount + 1), + mMinSyncBufferSlots(bufferCount), + mBufferCount(mMinAsyncBufferSlots), + mClientBufferCount(0), + mServerBufferCount(mMinAsyncBufferSlots), + mSynchronousMode(false), + mAllowSynchronousMode(allowSynchronousMode), + mConnectedApi(NO_CONNECTED_API), + mAbandoned(false), + mFrameCounter(0), + mBufferHasBeenQueued(false), + mDefaultBufferFormat(0), + mConsumerUsageBits(0), + mTransformHint(0) +{ + // Choose a name using the PID and a process-unique ID. + mConsumerName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId()); + + ST_LOGV("BufferQueue"); + sp composer(ComposerService::getComposerService()); + mGraphicBufferAlloc = composer->createGraphicBufferAlloc(); + if (mGraphicBufferAlloc == 0) { + ST_LOGE("createGraphicBufferAlloc() failed in BufferQueue()"); } } -void BufferQueue::ProxyConsumerListener::onFrameReplaced( - const BufferItem& item) { - sp listener(mConsumerListener.promote()); - if (listener != NULL) { - listener->onFrameReplaced(item); +BufferQueue::~BufferQueue() { + ST_LOGV("~BufferQueue"); +} + +status_t BufferQueue::setBufferCountServerLocked(int bufferCount) { + if (bufferCount > NUM_BUFFER_SLOTS) + return BAD_VALUE; + + // special-case, nothing to do + if (bufferCount == mBufferCount) + return OK; + + if (!mClientBufferCount && + bufferCount >= mBufferCount) { + // easy, we just have more buffers + mBufferCount = bufferCount; + mServerBufferCount = bufferCount; + mDequeueCondition.broadcast(); + } else { + // we're here because we're either + // - reducing the number of available buffers + // - or there is a client-buffer-count in effect + + // less than 2 buffers is never allowed + if (bufferCount < 2) + return BAD_VALUE; + + // when there is non client-buffer-count in effect, the client is not + // allowed to dequeue more than one buffer at a time, + // so the next time they dequeue a buffer, we know that they don't + // own one. the actual resizing will happen during the next + // dequeueBuffer. + + mServerBufferCount = bufferCount; + mDequeueCondition.broadcast(); } + return OK; } -void BufferQueue::ProxyConsumerListener::onBuffersReleased() { - sp listener(mConsumerListener.promote()); +bool BufferQueue::isSynchronousMode() const { + Mutex::Autolock lock(mMutex); + return mSynchronousMode; +} + +void BufferQueue::setConsumerName(const String8& name) { + Mutex::Autolock lock(mMutex); + mConsumerName = name; +} + +status_t BufferQueue::setDefaultBufferFormat(uint32_t defaultFormat) { + Mutex::Autolock lock(mMutex); + mDefaultBufferFormat = defaultFormat; + return OK; +} + +status_t BufferQueue::setConsumerUsageBits(uint32_t usage) { + Mutex::Autolock lock(mMutex); + mConsumerUsageBits = usage; + return OK; +} + +status_t BufferQueue::setTransformHint(uint32_t hint) { + Mutex::Autolock lock(mMutex); + mTransformHint = hint; + return OK; +} + +status_t BufferQueue::setBufferCount(int bufferCount) { + ST_LOGV("setBufferCount: count=%d", bufferCount); + + sp listener; + { + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("setBufferCount: SurfaceTexture has been abandoned!"); + return NO_INIT; + } + if (bufferCount > NUM_BUFFER_SLOTS) { + ST_LOGE("setBufferCount: bufferCount larger than slots available"); + return BAD_VALUE; + } + + // Error out if the user has dequeued buffers + for (int i=0 ; i= minBufferSlots) ? + mServerBufferCount : minBufferSlots; + return setBufferCountServerLocked(bufferCount); + } + + if (bufferCount < minBufferSlots) { + ST_LOGE("setBufferCount: requested buffer count (%d) is less than " + "minimum (%d)", bufferCount, minBufferSlots); + return BAD_VALUE; + } + + // here we're guaranteed that the client doesn't have dequeued buffers + // and will release all of its buffer references. + freeAllBuffersLocked(); + mBufferCount = bufferCount; + mClientBufferCount = bufferCount; + mBufferHasBeenQueued = false; + mQueue.clear(); + mDequeueCondition.broadcast(); + listener = mConsumerListener; + } // scope for lock + if (listener != NULL) { listener->onBuffersReleased(); } + + return OK; +} + +int BufferQueue::query(int what, int* outValue) +{ + ATRACE_CALL(); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("query: SurfaceTexture has been abandoned!"); + return NO_INIT; + } + + int value; + switch (what) { + case NATIVE_WINDOW_WIDTH: + value = mDefaultWidth; + break; + case NATIVE_WINDOW_HEIGHT: + value = mDefaultHeight; + break; + case NATIVE_WINDOW_FORMAT: + value = mPixelFormat; + break; + case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: + value = mSynchronousMode ? + (mMinUndequeuedBuffers-1) : mMinUndequeuedBuffers; + break; + case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: + value = (mQueue.size() >= 2); + break; + default: + return BAD_VALUE; + } + outValue[0] = value; + return NO_ERROR; +} + +status_t BufferQueue::requestBuffer(int slot, sp* buf) { + ATRACE_CALL(); + ST_LOGV("requestBuffer: slot=%d", slot); + Mutex::Autolock lock(mMutex); + if (mAbandoned) { + ST_LOGE("requestBuffer: SurfaceTexture has been abandoned!"); + return NO_INIT; + } + if (slot < 0 || mBufferCount <= slot) { + ST_LOGE("requestBuffer: slot index out of range [0, %d]: %d", + mBufferCount, slot); + return BAD_VALUE; + } + mSlots[slot].mRequestBufferCalled = true; + *buf = mSlots[slot].mGraphicBuffer; + return NO_ERROR; +} + +status_t BufferQueue::dequeueBuffer(int *outBuf, uint32_t w, uint32_t h, + uint32_t format, uint32_t usage) { + ATRACE_CALL(); + ST_LOGV("dequeueBuffer: w=%d h=%d fmt=%#x usage=%#x", w, h, format, usage); + + if ((w && !h) || (!w && h)) { + ST_LOGE("dequeueBuffer: invalid size: w=%u, h=%u", w, h); + return BAD_VALUE; + } + + status_t returnFlags(OK); + EGLDisplay dpy = EGL_NO_DISPLAY; + EGLSyncKHR fence = EGL_NO_SYNC_KHR; + + { // Scope for the lock + Mutex::Autolock lock(mMutex); + + if (format == 0) { + format = mDefaultBufferFormat; + } + // turn on usage bits the consumer requested + usage |= mConsumerUsageBits; + + int found = -1; + int foundSync = -1; + int dequeuedCount = 0; + bool tryAgain = true; + while (tryAgain) { + if (mAbandoned) { + ST_LOGE("dequeueBuffer: SurfaceTexture has been abandoned!"); + return NO_INIT; + } + + // We need to wait for the FIFO to drain if the number of buffer + // needs to change. + // + // The condition "number of buffers needs to change" is true if + // - the client doesn't care about how many buffers there are + // - AND the actual number of buffer is different from what was + // set in the last setBufferCountServer() + // - OR - + // setBufferCountServer() was set to a value incompatible with + // the synchronization mode (for instance because the sync mode + // changed since) + // + // As long as this condition is true AND the FIFO is not empty, we + // wait on mDequeueCondition. + + const int minBufferCountNeeded = mSynchronousMode ? + mMinSyncBufferSlots : mMinAsyncBufferSlots; + + const bool numberOfBuffersNeedsToChange = !mClientBufferCount && + ((mServerBufferCount != mBufferCount) || + (mServerBufferCount < minBufferCountNeeded)); + + if (!mQueue.isEmpty() && numberOfBuffersNeedsToChange) { + // wait for the FIFO to drain + mDequeueCondition.wait(mMutex); + // NOTE: we continue here because we need to reevaluate our + // whole state (eg: we could be abandoned or disconnected) + continue; + } + + if (numberOfBuffersNeedsToChange) { + // here we're guaranteed that mQueue is empty + freeAllBuffersLocked(); + mBufferCount = mServerBufferCount; + if (mBufferCount < minBufferCountNeeded) + mBufferCount = minBufferCountNeeded; + mBufferHasBeenQueued = false; + returnFlags |= ISurfaceTexture::RELEASE_ALL_BUFFERS; + } + + // look for a free buffer to give to the client + found = INVALID_BUFFER_SLOT; + foundSync = INVALID_BUFFER_SLOT; + dequeuedCount = 0; + for (int i = 0; i < mBufferCount; i++) { + const int state = mSlots[i].mBufferState; + if (state == BufferSlot::DEQUEUED) { + dequeuedCount++; + } + + // this logic used to be if (FLAG_ALLOW_DEQUEUE_CURRENT_BUFFER) + // but dequeuing the current buffer is disabled. + if (false) { + // This functionality has been temporarily removed so + // BufferQueue and SurfaceTexture can be refactored into + // separate objects + } else { + if (state == BufferSlot::FREE) { + /* We return the oldest of the free buffers to avoid + * stalling the producer if possible. This is because + * the consumer may still have pending reads of the + * buffers in flight. + */ + bool isOlder = mSlots[i].mFrameNumber < + mSlots[found].mFrameNumber; + if (found < 0 || isOlder) { + foundSync = i; + found = i; + } + } + } + } + + // clients are not allowed to dequeue more than one buffer + // if they didn't set a buffer count. + if (!mClientBufferCount && dequeuedCount) { + ST_LOGE("dequeueBuffer: can't dequeue multiple buffers without " + "setting the buffer count"); + return -EINVAL; + } + + // See whether a buffer has been queued since the last + // setBufferCount so we know whether to perform the + // mMinUndequeuedBuffers check below. + if (mBufferHasBeenQueued) { + // make sure the client is not trying to dequeue more buffers + // than allowed. + const int avail = mBufferCount - (dequeuedCount+1); + if (avail < (mMinUndequeuedBuffers-int(mSynchronousMode))) { + ST_LOGE("dequeueBuffer: mMinUndequeuedBuffers=%d exceeded " + "(dequeued=%d)", + mMinUndequeuedBuffers-int(mSynchronousMode), + dequeuedCount); + return -EBUSY; + } + } + + // if no buffer is found, wait for a buffer to be released + tryAgain = found == INVALID_BUFFER_SLOT; + if (tryAgain) { + mDequeueCondition.wait(mMutex); + } + } + + + if (found == INVALID_BUFFER_SLOT) { + // This should not happen. + ST_LOGE("dequeueBuffer: no available buffer slots"); + return -EBUSY; + } + + const int buf = found; + *outBuf = found; + + ATRACE_BUFFER_INDEX(buf); + + const bool useDefaultSize = !w && !h; + if (useDefaultSize) { + // use the default size + w = mDefaultWidth; + h = mDefaultHeight; + } + + const bool updateFormat = (format != 0); + if (!updateFormat) { + // keep the current (or default) format + format = mPixelFormat; + } + + // buffer is now in DEQUEUED (but can also be current at the same time, + // if we're in synchronous mode) + mSlots[buf].mBufferState = BufferSlot::DEQUEUED; + + const sp& buffer(mSlots[buf].mGraphicBuffer); + if ((buffer == NULL) || + (uint32_t(buffer->width) != w) || + (uint32_t(buffer->height) != h) || + (uint32_t(buffer->format) != format) || + ((uint32_t(buffer->usage) & usage) != usage)) + { + status_t error; + sp graphicBuffer( + mGraphicBufferAlloc->createGraphicBuffer( + w, h, format, usage, &error)); + if (graphicBuffer == 0) { + ST_LOGE("dequeueBuffer: SurfaceComposer::createGraphicBuffer " + "failed"); + return error; + } + if (updateFormat) { + mPixelFormat = format; + } + + mSlots[buf].mAcquireCalled = false; + mSlots[buf].mGraphicBuffer = graphicBuffer; + mSlots[buf].mRequestBufferCalled = false; + mSlots[buf].mFence = EGL_NO_SYNC_KHR; + mSlots[buf].mEglDisplay = EGL_NO_DISPLAY; + + returnFlags |= ISurfaceTexture::BUFFER_NEEDS_REALLOCATION; + } + + dpy = mSlots[buf].mEglDisplay; + fence = mSlots[buf].mFence; + mSlots[buf].mFence = EGL_NO_SYNC_KHR; + } // end lock scope + + if (fence != EGL_NO_SYNC_KHR) { + EGLint result = eglClientWaitSyncKHR(dpy, fence, 0, 1000000000); + // If something goes wrong, log the error, but return the buffer without + // synchronizing access to it. It's too late at this point to abort the + // dequeue operation. + if (result == EGL_FALSE) { + ST_LOGE("dequeueBuffer: error waiting for fence: %#x", eglGetError()); + } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { + ST_LOGE("dequeueBuffer: timeout waiting for fence"); + } + eglDestroySyncKHR(dpy, fence); + } + + ST_LOGV("dequeueBuffer: returning slot=%d buf=%p flags=%#x", *outBuf, + mSlots[*outBuf].mGraphicBuffer->handle, returnFlags); + + return returnFlags; +} + +status_t BufferQueue::setSynchronousMode(bool enabled) { + ATRACE_CALL(); + ST_LOGV("setSynchronousMode: enabled=%d", enabled); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("setSynchronousMode: SurfaceTexture has been abandoned!"); + return NO_INIT; + } + + status_t err = OK; + if (!mAllowSynchronousMode && enabled) + return err; + + if (!enabled) { + // going to asynchronous mode, drain the queue + err = drainQueueLocked(); + if (err != NO_ERROR) + return err; + } + + if (mSynchronousMode != enabled) { + // - if we're going to asynchronous mode, the queue is guaranteed to be + // empty here + // - if the client set the number of buffers, we're guaranteed that + // we have at least 3 (because we don't allow less) + mSynchronousMode = enabled; + mDequeueCondition.broadcast(); + } + return err; } -void BufferQueue::ProxyConsumerListener::onSidebandStreamChanged() { - sp listener(mConsumerListener.promote()); +status_t BufferQueue::queueBuffer(int buf, + const QueueBufferInput& input, QueueBufferOutput* output) { + ATRACE_CALL(); + ATRACE_BUFFER_INDEX(buf); + + Rect crop; + uint32_t transform; + int scalingMode; + int64_t timestamp; + + input.deflate(×tamp, &crop, &scalingMode, &transform); + + ST_LOGV("queueBuffer: slot=%d time=%#llx crop=[%d,%d,%d,%d] tr=%#x " + "scale=%s", + buf, timestamp, crop.left, crop.top, crop.right, crop.bottom, + transform, scalingModeName(scalingMode)); + + sp listener; + + { // scope for the lock + Mutex::Autolock lock(mMutex); + if (mAbandoned) { + ST_LOGE("queueBuffer: SurfaceTexture has been abandoned!"); + return NO_INIT; + } + if (buf < 0 || buf >= mBufferCount) { + ST_LOGE("queueBuffer: slot index out of range [0, %d]: %d", + mBufferCount, buf); + return -EINVAL; + } else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) { + ST_LOGE("queueBuffer: slot %d is not owned by the client " + "(state=%d)", buf, mSlots[buf].mBufferState); + return -EINVAL; + } else if (!mSlots[buf].mRequestBufferCalled) { + ST_LOGE("queueBuffer: slot %d was enqueued without requesting a " + "buffer", buf); + return -EINVAL; + } + + const sp& graphicBuffer(mSlots[buf].mGraphicBuffer); + Rect bufferRect(graphicBuffer->getWidth(), graphicBuffer->getHeight()); + Rect croppedCrop; + crop.intersect(bufferRect, &croppedCrop); + if (croppedCrop != crop) { + ST_LOGE("queueBuffer: crop rect is not contained within the " + "buffer in slot %d", buf); + return -EINVAL; + } + + if (mSynchronousMode) { + // In synchronous mode we queue all buffers in a FIFO. + mQueue.push_back(buf); + + // Synchronous mode always signals that an additional frame should + // be consumed. + listener = mConsumerListener; + } else { + // In asynchronous mode we only keep the most recent buffer. + if (mQueue.empty()) { + mQueue.push_back(buf); + + // Asynchronous mode only signals that a frame should be + // consumed if no previous frame was pending. If a frame were + // pending then the consumer would have already been notified. + listener = mConsumerListener; + } else { + Fifo::iterator front(mQueue.begin()); + // buffer currently queued is freed + mSlots[*front].mBufferState = BufferSlot::FREE; + // and we record the new buffer index in the queued list + *front = buf; + } + } + + mSlots[buf].mTimestamp = timestamp; + mSlots[buf].mCrop = crop; + mSlots[buf].mTransform = transform; + + switch (scalingMode) { + case NATIVE_WINDOW_SCALING_MODE_FREEZE: + case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: + case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: + break; + default: + ST_LOGE("unknown scaling mode: %d (ignoring)", scalingMode); + scalingMode = mSlots[buf].mScalingMode; + break; + } + + mSlots[buf].mBufferState = BufferSlot::QUEUED; + mSlots[buf].mScalingMode = scalingMode; + mFrameCounter++; + mSlots[buf].mFrameNumber = mFrameCounter; + + mBufferHasBeenQueued = true; + mDequeueCondition.broadcast(); + + output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, + mQueue.size()); + + ATRACE_INT(mConsumerName.string(), mQueue.size()); + } // scope for the lock + + // call back without lock held + if (listener != 0) { + listener->onFrameAvailable(); + } + return OK; +} + +void BufferQueue::cancelBuffer(int buf) { + ATRACE_CALL(); + ST_LOGV("cancelBuffer: slot=%d", buf); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGW("cancelBuffer: BufferQueue has been abandoned!"); + return; + } + + if (buf < 0 || buf >= mBufferCount) { + ST_LOGE("cancelBuffer: slot index out of range [0, %d]: %d", + mBufferCount, buf); + return; + } else if (mSlots[buf].mBufferState != BufferSlot::DEQUEUED) { + ST_LOGE("cancelBuffer: slot %d is not owned by the client (state=%d)", + buf, mSlots[buf].mBufferState); + return; + } + mSlots[buf].mBufferState = BufferSlot::FREE; + mSlots[buf].mFrameNumber = 0; + mDequeueCondition.broadcast(); +} + +status_t BufferQueue::connect(int api, QueueBufferOutput* output) { + ATRACE_CALL(); + ST_LOGV("connect: api=%d", api); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("connect: BufferQueue has been abandoned!"); + return NO_INIT; + } + + if (mConsumerListener == NULL) { + ST_LOGE("connect: BufferQueue has no consumer!"); + return NO_INIT; + } + + int err = NO_ERROR; + switch (api) { + case NATIVE_WINDOW_API_EGL: + case NATIVE_WINDOW_API_CPU: + case NATIVE_WINDOW_API_MEDIA: + case NATIVE_WINDOW_API_CAMERA: + if (mConnectedApi != NO_CONNECTED_API) { + ST_LOGE("connect: already connected (cur=%d, req=%d)", + mConnectedApi, api); + err = -EINVAL; + } else { + mConnectedApi = api; + output->inflate(mDefaultWidth, mDefaultHeight, mTransformHint, + mQueue.size()); + } + break; + default: + err = -EINVAL; + break; + } + + mBufferHasBeenQueued = false; + + return err; +} + +status_t BufferQueue::disconnect(int api) { + ATRACE_CALL(); + ST_LOGV("disconnect: api=%d", api); + + int err = NO_ERROR; + sp listener; + + { // Scope for the lock + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + // it is not really an error to disconnect after the surface + // has been abandoned, it should just be a no-op. + return NO_ERROR; + } + + switch (api) { + case NATIVE_WINDOW_API_EGL: + case NATIVE_WINDOW_API_CPU: + case NATIVE_WINDOW_API_MEDIA: + case NATIVE_WINDOW_API_CAMERA: + if (mConnectedApi == api) { + drainQueueAndFreeBuffersLocked(); + mConnectedApi = NO_CONNECTED_API; + mDequeueCondition.broadcast(); + listener = mConsumerListener; + } else { + ST_LOGE("disconnect: connected to another api (cur=%d, req=%d)", + mConnectedApi, api); + err = -EINVAL; + } + break; + default: + ST_LOGE("disconnect: unknown API %d", api); + err = -EINVAL; + break; + } + } + if (listener != NULL) { - listener->onSidebandStreamChanged(); + listener->onBuffersReleased(); + } + + return err; +} + +void BufferQueue::dump(String8& result) const +{ + char buffer[1024]; + BufferQueue::dump(result, "", buffer, 1024); +} + +void BufferQueue::dump(String8& result, const char* prefix, + char* buffer, size_t SIZE) const +{ + Mutex::Autolock _l(mMutex); + + String8 fifo; + int fifoSize = 0; + Fifo::const_iterator i(mQueue.begin()); + while (i != mQueue.end()) { + snprintf(buffer, SIZE, "%02d ", *i++); + fifoSize++; + fifo.append(buffer); + } + + snprintf(buffer, SIZE, + "%s-BufferQueue mBufferCount=%d, mSynchronousMode=%d, default-size=[%dx%d], " + "mPixelFormat=%d, FIFO(%d)={%s}\n", + prefix, mBufferCount, mSynchronousMode, mDefaultWidth, + mDefaultHeight, mPixelFormat, fifoSize, fifo.string()); + result.append(buffer); + + + struct { + const char * operator()(int state) const { + switch (state) { + case BufferSlot::DEQUEUED: return "DEQUEUED"; + case BufferSlot::QUEUED: return "QUEUED"; + case BufferSlot::FREE: return "FREE"; + case BufferSlot::ACQUIRED: return "ACQUIRED"; + default: return "Unknown"; + } + } + } stateName; + + for (int i=0 ; i":" ", i, + stateName(slot.mBufferState), + slot.mCrop.left, slot.mCrop.top, slot.mCrop.right, + slot.mCrop.bottom, slot.mTransform, slot.mTimestamp, + scalingModeName(slot.mScalingMode) + ); + result.append(buffer); + + const sp& buf(slot.mGraphicBuffer); + if (buf != NULL) { + snprintf(buffer, SIZE, + ", %p [%4ux%4u:%4u,%3X]", + buf->handle, buf->width, buf->height, buf->stride, + buf->format); + result.append(buffer); + } + result.append("\n"); } } -void BufferQueue::createBufferQueue(sp* outProducer, - sp* outConsumer, - const sp& allocator) { - LOG_ALWAYS_FATAL_IF(outProducer == NULL, - "BufferQueue: outProducer must not be NULL"); - LOG_ALWAYS_FATAL_IF(outConsumer == NULL, - "BufferQueue: outConsumer must not be NULL"); +void BufferQueue::freeBufferLocked(int i) { + mSlots[i].mGraphicBuffer = 0; + if (mSlots[i].mBufferState == BufferSlot::ACQUIRED) { + mSlots[i].mNeedsCleanupOnRelease = true; + } + mSlots[i].mBufferState = BufferSlot::FREE; + mSlots[i].mFrameNumber = 0; + mSlots[i].mAcquireCalled = false; - sp core(new BufferQueueCore(allocator)); - LOG_ALWAYS_FATAL_IF(core == NULL, - "BufferQueue: failed to create BufferQueueCore"); + // destroy fence as BufferQueue now takes ownership + if (mSlots[i].mFence != EGL_NO_SYNC_KHR) { + eglDestroySyncKHR(mSlots[i].mEglDisplay, mSlots[i].mFence); + mSlots[i].mFence = EGL_NO_SYNC_KHR; + } +} + +void BufferQueue::freeAllBuffersLocked() { + ALOGW_IF(!mQueue.isEmpty(), + "freeAllBuffersLocked called but mQueue is not empty"); + mQueue.clear(); + mBufferHasBeenQueued = false; + for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { + freeBufferLocked(i); + } +} + +status_t BufferQueue::acquireBuffer(BufferItem *buffer) { + ATRACE_CALL(); + Mutex::Autolock _l(mMutex); + // check if queue is empty + // In asynchronous mode the list is guaranteed to be one buffer + // deep, while in synchronous mode we use the oldest buffer. + if (!mQueue.empty()) { + Fifo::iterator front(mQueue.begin()); + int buf = *front; + + ATRACE_BUFFER_INDEX(buf); + + if (mSlots[buf].mAcquireCalled) { + buffer->mGraphicBuffer = NULL; + } else { + buffer->mGraphicBuffer = mSlots[buf].mGraphicBuffer; + } + buffer->mCrop = mSlots[buf].mCrop; + buffer->mTransform = mSlots[buf].mTransform; + buffer->mScalingMode = mSlots[buf].mScalingMode; + buffer->mFrameNumber = mSlots[buf].mFrameNumber; + buffer->mTimestamp = mSlots[buf].mTimestamp; + buffer->mBuf = buf; + mSlots[buf].mAcquireCalled = true; + + mSlots[buf].mBufferState = BufferSlot::ACQUIRED; + mQueue.erase(front); + mDequeueCondition.broadcast(); + + ATRACE_INT(mConsumerName.string(), mQueue.size()); + } else { + return NO_BUFFER_AVAILABLE; + } + + return OK; +} - sp producer(new BufferQueueProducer(core)); - LOG_ALWAYS_FATAL_IF(producer == NULL, - "BufferQueue: failed to create BufferQueueProducer"); +status_t BufferQueue::releaseBuffer(int buf, EGLDisplay display, + EGLSyncKHR fence) { + ATRACE_CALL(); + ATRACE_BUFFER_INDEX(buf); - sp consumer(new BufferQueueConsumer(core)); - LOG_ALWAYS_FATAL_IF(consumer == NULL, - "BufferQueue: failed to create BufferQueueConsumer"); + Mutex::Autolock _l(mMutex); - *outProducer = producer; - *outConsumer = consumer; + if (buf == INVALID_BUFFER_SLOT) { + return -EINVAL; + } + + mSlots[buf].mEglDisplay = display; + mSlots[buf].mFence = fence; + + // The buffer can now only be released if its in the acquired state + if (mSlots[buf].mBufferState == BufferSlot::ACQUIRED) { + mSlots[buf].mBufferState = BufferSlot::FREE; + } else if (mSlots[buf].mNeedsCleanupOnRelease) { + ST_LOGV("releasing a stale buf %d its state was %d", buf, mSlots[buf].mBufferState); + mSlots[buf].mNeedsCleanupOnRelease = false; + return STALE_BUFFER_SLOT; + } else { + ST_LOGE("attempted to release buf %d but its state was %d", buf, mSlots[buf].mBufferState); + return -EINVAL; + } + + mDequeueCondition.broadcast(); + return OK; +} + +status_t BufferQueue::consumerConnect(const sp& consumerListener) { + ST_LOGV("consumerConnect"); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("consumerConnect: BufferQueue has been abandoned!"); + return NO_INIT; + } + + mConsumerListener = consumerListener; + + return OK; +} + +status_t BufferQueue::consumerDisconnect() { + ST_LOGV("consumerDisconnect"); + Mutex::Autolock lock(mMutex); + + if (mConsumerListener == NULL) { + ST_LOGE("consumerDisconnect: No consumer is connected!"); + return -EINVAL; + } + + mAbandoned = true; + mConsumerListener = NULL; + mQueue.clear(); + freeAllBuffersLocked(); + mDequeueCondition.broadcast(); + return OK; +} + +status_t BufferQueue::getReleasedBuffers(uint32_t* slotMask) { + ST_LOGV("getReleasedBuffers"); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("getReleasedBuffers: BufferQueue has been abandoned!"); + return NO_INIT; + } + + uint32_t mask = 0; + for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { + if (!mSlots[i].mAcquireCalled) { + mask |= 1 << i; + } + } + *slotMask = mask; + + ST_LOGV("getReleasedBuffers: returning mask %#x", mask); + return NO_ERROR; +} + +status_t BufferQueue::setDefaultBufferSize(uint32_t w, uint32_t h) +{ + ST_LOGV("setDefaultBufferSize: w=%d, h=%d", w, h); + if (!w || !h) { + ST_LOGE("setDefaultBufferSize: dimensions cannot be 0 (w=%d, h=%d)", + w, h); + return BAD_VALUE; + } + + Mutex::Autolock lock(mMutex); + mDefaultWidth = w; + mDefaultHeight = h; + return OK; +} + +status_t BufferQueue::setBufferCountServer(int bufferCount) { + ATRACE_CALL(); + Mutex::Autolock lock(mMutex); + return setBufferCountServerLocked(bufferCount); +} + +void BufferQueue::freeAllBuffersExceptHeadLocked() { + int head = -1; + if (!mQueue.empty()) { + Fifo::iterator front(mQueue.begin()); + head = *front; + } + mBufferHasBeenQueued = false; + for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { + if (i != head) { + freeBufferLocked(i); + } + } +} + +status_t BufferQueue::drainQueueLocked() { + while (mSynchronousMode && !mQueue.isEmpty()) { + mDequeueCondition.wait(mMutex); + if (mAbandoned) { + ST_LOGE("drainQueueLocked: BufferQueue has been abandoned!"); + return NO_INIT; + } + if (mConnectedApi == NO_CONNECTED_API) { + ST_LOGE("drainQueueLocked: BufferQueue is not connected!"); + return NO_INIT; + } + } + return NO_ERROR; +} + +status_t BufferQueue::drainQueueAndFreeBuffersLocked() { + status_t err = drainQueueLocked(); + if (err == NO_ERROR) { + if (mSynchronousMode) { + freeAllBuffersLocked(); + } else { + freeAllBuffersExceptHeadLocked(); + } + } + return err; +} + +BufferQueue::ProxyConsumerListener::ProxyConsumerListener( + const wp& consumerListener): + mConsumerListener(consumerListener) {} + +BufferQueue::ProxyConsumerListener::~ProxyConsumerListener() {} + +void BufferQueue::ProxyConsumerListener::onFrameAvailable() { + sp listener(mConsumerListener.promote()); + if (listener != NULL) { + listener->onFrameAvailable(); + } +} + +void BufferQueue::ProxyConsumerListener::onBuffersReleased() { + sp listener(mConsumerListener.promote()); + if (listener != NULL) { + listener->onBuffersReleased(); + } } }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueueProducer.cpp android-platform-frameworks-native-21/libs/gui/BufferQueueProducer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferQueueProducer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferQueueProducer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1107 +0,0 @@ -/* - * Copyright 2014 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 - -#define LOG_TAG "BufferQueueProducer" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#define EGL_EGLEXT_PROTOTYPES - -#include -#include -#include -#include -#include -#include - -#include -#include - -namespace android { - -BufferQueueProducer::BufferQueueProducer(const sp& core) : - mCore(core), - mSlots(core->mSlots), - mConsumerName(), - mStickyTransform(0), - mLastQueueBufferFence(Fence::NO_FENCE), - mCallbackMutex(), - mNextCallbackTicket(0), - mCurrentCallbackTicket(0), - mCallbackCondition() {} - -BufferQueueProducer::~BufferQueueProducer() {} - -status_t BufferQueueProducer::requestBuffer(int slot, sp* buf) { - ATRACE_CALL(); - BQ_LOGV("requestBuffer: slot %d", slot); - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("requestBuffer: BufferQueue has been abandoned"); - return NO_INIT; - } - - if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { - BQ_LOGE("requestBuffer: slot index %d out of range [0, %d)", - slot, BufferQueueDefs::NUM_BUFFER_SLOTS); - return BAD_VALUE; - } else if (mSlots[slot].mBufferState != BufferSlot::DEQUEUED) { - BQ_LOGE("requestBuffer: slot %d is not owned by the producer " - "(state = %d)", slot, mSlots[slot].mBufferState); - return BAD_VALUE; - } - - mSlots[slot].mRequestBufferCalled = true; - *buf = mSlots[slot].mGraphicBuffer; - return NO_ERROR; -} - -status_t BufferQueueProducer::setBufferCount(int bufferCount) { - ATRACE_CALL(); - BQ_LOGV("setBufferCount: count = %d", bufferCount); - - sp listener; - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - mCore->waitWhileAllocatingLocked(); - - if (mCore->mIsAbandoned) { - BQ_LOGE("setBufferCount: BufferQueue has been abandoned"); - return NO_INIT; - } - - if (bufferCount > BufferQueueDefs::NUM_BUFFER_SLOTS) { - BQ_LOGE("setBufferCount: bufferCount %d too large (max %d)", - bufferCount, BufferQueueDefs::NUM_BUFFER_SLOTS); - return BAD_VALUE; - } - - // There must be no dequeued buffers when changing the buffer count. - for (int s = 0; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - if (mSlots[s].mBufferState == BufferSlot::DEQUEUED) { - BQ_LOGE("setBufferCount: buffer owned by producer"); - return BAD_VALUE; - } - } - - if (bufferCount == 0) { - mCore->mOverrideMaxBufferCount = 0; - mCore->mDequeueCondition.broadcast(); - return NO_ERROR; - } - - const int minBufferSlots = mCore->getMinMaxBufferCountLocked(false); - if (bufferCount < minBufferSlots) { - BQ_LOGE("setBufferCount: requested buffer count %d is less than " - "minimum %d", bufferCount, minBufferSlots); - return BAD_VALUE; - } - - // Here we are guaranteed that the producer doesn't have any dequeued - // buffers and will release all of its buffer references. We don't - // clear the queue, however, so that currently queued buffers still - // get displayed. - mCore->freeAllBuffersLocked(); - mCore->mOverrideMaxBufferCount = bufferCount; - mCore->mDequeueCondition.broadcast(); - listener = mCore->mConsumerListener; - } // Autolock scope - - // Call back without lock held - if (listener != NULL) { - listener->onBuffersReleased(); - } - - return NO_ERROR; -} - -status_t BufferQueueProducer::waitForFreeSlotThenRelock(const char* caller, - bool async, int* found, status_t* returnFlags) const { - bool tryAgain = true; - while (tryAgain) { - if (mCore->mIsAbandoned) { - BQ_LOGE("%s: BufferQueue has been abandoned", caller); - return NO_INIT; - } - - const int maxBufferCount = mCore->getMaxBufferCountLocked(async); - if (async && mCore->mOverrideMaxBufferCount) { - // FIXME: Some drivers are manually setting the buffer count - // (which they shouldn't), so we do this extra test here to - // handle that case. This is TEMPORARY until we get this fixed. - if (mCore->mOverrideMaxBufferCount < maxBufferCount) { - BQ_LOGE("%s: async mode is invalid with buffer count override", - caller); - return BAD_VALUE; - } - } - - // Free up any buffers that are in slots beyond the max buffer count - for (int s = maxBufferCount; s < BufferQueueDefs::NUM_BUFFER_SLOTS; ++s) { - assert(mSlots[s].mBufferState == BufferSlot::FREE); - if (mSlots[s].mGraphicBuffer != NULL) { - mCore->freeBufferLocked(s); - *returnFlags |= RELEASE_ALL_BUFFERS; - } - } - - int dequeuedCount = 0; - int acquiredCount = 0; - for (int s = 0; s < maxBufferCount; ++s) { - switch (mSlots[s].mBufferState) { - case BufferSlot::DEQUEUED: - ++dequeuedCount; - break; - case BufferSlot::ACQUIRED: - ++acquiredCount; - break; - default: - break; - } - } - - // Producers are not allowed to dequeue more than one buffer if they - // did not set a buffer count - if (!mCore->mOverrideMaxBufferCount && dequeuedCount) { - BQ_LOGE("%s: can't dequeue multiple buffers without setting the " - "buffer count", caller); - return INVALID_OPERATION; - } - - // See whether a buffer has been queued since the last - // setBufferCount so we know whether to perform the min undequeued - // buffers check below - if (mCore->mBufferHasBeenQueued) { - // Make sure the producer is not trying to dequeue more buffers - // than allowed - const int newUndequeuedCount = - maxBufferCount - (dequeuedCount + 1); - const int minUndequeuedCount = - mCore->getMinUndequeuedBufferCountLocked(async); - if (newUndequeuedCount < minUndequeuedCount) { - BQ_LOGE("%s: min undequeued buffer count (%d) exceeded " - "(dequeued=%d undequeued=%d)", - caller, minUndequeuedCount, - dequeuedCount, newUndequeuedCount); - return INVALID_OPERATION; - } - } - - *found = BufferQueueCore::INVALID_BUFFER_SLOT; - - // If we disconnect and reconnect quickly, we can be in a state where - // our slots are empty but we have many buffers in the queue. This can - // cause us to run out of memory if we outrun the consumer. Wait here if - // it looks like we have too many buffers queued up. - bool tooManyBuffers = mCore->mQueue.size() - > static_cast(maxBufferCount); - if (tooManyBuffers) { - BQ_LOGV("%s: queue size is %zu, waiting", caller, - mCore->mQueue.size()); - } else { - if (!mCore->mFreeBuffers.empty()) { - auto slot = mCore->mFreeBuffers.begin(); - *found = *slot; - mCore->mFreeBuffers.erase(slot); - } else if (mCore->mAllowAllocation && !mCore->mFreeSlots.empty()) { - auto slot = mCore->mFreeSlots.begin(); - // Only return free slots up to the max buffer count - if (*slot < maxBufferCount) { - *found = *slot; - mCore->mFreeSlots.erase(slot); - } - } - } - - // If no buffer is found, or if the queue has too many buffers - // outstanding, wait for a buffer to be acquired or released, or for the - // max buffer count to change. - tryAgain = (*found == BufferQueueCore::INVALID_BUFFER_SLOT) || - tooManyBuffers; - if (tryAgain) { - // Return an error if we're in non-blocking mode (producer and - // consumer are controlled by the application). - // However, the consumer is allowed to briefly acquire an extra - // buffer (which could cause us to have to wait here), which is - // okay, since it is only used to implement an atomic acquire + - // release (e.g., in GLConsumer::updateTexImage()) - if (mCore->mDequeueBufferCannotBlock && - (acquiredCount <= mCore->mMaxAcquiredBufferCount)) { - return WOULD_BLOCK; - } - mCore->mDequeueCondition.wait(mCore->mMutex); - } - } // while (tryAgain) - - return NO_ERROR; -} - -status_t BufferQueueProducer::dequeueBuffer(int *outSlot, - sp *outFence, bool async, - uint32_t width, uint32_t height, PixelFormat format, uint32_t usage) { - ATRACE_CALL(); - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - mConsumerName = mCore->mConsumerName; - } // Autolock scope - - BQ_LOGV("dequeueBuffer: async=%s w=%u h=%u format=%#x, usage=%#x", - async ? "true" : "false", width, height, format, usage); - - if ((width && !height) || (!width && height)) { - BQ_LOGE("dequeueBuffer: invalid size: w=%u h=%u", width, height); - return BAD_VALUE; - } - - status_t returnFlags = NO_ERROR; - EGLDisplay eglDisplay = EGL_NO_DISPLAY; - EGLSyncKHR eglFence = EGL_NO_SYNC_KHR; - bool attachedByConsumer = false; - - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - mCore->waitWhileAllocatingLocked(); - - if (format == 0) { - format = mCore->mDefaultBufferFormat; - } - - // Enable the usage bits the consumer requested - usage |= mCore->mConsumerUsageBits; - - const bool useDefaultSize = !width && !height; - if (useDefaultSize) { - width = mCore->mDefaultWidth; - height = mCore->mDefaultHeight; - } - - int found = BufferItem::INVALID_BUFFER_SLOT; - while (found == BufferItem::INVALID_BUFFER_SLOT) { - status_t status = waitForFreeSlotThenRelock("dequeueBuffer", async, - &found, &returnFlags); - if (status != NO_ERROR) { - return status; - } - - // This should not happen - if (found == BufferQueueCore::INVALID_BUFFER_SLOT) { - BQ_LOGE("dequeueBuffer: no available buffer slots"); - return -EBUSY; - } - - const sp& buffer(mSlots[found].mGraphicBuffer); - - // If we are not allowed to allocate new buffers, - // waitForFreeSlotThenRelock must have returned a slot containing a - // buffer. If this buffer would require reallocation to meet the - // requested attributes, we free it and attempt to get another one. - if (!mCore->mAllowAllocation) { - if (buffer->needsReallocation(width, height, format, usage)) { - mCore->freeBufferLocked(found); - found = BufferItem::INVALID_BUFFER_SLOT; - continue; - } - } - } - - *outSlot = found; - ATRACE_BUFFER_INDEX(found); - - attachedByConsumer = mSlots[found].mAttachedByConsumer; - - mSlots[found].mBufferState = BufferSlot::DEQUEUED; - - const sp& buffer(mSlots[found].mGraphicBuffer); - if ((buffer == NULL) || - buffer->needsReallocation(width, height, format, usage)) - { - mSlots[found].mAcquireCalled = false; - mSlots[found].mGraphicBuffer = NULL; - mSlots[found].mRequestBufferCalled = false; - mSlots[found].mEglDisplay = EGL_NO_DISPLAY; - mSlots[found].mEglFence = EGL_NO_SYNC_KHR; - mSlots[found].mFence = Fence::NO_FENCE; - mCore->mBufferAge = 0; - - returnFlags |= BUFFER_NEEDS_REALLOCATION; - } else { - // We add 1 because that will be the frame number when this buffer - // is queued - mCore->mBufferAge = - mCore->mFrameCounter + 1 - mSlots[found].mFrameNumber; - } - - BQ_LOGV("dequeueBuffer: setting buffer age to %" PRIu64, - mCore->mBufferAge); - - if (CC_UNLIKELY(mSlots[found].mFence == NULL)) { - BQ_LOGE("dequeueBuffer: about to return a NULL fence - " - "slot=%d w=%d h=%d format=%u", - found, buffer->width, buffer->height, buffer->format); - } - - eglDisplay = mSlots[found].mEglDisplay; - eglFence = mSlots[found].mEglFence; - *outFence = mSlots[found].mFence; - mSlots[found].mEglFence = EGL_NO_SYNC_KHR; - mSlots[found].mFence = Fence::NO_FENCE; - - mCore->validateConsistencyLocked(); - } // Autolock scope - - if (returnFlags & BUFFER_NEEDS_REALLOCATION) { - status_t error; - BQ_LOGV("dequeueBuffer: allocating a new buffer for slot %d", *outSlot); - sp graphicBuffer(mCore->mAllocator->createGraphicBuffer( - width, height, format, usage, &error)); - if (graphicBuffer == NULL) { - BQ_LOGE("dequeueBuffer: createGraphicBuffer failed"); - return error; - } - - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("dequeueBuffer: BufferQueue has been abandoned"); - return NO_INIT; - } - - graphicBuffer->setGenerationNumber(mCore->mGenerationNumber); - mSlots[*outSlot].mGraphicBuffer = graphicBuffer; - } // Autolock scope - } - - if (attachedByConsumer) { - returnFlags |= BUFFER_NEEDS_REALLOCATION; - } - - if (eglFence != EGL_NO_SYNC_KHR) { - EGLint result = eglClientWaitSyncKHR(eglDisplay, eglFence, 0, - 1000000000); - // If something goes wrong, log the error, but return the buffer without - // synchronizing access to it. It's too late at this point to abort the - // dequeue operation. - if (result == EGL_FALSE) { - BQ_LOGE("dequeueBuffer: error %#x waiting for fence", - eglGetError()); - } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { - BQ_LOGE("dequeueBuffer: timeout waiting for fence"); - } - eglDestroySyncKHR(eglDisplay, eglFence); - } - - BQ_LOGV("dequeueBuffer: returning slot=%d/%" PRIu64 " buf=%p flags=%#x", - *outSlot, - mSlots[*outSlot].mFrameNumber, - mSlots[*outSlot].mGraphicBuffer->handle, returnFlags); - - return returnFlags; -} - -status_t BufferQueueProducer::detachBuffer(int slot) { - ATRACE_CALL(); - ATRACE_BUFFER_INDEX(slot); - BQ_LOGV("detachBuffer(P): slot %d", slot); - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("detachBuffer(P): BufferQueue has been abandoned"); - return NO_INIT; - } - - if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { - BQ_LOGE("detachBuffer(P): slot index %d out of range [0, %d)", - slot, BufferQueueDefs::NUM_BUFFER_SLOTS); - return BAD_VALUE; - } else if (mSlots[slot].mBufferState != BufferSlot::DEQUEUED) { - BQ_LOGE("detachBuffer(P): slot %d is not owned by the producer " - "(state = %d)", slot, mSlots[slot].mBufferState); - return BAD_VALUE; - } else if (!mSlots[slot].mRequestBufferCalled) { - BQ_LOGE("detachBuffer(P): buffer in slot %d has not been requested", - slot); - return BAD_VALUE; - } - - mCore->freeBufferLocked(slot); - mCore->mDequeueCondition.broadcast(); - mCore->validateConsistencyLocked(); - - return NO_ERROR; -} - -status_t BufferQueueProducer::detachNextBuffer(sp* outBuffer, - sp* outFence) { - ATRACE_CALL(); - - if (outBuffer == NULL) { - BQ_LOGE("detachNextBuffer: outBuffer must not be NULL"); - return BAD_VALUE; - } else if (outFence == NULL) { - BQ_LOGE("detachNextBuffer: outFence must not be NULL"); - return BAD_VALUE; - } - - Mutex::Autolock lock(mCore->mMutex); - mCore->waitWhileAllocatingLocked(); - - if (mCore->mIsAbandoned) { - BQ_LOGE("detachNextBuffer: BufferQueue has been abandoned"); - return NO_INIT; - } - - if (mCore->mFreeBuffers.empty()) { - return NO_MEMORY; - } - - int found = mCore->mFreeBuffers.front(); - mCore->mFreeBuffers.remove(found); - - BQ_LOGV("detachNextBuffer detached slot %d", found); - - *outBuffer = mSlots[found].mGraphicBuffer; - *outFence = mSlots[found].mFence; - mCore->freeBufferLocked(found); - mCore->validateConsistencyLocked(); - - return NO_ERROR; -} - -status_t BufferQueueProducer::attachBuffer(int* outSlot, - const sp& buffer) { - ATRACE_CALL(); - - if (outSlot == NULL) { - BQ_LOGE("attachBuffer(P): outSlot must not be NULL"); - return BAD_VALUE; - } else if (buffer == NULL) { - BQ_LOGE("attachBuffer(P): cannot attach NULL buffer"); - return BAD_VALUE; - } - - Mutex::Autolock lock(mCore->mMutex); - mCore->waitWhileAllocatingLocked(); - - if (buffer->getGenerationNumber() != mCore->mGenerationNumber) { - BQ_LOGE("attachBuffer: generation number mismatch [buffer %u] " - "[queue %u]", buffer->getGenerationNumber(), - mCore->mGenerationNumber); - return BAD_VALUE; - } - - status_t returnFlags = NO_ERROR; - int found; - // TODO: Should we provide an async flag to attachBuffer? It seems - // unlikely that buffers which we are attaching to a BufferQueue will - // be asynchronous (droppable), but it may not be impossible. - status_t status = waitForFreeSlotThenRelock("attachBuffer(P)", false, - &found, &returnFlags); - if (status != NO_ERROR) { - return status; - } - - // This should not happen - if (found == BufferQueueCore::INVALID_BUFFER_SLOT) { - BQ_LOGE("attachBuffer(P): no available buffer slots"); - return -EBUSY; - } - - *outSlot = found; - ATRACE_BUFFER_INDEX(*outSlot); - BQ_LOGV("attachBuffer(P): returning slot %d flags=%#x", - *outSlot, returnFlags); - - mSlots[*outSlot].mGraphicBuffer = buffer; - mSlots[*outSlot].mBufferState = BufferSlot::DEQUEUED; - mSlots[*outSlot].mEglFence = EGL_NO_SYNC_KHR; - mSlots[*outSlot].mFence = Fence::NO_FENCE; - mSlots[*outSlot].mRequestBufferCalled = true; - - mCore->validateConsistencyLocked(); - - return returnFlags; -} - -status_t BufferQueueProducer::queueBuffer(int slot, - const QueueBufferInput &input, QueueBufferOutput *output) { - ATRACE_CALL(); - ATRACE_BUFFER_INDEX(slot); - - int64_t timestamp; - bool isAutoTimestamp; - android_dataspace dataSpace; - Rect crop; - int scalingMode; - uint32_t transform; - uint32_t stickyTransform; - bool async; - sp fence; - input.deflate(×tamp, &isAutoTimestamp, &dataSpace, &crop, &scalingMode, - &transform, &async, &fence, &stickyTransform); - Region surfaceDamage = input.getSurfaceDamage(); - - if (fence == NULL) { - BQ_LOGE("queueBuffer: fence is NULL"); - return BAD_VALUE; - } - - switch (scalingMode) { - case NATIVE_WINDOW_SCALING_MODE_FREEZE: - case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: - case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: - case NATIVE_WINDOW_SCALING_MODE_NO_SCALE_CROP: - break; - default: - BQ_LOGE("queueBuffer: unknown scaling mode %d", scalingMode); - return BAD_VALUE; - } - - sp frameAvailableListener; - sp frameReplacedListener; - int callbackTicket = 0; - BufferItem item; - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("queueBuffer: BufferQueue has been abandoned"); - return NO_INIT; - } - - const int maxBufferCount = mCore->getMaxBufferCountLocked(async); - if (async && mCore->mOverrideMaxBufferCount) { - // FIXME: Some drivers are manually setting the buffer count - // (which they shouldn't), so we do this extra test here to - // handle that case. This is TEMPORARY until we get this fixed. - if (mCore->mOverrideMaxBufferCount < maxBufferCount) { - BQ_LOGE("queueBuffer: async mode is invalid with " - "buffer count override"); - return BAD_VALUE; - } - } - - if (slot < 0 || slot >= maxBufferCount) { - BQ_LOGE("queueBuffer: slot index %d out of range [0, %d)", - slot, maxBufferCount); - return BAD_VALUE; - } else if (mSlots[slot].mBufferState != BufferSlot::DEQUEUED) { - BQ_LOGE("queueBuffer: slot %d is not owned by the producer " - "(state = %d)", slot, mSlots[slot].mBufferState); - return BAD_VALUE; - } else if (!mSlots[slot].mRequestBufferCalled) { - BQ_LOGE("queueBuffer: slot %d was queued without requesting " - "a buffer", slot); - return BAD_VALUE; - } - - BQ_LOGV("queueBuffer: slot=%d/%" PRIu64 " time=%" PRIu64 " dataSpace=%d" - " crop=[%d,%d,%d,%d] transform=%#x scale=%s", - slot, mCore->mFrameCounter + 1, timestamp, dataSpace, - crop.left, crop.top, crop.right, crop.bottom, transform, - BufferItem::scalingModeName(static_cast(scalingMode))); - - const sp& graphicBuffer(mSlots[slot].mGraphicBuffer); - Rect bufferRect(graphicBuffer->getWidth(), graphicBuffer->getHeight()); - Rect croppedRect; - crop.intersect(bufferRect, &croppedRect); - if (croppedRect != crop) { - BQ_LOGE("queueBuffer: crop rect is not contained within the " - "buffer in slot %d", slot); - return BAD_VALUE; - } - - // Override UNKNOWN dataspace with consumer default - if (dataSpace == HAL_DATASPACE_UNKNOWN) { - dataSpace = mCore->mDefaultBufferDataSpace; - } - - mSlots[slot].mFence = fence; - mSlots[slot].mBufferState = BufferSlot::QUEUED; - ++mCore->mFrameCounter; - mSlots[slot].mFrameNumber = mCore->mFrameCounter; - - item.mAcquireCalled = mSlots[slot].mAcquireCalled; - item.mGraphicBuffer = mSlots[slot].mGraphicBuffer; - item.mCrop = crop; - item.mTransform = transform & - ~static_cast(NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY); - item.mTransformToDisplayInverse = - (transform & NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY) != 0; - item.mScalingMode = static_cast(scalingMode); - item.mTimestamp = timestamp; - item.mIsAutoTimestamp = isAutoTimestamp; - item.mDataSpace = dataSpace; - item.mFrameNumber = mCore->mFrameCounter; - item.mSlot = slot; - item.mFence = fence; - item.mIsDroppable = mCore->mDequeueBufferCannotBlock || async; - item.mSurfaceDamage = surfaceDamage; - - mStickyTransform = stickyTransform; - - if (mCore->mQueue.empty()) { - // When the queue is empty, we can ignore mDequeueBufferCannotBlock - // and simply queue this buffer - mCore->mQueue.push_back(item); - frameAvailableListener = mCore->mConsumerListener; - } else { - // When the queue is not empty, we need to look at the front buffer - // state to see if we need to replace it - BufferQueueCore::Fifo::iterator front(mCore->mQueue.begin()); - if (front->mIsDroppable) { - // If the front queued buffer is still being tracked, we first - // mark it as freed - if (mCore->stillTracking(front)) { - mSlots[front->mSlot].mBufferState = BufferSlot::FREE; - mCore->mFreeBuffers.push_front(front->mSlot); - } - // Overwrite the droppable buffer with the incoming one - *front = item; - frameReplacedListener = mCore->mConsumerListener; - } else { - mCore->mQueue.push_back(item); - frameAvailableListener = mCore->mConsumerListener; - } - } - - mCore->mBufferHasBeenQueued = true; - mCore->mDequeueCondition.broadcast(); - - output->inflate(mCore->mDefaultWidth, mCore->mDefaultHeight, - mCore->mTransformHint, - static_cast(mCore->mQueue.size())); - - ATRACE_INT(mCore->mConsumerName.string(), mCore->mQueue.size()); - - // Take a ticket for the callback functions - callbackTicket = mNextCallbackTicket++; - - mCore->validateConsistencyLocked(); - } // Autolock scope - - // Wait without lock held - if (mCore->mConnectedApi == NATIVE_WINDOW_API_EGL) { - // Waiting here allows for two full buffers to be queued but not a - // third. In the event that frames take varying time, this makes a - // small trade-off in favor of latency rather than throughput. - mLastQueueBufferFence->waitForever("Throttling EGL Production"); - mLastQueueBufferFence = fence; - } - - // Don't send the GraphicBuffer through the callback, and don't send - // the slot number, since the consumer shouldn't need it - item.mGraphicBuffer.clear(); - item.mSlot = BufferItem::INVALID_BUFFER_SLOT; - - // Call back without the main BufferQueue lock held, but with the callback - // lock held so we can ensure that callbacks occur in order - { - Mutex::Autolock lock(mCallbackMutex); - while (callbackTicket != mCurrentCallbackTicket) { - mCallbackCondition.wait(mCallbackMutex); - } - - if (frameAvailableListener != NULL) { - frameAvailableListener->onFrameAvailable(item); - } else if (frameReplacedListener != NULL) { - frameReplacedListener->onFrameReplaced(item); - } - - ++mCurrentCallbackTicket; - mCallbackCondition.broadcast(); - } - - return NO_ERROR; -} - -void BufferQueueProducer::cancelBuffer(int slot, const sp& fence) { - ATRACE_CALL(); - BQ_LOGV("cancelBuffer: slot %d", slot); - Mutex::Autolock lock(mCore->mMutex); - - if (mCore->mIsAbandoned) { - BQ_LOGE("cancelBuffer: BufferQueue has been abandoned"); - return; - } - - if (slot < 0 || slot >= BufferQueueDefs::NUM_BUFFER_SLOTS) { - BQ_LOGE("cancelBuffer: slot index %d out of range [0, %d)", - slot, BufferQueueDefs::NUM_BUFFER_SLOTS); - return; - } else if (mSlots[slot].mBufferState != BufferSlot::DEQUEUED) { - BQ_LOGE("cancelBuffer: slot %d is not owned by the producer " - "(state = %d)", slot, mSlots[slot].mBufferState); - return; - } else if (fence == NULL) { - BQ_LOGE("cancelBuffer: fence is NULL"); - return; - } - - mCore->mFreeBuffers.push_front(slot); - mSlots[slot].mBufferState = BufferSlot::FREE; - mSlots[slot].mFence = fence; - mCore->mDequeueCondition.broadcast(); - mCore->validateConsistencyLocked(); -} - -int BufferQueueProducer::query(int what, int *outValue) { - ATRACE_CALL(); - Mutex::Autolock lock(mCore->mMutex); - - if (outValue == NULL) { - BQ_LOGE("query: outValue was NULL"); - return BAD_VALUE; - } - - if (mCore->mIsAbandoned) { - BQ_LOGE("query: BufferQueue has been abandoned"); - return NO_INIT; - } - - int value; - switch (what) { - case NATIVE_WINDOW_WIDTH: - value = static_cast(mCore->mDefaultWidth); - break; - case NATIVE_WINDOW_HEIGHT: - value = static_cast(mCore->mDefaultHeight); - break; - case NATIVE_WINDOW_FORMAT: - value = static_cast(mCore->mDefaultBufferFormat); - break; - case NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS: - value = mCore->getMinUndequeuedBufferCountLocked(false); - break; - case NATIVE_WINDOW_STICKY_TRANSFORM: - value = static_cast(mStickyTransform); - break; - case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: - value = (mCore->mQueue.size() > 1); - break; - case NATIVE_WINDOW_CONSUMER_USAGE_BITS: - value = static_cast(mCore->mConsumerUsageBits); - break; - case NATIVE_WINDOW_DEFAULT_DATASPACE: - value = static_cast(mCore->mDefaultBufferDataSpace); - break; - case NATIVE_WINDOW_BUFFER_AGE: - if (mCore->mBufferAge > INT32_MAX) { - value = 0; - } else { - value = static_cast(mCore->mBufferAge); - } - break; - default: - return BAD_VALUE; - } - - BQ_LOGV("query: %d? %d", what, value); - *outValue = value; - return NO_ERROR; -} - -status_t BufferQueueProducer::connect(const sp& listener, - int api, bool producerControlledByApp, QueueBufferOutput *output) { - ATRACE_CALL(); - Mutex::Autolock lock(mCore->mMutex); - mConsumerName = mCore->mConsumerName; - BQ_LOGV("connect(P): api=%d producerControlledByApp=%s", api, - producerControlledByApp ? "true" : "false"); - - if (mCore->mIsAbandoned) { - BQ_LOGE("connect(P): BufferQueue has been abandoned"); - return NO_INIT; - } - - if (mCore->mConsumerListener == NULL) { - BQ_LOGE("connect(P): BufferQueue has no consumer"); - return NO_INIT; - } - - if (output == NULL) { - BQ_LOGE("connect(P): output was NULL"); - return BAD_VALUE; - } - - if (mCore->mConnectedApi != BufferQueueCore::NO_CONNECTED_API) { - BQ_LOGE("connect(P): already connected (cur=%d req=%d)", - mCore->mConnectedApi, api); - return BAD_VALUE; - } - - int status = NO_ERROR; - switch (api) { - case NATIVE_WINDOW_API_EGL: - case NATIVE_WINDOW_API_CPU: - case NATIVE_WINDOW_API_MEDIA: - case NATIVE_WINDOW_API_CAMERA: - mCore->mConnectedApi = api; - output->inflate(mCore->mDefaultWidth, mCore->mDefaultHeight, - mCore->mTransformHint, - static_cast(mCore->mQueue.size())); - - // Set up a death notification so that we can disconnect - // automatically if the remote producer dies - if (listener != NULL && - IInterface::asBinder(listener)->remoteBinder() != NULL) { - status = IInterface::asBinder(listener)->linkToDeath( - static_cast(this)); - if (status != NO_ERROR) { - BQ_LOGE("connect(P): linkToDeath failed: %s (%d)", - strerror(-status), status); - } - } - mCore->mConnectedProducerListener = listener; - break; - default: - BQ_LOGE("connect(P): unknown API %d", api); - status = BAD_VALUE; - break; - } - - mCore->mBufferHasBeenQueued = false; - mCore->mDequeueBufferCannotBlock = - mCore->mConsumerControlledByApp && producerControlledByApp; - mCore->mAllowAllocation = true; - - return status; -} - -status_t BufferQueueProducer::disconnect(int api) { - ATRACE_CALL(); - BQ_LOGV("disconnect(P): api %d", api); - - int status = NO_ERROR; - sp listener; - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - mCore->waitWhileAllocatingLocked(); - - if (mCore->mIsAbandoned) { - // It's not really an error to disconnect after the surface has - // been abandoned; it should just be a no-op. - return NO_ERROR; - } - - switch (api) { - case NATIVE_WINDOW_API_EGL: - case NATIVE_WINDOW_API_CPU: - case NATIVE_WINDOW_API_MEDIA: - case NATIVE_WINDOW_API_CAMERA: - if (mCore->mConnectedApi == api) { - mCore->freeAllBuffersLocked(); - - // Remove our death notification callback if we have one - if (mCore->mConnectedProducerListener != NULL) { - sp token = - IInterface::asBinder(mCore->mConnectedProducerListener); - // This can fail if we're here because of the death - // notification, but we just ignore it - token->unlinkToDeath( - static_cast(this)); - } - mCore->mConnectedProducerListener = NULL; - mCore->mConnectedApi = BufferQueueCore::NO_CONNECTED_API; - mCore->mSidebandStream.clear(); - mCore->mDequeueCondition.broadcast(); - listener = mCore->mConsumerListener; - } else if (mCore->mConnectedApi != BufferQueueCore::NO_CONNECTED_API) { - BQ_LOGE("disconnect(P): still connected to another API " - "(cur=%d req=%d)", mCore->mConnectedApi, api); - status = BAD_VALUE; - } - break; - default: - BQ_LOGE("disconnect(P): unknown API %d", api); - status = BAD_VALUE; - break; - } - } // Autolock scope - - // Call back without lock held - if (listener != NULL) { - listener->onBuffersReleased(); - } - - return status; -} - -status_t BufferQueueProducer::setSidebandStream(const sp& stream) { - sp listener; - { // Autolock scope - Mutex::Autolock _l(mCore->mMutex); - mCore->mSidebandStream = stream; - listener = mCore->mConsumerListener; - } // Autolock scope - - if (listener != NULL) { - listener->onSidebandStreamChanged(); - } - return NO_ERROR; -} - -void BufferQueueProducer::allocateBuffers(bool async, uint32_t width, - uint32_t height, PixelFormat format, uint32_t usage) { - ATRACE_CALL(); - while (true) { - Vector freeSlots; - size_t newBufferCount = 0; - uint32_t allocWidth = 0; - uint32_t allocHeight = 0; - PixelFormat allocFormat = PIXEL_FORMAT_UNKNOWN; - uint32_t allocUsage = 0; - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - mCore->waitWhileAllocatingLocked(); - - if (!mCore->mAllowAllocation) { - BQ_LOGE("allocateBuffers: allocation is not allowed for this " - "BufferQueue"); - return; - } - - int currentBufferCount = 0; - for (int slot = 0; slot < BufferQueueDefs::NUM_BUFFER_SLOTS; ++slot) { - if (mSlots[slot].mGraphicBuffer != NULL) { - ++currentBufferCount; - } else { - if (mSlots[slot].mBufferState != BufferSlot::FREE) { - BQ_LOGE("allocateBuffers: slot %d without buffer is not FREE", - slot); - continue; - } - - freeSlots.push_back(slot); - } - } - - int maxBufferCount = mCore->getMaxBufferCountLocked(async); - BQ_LOGV("allocateBuffers: allocating from %d buffers up to %d buffers", - currentBufferCount, maxBufferCount); - if (maxBufferCount <= currentBufferCount) - return; - newBufferCount = - static_cast(maxBufferCount - currentBufferCount); - if (freeSlots.size() < newBufferCount) { - BQ_LOGE("allocateBuffers: ran out of free slots"); - return; - } - allocWidth = width > 0 ? width : mCore->mDefaultWidth; - allocHeight = height > 0 ? height : mCore->mDefaultHeight; - allocFormat = format != 0 ? format : mCore->mDefaultBufferFormat; - allocUsage = usage | mCore->mConsumerUsageBits; - - mCore->mIsAllocating = true; - } // Autolock scope - - Vector> buffers; - for (size_t i = 0; i < newBufferCount; ++i) { - status_t result = NO_ERROR; - sp graphicBuffer(mCore->mAllocator->createGraphicBuffer( - allocWidth, allocHeight, allocFormat, allocUsage, &result)); - if (result != NO_ERROR) { - BQ_LOGE("allocateBuffers: failed to allocate buffer (%u x %u, format" - " %u, usage %u)", width, height, format, usage); - Mutex::Autolock lock(mCore->mMutex); - mCore->mIsAllocating = false; - mCore->mIsAllocatingCondition.broadcast(); - return; - } - buffers.push_back(graphicBuffer); - } - - { // Autolock scope - Mutex::Autolock lock(mCore->mMutex); - uint32_t checkWidth = width > 0 ? width : mCore->mDefaultWidth; - uint32_t checkHeight = height > 0 ? height : mCore->mDefaultHeight; - PixelFormat checkFormat = format != 0 ? - format : mCore->mDefaultBufferFormat; - uint32_t checkUsage = usage | mCore->mConsumerUsageBits; - if (checkWidth != allocWidth || checkHeight != allocHeight || - checkFormat != allocFormat || checkUsage != allocUsage) { - // Something changed while we released the lock. Retry. - BQ_LOGV("allocateBuffers: size/format/usage changed while allocating. Retrying."); - mCore->mIsAllocating = false; - mCore->mIsAllocatingCondition.broadcast(); - continue; - } - - for (size_t i = 0; i < newBufferCount; ++i) { - int slot = freeSlots[i]; - if (mSlots[slot].mBufferState != BufferSlot::FREE) { - // A consumer allocated the FREE slot with attachBuffer. Discard the buffer we - // allocated. - BQ_LOGV("allocateBuffers: slot %d was acquired while allocating. " - "Dropping allocated buffer.", slot); - continue; - } - mCore->freeBufferLocked(slot); // Clean up the slot first - mSlots[slot].mGraphicBuffer = buffers[i]; - mSlots[slot].mFence = Fence::NO_FENCE; - - // freeBufferLocked puts this slot on the free slots list. Since - // we then attached a buffer, move the slot to free buffer list. - mCore->mFreeSlots.erase(slot); - mCore->mFreeBuffers.push_front(slot); - - BQ_LOGV("allocateBuffers: allocated a new buffer in slot %d", slot); - } - - mCore->mIsAllocating = false; - mCore->mIsAllocatingCondition.broadcast(); - mCore->validateConsistencyLocked(); - } // Autolock scope - } -} - -status_t BufferQueueProducer::allowAllocation(bool allow) { - ATRACE_CALL(); - BQ_LOGV("allowAllocation: %s", allow ? "true" : "false"); - - Mutex::Autolock lock(mCore->mMutex); - mCore->mAllowAllocation = allow; - return NO_ERROR; -} - -status_t BufferQueueProducer::setGenerationNumber(uint32_t generationNumber) { - ATRACE_CALL(); - BQ_LOGV("setGenerationNumber: %u", generationNumber); - - Mutex::Autolock lock(mCore->mMutex); - mCore->mGenerationNumber = generationNumber; - return NO_ERROR; -} - -String8 BufferQueueProducer::getConsumerName() const { - ATRACE_CALL(); - BQ_LOGV("getConsumerName: %s", mConsumerName.string()); - return mConsumerName; -} - -void BufferQueueProducer::binderDied(const wp& /* who */) { - // If we're here, it means that a producer we were connected to died. - // We're guaranteed that we are still connected to it because we remove - // this callback upon disconnect. It's therefore safe to read mConnectedApi - // without synchronization here. - int api = mCore->mConnectedApi; - disconnect(api); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferSlot.cpp android-platform-frameworks-native-21/libs/gui/BufferSlot.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/BufferSlot.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/BufferSlot.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* - * Copyright 2014 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 - -namespace android { - -const char* BufferSlot::bufferStateName(BufferState state) { - switch (state) { - case BufferSlot::DEQUEUED: return "DEQUEUED"; - case BufferSlot::QUEUED: return "QUEUED"; - case BufferSlot::FREE: return "FREE"; - case BufferSlot::ACQUIRED: return "ACQUIRED"; - } - return "Unknown"; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/CleanSpec.mk android-platform-frameworks-native-21/libs/gui/CleanSpec.mk --- android-platform-frameworks-native-6.0.1+r16/libs/gui/CleanSpec.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/CleanSpec.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -# Copyright (C) 2012 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. -# - -# If you don't need to do a full clean build but would like to touch -# a file or delete some intermediate files, add a clean step to the end -# of the list. These steps will only be run once, if they haven't been -# run before. -# -# E.g.: -# $(call add-clean-step, touch -c external/sqlite/sqlite3.h) -# $(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/STATIC_LIBRARIES/libz_intermediates) -# -# Always use "touch -c" and "rm -f" or "rm -rf" to gracefully deal with -# files that are missing or have been moved. -# -# Use $(PRODUCT_OUT) to get to the "out/target/product/blah/" directory. -# Use $(OUT_DIR) to refer to the "out" directory. -# -# If you need to re-do something that's already mentioned, just copy -# the command and add it to the bottom of the list. E.g., if a change -# that you made last week required touching a file and a change you -# made today requires touching the same file, just copy the old -# touch step and add it to the end of the list. -# -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ - -# For example: -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/APPS/AndroidTests_intermediates) -#$(call add-clean-step, rm -rf $(OUT_DIR)/target/common/obj/JAVA_LIBRARIES/core_intermediates) -#$(call add-clean-step, find $(OUT_DIR) -type f -name "IGTalkSession*" -print0 | xargs -0 rm -f) -#$(call add-clean-step, rm -rf $(PRODUCT_OUT)/data/*) - -# ************************************************ -# NEWER CLEAN STEPS MUST BE AT THE END OF THE LIST -# ************************************************ -$(call add-clean-step, find $(PRODUCT_OUT) -type f -name "libgui*" -print0 | xargs -0 rm -f) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libgui_intermediates) -$(call add-clean-step, rm -rf $(PRODUCT_OUT)/obj/SHARED_LIBRARIES/libgui_intermediates) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ConsumerBase.cpp android-platform-frameworks-native-21/libs/gui/ConsumerBase.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ConsumerBase.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ConsumerBase.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,321 +0,0 @@ -/* - * Copyright (C) 2010 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 - -#define LOG_TAG "ConsumerBase" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#define EGL_EGLEXT_PROTOTYPES - -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include - -// Macros for including the ConsumerBase name in log messages -#define CB_LOGV(x, ...) ALOGV("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define CB_LOGD(x, ...) ALOGD("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define CB_LOGI(x, ...) ALOGI("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define CB_LOGW(x, ...) ALOGW("[%s] " x, mName.string(), ##__VA_ARGS__) -#define CB_LOGE(x, ...) ALOGE("[%s] " x, mName.string(), ##__VA_ARGS__) - -namespace android { - -// Get an ID that's unique within this process. -static int32_t createProcessUniqueId() { - static volatile int32_t globalCounter = 0; - return android_atomic_inc(&globalCounter); -} - -ConsumerBase::ConsumerBase(const sp& bufferQueue, bool controlledByApp) : - mAbandoned(false), - mConsumer(bufferQueue) { - // Choose a name using the PID and a process-unique ID. - mName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId()); - - // Note that we can't create an sp<...>(this) in a ctor that will not keep a - // reference once the ctor ends, as that would cause the refcount of 'this' - // dropping to 0 at the end of the ctor. Since all we need is a wp<...> - // that's what we create. - wp listener = static_cast(this); - sp proxy = new BufferQueue::ProxyConsumerListener(listener); - - status_t err = mConsumer->consumerConnect(proxy, controlledByApp); - if (err != NO_ERROR) { - CB_LOGE("ConsumerBase: error connecting to BufferQueue: %s (%d)", - strerror(-err), err); - } else { - mConsumer->setConsumerName(mName); - } -} - -ConsumerBase::~ConsumerBase() { - CB_LOGV("~ConsumerBase"); - Mutex::Autolock lock(mMutex); - - // Verify that abandon() has been called before we get here. This should - // be done by ConsumerBase::onLastStrongRef(), but it's possible for a - // derived class to override that method and not call - // ConsumerBase::onLastStrongRef(). - LOG_ALWAYS_FATAL_IF(!mAbandoned, "[%s] ~ConsumerBase was called, but the " - "consumer is not abandoned!", mName.string()); -} - -void ConsumerBase::onLastStrongRef(const void* id __attribute__((unused))) { - abandon(); -} - -void ConsumerBase::freeBufferLocked(int slotIndex) { - CB_LOGV("freeBufferLocked: slotIndex=%d", slotIndex); - mSlots[slotIndex].mGraphicBuffer = 0; - mSlots[slotIndex].mFence = Fence::NO_FENCE; - mSlots[slotIndex].mFrameNumber = 0; -} - -void ConsumerBase::onFrameAvailable(const BufferItem& item) { - CB_LOGV("onFrameAvailable"); - - sp listener; - { // scope for the lock - Mutex::Autolock lock(mMutex); - listener = mFrameAvailableListener.promote(); - } - - if (listener != NULL) { - CB_LOGV("actually calling onFrameAvailable"); - listener->onFrameAvailable(item); - } -} - -void ConsumerBase::onFrameReplaced(const BufferItem &item) { - CB_LOGV("onFrameReplaced"); - - sp listener; - { - Mutex::Autolock lock(mMutex); - listener = mFrameAvailableListener.promote(); - } - - if (listener != NULL) { - CB_LOGV("actually calling onFrameReplaced"); - listener->onFrameReplaced(item); - } -} - -void ConsumerBase::onBuffersReleased() { - Mutex::Autolock lock(mMutex); - - CB_LOGV("onBuffersReleased"); - - if (mAbandoned) { - // Nothing to do if we're already abandoned. - return; - } - - uint64_t mask = 0; - mConsumer->getReleasedBuffers(&mask); - for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { - if (mask & (1ULL << i)) { - freeBufferLocked(i); - } - } -} - -void ConsumerBase::onSidebandStreamChanged() { -} - -void ConsumerBase::abandon() { - CB_LOGV("abandon"); - Mutex::Autolock lock(mMutex); - - if (!mAbandoned) { - abandonLocked(); - mAbandoned = true; - } -} - -void ConsumerBase::abandonLocked() { - CB_LOGV("abandonLocked"); - for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { - freeBufferLocked(i); - } - // disconnect from the BufferQueue - mConsumer->consumerDisconnect(); - mConsumer.clear(); -} - -bool ConsumerBase::isAbandoned() { - Mutex::Autolock _l(mMutex); - return mAbandoned; -} - -void ConsumerBase::setFrameAvailableListener( - const wp& listener) { - CB_LOGV("setFrameAvailableListener"); - Mutex::Autolock lock(mMutex); - mFrameAvailableListener = listener; -} - -status_t ConsumerBase::detachBuffer(int slot) { - CB_LOGV("detachBuffer"); - Mutex::Autolock lock(mMutex); - - status_t result = mConsumer->detachBuffer(slot); - if (result != NO_ERROR) { - CB_LOGE("Failed to detach buffer: %d", result); - return result; - } - - freeBufferLocked(slot); - - return result; -} - -status_t ConsumerBase::setDefaultBufferSize(uint32_t width, uint32_t height) { - Mutex::Autolock _l(mMutex); - return mConsumer->setDefaultBufferSize(width, height); -} - -status_t ConsumerBase::setDefaultBufferFormat(PixelFormat defaultFormat) { - Mutex::Autolock _l(mMutex); - return mConsumer->setDefaultBufferFormat(defaultFormat); -} - -status_t ConsumerBase::setDefaultBufferDataSpace( - android_dataspace defaultDataSpace) { - Mutex::Autolock _l(mMutex); - return mConsumer->setDefaultBufferDataSpace(defaultDataSpace); -} - -void ConsumerBase::dump(String8& result) const { - dump(result, ""); -} - -void ConsumerBase::dump(String8& result, const char* prefix) const { - Mutex::Autolock _l(mMutex); - dumpLocked(result, prefix); -} - -void ConsumerBase::dumpLocked(String8& result, const char* prefix) const { - result.appendFormat("%smAbandoned=%d\n", prefix, int(mAbandoned)); - - if (!mAbandoned) { - mConsumer->dump(result, prefix); - } -} - -status_t ConsumerBase::acquireBufferLocked(BufferItem *item, - nsecs_t presentWhen, uint64_t maxFrameNumber) { - status_t err = mConsumer->acquireBuffer(item, presentWhen, maxFrameNumber); - if (err != NO_ERROR) { - return err; - } - - if (item->mGraphicBuffer != NULL) { - mSlots[item->mBuf].mGraphicBuffer = item->mGraphicBuffer; - } - - mSlots[item->mBuf].mFrameNumber = item->mFrameNumber; - mSlots[item->mBuf].mFence = item->mFence; - - CB_LOGV("acquireBufferLocked: -> slot=%d/%" PRIu64, - item->mBuf, item->mFrameNumber); - - return OK; -} - -status_t ConsumerBase::addReleaseFence(int slot, - const sp graphicBuffer, const sp& fence) { - Mutex::Autolock lock(mMutex); - return addReleaseFenceLocked(slot, graphicBuffer, fence); -} - -status_t ConsumerBase::addReleaseFenceLocked(int slot, - const sp graphicBuffer, const sp& fence) { - CB_LOGV("addReleaseFenceLocked: slot=%d", slot); - - // If consumer no longer tracks this graphicBuffer, we can safely - // drop this fence, as it will never be received by the producer. - if (!stillTracking(slot, graphicBuffer)) { - return OK; - } - - if (!mSlots[slot].mFence.get()) { - mSlots[slot].mFence = fence; - } else { - sp mergedFence = Fence::merge( - String8::format("%.28s:%d", mName.string(), slot), - mSlots[slot].mFence, fence); - if (!mergedFence.get()) { - CB_LOGE("failed to merge release fences"); - // synchronization is broken, the best we can do is hope fences - // signal in order so the new fence will act like a union - mSlots[slot].mFence = fence; - return BAD_VALUE; - } - mSlots[slot].mFence = mergedFence; - } - - return OK; -} - -status_t ConsumerBase::releaseBufferLocked( - int slot, const sp graphicBuffer, - EGLDisplay display, EGLSyncKHR eglFence) { - // If consumer no longer tracks this graphicBuffer (we received a new - // buffer on the same slot), the buffer producer is definitely no longer - // tracking it. - if (!stillTracking(slot, graphicBuffer)) { - return OK; - } - - CB_LOGV("releaseBufferLocked: slot=%d/%" PRIu64, - slot, mSlots[slot].mFrameNumber); - status_t err = mConsumer->releaseBuffer(slot, mSlots[slot].mFrameNumber, - display, eglFence, mSlots[slot].mFence); - if (err == IGraphicBufferConsumer::STALE_BUFFER_SLOT) { - freeBufferLocked(slot); - } - - mSlots[slot].mFence = Fence::NO_FENCE; - - return err; -} - -bool ConsumerBase::stillTracking(int slot, - const sp graphicBuffer) { - if (slot < 0 || slot >= BufferQueue::NUM_BUFFER_SLOTS) { - return false; - } - return (mSlots[slot].mGraphicBuffer != NULL && - mSlots[slot].mGraphicBuffer->handle == graphicBuffer->handle); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/CpuConsumer.cpp android-platform-frameworks-native-21/libs/gui/CpuConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/CpuConsumer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/CpuConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,261 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -//#define LOG_NDEBUG 0 -#define LOG_TAG "CpuConsumer" -//#define ATRACE_TAG ATRACE_TAG_GRAPHICS - -#include -#include -#include -#include - -#define CC_LOGV(x, ...) ALOGV("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define CC_LOGD(x, ...) ALOGD("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define CC_LOGI(x, ...) ALOGI("[%s] " x, mName.string(), ##__VA_ARGS__) -#define CC_LOGW(x, ...) ALOGW("[%s] " x, mName.string(), ##__VA_ARGS__) -#define CC_LOGE(x, ...) ALOGE("[%s] " x, mName.string(), ##__VA_ARGS__) - -namespace android { - -CpuConsumer::CpuConsumer(const sp& bq, - size_t maxLockedBuffers, bool controlledByApp) : - ConsumerBase(bq, controlledByApp), - mMaxLockedBuffers(maxLockedBuffers), - mCurrentLockedBuffers(0) -{ - // Create tracking entries for locked buffers - mAcquiredBuffers.insertAt(0, maxLockedBuffers); - - mConsumer->setConsumerUsageBits(GRALLOC_USAGE_SW_READ_OFTEN); - mConsumer->setMaxAcquiredBufferCount(static_cast(maxLockedBuffers)); -} - -CpuConsumer::~CpuConsumer() { - // ConsumerBase destructor does all the work. -} - - - -void CpuConsumer::setName(const String8& name) { - Mutex::Autolock _l(mMutex); - mName = name; - mConsumer->setConsumerName(name); -} - -static bool isPossiblyYUV(PixelFormat format) { - switch (static_cast(format)) { - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_RGBX_8888: - case HAL_PIXEL_FORMAT_RGB_888: - case HAL_PIXEL_FORMAT_RGB_565: - case HAL_PIXEL_FORMAT_BGRA_8888: - case HAL_PIXEL_FORMAT_Y8: - case HAL_PIXEL_FORMAT_Y16: - case HAL_PIXEL_FORMAT_RAW16: - case HAL_PIXEL_FORMAT_RAW10: - case HAL_PIXEL_FORMAT_RAW_OPAQUE: - case HAL_PIXEL_FORMAT_BLOB: - case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: - return false; - - case HAL_PIXEL_FORMAT_YV12: - case HAL_PIXEL_FORMAT_YCbCr_420_888: - case HAL_PIXEL_FORMAT_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_YCrCb_420_SP: - case HAL_PIXEL_FORMAT_YCbCr_422_I: - default: - return true; - } -} - -status_t CpuConsumer::lockNextBuffer(LockedBuffer *nativeBuffer) { - status_t err; - - if (!nativeBuffer) return BAD_VALUE; - if (mCurrentLockedBuffers == mMaxLockedBuffers) { - CC_LOGW("Max buffers have been locked (%zd), cannot lock anymore.", - mMaxLockedBuffers); - return NOT_ENOUGH_DATA; - } - - BufferItem b; - - Mutex::Autolock _l(mMutex); - - err = acquireBufferLocked(&b, 0); - if (err != OK) { - if (err == BufferQueue::NO_BUFFER_AVAILABLE) { - return BAD_VALUE; - } else { - CC_LOGE("Error acquiring buffer: %s (%d)", strerror(err), err); - return err; - } - } - - int buf = b.mBuf; - - void *bufferPointer = NULL; - android_ycbcr ycbcr = android_ycbcr(); - - PixelFormat format = mSlots[buf].mGraphicBuffer->getPixelFormat(); - PixelFormat flexFormat = format; - if (isPossiblyYUV(format)) { - if (b.mFence.get()) { - err = mSlots[buf].mGraphicBuffer->lockAsyncYCbCr( - GraphicBuffer::USAGE_SW_READ_OFTEN, - b.mCrop, - &ycbcr, - b.mFence->dup()); - } else { - err = mSlots[buf].mGraphicBuffer->lockYCbCr( - GraphicBuffer::USAGE_SW_READ_OFTEN, - b.mCrop, - &ycbcr); - } - if (err == OK) { - bufferPointer = ycbcr.y; - flexFormat = HAL_PIXEL_FORMAT_YCbCr_420_888; - if (format != HAL_PIXEL_FORMAT_YCbCr_420_888) { - CC_LOGV("locking buffer of format %#x as flex YUV", format); - } - } else if (format == HAL_PIXEL_FORMAT_YCbCr_420_888) { - CC_LOGE("Unable to lock YCbCr buffer for CPU reading: %s (%d)", - strerror(-err), err); - return err; - } - } - - if (bufferPointer == NULL) { // not flexible YUV - if (b.mFence.get()) { - err = mSlots[buf].mGraphicBuffer->lockAsync( - GraphicBuffer::USAGE_SW_READ_OFTEN, - b.mCrop, - &bufferPointer, - b.mFence->dup()); - } else { - err = mSlots[buf].mGraphicBuffer->lock( - GraphicBuffer::USAGE_SW_READ_OFTEN, - b.mCrop, - &bufferPointer); - } - if (err != OK) { - CC_LOGE("Unable to lock buffer for CPU reading: %s (%d)", - strerror(-err), err); - return err; - } - } - - size_t lockedIdx = 0; - for (; lockedIdx < static_cast(mMaxLockedBuffers); lockedIdx++) { - if (mAcquiredBuffers[lockedIdx].mSlot == - BufferQueue::INVALID_BUFFER_SLOT) { - break; - } - } - assert(lockedIdx < mMaxLockedBuffers); - - AcquiredBuffer &ab = mAcquiredBuffers.editItemAt(lockedIdx); - ab.mSlot = buf; - ab.mBufferPointer = bufferPointer; - ab.mGraphicBuffer = mSlots[buf].mGraphicBuffer; - - nativeBuffer->data = - reinterpret_cast(bufferPointer); - nativeBuffer->width = mSlots[buf].mGraphicBuffer->getWidth(); - nativeBuffer->height = mSlots[buf].mGraphicBuffer->getHeight(); - nativeBuffer->format = format; - nativeBuffer->flexFormat = flexFormat; - nativeBuffer->stride = (ycbcr.y != NULL) ? - static_cast(ycbcr.ystride) : - mSlots[buf].mGraphicBuffer->getStride(); - - nativeBuffer->crop = b.mCrop; - nativeBuffer->transform = b.mTransform; - nativeBuffer->scalingMode = b.mScalingMode; - nativeBuffer->timestamp = b.mTimestamp; - nativeBuffer->dataSpace = b.mDataSpace; - nativeBuffer->frameNumber = b.mFrameNumber; - - nativeBuffer->dataCb = reinterpret_cast(ycbcr.cb); - nativeBuffer->dataCr = reinterpret_cast(ycbcr.cr); - nativeBuffer->chromaStride = static_cast(ycbcr.cstride); - nativeBuffer->chromaStep = static_cast(ycbcr.chroma_step); - - mCurrentLockedBuffers++; - - return OK; -} - -status_t CpuConsumer::unlockBuffer(const LockedBuffer &nativeBuffer) { - Mutex::Autolock _l(mMutex); - size_t lockedIdx = 0; - - void *bufPtr = reinterpret_cast(nativeBuffer.data); - for (; lockedIdx < static_cast(mMaxLockedBuffers); lockedIdx++) { - if (bufPtr == mAcquiredBuffers[lockedIdx].mBufferPointer) break; - } - if (lockedIdx == mMaxLockedBuffers) { - CC_LOGE("%s: Can't find buffer to free", __FUNCTION__); - return BAD_VALUE; - } - - return releaseAcquiredBufferLocked(lockedIdx); -} - -status_t CpuConsumer::releaseAcquiredBufferLocked(size_t lockedIdx) { - status_t err; - int fd = -1; - - err = mAcquiredBuffers[lockedIdx].mGraphicBuffer->unlockAsync(&fd); - if (err != OK) { - CC_LOGE("%s: Unable to unlock graphic buffer %zd", __FUNCTION__, - lockedIdx); - return err; - } - int buf = mAcquiredBuffers[lockedIdx].mSlot; - if (CC_LIKELY(fd != -1)) { - sp fence(new Fence(fd)); - addReleaseFenceLocked( - mAcquiredBuffers[lockedIdx].mSlot, - mSlots[buf].mGraphicBuffer, - fence); - } - - // release the buffer if it hasn't already been freed by the BufferQueue. - // This can happen, for example, when the producer of this buffer - // disconnected after this buffer was acquired. - if (CC_LIKELY(mAcquiredBuffers[lockedIdx].mGraphicBuffer == - mSlots[buf].mGraphicBuffer)) { - releaseBufferLocked( - buf, mAcquiredBuffers[lockedIdx].mGraphicBuffer, - EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); - } - - AcquiredBuffer &ab = mAcquiredBuffers.editItemAt(lockedIdx); - ab.mSlot = BufferQueue::INVALID_BUFFER_SLOT; - ab.mBufferPointer = NULL; - ab.mGraphicBuffer.clear(); - - mCurrentLockedBuffers--; - return OK; -} - -void CpuConsumer::freeBufferLocked(int slotIndex) { - ConsumerBase::freeBufferLocked(slotIndex); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/DummyConsumer.cpp android-platform-frameworks-native-21/libs/gui/DummyConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/DummyConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/DummyConsumer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,43 @@ +/* + * Copyright (C) 2012 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. + */ + +#define LOG_TAG "DummyConsumer" +// #define LOG_NDEBUG 0 + +#include + +#include +#include + +namespace android { + +DummyConsumer::DummyConsumer() { + ALOGV("DummyConsumer"); +} + +DummyConsumer::~DummyConsumer() { + ALOGV("~DummyConsumer"); +} + +void DummyConsumer::onFrameAvailable() { + ALOGV("onFrameAvailable"); +} + +void DummyConsumer::onBuffersReleased() { + ALOGV("onBuffersReleased"); +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/GLConsumer.cpp android-platform-frameworks-native-21/libs/gui/GLConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/GLConsumer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/GLConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1173 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "GLConsumer" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#define GL_GLEXT_PROTOTYPES -#define EGL_EGLEXT_PROTOTYPES - -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); -#define CROP_EXT_STR "EGL_ANDROID_image_crop" - -namespace android { - -// Macros for including the GLConsumer name in log messages -#define GLC_LOGV(x, ...) ALOGV("[%s] " x, mName.string(), ##__VA_ARGS__) -#define GLC_LOGD(x, ...) ALOGD("[%s] " x, mName.string(), ##__VA_ARGS__) -//#define GLC_LOGI(x, ...) ALOGI("[%s] " x, mName.string(), ##__VA_ARGS__) -#define GLC_LOGW(x, ...) ALOGW("[%s] " x, mName.string(), ##__VA_ARGS__) -#define GLC_LOGE(x, ...) ALOGE("[%s] " x, mName.string(), ##__VA_ARGS__) - -static const struct { - uint32_t width, height; - char const* bits; -} kDebugData = { 15, 12, - "_______________" - "_______________" - "_____XX_XX_____" - "__X_X_____X_X__" - "__X_XXXXXXX_X__" - "__XXXXXXXXXXX__" - "___XX_XXX_XX___" - "____XXXXXXX____" - "_____X___X_____" - "____X_____X____" - "_______________" - "_______________" -}; - -// Transform matrices -static float mtxIdentity[16] = { - 1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 0, 0, 0, 1, -}; -static float mtxFlipH[16] = { - -1, 0, 0, 0, - 0, 1, 0, 0, - 0, 0, 1, 0, - 1, 0, 0, 1, -}; -static float mtxFlipV[16] = { - 1, 0, 0, 0, - 0, -1, 0, 0, - 0, 0, 1, 0, - 0, 1, 0, 1, -}; -static float mtxRot90[16] = { - 0, 1, 0, 0, - -1, 0, 0, 0, - 0, 0, 1, 0, - 1, 0, 0, 1, -}; - -static void mtxMul(float out[16], const float a[16], const float b[16]); - -Mutex GLConsumer::sStaticInitLock; -sp GLConsumer::sReleasedTexImageBuffer; - -static bool hasEglAndroidImageCropImpl() { - EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); - const char* exts = eglQueryStringImplementationANDROID(dpy, EGL_EXTENSIONS); - size_t cropExtLen = strlen(CROP_EXT_STR); - size_t extsLen = strlen(exts); - bool equal = !strcmp(CROP_EXT_STR, exts); - bool atStart = !strncmp(CROP_EXT_STR " ", exts, cropExtLen+1); - bool atEnd = (cropExtLen+1) < extsLen && - !strcmp(" " CROP_EXT_STR, exts + extsLen - (cropExtLen+1)); - bool inMiddle = strstr(exts, " " CROP_EXT_STR " "); - return equal || atStart || atEnd || inMiddle; -} - -static bool hasEglAndroidImageCrop() { - // Only compute whether the extension is present once the first time this - // function is called. - static bool hasIt = hasEglAndroidImageCropImpl(); - return hasIt; -} - -static bool isEglImageCroppable(const Rect& crop) { - return hasEglAndroidImageCrop() && (crop.left == 0 && crop.top == 0); -} - -GLConsumer::GLConsumer(const sp& bq, uint32_t tex, - uint32_t texTarget, bool useFenceSync, bool isControlledByApp) : - ConsumerBase(bq, isControlledByApp), - mCurrentTransform(0), - mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), - mCurrentFence(Fence::NO_FENCE), - mCurrentTimestamp(0), - mCurrentFrameNumber(0), - mDefaultWidth(1), - mDefaultHeight(1), - mFilteringEnabled(true), - mTexName(tex), - mUseFenceSync(useFenceSync), - mTexTarget(texTarget), - mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT), - mCurrentTexture(BufferQueue::INVALID_BUFFER_SLOT), - mAttached(true) -{ - GLC_LOGV("GLConsumer"); - - memcpy(mCurrentTransformMatrix, mtxIdentity, - sizeof(mCurrentTransformMatrix)); - - mConsumer->setConsumerUsageBits(DEFAULT_USAGE_FLAGS); -} - -GLConsumer::GLConsumer(const sp& bq, uint32_t texTarget, - bool useFenceSync, bool isControlledByApp) : - ConsumerBase(bq, isControlledByApp), - mCurrentTransform(0), - mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), - mCurrentFence(Fence::NO_FENCE), - mCurrentTimestamp(0), - mCurrentFrameNumber(0), - mDefaultWidth(1), - mDefaultHeight(1), - mFilteringEnabled(true), - mTexName(0), - mUseFenceSync(useFenceSync), - mTexTarget(texTarget), - mEglDisplay(EGL_NO_DISPLAY), - mEglContext(EGL_NO_CONTEXT), - mCurrentTexture(BufferQueue::INVALID_BUFFER_SLOT), - mAttached(false) -{ - GLC_LOGV("GLConsumer"); - - memcpy(mCurrentTransformMatrix, mtxIdentity, - sizeof(mCurrentTransformMatrix)); - - mConsumer->setConsumerUsageBits(DEFAULT_USAGE_FLAGS); -} - -status_t GLConsumer::setDefaultMaxBufferCount(int bufferCount) { - Mutex::Autolock lock(mMutex); - return mConsumer->setDefaultMaxBufferCount(bufferCount); -} - - -status_t GLConsumer::setDefaultBufferSize(uint32_t w, uint32_t h) -{ - Mutex::Autolock lock(mMutex); - mDefaultWidth = w; - mDefaultHeight = h; - return mConsumer->setDefaultBufferSize(w, h); -} - -status_t GLConsumer::updateTexImage() { - ATRACE_CALL(); - GLC_LOGV("updateTexImage"); - Mutex::Autolock lock(mMutex); - - if (mAbandoned) { - GLC_LOGE("updateTexImage: GLConsumer is abandoned!"); - return NO_INIT; - } - - // Make sure the EGL state is the same as in previous calls. - status_t err = checkAndUpdateEglStateLocked(); - if (err != NO_ERROR) { - return err; - } - - BufferItem item; - - // Acquire the next buffer. - // In asynchronous mode the list is guaranteed to be one buffer - // deep, while in synchronous mode we use the oldest buffer. - err = acquireBufferLocked(&item, 0); - if (err != NO_ERROR) { - if (err == BufferQueue::NO_BUFFER_AVAILABLE) { - // We always bind the texture even if we don't update its contents. - GLC_LOGV("updateTexImage: no buffers were available"); - glBindTexture(mTexTarget, mTexName); - err = NO_ERROR; - } else { - GLC_LOGE("updateTexImage: acquire failed: %s (%d)", - strerror(-err), err); - } - return err; - } - - // Release the previous buffer. - err = updateAndReleaseLocked(item); - if (err != NO_ERROR) { - // We always bind the texture. - glBindTexture(mTexTarget, mTexName); - return err; - } - - // Bind the new buffer to the GL texture, and wait until it's ready. - return bindTextureImageLocked(); -} - - -status_t GLConsumer::releaseTexImage() { - ATRACE_CALL(); - GLC_LOGV("releaseTexImage"); - Mutex::Autolock lock(mMutex); - - if (mAbandoned) { - GLC_LOGE("releaseTexImage: GLConsumer is abandoned!"); - return NO_INIT; - } - - // Make sure the EGL state is the same as in previous calls. - status_t err = NO_ERROR; - - if (mAttached) { - err = checkAndUpdateEglStateLocked(true); - if (err != NO_ERROR) { - return err; - } - } else { - // if we're detached, no need to validate EGL's state -- we won't use it. - } - - // Update the GLConsumer state. - int buf = mCurrentTexture; - if (buf != BufferQueue::INVALID_BUFFER_SLOT) { - - GLC_LOGV("releaseTexImage: (slot=%d, mAttached=%d)", buf, mAttached); - - if (mAttached) { - // Do whatever sync ops we need to do before releasing the slot. - err = syncForReleaseLocked(mEglDisplay); - if (err != NO_ERROR) { - GLC_LOGE("syncForReleaseLocked failed (slot=%d), err=%d", buf, err); - return err; - } - } else { - // if we're detached, we just use the fence that was created in detachFromContext() - // so... basically, nothing more to do here. - } - - err = releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, mEglDisplay, EGL_NO_SYNC_KHR); - if (err < NO_ERROR) { - GLC_LOGE("releaseTexImage: failed to release buffer: %s (%d)", - strerror(-err), err); - return err; - } - - if (mReleasedTexImage == NULL) { - mReleasedTexImage = new EglImage(getDebugTexImageBuffer()); - } - - mCurrentTexture = BufferQueue::INVALID_BUFFER_SLOT; - mCurrentTextureImage = mReleasedTexImage; - mCurrentCrop.makeInvalid(); - mCurrentTransform = 0; - mCurrentScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; - mCurrentTimestamp = 0; - mCurrentFence = Fence::NO_FENCE; - - if (mAttached) { - // This binds a dummy buffer (mReleasedTexImage). - status_t result = bindTextureImageLocked(); - if (result != NO_ERROR) { - return result; - } - } else { - // detached, don't touch the texture (and we may not even have an - // EGLDisplay here. - } - } - - return NO_ERROR; -} - -sp GLConsumer::getDebugTexImageBuffer() { - Mutex::Autolock _l(sStaticInitLock); - if (CC_UNLIKELY(sReleasedTexImageBuffer == NULL)) { - // The first time, create the debug texture in case the application - // continues to use it. - sp buffer = new GraphicBuffer( - kDebugData.width, kDebugData.height, PIXEL_FORMAT_RGBA_8888, - GraphicBuffer::USAGE_SW_WRITE_RARELY); - uint32_t* bits; - buffer->lock(GraphicBuffer::USAGE_SW_WRITE_RARELY, reinterpret_cast(&bits)); - uint32_t stride = buffer->getStride(); - uint32_t height = buffer->getHeight(); - memset(bits, 0, stride * height * 4); - for (uint32_t y = 0; y < kDebugData.height; y++) { - for (uint32_t x = 0; x < kDebugData.width; x++) { - bits[x] = (kDebugData.bits[y + kDebugData.width + x] == 'X') ? - 0xFF000000 : 0xFFFFFFFF; - } - bits += stride; - } - buffer->unlock(); - sReleasedTexImageBuffer = buffer; - } - return sReleasedTexImageBuffer; -} - -status_t GLConsumer::acquireBufferLocked(BufferItem *item, - nsecs_t presentWhen, uint64_t maxFrameNumber) { - status_t err = ConsumerBase::acquireBufferLocked(item, presentWhen, - maxFrameNumber); - if (err != NO_ERROR) { - return err; - } - - // If item->mGraphicBuffer is not null, this buffer has not been acquired - // before, so any prior EglImage created is using a stale buffer. This - // replaces any old EglImage with a new one (using the new buffer). - if (item->mGraphicBuffer != NULL) { - int slot = item->mBuf; - mEglSlots[slot].mEglImage = new EglImage(item->mGraphicBuffer); - } - - return NO_ERROR; -} - -status_t GLConsumer::releaseBufferLocked(int buf, - sp graphicBuffer, - EGLDisplay display, EGLSyncKHR eglFence) { - // release the buffer if it hasn't already been discarded by the - // BufferQueue. This can happen, for example, when the producer of this - // buffer has reallocated the original buffer slot after this buffer - // was acquired. - status_t err = ConsumerBase::releaseBufferLocked( - buf, graphicBuffer, display, eglFence); - mEglSlots[buf].mEglFence = EGL_NO_SYNC_KHR; - return err; -} - -status_t GLConsumer::updateAndReleaseLocked(const BufferItem& item) -{ - status_t err = NO_ERROR; - - int buf = item.mBuf; - - if (!mAttached) { - GLC_LOGE("updateAndRelease: GLConsumer is not attached to an OpenGL " - "ES context"); - releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, - mEglDisplay, EGL_NO_SYNC_KHR); - return INVALID_OPERATION; - } - - // Confirm state. - err = checkAndUpdateEglStateLocked(); - if (err != NO_ERROR) { - releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, - mEglDisplay, EGL_NO_SYNC_KHR); - return err; - } - - // Ensure we have a valid EglImageKHR for the slot, creating an EglImage - // if nessessary, for the gralloc buffer currently in the slot in - // ConsumerBase. - // We may have to do this even when item.mGraphicBuffer == NULL (which - // means the buffer was previously acquired). - err = mEglSlots[buf].mEglImage->createIfNeeded(mEglDisplay, item.mCrop); - if (err != NO_ERROR) { - GLC_LOGW("updateAndRelease: unable to createImage on display=%p slot=%d", - mEglDisplay, buf); - releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, - mEglDisplay, EGL_NO_SYNC_KHR); - return UNKNOWN_ERROR; - } - - // Do whatever sync ops we need to do before releasing the old slot. - err = syncForReleaseLocked(mEglDisplay); - if (err != NO_ERROR) { - // Release the buffer we just acquired. It's not safe to - // release the old buffer, so instead we just drop the new frame. - // As we are still under lock since acquireBuffer, it is safe to - // release by slot. - releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, - mEglDisplay, EGL_NO_SYNC_KHR); - return err; - } - - GLC_LOGV("updateAndRelease: (slot=%d buf=%p) -> (slot=%d buf=%p)", - mCurrentTexture, mCurrentTextureImage != NULL ? - mCurrentTextureImage->graphicBufferHandle() : 0, - buf, mSlots[buf].mGraphicBuffer->handle); - - // release old buffer - if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) { - status_t status = releaseBufferLocked( - mCurrentTexture, mCurrentTextureImage->graphicBuffer(), - mEglDisplay, mEglSlots[mCurrentTexture].mEglFence); - if (status < NO_ERROR) { - GLC_LOGE("updateAndRelease: failed to release buffer: %s (%d)", - strerror(-status), status); - err = status; - // keep going, with error raised [?] - } - } - - // Update the GLConsumer state. - mCurrentTexture = buf; - mCurrentTextureImage = mEglSlots[buf].mEglImage; - mCurrentCrop = item.mCrop; - mCurrentTransform = item.mTransform; - mCurrentScalingMode = item.mScalingMode; - mCurrentTimestamp = item.mTimestamp; - mCurrentFence = item.mFence; - mCurrentFrameNumber = item.mFrameNumber; - - computeCurrentTransformMatrixLocked(); - - return err; -} - -status_t GLConsumer::bindTextureImageLocked() { - if (mEglDisplay == EGL_NO_DISPLAY) { - ALOGE("bindTextureImage: invalid display"); - return INVALID_OPERATION; - } - - GLenum error; - while ((error = glGetError()) != GL_NO_ERROR) { - GLC_LOGW("bindTextureImage: clearing GL error: %#04x", error); - } - - glBindTexture(mTexTarget, mTexName); - if (mCurrentTexture == BufferQueue::INVALID_BUFFER_SLOT && - mCurrentTextureImage == NULL) { - GLC_LOGE("bindTextureImage: no currently-bound texture"); - return NO_INIT; - } - - status_t err = mCurrentTextureImage->createIfNeeded(mEglDisplay, - mCurrentCrop); - if (err != NO_ERROR) { - GLC_LOGW("bindTextureImage: can't create image on display=%p slot=%d", - mEglDisplay, mCurrentTexture); - return UNKNOWN_ERROR; - } - mCurrentTextureImage->bindToTextureTarget(mTexTarget); - - // In the rare case that the display is terminated and then initialized - // again, we can't detect that the display changed (it didn't), but the - // image is invalid. In this case, repeat the exact same steps while - // forcing the creation of a new image. - if ((error = glGetError()) != GL_NO_ERROR) { - glBindTexture(mTexTarget, mTexName); - status_t result = mCurrentTextureImage->createIfNeeded(mEglDisplay, - mCurrentCrop, - true); - if (result != NO_ERROR) { - GLC_LOGW("bindTextureImage: can't create image on display=%p slot=%d", - mEglDisplay, mCurrentTexture); - return UNKNOWN_ERROR; - } - mCurrentTextureImage->bindToTextureTarget(mTexTarget); - if ((error = glGetError()) != GL_NO_ERROR) { - GLC_LOGE("bindTextureImage: error binding external image: %#04x", error); - return UNKNOWN_ERROR; - } - } - - // Wait for the new buffer to be ready. - return doGLFenceWaitLocked(); -} - -status_t GLConsumer::checkAndUpdateEglStateLocked(bool contextCheck) { - EGLDisplay dpy = eglGetCurrentDisplay(); - EGLContext ctx = eglGetCurrentContext(); - - if (!contextCheck) { - // if this is the first time we're called, mEglDisplay/mEglContext have - // never been set, so don't error out (below). - if (mEglDisplay == EGL_NO_DISPLAY) { - mEglDisplay = dpy; - } - if (mEglContext == EGL_NO_CONTEXT) { - mEglContext = ctx; - } - } - - if (mEglDisplay != dpy || dpy == EGL_NO_DISPLAY) { - GLC_LOGE("checkAndUpdateEglState: invalid current EGLDisplay"); - return INVALID_OPERATION; - } - - if (mEglContext != ctx || ctx == EGL_NO_CONTEXT) { - GLC_LOGE("checkAndUpdateEglState: invalid current EGLContext"); - return INVALID_OPERATION; - } - - mEglDisplay = dpy; - mEglContext = ctx; - return NO_ERROR; -} - -void GLConsumer::setReleaseFence(const sp& fence) { - if (fence->isValid() && - mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) { - status_t err = addReleaseFence(mCurrentTexture, - mCurrentTextureImage->graphicBuffer(), fence); - if (err != OK) { - GLC_LOGE("setReleaseFence: failed to add the fence: %s (%d)", - strerror(-err), err); - } - } -} - -status_t GLConsumer::detachFromContext() { - ATRACE_CALL(); - GLC_LOGV("detachFromContext"); - Mutex::Autolock lock(mMutex); - - if (mAbandoned) { - GLC_LOGE("detachFromContext: abandoned GLConsumer"); - return NO_INIT; - } - - if (!mAttached) { - GLC_LOGE("detachFromContext: GLConsumer is not attached to a " - "context"); - return INVALID_OPERATION; - } - - EGLDisplay dpy = eglGetCurrentDisplay(); - EGLContext ctx = eglGetCurrentContext(); - - if (mEglDisplay != dpy && mEglDisplay != EGL_NO_DISPLAY) { - GLC_LOGE("detachFromContext: invalid current EGLDisplay"); - return INVALID_OPERATION; - } - - if (mEglContext != ctx && mEglContext != EGL_NO_CONTEXT) { - GLC_LOGE("detachFromContext: invalid current EGLContext"); - return INVALID_OPERATION; - } - - if (dpy != EGL_NO_DISPLAY && ctx != EGL_NO_CONTEXT) { - status_t err = syncForReleaseLocked(dpy); - if (err != OK) { - return err; - } - - glDeleteTextures(1, &mTexName); - } - - mEglDisplay = EGL_NO_DISPLAY; - mEglContext = EGL_NO_CONTEXT; - mAttached = false; - - return OK; -} - -status_t GLConsumer::attachToContext(uint32_t tex) { - ATRACE_CALL(); - GLC_LOGV("attachToContext"); - Mutex::Autolock lock(mMutex); - - if (mAbandoned) { - GLC_LOGE("attachToContext: abandoned GLConsumer"); - return NO_INIT; - } - - if (mAttached) { - GLC_LOGE("attachToContext: GLConsumer is already attached to a " - "context"); - return INVALID_OPERATION; - } - - EGLDisplay dpy = eglGetCurrentDisplay(); - EGLContext ctx = eglGetCurrentContext(); - - if (dpy == EGL_NO_DISPLAY) { - GLC_LOGE("attachToContext: invalid current EGLDisplay"); - return INVALID_OPERATION; - } - - if (ctx == EGL_NO_CONTEXT) { - GLC_LOGE("attachToContext: invalid current EGLContext"); - return INVALID_OPERATION; - } - - // We need to bind the texture regardless of whether there's a current - // buffer. - glBindTexture(mTexTarget, GLuint(tex)); - - mEglDisplay = dpy; - mEglContext = ctx; - mTexName = tex; - mAttached = true; - - if (mCurrentTextureImage != NULL) { - // This may wait for a buffer a second time. This is likely required if - // this is a different context, since otherwise the wait could be skipped - // by bouncing through another context. For the same context the extra - // wait is redundant. - status_t err = bindTextureImageLocked(); - if (err != NO_ERROR) { - return err; - } - } - - return OK; -} - - -status_t GLConsumer::syncForReleaseLocked(EGLDisplay dpy) { - GLC_LOGV("syncForReleaseLocked"); - - if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) { - if (SyncFeatures::getInstance().useNativeFenceSync()) { - EGLSyncKHR sync = eglCreateSyncKHR(dpy, - EGL_SYNC_NATIVE_FENCE_ANDROID, NULL); - if (sync == EGL_NO_SYNC_KHR) { - GLC_LOGE("syncForReleaseLocked: error creating EGL fence: %#x", - eglGetError()); - return UNKNOWN_ERROR; - } - glFlush(); - int fenceFd = eglDupNativeFenceFDANDROID(dpy, sync); - eglDestroySyncKHR(dpy, sync); - if (fenceFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) { - GLC_LOGE("syncForReleaseLocked: error dup'ing native fence " - "fd: %#x", eglGetError()); - return UNKNOWN_ERROR; - } - sp fence(new Fence(fenceFd)); - status_t err = addReleaseFenceLocked(mCurrentTexture, - mCurrentTextureImage->graphicBuffer(), fence); - if (err != OK) { - GLC_LOGE("syncForReleaseLocked: error adding release fence: " - "%s (%d)", strerror(-err), err); - return err; - } - } else if (mUseFenceSync && SyncFeatures::getInstance().useFenceSync()) { - EGLSyncKHR fence = mEglSlots[mCurrentTexture].mEglFence; - if (fence != EGL_NO_SYNC_KHR) { - // There is already a fence for the current slot. We need to - // wait on that before replacing it with another fence to - // ensure that all outstanding buffer accesses have completed - // before the producer accesses it. - EGLint result = eglClientWaitSyncKHR(dpy, fence, 0, 1000000000); - if (result == EGL_FALSE) { - GLC_LOGE("syncForReleaseLocked: error waiting for previous " - "fence: %#x", eglGetError()); - return UNKNOWN_ERROR; - } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { - GLC_LOGE("syncForReleaseLocked: timeout waiting for previous " - "fence"); - return TIMED_OUT; - } - eglDestroySyncKHR(dpy, fence); - } - - // Create a fence for the outstanding accesses in the current - // OpenGL ES context. - fence = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); - if (fence == EGL_NO_SYNC_KHR) { - GLC_LOGE("syncForReleaseLocked: error creating fence: %#x", - eglGetError()); - return UNKNOWN_ERROR; - } - glFlush(); - mEglSlots[mCurrentTexture].mEglFence = fence; - } - } - - return OK; -} - -bool GLConsumer::isExternalFormat(PixelFormat format) -{ - switch (format) { - // supported YUV formats - case HAL_PIXEL_FORMAT_YV12: - // Legacy/deprecated YUV formats - case HAL_PIXEL_FORMAT_YCbCr_422_SP: - case HAL_PIXEL_FORMAT_YCrCb_420_SP: - case HAL_PIXEL_FORMAT_YCbCr_422_I: - return true; - } - - // Any OEM format needs to be considered - if (format>=0x100 && format<=0x1FF) - return true; - - return false; -} - -uint32_t GLConsumer::getCurrentTextureTarget() const { - return mTexTarget; -} - -void GLConsumer::getTransformMatrix(float mtx[16]) { - Mutex::Autolock lock(mMutex); - memcpy(mtx, mCurrentTransformMatrix, sizeof(mCurrentTransformMatrix)); -} - -void GLConsumer::setFilteringEnabled(bool enabled) { - Mutex::Autolock lock(mMutex); - if (mAbandoned) { - GLC_LOGE("setFilteringEnabled: GLConsumer is abandoned!"); - return; - } - bool needsRecompute = mFilteringEnabled != enabled; - mFilteringEnabled = enabled; - - if (needsRecompute && mCurrentTextureImage==NULL) { - GLC_LOGD("setFilteringEnabled called with mCurrentTextureImage == NULL"); - } - - if (needsRecompute && mCurrentTextureImage != NULL) { - computeCurrentTransformMatrixLocked(); - } -} - -void GLConsumer::computeCurrentTransformMatrixLocked() { - GLC_LOGV("computeCurrentTransformMatrixLocked"); - - float xform[16]; - for (int i = 0; i < 16; i++) { - xform[i] = mtxIdentity[i]; - } - if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) { - float result[16]; - mtxMul(result, xform, mtxFlipH); - for (int i = 0; i < 16; i++) { - xform[i] = result[i]; - } - } - if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) { - float result[16]; - mtxMul(result, xform, mtxFlipV); - for (int i = 0; i < 16; i++) { - xform[i] = result[i]; - } - } - if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { - float result[16]; - mtxMul(result, xform, mtxRot90); - for (int i = 0; i < 16; i++) { - xform[i] = result[i]; - } - } - - sp buf = (mCurrentTextureImage == NULL) ? - NULL : mCurrentTextureImage->graphicBuffer(); - - if (buf == NULL) { - GLC_LOGD("computeCurrentTransformMatrixLocked: mCurrentTextureImage is NULL"); - } - - float mtxBeforeFlipV[16]; - if (!isEglImageCroppable(mCurrentCrop)) { - Rect cropRect = mCurrentCrop; - float tx = 0.0f, ty = 0.0f, sx = 1.0f, sy = 1.0f; - float bufferWidth = buf->getWidth(); - float bufferHeight = buf->getHeight(); - if (!cropRect.isEmpty()) { - float shrinkAmount = 0.0f; - if (mFilteringEnabled) { - // In order to prevent bilinear sampling beyond the edge of the - // crop rectangle we may need to shrink it by 2 texels in each - // dimension. Normally this would just need to take 1/2 a texel - // off each end, but because the chroma channels of YUV420 images - // are subsampled we may need to shrink the crop region by a whole - // texel on each side. - switch (buf->getPixelFormat()) { - case PIXEL_FORMAT_RGBA_8888: - case PIXEL_FORMAT_RGBX_8888: - case PIXEL_FORMAT_RGB_888: - case PIXEL_FORMAT_RGB_565: - case PIXEL_FORMAT_BGRA_8888: - // We know there's no subsampling of any channels, so we - // only need to shrink by a half a pixel. - shrinkAmount = 0.5; - break; - - default: - // If we don't recognize the format, we must assume the - // worst case (that we care about), which is YUV420. - shrinkAmount = 1.0; - break; - } - } - - // Only shrink the dimensions that are not the size of the buffer. - if (cropRect.width() < bufferWidth) { - tx = (float(cropRect.left) + shrinkAmount) / bufferWidth; - sx = (float(cropRect.width()) - (2.0f * shrinkAmount)) / - bufferWidth; - } - if (cropRect.height() < bufferHeight) { - ty = (float(bufferHeight - cropRect.bottom) + shrinkAmount) / - bufferHeight; - sy = (float(cropRect.height()) - (2.0f * shrinkAmount)) / - bufferHeight; - } - } - float crop[16] = { - sx, 0, 0, 0, - 0, sy, 0, 0, - 0, 0, 1, 0, - tx, ty, 0, 1, - }; - - mtxMul(mtxBeforeFlipV, crop, xform); - } else { - for (int i = 0; i < 16; i++) { - mtxBeforeFlipV[i] = xform[i]; - } - } - - // SurfaceFlinger expects the top of its window textures to be at a Y - // coordinate of 0, so GLConsumer must behave the same way. We don't - // want to expose this to applications, however, so we must add an - // additional vertical flip to the transform after all the other transforms. - mtxMul(mCurrentTransformMatrix, mtxFlipV, mtxBeforeFlipV); -} - -nsecs_t GLConsumer::getTimestamp() { - GLC_LOGV("getTimestamp"); - Mutex::Autolock lock(mMutex); - return mCurrentTimestamp; -} - -uint64_t GLConsumer::getFrameNumber() { - GLC_LOGV("getFrameNumber"); - Mutex::Autolock lock(mMutex); - return mCurrentFrameNumber; -} - -sp GLConsumer::getCurrentBuffer() const { - Mutex::Autolock lock(mMutex); - return (mCurrentTextureImage == NULL) ? - NULL : mCurrentTextureImage->graphicBuffer(); -} - -Rect GLConsumer::getCurrentCrop() const { - Mutex::Autolock lock(mMutex); - - Rect outCrop = mCurrentCrop; - if (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) { - uint32_t newWidth = static_cast(mCurrentCrop.width()); - uint32_t newHeight = static_cast(mCurrentCrop.height()); - - if (newWidth * mDefaultHeight > newHeight * mDefaultWidth) { - newWidth = newHeight * mDefaultWidth / mDefaultHeight; - GLC_LOGV("too wide: newWidth = %d", newWidth); - } else if (newWidth * mDefaultHeight < newHeight * mDefaultWidth) { - newHeight = newWidth * mDefaultHeight / mDefaultWidth; - GLC_LOGV("too tall: newHeight = %d", newHeight); - } - - uint32_t currentWidth = static_cast(mCurrentCrop.width()); - uint32_t currentHeight = static_cast(mCurrentCrop.height()); - - // The crop is too wide - if (newWidth < currentWidth) { - uint32_t dw = currentWidth - newWidth; - auto halfdw = dw / 2; - outCrop.left += halfdw; - // Not halfdw because it would subtract 1 too few when dw is odd - outCrop.right -= (dw - halfdw); - // The crop is too tall - } else if (newHeight < currentHeight) { - uint32_t dh = currentHeight - newHeight; - auto halfdh = dh / 2; - outCrop.top += halfdh; - // Not halfdh because it would subtract 1 too few when dh is odd - outCrop.bottom -= (dh - halfdh); - } - - GLC_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]", - outCrop.left, outCrop.top, - outCrop.right,outCrop.bottom); - } - - return outCrop; -} - -uint32_t GLConsumer::getCurrentTransform() const { - Mutex::Autolock lock(mMutex); - return mCurrentTransform; -} - -uint32_t GLConsumer::getCurrentScalingMode() const { - Mutex::Autolock lock(mMutex); - return mCurrentScalingMode; -} - -sp GLConsumer::getCurrentFence() const { - Mutex::Autolock lock(mMutex); - return mCurrentFence; -} - -status_t GLConsumer::doGLFenceWait() const { - Mutex::Autolock lock(mMutex); - return doGLFenceWaitLocked(); -} - -status_t GLConsumer::doGLFenceWaitLocked() const { - - EGLDisplay dpy = eglGetCurrentDisplay(); - EGLContext ctx = eglGetCurrentContext(); - - if (mEglDisplay != dpy || mEglDisplay == EGL_NO_DISPLAY) { - GLC_LOGE("doGLFenceWait: invalid current EGLDisplay"); - return INVALID_OPERATION; - } - - if (mEglContext != ctx || mEglContext == EGL_NO_CONTEXT) { - GLC_LOGE("doGLFenceWait: invalid current EGLContext"); - return INVALID_OPERATION; - } - - if (mCurrentFence->isValid()) { - if (SyncFeatures::getInstance().useWaitSync()) { - // Create an EGLSyncKHR from the current fence. - int fenceFd = mCurrentFence->dup(); - if (fenceFd == -1) { - GLC_LOGE("doGLFenceWait: error dup'ing fence fd: %d", errno); - return -errno; - } - EGLint attribs[] = { - EGL_SYNC_NATIVE_FENCE_FD_ANDROID, fenceFd, - EGL_NONE - }; - EGLSyncKHR sync = eglCreateSyncKHR(dpy, - EGL_SYNC_NATIVE_FENCE_ANDROID, attribs); - if (sync == EGL_NO_SYNC_KHR) { - close(fenceFd); - GLC_LOGE("doGLFenceWait: error creating EGL fence: %#x", - eglGetError()); - return UNKNOWN_ERROR; - } - - // XXX: The spec draft is inconsistent as to whether this should - // return an EGLint or void. Ignore the return value for now, as - // it's not strictly needed. - eglWaitSyncKHR(dpy, sync, 0); - EGLint eglErr = eglGetError(); - eglDestroySyncKHR(dpy, sync); - if (eglErr != EGL_SUCCESS) { - GLC_LOGE("doGLFenceWait: error waiting for EGL fence: %#x", - eglErr); - return UNKNOWN_ERROR; - } - } else { - status_t err = mCurrentFence->waitForever( - "GLConsumer::doGLFenceWaitLocked"); - if (err != NO_ERROR) { - GLC_LOGE("doGLFenceWait: error waiting for fence: %d", err); - return err; - } - } - } - - return NO_ERROR; -} - -void GLConsumer::freeBufferLocked(int slotIndex) { - GLC_LOGV("freeBufferLocked: slotIndex=%d", slotIndex); - if (slotIndex == mCurrentTexture) { - mCurrentTexture = BufferQueue::INVALID_BUFFER_SLOT; - } - mEglSlots[slotIndex].mEglImage.clear(); - ConsumerBase::freeBufferLocked(slotIndex); -} - -void GLConsumer::abandonLocked() { - GLC_LOGV("abandonLocked"); - mCurrentTextureImage.clear(); - ConsumerBase::abandonLocked(); -} - -void GLConsumer::setName(const String8& name) { - Mutex::Autolock _l(mMutex); - mName = name; - mConsumer->setConsumerName(name); -} - -status_t GLConsumer::setDefaultBufferFormat(PixelFormat defaultFormat) { - Mutex::Autolock lock(mMutex); - return mConsumer->setDefaultBufferFormat(defaultFormat); -} - -status_t GLConsumer::setDefaultBufferDataSpace( - android_dataspace defaultDataSpace) { - Mutex::Autolock lock(mMutex); - return mConsumer->setDefaultBufferDataSpace(defaultDataSpace); -} - -status_t GLConsumer::setConsumerUsageBits(uint32_t usage) { - Mutex::Autolock lock(mMutex); - usage |= DEFAULT_USAGE_FLAGS; - return mConsumer->setConsumerUsageBits(usage); -} - -status_t GLConsumer::setTransformHint(uint32_t hint) { - Mutex::Autolock lock(mMutex); - return mConsumer->setTransformHint(hint); -} - -void GLConsumer::dumpLocked(String8& result, const char* prefix) const -{ - result.appendFormat( - "%smTexName=%d mCurrentTexture=%d\n" - "%smCurrentCrop=[%d,%d,%d,%d] mCurrentTransform=%#x\n", - prefix, mTexName, mCurrentTexture, prefix, mCurrentCrop.left, - mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom, - mCurrentTransform); - - ConsumerBase::dumpLocked(result, prefix); -} - -static void mtxMul(float out[16], const float a[16], const float b[16]) { - out[0] = a[0]*b[0] + a[4]*b[1] + a[8]*b[2] + a[12]*b[3]; - out[1] = a[1]*b[0] + a[5]*b[1] + a[9]*b[2] + a[13]*b[3]; - out[2] = a[2]*b[0] + a[6]*b[1] + a[10]*b[2] + a[14]*b[3]; - out[3] = a[3]*b[0] + a[7]*b[1] + a[11]*b[2] + a[15]*b[3]; - - out[4] = a[0]*b[4] + a[4]*b[5] + a[8]*b[6] + a[12]*b[7]; - out[5] = a[1]*b[4] + a[5]*b[5] + a[9]*b[6] + a[13]*b[7]; - out[6] = a[2]*b[4] + a[6]*b[5] + a[10]*b[6] + a[14]*b[7]; - out[7] = a[3]*b[4] + a[7]*b[5] + a[11]*b[6] + a[15]*b[7]; - - out[8] = a[0]*b[8] + a[4]*b[9] + a[8]*b[10] + a[12]*b[11]; - out[9] = a[1]*b[8] + a[5]*b[9] + a[9]*b[10] + a[13]*b[11]; - out[10] = a[2]*b[8] + a[6]*b[9] + a[10]*b[10] + a[14]*b[11]; - out[11] = a[3]*b[8] + a[7]*b[9] + a[11]*b[10] + a[15]*b[11]; - - out[12] = a[0]*b[12] + a[4]*b[13] + a[8]*b[14] + a[12]*b[15]; - out[13] = a[1]*b[12] + a[5]*b[13] + a[9]*b[14] + a[13]*b[15]; - out[14] = a[2]*b[12] + a[6]*b[13] + a[10]*b[14] + a[14]*b[15]; - out[15] = a[3]*b[12] + a[7]*b[13] + a[11]*b[14] + a[15]*b[15]; -} - -GLConsumer::EglImage::EglImage(sp graphicBuffer) : - mGraphicBuffer(graphicBuffer), - mEglImage(EGL_NO_IMAGE_KHR), - mEglDisplay(EGL_NO_DISPLAY) { -} - -GLConsumer::EglImage::~EglImage() { - if (mEglImage != EGL_NO_IMAGE_KHR) { - if (!eglDestroyImageKHR(mEglDisplay, mEglImage)) { - ALOGE("~EglImage: eglDestroyImageKHR failed"); - } - eglTerminate(mEglDisplay); - } -} - -status_t GLConsumer::EglImage::createIfNeeded(EGLDisplay eglDisplay, - const Rect& cropRect, - bool forceCreation) { - // If there's an image and it's no longer valid, destroy it. - bool haveImage = mEglImage != EGL_NO_IMAGE_KHR; - bool displayInvalid = mEglDisplay != eglDisplay; - bool cropInvalid = hasEglAndroidImageCrop() && mCropRect != cropRect; - if (haveImage && (displayInvalid || cropInvalid || forceCreation)) { - if (!eglDestroyImageKHR(mEglDisplay, mEglImage)) { - ALOGE("createIfNeeded: eglDestroyImageKHR failed"); - } - eglTerminate(mEglDisplay); - mEglImage = EGL_NO_IMAGE_KHR; - mEglDisplay = EGL_NO_DISPLAY; - } - - // If there's no image, create one. - if (mEglImage == EGL_NO_IMAGE_KHR) { - mEglDisplay = eglDisplay; - mCropRect = cropRect; - mEglImage = createImage(mEglDisplay, mGraphicBuffer, mCropRect); - } - - // Fail if we can't create a valid image. - if (mEglImage == EGL_NO_IMAGE_KHR) { - mEglDisplay = EGL_NO_DISPLAY; - mCropRect.makeInvalid(); - const sp& buffer = mGraphicBuffer; - ALOGE("Failed to create image. size=%ux%u st=%u usage=0x%x fmt=%d", - buffer->getWidth(), buffer->getHeight(), buffer->getStride(), - buffer->getUsage(), buffer->getPixelFormat()); - return UNKNOWN_ERROR; - } - - return OK; -} - -void GLConsumer::EglImage::bindToTextureTarget(uint32_t texTarget) { - glEGLImageTargetTexture2DOES(texTarget, - static_cast(mEglImage)); -} - -EGLImageKHR GLConsumer::EglImage::createImage(EGLDisplay dpy, - const sp& graphicBuffer, const Rect& crop) { - EGLClientBuffer cbuf = - static_cast(graphicBuffer->getNativeBuffer()); - EGLint attrs[] = { - EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, - EGL_IMAGE_CROP_LEFT_ANDROID, crop.left, - EGL_IMAGE_CROP_TOP_ANDROID, crop.top, - EGL_IMAGE_CROP_RIGHT_ANDROID, crop.right, - EGL_IMAGE_CROP_BOTTOM_ANDROID, crop.bottom, - EGL_NONE, - }; - if (!crop.isValid()) { - // No crop rect to set, so terminate the attrib array before the crop. - attrs[2] = EGL_NONE; - } else if (!isEglImageCroppable(crop)) { - // The crop rect is not at the origin, so we can't set the crop on the - // EGLImage because that's not allowed by the EGL_ANDROID_image_crop - // extension. In the future we can add a layered extension that - // removes this restriction if there is hardware that can support it. - attrs[2] = EGL_NONE; - } - eglInitialize(dpy, 0, 0); - EGLImageKHR image = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, - EGL_NATIVE_BUFFER_ANDROID, cbuf, attrs); - if (image == EGL_NO_IMAGE_KHR) { - EGLint error = eglGetError(); - ALOGE("error creating EGLImage: %#x", error); - eglTerminate(dpy); - } - return image; -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/GraphicBufferAlloc.cpp android-platform-frameworks-native-21/libs/gui/GraphicBufferAlloc.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/GraphicBufferAlloc.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/GraphicBufferAlloc.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,54 +0,0 @@ -/* - ** - ** Copyright 2012 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 - -#include - -#include - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -GraphicBufferAlloc::GraphicBufferAlloc() { -} - -GraphicBufferAlloc::~GraphicBufferAlloc() { -} - -sp GraphicBufferAlloc::createGraphicBuffer(uint32_t width, - uint32_t height, PixelFormat format, uint32_t usage, status_t* error) { - sp graphicBuffer( - new GraphicBuffer(width, height, format, usage)); - status_t err = graphicBuffer->initCheck(); - *error = err; - if (err != 0 || graphicBuffer->handle == 0) { - if (err == NO_MEMORY) { - GraphicBuffer::dumpAllocationsToSystemLog(); - } - ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " - "failed (%s), handle=%p", - width, height, strerror(-err), graphicBuffer->handle); - return 0; - } - return graphicBuffer; -} - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/GuiConfig.cpp android-platform-frameworks-native-21/libs/gui/GuiConfig.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/GuiConfig.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/GuiConfig.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,32 +0,0 @@ -/* - * Copyright (C) 2012 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 - -namespace android { - -void appendGuiConfigString(String8& configStr) -{ - static const char* config = - " [libgui" -#ifdef DONT_USE_FENCE_SYNC - " DONT_USE_FENCE_SYNC" -#endif - "]"; - configStr.append(config); -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/IConsumerListener.cpp android-platform-frameworks-native-21/libs/gui/IConsumerListener.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/IConsumerListener.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/IConsumerListener.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include - -#include -#include - -#include -#include - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -enum { - ON_FRAME_AVAILABLE = IBinder::FIRST_CALL_TRANSACTION, - ON_BUFFER_RELEASED, - ON_SIDEBAND_STREAM_CHANGED, -}; - -class BpConsumerListener : public BpInterface -{ -public: - BpConsumerListener(const sp& impl) - : BpInterface(impl) { - } - - virtual ~BpConsumerListener(); - - virtual void onFrameAvailable(const BufferItem& item) { - Parcel data, reply; - data.writeInterfaceToken(IConsumerListener::getInterfaceDescriptor()); - data.write(item); - remote()->transact(ON_FRAME_AVAILABLE, data, &reply, IBinder::FLAG_ONEWAY); - } - - virtual void onBuffersReleased() { - Parcel data, reply; - data.writeInterfaceToken(IConsumerListener::getInterfaceDescriptor()); - remote()->transact(ON_BUFFER_RELEASED, data, &reply, IBinder::FLAG_ONEWAY); - } - - virtual void onSidebandStreamChanged() { - Parcel data, reply; - data.writeInterfaceToken(IConsumerListener::getInterfaceDescriptor()); - remote()->transact(ON_SIDEBAND_STREAM_CHANGED, data, &reply, IBinder::FLAG_ONEWAY); - } -}; - -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpConsumerListener::~BpConsumerListener() {} - -IMPLEMENT_META_INTERFACE(ConsumerListener, "android.gui.IConsumerListener"); - -// ---------------------------------------------------------------------- - -status_t BnConsumerListener::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case ON_FRAME_AVAILABLE: { - CHECK_INTERFACE(IConsumerListener, data, reply); - BufferItem item; - data.read(item); - onFrameAvailable(item); - return NO_ERROR; } - case ON_BUFFER_RELEASED: { - CHECK_INTERFACE(IConsumerListener, data, reply); - onBuffersReleased(); - return NO_ERROR; } - case ON_SIDEBAND_STREAM_CHANGED: { - CHECK_INTERFACE(IConsumerListener, data, reply); - onSidebandStreamChanged(); - return NO_ERROR; } - } - return BBinder::onTransact(code, data, reply, flags); -} - - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/IDisplayEventConnection.cpp android-platform-frameworks-native-21/libs/gui/IDisplayEventConnection.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/IDisplayEventConnection.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/IDisplayEventConnection.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -44,8 +44,6 @@ { } - virtual ~BpDisplayEventConnection(); - virtual sp getDataChannel() const { Parcel data, reply; @@ -57,7 +55,7 @@ virtual void setVsyncRate(uint32_t count) { Parcel data, reply; data.writeInterfaceToken(IDisplayEventConnection::getInterfaceDescriptor()); - data.writeUint32(count); + data.writeInt32(count); remote()->transact(SET_VSYNC_RATE, data, &reply); } @@ -68,10 +66,6 @@ } }; -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpDisplayEventConnection::~BpDisplayEventConnection() {} - IMPLEMENT_META_INTERFACE(DisplayEventConnection, "android.gui.DisplayEventConnection"); // ---------------------------------------------------------------------------- @@ -85,17 +79,17 @@ sp channel(getDataChannel()); channel->writeToParcel(reply); return NO_ERROR; - } + } break; case SET_VSYNC_RATE: { CHECK_INTERFACE(IDisplayEventConnection, data, reply); - setVsyncRate(data.readUint32()); + setVsyncRate(data.readInt32()); return NO_ERROR; - } + } break; case REQUEST_NEXT_VSYNC: { CHECK_INTERFACE(IDisplayEventConnection, data, reply); requestNextVsync(); return NO_ERROR; - } + } break; } return BBinder::onTransact(code, data, reply, flags); } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/IGraphicBufferAlloc.cpp android-platform-frameworks-native-21/libs/gui/IGraphicBufferAlloc.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/IGraphicBufferAlloc.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/IGraphicBufferAlloc.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -42,26 +42,20 @@ { } - virtual ~BpGraphicBufferAlloc(); - - virtual sp createGraphicBuffer(uint32_t width, - uint32_t height, PixelFormat format, uint32_t usage, - status_t* error) { + virtual sp createGraphicBuffer(uint32_t w, uint32_t h, + PixelFormat format, uint32_t usage, status_t* error) { Parcel data, reply; data.writeInterfaceToken(IGraphicBufferAlloc::getInterfaceDescriptor()); - data.writeUint32(width); - data.writeUint32(height); - data.writeInt32(static_cast(format)); - data.writeUint32(usage); + data.writeInt32(w); + data.writeInt32(h); + data.writeInt32(format); + data.writeInt32(usage); remote()->transact(CREATE_GRAPHIC_BUFFER, data, &reply); sp graphicBuffer; status_t result = reply.readInt32(); if (result == NO_ERROR) { graphicBuffer = new GraphicBuffer(); - result = reply.read(*graphicBuffer); - if (result != NO_ERROR) { - graphicBuffer.clear(); - } + reply.read(*graphicBuffer); // reply.readStrongBinder(); // here we don't even have to read the BufferReference from // the parcel, it'll die with the parcel. @@ -71,10 +65,6 @@ } }; -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpGraphicBufferAlloc::~BpGraphicBufferAlloc() {} - IMPLEMENT_META_INTERFACE(GraphicBufferAlloc, "android.ui.IGraphicBufferAlloc"); // ---------------------------------------------------------------------- @@ -84,26 +74,27 @@ { // codes that don't require permission check - // BufferReference just keeps a strong reference to a GraphicBuffer until it - // is destroyed (that is, until no local or remote process have a reference - // to it). + /* BufferReference just keeps a strong reference to a + * GraphicBuffer until it is destroyed (that is, until + * no local or remote process have a reference to it). + */ class BufferReference : public BBinder { - sp mBuffer; + sp buffer; public: - BufferReference(const sp& buffer) : mBuffer(buffer) {} + BufferReference(const sp& buffer) : buffer(buffer) { } }; - switch (code) { + switch(code) { case CREATE_GRAPHIC_BUFFER: { CHECK_INTERFACE(IGraphicBufferAlloc, data, reply); - uint32_t width = data.readUint32(); - uint32_t height = data.readUint32(); - PixelFormat format = static_cast(data.readInt32()); - uint32_t usage = data.readUint32(); + uint32_t w = data.readInt32(); + uint32_t h = data.readInt32(); + PixelFormat format = data.readInt32(); + uint32_t usage = data.readInt32(); status_t error; sp result = - createGraphicBuffer(width, height, format, usage, &error); + createGraphicBuffer(w, h, format, usage, &error); reply->writeInt32(error); if (result != 0) { reply->write(*result); @@ -116,7 +107,7 @@ reply->writeStrongBinder( new BufferReference(result) ); } return NO_ERROR; - } + } break; default: return BBinder::onTransact(code, data, reply, flags); } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/IGraphicBufferConsumer.cpp android-platform-frameworks-native-21/libs/gui/IGraphicBufferConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/IGraphicBufferConsumer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/IGraphicBufferConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,441 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include -#include - -#include - -namespace android { - -enum { - ACQUIRE_BUFFER = IBinder::FIRST_CALL_TRANSACTION, - DETACH_BUFFER, - ATTACH_BUFFER, - RELEASE_BUFFER, - CONSUMER_CONNECT, - CONSUMER_DISCONNECT, - GET_RELEASED_BUFFERS, - SET_DEFAULT_BUFFER_SIZE, - SET_DEFAULT_MAX_BUFFER_COUNT, - DISABLE_ASYNC_BUFFER, - SET_MAX_ACQUIRED_BUFFER_COUNT, - SET_CONSUMER_NAME, - SET_DEFAULT_BUFFER_FORMAT, - SET_DEFAULT_BUFFER_DATA_SPACE, - SET_CONSUMER_USAGE_BITS, - SET_TRANSFORM_HINT, - GET_SIDEBAND_STREAM, - DUMP, -}; - - -class BpGraphicBufferConsumer : public BpInterface -{ -public: - BpGraphicBufferConsumer(const sp& impl) - : BpInterface(impl) - { - } - - virtual ~BpGraphicBufferConsumer(); - - virtual status_t acquireBuffer(BufferItem *buffer, nsecs_t presentWhen, - uint64_t maxFrameNumber) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt64(presentWhen); - data.writeUint64(maxFrameNumber); - status_t result = remote()->transact(ACQUIRE_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.read(*buffer); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t detachBuffer(int slot) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt32(slot); - status_t result = remote()->transact(DETACH_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.readInt32(); - return result; - } - - virtual status_t attachBuffer(int* slot, const sp& buffer) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.write(*buffer.get()); - status_t result = remote()->transact(ATTACH_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - *slot = reply.readInt32(); - result = reply.readInt32(); - return result; - } - - virtual status_t releaseBuffer(int buf, uint64_t frameNumber, - EGLDisplay display __attribute__((unused)), EGLSyncKHR fence __attribute__((unused)), - const sp& releaseFence) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt32(buf); - data.writeInt64(static_cast(frameNumber)); - data.write(*releaseFence); - status_t result = remote()->transact(RELEASE_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t consumerConnect(const sp& consumer, bool controlledByApp) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(consumer)); - data.writeInt32(controlledByApp); - status_t result = remote()->transact(CONSUMER_CONNECT, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t consumerDisconnect() { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - status_t result = remote()->transact(CONSUMER_DISCONNECT, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t getReleasedBuffers(uint64_t* slotMask) { - Parcel data, reply; - if (slotMask == NULL) { - ALOGE("getReleasedBuffers: slotMask must not be NULL"); - return BAD_VALUE; - } - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - status_t result = remote()->transact(GET_RELEASED_BUFFERS, data, &reply); - if (result != NO_ERROR) { - return result; - } - *slotMask = static_cast(reply.readInt64()); - return reply.readInt32(); - } - - virtual status_t setDefaultBufferSize(uint32_t width, uint32_t height) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeUint32(width); - data.writeUint32(height); - status_t result = remote()->transact(SET_DEFAULT_BUFFER_SIZE, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t setDefaultMaxBufferCount(int bufferCount) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt32(bufferCount); - status_t result = remote()->transact(SET_DEFAULT_MAX_BUFFER_COUNT, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t disableAsyncBuffer() { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - status_t result = remote()->transact(DISABLE_ASYNC_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t setMaxAcquiredBufferCount(int maxAcquiredBuffers) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt32(maxAcquiredBuffers); - status_t result = remote()->transact(SET_MAX_ACQUIRED_BUFFER_COUNT, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual void setConsumerName(const String8& name) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeString8(name); - remote()->transact(SET_CONSUMER_NAME, data, &reply); - } - - virtual status_t setDefaultBufferFormat(PixelFormat defaultFormat) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt32(static_cast(defaultFormat)); - status_t result = remote()->transact(SET_DEFAULT_BUFFER_FORMAT, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t setDefaultBufferDataSpace( - android_dataspace defaultDataSpace) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeInt32(static_cast(defaultDataSpace)); - status_t result = remote()->transact(SET_DEFAULT_BUFFER_DATA_SPACE, - data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t setConsumerUsageBits(uint32_t usage) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeUint32(usage); - status_t result = remote()->transact(SET_CONSUMER_USAGE_BITS, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual status_t setTransformHint(uint32_t hint) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeUint32(hint); - status_t result = remote()->transact(SET_TRANSFORM_HINT, data, &reply); - if (result != NO_ERROR) { - return result; - } - return reply.readInt32(); - } - - virtual sp getSidebandStream() const { - Parcel data, reply; - status_t err; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - if ((err = remote()->transact(GET_SIDEBAND_STREAM, data, &reply)) != NO_ERROR) { - return NULL; - } - sp stream; - if (reply.readInt32()) { - stream = NativeHandle::create(reply.readNativeHandle(), true); - } - return stream; - } - - virtual void dump(String8& result, const char* prefix) const { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferConsumer::getInterfaceDescriptor()); - data.writeString8(result); - data.writeString8(String8(prefix ? prefix : "")); - remote()->transact(DUMP, data, &reply); - reply.readString8(); - } -}; - -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpGraphicBufferConsumer::~BpGraphicBufferConsumer() {} - -IMPLEMENT_META_INTERFACE(GraphicBufferConsumer, "android.gui.IGraphicBufferConsumer"); - -// ---------------------------------------------------------------------- - -status_t BnGraphicBufferConsumer::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case ACQUIRE_BUFFER: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - BufferItem item; - int64_t presentWhen = data.readInt64(); - uint64_t maxFrameNumber = data.readUint64(); - status_t result = acquireBuffer(&item, presentWhen, maxFrameNumber); - status_t err = reply->write(item); - if (err) return err; - reply->writeInt32(result); - return NO_ERROR; - } - case DETACH_BUFFER: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - int slot = data.readInt32(); - int result = detachBuffer(slot); - reply->writeInt32(result); - return NO_ERROR; - } - case ATTACH_BUFFER: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - sp buffer = new GraphicBuffer(); - data.read(*buffer.get()); - int slot; - int result = attachBuffer(&slot, buffer); - reply->writeInt32(slot); - reply->writeInt32(result); - return NO_ERROR; - } - case RELEASE_BUFFER: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - int buf = data.readInt32(); - uint64_t frameNumber = static_cast(data.readInt64()); - sp releaseFence = new Fence(); - status_t err = data.read(*releaseFence); - if (err) return err; - status_t result = releaseBuffer(buf, frameNumber, - EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, releaseFence); - reply->writeInt32(result); - return NO_ERROR; - } - case CONSUMER_CONNECT: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - sp consumer = IConsumerListener::asInterface( data.readStrongBinder() ); - bool controlledByApp = data.readInt32(); - status_t result = consumerConnect(consumer, controlledByApp); - reply->writeInt32(result); - return NO_ERROR; - } - case CONSUMER_DISCONNECT: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - status_t result = consumerDisconnect(); - reply->writeInt32(result); - return NO_ERROR; - } - case GET_RELEASED_BUFFERS: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - uint64_t slotMask; - status_t result = getReleasedBuffers(&slotMask); - reply->writeInt64(static_cast(slotMask)); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_DEFAULT_BUFFER_SIZE: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - uint32_t width = data.readUint32(); - uint32_t height = data.readUint32(); - status_t result = setDefaultBufferSize(width, height); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_DEFAULT_MAX_BUFFER_COUNT: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - int bufferCount = data.readInt32(); - status_t result = setDefaultMaxBufferCount(bufferCount); - reply->writeInt32(result); - return NO_ERROR; - } - case DISABLE_ASYNC_BUFFER: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - status_t result = disableAsyncBuffer(); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_MAX_ACQUIRED_BUFFER_COUNT: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - int maxAcquiredBuffers = data.readInt32(); - status_t result = setMaxAcquiredBufferCount(maxAcquiredBuffers); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_CONSUMER_NAME: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - setConsumerName( data.readString8() ); - return NO_ERROR; - } - case SET_DEFAULT_BUFFER_FORMAT: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - PixelFormat defaultFormat = static_cast(data.readInt32()); - status_t result = setDefaultBufferFormat(defaultFormat); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_DEFAULT_BUFFER_DATA_SPACE: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - android_dataspace defaultDataSpace = - static_cast(data.readInt32()); - status_t result = setDefaultBufferDataSpace(defaultDataSpace); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_CONSUMER_USAGE_BITS: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - uint32_t usage = data.readUint32(); - status_t result = setConsumerUsageBits(usage); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_TRANSFORM_HINT: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - uint32_t hint = data.readUint32(); - status_t result = setTransformHint(hint); - reply->writeInt32(result); - return NO_ERROR; - } - case GET_SIDEBAND_STREAM: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - sp stream = getSidebandStream(); - reply->writeInt32(static_cast(stream != NULL)); - if (stream != NULL) { - reply->writeNativeHandle(stream->handle()); - } - return NO_ERROR; - } - case DUMP: { - CHECK_INTERFACE(IGraphicBufferConsumer, data, reply); - String8 result = data.readString8(); - String8 prefix = data.readString8(); - static_cast(this)->dump(result, prefix); - reply->writeString8(result); - return NO_ERROR; - } - } - return BBinder::onTransact(code, data, reply, flags); -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/IGraphicBufferProducer.cpp android-platform-frameworks-native-21/libs/gui/IGraphicBufferProducer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/IGraphicBufferProducer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/IGraphicBufferProducer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,569 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include - -#include -#include -#include -#include -#include - -#include -#include - -#include -#include - -namespace android { -// ---------------------------------------------------------------------------- - -enum { - REQUEST_BUFFER = IBinder::FIRST_CALL_TRANSACTION, - SET_BUFFER_COUNT, - DEQUEUE_BUFFER, - DETACH_BUFFER, - DETACH_NEXT_BUFFER, - ATTACH_BUFFER, - QUEUE_BUFFER, - CANCEL_BUFFER, - QUERY, - CONNECT, - DISCONNECT, - SET_SIDEBAND_STREAM, - ALLOCATE_BUFFERS, - ALLOW_ALLOCATION, - SET_GENERATION_NUMBER, - GET_CONSUMER_NAME, -}; - -class BpGraphicBufferProducer : public BpInterface -{ -public: - BpGraphicBufferProducer(const sp& impl) - : BpInterface(impl) - { - } - - virtual ~BpGraphicBufferProducer(); - - virtual status_t requestBuffer(int bufferIdx, sp* buf) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(bufferIdx); - status_t result =remote()->transact(REQUEST_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - bool nonNull = reply.readInt32(); - if (nonNull) { - *buf = new GraphicBuffer(); - result = reply.read(**buf); - if(result != NO_ERROR) { - (*buf).clear(); - return result; - } - } - result = reply.readInt32(); - return result; - } - - virtual status_t setBufferCount(int bufferCount) - { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(bufferCount); - status_t result =remote()->transact(SET_BUFFER_COUNT, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.readInt32(); - return result; - } - - virtual status_t dequeueBuffer(int *buf, sp* fence, bool async, - uint32_t width, uint32_t height, PixelFormat format, - uint32_t usage) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(static_cast(async)); - data.writeUint32(width); - data.writeUint32(height); - data.writeInt32(static_cast(format)); - data.writeUint32(usage); - status_t result = remote()->transact(DEQUEUE_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - *buf = reply.readInt32(); - bool nonNull = reply.readInt32(); - if (nonNull) { - *fence = new Fence(); - reply.read(**fence); - } - result = reply.readInt32(); - return result; - } - - virtual status_t detachBuffer(int slot) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(slot); - status_t result = remote()->transact(DETACH_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.readInt32(); - return result; - } - - virtual status_t detachNextBuffer(sp* outBuffer, - sp* outFence) { - if (outBuffer == NULL) { - ALOGE("detachNextBuffer: outBuffer must not be NULL"); - return BAD_VALUE; - } else if (outFence == NULL) { - ALOGE("detachNextBuffer: outFence must not be NULL"); - return BAD_VALUE; - } - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - status_t result = remote()->transact(DETACH_NEXT_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.readInt32(); - if (result == NO_ERROR) { - bool nonNull = reply.readInt32(); - if (nonNull) { - *outBuffer = new GraphicBuffer; - reply.read(**outBuffer); - } - nonNull = reply.readInt32(); - if (nonNull) { - *outFence = new Fence; - reply.read(**outFence); - } - } - return result; - } - - virtual status_t attachBuffer(int* slot, const sp& buffer) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.write(*buffer.get()); - status_t result = remote()->transact(ATTACH_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - *slot = reply.readInt32(); - result = reply.readInt32(); - return result; - } - - virtual status_t queueBuffer(int buf, - const QueueBufferInput& input, QueueBufferOutput* output) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(buf); - data.write(input); - status_t result = remote()->transact(QUEUE_BUFFER, data, &reply); - if (result != NO_ERROR) { - return result; - } - memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output)); - result = reply.readInt32(); - return result; - } - - virtual void cancelBuffer(int buf, const sp& fence) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(buf); - data.write(*fence.get()); - remote()->transact(CANCEL_BUFFER, data, &reply); - } - - virtual int query(int what, int* value) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(what); - status_t result = remote()->transact(QUERY, data, &reply); - if (result != NO_ERROR) { - return result; - } - value[0] = reply.readInt32(); - result = reply.readInt32(); - return result; - } - - virtual status_t connect(const sp& listener, - int api, bool producerControlledByApp, QueueBufferOutput* output) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - if (listener != NULL) { - data.writeInt32(1); - data.writeStrongBinder(IInterface::asBinder(listener)); - } else { - data.writeInt32(0); - } - data.writeInt32(api); - data.writeInt32(producerControlledByApp); - status_t result = remote()->transact(CONNECT, data, &reply); - if (result != NO_ERROR) { - return result; - } - memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output)); - result = reply.readInt32(); - return result; - } - - virtual status_t disconnect(int api) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(api); - status_t result =remote()->transact(DISCONNECT, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.readInt32(); - return result; - } - - virtual status_t setSidebandStream(const sp& stream) { - Parcel data, reply; - status_t result; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - if (stream.get()) { - data.writeInt32(true); - data.writeNativeHandle(stream->handle()); - } else { - data.writeInt32(false); - } - if ((result = remote()->transact(SET_SIDEBAND_STREAM, data, &reply)) == NO_ERROR) { - result = reply.readInt32(); - } - return result; - } - - virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - PixelFormat format, uint32_t usage) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(static_cast(async)); - data.writeUint32(width); - data.writeUint32(height); - data.writeInt32(static_cast(format)); - data.writeUint32(usage); - status_t result = remote()->transact(ALLOCATE_BUFFERS, data, &reply); - if (result != NO_ERROR) { - ALOGE("allocateBuffers failed to transact: %d", result); - } - } - - virtual status_t allowAllocation(bool allow) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeInt32(static_cast(allow)); - status_t result = remote()->transact(ALLOW_ALLOCATION, data, &reply); - if (result != NO_ERROR) { - return result; - } - result = reply.readInt32(); - return result; - } - - virtual status_t setGenerationNumber(uint32_t generationNumber) { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - data.writeUint32(generationNumber); - status_t result = remote()->transact(SET_GENERATION_NUMBER, data, &reply); - if (result == NO_ERROR) { - result = reply.readInt32(); - } - return result; - } - - virtual String8 getConsumerName() const { - Parcel data, reply; - data.writeInterfaceToken(IGraphicBufferProducer::getInterfaceDescriptor()); - status_t result = remote()->transact(GET_CONSUMER_NAME, data, &reply); - if (result != NO_ERROR) { - ALOGE("getConsumerName failed to transact: %d", result); - return String8("TransactFailed"); - } - return reply.readString8(); - } -}; - -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpGraphicBufferProducer::~BpGraphicBufferProducer() {} - -IMPLEMENT_META_INTERFACE(GraphicBufferProducer, "android.gui.IGraphicBufferProducer"); - -// ---------------------------------------------------------------------- - -status_t BnGraphicBufferProducer::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - switch(code) { - case REQUEST_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int bufferIdx = data.readInt32(); - sp buffer; - int result = requestBuffer(bufferIdx, &buffer); - reply->writeInt32(buffer != 0); - if (buffer != 0) { - reply->write(*buffer); - } - reply->writeInt32(result); - return NO_ERROR; - } - case SET_BUFFER_COUNT: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int bufferCount = data.readInt32(); - int result = setBufferCount(bufferCount); - reply->writeInt32(result); - return NO_ERROR; - } - case DEQUEUE_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - bool async = static_cast(data.readInt32()); - uint32_t width = data.readUint32(); - uint32_t height = data.readUint32(); - PixelFormat format = static_cast(data.readInt32()); - uint32_t usage = data.readUint32(); - int buf = 0; - sp fence; - int result = dequeueBuffer(&buf, &fence, async, width, height, - format, usage); - reply->writeInt32(buf); - reply->writeInt32(fence != NULL); - if (fence != NULL) { - reply->write(*fence); - } - reply->writeInt32(result); - return NO_ERROR; - } - case DETACH_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int slot = data.readInt32(); - int result = detachBuffer(slot); - reply->writeInt32(result); - return NO_ERROR; - } - case DETACH_NEXT_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - sp buffer; - sp fence; - int32_t result = detachNextBuffer(&buffer, &fence); - reply->writeInt32(result); - if (result == NO_ERROR) { - reply->writeInt32(buffer != NULL); - if (buffer != NULL) { - reply->write(*buffer); - } - reply->writeInt32(fence != NULL); - if (fence != NULL) { - reply->write(*fence); - } - } - return NO_ERROR; - } - case ATTACH_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - sp buffer = new GraphicBuffer(); - data.read(*buffer.get()); - int slot = 0; - int result = attachBuffer(&slot, buffer); - reply->writeInt32(slot); - reply->writeInt32(result); - return NO_ERROR; - } - case QUEUE_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int buf = data.readInt32(); - QueueBufferInput input(data); - QueueBufferOutput* const output = - reinterpret_cast( - reply->writeInplace(sizeof(QueueBufferOutput))); - status_t result = queueBuffer(buf, input, output); - reply->writeInt32(result); - return NO_ERROR; - } - case CANCEL_BUFFER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int buf = data.readInt32(); - sp fence = new Fence(); - data.read(*fence.get()); - cancelBuffer(buf, fence); - return NO_ERROR; - } - case QUERY: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int value = 0; - int what = data.readInt32(); - int res = query(what, &value); - reply->writeInt32(value); - reply->writeInt32(res); - return NO_ERROR; - } - case CONNECT: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - sp listener; - if (data.readInt32() == 1) { - listener = IProducerListener::asInterface(data.readStrongBinder()); - } - int api = data.readInt32(); - bool producerControlledByApp = data.readInt32(); - QueueBufferOutput* const output = - reinterpret_cast( - reply->writeInplace(sizeof(QueueBufferOutput))); - status_t res = connect(listener, api, producerControlledByApp, output); - reply->writeInt32(res); - return NO_ERROR; - } - case DISCONNECT: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - int api = data.readInt32(); - status_t res = disconnect(api); - reply->writeInt32(res); - return NO_ERROR; - } - case SET_SIDEBAND_STREAM: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - sp stream; - if (data.readInt32()) { - stream = NativeHandle::create(data.readNativeHandle(), true); - } - status_t result = setSidebandStream(stream); - reply->writeInt32(result); - return NO_ERROR; - } - case ALLOCATE_BUFFERS: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - bool async = static_cast(data.readInt32()); - uint32_t width = data.readUint32(); - uint32_t height = data.readUint32(); - PixelFormat format = static_cast(data.readInt32()); - uint32_t usage = data.readUint32(); - allocateBuffers(async, width, height, format, usage); - return NO_ERROR; - } - case ALLOW_ALLOCATION: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - bool allow = static_cast(data.readInt32()); - status_t result = allowAllocation(allow); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_GENERATION_NUMBER: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - uint32_t generationNumber = data.readUint32(); - status_t result = setGenerationNumber(generationNumber); - reply->writeInt32(result); - return NO_ERROR; - } - case GET_CONSUMER_NAME: { - CHECK_INTERFACE(IGraphicBufferProducer, data, reply); - reply->writeString8(getConsumerName()); - return NO_ERROR; - } - } - return BBinder::onTransact(code, data, reply, flags); -} - -// ---------------------------------------------------------------------------- - -IGraphicBufferProducer::QueueBufferInput::QueueBufferInput(const Parcel& parcel) { - parcel.read(*this); -} - -size_t IGraphicBufferProducer::QueueBufferInput::getFlattenedSize() const { - return sizeof(timestamp) - + sizeof(isAutoTimestamp) - + sizeof(dataSpace) - + sizeof(crop) - + sizeof(scalingMode) - + sizeof(transform) - + sizeof(stickyTransform) - + sizeof(async) - + fence->getFlattenedSize() - + surfaceDamage.getFlattenedSize(); -} - -size_t IGraphicBufferProducer::QueueBufferInput::getFdCount() const { - return fence->getFdCount(); -} - -status_t IGraphicBufferProducer::QueueBufferInput::flatten( - void*& buffer, size_t& size, int*& fds, size_t& count) const -{ - if (size < getFlattenedSize()) { - return NO_MEMORY; - } - FlattenableUtils::write(buffer, size, timestamp); - FlattenableUtils::write(buffer, size, isAutoTimestamp); - FlattenableUtils::write(buffer, size, dataSpace); - FlattenableUtils::write(buffer, size, crop); - FlattenableUtils::write(buffer, size, scalingMode); - FlattenableUtils::write(buffer, size, transform); - FlattenableUtils::write(buffer, size, stickyTransform); - FlattenableUtils::write(buffer, size, async); - status_t result = fence->flatten(buffer, size, fds, count); - if (result != NO_ERROR) { - return result; - } - return surfaceDamage.flatten(buffer, size); -} - -status_t IGraphicBufferProducer::QueueBufferInput::unflatten( - void const*& buffer, size_t& size, int const*& fds, size_t& count) -{ - size_t minNeeded = - sizeof(timestamp) - + sizeof(isAutoTimestamp) - + sizeof(dataSpace) - + sizeof(crop) - + sizeof(scalingMode) - + sizeof(transform) - + sizeof(stickyTransform) - + sizeof(async); - - if (size < minNeeded) { - return NO_MEMORY; - } - - FlattenableUtils::read(buffer, size, timestamp); - FlattenableUtils::read(buffer, size, isAutoTimestamp); - FlattenableUtils::read(buffer, size, dataSpace); - FlattenableUtils::read(buffer, size, crop); - FlattenableUtils::read(buffer, size, scalingMode); - FlattenableUtils::read(buffer, size, transform); - FlattenableUtils::read(buffer, size, stickyTransform); - FlattenableUtils::read(buffer, size, async); - - fence = new Fence(); - status_t result = fence->unflatten(buffer, size, fds, count); - if (result != NO_ERROR) { - return result; - } - return surfaceDamage.unflatten(buffer, size); -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/IProducerListener.cpp android-platform-frameworks-native-21/libs/gui/IProducerListener.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/IProducerListener.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/IProducerListener.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2014 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 - -#include - -namespace android { - -enum { - ON_BUFFER_RELEASED = IBinder::FIRST_CALL_TRANSACTION, -}; - -class BpProducerListener : public BpInterface -{ -public: - BpProducerListener(const sp& impl) - : BpInterface(impl) {} - - virtual ~BpProducerListener(); - - virtual void onBufferReleased() { - Parcel data, reply; - data.writeInterfaceToken(IProducerListener::getInterfaceDescriptor()); - remote()->transact(ON_BUFFER_RELEASED, data, &reply, IBinder::FLAG_ONEWAY); - } -}; - -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpProducerListener::~BpProducerListener() {} - -IMPLEMENT_META_INTERFACE(ProducerListener, "android.gui.IProducerListener") - -status_t BnProducerListener::onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags) { - switch (code) { - case ON_BUFFER_RELEASED: - CHECK_INTERFACE(IProducerListener, data, reply); - onBufferReleased(); - return NO_ERROR; - } - return BBinder::onTransact(code, data, reply, flags); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ISensorEventConnection.cpp android-platform-frameworks-native-21/libs/gui/ISensorEventConnection.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ISensorEventConnection.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ISensorEventConnection.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -33,8 +33,7 @@ enum { GET_SENSOR_CHANNEL = IBinder::FIRST_CALL_TRANSACTION, ENABLE_DISABLE, - SET_EVENT_RATE, - FLUSH_SENSOR + SET_EVENT_RATE }; class BpSensorEventConnection : public BpInterface @@ -45,8 +44,6 @@ { } - virtual ~BpSensorEventConnection(); - virtual sp getSensorChannel() const { Parcel data, reply; @@ -55,16 +52,12 @@ return new BitTube(reply); } - virtual status_t enableDisable(int handle, bool enabled, nsecs_t samplingPeriodNs, - nsecs_t maxBatchReportLatencyNs, int reservedFlags) + virtual status_t enableDisable(int handle, bool enabled) { Parcel data, reply; data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); data.writeInt32(handle); data.writeInt32(enabled); - data.writeInt64(samplingPeriodNs); - data.writeInt64(maxBatchReportLatencyNs); - data.writeInt32(reservedFlags); remote()->transact(ENABLE_DISABLE, data, &reply); return reply.readInt32(); } @@ -78,19 +71,8 @@ remote()->transact(SET_EVENT_RATE, data, &reply); return reply.readInt32(); } - - virtual status_t flush() { - Parcel data, reply; - data.writeInterfaceToken(ISensorEventConnection::getInterfaceDescriptor()); - remote()->transact(FLUSH_SENSOR, data, &reply); - return reply.readInt32(); - } }; -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpSensorEventConnection::~BpSensorEventConnection() {} - IMPLEMENT_META_INTERFACE(SensorEventConnection, "android.gui.SensorEventConnection"); // ---------------------------------------------------------------------------- @@ -104,33 +86,23 @@ sp channel(getSensorChannel()); channel->writeToParcel(reply); return NO_ERROR; - } + } break; case ENABLE_DISABLE: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); int enabled = data.readInt32(); - nsecs_t samplingPeriodNs = data.readInt64(); - nsecs_t maxBatchReportLatencyNs = data.readInt64(); - int reservedFlags = data.readInt32(); - status_t result = enableDisable(handle, enabled, samplingPeriodNs, - maxBatchReportLatencyNs, reservedFlags); + status_t result = enableDisable(handle, enabled); reply->writeInt32(result); return NO_ERROR; - } + } break; case SET_EVENT_RATE: { CHECK_INTERFACE(ISensorEventConnection, data, reply); int handle = data.readInt32(); - nsecs_t ns = data.readInt64(); + int ns = data.readInt64(); status_t result = setEventRate(handle, ns); reply->writeInt32(result); return NO_ERROR; - } - case FLUSH_SENSOR: { - CHECK_INTERFACE(ISensorEventConnection, data, reply); - status_t result = flush(); - reply->writeInt32(result); - return NO_ERROR; - } + } break; } return BBinder::onTransact(code, data, reply, flags); } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ISensorServer.cpp android-platform-frameworks-native-21/libs/gui/ISensorServer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ISensorServer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ISensorServer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -35,7 +35,6 @@ enum { GET_SENSOR_LIST = IBinder::FIRST_CALL_TRANSACTION, CREATE_SENSOR_EVENT_CONNECTION, - ENABLE_DATA_INJECTION }; class BpSensorServer : public BpInterface @@ -46,49 +45,31 @@ { } - virtual ~BpSensorServer(); - - virtual Vector getSensorList(const String16& opPackageName) + virtual Vector getSensorList() { Parcel data, reply; data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor()); - data.writeString16(opPackageName); remote()->transact(GET_SENSOR_LIST, data, &reply); Sensor s; Vector v; - uint32_t n = reply.readUint32(); + int32_t n = reply.readInt32(); v.setCapacity(n); while (n--) { - reply.read(s); + reply.read(static_cast(s)); v.add(s); } return v; } - virtual sp createSensorEventConnection(const String8& packageName, - int mode, const String16& opPackageName) + virtual sp createSensorEventConnection() { Parcel data, reply; data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor()); - data.writeString8(packageName); - data.writeInt32(mode); - data.writeString16(opPackageName); remote()->transact(CREATE_SENSOR_EVENT_CONNECTION, data, &reply); return interface_cast(reply.readStrongBinder()); } - - virtual int isDataInjectionEnabled() { - Parcel data, reply; - data.writeInterfaceToken(ISensorServer::getInterfaceDescriptor()); - remote()->transact(ENABLE_DATA_INJECTION, data, &reply); - return reply.readInt32(); - } }; -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpSensorServer::~BpSensorServer() {} - IMPLEMENT_META_INTERFACE(SensorServer, "android.gui.SensorServer"); // ---------------------------------------------------------------------- @@ -99,31 +80,20 @@ switch(code) { case GET_SENSOR_LIST: { CHECK_INTERFACE(ISensorServer, data, reply); - const String16& opPackageName = data.readString16(); - Vector v(getSensorList(opPackageName)); + Vector v(getSensorList()); size_t n = v.size(); - reply->writeUint32(static_cast(n)); - for (size_t i = 0; i < n; i++) { - reply->write(v[i]); + reply->writeInt32(n); + for (size_t i=0 ; iwrite(static_cast(v[i])); } return NO_ERROR; - } + } break; case CREATE_SENSOR_EVENT_CONNECTION: { CHECK_INTERFACE(ISensorServer, data, reply); - String8 packageName = data.readString8(); - int32_t mode = data.readInt32(); - const String16& opPackageName = data.readString16(); - sp connection(createSensorEventConnection(packageName, mode, - opPackageName)); - reply->writeStrongBinder(IInterface::asBinder(connection)); + sp connection(createSensorEventConnection()); + reply->writeStrongBinder(connection->asBinder()); return NO_ERROR; - } - case ENABLE_DATA_INJECTION: { - CHECK_INTERFACE(ISensorServer, data, reply); - int32_t ret = isDataInjectionEnabled(); - reply->writeInt32(static_cast(ret)); - return NO_ERROR; - } + } break; } return BBinder::onTransact(code, data, reply, flags); } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurfaceComposerClient.cpp android-platform-frameworks-native-21/libs/gui/ISurfaceComposerClient.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurfaceComposerClient.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ISurfaceComposerClient.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -29,7 +29,7 @@ #include #include -#include +#include #include #include @@ -39,67 +39,48 @@ enum { CREATE_SURFACE = IBinder::FIRST_CALL_TRANSACTION, - DESTROY_SURFACE, - CLEAR_LAYER_FRAME_STATS, - GET_LAYER_FRAME_STATS + DESTROY_SURFACE }; class BpSurfaceComposerClient : public BpInterface { public: BpSurfaceComposerClient(const sp& impl) - : BpInterface(impl) { + : BpInterface(impl) + { } - virtual ~BpSurfaceComposerClient(); - - virtual status_t createSurface(const String8& name, uint32_t width, - uint32_t height, PixelFormat format, uint32_t flags, - sp* handle, - sp* gbp) { + virtual sp createSurface( surface_data_t* params, + const String8& name, + DisplayID display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) + { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); data.writeString8(name); - data.writeUint32(width); - data.writeUint32(height); - data.writeInt32(static_cast(format)); - data.writeUint32(flags); + data.writeInt32(display); + data.writeInt32(w); + data.writeInt32(h); + data.writeInt32(format); + data.writeInt32(flags); remote()->transact(CREATE_SURFACE, data, &reply); - *handle = reply.readStrongBinder(); - *gbp = interface_cast(reply.readStrongBinder()); - return reply.readInt32(); + params->readFromParcel(reply); + return interface_cast(reply.readStrongBinder()); } - virtual status_t destroySurface(const sp& handle) { + virtual status_t destroySurface(SurfaceID sid) + { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); - data.writeStrongBinder(handle); + data.writeInt32(sid); remote()->transact(DESTROY_SURFACE, data, &reply); return reply.readInt32(); } - - virtual status_t clearLayerFrameStats(const sp& handle) const { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); - data.writeStrongBinder(handle); - remote()->transact(CLEAR_LAYER_FRAME_STATS, data, &reply); - return reply.readInt32(); - } - - virtual status_t getLayerFrameStats(const sp& handle, FrameStats* outStats) const { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposerClient::getInterfaceDescriptor()); - data.writeStrongBinder(handle); - remote()->transact(GET_LAYER_FRAME_STATS, data, &reply); - reply.read(*outStats); - return reply.readInt32(); - } }; -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpSurfaceComposerClient::~BpSurfaceComposerClient() {} - IMPLEMENT_META_INTERFACE(SurfaceComposerClient, "android.ui.ISurfaceComposerClient"); // ---------------------------------------------------------------------- @@ -110,44 +91,43 @@ switch(code) { case CREATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposerClient, data, reply); + surface_data_t params; String8 name = data.readString8(); - uint32_t width = data.readUint32(); - uint32_t height = data.readUint32(); - PixelFormat format = static_cast(data.readInt32()); - uint32_t createFlags = data.readUint32(); - sp handle; - sp gbp; - status_t result = createSurface(name, width, height, format, - createFlags, &handle, &gbp); - reply->writeStrongBinder(handle); - reply->writeStrongBinder(IInterface::asBinder(gbp)); - reply->writeInt32(result); + DisplayID display = data.readInt32(); + uint32_t w = data.readInt32(); + uint32_t h = data.readInt32(); + PixelFormat format = data.readInt32(); + uint32_t flags = data.readInt32(); + sp s = createSurface(¶ms, name, display, w, h, + format, flags); + params.writeToParcel(reply); + reply->writeStrongBinder(s->asBinder()); return NO_ERROR; - } + } break; case DESTROY_SURFACE: { CHECK_INTERFACE(ISurfaceComposerClient, data, reply); - reply->writeInt32(destroySurface( data.readStrongBinder() ) ); + reply->writeInt32( destroySurface( data.readInt32() ) ); return NO_ERROR; - } - case CLEAR_LAYER_FRAME_STATS: { - CHECK_INTERFACE(ISurfaceComposerClient, data, reply); - sp handle = data.readStrongBinder(); - status_t result = clearLayerFrameStats(handle); - reply->writeInt32(result); - return NO_ERROR; - } - case GET_LAYER_FRAME_STATS: { - CHECK_INTERFACE(ISurfaceComposerClient, data, reply); - sp handle = data.readStrongBinder(); - FrameStats stats; - status_t result = getLayerFrameStats(handle, &stats); - reply->write(stats); - reply->writeInt32(result); - return NO_ERROR; - } + } break; default: return BBinder::onTransact(code, data, reply, flags); } } +// ---------------------------------------------------------------------- + +status_t ISurfaceComposerClient::surface_data_t::readFromParcel(const Parcel& parcel) +{ + token = parcel.readInt32(); + identity = parcel.readInt32(); + return NO_ERROR; +} + +status_t ISurfaceComposerClient::surface_data_t::writeToParcel(Parcel* parcel) const +{ + parcel->writeInt32(token); + parcel->writeInt32(identity); + return NO_ERROR; +} + }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurfaceComposer.cpp android-platform-frameworks-native-21/libs/gui/ISurfaceComposer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurfaceComposer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ISurfaceComposer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -28,12 +28,11 @@ #include #include #include -#include +#include #include #include -#include #include @@ -51,10 +50,9 @@ { } - virtual ~BpSurfaceComposer(); - virtual sp createConnection() { + uint32_t n; Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); remote()->transact(BnSurfaceComposer::CREATE_CONNECTION, data, &reply); @@ -63,31 +61,34 @@ virtual sp createGraphicBufferAlloc() { + uint32_t n; Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); remote()->transact(BnSurfaceComposer::CREATE_GRAPHIC_BUFFER_ALLOC, data, &reply); return interface_cast(reply.readStrongBinder()); } - virtual void setTransactionState( - const Vector& state, - const Vector& displays, - uint32_t flags) + virtual sp getCblk() const { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + remote()->transact(BnSurfaceComposer::GET_CBLK, data, &reply); + return interface_cast(reply.readStrongBinder()); + } - data.writeUint32(static_cast(state.size())); - for (const auto& s : state) { - s.write(data); - } - - data.writeUint32(static_cast(displays.size())); - for (const auto& d : displays) { - d.write(data); + virtual void setTransactionState(const Vector& state, + int orientation, uint32_t flags) + { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + Vector::const_iterator b(state.begin()); + Vector::const_iterator e(state.end()); + data.writeInt32(state.size()); + for ( ; b != e ; ++b ) { + b->write(data); } - - data.writeUint32(flags); + data.writeInt32(orientation); + data.writeInt32(flags); remote()->transact(BnSurfaceComposer::SET_TRANSACTION_STATE, data, &reply); } @@ -98,30 +99,47 @@ remote()->transact(BnSurfaceComposer::BOOT_FINISHED, data, &reply); } - virtual status_t captureScreen(const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, - ISurfaceComposer::Rotation rotation) + virtual status_t captureScreen(DisplayID dpy, + sp* heap, + uint32_t* width, uint32_t* height, PixelFormat* format, + uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ) { Parcel data, reply; data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - data.writeStrongBinder(IInterface::asBinder(producer)); - data.write(sourceCrop); - data.writeUint32(reqWidth); - data.writeUint32(reqHeight); - data.writeUint32(minLayerZ); - data.writeUint32(maxLayerZ); - data.writeInt32(static_cast(useIdentityTransform)); - data.writeInt32(static_cast(rotation)); + data.writeInt32(dpy); + data.writeInt32(reqWidth); + data.writeInt32(reqHeight); + data.writeInt32(minLayerZ); + data.writeInt32(maxLayerZ); remote()->transact(BnSurfaceComposer::CAPTURE_SCREEN, data, &reply); + *heap = interface_cast(reply.readStrongBinder()); + *width = reply.readInt32(); + *height = reply.readInt32(); + *format = reply.readInt32(); + return reply.readInt32(); + } + + virtual status_t turnElectronBeamOff(int32_t mode) + { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeInt32(mode); + remote()->transact(BnSurfaceComposer::TURN_ELECTRON_BEAM_OFF, data, &reply); + return reply.readInt32(); + } + + virtual status_t turnElectronBeamOn(int32_t mode) + { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); + data.writeInt32(mode); + remote()->transact(BnSurfaceComposer::TURN_ELECTRON_BEAM_ON, data, &reply); return reply.readInt32(); } virtual bool authenticateSurfaceTexture( - const sp& bufferProducer) const + const sp& surfaceTexture) const { Parcel data, reply; int err = NO_ERROR; @@ -132,7 +150,7 @@ "interface descriptor: %s (%d)", strerror(-err), -err); return false; } - err = data.writeStrongBinder(IInterface::asBinder(bufferProducer)); + err = data.writeStrongBinder(surfaceTexture->asBinder()); if (err != NO_ERROR) { ALOGE("ISurfaceComposer::authenticateSurfaceTexture: error writing " "strong binder to parcel: %s (%d)", strerror(-err), -err); @@ -175,119 +193,8 @@ result = interface_cast(reply.readStrongBinder()); return result; } - - virtual sp createDisplay(const String8& displayName, bool secure) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeString8(displayName); - data.writeInt32(secure ? 1 : 0); - remote()->transact(BnSurfaceComposer::CREATE_DISPLAY, data, &reply); - return reply.readStrongBinder(); - } - - virtual void destroyDisplay(const sp& display) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - remote()->transact(BnSurfaceComposer::DESTROY_DISPLAY, data, &reply); - } - - virtual sp getBuiltInDisplay(int32_t id) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeInt32(id); - remote()->transact(BnSurfaceComposer::GET_BUILT_IN_DISPLAY, data, &reply); - return reply.readStrongBinder(); - } - - virtual void setPowerMode(const sp& display, int mode) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - data.writeInt32(mode); - remote()->transact(BnSurfaceComposer::SET_POWER_MODE, data, &reply); - } - - virtual status_t getDisplayConfigs(const sp& display, - Vector* configs) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - remote()->transact(BnSurfaceComposer::GET_DISPLAY_CONFIGS, data, &reply); - status_t result = reply.readInt32(); - if (result == NO_ERROR) { - size_t numConfigs = reply.readUint32(); - configs->clear(); - configs->resize(numConfigs); - for (size_t c = 0; c < numConfigs; ++c) { - memcpy(&(configs->editItemAt(c)), - reply.readInplace(sizeof(DisplayInfo)), - sizeof(DisplayInfo)); - } - } - return result; - } - - virtual status_t getDisplayStats(const sp& display, - DisplayStatInfo* stats) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - remote()->transact(BnSurfaceComposer::GET_DISPLAY_STATS, data, &reply); - status_t result = reply.readInt32(); - if (result == NO_ERROR) { - memcpy(stats, - reply.readInplace(sizeof(DisplayStatInfo)), - sizeof(DisplayStatInfo)); - } - return result; - } - - virtual int getActiveConfig(const sp& display) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - remote()->transact(BnSurfaceComposer::GET_ACTIVE_CONFIG, data, &reply); - return reply.readInt32(); - } - - virtual status_t setActiveConfig(const sp& display, int id) - { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - data.writeStrongBinder(display); - data.writeInt32(id); - remote()->transact(BnSurfaceComposer::SET_ACTIVE_CONFIG, data, &reply); - return reply.readInt32(); - } - - virtual status_t clearAnimationFrameStats() { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - remote()->transact(BnSurfaceComposer::CLEAR_ANIMATION_FRAME_STATS, data, &reply); - return reply.readInt32(); - } - - virtual status_t getAnimationFrameStats(FrameStats* outStats) const { - Parcel data, reply; - data.writeInterfaceToken(ISurfaceComposer::getInterfaceDescriptor()); - remote()->transact(BnSurfaceComposer::GET_ANIMATION_FRAME_STATS, data, &reply); - reply.read(*outStats); - return reply.readInt32(); - } }; -// Out-of-line virtual method definition to trigger vtable emission in this -// translation unit (see clang warning -Wweak-vtables) -BpSurfaceComposer::~BpSurfaceComposer() {} - IMPLEMENT_META_INTERFACE(SurfaceComposer, "android.ui.ISurfaceComposer"); // ---------------------------------------------------------------------- @@ -298,179 +205,84 @@ switch(code) { case CREATE_CONNECTION: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp b = IInterface::asBinder(createConnection()); + sp b = createConnection()->asBinder(); reply->writeStrongBinder(b); - return NO_ERROR; - } + } break; case CREATE_GRAPHIC_BUFFER_ALLOC: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp b = IInterface::asBinder(createGraphicBufferAlloc()); + sp b = createGraphicBufferAlloc()->asBinder(); reply->writeStrongBinder(b); - return NO_ERROR; - } + } break; case SET_TRANSACTION_STATE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - - size_t count = data.readUint32(); - if (count > data.dataSize()) { - return BAD_VALUE; - } + size_t count = data.readInt32(); ComposerState s; Vector state; state.setCapacity(count); - for (size_t i = 0; i < count; i++) { - if (s.read(data) == BAD_VALUE) { - return BAD_VALUE; - } + for (size_t i=0 ; i data.dataSize()) { - return BAD_VALUE; - } - DisplayState d; - Vector displays; - displays.setCapacity(count); - for (size_t i = 0; i < count; i++) { - if (d.read(data) == BAD_VALUE) { - return BAD_VALUE; - } - displays.add(d); - } - - uint32_t stateFlags = data.readUint32(); - setTransactionState(state, displays, stateFlags); - return NO_ERROR; - } + int orientation = data.readInt32(); + uint32_t flags = data.readInt32(); + setTransactionState(state, orientation, flags); + } break; case BOOT_FINISHED: { CHECK_INTERFACE(ISurfaceComposer, data, reply); bootFinished(); - return NO_ERROR; - } + } break; + case GET_CBLK: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + sp b = getCblk()->asBinder(); + reply->writeStrongBinder(b); + } break; case CAPTURE_SCREEN: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp display = data.readStrongBinder(); - sp producer = - interface_cast(data.readStrongBinder()); - Rect sourceCrop; - data.read(sourceCrop); - uint32_t reqWidth = data.readUint32(); - uint32_t reqHeight = data.readUint32(); - uint32_t minLayerZ = data.readUint32(); - uint32_t maxLayerZ = data.readUint32(); - bool useIdentityTransform = static_cast(data.readInt32()); - int32_t rotation = data.readInt32(); - - status_t res = captureScreen(display, producer, - sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, - useIdentityTransform, - static_cast(rotation)); + DisplayID dpy = data.readInt32(); + uint32_t reqWidth = data.readInt32(); + uint32_t reqHeight = data.readInt32(); + uint32_t minLayerZ = data.readInt32(); + uint32_t maxLayerZ = data.readInt32(); + sp heap; + uint32_t w, h; + PixelFormat f; + status_t res = captureScreen(dpy, &heap, &w, &h, &f, + reqWidth, reqHeight, minLayerZ, maxLayerZ); + reply->writeStrongBinder(heap->asBinder()); + reply->writeInt32(w); + reply->writeInt32(h); + reply->writeInt32(f); reply->writeInt32(res); - return NO_ERROR; - } + } break; + case TURN_ELECTRON_BEAM_OFF: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + int32_t mode = data.readInt32(); + status_t res = turnElectronBeamOff(mode); + reply->writeInt32(res); + } break; + case TURN_ELECTRON_BEAM_ON: { + CHECK_INTERFACE(ISurfaceComposer, data, reply); + int32_t mode = data.readInt32(); + status_t res = turnElectronBeamOn(mode); + reply->writeInt32(res); + } break; case AUTHENTICATE_SURFACE: { CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp bufferProducer = - interface_cast(data.readStrongBinder()); - int32_t result = authenticateSurfaceTexture(bufferProducer) ? 1 : 0; + sp surfaceTexture = + interface_cast(data.readStrongBinder()); + int32_t result = authenticateSurfaceTexture(surfaceTexture) ? 1 : 0; reply->writeInt32(result); - return NO_ERROR; - } + } break; case CREATE_DISPLAY_EVENT_CONNECTION: { CHECK_INTERFACE(ISurfaceComposer, data, reply); sp connection(createDisplayEventConnection()); - reply->writeStrongBinder(IInterface::asBinder(connection)); + reply->writeStrongBinder(connection->asBinder()); return NO_ERROR; - } - case CREATE_DISPLAY: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - String8 displayName = data.readString8(); - bool secure = bool(data.readInt32()); - sp display(createDisplay(displayName, secure)); - reply->writeStrongBinder(display); - return NO_ERROR; - } - case DESTROY_DISPLAY: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp display = data.readStrongBinder(); - destroyDisplay(display); - return NO_ERROR; - } - case GET_BUILT_IN_DISPLAY: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - int32_t id = data.readInt32(); - sp display(getBuiltInDisplay(id)); - reply->writeStrongBinder(display); - return NO_ERROR; - } - case GET_DISPLAY_CONFIGS: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - Vector configs; - sp display = data.readStrongBinder(); - status_t result = getDisplayConfigs(display, &configs); - reply->writeInt32(result); - if (result == NO_ERROR) { - reply->writeUint32(static_cast(configs.size())); - for (size_t c = 0; c < configs.size(); ++c) { - memcpy(reply->writeInplace(sizeof(DisplayInfo)), - &configs[c], sizeof(DisplayInfo)); - } - } - return NO_ERROR; - } - case GET_DISPLAY_STATS: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - DisplayStatInfo stats; - sp display = data.readStrongBinder(); - status_t result = getDisplayStats(display, &stats); - reply->writeInt32(result); - if (result == NO_ERROR) { - memcpy(reply->writeInplace(sizeof(DisplayStatInfo)), - &stats, sizeof(DisplayStatInfo)); - } - return NO_ERROR; - } - case GET_ACTIVE_CONFIG: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp display = data.readStrongBinder(); - int id = getActiveConfig(display); - reply->writeInt32(id); - return NO_ERROR; - } - case SET_ACTIVE_CONFIG: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp display = data.readStrongBinder(); - int id = data.readInt32(); - status_t result = setActiveConfig(display, id); - reply->writeInt32(result); - return NO_ERROR; - } - case CLEAR_ANIMATION_FRAME_STATS: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - status_t result = clearAnimationFrameStats(); - reply->writeInt32(result); - return NO_ERROR; - } - case GET_ANIMATION_FRAME_STATS: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - FrameStats stats; - status_t result = getAnimationFrameStats(&stats); - reply->write(stats); - reply->writeInt32(result); - return NO_ERROR; - } - case SET_POWER_MODE: { - CHECK_INTERFACE(ISurfaceComposer, data, reply); - sp display = data.readStrongBinder(); - int32_t mode = data.readInt32(); - setPowerMode(display, mode); - return NO_ERROR; - } - default: { + } break; + default: return BBinder::onTransact(code, data, reply, flags); - } } + return NO_ERROR; } // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurface.cpp android-platform-frameworks-native-21/libs/gui/ISurface.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurface.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ISurface.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2007 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. + */ + +#define LOG_TAG "ISurface" + +#include +#include +#include + +#include + +#include +#include + +namespace android { + +// ---------------------------------------------------------------------- + +class BpSurface : public BpInterface +{ +public: + BpSurface(const sp& impl) + : BpInterface(impl) + { + } + + virtual sp getSurfaceTexture() const { + Parcel data, reply; + data.writeInterfaceToken(ISurface::getInterfaceDescriptor()); + remote()->transact(GET_SURFACE_TEXTURE, data, &reply); + return interface_cast(reply.readStrongBinder()); + } +}; + +IMPLEMENT_META_INTERFACE(Surface, "android.ui.ISurface"); + +// ---------------------------------------------------------------------- + +status_t BnSurface::onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) +{ + switch(code) { + case GET_SURFACE_TEXTURE: { + CHECK_INTERFACE(ISurface, data, reply); + reply->writeStrongBinder( getSurfaceTexture()->asBinder() ); + return NO_ERROR; + } + default: + return BBinder::onTransact(code, data, reply, flags); + } +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurfaceTexture.cpp android-platform-frameworks-native-21/libs/gui/ISurfaceTexture.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/ISurfaceTexture.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/ISurfaceTexture.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,271 @@ +/* + * Copyright (C) 2010 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 +#include + +#include +#include +#include +#include + +#include +#include + +#include + +namespace android { +// ---------------------------------------------------------------------------- + +enum { + REQUEST_BUFFER = IBinder::FIRST_CALL_TRANSACTION, + SET_BUFFER_COUNT, + DEQUEUE_BUFFER, + QUEUE_BUFFER, + CANCEL_BUFFER, + QUERY, + SET_SYNCHRONOUS_MODE, + CONNECT, + DISCONNECT, +}; + + +class BpSurfaceTexture : public BpInterface +{ +public: + BpSurfaceTexture(const sp& impl) + : BpInterface(impl) + { + } + + virtual status_t requestBuffer(int bufferIdx, sp* buf) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(bufferIdx); + status_t result =remote()->transact(REQUEST_BUFFER, data, &reply); + if (result != NO_ERROR) { + return result; + } + bool nonNull = reply.readInt32(); + if (nonNull) { + *buf = new GraphicBuffer(); + reply.read(**buf); + } + result = reply.readInt32(); + return result; + } + + virtual status_t setBufferCount(int bufferCount) + { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(bufferCount); + status_t result =remote()->transact(SET_BUFFER_COUNT, data, &reply); + if (result != NO_ERROR) { + return result; + } + result = reply.readInt32(); + return result; + } + + virtual status_t dequeueBuffer(int *buf, uint32_t w, uint32_t h, + uint32_t format, uint32_t usage) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(w); + data.writeInt32(h); + data.writeInt32(format); + data.writeInt32(usage); + status_t result = remote()->transact(DEQUEUE_BUFFER, data, &reply); + if (result != NO_ERROR) { + return result; + } + *buf = reply.readInt32(); + result = reply.readInt32(); + return result; + } + + virtual status_t queueBuffer(int buf, + const QueueBufferInput& input, QueueBufferOutput* output) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(buf); + memcpy(data.writeInplace(sizeof(input)), &input, sizeof(input)); + status_t result = remote()->transact(QUEUE_BUFFER, data, &reply); + if (result != NO_ERROR) { + return result; + } + memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output)); + result = reply.readInt32(); + return result; + } + + virtual void cancelBuffer(int buf) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(buf); + remote()->transact(CANCEL_BUFFER, data, &reply); + } + + virtual int query(int what, int* value) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(what); + status_t result = remote()->transact(QUERY, data, &reply); + if (result != NO_ERROR) { + return result; + } + value[0] = reply.readInt32(); + result = reply.readInt32(); + return result; + } + + virtual status_t setSynchronousMode(bool enabled) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(enabled); + status_t result = remote()->transact(SET_SYNCHRONOUS_MODE, data, &reply); + if (result != NO_ERROR) { + return result; + } + result = reply.readInt32(); + return result; + } + + virtual status_t connect(int api, QueueBufferOutput* output) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(api); + status_t result = remote()->transact(CONNECT, data, &reply); + if (result != NO_ERROR) { + return result; + } + memcpy(output, reply.readInplace(sizeof(*output)), sizeof(*output)); + result = reply.readInt32(); + return result; + } + + virtual status_t disconnect(int api) { + Parcel data, reply; + data.writeInterfaceToken(ISurfaceTexture::getInterfaceDescriptor()); + data.writeInt32(api); + status_t result =remote()->transact(DISCONNECT, data, &reply); + if (result != NO_ERROR) { + return result; + } + result = reply.readInt32(); + return result; + } +}; + +IMPLEMENT_META_INTERFACE(SurfaceTexture, "android.gui.SurfaceTexture"); + +// ---------------------------------------------------------------------- + +status_t BnSurfaceTexture::onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) +{ + switch(code) { + case REQUEST_BUFFER: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int bufferIdx = data.readInt32(); + sp buffer; + int result = requestBuffer(bufferIdx, &buffer); + reply->writeInt32(buffer != 0); + if (buffer != 0) { + reply->write(*buffer); + } + reply->writeInt32(result); + return NO_ERROR; + } break; + case SET_BUFFER_COUNT: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int bufferCount = data.readInt32(); + int result = setBufferCount(bufferCount); + reply->writeInt32(result); + return NO_ERROR; + } break; + case DEQUEUE_BUFFER: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + uint32_t w = data.readInt32(); + uint32_t h = data.readInt32(); + uint32_t format = data.readInt32(); + uint32_t usage = data.readInt32(); + int buf; + int result = dequeueBuffer(&buf, w, h, format, usage); + reply->writeInt32(buf); + reply->writeInt32(result); + return NO_ERROR; + } break; + case QUEUE_BUFFER: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int buf = data.readInt32(); + QueueBufferInput const* const input = + reinterpret_cast( + data.readInplace(sizeof(QueueBufferInput))); + QueueBufferOutput* const output = + reinterpret_cast( + reply->writeInplace(sizeof(QueueBufferOutput))); + status_t result = queueBuffer(buf, *input, output); + reply->writeInt32(result); + return NO_ERROR; + } break; + case CANCEL_BUFFER: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int buf = data.readInt32(); + cancelBuffer(buf); + return NO_ERROR; + } break; + case QUERY: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int value; + int what = data.readInt32(); + int res = query(what, &value); + reply->writeInt32(value); + reply->writeInt32(res); + return NO_ERROR; + } break; + case SET_SYNCHRONOUS_MODE: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + bool enabled = data.readInt32(); + status_t res = setSynchronousMode(enabled); + reply->writeInt32(res); + return NO_ERROR; + } break; + case CONNECT: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int api = data.readInt32(); + QueueBufferOutput* const output = + reinterpret_cast( + reply->writeInplace(sizeof(QueueBufferOutput))); + status_t res = connect(api, output); + reply->writeInt32(res); + return NO_ERROR; + } break; + case DISCONNECT: { + CHECK_INTERFACE(ISurfaceTexture, data, reply); + int api = data.readInt32(); + status_t res = disconnect(api); + reply->writeInt32(res); + return NO_ERROR; + } break; + } + return BBinder::onTransact(code, data, reply, flags); +} + +// ---------------------------------------------------------------------------- + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/LayerState.cpp android-platform-frameworks-native-21/libs/gui/LayerState.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/LayerState.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/LayerState.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -17,57 +17,50 @@ #include #include #include -#include #include namespace android { status_t layer_state_t::write(Parcel& output) const { - output.writeStrongBinder(surface); - output.writeUint32(what); - output.writeFloat(x); - output.writeFloat(y); - output.writeUint32(z); - output.writeUint32(w); - output.writeUint32(h); - output.writeUint32(layerStack); - output.writeFloat(alpha); - output.writeUint32(flags); - output.writeUint32(mask); - *reinterpret_cast( - output.writeInplace(sizeof(layer_state_t::matrix22_t))) = matrix; - output.write(crop); - output.write(transparentRegion); - return NO_ERROR; + status_t err; + + size_t len = transparentRegion.write(NULL, 0); + err = output.writeInt32(len); + if (err < NO_ERROR) return err; + + void* buf = output.writeInplace(len); + if (buf == NULL) return NO_MEMORY; + + err = transparentRegion.write(buf, len); + if (err < NO_ERROR) return err; + + // NOTE: regions are at the end of the structure + size_t size = sizeof(layer_state_t); + size -= sizeof(transparentRegion); + err = output.write(this, size); + return err; } status_t layer_state_t::read(const Parcel& input) { - surface = input.readStrongBinder(); - what = input.readUint32(); - x = input.readFloat(); - y = input.readFloat(); - z = input.readUint32(); - w = input.readUint32(); - h = input.readUint32(); - layerStack = input.readUint32(); - alpha = input.readFloat(); - flags = static_cast(input.readUint32()); - mask = static_cast(input.readUint32()); - const void* matrix_data = input.readInplace(sizeof(layer_state_t::matrix22_t)); - if (matrix_data) { - matrix = *reinterpret_cast(matrix_data); - } else { - return BAD_VALUE; - } - input.read(crop); - input.read(transparentRegion); + status_t err; + size_t len = input.readInt32(); + void const* buf = input.readInplace(len); + if (buf == NULL) return NO_MEMORY; + + err = transparentRegion.read(buf); + if (err < NO_ERROR) return err; + + // NOTE: regions are at the end of the structure + size_t size = sizeof(layer_state_t); + size -= sizeof(transparentRegion); + input.read(this, size); return NO_ERROR; } status_t ComposerState::write(Parcel& output) const { - output.writeStrongBinder(IInterface::asBinder(client)); + output.writeStrongBinder(client->asBinder()); return state.write(output); } @@ -76,32 +69,4 @@ return state.read(input); } - -status_t DisplayState::write(Parcel& output) const { - output.writeStrongBinder(token); - output.writeStrongBinder(IInterface::asBinder(surface)); - output.writeUint32(what); - output.writeUint32(layerStack); - output.writeUint32(orientation); - output.write(viewport); - output.write(frame); - output.writeUint32(width); - output.writeUint32(height); - return NO_ERROR; -} - -status_t DisplayState::read(const Parcel& input) { - token = input.readStrongBinder(); - surface = interface_cast(input.readStrongBinder()); - what = input.readUint32(); - layerStack = input.readUint32(); - orientation = input.readUint32(); - input.read(viewport); - input.read(frame); - width = input.readUint32(); - height = input.readUint32(); - return NO_ERROR; -} - - }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/Sensor.cpp android-platform-frameworks-native-21/libs/gui/Sensor.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/Sensor.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/Sensor.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -14,10 +14,8 @@ * limitations under the License. */ -#include #include #include -#include #include #include @@ -25,11 +23,7 @@ #include -#include -#include - #include -#include // ---------------------------------------------------------------------------- namespace android { @@ -38,12 +32,11 @@ Sensor::Sensor() : mHandle(0), mType(0), mMinValue(0), mMaxValue(0), mResolution(0), - mPower(0), mMinDelay(0), mFifoReservedEventCount(0), mFifoMaxEventCount(0), - mMaxDelay(0), mFlags(0) + mPower(0), mMinDelay(0) { } -Sensor::Sensor(struct sensor_t const* hwSensor, int halVersion) +Sensor::Sensor(struct sensor_t const* hwSensor) { mName = hwSensor->name; mVendor = hwSensor->vendor; @@ -55,228 +48,6 @@ mResolution = hwSensor->resolution; mPower = hwSensor->power; mMinDelay = hwSensor->minDelay; - mFlags = 0; - - // Set fifo event count zero for older devices which do not support batching. Fused - // sensors also have their fifo counts set to zero. - if (halVersion > SENSORS_DEVICE_API_VERSION_1_0) { - mFifoReservedEventCount = hwSensor->fifoReservedEventCount; - mFifoMaxEventCount = hwSensor->fifoMaxEventCount; - } else { - mFifoReservedEventCount = 0; - mFifoMaxEventCount = 0; - } - - if (halVersion >= SENSORS_DEVICE_API_VERSION_1_3) { - if (hwSensor->maxDelay > INT_MAX) { - // Max delay is declared as a 64 bit integer for 64 bit architectures. But it should - // always fit in a 32 bit integer, log error and cap it to INT_MAX. - ALOGE("Sensor maxDelay overflow error %s %" PRId64, mName.string(), - static_cast(hwSensor->maxDelay)); - mMaxDelay = INT_MAX; - } else { - mMaxDelay = static_cast(hwSensor->maxDelay); - } - } else { - // For older hals set maxDelay to 0. - mMaxDelay = 0; - } - - // Ensure existing sensors have correct string type, required permissions and reporting mode. - // Set reportingMode for all android defined sensor types, set wake-up flag only for proximity - // sensor, significant motion, tilt, pick_up gesture, wake gesture and glance gesture on older - // HALs. Newer HALs can define both wake-up and non wake-up proximity sensors. - // All the OEM defined defined sensors have flags set to whatever is provided by the HAL. - switch (mType) { - case SENSOR_TYPE_ACCELEROMETER: - mStringType = SENSOR_STRING_TYPE_ACCELEROMETER; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_AMBIENT_TEMPERATURE: - mStringType = SENSOR_STRING_TYPE_AMBIENT_TEMPERATURE; - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - break; - case SENSOR_TYPE_GAME_ROTATION_VECTOR: - mStringType = SENSOR_STRING_TYPE_GAME_ROTATION_VECTOR; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: - mStringType = SENSOR_STRING_TYPE_GEOMAGNETIC_ROTATION_VECTOR; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_GRAVITY: - mStringType = SENSOR_STRING_TYPE_GRAVITY; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_GYROSCOPE: - mStringType = SENSOR_STRING_TYPE_GYROSCOPE; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED: - mStringType = SENSOR_STRING_TYPE_GYROSCOPE_UNCALIBRATED; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_HEART_RATE: { - mStringType = SENSOR_STRING_TYPE_HEART_RATE; - mRequiredPermission = SENSOR_PERMISSION_BODY_SENSORS; - AppOpsManager appOps; - mRequiredAppOp = appOps.permissionToOpCode(String16(SENSOR_PERMISSION_BODY_SENSORS)); - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - } break; - case SENSOR_TYPE_LIGHT: - mStringType = SENSOR_STRING_TYPE_LIGHT; - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - break; - case SENSOR_TYPE_LINEAR_ACCELERATION: - mStringType = SENSOR_STRING_TYPE_LINEAR_ACCELERATION; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_MAGNETIC_FIELD: - mStringType = SENSOR_STRING_TYPE_MAGNETIC_FIELD; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: - mStringType = SENSOR_STRING_TYPE_MAGNETIC_FIELD_UNCALIBRATED; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_ORIENTATION: - mStringType = SENSOR_STRING_TYPE_ORIENTATION; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_PRESSURE: - mStringType = SENSOR_STRING_TYPE_PRESSURE; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_PROXIMITY: - mStringType = SENSOR_STRING_TYPE_PROXIMITY; - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - case SENSOR_TYPE_RELATIVE_HUMIDITY: - mStringType = SENSOR_STRING_TYPE_RELATIVE_HUMIDITY; - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - break; - case SENSOR_TYPE_ROTATION_VECTOR: - mStringType = SENSOR_STRING_TYPE_ROTATION_VECTOR; - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - break; - case SENSOR_TYPE_SIGNIFICANT_MOTION: - mStringType = SENSOR_STRING_TYPE_SIGNIFICANT_MOTION; - mFlags |= SENSOR_FLAG_ONE_SHOT_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - case SENSOR_TYPE_STEP_COUNTER: - mStringType = SENSOR_STRING_TYPE_STEP_COUNTER; - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - break; - case SENSOR_TYPE_STEP_DETECTOR: - mStringType = SENSOR_STRING_TYPE_STEP_DETECTOR; - mFlags |= SENSOR_FLAG_SPECIAL_REPORTING_MODE; - break; - case SENSOR_TYPE_TEMPERATURE: - mStringType = SENSOR_STRING_TYPE_TEMPERATURE; - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - break; - case SENSOR_TYPE_TILT_DETECTOR: - mStringType = SENSOR_STRING_TYPE_TILT_DETECTOR; - mFlags |= SENSOR_FLAG_SPECIAL_REPORTING_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - case SENSOR_TYPE_WAKE_GESTURE: - mStringType = SENSOR_STRING_TYPE_WAKE_GESTURE; - mFlags |= SENSOR_FLAG_ONE_SHOT_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - case SENSOR_TYPE_GLANCE_GESTURE: - mStringType = SENSOR_STRING_TYPE_GLANCE_GESTURE; - mFlags |= SENSOR_FLAG_ONE_SHOT_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - case SENSOR_TYPE_PICK_UP_GESTURE: - mStringType = SENSOR_STRING_TYPE_PICK_UP_GESTURE; - mFlags |= SENSOR_FLAG_ONE_SHOT_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - case SENSOR_TYPE_WRIST_TILT_GESTURE: - mStringType = SENSOR_STRING_TYPE_WRIST_TILT_GESTURE; - mFlags |= SENSOR_FLAG_SPECIAL_REPORTING_MODE; - if (halVersion < SENSORS_DEVICE_API_VERSION_1_3) { - mFlags |= SENSOR_FLAG_WAKE_UP; - } - break; - default: - // Only pipe the stringType, requiredPermission and flags for custom sensors. - if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor->stringType) { - mStringType = hwSensor->stringType; - } - if (halVersion > SENSORS_DEVICE_API_VERSION_1_0 && hwSensor->requiredPermission) { - mRequiredPermission = hwSensor->requiredPermission; - if (!strcmp(mRequiredPermission, SENSOR_PERMISSION_BODY_SENSORS)) { - AppOpsManager appOps; - mRequiredAppOp = appOps.permissionToOpCode(String16(SENSOR_PERMISSION_BODY_SENSORS)); - } - } - - if (halVersion >= SENSORS_DEVICE_API_VERSION_1_3) { - mFlags = static_cast(hwSensor->flags); - } else { - // This is an OEM defined sensor on an older HAL. Use minDelay to determine the - // reporting mode of the sensor. - if (mMinDelay > 0) { - mFlags |= SENSOR_FLAG_CONTINUOUS_MODE; - } else if (mMinDelay == 0) { - mFlags |= SENSOR_FLAG_ON_CHANGE_MODE; - } else if (mMinDelay < 0) { - mFlags |= SENSOR_FLAG_ONE_SHOT_MODE; - } - } - break; - } - - // Set DATA_INJECTION flag here. Defined in HAL 1_4. - if (halVersion >= SENSORS_DEVICE_API_VERSION_1_4) { - mFlags |= (hwSensor->flags & DATA_INJECTION_MASK); - } - - // For the newer HALs log errors if reporting mask flags are set incorrectly. - if (halVersion >= SENSORS_DEVICE_API_VERSION_1_3) { - // Wake-up flag is set here. - mFlags |= (hwSensor->flags & SENSOR_FLAG_WAKE_UP); - if (mFlags != hwSensor->flags) { - int actualReportingMode = - (hwSensor->flags & REPORTING_MODE_MASK) >> REPORTING_MODE_SHIFT; - int expectedReportingMode = (mFlags & REPORTING_MODE_MASK) >> REPORTING_MODE_SHIFT; - if (actualReportingMode != expectedReportingMode) { - ALOGE("Reporting Mode incorrect: sensor %s handle=%d type=%d " - "actual=%d expected=%d", - mName.string(), mHandle, mType, actualReportingMode, expectedReportingMode); - } - - } - } - - if (mRequiredPermission.length() > 0) { - // If the sensor is protected by a permission we need to know if it is - // a runtime one to determine whether we can use the permission cache. - sp binder = defaultServiceManager()->getService(String16("permission")); - if (binder != 0) { - sp permCtrl = interface_cast(binder); - mRequiredPermissionRuntime = permCtrl->isRuntimePermission( - String16(mRequiredPermission)); - } - } } Sensor::~Sensor() @@ -327,150 +98,99 @@ return mVersion; } -uint32_t Sensor::getFifoReservedEventCount() const { - return mFifoReservedEventCount; +size_t Sensor::getFlattenedSize() const +{ + return sizeof(int32_t) + ((mName.length() + 3) & ~3) + + sizeof(int32_t) + ((mVendor.length() + 3) & ~3) + + sizeof(int32_t) * 3 + + sizeof(float) * 4 + + sizeof(int32_t); } -uint32_t Sensor::getFifoMaxEventCount() const { - return mFifoMaxEventCount; +size_t Sensor::getFdCount() const +{ + return 0; } -const String8& Sensor::getStringType() const { - return mStringType; +static inline +size_t write(void* buffer, size_t offset, const String8& value) { + memcpy(static_cast(buffer) + offset, value.string(), value.length()); + return (value.length() + 3) & ~3; } -const String8& Sensor::getRequiredPermission() const { - return mRequiredPermission; +static inline +size_t write(void* buffer, size_t offset, float value) { + *reinterpret_cast(static_cast(buffer) + offset) = value; + return sizeof(float); } -bool Sensor::isRequiredPermissionRuntime() const { - return mRequiredPermissionRuntime; +static inline +size_t write(void* buffer, size_t offset, int32_t value) { + *reinterpret_cast(static_cast(buffer) + offset) = value; + return sizeof(int32_t); } -int32_t Sensor::getRequiredAppOp() const { - return mRequiredAppOp; -} +status_t Sensor::flatten(void* buffer, size_t size, + int fds[], size_t count) const +{ + if (size < Sensor::getFlattenedSize()) + return -ENOMEM; -int32_t Sensor::getMaxDelay() const { - return mMaxDelay; -} + size_t offset = 0; + offset += write(buffer, offset, int32_t(mName.length())); + offset += write(buffer, offset, mName); + offset += write(buffer, offset, int32_t(mVendor.length())); + offset += write(buffer, offset, mVendor); + offset += write(buffer, offset, mVersion); + offset += write(buffer, offset, mHandle); + offset += write(buffer, offset, mType); + offset += write(buffer, offset, mMinValue); + offset += write(buffer, offset, mMaxValue); + offset += write(buffer, offset, mResolution); + offset += write(buffer, offset, mPower); + offset += write(buffer, offset, mMinDelay); -uint32_t Sensor::getFlags() const { - return mFlags; + return NO_ERROR; } -bool Sensor::isWakeUpSensor() const { - return mFlags & SENSOR_FLAG_WAKE_UP; +static inline +size_t read(void const* buffer, size_t offset, String8* value, int32_t len) { + value->setTo(static_cast(buffer) + offset, len); + return (len + 3) & ~3; } -int32_t Sensor::getReportingMode() const { - return ((mFlags & REPORTING_MODE_MASK) >> REPORTING_MODE_SHIFT); +static inline +size_t read(void const* buffer, size_t offset, float* value) { + *value = *reinterpret_cast(static_cast(buffer) + offset); + return sizeof(float); } -size_t Sensor::getFlattenedSize() const -{ - size_t fixedSize = - sizeof(int32_t) * 3 + - sizeof(float) * 4 + - sizeof(int32_t) * 6 + - sizeof(bool); - - size_t variableSize = - sizeof(uint32_t) + FlattenableUtils::align<4>(mName.length()) + - sizeof(uint32_t) + FlattenableUtils::align<4>(mVendor.length()) + - sizeof(uint32_t) + FlattenableUtils::align<4>(mStringType.length()) + - sizeof(uint32_t) + FlattenableUtils::align<4>(mRequiredPermission.length()); - - return fixedSize + variableSize; -} - -status_t Sensor::flatten(void* buffer, size_t size) const { - if (size < getFlattenedSize()) { - return NO_MEMORY; - } - - flattenString8(buffer, size, mName); - flattenString8(buffer, size, mVendor); - FlattenableUtils::write(buffer, size, mVersion); - FlattenableUtils::write(buffer, size, mHandle); - FlattenableUtils::write(buffer, size, mType); - FlattenableUtils::write(buffer, size, mMinValue); - FlattenableUtils::write(buffer, size, mMaxValue); - FlattenableUtils::write(buffer, size, mResolution); - FlattenableUtils::write(buffer, size, mPower); - FlattenableUtils::write(buffer, size, mMinDelay); - FlattenableUtils::write(buffer, size, mFifoReservedEventCount); - FlattenableUtils::write(buffer, size, mFifoMaxEventCount); - flattenString8(buffer, size, mStringType); - flattenString8(buffer, size, mRequiredPermission); - FlattenableUtils::write(buffer, size, mRequiredPermissionRuntime); - FlattenableUtils::write(buffer, size, mRequiredAppOp); - FlattenableUtils::write(buffer, size, mMaxDelay); - FlattenableUtils::write(buffer, size, mFlags); - return NO_ERROR; +static inline +size_t read(void const* buffer, size_t offset, int32_t* value) { + *value = *reinterpret_cast(static_cast(buffer) + offset); + return sizeof(int32_t); } -status_t Sensor::unflatten(void const* buffer, size_t size) { - if (!unflattenString8(buffer, size, mName)) { - return NO_MEMORY; - } - if (!unflattenString8(buffer, size, mVendor)) { - return NO_MEMORY; - } +status_t Sensor::unflatten(void const* buffer, size_t size, + int fds[], size_t count) +{ + int32_t len; + size_t offset = 0; + offset += read(buffer, offset, &len); + offset += read(buffer, offset, &mName, len); + offset += read(buffer, offset, &len); + offset += read(buffer, offset, &mVendor, len); + offset += read(buffer, offset, &mVersion); + offset += read(buffer, offset, &mHandle); + offset += read(buffer, offset, &mType); + offset += read(buffer, offset, &mMinValue); + offset += read(buffer, offset, &mMaxValue); + offset += read(buffer, offset, &mResolution); + offset += read(buffer, offset, &mPower); + offset += read(buffer, offset, &mMinDelay); - size_t fixedSize = - sizeof(int32_t) * 3 + - sizeof(float) * 4 + - sizeof(int32_t) * 5; - if (size < fixedSize) { - return NO_MEMORY; - } - - FlattenableUtils::read(buffer, size, mVersion); - FlattenableUtils::read(buffer, size, mHandle); - FlattenableUtils::read(buffer, size, mType); - FlattenableUtils::read(buffer, size, mMinValue); - FlattenableUtils::read(buffer, size, mMaxValue); - FlattenableUtils::read(buffer, size, mResolution); - FlattenableUtils::read(buffer, size, mPower); - FlattenableUtils::read(buffer, size, mMinDelay); - FlattenableUtils::read(buffer, size, mFifoReservedEventCount); - FlattenableUtils::read(buffer, size, mFifoMaxEventCount); - - if (!unflattenString8(buffer, size, mStringType)) { - return NO_MEMORY; - } - if (!unflattenString8(buffer, size, mRequiredPermission)) { - return NO_MEMORY; - } - FlattenableUtils::read(buffer, size, mRequiredPermissionRuntime); - FlattenableUtils::read(buffer, size, mRequiredAppOp); - FlattenableUtils::read(buffer, size, mMaxDelay); - FlattenableUtils::read(buffer, size, mFlags); return NO_ERROR; } -void Sensor::flattenString8(void*& buffer, size_t& size, - const String8& string8) { - uint32_t len = static_cast(string8.length()); - FlattenableUtils::write(buffer, size, len); - memcpy(static_cast(buffer), string8.string(), len); - FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len)); -} - -bool Sensor::unflattenString8(void const*& buffer, size_t& size, String8& outputString8) { - uint32_t len; - if (size < sizeof(len)) { - return false; - } - FlattenableUtils::read(buffer, size, len); - if (size < len) { - return false; - } - outputString8.setTo(static_cast(buffer), len); - FlattenableUtils::advance(buffer, size, FlattenableUtils::align<4>(len)); - return true; -} - // ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SensorEventQueue.cpp android-platform-frameworks-native-21/libs/gui/SensorEventQueue.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SensorEventQueue.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SensorEventQueue.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,11 +16,8 @@ #define LOG_TAG "Sensors" -#include #include #include -#include -#include #include #include @@ -33,20 +30,17 @@ #include -using std::min; - // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- SensorEventQueue::SensorEventQueue(const sp& connection) - : mSensorEventConnection(connection), mRecBuffer(NULL), mAvailable(0), mConsumed(0), - mNumAcksToSend(0) { - mRecBuffer = new ASensorEvent[MAX_RECEIVE_BUFFER_EVENT_COUNT]; + : mSensorEventConnection(connection) +{ } -SensorEventQueue::~SensorEventQueue() { - delete [] mRecBuffer; +SensorEventQueue::~SensorEventQueue() +{ } void SensorEventQueue::onFirstRef() @@ -65,21 +59,9 @@ return BitTube::sendObjects(tube, events, numEvents); } -ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents) { - if (mAvailable == 0) { - ssize_t err = BitTube::recvObjects(mSensorChannel, - mRecBuffer, MAX_RECEIVE_BUFFER_EVENT_COUNT); - if (err < 0) { - return err; - } - mAvailable = static_cast(err); - mConsumed = 0; - } - size_t count = min(numEvents, mAvailable); - memcpy(events, mRecBuffer + mConsumed, count * sizeof(ASensorEvent)); - mAvailable -= count; - mConsumed += count; - return static_cast(count); +ssize_t SensorEventQueue::read(ASensorEvent* events, size_t numEvents) +{ + return BitTube::recvObjects(mSensorChannel, events, numEvents); } sp SensorEventQueue::getLooper() const @@ -125,67 +107,29 @@ } status_t SensorEventQueue::enableSensor(Sensor const* sensor) const { - return mSensorEventConnection->enableDisable(sensor->getHandle(), true, 0, 0, false); + return mSensorEventConnection->enableDisable(sensor->getHandle(), true); } status_t SensorEventQueue::disableSensor(Sensor const* sensor) const { - return mSensorEventConnection->enableDisable(sensor->getHandle(), false, 0, 0, false); -} - -status_t SensorEventQueue::enableSensor(int32_t handle, int32_t samplingPeriodUs, - int maxBatchReportLatencyUs, int reservedFlags) const { - return mSensorEventConnection->enableDisable(handle, true, us2ns(samplingPeriodUs), - us2ns(maxBatchReportLatencyUs), reservedFlags); + return mSensorEventConnection->enableDisable(sensor->getHandle(), false); } -status_t SensorEventQueue::flush() const { - return mSensorEventConnection->flush(); +status_t SensorEventQueue::enableSensor(int32_t handle, int32_t us) const { + status_t err = mSensorEventConnection->enableDisable(handle, true); + if (err == NO_ERROR) { + mSensorEventConnection->setEventRate(handle, us2ns(us)); + } + return err; } status_t SensorEventQueue::disableSensor(int32_t handle) const { - return mSensorEventConnection->enableDisable(handle, false, 0, 0, false); + return mSensorEventConnection->enableDisable(handle, false); } status_t SensorEventQueue::setEventRate(Sensor const* sensor, nsecs_t ns) const { return mSensorEventConnection->setEventRate(sensor->getHandle(), ns); } -status_t SensorEventQueue::injectSensorEvent(const ASensorEvent& event) { - do { - // Blocking call. - ssize_t size = ::send(mSensorChannel->getFd(), &event, sizeof(event), MSG_NOSIGNAL); - if (size >= 0) { - return NO_ERROR; - } else if (size < 0 && errno == EAGAIN) { - // If send is returning a "Try again" error, sleep for 100ms and try again. In all - // other cases log a failure and exit. - usleep(100000); - } else { - ALOGE("injectSensorEvent failure %s %zd", strerror(errno), size); - return INVALID_OPERATION; - } - } while (true); -} - -void SensorEventQueue::sendAck(const ASensorEvent* events, int count) { - for (int i = 0; i < count; ++i) { - if (events[i].flags & WAKE_UP_SENSOR_EVENT_NEEDS_ACK) { - ++mNumAcksToSend; - } - } - // Send mNumAcksToSend to acknowledge for the wake up sensor events received. - if (mNumAcksToSend > 0) { - ssize_t size = ::send(mSensorChannel->getFd(), &mNumAcksToSend, sizeof(mNumAcksToSend), - MSG_DONTWAIT | MSG_NOSIGNAL); - if (size < 0) { - ALOGE("sendAck failure %zd %d", size, mNumAcksToSend); - } else { - mNumAcksToSend = 0; - } - } - return; -} - // ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SensorManager.cpp android-platform-frameworks-native-21/libs/gui/SensorManager.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SensorManager.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SensorManager.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -36,60 +36,10 @@ namespace android { // ---------------------------------------------------------------------------- -android::Mutex android::SensorManager::sLock; -std::map android::SensorManager::sPackageInstances; +ANDROID_SINGLETON_STATIC_INSTANCE(SensorManager) -SensorManager& SensorManager::getInstanceForPackage(const String16& packageName) { - Mutex::Autolock _l(sLock); - SensorManager* sensorManager; - std::map::iterator iterator = - sPackageInstances.find(packageName); - - if (iterator != sPackageInstances.end()) { - sensorManager = iterator->second; - } else { - String16 opPackageName = packageName; - - // It is possible that the calling code has no access to the package name. - // In this case we will get the packages for the calling UID and pick the - // first one for attributing the app op. This will work correctly for - // runtime permissions as for legacy apps we will toggle the app op for - // all packages in the UID. The caveat is that the operation may be attributed - // to the wrong package and stats based on app ops may be slightly off. - if (opPackageName.size() <= 0) { - sp binder = defaultServiceManager()->getService(String16("permission")); - if (binder != 0) { - const uid_t uid = IPCThreadState::self()->getCallingUid(); - Vector packages; - interface_cast(binder)->getPackagesForUid(uid, packages); - if (!packages.isEmpty()) { - opPackageName = packages[0]; - } else { - ALOGE("No packages for calling UID"); - } - } else { - ALOGE("Cannot get permission service"); - } - } - - sensorManager = new SensorManager(opPackageName); - - // If we had no package name, we looked it up from the UID and the sensor - // manager instance we created should also be mapped to the empty package - // name, to avoid looking up the packages for a UID and get the same result. - if (packageName.size() <= 0) { - sPackageInstances.insert(std::make_pair(String16(), sensorManager)); - } - - // Stash the per package sensor manager. - sPackageInstances.insert(std::make_pair(opPackageName, sensorManager)); - } - - return *sensorManager; -} - -SensorManager::SensorManager(const String16& opPackageName) - : mSensorList(0), mOpPackageName(opPackageName) +SensorManager::SensorManager() + : mSensorList(0) { // okay we're not locked here, but it's not needed during construction assertStateLocked(); @@ -110,23 +60,13 @@ } status_t SensorManager::assertStateLocked() const { - bool initSensorManager = false; if (mSensorServer == NULL) { - initSensorManager = true; - } else { - // Ping binder to check if sensorservice is alive. - status_t err = IInterface::asBinder(mSensorServer)->pingBinder(); - if (err != NO_ERROR) { - initSensorManager = true; - } - } - if (initSensorManager) { - // try for 300 seconds (60*5(getService() tries for 5 seconds)) before giving up ... + // try for one second const String16 name("sensorservice"); - for (int i = 0; i < 60; i++) { + for (int i=0 ; i<4 ; i++) { status_t err = getService(name, &mSensorServer); if (err == NAME_NOT_FOUND) { - sleep(1); + usleep(250000); continue; } if (err != NO_ERROR) { @@ -145,17 +85,12 @@ DeathObserver(SensorManager& mgr) : mSensorManger(mgr) { } }; - LOG_ALWAYS_FATAL_IF(mSensorServer.get() == NULL, "getService(SensorService) NULL"); - mDeathObserver = new DeathObserver(*const_cast(this)); - IInterface::asBinder(mSensorServer)->linkToDeath(mDeathObserver); + mSensorServer->asBinder()->linkToDeath(mDeathObserver); - mSensors = mSensorServer->getSensorList(mOpPackageName); + mSensors = mSensorServer->getSensorList(); size_t count = mSensors.size(); - mSensorList = - static_cast(malloc(count * sizeof(Sensor*))); - LOG_ALWAYS_FATAL_IF(mSensorList == NULL, "mSensorList NULL"); - + mSensorList = (Sensor const**)malloc(count * sizeof(Sensor*)); for (size_t i=0 ; i(err); + return ssize_t(err); } *list = mSensorList; - return static_cast(mSensors.size()); + return mSensors.size(); } Sensor const* SensorManager::getDefaultSensor(int type) { Mutex::Autolock _l(mLock); if (assertStateLocked() == NO_ERROR) { - bool wakeUpSensor = false; - // For the following sensor types, return a wake-up sensor. These types are by default - // defined as wake-up sensors. For the rest of the sensor types defined in sensors.h return - // a non_wake-up version. - if (type == SENSOR_TYPE_PROXIMITY || type == SENSOR_TYPE_SIGNIFICANT_MOTION || - type == SENSOR_TYPE_TILT_DETECTOR || type == SENSOR_TYPE_WAKE_GESTURE || - type == SENSOR_TYPE_GLANCE_GESTURE || type == SENSOR_TYPE_PICK_UP_GESTURE) { - wakeUpSensor = true; - } // For now we just return the first sensor of that type we find. // in the future it will make sense to let the SensorService make // that decision. for (size_t i=0 ; igetType() == type && - mSensorList[i]->isWakeUpSensor() == wakeUpSensor) { + if (mSensorList[i]->getType() == type) return mSensorList[i]; - } } } return NULL; } -sp SensorManager::createEventQueue(String8 packageName, int mode) { +sp SensorManager::createEventQueue() +{ sp queue; Mutex::Autolock _l(mLock); while (assertStateLocked() == NO_ERROR) { sp connection = - mSensorServer->createSensorEventConnection(packageName, mode, mOpPackageName); + mSensorServer->createSensorEventConnection(); if (connection == NULL) { - // SensorService just died or the app doesn't have required permissions. - ALOGE("createEventQueue: connection is NULL."); - return NULL; + // SensorService just died. + ALOGE("createEventQueue: connection is NULL. SensorService died."); + continue; } queue = new SensorEventQueue(connection); break; @@ -219,13 +146,5 @@ return queue; } -bool SensorManager::isDataInjectionEnabled() { - Mutex::Autolock _l(mLock); - if (assertStateLocked() == NO_ERROR) { - return mSensorServer->isDataInjectionEnabled(); - } - return false; -} - // ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/StreamSplitter.cpp android-platform-frameworks-native-21/libs/gui/StreamSplitter.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/StreamSplitter.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/StreamSplitter.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,286 +0,0 @@ -/* - * Copyright 2014 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 - -#define LOG_TAG "StreamSplitter" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#include -#include -#include -#include - -#include - -#include - -#include - -namespace android { - -status_t StreamSplitter::createSplitter( - const sp& inputQueue, - sp* outSplitter) { - if (inputQueue == NULL) { - ALOGE("createSplitter: inputQueue must not be NULL"); - return BAD_VALUE; - } - if (outSplitter == NULL) { - ALOGE("createSplitter: outSplitter must not be NULL"); - return BAD_VALUE; - } - - sp splitter(new StreamSplitter(inputQueue)); - status_t status = splitter->mInput->consumerConnect(splitter, false); - if (status == NO_ERROR) { - splitter->mInput->setConsumerName(String8("StreamSplitter")); - *outSplitter = splitter; - } - return status; -} - -StreamSplitter::StreamSplitter(const sp& inputQueue) - : mIsAbandoned(false), mMutex(), mReleaseCondition(), - mOutstandingBuffers(0), mInput(inputQueue), mOutputs(), mBuffers() {} - -StreamSplitter::~StreamSplitter() { - mInput->consumerDisconnect(); - Vector >::iterator output = mOutputs.begin(); - for (; output != mOutputs.end(); ++output) { - (*output)->disconnect(NATIVE_WINDOW_API_CPU); - } - - if (mBuffers.size() > 0) { - ALOGE("%zu buffers still being tracked", mBuffers.size()); - } -} - -status_t StreamSplitter::addOutput( - const sp& outputQueue) { - if (outputQueue == NULL) { - ALOGE("addOutput: outputQueue must not be NULL"); - return BAD_VALUE; - } - - Mutex::Autolock lock(mMutex); - - IGraphicBufferProducer::QueueBufferOutput queueBufferOutput; - sp listener(new OutputListener(this, outputQueue)); - IInterface::asBinder(outputQueue)->linkToDeath(listener); - status_t status = outputQueue->connect(listener, NATIVE_WINDOW_API_CPU, - /* producerControlledByApp */ false, &queueBufferOutput); - if (status != NO_ERROR) { - ALOGE("addOutput: failed to connect (%d)", status); - return status; - } - - mOutputs.push_back(outputQueue); - - return NO_ERROR; -} - -void StreamSplitter::setName(const String8 &name) { - Mutex::Autolock lock(mMutex); - mInput->setConsumerName(name); -} - -void StreamSplitter::onFrameAvailable(const BufferItem& /* item */) { - ATRACE_CALL(); - Mutex::Autolock lock(mMutex); - - // The current policy is that if any one consumer is consuming buffers too - // slowly, the splitter will stall the rest of the outputs by not acquiring - // any more buffers from the input. This will cause back pressure on the - // input queue, slowing down its producer. - - // If there are too many outstanding buffers, we block until a buffer is - // released back to the input in onBufferReleased - while (mOutstandingBuffers >= MAX_OUTSTANDING_BUFFERS) { - mReleaseCondition.wait(mMutex); - - // If the splitter is abandoned while we are waiting, the release - // condition variable will be broadcast, and we should just return - // without attempting to do anything more (since the input queue will - // also be abandoned). - if (mIsAbandoned) { - return; - } - } - ++mOutstandingBuffers; - - // Acquire and detach the buffer from the input - BufferItem bufferItem; - status_t status = mInput->acquireBuffer(&bufferItem, /* presentWhen */ 0); - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "acquiring buffer from input failed (%d)", status); - - ALOGV("acquired buffer %#" PRIx64 " from input", - bufferItem.mGraphicBuffer->getId()); - - status = mInput->detachBuffer(bufferItem.mBuf); - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "detaching buffer from input failed (%d)", status); - - // Initialize our reference count for this buffer - mBuffers.add(bufferItem.mGraphicBuffer->getId(), - new BufferTracker(bufferItem.mGraphicBuffer)); - - IGraphicBufferProducer::QueueBufferInput queueInput( - bufferItem.mTimestamp, bufferItem.mIsAutoTimestamp, - bufferItem.mDataSpace, bufferItem.mCrop, - static_cast(bufferItem.mScalingMode), - bufferItem.mTransform, bufferItem.mIsDroppable, - bufferItem.mFence); - - // Attach and queue the buffer to each of the outputs - Vector >::iterator output = mOutputs.begin(); - for (; output != mOutputs.end(); ++output) { - int slot; - status = (*output)->attachBuffer(&slot, bufferItem.mGraphicBuffer); - if (status == NO_INIT) { - // If we just discovered that this output has been abandoned, note - // that, increment the release count so that we still release this - // buffer eventually, and move on to the next output - onAbandonedLocked(); - mBuffers.editValueFor(bufferItem.mGraphicBuffer->getId())-> - incrementReleaseCountLocked(); - continue; - } else { - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "attaching buffer to output failed (%d)", status); - } - - IGraphicBufferProducer::QueueBufferOutput queueOutput; - status = (*output)->queueBuffer(slot, queueInput, &queueOutput); - if (status == NO_INIT) { - // If we just discovered that this output has been abandoned, note - // that, increment the release count so that we still release this - // buffer eventually, and move on to the next output - onAbandonedLocked(); - mBuffers.editValueFor(bufferItem.mGraphicBuffer->getId())-> - incrementReleaseCountLocked(); - continue; - } else { - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "queueing buffer to output failed (%d)", status); - } - - ALOGV("queued buffer %#" PRIx64 " to output %p", - bufferItem.mGraphicBuffer->getId(), output->get()); - } -} - -void StreamSplitter::onBufferReleasedByOutput( - const sp& from) { - ATRACE_CALL(); - Mutex::Autolock lock(mMutex); - - sp buffer; - sp fence; - status_t status = from->detachNextBuffer(&buffer, &fence); - if (status == NO_INIT) { - // If we just discovered that this output has been abandoned, note that, - // but we can't do anything else, since buffer is invalid - onAbandonedLocked(); - return; - } else { - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "detaching buffer from output failed (%d)", status); - } - - ALOGV("detached buffer %#" PRIx64 " from output %p", - buffer->getId(), from.get()); - - const sp& tracker = mBuffers.editValueFor(buffer->getId()); - - // Merge the release fence of the incoming buffer so that the fence we send - // back to the input includes all of the outputs' fences - tracker->mergeFence(fence); - - // Check to see if this is the last outstanding reference to this buffer - size_t releaseCount = tracker->incrementReleaseCountLocked(); - ALOGV("buffer %#" PRIx64 " reference count %zu (of %zu)", buffer->getId(), - releaseCount, mOutputs.size()); - if (releaseCount < mOutputs.size()) { - return; - } - - // If we've been abandoned, we can't return the buffer to the input, so just - // stop tracking it and move on - if (mIsAbandoned) { - mBuffers.removeItem(buffer->getId()); - return; - } - - // Attach and release the buffer back to the input - int consumerSlot; - status = mInput->attachBuffer(&consumerSlot, tracker->getBuffer()); - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "attaching buffer to input failed (%d)", status); - - status = mInput->releaseBuffer(consumerSlot, /* frameNumber */ 0, - EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, tracker->getMergedFence()); - LOG_ALWAYS_FATAL_IF(status != NO_ERROR, - "releasing buffer to input failed (%d)", status); - - ALOGV("released buffer %#" PRIx64 " to input", buffer->getId()); - - // We no longer need to track the buffer once it has been returned to the - // input - mBuffers.removeItem(buffer->getId()); - - // Notify any waiting onFrameAvailable calls - --mOutstandingBuffers; - mReleaseCondition.signal(); -} - -void StreamSplitter::onAbandonedLocked() { - ALOGE("one of my outputs has abandoned me"); - if (!mIsAbandoned) { - mInput->consumerDisconnect(); - } - mIsAbandoned = true; - mReleaseCondition.broadcast(); -} - -StreamSplitter::OutputListener::OutputListener( - const sp& splitter, - const sp& output) - : mSplitter(splitter), mOutput(output) {} - -StreamSplitter::OutputListener::~OutputListener() {} - -void StreamSplitter::OutputListener::onBufferReleased() { - mSplitter->onBufferReleasedByOutput(mOutput); -} - -void StreamSplitter::OutputListener::binderDied(const wp& /* who */) { - Mutex::Autolock lock(mSplitter->mMutex); - mSplitter->onAbandonedLocked(); -} - -StreamSplitter::BufferTracker::BufferTracker(const sp& buffer) - : mBuffer(buffer), mMergedFence(Fence::NO_FENCE), mReleaseCount(0) {} - -StreamSplitter::BufferTracker::~BufferTracker() {} - -void StreamSplitter::BufferTracker::mergeFence(const sp& with) { - mMergedFence = Fence::merge(String8("StreamSplitter"), mMergedFence, with); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceComposerClient.cpp android-platform-frameworks-native-21/libs/gui/SurfaceComposerClient.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceComposerClient.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SurfaceComposerClient.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -31,14 +31,14 @@ #include -#include -#include +#include #include #include #include #include #include +#include namespace android { // --------------------------------------------------------------------------- @@ -47,55 +47,37 @@ ComposerService::ComposerService() : Singleton() { - Mutex::Autolock _l(mLock); - connectLocked(); -} - -void ComposerService::connectLocked() { const String16 name("SurfaceFlinger"); while (getService(name, &mComposerService) != NO_ERROR) { usleep(250000); } - assert(mComposerService != NULL); + mServerCblkMemory = mComposerService->getCblk(); + mServerCblk = static_cast( + mServerCblkMemory->getBase()); +} - // Create the death listener. - class DeathObserver : public IBinder::DeathRecipient { - ComposerService& mComposerService; - virtual void binderDied(const wp& who) { - ALOGW("ComposerService remote (surfaceflinger) died [%p]", - who.unsafe_get()); - mComposerService.composerServiceDied(); - } - public: - DeathObserver(ComposerService& mgr) : mComposerService(mgr) { } - }; - - mDeathObserver = new DeathObserver(*const_cast(this)); - IInterface::asBinder(mComposerService)->linkToDeath(mDeathObserver); +sp ComposerService::getComposerService() { + return ComposerService::getInstance().mComposerService; } -/*static*/ sp ComposerService::getComposerService() { - ComposerService& instance = ComposerService::getInstance(); - Mutex::Autolock _l(instance.mLock); - if (instance.mComposerService == NULL) { - ComposerService::getInstance().connectLocked(); - assert(instance.mComposerService != NULL); - ALOGD("ComposerService reconnected"); - } - return instance.mComposerService; +surface_flinger_cblk_t const volatile * ComposerService::getControlBlock() { + return ComposerService::getInstance().mServerCblk; } -void ComposerService::composerServiceDied() -{ - Mutex::Autolock _l(mLock); - mComposerService = NULL; - mDeathObserver = NULL; +static inline sp getComposerService() { + return ComposerService::getComposerService(); +} + +static inline surface_flinger_cblk_t const volatile * get_cblk() { + return ComposerService::getControlBlock(); } // --------------------------------------------------------------------------- +// NOTE: this is NOT a member function (it's a friend defined with its +// declaration). static inline -int compare_type(const ComposerState& lhs, const ComposerState& rhs) { +int compare_type( const ComposerState& lhs, const ComposerState& rhs) { if (lhs.client < rhs.client) return -1; if (lhs.client > rhs.client) return 1; if (lhs.state.surface < rhs.state.surface) return -1; @@ -103,78 +85,48 @@ return 0; } -static inline -int compare_type(const DisplayState& lhs, const DisplayState& rhs) { - return compare_type(lhs.token, rhs.token); -} - class Composer : public Singleton { friend class Singleton; mutable Mutex mLock; - SortedVector mComposerStates; - SortedVector mDisplayStates; + SortedVector mStates; + int mOrientation; uint32_t mForceSynchronous; - uint32_t mTransactionNestCount; - bool mAnimation; Composer() : Singleton(), - mForceSynchronous(0), mTransactionNestCount(0), - mAnimation(false) + mOrientation(ISurfaceComposer::eOrientationUnchanged), + mForceSynchronous(0) { } - void openGlobalTransactionImpl(); void closeGlobalTransactionImpl(bool synchronous); - void setAnimationTransactionImpl(); layer_state_t* getLayerStateLocked( - const sp& client, const sp& id); - - DisplayState& getDisplayStateLocked(const sp& token); + const sp& client, SurfaceID id); public: - sp createDisplay(const String8& displayName, bool secure); - void destroyDisplay(const sp& display); - sp getBuiltInDisplay(int32_t id); - status_t setPosition(const sp& client, const sp& id, + status_t setPosition(const sp& client, SurfaceID id, float x, float y); - status_t setSize(const sp& client, const sp& id, + status_t setSize(const sp& client, SurfaceID id, uint32_t w, uint32_t h); - status_t setLayer(const sp& client, const sp& id, - uint32_t z); - status_t setFlags(const sp& client, const sp& id, + status_t setLayer(const sp& client, SurfaceID id, + int32_t z); + status_t setFlags(const sp& client, SurfaceID id, uint32_t flags, uint32_t mask); status_t setTransparentRegionHint( - const sp& client, const sp& id, + const sp& client, SurfaceID id, const Region& transparentRegion); - status_t setAlpha(const sp& client, const sp& id, + status_t setAlpha(const sp& client, SurfaceID id, float alpha); - status_t setMatrix(const sp& client, const sp& id, + status_t setMatrix(const sp& client, SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy); + status_t setFreezeTint( + const sp& client, SurfaceID id, + uint32_t tint); status_t setOrientation(int orientation); - status_t setCrop(const sp& client, const sp& id, + status_t setCrop(const sp& client, SurfaceID id, const Rect& crop); - status_t setLayerStack(const sp& client, - const sp& id, uint32_t layerStack); - - void setDisplaySurface(const sp& token, - const sp& bufferProducer); - void setDisplayLayerStack(const sp& token, uint32_t layerStack); - void setDisplayProjection(const sp& token, - uint32_t orientation, - const Rect& layerStackRect, - const Rect& displayRect); - void setDisplaySize(const sp& token, uint32_t width, uint32_t height); - - static void setAnimationTransaction() { - Composer::getInstance().setAnimationTransactionImpl(); - } - - static void openGlobalTransaction() { - Composer::getInstance().openGlobalTransactionImpl(); - } static void closeGlobalTransaction(bool synchronous) { Composer::getInstance().closeGlobalTransactionImpl(synchronous); @@ -185,104 +137,66 @@ // --------------------------------------------------------------------------- -sp Composer::createDisplay(const String8& displayName, bool secure) { - return ComposerService::getComposerService()->createDisplay(displayName, - secure); -} - -void Composer::destroyDisplay(const sp& display) { - return ComposerService::getComposerService()->destroyDisplay(display); -} - -sp Composer::getBuiltInDisplay(int32_t id) { - return ComposerService::getComposerService()->getBuiltInDisplay(id); -} - -void Composer::openGlobalTransactionImpl() { - { // scope for the lock - Mutex::Autolock _l(mLock); - mTransactionNestCount += 1; - } -} - void Composer::closeGlobalTransactionImpl(bool synchronous) { - sp sm(ComposerService::getComposerService()); + sp sm(getComposerService()); Vector transaction; - Vector displayTransaction; + int orientation; uint32_t flags = 0; { // scope for the lock Mutex::Autolock _l(mLock); - mForceSynchronous |= synchronous; - if (!mTransactionNestCount) { - ALOGW("At least one call to closeGlobalTransaction() was not matched by a prior " - "call to openGlobalTransaction()."); - } else if (--mTransactionNestCount) { - return; - } + transaction = mStates; + mStates.clear(); - transaction = mComposerStates; - mComposerStates.clear(); + orientation = mOrientation; + mOrientation = ISurfaceComposer::eOrientationUnchanged; - displayTransaction = mDisplayStates; - mDisplayStates.clear(); - - if (mForceSynchronous) { + if (synchronous || mForceSynchronous) { flags |= ISurfaceComposer::eSynchronous; } - if (mAnimation) { - flags |= ISurfaceComposer::eAnimation; - } - mForceSynchronous = false; - mAnimation = false; } - sm->setTransactionState(transaction, displayTransaction, flags); -} - -void Composer::setAnimationTransactionImpl() { - Mutex::Autolock _l(mLock); - mAnimation = true; + sm->setTransactionState(transaction, orientation, flags); } layer_state_t* Composer::getLayerStateLocked( - const sp& client, const sp& id) { + const sp& client, SurfaceID id) { ComposerState s; s.client = client->mClient; s.state.surface = id; - ssize_t index = mComposerStates.indexOf(s); + ssize_t index = mStates.indexOf(s); if (index < 0) { // we don't have it, add an initialized layer_state to our list - index = mComposerStates.add(s); + index = mStates.add(s); } - ComposerState* const out = mComposerStates.editArray(); + ComposerState* const out = mStates.editArray(); return &(out[index].state); } status_t Composer::setPosition(const sp& client, - const sp& id, float x, float y) { + SurfaceID id, float x, float y) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::ePositionChanged; + s->what |= ISurfaceComposer::ePositionChanged; s->x = x; s->y = y; return NO_ERROR; } status_t Composer::setSize(const sp& client, - const sp& id, uint32_t w, uint32_t h) { + SurfaceID id, uint32_t w, uint32_t h) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::eSizeChanged; + s->what |= ISurfaceComposer::eSizeChanged; s->w = w; s->h = h; @@ -293,28 +207,24 @@ } status_t Composer::setLayer(const sp& client, - const sp& id, uint32_t z) { + SurfaceID id, int32_t z) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::eLayerChanged; + s->what |= ISurfaceComposer::eLayerChanged; s->z = z; return NO_ERROR; } status_t Composer::setFlags(const sp& client, - const sp& id, uint32_t flags, + SurfaceID id, uint32_t flags, uint32_t mask) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - if (mask & layer_state_t::eLayerOpaque || - mask & layer_state_t::eLayerHidden || - mask & layer_state_t::eLayerSecure) { - s->what |= layer_state_t::eFlagsChanged; - } + s->what |= ISurfaceComposer::eVisibilityChanged; s->flags &= ~mask; s->flags |= (flags & mask); s->mask |= mask; @@ -322,47 +232,36 @@ } status_t Composer::setTransparentRegionHint( - const sp& client, const sp& id, + const sp& client, SurfaceID id, const Region& transparentRegion) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::eTransparentRegionChanged; + s->what |= ISurfaceComposer::eTransparentRegionChanged; s->transparentRegion = transparentRegion; return NO_ERROR; } status_t Composer::setAlpha(const sp& client, - const sp& id, float alpha) { + SurfaceID id, float alpha) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::eAlphaChanged; + s->what |= ISurfaceComposer::eAlphaChanged; s->alpha = alpha; return NO_ERROR; } -status_t Composer::setLayerStack(const sp& client, - const sp& id, uint32_t layerStack) { - Mutex::Autolock _l(mLock); - layer_state_t* s = getLayerStateLocked(client, id); - if (!s) - return BAD_INDEX; - s->what |= layer_state_t::eLayerStackChanged; - s->layerStack = layerStack; - return NO_ERROR; -} - status_t Composer::setMatrix(const sp& client, - const sp& id, float dsdx, float dtdx, + SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::eMatrixChanged; + s->what |= ISurfaceComposer::eMatrixChanged; layer_state_t::matrix22_t matrix; matrix.dsdx = dsdx; matrix.dtdx = dtdx; @@ -372,66 +271,36 @@ return NO_ERROR; } -status_t Composer::setCrop(const sp& client, - const sp& id, const Rect& crop) { +status_t Composer::setFreezeTint(const sp& client, + SurfaceID id, uint32_t tint) { Mutex::Autolock _l(mLock); layer_state_t* s = getLayerStateLocked(client, id); if (!s) return BAD_INDEX; - s->what |= layer_state_t::eCropChanged; - s->crop = crop; + s->what |= ISurfaceComposer::eFreezeTintChanged; + s->tint = tint; return NO_ERROR; } -// --------------------------------------------------------------------------- - -DisplayState& Composer::getDisplayStateLocked(const sp& token) { - DisplayState s; - s.token = token; - ssize_t index = mDisplayStates.indexOf(s); - if (index < 0) { - // we don't have it, add an initialized layer_state to our list - s.what = 0; - index = mDisplayStates.add(s); - } - return mDisplayStates.editItemAt(static_cast(index)); -} - -void Composer::setDisplaySurface(const sp& token, - const sp& bufferProducer) { +status_t Composer::setOrientation(int orientation) { Mutex::Autolock _l(mLock); - DisplayState& s(getDisplayStateLocked(token)); - s.surface = bufferProducer; - s.what |= DisplayState::eSurfaceChanged; -} + mOrientation = orientation; -void Composer::setDisplayLayerStack(const sp& token, - uint32_t layerStack) { - Mutex::Autolock _l(mLock); - DisplayState& s(getDisplayStateLocked(token)); - s.layerStack = layerStack; - s.what |= DisplayState::eLayerStackChanged; -} + // Changing the orientation makes the transaction synchronous. + mForceSynchronous = true; -void Composer::setDisplayProjection(const sp& token, - uint32_t orientation, - const Rect& layerStackRect, - const Rect& displayRect) { - Mutex::Autolock _l(mLock); - DisplayState& s(getDisplayStateLocked(token)); - s.orientation = orientation; - s.viewport = layerStackRect; - s.frame = displayRect; - s.what |= DisplayState::eDisplayProjectionChanged; - mForceSynchronous = true; // TODO: do we actually still need this? + return NO_ERROR; } -void Composer::setDisplaySize(const sp& token, uint32_t width, uint32_t height) { +status_t Composer::setCrop(const sp& client, + SurfaceID id, const Rect& crop) { Mutex::Autolock _l(mLock); - DisplayState& s(getDisplayStateLocked(token)); - s.width = width; - s.height = height; - s.what |= DisplayState::eDisplaySizeChanged; + layer_state_t* s = getLayerStateLocked(client, id); + if (!s) + return BAD_INDEX; + s->what |= ISurfaceComposer::eCropChanged; + s->crop = crop; + return NO_ERROR; } // --------------------------------------------------------------------------- @@ -442,7 +311,7 @@ } void SurfaceComposerClient::onFirstRef() { - sp sm(ComposerService::getComposerService()); + sp sm(getComposerService()); if (sm != 0) { sp conn = sm->createConnection(); if (conn != 0) { @@ -461,14 +330,14 @@ } sp SurfaceComposerClient::connection() const { - return IInterface::asBinder(mClient); + return (mClient != 0) ? mClient->asBinder() : 0; } status_t SurfaceComposerClient::linkToComposerDeath( const sp& recipient, void* cookie, uint32_t flags) { - sp sm(ComposerService::getComposerService()); - return IInterface::asBinder(sm)->linkToDeath(recipient, cookie, flags); + sp sm(getComposerService()); + return sm->asBinder()->linkToDeath(recipient, cookie, flags); } void SurfaceComposerClient::dispose() { @@ -483,61 +352,49 @@ } sp SurfaceComposerClient::createSurface( + DisplayID display, + uint32_t w, + uint32_t h, + PixelFormat format, + uint32_t flags) +{ + String8 name; + const size_t SIZE = 128; + char buffer[SIZE]; + snprintf(buffer, SIZE, "", getpid()); + name.append(buffer); + + return SurfaceComposerClient::createSurface(name, display, + w, h, format, flags); +} + +sp SurfaceComposerClient::createSurface( const String8& name, + DisplayID display, uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { - sp sur; + sp result; if (mStatus == NO_ERROR) { - sp handle; - sp gbp; - status_t err = mClient->createSurface(name, w, h, format, flags, - &handle, &gbp); - ALOGE_IF(err, "SurfaceComposerClient::createSurface error %s", strerror(-err)); - if (err == NO_ERROR) { - sur = new SurfaceControl(this, handle, gbp); + ISurfaceComposerClient::surface_data_t data; + sp surface = mClient->createSurface(&data, name, + display, w, h, format, flags); + if (surface != 0) { + result = new SurfaceControl(this, surface, data); } } - return sur; -} - -sp SurfaceComposerClient::createDisplay(const String8& displayName, - bool secure) { - return Composer::getInstance().createDisplay(displayName, secure); -} - -void SurfaceComposerClient::destroyDisplay(const sp& display) { - Composer::getInstance().destroyDisplay(display); + return result; } -sp SurfaceComposerClient::getBuiltInDisplay(int32_t id) { - return Composer::getInstance().getBuiltInDisplay(id); -} - -status_t SurfaceComposerClient::destroySurface(const sp& sid) { +status_t SurfaceComposerClient::destroySurface(SurfaceID sid) { if (mStatus != NO_ERROR) return mStatus; status_t err = mClient->destroySurface(sid); return err; } -status_t SurfaceComposerClient::clearLayerFrameStats(const sp& token) const { - if (mStatus != NO_ERROR) { - return mStatus; - } - return mClient->clearLayerFrameStats(token); -} - -status_t SurfaceComposerClient::getLayerFrameStats(const sp& token, - FrameStats* outStats) const { - if (mStatus != NO_ERROR) { - return mStatus; - } - return mClient->getLayerFrameStats(token, outStats); -} - inline Composer& SurfaceComposerClient::getComposer() { return mComposer; } @@ -545,253 +402,218 @@ // ---------------------------------------------------------------------------- void SurfaceComposerClient::openGlobalTransaction() { - Composer::openGlobalTransaction(); + // Currently a no-op } void SurfaceComposerClient::closeGlobalTransaction(bool synchronous) { Composer::closeGlobalTransaction(synchronous); } -void SurfaceComposerClient::setAnimationTransaction() { - Composer::setAnimationTransaction(); -} - // ---------------------------------------------------------------------------- -status_t SurfaceComposerClient::setCrop(const sp& id, const Rect& crop) { +status_t SurfaceComposerClient::setCrop(SurfaceID id, const Rect& crop) { return getComposer().setCrop(this, id, crop); } -status_t SurfaceComposerClient::setPosition(const sp& id, float x, float y) { +status_t SurfaceComposerClient::setFreezeTint(SurfaceID id, uint32_t tint) { + return getComposer().setFreezeTint(this, id, tint); +} + +status_t SurfaceComposerClient::setPosition(SurfaceID id, float x, float y) { return getComposer().setPosition(this, id, x, y); } -status_t SurfaceComposerClient::setSize(const sp& id, uint32_t w, uint32_t h) { +status_t SurfaceComposerClient::setSize(SurfaceID id, uint32_t w, uint32_t h) { return getComposer().setSize(this, id, w, h); } -status_t SurfaceComposerClient::setLayer(const sp& id, uint32_t z) { +status_t SurfaceComposerClient::setLayer(SurfaceID id, int32_t z) { return getComposer().setLayer(this, id, z); } -status_t SurfaceComposerClient::hide(const sp& id) { +status_t SurfaceComposerClient::hide(SurfaceID id) { return getComposer().setFlags(this, id, - layer_state_t::eLayerHidden, - layer_state_t::eLayerHidden); + ISurfaceComposer::eLayerHidden, + ISurfaceComposer::eLayerHidden); } -status_t SurfaceComposerClient::show(const sp& id) { +status_t SurfaceComposerClient::show(SurfaceID id, int32_t) { return getComposer().setFlags(this, id, 0, - layer_state_t::eLayerHidden); + ISurfaceComposer::eLayerHidden); } -status_t SurfaceComposerClient::setFlags(const sp& id, uint32_t flags, +status_t SurfaceComposerClient::freeze(SurfaceID id) { + return getComposer().setFlags(this, id, + ISurfaceComposer::eLayerFrozen, + ISurfaceComposer::eLayerFrozen); +} + +status_t SurfaceComposerClient::unfreeze(SurfaceID id) { + return getComposer().setFlags(this, id, + 0, + ISurfaceComposer::eLayerFrozen); +} + +status_t SurfaceComposerClient::setFlags(SurfaceID id, uint32_t flags, uint32_t mask) { return getComposer().setFlags(this, id, flags, mask); } -status_t SurfaceComposerClient::setTransparentRegionHint(const sp& id, +status_t SurfaceComposerClient::setTransparentRegionHint(SurfaceID id, const Region& transparentRegion) { return getComposer().setTransparentRegionHint(this, id, transparentRegion); } -status_t SurfaceComposerClient::setAlpha(const sp& id, float alpha) { +status_t SurfaceComposerClient::setAlpha(SurfaceID id, float alpha) { return getComposer().setAlpha(this, id, alpha); } -status_t SurfaceComposerClient::setLayerStack(const sp& id, uint32_t layerStack) { - return getComposer().setLayerStack(this, id, layerStack); -} - -status_t SurfaceComposerClient::setMatrix(const sp& id, float dsdx, float dtdx, +status_t SurfaceComposerClient::setMatrix(SurfaceID id, float dsdx, float dtdx, float dsdy, float dtdy) { return getComposer().setMatrix(this, id, dsdx, dtdx, dsdy, dtdy); } -// ---------------------------------------------------------------------------- - -void SurfaceComposerClient::setDisplaySurface(const sp& token, - const sp& bufferProducer) { - Composer::getInstance().setDisplaySurface(token, bufferProducer); -} - -void SurfaceComposerClient::setDisplayLayerStack(const sp& token, - uint32_t layerStack) { - Composer::getInstance().setDisplayLayerStack(token, layerStack); -} - -void SurfaceComposerClient::setDisplayProjection(const sp& token, - uint32_t orientation, - const Rect& layerStackRect, - const Rect& displayRect) { - Composer::getInstance().setDisplayProjection(token, orientation, - layerStackRect, displayRect); -} - -void SurfaceComposerClient::setDisplaySize(const sp& token, - uint32_t width, uint32_t height) { - Composer::getInstance().setDisplaySize(token, width, height); +status_t SurfaceComposerClient::setOrientation(DisplayID dpy, + int orientation, uint32_t flags) +{ + return Composer::getInstance().setOrientation(orientation); } // ---------------------------------------------------------------------------- -status_t SurfaceComposerClient::getDisplayConfigs( - const sp& display, Vector* configs) +status_t SurfaceComposerClient::getDisplayInfo( + DisplayID dpy, DisplayInfo* info) { - return ComposerService::getComposerService()->getDisplayConfigs(display, configs); -} - -status_t SurfaceComposerClient::getDisplayInfo(const sp& display, - DisplayInfo* info) { - Vector configs; - status_t result = getDisplayConfigs(display, &configs); - if (result != NO_ERROR) { - return result; - } - - int activeId = getActiveConfig(display); - if (activeId < 0) { - ALOGE("No active configuration found"); - return NAME_NOT_FOUND; - } + if (uint32_t(dpy)>=NUM_DISPLAY_MAX) + return BAD_VALUE; - *info = configs[static_cast(activeId)]; - return NO_ERROR; -} + volatile surface_flinger_cblk_t const * cblk = get_cblk(); + volatile display_cblk_t const * dcblk = cblk->displays + dpy; -int SurfaceComposerClient::getActiveConfig(const sp& display) { - return ComposerService::getComposerService()->getActiveConfig(display); + info->w = dcblk->w; + info->h = dcblk->h; + info->orientation = dcblk->orientation; + info->xdpi = dcblk->xdpi; + info->ydpi = dcblk->ydpi; + info->fps = dcblk->fps; + info->density = dcblk->density; + return getPixelFormatInfo(dcblk->format, &(info->pixelFormatInfo)); } -status_t SurfaceComposerClient::setActiveConfig(const sp& display, int id) { - return ComposerService::getComposerService()->setActiveConfig(display, id); +ssize_t SurfaceComposerClient::getDisplayWidth(DisplayID dpy) +{ + if (uint32_t(dpy)>=NUM_DISPLAY_MAX) + return BAD_VALUE; + volatile surface_flinger_cblk_t const * cblk = get_cblk(); + volatile display_cblk_t const * dcblk = cblk->displays + dpy; + return dcblk->w; } -void SurfaceComposerClient::setDisplayPowerMode(const sp& token, - int mode) { - ComposerService::getComposerService()->setPowerMode(token, mode); +ssize_t SurfaceComposerClient::getDisplayHeight(DisplayID dpy) +{ + if (uint32_t(dpy)>=NUM_DISPLAY_MAX) + return BAD_VALUE; + volatile surface_flinger_cblk_t const * cblk = get_cblk(); + volatile display_cblk_t const * dcblk = cblk->displays + dpy; + return dcblk->h; } -status_t SurfaceComposerClient::clearAnimationFrameStats() { - return ComposerService::getComposerService()->clearAnimationFrameStats(); +ssize_t SurfaceComposerClient::getDisplayOrientation(DisplayID dpy) +{ + if (uint32_t(dpy)>=NUM_DISPLAY_MAX) + return BAD_VALUE; + volatile surface_flinger_cblk_t const * cblk = get_cblk(); + volatile display_cblk_t const * dcblk = cblk->displays + dpy; + return dcblk->orientation; } -status_t SurfaceComposerClient::getAnimationFrameStats(FrameStats* outStats) { - return ComposerService::getComposerService()->getAnimationFrameStats(outStats); +ssize_t SurfaceComposerClient::getNumberOfDisplays() +{ + volatile surface_flinger_cblk_t const * cblk = get_cblk(); + uint32_t connected = cblk->connected; + int n = 0; + while (connected) { + if (connected&1) n++; + connected >>= 1; + } + return n; } // ---------------------------------------------------------------------------- -status_t ScreenshotClient::capture( - const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, bool useIdentityTransform) { - sp s(ComposerService::getComposerService()); - if (s == NULL) return NO_INIT; - return s->captureScreen(display, producer, sourceCrop, - reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform); +status_t SurfaceComposerClient::freezeDisplay(DisplayID dpy, uint32_t flags) +{ + // This has been made a no-op because it can cause Gralloc buffer deadlocks. + return NO_ERROR; } -ScreenshotClient::ScreenshotClient() - : mHaveBuffer(false) { - memset(&mBuffer, 0, sizeof(mBuffer)); +status_t SurfaceComposerClient::unfreezeDisplay(DisplayID dpy, uint32_t flags) +{ + // This has been made a no-op because it can cause Gralloc buffer deadlocks. + return NO_ERROR; } -ScreenshotClient::~ScreenshotClient() { - ScreenshotClient::release(); -} +// ---------------------------------------------------------------------------- -sp ScreenshotClient::getCpuConsumer() const { - if (mCpuConsumer == NULL) { - sp consumer; - BufferQueue::createBufferQueue(&mProducer, &consumer); - mCpuConsumer = new CpuConsumer(consumer, 1); - mCpuConsumer->setName(String8("ScreenshotClient")); - } - return mCpuConsumer; +ScreenshotClient::ScreenshotClient() + : mWidth(0), mHeight(0), mFormat(PIXEL_FORMAT_NONE) { } -status_t ScreenshotClient::update(const sp& display, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, uint32_t rotation) { +status_t ScreenshotClient::update() { sp s(ComposerService::getComposerService()); if (s == NULL) return NO_INIT; - sp cpuConsumer = getCpuConsumer(); - - if (mHaveBuffer) { - mCpuConsumer->unlockBuffer(mBuffer); - memset(&mBuffer, 0, sizeof(mBuffer)); - mHaveBuffer = false; - } - - status_t err = s->captureScreen(display, mProducer, sourceCrop, - reqWidth, reqHeight, minLayerZ, maxLayerZ, useIdentityTransform, - static_cast(rotation)); - - if (err == NO_ERROR) { - err = mCpuConsumer->lockNextBuffer(&mBuffer); - if (err == NO_ERROR) { - mHaveBuffer = true; - } - } - return err; + mHeap = 0; + return s->captureScreen(0, &mHeap, + &mWidth, &mHeight, &mFormat, 0, 0, + 0, -1UL); } -status_t ScreenshotClient::update(const sp& display, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform) { - - return ScreenshotClient::update(display, sourceCrop, reqWidth, reqHeight, - minLayerZ, maxLayerZ, useIdentityTransform, ISurfaceComposer::eRotateNone); -} - -status_t ScreenshotClient::update(const sp& display, Rect sourceCrop, - bool useIdentityTransform) { - return ScreenshotClient::update(display, sourceCrop, 0, 0, 0, -1U, - useIdentityTransform, ISurfaceComposer::eRotateNone); +status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight) { + sp s(ComposerService::getComposerService()); + if (s == NULL) return NO_INIT; + mHeap = 0; + return s->captureScreen(0, &mHeap, + &mWidth, &mHeight, &mFormat, reqWidth, reqHeight, + 0, -1UL); } -status_t ScreenshotClient::update(const sp& display, Rect sourceCrop, - uint32_t reqWidth, uint32_t reqHeight, bool useIdentityTransform) { - return ScreenshotClient::update(display, sourceCrop, reqWidth, reqHeight, - 0, -1U, useIdentityTransform, ISurfaceComposer::eRotateNone); +status_t ScreenshotClient::update(uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ) { + sp s(ComposerService::getComposerService()); + if (s == NULL) return NO_INIT; + mHeap = 0; + return s->captureScreen(0, &mHeap, + &mWidth, &mHeight, &mFormat, reqWidth, reqHeight, + minLayerZ, maxLayerZ); } void ScreenshotClient::release() { - if (mHaveBuffer) { - mCpuConsumer->unlockBuffer(mBuffer); - memset(&mBuffer, 0, sizeof(mBuffer)); - mHaveBuffer = false; - } - mCpuConsumer.clear(); + mHeap = 0; } void const* ScreenshotClient::getPixels() const { - return mBuffer.data; + return mHeap->getBase(); } uint32_t ScreenshotClient::getWidth() const { - return mBuffer.width; + return mWidth; } uint32_t ScreenshotClient::getHeight() const { - return mBuffer.height; + return mHeight; } PixelFormat ScreenshotClient::getFormat() const { - return mBuffer.format; + return mFormat; } uint32_t ScreenshotClient::getStride() const { - return mBuffer.stride; + return mWidth; } size_t ScreenshotClient::getSize() const { - return mBuffer.stride * mBuffer.height * bytesPerPixel(mBuffer.format); + return mHeap->getSize(); } // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceControl.cpp android-platform-frameworks-native-21/libs/gui/SurfaceControl.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceControl.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SurfaceControl.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,194 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#define LOG_TAG "SurfaceControl" - -#include -#include -#include -#include - -#include - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include -#include -#include - -namespace android { - -// ============================================================================ -// SurfaceControl -// ============================================================================ - -SurfaceControl::SurfaceControl( - const sp& client, - const sp& handle, - const sp& gbp) - : mClient(client), mHandle(handle), mGraphicBufferProducer(gbp) -{ -} - -SurfaceControl::~SurfaceControl() -{ - destroy(); -} - -void SurfaceControl::destroy() -{ - if (isValid()) { - mClient->destroySurface(mHandle); - } - // clear all references and trigger an IPC now, to make sure things - // happen without delay, since these resources are quite heavy. - mClient.clear(); - mHandle.clear(); - mGraphicBufferProducer.clear(); - IPCThreadState::self()->flushCommands(); -} - -void SurfaceControl::clear() -{ - // here, the window manager tells us explicitly that we should destroy - // the surface's resource. Soon after this call, it will also release - // its last reference (which will call the dtor); however, it is possible - // that a client living in the same process still holds references which - // would delay the call to the dtor -- that is why we need this explicit - // "clear()" call. - destroy(); -} - -bool SurfaceControl::isSameSurface( - const sp& lhs, const sp& rhs) -{ - if (lhs == 0 || rhs == 0) - return false; - return lhs->mHandle == rhs->mHandle; -} - -status_t SurfaceControl::setLayerStack(uint32_t layerStack) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setLayerStack(mHandle, layerStack); -} -status_t SurfaceControl::setLayer(uint32_t layer) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setLayer(mHandle, layer); -} -status_t SurfaceControl::setPosition(float x, float y) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setPosition(mHandle, x, y); -} -status_t SurfaceControl::setSize(uint32_t w, uint32_t h) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setSize(mHandle, w, h); -} -status_t SurfaceControl::hide() { - status_t err = validate(); - if (err < 0) return err; - return mClient->hide(mHandle); -} -status_t SurfaceControl::show() { - status_t err = validate(); - if (err < 0) return err; - return mClient->show(mHandle); -} -status_t SurfaceControl::setFlags(uint32_t flags, uint32_t mask) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setFlags(mHandle, flags, mask); -} -status_t SurfaceControl::setTransparentRegionHint(const Region& transparent) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setTransparentRegionHint(mHandle, transparent); -} -status_t SurfaceControl::setAlpha(float alpha) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setAlpha(mHandle, alpha); -} -status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setMatrix(mHandle, dsdx, dtdx, dsdy, dtdy); -} -status_t SurfaceControl::setCrop(const Rect& crop) { - status_t err = validate(); - if (err < 0) return err; - return mClient->setCrop(mHandle, crop); -} - -status_t SurfaceControl::clearLayerFrameStats() const { - status_t err = validate(); - if (err < 0) return err; - const sp& client(mClient); - return client->clearLayerFrameStats(mHandle); -} - -status_t SurfaceControl::getLayerFrameStats(FrameStats* outStats) const { - status_t err = validate(); - if (err < 0) return err; - const sp& client(mClient); - return client->getLayerFrameStats(mHandle, outStats); -} - -status_t SurfaceControl::validate() const -{ - if (mHandle==0 || mClient==0) { - ALOGE("invalid handle (%p) or client (%p)", - mHandle.get(), mClient.get()); - return NO_INIT; - } - return NO_ERROR; -} - -status_t SurfaceControl::writeSurfaceToParcel( - const sp& control, Parcel* parcel) -{ - sp bp; - if (control != NULL) { - bp = control->mGraphicBufferProducer; - } - return parcel->writeStrongBinder(IInterface::asBinder(bp)); -} - -sp SurfaceControl::getSurface() const -{ - Mutex::Autolock _l(mLock); - if (mSurfaceData == 0) { - // This surface is always consumed by SurfaceFlinger, so the - // producerControlledByApp value doesn't matter; using false. - mSurfaceData = new Surface(mGraphicBufferProducer, false); - } - return mSurfaceData; -} - -// ---------------------------------------------------------------------------- -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/Surface.cpp android-platform-frameworks-native-21/libs/gui/Surface.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/Surface.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/Surface.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,5 +1,5 @@ /* - * Copyright (C) 2010 The Android Open Source Project + * Copyright (C) 2007 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. @@ -15,1092 +15,380 @@ */ #define LOG_TAG "Surface" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 -#include +#include +#include +#include +#include -#include +#include +#include +#include #include -#include -#include +#include -#include -#include +#include -#include +#include +#include +#include + +#include #include -#include -#include #include - -#include +#include +#include namespace android { -Surface::Surface( - const sp& bufferProducer, - bool controlledByApp) - : mGraphicBufferProducer(bufferProducer), - mGenerationNumber(0) -{ - // Initialize the ANativeWindow function pointers. - ANativeWindow::setSwapInterval = hook_setSwapInterval; - ANativeWindow::dequeueBuffer = hook_dequeueBuffer; - ANativeWindow::cancelBuffer = hook_cancelBuffer; - ANativeWindow::queueBuffer = hook_queueBuffer; - ANativeWindow::query = hook_query; - ANativeWindow::perform = hook_perform; - - ANativeWindow::dequeueBuffer_DEPRECATED = hook_dequeueBuffer_DEPRECATED; - ANativeWindow::cancelBuffer_DEPRECATED = hook_cancelBuffer_DEPRECATED; - ANativeWindow::lockBuffer_DEPRECATED = hook_lockBuffer_DEPRECATED; - ANativeWindow::queueBuffer_DEPRECATED = hook_queueBuffer_DEPRECATED; - - const_cast(ANativeWindow::minSwapInterval) = 0; - const_cast(ANativeWindow::maxSwapInterval) = 1; - - mReqWidth = 0; - mReqHeight = 0; - mReqFormat = 0; - mReqUsage = 0; - mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO; - mDataSpace = HAL_DATASPACE_UNKNOWN; - mCrop.clear(); - mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; - mTransform = 0; - mStickyTransform = 0; - mDefaultWidth = 0; - mDefaultHeight = 0; - mUserWidth = 0; - mUserHeight = 0; - mTransformHint = 0; - mConsumerRunningBehind = false; - mConnectedToCpu = false; - mProducerControlledByApp = controlledByApp; - mSwapIntervalZero = false; -} - -Surface::~Surface() { - if (mConnectedToCpu) { - Surface::disconnect(NATIVE_WINDOW_API_CPU); - } -} - -sp Surface::getIGraphicBufferProducer() const { - return mGraphicBufferProducer; -} +// ============================================================================ +// SurfaceControl +// ============================================================================ -void Surface::setSidebandStream(const sp& stream) { - mGraphicBufferProducer->setSidebandStream(stream); +SurfaceControl::SurfaceControl( + const sp& client, + const sp& surface, + const ISurfaceComposerClient::surface_data_t& data) + : mClient(client), mSurface(surface), + mToken(data.token), mIdentity(data.identity) +{ } - -void Surface::allocateBuffers() { - uint32_t reqWidth = mReqWidth ? mReqWidth : mUserWidth; - uint32_t reqHeight = mReqHeight ? mReqHeight : mUserHeight; - mGraphicBufferProducer->allocateBuffers(mSwapIntervalZero, reqWidth, - reqHeight, mReqFormat, mReqUsage); + +SurfaceControl::~SurfaceControl() +{ + destroy(); } -status_t Surface::setGenerationNumber(uint32_t generation) { - status_t result = mGraphicBufferProducer->setGenerationNumber(generation); - if (result == NO_ERROR) { - mGenerationNumber = generation; +void SurfaceControl::destroy() +{ + if (isValid()) { + mClient->destroySurface(mToken); } - return result; -} -String8 Surface::getConsumerName() const { - return mGraphicBufferProducer->getConsumerName(); + // clear all references and trigger an IPC now, to make sure things + // happen without delay, since these resources are quite heavy. + mClient.clear(); + mSurface.clear(); + IPCThreadState::self()->flushCommands(); } -int Surface::hook_setSwapInterval(ANativeWindow* window, int interval) { - Surface* c = getSelf(window); - return c->setSwapInterval(interval); +void SurfaceControl::clear() +{ + // here, the window manager tells us explicitly that we should destroy + // the surface's resource. Soon after this call, it will also release + // its last reference (which will call the dtor); however, it is possible + // that a client living in the same process still holds references which + // would delay the call to the dtor -- that is why we need this explicit + // "clear()" call. + destroy(); } -int Surface::hook_dequeueBuffer(ANativeWindow* window, - ANativeWindowBuffer** buffer, int* fenceFd) { - Surface* c = getSelf(window); - return c->dequeueBuffer(buffer, fenceFd); +bool SurfaceControl::isSameSurface( + const sp& lhs, const sp& rhs) +{ + if (lhs == 0 || rhs == 0) + return false; + return lhs->mSurface->asBinder() == rhs->mSurface->asBinder(); } -int Surface::hook_cancelBuffer(ANativeWindow* window, - ANativeWindowBuffer* buffer, int fenceFd) { - Surface* c = getSelf(window); - return c->cancelBuffer(buffer, fenceFd); +status_t SurfaceControl::setLayer(int32_t layer) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setLayer(mToken, layer); } - -int Surface::hook_queueBuffer(ANativeWindow* window, - ANativeWindowBuffer* buffer, int fenceFd) { - Surface* c = getSelf(window); - return c->queueBuffer(buffer, fenceFd); +status_t SurfaceControl::setPosition(int32_t x, int32_t y) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setPosition(mToken, x, y); } - -int Surface::hook_dequeueBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer** buffer) { - Surface* c = getSelf(window); - ANativeWindowBuffer* buf; - int fenceFd = -1; - int result = c->dequeueBuffer(&buf, &fenceFd); - sp fence(new Fence(fenceFd)); - int waitResult = fence->waitForever("dequeueBuffer_DEPRECATED"); - if (waitResult != OK) { - ALOGE("dequeueBuffer_DEPRECATED: Fence::wait returned an error: %d", - waitResult); - c->cancelBuffer(buf, -1); - return waitResult; - } - *buffer = buf; - return result; +status_t SurfaceControl::setSize(uint32_t w, uint32_t h) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setSize(mToken, w, h); } - -int Surface::hook_cancelBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer* buffer) { - Surface* c = getSelf(window); - return c->cancelBuffer(buffer, -1); +status_t SurfaceControl::hide() { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->hide(mToken); } - -int Surface::hook_lockBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer* buffer) { - Surface* c = getSelf(window); - return c->lockBuffer_DEPRECATED(buffer); +status_t SurfaceControl::show(int32_t layer) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->show(mToken, layer); } - -int Surface::hook_queueBuffer_DEPRECATED(ANativeWindow* window, - ANativeWindowBuffer* buffer) { - Surface* c = getSelf(window); - return c->queueBuffer(buffer, -1); +status_t SurfaceControl::freeze() { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->freeze(mToken); } - -int Surface::hook_query(const ANativeWindow* window, - int what, int* value) { - const Surface* c = getSelf(window); - return c->query(what, value); +status_t SurfaceControl::unfreeze() { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->unfreeze(mToken); } - -int Surface::hook_perform(ANativeWindow* window, int operation, ...) { - va_list args; - va_start(args, operation); - Surface* c = getSelf(window); - return c->perform(operation, args); +status_t SurfaceControl::setFlags(uint32_t flags, uint32_t mask) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setFlags(mToken, flags, mask); } - -int Surface::setSwapInterval(int interval) { - ATRACE_CALL(); - // EGL specification states: - // interval is silently clamped to minimum and maximum implementation - // dependent values before being stored. - - if (interval < minSwapInterval) - interval = minSwapInterval; - - if (interval > maxSwapInterval) - interval = maxSwapInterval; - - mSwapIntervalZero = (interval == 0); - - return NO_ERROR; +status_t SurfaceControl::setTransparentRegionHint(const Region& transparent) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setTransparentRegionHint(mToken, transparent); } - -int Surface::dequeueBuffer(android_native_buffer_t** buffer, int* fenceFd) { - ATRACE_CALL(); - ALOGV("Surface::dequeueBuffer"); - - uint32_t reqWidth; - uint32_t reqHeight; - bool swapIntervalZero; - PixelFormat reqFormat; - uint32_t reqUsage; - - { - Mutex::Autolock lock(mMutex); - - reqWidth = mReqWidth ? mReqWidth : mUserWidth; - reqHeight = mReqHeight ? mReqHeight : mUserHeight; - - swapIntervalZero = mSwapIntervalZero; - reqFormat = mReqFormat; - reqUsage = mReqUsage; - } // Drop the lock so that we can still touch the Surface while blocking in IGBP::dequeueBuffer - - int buf = -1; - sp fence; - status_t result = mGraphicBufferProducer->dequeueBuffer(&buf, &fence, swapIntervalZero, - reqWidth, reqHeight, reqFormat, reqUsage); - - if (result < 0) { - ALOGV("dequeueBuffer: IGraphicBufferProducer::dequeueBuffer(%d, %d, %d, %d, %d)" - "failed: %d", swapIntervalZero, reqWidth, reqHeight, reqFormat, - reqUsage, result); - return result; - } - - Mutex::Autolock lock(mMutex); - - sp& gbuf(mSlots[buf].buffer); - - // this should never happen - ALOGE_IF(fence == NULL, "Surface::dequeueBuffer: received null Fence! buf=%d", buf); - - if (result & IGraphicBufferProducer::RELEASE_ALL_BUFFERS) { - freeAllBuffers(); - } - - if ((result & IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) { - result = mGraphicBufferProducer->requestBuffer(buf, &gbuf); - if (result != NO_ERROR) { - ALOGE("dequeueBuffer: IGraphicBufferProducer::requestBuffer failed: %d", result); - mGraphicBufferProducer->cancelBuffer(buf, fence); - return result; - } - } - - if (fence->isValid()) { - *fenceFd = fence->dup(); - if (*fenceFd == -1) { - ALOGE("dequeueBuffer: error duping fence: %d", errno); - // dup() should never fail; something is badly wrong. Soldier on - // and hope for the best; the worst that should happen is some - // visible corruption that lasts until the next frame. - } - } else { - *fenceFd = -1; - } - - *buffer = gbuf.get(); - return OK; +status_t SurfaceControl::setAlpha(float alpha) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setAlpha(mToken, alpha); } - -int Surface::cancelBuffer(android_native_buffer_t* buffer, - int fenceFd) { - ATRACE_CALL(); - ALOGV("Surface::cancelBuffer"); - Mutex::Autolock lock(mMutex); - int i = getSlotFromBufferLocked(buffer); - if (i < 0) { - if (fenceFd >= 0) { - close(fenceFd); - } - return i; - } - sp fence(fenceFd >= 0 ? new Fence(fenceFd) : Fence::NO_FENCE); - mGraphicBufferProducer->cancelBuffer(i, fence); - return OK; +status_t SurfaceControl::setMatrix(float dsdx, float dtdx, float dsdy, float dtdy) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setMatrix(mToken, dsdx, dtdx, dsdy, dtdy); } - -int Surface::getSlotFromBufferLocked( - android_native_buffer_t* buffer) const { - for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { - if (mSlots[i].buffer != NULL && - mSlots[i].buffer->handle == buffer->handle) { - return i; - } - } - ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle); - return BAD_VALUE; +status_t SurfaceControl::setFreezeTint(uint32_t tint) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setFreezeTint(mToken, tint); } - -int Surface::lockBuffer_DEPRECATED(android_native_buffer_t* buffer __attribute__((unused))) { - ALOGV("Surface::lockBuffer"); - Mutex::Autolock lock(mMutex); - return OK; -} - -int Surface::queueBuffer(android_native_buffer_t* buffer, int fenceFd) { - ATRACE_CALL(); - ALOGV("Surface::queueBuffer"); - Mutex::Autolock lock(mMutex); - int64_t timestamp; - bool isAutoTimestamp = false; - if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) { - timestamp = systemTime(SYSTEM_TIME_MONOTONIC); - isAutoTimestamp = true; - ALOGV("Surface::queueBuffer making up timestamp: %.2f ms", - timestamp / 1000000.f); - } else { - timestamp = mTimestamp; - } - int i = getSlotFromBufferLocked(buffer); - if (i < 0) { - if (fenceFd >= 0) { - close(fenceFd); - } - return i; - } - - - // Make sure the crop rectangle is entirely inside the buffer. - Rect crop; - mCrop.intersect(Rect(buffer->width, buffer->height), &crop); - - sp fence(fenceFd >= 0 ? new Fence(fenceFd) : Fence::NO_FENCE); - IGraphicBufferProducer::QueueBufferOutput output; - IGraphicBufferProducer::QueueBufferInput input(timestamp, isAutoTimestamp, - mDataSpace, crop, mScalingMode, mTransform ^ mStickyTransform, - mSwapIntervalZero, fence, mStickyTransform); - - if (mConnectedToCpu || mDirtyRegion.bounds() == Rect::INVALID_RECT) { - input.setSurfaceDamage(Region::INVALID_REGION); - } else { - // Here we do two things: - // 1) The surface damage was specified using the OpenGL ES convention of - // the origin being in the bottom-left corner. Here we flip to the - // convention that the rest of the system uses (top-left corner) by - // subtracting all top/bottom coordinates from the buffer height. - // 2) If the buffer is coming in rotated (for example, because the EGL - // implementation is reacting to the transform hint coming back from - // SurfaceFlinger), the surface damage needs to be rotated the - // opposite direction, since it was generated assuming an unrotated - // buffer (the app doesn't know that the EGL implementation is - // reacting to the transform hint behind its back). The - // transformations in the switch statement below apply those - // complementary rotations (e.g., if 90 degrees, rotate 270 degrees). - - int width = buffer->width; - int height = buffer->height; - bool rotated90 = (mTransform ^ mStickyTransform) & - NATIVE_WINDOW_TRANSFORM_ROT_90; - if (rotated90) { - std::swap(width, height); - } - - Region flippedRegion; - for (auto rect : mDirtyRegion) { - int left = rect.left; - int right = rect.right; - int top = height - rect.bottom; // Flip from OpenGL convention - int bottom = height - rect.top; // Flip from OpenGL convention - switch (mTransform ^ mStickyTransform) { - case NATIVE_WINDOW_TRANSFORM_ROT_90: { - // Rotate 270 degrees - Rect flippedRect{top, width - right, bottom, width - left}; - flippedRegion.orSelf(flippedRect); - break; - } - case NATIVE_WINDOW_TRANSFORM_ROT_180: { - // Rotate 180 degrees - Rect flippedRect{width - right, height - bottom, - width - left, height - top}; - flippedRegion.orSelf(flippedRect); - break; - } - case NATIVE_WINDOW_TRANSFORM_ROT_270: { - // Rotate 90 degrees - Rect flippedRect{height - bottom, left, - height - top, right}; - flippedRegion.orSelf(flippedRect); - break; - } - default: { - Rect flippedRect{left, top, right, bottom}; - flippedRegion.orSelf(flippedRect); - break; - } - } - } - - input.setSurfaceDamage(flippedRegion); - } - - status_t err = mGraphicBufferProducer->queueBuffer(i, input, &output); - if (err != OK) { - ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); - } - uint32_t numPendingBuffers = 0; - uint32_t hint = 0; - output.deflate(&mDefaultWidth, &mDefaultHeight, &hint, - &numPendingBuffers); - - // Disable transform hint if sticky transform is set. - if (mStickyTransform == 0) { - mTransformHint = hint; - } - - mConsumerRunningBehind = (numPendingBuffers >= 2); - - if (!mConnectedToCpu) { - // Clear surface damage back to full-buffer - mDirtyRegion = Region::INVALID_REGION; - } - - return err; +status_t SurfaceControl::setCrop(const Rect& crop) { + status_t err = validate(); + if (err < 0) return err; + const sp& client(mClient); + return client->setCrop(mToken, crop); } -int Surface::query(int what, int* value) const { - ATRACE_CALL(); - ALOGV("Surface::query"); - { // scope for the lock - Mutex::Autolock lock(mMutex); - switch (what) { - case NATIVE_WINDOW_FORMAT: - if (mReqFormat) { - *value = static_cast(mReqFormat); - return NO_ERROR; - } - break; - case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: { - sp composer( - ComposerService::getComposerService()); - if (composer->authenticateSurfaceTexture(mGraphicBufferProducer)) { - *value = 1; - } else { - *value = 0; - } - return NO_ERROR; - } - case NATIVE_WINDOW_CONCRETE_TYPE: - *value = NATIVE_WINDOW_SURFACE; - return NO_ERROR; - case NATIVE_WINDOW_DEFAULT_WIDTH: - *value = static_cast( - mUserWidth ? mUserWidth : mDefaultWidth); - return NO_ERROR; - case NATIVE_WINDOW_DEFAULT_HEIGHT: - *value = static_cast( - mUserHeight ? mUserHeight : mDefaultHeight); - return NO_ERROR; - case NATIVE_WINDOW_TRANSFORM_HINT: - *value = static_cast(mTransformHint); - return NO_ERROR; - case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: { - status_t err = NO_ERROR; - if (!mConsumerRunningBehind) { - *value = 0; - } else { - err = mGraphicBufferProducer->query(what, value); - if (err == NO_ERROR) { - mConsumerRunningBehind = *value; - } - } - return err; - } - } - } - return mGraphicBufferProducer->query(what, value); -} - -int Surface::perform(int operation, va_list args) +status_t SurfaceControl::validate() const { - int res = NO_ERROR; - switch (operation) { - case NATIVE_WINDOW_CONNECT: - // deprecated. must return NO_ERROR. - break; - case NATIVE_WINDOW_DISCONNECT: - // deprecated. must return NO_ERROR. - break; - case NATIVE_WINDOW_SET_USAGE: - res = dispatchSetUsage(args); - break; - case NATIVE_WINDOW_SET_CROP: - res = dispatchSetCrop(args); - break; - case NATIVE_WINDOW_SET_BUFFER_COUNT: - res = dispatchSetBufferCount(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY: - res = dispatchSetBuffersGeometry(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM: - res = dispatchSetBuffersTransform(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_STICKY_TRANSFORM: - res = dispatchSetBuffersStickyTransform(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP: - res = dispatchSetBuffersTimestamp(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS: - res = dispatchSetBuffersDimensions(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS: - res = dispatchSetBuffersUserDimensions(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_FORMAT: - res = dispatchSetBuffersFormat(args); - break; - case NATIVE_WINDOW_LOCK: - res = dispatchLock(args); - break; - case NATIVE_WINDOW_UNLOCK_AND_POST: - res = dispatchUnlockAndPost(args); - break; - case NATIVE_WINDOW_SET_SCALING_MODE: - res = dispatchSetScalingMode(args); - break; - case NATIVE_WINDOW_API_CONNECT: - res = dispatchConnect(args); - break; - case NATIVE_WINDOW_API_DISCONNECT: - res = dispatchDisconnect(args); - break; - case NATIVE_WINDOW_SET_SIDEBAND_STREAM: - res = dispatchSetSidebandStream(args); - break; - case NATIVE_WINDOW_SET_BUFFERS_DATASPACE: - res = dispatchSetBuffersDataSpace(args); - break; - case NATIVE_WINDOW_SET_SURFACE_DAMAGE: - res = dispatchSetSurfaceDamage(args); - break; - default: - res = NAME_NOT_FOUND; - break; - } - return res; -} - -int Surface::dispatchConnect(va_list args) { - int api = va_arg(args, int); - return connect(api); -} - -int Surface::dispatchDisconnect(va_list args) { - int api = va_arg(args, int); - return disconnect(api); -} - -int Surface::dispatchSetUsage(va_list args) { - int usage = va_arg(args, int); - return setUsage(static_cast(usage)); -} - -int Surface::dispatchSetCrop(va_list args) { - android_native_rect_t const* rect = va_arg(args, android_native_rect_t*); - return setCrop(reinterpret_cast(rect)); -} - -int Surface::dispatchSetBufferCount(va_list args) { - size_t bufferCount = va_arg(args, size_t); - return setBufferCount(static_cast(bufferCount)); -} - -int Surface::dispatchSetBuffersGeometry(va_list args) { - uint32_t width = va_arg(args, uint32_t); - uint32_t height = va_arg(args, uint32_t); - PixelFormat format = va_arg(args, PixelFormat); - int err = setBuffersDimensions(width, height); - if (err != 0) { - return err; + if (mToken<0 || mClient==0) { + ALOGE("invalid token (%d, identity=%u) or client (%p)", + mToken, mIdentity, mClient.get()); + return NO_INIT; } - return setBuffersFormat(format); -} - -int Surface::dispatchSetBuffersDimensions(va_list args) { - uint32_t width = va_arg(args, uint32_t); - uint32_t height = va_arg(args, uint32_t); - return setBuffersDimensions(width, height); -} - -int Surface::dispatchSetBuffersUserDimensions(va_list args) { - uint32_t width = va_arg(args, uint32_t); - uint32_t height = va_arg(args, uint32_t); - return setBuffersUserDimensions(width, height); -} - -int Surface::dispatchSetBuffersFormat(va_list args) { - PixelFormat format = va_arg(args, PixelFormat); - return setBuffersFormat(format); -} - -int Surface::dispatchSetScalingMode(va_list args) { - int mode = va_arg(args, int); - return setScalingMode(mode); -} - -int Surface::dispatchSetBuffersTransform(va_list args) { - uint32_t transform = va_arg(args, uint32_t); - return setBuffersTransform(transform); -} - -int Surface::dispatchSetBuffersStickyTransform(va_list args) { - uint32_t transform = va_arg(args, uint32_t); - return setBuffersStickyTransform(transform); -} - -int Surface::dispatchSetBuffersTimestamp(va_list args) { - int64_t timestamp = va_arg(args, int64_t); - return setBuffersTimestamp(timestamp); -} - -int Surface::dispatchLock(va_list args) { - ANativeWindow_Buffer* outBuffer = va_arg(args, ANativeWindow_Buffer*); - ARect* inOutDirtyBounds = va_arg(args, ARect*); - return lock(outBuffer, inOutDirtyBounds); -} - -int Surface::dispatchUnlockAndPost(va_list args __attribute__((unused))) { - return unlockAndPost(); -} - -int Surface::dispatchSetSidebandStream(va_list args) { - native_handle_t* sH = va_arg(args, native_handle_t*); - sp sidebandHandle = NativeHandle::create(sH, false); - setSidebandStream(sidebandHandle); - return OK; -} - -int Surface::dispatchSetBuffersDataSpace(va_list args) { - android_dataspace dataspace = - static_cast(va_arg(args, int)); - return setBuffersDataSpace(dataspace); -} - -int Surface::dispatchSetSurfaceDamage(va_list args) { - android_native_rect_t* rects = va_arg(args, android_native_rect_t*); - size_t numRects = va_arg(args, size_t); - setSurfaceDamage(rects, numRects); return NO_ERROR; } -int Surface::connect(int api) { - static sp listener = new DummyProducerListener(); - return connect(api, listener); -} - -int Surface::connect(int api, const sp& listener) { - ATRACE_CALL(); - ALOGV("Surface::connect"); - Mutex::Autolock lock(mMutex); - IGraphicBufferProducer::QueueBufferOutput output; - int err = mGraphicBufferProducer->connect(listener, api, mProducerControlledByApp, &output); - if (err == NO_ERROR) { - uint32_t numPendingBuffers = 0; - uint32_t hint = 0; - output.deflate(&mDefaultWidth, &mDefaultHeight, &hint, - &numPendingBuffers); - - // Disable transform hint if sticky transform is set. - if (mStickyTransform == 0) { - mTransformHint = hint; - } - - mConsumerRunningBehind = (numPendingBuffers >= 2); - } - if (!err && api == NATIVE_WINDOW_API_CPU) { - mConnectedToCpu = true; - // Clear the dirty region in case we're switching from a non-CPU API - mDirtyRegion.clear(); - } else if (!err) { - // Initialize the dirty region for tracking surface damage - mDirtyRegion = Region::INVALID_REGION; - } - - return err; -} - - -int Surface::disconnect(int api) { - ATRACE_CALL(); - ALOGV("Surface::disconnect"); - Mutex::Autolock lock(mMutex); - freeAllBuffers(); - int err = mGraphicBufferProducer->disconnect(api); - if (!err) { - mReqFormat = 0; - mReqWidth = 0; - mReqHeight = 0; - mReqUsage = 0; - mCrop.clear(); - mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; - mTransform = 0; - mStickyTransform = 0; - - if (api == NATIVE_WINDOW_API_CPU) { - mConnectedToCpu = false; - } - } - return err; -} - -int Surface::detachNextBuffer(sp* outBuffer, - sp* outFence) { - ATRACE_CALL(); - ALOGV("Surface::detachNextBuffer"); - - if (outBuffer == NULL || outFence == NULL) { - return BAD_VALUE; - } - - Mutex::Autolock lock(mMutex); - - sp buffer(NULL); - sp fence(NULL); - status_t result = mGraphicBufferProducer->detachNextBuffer( - &buffer, &fence); - if (result != NO_ERROR) { - return result; - } - - *outBuffer = buffer; - if (fence != NULL && fence->isValid()) { - *outFence = fence; - } else { - *outFence = Fence::NO_FENCE; +status_t SurfaceControl::writeSurfaceToParcel( + const sp& control, Parcel* parcel) +{ + sp sur; + uint32_t identity = 0; + if (SurfaceControl::isValid(control)) { + sur = control->mSurface; + identity = control->mIdentity; } - + parcel->writeStrongBinder(sur!=0 ? sur->asBinder() : NULL); + parcel->writeStrongBinder(NULL); // NULL ISurfaceTexture in this case. + parcel->writeInt32(identity); return NO_ERROR; } -int Surface::attachBuffer(ANativeWindowBuffer* buffer) +sp SurfaceControl::getSurface() const { - ATRACE_CALL(); - ALOGV("Surface::attachBuffer"); - - Mutex::Autolock lock(mMutex); - - sp graphicBuffer(static_cast(buffer)); - uint32_t priorGeneration = graphicBuffer->mGenerationNumber; - graphicBuffer->mGenerationNumber = mGenerationNumber; - int32_t attachedSlot = -1; - status_t result = mGraphicBufferProducer->attachBuffer( - &attachedSlot, graphicBuffer); - if (result != NO_ERROR) { - ALOGE("attachBuffer: IGraphicBufferProducer call failed (%d)", result); - graphicBuffer->mGenerationNumber = priorGeneration; - return result; + Mutex::Autolock _l(mLock); + if (mSurfaceData == 0) { + sp surface_control(const_cast(this)); + mSurfaceData = new Surface(surface_control); } - mSlots[attachedSlot].buffer = graphicBuffer; - - return NO_ERROR; + return mSurfaceData; } -int Surface::setUsage(uint32_t reqUsage) -{ - ALOGV("Surface::setUsage"); - Mutex::Autolock lock(mMutex); - mReqUsage = reqUsage; - return OK; -} +// ============================================================================ +// Surface +// ============================================================================ -int Surface::setCrop(Rect const* rect) -{ - ATRACE_CALL(); +// --------------------------------------------------------------------------- - Rect realRect; - if (rect == NULL || rect->isEmpty()) { - realRect.clear(); - } else { - realRect = *rect; +Surface::Surface(const sp& surface) + : SurfaceTextureClient(), + mSurface(surface->mSurface), + mIdentity(surface->mIdentity) +{ + sp st; + if (mSurface != NULL) { + st = mSurface->getSurfaceTexture(); } - - ALOGV("Surface::setCrop rect=[%d %d %d %d]", - realRect.left, realRect.top, realRect.right, realRect.bottom); - - Mutex::Autolock lock(mMutex); - mCrop = realRect; - return NO_ERROR; + init(st); } -int Surface::setBufferCount(int bufferCount) +Surface::Surface(const Parcel& parcel, const sp& ref) + : SurfaceTextureClient() { - ATRACE_CALL(); - ALOGV("Surface::setBufferCount"); - Mutex::Autolock lock(mMutex); - - status_t err = mGraphicBufferProducer->setBufferCount(bufferCount); - ALOGE_IF(err, "IGraphicBufferProducer::setBufferCount(%d) returned %s", - bufferCount, strerror(-err)); - - if (err == NO_ERROR) { - freeAllBuffers(); + mSurface = interface_cast(ref); + sp st_binder(parcel.readStrongBinder()); + sp st; + if (st_binder != NULL) { + st = interface_cast(st_binder); + } else if (mSurface != NULL) { + st = mSurface->getSurfaceTexture(); } - return err; + mIdentity = parcel.readInt32(); + init(st); } -int Surface::setBuffersDimensions(uint32_t width, uint32_t height) +Surface::Surface(const sp& st) + : SurfaceTextureClient(), + mSurface(NULL), + mIdentity(0) { - ATRACE_CALL(); - ALOGV("Surface::setBuffersDimensions"); - - if ((width && !height) || (!width && height)) - return BAD_VALUE; - - Mutex::Autolock lock(mMutex); - mReqWidth = width; - mReqHeight = height; - return NO_ERROR; + init(st); } -int Surface::setBuffersUserDimensions(uint32_t width, uint32_t height) +status_t Surface::writeToParcel( + const sp& surface, Parcel* parcel) { - ATRACE_CALL(); - ALOGV("Surface::setBuffersUserDimensions"); - - if ((width && !height) || (!width && height)) - return BAD_VALUE; + sp sur; + sp st; + uint32_t identity = 0; + if (Surface::isValid(surface)) { + sur = surface->mSurface; + st = surface->getISurfaceTexture(); + identity = surface->mIdentity; + } else if (surface != 0 && + (surface->mSurface != NULL || + surface->getISurfaceTexture() != NULL)) { + ALOGE("Parceling invalid surface with non-NULL ISurface/ISurfaceTexture as NULL: " + "mSurface = %p, surfaceTexture = %p, mIdentity = %d, ", + surface->mSurface.get(), surface->getISurfaceTexture().get(), + surface->mIdentity); + } - Mutex::Autolock lock(mMutex); - mUserWidth = width; - mUserHeight = height; + parcel->writeStrongBinder(sur != NULL ? sur->asBinder() : NULL); + parcel->writeStrongBinder(st != NULL ? st->asBinder() : NULL); + parcel->writeInt32(identity); return NO_ERROR; -} - -int Surface::setBuffersFormat(PixelFormat format) -{ - ALOGV("Surface::setBuffersFormat"); - Mutex::Autolock lock(mMutex); - mReqFormat = format; - return NO_ERROR; } -int Surface::setScalingMode(int mode) -{ - ATRACE_CALL(); - ALOGV("Surface::setScalingMode(%d)", mode); +Mutex Surface::sCachedSurfacesLock; +DefaultKeyedVector, wp > Surface::sCachedSurfaces; - switch (mode) { - case NATIVE_WINDOW_SCALING_MODE_FREEZE: - case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: - case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: - break; - default: - ALOGE("unknown scaling mode: %d", mode); - return BAD_VALUE; +sp Surface::readFromParcel(const Parcel& data) { + Mutex::Autolock _l(sCachedSurfacesLock); + sp binder(data.readStrongBinder()); + sp surface = sCachedSurfaces.valueFor(binder).promote(); + if (surface == 0) { + surface = new Surface(data, binder); + sCachedSurfaces.add(binder, surface); + } else { + // The Surface was found in the cache, but we still should clear any + // remaining data from the parcel. + data.readStrongBinder(); // ISurfaceTexture + data.readInt32(); // identity } - - Mutex::Autolock lock(mMutex); - mScalingMode = mode; - return NO_ERROR; + if (surface->mSurface == NULL && surface->getISurfaceTexture() == NULL) { + surface = 0; + } + cleanCachedSurfacesLocked(); + return surface; } -int Surface::setBuffersTransform(uint32_t transform) -{ - ATRACE_CALL(); - ALOGV("Surface::setBuffersTransform"); - Mutex::Autolock lock(mMutex); - mTransform = transform; - return NO_ERROR; +// Remove the stale entries from the surface cache. This should only be called +// with sCachedSurfacesLock held. +void Surface::cleanCachedSurfacesLocked() { + for (int i = sCachedSurfaces.size()-1; i >= 0; --i) { + wp s(sCachedSurfaces.valueAt(i)); + if (s == 0 || s.promote() == 0) { + sCachedSurfaces.removeItemsAt(i); + } + } } -int Surface::setBuffersStickyTransform(uint32_t transform) +void Surface::init(const sp& surfaceTexture) { - ATRACE_CALL(); - ALOGV("Surface::setBuffersStickyTransform"); - Mutex::Autolock lock(mMutex); - mStickyTransform = transform; - return NO_ERROR; -} + if (mSurface != NULL || surfaceTexture != NULL) { + ALOGE_IF(surfaceTexture==0, "got a NULL ISurfaceTexture from ISurface"); + if (surfaceTexture != NULL) { + setISurfaceTexture(surfaceTexture); + setUsage(GraphicBuffer::USAGE_HW_RENDER); + } -int Surface::setBuffersTimestamp(int64_t timestamp) -{ - ALOGV("Surface::setBuffersTimestamp"); - Mutex::Autolock lock(mMutex); - mTimestamp = timestamp; - return NO_ERROR; + DisplayInfo dinfo; + SurfaceComposerClient::getDisplayInfo(0, &dinfo); + const_cast(ANativeWindow::xdpi) = dinfo.xdpi; + const_cast(ANativeWindow::ydpi) = dinfo.ydpi; + const_cast(ANativeWindow::flags) = 0; + } } -int Surface::setBuffersDataSpace(android_dataspace dataSpace) +Surface::~Surface() { - ALOGV("Surface::setBuffersDataSpace"); - Mutex::Autolock lock(mMutex); - mDataSpace = dataSpace; - return NO_ERROR; + // clear all references and trigger an IPC now, to make sure things + // happen without delay, since these resources are quite heavy. + mSurface.clear(); + IPCThreadState::self()->flushCommands(); } -void Surface::freeAllBuffers() { - for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { - mSlots[i].buffer = 0; - } +bool Surface::isValid() { + return getISurfaceTexture() != NULL; } -void Surface::setSurfaceDamage(android_native_rect_t* rects, size_t numRects) { - ATRACE_CALL(); - ALOGV("Surface::setSurfaceDamage"); - Mutex::Autolock lock(mMutex); - - if (mConnectedToCpu || numRects == 0) { - mDirtyRegion = Region::INVALID_REGION; - return; - } +sp Surface::getSurfaceTexture() { + return getISurfaceTexture(); +} - mDirtyRegion.clear(); - for (size_t r = 0; r < numRects; ++r) { - // We intentionally flip top and bottom here, since because they're - // specified with a bottom-left origin, top > bottom, which fails - // validation in the Region class. We will fix this up when we flip to a - // top-left origin in queueBuffer. - Rect rect(rects[r].left, rects[r].bottom, rects[r].right, rects[r].top); - mDirtyRegion.orSelf(rect); - } +sp Surface::asBinder() const { + return mSurface!=0 ? mSurface->asBinder() : 0; } -// ---------------------------------------------------------------------- -// the lock/unlock APIs must be used from the same thread +// ---------------------------------------------------------------------------- -static status_t copyBlt( - const sp& dst, - const sp& src, - const Region& reg) -{ - // src and dst with, height and format must be identical. no verification - // is done here. - status_t err; - uint8_t* src_bits = NULL; - err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), - reinterpret_cast(&src_bits)); - ALOGE_IF(err, "error locking src buffer %s", strerror(-err)); - - uint8_t* dst_bits = NULL; - err = dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), - reinterpret_cast(&dst_bits)); - ALOGE_IF(err, "error locking dst buffer %s", strerror(-err)); - - Region::const_iterator head(reg.begin()); - Region::const_iterator tail(reg.end()); - if (head != tail && src_bits && dst_bits) { - const size_t bpp = bytesPerPixel(src->format); - const size_t dbpr = static_cast(dst->stride) * bpp; - const size_t sbpr = static_cast(src->stride) * bpp; - - while (head != tail) { - const Rect& r(*head++); - int32_t h = r.height(); - if (h <= 0) continue; - size_t size = static_cast(r.width()) * bpp; - uint8_t const * s = src_bits + - static_cast(r.left + src->stride * r.top) * bpp; - uint8_t * d = dst_bits + - static_cast(r.left + dst->stride * r.top) * bpp; - if (dbpr==sbpr && size==sbpr) { - size *= static_cast(h); - h = 1; - } - do { - memcpy(d, s, size); - d += dbpr; - s += sbpr; - } while (--h > 0); - } +int Surface::query(int what, int* value) const { + switch (what) { + case NATIVE_WINDOW_CONCRETE_TYPE: + *value = NATIVE_WINDOW_SURFACE; + return NO_ERROR; } - - if (src_bits) - src->unlock(); - - if (dst_bits) - dst->unlock(); - - return err; + return SurfaceTextureClient::query(what, value); } // ---------------------------------------------------------------------------- -status_t Surface::lock( - ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds) -{ - if (mLockedBuffer != 0) { - ALOGE("Surface::lock failed, already locked"); - return INVALID_OPERATION; - } +status_t Surface::lock(SurfaceInfo* other, Region* inOutDirtyRegion) { + ANativeWindow_Buffer outBuffer; - if (!mConnectedToCpu) { - int err = Surface::connect(NATIVE_WINDOW_API_CPU); - if (err) { - return err; - } - // we're intending to do software rendering from this point - setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN); + ARect temp; + ARect* inOutDirtyBounds = NULL; + if (inOutDirtyRegion) { + temp = inOutDirtyRegion->getBounds(); + inOutDirtyBounds = &temp; } - ANativeWindowBuffer* out; - int fenceFd = -1; - status_t err = dequeueBuffer(&out, &fenceFd); - ALOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err)); - if (err == NO_ERROR) { - sp backBuffer(GraphicBuffer::getSelf(out)); - const Rect bounds(backBuffer->width, backBuffer->height); - - Region newDirtyRegion; - if (inOutDirtyBounds) { - newDirtyRegion.set(static_cast(*inOutDirtyBounds)); - newDirtyRegion.andSelf(bounds); - } else { - newDirtyRegion.set(bounds); - } - - // figure out if we can copy the frontbuffer back - const sp& frontBuffer(mPostedBuffer); - const bool canCopyBack = (frontBuffer != 0 && - backBuffer->width == frontBuffer->width && - backBuffer->height == frontBuffer->height && - backBuffer->format == frontBuffer->format); - - if (canCopyBack) { - // copy the area that is invalid and not repainted this round - const Region copyback(mDirtyRegion.subtract(newDirtyRegion)); - if (!copyback.isEmpty()) - copyBlt(backBuffer, frontBuffer, copyback); - } else { - // if we can't copy-back anything, modify the user's dirty - // region to make sure they redraw the whole buffer - newDirtyRegion.set(bounds); - mDirtyRegion.clear(); - Mutex::Autolock lock(mMutex); - for (size_t i=0 ; i= 0) { - Region& dirtyRegion(mSlots[backBufferSlot].dirtyRegion); - mDirtyRegion.subtract(dirtyRegion); - dirtyRegion = newDirtyRegion; - } - } - - mDirtyRegion.orSelf(newDirtyRegion); - if (inOutDirtyBounds) { - *inOutDirtyBounds = newDirtyRegion.getBounds(); - } - - void* vaddr; - status_t res = backBuffer->lockAsync( - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, - newDirtyRegion.bounds(), &vaddr, fenceFd); - - ALOGW_IF(res, "failed locking buffer (handle = %p)", - backBuffer->handle); - - if (res != 0) { - err = INVALID_OPERATION; - } else { - mLockedBuffer = backBuffer; - outBuffer->width = backBuffer->width; - outBuffer->height = backBuffer->height; - outBuffer->stride = backBuffer->stride; - outBuffer->format = backBuffer->format; - outBuffer->bits = vaddr; - } + if (err == NO_ERROR) { + other->w = uint32_t(outBuffer.width); + other->h = uint32_t(outBuffer.height); + other->s = uint32_t(outBuffer.stride); + other->usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN; + other->format = uint32_t(outBuffer.format); + other->bits = outBuffer.bits; } - return err; -} -status_t Surface::unlockAndPost() -{ - if (mLockedBuffer == 0) { - ALOGE("Surface::unlockAndPost failed, no locked buffer"); - return INVALID_OPERATION; + if (inOutDirtyRegion) { + inOutDirtyRegion->set( static_cast(temp) ); } - int fd = -1; - status_t err = mLockedBuffer->unlockAsync(&fd); - ALOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle); - - err = queueBuffer(mLockedBuffer.get(), fd); - ALOGE_IF(err, "queueBuffer (handle=%p) failed (%s)", - mLockedBuffer->handle, strerror(-err)); - - mPostedBuffer = mLockedBuffer; - mLockedBuffer = 0; return err; } +status_t Surface::unlockAndPost() { + return SurfaceTextureClient::unlockAndPost(); +} + +// ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceTextureClient.cpp android-platform-frameworks-native-21/libs/gui/SurfaceTextureClient.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceTextureClient.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SurfaceTextureClient.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,794 @@ +/* + * Copyright (C) 2010 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. + */ + +#define LOG_TAG "SurfaceTextureClient" +#define ATRACE_TAG ATRACE_TAG_GRAPHICS +//#define LOG_NDEBUG 0 + +#include + +#include +#include + +#include +#include +#include +#include + +#include + +namespace android { + +SurfaceTextureClient::SurfaceTextureClient( + const sp& surfaceTexture) +{ + SurfaceTextureClient::init(); + SurfaceTextureClient::setISurfaceTexture(surfaceTexture); +} + +// see SurfaceTextureClient.h +SurfaceTextureClient::SurfaceTextureClient(const + sp& surfaceTexture) +{ + SurfaceTextureClient::init(); + SurfaceTextureClient::setISurfaceTexture(surfaceTexture->getBufferQueue()); +} + +SurfaceTextureClient::SurfaceTextureClient() { + SurfaceTextureClient::init(); +} + +SurfaceTextureClient::~SurfaceTextureClient() { + if (mConnectedToCpu) { + SurfaceTextureClient::disconnect(NATIVE_WINDOW_API_CPU); + } +} + +void SurfaceTextureClient::init() { + // Initialize the ANativeWindow function pointers. + ANativeWindow::setSwapInterval = hook_setSwapInterval; + ANativeWindow::dequeueBuffer = hook_dequeueBuffer; + ANativeWindow::cancelBuffer = hook_cancelBuffer; + ANativeWindow::lockBuffer = hook_lockBuffer; + ANativeWindow::queueBuffer = hook_queueBuffer; + ANativeWindow::query = hook_query; + ANativeWindow::perform = hook_perform; + + const_cast(ANativeWindow::minSwapInterval) = 0; + const_cast(ANativeWindow::maxSwapInterval) = 1; + + mReqWidth = 0; + mReqHeight = 0; + mReqFormat = 0; + mReqUsage = 0; + mTimestamp = NATIVE_WINDOW_TIMESTAMP_AUTO; + mCrop.clear(); + mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; + mTransform = 0; + mDefaultWidth = 0; + mDefaultHeight = 0; + mUserWidth = 0; + mUserHeight = 0; + mTransformHint = 0; + mConsumerRunningBehind = false; + mConnectedToCpu = false; +} + +void SurfaceTextureClient::setISurfaceTexture( + const sp& surfaceTexture) +{ + mSurfaceTexture = surfaceTexture; +} + +sp SurfaceTextureClient::getISurfaceTexture() const { + return mSurfaceTexture; +} + +int SurfaceTextureClient::hook_setSwapInterval(ANativeWindow* window, int interval) { + SurfaceTextureClient* c = getSelf(window); + return c->setSwapInterval(interval); +} + +int SurfaceTextureClient::hook_dequeueBuffer(ANativeWindow* window, + ANativeWindowBuffer** buffer) { + SurfaceTextureClient* c = getSelf(window); + return c->dequeueBuffer(buffer); +} + +int SurfaceTextureClient::hook_cancelBuffer(ANativeWindow* window, + ANativeWindowBuffer* buffer) { + SurfaceTextureClient* c = getSelf(window); + return c->cancelBuffer(buffer); +} + +int SurfaceTextureClient::hook_lockBuffer(ANativeWindow* window, + ANativeWindowBuffer* buffer) { + SurfaceTextureClient* c = getSelf(window); + return c->lockBuffer(buffer); +} + +int SurfaceTextureClient::hook_queueBuffer(ANativeWindow* window, + ANativeWindowBuffer* buffer) { + SurfaceTextureClient* c = getSelf(window); + return c->queueBuffer(buffer); +} + +int SurfaceTextureClient::hook_query(const ANativeWindow* window, + int what, int* value) { + const SurfaceTextureClient* c = getSelf(window); + return c->query(what, value); +} + +int SurfaceTextureClient::hook_perform(ANativeWindow* window, int operation, ...) { + va_list args; + va_start(args, operation); + SurfaceTextureClient* c = getSelf(window); + return c->perform(operation, args); +} + +int SurfaceTextureClient::setSwapInterval(int interval) { + ATRACE_CALL(); + // EGL specification states: + // interval is silently clamped to minimum and maximum implementation + // dependent values before being stored. + // Although we don't have to, we apply the same logic here. + + if (interval < minSwapInterval) + interval = minSwapInterval; + + if (interval > maxSwapInterval) + interval = maxSwapInterval; + + status_t res = mSurfaceTexture->setSynchronousMode(interval ? true : false); + + return res; +} + +int SurfaceTextureClient::dequeueBuffer(android_native_buffer_t** buffer) { + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::dequeueBuffer"); + Mutex::Autolock lock(mMutex); + int buf = -1; + int reqW = mReqWidth ? mReqWidth : mUserWidth; + int reqH = mReqHeight ? mReqHeight : mUserHeight; + status_t result = mSurfaceTexture->dequeueBuffer(&buf, reqW, reqH, + mReqFormat, mReqUsage); + if (result < 0) { + ALOGV("dequeueBuffer: ISurfaceTexture::dequeueBuffer(%d, %d, %d, %d)" + "failed: %d", mReqWidth, mReqHeight, mReqFormat, mReqUsage, + result); + return result; + } + sp& gbuf(mSlots[buf].buffer); + if (result & ISurfaceTexture::RELEASE_ALL_BUFFERS) { + freeAllBuffers(); + } + + if ((result & ISurfaceTexture::BUFFER_NEEDS_REALLOCATION) || gbuf == 0) { + result = mSurfaceTexture->requestBuffer(buf, &gbuf); + if (result != NO_ERROR) { + ALOGE("dequeueBuffer: ISurfaceTexture::requestBuffer failed: %d", + result); + return result; + } + } + *buffer = gbuf.get(); + return OK; +} + +int SurfaceTextureClient::cancelBuffer(android_native_buffer_t* buffer) { + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::cancelBuffer"); + Mutex::Autolock lock(mMutex); + int i = getSlotFromBufferLocked(buffer); + if (i < 0) { + return i; + } + mSurfaceTexture->cancelBuffer(i); + return OK; +} + +int SurfaceTextureClient::getSlotFromBufferLocked( + android_native_buffer_t* buffer) const { + bool dumpedState = false; + for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { + if (mSlots[i].buffer != NULL && + mSlots[i].buffer->handle == buffer->handle) { + return i; + } + } + ALOGE("getSlotFromBufferLocked: unknown buffer: %p", buffer->handle); + return BAD_VALUE; +} + +int SurfaceTextureClient::lockBuffer(android_native_buffer_t* buffer) { + ALOGV("SurfaceTextureClient::lockBuffer"); + Mutex::Autolock lock(mMutex); + return OK; +} + +int SurfaceTextureClient::queueBuffer(android_native_buffer_t* buffer) { + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::queueBuffer"); + Mutex::Autolock lock(mMutex); + int64_t timestamp; + if (mTimestamp == NATIVE_WINDOW_TIMESTAMP_AUTO) { + timestamp = systemTime(SYSTEM_TIME_MONOTONIC); + ALOGV("SurfaceTextureClient::queueBuffer making up timestamp: %.2f ms", + timestamp / 1000000.f); + } else { + timestamp = mTimestamp; + } + int i = getSlotFromBufferLocked(buffer); + if (i < 0) { + return i; + } + + // Make sure the crop rectangle is entirely inside the buffer. + Rect crop; + mCrop.intersect(Rect(buffer->width, buffer->height), &crop); + + ISurfaceTexture::QueueBufferOutput output; + ISurfaceTexture::QueueBufferInput input(timestamp, crop, mScalingMode, + mTransform); + status_t err = mSurfaceTexture->queueBuffer(i, input, &output); + if (err != OK) { + ALOGE("queueBuffer: error queuing buffer to SurfaceTexture, %d", err); + } + uint32_t numPendingBuffers = 0; + output.deflate(&mDefaultWidth, &mDefaultHeight, &mTransformHint, + &numPendingBuffers); + + mConsumerRunningBehind = (numPendingBuffers >= 2); + + return err; +} + +int SurfaceTextureClient::query(int what, int* value) const { + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::query"); + { // scope for the lock + Mutex::Autolock lock(mMutex); + switch (what) { + case NATIVE_WINDOW_FORMAT: + if (mReqFormat) { + *value = mReqFormat; + return NO_ERROR; + } + break; + case NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER: { + sp composer( + ComposerService::getComposerService()); + if (composer->authenticateSurfaceTexture(mSurfaceTexture)) { + *value = 1; + } else { + *value = 0; + } + return NO_ERROR; + } + case NATIVE_WINDOW_CONCRETE_TYPE: + *value = NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT; + return NO_ERROR; + case NATIVE_WINDOW_DEFAULT_WIDTH: + *value = mUserWidth ? mUserWidth : mDefaultWidth; + return NO_ERROR; + case NATIVE_WINDOW_DEFAULT_HEIGHT: + *value = mUserHeight ? mUserHeight : mDefaultHeight; + return NO_ERROR; + case NATIVE_WINDOW_TRANSFORM_HINT: + *value = mTransformHint; + return NO_ERROR; + case NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND: { + status_t err = NO_ERROR; + if (!mConsumerRunningBehind) { + *value = 0; + } else { + err = mSurfaceTexture->query(what, value); + if (err == NO_ERROR) { + mConsumerRunningBehind = *value; + } + } + return err; + } + } + } + return mSurfaceTexture->query(what, value); +} + +int SurfaceTextureClient::perform(int operation, va_list args) +{ + int res = NO_ERROR; + switch (operation) { + case NATIVE_WINDOW_CONNECT: + // deprecated. must return NO_ERROR. + break; + case NATIVE_WINDOW_DISCONNECT: + // deprecated. must return NO_ERROR. + break; + case NATIVE_WINDOW_SET_USAGE: + res = dispatchSetUsage(args); + break; + case NATIVE_WINDOW_SET_CROP: + res = dispatchSetCrop(args); + break; + case NATIVE_WINDOW_SET_BUFFER_COUNT: + res = dispatchSetBufferCount(args); + break; + case NATIVE_WINDOW_SET_BUFFERS_GEOMETRY: + res = dispatchSetBuffersGeometry(args); + break; + case NATIVE_WINDOW_SET_BUFFERS_TRANSFORM: + res = dispatchSetBuffersTransform(args); + break; + case NATIVE_WINDOW_SET_BUFFERS_TIMESTAMP: + res = dispatchSetBuffersTimestamp(args); + break; + case NATIVE_WINDOW_SET_BUFFERS_DIMENSIONS: + res = dispatchSetBuffersDimensions(args); + break; + case NATIVE_WINDOW_SET_BUFFERS_USER_DIMENSIONS: + res = dispatchSetBuffersUserDimensions(args); + break; + case NATIVE_WINDOW_SET_BUFFERS_FORMAT: + res = dispatchSetBuffersFormat(args); + break; + case NATIVE_WINDOW_LOCK: + res = dispatchLock(args); + break; + case NATIVE_WINDOW_UNLOCK_AND_POST: + res = dispatchUnlockAndPost(args); + break; + case NATIVE_WINDOW_SET_SCALING_MODE: + res = dispatchSetScalingMode(args); + break; + case NATIVE_WINDOW_API_CONNECT: + res = dispatchConnect(args); + break; + case NATIVE_WINDOW_API_DISCONNECT: + res = dispatchDisconnect(args); + break; + default: + res = NAME_NOT_FOUND; + break; + } + return res; +} + +int SurfaceTextureClient::dispatchConnect(va_list args) { + int api = va_arg(args, int); + return connect(api); +} + +int SurfaceTextureClient::dispatchDisconnect(va_list args) { + int api = va_arg(args, int); + return disconnect(api); +} + +int SurfaceTextureClient::dispatchSetUsage(va_list args) { + int usage = va_arg(args, int); + return setUsage(usage); +} + +int SurfaceTextureClient::dispatchSetCrop(va_list args) { + android_native_rect_t const* rect = va_arg(args, android_native_rect_t*); + return setCrop(reinterpret_cast(rect)); +} + +int SurfaceTextureClient::dispatchSetBufferCount(va_list args) { + size_t bufferCount = va_arg(args, size_t); + return setBufferCount(bufferCount); +} + +int SurfaceTextureClient::dispatchSetBuffersGeometry(va_list args) { + int w = va_arg(args, int); + int h = va_arg(args, int); + int f = va_arg(args, int); + int err = setBuffersDimensions(w, h); + if (err != 0) { + return err; + } + return setBuffersFormat(f); +} + +int SurfaceTextureClient::dispatchSetBuffersDimensions(va_list args) { + int w = va_arg(args, int); + int h = va_arg(args, int); + return setBuffersDimensions(w, h); +} + +int SurfaceTextureClient::dispatchSetBuffersUserDimensions(va_list args) { + int w = va_arg(args, int); + int h = va_arg(args, int); + return setBuffersUserDimensions(w, h); +} + +int SurfaceTextureClient::dispatchSetBuffersFormat(va_list args) { + int f = va_arg(args, int); + return setBuffersFormat(f); +} + +int SurfaceTextureClient::dispatchSetScalingMode(va_list args) { + int m = va_arg(args, int); + return setScalingMode(m); +} + +int SurfaceTextureClient::dispatchSetBuffersTransform(va_list args) { + int transform = va_arg(args, int); + return setBuffersTransform(transform); +} + +int SurfaceTextureClient::dispatchSetBuffersTimestamp(va_list args) { + int64_t timestamp = va_arg(args, int64_t); + return setBuffersTimestamp(timestamp); +} + +int SurfaceTextureClient::dispatchLock(va_list args) { + ANativeWindow_Buffer* outBuffer = va_arg(args, ANativeWindow_Buffer*); + ARect* inOutDirtyBounds = va_arg(args, ARect*); + return lock(outBuffer, inOutDirtyBounds); +} + +int SurfaceTextureClient::dispatchUnlockAndPost(va_list args) { + return unlockAndPost(); +} + + +int SurfaceTextureClient::connect(int api) { + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::connect"); + Mutex::Autolock lock(mMutex); + ISurfaceTexture::QueueBufferOutput output; + int err = mSurfaceTexture->connect(api, &output); + if (err == NO_ERROR) { + uint32_t numPendingBuffers = 0; + output.deflate(&mDefaultWidth, &mDefaultHeight, &mTransformHint, + &numPendingBuffers); + mConsumerRunningBehind = (numPendingBuffers >= 2); + } + if (!err && api == NATIVE_WINDOW_API_CPU) { + mConnectedToCpu = true; + } + return err; +} + +int SurfaceTextureClient::disconnect(int api) { + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::disconnect"); + Mutex::Autolock lock(mMutex); + freeAllBuffers(); + int err = mSurfaceTexture->disconnect(api); + if (!err) { + mReqFormat = 0; + mReqWidth = 0; + mReqHeight = 0; + mReqUsage = 0; + mCrop.clear(); + mScalingMode = NATIVE_WINDOW_SCALING_MODE_FREEZE; + mTransform = 0; + if (api == NATIVE_WINDOW_API_CPU) { + mConnectedToCpu = false; + } + } + return err; +} + +int SurfaceTextureClient::setUsage(uint32_t reqUsage) +{ + ALOGV("SurfaceTextureClient::setUsage"); + Mutex::Autolock lock(mMutex); + mReqUsage = reqUsage; + return OK; +} + +int SurfaceTextureClient::setCrop(Rect const* rect) +{ + ATRACE_CALL(); + + Rect realRect; + if (rect == NULL || rect->isEmpty()) { + realRect.clear(); + } else { + realRect = *rect; + } + + ALOGV("SurfaceTextureClient::setCrop rect=[%d %d %d %d]", + realRect.left, realRect.top, realRect.right, realRect.bottom); + + Mutex::Autolock lock(mMutex); + mCrop = realRect; + return NO_ERROR; +} + +int SurfaceTextureClient::setBufferCount(int bufferCount) +{ + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::setBufferCount"); + Mutex::Autolock lock(mMutex); + + status_t err = mSurfaceTexture->setBufferCount(bufferCount); + ALOGE_IF(err, "ISurfaceTexture::setBufferCount(%d) returned %s", + bufferCount, strerror(-err)); + + if (err == NO_ERROR) { + freeAllBuffers(); + } + + return err; +} + +int SurfaceTextureClient::setBuffersDimensions(int w, int h) +{ + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::setBuffersDimensions"); + + if (w<0 || h<0) + return BAD_VALUE; + + if ((w && !h) || (!w && h)) + return BAD_VALUE; + + Mutex::Autolock lock(mMutex); + mReqWidth = w; + mReqHeight = h; + return NO_ERROR; +} + +int SurfaceTextureClient::setBuffersUserDimensions(int w, int h) +{ + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::setBuffersUserDimensions"); + + if (w<0 || h<0) + return BAD_VALUE; + + if ((w && !h) || (!w && h)) + return BAD_VALUE; + + Mutex::Autolock lock(mMutex); + mUserWidth = w; + mUserHeight = h; + return NO_ERROR; +} + +int SurfaceTextureClient::setBuffersFormat(int format) +{ + ALOGV("SurfaceTextureClient::setBuffersFormat"); + + if (format<0) + return BAD_VALUE; + + Mutex::Autolock lock(mMutex); + mReqFormat = format; + return NO_ERROR; +} + +int SurfaceTextureClient::setScalingMode(int mode) +{ + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::setScalingMode(%d)", mode); + + switch (mode) { + case NATIVE_WINDOW_SCALING_MODE_FREEZE: + case NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW: + case NATIVE_WINDOW_SCALING_MODE_SCALE_CROP: + break; + default: + ALOGE("unknown scaling mode: %d", mode); + return BAD_VALUE; + } + + Mutex::Autolock lock(mMutex); + mScalingMode = mode; + return NO_ERROR; +} + +int SurfaceTextureClient::setBuffersTransform(int transform) +{ + ATRACE_CALL(); + ALOGV("SurfaceTextureClient::setBuffersTransform"); + Mutex::Autolock lock(mMutex); + mTransform = transform; + return NO_ERROR; +} + +int SurfaceTextureClient::setBuffersTimestamp(int64_t timestamp) +{ + ALOGV("SurfaceTextureClient::setBuffersTimestamp"); + Mutex::Autolock lock(mMutex); + mTimestamp = timestamp; + return NO_ERROR; +} + +void SurfaceTextureClient::freeAllBuffers() { + for (int i = 0; i < NUM_BUFFER_SLOTS; i++) { + mSlots[i].buffer = 0; + } +} + +// ---------------------------------------------------------------------- +// the lock/unlock APIs must be used from the same thread + +static status_t copyBlt( + const sp& dst, + const sp& src, + const Region& reg) +{ + // src and dst with, height and format must be identical. no verification + // is done here. + status_t err; + uint8_t const * src_bits = NULL; + err = src->lock(GRALLOC_USAGE_SW_READ_OFTEN, reg.bounds(), (void**)&src_bits); + ALOGE_IF(err, "error locking src buffer %s", strerror(-err)); + + uint8_t* dst_bits = NULL; + err = dst->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, reg.bounds(), (void**)&dst_bits); + ALOGE_IF(err, "error locking dst buffer %s", strerror(-err)); + + Region::const_iterator head(reg.begin()); + Region::const_iterator tail(reg.end()); + if (head != tail && src_bits && dst_bits) { + const size_t bpp = bytesPerPixel(src->format); + const size_t dbpr = dst->stride * bpp; + const size_t sbpr = src->stride * bpp; + + while (head != tail) { + const Rect& r(*head++); + ssize_t h = r.height(); + if (h <= 0) continue; + size_t size = r.width() * bpp; + uint8_t const * s = src_bits + (r.left + src->stride * r.top) * bpp; + uint8_t * d = dst_bits + (r.left + dst->stride * r.top) * bpp; + if (dbpr==sbpr && size==sbpr) { + size *= h; + h = 1; + } + do { + memcpy(d, s, size); + d += dbpr; + s += sbpr; + } while (--h > 0); + } + } + + if (src_bits) + src->unlock(); + + if (dst_bits) + dst->unlock(); + + return err; +} + +// ---------------------------------------------------------------------------- + +status_t SurfaceTextureClient::lock( + ANativeWindow_Buffer* outBuffer, ARect* inOutDirtyBounds) +{ + if (mLockedBuffer != 0) { + ALOGE("Surface::lock failed, already locked"); + return INVALID_OPERATION; + } + + if (!mConnectedToCpu) { + int err = SurfaceTextureClient::connect(NATIVE_WINDOW_API_CPU); + if (err) { + return err; + } + // we're intending to do software rendering from this point + setUsage(GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN); + } + + ANativeWindowBuffer* out; + status_t err = dequeueBuffer(&out); + ALOGE_IF(err, "dequeueBuffer failed (%s)", strerror(-err)); + if (err == NO_ERROR) { + sp backBuffer(GraphicBuffer::getSelf(out)); + err = lockBuffer(backBuffer.get()); + ALOGE_IF(err, "lockBuffer (handle=%p) failed (%s)", + backBuffer->handle, strerror(-err)); + if (err == NO_ERROR) { + const Rect bounds(backBuffer->width, backBuffer->height); + + Region newDirtyRegion; + if (inOutDirtyBounds) { + newDirtyRegion.set(static_cast(*inOutDirtyBounds)); + newDirtyRegion.andSelf(bounds); + } else { + newDirtyRegion.set(bounds); + } + + // figure out if we can copy the frontbuffer back + const sp& frontBuffer(mPostedBuffer); + const bool canCopyBack = (frontBuffer != 0 && + backBuffer->width == frontBuffer->width && + backBuffer->height == frontBuffer->height && + backBuffer->format == frontBuffer->format); + + if (canCopyBack) { + // copy the area that is invalid and not repainted this round + const Region copyback(mDirtyRegion.subtract(newDirtyRegion)); + if (!copyback.isEmpty()) + copyBlt(backBuffer, frontBuffer, copyback); + } else { + // if we can't copy-back anything, modify the user's dirty + // region to make sure they redraw the whole buffer + newDirtyRegion.set(bounds); + mDirtyRegion.clear(); + Mutex::Autolock lock(mMutex); + for (size_t i=0 ; i= 0) { + Region& dirtyRegion(mSlots[backBufferSlot].dirtyRegion); + mDirtyRegion.subtract(dirtyRegion); + dirtyRegion = newDirtyRegion; + } + } + + mDirtyRegion.orSelf(newDirtyRegion); + if (inOutDirtyBounds) { + *inOutDirtyBounds = newDirtyRegion.getBounds(); + } + + void* vaddr; + status_t res = backBuffer->lock( + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, + newDirtyRegion.bounds(), &vaddr); + + ALOGW_IF(res, "failed locking buffer (handle = %p)", + backBuffer->handle); + + if (res != 0) { + err = INVALID_OPERATION; + } else { + mLockedBuffer = backBuffer; + outBuffer->width = backBuffer->width; + outBuffer->height = backBuffer->height; + outBuffer->stride = backBuffer->stride; + outBuffer->format = backBuffer->format; + outBuffer->bits = vaddr; + } + } + } + return err; +} + +status_t SurfaceTextureClient::unlockAndPost() +{ + if (mLockedBuffer == 0) { + ALOGE("Surface::unlockAndPost failed, no locked buffer"); + return INVALID_OPERATION; + } + + status_t err = mLockedBuffer->unlock(); + ALOGE_IF(err, "failed unlocking buffer (%p)", mLockedBuffer->handle); + + err = queueBuffer(mLockedBuffer.get()); + ALOGE_IF(err, "queueBuffer (handle=%p) failed (%s)", + mLockedBuffer->handle, strerror(-err)); + + mPostedBuffer = mLockedBuffer; + mLockedBuffer = 0; + return err; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceTexture.cpp android-platform-frameworks-native-21/libs/gui/SurfaceTexture.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SurfaceTexture.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SurfaceTexture.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,864 @@ +/* + * Copyright (C) 2010 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. + */ + +#define LOG_TAG "SurfaceTexture" +#define ATRACE_TAG ATRACE_TAG_GRAPHICS +//#define LOG_NDEBUG 0 + +#define GL_GLEXT_PROTOTYPES +#define EGL_EGLEXT_PROTOTYPES + +#include +#include +#include +#include + +#include + +#include +#include +#include +#include + +#include + +#include +#include +#include + +// This compile option makes SurfaceTexture use the EGL_KHR_fence_sync extension +// to synchronize access to the buffers. It will cause dequeueBuffer to stall, +// waiting for the GL reads for the buffer being dequeued to complete before +// allowing the buffer to be dequeued. +#ifdef USE_FENCE_SYNC +#ifdef ALLOW_DEQUEUE_CURRENT_BUFFER +#error "USE_FENCE_SYNC and ALLOW_DEQUEUE_CURRENT_BUFFER are incompatible" +#endif +#endif + +// Macros for including the SurfaceTexture name in log messages +#define ST_LOGV(x, ...) ALOGV("[%s] "x, mName.string(), ##__VA_ARGS__) +#define ST_LOGD(x, ...) ALOGD("[%s] "x, mName.string(), ##__VA_ARGS__) +#define ST_LOGI(x, ...) ALOGI("[%s] "x, mName.string(), ##__VA_ARGS__) +#define ST_LOGW(x, ...) ALOGW("[%s] "x, mName.string(), ##__VA_ARGS__) +#define ST_LOGE(x, ...) ALOGE("[%s] "x, mName.string(), ##__VA_ARGS__) + +namespace android { + +// Transform matrices +static float mtxIdentity[16] = { + 1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 0, 0, 0, 1, +}; +static float mtxFlipH[16] = { + -1, 0, 0, 0, + 0, 1, 0, 0, + 0, 0, 1, 0, + 1, 0, 0, 1, +}; +static float mtxFlipV[16] = { + 1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, 1, 0, + 0, 1, 0, 1, +}; +static float mtxRot90[16] = { + 0, 1, 0, 0, + -1, 0, 0, 0, + 0, 0, 1, 0, + 1, 0, 0, 1, +}; +static float mtxRot180[16] = { + -1, 0, 0, 0, + 0, -1, 0, 0, + 0, 0, 1, 0, + 1, 1, 0, 1, +}; +static float mtxRot270[16] = { + 0, -1, 0, 0, + 1, 0, 0, 0, + 0, 0, 1, 0, + 0, 1, 0, 1, +}; + +static void mtxMul(float out[16], const float a[16], const float b[16]); + +// Get an ID that's unique within this process. +static int32_t createProcessUniqueId() { + static volatile int32_t globalCounter = 0; + return android_atomic_inc(&globalCounter); +} + +SurfaceTexture::SurfaceTexture(GLuint tex, bool allowSynchronousMode, + GLenum texTarget, bool useFenceSync, const sp &bufferQueue) : + mCurrentTransform(0), + mCurrentTimestamp(0), + mFilteringEnabled(true), + mTexName(tex), +#ifdef USE_FENCE_SYNC + mUseFenceSync(useFenceSync), +#else + mUseFenceSync(false), +#endif + mTexTarget(texTarget), + mEglDisplay(EGL_NO_DISPLAY), + mEglContext(EGL_NO_CONTEXT), + mAbandoned(false), + mCurrentTexture(BufferQueue::INVALID_BUFFER_SLOT), + mAttached(true) +{ + // Choose a name using the PID and a process-unique ID. + mName = String8::format("unnamed-%d-%d", getpid(), createProcessUniqueId()); + ST_LOGV("SurfaceTexture"); + if (bufferQueue == 0) { + ST_LOGV("Creating a new BufferQueue"); + mBufferQueue = new BufferQueue(allowSynchronousMode); + } + else { + mBufferQueue = bufferQueue; + } + + memcpy(mCurrentTransformMatrix, mtxIdentity, + sizeof(mCurrentTransformMatrix)); + + // Note that we can't create an sp<...>(this) in a ctor that will not keep a + // reference once the ctor ends, as that would cause the refcount of 'this' + // dropping to 0 at the end of the ctor. Since all we need is a wp<...> + // that's what we create. + wp listener; + sp proxy; + listener = static_cast(this); + proxy = new BufferQueue::ProxyConsumerListener(listener); + + status_t err = mBufferQueue->consumerConnect(proxy); + if (err != NO_ERROR) { + ST_LOGE("SurfaceTexture: error connecting to BufferQueue: %s (%d)", + strerror(-err), err); + } else { + mBufferQueue->setConsumerName(mName); + mBufferQueue->setConsumerUsageBits(DEFAULT_USAGE_FLAGS); + } +} + +SurfaceTexture::~SurfaceTexture() { + ST_LOGV("~SurfaceTexture"); + + abandon(); +} + +status_t SurfaceTexture::setBufferCountServer(int bufferCount) { + Mutex::Autolock lock(mMutex); + return mBufferQueue->setBufferCountServer(bufferCount); +} + + +status_t SurfaceTexture::setDefaultBufferSize(uint32_t w, uint32_t h) +{ + Mutex::Autolock lock(mMutex); + mDefaultWidth = w; + mDefaultHeight = h; + return mBufferQueue->setDefaultBufferSize(w, h); +} + +status_t SurfaceTexture::updateTexImage() { + return SurfaceTexture::updateTexImage(NULL); +} + +status_t SurfaceTexture::updateTexImage(BufferRejecter* rejecter) { + ATRACE_CALL(); + ST_LOGV("updateTexImage"); + Mutex::Autolock lock(mMutex); + + status_t err = NO_ERROR; + + if (mAbandoned) { + ST_LOGE("updateTexImage: SurfaceTexture is abandoned!"); + return NO_INIT; + } + + if (!mAttached) { + ST_LOGE("updateTexImage: SurfaceTexture is not attached to an OpenGL " + "ES context"); + return INVALID_OPERATION; + } + + EGLDisplay dpy = eglGetCurrentDisplay(); + EGLContext ctx = eglGetCurrentContext(); + + if ((mEglDisplay != dpy && mEglDisplay != EGL_NO_DISPLAY) || + dpy == EGL_NO_DISPLAY) { + ST_LOGE("updateTexImage: invalid current EGLDisplay"); + return INVALID_OPERATION; + } + + if ((mEglContext != ctx && mEglContext != EGL_NO_CONTEXT) || + ctx == EGL_NO_CONTEXT) { + ST_LOGE("updateTexImage: invalid current EGLContext"); + return INVALID_OPERATION; + } + + mEglDisplay = dpy; + mEglContext = ctx; + + BufferQueue::BufferItem item; + + // In asynchronous mode the list is guaranteed to be one buffer + // deep, while in synchronous mode we use the oldest buffer. + err = mBufferQueue->acquireBuffer(&item); + if (err == NO_ERROR) { + int buf = item.mBuf; + // This buffer was newly allocated, so we need to clean up on our side + if (item.mGraphicBuffer != NULL) { + mEGLSlots[buf].mGraphicBuffer = 0; + if (mEGLSlots[buf].mEglImage != EGL_NO_IMAGE_KHR) { + eglDestroyImageKHR(dpy, mEGLSlots[buf].mEglImage); + mEGLSlots[buf].mEglImage = EGL_NO_IMAGE_KHR; + } + mEGLSlots[buf].mGraphicBuffer = item.mGraphicBuffer; + } + + // we call the rejecter here, in case the caller has a reason to + // not accept this buffer. this is used by SurfaceFlinger to + // reject buffers which have the wrong size + if (rejecter && rejecter->reject(mEGLSlots[buf].mGraphicBuffer, item)) { + mBufferQueue->releaseBuffer(buf, dpy, mEGLSlots[buf].mFence); + mEGLSlots[buf].mFence = EGL_NO_SYNC_KHR; + glBindTexture(mTexTarget, mTexName); + return NO_ERROR; + } + + // Update the GL texture object. We may have to do this even when + // item.mGraphicBuffer == NULL, if we destroyed the EGLImage when + // detaching from a context but the buffer has not been re-allocated. + EGLImageKHR image = mEGLSlots[buf].mEglImage; + if (image == EGL_NO_IMAGE_KHR) { + if (mEGLSlots[buf].mGraphicBuffer == NULL) { + ST_LOGE("updateTexImage: buffer at slot %d is null", buf); + err = BAD_VALUE; + } else { + image = createImage(dpy, mEGLSlots[buf].mGraphicBuffer); + mEGLSlots[buf].mEglImage = image; + if (image == EGL_NO_IMAGE_KHR) { + // NOTE: if dpy was invalid, createImage() is guaranteed to + // fail. so we'd end up here. + err = UNKNOWN_ERROR; + } + } + } + + if (err == NO_ERROR) { + GLint error; + while ((error = glGetError()) != GL_NO_ERROR) { + ST_LOGW("updateTexImage: clearing GL error: %#04x", error); + } + + glBindTexture(mTexTarget, mTexName); + glEGLImageTargetTexture2DOES(mTexTarget, (GLeglImageOES)image); + + while ((error = glGetError()) != GL_NO_ERROR) { + ST_LOGE("updateTexImage: error binding external texture image %p " + "(slot %d): %#04x", image, buf, error); + err = UNKNOWN_ERROR; + } + + if (err == NO_ERROR) { + err = syncForReleaseLocked(dpy); + } + } + + if (err != NO_ERROR) { + // Release the buffer we just acquired. It's not safe to + // release the old buffer, so instead we just drop the new frame. + mBufferQueue->releaseBuffer(buf, dpy, mEGLSlots[buf].mFence); + mEGLSlots[buf].mFence = EGL_NO_SYNC_KHR; + return err; + } + + ST_LOGV("updateTexImage: (slot=%d buf=%p) -> (slot=%d buf=%p)", + mCurrentTexture, + mCurrentTextureBuf != NULL ? mCurrentTextureBuf->handle : 0, + buf, item.mGraphicBuffer != NULL ? item.mGraphicBuffer->handle : 0); + + // release old buffer + if (mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) { + status_t status = mBufferQueue->releaseBuffer(mCurrentTexture, dpy, + mEGLSlots[mCurrentTexture].mFence); + + mEGLSlots[mCurrentTexture].mFence = EGL_NO_SYNC_KHR; + if (status == BufferQueue::STALE_BUFFER_SLOT) { + freeBufferLocked(mCurrentTexture); + } else if (status != NO_ERROR) { + ST_LOGE("updateTexImage: released invalid buffer"); + err = status; + } + } + + // Update the SurfaceTexture state. + mCurrentTexture = buf; + mCurrentTextureBuf = mEGLSlots[buf].mGraphicBuffer; + mCurrentCrop = item.mCrop; + mCurrentTransform = item.mTransform; + mCurrentScalingMode = item.mScalingMode; + mCurrentTimestamp = item.mTimestamp; + computeCurrentTransformMatrix(); + } else { + if (err < 0) { + ALOGE("updateTexImage failed on acquire %d", err); + } + // We always bind the texture even if we don't update its contents. + glBindTexture(mTexTarget, mTexName); + return OK; + } + + return err; +} + +status_t SurfaceTexture::detachFromContext() { + ATRACE_CALL(); + ST_LOGV("detachFromContext"); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("detachFromContext: abandoned SurfaceTexture"); + return NO_INIT; + } + + if (!mAttached) { + ST_LOGE("detachFromContext: SurfaceTexture is not attached to a " + "context"); + return INVALID_OPERATION; + } + + EGLDisplay dpy = eglGetCurrentDisplay(); + EGLContext ctx = eglGetCurrentContext(); + + if (mEglDisplay != dpy && mEglDisplay != EGL_NO_DISPLAY) { + ST_LOGE("detachFromContext: invalid current EGLDisplay"); + return INVALID_OPERATION; + } + + if (mEglContext != ctx && mEglContext != EGL_NO_CONTEXT) { + ST_LOGE("detachFromContext: invalid current EGLContext"); + return INVALID_OPERATION; + } + + if (dpy != EGL_NO_DISPLAY && ctx != EGL_NO_CONTEXT) { + status_t err = syncForReleaseLocked(dpy); + if (err != OK) { + return err; + } + + glDeleteTextures(1, &mTexName); + } + + // Because we're giving up the EGLDisplay we need to free all the EGLImages + // that are associated with it. They'll be recreated when the + // SurfaceTexture gets attached to a new OpenGL ES context (and thus gets a + // new EGLDisplay). + for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { + EGLImageKHR img = mEGLSlots[i].mEglImage; + if (img != EGL_NO_IMAGE_KHR) { + eglDestroyImageKHR(mEglDisplay, img); + mEGLSlots[i].mEglImage = EGL_NO_IMAGE_KHR; + } + } + + mEglDisplay = EGL_NO_DISPLAY; + mEglContext = EGL_NO_CONTEXT; + mAttached = false; + + return OK; +} + +status_t SurfaceTexture::attachToContext(GLuint tex) { + ATRACE_CALL(); + ST_LOGV("attachToContext"); + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + ST_LOGE("attachToContext: abandoned SurfaceTexture"); + return NO_INIT; + } + + if (mAttached) { + ST_LOGE("attachToContext: SurfaceTexture is already attached to a " + "context"); + return INVALID_OPERATION; + } + + EGLDisplay dpy = eglGetCurrentDisplay(); + EGLContext ctx = eglGetCurrentContext(); + + if (dpy == EGL_NO_DISPLAY) { + ST_LOGE("attachToContext: invalid current EGLDisplay"); + return INVALID_OPERATION; + } + + if (ctx == EGL_NO_CONTEXT) { + ST_LOGE("attachToContext: invalid current EGLContext"); + return INVALID_OPERATION; + } + + // We need to bind the texture regardless of whether there's a current + // buffer. + glBindTexture(mTexTarget, tex); + + if (mCurrentTextureBuf != NULL) { + // The EGLImageKHR that was associated with the slot was destroyed when + // the SurfaceTexture was detached from the old context, so we need to + // recreate it here. + EGLImageKHR image = createImage(dpy, mCurrentTextureBuf); + if (image == EGL_NO_IMAGE_KHR) { + return UNKNOWN_ERROR; + } + + // Attach the current buffer to the GL texture. + glEGLImageTargetTexture2DOES(mTexTarget, (GLeglImageOES)image); + + GLint error; + status_t err = OK; + while ((error = glGetError()) != GL_NO_ERROR) { + ST_LOGE("attachToContext: error binding external texture image %p " + "(slot %d): %#04x", image, mCurrentTexture, error); + err = UNKNOWN_ERROR; + } + + // We destroy the EGLImageKHR here because the current buffer may no + // longer be associated with one of the buffer slots, so we have + // nowhere to to store it. If the buffer is still associated with a + // slot then another EGLImageKHR will be created next time that buffer + // gets acquired in updateTexImage. + eglDestroyImageKHR(dpy, image); + + if (err != OK) { + return err; + } + } + + mEglDisplay = dpy; + mEglContext = ctx; + mTexName = tex; + mAttached = true; + + return OK; +} + +status_t SurfaceTexture::syncForReleaseLocked(EGLDisplay dpy) { + ST_LOGV("syncForReleaseLocked"); + + if (mUseFenceSync && mCurrentTexture != BufferQueue::INVALID_BUFFER_SLOT) { + EGLSyncKHR fence = mEGLSlots[mCurrentTexture].mFence; + if (fence != EGL_NO_SYNC_KHR) { + // There is already a fence for the current slot. We need to wait + // on that before replacing it with another fence to ensure that all + // outstanding buffer accesses have completed before the producer + // accesses it. + EGLint result = eglClientWaitSyncKHR(dpy, fence, 0, 1000000000); + if (result == EGL_FALSE) { + ST_LOGE("syncForReleaseLocked: error waiting for previous " + "fence: %#x", eglGetError()); + return UNKNOWN_ERROR; + } else if (result == EGL_TIMEOUT_EXPIRED_KHR) { + ST_LOGE("syncForReleaseLocked: timeout waiting for previous " + "fence"); + return TIMED_OUT; + } + eglDestroySyncKHR(dpy, fence); + } + + // Create a fence for the outstanding accesses in the current OpenGL ES + // context. + fence = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); + if (fence == EGL_NO_SYNC_KHR) { + ST_LOGE("syncForReleaseLocked: error creating fence: %#x", + eglGetError()); + return UNKNOWN_ERROR; + } + glFlush(); + mEGLSlots[mCurrentTexture].mFence = fence; + } + + return OK; +} + +bool SurfaceTexture::isExternalFormat(uint32_t format) +{ + switch (format) { + // supported YUV formats + case HAL_PIXEL_FORMAT_YV12: + // Legacy/deprecated YUV formats + case HAL_PIXEL_FORMAT_YCbCr_422_SP: + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + case HAL_PIXEL_FORMAT_YCbCr_422_I: + return true; + } + + // Any OEM format needs to be considered + if (format>=0x100 && format<=0x1FF) + return true; + + return false; +} + +GLenum SurfaceTexture::getCurrentTextureTarget() const { + return mTexTarget; +} + +void SurfaceTexture::getTransformMatrix(float mtx[16]) { + Mutex::Autolock lock(mMutex); + memcpy(mtx, mCurrentTransformMatrix, sizeof(mCurrentTransformMatrix)); +} + +void SurfaceTexture::setFilteringEnabled(bool enabled) { + Mutex::Autolock lock(mMutex); + bool needsRecompute = mFilteringEnabled != enabled; + mFilteringEnabled = enabled; + if (needsRecompute) { + computeCurrentTransformMatrix(); + } +} + +void SurfaceTexture::computeCurrentTransformMatrix() { + ST_LOGV("computeCurrentTransformMatrix"); + + float xform[16]; + for (int i = 0; i < 16; i++) { + xform[i] = mtxIdentity[i]; + } + if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) { + float result[16]; + mtxMul(result, xform, mtxFlipH); + for (int i = 0; i < 16; i++) { + xform[i] = result[i]; + } + } + if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) { + float result[16]; + mtxMul(result, xform, mtxFlipV); + for (int i = 0; i < 16; i++) { + xform[i] = result[i]; + } + } + if (mCurrentTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { + float result[16]; + mtxMul(result, xform, mtxRot90); + for (int i = 0; i < 16; i++) { + xform[i] = result[i]; + } + } + + sp& buf(mCurrentTextureBuf); + Rect cropRect = mCurrentCrop; + float tx = 0.0f, ty = 0.0f, sx = 1.0f, sy = 1.0f; + float bufferWidth = buf->getWidth(); + float bufferHeight = buf->getHeight(); + if (!cropRect.isEmpty()) { + float shrinkAmount = 0.0f; + if (mFilteringEnabled) { + // In order to prevent bilinear sampling beyond the edge of the + // crop rectangle we may need to shrink it by 2 texels in each + // dimension. Normally this would just need to take 1/2 a texel + // off each end, but because the chroma channels of YUV420 images + // are subsampled we may need to shrink the crop region by a whole + // texel on each side. + switch (buf->getPixelFormat()) { + case PIXEL_FORMAT_RGBA_8888: + case PIXEL_FORMAT_RGBX_8888: + case PIXEL_FORMAT_RGB_888: + case PIXEL_FORMAT_RGB_565: + case PIXEL_FORMAT_BGRA_8888: + case PIXEL_FORMAT_RGBA_5551: + case PIXEL_FORMAT_RGBA_4444: + // We know there's no subsampling of any channels, so we + // only need to shrink by a half a pixel. + shrinkAmount = 0.5; + + default: + // If we don't recognize the format, we must assume the + // worst case (that we care about), which is YUV420. + shrinkAmount = 1.0; + } + } + + // Only shrink the dimensions that are not the size of the buffer. + if (cropRect.width() < bufferWidth) { + tx = (float(cropRect.left) + shrinkAmount) / bufferWidth; + sx = (float(cropRect.width()) - (2.0f * shrinkAmount)) / + bufferWidth; + } + if (cropRect.height() < bufferHeight) { + ty = (float(bufferHeight - cropRect.bottom) + shrinkAmount) / + bufferHeight; + sy = (float(cropRect.height()) - (2.0f * shrinkAmount)) / + bufferHeight; + } + } + float crop[16] = { + sx, 0, 0, 0, + 0, sy, 0, 0, + 0, 0, 1, 0, + tx, ty, 0, 1, + }; + + float mtxBeforeFlipV[16]; + mtxMul(mtxBeforeFlipV, crop, xform); + + // SurfaceFlinger expects the top of its window textures to be at a Y + // coordinate of 0, so SurfaceTexture must behave the same way. We don't + // want to expose this to applications, however, so we must add an + // additional vertical flip to the transform after all the other transforms. + mtxMul(mCurrentTransformMatrix, mtxFlipV, mtxBeforeFlipV); +} + +nsecs_t SurfaceTexture::getTimestamp() { + ST_LOGV("getTimestamp"); + Mutex::Autolock lock(mMutex); + return mCurrentTimestamp; +} + +void SurfaceTexture::setFrameAvailableListener( + const sp& listener) { + ST_LOGV("setFrameAvailableListener"); + Mutex::Autolock lock(mMutex); + mFrameAvailableListener = listener; +} + +EGLImageKHR SurfaceTexture::createImage(EGLDisplay dpy, + const sp& graphicBuffer) { + EGLClientBuffer cbuf = (EGLClientBuffer)graphicBuffer->getNativeBuffer(); + EGLint attrs[] = { + EGL_IMAGE_PRESERVED_KHR, EGL_TRUE, + EGL_NONE, + }; + EGLImageKHR image = eglCreateImageKHR(dpy, EGL_NO_CONTEXT, + EGL_NATIVE_BUFFER_ANDROID, cbuf, attrs); + if (image == EGL_NO_IMAGE_KHR) { + EGLint error = eglGetError(); + ST_LOGE("error creating EGLImage: %#x", error); + } + return image; +} + +sp SurfaceTexture::getCurrentBuffer() const { + Mutex::Autolock lock(mMutex); + return mCurrentTextureBuf; +} + +Rect SurfaceTexture::getCurrentCrop() const { + Mutex::Autolock lock(mMutex); + + Rect outCrop = mCurrentCrop; + if (mCurrentScalingMode == NATIVE_WINDOW_SCALING_MODE_SCALE_CROP) { + int32_t newWidth = mCurrentCrop.width(); + int32_t newHeight = mCurrentCrop.height(); + + if (newWidth * mDefaultHeight > newHeight * mDefaultWidth) { + newWidth = newHeight * mDefaultWidth / mDefaultHeight; + ST_LOGV("too wide: newWidth = %d", newWidth); + } else if (newWidth * mDefaultHeight < newHeight * mDefaultWidth) { + newHeight = newWidth * mDefaultHeight / mDefaultWidth; + ST_LOGV("too tall: newHeight = %d", newHeight); + } + + // The crop is too wide + if (newWidth < mCurrentCrop.width()) { + int32_t dw = (newWidth - mCurrentCrop.width())/2; + outCrop.left -=dw; + outCrop.right += dw; + // The crop is too tall + } else if (newHeight < mCurrentCrop.height()) { + int32_t dh = (newHeight - mCurrentCrop.height())/2; + outCrop.top -= dh; + outCrop.bottom += dh; + } + + ST_LOGV("getCurrentCrop final crop [%d,%d,%d,%d]", + outCrop.left, outCrop.top, + outCrop.right,outCrop.bottom); + } + + return outCrop; +} + +uint32_t SurfaceTexture::getCurrentTransform() const { + Mutex::Autolock lock(mMutex); + return mCurrentTransform; +} + +uint32_t SurfaceTexture::getCurrentScalingMode() const { + Mutex::Autolock lock(mMutex); + return mCurrentScalingMode; +} + +bool SurfaceTexture::isSynchronousMode() const { + Mutex::Autolock lock(mMutex); + return mBufferQueue->isSynchronousMode(); +} + +void SurfaceTexture::freeBufferLocked(int slotIndex) { + ST_LOGV("freeBufferLocked: slotIndex=%d", slotIndex); + mEGLSlots[slotIndex].mGraphicBuffer = 0; + if (slotIndex == mCurrentTexture) { + mCurrentTexture = BufferQueue::INVALID_BUFFER_SLOT; + } + EGLImageKHR img = mEGLSlots[slotIndex].mEglImage; + if (img != EGL_NO_IMAGE_KHR) { + ST_LOGV("destroying EGLImage dpy=%p img=%p", mEglDisplay, img); + eglDestroyImageKHR(mEglDisplay, img); + } + mEGLSlots[slotIndex].mEglImage = EGL_NO_IMAGE_KHR; +} + +void SurfaceTexture::abandon() { + ST_LOGV("abandon"); + Mutex::Autolock lock(mMutex); + + if (!mAbandoned) { + mAbandoned = true; + mCurrentTextureBuf.clear(); + + // destroy all egl buffers + for (int i =0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { + freeBufferLocked(i); + } + + // disconnect from the BufferQueue + mBufferQueue->consumerDisconnect(); + mBufferQueue.clear(); + } +} + +void SurfaceTexture::setName(const String8& name) { + Mutex::Autolock _l(mMutex); + mName = name; + mBufferQueue->setConsumerName(name); +} + +status_t SurfaceTexture::setDefaultBufferFormat(uint32_t defaultFormat) { + Mutex::Autolock lock(mMutex); + return mBufferQueue->setDefaultBufferFormat(defaultFormat); +} + +status_t SurfaceTexture::setConsumerUsageBits(uint32_t usage) { + Mutex::Autolock lock(mMutex); + usage |= DEFAULT_USAGE_FLAGS; + return mBufferQueue->setConsumerUsageBits(usage); +} + +status_t SurfaceTexture::setTransformHint(uint32_t hint) { + Mutex::Autolock lock(mMutex); + return mBufferQueue->setTransformHint(hint); +} + +// Used for refactoring BufferQueue from SurfaceTexture +// Should not be in final interface once users of SurfaceTexture are clean up. +status_t SurfaceTexture::setSynchronousMode(bool enabled) { + Mutex::Autolock lock(mMutex); + return mBufferQueue->setSynchronousMode(enabled); +} + +// Used for refactoring, should not be in final interface +sp SurfaceTexture::getBufferQueue() const { + Mutex::Autolock lock(mMutex); + return mBufferQueue; +} + +void SurfaceTexture::onFrameAvailable() { + ST_LOGV("onFrameAvailable"); + + sp listener; + { // scope for the lock + Mutex::Autolock lock(mMutex); + listener = mFrameAvailableListener; + } + + if (listener != NULL) { + ST_LOGV("actually calling onFrameAvailable"); + listener->onFrameAvailable(); + } +} + +void SurfaceTexture::onBuffersReleased() { + ST_LOGV("onBuffersReleased"); + + Mutex::Autolock lock(mMutex); + + if (mAbandoned) { + // Nothing to do if we're already abandoned. + return; + } + + uint32_t mask = 0; + mBufferQueue->getReleasedBuffers(&mask); + for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { + if (mask & (1 << i)) { + freeBufferLocked(i); + } + } +} + +void SurfaceTexture::dump(String8& result) const +{ + char buffer[1024]; + dump(result, "", buffer, 1024); +} + +void SurfaceTexture::dump(String8& result, const char* prefix, + char* buffer, size_t SIZE) const +{ + Mutex::Autolock _l(mMutex); + snprintf(buffer, SIZE, "%smTexName=%d, mAbandoned=%d\n", prefix, mTexName, + int(mAbandoned)); + result.append(buffer); + + snprintf(buffer, SIZE, + "%snext : {crop=[%d,%d,%d,%d], transform=0x%02x, current=%d}\n", + prefix, mCurrentCrop.left, + mCurrentCrop.top, mCurrentCrop.right, mCurrentCrop.bottom, + mCurrentTransform, mCurrentTexture + ); + result.append(buffer); + + if (!mAbandoned) { + mBufferQueue->dump(result, prefix, buffer, SIZE); + } +} + +static void mtxMul(float out[16], const float a[16], const float b[16]) { + out[0] = a[0]*b[0] + a[4]*b[1] + a[8]*b[2] + a[12]*b[3]; + out[1] = a[1]*b[0] + a[5]*b[1] + a[9]*b[2] + a[13]*b[3]; + out[2] = a[2]*b[0] + a[6]*b[1] + a[10]*b[2] + a[14]*b[3]; + out[3] = a[3]*b[0] + a[7]*b[1] + a[11]*b[2] + a[15]*b[3]; + + out[4] = a[0]*b[4] + a[4]*b[5] + a[8]*b[6] + a[12]*b[7]; + out[5] = a[1]*b[4] + a[5]*b[5] + a[9]*b[6] + a[13]*b[7]; + out[6] = a[2]*b[4] + a[6]*b[5] + a[10]*b[6] + a[14]*b[7]; + out[7] = a[3]*b[4] + a[7]*b[5] + a[11]*b[6] + a[15]*b[7]; + + out[8] = a[0]*b[8] + a[4]*b[9] + a[8]*b[10] + a[12]*b[11]; + out[9] = a[1]*b[8] + a[5]*b[9] + a[9]*b[10] + a[13]*b[11]; + out[10] = a[2]*b[8] + a[6]*b[9] + a[10]*b[10] + a[14]*b[11]; + out[11] = a[3]*b[8] + a[7]*b[9] + a[11]*b[10] + a[15]*b[11]; + + out[12] = a[0]*b[12] + a[4]*b[13] + a[8]*b[14] + a[12]*b[15]; + out[13] = a[1]*b[12] + a[5]*b[13] + a[9]*b[14] + a[13]*b[15]; + out[14] = a[2]*b[12] + a[6]*b[13] + a[10]*b[14] + a[14]*b[15]; + out[15] = a[3]*b[12] + a[7]*b[13] + a[11]*b[14] + a[15]*b[15]; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/SyncFeatures.cpp android-platform-frameworks-native-21/libs/gui/SyncFeatures.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/SyncFeatures.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/SyncFeatures.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* - ** Copyright 2013, 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. - */ - -#define LOG_TAG "GLConsumer" - -#define EGL_EGLEXT_PROTOTYPES - -#include -#include - -#include -#include -#include - -#include - -EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); - -namespace android { - -ANDROID_SINGLETON_STATIC_INSTANCE(SyncFeatures); - -SyncFeatures::SyncFeatures() : Singleton(), - mHasNativeFenceSync(false), - mHasFenceSync(false), - mHasWaitSync(false) { - EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); - // This can only be called after EGL has been initialized; otherwise the - // check below will abort. - const char* exts = eglQueryStringImplementationANDROID(dpy, EGL_EXTENSIONS); - LOG_ALWAYS_FATAL_IF(exts == NULL, "eglQueryStringImplementationANDROID failed"); - if (strstr(exts, "EGL_ANDROID_native_fence_sync")) { - // This makes GLConsumer use the EGL_ANDROID_native_fence_sync - // extension to create Android native fences to signal when all - // GLES reads for a given buffer have completed. - mHasNativeFenceSync = true; - } - if (strstr(exts, "EGL_KHR_fence_sync")) { - mHasFenceSync = true; - } - if (strstr(exts, "EGL_KHR_wait_sync")) { - mHasWaitSync = true; - } - mString.append("[using:"); - if (useNativeFenceSync()) { - mString.append(" EGL_ANDROID_native_fence_sync"); - } - if (useFenceSync()) { - mString.append(" EGL_KHR_fence_sync"); - } - if (useWaitSync()) { - mString.append(" EGL_KHR_wait_sync"); - } - mString.append("]"); -} - -bool SyncFeatures::useNativeFenceSync() const { - // EGL_ANDROID_native_fence_sync is not compatible with using the - // EGL_KHR_fence_sync extension for the same purpose. - return mHasNativeFenceSync; -} -bool SyncFeatures::useFenceSync() const { -#ifdef DONT_USE_FENCE_SYNC - // on some devices it's better to not use EGL_KHR_fence_sync - // even if they have it - return false; -#else - // currently we shall only attempt to use EGL_KHR_fence_sync if - // USE_FENCE_SYNC is set in our makefile - return !mHasNativeFenceSync && mHasFenceSync; -#endif -} -bool SyncFeatures::useWaitSync() const { - return (useNativeFenceSync() || useFenceSync()) && mHasWaitSync; -} - -String8 SyncFeatures::toString() const { - return mString; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/Android.mk android-platform-frameworks-native-21/libs/gui/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,43 +1,32 @@ # Build the unit tests, LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_CLANG := true - -LOCAL_MODULE := libgui_test +LOCAL_MODULE := SurfaceTexture_test LOCAL_MODULE_TAGS := tests LOCAL_SRC_FILES := \ - BufferQueue_test.cpp \ - CpuConsumer_test.cpp \ - FillBuffer.cpp \ - GLTest.cpp \ - IGraphicBufferProducer_test.cpp \ - MultiTextureConsumer_test.cpp \ - SRGB_test.cpp \ - StreamSplitter_test.cpp \ - SurfaceTextureClient_test.cpp \ - SurfaceTextureFBO_test.cpp \ - SurfaceTextureGLThreadToGL_test.cpp \ - SurfaceTextureGLToGL_test.cpp \ - SurfaceTextureGL_test.cpp \ - SurfaceTextureMultiContextGL_test.cpp \ Surface_test.cpp \ - TextureRenderer.cpp \ + SurfaceTextureClient_test.cpp \ + SurfaceTexture_test.cpp \ LOCAL_SHARED_LIBRARIES := \ libEGL \ - libGLESv1_CM \ libGLESv2 \ libbinder \ libcutils \ libgui \ - libsync \ + libstlport \ libui \ libutils \ +LOCAL_C_INCLUDES := \ + bionic \ + bionic/libstdc++/include \ + external/gtest/include \ + external/stlport/stlport \ + # Build the binary to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE) # to integrate with auto-test framework. include $(BUILD_NATIVE_TEST) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/BufferQueue_test.cpp android-platform-frameworks-native-21/libs/gui/tests/BufferQueue_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/BufferQueue_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/BufferQueue_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,443 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "BufferQueue_test" -//#define LOG_NDEBUG 0 - -#include "DummyConsumer.h" - -#include -#include -#include - -#include - -#include -#include -#include - -#include -#include - -#include - -namespace android { - -class BufferQueueTest : public ::testing::Test { - -public: -protected: - BufferQueueTest() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("Begin test: %s.%s", testInfo->test_case_name(), - testInfo->name()); - } - - ~BufferQueueTest() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("End test: %s.%s", testInfo->test_case_name(), - testInfo->name()); - } - - void GetMinUndequeuedBufferCount(int* bufferCount) { - ASSERT_TRUE(bufferCount != NULL); - ASSERT_EQ(OK, mProducer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, - bufferCount)); - ASSERT_GE(*bufferCount, 0); - } - - void createBufferQueue() { - BufferQueue::createBufferQueue(&mProducer, &mConsumer); - } - - sp mProducer; - sp mConsumer; -}; - -static const uint32_t TEST_DATA = 0x12345678u; - -// XXX: Tests that fork a process to hold the BufferQueue must run before tests -// that use a local BufferQueue, or else Binder will get unhappy -TEST_F(BufferQueueTest, BufferQueueInAnotherProcess) { - const String16 PRODUCER_NAME = String16("BQTestProducer"); - const String16 CONSUMER_NAME = String16("BQTestConsumer"); - - pid_t forkPid = fork(); - ASSERT_NE(forkPid, -1); - - if (forkPid == 0) { - // Child process - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - sp serviceManager = defaultServiceManager(); - serviceManager->addService(PRODUCER_NAME, IInterface::asBinder(producer)); - serviceManager->addService(CONSUMER_NAME, IInterface::asBinder(consumer)); - ProcessState::self()->startThreadPool(); - IPCThreadState::self()->joinThreadPool(); - LOG_ALWAYS_FATAL("Shouldn't be here"); - } - - sp serviceManager = defaultServiceManager(); - sp binderProducer = - serviceManager->getService(PRODUCER_NAME); - mProducer = interface_cast(binderProducer); - EXPECT_TRUE(mProducer != NULL); - sp binderConsumer = - serviceManager->getService(CONSUMER_NAME); - mConsumer = interface_cast(binderConsumer); - EXPECT_TRUE(mConsumer != NULL); - - sp dc(new DummyConsumer); - ASSERT_EQ(OK, mConsumer->consumerConnect(dc, false)); - IGraphicBufferProducer::QueueBufferOutput output; - ASSERT_EQ(OK, - mProducer->connect(NULL, NATIVE_WINDOW_API_CPU, false, &output)); - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buffer)); - - uint32_t* dataIn; - ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN, - reinterpret_cast(&dataIn))); - *dataIn = TEST_DATA; - ASSERT_EQ(OK, buffer->unlock()); - - IGraphicBufferProducer::QueueBufferInput input(0, false, - HAL_DATASPACE_UNKNOWN, Rect(0, 0, 1, 1), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, Fence::NO_FENCE); - ASSERT_EQ(OK, mProducer->queueBuffer(slot, input, &output)); - - BufferItem item; - ASSERT_EQ(OK, mConsumer->acquireBuffer(&item, 0)); - - uint32_t* dataOut; - ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, - reinterpret_cast(&dataOut))); - ASSERT_EQ(*dataOut, TEST_DATA); - ASSERT_EQ(OK, item.mGraphicBuffer->unlock()); -} - -TEST_F(BufferQueueTest, AcquireBuffer_ExceedsMaxAcquireCount_Fails) { - createBufferQueue(); - sp dc(new DummyConsumer); - mConsumer->consumerConnect(dc, false); - IGraphicBufferProducer::QueueBufferOutput qbo; - mProducer->connect(new DummyProducerListener, NATIVE_WINDOW_API_CPU, false, - &qbo); - mProducer->setBufferCount(4); - - int slot; - sp fence; - sp buf; - IGraphicBufferProducer::QueueBufferInput qbi(0, false, - HAL_DATASPACE_UNKNOWN, Rect(0, 0, 1, 1), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, Fence::NO_FENCE); - BufferItem item; - - for (int i = 0; i < 2; i++) { - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 1, 1, 0, - GRALLOC_USAGE_SW_READ_OFTEN)); - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buf)); - ASSERT_EQ(OK, mProducer->queueBuffer(slot, qbi, &qbo)); - ASSERT_EQ(OK, mConsumer->acquireBuffer(&item, 0)); - } - - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 1, 1, 0, - GRALLOC_USAGE_SW_READ_OFTEN)); - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buf)); - ASSERT_EQ(OK, mProducer->queueBuffer(slot, qbi, &qbo)); - - // Acquire the third buffer, which should fail. - ASSERT_EQ(INVALID_OPERATION, mConsumer->acquireBuffer(&item, 0)); -} - -TEST_F(BufferQueueTest, SetMaxAcquiredBufferCountWithIllegalValues_ReturnsError) { - createBufferQueue(); - sp dc(new DummyConsumer); - mConsumer->consumerConnect(dc, false); - - int minBufferCount; - ASSERT_NO_FATAL_FAILURE(GetMinUndequeuedBufferCount(&minBufferCount)); - EXPECT_EQ(BAD_VALUE, mConsumer->setMaxAcquiredBufferCount( - minBufferCount - 1)); - - EXPECT_EQ(BAD_VALUE, mConsumer->setMaxAcquiredBufferCount(0)); - EXPECT_EQ(BAD_VALUE, mConsumer->setMaxAcquiredBufferCount(-3)); - EXPECT_EQ(BAD_VALUE, mConsumer->setMaxAcquiredBufferCount( - BufferQueue::MAX_MAX_ACQUIRED_BUFFERS+1)); - EXPECT_EQ(BAD_VALUE, mConsumer->setMaxAcquiredBufferCount(100)); -} - -TEST_F(BufferQueueTest, SetMaxAcquiredBufferCountWithLegalValues_Succeeds) { - createBufferQueue(); - sp dc(new DummyConsumer); - mConsumer->consumerConnect(dc, false); - - int minBufferCount; - ASSERT_NO_FATAL_FAILURE(GetMinUndequeuedBufferCount(&minBufferCount)); - - EXPECT_EQ(OK, mConsumer->setMaxAcquiredBufferCount(1)); - EXPECT_EQ(OK, mConsumer->setMaxAcquiredBufferCount(2)); - EXPECT_EQ(OK, mConsumer->setMaxAcquiredBufferCount(minBufferCount)); - EXPECT_EQ(OK, mConsumer->setMaxAcquiredBufferCount( - BufferQueue::MAX_MAX_ACQUIRED_BUFFERS)); -} - -TEST_F(BufferQueueTest, DetachAndReattachOnProducerSide) { - createBufferQueue(); - sp dc(new DummyConsumer); - ASSERT_EQ(OK, mConsumer->consumerConnect(dc, false)); - IGraphicBufferProducer::QueueBufferOutput output; - ASSERT_EQ(OK, mProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, false, &output)); - - ASSERT_EQ(BAD_VALUE, mProducer->detachBuffer(-1)); // Index too low - ASSERT_EQ(BAD_VALUE, mProducer->detachBuffer( - BufferQueueDefs::NUM_BUFFER_SLOTS)); // Index too high - ASSERT_EQ(BAD_VALUE, mProducer->detachBuffer(0)); // Not dequeued - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(BAD_VALUE, mProducer->detachBuffer(slot)); // Not requested - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buffer)); - ASSERT_EQ(OK, mProducer->detachBuffer(slot)); - ASSERT_EQ(BAD_VALUE, mProducer->detachBuffer(slot)); // Not dequeued - - sp safeToClobberBuffer; - // Can no longer request buffer from this slot - ASSERT_EQ(BAD_VALUE, mProducer->requestBuffer(slot, &safeToClobberBuffer)); - - uint32_t* dataIn; - ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN, - reinterpret_cast(&dataIn))); - *dataIn = TEST_DATA; - ASSERT_EQ(OK, buffer->unlock()); - - int newSlot; - ASSERT_EQ(BAD_VALUE, mProducer->attachBuffer(NULL, safeToClobberBuffer)); - ASSERT_EQ(BAD_VALUE, mProducer->attachBuffer(&newSlot, NULL)); - - ASSERT_EQ(OK, mProducer->attachBuffer(&newSlot, buffer)); - IGraphicBufferProducer::QueueBufferInput input(0, false, - HAL_DATASPACE_UNKNOWN, Rect(0, 0, 1, 1), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, Fence::NO_FENCE); - ASSERT_EQ(OK, mProducer->queueBuffer(newSlot, input, &output)); - - BufferItem item; - ASSERT_EQ(OK, mConsumer->acquireBuffer(&item, static_cast(0))); - - uint32_t* dataOut; - ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, - reinterpret_cast(&dataOut))); - ASSERT_EQ(*dataOut, TEST_DATA); - ASSERT_EQ(OK, item.mGraphicBuffer->unlock()); -} - -TEST_F(BufferQueueTest, DetachAndReattachOnConsumerSide) { - createBufferQueue(); - sp dc(new DummyConsumer); - ASSERT_EQ(OK, mConsumer->consumerConnect(dc, false)); - IGraphicBufferProducer::QueueBufferOutput output; - ASSERT_EQ(OK, mProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, false, &output)); - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buffer)); - IGraphicBufferProducer::QueueBufferInput input(0, false, - HAL_DATASPACE_UNKNOWN, Rect(0, 0, 1, 1), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, Fence::NO_FENCE); - ASSERT_EQ(OK, mProducer->queueBuffer(slot, input, &output)); - - ASSERT_EQ(BAD_VALUE, mConsumer->detachBuffer(-1)); // Index too low - ASSERT_EQ(BAD_VALUE, mConsumer->detachBuffer( - BufferQueueDefs::NUM_BUFFER_SLOTS)); // Index too high - ASSERT_EQ(BAD_VALUE, mConsumer->detachBuffer(0)); // Not acquired - - BufferItem item; - ASSERT_EQ(OK, mConsumer->acquireBuffer(&item, static_cast(0))); - - ASSERT_EQ(OK, mConsumer->detachBuffer(item.mBuf)); - ASSERT_EQ(BAD_VALUE, mConsumer->detachBuffer(item.mBuf)); // Not acquired - - uint32_t* dataIn; - ASSERT_EQ(OK, item.mGraphicBuffer->lock( - GraphicBuffer::USAGE_SW_WRITE_OFTEN, - reinterpret_cast(&dataIn))); - *dataIn = TEST_DATA; - ASSERT_EQ(OK, item.mGraphicBuffer->unlock()); - - int newSlot; - sp safeToClobberBuffer; - ASSERT_EQ(BAD_VALUE, mConsumer->attachBuffer(NULL, safeToClobberBuffer)); - ASSERT_EQ(BAD_VALUE, mConsumer->attachBuffer(&newSlot, NULL)); - ASSERT_EQ(OK, mConsumer->attachBuffer(&newSlot, item.mGraphicBuffer)); - - ASSERT_EQ(OK, mConsumer->releaseBuffer(newSlot, 0, EGL_NO_DISPLAY, - EGL_NO_SYNC_KHR, Fence::NO_FENCE)); - - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buffer)); - - uint32_t* dataOut; - ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, - reinterpret_cast(&dataOut))); - ASSERT_EQ(*dataOut, TEST_DATA); - ASSERT_EQ(OK, buffer->unlock()); -} - -TEST_F(BufferQueueTest, MoveFromConsumerToProducer) { - createBufferQueue(); - sp dc(new DummyConsumer); - ASSERT_EQ(OK, mConsumer->consumerConnect(dc, false)); - IGraphicBufferProducer::QueueBufferOutput output; - ASSERT_EQ(OK, mProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, false, &output)); - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buffer)); - - uint32_t* dataIn; - ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN, - reinterpret_cast(&dataIn))); - *dataIn = TEST_DATA; - ASSERT_EQ(OK, buffer->unlock()); - - IGraphicBufferProducer::QueueBufferInput input(0, false, - HAL_DATASPACE_UNKNOWN, Rect(0, 0, 1, 1), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, Fence::NO_FENCE); - ASSERT_EQ(OK, mProducer->queueBuffer(slot, input, &output)); - - BufferItem item; - ASSERT_EQ(OK, mConsumer->acquireBuffer(&item, static_cast(0))); - ASSERT_EQ(OK, mConsumer->detachBuffer(item.mBuf)); - - int newSlot; - ASSERT_EQ(OK, mProducer->attachBuffer(&newSlot, item.mGraphicBuffer)); - ASSERT_EQ(OK, mProducer->queueBuffer(newSlot, input, &output)); - ASSERT_EQ(OK, mConsumer->acquireBuffer(&item, static_cast(0))); - - uint32_t* dataOut; - ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, - reinterpret_cast(&dataOut))); - ASSERT_EQ(*dataOut, TEST_DATA); - ASSERT_EQ(OK, item.mGraphicBuffer->unlock()); -} - -TEST_F(BufferQueueTest, TestDisallowingAllocation) { - createBufferQueue(); - sp dc(new DummyConsumer); - ASSERT_EQ(OK, mConsumer->consumerConnect(dc, true)); - IGraphicBufferProducer::QueueBufferOutput output; - ASSERT_EQ(OK, mProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, true, &output)); - - static const uint32_t WIDTH = 320; - static const uint32_t HEIGHT = 240; - - ASSERT_EQ(OK, mConsumer->setDefaultBufferSize(WIDTH, HEIGHT)); - - int slot; - sp fence; - sp buffer; - // This should return an error since it would require an allocation - ASSERT_EQ(OK, mProducer->allowAllocation(false)); - ASSERT_EQ(WOULD_BLOCK, mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, - 0, GRALLOC_USAGE_SW_WRITE_OFTEN)); - - // This should succeed, now that we've lifted the prohibition - ASSERT_EQ(OK, mProducer->allowAllocation(true)); - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - - // Release the previous buffer back to the BufferQueue - mProducer->cancelBuffer(slot, fence); - - // This should fail since we're requesting a different size - ASSERT_EQ(OK, mProducer->allowAllocation(false)); - ASSERT_EQ(WOULD_BLOCK, mProducer->dequeueBuffer(&slot, &fence, false, - WIDTH * 2, HEIGHT * 2, 0, GRALLOC_USAGE_SW_WRITE_OFTEN)); -} - -TEST_F(BufferQueueTest, TestGenerationNumbers) { - createBufferQueue(); - sp dc(new DummyConsumer); - ASSERT_EQ(OK, mConsumer->consumerConnect(dc, true)); - IGraphicBufferProducer::QueueBufferOutput output; - ASSERT_EQ(OK, mProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, true, &output)); - - ASSERT_EQ(OK, mProducer->setGenerationNumber(1)); - - // Get one buffer to play with - int slot; - sp fence; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, 0)); - - sp buffer; - ASSERT_EQ(OK, mProducer->requestBuffer(slot, &buffer)); - - // Ensure that the generation number we set propagates to allocated buffers - ASSERT_EQ(1U, buffer->getGenerationNumber()); - - ASSERT_EQ(OK, mProducer->detachBuffer(slot)); - - ASSERT_EQ(OK, mProducer->setGenerationNumber(2)); - - // These should fail, since we've changed the generation number on the queue - int outSlot; - ASSERT_EQ(BAD_VALUE, mProducer->attachBuffer(&outSlot, buffer)); - ASSERT_EQ(BAD_VALUE, mConsumer->attachBuffer(&outSlot, buffer)); - - buffer->setGenerationNumber(2); - - // This should succeed now that we've changed the buffer's generation number - ASSERT_EQ(OK, mProducer->attachBuffer(&outSlot, buffer)); - - ASSERT_EQ(OK, mProducer->detachBuffer(outSlot)); - - // This should also succeed with the new generation number - ASSERT_EQ(OK, mConsumer->attachBuffer(&outSlot, buffer)); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/CpuConsumer_test.cpp android-platform-frameworks-native-21/libs/gui/tests/CpuConsumer_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/CpuConsumer_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/CpuConsumer_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,759 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "CpuConsumer_test" -//#define LOG_NDEBUG 0 -//#define LOG_NNDEBUG 0 - -#ifdef LOG_NNDEBUG -#define ALOGVV(...) ALOGV(__VA_ARGS__) -#else -#define ALOGVV(...) ((void)0) -#endif - -#include -#include -#include -#include -#include -#include -#include -#include - -#define CPU_CONSUMER_TEST_FORMAT_RAW 0 -#define CPU_CONSUMER_TEST_FORMAT_Y8 0 -#define CPU_CONSUMER_TEST_FORMAT_Y16 0 -#define CPU_CONSUMER_TEST_FORMAT_RGBA_8888 1 - -namespace android { - -struct CpuConsumerTestParams { - uint32_t width; - uint32_t height; - int maxLockedBuffers; - PixelFormat format; -}; - -::std::ostream& operator<<(::std::ostream& os, const CpuConsumerTestParams& p) { - return os << "[ (" << p.width << ", " << p.height << "), B:" - << p.maxLockedBuffers << ", F:0x" - << ::std::hex << p.format << "]"; -} - -class CpuConsumerTest : public ::testing::TestWithParam { -protected: - - virtual void SetUp() { - const ::testing::TestInfo* const test_info = - ::testing::UnitTest::GetInstance()->current_test_info(); - CpuConsumerTestParams params = GetParam(); - ALOGV("** Starting test %s (%d x %d, %d, 0x%x)", - test_info->name(), - params.width, params.height, - params.maxLockedBuffers, params.format); - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - mCC = new CpuConsumer(consumer, params.maxLockedBuffers); - String8 name("CpuConsumer_Under_Test"); - mCC->setName(name); - mSTC = new Surface(producer); - mANW = mSTC; - } - - virtual void TearDown() { - mANW.clear(); - mSTC.clear(); - mCC.clear(); - } - - class FrameWaiter : public CpuConsumer::FrameAvailableListener { - public: - FrameWaiter(): - mPendingFrames(0) { - } - - void waitForFrame() { - Mutex::Autolock lock(mMutex); - while (mPendingFrames == 0) { - mCondition.wait(mMutex); - } - mPendingFrames--; - } - - virtual void onFrameAvailable(const BufferItem&) { - Mutex::Autolock lock(mMutex); - mPendingFrames++; - mCondition.signal(); - } - - int mPendingFrames; - Mutex mMutex; - Condition mCondition; - }; - - // Note that SurfaceTexture will lose the notifications - // onBuffersReleased and onFrameAvailable as there is currently - // no way to forward the events. This DisconnectWaiter will not let the - // disconnect finish until finishDisconnect() is called. It will - // also block until a disconnect is called - class DisconnectWaiter : public BufferQueue::ConsumerListener { - public: - DisconnectWaiter () : - mWaitForDisconnect(false), - mPendingFrames(0) { - } - - void waitForFrame() { - Mutex::Autolock lock(mMutex); - while (mPendingFrames == 0) { - mFrameCondition.wait(mMutex); - } - mPendingFrames--; - } - - virtual void onFrameAvailable(const BufferItem&) { - Mutex::Autolock lock(mMutex); - mPendingFrames++; - mFrameCondition.signal(); - } - - virtual void onBuffersReleased() { - Mutex::Autolock lock(mMutex); - while (!mWaitForDisconnect) { - mDisconnectCondition.wait(mMutex); - } - } - - void finishDisconnect() { - Mutex::Autolock lock(mMutex); - mWaitForDisconnect = true; - mDisconnectCondition.signal(); - } - - private: - Mutex mMutex; - - bool mWaitForDisconnect; - Condition mDisconnectCondition; - - int mPendingFrames; - Condition mFrameCondition; - }; - - sp mCC; - sp mSTC; - sp mANW; -}; - -#define ASSERT_NO_ERROR(err, msg) \ - ASSERT_EQ(NO_ERROR, err) << msg << strerror(-err) - -void checkPixel(const CpuConsumer::LockedBuffer &buf, - uint32_t x, uint32_t y, uint32_t r, uint32_t g=0, uint32_t b=0) { - // Ignores components that don't exist for given pixel - switch(buf.format) { - case HAL_PIXEL_FORMAT_RAW16: { - String8 msg; - uint16_t *bPtr = (uint16_t*)buf.data; - bPtr += y * buf.stride + x; - // GRBG Bayer mosaic; only check the matching channel - switch( ((y & 1) << 1) | (x & 1) ) { - case 0: // G - case 3: // G - EXPECT_EQ(g, *bPtr); - break; - case 1: // R - EXPECT_EQ(r, *bPtr); - break; - case 2: // B - EXPECT_EQ(b, *bPtr); - break; - } - break; - } - // ignores g,b - case HAL_PIXEL_FORMAT_Y8: { - uint8_t *bPtr = (uint8_t*)buf.data; - bPtr += y * buf.stride + x; - EXPECT_EQ(r, *bPtr) << "at x = " << x << " y = " << y; - break; - } - // ignores g,b - case HAL_PIXEL_FORMAT_Y16: { - // stride is in pixels, not in bytes - uint16_t *bPtr = ((uint16_t*)buf.data) + y * buf.stride + x; - - EXPECT_EQ(r, *bPtr) << "at x = " << x << " y = " << y; - break; - } - case HAL_PIXEL_FORMAT_RGBA_8888: { - const int bytesPerPixel = 4; - uint8_t *bPtr = (uint8_t*)buf.data; - bPtr += (y * buf.stride + x) * bytesPerPixel; - - EXPECT_EQ(r, bPtr[0]) << "at x = " << x << " y = " << y; - EXPECT_EQ(g, bPtr[1]) << "at x = " << x << " y = " << y; - EXPECT_EQ(b, bPtr[2]) << "at x = " << x << " y = " << y; - break; - } - default: { - ADD_FAILURE() << "Unknown format for check:" << buf.format; - break; - } - } -} - -// Fill a YV12 buffer with a multi-colored checkerboard pattern -void fillYV12Buffer(uint8_t* buf, int w, int h, int stride); - -// Fill a Y8/Y16 buffer with a multi-colored checkerboard pattern -template // T == uint8_t or uint16_t -void fillGreyscaleBuffer(T* buf, int w, int h, int stride, int bpp) { - const int blockWidth = w > 16 ? w / 16 : 1; - const int blockHeight = h > 16 ? h / 16 : 1; - const int yuvTexOffsetY = 0; - - ASSERT_TRUE(bpp == 8 || bpp == 16); - ASSERT_TRUE(sizeof(T)*8 == bpp); - - // stride is in pixels, not in bytes - int yuvTexStrideY = stride; - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - int parityX = (x / blockWidth) & 1; - int parityY = (y / blockHeight) & 1; - T intensity = (parityX ^ parityY) ? 63 : 191; - buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity; - } - } -} - -inline uint8_t chooseColorRgba8888(int blockX, int blockY, uint8_t channel) { - const int colorVariations = 3; - uint8_t color = ((blockX % colorVariations) + (blockY % colorVariations)) - % (colorVariations) == channel ? 191: 63; - - return color; -} - -// Fill a RGBA8888 buffer with a multi-colored checkerboard pattern -void fillRgba8888Buffer(uint8_t* buf, int w, int h, int stride) -{ - const int blockWidth = w > 16 ? w / 16 : 1; - const int blockHeight = h > 16 ? h / 16 : 1; - const int bytesPerPixel = 4; - - // stride is in pixels, not in bytes - for (int x = 0; x < w; ++x) { - for (int y = 0; y < h; ++y) { - int blockX = (x / blockWidth); - int blockY = (y / blockHeight); - - uint8_t r = chooseColorRgba8888(blockX, blockY, 0); - uint8_t g = chooseColorRgba8888(blockX, blockY, 1); - uint8_t b = chooseColorRgba8888(blockX, blockY, 2); - - buf[(y*stride + x)*bytesPerPixel + 0] = r; - buf[(y*stride + x)*bytesPerPixel + 1] = g; - buf[(y*stride + x)*bytesPerPixel + 2] = b; - buf[(y*stride + x)*bytesPerPixel + 3] = 255; - } - } -} - -// Fill a RAW sensor buffer with a multi-colored checkerboard pattern. -// Assumes GRBG mosaic ordering. Result should be a grid in a 2x2 pattern -// of [ R, B; G, W] -void fillBayerRawBuffer(uint8_t* buf, int w, int h, int stride) { - ALOGVV("fillBayerRawBuffer: %p with %d x %d, stride %d", buf, w, h ,stride); - // Blocks need to be even-width/height, aim for 8-wide otherwise - const int blockWidth = (w > 16 ? w / 8 : 2) & ~0x1; - const int blockHeight = (h > 16 ? h / 8 : 2) & ~0x1; - for (int y = 0; y < h; y+=2) { - uint16_t *bPtr1 = ((uint16_t*)buf) + stride*y; - uint16_t *bPtr2 = bPtr1 + stride; - for (int x = 0; x < w; x+=2) { - int blockX = (x / blockWidth ) & 1; - int blockY = (y / blockHeight) & 1; - unsigned short r = (blockX == blockY) ? 1000 : 200; - unsigned short g = blockY ? 1000: 200; - unsigned short b = blockX ? 1000: 200; - // GR row - *bPtr1++ = g; - *bPtr1++ = r; - // BG row - *bPtr2++ = b; - *bPtr2++ = g; - } - } - -} - -template // uint8_t or uint16_t -void checkGreyscaleBuffer(const CpuConsumer::LockedBuffer &buf) { - uint32_t w = buf.width; - uint32_t h = buf.height; - const int blockWidth = w > 16 ? w / 16 : 1; - const int blockHeight = h > 16 ? h / 16 : 1; - const int blockRows = h / blockHeight; - const int blockCols = w / blockWidth; - - // Top-left square is bright - checkPixel(buf, 0, 0, 191); - checkPixel(buf, 1, 0, 191); - checkPixel(buf, 0, 1, 191); - checkPixel(buf, 1, 1, 191); - - // One-right square is dark - checkPixel(buf, blockWidth, 0, 63); - checkPixel(buf, blockWidth + 1, 0, 63); - checkPixel(buf, blockWidth, 1, 63); - checkPixel(buf, blockWidth + 1, 1, 63); - - // One-down square is dark - checkPixel(buf, 0, blockHeight, 63); - checkPixel(buf, 1, blockHeight, 63); - checkPixel(buf, 0, blockHeight + 1, 63); - checkPixel(buf, 1, blockHeight + 1, 63); - - // One-diag square is bright - checkPixel(buf, blockWidth, blockHeight, 191); - checkPixel(buf, blockWidth + 1, blockHeight, 191); - checkPixel(buf, blockWidth, blockHeight + 1, 191); - checkPixel(buf, blockWidth + 1, blockHeight + 1, 191); - - // Test bottom-right pixel - const int maxBlockX = ((w-1 + (blockWidth-1)) / blockWidth) & 0x1; - const int maxBlockY = ((h-1 + (blockHeight-1)) / blockHeight) & 0x1; - uint32_t pixelValue = ((maxBlockX % 2) == (maxBlockY % 2)) ? 191 : 63; - checkPixel(buf, w-1, h-1, pixelValue); -} - -void checkRgba8888Buffer(const CpuConsumer::LockedBuffer &buf) { - uint32_t w = buf.width; - uint32_t h = buf.height; - const int blockWidth = w > 16 ? w / 16 : 1; - const int blockHeight = h > 16 ? h / 16 : 1; - const int blockRows = h / blockHeight; - const int blockCols = w / blockWidth; - - // Top-left square is bright red - checkPixel(buf, 0, 0, 191, 63, 63); - checkPixel(buf, 1, 0, 191, 63, 63); - checkPixel(buf, 0, 1, 191, 63, 63); - checkPixel(buf, 1, 1, 191, 63, 63); - - // One-right square is bright green - checkPixel(buf, blockWidth, 0, 63, 191, 63); - checkPixel(buf, blockWidth + 1, 0, 63, 191, 63); - checkPixel(buf, blockWidth, 1, 63, 191, 63); - checkPixel(buf, blockWidth + 1, 1, 63, 191, 63); - - // One-down square is bright green - checkPixel(buf, 0, blockHeight, 63, 191, 63); - checkPixel(buf, 1, blockHeight, 63, 191, 63); - checkPixel(buf, 0, blockHeight + 1, 63, 191, 63); - checkPixel(buf, 1, blockHeight + 1, 63, 191, 63); - - // One-diag square is bright blue - checkPixel(buf, blockWidth, blockHeight, 63, 63, 191); - checkPixel(buf, blockWidth + 1, blockHeight, 63, 63, 191); - checkPixel(buf, blockWidth, blockHeight + 1, 63, 63, 191); - checkPixel(buf, blockWidth + 1, blockHeight + 1, 63, 63, 191); - - // Test bottom-right pixel - { - const int maxBlockX = ((w-1) / blockWidth); - const int maxBlockY = ((h-1) / blockHeight); - uint8_t r = chooseColorRgba8888(maxBlockX, maxBlockY, 0); - uint8_t g = chooseColorRgba8888(maxBlockX, maxBlockY, 1); - uint8_t b = chooseColorRgba8888(maxBlockX, maxBlockY, 2); - checkPixel(buf, w-1, h-1, r, g, b); - } -} - -void checkBayerRawBuffer(const CpuConsumer::LockedBuffer &buf) { - uint32_t w = buf.width; - uint32_t h = buf.height; - const int blockWidth = (w > 16 ? w / 8 : 2) & ~0x1; - const int blockHeight = (h > 16 ? h / 8 : 2) & ~0x1; - const int blockRows = h / blockHeight; - const int blockCols = w / blockWidth; - - // Top-left square is red - checkPixel(buf, 0, 0, 1000, 200, 200); - checkPixel(buf, 1, 0, 1000, 200, 200); - checkPixel(buf, 0, 1, 1000, 200, 200); - checkPixel(buf, 1, 1, 1000, 200, 200); - - // One-right square is blue - checkPixel(buf, blockWidth, 0, 200, 200, 1000); - checkPixel(buf, blockWidth + 1, 0, 200, 200, 1000); - checkPixel(buf, blockWidth, 1, 200, 200, 1000); - checkPixel(buf, blockWidth + 1, 1, 200, 200, 1000); - - // One-down square is green - checkPixel(buf, 0, blockHeight, 200, 1000, 200); - checkPixel(buf, 1, blockHeight, 200, 1000, 200); - checkPixel(buf, 0, blockHeight + 1, 200, 1000, 200); - checkPixel(buf, 1, blockHeight + 1, 200, 1000, 200); - - // One-diag square is white - checkPixel(buf, blockWidth, blockHeight, 1000, 1000, 1000); - checkPixel(buf, blockWidth + 1, blockHeight, 1000, 1000, 1000); - checkPixel(buf, blockWidth, blockHeight + 1, 1000, 1000, 1000); - checkPixel(buf, blockWidth + 1, blockHeight + 1, 1000, 1000, 1000); - - // Test bottom-right pixel - const int maxBlockX = ((w-1) / blockWidth) & 0x1; - const int maxBlockY = ((w-1) / blockHeight) & 0x1; - unsigned short maxR = (maxBlockX == maxBlockY) ? 1000 : 200; - unsigned short maxG = maxBlockY ? 1000: 200; - unsigned short maxB = maxBlockX ? 1000: 200; - checkPixel(buf, w-1, h-1, maxR, maxG, maxB); -} - -void checkAnyBuffer(const CpuConsumer::LockedBuffer &buf, int format) { - switch (format) { - case HAL_PIXEL_FORMAT_RAW16: - checkBayerRawBuffer(buf); - break; - case HAL_PIXEL_FORMAT_Y8: - checkGreyscaleBuffer(buf); - break; - case HAL_PIXEL_FORMAT_Y16: - checkGreyscaleBuffer(buf); - break; - case HAL_PIXEL_FORMAT_RGBA_8888: - checkRgba8888Buffer(buf); - break; - } -} - -void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride, - const android_native_rect_t& rect); - -void fillRGBA8Buffer(uint8_t* buf, int w, int h, int stride); - -void fillRGBA8BufferSolid(uint8_t* buf, int w, int h, int stride, uint8_t r, - uint8_t g, uint8_t b, uint8_t a); - -// Configures the ANativeWindow producer-side interface based on test parameters -void configureANW(const sp& anw, - const CpuConsumerTestParams& params, - int maxBufferSlack) { - status_t err; - err = native_window_set_buffers_dimensions(anw.get(), - params.width, params.height); - ASSERT_NO_ERROR(err, "set_buffers_dimensions error: "); - - err = native_window_set_buffers_format(anw.get(), params.format); - ASSERT_NO_ERROR(err, "set_buffers_format error: "); - - err = native_window_set_usage(anw.get(), - GRALLOC_USAGE_SW_WRITE_OFTEN); - ASSERT_NO_ERROR(err, "set_usage error: "); - - int minUndequeuedBuffers; - err = anw.get()->query(anw.get(), - NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, - &minUndequeuedBuffers); - ASSERT_NO_ERROR(err, "query error: "); - - ALOGVV("Setting buffer count to %d", - maxBufferSlack + 1 + minUndequeuedBuffers); - err = native_window_set_buffer_count(anw.get(), - maxBufferSlack + 1 + minUndequeuedBuffers); - ASSERT_NO_ERROR(err, "set_buffer_count error: "); - -} - -// Produce one frame of image data; assumes format and resolution configuration -// is already done. -void produceOneFrame(const sp& anw, - const CpuConsumerTestParams& params, - int64_t timestamp, uint32_t *stride) { - status_t err; - ANativeWindowBuffer* anb; - ALOGVV("Dequeue buffer from %p", anw.get()); - err = native_window_dequeue_buffer_and_wait(anw.get(), &anb); - ASSERT_NO_ERROR(err, "dequeueBuffer error: "); - - ASSERT_TRUE(anb != NULL); - - sp buf(new GraphicBuffer(anb, false)); - - *stride = buf->getStride(); - uint8_t* img = NULL; - - ALOGVV("Lock buffer from %p for write", anw.get()); - err = buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); - ASSERT_NO_ERROR(err, "lock error: "); - - switch (params.format) { - case HAL_PIXEL_FORMAT_YV12: - fillYV12Buffer(img, params.width, params.height, *stride); - break; - case HAL_PIXEL_FORMAT_RAW16: - fillBayerRawBuffer(img, params.width, params.height, buf->getStride()); - break; - case HAL_PIXEL_FORMAT_Y8: - fillGreyscaleBuffer(img, params.width, params.height, - buf->getStride(), /*bpp*/8); - break; - case HAL_PIXEL_FORMAT_Y16: - fillGreyscaleBuffer((uint16_t*)img, params.width, - params.height, buf->getStride(), - /*bpp*/16); - break; - case HAL_PIXEL_FORMAT_RGBA_8888: - fillRgba8888Buffer(img, params.width, params.height, buf->getStride()); - break; - default: - FAIL() << "Unknown pixel format under test!"; - break; - } - ALOGVV("Unlock buffer from %p", anw.get()); - err = buf->unlock(); - ASSERT_NO_ERROR(err, "unlock error: "); - - ALOGVV("Set timestamp to %p", anw.get()); - err = native_window_set_buffers_timestamp(anw.get(), timestamp); - ASSERT_NO_ERROR(err, "set_buffers_timestamp error: "); - - ALOGVV("Queue buffer to %p", anw.get()); - err = anw->queueBuffer(anw.get(), buf->getNativeBuffer(), -1); - ASSERT_NO_ERROR(err, "queueBuffer error:"); -}; - -// This test is disabled because the HAL_PIXEL_FORMAT_RAW16 format is not -// supported on all devices. -TEST_P(CpuConsumerTest, FromCpuSingle) { - status_t err; - CpuConsumerTestParams params = GetParam(); - - // Set up - - ASSERT_NO_FATAL_FAILURE(configureANW(mANW, params, 1)); - - // Produce - - const int64_t time = 12345678L; - uint32_t stride; - ASSERT_NO_FATAL_FAILURE(produceOneFrame(mANW, params, time, - &stride)); - - // Consume - - CpuConsumer::LockedBuffer b; - err = mCC->lockNextBuffer(&b); - ASSERT_NO_ERROR(err, "getNextBuffer error: "); - - ASSERT_TRUE(b.data != NULL); - EXPECT_EQ(params.width, b.width); - EXPECT_EQ(params.height, b.height); - EXPECT_EQ(params.format, b.format); - EXPECT_EQ(stride, b.stride); - EXPECT_EQ(time, b.timestamp); - - checkAnyBuffer(b, GetParam().format); - mCC->unlockBuffer(b); -} - -// This test is disabled because the HAL_PIXEL_FORMAT_RAW16 format is not -// supported on all devices. -TEST_P(CpuConsumerTest, FromCpuManyInQueue) { - status_t err; - CpuConsumerTestParams params = GetParam(); - - const int numInQueue = 5; - // Set up - - ASSERT_NO_FATAL_FAILURE(configureANW(mANW, params, numInQueue)); - - // Produce - - const int64_t time[numInQueue] = { 1L, 2L, 3L, 4L, 5L}; - uint32_t stride[numInQueue]; - - for (int i = 0; i < numInQueue; i++) { - ALOGV("Producing frame %d", i); - ASSERT_NO_FATAL_FAILURE(produceOneFrame(mANW, params, time[i], - &stride[i])); - } - - // Consume - - for (int i = 0; i < numInQueue; i++) { - ALOGV("Consuming frame %d", i); - CpuConsumer::LockedBuffer b; - err = mCC->lockNextBuffer(&b); - ASSERT_NO_ERROR(err, "getNextBuffer error: "); - - ASSERT_TRUE(b.data != NULL); - EXPECT_EQ(params.width, b.width); - EXPECT_EQ(params.height, b.height); - EXPECT_EQ(params.format, b.format); - EXPECT_EQ(stride[i], b.stride); - EXPECT_EQ(time[i], b.timestamp); - - checkAnyBuffer(b, GetParam().format); - - mCC->unlockBuffer(b); - } -} - -// This test is disabled because the HAL_PIXEL_FORMAT_RAW16 format is not -// supported on all devices. -TEST_P(CpuConsumerTest, FromCpuLockMax) { - status_t err; - CpuConsumerTestParams params = GetParam(); - - // Set up - - ASSERT_NO_FATAL_FAILURE(configureANW(mANW, params, params.maxLockedBuffers + 1)); - - // Produce - - const int64_t time = 1234L; - uint32_t stride; - - for (int i = 0; i < params.maxLockedBuffers + 1; i++) { - ALOGV("Producing frame %d", i); - ASSERT_NO_FATAL_FAILURE(produceOneFrame(mANW, params, time, - &stride)); - } - - // Consume - - CpuConsumer::LockedBuffer *b = new CpuConsumer::LockedBuffer[params.maxLockedBuffers]; - for (int i = 0; i < params.maxLockedBuffers; i++) { - ALOGV("Locking frame %d", i); - err = mCC->lockNextBuffer(&b[i]); - ASSERT_NO_ERROR(err, "getNextBuffer error: "); - - ASSERT_TRUE(b[i].data != NULL); - EXPECT_EQ(params.width, b[i].width); - EXPECT_EQ(params.height, b[i].height); - EXPECT_EQ(params.format, b[i].format); - EXPECT_EQ(stride, b[i].stride); - EXPECT_EQ(time, b[i].timestamp); - - checkAnyBuffer(b[i], GetParam().format); - } - - ALOGV("Locking frame %d (too many)", params.maxLockedBuffers); - CpuConsumer::LockedBuffer bTooMuch; - err = mCC->lockNextBuffer(&bTooMuch); - ASSERT_TRUE(err == NOT_ENOUGH_DATA) << "Allowing too many locks"; - - ALOGV("Unlocking frame 0"); - err = mCC->unlockBuffer(b[0]); - ASSERT_NO_ERROR(err, "Could not unlock buffer 0: "); - - ALOGV("Locking frame %d (should work now)", params.maxLockedBuffers); - err = mCC->lockNextBuffer(&bTooMuch); - ASSERT_NO_ERROR(err, "Did not allow new lock after unlock"); - - ASSERT_TRUE(bTooMuch.data != NULL); - EXPECT_EQ(params.width, bTooMuch.width); - EXPECT_EQ(params.height, bTooMuch.height); - EXPECT_EQ(params.format, bTooMuch.format); - EXPECT_EQ(stride, bTooMuch.stride); - EXPECT_EQ(time, bTooMuch.timestamp); - - checkAnyBuffer(bTooMuch, GetParam().format); - - ALOGV("Unlocking extra buffer"); - err = mCC->unlockBuffer(bTooMuch); - ASSERT_NO_ERROR(err, "Could not unlock extra buffer: "); - - ALOGV("Locking frame %d (no more available)", params.maxLockedBuffers + 1); - err = mCC->lockNextBuffer(&b[0]); - ASSERT_EQ(BAD_VALUE, err) << "Not out of buffers somehow"; - - for (int i = 1; i < params.maxLockedBuffers; i++) { - mCC->unlockBuffer(b[i]); - } - - delete[] b; - -} - -CpuConsumerTestParams y8TestSets[] = { - { 512, 512, 1, HAL_PIXEL_FORMAT_Y8}, - { 512, 512, 3, HAL_PIXEL_FORMAT_Y8}, - { 2608, 1960, 1, HAL_PIXEL_FORMAT_Y8}, - { 2608, 1960, 3, HAL_PIXEL_FORMAT_Y8}, - { 100, 100, 1, HAL_PIXEL_FORMAT_Y8}, - { 100, 100, 3, HAL_PIXEL_FORMAT_Y8}, -}; - -CpuConsumerTestParams y16TestSets[] = { - { 512, 512, 1, HAL_PIXEL_FORMAT_Y16}, - { 512, 512, 3, HAL_PIXEL_FORMAT_Y16}, - { 2608, 1960, 1, HAL_PIXEL_FORMAT_Y16}, - { 2608, 1960, 3, HAL_PIXEL_FORMAT_Y16}, - { 100, 100, 1, HAL_PIXEL_FORMAT_Y16}, - { 100, 100, 3, HAL_PIXEL_FORMAT_Y16}, -}; - -CpuConsumerTestParams rawTestSets[] = { - { 512, 512, 1, HAL_PIXEL_FORMAT_RAW16}, - { 512, 512, 3, HAL_PIXEL_FORMAT_RAW16}, - { 2608, 1960, 1, HAL_PIXEL_FORMAT_RAW16}, - { 2608, 1960, 3, HAL_PIXEL_FORMAT_RAW16}, - { 100, 100, 1, HAL_PIXEL_FORMAT_RAW16}, - { 100, 100, 3, HAL_PIXEL_FORMAT_RAW16}, -}; - -CpuConsumerTestParams rgba8888TestSets[] = { - { 512, 512, 1, HAL_PIXEL_FORMAT_RGBA_8888}, - { 512, 512, 3, HAL_PIXEL_FORMAT_RGBA_8888}, - { 2608, 1960, 1, HAL_PIXEL_FORMAT_RGBA_8888}, - { 2608, 1960, 3, HAL_PIXEL_FORMAT_RGBA_8888}, - { 100, 100, 1, HAL_PIXEL_FORMAT_RGBA_8888}, - { 100, 100, 3, HAL_PIXEL_FORMAT_RGBA_8888}, -}; - -#if CPU_CONSUMER_TEST_FORMAT_Y8 -INSTANTIATE_TEST_CASE_P(Y8Tests, - CpuConsumerTest, - ::testing::ValuesIn(y8TestSets)); -#endif - -#if CPU_CONSUMER_TEST_FORMAT_Y16 -INSTANTIATE_TEST_CASE_P(Y16Tests, - CpuConsumerTest, - ::testing::ValuesIn(y16TestSets)); -#endif - -#if CPU_CONSUMER_TEST_FORMAT_RAW -INSTANTIATE_TEST_CASE_P(RawTests, - CpuConsumerTest, - ::testing::ValuesIn(rawTestSets)); -#endif - -#if CPU_CONSUMER_TEST_FORMAT_RGBA_8888 -INSTANTIATE_TEST_CASE_P(Rgba8888Tests, - CpuConsumerTest, - ::testing::ValuesIn(rgba8888TestSets)); -#endif - - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/DisconnectWaiter.h android-platform-frameworks-native-21/libs/gui/tests/DisconnectWaiter.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/DisconnectWaiter.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/DisconnectWaiter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,80 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_DISCONNECT_WAITER_H -#define ANDROID_DISCONNECT_WAITER_H - -#include - -#include -#include - -namespace android { - -// Note that GLConsumer will lose the notifications -// onBuffersReleased and onFrameAvailable as there is currently -// no way to forward the events. This DisconnectWaiter will not let the -// disconnect finish until finishDisconnect() is called. It will -// also block until a disconnect is called -class DisconnectWaiter : public BnConsumerListener { -public: - DisconnectWaiter () : - mWaitForDisconnect(false), - mPendingFrames(0) { - } - - void waitForFrame() { - Mutex::Autolock lock(mMutex); - while (mPendingFrames == 0) { - mFrameCondition.wait(mMutex); - } - mPendingFrames--; - } - - virtual void onFrameAvailable(const BufferItem& /* item */) { - Mutex::Autolock lock(mMutex); - mPendingFrames++; - mFrameCondition.signal(); - } - - virtual void onBuffersReleased() { - Mutex::Autolock lock(mMutex); - while (!mWaitForDisconnect) { - mDisconnectCondition.wait(mMutex); - } - } - - virtual void onSidebandStreamChanged() {} - - void finishDisconnect() { - Mutex::Autolock lock(mMutex); - mWaitForDisconnect = true; - mDisconnectCondition.signal(); - } - -private: - Mutex mMutex; - - bool mWaitForDisconnect; - Condition mDisconnectCondition; - - int mPendingFrames; - Condition mFrameCondition; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/DummyConsumer.h android-platform-frameworks-native-21/libs/gui/tests/DummyConsumer.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/DummyConsumer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/DummyConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,27 +0,0 @@ -/* - * Copyright 2015 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 - -namespace android { - -struct DummyConsumer : public BnConsumerListener { - virtual void onFrameAvailable(const BufferItem& /* item */) {} - virtual void onBuffersReleased() {} - virtual void onSidebandStreamChanged() {} -}; - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/FillBuffer.cpp android-platform-frameworks-native-21/libs/gui/tests/FillBuffer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/FillBuffer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/FillBuffer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -/* - * Copyright 2013 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 "FillBuffer.h" - -#include - -#include - -namespace android { - -void fillYV12Buffer(uint8_t* buf, int w, int h, int stride) { - const int blockWidth = w > 16 ? w / 16 : 1; - const int blockHeight = h > 16 ? h / 16 : 1; - const int yuvTexOffsetY = 0; - int yuvTexStrideY = stride; - int yuvTexOffsetV = yuvTexStrideY * h; - int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; - int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2; - int yuvTexStrideU = yuvTexStrideV; - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - int parityX = (x / blockWidth) & 1; - int parityY = (y / blockHeight) & 1; - unsigned char intensity = (parityX ^ parityY) ? 63 : 191; - buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity; - if (x < w / 2 && y < h / 2) { - buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity; - if (x * 2 < w / 2 && y * 2 < h / 2) { - buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] = - buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] = - buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] = - buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] = - intensity; - } - } - } - } -} - -void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride, - const android_native_rect_t& rect) { - const int yuvTexOffsetY = 0; - int yuvTexStrideY = stride; - int yuvTexOffsetV = yuvTexStrideY * h; - int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; - int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2; - int yuvTexStrideU = yuvTexStrideV; - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - bool inside = rect.left <= x && x < rect.right && - rect.top <= y && y < rect.bottom; - buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = inside ? 240 : 64; - if (x < w / 2 && y < h / 2) { - bool inside = rect.left <= 2*x && 2*x < rect.right && - rect.top <= 2*y && 2*y < rect.bottom; - buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = 16; - buf[yuvTexOffsetV + (y * yuvTexStrideV) + x] = - inside ? 16 : 255; - } - } - } -} - -void fillRGBA8Buffer(uint8_t* buf, int w, int h, int stride) { - const size_t PIXEL_SIZE = 4; - for (int x = 0; x < w; x++) { - for (int y = 0; y < h; y++) { - off_t offset = (y * stride + x) * PIXEL_SIZE; - for (int c = 0; c < 4; c++) { - int parityX = (x / (1 << (c+2))) & 1; - int parityY = (y / (1 << (c+2))) & 1; - buf[offset + c] = (parityX ^ parityY) ? 231 : 35; - } - } - } -} - -void produceOneRGBA8Frame(const sp& anw) { - android_native_buffer_t* anb; - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(anw.get(), - &anb)); - ASSERT_TRUE(anb != NULL); - - sp buf(new GraphicBuffer(anb, false)); - - uint8_t* img = NULL; - ASSERT_EQ(NO_ERROR, buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, - (void**)(&img))); - fillRGBA8Buffer(img, buf->getWidth(), buf->getHeight(), buf->getStride()); - ASSERT_EQ(NO_ERROR, buf->unlock()); - ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf->getNativeBuffer(), - -1)); -} -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/FillBuffer.h android-platform-frameworks-native-21/libs/gui/tests/FillBuffer.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/FillBuffer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/FillBuffer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,43 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_FILL_BUFFER_H -#define ANDROID_FILL_BUFFER_H - -#include -#include - -namespace android { - -// Fill a YV12 buffer with a multi-colored checkerboard pattern -void fillYV12Buffer(uint8_t* buf, int w, int h, int stride); - -// Fill a YV12 buffer with red outside a given rectangle and green inside it. -void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride, - const android_native_rect_t& rect); - -void fillRGBA8Buffer(uint8_t* buf, int w, int h, int stride); - -// Produce a single RGBA8 frame by filling a buffer with a checkerboard pattern -// using the CPU. This assumes that the ANativeWindow is already configured to -// allow this to be done (e.g. the format is set to RGBA8). -// -// Calls to this function should be wrapped in an ASSERT_NO_FATAL_FAILURE(). -void produceOneRGBA8Frame(const sp& anw); - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/FrameWaiter.h android-platform-frameworks-native-21/libs/gui/tests/FrameWaiter.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/FrameWaiter.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/FrameWaiter.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_FRAME_WAITER_H -#define ANDROID_FRAME_WAITER_H - -#include - -namespace android { - -class FrameWaiter : public GLConsumer::FrameAvailableListener { -public: - FrameWaiter(): - mPendingFrames(0) { - } - - void waitForFrame() { - Mutex::Autolock lock(mMutex); - while (mPendingFrames == 0) { - mCondition.wait(mMutex); - } - mPendingFrames--; - } - - virtual void onFrameAvailable(const BufferItem& /* item */) { - Mutex::Autolock lock(mMutex); - mPendingFrames++; - mCondition.signal(); - } - -private: - int mPendingFrames; - Mutex mMutex; - Condition mCondition; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/GLTest.cpp android-platform-frameworks-native-21/libs/gui/tests/GLTest.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/GLTest.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/GLTest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,339 +0,0 @@ -/* - * Copyright 2013 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 "GLTest.h" - -#include - -#include - -namespace android { - -static int abs(int value) { - return value > 0 ? value : -value; -} - -void GLTest::SetUp() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("Begin test: %s.%s", testInfo->test_case_name(), testInfo->name()); - - mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay); - - EGLint majorVersion; - EGLint minorVersion; - EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - RecordProperty("EglVersionMajor", majorVersion); - RecordProperty("EglVersionMinor", minorVersion); - - EGLint numConfigs = 0; - EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(), &mGlConfig, 1, - &numConfigs)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - char* displaySecsEnv = getenv("GLTEST_DISPLAY_SECS"); - if (displaySecsEnv != NULL) { - mDisplaySecs = atoi(displaySecsEnv); - if (mDisplaySecs < 0) { - mDisplaySecs = 0; - } - } else { - mDisplaySecs = 0; - } - - if (mDisplaySecs > 0) { - mComposerClient = new SurfaceComposerClient; - ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); - - mSurfaceControl = mComposerClient->createSurface( - String8("Test Surface"), getSurfaceWidth(), getSurfaceHeight(), - PIXEL_FORMAT_RGB_888, 0); - - ASSERT_TRUE(mSurfaceControl != NULL); - ASSERT_TRUE(mSurfaceControl->isValid()); - - SurfaceComposerClient::openGlobalTransaction(); - ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(0x7FFFFFFF)); - ASSERT_EQ(NO_ERROR, mSurfaceControl->show()); - SurfaceComposerClient::closeGlobalTransaction(); - - sp window = mSurfaceControl->getSurface(); - mEglSurface = createWindowSurface(mEglDisplay, mGlConfig, window); - } else { - EGLint pbufferAttribs[] = { - EGL_WIDTH, getSurfaceWidth(), - EGL_HEIGHT, getSurfaceHeight(), - EGL_NONE }; - - mEglSurface = eglCreatePbufferSurface(mEglDisplay, mGlConfig, - pbufferAttribs); - } - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_SURFACE, mEglSurface); - - mEglContext = eglCreateContext(mEglDisplay, mGlConfig, EGL_NO_CONTEXT, - getContextAttribs()); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_CONTEXT, mEglContext); - - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - EGLint w, h; - EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, &w)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, &h)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - RecordProperty("EglSurfaceWidth", w); - RecordProperty("EglSurfaceHeight", h); - - glViewport(0, 0, w, h); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); -} - -void GLTest::TearDown() { - // Display the result - if (mDisplaySecs > 0 && mEglSurface != EGL_NO_SURFACE) { - eglSwapBuffers(mEglDisplay, mEglSurface); - sleep(mDisplaySecs); - } - - if (mComposerClient != NULL) { - mComposerClient->dispose(); - } - if (mEglContext != EGL_NO_CONTEXT) { - eglDestroyContext(mEglDisplay, mEglContext); - } - if (mEglSurface != EGL_NO_SURFACE) { - eglDestroySurface(mEglDisplay, mEglSurface); - } - if (mEglDisplay != EGL_NO_DISPLAY) { - eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); - eglTerminate(mEglDisplay); - } - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("End test: %s.%s", testInfo->test_case_name(), testInfo->name()); -} - -EGLint const* GLTest::getConfigAttribs() { - static const EGLint sDefaultConfigAttribs[] = { - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_DEPTH_SIZE, 16, - EGL_STENCIL_SIZE, 8, - EGL_NONE }; - - return sDefaultConfigAttribs; -} - -EGLint const* GLTest::getContextAttribs() { - static const EGLint sDefaultContextAttribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 2, - EGL_NONE }; - - return sDefaultContextAttribs; -} - -EGLint GLTest::getSurfaceWidth() { - return 512; -} - -EGLint GLTest::getSurfaceHeight() { - return 512; -} - -EGLSurface GLTest::createWindowSurface(EGLDisplay display, EGLConfig config, - sp& window) const { - return eglCreateWindowSurface(display, config, window.get(), NULL); -} - -::testing::AssertionResult GLTest::checkPixel(int x, int y, - int r, int g, int b, int a, int tolerance) { - GLubyte pixel[4]; - String8 msg; - glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); - GLenum err = glGetError(); - if (err != GL_NO_ERROR) { - msg += String8::format("error reading pixel: %#x", err); - while ((err = glGetError()) != GL_NO_ERROR) { - msg += String8::format(", %#x", err); - } - return ::testing::AssertionFailure(::testing::Message(msg.string())); - } - if (r >= 0 && abs(r - int(pixel[0])) > tolerance) { - msg += String8::format("r(%d isn't %d)", pixel[0], r); - } - if (g >= 0 && abs(g - int(pixel[1])) > tolerance) { - if (!msg.isEmpty()) { - msg += " "; - } - msg += String8::format("g(%d isn't %d)", pixel[1], g); - } - if (b >= 0 && abs(b - int(pixel[2])) > tolerance) { - if (!msg.isEmpty()) { - msg += " "; - } - msg += String8::format("b(%d isn't %d)", pixel[2], b); - } - if (a >= 0 && abs(a - int(pixel[3])) > tolerance) { - if (!msg.isEmpty()) { - msg += " "; - } - msg += String8::format("a(%d isn't %d)", pixel[3], a); - } - if (!msg.isEmpty()) { - return ::testing::AssertionFailure(::testing::Message(msg.string())); - } else { - return ::testing::AssertionSuccess(); - } -} - -::testing::AssertionResult GLTest::assertRectEq(const Rect &r1, const Rect &r2, - int tolerance) { - String8 msg; - - if (abs(r1.left - r2.left) > tolerance) { - msg += String8::format("left(%d isn't %d)", r1.left, r2.left); - } - if (abs(r1.top - r2.top) > tolerance) { - if (!msg.isEmpty()) { - msg += " "; - } - msg += String8::format("top(%d isn't %d)", r1.top, r2.top); - } - if (abs(r1.right - r2.right) > tolerance) { - if (!msg.isEmpty()) { - msg += " "; - } - msg += String8::format("right(%d isn't %d)", r1.right, r2.right); - } - if (abs(r1.bottom - r2.bottom) > tolerance) { - if (!msg.isEmpty()) { - msg += " "; - } - msg += String8::format("bottom(%d isn't %d)", r1.bottom, r2.bottom); - } - if (!msg.isEmpty()) { - msg += String8::format(" R1: [%d %d %d %d] R2: [%d %d %d %d]", - r1.left, r1.top, r1.right, r1.bottom, - r2.left, r2.top, r2.right, r2.bottom); - fprintf(stderr, "assertRectEq: %s\n", msg.string()); - return ::testing::AssertionFailure(::testing::Message(msg.string())); - } else { - return ::testing::AssertionSuccess(); - } -} - -void GLTest::loadShader(GLenum shaderType, const char* pSource, - GLuint* outShader) { - GLuint shader = glCreateShader(shaderType); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - if (shader) { - glShaderSource(shader, 1, &pSource, NULL); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glCompileShader(shader); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - GLint compiled = 0; - glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - if (!compiled) { - GLint infoLen = 0; - glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - if (infoLen) { - char* buf = (char*) malloc(infoLen); - if (buf) { - glGetShaderInfoLog(shader, infoLen, NULL, buf); - printf("Shader compile log:\n%s\n", buf); - free(buf); - FAIL(); - } - } else { - char* buf = (char*) malloc(0x1000); - if (buf) { - glGetShaderInfoLog(shader, 0x1000, NULL, buf); - printf("Shader compile log:\n%s\n", buf); - free(buf); - FAIL(); - } - } - glDeleteShader(shader); - shader = 0; - } - } - ASSERT_TRUE(shader != 0); - *outShader = shader; -} - -void GLTest::createProgram(const char* pVertexSource, - const char* pFragmentSource, GLuint* outPgm) { - GLuint vertexShader, fragmentShader; - { - SCOPED_TRACE("compiling vertex shader"); - ASSERT_NO_FATAL_FAILURE(loadShader(GL_VERTEX_SHADER, pVertexSource, - &vertexShader)); - } - { - SCOPED_TRACE("compiling fragment shader"); - ASSERT_NO_FATAL_FAILURE(loadShader(GL_FRAGMENT_SHADER, pFragmentSource, - &fragmentShader)); - } - - GLuint program = glCreateProgram(); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - if (program) { - glAttachShader(program, vertexShader); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glAttachShader(program, fragmentShader); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glLinkProgram(program); - GLint linkStatus = GL_FALSE; - glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); - if (linkStatus != GL_TRUE) { - GLint bufLength = 0; - glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); - if (bufLength) { - char* buf = (char*) malloc(bufLength); - if (buf) { - glGetProgramInfoLog(program, bufLength, NULL, buf); - printf("Program link log:\n%s\n", buf); - free(buf); - FAIL(); - } - } - glDeleteProgram(program); - program = 0; - } - } - glDeleteShader(vertexShader); - glDeleteShader(fragmentShader); - ASSERT_TRUE(program != 0); - *outPgm = program; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/GLTest.h android-platform-frameworks-native-21/libs/gui/tests/GLTest.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/GLTest.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/GLTest.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_GL_TEST_H -#define ANDROID_GL_TEST_H - -#include - -#include - -#include -#include - -namespace android { - -class GLTest : public ::testing::Test { -public: - static void loadShader(GLenum shaderType, const char* pSource, - GLuint* outShader); - static void createProgram(const char* pVertexSource, - const char* pFragmentSource, GLuint* outPgm); - -protected: - GLTest() : - mEglDisplay(EGL_NO_DISPLAY), - mEglSurface(EGL_NO_SURFACE), - mEglContext(EGL_NO_CONTEXT) { - } - - virtual void SetUp(); - virtual void TearDown(); - - virtual EGLint const* getConfigAttribs(); - virtual EGLint const* getContextAttribs(); - virtual EGLint getSurfaceWidth(); - virtual EGLint getSurfaceHeight(); - virtual EGLSurface createWindowSurface(EGLDisplay display, EGLConfig config, - sp& window) const; - - ::testing::AssertionResult checkPixel(int x, int y, - int r, int g, int b, int a, int tolerance = 2); - ::testing::AssertionResult assertRectEq(const Rect &r1, const Rect &r2, - int tolerance = 1); - - int mDisplaySecs; - sp mComposerClient; - sp mSurfaceControl; - - EGLDisplay mEglDisplay; - EGLSurface mEglSurface; - EGLContext mEglContext; - EGLConfig mGlConfig; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/IGraphicBufferProducer_test.cpp android-platform-frameworks-native-21/libs/gui/tests/IGraphicBufferProducer_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/IGraphicBufferProducer_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/IGraphicBufferProducer_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,572 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define LOG_TAG "IGraphicBufferProducer_test" -//#define LOG_NDEBUG 0 - -#include - -#include -#include - -#include - -#include -#include - -#include - -#define ASSERT_OK(x) ASSERT_EQ(OK, (x)) -#define EXPECT_OK(x) EXPECT_EQ(OK, (x)) - -#define TEST_TOKEN ((IProducerListener*)(NULL)) -#define TEST_API NATIVE_WINDOW_API_CPU -#define TEST_API_OTHER NATIVE_WINDOW_API_EGL // valid API that's not TEST_API -#define TEST_CONTROLLED_BY_APP false -#define TEST_PRODUCER_USAGE_BITS (0) - -namespace android { - -namespace { - // Default dimensions before setDefaultBufferSize is called - const uint32_t DEFAULT_WIDTH = 1; - const uint32_t DEFAULT_HEIGHT = 1; - - // Default format before setDefaultBufferFormat is called - const PixelFormat DEFAULT_FORMAT = HAL_PIXEL_FORMAT_RGBA_8888; - - // Default transform hint before setTransformHint is called - const uint32_t DEFAULT_TRANSFORM_HINT = 0; - - // TODO: Make these constants in header - const int DEFAULT_CONSUMER_USAGE_BITS = 0; - - // Parameters for a generic "valid" input for queueBuffer. - const int64_t QUEUE_BUFFER_INPUT_TIMESTAMP = 1384888611; - const bool QUEUE_BUFFER_INPUT_IS_AUTO_TIMESTAMP = false; - const android_dataspace QUEUE_BUFFER_INPUT_DATASPACE = HAL_DATASPACE_UNKNOWN; - const Rect QUEUE_BUFFER_INPUT_RECT = Rect(DEFAULT_WIDTH, DEFAULT_HEIGHT); - const int QUEUE_BUFFER_INPUT_SCALING_MODE = 0; - const int QUEUE_BUFFER_INPUT_TRANSFORM = 0; - const bool QUEUE_BUFFER_INPUT_ASYNC = false; - const sp QUEUE_BUFFER_INPUT_FENCE = Fence::NO_FENCE; -}; // namespace anonymous - -struct DummyConsumer : public BnConsumerListener { - virtual void onFrameAvailable(const BufferItem& /* item */) {} - virtual void onBuffersReleased() {} - virtual void onSidebandStreamChanged() {} -}; - -class IGraphicBufferProducerTest : public ::testing::Test { -protected: - - IGraphicBufferProducerTest() {} - - virtual void SetUp() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("Begin test: %s.%s", testInfo->test_case_name(), - testInfo->name()); - - mDC = new DummyConsumer; - - BufferQueue::createBufferQueue(&mProducer, &mConsumer); - - // Test check: Can't connect producer if no consumer yet - ASSERT_EQ(NO_INIT, TryConnectProducer()); - - // Must connect consumer before producer connects will succeed. - ASSERT_OK(mConsumer->consumerConnect(mDC, /*controlledByApp*/false)); - } - - virtual void TearDown() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("End test: %s.%s", testInfo->test_case_name(), - testInfo->name()); - } - - status_t TryConnectProducer() { - IGraphicBufferProducer::QueueBufferOutput output; - return mProducer->connect(TEST_TOKEN, - TEST_API, - TEST_CONTROLLED_BY_APP, - &output); - // TODO: use params to vary token, api, producercontrolledbyapp, etc - } - - // Connect to a producer in a 'correct' fashion. - // Precondition: Consumer is connected. - void ConnectProducer() { - ASSERT_OK(TryConnectProducer()); - } - - // Create a generic "valid" input for queueBuffer - // -- uses the default buffer format, width, etc. - static IGraphicBufferProducer::QueueBufferInput CreateBufferInput() { - return QueueBufferInputBuilder().build(); - } - - // Builder pattern to slightly vary *almost* correct input - // -- avoids copying and pasting - struct QueueBufferInputBuilder { - QueueBufferInputBuilder() { - timestamp = QUEUE_BUFFER_INPUT_TIMESTAMP; - isAutoTimestamp = QUEUE_BUFFER_INPUT_IS_AUTO_TIMESTAMP; - dataSpace = QUEUE_BUFFER_INPUT_DATASPACE; - crop = QUEUE_BUFFER_INPUT_RECT; - scalingMode = QUEUE_BUFFER_INPUT_SCALING_MODE; - transform = QUEUE_BUFFER_INPUT_TRANSFORM; - async = QUEUE_BUFFER_INPUT_ASYNC; - fence = QUEUE_BUFFER_INPUT_FENCE; - } - - IGraphicBufferProducer::QueueBufferInput build() { - return IGraphicBufferProducer::QueueBufferInput( - timestamp, - isAutoTimestamp, - dataSpace, - crop, - scalingMode, - transform, - async, - fence); - } - - QueueBufferInputBuilder& setTimestamp(int64_t timestamp) { - this->timestamp = timestamp; - return *this; - } - - QueueBufferInputBuilder& setIsAutoTimestamp(bool isAutoTimestamp) { - this->isAutoTimestamp = isAutoTimestamp; - return *this; - } - - QueueBufferInputBuilder& setDataSpace(android_dataspace dataSpace) { - this->dataSpace = dataSpace; - return *this; - } - - QueueBufferInputBuilder& setCrop(Rect crop) { - this->crop = crop; - return *this; - } - - QueueBufferInputBuilder& setScalingMode(int scalingMode) { - this->scalingMode = scalingMode; - return *this; - } - - QueueBufferInputBuilder& setTransform(uint32_t transform) { - this->transform = transform; - return *this; - } - - QueueBufferInputBuilder& setAsync(bool async) { - this->async = async; - return *this; - } - - QueueBufferInputBuilder& setFence(sp fence) { - this->fence = fence; - return *this; - } - - private: - int64_t timestamp; - bool isAutoTimestamp; - android_dataspace dataSpace; - Rect crop; - int scalingMode; - uint32_t transform; - int async; - sp fence; - }; // struct QueueBufferInputBuilder - - // To easily store dequeueBuffer results into containers - struct DequeueBufferResult { - int slot; - sp fence; - }; - - status_t dequeueBuffer(bool async, uint32_t w, uint32_t h, uint32_t format, uint32_t usage, DequeueBufferResult* result) { - return mProducer->dequeueBuffer(&result->slot, &result->fence, async, w, h, format, usage); - } - -private: // hide from test body - sp mDC; - -protected: // accessible from test body - sp mProducer; - sp mConsumer; -}; - -TEST_F(IGraphicBufferProducerTest, ConnectFirst_ReturnsError) { - IGraphicBufferProducer::QueueBufferOutput output; - - // NULL output returns BAD_VALUE - EXPECT_EQ(BAD_VALUE, mProducer->connect(TEST_TOKEN, - TEST_API, - TEST_CONTROLLED_BY_APP, - /*output*/NULL)); - - // Invalid API returns bad value - EXPECT_EQ(BAD_VALUE, mProducer->connect(TEST_TOKEN, - /*api*/0xDEADBEEF, - TEST_CONTROLLED_BY_APP, - &output)); - - // TODO: get a token from a dead process somehow -} - -TEST_F(IGraphicBufferProducerTest, ConnectAgain_ReturnsError) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - // Can't connect when there is already a producer connected - IGraphicBufferProducer::QueueBufferOutput output; - EXPECT_EQ(BAD_VALUE, mProducer->connect(TEST_TOKEN, - TEST_API, - TEST_CONTROLLED_BY_APP, - &output)); - - ASSERT_OK(mConsumer->consumerDisconnect()); - // Can't connect when IGBP is abandoned - EXPECT_EQ(NO_INIT, mProducer->connect(TEST_TOKEN, - TEST_API, - TEST_CONTROLLED_BY_APP, - &output)); -} - -TEST_F(IGraphicBufferProducerTest, Disconnect_Succeeds) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - ASSERT_OK(mProducer->disconnect(TEST_API)); -} - - -TEST_F(IGraphicBufferProducerTest, Disconnect_ReturnsError) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - // Must disconnect with same API number - ASSERT_EQ(BAD_VALUE, mProducer->disconnect(TEST_API_OTHER)); - // API must not be out of range - ASSERT_EQ(BAD_VALUE, mProducer->disconnect(/*api*/0xDEADBEEF)); - - // TODO: somehow kill mProducer so that this returns DEAD_OBJECT -} - -TEST_F(IGraphicBufferProducerTest, Query_Succeeds) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - int32_t value = -1; - EXPECT_OK(mProducer->query(NATIVE_WINDOW_WIDTH, &value)); - EXPECT_EQ(DEFAULT_WIDTH, static_cast(value)); - - EXPECT_OK(mProducer->query(NATIVE_WINDOW_HEIGHT, &value)); - EXPECT_EQ(DEFAULT_HEIGHT, static_cast(value)); - - EXPECT_OK(mProducer->query(NATIVE_WINDOW_FORMAT, &value)); - EXPECT_EQ(DEFAULT_FORMAT, value); - - EXPECT_OK(mProducer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &value)); - EXPECT_LE(0, value); - EXPECT_GE(BufferQueue::NUM_BUFFER_SLOTS, value); - - EXPECT_OK(mProducer->query(NATIVE_WINDOW_CONSUMER_RUNNING_BEHIND, &value)); - EXPECT_FALSE(value); // Can't run behind when we haven't touched the queue - - EXPECT_OK(mProducer->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &value)); - EXPECT_EQ(DEFAULT_CONSUMER_USAGE_BITS, value); - -} - -TEST_F(IGraphicBufferProducerTest, Query_ReturnsError) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - // One past the end of the last 'query' enum value. Update this if we add more enums. - const int NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE = NATIVE_WINDOW_BUFFER_AGE + 1; - - int value; - // What was out of range - EXPECT_EQ(BAD_VALUE, mProducer->query(/*what*/-1, &value)); - EXPECT_EQ(BAD_VALUE, mProducer->query(/*what*/0xDEADBEEF, &value)); - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_QUERY_LAST_OFF_BY_ONE, &value)); - - // Some enums from window.h are 'invalid' - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_QUEUES_TO_WINDOW_COMPOSER, &value)); - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_CONCRETE_TYPE, &value)); - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_DEFAULT_WIDTH, &value)); - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_DEFAULT_HEIGHT, &value)); - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_TRANSFORM_HINT, &value)); - // TODO: Consider documented the above enums as unsupported or make a new enum for IGBP - - // Value was NULL - EXPECT_EQ(BAD_VALUE, mProducer->query(NATIVE_WINDOW_FORMAT, /*value*/NULL)); - - ASSERT_OK(mConsumer->consumerDisconnect()); - - // BQ was abandoned - EXPECT_EQ(NO_INIT, mProducer->query(NATIVE_WINDOW_FORMAT, &value)); - - // TODO: other things in window.h that are supported by Surface::query - // but not by BufferQueue::query -} - -// TODO: queue under more complicated situations not involving just a single buffer -TEST_F(IGraphicBufferProducerTest, Queue_Succeeds) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - int dequeuedSlot = -1; - sp dequeuedFence; - - // XX: OK to assume first call returns this flag or not? Not really documented. - ASSERT_EQ(OK | IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&dequeuedSlot, &dequeuedFence, - QUEUE_BUFFER_INPUT_ASYNC, - DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FORMAT, - TEST_PRODUCER_USAGE_BITS)); - - EXPECT_LE(0, dequeuedSlot); - EXPECT_GT(BufferQueue::NUM_BUFFER_SLOTS, dequeuedSlot); - - // Request the buffer (pre-requisite for queueing) - sp dequeuedBuffer; - ASSERT_OK(mProducer->requestBuffer(dequeuedSlot, &dequeuedBuffer)); - - // A generic "valid" input - IGraphicBufferProducer::QueueBufferInput input = CreateBufferInput(); - IGraphicBufferProducer::QueueBufferOutput output; - - // Queue the buffer back into the BQ - ASSERT_OK(mProducer->queueBuffer(dequeuedSlot, input, &output)); - - { - uint32_t width; - uint32_t height; - uint32_t transformHint; - uint32_t numPendingBuffers; - - output.deflate(&width, &height, &transformHint, &numPendingBuffers); - - EXPECT_EQ(DEFAULT_WIDTH, width); - EXPECT_EQ(DEFAULT_HEIGHT, height); - EXPECT_EQ(DEFAULT_TRANSFORM_HINT, transformHint); - EXPECT_EQ(1u, numPendingBuffers); // since queueBuffer was called exactly once - } - - // Buffer was not in the dequeued state - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(dequeuedSlot, input, &output)); -} - -TEST_F(IGraphicBufferProducerTest, Queue_ReturnsError) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - // Invalid slot number - { - // A generic "valid" input - IGraphicBufferProducer::QueueBufferInput input = CreateBufferInput(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(/*slot*/-1, input, &output)); - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(/*slot*/0xDEADBEEF, input, &output)); - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(BufferQueue::NUM_BUFFER_SLOTS, - input, &output)); - } - - // Slot was not in the dequeued state (all slots start out in Free state) - { - IGraphicBufferProducer::QueueBufferInput input = CreateBufferInput(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(/*slot*/0, input, &output)); - } - - // Put the slot into the "dequeued" state for the rest of the test - int dequeuedSlot = -1; - sp dequeuedFence; - - ASSERT_EQ(OK | IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&dequeuedSlot, &dequeuedFence, - QUEUE_BUFFER_INPUT_ASYNC, - DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FORMAT, - TEST_PRODUCER_USAGE_BITS)); - - // Slot was enqueued without requesting a buffer - { - IGraphicBufferProducer::QueueBufferInput input = CreateBufferInput(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(dequeuedSlot, input, &output)); - } - - // Request the buffer so that the rest of the tests don't fail on earlier checks. - sp dequeuedBuffer; - ASSERT_OK(mProducer->requestBuffer(dequeuedSlot, &dequeuedBuffer)); - - // Fence was NULL - { - sp nullFence = NULL; - - IGraphicBufferProducer::QueueBufferInput input = - QueueBufferInputBuilder().setFence(nullFence).build(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(dequeuedSlot, input, &output)); - } - - // Scaling mode was unknown - { - IGraphicBufferProducer::QueueBufferInput input = - QueueBufferInputBuilder().setScalingMode(-1).build(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(dequeuedSlot, input, &output)); - - input = QueueBufferInputBuilder().setScalingMode(0xDEADBEEF).build(); - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(dequeuedSlot, input, &output)); - } - - // Crop rect is out of bounds of the buffer dimensions - { - IGraphicBufferProducer::QueueBufferInput input = - QueueBufferInputBuilder().setCrop(Rect(DEFAULT_WIDTH + 1, DEFAULT_HEIGHT + 1)) - .build(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(BAD_VALUE, mProducer->queueBuffer(dequeuedSlot, input, &output)); - } - - // Abandon the buffer queue so that the last test fails - ASSERT_OK(mConsumer->consumerDisconnect()); - - // The buffer queue has been abandoned. - { - IGraphicBufferProducer::QueueBufferInput input = CreateBufferInput(); - IGraphicBufferProducer::QueueBufferOutput output; - - EXPECT_EQ(NO_INIT, mProducer->queueBuffer(dequeuedSlot, input, &output)); - } -} - -TEST_F(IGraphicBufferProducerTest, CancelBuffer_DoesntCrash) { - ASSERT_NO_FATAL_FAILURE(ConnectProducer()); - - int dequeuedSlot = -1; - sp dequeuedFence; - - ASSERT_EQ(OK | IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - mProducer->dequeueBuffer(&dequeuedSlot, &dequeuedFence, - QUEUE_BUFFER_INPUT_ASYNC, - DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FORMAT, - TEST_PRODUCER_USAGE_BITS)); - - // No return code, but at least test that it doesn't blow up... - // TODO: add a return code - mProducer->cancelBuffer(dequeuedSlot, dequeuedFence); -} - -TEST_F(IGraphicBufferProducerTest, SetBufferCount_Succeeds) { - - // The producer does not wish to set a buffer count - EXPECT_OK(mProducer->setBufferCount(0)) << "bufferCount: " << 0; - // TODO: how to test "0" buffer count? - - int minBuffers; - ASSERT_OK(mProducer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minBuffers)); - - // The MIN_UNDEQUEUED_BUFFERS limit is exclusive, so need to increment by at least 1 - minBuffers++; - - ASSERT_OK(mProducer->setBufferCount(minBuffers)) << "bufferCount: " << minBuffers; - - std::vector dequeueList; - - // Should now be able to dequeue up to minBuffers times - for (int i = 0; i < minBuffers; ++i) { - DequeueBufferResult result; - - EXPECT_LE(OK, - dequeueBuffer(QUEUE_BUFFER_INPUT_ASYNC, - DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FORMAT, - TEST_PRODUCER_USAGE_BITS, &result)) - << "iteration: " << i << ", slot: " << result.slot; - - dequeueList.push_back(result); - } - - // Cancel every buffer, so we can set buffer count again - for (int i = 0; i < minBuffers; ++i) { - DequeueBufferResult& result = dequeueList[i]; - mProducer->cancelBuffer(result.slot, result.fence); - } - - ASSERT_OK(mProducer->setBufferCount(BufferQueue::NUM_BUFFER_SLOTS)); - - // Should now be able to dequeue up to NUM_BUFFER_SLOTS times - for (int i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; ++i) { - int dequeuedSlot = -1; - sp dequeuedFence; - - EXPECT_LE(OK, - mProducer->dequeueBuffer(&dequeuedSlot, &dequeuedFence, - QUEUE_BUFFER_INPUT_ASYNC, - DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FORMAT, - TEST_PRODUCER_USAGE_BITS)) - << "iteration: " << i << ", slot: " << dequeuedSlot; - } -} - -TEST_F(IGraphicBufferProducerTest, SetBufferCount_Fails) { - int minBuffers; - ASSERT_OK(mProducer->query(NATIVE_WINDOW_MIN_UNDEQUEUED_BUFFERS, &minBuffers)); - - // The MIN_UNDEQUEUED_BUFFERS limit is exclusive, so need to increment by at least 1 - minBuffers++; - - // Buffer count was out of range - EXPECT_EQ(BAD_VALUE, mProducer->setBufferCount(-1)) << "bufferCount: " << -1; - EXPECT_EQ(BAD_VALUE, mProducer->setBufferCount(minBuffers - 1)) << "bufferCount: " << minBuffers - 1; - EXPECT_EQ(BAD_VALUE, mProducer->setBufferCount(BufferQueue::NUM_BUFFER_SLOTS + 1)) - << "bufferCount: " << BufferQueue::NUM_BUFFER_SLOTS + 1; - - // Pre-requisite to fail out a valid setBufferCount call - { - int dequeuedSlot = -1; - sp dequeuedFence; - - ASSERT_LE(OK, - mProducer->dequeueBuffer(&dequeuedSlot, &dequeuedFence, - QUEUE_BUFFER_INPUT_ASYNC, - DEFAULT_WIDTH, DEFAULT_HEIGHT, DEFAULT_FORMAT, - TEST_PRODUCER_USAGE_BITS)) - << "slot: " << dequeuedSlot; - } - - // Client has one or more buffers dequeued - EXPECT_EQ(BAD_VALUE, mProducer->setBufferCount(minBuffers)) << "bufferCount: " << minBuffers; - - // Abandon buffer queue - ASSERT_OK(mConsumer->consumerDisconnect()); - - // Fail because the buffer queue was abandoned - EXPECT_EQ(NO_INIT, mProducer->setBufferCount(minBuffers)) << "bufferCount: " << minBuffers; - -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/MultiTextureConsumer_test.cpp android-platform-frameworks-native-21/libs/gui/tests/MultiTextureConsumer_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/MultiTextureConsumer_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/MultiTextureConsumer_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "MultiTextureConsumer_test" -//#define LOG_NDEBUG 0 - -#include "GLTest.h" - -#include -#include - -#include - -#include - -namespace android { - -class MultiTextureConsumerTest : public GLTest { -protected: - enum { TEX_ID = 123 }; - - virtual void SetUp() { - GLTest::SetUp(); - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - mGlConsumer = new GLConsumer(consumer, TEX_ID, - GLConsumer::TEXTURE_EXTERNAL, true, false); - mSurface = new Surface(producer); - mANW = mSurface.get(); - - } - virtual void TearDown() { - GLTest::TearDown(); - } - virtual EGLint const* getContextAttribs() { - return NULL; - } - virtual EGLint const* getConfigAttribs() { - static EGLint sDefaultConfigAttribs[] = { - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_NONE }; - - return sDefaultConfigAttribs; - } - sp mGlConsumer; - sp mSurface; - ANativeWindow* mANW; -}; - -TEST_F(MultiTextureConsumerTest, EGLImageTargetWorks) { - ANativeWindow_Buffer buffer; - - ASSERT_EQ(native_window_set_usage(mANW, GRALLOC_USAGE_SW_WRITE_OFTEN), NO_ERROR); - ASSERT_EQ(native_window_set_buffers_format(mANW, HAL_PIXEL_FORMAT_RGBA_8888), NO_ERROR); - - glShadeModel(GL_FLAT); - glDisable(GL_DITHER); - glDisable(GL_CULL_FACE); - glViewport(0, 0, getSurfaceWidth(), getSurfaceHeight()); - glOrthof(0, getSurfaceWidth(), 0, getSurfaceHeight(), 0, 1); - glEnableClientState(GL_VERTEX_ARRAY); - glColor4f(1, 1, 1, 1); - - glBindTexture(GL_TEXTURE_EXTERNAL_OES, TEX_ID); - glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - uint32_t texel = 0x80808080; - glBindTexture(GL_TEXTURE_2D, TEX_ID+1); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, 1, 1, 0, GL_RGBA, GL_UNSIGNED_BYTE, &texel); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - - glActiveTexture(GL_TEXTURE1); - glBindTexture(GL_TEXTURE_2D, TEX_ID+1); - glEnable(GL_TEXTURE_2D); - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glActiveTexture(GL_TEXTURE0); - glBindTexture(GL_TEXTURE_EXTERNAL_OES, TEX_ID); - glEnable(GL_TEXTURE_EXTERNAL_OES); - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - - glClear(GL_COLOR_BUFFER_BIT); - for (int i=0 ; i<8 ; i++) { - mSurface->lock(&buffer, NULL); - memset(buffer.bits, (i&7) * 0x20, buffer.stride * buffer.height * 4); - mSurface->unlockAndPost(); - - mGlConsumer->updateTexImage(); - - GLfloat vertices[][2] = { {i*16.0f, 0}, {(i+1)*16.0f, 0}, {(i+1)*16.0f, 16.0f}, {i*16.0f, 16.0f} }; - glVertexPointer(2, GL_FLOAT, 0, vertices); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - } - - for (int i=0 ; i<8 ; i++) { - EXPECT_TRUE(checkPixel(i*16 + 8, 8, i*16, i*16, i*16, i*16, 0)); - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SRGB_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SRGB_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SRGB_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SRGB_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,489 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "SRGB_test" -//#define LOG_NDEBUG 0 - -// Ignore for this file because it flags every instance of -// ASSERT_EQ(GL_NO_ERROR, glGetError()); -#pragma clang diagnostic ignored "-Wsign-compare" - -#include "GLTest.h" - -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include - -namespace android { - -class SRGBTest : public ::testing::Test { -protected: - // Class constants - enum { - DISPLAY_WIDTH = 512, - DISPLAY_HEIGHT = 512, - PIXEL_SIZE = 4, // bytes or components - DISPLAY_SIZE = DISPLAY_WIDTH * DISPLAY_HEIGHT * PIXEL_SIZE, - ALPHA_VALUE = 223, // should be in [0, 255] - TOLERANCE = 1, - }; - static const char SHOW_DEBUG_STRING[]; - - SRGBTest() : - mInputSurface(), mCpuConsumer(), mLockedBuffer(), - mEglDisplay(EGL_NO_DISPLAY), mEglConfig(), - mEglContext(EGL_NO_CONTEXT), mEglSurface(EGL_NO_SURFACE), - mComposerClient(), mSurfaceControl(), mOutputSurface() { - } - - virtual ~SRGBTest() { - if (mEglDisplay != EGL_NO_DISPLAY) { - if (mEglSurface != EGL_NO_SURFACE) { - eglDestroySurface(mEglDisplay, mEglSurface); - } - if (mEglContext != EGL_NO_CONTEXT) { - eglDestroyContext(mEglDisplay, mEglContext); - } - eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); - eglTerminate(mEglDisplay); - } - } - - virtual void SetUp() { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - ASSERT_EQ(NO_ERROR, consumer->setDefaultBufferSize( - DISPLAY_WIDTH, DISPLAY_HEIGHT)); - mCpuConsumer = new CpuConsumer(consumer, 1); - String8 name("CpuConsumer_for_SRGBTest"); - mCpuConsumer->setName(name); - mInputSurface = new Surface(producer); - - ASSERT_NO_FATAL_FAILURE(createEGLSurface(mInputSurface.get())); - ASSERT_NO_FATAL_FAILURE(createDebugSurface()); - } - - virtual void TearDown() { - ASSERT_NO_FATAL_FAILURE(copyToDebugSurface()); - ASSERT_TRUE(mLockedBuffer.data != NULL); - ASSERT_EQ(NO_ERROR, mCpuConsumer->unlockBuffer(mLockedBuffer)); - } - - static float linearToSRGB(float l) { - if (l <= 0.0031308f) { - return l * 12.92f; - } else { - return 1.055f * pow(l, (1 / 2.4f)) - 0.055f; - } - } - - static float srgbToLinear(float s) { - if (s <= 0.04045) { - return s / 12.92f; - } else { - return pow(((s + 0.055f) / 1.055f), 2.4f); - } - } - - static uint8_t srgbToLinear(uint8_t u) { - float f = u / 255.0f; - return static_cast(srgbToLinear(f) * 255.0f + 0.5f); - } - - void fillTexture(bool writeAsSRGB) { - uint8_t* textureData = new uint8_t[DISPLAY_SIZE]; - - for (int y = 0; y < DISPLAY_HEIGHT; ++y) { - for (int x = 0; x < DISPLAY_WIDTH; ++x) { - float realValue = static_cast(x) / (DISPLAY_WIDTH - 1); - realValue *= ALPHA_VALUE / 255.0f; // Premultiply by alpha - if (writeAsSRGB) { - realValue = linearToSRGB(realValue); - } - - int offset = (y * DISPLAY_WIDTH + x) * PIXEL_SIZE; - for (int c = 0; c < 3; ++c) { - uint8_t intValue = static_cast( - realValue * 255.0f + 0.5f); - textureData[offset + c] = intValue; - } - textureData[offset + 3] = ALPHA_VALUE; - } - } - - glTexImage2D(GL_TEXTURE_2D, 0, writeAsSRGB ? GL_SRGB8_ALPHA8 : GL_RGBA8, - DISPLAY_WIDTH, DISPLAY_HEIGHT, 0, GL_RGBA, GL_UNSIGNED_BYTE, - textureData); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - - delete[] textureData; - } - - void initShaders() { - static const char vertexSource[] = - "attribute vec4 vPosition;\n" - "varying vec2 texCoords;\n" - "void main() {\n" - " texCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n" - " gl_Position = vPosition;\n" - "}\n"; - - static const char fragmentSource[] = - "precision mediump float;\n" - "uniform sampler2D texSampler;\n" - "varying vec2 texCoords;\n" - "void main() {\n" - " gl_FragColor = texture2D(texSampler, texCoords);\n" - "}\n"; - - GLuint program; - { - SCOPED_TRACE("Creating shader program"); - ASSERT_NO_FATAL_FAILURE(GLTest::createProgram( - vertexSource, fragmentSource, &program)); - } - - GLint positionHandle = glGetAttribLocation(program, "vPosition"); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - ASSERT_NE(-1, positionHandle); - - GLint samplerHandle = glGetUniformLocation(program, "texSampler"); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - ASSERT_NE(-1, samplerHandle); - - static const GLfloat vertices[] = { - -1.0f, 1.0f, - -1.0f, -1.0f, - 1.0f, -1.0f, - 1.0f, 1.0f, - }; - - glVertexAttribPointer(positionHandle, 2, GL_FLOAT, GL_FALSE, 0, vertices); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glEnableVertexAttribArray(positionHandle); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - - glUseProgram(program); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glUniform1i(samplerHandle, 0); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - - GLuint textureHandle; - glGenTextures(1, &textureHandle); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glBindTexture(GL_TEXTURE_2D, textureHandle); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - } - - void drawTexture(bool asSRGB, GLint x, GLint y, GLsizei width, - GLsizei height) { - ASSERT_NO_FATAL_FAILURE(fillTexture(asSRGB)); - glViewport(x, y, width, height); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - ASSERT_EQ(GL_NO_ERROR, glGetError()); - } - - void checkLockedBuffer(PixelFormat format, android_dataspace dataSpace) { - ASSERT_EQ(mLockedBuffer.format, format); - ASSERT_EQ(mLockedBuffer.width, DISPLAY_WIDTH); - ASSERT_EQ(mLockedBuffer.height, DISPLAY_HEIGHT); - ASSERT_EQ(mLockedBuffer.dataSpace, dataSpace); - } - - static bool withinTolerance(int a, int b) { - int diff = a - b; - return diff >= 0 ? diff <= TOLERANCE : -diff <= TOLERANCE; - } - - // Primary producer and consumer - sp mInputSurface; - sp mCpuConsumer; - CpuConsumer::LockedBuffer mLockedBuffer; - - EGLDisplay mEglDisplay; - EGLConfig mEglConfig; - EGLContext mEglContext; - EGLSurface mEglSurface; - - // Auxiliary display output - sp mComposerClient; - sp mSurfaceControl; - sp mOutputSurface; - -private: - void createEGLSurface(Surface* inputSurface) { - mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay); - - EXPECT_TRUE(eglInitialize(mEglDisplay, NULL, NULL)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - static const EGLint configAttribs[] = { - EGL_SURFACE_TYPE, EGL_WINDOW_BIT, - EGL_RENDERABLE_TYPE, EGL_OPENGL_ES3_BIT_KHR, - EGL_RED_SIZE, 8, - EGL_GREEN_SIZE, 8, - EGL_BLUE_SIZE, 8, - EGL_ALPHA_SIZE, 8, - EGL_NONE }; - - EGLint numConfigs = 0; - EXPECT_TRUE(eglChooseConfig(mEglDisplay, configAttribs, &mEglConfig, 1, - &numConfigs)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_GT(numConfigs, 0); - - static const EGLint contextAttribs[] = { - EGL_CONTEXT_CLIENT_VERSION, 3, - EGL_NONE } ; - - mEglContext = eglCreateContext(mEglDisplay, mEglConfig, EGL_NO_CONTEXT, - contextAttribs); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_CONTEXT, mEglContext); - - mEglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, - inputSurface, NULL); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_SURFACE, mEglSurface); - - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - } - - void createDebugSurface() { - if (getenv(SHOW_DEBUG_STRING) == NULL) return; - - mComposerClient = new SurfaceComposerClient; - ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); - - mSurfaceControl = mComposerClient->createSurface( - String8("SRGBTest Surface"), DISPLAY_WIDTH, DISPLAY_HEIGHT, - PIXEL_FORMAT_RGBA_8888); - - ASSERT_TRUE(mSurfaceControl != NULL); - ASSERT_TRUE(mSurfaceControl->isValid()); - - SurfaceComposerClient::openGlobalTransaction(); - ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(0x7FFFFFFF)); - ASSERT_EQ(NO_ERROR, mSurfaceControl->show()); - SurfaceComposerClient::closeGlobalTransaction(); - - ANativeWindow_Buffer outBuffer; - ARect inOutDirtyBounds; - mOutputSurface = mSurfaceControl->getSurface(); - mOutputSurface->lock(&outBuffer, &inOutDirtyBounds); - uint8_t* bytePointer = reinterpret_cast(outBuffer.bits); - for (int y = 0; y < outBuffer.height; ++y) { - int rowOffset = y * outBuffer.stride; // pixels - for (int x = 0; x < outBuffer.width; ++x) { - int colOffset = (rowOffset + x) * PIXEL_SIZE; // bytes - for (int c = 0; c < PIXEL_SIZE; ++c) { - int offset = colOffset + c; - bytePointer[offset] = ((c + 1) * 56) - 1; - } - } - } - mOutputSurface->unlockAndPost(); - } - - void copyToDebugSurface() { - if (!mOutputSurface.get()) return; - - size_t bufferSize = mLockedBuffer.height * mLockedBuffer.stride * - PIXEL_SIZE; - - ANativeWindow_Buffer outBuffer; - ARect outBufferBounds; - mOutputSurface->lock(&outBuffer, &outBufferBounds); - ASSERT_EQ(mLockedBuffer.width, static_cast(outBuffer.width)); - ASSERT_EQ(mLockedBuffer.height, static_cast(outBuffer.height)); - ASSERT_EQ(mLockedBuffer.stride, static_cast(outBuffer.stride)); - - if (mLockedBuffer.format == outBuffer.format) { - memcpy(outBuffer.bits, mLockedBuffer.data, bufferSize); - } else { - ASSERT_EQ(mLockedBuffer.format, PIXEL_FORMAT_RGBA_8888); - ASSERT_EQ(mLockedBuffer.dataSpace, HAL_DATASPACE_SRGB); - ASSERT_EQ(outBuffer.format, PIXEL_FORMAT_RGBA_8888); - uint8_t* outPointer = reinterpret_cast(outBuffer.bits); - for (int y = 0; y < outBuffer.height; ++y) { - int rowOffset = y * outBuffer.stride; // pixels - for (int x = 0; x < outBuffer.width; ++x) { - int colOffset = (rowOffset + x) * PIXEL_SIZE; // bytes - - // RGB are converted - for (int c = 0; c < (PIXEL_SIZE - 1); ++c) { - outPointer[colOffset + c] = srgbToLinear( - mLockedBuffer.data[colOffset + c]); - } - - // Alpha isn't converted - outPointer[colOffset + 3] = - mLockedBuffer.data[colOffset + 3]; - } - } - } - mOutputSurface->unlockAndPost(); - - int sleepSeconds = atoi(getenv(SHOW_DEBUG_STRING)); - sleep(sleepSeconds); - } -}; - -const char SRGBTest::SHOW_DEBUG_STRING[] = "DEBUG_OUTPUT_SECONDS"; - -TEST_F(SRGBTest, GLRenderFromSRGBTexture) { - ASSERT_NO_FATAL_FAILURE(initShaders()); - - // The RGB texture is displayed in the top half - ASSERT_NO_FATAL_FAILURE(drawTexture(false, 0, DISPLAY_HEIGHT / 2, - DISPLAY_WIDTH, DISPLAY_HEIGHT / 2)); - - // The SRGB texture is displayed in the bottom half - ASSERT_NO_FATAL_FAILURE(drawTexture(true, 0, 0, - DISPLAY_WIDTH, DISPLAY_HEIGHT / 2)); - - eglSwapBuffers(mEglDisplay, mEglSurface); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Lock - ASSERT_EQ(NO_ERROR, mCpuConsumer->lockNextBuffer(&mLockedBuffer)); - ASSERT_NO_FATAL_FAILURE( - checkLockedBuffer(PIXEL_FORMAT_RGBA_8888, HAL_DATASPACE_UNKNOWN)); - - // Compare a pixel in the middle of each texture - int midSRGBOffset = (DISPLAY_HEIGHT / 4) * mLockedBuffer.stride * - PIXEL_SIZE; - int midRGBOffset = midSRGBOffset * 3; - midRGBOffset += (DISPLAY_WIDTH / 2) * PIXEL_SIZE; - midSRGBOffset += (DISPLAY_WIDTH / 2) * PIXEL_SIZE; - for (int c = 0; c < PIXEL_SIZE; ++c) { - int expectedValue = mLockedBuffer.data[midRGBOffset + c]; - int actualValue = mLockedBuffer.data[midSRGBOffset + c]; - ASSERT_PRED2(withinTolerance, expectedValue, actualValue); - } - - // mLockedBuffer is unlocked in TearDown so we can copy data from it to - // the debug surface if necessary -} - -// XXX: Disabled since we don't currently expect this to work -TEST_F(SRGBTest, DISABLED_RenderToSRGBSurface) { - ASSERT_NO_FATAL_FAILURE(initShaders()); - - // By default, the first buffer we write into will be RGB - - // Render an RGB texture across the whole surface - ASSERT_NO_FATAL_FAILURE(drawTexture(false, 0, 0, - DISPLAY_WIDTH, DISPLAY_HEIGHT)); - eglSwapBuffers(mEglDisplay, mEglSurface); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Lock - ASSERT_EQ(NO_ERROR, mCpuConsumer->lockNextBuffer(&mLockedBuffer)); - ASSERT_NO_FATAL_FAILURE( - checkLockedBuffer(PIXEL_FORMAT_RGBA_8888, HAL_DATASPACE_UNKNOWN)); - - // Save the values of the middle pixel for later comparison against SRGB - uint8_t values[PIXEL_SIZE] = {}; - int middleOffset = (DISPLAY_HEIGHT / 2) * mLockedBuffer.stride * - PIXEL_SIZE; - middleOffset += (DISPLAY_WIDTH / 2) * PIXEL_SIZE; - for (int c = 0; c < PIXEL_SIZE; ++c) { - values[c] = mLockedBuffer.data[middleOffset + c]; - } - - // Unlock - ASSERT_EQ(NO_ERROR, mCpuConsumer->unlockBuffer(mLockedBuffer)); - - // Switch to SRGB window surface -#define EGL_GL_COLORSPACE_KHR EGL_VG_COLORSPACE -#define EGL_GL_COLORSPACE_SRGB_KHR EGL_VG_COLORSPACE_sRGB - - static const int srgbAttribs[] = { - EGL_GL_COLORSPACE_KHR, EGL_GL_COLORSPACE_SRGB_KHR, - EGL_NONE, - }; - - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - EXPECT_TRUE(eglDestroySurface(mEglDisplay, mEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - mEglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, - mInputSurface.get(), srgbAttribs); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_SURFACE, mEglSurface); - - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Render the texture again - ASSERT_NO_FATAL_FAILURE(drawTexture(false, 0, 0, - DISPLAY_WIDTH, DISPLAY_HEIGHT)); - eglSwapBuffers(mEglDisplay, mEglSurface); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Lock - ASSERT_EQ(NO_ERROR, mCpuConsumer->lockNextBuffer(&mLockedBuffer)); - - // Make sure we actually got the SRGB buffer on the consumer side - ASSERT_NO_FATAL_FAILURE( - checkLockedBuffer(PIXEL_FORMAT_RGBA_8888, HAL_DATASPACE_SRGB)); - - // Verify that the stored value is the same, accounting for RGB/SRGB - for (int c = 0; c < PIXEL_SIZE; ++c) { - // The alpha value should be equivalent before linear->SRGB - float rgbAsSRGB = (c == 3) ? values[c] / 255.0f : - linearToSRGB(values[c] / 255.0f); - int expectedValue = rgbAsSRGB * 255.0f + 0.5f; - int actualValue = mLockedBuffer.data[middleOffset + c]; - ASSERT_PRED2(withinTolerance, expectedValue, actualValue); - } - - // mLockedBuffer is unlocked in TearDown so we can copy data from it to - // the debug surface if necessary -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/StreamSplitter_test.cpp android-platform-frameworks-native-21/libs/gui/tests/StreamSplitter_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/StreamSplitter_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/StreamSplitter_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,252 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#define LOG_TAG "StreamSplitter_test" -//#define LOG_NDEBUG 0 - -#include -#include -#include -#include -#include -#include - -#include - -namespace android { - -class StreamSplitterTest : public ::testing::Test { - -protected: - StreamSplitterTest() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("Begin test: %s.%s", testInfo->test_case_name(), - testInfo->name()); - } - - ~StreamSplitterTest() { - const ::testing::TestInfo* const testInfo = - ::testing::UnitTest::GetInstance()->current_test_info(); - ALOGV("End test: %s.%s", testInfo->test_case_name(), - testInfo->name()); - } -}; - -struct DummyListener : public BnConsumerListener { - virtual void onFrameAvailable(const BufferItem& /* item */) {} - virtual void onBuffersReleased() {} - virtual void onSidebandStreamChanged() {} -}; - -class CountedAllocator : public BnGraphicBufferAlloc { -public: - CountedAllocator() : mAllocCount(0) { - sp composer(ComposerService::getComposerService()); - mAllocator = composer->createGraphicBufferAlloc(); - } - - virtual ~CountedAllocator() {} - - virtual sp createGraphicBuffer(uint32_t w, uint32_t h, - PixelFormat format, uint32_t usage, status_t* error) { - ++mAllocCount; - sp buffer = mAllocator->createGraphicBuffer(w, h, format, - usage, error); - return buffer; - } - - int getAllocCount() const { return mAllocCount; } - -private: - sp mAllocator; - int mAllocCount; -}; - -static const uint32_t TEST_DATA = 0x12345678u; - -TEST_F(StreamSplitterTest, OneInputOneOutput) { - sp allocator(new CountedAllocator); - - sp inputProducer; - sp inputConsumer; - BufferQueue::createBufferQueue(&inputProducer, &inputConsumer, allocator); - - sp outputProducer; - sp outputConsumer; - BufferQueue::createBufferQueue(&outputProducer, &outputConsumer, allocator); - ASSERT_EQ(OK, outputConsumer->consumerConnect(new DummyListener, false)); - - sp splitter; - status_t status = StreamSplitter::createSplitter(inputConsumer, &splitter); - ASSERT_EQ(OK, status); - ASSERT_EQ(OK, splitter->addOutput(outputProducer)); - - IGraphicBufferProducer::QueueBufferOutput qbOutput; - ASSERT_EQ(OK, inputProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, false, &qbOutput)); - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - inputProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, inputProducer->requestBuffer(slot, &buffer)); - - uint32_t* dataIn; - ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN, - reinterpret_cast(&dataIn))); - *dataIn = TEST_DATA; - ASSERT_EQ(OK, buffer->unlock()); - - IGraphicBufferProducer::QueueBufferInput qbInput(0, false, - HAL_DATASPACE_UNKNOWN, - Rect(0, 0, 1, 1), NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, - Fence::NO_FENCE); - ASSERT_EQ(OK, inputProducer->queueBuffer(slot, qbInput, &qbOutput)); - - BufferItem item; - ASSERT_EQ(OK, outputConsumer->acquireBuffer(&item, 0)); - - uint32_t* dataOut; - ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, - reinterpret_cast(&dataOut))); - ASSERT_EQ(*dataOut, TEST_DATA); - ASSERT_EQ(OK, item.mGraphicBuffer->unlock()); - - ASSERT_EQ(OK, outputConsumer->releaseBuffer(item.mBuf, item.mFrameNumber, - EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, Fence::NO_FENCE)); - - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - inputProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - - ASSERT_EQ(1, allocator->getAllocCount()); -} - -TEST_F(StreamSplitterTest, OneInputMultipleOutputs) { - const int NUM_OUTPUTS = 4; - sp allocator(new CountedAllocator); - - sp inputProducer; - sp inputConsumer; - BufferQueue::createBufferQueue(&inputProducer, &inputConsumer, allocator); - - sp outputProducers[NUM_OUTPUTS] = {}; - sp outputConsumers[NUM_OUTPUTS] = {}; - for (int output = 0; output < NUM_OUTPUTS; ++output) { - BufferQueue::createBufferQueue(&outputProducers[output], - &outputConsumers[output], allocator); - ASSERT_EQ(OK, outputConsumers[output]->consumerConnect( - new DummyListener, false)); - } - - sp splitter; - status_t status = StreamSplitter::createSplitter(inputConsumer, &splitter); - ASSERT_EQ(OK, status); - for (int output = 0; output < NUM_OUTPUTS; ++output) { - ASSERT_EQ(OK, splitter->addOutput(outputProducers[output])); - } - - IGraphicBufferProducer::QueueBufferOutput qbOutput; - ASSERT_EQ(OK, inputProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, false, &qbOutput)); - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - inputProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, inputProducer->requestBuffer(slot, &buffer)); - - uint32_t* dataIn; - ASSERT_EQ(OK, buffer->lock(GraphicBuffer::USAGE_SW_WRITE_OFTEN, - reinterpret_cast(&dataIn))); - *dataIn = TEST_DATA; - ASSERT_EQ(OK, buffer->unlock()); - - IGraphicBufferProducer::QueueBufferInput qbInput(0, false, - HAL_DATASPACE_UNKNOWN, - Rect(0, 0, 1, 1), NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, - Fence::NO_FENCE); - ASSERT_EQ(OK, inputProducer->queueBuffer(slot, qbInput, &qbOutput)); - - for (int output = 0; output < NUM_OUTPUTS; ++output) { - BufferItem item; - ASSERT_EQ(OK, outputConsumers[output]->acquireBuffer(&item, 0)); - - uint32_t* dataOut; - ASSERT_EQ(OK, item.mGraphicBuffer->lock(GraphicBuffer::USAGE_SW_READ_OFTEN, - reinterpret_cast(&dataOut))); - ASSERT_EQ(*dataOut, TEST_DATA); - ASSERT_EQ(OK, item.mGraphicBuffer->unlock()); - - ASSERT_EQ(OK, outputConsumers[output]->releaseBuffer(item.mBuf, - item.mFrameNumber, EGL_NO_DISPLAY, EGL_NO_SYNC_KHR, - Fence::NO_FENCE)); - } - - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - inputProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - - ASSERT_EQ(1, allocator->getAllocCount()); -} - -TEST_F(StreamSplitterTest, OutputAbandonment) { - sp inputProducer; - sp inputConsumer; - BufferQueue::createBufferQueue(&inputProducer, &inputConsumer); - - sp outputProducer; - sp outputConsumer; - BufferQueue::createBufferQueue(&outputProducer, &outputConsumer); - ASSERT_EQ(OK, outputConsumer->consumerConnect(new DummyListener, false)); - - sp splitter; - status_t status = StreamSplitter::createSplitter(inputConsumer, &splitter); - ASSERT_EQ(OK, status); - ASSERT_EQ(OK, splitter->addOutput(outputProducer)); - - IGraphicBufferProducer::QueueBufferOutput qbOutput; - ASSERT_EQ(OK, inputProducer->connect(new DummyProducerListener, - NATIVE_WINDOW_API_CPU, false, &qbOutput)); - - int slot; - sp fence; - sp buffer; - ASSERT_EQ(IGraphicBufferProducer::BUFFER_NEEDS_REALLOCATION, - inputProducer->dequeueBuffer(&slot, &fence, false, 0, 0, 0, - GRALLOC_USAGE_SW_WRITE_OFTEN)); - ASSERT_EQ(OK, inputProducer->requestBuffer(slot, &buffer)); - - // Abandon the output - outputConsumer->consumerDisconnect(); - - IGraphicBufferProducer::QueueBufferInput qbInput(0, false, - HAL_DATASPACE_UNKNOWN, - Rect(0, 0, 1, 1), NATIVE_WINDOW_SCALING_MODE_FREEZE, 0, false, - Fence::NO_FENCE); - ASSERT_EQ(OK, inputProducer->queueBuffer(slot, qbInput, &qbOutput)); - - // Input should be abandoned - ASSERT_EQ(NO_INIT, inputProducer->dequeueBuffer(&slot, &fence, false, 0, 0, - 0, GRALLOC_USAGE_SW_WRITE_OFTEN)); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/Surface_test.cpp android-platform-frameworks-native-21/libs/gui/tests/Surface_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/Surface_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/Surface_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -14,36 +14,26 @@ * limitations under the License. */ -#include "DummyConsumer.h" - #include #include #include #include #include -#include -#include #include #include -#include namespace android { class SurfaceTest : public ::testing::Test { protected: - - SurfaceTest() { - ProcessState::self()->startThreadPool(); - } - virtual void SetUp() { mComposerClient = new SurfaceComposerClient; ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); mSurfaceControl = mComposerClient->createSurface( - String8("Test Surface"), 32, 32, PIXEL_FORMAT_RGBA_8888, 0); + String8("Test Surface"), 0, 32, 32, PIXEL_FORMAT_RGBA_8888, 0); ASSERT_TRUE(mSurfaceControl != NULL); ASSERT_TRUE(mSurfaceControl->isValid()); @@ -91,14 +81,13 @@ sp anw(mSurface); // Verify the screenshot works with no protected buffers. - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - sp cpuConsumer = new CpuConsumer(consumer, 1); + sp heap; + uint32_t w=0, h=0; + PixelFormat fmt=0; sp sf(ComposerService::getComposerService()); - sp display(sf->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); - ASSERT_EQ(NO_ERROR, sf->captureScreen(display, producer, Rect(), - 64, 64, 0, 0x7fffffff, false)); + ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt, 64, 64, 0, + 0x7fffffff)); + ASSERT_TRUE(heap != NULL); // Set the PROTECTED usage bit and verify that the screenshot fails. Note // that we need to dequeue a buffer in order for it to actually get @@ -108,26 +97,28 @@ ASSERT_EQ(NO_ERROR, native_window_set_buffer_count(anw.get(), 3)); ANativeWindowBuffer* buf = 0; - status_t err = native_window_dequeue_buffer_and_wait(anw.get(), &buf); + status_t err = anw->dequeueBuffer(anw.get(), &buf); if (err) { // we could fail if GRALLOC_USAGE_PROTECTED is not supported. // that's okay as long as this is the reason for the failure. // try again without the GRALLOC_USAGE_PROTECTED bit. ASSERT_EQ(NO_ERROR, native_window_set_usage(anw.get(), 0)); - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(anw.get(), - &buf)); + ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf)); return; } - ASSERT_EQ(NO_ERROR, anw->cancelBuffer(anw.get(), buf, -1)); + ASSERT_EQ(NO_ERROR, anw->cancelBuffer(anw.get(), buf)); for (int i = 0; i < 4; i++) { // Loop to make sure SurfaceFlinger has retired a protected buffer. - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(anw.get(), - &buf)); - ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf, -1)); + ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &buf)); + ASSERT_EQ(NO_ERROR, anw->lockBuffer(anw.get(), buf)); + ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf)); } - ASSERT_EQ(NO_ERROR, sf->captureScreen(display, producer, Rect(), - 64, 64, 0, 0x7fffffff, false)); + heap = 0; + w = h = fmt = 0; + ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt, + 64, 64, 0, 0x7fffffff)); + ASSERT_TRUE(heap != NULL); } TEST_F(SurfaceTest, ConcreteTypeIsSurface) { @@ -138,94 +129,4 @@ EXPECT_EQ(NATIVE_WINDOW_SURFACE, result); } -TEST_F(SurfaceTest, QueryConsumerUsage) { - const int TEST_USAGE_FLAGS = - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_HW_RENDER; - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - sp c = new BufferItemConsumer(consumer, - TEST_USAGE_FLAGS); - sp s = new Surface(producer); - - sp anw(s); - - int flags = -1; - int err = anw->query(anw.get(), NATIVE_WINDOW_CONSUMER_USAGE_BITS, &flags); - - ASSERT_EQ(NO_ERROR, err); - ASSERT_EQ(TEST_USAGE_FLAGS, flags); -} - -TEST_F(SurfaceTest, QueryDefaultBuffersDataSpace) { - const android_dataspace TEST_DATASPACE = HAL_DATASPACE_SRGB; - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - sp cpuConsumer = new CpuConsumer(consumer, 1); - - cpuConsumer->setDefaultBufferDataSpace(TEST_DATASPACE); - - sp s = new Surface(producer); - - sp anw(s); - - android_dataspace dataSpace; - - int err = anw->query(anw.get(), NATIVE_WINDOW_DEFAULT_DATASPACE, - reinterpret_cast(&dataSpace)); - - ASSERT_EQ(NO_ERROR, err); - ASSERT_EQ(TEST_DATASPACE, dataSpace); -} - -TEST_F(SurfaceTest, SettingGenerationNumber) { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - sp cpuConsumer = new CpuConsumer(consumer, 1); - sp surface = new Surface(producer); - sp window(surface); - - // Allocate a buffer with a generation number of 0 - ANativeWindowBuffer* buffer; - int fenceFd; - ASSERT_EQ(NO_ERROR, window->dequeueBuffer(window.get(), &buffer, &fenceFd)); - ASSERT_EQ(NO_ERROR, window->cancelBuffer(window.get(), buffer, fenceFd)); - - // Detach the buffer and check its generation number - sp graphicBuffer; - sp fence; - ASSERT_EQ(NO_ERROR, surface->detachNextBuffer(&graphicBuffer, &fence)); - ASSERT_EQ(0U, graphicBuffer->getGenerationNumber()); - - ASSERT_EQ(NO_ERROR, surface->setGenerationNumber(1)); - buffer = static_cast(graphicBuffer.get()); - - // This should change the generation number of the GraphicBuffer - ASSERT_EQ(NO_ERROR, surface->attachBuffer(buffer)); - - // Check that the new generation number sticks with the buffer - ASSERT_EQ(NO_ERROR, window->cancelBuffer(window.get(), buffer, -1)); - ASSERT_EQ(NO_ERROR, window->dequeueBuffer(window.get(), &buffer, &fenceFd)); - graphicBuffer = static_cast(buffer); - ASSERT_EQ(1U, graphicBuffer->getGenerationNumber()); -} - -TEST_F(SurfaceTest, GetConsumerName) { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - - sp dummyConsumer(new DummyConsumer); - consumer->consumerConnect(dummyConsumer, false); - consumer->setConsumerName(String8("TestConsumer")); - - sp surface = new Surface(producer); - sp window(surface); - native_window_api_connect(window.get(), NATIVE_WINDOW_API_CPU); - - EXPECT_STREQ("TestConsumer", surface->getConsumerName().string()); -} - } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureClient_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureClient_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureClient_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureClient_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -18,18 +18,12 @@ //#define LOG_NDEBUG 0 #include -#include - #include -#include -#include +#include #include #include #include -EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); -#define CROP_EXT_STR "EGL_ANDROID_image_crop" - namespace android { class SurfaceTextureClientTest : public ::testing::Test { @@ -46,12 +40,8 @@ ALOGV("Begin test: %s.%s", testInfo->test_case_name(), testInfo->name()); - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - mST = new GLConsumer(consumer, 123, GLConsumer::TEXTURE_EXTERNAL, true, - false); - mSTC = new Surface(producer); + mST = new SurfaceTexture(123); + mSTC = new SurfaceTextureClient(mST); mANW = mSTC; // We need a valid GL context so we can test updateTexImage() @@ -71,7 +61,6 @@ &myConfig, 1, &numConfigs)); ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mEglConfig = myConfig; EGLint pbufferAttribs[] = { EGL_WIDTH, 16, EGL_HEIGHT, 16, @@ -106,25 +95,24 @@ virtual EGLint const* getConfigAttribs() { static EGLint sDefaultConfigAttribs[] = { - EGL_SURFACE_TYPE, EGL_PBUFFER_BIT | EGL_WINDOW_BIT, + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, EGL_NONE }; return sDefaultConfigAttribs; } - sp mST; - sp mSTC; + sp mST; + sp mSTC; sp mANW; EGLDisplay mEglDisplay; EGLSurface mEglSurface; EGLContext mEglContext; - EGLConfig mEglConfig; }; TEST_F(SurfaceTextureClientTest, GetISurfaceTextureIsNotNull) { - sp ist(mSTC->getIGraphicBufferProducer()); + sp ist(mSTC->getISurfaceTexture()); ASSERT_TRUE(ist != NULL); } @@ -140,7 +128,7 @@ int result = -123; int err = mANW->query(mANW.get(), NATIVE_WINDOW_CONCRETE_TYPE, &result); EXPECT_EQ(NO_ERROR, err); - EXPECT_EQ(NATIVE_WINDOW_SURFACE, result); + EXPECT_EQ(NATIVE_WINDOW_SURFACE_TEXTURE_CLIENT, result); } TEST_F(SurfaceTextureClientTest, EglCreateWindowSurfaceSucceeds) { @@ -181,190 +169,159 @@ eglTerminate(dpy); } -TEST_F(SurfaceTextureClientTest, EglSwapBuffersAbandonErrorIsEglBadSurface) { - - EGLSurface eglSurface = eglCreateWindowSurface(mEglDisplay, mEglConfig, mANW.get(), NULL); - EXPECT_NE(EGL_NO_SURFACE, eglSurface); - EXPECT_EQ(EGL_SUCCESS, eglGetError()); - - EGLBoolean success = eglMakeCurrent(mEglDisplay, eglSurface, eglSurface, mEglContext); - EXPECT_TRUE(success); - - glClear(GL_COLOR_BUFFER_BIT); - success = eglSwapBuffers(mEglDisplay, eglSurface); - EXPECT_TRUE(success); - - mST->abandon(); - - glClear(GL_COLOR_BUFFER_BIT); - success = eglSwapBuffers(mEglDisplay, eglSurface); - EXPECT_FALSE(success); - EXPECT_EQ(EGL_BAD_SURFACE, eglGetError()); - - success = eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, mEglContext); - ASSERT_TRUE(success); - - if (eglSurface != EGL_NO_SURFACE) { - eglDestroySurface(mEglDisplay, eglSurface); - } -} - TEST_F(SurfaceTextureClientTest, BufferGeometryInvalidSizesFail) { - EXPECT_GT(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 8)); - EXPECT_GT(OK, native_window_set_buffers_dimensions(mANW.get(), 8, 0)); + EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, 0, 0)); + EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, -1, 0)); + EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, -1)); + EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), -1, -1, 0)); + EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 0, 8, 0)); + EXPECT_GT(OK, native_window_set_buffers_geometry(mANW.get(), 8, 0, 0)); } TEST_F(SurfaceTextureClientTest, DefaultGeometryValues) { ANativeWindowBuffer* buf; - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(1, buf->width); EXPECT_EQ(1, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, BufferGeometryCanBeSet) { ANativeWindowBuffer* buf; - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), PIXEL_FORMAT_RGB_565)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, PIXEL_FORMAT_RGB_565)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(16, buf->width); EXPECT_EQ(8, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, BufferGeometryDefaultSizeSetFormat) { ANativeWindowBuffer* buf; - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 0)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), PIXEL_FORMAT_RGB_565)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, PIXEL_FORMAT_RGB_565)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(1, buf->width); EXPECT_EQ(1, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, BufferGeometrySetSizeDefaultFormat) { ANativeWindowBuffer* buf; - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(16, buf->width); EXPECT_EQ(8, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeUnset) { ANativeWindowBuffer* buf; - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(16, buf->width); EXPECT_EQ(8, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 0)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, 0)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(1, buf->width); EXPECT_EQ(1, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, BufferGeometrySizeCanBeChangedWithoutFormat) { ANativeWindowBuffer* buf; - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 0, 0)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), PIXEL_FORMAT_RGB_565)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 0, 0, PIXEL_FORMAT_RGB_565)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(1, buf->width); EXPECT_EQ(1, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 16, 8)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 16, 8, 0)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(16, buf->width); EXPECT_EQ(8, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGB_565, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSize) { - sp st(mST); + sp st(mST); ANativeWindowBuffer* buf; EXPECT_EQ(OK, st->setDefaultBufferSize(16, 8)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); EXPECT_EQ(16, buf->width); EXPECT_EQ(8, buf->height); EXPECT_EQ(PIXEL_FORMAT_RGBA_8888, buf->format); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf)); } TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeAfterDequeue) { ANativeWindowBuffer* buf[2]; ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); EXPECT_NE(buf[0], buf[1]); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1])); EXPECT_EQ(OK, mST->setDefaultBufferSize(16, 8)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); EXPECT_NE(buf[0], buf[1]); EXPECT_EQ(16, buf[0]->width); EXPECT_EQ(16, buf[1]->width); EXPECT_EQ(8, buf[0]->height); EXPECT_EQ(8, buf[1]->height); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1])); } TEST_F(SurfaceTextureClientTest, SurfaceTextureSetDefaultSizeVsGeometry) { ANativeWindowBuffer* buf[2]; ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); EXPECT_EQ(OK, mST->setDefaultBufferSize(16, 8)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); EXPECT_NE(buf[0], buf[1]); EXPECT_EQ(16, buf[0]->width); EXPECT_EQ(16, buf[1]->width); EXPECT_EQ(8, buf[0]->height); EXPECT_EQ(8, buf[1]->height); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1], -1)); - EXPECT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 12, 24)); - EXPECT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1])); + EXPECT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 12, 24, 0)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); EXPECT_NE(buf[0], buf[1]); EXPECT_EQ(12, buf[0]->width); EXPECT_EQ(12, buf[1]->width); EXPECT_EQ(24, buf[0]->height); EXPECT_EQ(24, buf[1]->height); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[1])); } TEST_F(SurfaceTextureClientTest, SurfaceTextureTooManyUpdateTexImage) { android_native_buffer_t* buf[3]; - ASSERT_EQ(OK, mANW->setSwapInterval(mANW.get(), 0)); + ASSERT_EQ(OK, mST->setSynchronousMode(false)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(OK, mST->updateTexImage()); - ASSERT_EQ(OK, mANW->setSwapInterval(mANW.get(), 1)); + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(OK, mST->updateTexImage()); @@ -373,16 +330,17 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeSlowRetire) { android_native_buffer_t* buf[3]; + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); EXPECT_NE(buf[0], buf[1]); EXPECT_NE(buf[1], buf[2]); EXPECT_NE(buf[2], buf[0]); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[0]); EXPECT_EQ(OK, mST->updateTexImage()); @@ -393,42 +351,44 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeFastRetire) { android_native_buffer_t* buf[3]; + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); EXPECT_NE(buf[0], buf[1]); EXPECT_NE(buf[1], buf[2]); EXPECT_NE(buf[2], buf[0]); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[0]); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[2]); } TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeDQQR) { android_native_buffer_t* buf[3]; + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[0]); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); EXPECT_NE(buf[0], buf[1]); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); EXPECT_NE(buf[1], buf[2]); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[2]); } @@ -438,17 +398,18 @@ TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeDequeueCurrent) { android_native_buffer_t* buf[3]; android_native_buffer_t* firstBuf; + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &firstBuf)); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), firstBuf, -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &firstBuf)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), firstBuf)); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), firstBuf); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2])); EXPECT_NE(buf[0], buf[1]); EXPECT_NE(buf[1], buf[2]); EXPECT_NE(buf[2], buf[0]); @@ -457,28 +418,28 @@ TEST_F(SurfaceTextureClientTest, SurfaceTextureSyncModeMinUndequeued) { android_native_buffer_t* buf[3]; + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3)); // We should be able to dequeue all the buffers before we've queued mANWy. - EXPECT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - EXPECT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); - EXPECT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); + EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); + EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2], -1)); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); EXPECT_EQ(OK, mST->updateTexImage()); EXPECT_EQ(mST->getCurrentBuffer().get(), buf[1]); - EXPECT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); + EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); // Once we've queued a buffer, however we should not be able to dequeue more // than (buffer-count - MIN_UNDEQUEUED_BUFFERS), which is 2 in this case. - EXPECT_EQ(INVALID_OPERATION, - native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); + EXPECT_EQ(-EBUSY, mANW->dequeueBuffer(mANW.get(), &buf[1])); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0], -1)); - ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2], -1)); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[0])); + ASSERT_EQ(OK, mANW->cancelBuffer(mANW.get(), buf[2])); } TEST_F(SurfaceTextureClientTest, SetCropCropsCrop) { @@ -488,8 +449,8 @@ ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 4, 4)); android_native_buffer_t* buf; - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf)); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf, -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf)); ASSERT_EQ(OK, mST->updateTexImage()); Rect crop = mST->getCurrentCrop(); @@ -503,7 +464,7 @@ // from the SurfaceTexture class. TEST_F(SurfaceTextureClientTest, DISABLED_SurfaceTextureSyncModeWaitRetire) { class MyThread : public Thread { - sp mST; + sp mST; EGLContext ctx; EGLSurface sur; EGLDisplay dpy; @@ -519,7 +480,7 @@ return false; } public: - MyThread(const sp& mST) + MyThread(const sp& mST) : mST(mST), mBufferRetired(false) { ctx = eglGetCurrentContext(); sur = eglGetCurrentSurface(EGL_DRAW); @@ -536,22 +497,23 @@ }; android_native_buffer_t* buf[3]; + ASSERT_EQ(OK, mST->setSynchronousMode(true)); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 3)); // dequeue/queue/update so we have a current buffer - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); mST->updateTexImage(); MyThread* thread = new MyThread(mST); sp threadBase(thread); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); thread->run(); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[1])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1], -1)); - //ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[2])); - //ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[1])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[1])); + //ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[2])); + //ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[2])); thread->bufferDequeued(); thread->requestExitAndWait(); } @@ -560,8 +522,8 @@ android_native_buffer_t* buf[3]; float mtx[16] = {}; ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); ASSERT_EQ(OK, mST->updateTexImage()); mST->getTransformMatrix(mtx); @@ -590,8 +552,8 @@ android_native_buffer_t* buf[3]; float mtx[16] = {}; ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); ASSERT_EQ(OK, mST->updateTexImage()); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 6)); // frees buffers mST->getTransformMatrix(mtx); @@ -618,18 +580,6 @@ } TEST_F(SurfaceTextureClientTest, GetTransformMatrixSucceedsAfterFreeingBuffersWithCrop) { - // Query to see if the image crop extension exists - EGLDisplay dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); - const char* exts = eglQueryStringImplementationANDROID(dpy, EGL_EXTENSIONS); - size_t cropExtLen = strlen(CROP_EXT_STR); - size_t extsLen = strlen(exts); - bool equal = !strcmp(CROP_EXT_STR, exts); - bool atStart = !strncmp(CROP_EXT_STR " ", exts, cropExtLen+1); - bool atEnd = (cropExtLen+1) < extsLen && - !strcmp(" " CROP_EXT_STR, exts + extsLen - (cropExtLen+1)); - bool inMiddle = strstr(exts, " " CROP_EXT_STR " "); - bool hasEglAndroidImageCrop = equal || atStart || atEnd || inMiddle; - android_native_buffer_t* buf[3]; float mtx[16] = {}; android_native_rect_t crop; @@ -639,26 +589,23 @@ crop.bottom = 5; ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 4)); - ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 8, 8)); - ASSERT_EQ(OK, native_window_set_buffers_format(mANW.get(), 0)); - ASSERT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &buf[0])); + ASSERT_EQ(OK, native_window_set_buffers_geometry(mANW.get(), 8, 8, 0)); + ASSERT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &buf[0])); ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &crop)); - ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0], -1)); + ASSERT_EQ(OK, mANW->queueBuffer(mANW.get(), buf[0])); ASSERT_EQ(OK, mST->updateTexImage()); ASSERT_EQ(OK, native_window_set_buffer_count(mANW.get(), 6)); // frees buffers mST->getTransformMatrix(mtx); - // If the egl image crop extension is not present, this accounts for the - // .5 texel shrink for each edge that's included in the transform matrix - // to avoid texturing outside the crop region. Otherwise the crop is not - // included in the transform matrix. - EXPECT_EQ(hasEglAndroidImageCrop ? 1 : 0.5, mtx[0]); + // This accounts for the 1 texel shrink for each edge that's included in the + // transform matrix to avoid texturing outside the crop region. + EXPECT_EQ(.375f, mtx[0]); EXPECT_EQ(0.f, mtx[1]); EXPECT_EQ(0.f, mtx[2]); EXPECT_EQ(0.f, mtx[3]); EXPECT_EQ(0.f, mtx[4]); - EXPECT_EQ(hasEglAndroidImageCrop ? -1 : -0.5, mtx[5]); + EXPECT_EQ(-.375f, mtx[5]); EXPECT_EQ(0.f, mtx[6]); EXPECT_EQ(0.f, mtx[7]); @@ -667,8 +614,8 @@ EXPECT_EQ(1.f, mtx[10]); EXPECT_EQ(0.f, mtx[11]); - EXPECT_EQ(hasEglAndroidImageCrop ? 0 : 0.0625f, mtx[12]); - EXPECT_EQ(hasEglAndroidImageCrop ? 1 : 0.5625f, mtx[13]); + EXPECT_EQ(.125f, mtx[12]); + EXPECT_EQ(.5f, mtx[13]); EXPECT_EQ(0.f, mtx[14]); EXPECT_EQ(1.f, mtx[15]); } @@ -684,14 +631,15 @@ HAL_PIXEL_FORMAT_RGB_888, HAL_PIXEL_FORMAT_RGB_565, HAL_PIXEL_FORMAT_BGRA_8888, + HAL_PIXEL_FORMAT_RGBA_5551, + HAL_PIXEL_FORMAT_RGBA_4444, HAL_PIXEL_FORMAT_YV12, }; const int numFmts = (sizeof(fmts) / sizeof(fmts[0])); for (int i = 0; i < numFmts; i++) { int fmt = -1; - ASSERT_EQ(OK, native_window_set_buffers_dimensions(anw.get(), 0, 0)); - ASSERT_EQ(OK, native_window_set_buffers_format(anw.get(), fmts[i])); + ASSERT_EQ(OK, native_window_set_buffers_geometry(anw.get(), 0, 0, fmts[i])); ASSERT_EQ(OK, anw->query(anw.get(), NATIVE_WINDOW_FORMAT, &fmt)); EXPECT_EQ(fmts[i], fmt); } @@ -737,12 +685,8 @@ ASSERT_NE(EGL_NO_CONTEXT, mEglContext); for (int i = 0; i < NUM_SURFACE_TEXTURES; i++) { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - sp st(new GLConsumer(consumer, i, - GLConsumer::TEXTURE_EXTERNAL, true, false)); - sp stc(new Surface(producer)); + sp st(new SurfaceTexture(i)); + sp stc(new SurfaceTextureClient(st)); mEglSurfaces[i] = eglCreateWindowSurface(mEglDisplay, myConfig, static_cast(stc.get()), NULL); ASSERT_EQ(EGL_SUCCESS, eglGetError()); diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureFBO.h android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureFBO.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureFBO.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureFBO.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,75 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SURFACE_TEXTURE_FBO_H -#define ANDROID_SURFACE_TEXTURE_FBO_H - -#include "SurfaceTextureGL.h" - -#include - -namespace android { - -class SurfaceTextureFBOTest : public SurfaceTextureGLTest { -protected: - virtual void SetUp() { - SurfaceTextureGLTest::SetUp(); - - glGenFramebuffers(1, &mFbo); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - - glGenTextures(1, &mFboTex); - glBindTexture(GL_TEXTURE_2D, mFboTex); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getSurfaceWidth(), - getSurfaceHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); - glBindTexture(GL_TEXTURE_2D, 0); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - - glBindFramebuffer(GL_FRAMEBUFFER, mFbo); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, - GL_TEXTURE_2D, mFboTex, 0); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - } - - virtual void TearDown() { - SurfaceTextureGLTest::TearDown(); - - glDeleteTextures(1, &mFboTex); - glDeleteFramebuffers(1, &mFbo); - } - - GLuint mFbo; - GLuint mFboTex; -}; - -void fillRGBA8BufferSolid(uint8_t* buf, int w, int h, int stride, - uint8_t r, uint8_t g, uint8_t b, uint8_t a) { - const size_t PIXEL_SIZE = 4; - for (int y = 0; y < h; y++) { - for (int x = 0; x < w; x++) { - off_t offset = (y * stride + x) * PIXEL_SIZE; - buf[offset + 0] = r; - buf[offset + 1] = g; - buf[offset + 2] = b; - buf[offset + 3] = a; - } - } -} - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureFBO_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureFBO_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureFBO_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureFBO_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "SurfaceTextureFBO_test" -//#define LOG_NDEBUG 0 - -#include "SurfaceTextureFBO.h" - -namespace android { - -// This test is intended to verify that proper synchronization is done when -// rendering into an FBO. -TEST_F(SurfaceTextureFBOTest, BlitFromCpuFilledBufferToFbo) { - const int texWidth = 64; - const int texHeight = 64; - - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_RGBA_8888)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); - - android_native_buffer_t* anb; - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - ASSERT_TRUE(anb != NULL); - - sp buf(new GraphicBuffer(anb, false)); - - // Fill the buffer with green - uint8_t* img = NULL; - buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); - fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 0, 255, - 0, 255); - buf->unlock(); - ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer(), - -1)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glBindFramebuffer(GL_FRAMEBUFFER, mFbo); - drawTexture(); - glBindFramebuffer(GL_FRAMEBUFFER, 0); - - for (int i = 0; i < 4; i++) { - SCOPED_TRACE(String8::format("frame %d", i).string()); - - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - ASSERT_TRUE(anb != NULL); - - buf = new GraphicBuffer(anb, false); - - // Fill the buffer with red - ASSERT_EQ(NO_ERROR, buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, - (void**)(&img))); - fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 255, 0, - 0, 255); - ASSERT_EQ(NO_ERROR, buf->unlock()); - ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), - buf->getNativeBuffer(), -1)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - drawTexture(); - - EXPECT_TRUE(checkPixel( 24, 39, 255, 0, 0, 255)); - } - - glBindFramebuffer(GL_FRAMEBUFFER, mFbo); - - EXPECT_TRUE(checkPixel( 24, 39, 0, 255, 0, 255)); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGL.h android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGL.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGL.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGL.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SURFACE_TEXTURE_GL_H -#define ANDROID_SURFACE_TEXTURE_GL_H - -#include "GLTest.h" - -#include "FrameWaiter.h" -#include "TextureRenderer.h" - -#include -#include - -namespace android { - -class FrameWaiter; -class GLConsumer; -class TextureRenderer; - -class SurfaceTextureGLTest : public GLTest { -protected: - enum { TEX_ID = 123 }; - - void SetUp() { - GLTest::SetUp(); - sp producer; - BufferQueue::createBufferQueue(&producer, &mConsumer); - mST = new GLConsumer(mConsumer, TEX_ID, GLConsumer::TEXTURE_EXTERNAL, - true, false); - mSTC = new Surface(producer); - mANW = mSTC; - mTextureRenderer = new TextureRenderer(TEX_ID, mST); - ASSERT_NO_FATAL_FAILURE(mTextureRenderer->SetUp()); - mFW = new FrameWaiter; - mST->setFrameAvailableListener(mFW); - } - - void TearDown() { - mTextureRenderer.clear(); - mANW.clear(); - mSTC.clear(); - mST.clear(); - GLTest::TearDown(); - } - - void drawTexture() { - mTextureRenderer->drawTexture(); - } - - sp mConsumer; - sp mST; - sp mSTC; - sp mANW; - sp mTextureRenderer; - sp mFW; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGL_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGL_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGL_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGL_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,715 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "SurfaceTextureGL_test" -//#define LOG_NDEBUG 0 - -#include "SurfaceTextureGL.h" - -#include "DisconnectWaiter.h" -#include "FillBuffer.h" - -namespace android { - -TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) { - const int texWidth = 64; - const int texHeight = 66; - - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_YV12)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); - - ANativeWindowBuffer* anb; - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - ASSERT_TRUE(anb != NULL); - - sp buf(new GraphicBuffer(anb, false)); - - // Fill the buffer with the a checkerboard pattern - uint8_t* img = NULL; - buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); - fillYV12Buffer(img, texWidth, texHeight, buf->getStride()); - buf->unlock(); - ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer(), - -1)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 255, 127, 255, 255, 3)); - EXPECT_TRUE(checkPixel(63, 0, 0, 133, 0, 255, 3)); - EXPECT_TRUE(checkPixel(63, 65, 0, 133, 0, 255, 3)); - EXPECT_TRUE(checkPixel( 0, 65, 255, 127, 255, 255, 3)); - - EXPECT_TRUE(checkPixel(22, 44, 255, 127, 255, 255, 3)); - EXPECT_TRUE(checkPixel(45, 52, 255, 127, 255, 255, 3)); - EXPECT_TRUE(checkPixel(52, 51, 98, 255, 73, 255, 3)); - EXPECT_TRUE(checkPixel( 7, 31, 155, 0, 118, 255, 3)); - EXPECT_TRUE(checkPixel(31, 9, 107, 24, 87, 255, 3)); - EXPECT_TRUE(checkPixel(29, 35, 255, 127, 255, 255, 3)); - EXPECT_TRUE(checkPixel(36, 22, 155, 29, 0, 255, 3)); -} - -TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferPow2) { - const int texWidth = 64; - const int texHeight = 64; - - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_YV12)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); - - ANativeWindowBuffer* anb; - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - ASSERT_TRUE(anb != NULL); - - sp buf(new GraphicBuffer(anb, false)); - - // Fill the buffer with the a checkerboard pattern - uint8_t* img = NULL; - buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); - fillYV12Buffer(img, texWidth, texHeight, buf->getStride()); - buf->unlock(); - ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer(), - -1)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 0, 133, 0, 255)); - EXPECT_TRUE(checkPixel(63, 0, 255, 127, 255, 255)); - EXPECT_TRUE(checkPixel(63, 63, 0, 133, 0, 255)); - EXPECT_TRUE(checkPixel( 0, 63, 255, 127, 255, 255)); - - EXPECT_TRUE(checkPixel(22, 19, 100, 255, 74, 255)); - EXPECT_TRUE(checkPixel(45, 11, 100, 255, 74, 255)); - EXPECT_TRUE(checkPixel(52, 12, 155, 0, 181, 255)); - EXPECT_TRUE(checkPixel( 7, 32, 150, 237, 170, 255)); - EXPECT_TRUE(checkPixel(31, 54, 0, 71, 117, 255)); - EXPECT_TRUE(checkPixel(29, 28, 0, 133, 0, 255)); - EXPECT_TRUE(checkPixel(36, 41, 100, 232, 255, 255)); -} - -TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) { - const int texWidth = 64; - const int texHeight = 66; - - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_YV12)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); - - android_native_rect_t crops[] = { - {4, 6, 22, 36}, - {0, 6, 22, 36}, - {4, 0, 22, 36}, - {4, 6, texWidth, 36}, - {4, 6, 22, texHeight}, - }; - - for (int i = 0; i < 5; i++) { - const android_native_rect_t& crop(crops[i]); - SCOPED_TRACE(String8::format("rect{ l: %d t: %d r: %d b: %d }", - crop.left, crop.top, crop.right, crop.bottom).string()); - - ASSERT_EQ(NO_ERROR, native_window_set_crop(mANW.get(), &crop)); - - ANativeWindowBuffer* anb; - ASSERT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - ASSERT_TRUE(anb != NULL); - - sp buf(new GraphicBuffer(anb, false)); - - uint8_t* img = NULL; - buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); - fillYV12BufferRect(img, texWidth, texHeight, buf->getStride(), crop); - buf->unlock(); - ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), - buf->getNativeBuffer(), -1)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, 64, 64); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(63, 0, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(63, 63, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel( 0, 63, 82, 255, 35, 255)); - - EXPECT_TRUE(checkPixel(25, 14, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(35, 31, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(57, 6, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel( 5, 42, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(32, 33, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(16, 26, 82, 255, 35, 255)); - EXPECT_TRUE(checkPixel(46, 51, 82, 255, 35, 255)); - } -} - -// This test is intended to catch synchronization bugs between the CPU-written -// and GPU-read buffers. -TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BuffersRepeatedly) { - enum { texWidth = 16 }; - enum { texHeight = 16 }; - enum { numFrames = 1024 }; - - ASSERT_EQ(NO_ERROR, mST->setDefaultMaxBufferCount(2)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_YV12)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_WRITE_OFTEN)); - - struct TestPixel { - int x; - int y; - }; - const TestPixel testPixels[] = { - { 4, 11 }, - { 12, 14 }, - { 7, 2 }, - }; - enum {numTestPixels = sizeof(testPixels) / sizeof(testPixels[0])}; - - class ProducerThread : public Thread { - public: - ProducerThread(const sp& anw, - const TestPixel* testPixels): - mANW(anw), - mTestPixels(testPixels) { - } - - virtual ~ProducerThread() { - } - - virtual bool threadLoop() { - for (int i = 0; i < numFrames; i++) { - ANativeWindowBuffer* anb; - if (native_window_dequeue_buffer_and_wait(mANW.get(), - &anb) != NO_ERROR) { - return false; - } - if (anb == NULL) { - return false; - } - - sp buf(new GraphicBuffer(anb, false)); - - const int yuvTexOffsetY = 0; - int stride = buf->getStride(); - int yuvTexStrideY = stride; - int yuvTexOffsetV = yuvTexStrideY * texHeight; - int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; - int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * texHeight/2; - int yuvTexStrideU = yuvTexStrideV; - - uint8_t* img = NULL; - buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); - - // Gray out all the test pixels first, so we're more likely to - // see a failure if GL is still texturing from the buffer we - // just dequeued. - for (int j = 0; j < numTestPixels; j++) { - int x = mTestPixels[j].x; - int y = mTestPixels[j].y; - uint8_t value = 128; - img[y*stride + x] = value; - } - - // Fill the buffer with gray. - for (int y = 0; y < texHeight; y++) { - for (int x = 0; x < texWidth; x++) { - img[yuvTexOffsetY + y*yuvTexStrideY + x] = 128; - img[yuvTexOffsetU + (y/2)*yuvTexStrideU + x/2] = 128; - img[yuvTexOffsetV + (y/2)*yuvTexStrideV + x/2] = 128; - } - } - - // Set the test pixels to either white or black. - for (int j = 0; j < numTestPixels; j++) { - int x = mTestPixels[j].x; - int y = mTestPixels[j].y; - uint8_t value = 0; - if (j == (i % numTestPixels)) { - value = 255; - } - img[y*stride + x] = value; - } - - buf->unlock(); - if (mANW->queueBuffer(mANW.get(), buf->getNativeBuffer(), -1) - != NO_ERROR) { - return false; - } - } - return false; - } - - sp mANW; - const TestPixel* mTestPixels; - }; - - sp pt(new ProducerThread(mANW, testPixels)); - pt->run(); - - glViewport(0, 0, texWidth, texHeight); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - // We wait for the first two frames up front so that the producer will be - // likely to dequeue the buffer that's currently being textured from. - mFW->waitForFrame(); - mFW->waitForFrame(); - - for (int i = 0; i < numFrames; i++) { - SCOPED_TRACE(String8::format("frame %d", i).string()); - - // We must wait for each frame to come in because if we ever do an - // updateTexImage call that doesn't consume a newly available buffer - // then the producer and consumer will get out of sync, which will cause - // a deadlock. - if (i > 1) { - mFW->waitForFrame(); - } - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - drawTexture(); - - for (int j = 0; j < numTestPixels; j++) { - int x = testPixels[j].x; - int y = testPixels[j].y; - uint8_t value = 0; - if (j == (i % numTestPixels)) { - // We must y-invert the texture coords - EXPECT_TRUE(checkPixel(x, texHeight-y-1, 255, 255, 255, 255)); - } else { - // We must y-invert the texture coords - EXPECT_TRUE(checkPixel(x, texHeight-y-1, 0, 0, 0, 255)); - } - } - } - - pt->requestExitAndWait(); -} - -TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferNpot) { - const int texWidth = 64; - const int texHeight = 66; - - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_RGBA_8888)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); - - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); - EXPECT_TRUE(checkPixel(63, 0, 231, 231, 231, 231)); - EXPECT_TRUE(checkPixel(63, 65, 231, 231, 231, 231)); - EXPECT_TRUE(checkPixel( 0, 65, 35, 35, 35, 35)); - - EXPECT_TRUE(checkPixel(15, 10, 35, 231, 231, 231)); - EXPECT_TRUE(checkPixel(23, 65, 231, 35, 231, 35)); - EXPECT_TRUE(checkPixel(19, 40, 35, 231, 35, 35)); - EXPECT_TRUE(checkPixel(38, 30, 231, 35, 35, 35)); - EXPECT_TRUE(checkPixel(42, 54, 35, 35, 35, 231)); - EXPECT_TRUE(checkPixel(37, 34, 35, 231, 231, 231)); - EXPECT_TRUE(checkPixel(31, 8, 231, 35, 35, 231)); - EXPECT_TRUE(checkPixel(37, 47, 231, 35, 231, 231)); - EXPECT_TRUE(checkPixel(25, 38, 35, 35, 35, 35)); - EXPECT_TRUE(checkPixel(49, 6, 35, 231, 35, 35)); - EXPECT_TRUE(checkPixel(54, 50, 35, 231, 231, 231)); - EXPECT_TRUE(checkPixel(27, 26, 231, 231, 231, 231)); - EXPECT_TRUE(checkPixel(10, 6, 35, 35, 231, 231)); - EXPECT_TRUE(checkPixel(29, 4, 35, 35, 35, 231)); - EXPECT_TRUE(checkPixel(55, 28, 35, 35, 231, 35)); - EXPECT_TRUE(checkPixel(58, 55, 35, 35, 231, 231)); -} - -TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) { - const int texWidth = 64; - const int texHeight = 64; - - ASSERT_EQ(NO_ERROR, native_window_set_buffers_dimensions(mANW.get(), - texWidth, texHeight)); - ASSERT_EQ(NO_ERROR, native_window_set_buffers_format(mANW.get(), - HAL_PIXEL_FORMAT_RGBA_8888)); - ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), - GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); - - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 231, 231, 231, 231)); - EXPECT_TRUE(checkPixel(63, 0, 35, 35, 35, 35)); - EXPECT_TRUE(checkPixel(63, 63, 231, 231, 231, 231)); - EXPECT_TRUE(checkPixel( 0, 63, 35, 35, 35, 35)); - - EXPECT_TRUE(checkPixel(12, 46, 231, 231, 231, 35)); - EXPECT_TRUE(checkPixel(16, 1, 231, 231, 35, 231)); - EXPECT_TRUE(checkPixel(21, 12, 231, 35, 35, 231)); - EXPECT_TRUE(checkPixel(26, 51, 231, 35, 231, 35)); - EXPECT_TRUE(checkPixel( 5, 32, 35, 231, 231, 35)); - EXPECT_TRUE(checkPixel(13, 8, 35, 231, 231, 231)); - EXPECT_TRUE(checkPixel(46, 3, 35, 35, 231, 35)); - EXPECT_TRUE(checkPixel(30, 33, 35, 35, 35, 35)); - EXPECT_TRUE(checkPixel( 6, 52, 231, 231, 35, 35)); - EXPECT_TRUE(checkPixel(55, 33, 35, 231, 35, 231)); - EXPECT_TRUE(checkPixel(16, 29, 35, 35, 231, 231)); - EXPECT_TRUE(checkPixel( 1, 30, 35, 35, 35, 231)); - EXPECT_TRUE(checkPixel(41, 37, 35, 35, 231, 231)); - EXPECT_TRUE(checkPixel(46, 29, 231, 231, 35, 35)); - EXPECT_TRUE(checkPixel(15, 25, 35, 231, 35, 231)); - EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35)); -} - -// Tests if GLConsumer and BufferQueue are robust enough -// to handle a special case where updateTexImage is called -// in the middle of disconnect. This ordering is enforced -// by blocking in the disconnect callback. -TEST_F(SurfaceTextureGLTest, DisconnectStressTest) { - - class ProducerThread : public Thread { - public: - ProducerThread(const sp& anw): - mANW(anw) { - } - - virtual ~ProducerThread() { - } - - virtual bool threadLoop() { - ANativeWindowBuffer* anb; - - native_window_api_connect(mANW.get(), NATIVE_WINDOW_API_EGL); - - for (int numFrames =0 ; numFrames < 2; numFrames ++) { - - if (native_window_dequeue_buffer_and_wait(mANW.get(), - &anb) != NO_ERROR) { - return false; - } - if (anb == NULL) { - return false; - } - if (mANW->queueBuffer(mANW.get(), anb, -1) - != NO_ERROR) { - return false; - } - } - - native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_EGL); - - return false; - } - - private: - sp mANW; - }; - - sp dw(new DisconnectWaiter()); - mConsumer->consumerConnect(dw, false); - - - sp pt(new ProducerThread(mANW)); - pt->run(); - - // eat a frame so GLConsumer will own an at least one slot - dw->waitForFrame(); - EXPECT_EQ(OK,mST->updateTexImage()); - - dw->waitForFrame(); - // Could fail here as GLConsumer thinks it still owns the slot - // but bufferQueue has released all slots - EXPECT_EQ(OK,mST->updateTexImage()); - - dw->finishDisconnect(); -} - - -// This test ensures that the GLConsumer clears the mCurrentTexture -// when it is disconnected and reconnected. Otherwise it will -// attempt to release a buffer that it does not owned -TEST_F(SurfaceTextureGLTest, DisconnectClearsCurrentTexture) { - ASSERT_EQ(OK, native_window_api_connect(mANW.get(), - NATIVE_WINDOW_API_EGL)); - - ANativeWindowBuffer *anb; - - EXPECT_EQ (OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - - EXPECT_EQ (OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - - EXPECT_EQ(OK,mST->updateTexImage()); - EXPECT_EQ(OK,mST->updateTexImage()); - - ASSERT_EQ(OK, native_window_api_disconnect(mANW.get(), - NATIVE_WINDOW_API_EGL)); - ASSERT_EQ(OK, native_window_api_connect(mANW.get(), - NATIVE_WINDOW_API_EGL)); - - EXPECT_EQ(OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - - // Will fail here if mCurrentTexture is not cleared properly - mFW->waitForFrame(); - EXPECT_EQ(OK,mST->updateTexImage()); - - ASSERT_EQ(OK, native_window_api_disconnect(mANW.get(), - NATIVE_WINDOW_API_EGL)); -} - -TEST_F(SurfaceTextureGLTest, ScaleToWindowMode) { - ASSERT_EQ(OK, native_window_set_scaling_mode(mANW.get(), - NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW)); - - // The producer image size - ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 512, 512)); - - // The consumer image size (16 x 9) ratio - mST->setDefaultBufferSize(1280, 720); - - ASSERT_EQ(OK, native_window_api_connect(mANW.get(), - NATIVE_WINDOW_API_CPU)); - - ANativeWindowBuffer *anb; - - android_native_rect_t odd = {23, 78, 123, 477}; - ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &odd)); - EXPECT_EQ (OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - mFW->waitForFrame(); - EXPECT_EQ(OK, mST->updateTexImage()); - Rect r = mST->getCurrentCrop(); - assertRectEq(Rect(23, 78, 123, 477), r); - - ASSERT_EQ(OK, native_window_api_disconnect(mANW.get(), - NATIVE_WINDOW_API_CPU)); -} - -// This test ensures the scaling mode does the right thing -// ie NATIVE_WINDOW_SCALING_MODE_CROP should crop -// the image such that it has the same aspect ratio as the -// default buffer size -TEST_F(SurfaceTextureGLTest, CroppedScalingMode) { - ASSERT_EQ(OK, native_window_set_scaling_mode(mANW.get(), - NATIVE_WINDOW_SCALING_MODE_SCALE_CROP)); - - // The producer image size - ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 512, 512)); - - // The consumer image size (16 x 9) ratio - mST->setDefaultBufferSize(1280, 720); - - native_window_api_connect(mANW.get(), NATIVE_WINDOW_API_CPU); - - ANativeWindowBuffer *anb; - - // The crop is in the shape of (320, 180) === 16 x 9 - android_native_rect_t standard = {10, 20, 330, 200}; - ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &standard)); - EXPECT_EQ (OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - mFW->waitForFrame(); - EXPECT_EQ(OK, mST->updateTexImage()); - Rect r = mST->getCurrentCrop(); - // crop should be the same as crop (same aspect ratio) - assertRectEq(Rect(10, 20, 330, 200), r); - - // make this wider then desired aspect 239 x 100 (2.39:1) - android_native_rect_t wide = {20, 30, 259, 130}; - ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &wide)); - EXPECT_EQ (OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - mFW->waitForFrame(); - EXPECT_EQ(OK, mST->updateTexImage()); - r = mST->getCurrentCrop(); - // crop should be the same height, but have cropped left and right borders - // offset is 30.6 px L+, R- - assertRectEq(Rect(51, 30, 228, 130), r); - - // This image is taller then desired aspect 400 x 300 (4:3) - android_native_rect_t narrow = {0, 0, 400, 300}; - ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &narrow)); - EXPECT_EQ (OK, native_window_dequeue_buffer_and_wait(mANW.get(), &anb)); - EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb, -1)); - mFW->waitForFrame(); - EXPECT_EQ(OK, mST->updateTexImage()); - r = mST->getCurrentCrop(); - // crop should be the same width, but have cropped top and bottom borders - // offset is 37.5 px - assertRectEq(Rect(0, 37, 400, 262), r); - - native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); -} - -TEST_F(SurfaceTextureGLTest, AbandonUnblocksDequeueBuffer) { - class ProducerThread : public Thread { - public: - ProducerThread(const sp& anw): - mANW(anw), - mDequeueError(NO_ERROR) { - } - - virtual ~ProducerThread() { - } - - virtual bool threadLoop() { - Mutex::Autolock lock(mMutex); - ANativeWindowBuffer* anb; - - // Frame 1 - if (native_window_dequeue_buffer_and_wait(mANW.get(), - &anb) != NO_ERROR) { - return false; - } - if (anb == NULL) { - return false; - } - if (mANW->queueBuffer(mANW.get(), anb, -1) - != NO_ERROR) { - return false; - } - - // Frame 2 - if (native_window_dequeue_buffer_and_wait(mANW.get(), - &anb) != NO_ERROR) { - return false; - } - if (anb == NULL) { - return false; - } - if (mANW->queueBuffer(mANW.get(), anb, -1) - != NO_ERROR) { - return false; - } - - // Frame 3 - error expected - mDequeueError = native_window_dequeue_buffer_and_wait(mANW.get(), - &anb); - return false; - } - - status_t getDequeueError() { - Mutex::Autolock lock(mMutex); - return mDequeueError; - } - - private: - sp mANW; - status_t mDequeueError; - Mutex mMutex; - }; - - ASSERT_EQ(OK, mST->setDefaultMaxBufferCount(2)); - - sp pt(new ProducerThread(mANW)); - pt->run(); - - mFW->waitForFrame(); - mFW->waitForFrame(); - - // Sleep for 100ms to allow the producer thread's dequeueBuffer call to - // block waiting for a buffer to become available. - usleep(100000); - - mST->abandon(); - - pt->requestExitAndWait(); - ASSERT_EQ(NO_INIT, - reinterpret_cast(pt.get())->getDequeueError()); -} - -TEST_F(SurfaceTextureGLTest, InvalidWidthOrHeightFails) { - int texHeight = 16; - ANativeWindowBuffer* anb; - - GLint maxTextureSize; - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); - - // make sure it works with small textures - mST->setDefaultBufferSize(16, texHeight); - EXPECT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - EXPECT_EQ(16, anb->width); - EXPECT_EQ(texHeight, anb->height); - EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb, -1)); - EXPECT_EQ(NO_ERROR, mST->updateTexImage()); - - // make sure it works with GL_MAX_TEXTURE_SIZE - mST->setDefaultBufferSize(maxTextureSize, texHeight); - EXPECT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - EXPECT_EQ(maxTextureSize, anb->width); - EXPECT_EQ(texHeight, anb->height); - EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb, -1)); - EXPECT_EQ(NO_ERROR, mST->updateTexImage()); - - // make sure it fails with GL_MAX_TEXTURE_SIZE+1 - mST->setDefaultBufferSize(maxTextureSize+1, texHeight); - EXPECT_EQ(NO_ERROR, native_window_dequeue_buffer_and_wait(mANW.get(), - &anb)); - EXPECT_EQ(maxTextureSize+1, anb->width); - EXPECT_EQ(texHeight, anb->height); - EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb, -1)); - ASSERT_NE(NO_ERROR, mST->updateTexImage()); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLThreadToGL.h android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLThreadToGL.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLThreadToGL.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLThreadToGL.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,183 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SURFACE_TEXTURE_GL_THREAD_TO_GL_H -#define ANDROID_SURFACE_TEXTURE_GL_THREAD_TO_GL_H - -#include "SurfaceTextureGLToGL.h" - -namespace android { - -/* - * This test fixture is for testing GL -> GL texture streaming from one thread - * to another. It contains functionality to create a producer thread that will - * perform GL rendering to an ANativeWindow that feeds frames to a - * GLConsumer. Additionally it supports interlocking the producer and - * consumer threads so that a specific sequence of calls can be - * deterministically created by the test. - * - * The intended usage is as follows: - * - * TEST_F(...) { - * class PT : public ProducerThread { - * virtual void render() { - * ... - * swapBuffers(); - * } - * }; - * - * runProducerThread(new PT()); - * - * // The order of these calls will vary from test to test and may include - * // multiple frames and additional operations (e.g. GL rendering from the - * // texture). - * fc->waitForFrame(); - * mST->updateTexImage(); - * fc->finishFrame(); - * } - * - */ -class SurfaceTextureGLThreadToGLTest : public SurfaceTextureGLToGLTest { -protected: - - // ProducerThread is an abstract base class to simplify the creation of - // OpenGL ES frame producer threads. - class ProducerThread : public Thread { - public: - virtual ~ProducerThread() { - } - - void setEglObjects(EGLDisplay producerEglDisplay, - EGLSurface producerEglSurface, - EGLContext producerEglContext) { - mProducerEglDisplay = producerEglDisplay; - mProducerEglSurface = producerEglSurface; - mProducerEglContext = producerEglContext; - } - - virtual bool threadLoop() { - eglMakeCurrent(mProducerEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext); - render(); - eglMakeCurrent(mProducerEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT); - return false; - } - - protected: - virtual void render() = 0; - - void swapBuffers() { - eglSwapBuffers(mProducerEglDisplay, mProducerEglSurface); - } - - EGLDisplay mProducerEglDisplay; - EGLSurface mProducerEglSurface; - EGLContext mProducerEglContext; - }; - - // FrameCondition is a utility class for interlocking between the producer - // and consumer threads. The FrameCondition object should be created and - // destroyed in the consumer thread only. The consumer thread should set - // the FrameCondition as the FrameAvailableListener of the GLConsumer, - // and should call both waitForFrame and finishFrame once for each expected - // frame. - // - // This interlocking relies on the fact that onFrameAvailable gets called - // synchronously from GLConsumer::queueBuffer. - class FrameCondition : public GLConsumer::FrameAvailableListener { - public: - FrameCondition(): - mFrameAvailable(false), - mFrameFinished(false) { - } - - // waitForFrame waits for the next frame to arrive. This should be - // called from the consumer thread once for every frame expected by the - // test. - void waitForFrame() { - Mutex::Autolock lock(mMutex); - ALOGV("+waitForFrame"); - while (!mFrameAvailable) { - mFrameAvailableCondition.wait(mMutex); - } - mFrameAvailable = false; - ALOGV("-waitForFrame"); - } - - // Allow the producer to return from its swapBuffers call and continue - // on to produce the next frame. This should be called by the consumer - // thread once for every frame expected by the test. - void finishFrame() { - Mutex::Autolock lock(mMutex); - ALOGV("+finishFrame"); - mFrameFinished = true; - mFrameFinishCondition.signal(); - ALOGV("-finishFrame"); - } - - // This should be called by GLConsumer on the producer thread. - virtual void onFrameAvailable(const BufferItem& /* item */) { - Mutex::Autolock lock(mMutex); - ALOGV("+onFrameAvailable"); - mFrameAvailable = true; - mFrameAvailableCondition.signal(); - while (!mFrameFinished) { - mFrameFinishCondition.wait(mMutex); - } - mFrameFinished = false; - ALOGV("-onFrameAvailable"); - } - - protected: - bool mFrameAvailable; - bool mFrameFinished; - - Mutex mMutex; - Condition mFrameAvailableCondition; - Condition mFrameFinishCondition; - }; - - virtual void SetUp() { - SurfaceTextureGLToGLTest::SetUp(); - mFC = new FrameCondition(); - mST->setFrameAvailableListener(mFC); - } - - virtual void TearDown() { - if (mProducerThread != NULL) { - mProducerThread->requestExitAndWait(); - } - mProducerThread.clear(); - mFC.clear(); - SurfaceTextureGLToGLTest::TearDown(); - } - - void runProducerThread(const sp producerThread) { - ASSERT_TRUE(mProducerThread == NULL); - mProducerThread = producerThread; - producerThread->setEglObjects(mEglDisplay, mProducerEglSurface, - mProducerEglContext); - producerThread->run(); - } - - sp mProducerThread; - sp mFC; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLThreadToGL_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,186 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "SurfaceTextureGLThreadToGL_test" -//#define LOG_NDEBUG 0 - -#include "SurfaceTextureGLThreadToGL.h" - -namespace android { - -TEST_F(SurfaceTextureGLThreadToGLTest, - UpdateTexImageBeforeFrameFinishedCompletes) { - class PT : public ProducerThread { - virtual void render() { - glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - swapBuffers(); - } - }; - - runProducerThread(new PT()); - - mFC->waitForFrame(); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - mFC->finishFrame(); - - // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! -} - -TEST_F(SurfaceTextureGLThreadToGLTest, - UpdateTexImageAfterFrameFinishedCompletes) { - class PT : public ProducerThread { - virtual void render() { - glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - swapBuffers(); - } - }; - - runProducerThread(new PT()); - - mFC->waitForFrame(); - mFC->finishFrame(); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! -} - -TEST_F(SurfaceTextureGLThreadToGLTest, - RepeatedUpdateTexImageBeforeFrameFinishedCompletes) { - enum { NUM_ITERATIONS = 1024 }; - - class PT : public ProducerThread { - virtual void render() { - for (int i = 0; i < NUM_ITERATIONS; i++) { - glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - ALOGV("+swapBuffers"); - swapBuffers(); - ALOGV("-swapBuffers"); - } - } - }; - - runProducerThread(new PT()); - - for (int i = 0; i < NUM_ITERATIONS; i++) { - mFC->waitForFrame(); - ALOGV("+updateTexImage"); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ALOGV("-updateTexImage"); - mFC->finishFrame(); - - // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! - } -} - -TEST_F(SurfaceTextureGLThreadToGLTest, - RepeatedUpdateTexImageAfterFrameFinishedCompletes) { - enum { NUM_ITERATIONS = 1024 }; - - class PT : public ProducerThread { - virtual void render() { - for (int i = 0; i < NUM_ITERATIONS; i++) { - glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - ALOGV("+swapBuffers"); - swapBuffers(); - ALOGV("-swapBuffers"); - } - } - }; - - runProducerThread(new PT()); - - for (int i = 0; i < NUM_ITERATIONS; i++) { - mFC->waitForFrame(); - mFC->finishFrame(); - ALOGV("+updateTexImage"); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ALOGV("-updateTexImage"); - - // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! - } -} - -// XXX: This test is disabled because it is currently hanging on some devices. -TEST_F(SurfaceTextureGLThreadToGLTest, - DISABLED_RepeatedSwapBuffersWhileDequeueStalledCompletes) { - enum { NUM_ITERATIONS = 64 }; - - class PT : public ProducerThread { - virtual void render() { - for (int i = 0; i < NUM_ITERATIONS; i++) { - glClearColor(0.0f, 1.0f, 0.0f, 1.0f); - glClear(GL_COLOR_BUFFER_BIT); - ALOGV("+swapBuffers"); - swapBuffers(); - ALOGV("-swapBuffers"); - } - } - }; - - ASSERT_EQ(OK, mST->setDefaultMaxBufferCount(2)); - - runProducerThread(new PT()); - - // Allow three frames to be rendered and queued before starting the - // rendering in this thread. For the latter two frames we don't call - // updateTexImage so the next dequeue from the producer thread will block - // waiting for a frame to become available. - mFC->waitForFrame(); - mFC->finishFrame(); - - // We must call updateTexImage to consume the first frame so that the - // SurfaceTexture is able to reduce the buffer count to 2. This is because - // the GL driver may dequeue a buffer when the EGLSurface is created, and - // that happens before we call setDefaultMaxBufferCount. It's possible that the - // driver does not dequeue a buffer at EGLSurface creation time, so we - // cannot rely on this to cause the second dequeueBuffer call to block. - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - mFC->waitForFrame(); - mFC->finishFrame(); - mFC->waitForFrame(); - mFC->finishFrame(); - - // Sleep for 100ms to allow the producer thread's dequeueBuffer call to - // block waiting for a buffer to become available. - usleep(100000); - - // Render and present a number of images. This thread should not be blocked - // by the fact that the producer thread is blocking in dequeue. - for (int i = 0; i < NUM_ITERATIONS; i++) { - glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(mEglDisplay, mEglSurface); - } - - // Consume the two pending buffers to unblock the producer thread. - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - // Consume the remaining buffers from the producer thread. - for (int i = 0; i < NUM_ITERATIONS-3; i++) { - mFC->waitForFrame(); - mFC->finishFrame(); - ALOGV("+updateTexImage"); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ALOGV("-updateTexImage"); - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLToGL.h android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLToGL.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLToGL.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLToGL.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SURFACE_TEXTURE_GL_TO_GL_H -#define ANDROID_SURFACE_TEXTURE_GL_TO_GL_H - -#include "SurfaceTextureGL.h" - -namespace android { - -/* - * This test fixture is for testing GL -> GL texture streaming. It creates an - * EGLSurface and an EGLContext for the image producer to use. - */ -class SurfaceTextureGLToGLTest : public SurfaceTextureGLTest { -protected: - SurfaceTextureGLToGLTest(): - mProducerEglSurface(EGL_NO_SURFACE), - mProducerEglContext(EGL_NO_CONTEXT) { - } - - virtual void SetUp() { - SurfaceTextureGLTest::SetUp(); - - mProducerEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig, - mANW.get(), NULL); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_SURFACE, mProducerEglSurface); - - mProducerEglContext = eglCreateContext(mEglDisplay, mGlConfig, - EGL_NO_CONTEXT, getContextAttribs()); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_CONTEXT, mProducerEglContext); - } - - virtual void TearDown() { - if (mProducerEglContext != EGL_NO_CONTEXT) { - eglDestroyContext(mEglDisplay, mProducerEglContext); - } - if (mProducerEglSurface != EGL_NO_SURFACE) { - eglDestroySurface(mEglDisplay, mProducerEglSurface); - } - SurfaceTextureGLTest::TearDown(); - } - - EGLSurface mProducerEglSurface; - EGLContext mProducerEglContext; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLToGL_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLToGL_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureGLToGL_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureGLToGL_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,507 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "SurfaceTextureGLToGL_test" -//#define LOG_NDEBUG 0 - -#include "SurfaceTextureGLToGL.h" - -namespace android { - -TEST_F(SurfaceTextureGLToGLTest, TransformHintGetsRespected) { - const uint32_t texWidth = 32; - const uint32_t texHeight = 64; - - mST->setDefaultBufferSize(texWidth, texHeight); - mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90); - - // This test requires 3 buffers to avoid deadlock because we're - // both producer and consumer, and only using one thread. - mST->setDefaultMaxBufferCount(3); - - // Do the producer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Start a buffer with our chosen size and transform hint moving - // through the system. - glClear(GL_COLOR_BUFFER_BIT); // give the driver something to do - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - mST->updateTexImage(); // consume it - // Swap again. - glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - mST->updateTexImage(); - - // The current buffer should either show the effects of the transform - // hint (in the form of an inverse transform), or show that the - // transform hint has been ignored. - sp buf = mST->getCurrentBuffer(); - if (mST->getCurrentTransform() == NATIVE_WINDOW_TRANSFORM_ROT_270) { - ASSERT_EQ(texWidth, buf->getHeight()); - ASSERT_EQ(texHeight, buf->getWidth()); - } else { - ASSERT_EQ(texWidth, buf->getWidth()); - ASSERT_EQ(texHeight, buf->getHeight()); - } - - // Reset the transform hint and confirm that it takes. - mST->setTransformHint(0); - glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - mST->updateTexImage(); - glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - mST->updateTexImage(); - - buf = mST->getCurrentBuffer(); - ASSERT_EQ((uint32_t) 0, mST->getCurrentTransform()); - ASSERT_EQ(texWidth, buf->getWidth()); - ASSERT_EQ(texHeight, buf->getHeight()); -} - -TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) { - const int texWidth = 64; - const int texHeight = 64; - - mST->setDefaultBufferSize(texWidth, texHeight); - - // This test requires 3 buffers to complete run on a single thread. - mST->setDefaultMaxBufferCount(3); - - // Do the producer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // This is needed to ensure we pick up a buffer of the correct size. - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - glClearColor(0.6, 0.6, 0.6, 0.6); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_SCISSOR_TEST); - glScissor(4, 4, 4, 4); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - glScissor(24, 48, 4, 4); - glClearColor(0.0, 1.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - glScissor(37, 17, 4, 4); - glClearColor(0.0, 0.0, 1.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - // Do the consumer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - glDisable(GL_SCISSOR_TEST); - - // Skip the first frame, which was empty - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153)); - - EXPECT_TRUE(checkPixel( 4, 7, 255, 0, 0, 255)); - EXPECT_TRUE(checkPixel(25, 51, 0, 255, 0, 255)); - EXPECT_TRUE(checkPixel(40, 19, 0, 0, 255, 255)); - EXPECT_TRUE(checkPixel(29, 51, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 5, 32, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(13, 8, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(46, 3, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(30, 33, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 6, 52, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(55, 33, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(16, 29, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 1, 30, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(41, 37, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(46, 29, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(15, 25, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 3, 52, 153, 153, 153, 153)); -} - -TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) { - sp buffers[2]; - - // This test requires async mode to run on a single thread. - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - EXPECT_TRUE(eglSwapInterval(mEglDisplay, 0)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - for (int i = 0; i < 2; i++) { - // Produce a frame - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - glClear(GL_COLOR_BUFFER_BIT); - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - // Consume a frame - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mFW->waitForFrame(); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - buffers[i] = mST->getCurrentBuffer(); - } - - // Destroy the GL texture object to release its ref on buffers[2]. - GLuint texID = TEX_ID; - glDeleteTextures(1, &texID); - - // Destroy the EGLSurface - EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mProducerEglSurface = EGL_NO_SURFACE; - - // This test should have the only reference to buffer 0. - EXPECT_EQ(1, buffers[0]->getStrongCount()); - - // The GLConsumer should hold one reference to buffer 1 in its - // mCurrentTextureImage member and another reference in mEglSlots. The third - // reference is in this test. - EXPECT_EQ(3, buffers[1]->getStrongCount()); -} - -TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) { - sp buffers[3]; - - // This test requires async mode to run on a single thread. - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - EXPECT_TRUE(eglSwapInterval(mEglDisplay, 0)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - for (int i = 0; i < 3; i++) { - // Produce a frame - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - glClear(GL_COLOR_BUFFER_BIT); - EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Consume a frame - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mFW->waitForFrame(); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - buffers[i] = mST->getCurrentBuffer(); - } - - // Abandon the GLConsumer, releasing the ref that the GLConsumer has - // on buffers[2]. - mST->abandon(); - - // Destroy the GL texture object to release its ref on buffers[2]. - GLuint texID = TEX_ID; - glDeleteTextures(1, &texID); - - // Destroy the EGLSurface. - EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mProducerEglSurface = EGL_NO_SURFACE; - - EXPECT_EQ(1, buffers[1]->getStrongCount()); - - // Depending on how lazily the GL driver dequeues buffers, we may end up - // with either two or three total buffers. If there are three, each entry - // of the buffers array will be unique and there should only be one - // reference (the one in this test). If there are two the first and last - // element in the array will be equal meaning that buffer representing both - // 0 and 2 will have two references (one for 0 and one for 2). - if (buffers[2] != buffers[0]) { - EXPECT_EQ(1, buffers[0]->getStrongCount()); - EXPECT_EQ(1, buffers[2]->getStrongCount()); - } else { - EXPECT_EQ(2, buffers[0]->getStrongCount()); - } -} - -TEST_F(SurfaceTextureGLToGLTest, EglMakeCurrentBeforeConsumerDeathUnrefsBuffers) { - sp buffer; - - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - - // Produce a frame - glClear(GL_COLOR_BUFFER_BIT); - EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Destroy the EGLSurface. - EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mProducerEglSurface = EGL_NO_SURFACE; - mSTC.clear(); - mANW.clear(); - mTextureRenderer.clear(); - - // Consume a frame - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - buffer = mST->getCurrentBuffer(); - - // Destroy the GL texture object to release its ref - GLuint texID = TEX_ID; - glDeleteTextures(1, &texID); - - // make un-current, all references to buffer should be gone - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT)); - - // Destroy consumer - mST.clear(); - - EXPECT_EQ(1, buffer->getStrongCount()); -} - -TEST_F(SurfaceTextureGLToGLTest, EglMakeCurrentAfterConsumerDeathUnrefsBuffers) { - sp buffer; - - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - - // Produce a frame - glClear(GL_COLOR_BUFFER_BIT); - EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Destroy the EGLSurface. - EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mProducerEglSurface = EGL_NO_SURFACE; - mSTC.clear(); - mANW.clear(); - mTextureRenderer.clear(); - - // Consume a frame - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - buffer = mST->getCurrentBuffer(); - - // Destroy the GL texture object to release its ref - GLuint texID = TEX_ID; - glDeleteTextures(1, &texID); - - // Destroy consumer - mST.clear(); - - // make un-current, all references to buffer should be gone - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, - EGL_NO_SURFACE, EGL_NO_CONTEXT)); - - EXPECT_EQ(1, buffer->getStrongCount()); -} - -TEST_F(SurfaceTextureGLToGLTest, TexturingFromUserSizedGLFilledBuffer) { - enum { texWidth = 64 }; - enum { texHeight = 64 }; - - // This test requires 3 buffers to complete run on a single thread. - mST->setDefaultMaxBufferCount(3); - - // Set the user buffer size. - native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight); - - // Do the producer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // This is needed to ensure we pick up a buffer of the correct size. - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - glClearColor(0.6, 0.6, 0.6, 0.6); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_SCISSOR_TEST); - glScissor(4, 4, 1, 1); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - // Do the consumer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - glDisable(GL_SCISSOR_TEST); - - // Skip the first frame, which was empty - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153)); - - EXPECT_TRUE(checkPixel( 4, 4, 255, 0, 0, 255)); - EXPECT_TRUE(checkPixel( 5, 5, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 3, 3, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(45, 52, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(12, 36, 153, 153, 153, 153)); -} - -TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedUserSizedGLFilledBuffer) { - enum { texWidth = 64 }; - enum { texHeight = 16 }; - - // This test requires 3 buffers to complete run on a single thread. - mST->setDefaultMaxBufferCount(3); - - // Set the transform hint. - mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90); - - // Set the user buffer size. - native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight); - - // Do the producer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // This is needed to ensure we pick up a buffer of the correct size and the - // new rotation hint. - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - glClearColor(0.6, 0.6, 0.6, 0.6); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_SCISSOR_TEST); - glScissor(24, 4, 1, 1); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - // Do the consumer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - glDisable(GL_SCISSOR_TEST); - - // Skip the first frame, which was empty - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 15, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 0, 15, 153, 153, 153, 153)); - - EXPECT_TRUE(checkPixel(24, 4, 255, 0, 0, 255)); - EXPECT_TRUE(checkPixel(25, 5, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(23, 3, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(45, 13, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(12, 8, 153, 153, 153, 153)); -} - -TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedGLFilledBuffer) { - enum { texWidth = 64 }; - enum { texHeight = 16 }; - - // This test requires 3 buffers to complete run on a single thread. - mST->setDefaultMaxBufferCount(3); - - // Set the transform hint. - mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90); - - // Set the default buffer size. - mST->setDefaultBufferSize(texWidth, texHeight); - - // Do the producer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, - mProducerEglSurface, mProducerEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // This is needed to ensure we pick up a buffer of the correct size and the - // new rotation hint. - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - glClearColor(0.6, 0.6, 0.6, 0.6); - glClear(GL_COLOR_BUFFER_BIT); - - glEnable(GL_SCISSOR_TEST); - glScissor(24, 4, 1, 1); - glClearColor(1.0, 0.0, 0.0, 1.0); - glClear(GL_COLOR_BUFFER_BIT); - - eglSwapBuffers(mEglDisplay, mProducerEglSurface); - - // Do the consumer side of things - EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - glDisable(GL_SCISSOR_TEST); - - // Skip the first frame, which was empty - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - ASSERT_EQ(NO_ERROR, mST->updateTexImage()); - - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - - glViewport(0, 0, texWidth, texHeight); - drawTexture(); - - EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(63, 15, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel( 0, 15, 153, 153, 153, 153)); - - EXPECT_TRUE(checkPixel(24, 4, 255, 0, 0, 255)); - EXPECT_TRUE(checkPixel(25, 5, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(23, 3, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(45, 13, 153, 153, 153, 153)); - EXPECT_TRUE(checkPixel(12, 8, 153, 153, 153, 153)); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureMultiContextGL.h android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureMultiContextGL.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureMultiContextGL.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureMultiContextGL.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SURFACE_TEXTURE_MULTI_CONTEXT_GL_H -#define ANDROID_SURFACE_TEXTURE_MULTI_CONTEXT_GL_H - -#include "SurfaceTextureGL.h" - -namespace android { - -class SurfaceTextureMultiContextGLTest : public SurfaceTextureGLTest { -protected: - enum { SECOND_TEX_ID = 123 }; - enum { THIRD_TEX_ID = 456 }; - - SurfaceTextureMultiContextGLTest(): - mSecondEglContext(EGL_NO_CONTEXT) { - } - - virtual void SetUp() { - SurfaceTextureGLTest::SetUp(); - - // Set up the secondary context and texture renderer. - mSecondEglContext = eglCreateContext(mEglDisplay, mGlConfig, - EGL_NO_CONTEXT, getContextAttribs()); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_CONTEXT, mSecondEglContext); - - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mSecondTextureRenderer = new TextureRenderer(SECOND_TEX_ID, mST); - ASSERT_NO_FATAL_FAILURE(mSecondTextureRenderer->SetUp()); - - // Set up the tertiary context and texture renderer. - mThirdEglContext = eglCreateContext(mEglDisplay, mGlConfig, - EGL_NO_CONTEXT, getContextAttribs()); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_CONTEXT, mThirdEglContext); - - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mThirdEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - mThirdTextureRenderer = new TextureRenderer(THIRD_TEX_ID, mST); - ASSERT_NO_FATAL_FAILURE(mThirdTextureRenderer->SetUp()); - - // Switch back to the primary context to start the tests. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mEglContext)); - } - - virtual void TearDown() { - if (mThirdEglContext != EGL_NO_CONTEXT) { - eglDestroyContext(mEglDisplay, mThirdEglContext); - } - if (mSecondEglContext != EGL_NO_CONTEXT) { - eglDestroyContext(mEglDisplay, mSecondEglContext); - } - SurfaceTextureGLTest::TearDown(); - } - - EGLContext mSecondEglContext; - sp mSecondTextureRenderer; - - EGLContext mThirdEglContext; - sp mThirdTextureRenderer; -}; - -} - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureMultiContextGL_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureMultiContextGL_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTextureMultiContextGL_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTextureMultiContextGL_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,444 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "SurfaceTextureMultiContextGL_test" -//#define LOG_NDEBUG 0 - -#include "SurfaceTextureMultiContextGL.h" - -#include "FillBuffer.h" - -#include - -namespace android { - -TEST_F(SurfaceTextureMultiContextGLTest, UpdateFromMultipleContextsFails) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Attempt to latch the texture on the secondary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_EQ(INVALID_OPERATION, mST->updateTexImage()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextSucceeds) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Check that the GL texture was deleted. - EXPECT_EQ(GL_FALSE, glIsTexture(TEX_ID)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - DetachFromContextSucceedsAfterProducerDisconnect) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); - ASSERT_EQ(OK, mST->detachFromContext()); - - // Check that the GL texture was deleted. - EXPECT_EQ(GL_FALSE, glIsTexture(TEX_ID)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWhenAbandoned) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Attempt to detach from the primary context. - mST->abandon(); - ASSERT_EQ(NO_INIT, mST->detachFromContext()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWhenDetached) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attempt to detach from the primary context again. - ASSERT_EQ(INVALID_OPERATION, mST->detachFromContext()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWithNoDisplay) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Make there be no current display. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Attempt to detach from the primary context. - ASSERT_EQ(INVALID_OPERATION, mST->detachFromContext()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWithNoContext) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Make current context be incorrect. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Attempt to detach from the primary context. - ASSERT_EQ(INVALID_OPERATION, mST->detachFromContext()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, UpdateTexImageFailsWhenDetached) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attempt to latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(INVALID_OPERATION, mST->updateTexImage()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextSucceeds) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the secondary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - - // Verify that the texture object was created and bound. - GLint texBinding = -1; - glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); - EXPECT_EQ(SECOND_TEX_ID, texBinding); - - // Try to use the texture from the secondary context. - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, 1, 1); - mSecondTextureRenderer->drawTexture(); - ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - AttachToContextSucceedsAfterProducerDisconnect) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the secondary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - - // Verify that the texture object was created and bound. - GLint texBinding = -1; - glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); - EXPECT_EQ(SECOND_TEX_ID, texBinding); - - // Try to use the texture from the secondary context. - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, 1, 1); - mSecondTextureRenderer->drawTexture(); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - AttachToContextSucceedsBeforeUpdateTexImage) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Detach from the primary context. - native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the secondary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - - // Verify that the texture object was created and bound. - GLint texBinding = -1; - glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); - EXPECT_EQ(SECOND_TEX_ID, texBinding); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Try to use the texture from the secondary context. - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, 1, 1); - mSecondTextureRenderer->drawTexture(); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextFailsWhenAbandoned) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attempt to attach to the secondary context. - mST->abandon(); - - // Attempt to attach to the primary context. - ASSERT_EQ(NO_INIT, mST->attachToContext(SECOND_TEX_ID)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextFailsWhenAttached) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Attempt to attach to the primary context. - ASSERT_EQ(INVALID_OPERATION, mST->attachToContext(SECOND_TEX_ID)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - AttachToContextFailsWhenAttachedBeforeUpdateTexImage) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Attempt to attach to the primary context. - ASSERT_EQ(INVALID_OPERATION, mST->attachToContext(SECOND_TEX_ID)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextFailsWithNoDisplay) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Make there be no current display. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, - EGL_NO_CONTEXT)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Attempt to attach with no context current. - ASSERT_EQ(INVALID_OPERATION, mST->attachToContext(SECOND_TEX_ID)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextSucceedsTwice) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Latch the texture contents on the primary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the secondary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - - // Detach from the secondary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the tertiary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mThirdEglContext)); - ASSERT_EQ(OK, mST->attachToContext(THIRD_TEX_ID)); - - // Verify that the texture object was created and bound. - GLint texBinding = -1; - glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); - EXPECT_EQ(THIRD_TEX_ID, texBinding); - - // Try to use the texture from the tertiary context. - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, 1, 1); - mThirdTextureRenderer->drawTexture(); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - AttachToContextSucceedsTwiceBeforeUpdateTexImage) { - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the secondary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - - // Detach from the secondary context. - ASSERT_EQ(OK, mST->detachFromContext()); - - // Attach to the tertiary context. - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mThirdEglContext)); - ASSERT_EQ(OK, mST->attachToContext(THIRD_TEX_ID)); - - // Verify that the texture object was created and bound. - GLint texBinding = -1; - glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); - EXPECT_EQ(THIRD_TEX_ID, texBinding); - - // Latch the texture contents on the tertiary context. - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // Try to use the texture from the tertiary context. - glClearColor(0.2, 0.2, 0.2, 0.2); - glClear(GL_COLOR_BUFFER_BIT); - glViewport(0, 0, 1, 1); - mThirdTextureRenderer->drawTexture(); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - UpdateTexImageSucceedsForBufferConsumedBeforeDetach) { - ASSERT_EQ(NO_ERROR, mST->setDefaultMaxBufferCount(2)); - - // produce two frames and consume them both on the primary context - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // produce one more frame - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Detach from the primary context and attach to the secondary context - ASSERT_EQ(OK, mST->detachFromContext()); - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - - // Consume final frame on secondary context - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); -} - -TEST_F(SurfaceTextureMultiContextGLTest, - AttachAfterDisplayTerminatedSucceeds) { - ASSERT_EQ(NO_ERROR, mST->setDefaultMaxBufferCount(2)); - - // produce two frames and consume them both on the primary context - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); - - // produce one more frame - ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); - - // Detach from the primary context. - ASSERT_EQ(OK, mST->releaseTexImage()); - ASSERT_EQ(OK, mST->detachFromContext()); - - // Terminate and then initialize the display. All contexts, surfaces - // and images are invalid at this point. - EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay); - EGLint majorVersion = 0; - EGLint minorVersion = 0; - EXPECT_TRUE(eglTerminate(display)); - EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // The surface is invalid so create it again. - EGLint pbufferAttribs[] = { - EGL_WIDTH, 64, - EGL_HEIGHT, 64, - EGL_NONE }; - mEglSurface = eglCreatePbufferSurface(mEglDisplay, mGlConfig, - pbufferAttribs); - - // The second context is invalid so create it again. - mSecondEglContext = eglCreateContext(mEglDisplay, mGlConfig, - EGL_NO_CONTEXT, getContextAttribs()); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - ASSERT_NE(EGL_NO_CONTEXT, mSecondEglContext); - - ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, - mSecondEglContext)); - ASSERT_EQ(EGL_SUCCESS, eglGetError()); - - // Now attach to and consume final frame on secondary context. - ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); - mFW->waitForFrame(); - ASSERT_EQ(OK, mST->updateTexImage()); -} - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTexture_test.cpp android-platform-frameworks-native-21/libs/gui/tests/SurfaceTexture_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/SurfaceTexture_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/SurfaceTexture_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,2608 @@ +/* + * 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. + */ + +#define LOG_TAG "SurfaceTexture_test" +//#define LOG_NDEBUG 0 + +#include +#include +#include +#include +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +#include + +namespace android { + +class GLTest : public ::testing::Test { +protected: + + GLTest(): + mEglDisplay(EGL_NO_DISPLAY), + mEglSurface(EGL_NO_SURFACE), + mEglContext(EGL_NO_CONTEXT) { + } + + virtual void SetUp() { + const ::testing::TestInfo* const testInfo = + ::testing::UnitTest::GetInstance()->current_test_info(); + ALOGV("Begin test: %s.%s", testInfo->test_case_name(), + testInfo->name()); + + mEglDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_DISPLAY, mEglDisplay); + + EGLint majorVersion; + EGLint minorVersion; + EXPECT_TRUE(eglInitialize(mEglDisplay, &majorVersion, &minorVersion)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + RecordProperty("EglVersionMajor", majorVersion); + RecordProperty("EglVersionMajor", minorVersion); + + EGLint numConfigs = 0; + EXPECT_TRUE(eglChooseConfig(mEglDisplay, getConfigAttribs(), &mGlConfig, + 1, &numConfigs)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + char* displaySecsEnv = getenv("GLTEST_DISPLAY_SECS"); + if (displaySecsEnv != NULL) { + mDisplaySecs = atoi(displaySecsEnv); + if (mDisplaySecs < 0) { + mDisplaySecs = 0; + } + } else { + mDisplaySecs = 0; + } + + if (mDisplaySecs > 0) { + mComposerClient = new SurfaceComposerClient; + ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); + + mSurfaceControl = mComposerClient->createSurface( + String8("Test Surface"), 0, + getSurfaceWidth(), getSurfaceHeight(), + PIXEL_FORMAT_RGB_888, 0); + + ASSERT_TRUE(mSurfaceControl != NULL); + ASSERT_TRUE(mSurfaceControl->isValid()); + + SurfaceComposerClient::openGlobalTransaction(); + ASSERT_EQ(NO_ERROR, mSurfaceControl->setLayer(0x7FFFFFFF)); + ASSERT_EQ(NO_ERROR, mSurfaceControl->show()); + SurfaceComposerClient::closeGlobalTransaction(); + + sp window = mSurfaceControl->getSurface(); + mEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig, + window.get(), NULL); + } else { + EGLint pbufferAttribs[] = { + EGL_WIDTH, getSurfaceWidth(), + EGL_HEIGHT, getSurfaceHeight(), + EGL_NONE }; + + mEglSurface = eglCreatePbufferSurface(mEglDisplay, mGlConfig, + pbufferAttribs); + } + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_SURFACE, mEglSurface); + + mEglContext = eglCreateContext(mEglDisplay, mGlConfig, EGL_NO_CONTEXT, + getContextAttribs()); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_CONTEXT, mEglContext); + + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + EGLint w, h; + EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_WIDTH, &w)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + EXPECT_TRUE(eglQuerySurface(mEglDisplay, mEglSurface, EGL_HEIGHT, &h)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + RecordProperty("EglSurfaceWidth", w); + RecordProperty("EglSurfaceHeight", h); + + glViewport(0, 0, w, h); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + } + + virtual void TearDown() { + // Display the result + if (mDisplaySecs > 0 && mEglSurface != EGL_NO_SURFACE) { + eglSwapBuffers(mEglDisplay, mEglSurface); + sleep(mDisplaySecs); + } + + if (mComposerClient != NULL) { + mComposerClient->dispose(); + } + if (mEglContext != EGL_NO_CONTEXT) { + eglDestroyContext(mEglDisplay, mEglContext); + } + if (mEglSurface != EGL_NO_SURFACE) { + eglDestroySurface(mEglDisplay, mEglSurface); + } + if (mEglDisplay != EGL_NO_DISPLAY) { + eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + eglTerminate(mEglDisplay); + } + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + const ::testing::TestInfo* const testInfo = + ::testing::UnitTest::GetInstance()->current_test_info(); + ALOGV("End test: %s.%s", testInfo->test_case_name(), + testInfo->name()); + } + + virtual EGLint const* getConfigAttribs() { + static EGLint sDefaultConfigAttribs[] = { + EGL_SURFACE_TYPE, EGL_PBUFFER_BIT, + EGL_RENDERABLE_TYPE, EGL_OPENGL_ES2_BIT, + EGL_RED_SIZE, 8, + EGL_GREEN_SIZE, 8, + EGL_BLUE_SIZE, 8, + EGL_ALPHA_SIZE, 8, + EGL_DEPTH_SIZE, 16, + EGL_STENCIL_SIZE, 8, + EGL_NONE }; + + return sDefaultConfigAttribs; + } + + virtual EGLint const* getContextAttribs() { + static EGLint sDefaultContextAttribs[] = { + EGL_CONTEXT_CLIENT_VERSION, 2, + EGL_NONE }; + + return sDefaultContextAttribs; + } + + virtual EGLint getSurfaceWidth() { + return 512; + } + + virtual EGLint getSurfaceHeight() { + return 512; + } + + ::testing::AssertionResult checkPixel(int x, int y, int r, + int g, int b, int a, int tolerance=2) { + GLubyte pixel[4]; + String8 msg; + glReadPixels(x, y, 1, 1, GL_RGBA, GL_UNSIGNED_BYTE, pixel); + GLenum err = glGetError(); + if (err != GL_NO_ERROR) { + msg += String8::format("error reading pixel: %#x", err); + while ((err = glGetError()) != GL_NO_ERROR) { + msg += String8::format(", %#x", err); + } + fprintf(stderr, "pixel check failure: %s\n", msg.string()); + return ::testing::AssertionFailure( + ::testing::Message(msg.string())); + } + if (r >= 0 && abs(r - int(pixel[0])) > tolerance) { + msg += String8::format("r(%d isn't %d)", pixel[0], r); + } + if (g >= 0 && abs(g - int(pixel[1])) > tolerance) { + if (!msg.isEmpty()) { + msg += " "; + } + msg += String8::format("g(%d isn't %d)", pixel[1], g); + } + if (b >= 0 && abs(b - int(pixel[2])) > tolerance) { + if (!msg.isEmpty()) { + msg += " "; + } + msg += String8::format("b(%d isn't %d)", pixel[2], b); + } + if (a >= 0 && abs(a - int(pixel[3])) > tolerance) { + if (!msg.isEmpty()) { + msg += " "; + } + msg += String8::format("a(%d isn't %d)", pixel[3], a); + } + if (!msg.isEmpty()) { + fprintf(stderr, "pixel check failure: %s\n", msg.string()); + return ::testing::AssertionFailure( + ::testing::Message(msg.string())); + } else { + return ::testing::AssertionSuccess(); + } + } + + ::testing::AssertionResult assertRectEq(const Rect &r1, + const Rect &r2, int tolerance=1) { + + String8 msg; + + if (abs(r1.left - r2.left) > tolerance) { + msg += String8::format("left(%d isn't %d)", r1.left, r2.left); + } + if (abs(r1.top - r2.top) > tolerance) { + if (!msg.isEmpty()) { + msg += " "; + } + msg += String8::format("top(%d isn't %d)", r1.top, r2.top); + } + if (abs(r1.right - r2.right) > tolerance) { + if (!msg.isEmpty()) { + msg += " "; + } + msg += String8::format("right(%d isn't %d)", r1.right, r2.right); + } + if (abs(r1.bottom - r2.bottom) > tolerance) { + if (!msg.isEmpty()) { + msg += " "; + } + msg += String8::format("bottom(%d isn't %d)", r1.bottom, r2.bottom); + } + if (!msg.isEmpty()) { + msg += String8::format(" R1: [%d %d %d %d] R2: [%d %d %d %d]", + r1.left, r1.top, r1.right, r1.bottom, + r2.left, r2.top, r2.right, r2.bottom); + fprintf(stderr, "assertRectEq: %s\n", msg.string()); + return ::testing::AssertionFailure( + ::testing::Message(msg.string())); + } else { + return ::testing::AssertionSuccess(); + } + } + + int mDisplaySecs; + sp mComposerClient; + sp mSurfaceControl; + + EGLDisplay mEglDisplay; + EGLSurface mEglSurface; + EGLContext mEglContext; + EGLConfig mGlConfig; +}; + +static void loadShader(GLenum shaderType, const char* pSource, + GLuint* outShader) { + GLuint shader = glCreateShader(shaderType); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + if (shader) { + glShaderSource(shader, 1, &pSource, NULL); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glCompileShader(shader); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + GLint compiled = 0; + glGetShaderiv(shader, GL_COMPILE_STATUS, &compiled); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + if (!compiled) { + GLint infoLen = 0; + glGetShaderiv(shader, GL_INFO_LOG_LENGTH, &infoLen); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + if (infoLen) { + char* buf = (char*) malloc(infoLen); + if (buf) { + glGetShaderInfoLog(shader, infoLen, NULL, buf); + printf("Shader compile log:\n%s\n", buf); + free(buf); + FAIL(); + } + } else { + char* buf = (char*) malloc(0x1000); + if (buf) { + glGetShaderInfoLog(shader, 0x1000, NULL, buf); + printf("Shader compile log:\n%s\n", buf); + free(buf); + FAIL(); + } + } + glDeleteShader(shader); + shader = 0; + } + } + ASSERT_TRUE(shader != 0); + *outShader = shader; +} + +static void createProgram(const char* pVertexSource, + const char* pFragmentSource, GLuint* outPgm) { + GLuint vertexShader, fragmentShader; + { + SCOPED_TRACE("compiling vertex shader"); + ASSERT_NO_FATAL_FAILURE(loadShader(GL_VERTEX_SHADER, pVertexSource, + &vertexShader)); + } + { + SCOPED_TRACE("compiling fragment shader"); + ASSERT_NO_FATAL_FAILURE(loadShader(GL_FRAGMENT_SHADER, pFragmentSource, + &fragmentShader)); + } + + GLuint program = glCreateProgram(); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + if (program) { + glAttachShader(program, vertexShader); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glAttachShader(program, fragmentShader); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glLinkProgram(program); + GLint linkStatus = GL_FALSE; + glGetProgramiv(program, GL_LINK_STATUS, &linkStatus); + if (linkStatus != GL_TRUE) { + GLint bufLength = 0; + glGetProgramiv(program, GL_INFO_LOG_LENGTH, &bufLength); + if (bufLength) { + char* buf = (char*) malloc(bufLength); + if (buf) { + glGetProgramInfoLog(program, bufLength, NULL, buf); + printf("Program link log:\n%s\n", buf); + free(buf); + FAIL(); + } + } + glDeleteProgram(program); + program = 0; + } + } + glDeleteShader(vertexShader); + glDeleteShader(fragmentShader); + ASSERT_TRUE(program != 0); + *outPgm = program; +} + +static int abs(int value) { + return value > 0 ? value : -value; +} + + +// XXX: Code above this point should live elsewhere + +class SurfaceTextureGLTest : public GLTest { +protected: + enum { TEX_ID = 123 }; + + virtual void SetUp() { + GLTest::SetUp(); + mST = new SurfaceTexture(TEX_ID); + mSTC = new SurfaceTextureClient(mST); + mANW = mSTC; + mTextureRenderer = new TextureRenderer(TEX_ID, mST); + ASSERT_NO_FATAL_FAILURE(mTextureRenderer->SetUp()); + mFW = new FrameWaiter; + mST->setFrameAvailableListener(mFW); + } + + virtual void TearDown() { + mANW.clear(); + mSTC.clear(); + mST.clear(); + GLTest::TearDown(); + } + + void drawTexture() { + mTextureRenderer->drawTexture(); + } + + class TextureRenderer: public RefBase { + public: + TextureRenderer(GLuint texName, const sp& st): + mTexName(texName), + mST(st) { + } + + void SetUp() { + const char vsrc[] = + "attribute vec4 vPosition;\n" + "varying vec2 texCoords;\n" + "uniform mat4 texMatrix;\n" + "void main() {\n" + " vec2 vTexCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n" + " texCoords = (texMatrix * vec4(vTexCoords, 0.0, 1.0)).xy;\n" + " gl_Position = vPosition;\n" + "}\n"; + + const char fsrc[] = + "#extension GL_OES_EGL_image_external : require\n" + "precision mediump float;\n" + "uniform samplerExternalOES texSampler;\n" + "varying vec2 texCoords;\n" + "void main() {\n" + " gl_FragColor = texture2D(texSampler, texCoords);\n" + "}\n"; + + { + SCOPED_TRACE("creating shader program"); + ASSERT_NO_FATAL_FAILURE(createProgram(vsrc, fsrc, &mPgm)); + } + + mPositionHandle = glGetAttribLocation(mPgm, "vPosition"); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_NE(-1, mPositionHandle); + mTexSamplerHandle = glGetUniformLocation(mPgm, "texSampler"); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_NE(-1, mTexSamplerHandle); + mTexMatrixHandle = glGetUniformLocation(mPgm, "texMatrix"); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_NE(-1, mTexMatrixHandle); + } + + // drawTexture draws the SurfaceTexture over the entire GL viewport. + void drawTexture() { + static const GLfloat triangleVertices[] = { + -1.0f, 1.0f, + -1.0f, -1.0f, + 1.0f, -1.0f, + 1.0f, 1.0f, + }; + + glVertexAttribPointer(mPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, + triangleVertices); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glEnableVertexAttribArray(mPositionHandle); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + + glUseProgram(mPgm); + glUniform1i(mTexSamplerHandle, 0); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + + // XXX: These calls are not needed for GL_TEXTURE_EXTERNAL_OES as + // they're setting the defautls for that target, but when hacking + // things to use GL_TEXTURE_2D they are needed to achieve the same + // behavior. + glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, + GL_LINEAR); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, + GL_LINEAR); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, + GL_CLAMP_TO_EDGE); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, + GL_CLAMP_TO_EDGE); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + + GLfloat texMatrix[16]; + mST->getTransformMatrix(texMatrix); + glUniformMatrix4fv(mTexMatrixHandle, 1, GL_FALSE, texMatrix); + + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + } + + GLuint mTexName; + sp mST; + GLuint mPgm; + GLint mPositionHandle; + GLint mTexSamplerHandle; + GLint mTexMatrixHandle; + }; + + class FrameWaiter : public SurfaceTexture::FrameAvailableListener { + public: + FrameWaiter(): + mPendingFrames(0) { + } + + void waitForFrame() { + Mutex::Autolock lock(mMutex); + while (mPendingFrames == 0) { + mCondition.wait(mMutex); + } + mPendingFrames--; + } + + virtual void onFrameAvailable() { + Mutex::Autolock lock(mMutex); + mPendingFrames++; + mCondition.signal(); + } + + int mPendingFrames; + Mutex mMutex; + Condition mCondition; + }; + + // Note that SurfaceTexture will lose the notifications + // onBuffersReleased and onFrameAvailable as there is currently + // no way to forward the events. This DisconnectWaiter will not let the + // disconnect finish until finishDisconnect() is called. It will + // also block until a disconnect is called + class DisconnectWaiter : public BufferQueue::ConsumerListener { + public: + DisconnectWaiter () : + mWaitForDisconnect(false), + mPendingFrames(0) { + } + + void waitForFrame() { + Mutex::Autolock lock(mMutex); + while (mPendingFrames == 0) { + mFrameCondition.wait(mMutex); + } + mPendingFrames--; + } + + virtual void onFrameAvailable() { + Mutex::Autolock lock(mMutex); + mPendingFrames++; + mFrameCondition.signal(); + } + + virtual void onBuffersReleased() { + Mutex::Autolock lock(mMutex); + while (!mWaitForDisconnect) { + mDisconnectCondition.wait(mMutex); + } + } + + void finishDisconnect() { + Mutex::Autolock lock(mMutex); + mWaitForDisconnect = true; + mDisconnectCondition.signal(); + } + + private: + Mutex mMutex; + + bool mWaitForDisconnect; + Condition mDisconnectCondition; + + int mPendingFrames; + Condition mFrameCondition; + }; + + sp mST; + sp mSTC; + sp mANW; + sp mTextureRenderer; + sp mFW; +}; + +// Fill a YV12 buffer with a multi-colored checkerboard pattern +void fillYV12Buffer(uint8_t* buf, int w, int h, int stride) { + const int blockWidth = w > 16 ? w / 16 : 1; + const int blockHeight = h > 16 ? h / 16 : 1; + const int yuvTexOffsetY = 0; + int yuvTexStrideY = stride; + int yuvTexOffsetV = yuvTexStrideY * h; + int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; + int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2; + int yuvTexStrideU = yuvTexStrideV; + for (int x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + int parityX = (x / blockWidth) & 1; + int parityY = (y / blockHeight) & 1; + unsigned char intensity = (parityX ^ parityY) ? 63 : 191; + buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = intensity; + if (x < w / 2 && y < h / 2) { + buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = intensity; + if (x * 2 < w / 2 && y * 2 < h / 2) { + buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 0] = + buf[yuvTexOffsetV + (y*2 * yuvTexStrideV) + x*2 + 1] = + buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 0] = + buf[yuvTexOffsetV + ((y*2+1) * yuvTexStrideV) + x*2 + 1] = + intensity; + } + } + } + } +} + +// Fill a YV12 buffer with red outside a given rectangle and green inside it. +void fillYV12BufferRect(uint8_t* buf, int w, int h, int stride, + const android_native_rect_t& rect) { + const int yuvTexOffsetY = 0; + int yuvTexStrideY = stride; + int yuvTexOffsetV = yuvTexStrideY * h; + int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; + int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * h/2; + int yuvTexStrideU = yuvTexStrideV; + for (int x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + bool inside = rect.left <= x && x < rect.right && + rect.top <= y && y < rect.bottom; + buf[yuvTexOffsetY + (y * yuvTexStrideY) + x] = inside ? 240 : 64; + if (x < w / 2 && y < h / 2) { + bool inside = rect.left <= 2*x && 2*x < rect.right && + rect.top <= 2*y && 2*y < rect.bottom; + buf[yuvTexOffsetU + (y * yuvTexStrideU) + x] = 16; + buf[yuvTexOffsetV + (y * yuvTexStrideV) + x] = + inside ? 16 : 255; + } + } + } +} + +void fillRGBA8Buffer(uint8_t* buf, int w, int h, int stride) { + const size_t PIXEL_SIZE = 4; + for (int x = 0; x < w; x++) { + for (int y = 0; y < h; y++) { + off_t offset = (y * stride + x) * PIXEL_SIZE; + for (int c = 0; c < 4; c++) { + int parityX = (x / (1 << (c+2))) & 1; + int parityY = (y / (1 << (c+2))) & 1; + buf[offset + c] = (parityX ^ parityY) ? 231 : 35; + } + } + } +} + +void fillRGBA8BufferSolid(uint8_t* buf, int w, int h, int stride, uint8_t r, + uint8_t g, uint8_t b, uint8_t a) { + const size_t PIXEL_SIZE = 4; + for (int y = 0; y < h; y++) { + for (int x = 0; x < h; x++) { + off_t offset = (y * stride + x) * PIXEL_SIZE; + buf[offset + 0] = r; + buf[offset + 1] = g; + buf[offset + 2] = b; + buf[offset + 3] = a; + } + } +} + +// Produce a single RGBA8 frame by filling a buffer with a checkerboard pattern +// using the CPU. This assumes that the ANativeWindow is already configured to +// allow this to be done (e.g. the format is set to RGBA8). +// +// Calls to this function should be wrapped in an ASSERT_NO_FATAL_FAILURE(). +void produceOneRGBA8Frame(const sp& anw) { + android_native_buffer_t* anb; + ASSERT_EQ(NO_ERROR, anw->dequeueBuffer(anw.get(), &anb)); + ASSERT_TRUE(anb != NULL); + + sp buf(new GraphicBuffer(anb, false)); + ASSERT_EQ(NO_ERROR, anw->lockBuffer(anw.get(), buf->getNativeBuffer())); + + uint8_t* img = NULL; + ASSERT_EQ(NO_ERROR, buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, + (void**)(&img))); + fillRGBA8Buffer(img, buf->getWidth(), buf->getHeight(), buf->getStride()); + ASSERT_EQ(NO_ERROR, buf->unlock()); + ASSERT_EQ(NO_ERROR, anw->queueBuffer(anw.get(), buf->getNativeBuffer())); +} + +TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferNpot) { + const int texWidth = 64; + const int texHeight = 66; + + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_YV12)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); + + ANativeWindowBuffer* anb; + ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + ASSERT_TRUE(anb != NULL); + + sp buf(new GraphicBuffer(anb, false)); + ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer())); + + // Fill the buffer with the a checkerboard pattern + uint8_t* img = NULL; + buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); + fillYV12Buffer(img, texWidth, texHeight, buf->getStride()); + buf->unlock(); + ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer())); + + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 255, 127, 255, 255)); + EXPECT_TRUE(checkPixel(63, 0, 0, 133, 0, 255)); + EXPECT_TRUE(checkPixel(63, 65, 0, 133, 0, 255)); + EXPECT_TRUE(checkPixel( 0, 65, 255, 127, 255, 255)); + + EXPECT_TRUE(checkPixel(22, 44, 255, 127, 255, 255)); + EXPECT_TRUE(checkPixel(45, 52, 255, 127, 255, 255)); + EXPECT_TRUE(checkPixel(52, 51, 98, 255, 73, 255)); + EXPECT_TRUE(checkPixel( 7, 31, 155, 0, 118, 255)); + EXPECT_TRUE(checkPixel(31, 9, 107, 24, 87, 255)); + EXPECT_TRUE(checkPixel(29, 35, 255, 127, 255, 255)); + EXPECT_TRUE(checkPixel(36, 22, 155, 29, 0, 255)); +} + +TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferPow2) { + const int texWidth = 64; + const int texHeight = 64; + + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_YV12)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); + + ANativeWindowBuffer* anb; + ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + ASSERT_TRUE(anb != NULL); + + sp buf(new GraphicBuffer(anb, false)); + ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer())); + + // Fill the buffer with the a checkerboard pattern + uint8_t* img = NULL; + buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); + fillYV12Buffer(img, texWidth, texHeight, buf->getStride()); + buf->unlock(); + ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer())); + + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 0, 133, 0, 255)); + EXPECT_TRUE(checkPixel(63, 0, 255, 127, 255, 255)); + EXPECT_TRUE(checkPixel(63, 63, 0, 133, 0, 255)); + EXPECT_TRUE(checkPixel( 0, 63, 255, 127, 255, 255)); + + EXPECT_TRUE(checkPixel(22, 19, 100, 255, 74, 255)); + EXPECT_TRUE(checkPixel(45, 11, 100, 255, 74, 255)); + EXPECT_TRUE(checkPixel(52, 12, 155, 0, 181, 255)); + EXPECT_TRUE(checkPixel( 7, 32, 150, 237, 170, 255)); + EXPECT_TRUE(checkPixel(31, 54, 0, 71, 117, 255)); + EXPECT_TRUE(checkPixel(29, 28, 0, 133, 0, 255)); + EXPECT_TRUE(checkPixel(36, 41, 100, 232, 255, 255)); +} + +TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BufferWithCrop) { + const int texWidth = 64; + const int texHeight = 66; + + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_YV12)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); + + android_native_rect_t crops[] = { + {4, 6, 22, 36}, + {0, 6, 22, 36}, + {4, 0, 22, 36}, + {4, 6, texWidth, 36}, + {4, 6, 22, texHeight}, + }; + + for (int i = 0; i < 5; i++) { + const android_native_rect_t& crop(crops[i]); + SCOPED_TRACE(String8::format("rect{ l: %d t: %d r: %d b: %d }", + crop.left, crop.top, crop.right, crop.bottom).string()); + + ASSERT_EQ(NO_ERROR, native_window_set_crop(mANW.get(), &crop)); + + ANativeWindowBuffer* anb; + ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + ASSERT_TRUE(anb != NULL); + + sp buf(new GraphicBuffer(anb, false)); + ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), + buf->getNativeBuffer())); + + uint8_t* img = NULL; + buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); + fillYV12BufferRect(img, texWidth, texHeight, buf->getStride(), crop); + buf->unlock(); + ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), + buf->getNativeBuffer())); + + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, 64, 64); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(63, 0, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(63, 63, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel( 0, 63, 82, 255, 35, 255)); + + EXPECT_TRUE(checkPixel(25, 14, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(35, 31, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(57, 6, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel( 5, 42, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(32, 33, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(16, 26, 82, 255, 35, 255)); + EXPECT_TRUE(checkPixel(46, 51, 82, 255, 35, 255)); + } +} + +// This test is intended to catch synchronization bugs between the CPU-written +// and GPU-read buffers. +TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledYV12BuffersRepeatedly) { + enum { texWidth = 16 }; + enum { texHeight = 16 }; + enum { numFrames = 1024 }; + + ASSERT_EQ(NO_ERROR, mST->setSynchronousMode(true)); + ASSERT_EQ(NO_ERROR, mST->setBufferCountServer(2)); + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_YV12)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_WRITE_OFTEN)); + + struct TestPixel { + int x; + int y; + }; + const TestPixel testPixels[] = { + { 4, 11 }, + { 12, 14 }, + { 7, 2 }, + }; + enum {numTestPixels = sizeof(testPixels) / sizeof(testPixels[0])}; + + class ProducerThread : public Thread { + public: + ProducerThread(const sp& anw, + const TestPixel* testPixels): + mANW(anw), + mTestPixels(testPixels) { + } + + virtual ~ProducerThread() { + } + + virtual bool threadLoop() { + for (int i = 0; i < numFrames; i++) { + ANativeWindowBuffer* anb; + if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) { + return false; + } + if (anb == NULL) { + return false; + } + + sp buf(new GraphicBuffer(anb, false)); + if (mANW->lockBuffer(mANW.get(), buf->getNativeBuffer()) + != NO_ERROR) { + return false; + } + + const int yuvTexOffsetY = 0; + int stride = buf->getStride(); + int yuvTexStrideY = stride; + int yuvTexOffsetV = yuvTexStrideY * texHeight; + int yuvTexStrideV = (yuvTexStrideY/2 + 0xf) & ~0xf; + int yuvTexOffsetU = yuvTexOffsetV + yuvTexStrideV * texHeight/2; + int yuvTexStrideU = yuvTexStrideV; + + uint8_t* img = NULL; + buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); + + // Gray out all the test pixels first, so we're more likely to + // see a failure if GL is still texturing from the buffer we + // just dequeued. + for (int j = 0; j < numTestPixels; j++) { + int x = mTestPixels[j].x; + int y = mTestPixels[j].y; + uint8_t value = 128; + img[y*stride + x] = value; + } + + // Fill the buffer with gray. + for (int y = 0; y < texHeight; y++) { + for (int x = 0; x < texWidth; x++) { + img[yuvTexOffsetY + y*yuvTexStrideY + x] = 128; + img[yuvTexOffsetU + (y/2)*yuvTexStrideU + x/2] = 128; + img[yuvTexOffsetV + (y/2)*yuvTexStrideV + x/2] = 128; + } + } + + // Set the test pixels to either white or black. + for (int j = 0; j < numTestPixels; j++) { + int x = mTestPixels[j].x; + int y = mTestPixels[j].y; + uint8_t value = 0; + if (j == (i % numTestPixels)) { + value = 255; + } + img[y*stride + x] = value; + } + + buf->unlock(); + if (mANW->queueBuffer(mANW.get(), buf->getNativeBuffer()) + != NO_ERROR) { + return false; + } + } + return false; + } + + sp mANW; + const TestPixel* mTestPixels; + }; + + sp pt(new ProducerThread(mANW, testPixels)); + pt->run(); + + glViewport(0, 0, texWidth, texHeight); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + // We wait for the first two frames up front so that the producer will be + // likely to dequeue the buffer that's currently being textured from. + mFW->waitForFrame(); + mFW->waitForFrame(); + + for (int i = 0; i < numFrames; i++) { + SCOPED_TRACE(String8::format("frame %d", i).string()); + + // We must wait for each frame to come in because if we ever do an + // updateTexImage call that doesn't consume a newly available buffer + // then the producer and consumer will get out of sync, which will cause + // a deadlock. + if (i > 1) { + mFW->waitForFrame(); + } + mST->updateTexImage(); + drawTexture(); + + for (int j = 0; j < numTestPixels; j++) { + int x = testPixels[j].x; + int y = testPixels[j].y; + uint8_t value = 0; + if (j == (i % numTestPixels)) { + // We must y-invert the texture coords + EXPECT_TRUE(checkPixel(x, texHeight-y-1, 255, 255, 255, 255)); + } else { + // We must y-invert the texture coords + EXPECT_TRUE(checkPixel(x, texHeight-y-1, 0, 0, 0, 255)); + } + } + } + + pt->requestExitAndWait(); +} + +TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferNpot) { + const int texWidth = 64; + const int texHeight = 66; + + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); + + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); + EXPECT_TRUE(checkPixel(63, 0, 231, 231, 231, 231)); + EXPECT_TRUE(checkPixel(63, 65, 231, 231, 231, 231)); + EXPECT_TRUE(checkPixel( 0, 65, 35, 35, 35, 35)); + + EXPECT_TRUE(checkPixel(15, 10, 35, 231, 231, 231)); + EXPECT_TRUE(checkPixel(23, 65, 231, 35, 231, 35)); + EXPECT_TRUE(checkPixel(19, 40, 35, 231, 35, 35)); + EXPECT_TRUE(checkPixel(38, 30, 231, 35, 35, 35)); + EXPECT_TRUE(checkPixel(42, 54, 35, 35, 35, 231)); + EXPECT_TRUE(checkPixel(37, 34, 35, 231, 231, 231)); + EXPECT_TRUE(checkPixel(31, 8, 231, 35, 35, 231)); + EXPECT_TRUE(checkPixel(37, 47, 231, 35, 231, 231)); + EXPECT_TRUE(checkPixel(25, 38, 35, 35, 35, 35)); + EXPECT_TRUE(checkPixel(49, 6, 35, 231, 35, 35)); + EXPECT_TRUE(checkPixel(54, 50, 35, 231, 231, 231)); + EXPECT_TRUE(checkPixel(27, 26, 231, 231, 231, 231)); + EXPECT_TRUE(checkPixel(10, 6, 35, 35, 231, 231)); + EXPECT_TRUE(checkPixel(29, 4, 35, 35, 35, 231)); + EXPECT_TRUE(checkPixel(55, 28, 35, 35, 231, 35)); + EXPECT_TRUE(checkPixel(58, 55, 35, 35, 231, 231)); +} + +TEST_F(SurfaceTextureGLTest, TexturingFromCpuFilledRGBABufferPow2) { + const int texWidth = 64; + const int texHeight = 64; + + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); + + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 231, 231, 231, 231)); + EXPECT_TRUE(checkPixel(63, 0, 35, 35, 35, 35)); + EXPECT_TRUE(checkPixel(63, 63, 231, 231, 231, 231)); + EXPECT_TRUE(checkPixel( 0, 63, 35, 35, 35, 35)); + + EXPECT_TRUE(checkPixel(12, 46, 231, 231, 231, 35)); + EXPECT_TRUE(checkPixel(16, 1, 231, 231, 35, 231)); + EXPECT_TRUE(checkPixel(21, 12, 231, 35, 35, 231)); + EXPECT_TRUE(checkPixel(26, 51, 231, 35, 231, 35)); + EXPECT_TRUE(checkPixel( 5, 32, 35, 231, 231, 35)); + EXPECT_TRUE(checkPixel(13, 8, 35, 231, 231, 231)); + EXPECT_TRUE(checkPixel(46, 3, 35, 35, 231, 35)); + EXPECT_TRUE(checkPixel(30, 33, 35, 35, 35, 35)); + EXPECT_TRUE(checkPixel( 6, 52, 231, 231, 35, 35)); + EXPECT_TRUE(checkPixel(55, 33, 35, 231, 35, 231)); + EXPECT_TRUE(checkPixel(16, 29, 35, 35, 231, 231)); + EXPECT_TRUE(checkPixel( 1, 30, 35, 35, 35, 231)); + EXPECT_TRUE(checkPixel(41, 37, 35, 35, 231, 231)); + EXPECT_TRUE(checkPixel(46, 29, 231, 231, 35, 35)); + EXPECT_TRUE(checkPixel(15, 25, 35, 231, 35, 231)); + EXPECT_TRUE(checkPixel( 3, 52, 35, 231, 35, 35)); +} + +// Tests if SurfaceTexture and BufferQueue are robust enough +// to handle a special case where updateTexImage is called +// in the middle of disconnect. This ordering is enforced +// by blocking in the disconnect callback. +TEST_F(SurfaceTextureGLTest, DisconnectStressTest) { + + class ProducerThread : public Thread { + public: + ProducerThread(const sp& anw): + mANW(anw) { + } + + virtual ~ProducerThread() { + } + + virtual bool threadLoop() { + ANativeWindowBuffer* anb; + + native_window_api_connect(mANW.get(), NATIVE_WINDOW_API_EGL); + + for (int numFrames =0 ; numFrames < 2; numFrames ++) { + + if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) { + return false; + } + if (anb == NULL) { + return false; + } + if (mANW->queueBuffer(mANW.get(), anb) + != NO_ERROR) { + return false; + } + } + + native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_EGL); + + return false; + } + + private: + sp mANW; + }; + + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + + sp dw(new DisconnectWaiter()); + mST->getBufferQueue()->consumerConnect(dw); + + + sp pt(new ProducerThread(mANW)); + pt->run(); + + // eat a frame so SurfaceTexture will own an at least one slot + dw->waitForFrame(); + EXPECT_EQ(OK,mST->updateTexImage()); + + dw->waitForFrame(); + // Could fail here as SurfaceTexture thinks it still owns the slot + // but bufferQueue has released all slots + EXPECT_EQ(OK,mST->updateTexImage()); + + dw->finishDisconnect(); +} + + +// This test ensures that the SurfaceTexture clears the mCurrentTexture +// when it is disconnected and reconnected. Otherwise it will +// attempt to release a buffer that it does not owned +TEST_F(SurfaceTextureGLTest, DisconnectClearsCurrentTexture) { + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + + ASSERT_EQ(OK, native_window_api_connect(mANW.get(), + NATIVE_WINDOW_API_EGL)); + + ANativeWindowBuffer *anb; + + EXPECT_EQ (OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + + EXPECT_EQ (OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + + EXPECT_EQ(OK,mST->updateTexImage()); + EXPECT_EQ(OK,mST->updateTexImage()); + + ASSERT_EQ(OK, native_window_api_disconnect(mANW.get(), + NATIVE_WINDOW_API_EGL)); + ASSERT_EQ(OK, native_window_api_connect(mANW.get(), + NATIVE_WINDOW_API_EGL)); + + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + + EXPECT_EQ(OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + + // Will fail here if mCurrentTexture is not cleared properly + mFW->waitForFrame(); + EXPECT_EQ(OK,mST->updateTexImage()); + + ASSERT_EQ(OK, native_window_api_disconnect(mANW.get(), + NATIVE_WINDOW_API_EGL)); +} + +TEST_F(SurfaceTextureGLTest, ScaleToWindowMode) { + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + + ASSERT_EQ(OK, native_window_set_scaling_mode(mANW.get(), + NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW)); + + // The producer image size + ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 512, 512)); + + // The consumer image size (16 x 9) ratio + mST->setDefaultBufferSize(1280, 720); + + ASSERT_EQ(OK, native_window_api_connect(mANW.get(), + NATIVE_WINDOW_API_CPU)); + + ANativeWindowBuffer *anb; + + android_native_rect_t odd = {23, 78, 123, 477}; + ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &odd)); + EXPECT_EQ (OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + mFW->waitForFrame(); + EXPECT_EQ(OK,mST->updateTexImage()); + Rect r = mST->getCurrentCrop(); + assertRectEq(Rect(23, 78, 123, 477), r); + + ASSERT_EQ(OK, native_window_api_disconnect(mANW.get(), + NATIVE_WINDOW_API_CPU)); +} + +// This test ensures the scaling mode does the right thing +// ie NATIVE_WINDOW_SCALING_MODE_CROP should crop +// the image such that it has the same aspect ratio as the +// default buffer size +TEST_F(SurfaceTextureGLTest, CroppedScalingMode) { + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + + ASSERT_EQ(OK, native_window_set_scaling_mode(mANW.get(), + NATIVE_WINDOW_SCALING_MODE_SCALE_CROP)); + + // The producer image size + ASSERT_EQ(OK, native_window_set_buffers_dimensions(mANW.get(), 512, 512)); + + // The consumer image size (16 x 9) ratio + mST->setDefaultBufferSize(1280, 720); + + native_window_api_connect(mANW.get(), NATIVE_WINDOW_API_CPU); + + ANativeWindowBuffer *anb; + + // The crop is in the shape of (320, 180) === 16 x 9 + android_native_rect_t standard = {10, 20, 330, 200}; + ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &standard)); + EXPECT_EQ (OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + mFW->waitForFrame(); + EXPECT_EQ(OK,mST->updateTexImage()); + Rect r = mST->getCurrentCrop(); + // crop should be the same as crop (same aspect ratio) + assertRectEq(Rect(10, 20, 330, 200), r); + + // make this wider then desired aspect 239 x 100 (2.39:1) + android_native_rect_t wide = {20, 30, 259, 130}; + ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &wide)); + EXPECT_EQ (OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + mFW->waitForFrame(); + EXPECT_EQ(OK,mST->updateTexImage()); + r = mST->getCurrentCrop(); + // crop should be the same height, but have cropped left and right borders + // offset is 30.6 px L+, R- + assertRectEq(Rect(51, 30, 228, 130), r); + + // This image is taller then desired aspect 400 x 300 (4:3) + android_native_rect_t narrow = {0, 0, 400, 300}; + ASSERT_EQ(OK, native_window_set_crop(mANW.get(), &narrow)); + EXPECT_EQ (OK, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(OK, mANW->queueBuffer(mANW.get(), anb)); + mFW->waitForFrame(); + EXPECT_EQ(OK,mST->updateTexImage()); + r = mST->getCurrentCrop(); + // crop should be the same width, but have cropped top and bottom borders + // offset is 37.5 px + assertRectEq(Rect(0, 37, 400, 262), r); + + native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); +} + +TEST_F(SurfaceTextureGLTest, AbandonUnblocksDequeueBuffer) { + class ProducerThread : public Thread { + public: + ProducerThread(const sp& anw): + mANW(anw), + mDequeueError(NO_ERROR) { + } + + virtual ~ProducerThread() { + } + + virtual bool threadLoop() { + Mutex::Autolock lock(mMutex); + ANativeWindowBuffer* anb; + + // Frame 1 + if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) { + return false; + } + if (anb == NULL) { + return false; + } + if (mANW->queueBuffer(mANW.get(), anb) + != NO_ERROR) { + return false; + } + + // Frame 2 + if (mANW->dequeueBuffer(mANW.get(), &anb) != NO_ERROR) { + return false; + } + if (anb == NULL) { + return false; + } + if (mANW->queueBuffer(mANW.get(), anb) + != NO_ERROR) { + return false; + } + + // Frame 3 - error expected + mDequeueError = mANW->dequeueBuffer(mANW.get(), &anb); + return false; + } + + status_t getDequeueError() { + Mutex::Autolock lock(mMutex); + return mDequeueError; + } + + private: + sp mANW; + status_t mDequeueError; + Mutex mMutex; + }; + + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + ASSERT_EQ(OK, mST->setBufferCountServer(2)); + + sp pt(new ProducerThread(mANW)); + pt->run(); + + mFW->waitForFrame(); + mFW->waitForFrame(); + + // Sleep for 100ms to allow the producer thread's dequeueBuffer call to + // block waiting for a buffer to become available. + usleep(100000); + + mST->abandon(); + + pt->requestExitAndWait(); + ASSERT_EQ(NO_INIT, + reinterpret_cast(pt.get())->getDequeueError()); +} + +TEST_F(SurfaceTextureGLTest, InvalidWidthOrHeightFails) { + int texHeight = 16; + ANativeWindowBuffer* anb; + + GLint maxTextureSize; + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &maxTextureSize); + + // make sure it works with small textures + mST->setDefaultBufferSize(16, texHeight); + EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(16, anb->width); + EXPECT_EQ(texHeight, anb->height); + EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb)); + EXPECT_EQ(NO_ERROR, mST->updateTexImage()); + + // make sure it works with GL_MAX_TEXTURE_SIZE + mST->setDefaultBufferSize(maxTextureSize, texHeight); + EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(maxTextureSize, anb->width); + EXPECT_EQ(texHeight, anb->height); + EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb)); + EXPECT_EQ(NO_ERROR, mST->updateTexImage()); + + // make sure it fails with GL_MAX_TEXTURE_SIZE+1 + mST->setDefaultBufferSize(maxTextureSize+1, texHeight); + EXPECT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + EXPECT_EQ(maxTextureSize+1, anb->width); + EXPECT_EQ(texHeight, anb->height); + EXPECT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), anb)); + ASSERT_NE(NO_ERROR, mST->updateTexImage()); +} + +/* + * This test fixture is for testing GL -> GL texture streaming. It creates an + * EGLSurface and an EGLContext for the image producer to use. + */ +class SurfaceTextureGLToGLTest : public SurfaceTextureGLTest { +protected: + SurfaceTextureGLToGLTest(): + mProducerEglSurface(EGL_NO_SURFACE), + mProducerEglContext(EGL_NO_CONTEXT) { + } + + virtual void SetUp() { + SurfaceTextureGLTest::SetUp(); + + mProducerEglSurface = eglCreateWindowSurface(mEglDisplay, mGlConfig, + mANW.get(), NULL); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_SURFACE, mProducerEglSurface); + + mProducerEglContext = eglCreateContext(mEglDisplay, mGlConfig, + EGL_NO_CONTEXT, getContextAttribs()); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_CONTEXT, mProducerEglContext); + } + + virtual void TearDown() { + if (mProducerEglContext != EGL_NO_CONTEXT) { + eglDestroyContext(mEglDisplay, mProducerEglContext); + } + if (mProducerEglSurface != EGL_NO_SURFACE) { + eglDestroySurface(mEglDisplay, mProducerEglSurface); + } + SurfaceTextureGLTest::TearDown(); + } + + EGLSurface mProducerEglSurface; + EGLContext mProducerEglContext; +}; + +TEST_F(SurfaceTextureGLToGLTest, TexturingFromGLFilledRGBABufferPow2) { + const int texWidth = 64; + const int texHeight = 64; + + mST->setDefaultBufferSize(texWidth, texHeight); + + // Do the producer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // This is needed to ensure we pick up a buffer of the correct size. + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + glClearColor(0.6, 0.6, 0.6, 0.6); + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(GL_SCISSOR_TEST); + glScissor(4, 4, 4, 4); + glClearColor(1.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + glScissor(24, 48, 4, 4); + glClearColor(0.0, 1.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + glScissor(37, 17, 4, 4); + glClearColor(0.0, 0.0, 1.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + // Do the consumer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + glDisable(GL_SCISSOR_TEST); + + mST->updateTexImage(); // Skip the first frame, which was empty + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153)); + + EXPECT_TRUE(checkPixel( 4, 7, 255, 0, 0, 255)); + EXPECT_TRUE(checkPixel(25, 51, 0, 255, 0, 255)); + EXPECT_TRUE(checkPixel(40, 19, 0, 0, 255, 255)); + EXPECT_TRUE(checkPixel(29, 51, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 5, 32, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(13, 8, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(46, 3, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(30, 33, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 6, 52, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(55, 33, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(16, 29, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 1, 30, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(41, 37, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(46, 29, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(15, 25, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 3, 52, 153, 153, 153, 153)); +} + +TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceUnrefsBuffers) { + sp buffers[2]; + + // This test requires async mode to run on a single thread. + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + EXPECT_TRUE(eglSwapInterval(mEglDisplay, 0)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + for (int i = 0; i < 2; i++) { + // Produce a frame + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + glClear(GL_COLOR_BUFFER_BIT); + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + // Consume a frame + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + mFW->waitForFrame(); + mST->updateTexImage(); + buffers[i] = mST->getCurrentBuffer(); + } + + // Destroy the GL texture object to release its ref on buffers[2]. + GLuint texID = TEX_ID; + glDeleteTextures(1, &texID); + + // Destroy the EGLSurface + EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + mProducerEglSurface = EGL_NO_SURFACE; + + // This test should have the only reference to buffer 0. + EXPECT_EQ(1, buffers[0]->getStrongCount()); + + // The SurfaceTexture should hold a single reference to buffer 1 in its + // mCurrentBuffer member. All of the references in the slots should have + // been released. + EXPECT_EQ(2, buffers[1]->getStrongCount()); +} + +TEST_F(SurfaceTextureGLToGLTest, EglDestroySurfaceAfterAbandonUnrefsBuffers) { + sp buffers[3]; + + // This test requires async mode to run on a single thread. + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + EXPECT_TRUE(eglSwapInterval(mEglDisplay, 0)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + for (int i = 0; i < 3; i++) { + // Produce a frame + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + glClear(GL_COLOR_BUFFER_BIT); + EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // Consume a frame + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + mFW->waitForFrame(); + ASSERT_EQ(NO_ERROR, mST->updateTexImage()); + buffers[i] = mST->getCurrentBuffer(); + } + + // Abandon the SurfaceTexture, releasing the ref that the SurfaceTexture has + // on buffers[2]. + mST->abandon(); + + // Destroy the GL texture object to release its ref on buffers[2]. + GLuint texID = TEX_ID; + glDeleteTextures(1, &texID); + + // Destroy the EGLSurface. + EXPECT_TRUE(eglDestroySurface(mEglDisplay, mProducerEglSurface)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + mProducerEglSurface = EGL_NO_SURFACE; + + EXPECT_EQ(1, buffers[0]->getStrongCount()); + EXPECT_EQ(1, buffers[1]->getStrongCount()); + + // Depending on how lazily the GL driver dequeues buffers, we may end up + // with either two or three total buffers. If there are three, make sure + // the last one was properly down-ref'd. + if (buffers[2] != buffers[0]) { + EXPECT_EQ(1, buffers[2]->getStrongCount()); + } +} + +TEST_F(SurfaceTextureGLToGLTest, EglSurfaceDefaultsToSynchronousMode) { + // This test requires 3 buffers to run on a single thread. + mST->setBufferCountServer(3); + + ASSERT_TRUE(mST->isSynchronousMode()); + + for (int i = 0; i < 10; i++) { + // Produce a frame + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + glClear(GL_COLOR_BUFFER_BIT); + EXPECT_TRUE(eglSwapBuffers(mEglDisplay, mProducerEglSurface)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // Consume a frame + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_EQ(NO_ERROR, mST->updateTexImage()); + } + + ASSERT_TRUE(mST->isSynchronousMode()); +} + +TEST_F(SurfaceTextureGLToGLTest, TexturingFromUserSizedGLFilledBuffer) { + enum { texWidth = 64 }; + enum { texHeight = 64 }; + + // Set the user buffer size. + native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight); + + // Do the producer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // This is needed to ensure we pick up a buffer of the correct size. + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + glClearColor(0.6, 0.6, 0.6, 0.6); + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(GL_SCISSOR_TEST); + glScissor(4, 4, 1, 1); + glClearColor(1.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + // Do the consumer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + glDisable(GL_SCISSOR_TEST); + + mST->updateTexImage(); // Skip the first frame, which was empty + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 63, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 0, 63, 153, 153, 153, 153)); + + EXPECT_TRUE(checkPixel( 4, 4, 255, 0, 0, 255)); + EXPECT_TRUE(checkPixel( 5, 5, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 3, 3, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(45, 52, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(12, 36, 153, 153, 153, 153)); +} + +TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedUserSizedGLFilledBuffer) { + enum { texWidth = 64 }; + enum { texHeight = 16 }; + + // Set the transform hint. + mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90); + + // Set the user buffer size. + native_window_set_buffers_user_dimensions(mANW.get(), texWidth, texHeight); + + // Do the producer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // This is needed to ensure we pick up a buffer of the correct size and the + // new rotation hint. + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + glClearColor(0.6, 0.6, 0.6, 0.6); + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(GL_SCISSOR_TEST); + glScissor(24, 4, 1, 1); + glClearColor(1.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + // Do the consumer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + glDisable(GL_SCISSOR_TEST); + + mST->updateTexImage(); // Skip the first frame, which was empty + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 15, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 0, 15, 153, 153, 153, 153)); + + EXPECT_TRUE(checkPixel(24, 4, 255, 0, 0, 255)); + EXPECT_TRUE(checkPixel(25, 5, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(23, 3, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(45, 13, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(12, 8, 153, 153, 153, 153)); +} + +TEST_F(SurfaceTextureGLToGLTest, TexturingFromPreRotatedGLFilledBuffer) { + enum { texWidth = 64 }; + enum { texHeight = 16 }; + + // Set the transform hint. + mST->setTransformHint(NATIVE_WINDOW_TRANSFORM_ROT_90); + + // Set the default buffer size. + mST->setDefaultBufferSize(texWidth, texHeight); + + // Do the producer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // This is needed to ensure we pick up a buffer of the correct size and the + // new rotation hint. + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + glClearColor(0.6, 0.6, 0.6, 0.6); + glClear(GL_COLOR_BUFFER_BIT); + + glEnable(GL_SCISSOR_TEST); + glScissor(24, 4, 1, 1); + glClearColor(1.0, 0.0, 0.0, 1.0); + glClear(GL_COLOR_BUFFER_BIT); + + eglSwapBuffers(mEglDisplay, mProducerEglSurface); + + // Do the consumer side of things + EXPECT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + glDisable(GL_SCISSOR_TEST); + + mST->updateTexImage(); // Skip the first frame, which was empty + mST->updateTexImage(); + + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + + glViewport(0, 0, texWidth, texHeight); + drawTexture(); + + EXPECT_TRUE(checkPixel( 0, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 0, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(63, 15, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel( 0, 15, 153, 153, 153, 153)); + + EXPECT_TRUE(checkPixel(24, 4, 255, 0, 0, 255)); + EXPECT_TRUE(checkPixel(25, 5, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(23, 3, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(45, 13, 153, 153, 153, 153)); + EXPECT_TRUE(checkPixel(12, 8, 153, 153, 153, 153)); +} + +/* + * This test fixture is for testing GL -> GL texture streaming from one thread + * to another. It contains functionality to create a producer thread that will + * perform GL rendering to an ANativeWindow that feeds frames to a + * SurfaceTexture. Additionally it supports interlocking the producer and + * consumer threads so that a specific sequence of calls can be + * deterministically created by the test. + * + * The intended usage is as follows: + * + * TEST_F(...) { + * class PT : public ProducerThread { + * virtual void render() { + * ... + * swapBuffers(); + * } + * }; + * + * runProducerThread(new PT()); + * + * // The order of these calls will vary from test to test and may include + * // multiple frames and additional operations (e.g. GL rendering from the + * // texture). + * fc->waitForFrame(); + * mST->updateTexImage(); + * fc->finishFrame(); + * } + * + */ +class SurfaceTextureGLThreadToGLTest : public SurfaceTextureGLToGLTest { +protected: + + // ProducerThread is an abstract base class to simplify the creation of + // OpenGL ES frame producer threads. + class ProducerThread : public Thread { + public: + virtual ~ProducerThread() { + } + + void setEglObjects(EGLDisplay producerEglDisplay, + EGLSurface producerEglSurface, + EGLContext producerEglContext) { + mProducerEglDisplay = producerEglDisplay; + mProducerEglSurface = producerEglSurface; + mProducerEglContext = producerEglContext; + } + + virtual bool threadLoop() { + eglMakeCurrent(mProducerEglDisplay, mProducerEglSurface, + mProducerEglSurface, mProducerEglContext); + render(); + eglMakeCurrent(mProducerEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT); + return false; + } + + protected: + virtual void render() = 0; + + void swapBuffers() { + eglSwapBuffers(mProducerEglDisplay, mProducerEglSurface); + } + + EGLDisplay mProducerEglDisplay; + EGLSurface mProducerEglSurface; + EGLContext mProducerEglContext; + }; + + // FrameCondition is a utility class for interlocking between the producer + // and consumer threads. The FrameCondition object should be created and + // destroyed in the consumer thread only. The consumer thread should set + // the FrameCondition as the FrameAvailableListener of the SurfaceTexture, + // and should call both waitForFrame and finishFrame once for each expected + // frame. + // + // This interlocking relies on the fact that onFrameAvailable gets called + // synchronously from SurfaceTexture::queueBuffer. + class FrameCondition : public SurfaceTexture::FrameAvailableListener { + public: + FrameCondition(): + mFrameAvailable(false), + mFrameFinished(false) { + } + + // waitForFrame waits for the next frame to arrive. This should be + // called from the consumer thread once for every frame expected by the + // test. + void waitForFrame() { + Mutex::Autolock lock(mMutex); + ALOGV("+waitForFrame"); + while (!mFrameAvailable) { + mFrameAvailableCondition.wait(mMutex); + } + mFrameAvailable = false; + ALOGV("-waitForFrame"); + } + + // Allow the producer to return from its swapBuffers call and continue + // on to produce the next frame. This should be called by the consumer + // thread once for every frame expected by the test. + void finishFrame() { + Mutex::Autolock lock(mMutex); + ALOGV("+finishFrame"); + mFrameFinished = true; + mFrameFinishCondition.signal(); + ALOGV("-finishFrame"); + } + + // This should be called by SurfaceTexture on the producer thread. + virtual void onFrameAvailable() { + Mutex::Autolock lock(mMutex); + ALOGV("+onFrameAvailable"); + mFrameAvailable = true; + mFrameAvailableCondition.signal(); + while (!mFrameFinished) { + mFrameFinishCondition.wait(mMutex); + } + mFrameFinished = false; + ALOGV("-onFrameAvailable"); + } + + protected: + bool mFrameAvailable; + bool mFrameFinished; + + Mutex mMutex; + Condition mFrameAvailableCondition; + Condition mFrameFinishCondition; + }; + + virtual void SetUp() { + SurfaceTextureGLToGLTest::SetUp(); + mFC = new FrameCondition(); + mST->setFrameAvailableListener(mFC); + } + + virtual void TearDown() { + if (mProducerThread != NULL) { + mProducerThread->requestExitAndWait(); + } + mProducerThread.clear(); + mFC.clear(); + SurfaceTextureGLToGLTest::TearDown(); + } + + void runProducerThread(const sp producerThread) { + ASSERT_TRUE(mProducerThread == NULL); + mProducerThread = producerThread; + producerThread->setEglObjects(mEglDisplay, mProducerEglSurface, + mProducerEglContext); + producerThread->run(); + } + + sp mProducerThread; + sp mFC; +}; + +TEST_F(SurfaceTextureGLThreadToGLTest, + UpdateTexImageBeforeFrameFinishedCompletes) { + class PT : public ProducerThread { + virtual void render() { + glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + swapBuffers(); + } + }; + + runProducerThread(new PT()); + + mFC->waitForFrame(); + mST->updateTexImage(); + mFC->finishFrame(); + + // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! +} + +TEST_F(SurfaceTextureGLThreadToGLTest, + UpdateTexImageAfterFrameFinishedCompletes) { + class PT : public ProducerThread { + virtual void render() { + glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + swapBuffers(); + } + }; + + runProducerThread(new PT()); + + mFC->waitForFrame(); + mFC->finishFrame(); + mST->updateTexImage(); + + // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! +} + +TEST_F(SurfaceTextureGLThreadToGLTest, + RepeatedUpdateTexImageBeforeFrameFinishedCompletes) { + enum { NUM_ITERATIONS = 1024 }; + + class PT : public ProducerThread { + virtual void render() { + for (int i = 0; i < NUM_ITERATIONS; i++) { + glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + ALOGV("+swapBuffers"); + swapBuffers(); + ALOGV("-swapBuffers"); + } + } + }; + + runProducerThread(new PT()); + + for (int i = 0; i < NUM_ITERATIONS; i++) { + mFC->waitForFrame(); + ALOGV("+updateTexImage"); + mST->updateTexImage(); + ALOGV("-updateTexImage"); + mFC->finishFrame(); + + // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! + } +} + +TEST_F(SurfaceTextureGLThreadToGLTest, + RepeatedUpdateTexImageAfterFrameFinishedCompletes) { + enum { NUM_ITERATIONS = 1024 }; + + class PT : public ProducerThread { + virtual void render() { + for (int i = 0; i < NUM_ITERATIONS; i++) { + glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + ALOGV("+swapBuffers"); + swapBuffers(); + ALOGV("-swapBuffers"); + } + } + }; + + runProducerThread(new PT()); + + for (int i = 0; i < NUM_ITERATIONS; i++) { + mFC->waitForFrame(); + mFC->finishFrame(); + ALOGV("+updateTexImage"); + mST->updateTexImage(); + ALOGV("-updateTexImage"); + + // TODO: Add frame verification once RGB TEX_EXTERNAL_OES is supported! + } +} + +// XXX: This test is disabled because it is currently hanging on some devices. +TEST_F(SurfaceTextureGLThreadToGLTest, + DISABLED_RepeatedSwapBuffersWhileDequeueStalledCompletes) { + enum { NUM_ITERATIONS = 64 }; + + class PT : public ProducerThread { + virtual void render() { + for (int i = 0; i < NUM_ITERATIONS; i++) { + glClearColor(0.0f, 1.0f, 0.0f, 1.0f); + glClear(GL_COLOR_BUFFER_BIT); + ALOGV("+swapBuffers"); + swapBuffers(); + ALOGV("-swapBuffers"); + } + } + }; + + ASSERT_EQ(OK, mST->setSynchronousMode(true)); + ASSERT_EQ(OK, mST->setBufferCountServer(2)); + + runProducerThread(new PT()); + + // Allow three frames to be rendered and queued before starting the + // rendering in this thread. For the latter two frames we don't call + // updateTexImage so the next dequeue from the producer thread will block + // waiting for a frame to become available. + mFC->waitForFrame(); + mFC->finishFrame(); + + // We must call updateTexImage to consume the first frame so that the + // SurfaceTexture is able to reduce the buffer count to 2. This is because + // the GL driver may dequeue a buffer when the EGLSurface is created, and + // that happens before we call setBufferCountServer. It's possible that the + // driver does not dequeue a buffer at EGLSurface creation time, so we + // cannot rely on this to cause the second dequeueBuffer call to block. + mST->updateTexImage(); + + mFC->waitForFrame(); + mFC->finishFrame(); + mFC->waitForFrame(); + mFC->finishFrame(); + + // Sleep for 100ms to allow the producer thread's dequeueBuffer call to + // block waiting for a buffer to become available. + usleep(100000); + + // Render and present a number of images. This thread should not be blocked + // by the fact that the producer thread is blocking in dequeue. + for (int i = 0; i < NUM_ITERATIONS; i++) { + glClear(GL_COLOR_BUFFER_BIT); + eglSwapBuffers(mEglDisplay, mEglSurface); + } + + // Consume the two pending buffers to unblock the producer thread. + mST->updateTexImage(); + mST->updateTexImage(); + + // Consume the remaining buffers from the producer thread. + for (int i = 0; i < NUM_ITERATIONS-3; i++) { + mFC->waitForFrame(); + mFC->finishFrame(); + ALOGV("+updateTexImage"); + mST->updateTexImage(); + ALOGV("-updateTexImage"); + } +} + +class SurfaceTextureFBOTest : public SurfaceTextureGLTest { +protected: + + virtual void SetUp() { + SurfaceTextureGLTest::SetUp(); + + glGenFramebuffers(1, &mFbo); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + + glGenTextures(1, &mFboTex); + glBindTexture(GL_TEXTURE_2D, mFboTex); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, getSurfaceWidth(), + getSurfaceHeight(), 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL); + glBindTexture(GL_TEXTURE_2D, 0); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + + glBindFramebuffer(GL_FRAMEBUFFER, mFbo); + glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, + GL_TEXTURE_2D, mFboTex, 0); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + } + + virtual void TearDown() { + SurfaceTextureGLTest::TearDown(); + + glDeleteTextures(1, &mFboTex); + glDeleteFramebuffers(1, &mFbo); + } + + GLuint mFbo; + GLuint mFboTex; +}; + +// This test is intended to verify that proper synchronization is done when +// rendering into an FBO. +TEST_F(SurfaceTextureFBOTest, BlitFromCpuFilledBufferToFbo) { + const int texWidth = 64; + const int texHeight = 64; + + ASSERT_EQ(NO_ERROR, native_window_set_buffers_geometry(mANW.get(), + texWidth, texHeight, HAL_PIXEL_FORMAT_RGBA_8888)); + ASSERT_EQ(NO_ERROR, native_window_set_usage(mANW.get(), + GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN)); + + android_native_buffer_t* anb; + ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + ASSERT_TRUE(anb != NULL); + + sp buf(new GraphicBuffer(anb, false)); + ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), buf->getNativeBuffer())); + + // Fill the buffer with green + uint8_t* img = NULL; + buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, (void**)(&img)); + fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 0, 255, + 0, 255); + buf->unlock(); + ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), buf->getNativeBuffer())); + + ASSERT_EQ(NO_ERROR, mST->updateTexImage()); + + glBindFramebuffer(GL_FRAMEBUFFER, mFbo); + drawTexture(); + glBindFramebuffer(GL_FRAMEBUFFER, 0); + + for (int i = 0; i < 4; i++) { + SCOPED_TRACE(String8::format("frame %d", i).string()); + + ASSERT_EQ(NO_ERROR, mANW->dequeueBuffer(mANW.get(), &anb)); + ASSERT_TRUE(anb != NULL); + + buf = new GraphicBuffer(anb, false); + ASSERT_EQ(NO_ERROR, mANW->lockBuffer(mANW.get(), + buf->getNativeBuffer())); + + // Fill the buffer with red + ASSERT_EQ(NO_ERROR, buf->lock(GRALLOC_USAGE_SW_WRITE_OFTEN, + (void**)(&img))); + fillRGBA8BufferSolid(img, texWidth, texHeight, buf->getStride(), 255, 0, + 0, 255); + ASSERT_EQ(NO_ERROR, buf->unlock()); + ASSERT_EQ(NO_ERROR, mANW->queueBuffer(mANW.get(), + buf->getNativeBuffer())); + + ASSERT_EQ(NO_ERROR, mST->updateTexImage()); + + drawTexture(); + + EXPECT_TRUE(checkPixel( 24, 39, 255, 0, 0, 255)); + } + + glBindFramebuffer(GL_FRAMEBUFFER, mFbo); + + EXPECT_TRUE(checkPixel( 24, 39, 0, 255, 0, 255)); +} + +class SurfaceTextureMultiContextGLTest : public SurfaceTextureGLTest { +protected: + enum { SECOND_TEX_ID = 123 }; + enum { THIRD_TEX_ID = 456 }; + + SurfaceTextureMultiContextGLTest(): + mSecondEglContext(EGL_NO_CONTEXT) { + } + + virtual void SetUp() { + SurfaceTextureGLTest::SetUp(); + + // Set up the secondary context and texture renderer. + mSecondEglContext = eglCreateContext(mEglDisplay, mGlConfig, + EGL_NO_CONTEXT, getContextAttribs()); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_CONTEXT, mSecondEglContext); + + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + mSecondTextureRenderer = new TextureRenderer(SECOND_TEX_ID, mST); + ASSERT_NO_FATAL_FAILURE(mSecondTextureRenderer->SetUp()); + + // Set up the tertiary context and texture renderer. + mThirdEglContext = eglCreateContext(mEglDisplay, mGlConfig, + EGL_NO_CONTEXT, getContextAttribs()); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_NE(EGL_NO_CONTEXT, mThirdEglContext); + + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mThirdEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + mThirdTextureRenderer = new TextureRenderer(THIRD_TEX_ID, mST); + ASSERT_NO_FATAL_FAILURE(mThirdTextureRenderer->SetUp()); + + // Switch back to the primary context to start the tests. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mEglContext)); + } + + virtual void TearDown() { + if (mThirdEglContext != EGL_NO_CONTEXT) { + eglDestroyContext(mEglDisplay, mThirdEglContext); + } + if (mSecondEglContext != EGL_NO_CONTEXT) { + eglDestroyContext(mEglDisplay, mSecondEglContext); + } + SurfaceTextureGLTest::TearDown(); + } + + EGLContext mSecondEglContext; + sp mSecondTextureRenderer; + + EGLContext mThirdEglContext; + sp mThirdTextureRenderer; +}; + +TEST_F(SurfaceTextureMultiContextGLTest, UpdateFromMultipleContextsFails) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Attempt to latch the texture on the secondary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + ASSERT_EQ(INVALID_OPERATION, mST->updateTexImage()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextSucceeds) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Check that the GL texture was deleted. + EXPECT_EQ(GL_FALSE, glIsTexture(TEX_ID)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, + DetachFromContextSucceedsAfterProducerDisconnect) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); + ASSERT_EQ(OK, mST->detachFromContext()); + + // Check that the GL texture was deleted. + EXPECT_EQ(GL_FALSE, glIsTexture(TEX_ID)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWhenAbandoned) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Attempt to detach from the primary context. + mST->abandon(); + ASSERT_EQ(NO_INIT, mST->detachFromContext()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWhenDetached) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attempt to detach from the primary context again. + ASSERT_EQ(INVALID_OPERATION, mST->detachFromContext()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWithNoDisplay) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Make there be no current display. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // Attempt to detach from the primary context. + ASSERT_EQ(INVALID_OPERATION, mST->detachFromContext()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, DetachFromContextFailsWithNoContext) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Make current context be incorrect. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // Attempt to detach from the primary context. + ASSERT_EQ(INVALID_OPERATION, mST->detachFromContext()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, UpdateTexImageFailsWhenDetached) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attempt to latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(INVALID_OPERATION, mST->updateTexImage()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextSucceeds) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the secondary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); + + // Verify that the texture object was created and bound. + GLint texBinding = -1; + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); + EXPECT_EQ(SECOND_TEX_ID, texBinding); + + // Try to use the texture from the secondary context. + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, 1, 1); + mSecondTextureRenderer->drawTexture(); + ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); +} + +TEST_F(SurfaceTextureMultiContextGLTest, + AttachToContextSucceedsAfterProducerDisconnect) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the secondary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); + + // Verify that the texture object was created and bound. + GLint texBinding = -1; + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); + EXPECT_EQ(SECOND_TEX_ID, texBinding); + + // Try to use the texture from the secondary context. + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, 1, 1); + mSecondTextureRenderer->drawTexture(); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, + AttachToContextSucceedsBeforeUpdateTexImage) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Detach from the primary context. + native_window_api_disconnect(mANW.get(), NATIVE_WINDOW_API_CPU); + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the secondary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); + + // Verify that the texture object was created and bound. + GLint texBinding = -1; + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); + EXPECT_EQ(SECOND_TEX_ID, texBinding); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Try to use the texture from the secondary context. + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, 1, 1); + mSecondTextureRenderer->drawTexture(); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextFailsWhenAbandoned) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attempt to attach to the secondary context. + mST->abandon(); + + // Attempt to attach to the primary context. + ASSERT_EQ(NO_INIT, mST->attachToContext(SECOND_TEX_ID)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextFailsWhenAttached) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Attempt to attach to the primary context. + ASSERT_EQ(INVALID_OPERATION, mST->attachToContext(SECOND_TEX_ID)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, + AttachToContextFailsWhenAttachedBeforeUpdateTexImage) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Attempt to attach to the primary context. + ASSERT_EQ(INVALID_OPERATION, mST->attachToContext(SECOND_TEX_ID)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextFailsWithNoDisplay) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Make there be no current display. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, + EGL_NO_CONTEXT)); + ASSERT_EQ(EGL_SUCCESS, eglGetError()); + + // Attempt to attach with no context current. + ASSERT_EQ(INVALID_OPERATION, mST->attachToContext(SECOND_TEX_ID)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, AttachToContextSucceedsTwice) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Latch the texture contents on the primary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the secondary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); + + // Detach from the secondary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the tertiary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mThirdEglContext)); + ASSERT_EQ(OK, mST->attachToContext(THIRD_TEX_ID)); + + // Verify that the texture object was created and bound. + GLint texBinding = -1; + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); + EXPECT_EQ(THIRD_TEX_ID, texBinding); + + // Try to use the texture from the tertiary context. + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, 1, 1); + mThirdTextureRenderer->drawTexture(); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, + AttachToContextSucceedsTwiceBeforeUpdateTexImage) { + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Detach from the primary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the secondary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); + + // Detach from the secondary context. + ASSERT_EQ(OK, mST->detachFromContext()); + + // Attach to the tertiary context. + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mThirdEglContext)); + ASSERT_EQ(OK, mST->attachToContext(THIRD_TEX_ID)); + + // Verify that the texture object was created and bound. + GLint texBinding = -1; + glGetIntegerv(GL_TEXTURE_BINDING_EXTERNAL_OES, &texBinding); + EXPECT_EQ(THIRD_TEX_ID, texBinding); + + // Latch the texture contents on the tertiary context. + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // Try to use the texture from the tertiary context. + glClearColor(0.2, 0.2, 0.2, 0.2); + glClear(GL_COLOR_BUFFER_BIT); + glViewport(0, 0, 1, 1); + mThirdTextureRenderer->drawTexture(); + ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); + ASSERT_TRUE(checkPixel( 0, 0, 35, 35, 35, 35)); +} + +TEST_F(SurfaceTextureMultiContextGLTest, + UpdateTexImageSucceedsForBufferConsumedBeforeDetach) { + ASSERT_EQ(NO_ERROR, mST->setSynchronousMode(true)); + ASSERT_EQ(NO_ERROR, mST->setBufferCountServer(2)); + + // produce two frames and consume them both on the primary context + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); + + // produce one more frame + ASSERT_NO_FATAL_FAILURE(produceOneRGBA8Frame(mANW)); + + // Detach from the primary context and attach to the secondary context + ASSERT_EQ(OK, mST->detachFromContext()); + ASSERT_TRUE(eglMakeCurrent(mEglDisplay, mEglSurface, mEglSurface, + mSecondEglContext)); + ASSERT_EQ(OK, mST->attachToContext(SECOND_TEX_ID)); + + // Consume final frame on secondary context + mFW->waitForFrame(); + ASSERT_EQ(OK, mST->updateTexImage()); +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/TextureRenderer.cpp android-platform-frameworks-native-21/libs/gui/tests/TextureRenderer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/TextureRenderer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/TextureRenderer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,116 +0,0 @@ -/* - * Copyright 2013 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 "TextureRenderer.h" - -#include "GLTest.h" - -#include - -#include -#include - -#include - -namespace android { - -TextureRenderer::TextureRenderer(GLuint texName, - const sp& st) : mTexName(texName), mST(st) { -} - -void TextureRenderer::SetUp() { - const char vsrc[] = - "attribute vec4 vPosition;\n" - "varying vec2 texCoords;\n" - "uniform mat4 texMatrix;\n" - "void main() {\n" - " vec2 vTexCoords = 0.5 * (vPosition.xy + vec2(1.0, 1.0));\n" - " texCoords = (texMatrix * vec4(vTexCoords, 0.0, 1.0)).xy;\n" - " gl_Position = vPosition;\n" - "}\n"; - - const char fsrc[] = - "#extension GL_OES_EGL_image_external : require\n" - "precision mediump float;\n" - "uniform samplerExternalOES texSampler;\n" - "varying vec2 texCoords;\n" - "void main() {\n" - " gl_FragColor = texture2D(texSampler, texCoords);\n" - "}\n"; - - { - SCOPED_TRACE("creating shader program"); - ASSERT_NO_FATAL_FAILURE(GLTest::createProgram(vsrc, fsrc, &mPgm)); - } - - mPositionHandle = glGetAttribLocation(mPgm, "vPosition"); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_NE(-1, mPositionHandle); - mTexSamplerHandle = glGetUniformLocation(mPgm, "texSampler"); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_NE(-1, mTexSamplerHandle); - mTexMatrixHandle = glGetUniformLocation(mPgm, "texMatrix"); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - ASSERT_NE(-1, mTexMatrixHandle); -} - -// drawTexture draws the GLConsumer over the entire GL viewport. -void TextureRenderer::drawTexture() { - static const GLfloat triangleVertices[] = { - -1.0f, 1.0f, - -1.0f, -1.0f, - 1.0f, -1.0f, - 1.0f, 1.0f, - }; - - glVertexAttribPointer(mPositionHandle, 2, GL_FLOAT, GL_FALSE, 0, - triangleVertices); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glEnableVertexAttribArray(mPositionHandle); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - - glUseProgram(mPgm); - glUniform1i(mTexSamplerHandle, 0); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTexName); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - - // XXX: These calls are not needed for GL_TEXTURE_EXTERNAL_OES as - // they're setting the defautls for that target, but when hacking - // things to use GL_TEXTURE_2D they are needed to achieve the same - // behavior. - glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, - GL_LINEAR); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, - GL_LINEAR); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, - GL_CLAMP_TO_EDGE); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - glTexParameteri(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, - GL_CLAMP_TO_EDGE); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); - - GLfloat texMatrix[16]; - mST->getTransformMatrix(texMatrix); - glUniformMatrix4fv(mTexMatrixHandle, 1, GL_FALSE, texMatrix); - - glDrawArrays(GL_TRIANGLE_FAN, 0, 4); - ASSERT_EQ(GLenum(GL_NO_ERROR), glGetError()); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/TextureRenderer.h android-platform-frameworks-native-21/libs/gui/tests/TextureRenderer.h --- android-platform-frameworks-native-6.0.1+r16/libs/gui/tests/TextureRenderer.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/gui/tests/TextureRenderer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_TEXTURE_RENDERER_H -#define ANDROID_TEXTURE_RENDERER_H - -#include - -#include - -namespace android { - -class GLConsumer; - -class TextureRenderer : public RefBase { -public: - TextureRenderer(GLuint texName, const sp& st); - - void SetUp(); - void drawTexture(); - -private: - GLuint mTexName; - sp mST; - GLuint mPgm; - GLint mPositionHandle; - GLint mTexSamplerHandle; - GLint mTexMatrixHandle; -}; - -} // namespace android - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/Android.mk android-platform-frameworks-native-21/libs/input/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/input/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -# Copyright (C) 2013 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. - -LOCAL_PATH:= $(call my-dir) - -# libinput is partially built for the host (used by build time keymap validation tool) -# These files are common to host and target builds. - -commonSources := \ - Input.cpp \ - InputDevice.cpp \ - Keyboard.cpp \ - KeyCharacterMap.cpp \ - KeyLayoutMap.cpp \ - VirtualKeyMap.cpp - -deviceSources := \ - $(commonSources) \ - IInputFlinger.cpp \ - InputTransport.cpp \ - VelocityControl.cpp \ - VelocityTracker.cpp - -hostSources := \ - $(commonSources) - -# For the host -# ===================================================== - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= $(hostSources) - -LOCAL_MODULE:= libinput - -LOCAL_MODULE_TAGS := optional - -include $(BUILD_HOST_STATIC_LIBRARY) - - -# For the device -# ===================================================== - -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= $(deviceSources) - -LOCAL_SHARED_LIBRARIES := \ - liblog \ - libcutils \ - libutils \ - libbinder - -LOCAL_MODULE:= libinput - -LOCAL_MODULE_TAGS := optional - -include $(BUILD_SHARED_LIBRARY) - - -# Include subdirectory makefiles -# ============================================================ - -# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework -# team really wants is to build the stuff defined by this makefile. -ifeq (,$(ONE_SHOT_MAKEFILE)) -include $(call first-makefiles-under,$(LOCAL_PATH)) -endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/IInputFlinger.cpp android-platform-frameworks-native-21/libs/input/IInputFlinger.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/IInputFlinger.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/IInputFlinger.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include - -#include -#include -#include - -#include - - -namespace android { - -class BpInputFlinger : public BpInterface { -public: - BpInputFlinger(const sp& impl) : - BpInterface(impl) { } - - virtual status_t doSomething() { - Parcel data, reply; - data.writeInterfaceToken(IInputFlinger::getInterfaceDescriptor()); - remote()->transact(BnInputFlinger::DO_SOMETHING_TRANSACTION, data, &reply); - return reply.readInt32(); - } -}; - -IMPLEMENT_META_INTERFACE(InputFlinger, "android.input.IInputFlinger"); - - -status_t BnInputFlinger::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) { - switch(code) { - case DO_SOMETHING_TRANSACTION: { - CHECK_INTERFACE(IInputFlinger, data, reply); - reply->writeInt32(0); - break; - } - default: - return BBinder::onTransact(code, data, reply, flags); - } - return NO_ERROR; -} - -}; diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/Input.cpp android-platform-frameworks-native-21/libs/input/Input.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/Input.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/Input.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,591 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "Input" -//#define LOG_NDEBUG 0 - -#include -#include - -#include -#include - -#ifdef HAVE_ANDROID_OS -#include -#endif - -namespace android { - -// --- InputEvent --- - -void InputEvent::initialize(int32_t deviceId, int32_t source) { - mDeviceId = deviceId; - mSource = source; -} - -void InputEvent::initialize(const InputEvent& from) { - mDeviceId = from.mDeviceId; - mSource = from.mSource; -} - -// --- KeyEvent --- - -const char* KeyEvent::getLabel(int32_t keyCode) { - return getLabelByKeyCode(keyCode); -} - -int32_t KeyEvent::getKeyCodeFromLabel(const char* label) { - return getKeyCodeByLabel(label); -} - -void KeyEvent::initialize( - int32_t deviceId, - int32_t source, - int32_t action, - int32_t flags, - int32_t keyCode, - int32_t scanCode, - int32_t metaState, - int32_t repeatCount, - nsecs_t downTime, - nsecs_t eventTime) { - InputEvent::initialize(deviceId, source); - mAction = action; - mFlags = flags; - mKeyCode = keyCode; - mScanCode = scanCode; - mMetaState = metaState; - mRepeatCount = repeatCount; - mDownTime = downTime; - mEventTime = eventTime; -} - -void KeyEvent::initialize(const KeyEvent& from) { - InputEvent::initialize(from); - mAction = from.mAction; - mFlags = from.mFlags; - mKeyCode = from.mKeyCode; - mScanCode = from.mScanCode; - mMetaState = from.mMetaState; - mRepeatCount = from.mRepeatCount; - mDownTime = from.mDownTime; - mEventTime = from.mEventTime; -} - - -// --- PointerCoords --- - -float PointerCoords::getAxisValue(int32_t axis) const { - if (axis < 0 || axis > 63 || !BitSet64::hasBit(bits, axis)){ - return 0; - } - return values[BitSet64::getIndexOfBit(bits, axis)]; -} - -status_t PointerCoords::setAxisValue(int32_t axis, float value) { - if (axis < 0 || axis > 63) { - return NAME_NOT_FOUND; - } - - uint32_t index = BitSet64::getIndexOfBit(bits, axis); - if (!BitSet64::hasBit(bits, axis)) { - if (value == 0) { - return OK; // axes with value 0 do not need to be stored - } - - uint32_t count = BitSet64::count(bits); - if (count >= MAX_AXES) { - tooManyAxes(axis); - return NO_MEMORY; - } - BitSet64::markBit(bits, axis); - for (uint32_t i = count; i > index; i--) { - values[i] = values[i - 1]; - } - } - - values[index] = value; - return OK; -} - -static inline void scaleAxisValue(PointerCoords& c, int axis, float scaleFactor) { - float value = c.getAxisValue(axis); - if (value != 0) { - c.setAxisValue(axis, value * scaleFactor); - } -} - -void PointerCoords::scale(float scaleFactor) { - // No need to scale pressure or size since they are normalized. - // No need to scale orientation since it is meaningless to do so. - scaleAxisValue(*this, AMOTION_EVENT_AXIS_X, scaleFactor); - scaleAxisValue(*this, AMOTION_EVENT_AXIS_Y, scaleFactor); - scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOUCH_MAJOR, scaleFactor); - scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOUCH_MINOR, scaleFactor); - scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MAJOR, scaleFactor); - scaleAxisValue(*this, AMOTION_EVENT_AXIS_TOOL_MINOR, scaleFactor); -} - -void PointerCoords::applyOffset(float xOffset, float yOffset) { - setAxisValue(AMOTION_EVENT_AXIS_X, getX() + xOffset); - setAxisValue(AMOTION_EVENT_AXIS_Y, getY() + yOffset); -} - -#ifdef HAVE_ANDROID_OS -status_t PointerCoords::readFromParcel(Parcel* parcel) { - bits = parcel->readInt64(); - - uint32_t count = BitSet64::count(bits); - if (count > MAX_AXES) { - return BAD_VALUE; - } - - for (uint32_t i = 0; i < count; i++) { - values[i] = parcel->readFloat(); - } - return OK; -} - -status_t PointerCoords::writeToParcel(Parcel* parcel) const { - parcel->writeInt64(bits); - - uint32_t count = BitSet64::count(bits); - for (uint32_t i = 0; i < count; i++) { - parcel->writeFloat(values[i]); - } - return OK; -} -#endif - -void PointerCoords::tooManyAxes(int axis) { - ALOGW("Could not set value for axis %d because the PointerCoords structure is full and " - "cannot contain more than %d axis values.", axis, int(MAX_AXES)); -} - -bool PointerCoords::operator==(const PointerCoords& other) const { - if (bits != other.bits) { - return false; - } - uint32_t count = BitSet64::count(bits); - for (uint32_t i = 0; i < count; i++) { - if (values[i] != other.values[i]) { - return false; - } - } - return true; -} - -void PointerCoords::copyFrom(const PointerCoords& other) { - bits = other.bits; - uint32_t count = BitSet64::count(bits); - for (uint32_t i = 0; i < count; i++) { - values[i] = other.values[i]; - } -} - - -// --- PointerProperties --- - -bool PointerProperties::operator==(const PointerProperties& other) const { - return id == other.id - && toolType == other.toolType; -} - -void PointerProperties::copyFrom(const PointerProperties& other) { - id = other.id; - toolType = other.toolType; -} - - -// --- MotionEvent --- - -void MotionEvent::initialize( - int32_t deviceId, - int32_t source, - int32_t action, - int32_t actionButton, - int32_t flags, - int32_t edgeFlags, - int32_t metaState, - int32_t buttonState, - float xOffset, - float yOffset, - float xPrecision, - float yPrecision, - nsecs_t downTime, - nsecs_t eventTime, - size_t pointerCount, - const PointerProperties* pointerProperties, - const PointerCoords* pointerCoords) { - InputEvent::initialize(deviceId, source); - mAction = action; - mActionButton = actionButton; - mFlags = flags; - mEdgeFlags = edgeFlags; - mMetaState = metaState; - mButtonState = buttonState; - mXOffset = xOffset; - mYOffset = yOffset; - mXPrecision = xPrecision; - mYPrecision = yPrecision; - mDownTime = downTime; - mPointerProperties.clear(); - mPointerProperties.appendArray(pointerProperties, pointerCount); - mSampleEventTimes.clear(); - mSamplePointerCoords.clear(); - addSample(eventTime, pointerCoords); -} - -void MotionEvent::copyFrom(const MotionEvent* other, bool keepHistory) { - InputEvent::initialize(other->mDeviceId, other->mSource); - mAction = other->mAction; - mActionButton = other->mActionButton; - mFlags = other->mFlags; - mEdgeFlags = other->mEdgeFlags; - mMetaState = other->mMetaState; - mButtonState = other->mButtonState; - mXOffset = other->mXOffset; - mYOffset = other->mYOffset; - mXPrecision = other->mXPrecision; - mYPrecision = other->mYPrecision; - mDownTime = other->mDownTime; - mPointerProperties = other->mPointerProperties; - - if (keepHistory) { - mSampleEventTimes = other->mSampleEventTimes; - mSamplePointerCoords = other->mSamplePointerCoords; - } else { - mSampleEventTimes.clear(); - mSampleEventTimes.push(other->getEventTime()); - mSamplePointerCoords.clear(); - size_t pointerCount = other->getPointerCount(); - size_t historySize = other->getHistorySize(); - mSamplePointerCoords.appendArray(other->mSamplePointerCoords.array() - + (historySize * pointerCount), pointerCount); - } -} - -void MotionEvent::addSample( - int64_t eventTime, - const PointerCoords* pointerCoords) { - mSampleEventTimes.push(eventTime); - mSamplePointerCoords.appendArray(pointerCoords, getPointerCount()); -} - -const PointerCoords* MotionEvent::getRawPointerCoords(size_t pointerIndex) const { - return &mSamplePointerCoords[getHistorySize() * getPointerCount() + pointerIndex]; -} - -float MotionEvent::getRawAxisValue(int32_t axis, size_t pointerIndex) const { - return getRawPointerCoords(pointerIndex)->getAxisValue(axis); -} - -float MotionEvent::getAxisValue(int32_t axis, size_t pointerIndex) const { - float value = getRawPointerCoords(pointerIndex)->getAxisValue(axis); - switch (axis) { - case AMOTION_EVENT_AXIS_X: - return value + mXOffset; - case AMOTION_EVENT_AXIS_Y: - return value + mYOffset; - } - return value; -} - -const PointerCoords* MotionEvent::getHistoricalRawPointerCoords( - size_t pointerIndex, size_t historicalIndex) const { - return &mSamplePointerCoords[historicalIndex * getPointerCount() + pointerIndex]; -} - -float MotionEvent::getHistoricalRawAxisValue(int32_t axis, size_t pointerIndex, - size_t historicalIndex) const { - return getHistoricalRawPointerCoords(pointerIndex, historicalIndex)->getAxisValue(axis); -} - -float MotionEvent::getHistoricalAxisValue(int32_t axis, size_t pointerIndex, - size_t historicalIndex) const { - float value = getHistoricalRawPointerCoords(pointerIndex, historicalIndex)->getAxisValue(axis); - switch (axis) { - case AMOTION_EVENT_AXIS_X: - return value + mXOffset; - case AMOTION_EVENT_AXIS_Y: - return value + mYOffset; - } - return value; -} - -ssize_t MotionEvent::findPointerIndex(int32_t pointerId) const { - size_t pointerCount = mPointerProperties.size(); - for (size_t i = 0; i < pointerCount; i++) { - if (mPointerProperties.itemAt(i).id == pointerId) { - return i; - } - } - return -1; -} - -void MotionEvent::offsetLocation(float xOffset, float yOffset) { - mXOffset += xOffset; - mYOffset += yOffset; -} - -void MotionEvent::scale(float scaleFactor) { - mXOffset *= scaleFactor; - mYOffset *= scaleFactor; - mXPrecision *= scaleFactor; - mYPrecision *= scaleFactor; - - size_t numSamples = mSamplePointerCoords.size(); - for (size_t i = 0; i < numSamples; i++) { - mSamplePointerCoords.editItemAt(i).scale(scaleFactor); - } -} - -static void transformPoint(const float matrix[9], float x, float y, float *outX, float *outY) { - // Apply perspective transform like Skia. - float newX = matrix[0] * x + matrix[1] * y + matrix[2]; - float newY = matrix[3] * x + matrix[4] * y + matrix[5]; - float newZ = matrix[6] * x + matrix[7] * y + matrix[8]; - if (newZ) { - newZ = 1.0f / newZ; - } - *outX = newX * newZ; - *outY = newY * newZ; -} - -static float transformAngle(const float matrix[9], float angleRadians, - float originX, float originY) { - // Construct and transform a vector oriented at the specified clockwise angle from vertical. - // Coordinate system: down is increasing Y, right is increasing X. - float x = sinf(angleRadians); - float y = -cosf(angleRadians); - transformPoint(matrix, x, y, &x, &y); - x -= originX; - y -= originY; - - // Derive the transformed vector's clockwise angle from vertical. - float result = atan2f(x, -y); - if (result < - M_PI_2) { - result += M_PI; - } else if (result > M_PI_2) { - result -= M_PI; - } - return result; -} - -void MotionEvent::transform(const float matrix[9]) { - // The tricky part of this implementation is to preserve the value of - // rawX and rawY. So we apply the transformation to the first point - // then derive an appropriate new X/Y offset that will preserve rawX - // and rawY for that point. - float oldXOffset = mXOffset; - float oldYOffset = mYOffset; - float newX, newY; - float rawX = getRawX(0); - float rawY = getRawY(0); - transformPoint(matrix, rawX + oldXOffset, rawY + oldYOffset, &newX, &newY); - mXOffset = newX - rawX; - mYOffset = newY - rawY; - - // Determine how the origin is transformed by the matrix so that we - // can transform orientation vectors. - float originX, originY; - transformPoint(matrix, 0, 0, &originX, &originY); - - // Apply the transformation to all samples. - size_t numSamples = mSamplePointerCoords.size(); - for (size_t i = 0; i < numSamples; i++) { - PointerCoords& c = mSamplePointerCoords.editItemAt(i); - float x = c.getAxisValue(AMOTION_EVENT_AXIS_X) + oldXOffset; - float y = c.getAxisValue(AMOTION_EVENT_AXIS_Y) + oldYOffset; - transformPoint(matrix, x, y, &x, &y); - c.setAxisValue(AMOTION_EVENT_AXIS_X, x - mXOffset); - c.setAxisValue(AMOTION_EVENT_AXIS_Y, y - mYOffset); - - float orientation = c.getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION); - c.setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, - transformAngle(matrix, orientation, originX, originY)); - } -} - -#ifdef HAVE_ANDROID_OS -status_t MotionEvent::readFromParcel(Parcel* parcel) { - size_t pointerCount = parcel->readInt32(); - size_t sampleCount = parcel->readInt32(); - if (pointerCount == 0 || pointerCount > MAX_POINTERS || - sampleCount == 0 || sampleCount > MAX_SAMPLES) { - return BAD_VALUE; - } - - mDeviceId = parcel->readInt32(); - mSource = parcel->readInt32(); - mAction = parcel->readInt32(); - mActionButton = parcel->readInt32(); - mFlags = parcel->readInt32(); - mEdgeFlags = parcel->readInt32(); - mMetaState = parcel->readInt32(); - mButtonState = parcel->readInt32(); - mXOffset = parcel->readFloat(); - mYOffset = parcel->readFloat(); - mXPrecision = parcel->readFloat(); - mYPrecision = parcel->readFloat(); - mDownTime = parcel->readInt64(); - - mPointerProperties.clear(); - mPointerProperties.setCapacity(pointerCount); - mSampleEventTimes.clear(); - mSampleEventTimes.setCapacity(sampleCount); - mSamplePointerCoords.clear(); - mSamplePointerCoords.setCapacity(sampleCount * pointerCount); - - for (size_t i = 0; i < pointerCount; i++) { - mPointerProperties.push(); - PointerProperties& properties = mPointerProperties.editTop(); - properties.id = parcel->readInt32(); - properties.toolType = parcel->readInt32(); - } - - while (sampleCount-- > 0) { - mSampleEventTimes.push(parcel->readInt64()); - for (size_t i = 0; i < pointerCount; i++) { - mSamplePointerCoords.push(); - status_t status = mSamplePointerCoords.editTop().readFromParcel(parcel); - if (status) { - return status; - } - } - } - return OK; -} - -status_t MotionEvent::writeToParcel(Parcel* parcel) const { - size_t pointerCount = mPointerProperties.size(); - size_t sampleCount = mSampleEventTimes.size(); - - parcel->writeInt32(pointerCount); - parcel->writeInt32(sampleCount); - - parcel->writeInt32(mDeviceId); - parcel->writeInt32(mSource); - parcel->writeInt32(mAction); - parcel->writeInt32(mActionButton); - parcel->writeInt32(mFlags); - parcel->writeInt32(mEdgeFlags); - parcel->writeInt32(mMetaState); - parcel->writeInt32(mButtonState); - parcel->writeFloat(mXOffset); - parcel->writeFloat(mYOffset); - parcel->writeFloat(mXPrecision); - parcel->writeFloat(mYPrecision); - parcel->writeInt64(mDownTime); - - for (size_t i = 0; i < pointerCount; i++) { - const PointerProperties& properties = mPointerProperties.itemAt(i); - parcel->writeInt32(properties.id); - parcel->writeInt32(properties.toolType); - } - - const PointerCoords* pc = mSamplePointerCoords.array(); - for (size_t h = 0; h < sampleCount; h++) { - parcel->writeInt64(mSampleEventTimes.itemAt(h)); - for (size_t i = 0; i < pointerCount; i++) { - status_t status = (pc++)->writeToParcel(parcel); - if (status) { - return status; - } - } - } - return OK; -} -#endif - -bool MotionEvent::isTouchEvent(int32_t source, int32_t action) { - if (source & AINPUT_SOURCE_CLASS_POINTER) { - // Specifically excludes HOVER_MOVE and SCROLL. - switch (action & AMOTION_EVENT_ACTION_MASK) { - case AMOTION_EVENT_ACTION_DOWN: - case AMOTION_EVENT_ACTION_MOVE: - case AMOTION_EVENT_ACTION_UP: - case AMOTION_EVENT_ACTION_POINTER_DOWN: - case AMOTION_EVENT_ACTION_POINTER_UP: - case AMOTION_EVENT_ACTION_CANCEL: - case AMOTION_EVENT_ACTION_OUTSIDE: - return true; - } - } - return false; -} - -const char* MotionEvent::getLabel(int32_t axis) { - return getAxisLabel(axis); -} - -int32_t MotionEvent::getAxisFromLabel(const char* label) { - return getAxisByLabel(label); -} - - -// --- PooledInputEventFactory --- - -PooledInputEventFactory::PooledInputEventFactory(size_t maxPoolSize) : - mMaxPoolSize(maxPoolSize) { -} - -PooledInputEventFactory::~PooledInputEventFactory() { - for (size_t i = 0; i < mKeyEventPool.size(); i++) { - delete mKeyEventPool.itemAt(i); - } - for (size_t i = 0; i < mMotionEventPool.size(); i++) { - delete mMotionEventPool.itemAt(i); - } -} - -KeyEvent* PooledInputEventFactory::createKeyEvent() { - if (!mKeyEventPool.isEmpty()) { - KeyEvent* event = mKeyEventPool.top(); - mKeyEventPool.pop(); - return event; - } - return new KeyEvent(); -} - -MotionEvent* PooledInputEventFactory::createMotionEvent() { - if (!mMotionEventPool.isEmpty()) { - MotionEvent* event = mMotionEventPool.top(); - mMotionEventPool.pop(); - return event; - } - return new MotionEvent(); -} - -void PooledInputEventFactory::recycle(InputEvent* event) { - switch (event->getType()) { - case AINPUT_EVENT_TYPE_KEY: - if (mKeyEventPool.size() < mMaxPoolSize) { - mKeyEventPool.push(static_cast(event)); - return; - } - break; - case AINPUT_EVENT_TYPE_MOTION: - if (mMotionEventPool.size() < mMaxPoolSize) { - mMotionEventPool.push(static_cast(event)); - return; - } - break; - } - delete event; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/InputDevice.cpp android-platform-frameworks-native-21/libs/input/InputDevice.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/InputDevice.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/InputDevice.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,188 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "InputDevice" - -#include -#include -#include - -#include - -namespace android { - -static const char* CONFIGURATION_FILE_DIR[] = { - "idc/", - "keylayout/", - "keychars/", -}; - -static const char* CONFIGURATION_FILE_EXTENSION[] = { - ".idc", - ".kl", - ".kcm", -}; - -static bool isValidNameChar(char ch) { - return isascii(ch) && (isdigit(ch) || isalpha(ch) || ch == '-' || ch == '_'); -} - -static void appendInputDeviceConfigurationFileRelativePath(String8& path, - const String8& name, InputDeviceConfigurationFileType type) { - path.append(CONFIGURATION_FILE_DIR[type]); - for (size_t i = 0; i < name.length(); i++) { - char ch = name[i]; - if (!isValidNameChar(ch)) { - ch = '_'; - } - path.append(&ch, 1); - } - path.append(CONFIGURATION_FILE_EXTENSION[type]); -} - -String8 getInputDeviceConfigurationFilePathByDeviceIdentifier( - const InputDeviceIdentifier& deviceIdentifier, - InputDeviceConfigurationFileType type) { - if (deviceIdentifier.vendor !=0 && deviceIdentifier.product != 0) { - if (deviceIdentifier.version != 0) { - // Try vendor product version. - String8 versionPath(getInputDeviceConfigurationFilePathByName( - String8::format("Vendor_%04x_Product_%04x_Version_%04x", - deviceIdentifier.vendor, deviceIdentifier.product, - deviceIdentifier.version), - type)); - if (!versionPath.isEmpty()) { - return versionPath; - } - } - - // Try vendor product. - String8 productPath(getInputDeviceConfigurationFilePathByName( - String8::format("Vendor_%04x_Product_%04x", - deviceIdentifier.vendor, deviceIdentifier.product), - type)); - if (!productPath.isEmpty()) { - return productPath; - } - } - - // Try device name. - return getInputDeviceConfigurationFilePathByName(deviceIdentifier.name, type); -} - -String8 getInputDeviceConfigurationFilePathByName( - const String8& name, InputDeviceConfigurationFileType type) { - // Search system repository. - String8 path; - path.setTo(getenv("ANDROID_ROOT")); - path.append("/usr/"); - appendInputDeviceConfigurationFileRelativePath(path, name, type); -#if DEBUG_PROBE - ALOGD("Probing for system provided input device configuration file: path='%s'", path.string()); -#endif - if (!access(path.string(), R_OK)) { -#if DEBUG_PROBE - ALOGD("Found"); -#endif - return path; - } - - // Search user repository. - // TODO Should only look here if not in safe mode. - path.setTo(getenv("ANDROID_DATA")); - path.append("/system/devices/"); - appendInputDeviceConfigurationFileRelativePath(path, name, type); -#if DEBUG_PROBE - ALOGD("Probing for system user input device configuration file: path='%s'", path.string()); -#endif - if (!access(path.string(), R_OK)) { -#if DEBUG_PROBE - ALOGD("Found"); -#endif - return path; - } - - // Not found. -#if DEBUG_PROBE - ALOGD("Probe failed to find input device configuration file: name='%s', type=%d", - name.string(), type); -#endif - return String8(); -} - - -// --- InputDeviceInfo --- - -InputDeviceInfo::InputDeviceInfo() { - initialize(-1, 0, -1, InputDeviceIdentifier(), String8(), false, false); -} - -InputDeviceInfo::InputDeviceInfo(const InputDeviceInfo& other) : - mId(other.mId), mGeneration(other.mGeneration), mControllerNumber(other.mControllerNumber), - mIdentifier(other.mIdentifier), mAlias(other.mAlias), mIsExternal(other.mIsExternal), - mHasMic(other.mHasMic), mSources(other.mSources), - mKeyboardType(other.mKeyboardType), mKeyCharacterMap(other.mKeyCharacterMap), - mHasVibrator(other.mHasVibrator), mHasButtonUnderPad(other.mHasButtonUnderPad), - mMotionRanges(other.mMotionRanges) { -} - -InputDeviceInfo::~InputDeviceInfo() { -} - -void InputDeviceInfo::initialize(int32_t id, int32_t generation, int32_t controllerNumber, - const InputDeviceIdentifier& identifier, const String8& alias, bool isExternal, - bool hasMic) { - mId = id; - mGeneration = generation; - mControllerNumber = controllerNumber; - mIdentifier = identifier; - mAlias = alias; - mIsExternal = isExternal; - mHasMic = hasMic; - mSources = 0; - mKeyboardType = AINPUT_KEYBOARD_TYPE_NONE; - mHasVibrator = false; - mHasButtonUnderPad = false; - mMotionRanges.clear(); -} - -const InputDeviceInfo::MotionRange* InputDeviceInfo::getMotionRange( - int32_t axis, uint32_t source) const { - size_t numRanges = mMotionRanges.size(); - for (size_t i = 0; i < numRanges; i++) { - const MotionRange& range = mMotionRanges.itemAt(i); - if (range.axis == axis && range.source == source) { - return ⦥ - } - } - return NULL; -} - -void InputDeviceInfo::addSource(uint32_t source) { - mSources |= source; -} - -void InputDeviceInfo::addMotionRange(int32_t axis, uint32_t source, float min, float max, - float flat, float fuzz, float resolution) { - MotionRange range = { axis, source, min, max, flat, fuzz, resolution }; - mMotionRanges.add(range); -} - -void InputDeviceInfo::addMotionRange(const MotionRange& range) { - mMotionRanges.add(range); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/InputTransport.cpp android-platform-frameworks-native-21/libs/input/InputTransport.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/InputTransport.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/InputTransport.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,974 +0,0 @@ -// -// Copyright 2010 The Android Open Source Project -// -// Provides a shared memory transport for input events. -// -#define LOG_TAG "InputTransport" - -//#define LOG_NDEBUG 0 - -// Log debug messages about channel messages (send message, receive message) -#define DEBUG_CHANNEL_MESSAGES 0 - -// Log debug messages whenever InputChannel objects are created/destroyed -#define DEBUG_CHANNEL_LIFECYCLE 0 - -// Log debug messages about transport actions -#define DEBUG_TRANSPORT_ACTIONS 0 - -// Log debug messages about touch event resampling -#define DEBUG_RESAMPLING 0 - - -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - - -namespace android { - -// Socket buffer size. The default is typically about 128KB, which is much larger than -// we really need. So we make it smaller. It just needs to be big enough to hold -// a few dozen large multi-finger motion events in the case where an application gets -// behind processing touches. -static const size_t SOCKET_BUFFER_SIZE = 32 * 1024; - -// Nanoseconds per milliseconds. -static const nsecs_t NANOS_PER_MS = 1000000; - -// Latency added during resampling. A few milliseconds doesn't hurt much but -// reduces the impact of mispredicted touch positions. -static const nsecs_t RESAMPLE_LATENCY = 5 * NANOS_PER_MS; - -// Minimum time difference between consecutive samples before attempting to resample. -static const nsecs_t RESAMPLE_MIN_DELTA = 2 * NANOS_PER_MS; - -// Maximum time difference between consecutive samples before attempting to resample -// by extrapolation. -static const nsecs_t RESAMPLE_MAX_DELTA = 20 * NANOS_PER_MS; - -// Maximum time to predict forward from the last known state, to avoid predicting too -// far into the future. This time is further bounded by 50% of the last time delta. -static const nsecs_t RESAMPLE_MAX_PREDICTION = 8 * NANOS_PER_MS; - -template -inline static T min(const T& a, const T& b) { - return a < b ? a : b; -} - -inline static float lerp(float a, float b, float alpha) { - return a + alpha * (b - a); -} - -// --- InputMessage --- - -bool InputMessage::isValid(size_t actualSize) const { - if (size() == actualSize) { - switch (header.type) { - case TYPE_KEY: - return true; - case TYPE_MOTION: - return body.motion.pointerCount > 0 - && body.motion.pointerCount <= MAX_POINTERS; - case TYPE_FINISHED: - return true; - } - } - return false; -} - -size_t InputMessage::size() const { - switch (header.type) { - case TYPE_KEY: - return sizeof(Header) + body.key.size(); - case TYPE_MOTION: - return sizeof(Header) + body.motion.size(); - case TYPE_FINISHED: - return sizeof(Header) + body.finished.size(); - } - return sizeof(Header); -} - - -// --- InputChannel --- - -InputChannel::InputChannel(const String8& name, int fd) : - mName(name), mFd(fd) { -#if DEBUG_CHANNEL_LIFECYCLE - ALOGD("Input channel constructed: name='%s', fd=%d", - mName.string(), fd); -#endif - - int result = fcntl(mFd, F_SETFL, O_NONBLOCK); - LOG_ALWAYS_FATAL_IF(result != 0, "channel '%s' ~ Could not make socket " - "non-blocking. errno=%d", mName.string(), errno); -} - -InputChannel::~InputChannel() { -#if DEBUG_CHANNEL_LIFECYCLE - ALOGD("Input channel destroyed: name='%s', fd=%d", - mName.string(), mFd); -#endif - - ::close(mFd); -} - -status_t InputChannel::openInputChannelPair(const String8& name, - sp& outServerChannel, sp& outClientChannel) { - int sockets[2]; - if (socketpair(AF_UNIX, SOCK_SEQPACKET, 0, sockets)) { - status_t result = -errno; - ALOGE("channel '%s' ~ Could not create socket pair. errno=%d", - name.string(), errno); - outServerChannel.clear(); - outClientChannel.clear(); - return result; - } - - int bufferSize = SOCKET_BUFFER_SIZE; - setsockopt(sockets[0], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)); - setsockopt(sockets[0], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)); - setsockopt(sockets[1], SOL_SOCKET, SO_SNDBUF, &bufferSize, sizeof(bufferSize)); - setsockopt(sockets[1], SOL_SOCKET, SO_RCVBUF, &bufferSize, sizeof(bufferSize)); - - String8 serverChannelName = name; - serverChannelName.append(" (server)"); - outServerChannel = new InputChannel(serverChannelName, sockets[0]); - - String8 clientChannelName = name; - clientChannelName.append(" (client)"); - outClientChannel = new InputChannel(clientChannelName, sockets[1]); - return OK; -} - -status_t InputChannel::sendMessage(const InputMessage* msg) { - size_t msgLength = msg->size(); - ssize_t nWrite; - do { - nWrite = ::send(mFd, msg, msgLength, MSG_DONTWAIT | MSG_NOSIGNAL); - } while (nWrite == -1 && errno == EINTR); - - if (nWrite < 0) { - int error = errno; -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ error sending message of type %d, errno=%d", mName.string(), - msg->header.type, error); -#endif - if (error == EAGAIN || error == EWOULDBLOCK) { - return WOULD_BLOCK; - } - if (error == EPIPE || error == ENOTCONN || error == ECONNREFUSED || error == ECONNRESET) { - return DEAD_OBJECT; - } - return -error; - } - - if (size_t(nWrite) != msgLength) { -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ error sending message type %d, send was incomplete", - mName.string(), msg->header.type); -#endif - return DEAD_OBJECT; - } - -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ sent message of type %d", mName.string(), msg->header.type); -#endif - return OK; -} - -status_t InputChannel::receiveMessage(InputMessage* msg) { - ssize_t nRead; - do { - nRead = ::recv(mFd, msg, sizeof(InputMessage), MSG_DONTWAIT); - } while (nRead == -1 && errno == EINTR); - - if (nRead < 0) { - int error = errno; -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ receive message failed, errno=%d", mName.string(), errno); -#endif - if (error == EAGAIN || error == EWOULDBLOCK) { - return WOULD_BLOCK; - } - if (error == EPIPE || error == ENOTCONN || error == ECONNREFUSED) { - return DEAD_OBJECT; - } - return -error; - } - - if (nRead == 0) { // check for EOF -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ receive message failed because peer was closed", mName.string()); -#endif - return DEAD_OBJECT; - } - - if (!msg->isValid(nRead)) { -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ received invalid message", mName.string()); -#endif - return BAD_VALUE; - } - -#if DEBUG_CHANNEL_MESSAGES - ALOGD("channel '%s' ~ received message of type %d", mName.string(), msg->header.type); -#endif - return OK; -} - -sp InputChannel::dup() const { - int fd = ::dup(getFd()); - return fd >= 0 ? new InputChannel(getName(), fd) : NULL; -} - - -// --- InputPublisher --- - -InputPublisher::InputPublisher(const sp& channel) : - mChannel(channel) { -} - -InputPublisher::~InputPublisher() { -} - -status_t InputPublisher::publishKeyEvent( - uint32_t seq, - int32_t deviceId, - int32_t source, - int32_t action, - int32_t flags, - int32_t keyCode, - int32_t scanCode, - int32_t metaState, - int32_t repeatCount, - nsecs_t downTime, - nsecs_t eventTime) { -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' publisher ~ publishKeyEvent: seq=%u, deviceId=%d, source=0x%x, " - "action=0x%x, flags=0x%x, keyCode=%d, scanCode=%d, metaState=0x%x, repeatCount=%d," - "downTime=%lld, eventTime=%lld", - mChannel->getName().string(), seq, - deviceId, source, action, flags, keyCode, scanCode, metaState, repeatCount, - downTime, eventTime); -#endif - - if (!seq) { - ALOGE("Attempted to publish a key event with sequence number 0."); - return BAD_VALUE; - } - - InputMessage msg; - msg.header.type = InputMessage::TYPE_KEY; - msg.body.key.seq = seq; - msg.body.key.deviceId = deviceId; - msg.body.key.source = source; - msg.body.key.action = action; - msg.body.key.flags = flags; - msg.body.key.keyCode = keyCode; - msg.body.key.scanCode = scanCode; - msg.body.key.metaState = metaState; - msg.body.key.repeatCount = repeatCount; - msg.body.key.downTime = downTime; - msg.body.key.eventTime = eventTime; - return mChannel->sendMessage(&msg); -} - -status_t InputPublisher::publishMotionEvent( - uint32_t seq, - int32_t deviceId, - int32_t source, - int32_t action, - int32_t actionButton, - int32_t flags, - int32_t edgeFlags, - int32_t metaState, - int32_t buttonState, - float xOffset, - float yOffset, - float xPrecision, - float yPrecision, - nsecs_t downTime, - nsecs_t eventTime, - uint32_t pointerCount, - const PointerProperties* pointerProperties, - const PointerCoords* pointerCoords) { -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' publisher ~ publishMotionEvent: seq=%u, deviceId=%d, source=0x%x, " - "action=0x%x, actionButton=0x%08x, flags=0x%x, edgeFlags=0x%x, " - "metaState=0x%x, buttonState=0x%x, xOffset=%f, yOffset=%f, " - "xPrecision=%f, yPrecision=%f, downTime=%lld, eventTime=%lld, " - "pointerCount=%" PRIu32, - mChannel->getName().string(), seq, - deviceId, source, action, actionButton, flags, edgeFlags, metaState, buttonState, - xOffset, yOffset, xPrecision, yPrecision, downTime, eventTime, pointerCount); -#endif - - if (!seq) { - ALOGE("Attempted to publish a motion event with sequence number 0."); - return BAD_VALUE; - } - - if (pointerCount > MAX_POINTERS || pointerCount < 1) { - ALOGE("channel '%s' publisher ~ Invalid number of pointers provided: %" PRIu32 ".", - mChannel->getName().string(), pointerCount); - return BAD_VALUE; - } - - InputMessage msg; - msg.header.type = InputMessage::TYPE_MOTION; - msg.body.motion.seq = seq; - msg.body.motion.deviceId = deviceId; - msg.body.motion.source = source; - msg.body.motion.action = action; - msg.body.motion.actionButton = actionButton; - msg.body.motion.flags = flags; - msg.body.motion.edgeFlags = edgeFlags; - msg.body.motion.metaState = metaState; - msg.body.motion.buttonState = buttonState; - msg.body.motion.xOffset = xOffset; - msg.body.motion.yOffset = yOffset; - msg.body.motion.xPrecision = xPrecision; - msg.body.motion.yPrecision = yPrecision; - msg.body.motion.downTime = downTime; - msg.body.motion.eventTime = eventTime; - msg.body.motion.pointerCount = pointerCount; - for (uint32_t i = 0; i < pointerCount; i++) { - msg.body.motion.pointers[i].properties.copyFrom(pointerProperties[i]); - msg.body.motion.pointers[i].coords.copyFrom(pointerCoords[i]); - } - return mChannel->sendMessage(&msg); -} - -status_t InputPublisher::receiveFinishedSignal(uint32_t* outSeq, bool* outHandled) { -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' publisher ~ receiveFinishedSignal", - mChannel->getName().string()); -#endif - - InputMessage msg; - status_t result = mChannel->receiveMessage(&msg); - if (result) { - *outSeq = 0; - *outHandled = false; - return result; - } - if (msg.header.type != InputMessage::TYPE_FINISHED) { - ALOGE("channel '%s' publisher ~ Received unexpected message of type %d from consumer", - mChannel->getName().string(), msg.header.type); - return UNKNOWN_ERROR; - } - *outSeq = msg.body.finished.seq; - *outHandled = msg.body.finished.handled; - return OK; -} - -// --- InputConsumer --- - -InputConsumer::InputConsumer(const sp& channel) : - mResampleTouch(isTouchResamplingEnabled()), - mChannel(channel), mMsgDeferred(false) { -} - -InputConsumer::~InputConsumer() { -} - -bool InputConsumer::isTouchResamplingEnabled() { - char value[PROPERTY_VALUE_MAX]; - int length = property_get("ro.input.noresample", value, NULL); - if (length > 0) { - if (!strcmp("1", value)) { - return false; - } - if (strcmp("0", value)) { - ALOGD("Unrecognized property value for 'ro.input.noresample'. " - "Use '1' or '0'."); - } - } - return true; -} - -status_t InputConsumer::consume(InputEventFactoryInterface* factory, - bool consumeBatches, nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) { -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ consume: consumeBatches=%s, frameTime=%lld", - mChannel->getName().string(), consumeBatches ? "true" : "false", frameTime); -#endif - - *outSeq = 0; - *outEvent = NULL; - - // Fetch the next input message. - // Loop until an event can be returned or no additional events are received. - while (!*outEvent) { - if (mMsgDeferred) { - // mMsg contains a valid input message from the previous call to consume - // that has not yet been processed. - mMsgDeferred = false; - } else { - // Receive a fresh message. - status_t result = mChannel->receiveMessage(&mMsg); - if (result) { - // Consume the next batched event unless batches are being held for later. - if (consumeBatches || result != WOULD_BLOCK) { - result = consumeBatch(factory, frameTime, outSeq, outEvent); - if (*outEvent) { -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ consumed batch event, seq=%u", - mChannel->getName().string(), *outSeq); -#endif - break; - } - } - return result; - } - } - - switch (mMsg.header.type) { - case InputMessage::TYPE_KEY: { - KeyEvent* keyEvent = factory->createKeyEvent(); - if (!keyEvent) return NO_MEMORY; - - initializeKeyEvent(keyEvent, &mMsg); - *outSeq = mMsg.body.key.seq; - *outEvent = keyEvent; -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ consumed key event, seq=%u", - mChannel->getName().string(), *outSeq); -#endif - break; - } - - case AINPUT_EVENT_TYPE_MOTION: { - ssize_t batchIndex = findBatch(mMsg.body.motion.deviceId, mMsg.body.motion.source); - if (batchIndex >= 0) { - Batch& batch = mBatches.editItemAt(batchIndex); - if (canAddSample(batch, &mMsg)) { - batch.samples.push(mMsg); -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ appended to batch event", - mChannel->getName().string()); -#endif - break; - } else { - // We cannot append to the batch in progress, so we need to consume - // the previous batch right now and defer the new message until later. - mMsgDeferred = true; - status_t result = consumeSamples(factory, - batch, batch.samples.size(), outSeq, outEvent); - mBatches.removeAt(batchIndex); - if (result) { - return result; - } -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ consumed batch event and " - "deferred current event, seq=%u", - mChannel->getName().string(), *outSeq); -#endif - break; - } - } - - // Start a new batch if needed. - if (mMsg.body.motion.action == AMOTION_EVENT_ACTION_MOVE - || mMsg.body.motion.action == AMOTION_EVENT_ACTION_HOVER_MOVE) { - mBatches.push(); - Batch& batch = mBatches.editTop(); - batch.samples.push(mMsg); -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ started batch event", - mChannel->getName().string()); -#endif - break; - } - - MotionEvent* motionEvent = factory->createMotionEvent(); - if (! motionEvent) return NO_MEMORY; - - updateTouchState(&mMsg); - initializeMotionEvent(motionEvent, &mMsg); - *outSeq = mMsg.body.motion.seq; - *outEvent = motionEvent; -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ consumed motion event, seq=%u", - mChannel->getName().string(), *outSeq); -#endif - break; - } - - default: - ALOGE("channel '%s' consumer ~ Received unexpected message of type %d", - mChannel->getName().string(), mMsg.header.type); - return UNKNOWN_ERROR; - } - } - return OK; -} - -status_t InputConsumer::consumeBatch(InputEventFactoryInterface* factory, - nsecs_t frameTime, uint32_t* outSeq, InputEvent** outEvent) { - status_t result; - for (size_t i = mBatches.size(); i-- > 0; ) { - Batch& batch = mBatches.editItemAt(i); - if (frameTime < 0) { - result = consumeSamples(factory, batch, batch.samples.size(), - outSeq, outEvent); - mBatches.removeAt(i); - return result; - } - - nsecs_t sampleTime = frameTime; - if (mResampleTouch) { - sampleTime -= RESAMPLE_LATENCY; - } - ssize_t split = findSampleNoLaterThan(batch, sampleTime); - if (split < 0) { - continue; - } - - result = consumeSamples(factory, batch, split + 1, outSeq, outEvent); - const InputMessage* next; - if (batch.samples.isEmpty()) { - mBatches.removeAt(i); - next = NULL; - } else { - next = &batch.samples.itemAt(0); - } - if (!result && mResampleTouch) { - resampleTouchState(sampleTime, static_cast(*outEvent), next); - } - return result; - } - - return WOULD_BLOCK; -} - -status_t InputConsumer::consumeSamples(InputEventFactoryInterface* factory, - Batch& batch, size_t count, uint32_t* outSeq, InputEvent** outEvent) { - MotionEvent* motionEvent = factory->createMotionEvent(); - if (! motionEvent) return NO_MEMORY; - - uint32_t chain = 0; - for (size_t i = 0; i < count; i++) { - InputMessage& msg = batch.samples.editItemAt(i); - updateTouchState(&msg); - if (i) { - SeqChain seqChain; - seqChain.seq = msg.body.motion.seq; - seqChain.chain = chain; - mSeqChains.push(seqChain); - addSample(motionEvent, &msg); - } else { - initializeMotionEvent(motionEvent, &msg); - } - chain = msg.body.motion.seq; - } - batch.samples.removeItemsAt(0, count); - - *outSeq = chain; - *outEvent = motionEvent; - return OK; -} - -void InputConsumer::updateTouchState(InputMessage* msg) { - if (!mResampleTouch || - !(msg->body.motion.source & AINPUT_SOURCE_CLASS_POINTER)) { - return; - } - - int32_t deviceId = msg->body.motion.deviceId; - int32_t source = msg->body.motion.source; - nsecs_t eventTime = msg->body.motion.eventTime; - - // Update the touch state history to incorporate the new input message. - // If the message is in the past relative to the most recently produced resampled - // touch, then use the resampled time and coordinates instead. - switch (msg->body.motion.action & AMOTION_EVENT_ACTION_MASK) { - case AMOTION_EVENT_ACTION_DOWN: { - ssize_t index = findTouchState(deviceId, source); - if (index < 0) { - mTouchStates.push(); - index = mTouchStates.size() - 1; - } - TouchState& touchState = mTouchStates.editItemAt(index); - touchState.initialize(deviceId, source); - touchState.addHistory(msg); - break; - } - - case AMOTION_EVENT_ACTION_MOVE: { - ssize_t index = findTouchState(deviceId, source); - if (index >= 0) { - TouchState& touchState = mTouchStates.editItemAt(index); - touchState.addHistory(msg); - if (eventTime < touchState.lastResample.eventTime) { - rewriteMessage(touchState, msg); - } else { - touchState.lastResample.idBits.clear(); - } - } - break; - } - - case AMOTION_EVENT_ACTION_POINTER_DOWN: { - ssize_t index = findTouchState(deviceId, source); - if (index >= 0) { - TouchState& touchState = mTouchStates.editItemAt(index); - touchState.lastResample.idBits.clearBit(msg->body.motion.getActionId()); - rewriteMessage(touchState, msg); - } - break; - } - - case AMOTION_EVENT_ACTION_POINTER_UP: { - ssize_t index = findTouchState(deviceId, source); - if (index >= 0) { - TouchState& touchState = mTouchStates.editItemAt(index); - rewriteMessage(touchState, msg); - touchState.lastResample.idBits.clearBit(msg->body.motion.getActionId()); - } - break; - } - - case AMOTION_EVENT_ACTION_SCROLL: { - ssize_t index = findTouchState(deviceId, source); - if (index >= 0) { - const TouchState& touchState = mTouchStates.itemAt(index); - rewriteMessage(touchState, msg); - } - break; - } - - case AMOTION_EVENT_ACTION_UP: - case AMOTION_EVENT_ACTION_CANCEL: { - ssize_t index = findTouchState(deviceId, source); - if (index >= 0) { - const TouchState& touchState = mTouchStates.itemAt(index); - rewriteMessage(touchState, msg); - mTouchStates.removeAt(index); - } - break; - } - } -} - -void InputConsumer::rewriteMessage(const TouchState& state, InputMessage* msg) { - for (uint32_t i = 0; i < msg->body.motion.pointerCount; i++) { - uint32_t id = msg->body.motion.pointers[i].properties.id; - if (state.lastResample.idBits.hasBit(id)) { - PointerCoords& msgCoords = msg->body.motion.pointers[i].coords; - const PointerCoords& resampleCoords = state.lastResample.getPointerById(id); -#if DEBUG_RESAMPLING - ALOGD("[%d] - rewrite (%0.3f, %0.3f), old (%0.3f, %0.3f)", id, - resampleCoords.getAxisValue(AMOTION_EVENT_AXIS_X), - resampleCoords.getAxisValue(AMOTION_EVENT_AXIS_Y), - msgCoords.getAxisValue(AMOTION_EVENT_AXIS_X), - msgCoords.getAxisValue(AMOTION_EVENT_AXIS_Y)); -#endif - msgCoords.setAxisValue(AMOTION_EVENT_AXIS_X, resampleCoords.getX()); - msgCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, resampleCoords.getY()); - } - } -} - -void InputConsumer::resampleTouchState(nsecs_t sampleTime, MotionEvent* event, - const InputMessage* next) { - if (!mResampleTouch - || !(event->getSource() & AINPUT_SOURCE_CLASS_POINTER) - || event->getAction() != AMOTION_EVENT_ACTION_MOVE) { - return; - } - - ssize_t index = findTouchState(event->getDeviceId(), event->getSource()); - if (index < 0) { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, no touch state for device."); -#endif - return; - } - - TouchState& touchState = mTouchStates.editItemAt(index); - if (touchState.historySize < 1) { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, no history for device."); -#endif - return; - } - - // Ensure that the current sample has all of the pointers that need to be reported. - const History* current = touchState.getHistory(0); - size_t pointerCount = event->getPointerCount(); - for (size_t i = 0; i < pointerCount; i++) { - uint32_t id = event->getPointerId(i); - if (!current->idBits.hasBit(id)) { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, missing id %d", id); -#endif - return; - } - } - - // Find the data to use for resampling. - const History* other; - History future; - float alpha; - if (next) { - // Interpolate between current sample and future sample. - // So current->eventTime <= sampleTime <= future.eventTime. - future.initializeFrom(next); - other = &future; - nsecs_t delta = future.eventTime - current->eventTime; - if (delta < RESAMPLE_MIN_DELTA) { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, delta time is too small: %lld ns.", delta); -#endif - return; - } - alpha = float(sampleTime - current->eventTime) / delta; - } else if (touchState.historySize >= 2) { - // Extrapolate future sample using current sample and past sample. - // So other->eventTime <= current->eventTime <= sampleTime. - other = touchState.getHistory(1); - nsecs_t delta = current->eventTime - other->eventTime; - if (delta < RESAMPLE_MIN_DELTA) { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, delta time is too small: %lld ns.", delta); -#endif - return; - } else if (delta > RESAMPLE_MAX_DELTA) { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, delta time is too large: %lld ns.", delta); -#endif - return; - } - nsecs_t maxPredict = current->eventTime + min(delta / 2, RESAMPLE_MAX_PREDICTION); - if (sampleTime > maxPredict) { -#if DEBUG_RESAMPLING - ALOGD("Sample time is too far in the future, adjusting prediction " - "from %lld to %lld ns.", - sampleTime - current->eventTime, maxPredict - current->eventTime); -#endif - sampleTime = maxPredict; - } - alpha = float(current->eventTime - sampleTime) / delta; - } else { -#if DEBUG_RESAMPLING - ALOGD("Not resampled, insufficient data."); -#endif - return; - } - - // Resample touch coordinates. - touchState.lastResample.eventTime = sampleTime; - touchState.lastResample.idBits.clear(); - for (size_t i = 0; i < pointerCount; i++) { - uint32_t id = event->getPointerId(i); - touchState.lastResample.idToIndex[id] = i; - touchState.lastResample.idBits.markBit(id); - PointerCoords& resampledCoords = touchState.lastResample.pointers[i]; - const PointerCoords& currentCoords = current->getPointerById(id); - if (other->idBits.hasBit(id) - && shouldResampleTool(event->getToolType(i))) { - const PointerCoords& otherCoords = other->getPointerById(id); - resampledCoords.copyFrom(currentCoords); - resampledCoords.setAxisValue(AMOTION_EVENT_AXIS_X, - lerp(currentCoords.getX(), otherCoords.getX(), alpha)); - resampledCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, - lerp(currentCoords.getY(), otherCoords.getY(), alpha)); -#if DEBUG_RESAMPLING - ALOGD("[%d] - out (%0.3f, %0.3f), cur (%0.3f, %0.3f), " - "other (%0.3f, %0.3f), alpha %0.3f", - id, resampledCoords.getX(), resampledCoords.getY(), - currentCoords.getX(), currentCoords.getY(), - otherCoords.getX(), otherCoords.getY(), - alpha); -#endif - } else { - resampledCoords.copyFrom(currentCoords); -#if DEBUG_RESAMPLING - ALOGD("[%d] - out (%0.3f, %0.3f), cur (%0.3f, %0.3f)", - id, resampledCoords.getX(), resampledCoords.getY(), - currentCoords.getX(), currentCoords.getY()); -#endif - } - } - - event->addSample(sampleTime, touchState.lastResample.pointers); -} - -bool InputConsumer::shouldResampleTool(int32_t toolType) { - return toolType == AMOTION_EVENT_TOOL_TYPE_FINGER - || toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN; -} - -status_t InputConsumer::sendFinishedSignal(uint32_t seq, bool handled) { -#if DEBUG_TRANSPORT_ACTIONS - ALOGD("channel '%s' consumer ~ sendFinishedSignal: seq=%u, handled=%s", - mChannel->getName().string(), seq, handled ? "true" : "false"); -#endif - - if (!seq) { - ALOGE("Attempted to send a finished signal with sequence number 0."); - return BAD_VALUE; - } - - // Send finished signals for the batch sequence chain first. - size_t seqChainCount = mSeqChains.size(); - if (seqChainCount) { - uint32_t currentSeq = seq; - uint32_t chainSeqs[seqChainCount]; - size_t chainIndex = 0; - for (size_t i = seqChainCount; i-- > 0; ) { - const SeqChain& seqChain = mSeqChains.itemAt(i); - if (seqChain.seq == currentSeq) { - currentSeq = seqChain.chain; - chainSeqs[chainIndex++] = currentSeq; - mSeqChains.removeAt(i); - } - } - status_t status = OK; - while (!status && chainIndex-- > 0) { - status = sendUnchainedFinishedSignal(chainSeqs[chainIndex], handled); - } - if (status) { - // An error occurred so at least one signal was not sent, reconstruct the chain. - do { - SeqChain seqChain; - seqChain.seq = chainIndex != 0 ? chainSeqs[chainIndex - 1] : seq; - seqChain.chain = chainSeqs[chainIndex]; - mSeqChains.push(seqChain); - } while (chainIndex-- > 0); - return status; - } - } - - // Send finished signal for the last message in the batch. - return sendUnchainedFinishedSignal(seq, handled); -} - -status_t InputConsumer::sendUnchainedFinishedSignal(uint32_t seq, bool handled) { - InputMessage msg; - msg.header.type = InputMessage::TYPE_FINISHED; - msg.body.finished.seq = seq; - msg.body.finished.handled = handled; - return mChannel->sendMessage(&msg); -} - -bool InputConsumer::hasDeferredEvent() const { - return mMsgDeferred; -} - -bool InputConsumer::hasPendingBatch() const { - return !mBatches.isEmpty(); -} - -ssize_t InputConsumer::findBatch(int32_t deviceId, int32_t source) const { - for (size_t i = 0; i < mBatches.size(); i++) { - const Batch& batch = mBatches.itemAt(i); - const InputMessage& head = batch.samples.itemAt(0); - if (head.body.motion.deviceId == deviceId && head.body.motion.source == source) { - return i; - } - } - return -1; -} - -ssize_t InputConsumer::findTouchState(int32_t deviceId, int32_t source) const { - for (size_t i = 0; i < mTouchStates.size(); i++) { - const TouchState& touchState = mTouchStates.itemAt(i); - if (touchState.deviceId == deviceId && touchState.source == source) { - return i; - } - } - return -1; -} - -void InputConsumer::initializeKeyEvent(KeyEvent* event, const InputMessage* msg) { - event->initialize( - msg->body.key.deviceId, - msg->body.key.source, - msg->body.key.action, - msg->body.key.flags, - msg->body.key.keyCode, - msg->body.key.scanCode, - msg->body.key.metaState, - msg->body.key.repeatCount, - msg->body.key.downTime, - msg->body.key.eventTime); -} - -void InputConsumer::initializeMotionEvent(MotionEvent* event, const InputMessage* msg) { - uint32_t pointerCount = msg->body.motion.pointerCount; - PointerProperties pointerProperties[pointerCount]; - PointerCoords pointerCoords[pointerCount]; - for (uint32_t i = 0; i < pointerCount; i++) { - pointerProperties[i].copyFrom(msg->body.motion.pointers[i].properties); - pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords); - } - - event->initialize( - msg->body.motion.deviceId, - msg->body.motion.source, - msg->body.motion.action, - msg->body.motion.actionButton, - msg->body.motion.flags, - msg->body.motion.edgeFlags, - msg->body.motion.metaState, - msg->body.motion.buttonState, - msg->body.motion.xOffset, - msg->body.motion.yOffset, - msg->body.motion.xPrecision, - msg->body.motion.yPrecision, - msg->body.motion.downTime, - msg->body.motion.eventTime, - pointerCount, - pointerProperties, - pointerCoords); -} - -void InputConsumer::addSample(MotionEvent* event, const InputMessage* msg) { - uint32_t pointerCount = msg->body.motion.pointerCount; - PointerCoords pointerCoords[pointerCount]; - for (uint32_t i = 0; i < pointerCount; i++) { - pointerCoords[i].copyFrom(msg->body.motion.pointers[i].coords); - } - - event->setMetaState(event->getMetaState() | msg->body.motion.metaState); - event->addSample(msg->body.motion.eventTime, pointerCoords); -} - -bool InputConsumer::canAddSample(const Batch& batch, const InputMessage *msg) { - const InputMessage& head = batch.samples.itemAt(0); - uint32_t pointerCount = msg->body.motion.pointerCount; - if (head.body.motion.pointerCount != pointerCount - || head.body.motion.action != msg->body.motion.action) { - return false; - } - for (size_t i = 0; i < pointerCount; i++) { - if (head.body.motion.pointers[i].properties - != msg->body.motion.pointers[i].properties) { - return false; - } - } - return true; -} - -ssize_t InputConsumer::findSampleNoLaterThan(const Batch& batch, nsecs_t time) { - size_t numSamples = batch.samples.size(); - size_t index = 0; - while (index < numSamples - && batch.samples.itemAt(index).body.motion.eventTime <= time) { - index += 1; - } - return ssize_t(index) - 1; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/Keyboard.cpp android-platform-frameworks-native-21/libs/input/Keyboard.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/Keyboard.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/Keyboard.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,266 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "Keyboard" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -namespace android { - -// --- KeyMap --- - -KeyMap::KeyMap() { -} - -KeyMap::~KeyMap() { -} - -status_t KeyMap::load(const InputDeviceIdentifier& deviceIdenfifier, - const PropertyMap* deviceConfiguration) { - // Use the configured key layout if available. - if (deviceConfiguration) { - String8 keyLayoutName; - if (deviceConfiguration->tryGetProperty(String8("keyboard.layout"), - keyLayoutName)) { - status_t status = loadKeyLayout(deviceIdenfifier, keyLayoutName); - if (status == NAME_NOT_FOUND) { - ALOGE("Configuration for keyboard device '%s' requested keyboard layout '%s' but " - "it was not found.", - deviceIdenfifier.name.string(), keyLayoutName.string()); - } - } - - String8 keyCharacterMapName; - if (deviceConfiguration->tryGetProperty(String8("keyboard.characterMap"), - keyCharacterMapName)) { - status_t status = loadKeyCharacterMap(deviceIdenfifier, keyCharacterMapName); - if (status == NAME_NOT_FOUND) { - ALOGE("Configuration for keyboard device '%s' requested keyboard character " - "map '%s' but it was not found.", - deviceIdenfifier.name.string(), keyLayoutName.string()); - } - } - - if (isComplete()) { - return OK; - } - } - - // Try searching by device identifier. - if (probeKeyMap(deviceIdenfifier, String8::empty())) { - return OK; - } - - // Fall back on the Generic key map. - // TODO Apply some additional heuristics here to figure out what kind of - // generic key map to use (US English, etc.) for typical external keyboards. - if (probeKeyMap(deviceIdenfifier, String8("Generic"))) { - return OK; - } - - // Try the Virtual key map as a last resort. - if (probeKeyMap(deviceIdenfifier, String8("Virtual"))) { - return OK; - } - - // Give up! - ALOGE("Could not determine key map for device '%s' and no default key maps were found!", - deviceIdenfifier.name.string()); - return NAME_NOT_FOUND; -} - -bool KeyMap::probeKeyMap(const InputDeviceIdentifier& deviceIdentifier, - const String8& keyMapName) { - if (!haveKeyLayout()) { - loadKeyLayout(deviceIdentifier, keyMapName); - } - if (!haveKeyCharacterMap()) { - loadKeyCharacterMap(deviceIdentifier, keyMapName); - } - return isComplete(); -} - -status_t KeyMap::loadKeyLayout(const InputDeviceIdentifier& deviceIdentifier, - const String8& name) { - String8 path(getPath(deviceIdentifier, name, - INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_LAYOUT)); - if (path.isEmpty()) { - return NAME_NOT_FOUND; - } - - status_t status = KeyLayoutMap::load(path, &keyLayoutMap); - if (status) { - return status; - } - - keyLayoutFile.setTo(path); - return OK; -} - -status_t KeyMap::loadKeyCharacterMap(const InputDeviceIdentifier& deviceIdentifier, - const String8& name) { - String8 path(getPath(deviceIdentifier, name, - INPUT_DEVICE_CONFIGURATION_FILE_TYPE_KEY_CHARACTER_MAP)); - if (path.isEmpty()) { - return NAME_NOT_FOUND; - } - - status_t status = KeyCharacterMap::load(path, - KeyCharacterMap::FORMAT_BASE, &keyCharacterMap); - if (status) { - return status; - } - - keyCharacterMapFile.setTo(path); - return OK; -} - -String8 KeyMap::getPath(const InputDeviceIdentifier& deviceIdentifier, - const String8& name, InputDeviceConfigurationFileType type) { - return name.isEmpty() - ? getInputDeviceConfigurationFilePathByDeviceIdentifier(deviceIdentifier, type) - : getInputDeviceConfigurationFilePathByName(name, type); -} - - -// --- Global functions --- - -bool isEligibleBuiltInKeyboard(const InputDeviceIdentifier& deviceIdentifier, - const PropertyMap* deviceConfiguration, const KeyMap* keyMap) { - if (!keyMap->haveKeyCharacterMap() - || keyMap->keyCharacterMap->getKeyboardType() - == KeyCharacterMap::KEYBOARD_TYPE_SPECIAL_FUNCTION) { - return false; - } - - if (deviceConfiguration) { - bool builtIn = false; - if (deviceConfiguration->tryGetProperty(String8("keyboard.builtIn"), builtIn) - && builtIn) { - return true; - } - } - - return strstr(deviceIdentifier.name.string(), "-keypad"); -} - -static int32_t setEphemeralMetaState(int32_t mask, bool down, int32_t oldMetaState) { - int32_t newMetaState; - if (down) { - newMetaState = oldMetaState | mask; - } else { - newMetaState = oldMetaState & - ~(mask | AMETA_ALT_ON | AMETA_SHIFT_ON | AMETA_CTRL_ON | AMETA_META_ON); - } - - return normalizeMetaState(newMetaState); -} - -int32_t normalizeMetaState(int32_t oldMetaState) { - int32_t newMetaState = oldMetaState; - if (newMetaState & (AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON)) { - newMetaState |= AMETA_ALT_ON; - } - - if (newMetaState & (AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_RIGHT_ON)) { - newMetaState |= AMETA_SHIFT_ON; - } - - if (newMetaState & (AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON)) { - newMetaState |= AMETA_CTRL_ON; - } - - if (newMetaState & (AMETA_META_LEFT_ON | AMETA_META_RIGHT_ON)) { - newMetaState |= AMETA_META_ON; - } - return newMetaState; -} - -static int32_t toggleLockedMetaState(int32_t mask, bool down, int32_t oldMetaState) { - if (down) { - return oldMetaState; - } else { - return oldMetaState ^ mask; - } -} - -int32_t updateMetaState(int32_t keyCode, bool down, int32_t oldMetaState) { - int32_t mask; - switch (keyCode) { - case AKEYCODE_ALT_LEFT: - return setEphemeralMetaState(AMETA_ALT_LEFT_ON, down, oldMetaState); - case AKEYCODE_ALT_RIGHT: - return setEphemeralMetaState(AMETA_ALT_RIGHT_ON, down, oldMetaState); - case AKEYCODE_SHIFT_LEFT: - return setEphemeralMetaState(AMETA_SHIFT_LEFT_ON, down, oldMetaState); - case AKEYCODE_SHIFT_RIGHT: - return setEphemeralMetaState(AMETA_SHIFT_RIGHT_ON, down, oldMetaState); - case AKEYCODE_SYM: - return setEphemeralMetaState(AMETA_SYM_ON, down, oldMetaState); - case AKEYCODE_FUNCTION: - return setEphemeralMetaState(AMETA_FUNCTION_ON, down, oldMetaState); - case AKEYCODE_CTRL_LEFT: - return setEphemeralMetaState(AMETA_CTRL_LEFT_ON, down, oldMetaState); - case AKEYCODE_CTRL_RIGHT: - return setEphemeralMetaState(AMETA_CTRL_RIGHT_ON, down, oldMetaState); - case AKEYCODE_META_LEFT: - return setEphemeralMetaState(AMETA_META_LEFT_ON, down, oldMetaState); - case AKEYCODE_META_RIGHT: - return setEphemeralMetaState(AMETA_META_RIGHT_ON, down, oldMetaState); - case AKEYCODE_CAPS_LOCK: - return toggleLockedMetaState(AMETA_CAPS_LOCK_ON, down, oldMetaState); - case AKEYCODE_NUM_LOCK: - return toggleLockedMetaState(AMETA_NUM_LOCK_ON, down, oldMetaState); - case AKEYCODE_SCROLL_LOCK: - return toggleLockedMetaState(AMETA_SCROLL_LOCK_ON, down, oldMetaState); - default: - return oldMetaState; - } -} - -bool isMetaKey(int32_t keyCode) { - switch (keyCode) { - case AKEYCODE_ALT_LEFT: - case AKEYCODE_ALT_RIGHT: - case AKEYCODE_SHIFT_LEFT: - case AKEYCODE_SHIFT_RIGHT: - case AKEYCODE_SYM: - case AKEYCODE_FUNCTION: - case AKEYCODE_CTRL_LEFT: - case AKEYCODE_CTRL_RIGHT: - case AKEYCODE_META_LEFT: - case AKEYCODE_META_RIGHT: - case AKEYCODE_CAPS_LOCK: - case AKEYCODE_NUM_LOCK: - case AKEYCODE_SCROLL_LOCK: - return true; - default: - return false; - } -} - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/KeyCharacterMap.cpp android-platform-frameworks-native-21/libs/input/KeyCharacterMap.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/KeyCharacterMap.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/KeyCharacterMap.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1237 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#define LOG_TAG "KeyCharacterMap" - -#include -#include - -#if HAVE_ANDROID_OS -#include -#endif - -#include -#include -#include -#include - -#include -#include -#include -#include - -// Enables debug output for the parser. -#define DEBUG_PARSER 0 - -// Enables debug output for parser performance. -#define DEBUG_PARSER_PERFORMANCE 0 - -// Enables debug output for mapping. -#define DEBUG_MAPPING 0 - - -namespace android { - -static const char* WHITESPACE = " \t\r"; -static const char* WHITESPACE_OR_PROPERTY_DELIMITER = " \t\r,:"; - -struct Modifier { - const char* label; - int32_t metaState; -}; -static const Modifier modifiers[] = { - { "shift", AMETA_SHIFT_ON }, - { "lshift", AMETA_SHIFT_LEFT_ON }, - { "rshift", AMETA_SHIFT_RIGHT_ON }, - { "alt", AMETA_ALT_ON }, - { "lalt", AMETA_ALT_LEFT_ON }, - { "ralt", AMETA_ALT_RIGHT_ON }, - { "ctrl", AMETA_CTRL_ON }, - { "lctrl", AMETA_CTRL_LEFT_ON }, - { "rctrl", AMETA_CTRL_RIGHT_ON }, - { "meta", AMETA_META_ON }, - { "lmeta", AMETA_META_LEFT_ON }, - { "rmeta", AMETA_META_RIGHT_ON }, - { "sym", AMETA_SYM_ON }, - { "fn", AMETA_FUNCTION_ON }, - { "capslock", AMETA_CAPS_LOCK_ON }, - { "numlock", AMETA_NUM_LOCK_ON }, - { "scrolllock", AMETA_SCROLL_LOCK_ON }, -}; - -#if DEBUG_MAPPING -static String8 toString(const char16_t* chars, size_t numChars) { - String8 result; - for (size_t i = 0; i < numChars; i++) { - result.appendFormat(i == 0 ? "%d" : ", %d", chars[i]); - } - return result; -} -#endif - - -// --- KeyCharacterMap --- - -sp KeyCharacterMap::sEmpty = new KeyCharacterMap(); - -KeyCharacterMap::KeyCharacterMap() : - mType(KEYBOARD_TYPE_UNKNOWN) { -} - -KeyCharacterMap::KeyCharacterMap(const KeyCharacterMap& other) : - RefBase(), mType(other.mType), mKeysByScanCode(other.mKeysByScanCode), - mKeysByUsageCode(other.mKeysByUsageCode) { - for (size_t i = 0; i < other.mKeys.size(); i++) { - mKeys.add(other.mKeys.keyAt(i), new Key(*other.mKeys.valueAt(i))); - } -} - -KeyCharacterMap::~KeyCharacterMap() { - for (size_t i = 0; i < mKeys.size(); i++) { - Key* key = mKeys.editValueAt(i); - delete key; - } -} - -status_t KeyCharacterMap::load(const String8& filename, - Format format, sp* outMap) { - outMap->clear(); - - Tokenizer* tokenizer; - status_t status = Tokenizer::open(filename, &tokenizer); - if (status) { - ALOGE("Error %d opening key character map file %s.", status, filename.string()); - } else { - status = load(tokenizer, format, outMap); - delete tokenizer; - } - return status; -} - -status_t KeyCharacterMap::loadContents(const String8& filename, const char* contents, - Format format, sp* outMap) { - outMap->clear(); - - Tokenizer* tokenizer; - status_t status = Tokenizer::fromContents(filename, contents, &tokenizer); - if (status) { - ALOGE("Error %d opening key character map.", status); - } else { - status = load(tokenizer, format, outMap); - delete tokenizer; - } - return status; -} - -status_t KeyCharacterMap::load(Tokenizer* tokenizer, - Format format, sp* outMap) { - status_t status = OK; - sp map = new KeyCharacterMap(); - if (!map.get()) { - ALOGE("Error allocating key character map."); - status = NO_MEMORY; - } else { -#if DEBUG_PARSER_PERFORMANCE - nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); -#endif - Parser parser(map.get(), tokenizer, format); - status = parser.parse(); -#if DEBUG_PARSER_PERFORMANCE - nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - ALOGD("Parsed key character map file '%s' %d lines in %0.3fms.", - tokenizer->getFilename().string(), tokenizer->getLineNumber(), - elapsedTime / 1000000.0); -#endif - if (!status) { - *outMap = map; - } - } - return status; -} - -sp KeyCharacterMap::combine(const sp& base, - const sp& overlay) { - if (overlay == NULL) { - return base; - } - if (base == NULL) { - return overlay; - } - - sp map = new KeyCharacterMap(*base.get()); - for (size_t i = 0; i < overlay->mKeys.size(); i++) { - int32_t keyCode = overlay->mKeys.keyAt(i); - Key* key = overlay->mKeys.valueAt(i); - ssize_t oldIndex = map->mKeys.indexOfKey(keyCode); - if (oldIndex >= 0) { - delete map->mKeys.valueAt(oldIndex); - map->mKeys.editValueAt(oldIndex) = new Key(*key); - } else { - map->mKeys.add(keyCode, new Key(*key)); - } - } - - for (size_t i = 0; i < overlay->mKeysByScanCode.size(); i++) { - map->mKeysByScanCode.replaceValueFor(overlay->mKeysByScanCode.keyAt(i), - overlay->mKeysByScanCode.valueAt(i)); - } - - for (size_t i = 0; i < overlay->mKeysByUsageCode.size(); i++) { - map->mKeysByUsageCode.replaceValueFor(overlay->mKeysByUsageCode.keyAt(i), - overlay->mKeysByUsageCode.valueAt(i)); - } - return map; -} - -sp KeyCharacterMap::empty() { - return sEmpty; -} - -int32_t KeyCharacterMap::getKeyboardType() const { - return mType; -} - -char16_t KeyCharacterMap::getDisplayLabel(int32_t keyCode) const { - char16_t result = 0; - const Key* key; - if (getKey(keyCode, &key)) { - result = key->label; - } -#if DEBUG_MAPPING - ALOGD("getDisplayLabel: keyCode=%d ~ Result %d.", keyCode, result); -#endif - return result; -} - -char16_t KeyCharacterMap::getNumber(int32_t keyCode) const { - char16_t result = 0; - const Key* key; - if (getKey(keyCode, &key)) { - result = key->number; - } -#if DEBUG_MAPPING - ALOGD("getNumber: keyCode=%d ~ Result %d.", keyCode, result); -#endif - return result; -} - -char16_t KeyCharacterMap::getCharacter(int32_t keyCode, int32_t metaState) const { - char16_t result = 0; - const Key* key; - const Behavior* behavior; - if (getKeyBehavior(keyCode, metaState, &key, &behavior)) { - result = behavior->character; - } -#if DEBUG_MAPPING - ALOGD("getCharacter: keyCode=%d, metaState=0x%08x ~ Result %d.", keyCode, metaState, result); -#endif - return result; -} - -bool KeyCharacterMap::getFallbackAction(int32_t keyCode, int32_t metaState, - FallbackAction* outFallbackAction) const { - outFallbackAction->keyCode = 0; - outFallbackAction->metaState = 0; - - bool result = false; - const Key* key; - const Behavior* behavior; - if (getKeyBehavior(keyCode, metaState, &key, &behavior)) { - if (behavior->fallbackKeyCode) { - outFallbackAction->keyCode = behavior->fallbackKeyCode; - outFallbackAction->metaState = metaState & ~behavior->metaState; - result = true; - } - } -#if DEBUG_MAPPING - ALOGD("getFallbackKeyCode: keyCode=%d, metaState=0x%08x ~ Result %s, " - "fallback keyCode=%d, fallback metaState=0x%08x.", - keyCode, metaState, result ? "true" : "false", - outFallbackAction->keyCode, outFallbackAction->metaState); -#endif - return result; -} - -char16_t KeyCharacterMap::getMatch(int32_t keyCode, const char16_t* chars, size_t numChars, - int32_t metaState) const { - char16_t result = 0; - const Key* key; - if (getKey(keyCode, &key)) { - // Try to find the most general behavior that maps to this character. - // For example, the base key behavior will usually be last in the list. - // However, if we find a perfect meta state match for one behavior then use that one. - for (const Behavior* behavior = key->firstBehavior; behavior; behavior = behavior->next) { - if (behavior->character) { - for (size_t i = 0; i < numChars; i++) { - if (behavior->character == chars[i]) { - result = behavior->character; - if ((behavior->metaState & metaState) == behavior->metaState) { - goto ExactMatch; - } - break; - } - } - } - } - ExactMatch: ; - } -#if DEBUG_MAPPING - ALOGD("getMatch: keyCode=%d, chars=[%s], metaState=0x%08x ~ Result %d.", - keyCode, toString(chars, numChars).string(), metaState, result); -#endif - return result; -} - -bool KeyCharacterMap::getEvents(int32_t deviceId, const char16_t* chars, size_t numChars, - Vector& outEvents) const { - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - - for (size_t i = 0; i < numChars; i++) { - int32_t keyCode, metaState; - char16_t ch = chars[i]; - if (!findKey(ch, &keyCode, &metaState)) { -#if DEBUG_MAPPING - ALOGD("getEvents: deviceId=%d, chars=[%s] ~ Failed to find mapping for character %d.", - deviceId, toString(chars, numChars).string(), ch); -#endif - return false; - } - - int32_t currentMetaState = 0; - addMetaKeys(outEvents, deviceId, metaState, true, now, ¤tMetaState); - addKey(outEvents, deviceId, keyCode, currentMetaState, true, now); - addKey(outEvents, deviceId, keyCode, currentMetaState, false, now); - addMetaKeys(outEvents, deviceId, metaState, false, now, ¤tMetaState); - } -#if DEBUG_MAPPING - ALOGD("getEvents: deviceId=%d, chars=[%s] ~ Generated %d events.", - deviceId, toString(chars, numChars).string(), int32_t(outEvents.size())); - for (size_t i = 0; i < outEvents.size(); i++) { - ALOGD(" Key: keyCode=%d, metaState=0x%08x, %s.", - outEvents[i].getKeyCode(), outEvents[i].getMetaState(), - outEvents[i].getAction() == AKEY_EVENT_ACTION_DOWN ? "down" : "up"); - } -#endif - return true; -} - -status_t KeyCharacterMap::mapKey(int32_t scanCode, int32_t usageCode, int32_t* outKeyCode) const { - if (usageCode) { - ssize_t index = mKeysByUsageCode.indexOfKey(usageCode); - if (index >= 0) { - *outKeyCode = mKeysByUsageCode.valueAt(index); -#if DEBUG_MAPPING - ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d.", - scanCode, usageCode, *outKeyCode); -#endif - return OK; - } - } - if (scanCode) { - ssize_t index = mKeysByScanCode.indexOfKey(scanCode); - if (index >= 0) { - *outKeyCode = mKeysByScanCode.valueAt(index); -#if DEBUG_MAPPING - ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d.", - scanCode, usageCode, *outKeyCode); -#endif - return OK; - } - } - -#if DEBUG_MAPPING - ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Failed.", scanCode, usageCode); -#endif - *outKeyCode = AKEYCODE_UNKNOWN; - return NAME_NOT_FOUND; -} - -void KeyCharacterMap::tryRemapKey(int32_t keyCode, int32_t metaState, - int32_t *outKeyCode, int32_t *outMetaState) const { - *outKeyCode = keyCode; - *outMetaState = metaState; - - const Key* key; - const Behavior* behavior; - if (getKeyBehavior(keyCode, metaState, &key, &behavior)) { - if (behavior->replacementKeyCode) { - *outKeyCode = behavior->replacementKeyCode; - int32_t newMetaState = metaState & ~behavior->metaState; - // Reset dependent meta states. - if (behavior->metaState & AMETA_ALT_ON) { - newMetaState &= ~(AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON); - } - if (behavior->metaState & (AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON)) { - newMetaState &= ~AMETA_ALT_ON; - } - if (behavior->metaState & AMETA_CTRL_ON) { - newMetaState &= ~(AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON); - } - if (behavior->metaState & (AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON)) { - newMetaState &= ~AMETA_CTRL_ON; - } - if (behavior->metaState & AMETA_SHIFT_ON) { - newMetaState &= ~(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_RIGHT_ON); - } - if (behavior->metaState & (AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_RIGHT_ON)) { - newMetaState &= ~AMETA_SHIFT_ON; - } - // ... and put universal bits back if needed - *outMetaState = normalizeMetaState(newMetaState); - } - } - -#if DEBUG_MAPPING - ALOGD("tryRemapKey: keyCode=%d, metaState=0x%08x ~ " - "replacement keyCode=%d, replacement metaState=0x%08x.", - keyCode, metaState, *outKeyCode, *outMetaState); -#endif -} - -bool KeyCharacterMap::getKey(int32_t keyCode, const Key** outKey) const { - ssize_t index = mKeys.indexOfKey(keyCode); - if (index >= 0) { - *outKey = mKeys.valueAt(index); - return true; - } - return false; -} - -bool KeyCharacterMap::getKeyBehavior(int32_t keyCode, int32_t metaState, - const Key** outKey, const Behavior** outBehavior) const { - const Key* key; - if (getKey(keyCode, &key)) { - const Behavior* behavior = key->firstBehavior; - while (behavior) { - if (matchesMetaState(metaState, behavior->metaState)) { - *outKey = key; - *outBehavior = behavior; - return true; - } - behavior = behavior->next; - } - } - return false; -} - -bool KeyCharacterMap::matchesMetaState(int32_t eventMetaState, int32_t behaviorMetaState) { - // Behavior must have at least the set of meta states specified. - // And if the key event has CTRL, ALT or META then the behavior must exactly - // match those, taking into account that a behavior can specify that it handles - // one, both or either of a left/right modifier pair. - if ((eventMetaState & behaviorMetaState) == behaviorMetaState) { - const int32_t EXACT_META_STATES = - AMETA_CTRL_ON | AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON - | AMETA_ALT_ON | AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON - | AMETA_META_ON | AMETA_META_LEFT_ON | AMETA_META_RIGHT_ON; - int32_t unmatchedMetaState = eventMetaState & ~behaviorMetaState & EXACT_META_STATES; - if (behaviorMetaState & AMETA_CTRL_ON) { - unmatchedMetaState &= ~(AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON); - } else if (behaviorMetaState & (AMETA_CTRL_LEFT_ON | AMETA_CTRL_RIGHT_ON)) { - unmatchedMetaState &= ~AMETA_CTRL_ON; - } - if (behaviorMetaState & AMETA_ALT_ON) { - unmatchedMetaState &= ~(AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON); - } else if (behaviorMetaState & (AMETA_ALT_LEFT_ON | AMETA_ALT_RIGHT_ON)) { - unmatchedMetaState &= ~AMETA_ALT_ON; - } - if (behaviorMetaState & AMETA_META_ON) { - unmatchedMetaState &= ~(AMETA_META_LEFT_ON | AMETA_META_RIGHT_ON); - } else if (behaviorMetaState & (AMETA_META_LEFT_ON | AMETA_META_RIGHT_ON)) { - unmatchedMetaState &= ~AMETA_META_ON; - } - return !unmatchedMetaState; - } - return false; -} - -bool KeyCharacterMap::findKey(char16_t ch, int32_t* outKeyCode, int32_t* outMetaState) const { - if (!ch) { - return false; - } - - for (size_t i = 0; i < mKeys.size(); i++) { - const Key* key = mKeys.valueAt(i); - - // Try to find the most general behavior that maps to this character. - // For example, the base key behavior will usually be last in the list. - const Behavior* found = NULL; - for (const Behavior* behavior = key->firstBehavior; behavior; behavior = behavior->next) { - if (behavior->character == ch) { - found = behavior; - } - } - if (found) { - *outKeyCode = mKeys.keyAt(i); - *outMetaState = found->metaState; - return true; - } - } - return false; -} - -void KeyCharacterMap::addKey(Vector& outEvents, - int32_t deviceId, int32_t keyCode, int32_t metaState, bool down, nsecs_t time) { - outEvents.push(); - KeyEvent& event = outEvents.editTop(); - event.initialize(deviceId, AINPUT_SOURCE_KEYBOARD, - down ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, - 0, keyCode, 0, metaState, 0, time, time); -} - -void KeyCharacterMap::addMetaKeys(Vector& outEvents, - int32_t deviceId, int32_t metaState, bool down, nsecs_t time, - int32_t* currentMetaState) { - // Add and remove meta keys symmetrically. - if (down) { - addLockedMetaKey(outEvents, deviceId, metaState, time, - AKEYCODE_CAPS_LOCK, AMETA_CAPS_LOCK_ON, currentMetaState); - addLockedMetaKey(outEvents, deviceId, metaState, time, - AKEYCODE_NUM_LOCK, AMETA_NUM_LOCK_ON, currentMetaState); - addLockedMetaKey(outEvents, deviceId, metaState, time, - AKEYCODE_SCROLL_LOCK, AMETA_SCROLL_LOCK_ON, currentMetaState); - - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, true, time, - AKEYCODE_SHIFT_LEFT, AMETA_SHIFT_LEFT_ON, - AKEYCODE_SHIFT_RIGHT, AMETA_SHIFT_RIGHT_ON, - AMETA_SHIFT_ON, currentMetaState); - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, true, time, - AKEYCODE_ALT_LEFT, AMETA_ALT_LEFT_ON, - AKEYCODE_ALT_RIGHT, AMETA_ALT_RIGHT_ON, - AMETA_ALT_ON, currentMetaState); - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, true, time, - AKEYCODE_CTRL_LEFT, AMETA_CTRL_LEFT_ON, - AKEYCODE_CTRL_RIGHT, AMETA_CTRL_RIGHT_ON, - AMETA_CTRL_ON, currentMetaState); - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, true, time, - AKEYCODE_META_LEFT, AMETA_META_LEFT_ON, - AKEYCODE_META_RIGHT, AMETA_META_RIGHT_ON, - AMETA_META_ON, currentMetaState); - - addSingleEphemeralMetaKey(outEvents, deviceId, metaState, true, time, - AKEYCODE_SYM, AMETA_SYM_ON, currentMetaState); - addSingleEphemeralMetaKey(outEvents, deviceId, metaState, true, time, - AKEYCODE_FUNCTION, AMETA_FUNCTION_ON, currentMetaState); - } else { - addSingleEphemeralMetaKey(outEvents, deviceId, metaState, false, time, - AKEYCODE_FUNCTION, AMETA_FUNCTION_ON, currentMetaState); - addSingleEphemeralMetaKey(outEvents, deviceId, metaState, false, time, - AKEYCODE_SYM, AMETA_SYM_ON, currentMetaState); - - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, false, time, - AKEYCODE_META_LEFT, AMETA_META_LEFT_ON, - AKEYCODE_META_RIGHT, AMETA_META_RIGHT_ON, - AMETA_META_ON, currentMetaState); - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, false, time, - AKEYCODE_CTRL_LEFT, AMETA_CTRL_LEFT_ON, - AKEYCODE_CTRL_RIGHT, AMETA_CTRL_RIGHT_ON, - AMETA_CTRL_ON, currentMetaState); - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, false, time, - AKEYCODE_ALT_LEFT, AMETA_ALT_LEFT_ON, - AKEYCODE_ALT_RIGHT, AMETA_ALT_RIGHT_ON, - AMETA_ALT_ON, currentMetaState); - addDoubleEphemeralMetaKey(outEvents, deviceId, metaState, false, time, - AKEYCODE_SHIFT_LEFT, AMETA_SHIFT_LEFT_ON, - AKEYCODE_SHIFT_RIGHT, AMETA_SHIFT_RIGHT_ON, - AMETA_SHIFT_ON, currentMetaState); - - addLockedMetaKey(outEvents, deviceId, metaState, time, - AKEYCODE_SCROLL_LOCK, AMETA_SCROLL_LOCK_ON, currentMetaState); - addLockedMetaKey(outEvents, deviceId, metaState, time, - AKEYCODE_NUM_LOCK, AMETA_NUM_LOCK_ON, currentMetaState); - addLockedMetaKey(outEvents, deviceId, metaState, time, - AKEYCODE_CAPS_LOCK, AMETA_CAPS_LOCK_ON, currentMetaState); - } -} - -bool KeyCharacterMap::addSingleEphemeralMetaKey(Vector& outEvents, - int32_t deviceId, int32_t metaState, bool down, nsecs_t time, - int32_t keyCode, int32_t keyMetaState, - int32_t* currentMetaState) { - if ((metaState & keyMetaState) == keyMetaState) { - *currentMetaState = updateMetaState(keyCode, down, *currentMetaState); - addKey(outEvents, deviceId, keyCode, *currentMetaState, down, time); - return true; - } - return false; -} - -void KeyCharacterMap::addDoubleEphemeralMetaKey(Vector& outEvents, - int32_t deviceId, int32_t metaState, bool down, nsecs_t time, - int32_t leftKeyCode, int32_t leftKeyMetaState, - int32_t rightKeyCode, int32_t rightKeyMetaState, - int32_t eitherKeyMetaState, - int32_t* currentMetaState) { - bool specific = false; - specific |= addSingleEphemeralMetaKey(outEvents, deviceId, metaState, down, time, - leftKeyCode, leftKeyMetaState, currentMetaState); - specific |= addSingleEphemeralMetaKey(outEvents, deviceId, metaState, down, time, - rightKeyCode, rightKeyMetaState, currentMetaState); - - if (!specific) { - addSingleEphemeralMetaKey(outEvents, deviceId, metaState, down, time, - leftKeyCode, eitherKeyMetaState, currentMetaState); - } -} - -void KeyCharacterMap::addLockedMetaKey(Vector& outEvents, - int32_t deviceId, int32_t metaState, nsecs_t time, - int32_t keyCode, int32_t keyMetaState, - int32_t* currentMetaState) { - if ((metaState & keyMetaState) == keyMetaState) { - *currentMetaState = updateMetaState(keyCode, true, *currentMetaState); - addKey(outEvents, deviceId, keyCode, *currentMetaState, true, time); - *currentMetaState = updateMetaState(keyCode, false, *currentMetaState); - addKey(outEvents, deviceId, keyCode, *currentMetaState, false, time); - } -} - -#if HAVE_ANDROID_OS -sp KeyCharacterMap::readFromParcel(Parcel* parcel) { - sp map = new KeyCharacterMap(); - map->mType = parcel->readInt32(); - size_t numKeys = parcel->readInt32(); - if (parcel->errorCheck()) { - return NULL; - } - - for (size_t i = 0; i < numKeys; i++) { - int32_t keyCode = parcel->readInt32(); - char16_t label = parcel->readInt32(); - char16_t number = parcel->readInt32(); - if (parcel->errorCheck()) { - return NULL; - } - - Key* key = new Key(); - key->label = label; - key->number = number; - map->mKeys.add(keyCode, key); - - Behavior* lastBehavior = NULL; - while (parcel->readInt32()) { - int32_t metaState = parcel->readInt32(); - char16_t character = parcel->readInt32(); - int32_t fallbackKeyCode = parcel->readInt32(); - int32_t replacementKeyCode = parcel->readInt32(); - if (parcel->errorCheck()) { - return NULL; - } - - Behavior* behavior = new Behavior(); - behavior->metaState = metaState; - behavior->character = character; - behavior->fallbackKeyCode = fallbackKeyCode; - behavior->replacementKeyCode = replacementKeyCode; - if (lastBehavior) { - lastBehavior->next = behavior; - } else { - key->firstBehavior = behavior; - } - lastBehavior = behavior; - } - - if (parcel->errorCheck()) { - return NULL; - } - } - return map; -} - -void KeyCharacterMap::writeToParcel(Parcel* parcel) const { - parcel->writeInt32(mType); - - size_t numKeys = mKeys.size(); - parcel->writeInt32(numKeys); - for (size_t i = 0; i < numKeys; i++) { - int32_t keyCode = mKeys.keyAt(i); - const Key* key = mKeys.valueAt(i); - parcel->writeInt32(keyCode); - parcel->writeInt32(key->label); - parcel->writeInt32(key->number); - for (const Behavior* behavior = key->firstBehavior; behavior != NULL; - behavior = behavior->next) { - parcel->writeInt32(1); - parcel->writeInt32(behavior->metaState); - parcel->writeInt32(behavior->character); - parcel->writeInt32(behavior->fallbackKeyCode); - parcel->writeInt32(behavior->replacementKeyCode); - } - parcel->writeInt32(0); - } -} -#endif - - -// --- KeyCharacterMap::Key --- - -KeyCharacterMap::Key::Key() : - label(0), number(0), firstBehavior(NULL) { -} - -KeyCharacterMap::Key::Key(const Key& other) : - label(other.label), number(other.number), - firstBehavior(other.firstBehavior ? new Behavior(*other.firstBehavior) : NULL) { -} - -KeyCharacterMap::Key::~Key() { - Behavior* behavior = firstBehavior; - while (behavior) { - Behavior* next = behavior->next; - delete behavior; - behavior = next; - } -} - - -// --- KeyCharacterMap::Behavior --- - -KeyCharacterMap::Behavior::Behavior() : - next(NULL), metaState(0), character(0), fallbackKeyCode(0), replacementKeyCode(0) { -} - -KeyCharacterMap::Behavior::Behavior(const Behavior& other) : - next(other.next ? new Behavior(*other.next) : NULL), - metaState(other.metaState), character(other.character), - fallbackKeyCode(other.fallbackKeyCode), - replacementKeyCode(other.replacementKeyCode) { -} - - -// --- KeyCharacterMap::Parser --- - -KeyCharacterMap::Parser::Parser(KeyCharacterMap* map, Tokenizer* tokenizer, Format format) : - mMap(map), mTokenizer(tokenizer), mFormat(format), mState(STATE_TOP) { -} - -KeyCharacterMap::Parser::~Parser() { -} - -status_t KeyCharacterMap::Parser::parse() { - while (!mTokenizer->isEof()) { -#if DEBUG_PARSER - ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), - mTokenizer->peekRemainderOfLine().string()); -#endif - - mTokenizer->skipDelimiters(WHITESPACE); - - if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { - switch (mState) { - case STATE_TOP: { - String8 keywordToken = mTokenizer->nextToken(WHITESPACE); - if (keywordToken == "type") { - mTokenizer->skipDelimiters(WHITESPACE); - status_t status = parseType(); - if (status) return status; - } else if (keywordToken == "map") { - mTokenizer->skipDelimiters(WHITESPACE); - status_t status = parseMap(); - if (status) return status; - } else if (keywordToken == "key") { - mTokenizer->skipDelimiters(WHITESPACE); - status_t status = parseKey(); - if (status) return status; - } else { - ALOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(), - keywordToken.string()); - return BAD_VALUE; - } - break; - } - - case STATE_KEY: { - status_t status = parseKeyProperty(); - if (status) return status; - break; - } - } - - mTokenizer->skipDelimiters(WHITESPACE); - if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { - ALOGE("%s: Expected end of line or trailing comment, got '%s'.", - mTokenizer->getLocation().string(), - mTokenizer->peekRemainderOfLine().string()); - return BAD_VALUE; - } - } - - mTokenizer->nextLine(); - } - - if (mState != STATE_TOP) { - ALOGE("%s: Unterminated key description at end of file.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - - if (mMap->mType == KEYBOARD_TYPE_UNKNOWN) { - ALOGE("%s: Keyboard layout missing required keyboard 'type' declaration.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - - if (mFormat == FORMAT_BASE) { - if (mMap->mType == KEYBOARD_TYPE_OVERLAY) { - ALOGE("%s: Base keyboard layout must specify a keyboard 'type' other than 'OVERLAY'.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - } else if (mFormat == FORMAT_OVERLAY) { - if (mMap->mType != KEYBOARD_TYPE_OVERLAY) { - ALOGE("%s: Overlay keyboard layout missing required keyboard " - "'type OVERLAY' declaration.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - } - - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::parseType() { - if (mMap->mType != KEYBOARD_TYPE_UNKNOWN) { - ALOGE("%s: Duplicate keyboard 'type' declaration.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - - KeyboardType type; - String8 typeToken = mTokenizer->nextToken(WHITESPACE); - if (typeToken == "NUMERIC") { - type = KEYBOARD_TYPE_NUMERIC; - } else if (typeToken == "PREDICTIVE") { - type = KEYBOARD_TYPE_PREDICTIVE; - } else if (typeToken == "ALPHA") { - type = KEYBOARD_TYPE_ALPHA; - } else if (typeToken == "FULL") { - type = KEYBOARD_TYPE_FULL; - } else if (typeToken == "SPECIAL_FUNCTION") { - type = KEYBOARD_TYPE_SPECIAL_FUNCTION; - } else if (typeToken == "OVERLAY") { - type = KEYBOARD_TYPE_OVERLAY; - } else { - ALOGE("%s: Expected keyboard type label, got '%s'.", mTokenizer->getLocation().string(), - typeToken.string()); - return BAD_VALUE; - } - -#if DEBUG_PARSER - ALOGD("Parsed type: type=%d.", type); -#endif - mMap->mType = type; - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::parseMap() { - String8 keywordToken = mTokenizer->nextToken(WHITESPACE); - if (keywordToken == "key") { - mTokenizer->skipDelimiters(WHITESPACE); - return parseMapKey(); - } - ALOGE("%s: Expected keyword after 'map', got '%s'.", mTokenizer->getLocation().string(), - keywordToken.string()); - return BAD_VALUE; -} - -status_t KeyCharacterMap::Parser::parseMapKey() { - String8 codeToken = mTokenizer->nextToken(WHITESPACE); - bool mapUsage = false; - if (codeToken == "usage") { - mapUsage = true; - mTokenizer->skipDelimiters(WHITESPACE); - codeToken = mTokenizer->nextToken(WHITESPACE); - } - - char* end; - int32_t code = int32_t(strtol(codeToken.string(), &end, 0)); - if (*end) { - ALOGE("%s: Expected key %s number, got '%s'.", mTokenizer->getLocation().string(), - mapUsage ? "usage" : "scan code", codeToken.string()); - return BAD_VALUE; - } - KeyedVector& map = - mapUsage ? mMap->mKeysByUsageCode : mMap->mKeysByScanCode; - if (map.indexOfKey(code) >= 0) { - ALOGE("%s: Duplicate entry for key %s '%s'.", mTokenizer->getLocation().string(), - mapUsage ? "usage" : "scan code", codeToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE); - int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string()); - if (!keyCode) { - ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), - keyCodeToken.string()); - return BAD_VALUE; - } - -#if DEBUG_PARSER - ALOGD("Parsed map key %s: code=%d, keyCode=%d.", - mapUsage ? "usage" : "scan code", code, keyCode); -#endif - map.add(code, keyCode); - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::parseKey() { - String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE); - int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string()); - if (!keyCode) { - ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), - keyCodeToken.string()); - return BAD_VALUE; - } - if (mMap->mKeys.indexOfKey(keyCode) >= 0) { - ALOGE("%s: Duplicate entry for key code '%s'.", mTokenizer->getLocation().string(), - keyCodeToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - String8 openBraceToken = mTokenizer->nextToken(WHITESPACE); - if (openBraceToken != "{") { - ALOGE("%s: Expected '{' after key code label, got '%s'.", - mTokenizer->getLocation().string(), openBraceToken.string()); - return BAD_VALUE; - } - -#if DEBUG_PARSER - ALOGD("Parsed beginning of key: keyCode=%d.", keyCode); -#endif - mKeyCode = keyCode; - mMap->mKeys.add(keyCode, new Key()); - mState = STATE_KEY; - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::parseKeyProperty() { - Key* key = mMap->mKeys.valueFor(mKeyCode); - String8 token = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); - if (token == "}") { - mState = STATE_TOP; - return finishKey(key); - } - - Vector properties; - - // Parse all comma-delimited property names up to the first colon. - for (;;) { - if (token == "label") { - properties.add(Property(PROPERTY_LABEL)); - } else if (token == "number") { - properties.add(Property(PROPERTY_NUMBER)); - } else { - int32_t metaState; - status_t status = parseModifier(token, &metaState); - if (status) { - ALOGE("%s: Expected a property name or modifier, got '%s'.", - mTokenizer->getLocation().string(), token.string()); - return status; - } - properties.add(Property(PROPERTY_META, metaState)); - } - - mTokenizer->skipDelimiters(WHITESPACE); - if (!mTokenizer->isEol()) { - char ch = mTokenizer->nextChar(); - if (ch == ':') { - break; - } else if (ch == ',') { - mTokenizer->skipDelimiters(WHITESPACE); - token = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); - continue; - } - } - - ALOGE("%s: Expected ',' or ':' after property name.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - - // Parse behavior after the colon. - mTokenizer->skipDelimiters(WHITESPACE); - - Behavior behavior; - bool haveCharacter = false; - bool haveFallback = false; - bool haveReplacement = false; - - do { - char ch = mTokenizer->peekChar(); - if (ch == '\'') { - char16_t character; - status_t status = parseCharacterLiteral(&character); - if (status || !character) { - ALOGE("%s: Invalid character literal for key.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - if (haveCharacter) { - ALOGE("%s: Cannot combine multiple character literals or 'none'.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - if (haveReplacement) { - ALOGE("%s: Cannot combine character literal with replace action.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - behavior.character = character; - haveCharacter = true; - } else { - token = mTokenizer->nextToken(WHITESPACE); - if (token == "none") { - if (haveCharacter) { - ALOGE("%s: Cannot combine multiple character literals or 'none'.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - if (haveReplacement) { - ALOGE("%s: Cannot combine 'none' with replace action.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - haveCharacter = true; - } else if (token == "fallback") { - mTokenizer->skipDelimiters(WHITESPACE); - token = mTokenizer->nextToken(WHITESPACE); - int32_t keyCode = getKeyCodeByLabel(token.string()); - if (!keyCode) { - ALOGE("%s: Invalid key code label for fallback behavior, got '%s'.", - mTokenizer->getLocation().string(), - token.string()); - return BAD_VALUE; - } - if (haveFallback || haveReplacement) { - ALOGE("%s: Cannot combine multiple fallback/replacement key codes.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - behavior.fallbackKeyCode = keyCode; - haveFallback = true; - } else if (token == "replace") { - mTokenizer->skipDelimiters(WHITESPACE); - token = mTokenizer->nextToken(WHITESPACE); - int32_t keyCode = getKeyCodeByLabel(token.string()); - if (!keyCode) { - ALOGE("%s: Invalid key code label for replace, got '%s'.", - mTokenizer->getLocation().string(), - token.string()); - return BAD_VALUE; - } - if (haveCharacter) { - ALOGE("%s: Cannot combine character literal with replace action.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - if (haveFallback || haveReplacement) { - ALOGE("%s: Cannot combine multiple fallback/replacement key codes.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - behavior.replacementKeyCode = keyCode; - haveReplacement = true; - - } else { - ALOGE("%s: Expected a key behavior after ':'.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - } - - mTokenizer->skipDelimiters(WHITESPACE); - } while (!mTokenizer->isEol() && mTokenizer->peekChar() != '#'); - - // Add the behavior. - for (size_t i = 0; i < properties.size(); i++) { - const Property& property = properties.itemAt(i); - switch (property.property) { - case PROPERTY_LABEL: - if (key->label) { - ALOGE("%s: Duplicate label for key.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - key->label = behavior.character; -#if DEBUG_PARSER - ALOGD("Parsed key label: keyCode=%d, label=%d.", mKeyCode, key->label); -#endif - break; - case PROPERTY_NUMBER: - if (key->number) { - ALOGE("%s: Duplicate number for key.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - key->number = behavior.character; -#if DEBUG_PARSER - ALOGD("Parsed key number: keyCode=%d, number=%d.", mKeyCode, key->number); -#endif - break; - case PROPERTY_META: { - for (Behavior* b = key->firstBehavior; b; b = b->next) { - if (b->metaState == property.metaState) { - ALOGE("%s: Duplicate key behavior for modifier.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - } - Behavior* newBehavior = new Behavior(behavior); - newBehavior->metaState = property.metaState; - newBehavior->next = key->firstBehavior; - key->firstBehavior = newBehavior; -#if DEBUG_PARSER - ALOGD("Parsed key meta: keyCode=%d, meta=0x%x, char=%d, fallback=%d replace=%d.", - mKeyCode, - newBehavior->metaState, newBehavior->character, - newBehavior->fallbackKeyCode, newBehavior->replacementKeyCode); -#endif - break; - } - } - } - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::finishKey(Key* key) { - // Fill in default number property. - if (!key->number) { - char16_t digit = 0; - char16_t symbol = 0; - for (Behavior* b = key->firstBehavior; b; b = b->next) { - char16_t ch = b->character; - if (ch) { - if (ch >= '0' && ch <= '9') { - digit = ch; - } else if (ch == '(' || ch == ')' || ch == '#' || ch == '*' - || ch == '-' || ch == '+' || ch == ',' || ch == '.' - || ch == '\'' || ch == ':' || ch == ';' || ch == '/') { - symbol = ch; - } - } - } - key->number = digit ? digit : symbol; - } - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::parseModifier(const String8& token, int32_t* outMetaState) { - if (token == "base") { - *outMetaState = 0; - return NO_ERROR; - } - - int32_t combinedMeta = 0; - - const char* str = token.string(); - const char* start = str; - for (const char* cur = str; ; cur++) { - char ch = *cur; - if (ch == '+' || ch == '\0') { - size_t len = cur - start; - int32_t metaState = 0; - for (size_t i = 0; i < sizeof(modifiers) / sizeof(Modifier); i++) { - if (strlen(modifiers[i].label) == len - && strncmp(modifiers[i].label, start, len) == 0) { - metaState = modifiers[i].metaState; - break; - } - } - if (!metaState) { - return BAD_VALUE; - } - if (combinedMeta & metaState) { - ALOGE("%s: Duplicate modifier combination '%s'.", - mTokenizer->getLocation().string(), token.string()); - return BAD_VALUE; - } - - combinedMeta |= metaState; - start = cur + 1; - - if (ch == '\0') { - break; - } - } - } - *outMetaState = combinedMeta; - return NO_ERROR; -} - -status_t KeyCharacterMap::Parser::parseCharacterLiteral(char16_t* outCharacter) { - char ch = mTokenizer->nextChar(); - if (ch != '\'') { - goto Error; - } - - ch = mTokenizer->nextChar(); - if (ch == '\\') { - // Escape sequence. - ch = mTokenizer->nextChar(); - if (ch == 'n') { - *outCharacter = '\n'; - } else if (ch == 't') { - *outCharacter = '\t'; - } else if (ch == '\\') { - *outCharacter = '\\'; - } else if (ch == '\'') { - *outCharacter = '\''; - } else if (ch == '"') { - *outCharacter = '"'; - } else if (ch == 'u') { - *outCharacter = 0; - for (int i = 0; i < 4; i++) { - ch = mTokenizer->nextChar(); - int digit; - if (ch >= '0' && ch <= '9') { - digit = ch - '0'; - } else if (ch >= 'A' && ch <= 'F') { - digit = ch - 'A' + 10; - } else if (ch >= 'a' && ch <= 'f') { - digit = ch - 'a' + 10; - } else { - goto Error; - } - *outCharacter = (*outCharacter << 4) | digit; - } - } else { - goto Error; - } - } else if (ch >= 32 && ch <= 126 && ch != '\'') { - // ASCII literal character. - *outCharacter = ch; - } else { - goto Error; - } - - ch = mTokenizer->nextChar(); - if (ch != '\'') { - goto Error; - } - - // Ensure that we consumed the entire token. - if (mTokenizer->nextToken(WHITESPACE).isEmpty()) { - return NO_ERROR; - } - -Error: - ALOGE("%s: Malformed character literal.", mTokenizer->getLocation().string()); - return BAD_VALUE; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/KeyLayoutMap.cpp android-platform-frameworks-native-21/libs/input/KeyLayoutMap.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/KeyLayoutMap.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/KeyLayoutMap.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,447 +0,0 @@ -/* - * Copyright (C) 2008 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. - */ - -#define LOG_TAG "KeyLayoutMap" - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -// Enables debug output for the parser. -#define DEBUG_PARSER 0 - -// Enables debug output for parser performance. -#define DEBUG_PARSER_PERFORMANCE 0 - -// Enables debug output for mapping. -#define DEBUG_MAPPING 0 - - -namespace android { - -static const char* WHITESPACE = " \t\r"; - -// --- KeyLayoutMap --- - -KeyLayoutMap::KeyLayoutMap() { -} - -KeyLayoutMap::~KeyLayoutMap() { -} - -status_t KeyLayoutMap::load(const String8& filename, sp* outMap) { - outMap->clear(); - - Tokenizer* tokenizer; - status_t status = Tokenizer::open(filename, &tokenizer); - if (status) { - ALOGE("Error %d opening key layout map file %s.", status, filename.string()); - } else { - sp map = new KeyLayoutMap(); - if (!map.get()) { - ALOGE("Error allocating key layout map."); - status = NO_MEMORY; - } else { -#if DEBUG_PARSER_PERFORMANCE - nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); -#endif - Parser parser(map.get(), tokenizer); - status = parser.parse(); -#if DEBUG_PARSER_PERFORMANCE - nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - ALOGD("Parsed key layout map file '%s' %d lines in %0.3fms.", - tokenizer->getFilename().string(), tokenizer->getLineNumber(), - elapsedTime / 1000000.0); -#endif - if (!status) { - *outMap = map; - } - } - delete tokenizer; - } - return status; -} - -status_t KeyLayoutMap::mapKey(int32_t scanCode, int32_t usageCode, - int32_t* outKeyCode, uint32_t* outFlags) const { - const Key* key = getKey(scanCode, usageCode); - if (!key) { -#if DEBUG_MAPPING - ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Failed.", scanCode, usageCode); -#endif - *outKeyCode = AKEYCODE_UNKNOWN; - *outFlags = 0; - return NAME_NOT_FOUND; - } - - *outKeyCode = key->keyCode; - *outFlags = key->flags; - -#if DEBUG_MAPPING - ALOGD("mapKey: scanCode=%d, usageCode=0x%08x ~ Result keyCode=%d, outFlags=0x%08x.", - scanCode, usageCode, *outKeyCode, *outFlags); -#endif - return NO_ERROR; -} - -const KeyLayoutMap::Key* KeyLayoutMap::getKey(int32_t scanCode, int32_t usageCode) const { - if (usageCode) { - ssize_t index = mKeysByUsageCode.indexOfKey(usageCode); - if (index >= 0) { - return &mKeysByUsageCode.valueAt(index); - } - } - if (scanCode) { - ssize_t index = mKeysByScanCode.indexOfKey(scanCode); - if (index >= 0) { - return &mKeysByScanCode.valueAt(index); - } - } - return NULL; -} - -status_t KeyLayoutMap::findScanCodesForKey(int32_t keyCode, Vector* outScanCodes) const { - const size_t N = mKeysByScanCode.size(); - for (size_t i=0; iadd(mKeysByScanCode.keyAt(i)); - } - } - return NO_ERROR; -} - -status_t KeyLayoutMap::mapAxis(int32_t scanCode, AxisInfo* outAxisInfo) const { - ssize_t index = mAxes.indexOfKey(scanCode); - if (index < 0) { -#if DEBUG_MAPPING - ALOGD("mapAxis: scanCode=%d ~ Failed.", scanCode); -#endif - return NAME_NOT_FOUND; - } - - *outAxisInfo = mAxes.valueAt(index); - -#if DEBUG_MAPPING - ALOGD("mapAxis: scanCode=%d ~ Result mode=%d, axis=%d, highAxis=%d, " - "splitValue=%d, flatOverride=%d.", - scanCode, - outAxisInfo->mode, outAxisInfo->axis, outAxisInfo->highAxis, - outAxisInfo->splitValue, outAxisInfo->flatOverride); -#endif - return NO_ERROR; -} - -status_t KeyLayoutMap::findScanCodeForLed(int32_t ledCode, int32_t* outScanCode) const { - const size_t N = mLedsByScanCode.size(); - for (size_t i = 0; i < N; i++) { - if (mLedsByScanCode.valueAt(i).ledCode == ledCode) { - *outScanCode = mLedsByScanCode.keyAt(i); -#if DEBUG_MAPPING - ALOGD("findScanCodeForLed: ledCode=%d, scanCode=%d.", ledCode, *outScanCode); -#endif - return NO_ERROR; - } - } -#if DEBUG_MAPPING - ALOGD("findScanCodeForLed: ledCode=%d ~ Not found.", ledCode); -#endif - return NAME_NOT_FOUND; -} - -status_t KeyLayoutMap::findUsageCodeForLed(int32_t ledCode, int32_t* outUsageCode) const { - const size_t N = mLedsByUsageCode.size(); - for (size_t i = 0; i < N; i++) { - if (mLedsByUsageCode.valueAt(i).ledCode == ledCode) { - *outUsageCode = mLedsByUsageCode.keyAt(i); -#if DEBUG_MAPPING - ALOGD("findUsageForLed: ledCode=%d, usage=%x.", ledCode, *outUsageCode); -#endif - return NO_ERROR; - } - } -#if DEBUG_MAPPING - ALOGD("findUsageForLed: ledCode=%d ~ Not found.", ledCode); -#endif - return NAME_NOT_FOUND; -} - - -// --- KeyLayoutMap::Parser --- - -KeyLayoutMap::Parser::Parser(KeyLayoutMap* map, Tokenizer* tokenizer) : - mMap(map), mTokenizer(tokenizer) { -} - -KeyLayoutMap::Parser::~Parser() { -} - -status_t KeyLayoutMap::Parser::parse() { - while (!mTokenizer->isEof()) { -#if DEBUG_PARSER - ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), - mTokenizer->peekRemainderOfLine().string()); -#endif - - mTokenizer->skipDelimiters(WHITESPACE); - - if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { - String8 keywordToken = mTokenizer->nextToken(WHITESPACE); - if (keywordToken == "key") { - mTokenizer->skipDelimiters(WHITESPACE); - status_t status = parseKey(); - if (status) return status; - } else if (keywordToken == "axis") { - mTokenizer->skipDelimiters(WHITESPACE); - status_t status = parseAxis(); - if (status) return status; - } else if (keywordToken == "led") { - mTokenizer->skipDelimiters(WHITESPACE); - status_t status = parseLed(); - if (status) return status; - } else { - ALOGE("%s: Expected keyword, got '%s'.", mTokenizer->getLocation().string(), - keywordToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { - ALOGE("%s: Expected end of line or trailing comment, got '%s'.", - mTokenizer->getLocation().string(), - mTokenizer->peekRemainderOfLine().string()); - return BAD_VALUE; - } - } - - mTokenizer->nextLine(); - } - return NO_ERROR; -} - -status_t KeyLayoutMap::Parser::parseKey() { - String8 codeToken = mTokenizer->nextToken(WHITESPACE); - bool mapUsage = false; - if (codeToken == "usage") { - mapUsage = true; - mTokenizer->skipDelimiters(WHITESPACE); - codeToken = mTokenizer->nextToken(WHITESPACE); - } - - char* end; - int32_t code = int32_t(strtol(codeToken.string(), &end, 0)); - if (*end) { - ALOGE("%s: Expected key %s number, got '%s'.", mTokenizer->getLocation().string(), - mapUsage ? "usage" : "scan code", codeToken.string()); - return BAD_VALUE; - } - KeyedVector& map = mapUsage ? mMap->mKeysByUsageCode : mMap->mKeysByScanCode; - if (map.indexOfKey(code) >= 0) { - ALOGE("%s: Duplicate entry for key %s '%s'.", mTokenizer->getLocation().string(), - mapUsage ? "usage" : "scan code", codeToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - String8 keyCodeToken = mTokenizer->nextToken(WHITESPACE); - int32_t keyCode = getKeyCodeByLabel(keyCodeToken.string()); - if (!keyCode) { - ALOGE("%s: Expected key code label, got '%s'.", mTokenizer->getLocation().string(), - keyCodeToken.string()); - return BAD_VALUE; - } - - uint32_t flags = 0; - for (;;) { - mTokenizer->skipDelimiters(WHITESPACE); - if (mTokenizer->isEol() || mTokenizer->peekChar() == '#') break; - - String8 flagToken = mTokenizer->nextToken(WHITESPACE); - uint32_t flag = getKeyFlagByLabel(flagToken.string()); - if (!flag) { - ALOGE("%s: Expected key flag label, got '%s'.", mTokenizer->getLocation().string(), - flagToken.string()); - return BAD_VALUE; - } - if (flags & flag) { - ALOGE("%s: Duplicate key flag '%s'.", mTokenizer->getLocation().string(), - flagToken.string()); - return BAD_VALUE; - } - flags |= flag; - } - -#if DEBUG_PARSER - ALOGD("Parsed key %s: code=%d, keyCode=%d, flags=0x%08x.", - mapUsage ? "usage" : "scan code", code, keyCode, flags); -#endif - Key key; - key.keyCode = keyCode; - key.flags = flags; - map.add(code, key); - return NO_ERROR; -} - -status_t KeyLayoutMap::Parser::parseAxis() { - String8 scanCodeToken = mTokenizer->nextToken(WHITESPACE); - char* end; - int32_t scanCode = int32_t(strtol(scanCodeToken.string(), &end, 0)); - if (*end) { - ALOGE("%s: Expected axis scan code number, got '%s'.", mTokenizer->getLocation().string(), - scanCodeToken.string()); - return BAD_VALUE; - } - if (mMap->mAxes.indexOfKey(scanCode) >= 0) { - ALOGE("%s: Duplicate entry for axis scan code '%s'.", mTokenizer->getLocation().string(), - scanCodeToken.string()); - return BAD_VALUE; - } - - AxisInfo axisInfo; - - mTokenizer->skipDelimiters(WHITESPACE); - String8 token = mTokenizer->nextToken(WHITESPACE); - if (token == "invert") { - axisInfo.mode = AxisInfo::MODE_INVERT; - - mTokenizer->skipDelimiters(WHITESPACE); - String8 axisToken = mTokenizer->nextToken(WHITESPACE); - axisInfo.axis = getAxisByLabel(axisToken.string()); - if (axisInfo.axis < 0) { - ALOGE("%s: Expected inverted axis label, got '%s'.", - mTokenizer->getLocation().string(), axisToken.string()); - return BAD_VALUE; - } - } else if (token == "split") { - axisInfo.mode = AxisInfo::MODE_SPLIT; - - mTokenizer->skipDelimiters(WHITESPACE); - String8 splitToken = mTokenizer->nextToken(WHITESPACE); - axisInfo.splitValue = int32_t(strtol(splitToken.string(), &end, 0)); - if (*end) { - ALOGE("%s: Expected split value, got '%s'.", - mTokenizer->getLocation().string(), splitToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - String8 lowAxisToken = mTokenizer->nextToken(WHITESPACE); - axisInfo.axis = getAxisByLabel(lowAxisToken.string()); - if (axisInfo.axis < 0) { - ALOGE("%s: Expected low axis label, got '%s'.", - mTokenizer->getLocation().string(), lowAxisToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - String8 highAxisToken = mTokenizer->nextToken(WHITESPACE); - axisInfo.highAxis = getAxisByLabel(highAxisToken.string()); - if (axisInfo.highAxis < 0) { - ALOGE("%s: Expected high axis label, got '%s'.", - mTokenizer->getLocation().string(), highAxisToken.string()); - return BAD_VALUE; - } - } else { - axisInfo.axis = getAxisByLabel(token.string()); - if (axisInfo.axis < 0) { - ALOGE("%s: Expected axis label, 'split' or 'invert', got '%s'.", - mTokenizer->getLocation().string(), token.string()); - return BAD_VALUE; - } - } - - for (;;) { - mTokenizer->skipDelimiters(WHITESPACE); - if (mTokenizer->isEol() || mTokenizer->peekChar() == '#') { - break; - } - String8 keywordToken = mTokenizer->nextToken(WHITESPACE); - if (keywordToken == "flat") { - mTokenizer->skipDelimiters(WHITESPACE); - String8 flatToken = mTokenizer->nextToken(WHITESPACE); - axisInfo.flatOverride = int32_t(strtol(flatToken.string(), &end, 0)); - if (*end) { - ALOGE("%s: Expected flat value, got '%s'.", - mTokenizer->getLocation().string(), flatToken.string()); - return BAD_VALUE; - } - } else { - ALOGE("%s: Expected keyword 'flat', got '%s'.", - mTokenizer->getLocation().string(), keywordToken.string()); - return BAD_VALUE; - } - } - -#if DEBUG_PARSER - ALOGD("Parsed axis: scanCode=%d, mode=%d, axis=%d, highAxis=%d, " - "splitValue=%d, flatOverride=%d.", - scanCode, - axisInfo.mode, axisInfo.axis, axisInfo.highAxis, - axisInfo.splitValue, axisInfo.flatOverride); -#endif - mMap->mAxes.add(scanCode, axisInfo); - return NO_ERROR; -} - -status_t KeyLayoutMap::Parser::parseLed() { - String8 codeToken = mTokenizer->nextToken(WHITESPACE); - bool mapUsage = false; - if (codeToken == "usage") { - mapUsage = true; - mTokenizer->skipDelimiters(WHITESPACE); - codeToken = mTokenizer->nextToken(WHITESPACE); - } - char* end; - int32_t code = int32_t(strtol(codeToken.string(), &end, 0)); - if (*end) { - ALOGE("%s: Expected led %s number, got '%s'.", mTokenizer->getLocation().string(), - mapUsage ? "usage" : "scan code", codeToken.string()); - return BAD_VALUE; - } - - KeyedVector& map = mapUsage ? mMap->mLedsByUsageCode : mMap->mLedsByScanCode; - if (map.indexOfKey(code) >= 0) { - ALOGE("%s: Duplicate entry for led %s '%s'.", mTokenizer->getLocation().string(), - mapUsage ? "usage" : "scan code", codeToken.string()); - return BAD_VALUE; - } - - mTokenizer->skipDelimiters(WHITESPACE); - String8 ledCodeToken = mTokenizer->nextToken(WHITESPACE); - int32_t ledCode = getLedByLabel(ledCodeToken.string()); - if (ledCode < 0) { - ALOGE("%s: Expected LED code label, got '%s'.", mTokenizer->getLocation().string(), - ledCodeToken.string()); - return BAD_VALUE; - } - -#if DEBUG_PARSER - ALOGD("Parsed led %s: code=%d, ledCode=%d.", - mapUsage ? "usage" : "scan code", code, ledCode); -#endif - - Led led; - led.ledCode = ledCode; - map.add(code, led); - return NO_ERROR; -} -}; diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/tests/Android.mk android-platform-frameworks-native-21/libs/input/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/input/tests/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -# Build the unit tests. -LOCAL_PATH:= $(call my-dir) - -# Build the unit tests. -test_src_files := \ - InputChannel_test.cpp \ - InputEvent_test.cpp \ - InputPublisherAndConsumer_test.cpp - -shared_libraries := \ - libinput \ - libcutils \ - libutils \ - libbinder \ - libui \ - -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval include $(BUILD_NATIVE_TEST)) \ -) - -# NOTE: This is a compile time test, and does not need to be -# run. All assertions are static_asserts and will fail during -# buildtime if something's wrong. -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_SRC_FILES := StructLayout_test.cpp -LOCAL_MODULE := StructLayout_test -LOCAL_CFLAGS := -std=c++11 -O0 -LOCAL_MULTILIB := both -include $(BUILD_STATIC_LIBRARY) - - -# Build the manual test programs. -include $(call all-makefiles-under, $(LOCAL_PATH)) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/tests/InputChannel_test.cpp android-platform-frameworks-native-21/libs/input/tests/InputChannel_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/tests/InputChannel_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/tests/InputChannel_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,159 +0,0 @@ -/* - * Copyright (C) 2010 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 "TestHelpers.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace android { - -class InputChannelTest : public testing::Test { -protected: - virtual void SetUp() { } - virtual void TearDown() { } -}; - - -TEST_F(InputChannelTest, ConstructorAndDestructor_TakesOwnershipOfFileDescriptors) { - // Our purpose here is to verify that the input channel destructor closes the - // file descriptor provided to it. One easy way is to provide it with one end - // of a pipe and to check for EPIPE on the other end after the channel is destroyed. - Pipe pipe; - - sp inputChannel = new InputChannel(String8("channel name"), pipe.sendFd); - - EXPECT_STREQ("channel name", inputChannel->getName().string()) - << "channel should have provided name"; - EXPECT_EQ(pipe.sendFd, inputChannel->getFd()) - << "channel should have provided fd"; - - inputChannel.clear(); // destroys input channel - - EXPECT_EQ(-EPIPE, pipe.readSignal()) - << "channel should have closed fd when destroyed"; - - // clean up fds of Pipe endpoints that were closed so we don't try to close them again - pipe.sendFd = -1; -} - -TEST_F(InputChannelTest, OpenInputChannelPair_ReturnsAPairOfConnectedChannels) { - sp serverChannel, clientChannel; - - status_t result = InputChannel::openInputChannelPair(String8("channel name"), - serverChannel, clientChannel); - - ASSERT_EQ(OK, result) - << "should have successfully opened a channel pair"; - - // Name - EXPECT_STREQ("channel name (server)", serverChannel->getName().string()) - << "server channel should have suffixed name"; - EXPECT_STREQ("channel name (client)", clientChannel->getName().string()) - << "client channel should have suffixed name"; - - // Server->Client communication - InputMessage serverMsg; - memset(&serverMsg, 0, sizeof(InputMessage)); - serverMsg.header.type = InputMessage::TYPE_KEY; - serverMsg.body.key.action = AKEY_EVENT_ACTION_DOWN; - EXPECT_EQ(OK, serverChannel->sendMessage(&serverMsg)) - << "server channel should be able to send message to client channel"; - - InputMessage clientMsg; - EXPECT_EQ(OK, clientChannel->receiveMessage(&clientMsg)) - << "client channel should be able to receive message from server channel"; - EXPECT_EQ(serverMsg.header.type, clientMsg.header.type) - << "client channel should receive the correct message from server channel"; - EXPECT_EQ(serverMsg.body.key.action, clientMsg.body.key.action) - << "client channel should receive the correct message from server channel"; - - // Client->Server communication - InputMessage clientReply; - memset(&clientReply, 0, sizeof(InputMessage)); - clientReply.header.type = InputMessage::TYPE_FINISHED; - clientReply.body.finished.seq = 0x11223344; - clientReply.body.finished.handled = true; - EXPECT_EQ(OK, clientChannel->sendMessage(&clientReply)) - << "client channel should be able to send message to server channel"; - - InputMessage serverReply; - EXPECT_EQ(OK, serverChannel->receiveMessage(&serverReply)) - << "server channel should be able to receive message from client channel"; - EXPECT_EQ(clientReply.header.type, serverReply.header.type) - << "server channel should receive the correct message from client channel"; - EXPECT_EQ(clientReply.body.finished.seq, serverReply.body.finished.seq) - << "server channel should receive the correct message from client channel"; - EXPECT_EQ(clientReply.body.finished.handled, serverReply.body.finished.handled) - << "server channel should receive the correct message from client channel"; -} - -TEST_F(InputChannelTest, ReceiveSignal_WhenNoSignalPresent_ReturnsAnError) { - sp serverChannel, clientChannel; - - status_t result = InputChannel::openInputChannelPair(String8("channel name"), - serverChannel, clientChannel); - - ASSERT_EQ(OK, result) - << "should have successfully opened a channel pair"; - - InputMessage msg; - EXPECT_EQ(WOULD_BLOCK, clientChannel->receiveMessage(&msg)) - << "receiveMessage should have returned WOULD_BLOCK"; -} - -TEST_F(InputChannelTest, ReceiveSignal_WhenPeerClosed_ReturnsAnError) { - sp serverChannel, clientChannel; - - status_t result = InputChannel::openInputChannelPair(String8("channel name"), - serverChannel, clientChannel); - - ASSERT_EQ(OK, result) - << "should have successfully opened a channel pair"; - - serverChannel.clear(); // close server channel - - InputMessage msg; - EXPECT_EQ(DEAD_OBJECT, clientChannel->receiveMessage(&msg)) - << "receiveMessage should have returned DEAD_OBJECT"; -} - -TEST_F(InputChannelTest, SendSignal_WhenPeerClosed_ReturnsAnError) { - sp serverChannel, clientChannel; - - status_t result = InputChannel::openInputChannelPair(String8("channel name"), - serverChannel, clientChannel); - - ASSERT_EQ(OK, result) - << "should have successfully opened a channel pair"; - - serverChannel.clear(); // close server channel - - InputMessage msg; - msg.header.type = InputMessage::TYPE_KEY; - EXPECT_EQ(DEAD_OBJECT, clientChannel->sendMessage(&msg)) - << "sendMessage should have returned DEAD_OBJECT"; -} - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/tests/InputEvent_test.cpp android-platform-frameworks-native-21/libs/input/tests/InputEvent_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/tests/InputEvent_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/tests/InputEvent_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,594 +0,0 @@ -/* - * 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 - -#include -#include -#include - -namespace android { - -class BaseTest : public testing::Test { -protected: - virtual void SetUp() { } - virtual void TearDown() { } -}; - -// --- PointerCoordsTest --- - -class PointerCoordsTest : public BaseTest { -}; - -TEST_F(PointerCoordsTest, ClearSetsBitsToZero) { - PointerCoords coords; - coords.clear(); - - ASSERT_EQ(0ULL, coords.bits); -} - -TEST_F(PointerCoordsTest, AxisValues) { - float* valuePtr; - PointerCoords coords; - coords.clear(); - - // Check invariants when no axes are present. - ASSERT_EQ(0, coords.getAxisValue(0)) - << "getAxisValue should return zero because axis is not present"; - ASSERT_EQ(0, coords.getAxisValue(1)) - << "getAxisValue should return zero because axis is not present"; - - // Set first axis. - ASSERT_EQ(OK, coords.setAxisValue(1, 5)); - ASSERT_EQ(5, coords.values[0]); - ASSERT_EQ(0x4000000000000000ULL, coords.bits); - - ASSERT_EQ(0, coords.getAxisValue(0)) - << "getAxisValue should return zero because axis is not present"; - ASSERT_EQ(5, coords.getAxisValue(1)) - << "getAxisValue should return value of axis"; - - // Set an axis with a higher id than all others. (appending value at the end) - ASSERT_EQ(OK, coords.setAxisValue(3, 2)); - ASSERT_EQ(0x5000000000000000ULL, coords.bits); - ASSERT_EQ(5, coords.values[0]); - ASSERT_EQ(2, coords.values[1]); - - ASSERT_EQ(0, coords.getAxisValue(0)) - << "getAxisValue should return zero because axis is not present"; - ASSERT_EQ(5, coords.getAxisValue(1)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(0, coords.getAxisValue(2)) - << "getAxisValue should return zero because axis is not present"; - ASSERT_EQ(2, coords.getAxisValue(3)) - << "getAxisValue should return value of axis"; - - // Set an axis with an id lower than all others. (prepending value at beginning) - ASSERT_EQ(OK, coords.setAxisValue(0, 4)); - ASSERT_EQ(0xd000000000000000ULL, coords.bits); - ASSERT_EQ(4, coords.values[0]); - ASSERT_EQ(5, coords.values[1]); - ASSERT_EQ(2, coords.values[2]); - - ASSERT_EQ(4, coords.getAxisValue(0)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(5, coords.getAxisValue(1)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(0, coords.getAxisValue(2)) - << "getAxisValue should return zero because axis is not present"; - ASSERT_EQ(2, coords.getAxisValue(3)) - << "getAxisValue should return value of axis"; - - // Set an axis with an id between the others. (inserting value in the middle) - ASSERT_EQ(OK, coords.setAxisValue(2, 1)); - ASSERT_EQ(0xf000000000000000ULL, coords.bits); - ASSERT_EQ(4, coords.values[0]); - ASSERT_EQ(5, coords.values[1]); - ASSERT_EQ(1, coords.values[2]); - ASSERT_EQ(2, coords.values[3]); - - ASSERT_EQ(4, coords.getAxisValue(0)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(5, coords.getAxisValue(1)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(1, coords.getAxisValue(2)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(2, coords.getAxisValue(3)) - << "getAxisValue should return value of axis"; - - // Set an existing axis value in place. - ASSERT_EQ(OK, coords.setAxisValue(1, 6)); - ASSERT_EQ(0xf000000000000000ULL, coords.bits); - ASSERT_EQ(4, coords.values[0]); - ASSERT_EQ(6, coords.values[1]); - ASSERT_EQ(1, coords.values[2]); - ASSERT_EQ(2, coords.values[3]); - - ASSERT_EQ(4, coords.getAxisValue(0)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(6, coords.getAxisValue(1)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(1, coords.getAxisValue(2)) - << "getAxisValue should return value of axis"; - ASSERT_EQ(2, coords.getAxisValue(3)) - << "getAxisValue should return value of axis"; - - // Set maximum number of axes. - for (size_t axis = 4; axis < PointerCoords::MAX_AXES; axis++) { - ASSERT_EQ(OK, coords.setAxisValue(axis, axis)); - } - ASSERT_EQ(PointerCoords::MAX_AXES, __builtin_popcountll(coords.bits)); - - // Try to set one more axis beyond maximum number. - // Ensure bits are unchanged. - ASSERT_EQ(NO_MEMORY, coords.setAxisValue(PointerCoords::MAX_AXES, 100)); - ASSERT_EQ(PointerCoords::MAX_AXES, __builtin_popcountll(coords.bits)); -} - -TEST_F(PointerCoordsTest, Parcel) { - Parcel parcel; - - PointerCoords inCoords; - inCoords.clear(); - PointerCoords outCoords; - - // Round trip with empty coords. - inCoords.writeToParcel(&parcel); - parcel.setDataPosition(0); - outCoords.readFromParcel(&parcel); - - ASSERT_EQ(0ULL, outCoords.bits); - - // Round trip with some values. - parcel.freeData(); - inCoords.setAxisValue(2, 5); - inCoords.setAxisValue(5, 8); - - inCoords.writeToParcel(&parcel); - parcel.setDataPosition(0); - outCoords.readFromParcel(&parcel); - - ASSERT_EQ(outCoords.bits, inCoords.bits); - ASSERT_EQ(outCoords.values[0], inCoords.values[0]); - ASSERT_EQ(outCoords.values[1], inCoords.values[1]); -} - - -// --- KeyEventTest --- - -class KeyEventTest : public BaseTest { -}; - -TEST_F(KeyEventTest, Properties) { - KeyEvent event; - - // Initialize and get properties. - const nsecs_t ARBITRARY_DOWN_TIME = 1; - const nsecs_t ARBITRARY_EVENT_TIME = 2; - event.initialize(2, AINPUT_SOURCE_GAMEPAD, AKEY_EVENT_ACTION_DOWN, - AKEY_EVENT_FLAG_FROM_SYSTEM, AKEYCODE_BUTTON_X, 121, - AMETA_ALT_ON, 1, ARBITRARY_DOWN_TIME, ARBITRARY_EVENT_TIME); - - ASSERT_EQ(AINPUT_EVENT_TYPE_KEY, event.getType()); - ASSERT_EQ(2, event.getDeviceId()); - ASSERT_EQ(AINPUT_SOURCE_GAMEPAD, event.getSource()); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, event.getAction()); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, event.getFlags()); - ASSERT_EQ(AKEYCODE_BUTTON_X, event.getKeyCode()); - ASSERT_EQ(121, event.getScanCode()); - ASSERT_EQ(AMETA_ALT_ON, event.getMetaState()); - ASSERT_EQ(1, event.getRepeatCount()); - ASSERT_EQ(ARBITRARY_DOWN_TIME, event.getDownTime()); - ASSERT_EQ(ARBITRARY_EVENT_TIME, event.getEventTime()); - - // Set source. - event.setSource(AINPUT_SOURCE_JOYSTICK); - ASSERT_EQ(AINPUT_SOURCE_JOYSTICK, event.getSource()); -} - - -// --- MotionEventTest --- - -class MotionEventTest : public BaseTest { -protected: - static const nsecs_t ARBITRARY_DOWN_TIME; - static const nsecs_t ARBITRARY_EVENT_TIME; - static const float X_OFFSET; - static const float Y_OFFSET; - - void initializeEventWithHistory(MotionEvent* event); - void assertEqualsEventWithHistory(const MotionEvent* event); -}; - -const nsecs_t MotionEventTest::ARBITRARY_DOWN_TIME = 1; -const nsecs_t MotionEventTest::ARBITRARY_EVENT_TIME = 2; -const float MotionEventTest::X_OFFSET = 1.0f; -const float MotionEventTest::Y_OFFSET = 1.1f; - -void MotionEventTest::initializeEventWithHistory(MotionEvent* event) { - PointerProperties pointerProperties[2]; - pointerProperties[0].clear(); - pointerProperties[0].id = 1; - pointerProperties[0].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; - pointerProperties[1].clear(); - pointerProperties[1].id = 2; - pointerProperties[1].toolType = AMOTION_EVENT_TOOL_TYPE_STYLUS; - - PointerCoords pointerCoords[2]; - pointerCoords[0].clear(); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 10); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 11); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 12); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 13); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 14); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 15); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 16); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 17); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 18); - pointerCoords[1].clear(); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_X, 20); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_Y, 21); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 22); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 23); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 24); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 25); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 26); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 27); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 28); - event->initialize(2, AINPUT_SOURCE_TOUCHSCREEN, AMOTION_EVENT_ACTION_MOVE, 0, - AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED, - AMOTION_EVENT_EDGE_FLAG_TOP, AMETA_ALT_ON, AMOTION_EVENT_BUTTON_PRIMARY, - X_OFFSET, Y_OFFSET, 2.0f, 2.1f, - ARBITRARY_DOWN_TIME, ARBITRARY_EVENT_TIME, - 2, pointerProperties, pointerCoords); - - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 110); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 111); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 112); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 113); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 114); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 115); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 116); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 117); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 118); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_X, 120); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_Y, 121); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 122); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 123); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 124); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 125); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 126); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 127); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 128); - event->addSample(ARBITRARY_EVENT_TIME + 1, pointerCoords); - - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, 210); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, 211); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 212); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 213); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 214); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 215); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 216); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 217); - pointerCoords[0].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 218); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_X, 220); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_Y, 221); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 222); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 223); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 224); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 225); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 226); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, 227); - pointerCoords[1].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 228); - event->addSample(ARBITRARY_EVENT_TIME + 2, pointerCoords); -} - -void MotionEventTest::assertEqualsEventWithHistory(const MotionEvent* event) { - // Check properties. - ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event->getType()); - ASSERT_EQ(2, event->getDeviceId()); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, event->getSource()); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, event->getAction()); - ASSERT_EQ(AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED, event->getFlags()); - ASSERT_EQ(AMOTION_EVENT_EDGE_FLAG_TOP, event->getEdgeFlags()); - ASSERT_EQ(AMETA_ALT_ON, event->getMetaState()); - ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, event->getButtonState()); - ASSERT_EQ(X_OFFSET, event->getXOffset()); - ASSERT_EQ(Y_OFFSET, event->getYOffset()); - ASSERT_EQ(2.0f, event->getXPrecision()); - ASSERT_EQ(2.1f, event->getYPrecision()); - ASSERT_EQ(ARBITRARY_DOWN_TIME, event->getDownTime()); - - ASSERT_EQ(2U, event->getPointerCount()); - ASSERT_EQ(1, event->getPointerId(0)); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, event->getToolType(0)); - ASSERT_EQ(2, event->getPointerId(1)); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, event->getToolType(1)); - - ASSERT_EQ(2U, event->getHistorySize()); - - // Check data. - ASSERT_EQ(ARBITRARY_EVENT_TIME, event->getHistoricalEventTime(0)); - ASSERT_EQ(ARBITRARY_EVENT_TIME + 1, event->getHistoricalEventTime(1)); - ASSERT_EQ(ARBITRARY_EVENT_TIME + 2, event->getEventTime()); - - ASSERT_EQ(11, event->getHistoricalRawPointerCoords(0, 0)-> - getAxisValue(AMOTION_EVENT_AXIS_Y)); - ASSERT_EQ(21, event->getHistoricalRawPointerCoords(1, 0)-> - getAxisValue(AMOTION_EVENT_AXIS_Y)); - ASSERT_EQ(111, event->getHistoricalRawPointerCoords(0, 1)-> - getAxisValue(AMOTION_EVENT_AXIS_Y)); - ASSERT_EQ(121, event->getHistoricalRawPointerCoords(1, 1)-> - getAxisValue(AMOTION_EVENT_AXIS_Y)); - ASSERT_EQ(211, event->getRawPointerCoords(0)-> - getAxisValue(AMOTION_EVENT_AXIS_Y)); - ASSERT_EQ(221, event->getRawPointerCoords(1)-> - getAxisValue(AMOTION_EVENT_AXIS_Y)); - - ASSERT_EQ(11, event->getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 0, 0)); - ASSERT_EQ(21, event->getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 1, 0)); - ASSERT_EQ(111, event->getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 0, 1)); - ASSERT_EQ(121, event->getHistoricalRawAxisValue(AMOTION_EVENT_AXIS_Y, 1, 1)); - ASSERT_EQ(211, event->getRawAxisValue(AMOTION_EVENT_AXIS_Y, 0)); - ASSERT_EQ(221, event->getRawAxisValue(AMOTION_EVENT_AXIS_Y, 1)); - - ASSERT_EQ(10, event->getHistoricalRawX(0, 0)); - ASSERT_EQ(20, event->getHistoricalRawX(1, 0)); - ASSERT_EQ(110, event->getHistoricalRawX(0, 1)); - ASSERT_EQ(120, event->getHistoricalRawX(1, 1)); - ASSERT_EQ(210, event->getRawX(0)); - ASSERT_EQ(220, event->getRawX(1)); - - ASSERT_EQ(11, event->getHistoricalRawY(0, 0)); - ASSERT_EQ(21, event->getHistoricalRawY(1, 0)); - ASSERT_EQ(111, event->getHistoricalRawY(0, 1)); - ASSERT_EQ(121, event->getHistoricalRawY(1, 1)); - ASSERT_EQ(211, event->getRawY(0)); - ASSERT_EQ(221, event->getRawY(1)); - - ASSERT_EQ(X_OFFSET + 10, event->getHistoricalX(0, 0)); - ASSERT_EQ(X_OFFSET + 20, event->getHistoricalX(1, 0)); - ASSERT_EQ(X_OFFSET + 110, event->getHistoricalX(0, 1)); - ASSERT_EQ(X_OFFSET + 120, event->getHistoricalX(1, 1)); - ASSERT_EQ(X_OFFSET + 210, event->getX(0)); - ASSERT_EQ(X_OFFSET + 220, event->getX(1)); - - ASSERT_EQ(Y_OFFSET + 11, event->getHistoricalY(0, 0)); - ASSERT_EQ(Y_OFFSET + 21, event->getHistoricalY(1, 0)); - ASSERT_EQ(Y_OFFSET + 111, event->getHistoricalY(0, 1)); - ASSERT_EQ(Y_OFFSET + 121, event->getHistoricalY(1, 1)); - ASSERT_EQ(Y_OFFSET + 211, event->getY(0)); - ASSERT_EQ(Y_OFFSET + 221, event->getY(1)); - - ASSERT_EQ(12, event->getHistoricalPressure(0, 0)); - ASSERT_EQ(22, event->getHistoricalPressure(1, 0)); - ASSERT_EQ(112, event->getHistoricalPressure(0, 1)); - ASSERT_EQ(122, event->getHistoricalPressure(1, 1)); - ASSERT_EQ(212, event->getPressure(0)); - ASSERT_EQ(222, event->getPressure(1)); - - ASSERT_EQ(13, event->getHistoricalSize(0, 0)); - ASSERT_EQ(23, event->getHistoricalSize(1, 0)); - ASSERT_EQ(113, event->getHistoricalSize(0, 1)); - ASSERT_EQ(123, event->getHistoricalSize(1, 1)); - ASSERT_EQ(213, event->getSize(0)); - ASSERT_EQ(223, event->getSize(1)); - - ASSERT_EQ(14, event->getHistoricalTouchMajor(0, 0)); - ASSERT_EQ(24, event->getHistoricalTouchMajor(1, 0)); - ASSERT_EQ(114, event->getHistoricalTouchMajor(0, 1)); - ASSERT_EQ(124, event->getHistoricalTouchMajor(1, 1)); - ASSERT_EQ(214, event->getTouchMajor(0)); - ASSERT_EQ(224, event->getTouchMajor(1)); - - ASSERT_EQ(15, event->getHistoricalTouchMinor(0, 0)); - ASSERT_EQ(25, event->getHistoricalTouchMinor(1, 0)); - ASSERT_EQ(115, event->getHistoricalTouchMinor(0, 1)); - ASSERT_EQ(125, event->getHistoricalTouchMinor(1, 1)); - ASSERT_EQ(215, event->getTouchMinor(0)); - ASSERT_EQ(225, event->getTouchMinor(1)); - - ASSERT_EQ(16, event->getHistoricalToolMajor(0, 0)); - ASSERT_EQ(26, event->getHistoricalToolMajor(1, 0)); - ASSERT_EQ(116, event->getHistoricalToolMajor(0, 1)); - ASSERT_EQ(126, event->getHistoricalToolMajor(1, 1)); - ASSERT_EQ(216, event->getToolMajor(0)); - ASSERT_EQ(226, event->getToolMajor(1)); - - ASSERT_EQ(17, event->getHistoricalToolMinor(0, 0)); - ASSERT_EQ(27, event->getHistoricalToolMinor(1, 0)); - ASSERT_EQ(117, event->getHistoricalToolMinor(0, 1)); - ASSERT_EQ(127, event->getHistoricalToolMinor(1, 1)); - ASSERT_EQ(217, event->getToolMinor(0)); - ASSERT_EQ(227, event->getToolMinor(1)); - - ASSERT_EQ(18, event->getHistoricalOrientation(0, 0)); - ASSERT_EQ(28, event->getHistoricalOrientation(1, 0)); - ASSERT_EQ(118, event->getHistoricalOrientation(0, 1)); - ASSERT_EQ(128, event->getHistoricalOrientation(1, 1)); - ASSERT_EQ(218, event->getOrientation(0)); - ASSERT_EQ(228, event->getOrientation(1)); -} - -TEST_F(MotionEventTest, Properties) { - MotionEvent event; - - // Initialize, add samples and check properties. - initializeEventWithHistory(&event); - ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&event)); - - // Set source. - event.setSource(AINPUT_SOURCE_JOYSTICK); - ASSERT_EQ(AINPUT_SOURCE_JOYSTICK, event.getSource()); - - // Set action. - event.setAction(AMOTION_EVENT_ACTION_CANCEL); - ASSERT_EQ(AMOTION_EVENT_ACTION_CANCEL, event.getAction()); - - // Set meta state. - event.setMetaState(AMETA_CTRL_ON); - ASSERT_EQ(AMETA_CTRL_ON, event.getMetaState()); -} - -TEST_F(MotionEventTest, CopyFrom_KeepHistory) { - MotionEvent event; - initializeEventWithHistory(&event); - - MotionEvent copy; - copy.copyFrom(&event, true /*keepHistory*/); - - ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&event)); -} - -TEST_F(MotionEventTest, CopyFrom_DoNotKeepHistory) { - MotionEvent event; - initializeEventWithHistory(&event); - - MotionEvent copy; - copy.copyFrom(&event, false /*keepHistory*/); - - ASSERT_EQ(event.getPointerCount(), copy.getPointerCount()); - ASSERT_EQ(0U, copy.getHistorySize()); - - ASSERT_EQ(event.getPointerId(0), copy.getPointerId(0)); - ASSERT_EQ(event.getPointerId(1), copy.getPointerId(1)); - - ASSERT_EQ(event.getEventTime(), copy.getEventTime()); - - ASSERT_EQ(event.getX(0), copy.getX(0)); -} - -TEST_F(MotionEventTest, OffsetLocation) { - MotionEvent event; - initializeEventWithHistory(&event); - - event.offsetLocation(5.0f, -2.0f); - - ASSERT_EQ(X_OFFSET + 5.0f, event.getXOffset()); - ASSERT_EQ(Y_OFFSET - 2.0f, event.getYOffset()); -} - -TEST_F(MotionEventTest, Scale) { - MotionEvent event; - initializeEventWithHistory(&event); - - event.scale(2.0f); - - ASSERT_EQ(X_OFFSET * 2, event.getXOffset()); - ASSERT_EQ(Y_OFFSET * 2, event.getYOffset()); - - ASSERT_EQ(210 * 2, event.getRawX(0)); - ASSERT_EQ(211 * 2, event.getRawY(0)); - ASSERT_EQ((X_OFFSET + 210) * 2, event.getX(0)); - ASSERT_EQ((Y_OFFSET + 211) * 2, event.getY(0)); - ASSERT_EQ(212, event.getPressure(0)); - ASSERT_EQ(213, event.getSize(0)); - ASSERT_EQ(214 * 2, event.getTouchMajor(0)); - ASSERT_EQ(215 * 2, event.getTouchMinor(0)); - ASSERT_EQ(216 * 2, event.getToolMajor(0)); - ASSERT_EQ(217 * 2, event.getToolMinor(0)); - ASSERT_EQ(218, event.getOrientation(0)); -} - -TEST_F(MotionEventTest, Parcel) { - Parcel parcel; - - MotionEvent inEvent; - initializeEventWithHistory(&inEvent); - MotionEvent outEvent; - - // Round trip. - inEvent.writeToParcel(&parcel); - parcel.setDataPosition(0); - outEvent.readFromParcel(&parcel); - - ASSERT_NO_FATAL_FAILURE(assertEqualsEventWithHistory(&outEvent)); -} - -static void setRotationMatrix(float matrix[9], float angle) { - float sin = sinf(angle); - float cos = cosf(angle); - matrix[0] = cos; - matrix[1] = -sin; - matrix[2] = 0; - matrix[3] = sin; - matrix[4] = cos; - matrix[5] = 0; - matrix[6] = 0; - matrix[7] = 0; - matrix[8] = 1.0f; -} - -TEST_F(MotionEventTest, Transform) { - // Generate some points on a circle. - // Each point 'i' is a point on a circle of radius ROTATION centered at (3,2) at an angle - // of ARC * i degrees clockwise relative to the Y axis. - // The geometrical representation is irrelevant to the test, it's just easy to generate - // and check rotation. We set the orientation to the same angle. - // Coordinate system: down is increasing Y, right is increasing X. - const float PI_180 = float(M_PI / 180); - const float RADIUS = 10; - const float ARC = 36; - const float ROTATION = ARC * 2; - - const size_t pointerCount = 11; - PointerProperties pointerProperties[pointerCount]; - PointerCoords pointerCoords[pointerCount]; - for (size_t i = 0; i < pointerCount; i++) { - float angle = float(i * ARC * PI_180); - pointerProperties[i].clear(); - pointerProperties[i].id = i; - pointerCoords[i].clear(); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_X, sinf(angle) * RADIUS + 3); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_Y, -cosf(angle) * RADIUS + 2); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, angle); - } - MotionEvent event; - event.initialize(0, 0, AMOTION_EVENT_ACTION_MOVE, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, pointerCount, pointerProperties, pointerCoords); - float originalRawX = 0 + 3; - float originalRawY = -RADIUS + 2; - - // Check original raw X and Y assumption. - ASSERT_NEAR(originalRawX, event.getRawX(0), 0.001); - ASSERT_NEAR(originalRawY, event.getRawY(0), 0.001); - - // Now translate the motion event so the circle's origin is at (0,0). - event.offsetLocation(-3, -2); - - // Offsetting the location should preserve the raw X and Y of the first point. - ASSERT_NEAR(originalRawX, event.getRawX(0), 0.001); - ASSERT_NEAR(originalRawY, event.getRawY(0), 0.001); - - // Apply a rotation about the origin by ROTATION degrees clockwise. - float matrix[9]; - setRotationMatrix(matrix, ROTATION * PI_180); - event.transform(matrix); - - // Check the points. - for (size_t i = 0; i < pointerCount; i++) { - float angle = float((i * ARC + ROTATION) * PI_180); - ASSERT_NEAR(sinf(angle) * RADIUS, event.getX(i), 0.001); - ASSERT_NEAR(-cosf(angle) * RADIUS, event.getY(i), 0.001); - ASSERT_NEAR(tanf(angle), tanf(event.getOrientation(i)), 0.1); - } - - // Applying the transformation should preserve the raw X and Y of the first point. - ASSERT_NEAR(originalRawX, event.getRawX(0), 0.001); - ASSERT_NEAR(originalRawY, event.getRawY(0), 0.001); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/tests/InputPublisherAndConsumer_test.cpp android-platform-frameworks-native-21/libs/input/tests/InputPublisherAndConsumer_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/tests/InputPublisherAndConsumer_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/tests/InputPublisherAndConsumer_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,289 +0,0 @@ -/* - * Copyright (C) 2010 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 "TestHelpers.h" - -#include -#include -#include - -#include -#include -#include -#include -#include - -namespace android { - -class InputPublisherAndConsumerTest : public testing::Test { -protected: - sp serverChannel, clientChannel; - InputPublisher* mPublisher; - InputConsumer* mConsumer; - PreallocatedInputEventFactory mEventFactory; - - virtual void SetUp() { - status_t result = InputChannel::openInputChannelPair(String8("channel name"), - serverChannel, clientChannel); - - mPublisher = new InputPublisher(serverChannel); - mConsumer = new InputConsumer(clientChannel); - } - - virtual void TearDown() { - if (mPublisher) { - delete mPublisher; - mPublisher = NULL; - } - - if (mConsumer) { - delete mConsumer; - mConsumer = NULL; - } - - serverChannel.clear(); - clientChannel.clear(); - } - - void PublishAndConsumeKeyEvent(); - void PublishAndConsumeMotionEvent(); -}; - -TEST_F(InputPublisherAndConsumerTest, GetChannel_ReturnsTheChannel) { - EXPECT_EQ(serverChannel.get(), mPublisher->getChannel().get()); - EXPECT_EQ(clientChannel.get(), mConsumer->getChannel().get()); -} - -void InputPublisherAndConsumerTest::PublishAndConsumeKeyEvent() { - status_t status; - - const uint32_t seq = 15; - const int32_t deviceId = 1; - const int32_t source = AINPUT_SOURCE_KEYBOARD; - const int32_t action = AKEY_EVENT_ACTION_DOWN; - const int32_t flags = AKEY_EVENT_FLAG_FROM_SYSTEM; - const int32_t keyCode = AKEYCODE_ENTER; - const int32_t scanCode = 13; - const int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON; - const int32_t repeatCount = 1; - const nsecs_t downTime = 3; - const nsecs_t eventTime = 4; - - status = mPublisher->publishKeyEvent(seq, deviceId, source, action, flags, - keyCode, scanCode, metaState, repeatCount, downTime, eventTime); - ASSERT_EQ(OK, status) - << "publisher publishKeyEvent should return OK"; - - uint32_t consumeSeq; - InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); - ASSERT_EQ(OK, status) - << "consumer consume should return OK"; - - ASSERT_TRUE(event != NULL) - << "consumer should have returned non-NULL event"; - ASSERT_EQ(AINPUT_EVENT_TYPE_KEY, event->getType()) - << "consumer should have returned a key event"; - - KeyEvent* keyEvent = static_cast(event); - EXPECT_EQ(seq, consumeSeq); - EXPECT_EQ(deviceId, keyEvent->getDeviceId()); - EXPECT_EQ(source, keyEvent->getSource()); - EXPECT_EQ(action, keyEvent->getAction()); - EXPECT_EQ(flags, keyEvent->getFlags()); - EXPECT_EQ(keyCode, keyEvent->getKeyCode()); - EXPECT_EQ(scanCode, keyEvent->getScanCode()); - EXPECT_EQ(metaState, keyEvent->getMetaState()); - EXPECT_EQ(repeatCount, keyEvent->getRepeatCount()); - EXPECT_EQ(downTime, keyEvent->getDownTime()); - EXPECT_EQ(eventTime, keyEvent->getEventTime()); - - status = mConsumer->sendFinishedSignal(seq, true); - ASSERT_EQ(OK, status) - << "consumer sendFinishedSignal should return OK"; - - uint32_t finishedSeq = 0; - bool handled = false; - status = mPublisher->receiveFinishedSignal(&finishedSeq, &handled); - ASSERT_EQ(OK, status) - << "publisher receiveFinishedSignal should return OK"; - ASSERT_EQ(seq, finishedSeq) - << "publisher receiveFinishedSignal should have returned the original sequence number"; - ASSERT_TRUE(handled) - << "publisher receiveFinishedSignal should have set handled to consumer's reply"; -} - -void InputPublisherAndConsumerTest::PublishAndConsumeMotionEvent() { - status_t status; - - const uint32_t seq = 15; - const int32_t deviceId = 1; - const int32_t source = AINPUT_SOURCE_TOUCHSCREEN; - const int32_t action = AMOTION_EVENT_ACTION_MOVE; - const int32_t actionButton = 0; - const int32_t flags = AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED; - const int32_t edgeFlags = AMOTION_EVENT_EDGE_FLAG_TOP; - const int32_t metaState = AMETA_ALT_LEFT_ON | AMETA_ALT_ON; - const int32_t buttonState = AMOTION_EVENT_BUTTON_PRIMARY; - const float xOffset = -10; - const float yOffset = -20; - const float xPrecision = 0.25; - const float yPrecision = 0.5; - const nsecs_t downTime = 3; - const size_t pointerCount = 3; - const nsecs_t eventTime = 4; - PointerProperties pointerProperties[pointerCount]; - PointerCoords pointerCoords[pointerCount]; - for (size_t i = 0; i < pointerCount; i++) { - pointerProperties[i].clear(); - pointerProperties[i].id = (i + 2) % pointerCount; - pointerProperties[i].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; - - pointerCoords[i].clear(); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_X, 100 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_Y, 200 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 0.5 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_SIZE, 0.7 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, 1.5 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, 1.7 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 2.5 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, 2.7 * i); - pointerCoords[i].setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, 3.5 * i); - } - - status = mPublisher->publishMotionEvent(seq, deviceId, source, action, actionButton, - flags, edgeFlags, metaState, buttonState, xOffset, yOffset, xPrecision, yPrecision, - downTime, eventTime, pointerCount, - pointerProperties, pointerCoords); - ASSERT_EQ(OK, status) - << "publisher publishMotionEvent should return OK"; - - uint32_t consumeSeq; - InputEvent* event; - status = mConsumer->consume(&mEventFactory, true /*consumeBatches*/, -1, &consumeSeq, &event); - ASSERT_EQ(OK, status) - << "consumer consume should return OK"; - - ASSERT_TRUE(event != NULL) - << "consumer should have returned non-NULL event"; - ASSERT_EQ(AINPUT_EVENT_TYPE_MOTION, event->getType()) - << "consumer should have returned a motion event"; - - MotionEvent* motionEvent = static_cast(event); - EXPECT_EQ(seq, consumeSeq); - EXPECT_EQ(deviceId, motionEvent->getDeviceId()); - EXPECT_EQ(source, motionEvent->getSource()); - EXPECT_EQ(action, motionEvent->getAction()); - EXPECT_EQ(flags, motionEvent->getFlags()); - EXPECT_EQ(edgeFlags, motionEvent->getEdgeFlags()); - EXPECT_EQ(metaState, motionEvent->getMetaState()); - EXPECT_EQ(buttonState, motionEvent->getButtonState()); - EXPECT_EQ(xPrecision, motionEvent->getXPrecision()); - EXPECT_EQ(yPrecision, motionEvent->getYPrecision()); - EXPECT_EQ(downTime, motionEvent->getDownTime()); - EXPECT_EQ(eventTime, motionEvent->getEventTime()); - EXPECT_EQ(pointerCount, motionEvent->getPointerCount()); - EXPECT_EQ(0U, motionEvent->getHistorySize()); - - for (size_t i = 0; i < pointerCount; i++) { - SCOPED_TRACE(i); - EXPECT_EQ(pointerProperties[i].id, motionEvent->getPointerId(i)); - EXPECT_EQ(pointerProperties[i].toolType, motionEvent->getToolType(i)); - - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X), - motionEvent->getRawX(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y), - motionEvent->getRawY(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X) + xOffset, - motionEvent->getX(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y) + yOffset, - motionEvent->getY(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE), - motionEvent->getPressure(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_SIZE), - motionEvent->getSize(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR), - motionEvent->getTouchMajor(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), - motionEvent->getTouchMinor(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), - motionEvent->getToolMajor(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), - motionEvent->getToolMinor(i)); - EXPECT_EQ(pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION), - motionEvent->getOrientation(i)); - } - - status = mConsumer->sendFinishedSignal(seq, false); - ASSERT_EQ(OK, status) - << "consumer sendFinishedSignal should return OK"; - - uint32_t finishedSeq = 0; - bool handled = true; - status = mPublisher->receiveFinishedSignal(&finishedSeq, &handled); - ASSERT_EQ(OK, status) - << "publisher receiveFinishedSignal should return OK"; - ASSERT_EQ(seq, finishedSeq) - << "publisher receiveFinishedSignal should have returned the original sequence number"; - ASSERT_FALSE(handled) - << "publisher receiveFinishedSignal should have set handled to consumer's reply"; -} - -TEST_F(InputPublisherAndConsumerTest, PublishKeyEvent_EndToEnd) { - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeKeyEvent()); -} - -TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_EndToEnd) { - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent()); -} - -TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountLessThan1_ReturnsError) { - status_t status; - const size_t pointerCount = 0; - PointerProperties pointerProperties[pointerCount]; - PointerCoords pointerCoords[pointerCount]; - - status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - pointerCount, pointerProperties, pointerCoords); - ASSERT_EQ(BAD_VALUE, status) - << "publisher publishMotionEvent should return BAD_VALUE"; -} - -TEST_F(InputPublisherAndConsumerTest, PublishMotionEvent_WhenPointerCountGreaterThanMax_ReturnsError) { - status_t status; - const size_t pointerCount = MAX_POINTERS + 1; - PointerProperties pointerProperties[pointerCount]; - PointerCoords pointerCoords[pointerCount]; - for (size_t i = 0; i < pointerCount; i++) { - pointerProperties[i].clear(); - pointerCoords[i].clear(); - } - - status = mPublisher->publishMotionEvent(0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - pointerCount, pointerProperties, pointerCoords); - ASSERT_EQ(BAD_VALUE, status) - << "publisher publishMotionEvent should return BAD_VALUE"; -} - -TEST_F(InputPublisherAndConsumerTest, PublishMultipleEvents_EndToEnd) { - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent()); - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeKeyEvent()); - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent()); - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeMotionEvent()); - ASSERT_NO_FATAL_FAILURE(PublishAndConsumeKeyEvent()); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/tests/StructLayout_test.cpp android-platform-frameworks-native-21/libs/input/tests/StructLayout_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/tests/StructLayout_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/tests/StructLayout_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright (C) 2014 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 -#include - -namespace android { - -#define CHECK_OFFSET(type, member, expected_offset) \ - static_assert((offsetof(type, member) == expected_offset), "") - -struct Foo { - uint32_t dummy; - PointerCoords coords; -}; - -void TestPointerCoordsAlignment() { - CHECK_OFFSET(Foo, coords, 8); -} - -void TestInputMessageAlignment() { - CHECK_OFFSET(InputMessage, body, 8); - - CHECK_OFFSET(InputMessage::Body::Key, seq, 0); - CHECK_OFFSET(InputMessage::Body::Key, eventTime, 8); - CHECK_OFFSET(InputMessage::Body::Key, deviceId, 16); - CHECK_OFFSET(InputMessage::Body::Key, source, 20); - CHECK_OFFSET(InputMessage::Body::Key, action, 24); - CHECK_OFFSET(InputMessage::Body::Key, flags, 28); - CHECK_OFFSET(InputMessage::Body::Key, keyCode, 32); - CHECK_OFFSET(InputMessage::Body::Key, scanCode, 36); - CHECK_OFFSET(InputMessage::Body::Key, metaState, 40); - CHECK_OFFSET(InputMessage::Body::Key, repeatCount, 44); - CHECK_OFFSET(InputMessage::Body::Key, downTime, 48); - - CHECK_OFFSET(InputMessage::Body::Motion, seq, 0); - CHECK_OFFSET(InputMessage::Body::Motion, eventTime, 8); - CHECK_OFFSET(InputMessage::Body::Motion, deviceId, 16); - CHECK_OFFSET(InputMessage::Body::Motion, source, 20); - CHECK_OFFSET(InputMessage::Body::Motion, action, 24); - CHECK_OFFSET(InputMessage::Body::Motion, actionButton, 28); - CHECK_OFFSET(InputMessage::Body::Motion, flags, 32); - CHECK_OFFSET(InputMessage::Body::Motion, metaState, 36); - CHECK_OFFSET(InputMessage::Body::Motion, buttonState, 40); - CHECK_OFFSET(InputMessage::Body::Motion, edgeFlags, 44); - CHECK_OFFSET(InputMessage::Body::Motion, downTime, 48); - CHECK_OFFSET(InputMessage::Body::Motion, xOffset, 56); - CHECK_OFFSET(InputMessage::Body::Motion, yOffset, 60); - CHECK_OFFSET(InputMessage::Body::Motion, xPrecision, 64); - CHECK_OFFSET(InputMessage::Body::Motion, yPrecision, 68); - CHECK_OFFSET(InputMessage::Body::Motion, pointerCount, 72); - CHECK_OFFSET(InputMessage::Body::Motion, pointers, 80); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/tests/TestHelpers.h android-platform-frameworks-native-21/libs/input/tests/TestHelpers.h --- android-platform-frameworks-native-6.0.1+r16/libs/input/tests/TestHelpers.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/tests/TestHelpers.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,81 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef TESTHELPERS_H -#define TESTHELPERS_H - -#include - -#include - -namespace android { - -class Pipe { -public: - int sendFd; - int receiveFd; - - Pipe() { - int fds[2]; - ::pipe(fds); - - receiveFd = fds[0]; - sendFd = fds[1]; - } - - ~Pipe() { - if (sendFd != -1) { - ::close(sendFd); - } - - if (receiveFd != -1) { - ::close(receiveFd); - } - } - - status_t writeSignal() { - ssize_t nWritten = ::write(sendFd, "*", 1); - return nWritten == 1 ? 0 : -errno; - } - - status_t readSignal() { - char buf[1]; - ssize_t nRead = ::read(receiveFd, buf, 1); - return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno; - } -}; - -class DelayedTask : public Thread { - int mDelayMillis; - -public: - DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { } - -protected: - virtual ~DelayedTask() { } - - virtual void doTask() = 0; - - virtual bool threadLoop() { - usleep(mDelayMillis * 1000); - doTask(); - return false; - } -}; - -} // namespace android - -#endif // TESTHELPERS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/VelocityControl.cpp android-platform-frameworks-native-21/libs/input/VelocityControl.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/VelocityControl.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/VelocityControl.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "VelocityControl" -//#define LOG_NDEBUG 0 - -// Log debug messages about acceleration. -#define DEBUG_ACCELERATION 0 - -#include -#include - -#include -#include -#include - -namespace android { - -// --- VelocityControl --- - -const nsecs_t VelocityControl::STOP_TIME; - -VelocityControl::VelocityControl() { - reset(); -} - -void VelocityControl::setParameters(const VelocityControlParameters& parameters) { - mParameters = parameters; - reset(); -} - -void VelocityControl::reset() { - mLastMovementTime = LLONG_MIN; - mRawPosition.x = 0; - mRawPosition.y = 0; - mVelocityTracker.clear(); -} - -void VelocityControl::move(nsecs_t eventTime, float* deltaX, float* deltaY) { - if ((deltaX && *deltaX) || (deltaY && *deltaY)) { - if (eventTime >= mLastMovementTime + STOP_TIME) { -#if DEBUG_ACCELERATION - ALOGD("VelocityControl: stopped, last movement was %0.3fms ago", - (eventTime - mLastMovementTime) * 0.000001f); -#endif - reset(); - } - - mLastMovementTime = eventTime; - if (deltaX) { - mRawPosition.x += *deltaX; - } - if (deltaY) { - mRawPosition.y += *deltaY; - } - mVelocityTracker.addMovement(eventTime, BitSet32(BitSet32::valueForBit(0)), &mRawPosition); - - float vx, vy; - float scale = mParameters.scale; - if (mVelocityTracker.getVelocity(0, &vx, &vy)) { - float speed = hypotf(vx, vy) * scale; - if (speed >= mParameters.highThreshold) { - // Apply full acceleration above the high speed threshold. - scale *= mParameters.acceleration; - } else if (speed > mParameters.lowThreshold) { - // Linearly interpolate the acceleration to apply between the low and high - // speed thresholds. - scale *= 1 + (speed - mParameters.lowThreshold) - / (mParameters.highThreshold - mParameters.lowThreshold) - * (mParameters.acceleration - 1); - } - -#if DEBUG_ACCELERATION - ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): " - "vx=%0.3f, vy=%0.3f, speed=%0.3f, accel=%0.3f", - mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold, - mParameters.acceleration, - vx, vy, speed, scale / mParameters.scale); -#endif - } else { -#if DEBUG_ACCELERATION - ALOGD("VelocityControl(%0.3f, %0.3f, %0.3f, %0.3f): unknown velocity", - mParameters.scale, mParameters.lowThreshold, mParameters.highThreshold, - mParameters.acceleration); -#endif - } - - if (deltaX) { - *deltaX *= scale; - } - if (deltaY) { - *deltaY *= scale; - } - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/VelocityTracker.cpp android-platform-frameworks-native-21/libs/input/VelocityTracker.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/VelocityTracker.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/VelocityTracker.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,927 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "VelocityTracker" -//#define LOG_NDEBUG 0 - -// Log debug messages about velocity tracking. -#define DEBUG_VELOCITY 0 - -// Log debug messages about the progress of the algorithm itself. -#define DEBUG_STRATEGY 0 - -#include -#include - -#include -#include -#include -#include -#include - -namespace android { - -// Nanoseconds per milliseconds. -static const nsecs_t NANOS_PER_MS = 1000000; - -// Threshold for determining that a pointer has stopped moving. -// Some input devices do not send ACTION_MOVE events in the case where a pointer has -// stopped. We need to detect this case so that we can accurately predict the -// velocity after the pointer starts moving again. -static const nsecs_t ASSUME_POINTER_STOPPED_TIME = 40 * NANOS_PER_MS; - - -static float vectorDot(const float* a, const float* b, uint32_t m) { - float r = 0; - while (m--) { - r += *(a++) * *(b++); - } - return r; -} - -static float vectorNorm(const float* a, uint32_t m) { - float r = 0; - while (m--) { - float t = *(a++); - r += t * t; - } - return sqrtf(r); -} - -#if DEBUG_STRATEGY || DEBUG_VELOCITY -static String8 vectorToString(const float* a, uint32_t m) { - String8 str; - str.append("["); - while (m--) { - str.appendFormat(" %f", *(a++)); - if (m) { - str.append(","); - } - } - str.append(" ]"); - return str; -} - -static String8 matrixToString(const float* a, uint32_t m, uint32_t n, bool rowMajor) { - String8 str; - str.append("["); - for (size_t i = 0; i < m; i++) { - if (i) { - str.append(","); - } - str.append(" ["); - for (size_t j = 0; j < n; j++) { - if (j) { - str.append(","); - } - str.appendFormat(" %f", a[rowMajor ? i * n + j : j * m + i]); - } - str.append(" ]"); - } - str.append(" ]"); - return str; -} -#endif - - -// --- VelocityTracker --- - -// The default velocity tracker strategy. -// Although other strategies are available for testing and comparison purposes, -// this is the strategy that applications will actually use. Be very careful -// when adjusting the default strategy because it can dramatically affect -// (often in a bad way) the user experience. -const char* VelocityTracker::DEFAULT_STRATEGY = "lsq2"; - -VelocityTracker::VelocityTracker(const char* strategy) : - mLastEventTime(0), mCurrentPointerIdBits(0), mActivePointerId(-1) { - char value[PROPERTY_VALUE_MAX]; - - // Allow the default strategy to be overridden using a system property for debugging. - if (!strategy) { - int length = property_get("debug.velocitytracker.strategy", value, NULL); - if (length > 0) { - strategy = value; - } else { - strategy = DEFAULT_STRATEGY; - } - } - - // Configure the strategy. - if (!configureStrategy(strategy)) { - ALOGD("Unrecognized velocity tracker strategy name '%s'.", strategy); - if (!configureStrategy(DEFAULT_STRATEGY)) { - LOG_ALWAYS_FATAL("Could not create the default velocity tracker strategy '%s'!", - strategy); - } - } -} - -VelocityTracker::~VelocityTracker() { - delete mStrategy; -} - -bool VelocityTracker::configureStrategy(const char* strategy) { - mStrategy = createStrategy(strategy); - return mStrategy != NULL; -} - -VelocityTrackerStrategy* VelocityTracker::createStrategy(const char* strategy) { - if (!strcmp("lsq1", strategy)) { - // 1st order least squares. Quality: POOR. - // Frequently underfits the touch data especially when the finger accelerates - // or changes direction. Often underestimates velocity. The direction - // is overly influenced by historical touch points. - return new LeastSquaresVelocityTrackerStrategy(1); - } - if (!strcmp("lsq2", strategy)) { - // 2nd order least squares. Quality: VERY GOOD. - // Pretty much ideal, but can be confused by certain kinds of touch data, - // particularly if the panel has a tendency to generate delayed, - // duplicate or jittery touch coordinates when the finger is released. - return new LeastSquaresVelocityTrackerStrategy(2); - } - if (!strcmp("lsq3", strategy)) { - // 3rd order least squares. Quality: UNUSABLE. - // Frequently overfits the touch data yielding wildly divergent estimates - // of the velocity when the finger is released. - return new LeastSquaresVelocityTrackerStrategy(3); - } - if (!strcmp("wlsq2-delta", strategy)) { - // 2nd order weighted least squares, delta weighting. Quality: EXPERIMENTAL - return new LeastSquaresVelocityTrackerStrategy(2, - LeastSquaresVelocityTrackerStrategy::WEIGHTING_DELTA); - } - if (!strcmp("wlsq2-central", strategy)) { - // 2nd order weighted least squares, central weighting. Quality: EXPERIMENTAL - return new LeastSquaresVelocityTrackerStrategy(2, - LeastSquaresVelocityTrackerStrategy::WEIGHTING_CENTRAL); - } - if (!strcmp("wlsq2-recent", strategy)) { - // 2nd order weighted least squares, recent weighting. Quality: EXPERIMENTAL - return new LeastSquaresVelocityTrackerStrategy(2, - LeastSquaresVelocityTrackerStrategy::WEIGHTING_RECENT); - } - if (!strcmp("int1", strategy)) { - // 1st order integrating filter. Quality: GOOD. - // Not as good as 'lsq2' because it cannot estimate acceleration but it is - // more tolerant of errors. Like 'lsq1', this strategy tends to underestimate - // the velocity of a fling but this strategy tends to respond to changes in - // direction more quickly and accurately. - return new IntegratingVelocityTrackerStrategy(1); - } - if (!strcmp("int2", strategy)) { - // 2nd order integrating filter. Quality: EXPERIMENTAL. - // For comparison purposes only. Unlike 'int1' this strategy can compensate - // for acceleration but it typically overestimates the effect. - return new IntegratingVelocityTrackerStrategy(2); - } - if (!strcmp("legacy", strategy)) { - // Legacy velocity tracker algorithm. Quality: POOR. - // For comparison purposes only. This algorithm is strongly influenced by - // old data points, consistently underestimates velocity and takes a very long - // time to adjust to changes in direction. - return new LegacyVelocityTrackerStrategy(); - } - return NULL; -} - -void VelocityTracker::clear() { - mCurrentPointerIdBits.clear(); - mActivePointerId = -1; - - mStrategy->clear(); -} - -void VelocityTracker::clearPointers(BitSet32 idBits) { - BitSet32 remainingIdBits(mCurrentPointerIdBits.value & ~idBits.value); - mCurrentPointerIdBits = remainingIdBits; - - if (mActivePointerId >= 0 && idBits.hasBit(mActivePointerId)) { - mActivePointerId = !remainingIdBits.isEmpty() ? remainingIdBits.firstMarkedBit() : -1; - } - - mStrategy->clearPointers(idBits); -} - -void VelocityTracker::addMovement(nsecs_t eventTime, BitSet32 idBits, const Position* positions) { - while (idBits.count() > MAX_POINTERS) { - idBits.clearLastMarkedBit(); - } - - if ((mCurrentPointerIdBits.value & idBits.value) - && eventTime >= mLastEventTime + ASSUME_POINTER_STOPPED_TIME) { -#if DEBUG_VELOCITY - ALOGD("VelocityTracker: stopped for %0.3f ms, clearing state.", - (eventTime - mLastEventTime) * 0.000001f); -#endif - // We have not received any movements for too long. Assume that all pointers - // have stopped. - mStrategy->clear(); - } - mLastEventTime = eventTime; - - mCurrentPointerIdBits = idBits; - if (mActivePointerId < 0 || !idBits.hasBit(mActivePointerId)) { - mActivePointerId = idBits.isEmpty() ? -1 : idBits.firstMarkedBit(); - } - - mStrategy->addMovement(eventTime, idBits, positions); - -#if DEBUG_VELOCITY - ALOGD("VelocityTracker: addMovement eventTime=%lld, idBits=0x%08x, activePointerId=%d", - eventTime, idBits.value, mActivePointerId); - for (BitSet32 iterBits(idBits); !iterBits.isEmpty(); ) { - uint32_t id = iterBits.firstMarkedBit(); - uint32_t index = idBits.getIndexOfBit(id); - iterBits.clearBit(id); - Estimator estimator; - getEstimator(id, &estimator); - ALOGD(" %d: position (%0.3f, %0.3f), " - "estimator (degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f)", - id, positions[index].x, positions[index].y, - int(estimator.degree), - vectorToString(estimator.xCoeff, estimator.degree + 1).string(), - vectorToString(estimator.yCoeff, estimator.degree + 1).string(), - estimator.confidence); - } -#endif -} - -void VelocityTracker::addMovement(const MotionEvent* event) { - int32_t actionMasked = event->getActionMasked(); - - switch (actionMasked) { - case AMOTION_EVENT_ACTION_DOWN: - case AMOTION_EVENT_ACTION_HOVER_ENTER: - // Clear all pointers on down before adding the new movement. - clear(); - break; - case AMOTION_EVENT_ACTION_POINTER_DOWN: { - // Start a new movement trace for a pointer that just went down. - // We do this on down instead of on up because the client may want to query the - // final velocity for a pointer that just went up. - BitSet32 downIdBits; - downIdBits.markBit(event->getPointerId(event->getActionIndex())); - clearPointers(downIdBits); - break; - } - case AMOTION_EVENT_ACTION_MOVE: - case AMOTION_EVENT_ACTION_HOVER_MOVE: - break; - default: - // Ignore all other actions because they do not convey any new information about - // pointer movement. We also want to preserve the last known velocity of the pointers. - // Note that ACTION_UP and ACTION_POINTER_UP always report the last known position - // of the pointers that went up. ACTION_POINTER_UP does include the new position of - // pointers that remained down but we will also receive an ACTION_MOVE with this - // information if any of them actually moved. Since we don't know how many pointers - // will be going up at once it makes sense to just wait for the following ACTION_MOVE - // before adding the movement. - return; - } - - size_t pointerCount = event->getPointerCount(); - if (pointerCount > MAX_POINTERS) { - pointerCount = MAX_POINTERS; - } - - BitSet32 idBits; - for (size_t i = 0; i < pointerCount; i++) { - idBits.markBit(event->getPointerId(i)); - } - - uint32_t pointerIndex[MAX_POINTERS]; - for (size_t i = 0; i < pointerCount; i++) { - pointerIndex[i] = idBits.getIndexOfBit(event->getPointerId(i)); - } - - nsecs_t eventTime; - Position positions[pointerCount]; - - size_t historySize = event->getHistorySize(); - for (size_t h = 0; h < historySize; h++) { - eventTime = event->getHistoricalEventTime(h); - for (size_t i = 0; i < pointerCount; i++) { - uint32_t index = pointerIndex[i]; - positions[index].x = event->getHistoricalX(i, h); - positions[index].y = event->getHistoricalY(i, h); - } - addMovement(eventTime, idBits, positions); - } - - eventTime = event->getEventTime(); - for (size_t i = 0; i < pointerCount; i++) { - uint32_t index = pointerIndex[i]; - positions[index].x = event->getX(i); - positions[index].y = event->getY(i); - } - addMovement(eventTime, idBits, positions); -} - -bool VelocityTracker::getVelocity(uint32_t id, float* outVx, float* outVy) const { - Estimator estimator; - if (getEstimator(id, &estimator) && estimator.degree >= 1) { - *outVx = estimator.xCoeff[1]; - *outVy = estimator.yCoeff[1]; - return true; - } - *outVx = 0; - *outVy = 0; - return false; -} - -bool VelocityTracker::getEstimator(uint32_t id, Estimator* outEstimator) const { - return mStrategy->getEstimator(id, outEstimator); -} - - -// --- LeastSquaresVelocityTrackerStrategy --- - -const nsecs_t LeastSquaresVelocityTrackerStrategy::HORIZON; -const uint32_t LeastSquaresVelocityTrackerStrategy::HISTORY_SIZE; - -LeastSquaresVelocityTrackerStrategy::LeastSquaresVelocityTrackerStrategy( - uint32_t degree, Weighting weighting) : - mDegree(degree), mWeighting(weighting) { - clear(); -} - -LeastSquaresVelocityTrackerStrategy::~LeastSquaresVelocityTrackerStrategy() { -} - -void LeastSquaresVelocityTrackerStrategy::clear() { - mIndex = 0; - mMovements[0].idBits.clear(); -} - -void LeastSquaresVelocityTrackerStrategy::clearPointers(BitSet32 idBits) { - BitSet32 remainingIdBits(mMovements[mIndex].idBits.value & ~idBits.value); - mMovements[mIndex].idBits = remainingIdBits; -} - -void LeastSquaresVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions) { - if (++mIndex == HISTORY_SIZE) { - mIndex = 0; - } - - Movement& movement = mMovements[mIndex]; - movement.eventTime = eventTime; - movement.idBits = idBits; - uint32_t count = idBits.count(); - for (uint32_t i = 0; i < count; i++) { - movement.positions[i] = positions[i]; - } -} - -/** - * Solves a linear least squares problem to obtain a N degree polynomial that fits - * the specified input data as nearly as possible. - * - * Returns true if a solution is found, false otherwise. - * - * The input consists of two vectors of data points X and Y with indices 0..m-1 - * along with a weight vector W of the same size. - * - * The output is a vector B with indices 0..n that describes a polynomial - * that fits the data, such the sum of W[i] * W[i] * abs(Y[i] - (B[0] + B[1] X[i] - * + B[2] X[i]^2 ... B[n] X[i]^n)) for all i between 0 and m-1 is minimized. - * - * Accordingly, the weight vector W should be initialized by the caller with the - * reciprocal square root of the variance of the error in each input data point. - * In other words, an ideal choice for W would be W[i] = 1 / var(Y[i]) = 1 / stddev(Y[i]). - * The weights express the relative importance of each data point. If the weights are - * all 1, then the data points are considered to be of equal importance when fitting - * the polynomial. It is a good idea to choose weights that diminish the importance - * of data points that may have higher than usual error margins. - * - * Errors among data points are assumed to be independent. W is represented here - * as a vector although in the literature it is typically taken to be a diagonal matrix. - * - * That is to say, the function that generated the input data can be approximated - * by y(x) ~= B[0] + B[1] x + B[2] x^2 + ... + B[n] x^n. - * - * The coefficient of determination (R^2) is also returned to describe the goodness - * of fit of the model for the given data. It is a value between 0 and 1, where 1 - * indicates perfect correspondence. - * - * This function first expands the X vector to a m by n matrix A such that - * A[i][0] = 1, A[i][1] = X[i], A[i][2] = X[i]^2, ..., A[i][n] = X[i]^n, then - * multiplies it by w[i]./ - * - * Then it calculates the QR decomposition of A yielding an m by m orthonormal matrix Q - * and an m by n upper triangular matrix R. Because R is upper triangular (lower - * part is all zeroes), we can simplify the decomposition into an m by n matrix - * Q1 and a n by n matrix R1 such that A = Q1 R1. - * - * Finally we solve the system of linear equations given by R1 B = (Qtranspose W Y) - * to find B. - * - * For efficiency, we lay out A and Q column-wise in memory because we frequently - * operate on the column vectors. Conversely, we lay out R row-wise. - * - * http://en.wikipedia.org/wiki/Numerical_methods_for_linear_least_squares - * http://en.wikipedia.org/wiki/Gram-Schmidt - */ -static bool solveLeastSquares(const float* x, const float* y, - const float* w, uint32_t m, uint32_t n, float* outB, float* outDet) { -#if DEBUG_STRATEGY - ALOGD("solveLeastSquares: m=%d, n=%d, x=%s, y=%s, w=%s", int(m), int(n), - vectorToString(x, m).string(), vectorToString(y, m).string(), - vectorToString(w, m).string()); -#endif - - // Expand the X vector to a matrix A, pre-multiplied by the weights. - float a[n][m]; // column-major order - for (uint32_t h = 0; h < m; h++) { - a[0][h] = w[h]; - for (uint32_t i = 1; i < n; i++) { - a[i][h] = a[i - 1][h] * x[h]; - } - } -#if DEBUG_STRATEGY - ALOGD(" - a=%s", matrixToString(&a[0][0], m, n, false /*rowMajor*/).string()); -#endif - - // Apply the Gram-Schmidt process to A to obtain its QR decomposition. - float q[n][m]; // orthonormal basis, column-major order - float r[n][n]; // upper triangular matrix, row-major order - for (uint32_t j = 0; j < n; j++) { - for (uint32_t h = 0; h < m; h++) { - q[j][h] = a[j][h]; - } - for (uint32_t i = 0; i < j; i++) { - float dot = vectorDot(&q[j][0], &q[i][0], m); - for (uint32_t h = 0; h < m; h++) { - q[j][h] -= dot * q[i][h]; - } - } - - float norm = vectorNorm(&q[j][0], m); - if (norm < 0.000001f) { - // vectors are linearly dependent or zero so no solution -#if DEBUG_STRATEGY - ALOGD(" - no solution, norm=%f", norm); -#endif - return false; - } - - float invNorm = 1.0f / norm; - for (uint32_t h = 0; h < m; h++) { - q[j][h] *= invNorm; - } - for (uint32_t i = 0; i < n; i++) { - r[j][i] = i < j ? 0 : vectorDot(&q[j][0], &a[i][0], m); - } - } -#if DEBUG_STRATEGY - ALOGD(" - q=%s", matrixToString(&q[0][0], m, n, false /*rowMajor*/).string()); - ALOGD(" - r=%s", matrixToString(&r[0][0], n, n, true /*rowMajor*/).string()); - - // calculate QR, if we factored A correctly then QR should equal A - float qr[n][m]; - for (uint32_t h = 0; h < m; h++) { - for (uint32_t i = 0; i < n; i++) { - qr[i][h] = 0; - for (uint32_t j = 0; j < n; j++) { - qr[i][h] += q[j][h] * r[j][i]; - } - } - } - ALOGD(" - qr=%s", matrixToString(&qr[0][0], m, n, false /*rowMajor*/).string()); -#endif - - // Solve R B = Qt W Y to find B. This is easy because R is upper triangular. - // We just work from bottom-right to top-left calculating B's coefficients. - float wy[m]; - for (uint32_t h = 0; h < m; h++) { - wy[h] = y[h] * w[h]; - } - for (uint32_t i = n; i-- != 0; ) { - outB[i] = vectorDot(&q[i][0], wy, m); - for (uint32_t j = n - 1; j > i; j--) { - outB[i] -= r[i][j] * outB[j]; - } - outB[i] /= r[i][i]; - } -#if DEBUG_STRATEGY - ALOGD(" - b=%s", vectorToString(outB, n).string()); -#endif - - // Calculate the coefficient of determination as 1 - (SSerr / SStot) where - // SSerr is the residual sum of squares (variance of the error), - // and SStot is the total sum of squares (variance of the data) where each - // has been weighted. - float ymean = 0; - for (uint32_t h = 0; h < m; h++) { - ymean += y[h]; - } - ymean /= m; - - float sserr = 0; - float sstot = 0; - for (uint32_t h = 0; h < m; h++) { - float err = y[h] - outB[0]; - float term = 1; - for (uint32_t i = 1; i < n; i++) { - term *= x[h]; - err -= term * outB[i]; - } - sserr += w[h] * w[h] * err * err; - float var = y[h] - ymean; - sstot += w[h] * w[h] * var * var; - } - *outDet = sstot > 0.000001f ? 1.0f - (sserr / sstot) : 1; -#if DEBUG_STRATEGY - ALOGD(" - sserr=%f", sserr); - ALOGD(" - sstot=%f", sstot); - ALOGD(" - det=%f", *outDet); -#endif - return true; -} - -bool LeastSquaresVelocityTrackerStrategy::getEstimator(uint32_t id, - VelocityTracker::Estimator* outEstimator) const { - outEstimator->clear(); - - // Iterate over movement samples in reverse time order and collect samples. - float x[HISTORY_SIZE]; - float y[HISTORY_SIZE]; - float w[HISTORY_SIZE]; - float time[HISTORY_SIZE]; - uint32_t m = 0; - uint32_t index = mIndex; - const Movement& newestMovement = mMovements[mIndex]; - do { - const Movement& movement = mMovements[index]; - if (!movement.idBits.hasBit(id)) { - break; - } - - nsecs_t age = newestMovement.eventTime - movement.eventTime; - if (age > HORIZON) { - break; - } - - const VelocityTracker::Position& position = movement.getPosition(id); - x[m] = position.x; - y[m] = position.y; - w[m] = chooseWeight(index); - time[m] = -age * 0.000000001f; - index = (index == 0 ? HISTORY_SIZE : index) - 1; - } while (++m < HISTORY_SIZE); - - if (m == 0) { - return false; // no data - } - - // Calculate a least squares polynomial fit. - uint32_t degree = mDegree; - if (degree > m - 1) { - degree = m - 1; - } - if (degree >= 1) { - float xdet, ydet; - uint32_t n = degree + 1; - if (solveLeastSquares(time, x, w, m, n, outEstimator->xCoeff, &xdet) - && solveLeastSquares(time, y, w, m, n, outEstimator->yCoeff, &ydet)) { - outEstimator->time = newestMovement.eventTime; - outEstimator->degree = degree; - outEstimator->confidence = xdet * ydet; -#if DEBUG_STRATEGY - ALOGD("estimate: degree=%d, xCoeff=%s, yCoeff=%s, confidence=%f", - int(outEstimator->degree), - vectorToString(outEstimator->xCoeff, n).string(), - vectorToString(outEstimator->yCoeff, n).string(), - outEstimator->confidence); -#endif - return true; - } - } - - // No velocity data available for this pointer, but we do have its current position. - outEstimator->xCoeff[0] = x[0]; - outEstimator->yCoeff[0] = y[0]; - outEstimator->time = newestMovement.eventTime; - outEstimator->degree = 0; - outEstimator->confidence = 1; - return true; -} - -float LeastSquaresVelocityTrackerStrategy::chooseWeight(uint32_t index) const { - switch (mWeighting) { - case WEIGHTING_DELTA: { - // Weight points based on how much time elapsed between them and the next - // point so that points that "cover" a shorter time span are weighed less. - // delta 0ms: 0.5 - // delta 10ms: 1.0 - if (index == mIndex) { - return 1.0f; - } - uint32_t nextIndex = (index + 1) % HISTORY_SIZE; - float deltaMillis = (mMovements[nextIndex].eventTime- mMovements[index].eventTime) - * 0.000001f; - if (deltaMillis < 0) { - return 0.5f; - } - if (deltaMillis < 10) { - return 0.5f + deltaMillis * 0.05; - } - return 1.0f; - } - - case WEIGHTING_CENTRAL: { - // Weight points based on their age, weighing very recent and very old points less. - // age 0ms: 0.5 - // age 10ms: 1.0 - // age 50ms: 1.0 - // age 60ms: 0.5 - float ageMillis = (mMovements[mIndex].eventTime - mMovements[index].eventTime) - * 0.000001f; - if (ageMillis < 0) { - return 0.5f; - } - if (ageMillis < 10) { - return 0.5f + ageMillis * 0.05; - } - if (ageMillis < 50) { - return 1.0f; - } - if (ageMillis < 60) { - return 0.5f + (60 - ageMillis) * 0.05; - } - return 0.5f; - } - - case WEIGHTING_RECENT: { - // Weight points based on their age, weighing older points less. - // age 0ms: 1.0 - // age 50ms: 1.0 - // age 100ms: 0.5 - float ageMillis = (mMovements[mIndex].eventTime - mMovements[index].eventTime) - * 0.000001f; - if (ageMillis < 50) { - return 1.0f; - } - if (ageMillis < 100) { - return 0.5f + (100 - ageMillis) * 0.01f; - } - return 0.5f; - } - - case WEIGHTING_NONE: - default: - return 1.0f; - } -} - - -// --- IntegratingVelocityTrackerStrategy --- - -IntegratingVelocityTrackerStrategy::IntegratingVelocityTrackerStrategy(uint32_t degree) : - mDegree(degree) { -} - -IntegratingVelocityTrackerStrategy::~IntegratingVelocityTrackerStrategy() { -} - -void IntegratingVelocityTrackerStrategy::clear() { - mPointerIdBits.clear(); -} - -void IntegratingVelocityTrackerStrategy::clearPointers(BitSet32 idBits) { - mPointerIdBits.value &= ~idBits.value; -} - -void IntegratingVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions) { - uint32_t index = 0; - for (BitSet32 iterIdBits(idBits); !iterIdBits.isEmpty();) { - uint32_t id = iterIdBits.clearFirstMarkedBit(); - State& state = mPointerState[id]; - const VelocityTracker::Position& position = positions[index++]; - if (mPointerIdBits.hasBit(id)) { - updateState(state, eventTime, position.x, position.y); - } else { - initState(state, eventTime, position.x, position.y); - } - } - - mPointerIdBits = idBits; -} - -bool IntegratingVelocityTrackerStrategy::getEstimator(uint32_t id, - VelocityTracker::Estimator* outEstimator) const { - outEstimator->clear(); - - if (mPointerIdBits.hasBit(id)) { - const State& state = mPointerState[id]; - populateEstimator(state, outEstimator); - return true; - } - - return false; -} - -void IntegratingVelocityTrackerStrategy::initState(State& state, - nsecs_t eventTime, float xpos, float ypos) const { - state.updateTime = eventTime; - state.degree = 0; - - state.xpos = xpos; - state.xvel = 0; - state.xaccel = 0; - state.ypos = ypos; - state.yvel = 0; - state.yaccel = 0; -} - -void IntegratingVelocityTrackerStrategy::updateState(State& state, - nsecs_t eventTime, float xpos, float ypos) const { - const nsecs_t MIN_TIME_DELTA = 2 * NANOS_PER_MS; - const float FILTER_TIME_CONSTANT = 0.010f; // 10 milliseconds - - if (eventTime <= state.updateTime + MIN_TIME_DELTA) { - return; - } - - float dt = (eventTime - state.updateTime) * 0.000000001f; - state.updateTime = eventTime; - - float xvel = (xpos - state.xpos) / dt; - float yvel = (ypos - state.ypos) / dt; - if (state.degree == 0) { - state.xvel = xvel; - state.yvel = yvel; - state.degree = 1; - } else { - float alpha = dt / (FILTER_TIME_CONSTANT + dt); - if (mDegree == 1) { - state.xvel += (xvel - state.xvel) * alpha; - state.yvel += (yvel - state.yvel) * alpha; - } else { - float xaccel = (xvel - state.xvel) / dt; - float yaccel = (yvel - state.yvel) / dt; - if (state.degree == 1) { - state.xaccel = xaccel; - state.yaccel = yaccel; - state.degree = 2; - } else { - state.xaccel += (xaccel - state.xaccel) * alpha; - state.yaccel += (yaccel - state.yaccel) * alpha; - } - state.xvel += (state.xaccel * dt) * alpha; - state.yvel += (state.yaccel * dt) * alpha; - } - } - state.xpos = xpos; - state.ypos = ypos; -} - -void IntegratingVelocityTrackerStrategy::populateEstimator(const State& state, - VelocityTracker::Estimator* outEstimator) const { - outEstimator->time = state.updateTime; - outEstimator->confidence = 1.0f; - outEstimator->degree = state.degree; - outEstimator->xCoeff[0] = state.xpos; - outEstimator->xCoeff[1] = state.xvel; - outEstimator->xCoeff[2] = state.xaccel / 2; - outEstimator->yCoeff[0] = state.ypos; - outEstimator->yCoeff[1] = state.yvel; - outEstimator->yCoeff[2] = state.yaccel / 2; -} - - -// --- LegacyVelocityTrackerStrategy --- - -const nsecs_t LegacyVelocityTrackerStrategy::HORIZON; -const uint32_t LegacyVelocityTrackerStrategy::HISTORY_SIZE; -const nsecs_t LegacyVelocityTrackerStrategy::MIN_DURATION; - -LegacyVelocityTrackerStrategy::LegacyVelocityTrackerStrategy() { - clear(); -} - -LegacyVelocityTrackerStrategy::~LegacyVelocityTrackerStrategy() { -} - -void LegacyVelocityTrackerStrategy::clear() { - mIndex = 0; - mMovements[0].idBits.clear(); -} - -void LegacyVelocityTrackerStrategy::clearPointers(BitSet32 idBits) { - BitSet32 remainingIdBits(mMovements[mIndex].idBits.value & ~idBits.value); - mMovements[mIndex].idBits = remainingIdBits; -} - -void LegacyVelocityTrackerStrategy::addMovement(nsecs_t eventTime, BitSet32 idBits, - const VelocityTracker::Position* positions) { - if (++mIndex == HISTORY_SIZE) { - mIndex = 0; - } - - Movement& movement = mMovements[mIndex]; - movement.eventTime = eventTime; - movement.idBits = idBits; - uint32_t count = idBits.count(); - for (uint32_t i = 0; i < count; i++) { - movement.positions[i] = positions[i]; - } -} - -bool LegacyVelocityTrackerStrategy::getEstimator(uint32_t id, - VelocityTracker::Estimator* outEstimator) const { - outEstimator->clear(); - - const Movement& newestMovement = mMovements[mIndex]; - if (!newestMovement.idBits.hasBit(id)) { - return false; // no data - } - - // Find the oldest sample that contains the pointer and that is not older than HORIZON. - nsecs_t minTime = newestMovement.eventTime - HORIZON; - uint32_t oldestIndex = mIndex; - uint32_t numTouches = 1; - do { - uint32_t nextOldestIndex = (oldestIndex == 0 ? HISTORY_SIZE : oldestIndex) - 1; - const Movement& nextOldestMovement = mMovements[nextOldestIndex]; - if (!nextOldestMovement.idBits.hasBit(id) - || nextOldestMovement.eventTime < minTime) { - break; - } - oldestIndex = nextOldestIndex; - } while (++numTouches < HISTORY_SIZE); - - // Calculate an exponentially weighted moving average of the velocity estimate - // at different points in time measured relative to the oldest sample. - // This is essentially an IIR filter. Newer samples are weighted more heavily - // than older samples. Samples at equal time points are weighted more or less - // equally. - // - // One tricky problem is that the sample data may be poorly conditioned. - // Sometimes samples arrive very close together in time which can cause us to - // overestimate the velocity at that time point. Most samples might be measured - // 16ms apart but some consecutive samples could be only 0.5sm apart because - // the hardware or driver reports them irregularly or in bursts. - float accumVx = 0; - float accumVy = 0; - uint32_t index = oldestIndex; - uint32_t samplesUsed = 0; - const Movement& oldestMovement = mMovements[oldestIndex]; - const VelocityTracker::Position& oldestPosition = oldestMovement.getPosition(id); - nsecs_t lastDuration = 0; - - while (numTouches-- > 1) { - if (++index == HISTORY_SIZE) { - index = 0; - } - const Movement& movement = mMovements[index]; - nsecs_t duration = movement.eventTime - oldestMovement.eventTime; - - // If the duration between samples is small, we may significantly overestimate - // the velocity. Consequently, we impose a minimum duration constraint on the - // samples that we include in the calculation. - if (duration >= MIN_DURATION) { - const VelocityTracker::Position& position = movement.getPosition(id); - float scale = 1000000000.0f / duration; // one over time delta in seconds - float vx = (position.x - oldestPosition.x) * scale; - float vy = (position.y - oldestPosition.y) * scale; - accumVx = (accumVx * lastDuration + vx * duration) / (duration + lastDuration); - accumVy = (accumVy * lastDuration + vy * duration) / (duration + lastDuration); - lastDuration = duration; - samplesUsed += 1; - } - } - - // Report velocity. - const VelocityTracker::Position& newestPosition = newestMovement.getPosition(id); - outEstimator->time = newestMovement.eventTime; - outEstimator->confidence = 1; - outEstimator->xCoeff[0] = newestPosition.x; - outEstimator->yCoeff[0] = newestPosition.y; - if (samplesUsed) { - outEstimator->xCoeff[1] = accumVx; - outEstimator->yCoeff[1] = accumVy; - outEstimator->degree = 1; - } else { - outEstimator->degree = 0; - } - return true; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/input/VirtualKeyMap.cpp android-platform-frameworks-native-21/libs/input/VirtualKeyMap.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/input/VirtualKeyMap.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/input/VirtualKeyMap.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,172 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "VirtualKeyMap" - -#include -#include - -#include -#include -#include -#include -#include - -// Enables debug output for the parser. -#define DEBUG_PARSER 0 - -// Enables debug output for parser performance. -#define DEBUG_PARSER_PERFORMANCE 0 - - -namespace android { - -static const char* WHITESPACE = " \t\r"; -static const char* WHITESPACE_OR_FIELD_DELIMITER = " \t\r:"; - - -// --- VirtualKeyMap --- - -VirtualKeyMap::VirtualKeyMap() { -} - -VirtualKeyMap::~VirtualKeyMap() { -} - -status_t VirtualKeyMap::load(const String8& filename, VirtualKeyMap** outMap) { - *outMap = NULL; - - Tokenizer* tokenizer; - status_t status = Tokenizer::open(filename, &tokenizer); - if (status) { - ALOGE("Error %d opening virtual key map file %s.", status, filename.string()); - } else { - VirtualKeyMap* map = new VirtualKeyMap(); - if (!map) { - ALOGE("Error allocating virtual key map."); - status = NO_MEMORY; - } else { -#if DEBUG_PARSER_PERFORMANCE - nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); -#endif - Parser parser(map, tokenizer); - status = parser.parse(); -#if DEBUG_PARSER_PERFORMANCE - nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; - ALOGD("Parsed key character map file '%s' %d lines in %0.3fms.", - tokenizer->getFilename().string(), tokenizer->getLineNumber(), - elapsedTime / 1000000.0); -#endif - if (status) { - delete map; - } else { - *outMap = map; - } - } - delete tokenizer; - } - return status; -} - - -// --- VirtualKeyMap::Parser --- - -VirtualKeyMap::Parser::Parser(VirtualKeyMap* map, Tokenizer* tokenizer) : - mMap(map), mTokenizer(tokenizer) { -} - -VirtualKeyMap::Parser::~Parser() { -} - -status_t VirtualKeyMap::Parser::parse() { - while (!mTokenizer->isEof()) { -#if DEBUG_PARSER - ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), - mTokenizer->peekRemainderOfLine().string()); -#endif - - mTokenizer->skipDelimiters(WHITESPACE); - - if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { - // Multiple keys can appear on one line or they can be broken up across multiple lines. - do { - String8 token = mTokenizer->nextToken(WHITESPACE_OR_FIELD_DELIMITER); - if (token != "0x01") { - ALOGE("%s: Unknown virtual key type, expected 0x01.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - - VirtualKeyDefinition defn; - bool success = parseNextIntField(&defn.scanCode) - && parseNextIntField(&defn.centerX) - && parseNextIntField(&defn.centerY) - && parseNextIntField(&defn.width) - && parseNextIntField(&defn.height); - if (!success) { - ALOGE("%s: Expected 5 colon-delimited integers in virtual key definition.", - mTokenizer->getLocation().string()); - return BAD_VALUE; - } - -#if DEBUG_PARSER - ALOGD("Parsed virtual key: scanCode=%d, centerX=%d, centerY=%d, " - "width=%d, height=%d", - defn.scanCode, defn.centerX, defn.centerY, defn.width, defn.height); -#endif - mMap->mVirtualKeys.push(defn); - } while (consumeFieldDelimiterAndSkipWhitespace()); - - if (!mTokenizer->isEol()) { - ALOGE("%s: Expected end of line, got '%s'.", - mTokenizer->getLocation().string(), - mTokenizer->peekRemainderOfLine().string()); - return BAD_VALUE; - } - } - - mTokenizer->nextLine(); - } - - return NO_ERROR; -} - -bool VirtualKeyMap::Parser::consumeFieldDelimiterAndSkipWhitespace() { - mTokenizer->skipDelimiters(WHITESPACE); - if (mTokenizer->peekChar() == ':') { - mTokenizer->nextChar(); - mTokenizer->skipDelimiters(WHITESPACE); - return true; - } - return false; -} - -bool VirtualKeyMap::Parser::parseNextIntField(int32_t* outValue) { - if (!consumeFieldDelimiterAndSkipWhitespace()) { - return false; - } - - String8 token = mTokenizer->nextToken(WHITESPACE_OR_FIELD_DELIMITER); - char* end; - *outValue = strtol(token.string(), &end, 0); - if (token.isEmpty() || *end != '\0') { - ALOGE("Expected an integer, got '%s'.", token.string()); - return false; - } - return true; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/Android.mk android-platform-frameworks-native-21/libs/ui/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/ui/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -12,51 +12,28 @@ # See the License for the specific language governing permissions and # limitations under the License. -LOCAL_PATH := $(call my-dir) +LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_CLANG := true -LOCAL_CPPFLAGS := -std=c++1y -Weverything -Werror - -# The static constructors and destructors in this library have not been noted to -# introduce significant overheads -LOCAL_CPPFLAGS += -Wno-exit-time-destructors -LOCAL_CPPFLAGS += -Wno-global-constructors - -# We only care about compiling as C++14 -LOCAL_CPPFLAGS += -Wno-c++98-compat-pedantic - -# We use four-character constants for the GraphicBuffer header, and don't care -# that they're non-portable as long as they're consistent within one execution -LOCAL_CPPFLAGS += -Wno-four-char-constants - -# Don't warn about struct padding -LOCAL_CPPFLAGS += -Wno-padded - -LOCAL_SRC_FILES := \ - Fence.cpp \ +LOCAL_SRC_FILES:= \ FramebufferNativeWindow.cpp \ - FrameStats.cpp \ GraphicBuffer.cpp \ GraphicBufferAllocator.cpp \ GraphicBufferMapper.cpp \ PixelFormat.cpp \ Rect.cpp \ - Region.cpp \ - UiConfig.cpp + Region.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ - libhardware \ - libsync \ libutils \ - liblog + libhardware ifneq ($(BOARD_FRAMEBUFFER_FORCE_FORMAT),) LOCAL_CFLAGS += -DFRAMEBUFFER_FORCE_FORMAT=$(BOARD_FRAMEBUFFER_FORCE_FORMAT) endif -LOCAL_MODULE := libui +LOCAL_MODULE:= libui include $(BUILD_SHARED_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/Fence.cpp android-platform-frameworks-native-21/libs/ui/Fence.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/Fence.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/Fence.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,183 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define LOG_TAG "Fence" -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -// We would eliminate the non-conforming zero-length array, but we can't since -// this is effectively included from the Linux kernel -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wzero-length-array" -#include -#pragma clang diagnostic pop - -#include -#include -#include -#include - -namespace android { - -const sp Fence::NO_FENCE = sp(new Fence); - -Fence::Fence() : - mFenceFd(-1) { -} - -Fence::Fence(int fenceFd) : - mFenceFd(fenceFd) { -} - -Fence::~Fence() { - if (mFenceFd != -1) { - close(mFenceFd); - } -} - -status_t Fence::wait(int timeout) { - ATRACE_CALL(); - if (mFenceFd == -1) { - return NO_ERROR; - } - int err = sync_wait(mFenceFd, timeout); - return err < 0 ? -errno : status_t(NO_ERROR); -} - -status_t Fence::waitForever(const char* logname) { - ATRACE_CALL(); - if (mFenceFd == -1) { - return NO_ERROR; - } - int warningTimeout = 3000; - int err = sync_wait(mFenceFd, warningTimeout); - if (err < 0 && errno == ETIME) { - ALOGE("%s: fence %d didn't signal in %u ms", logname, mFenceFd, - warningTimeout); - err = sync_wait(mFenceFd, TIMEOUT_NEVER); - } - return err < 0 ? -errno : status_t(NO_ERROR); -} - -sp Fence::merge(const String8& name, const sp& f1, - const sp& f2) { - ATRACE_CALL(); - int result; - // Merge the two fences. In the case where one of the fences is not a - // valid fence (e.g. NO_FENCE) we merge the one valid fence with itself so - // that a new fence with the given name is created. - if (f1->isValid() && f2->isValid()) { - result = sync_merge(name.string(), f1->mFenceFd, f2->mFenceFd); - } else if (f1->isValid()) { - result = sync_merge(name.string(), f1->mFenceFd, f1->mFenceFd); - } else if (f2->isValid()) { - result = sync_merge(name.string(), f2->mFenceFd, f2->mFenceFd); - } else { - return NO_FENCE; - } - if (result == -1) { - status_t err = -errno; - ALOGE("merge: sync_merge(\"%s\", %d, %d) returned an error: %s (%d)", - name.string(), f1->mFenceFd, f2->mFenceFd, - strerror(-err), err); - return NO_FENCE; - } - return sp(new Fence(result)); -} - -int Fence::dup() const { - return ::dup(mFenceFd); -} - -nsecs_t Fence::getSignalTime() const { - if (mFenceFd == -1) { - return -1; - } - - struct sync_fence_info_data* finfo = sync_fence_info(mFenceFd); - if (finfo == NULL) { - ALOGE("sync_fence_info returned NULL for fd %d", mFenceFd); - return -1; - } - if (finfo->status != 1) { - sync_fence_info_free(finfo); - return INT64_MAX; - } - - struct sync_pt_info* pinfo = NULL; - uint64_t timestamp = 0; - while ((pinfo = sync_pt_info(finfo, pinfo)) != NULL) { - if (pinfo->timestamp_ns > timestamp) { - timestamp = pinfo->timestamp_ns; - } - } - sync_fence_info_free(finfo); - - return nsecs_t(timestamp); -} - -size_t Fence::getFlattenedSize() const { - return 4; -} - -size_t Fence::getFdCount() const { - return isValid() ? 1 : 0; -} - -status_t Fence::flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const { - if (size < getFlattenedSize() || count < getFdCount()) { - return NO_MEMORY; - } - // Cast to uint32_t since the size of a size_t can vary between 32- and - // 64-bit processes - FlattenableUtils::write(buffer, size, static_cast(getFdCount())); - if (isValid()) { - *fds++ = mFenceFd; - count--; - } - return NO_ERROR; -} - -status_t Fence::unflatten(void const*& buffer, size_t& size, int const*& fds, size_t& count) { - if (mFenceFd != -1) { - // Don't unflatten if we already have a valid fd. - return INVALID_OPERATION; - } - - if (size < 1) { - return NO_MEMORY; - } - - uint32_t numFds; - FlattenableUtils::read(buffer, size, numFds); - - if (numFds > 1) { - return BAD_VALUE; - } - - if (count < numFds) { - return NO_MEMORY; - } - - if (numFds) { - mFenceFd = *fds++; - count--; - } - - return NO_ERROR; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/FramebufferNativeWindow.cpp android-platform-frameworks-native-21/libs/ui/FramebufferNativeWindow.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/FramebufferNativeWindow.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/FramebufferNativeWindow.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,17 +1,17 @@ -/* +/* ** ** Copyright 2007 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 +** 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 +** 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 +** 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. */ @@ -28,10 +28,7 @@ #include #include -#include -#define INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP #include -#undef INCLUDED_FROM_FRAMEBUFFER_NATIVE_WINDOW_CPP #include #include @@ -43,11 +40,11 @@ namespace android { // ---------------------------------------------------------------------------- -class NativeBuffer final +class NativeBuffer : public ANativeObjectBase< - ANativeWindowBuffer, - NativeBuffer, - LightRefBase> + ANativeWindowBuffer, + NativeBuffer, + LightRefBase > { public: NativeBuffer(int w, int h, int f, int u) : BASE() { @@ -57,49 +54,46 @@ ANativeWindowBuffer::usage = u; } private: - friend class LightRefBase; + friend class LightRefBase; + ~NativeBuffer() { }; // this class cannot be overloaded }; /* * This implements the (main) framebuffer management. This class is used * mostly by SurfaceFlinger, but also by command line GL application. - * + * * In fact this is an implementation of ANativeWindow on top of * the framebuffer. - * - * Currently it is pretty simple, it manages only two buffers (the front and + * + * Currently it is pretty simple, it manages only two buffers (the front and * back buffer). - * + * */ -FramebufferNativeWindow::FramebufferNativeWindow() +FramebufferNativeWindow::FramebufferNativeWindow() : BASE(), fbDev(0), grDev(0), mUpdateOnDemand(false) { hw_module_t const* module; if (hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module) == 0) { + int stride; int err; int i; err = framebuffer_open(module, &fbDev); ALOGE_IF(err, "couldn't open framebuffer HAL (%s)", strerror(-err)); - + err = gralloc_open(module, &grDev); ALOGE_IF(err, "couldn't open gralloc HAL (%s)", strerror(-err)); // bail out if we can't initialize the modules if (!fbDev || !grDev) return; - + mUpdateOnDemand = (fbDev->setUpdateRect != 0); - + // initialize the buffer FIFO - if(fbDev->numFramebuffers >= MIN_NUM_FRAME_BUFFERS && - fbDev->numFramebuffers <= MAX_NUM_FRAME_BUFFERS){ - mNumBuffers = fbDev->numFramebuffers; - } else { - mNumBuffers = MIN_NUM_FRAME_BUFFERS; - } - mNumFreeBuffers = mNumBuffers; + mNumBuffers = NUM_FRAME_BUFFERS; + mNumFreeBuffers = NUM_FRAME_BUFFERS; mBufferHead = mNumBuffers-1; /* @@ -114,37 +108,36 @@ *((uint32_t *)&fbDev->format) = FRAMEBUFFER_FORCE_FORMAT; #endif - for (i = 0; i < mNumBuffers; i++) { - buffers[i] = new NativeBuffer( - static_cast(fbDev->width), - static_cast(fbDev->height), - fbDev->format, GRALLOC_USAGE_HW_FB); + for (i = 0; i < mNumBuffers; i++) + { + buffers[i] = new NativeBuffer( + fbDev->width, fbDev->height, fbDev->format, GRALLOC_USAGE_HW_FB); } - for (i = 0; i < mNumBuffers; i++) { - err = grDev->alloc(grDev, - static_cast(fbDev->width), - static_cast(fbDev->height), - fbDev->format, GRALLOC_USAGE_HW_FB, - &buffers[i]->handle, &buffers[i]->stride); - - ALOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s", - i, fbDev->width, fbDev->height, strerror(-err)); - - if (err) { - mNumBuffers = i; - mNumFreeBuffers = i; - mBufferHead = mNumBuffers-1; - break; - } + for (i = 0; i < mNumBuffers; i++) + { + err = grDev->alloc(grDev, + fbDev->width, fbDev->height, fbDev->format, + GRALLOC_USAGE_HW_FB, &buffers[i]->handle, &buffers[i]->stride); + + ALOGE_IF(err, "fb buffer %d allocation failed w=%d, h=%d, err=%s", + i, fbDev->width, fbDev->height, strerror(-err)); + + if (err) + { + mNumBuffers = i; + mNumFreeBuffers = i; + mBufferHead = mNumBuffers-1; + break; + } } - const_cast(ANativeWindow::flags) = fbDev->flags; + const_cast(ANativeWindow::flags) = fbDev->flags; const_cast(ANativeWindow::xdpi) = fbDev->xdpi; const_cast(ANativeWindow::ydpi) = fbDev->ydpi; - const_cast(ANativeWindow::minSwapInterval) = + const_cast(ANativeWindow::minSwapInterval) = fbDev->minSwapInterval; - const_cast(ANativeWindow::maxSwapInterval) = + const_cast(ANativeWindow::maxSwapInterval) = fbDev->maxSwapInterval; } else { ALOGE("Couldn't get gralloc module"); @@ -152,23 +145,19 @@ ANativeWindow::setSwapInterval = setSwapInterval; ANativeWindow::dequeueBuffer = dequeueBuffer; + ANativeWindow::lockBuffer = lockBuffer; ANativeWindow::queueBuffer = queueBuffer; ANativeWindow::query = query; ANativeWindow::perform = perform; - - ANativeWindow::dequeueBuffer_DEPRECATED = dequeueBuffer_DEPRECATED; - ANativeWindow::lockBuffer_DEPRECATED = lockBuffer_DEPRECATED; - ANativeWindow::queueBuffer_DEPRECATED = queueBuffer_DEPRECATED; } -FramebufferNativeWindow::~FramebufferNativeWindow() +FramebufferNativeWindow::~FramebufferNativeWindow() { if (grDev) { - for(int i = 0; i < mNumBuffers; i++) { - if (buffers[i] != NULL) { - grDev->free(grDev, buffers[i]->handle); - } - } + if (buffers[0] != NULL) + grDev->free(grDev, buffers[0]->handle); + if (buffers[1] != NULL) + grDev->free(grDev, buffers[1]->handle); gralloc_close(grDev); } @@ -177,7 +166,7 @@ } } -status_t FramebufferNativeWindow::setUpdateRectangle(const Rect& r) +status_t FramebufferNativeWindow::setUpdateRectangle(const Rect& r) { if (!mUpdateOnDemand) { return INVALID_OPERATION; @@ -194,7 +183,7 @@ } int FramebufferNativeWindow::setSwapInterval( - ANativeWindow* window, int interval) + ANativeWindow* window, int interval) { framebuffer_device_t* fb = getSelf(window)->fbDev; return fb->setSwapInterval(fb, interval); @@ -218,70 +207,55 @@ return index; } -int FramebufferNativeWindow::dequeueBuffer_DEPRECATED(ANativeWindow* window, +int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window, ANativeWindowBuffer** buffer) { - int fenceFd = -1; - int result = dequeueBuffer(window, buffer, &fenceFd); - sp fence(new Fence(fenceFd)); - int waitResult = fence->wait(Fence::TIMEOUT_NEVER); - if (waitResult != OK) { - ALOGE("dequeueBuffer_DEPRECATED: Fence::wait returned an " - "error: %d", waitResult); - return waitResult; - } - return result; -} - -int FramebufferNativeWindow::dequeueBuffer(ANativeWindow* window, - ANativeWindowBuffer** buffer, int* fenceFd) -{ FramebufferNativeWindow* self = getSelf(window); Mutex::Autolock _l(self->mutex); + framebuffer_device_t* fb = self->fbDev; int index = self->mBufferHead++; if (self->mBufferHead >= self->mNumBuffers) self->mBufferHead = 0; - // wait for a free non-front buffer - while (self->mNumFreeBuffers < 2) { + // wait for a free buffer + while (!self->mNumFreeBuffers) { self->mCondition.wait(self->mutex); } - ALOG_ASSERT(self->buffers[index] != self->front, ""); - // get this buffer self->mNumFreeBuffers--; self->mCurrentBufferIndex = index; *buffer = self->buffers[index].get(); - *fenceFd = -1; return 0; } -int FramebufferNativeWindow::lockBuffer_DEPRECATED(ANativeWindow* /*window*/, - ANativeWindowBuffer* /*buffer*/) +int FramebufferNativeWindow::lockBuffer(ANativeWindow* window, + ANativeWindowBuffer* buffer) { + FramebufferNativeWindow* self = getSelf(window); + Mutex::Autolock _l(self->mutex); + + const int index = self->mCurrentBufferIndex; + + // wait that the buffer we're locking is not front anymore + while (self->front == buffer) { + self->mCondition.wait(self->mutex); + } + return NO_ERROR; } -int FramebufferNativeWindow::queueBuffer_DEPRECATED(ANativeWindow* window, +int FramebufferNativeWindow::queueBuffer(ANativeWindow* window, ANativeWindowBuffer* buffer) { - return queueBuffer(window, buffer, -1); -} - -int FramebufferNativeWindow::queueBuffer(ANativeWindow* window, - ANativeWindowBuffer* buffer, int fenceFd) -{ FramebufferNativeWindow* self = getSelf(window); Mutex::Autolock _l(self->mutex); framebuffer_device_t* fb = self->fbDev; buffer_handle_t handle = static_cast(buffer)->handle; - sp fence(new Fence(fenceFd)); - fence->wait(Fence::TIMEOUT_NEVER); - + const int index = self->mCurrentBufferIndex; int res = fb->post(fb, handle); self->front = static_cast(buffer); self->mNumFreeBuffers++; @@ -290,17 +264,17 @@ } int FramebufferNativeWindow::query(const ANativeWindow* window, - int what, int* value) + int what, int* value) { const FramebufferNativeWindow* self = getSelf(window); Mutex::Autolock _l(self->mutex); framebuffer_device_t* fb = self->fbDev; switch (what) { case NATIVE_WINDOW_WIDTH: - *value = static_cast(fb->width); + *value = fb->width; return NO_ERROR; case NATIVE_WINDOW_HEIGHT: - *value = static_cast(fb->height); + *value = fb->height; return NO_ERROR; case NATIVE_WINDOW_FORMAT: *value = fb->format; @@ -312,10 +286,10 @@ *value = 0; return NO_ERROR; case NATIVE_WINDOW_DEFAULT_WIDTH: - *value = static_cast(fb->width); + *value = fb->width; return NO_ERROR; case NATIVE_WINDOW_DEFAULT_HEIGHT: - *value = static_cast(fb->height); + *value = fb->height; return NO_ERROR; case NATIVE_WINDOW_TRANSFORM_HINT: *value = 0; @@ -325,7 +299,7 @@ return BAD_VALUE; } -int FramebufferNativeWindow::perform(ANativeWindow* /*window*/, +int FramebufferNativeWindow::perform(ANativeWindow* window, int operation, ...) { switch (operation) { @@ -356,8 +330,7 @@ }; // namespace android // ---------------------------------------------------------------------------- -using android::sp; -using android::FramebufferNativeWindow; +using namespace android; EGLNativeWindowType android_createDisplaySurface(void) { @@ -368,5 +341,5 @@ sp ref(w); return NULL; } - return static_cast(w); + return (EGLNativeWindowType)w; } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/FrameStats.cpp android-platform-frameworks-native-21/libs/ui/FrameStats.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/FrameStats.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/FrameStats.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,84 +0,0 @@ -/* - * Copyright (C) 2014 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 - -namespace android { - -bool FrameStats::isFixedSize() const { - return false; -} - -size_t FrameStats::getFlattenedSize() const { - const size_t timestampSize = sizeof(nsecs_t); - - size_t size = timestampSize; - size += 3 * desiredPresentTimesNano.size() * timestampSize; - - return size; -} - -status_t FrameStats::flatten(void* buffer, size_t size) const { - if (size < getFlattenedSize()) { - return NO_MEMORY; - } - - nsecs_t* timestamps = reinterpret_cast(buffer); - const size_t timestampSize = sizeof(nsecs_t); - size_t frameCount = desiredPresentTimesNano.size(); - - memcpy(timestamps, &refreshPeriodNano, timestampSize); - timestamps += 1; - - memcpy(timestamps, desiredPresentTimesNano.array(), frameCount * timestampSize); - timestamps += frameCount; - - memcpy(timestamps, actualPresentTimesNano.array(), frameCount * timestampSize); - timestamps += frameCount; - - memcpy(timestamps, frameReadyTimesNano.array(), frameCount * timestampSize); - - return NO_ERROR; -} - -status_t FrameStats::unflatten(void const* buffer, size_t size) { - const size_t timestampSize = sizeof(nsecs_t); - - if (size < timestampSize) { - return NO_MEMORY; - } - - nsecs_t const* timestamps = reinterpret_cast(buffer); - size_t frameCount = (size - timestampSize) / (3 * timestampSize); - - memcpy(&refreshPeriodNano, timestamps, timestampSize); - timestamps += 1; - - desiredPresentTimesNano.resize(frameCount); - memcpy(desiredPresentTimesNano.editArray(), timestamps, frameCount * timestampSize); - timestamps += frameCount; - - actualPresentTimesNano.resize(frameCount); - memcpy(actualPresentTimesNano.editArray(), timestamps, frameCount * timestampSize); - timestamps += frameCount; - - frameReadyTimesNano.resize(frameCount); - memcpy(frameReadyTimesNano.editArray(), timestamps, frameCount * timestampSize); - - return NO_ERROR; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/GraphicBufferAllocator.cpp android-platform-frameworks-native-21/libs/ui/GraphicBufferAllocator.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/GraphicBufferAllocator.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/GraphicBufferAllocator.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,17 +1,17 @@ -/* +/* ** ** Copyright 2009, 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 +** 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 +** 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 +** 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. */ @@ -66,11 +66,11 @@ if (rec.size) { snprintf(buffer, SIZE, "%10p: %7.2f KiB | %4u (%4u) x %4u | %8X | 0x%08x\n", list.keyAt(i), rec.size/1024.0f, - rec.width, rec.stride, rec.height, rec.format, rec.usage); + rec.w, rec.s, rec.h, rec.format, rec.usage); } else { snprintf(buffer, SIZE, "%10p: unknown | %4u (%4u) x %4u | %8X | 0x%08x\n", list.keyAt(i), - rec.width, rec.stride, rec.height, rec.format, rec.usage); + rec.w, rec.s, rec.h, rec.format, rec.usage); } result.append(buffer); total += rec.size; @@ -90,43 +90,39 @@ ALOGD("%s", s.string()); } -status_t GraphicBufferAllocator::alloc(uint32_t width, uint32_t height, - PixelFormat format, uint32_t usage, buffer_handle_t* handle, - uint32_t* stride) +status_t GraphicBufferAllocator::alloc(uint32_t w, uint32_t h, PixelFormat format, + int usage, buffer_handle_t* handle, int32_t* stride) { ATRACE_CALL(); - // make sure to not allocate a N x 0 or 0 x N buffer, since this is // allowed from an API stand-point allocate a 1x1 buffer instead. - if (!width || !height) - width = height = 1; + if (!w || !h) + w = h = 1; // we have a h/w allocator and h/w buffer is requested - status_t err; - - // Filter out any usage bits that should not be passed to the gralloc module - usage &= GRALLOC_USAGE_ALLOC_MASK; - - int outStride = 0; - err = mAllocDev->alloc(mAllocDev, static_cast(width), - static_cast(height), format, static_cast(usage), handle, - &outStride); - *stride = static_cast(outStride); + status_t err; + + err = mAllocDev->alloc(mAllocDev, w, h, format, usage, handle, stride); ALOGW_IF(err, "alloc(%u, %u, %d, %08x, ...) failed %d (%s)", - width, height, format, usage, err, strerror(-err)); - + w, h, format, usage, err, strerror(-err)); + if (err == NO_ERROR) { Mutex::Autolock _l(sLock); KeyedVector& list(sAllocList); - uint32_t bpp = bytesPerPixel(format); + int bpp = bytesPerPixel(format); + if (bpp < 0) { + // probably a HAL custom format. in any case, we don't know + // what its pixel size is. + bpp = 0; + } alloc_rec_t rec; - rec.width = width; - rec.height = height; - rec.stride = *stride; + rec.w = w; + rec.h = h; + rec.s = *stride; rec.format = format; rec.usage = usage; - rec.size = static_cast(height * (*stride) * bpp); + rec.size = h * stride[0] * bpp; list.add(*handle, rec); } diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/GraphicBuffer.cpp android-platform-frameworks-native-21/libs/ui/GraphicBuffer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/GraphicBuffer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/GraphicBuffer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -34,58 +34,51 @@ // Buffer and implementation of ANativeWindowBuffer // =========================================================================== -static uint64_t getUniqueId() { - static volatile int32_t nextId = 0; - uint64_t id = static_cast(getpid()) << 32; - id |= static_cast(android_atomic_inc(&nextId)); - return id; -} - GraphicBuffer::GraphicBuffer() : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()), - mInitCheck(NO_ERROR), mId(getUniqueId()) + mInitCheck(NO_ERROR), mIndex(-1) { - width = - height = - stride = - format = + width = + height = + stride = + format = usage = 0; handle = NULL; } -GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage) +GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h, + PixelFormat reqFormat, uint32_t reqUsage) : BASE(), mOwner(ownData), mBufferMapper(GraphicBufferMapper::get()), - mInitCheck(NO_ERROR), mId(getUniqueId()) + mInitCheck(NO_ERROR), mIndex(-1) { - width = - height = - stride = - format = + width = + height = + stride = + format = usage = 0; handle = NULL; - mInitCheck = initSize(inWidth, inHeight, inFormat, inUsage); + mInitCheck = initSize(w, h, reqFormat, reqUsage); } -GraphicBuffer::GraphicBuffer(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage, uint32_t inStride, - native_handle_t* inHandle, bool keepOwnership) +GraphicBuffer::GraphicBuffer(uint32_t w, uint32_t h, + PixelFormat inFormat, uint32_t inUsage, + uint32_t inStride, native_handle_t* inHandle, bool keepOwnership) : BASE(), mOwner(keepOwnership ? ownHandle : ownNone), mBufferMapper(GraphicBufferMapper::get()), - mInitCheck(NO_ERROR), mId(getUniqueId()) + mInitCheck(NO_ERROR), mIndex(-1) { - width = static_cast(inWidth); - height = static_cast(inHeight); - stride = static_cast(inStride); + width = w; + height = h; + stride = inStride; format = inFormat; - usage = static_cast(inUsage); + usage = inUsage; handle = inHandle; } GraphicBuffer::GraphicBuffer(ANativeWindowBuffer* buffer, bool keepOwnership) : BASE(), mOwner(keepOwnership ? ownHandle : ownNone), mBufferMapper(GraphicBufferMapper::get()), - mInitCheck(NO_ERROR), mWrappedBuffer(buffer), mId(getUniqueId()) + mInitCheck(NO_ERROR), mIndex(-1), mWrappedBuffer(buffer) { width = buffer->width; height = buffer->height; @@ -116,7 +109,7 @@ } status_t GraphicBuffer::initCheck() const { - return static_cast(mInitCheck); + return mInitCheck; } void GraphicBuffer::dumpAllocationsToSystemLog() @@ -126,22 +119,17 @@ ANativeWindowBuffer* GraphicBuffer::getNativeBuffer() const { - LOG_ALWAYS_FATAL_IF(this == NULL, "getNativeBuffer() called on NULL GraphicBuffer"); return static_cast( const_cast(this)); } -status_t GraphicBuffer::reallocate(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage) +status_t GraphicBuffer::reallocate(uint32_t w, uint32_t h, PixelFormat f, + uint32_t reqUsage) { if (mOwner != ownData) return INVALID_OPERATION; - if (handle && - static_cast(inWidth) == width && - static_cast(inHeight) == height && - inFormat == format && - static_cast(inUsage) == usage) + if (handle && w==width && h==height && f==format && reqUsage==usage) return NO_ERROR; if (handle) { @@ -149,74 +137,40 @@ allocator.free(handle); handle = 0; } - return initSize(inWidth, inHeight, inFormat, inUsage); -} - -bool GraphicBuffer::needsReallocation(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage) -{ - if (static_cast(inWidth) != width) return true; - if (static_cast(inHeight) != height) return true; - if (inFormat != format) return true; - if ((static_cast(usage) & inUsage) != inUsage) return true; - return false; + return initSize(w, h, f, reqUsage); } -status_t GraphicBuffer::initSize(uint32_t inWidth, uint32_t inHeight, - PixelFormat inFormat, uint32_t inUsage) +status_t GraphicBuffer::initSize(uint32_t w, uint32_t h, PixelFormat format, + uint32_t reqUsage) { GraphicBufferAllocator& allocator = GraphicBufferAllocator::get(); - uint32_t outStride = 0; - status_t err = allocator.alloc(inWidth, inHeight, inFormat, inUsage, - &handle, &outStride); + status_t err = allocator.alloc(w, h, format, reqUsage, &handle, &stride); if (err == NO_ERROR) { - width = static_cast(inWidth); - height = static_cast(inHeight); - format = inFormat; - usage = static_cast(inUsage); - stride = static_cast(outStride); + this->width = w; + this->height = h; + this->format = format; + this->usage = reqUsage; } return err; } -status_t GraphicBuffer::lock(uint32_t inUsage, void** vaddr) -{ - const Rect lockBounds(width, height); - status_t res = lock(inUsage, lockBounds, vaddr); - return res; -} - -status_t GraphicBuffer::lock(uint32_t inUsage, const Rect& rect, void** vaddr) -{ - if (rect.left < 0 || rect.right > width || - rect.top < 0 || rect.bottom > height) { - ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", - rect.left, rect.top, rect.right, rect.bottom, - width, height); - return BAD_VALUE; - } - status_t res = getBufferMapper().lock(handle, inUsage, rect, vaddr); - return res; -} - -status_t GraphicBuffer::lockYCbCr(uint32_t inUsage, android_ycbcr* ycbcr) +status_t GraphicBuffer::lock(uint32_t usage, void** vaddr) { const Rect lockBounds(width, height); - status_t res = lockYCbCr(inUsage, lockBounds, ycbcr); + status_t res = lock(usage, lockBounds, vaddr); return res; } -status_t GraphicBuffer::lockYCbCr(uint32_t inUsage, const Rect& rect, - android_ycbcr* ycbcr) +status_t GraphicBuffer::lock(uint32_t usage, const Rect& rect, void** vaddr) { - if (rect.left < 0 || rect.right > width || - rect.top < 0 || rect.bottom > height) { + if (rect.left < 0 || rect.right > this->width || + rect.top < 0 || rect.bottom > this->height) { ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", - rect.left, rect.top, rect.right, rect.bottom, - width, height); + rect.left, rect.top, rect.right, rect.bottom, + this->width, this->height); return BAD_VALUE; } - status_t res = getBufferMapper().lockYCbCr(handle, inUsage, rect, ycbcr); + status_t res = getBufferMapper().lock(handle, usage, rect, vaddr); return res; } @@ -226,131 +180,59 @@ return res; } -status_t GraphicBuffer::lockAsync(uint32_t inUsage, void** vaddr, int fenceFd) -{ - const Rect lockBounds(width, height); - status_t res = lockAsync(inUsage, lockBounds, vaddr, fenceFd); - return res; -} - -status_t GraphicBuffer::lockAsync(uint32_t inUsage, const Rect& rect, - void** vaddr, int fenceFd) -{ - if (rect.left < 0 || rect.right > width || - rect.top < 0 || rect.bottom > height) { - ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", - rect.left, rect.top, rect.right, rect.bottom, - width, height); - return BAD_VALUE; - } - status_t res = getBufferMapper().lockAsync(handle, inUsage, rect, vaddr, - fenceFd); - return res; -} - -status_t GraphicBuffer::lockAsyncYCbCr(uint32_t inUsage, android_ycbcr* ycbcr, - int fenceFd) -{ - const Rect lockBounds(width, height); - status_t res = lockAsyncYCbCr(inUsage, lockBounds, ycbcr, fenceFd); - return res; -} - -status_t GraphicBuffer::lockAsyncYCbCr(uint32_t inUsage, const Rect& rect, - android_ycbcr* ycbcr, int fenceFd) -{ - if (rect.left < 0 || rect.right > width || - rect.top < 0 || rect.bottom > height) { - ALOGE("locking pixels (%d,%d,%d,%d) outside of buffer (w=%d, h=%d)", - rect.left, rect.top, rect.right, rect.bottom, - width, height); - return BAD_VALUE; - } - status_t res = getBufferMapper().lockAsyncYCbCr(handle, inUsage, rect, - ycbcr, fenceFd); - return res; -} - -status_t GraphicBuffer::unlockAsync(int *fenceFd) -{ - status_t res = getBufferMapper().unlockAsync(handle, fenceFd); - return res; -} - size_t GraphicBuffer::getFlattenedSize() const { - return static_cast(11 + (handle ? handle->numInts : 0)) * sizeof(int); + return (8 + (handle ? handle->numInts : 0))*sizeof(int); } size_t GraphicBuffer::getFdCount() const { - return static_cast(handle ? handle->numFds : 0); + return handle ? handle->numFds : 0; } -status_t GraphicBuffer::flatten(void*& buffer, size_t& size, int*& fds, size_t& count) const { +status_t GraphicBuffer::flatten(void* buffer, size_t size, + int fds[], size_t count) const +{ size_t sizeNeeded = GraphicBuffer::getFlattenedSize(); if (size < sizeNeeded) return NO_MEMORY; size_t fdCountNeeded = GraphicBuffer::getFdCount(); if (count < fdCountNeeded) return NO_MEMORY; - int32_t* buf = static_cast(buffer); + int* buf = static_cast(buffer); buf[0] = 'GBFR'; buf[1] = width; buf[2] = height; buf[3] = stride; buf[4] = format; buf[5] = usage; - buf[6] = static_cast(mId >> 32); - buf[7] = static_cast(mId & 0xFFFFFFFFull); - buf[8] = static_cast(mGenerationNumber); - buf[9] = 0; - buf[10] = 0; + buf[6] = 0; + buf[7] = 0; if (handle) { - buf[9] = handle->numFds; - buf[10] = handle->numInts; - memcpy(fds, handle->data, - static_cast(handle->numFds) * sizeof(int)); - memcpy(&buf[11], handle->data + handle->numFds, - static_cast(handle->numInts) * sizeof(int)); - } - - buffer = static_cast(static_cast(buffer) + sizeNeeded); - size -= sizeNeeded; - if (handle) { - fds += handle->numFds; - count -= static_cast(handle->numFds); + buf[6] = handle->numFds; + buf[7] = handle->numInts; + native_handle_t const* const h = handle; + memcpy(fds, h->data, h->numFds*sizeof(int)); + memcpy(&buf[8], h->data + h->numFds, h->numInts*sizeof(int)); } return NO_ERROR; } -status_t GraphicBuffer::unflatten( - void const*& buffer, size_t& size, int const*& fds, size_t& count) { - if (size < 11 * sizeof(int)) return NO_MEMORY; +status_t GraphicBuffer::unflatten(void const* buffer, size_t size, + int fds[], size_t count) +{ + if (size < 8*sizeof(int)) return NO_MEMORY; int const* buf = static_cast(buffer); if (buf[0] != 'GBFR') return BAD_TYPE; - const size_t numFds = static_cast(buf[9]); - const size_t numInts = static_cast(buf[10]); - - // Limit the maxNumber to be relatively small. The number of fds or ints - // should not come close to this number, and the number itself was simply - // chosen to be high enough to not cause issues and low enough to prevent - // overflow problems. - const size_t maxNumber = 4096; - if (numFds >= maxNumber || numInts >= (maxNumber - 11)) { - width = height = stride = format = usage = 0; - handle = NULL; - ALOGE("unflatten: numFds or numInts is too large: %zd, %zd", - numFds, numInts); - return BAD_VALUE; - } + const size_t numFds = buf[6]; + const size_t numInts = buf[7]; - const size_t sizeNeeded = (11 + numInts) * sizeof(int); + const size_t sizeNeeded = (8 + numInts) * sizeof(int); if (size < sizeNeeded) return NO_MEMORY; - size_t fdCountNeeded = numFds; + size_t fdCountNeeded = 0; if (count < fdCountNeeded) return NO_MEMORY; if (handle) { @@ -364,48 +246,33 @@ stride = buf[3]; format = buf[4]; usage = buf[5]; - native_handle* h = native_handle_create( - static_cast(numFds), static_cast(numInts)); - if (!h) { - width = height = stride = format = usage = 0; - handle = NULL; - ALOGE("unflatten: native_handle_create failed"); - return NO_MEMORY; - } - memcpy(h->data, fds, numFds * sizeof(int)); - memcpy(h->data + numFds, &buf[11], numInts * sizeof(int)); + native_handle* h = native_handle_create(numFds, numInts); + memcpy(h->data, fds, numFds*sizeof(int)); + memcpy(h->data + numFds, &buf[8], numInts*sizeof(int)); handle = h; } else { width = height = stride = format = usage = 0; handle = NULL; } - mId = static_cast(buf[6]) << 32; - mId |= static_cast(buf[7]); - - mGenerationNumber = static_cast(buf[8]); - mOwner = ownHandle; if (handle != 0) { - status_t err = mBufferMapper.registerBuffer(handle); - if (err != NO_ERROR) { - width = height = stride = format = usage = 0; - handle = NULL; - ALOGE("unflatten: registerBuffer failed: %s (%d)", - strerror(-err), err); - return err; - } + mBufferMapper.registerBuffer(handle); } - buffer = static_cast(static_cast(buffer) + sizeNeeded); - size -= sizeNeeded; - fds += numFds; - count -= numFds; - return NO_ERROR; } + +void GraphicBuffer::setIndex(int index) { + mIndex = index; +} + +int GraphicBuffer::getIndex() const { + return mIndex; +} + // --------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/GraphicBufferMapper.cpp android-platform-frameworks-native-21/libs/ui/GraphicBufferMapper.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/GraphicBufferMapper.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/GraphicBufferMapper.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -20,13 +20,6 @@ #include #include -// We would eliminate the non-conforming zero-length array, but we can't since -// this is effectively included from the Linux kernel -#pragma clang diagnostic push -#pragma clang diagnostic ignored "-Wzero-length-array" -#include -#pragma clang diagnostic pop - #include #include #include @@ -49,7 +42,7 @@ int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); ALOGE_IF(err, "FATAL: can't find the %s module", GRALLOC_HARDWARE_MODULE_ID); if (err == 0) { - mAllocMod = reinterpret_cast(module); + mAllocMod = (gralloc_module_t const *)module; } } @@ -77,13 +70,13 @@ return err; } -status_t GraphicBufferMapper::lock(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, void** vaddr) +status_t GraphicBufferMapper::lock(buffer_handle_t handle, + int usage, const Rect& bounds, void** vaddr) { ATRACE_CALL(); status_t err; - err = mAllocMod->lock(mAllocMod, handle, static_cast(usage), + err = mAllocMod->lock(mAllocMod, handle, usage, bounds.left, bounds.top, bounds.width(), bounds.height(), vaddr); @@ -91,24 +84,6 @@ return err; } -status_t GraphicBufferMapper::lockYCbCr(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr) -{ - ATRACE_CALL(); - status_t err; - - if (mAllocMod->lock_ycbcr == NULL) { - return -EINVAL; // do not log failure - } - - err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast(usage), - bounds.left, bounds.top, bounds.width(), bounds.height(), - ycbcr); - - ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err)); - return err; -} - status_t GraphicBufferMapper::unlock(buffer_handle_t handle) { ATRACE_CALL(); @@ -120,75 +95,5 @@ return err; } -status_t GraphicBufferMapper::lockAsync(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, void** vaddr, int fenceFd) -{ - ATRACE_CALL(); - status_t err; - - if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3) { - err = mAllocMod->lockAsync(mAllocMod, handle, static_cast(usage), - bounds.left, bounds.top, bounds.width(), bounds.height(), - vaddr, fenceFd); - } else { - if (fenceFd >= 0) { - sync_wait(fenceFd, -1); - close(fenceFd); - } - err = mAllocMod->lock(mAllocMod, handle, static_cast(usage), - bounds.left, bounds.top, bounds.width(), bounds.height(), - vaddr); - } - - ALOGW_IF(err, "lockAsync(...) failed %d (%s)", err, strerror(-err)); - return err; -} - -status_t GraphicBufferMapper::lockAsyncYCbCr(buffer_handle_t handle, - uint32_t usage, const Rect& bounds, android_ycbcr *ycbcr, int fenceFd) -{ - ATRACE_CALL(); - status_t err; - - if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3 - && mAllocMod->lockAsync_ycbcr != NULL) { - err = mAllocMod->lockAsync_ycbcr(mAllocMod, handle, - static_cast(usage), bounds.left, bounds.top, - bounds.width(), bounds.height(), ycbcr, fenceFd); - } else if (mAllocMod->lock_ycbcr != NULL) { - if (fenceFd >= 0) { - sync_wait(fenceFd, -1); - close(fenceFd); - } - err = mAllocMod->lock_ycbcr(mAllocMod, handle, static_cast(usage), - bounds.left, bounds.top, bounds.width(), bounds.height(), - ycbcr); - } else { - if (fenceFd >= 0) { - close(fenceFd); - } - return -EINVAL; // do not log failure - } - - ALOGW_IF(err, "lock(...) failed %d (%s)", err, strerror(-err)); - return err; -} - -status_t GraphicBufferMapper::unlockAsync(buffer_handle_t handle, int *fenceFd) -{ - ATRACE_CALL(); - status_t err; - - if (mAllocMod->common.module_api_version >= GRALLOC_MODULE_API_VERSION_0_3) { - err = mAllocMod->unlockAsync(mAllocMod, handle, fenceFd); - } else { - *fenceFd = -1; - err = mAllocMod->unlock(mAllocMod, handle); - } - - ALOGW_IF(err, "unlockAsync(...) failed %d (%s)", err, strerror(-err)); - return err; -} - // --------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/PixelFormat.cpp android-platform-frameworks-native-21/libs/ui/PixelFormat.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/PixelFormat.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/PixelFormat.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -15,43 +15,132 @@ */ #include +#include // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- -uint32_t bytesPerPixel(PixelFormat format) { - switch (format) { - case PIXEL_FORMAT_RGBA_8888: - case PIXEL_FORMAT_RGBX_8888: - case PIXEL_FORMAT_BGRA_8888: - return 4; - case PIXEL_FORMAT_RGB_888: - return 3; - case PIXEL_FORMAT_RGB_565: - case PIXEL_FORMAT_RGBA_5551: - case PIXEL_FORMAT_RGBA_4444: - return 2; +static const int COMPONENT_YUV = 0xFF; + +struct Info { + size_t size; + size_t bitsPerPixel; + struct { + uint8_t ah; + uint8_t al; + uint8_t rh; + uint8_t rl; + uint8_t gh; + uint8_t gl; + uint8_t bh; + uint8_t bl; + }; + uint8_t components; +}; + +static Info const sPixelFormatInfos[] = { + { 0, 0, { 0, 0, 0, 0, 0, 0, 0, 0 }, 0 }, + { 4, 32, {32,24, 8, 0, 16, 8, 24,16 }, PixelFormatInfo::RGBA }, + { 4, 24, { 0, 0, 8, 0, 16, 8, 24,16 }, PixelFormatInfo::RGB }, + { 3, 24, { 0, 0, 8, 0, 16, 8, 24,16 }, PixelFormatInfo::RGB }, + { 2, 16, { 0, 0, 16,11, 11, 5, 5, 0 }, PixelFormatInfo::RGB }, + { 4, 32, {32,24, 24,16, 16, 8, 8, 0 }, PixelFormatInfo::RGBA }, + { 2, 16, { 1, 0, 16,11, 11, 6, 6, 1 }, PixelFormatInfo::RGBA }, + { 2, 16, { 4, 0, 16,12, 12, 8, 8, 4 }, PixelFormatInfo::RGBA }, + { 1, 8, { 8, 0, 0, 0, 0, 0, 0, 0 }, PixelFormatInfo::ALPHA}, + { 1, 8, { 0, 0, 8, 0, 8, 0, 8, 0 }, PixelFormatInfo::L }, + { 2, 16, {16, 8, 8, 0, 8, 0, 8, 0 }, PixelFormatInfo::LA }, + { 1, 8, { 0, 0, 8, 5, 5, 2, 2, 0 }, PixelFormatInfo::RGB }, +}; + +static const Info* gGetPixelFormatTable(size_t* numEntries) { + if (numEntries) { + *numEntries = sizeof(sPixelFormatInfos)/sizeof(Info); + } + return sPixelFormatInfos; +} + +// ---------------------------------------------------------------------------- + +size_t PixelFormatInfo::getScanlineSize(unsigned int width) const +{ + size_t size; + if (components == COMPONENT_YUV) { + // YCbCr formats are different. + size = (width * bitsPerPixel)>>3; + } else { + size = width * bytesPerPixel; } - return 0; + return size; +} + +ssize_t bytesPerPixel(PixelFormat format) +{ + PixelFormatInfo info; + status_t err = getPixelFormatInfo(format, &info); + return (err < 0) ? err : info.bytesPerPixel; +} + +ssize_t bitsPerPixel(PixelFormat format) +{ + PixelFormatInfo info; + status_t err = getPixelFormatInfo(format, &info); + return (err < 0) ? err : info.bitsPerPixel; } -uint32_t bitsPerPixel(PixelFormat format) { +status_t getPixelFormatInfo(PixelFormat format, PixelFormatInfo* info) +{ + if (format <= 0) + return BAD_VALUE; + + if (info->version != sizeof(PixelFormatInfo)) + return INVALID_OPERATION; + + // YUV format from the HAL are handled here switch (format) { - case PIXEL_FORMAT_RGBA_8888: - case PIXEL_FORMAT_RGBX_8888: - case PIXEL_FORMAT_BGRA_8888: - return 32; - case PIXEL_FORMAT_RGB_888: - return 24; - case PIXEL_FORMAT_RGB_565: - case PIXEL_FORMAT_RGBA_5551: - case PIXEL_FORMAT_RGBA_4444: - return 16; + case HAL_PIXEL_FORMAT_YCbCr_422_SP: + case HAL_PIXEL_FORMAT_YCbCr_422_I: + info->bitsPerPixel = 16; + goto done; + case HAL_PIXEL_FORMAT_YCrCb_420_SP: + case HAL_PIXEL_FORMAT_YV12: + info->bitsPerPixel = 12; + done: + info->format = format; + info->components = COMPONENT_YUV; + info->bytesPerPixel = 1; + info->h_alpha = 0; + info->l_alpha = 0; + info->h_red = info->h_green = info->h_blue = 8; + info->l_red = info->l_green = info->l_blue = 0; + return NO_ERROR; } - return 0; + + size_t numEntries; + const Info *i = gGetPixelFormatTable(&numEntries) + format; + bool valid = uint32_t(format) < numEntries; + if (!valid) { + return BAD_INDEX; + } + + info->format = format; + info->bytesPerPixel = i->size; + info->bitsPerPixel = i->bitsPerPixel; + info->h_alpha = i->ah; + info->l_alpha = i->al; + info->h_red = i->rh; + info->l_red = i->rl; + info->h_green = i->gh; + info->l_green = i->gl; + info->h_blue = i->bh; + info->l_blue = i->bl; + info->components = i->components; + + return NO_ERROR; } // ---------------------------------------------------------------------------- }; // namespace android // ---------------------------------------------------------------------------- + diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/Rect.cpp android-platform-frameworks-native-21/libs/ui/Rect.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/Rect.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/Rect.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -19,14 +19,12 @@ namespace android { -const Rect Rect::INVALID_RECT{0, 0, -1, -1}; - static inline int32_t min(int32_t a, int32_t b) { - return (a < b) ? a : b; + return (a b) ? a : b; + return (a>b) ? a : b; } void Rect::makeInvalid() { @@ -36,17 +34,18 @@ bottom = -1; } -bool Rect::operator <(const Rect& rhs) const { - if (top < rhs.top) { +bool Rect::operator < (const Rect& rhs) const +{ + if (topleft = max(left, with.left); - result->top = max(top, with.top); - result->right = min(right, with.right); - result->bottom = min(bottom, with.bottom); +bool Rect::intersect(const Rect& with, Rect* result) const +{ + result->left = max(left, with.left); + result->top = max(top, with.top); + result->right = min(right, with.right); + result->bottom = min(bottom, with.bottom); return !(result->isEmpty()); } Rect Rect::transform(uint32_t xform, int32_t width, int32_t height) const { Rect result(*this); if (xform & HAL_TRANSFORM_FLIP_H) { - result = Rect(width - result.right, result.top, width - result.left, - result.bottom); + result = Rect(width - result.right, result.top, + width - result.left, result.bottom); } if (xform & HAL_TRANSFORM_FLIP_V) { - result = Rect(result.left, height - result.bottom, result.right, - height - result.top); + result = Rect(result.left, height - result.bottom, + result.right, height - result.top); } if (xform & HAL_TRANSFORM_ROT_90) { int left = height - result.bottom; @@ -109,35 +113,4 @@ return result; } -Rect Rect::reduce(const Rect& exclude) const { - Rect result; - - uint32_t mask = 0; - mask |= (exclude.left > left) ? 1 : 0; - mask |= (exclude.top > top) ? 2 : 0; - mask |= (exclude.right < right) ? 4 : 0; - mask |= (exclude.bottom < bottom) ? 8 : 0; - - if (mask == 0) { - // crop entirely covers us - result.clear(); - } else { - result = *this; - if (!(mask & (mask - 1))) { - // power-of-2, i.e.: just one bit is set - if (mask & 1) { - result.right = exclude.left; - } else if (mask & 2) { - result.bottom = exclude.top; - } else if (mask & 4) { - result.left = exclude.right; - } else if (mask & 8) { - result.top = exclude.bottom; - } - } - } - - return result; -} - }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/Region.cpp android-platform-frameworks-native-21/libs/ui/Region.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/Region.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/Region.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,12 +16,10 @@ #define LOG_TAG "Region" -#include #include #include #include -#include #include #include @@ -48,163 +46,34 @@ op_xor = region_operator::op_xor }; -enum { - direction_LTR, - direction_RTL -}; - -const Region Region::INVALID_REGION(Rect::INVALID_RECT); - // ---------------------------------------------------------------------------- -Region::Region() { - mStorage.add(Rect(0,0)); +Region::Region() + : mBounds(0,0) +{ } Region::Region(const Region& rhs) - : mStorage(rhs.mStorage) + : mBounds(rhs.mBounds), mStorage(rhs.mStorage) { #if VALIDATE_REGIONS validate(rhs, "rhs copy-ctor"); #endif } -Region::Region(const Rect& rhs) { - mStorage.add(rhs); -} - -Region::~Region() +Region::Region(const Rect& rhs) + : mBounds(rhs) { } -/** - * Copy rects from the src vector into the dst vector, resolving vertical T-Junctions along the way - * - * First pass through, divideSpanRTL will be set because the 'previous span' (indexing into the dst - * vector) will be reversed. Each rectangle in the original list, starting from the bottom, will be - * compared with the span directly below, and subdivided as needed to resolve T-junctions. - * - * The resulting temporary vector will be a completely reversed copy of the original, without any - * bottom-up T-junctions. - * - * Second pass through, divideSpanRTL will be false since the previous span will index into the - * final, correctly ordered region buffer. Each rectangle will be compared with the span directly - * above it, and subdivided to resolve any remaining T-junctions. - */ -static void reverseRectsResolvingJunctions(const Rect* begin, const Rect* end, - Vector& dst, int spanDirection) { - dst.clear(); - - const Rect* current = end - 1; - int lastTop = current->top; - - // add first span immediately - do { - dst.add(*current); - current--; - } while (current->top == lastTop && current >= begin); - - int beginLastSpan = -1; - int endLastSpan = -1; - int top = -1; - int bottom = -1; - - // for all other spans, split if a t-junction exists in the span directly above - while (current >= begin) { - if (current->top != (current + 1)->top) { - // new span - if ((spanDirection == direction_RTL && current->bottom != (current + 1)->top) || - (spanDirection == direction_LTR && current->top != (current + 1)->bottom)) { - // previous span not directly adjacent, don't check for T junctions - beginLastSpan = INT_MAX; - } else { - beginLastSpan = endLastSpan + 1; - } - endLastSpan = static_cast(dst.size()) - 1; - - top = current->top; - bottom = current->bottom; - } - int left = current->left; - int right = current->right; - - for (int prevIndex = beginLastSpan; prevIndex <= endLastSpan; prevIndex++) { - // prevIndex can't be -1 here because if endLastSpan is set to a - // value greater than -1 (allowing the loop to execute), - // beginLastSpan (and therefore prevIndex) will also be increased - const Rect prev = dst[static_cast(prevIndex)]; - if (spanDirection == direction_RTL) { - // iterating over previous span RTL, quit if it's too far left - if (prev.right <= left) break; - - if (prev.right > left && prev.right < right) { - dst.add(Rect(prev.right, top, right, bottom)); - right = prev.right; - } - - if (prev.left > left && prev.left < right) { - dst.add(Rect(prev.left, top, right, bottom)); - right = prev.left; - } - - // if an entry in the previous span is too far right, nothing further left in the - // current span will need it - if (prev.left >= right) { - beginLastSpan = prevIndex; - } - } else { - // iterating over previous span LTR, quit if it's too far right - if (prev.left >= right) break; - - if (prev.left > left && prev.left < right) { - dst.add(Rect(left, top, prev.left, bottom)); - left = prev.left; - } - - if (prev.right > left && prev.right < right) { - dst.add(Rect(left, top, prev.right, bottom)); - left = prev.right; - } - // if an entry in the previous span is too far left, nothing further right in the - // current span will need it - if (prev.right <= left) { - beginLastSpan = prevIndex; - } - } - } - - if (left < right) { - dst.add(Rect(left, top, right, bottom)); - } - - current--; - } +Region::Region(const void* buffer) +{ + status_t err = read(buffer); + ALOGE_IF(err<0, "error %s reading Region from buffer", strerror(err)); } -/** - * Creates a new region with the same data as the argument, but divides rectangles as necessary to - * remove T-Junctions - * - * Note: the output will not necessarily be a very efficient representation of the region, since it - * may be that a triangle-based approach would generate significantly simpler geometry - */ -Region Region::createTJunctionFreeRegion(const Region& r) { - if (r.isEmpty()) return r; - if (r.isRect()) return r; - - Vector reversed; - reverseRectsResolvingJunctions(r.begin(), r.end(), reversed, direction_RTL); - - Region outputRegion; - reverseRectsResolvingJunctions(reversed.begin(), reversed.end(), - outputRegion.mStorage, direction_LTR); - outputRegion.mStorage.add(r.getBounds()); // to make region valid, mStorage must end with bounds - -#if VALIDATE_REGIONS - validate(outputRegion, "T-Junction free region"); -#endif - - return outputRegion; +Region::~Region() +{ } Region& Region::operator = (const Region& rhs) @@ -213,71 +82,43 @@ validate(*this, "this->operator="); validate(rhs, "rhs.operator="); #endif + mBounds = rhs.mBounds; mStorage = rhs.mStorage; return *this; } Region& Region::makeBoundsSelf() { - if (mStorage.size() >= 2) { - const Rect bounds(getBounds()); - mStorage.clear(); - mStorage.add(bounds); - } + mStorage.clear(); return *this; } -bool Region::contains(const Point& point) const { - return contains(point.x, point.y); -} - -bool Region::contains(int x, int y) const { - const_iterator cur = begin(); - const_iterator const tail = end(); - while (cur != tail) { - if (y >= cur->top && y < cur->bottom && x >= cur->left && x < cur->right) { - return true; - } - cur++; - } - return false; -} - void Region::clear() { + mBounds.clear(); mStorage.clear(); - mStorage.add(Rect(0,0)); } void Region::set(const Rect& r) { + mBounds = r; mStorage.clear(); - mStorage.add(r); -} - -void Region::set(int32_t w, int32_t h) -{ - mStorage.clear(); - mStorage.add(Rect(w, h)); } void Region::set(uint32_t w, uint32_t h) { + mBounds = Rect(int(w), int(h)); mStorage.clear(); - mStorage.add(Rect(w, h)); -} - -bool Region::isTriviallyEqual(const Region& region) const { - return begin() == region.begin(); } // ---------------------------------------------------------------------------- void Region::addRectUnchecked(int l, int t, int r, int b) { - Rect rect(l,t,r,b); - size_t where = mStorage.size() - 1; - mStorage.insertAt(rect, where, 1); + mStorage.add(Rect(l,t,r,b)); +#if VALIDATE_REGIONS + validate(*this, "addRectUnchecked"); +#endif } // ---------------------------------------------------------------------------- @@ -415,169 +256,130 @@ // This is our region rasterizer, which merges rects and spans together // to obtain an optimal region. -class Region::rasterizer : public region_operator::region_rasterizer +class Region::rasterizer : public region_operator::region_rasterizer { - Rect bounds; + Rect& bounds; Vector& storage; Rect* head; Rect* tail; Vector span; Rect* cur; public: - rasterizer(Region& reg) - : bounds(INT_MAX, 0, INT_MIN, 0), storage(reg.mStorage), head(), tail(), cur() { + rasterizer(Region& reg) + : bounds(reg.mBounds), storage(reg.mStorage), head(), tail(), cur() { + bounds.top = bounds.bottom = 0; + bounds.left = INT_MAX; + bounds.right = INT_MIN; storage.clear(); } - virtual ~rasterizer(); - - virtual void operator()(const Rect& rect); - -private: - template - static inline T min(T rhs, T lhs) { return rhs < lhs ? rhs : lhs; } - template - static inline T max(T rhs, T lhs) { return rhs > lhs ? rhs : lhs; } - - void flushSpan(); -}; - -Region::rasterizer::~rasterizer() -{ - if (span.size()) { - flushSpan(); + ~rasterizer() { + if (span.size()) { + flushSpan(); + } + if (storage.size()) { + bounds.top = storage.itemAt(0).top; + bounds.bottom = storage.top().bottom; + if (storage.size() == 1) { + storage.clear(); + } + } else { + bounds.left = 0; + bounds.right = 0; + } } - if (storage.size()) { - bounds.top = storage.itemAt(0).top; - bounds.bottom = storage.top().bottom; - if (storage.size() == 1) { - storage.clear(); + + virtual void operator()(const Rect& rect) { + //ALOGD(">>> %3d, %3d, %3d, %3d", + // rect.left, rect.top, rect.right, rect.bottom); + if (span.size()) { + if (cur->top != rect.top) { + flushSpan(); + } else if (cur->right == rect.left) { + cur->right = rect.right; + return; + } } - } else { - bounds.left = 0; - bounds.right = 0; + span.add(rect); + cur = span.editArray() + (span.size() - 1); } - storage.add(bounds); -} - -void Region::rasterizer::operator()(const Rect& rect) -{ - //ALOGD(">>> %3d, %3d, %3d, %3d", - // rect.left, rect.top, rect.right, rect.bottom); - if (span.size()) { - if (cur->top != rect.top) { - flushSpan(); - } else if (cur->right == rect.left) { - cur->right = rect.right; - return; - } - } - span.add(rect); - cur = span.editArray() + (span.size() - 1); -} - -void Region::rasterizer::flushSpan() -{ - bool merge = false; - if (tail-head == ssize_t(span.size())) { - Rect const* p = span.editArray(); - Rect const* q = head; - if (p->top == q->bottom) { - merge = true; - while (q != tail) { - if ((p->left != q->left) || (p->right != q->right)) { - merge = false; - break; +private: + template + static inline T min(T rhs, T lhs) { return rhs < lhs ? rhs : lhs; } + template + static inline T max(T rhs, T lhs) { return rhs > lhs ? rhs : lhs; } + void flushSpan() { + bool merge = false; + if (tail-head == ssize_t(span.size())) { + Rect const* p = span.editArray(); + Rect const* q = head; + if (p->top == q->bottom) { + merge = true; + while (q != tail) { + if ((p->left != q->left) || (p->right != q->right)) { + merge = false; + break; + } + p++, q++; } - p++, q++; } } - } - if (merge) { - const int bottom = span[0].bottom; - Rect* r = head; - while (r != tail) { - r->bottom = bottom; - r++; + if (merge) { + const int bottom = span[0].bottom; + Rect* r = head; + while (r != tail) { + r->bottom = bottom; + r++; + } + } else { + bounds.left = min(span.itemAt(0).left, bounds.left); + bounds.right = max(span.top().right, bounds.right); + storage.appendVector(span); + tail = storage.editArray() + storage.size(); + head = tail - span.size(); } - } else { - bounds.left = min(span.itemAt(0).left, bounds.left); - bounds.right = max(span.top().right, bounds.right); - storage.appendVector(span); - tail = storage.editArray() + storage.size(); - head = tail - span.size(); + span.clear(); } - span.clear(); -} +}; -bool Region::validate(const Region& reg, const char* name, bool silent) +bool Region::validate(const Region& reg, const char* name) { bool result = true; const_iterator cur = reg.begin(); const_iterator const tail = reg.end(); - const_iterator prev = cur; + const_iterator prev = cur++; Rect b(*prev); while (cur != tail) { - if (cur->isValid() == false) { - // We allow this particular flavor of invalid Rect, since it is used - // as a signal value in various parts of the system - if (*cur != Rect::INVALID_RECT) { - ALOGE_IF(!silent, "%s: region contains an invalid Rect", name); - result = false; - } - } - if (cur->right > region_operator::max_value) { - ALOGE_IF(!silent, "%s: rect->right > max_value", name); - result = false; - } - if (cur->bottom > region_operator::max_value) { - ALOGE_IF(!silent, "%s: rect->right > max_value", name); - result = false; - } - if (prev != cur) { - b.left = b.left < cur->left ? b.left : cur->left; - b.top = b.top < cur->top ? b.top : cur->top; - b.right = b.right > cur->right ? b.right : cur->right; - b.bottom = b.bottom > cur->bottom ? b.bottom : cur->bottom; - if ((*prev < *cur) == false) { - ALOGE_IF(!silent, "%s: region's Rects not sorted", name); + b.left = b.left < cur->left ? b.left : cur->left; + b.top = b.top < cur->top ? b.top : cur->top; + b.right = b.right > cur->right ? b.right : cur->right; + b.bottom = b.bottom > cur->bottom ? b.bottom : cur->bottom; + if (cur->top == prev->top) { + if (cur->bottom != prev->bottom) { + ALOGE("%s: invalid span %p", name, cur); result = false; - } - if (cur->top == prev->top) { - if (cur->bottom != prev->bottom) { - ALOGE_IF(!silent, "%s: invalid span %p", name, cur); - result = false; - } else if (cur->left < prev->right) { - ALOGE_IF(!silent, - "%s: spans overlap horizontally prev=%p, cur=%p", - name, prev, cur); - result = false; - } - } else if (cur->top < prev->bottom) { - ALOGE_IF(!silent, - "%s: spans overlap vertically prev=%p, cur=%p", + } else if (cur->left < prev->right) { + ALOGE("%s: spans overlap horizontally prev=%p, cur=%p", name, prev, cur); result = false; } - prev = cur; + } else if (cur->top < prev->bottom) { + ALOGE("%s: spans overlap vertically prev=%p, cur=%p", + name, prev, cur); + result = false; } + prev = cur; cur++; } if (b != reg.getBounds()) { result = false; - ALOGE_IF(!silent, - "%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name, + ALOGE("%s: invalid bounds [%d,%d,%d,%d] vs. [%d,%d,%d,%d]", name, b.left, b.top, b.right, b.bottom, reg.getBounds().left, reg.getBounds().top, reg.getBounds().right, reg.getBounds().bottom); } - if (reg.mStorage.size() == 2) { - result = false; - ALOGE_IF(!silent, "%s: mStorage size is 2, which is never valid", name); - } - if (result == false && !silent) { + if (result == false) { reg.dump(name); - CallStack stack(LOG_TAG); } return result; } @@ -696,9 +498,7 @@ const Region& lhs, const Rect& rhs, int dx, int dy) { - // We allow this particular flavor of invalid Rect, since it is used as a - // signal value in various parts of the system - if (!rhs.isValid() && rhs != Rect::INVALID_RECT) { + if (!rhs.isValid()) { ALOGE("Region::boolean_operation(op=%d) invalid Rect={%d,%d,%d,%d}", op, rhs.left, rhs.top, rhs.right, rhs.bottom); return; @@ -735,14 +535,15 @@ void Region::translate(Region& reg, int dx, int dy) { - if ((dx || dy) && !reg.isEmpty()) { + if (!reg.isEmpty()) { #if VALIDATE_REGIONS validate(reg, "translate (before)"); #endif + reg.mBounds.translate(dx, dy); size_t count = reg.mStorage.size(); Rect* rects = reg.mStorage.editArray(); while (count) { - rects->offsetBy(dx, dy); + rects->translate(dx, dy); rects++; count--; } @@ -760,114 +561,120 @@ // ---------------------------------------------------------------------------- -size_t Region::getFlattenedSize() const { - return sizeof(uint32_t) + mStorage.size() * sizeof(Rect); -} - -status_t Region::flatten(void* buffer, size_t size) const { +ssize_t Region::write(void* buffer, size_t size) const +{ #if VALIDATE_REGIONS - validate(*this, "Region::flatten"); + validate(*this, "write(buffer)"); #endif - if (size < getFlattenedSize()) { - return NO_MEMORY; - } - // Cast to uint32_t since the size of a size_t can vary between 32- and - // 64-bit processes - FlattenableUtils::write(buffer, size, static_cast(mStorage.size())); - for (auto rect : mStorage) { - status_t result = rect.flatten(buffer, size); - if (result != NO_ERROR) { - return result; + const size_t count = mStorage.size(); + const size_t sizeNeeded = sizeof(int32_t) + (1+count)*sizeof(Rect); + if (buffer != NULL) { + if (sizeNeeded > size) return NO_MEMORY; + int32_t* const p = static_cast(buffer); + *p = count; + memcpy(p+1, &mBounds, sizeof(Rect)); + if (count) { + memcpy(p+5, mStorage.array(), count*sizeof(Rect)); } - FlattenableUtils::advance(buffer, size, sizeof(rect)); } - return NO_ERROR; + return ssize_t(sizeNeeded); } -status_t Region::unflatten(void const* buffer, size_t size) { - if (size < sizeof(uint32_t)) { - return NO_MEMORY; - } - - uint32_t numRects = 0; - FlattenableUtils::read(buffer, size, numRects); - if (size < numRects * sizeof(Rect)) { - return NO_MEMORY; - } - - Region result; - result.mStorage.clear(); - for (size_t r = 0; r < numRects; ++r) { - Rect rect; - status_t status = rect.unflatten(buffer, size); - if (status != NO_ERROR) { - return status; - } - FlattenableUtils::advance(buffer, size, sizeof(rect)); - result.mStorage.push_back(rect); +ssize_t Region::read(const void* buffer) +{ + int32_t const* const p = static_cast(buffer); + const size_t count = *p; + memcpy(&mBounds, p+1, sizeof(Rect)); + mStorage.clear(); + if (count) { + mStorage.insertAt(0, count); + memcpy(mStorage.editArray(), p+5, count*sizeof(Rect)); } - #if VALIDATE_REGIONS - validate(result, "Region::unflatten"); + validate(*this, "read(buffer)"); #endif + return ssize_t(sizeof(int32_t) + (1+count)*sizeof(Rect)); +} - if (!result.validate(result, "Region::unflatten", true)) { - ALOGE("Region::unflatten() failed, invalid region"); - return BAD_VALUE; - } - mStorage = result.mStorage; - return NO_ERROR; +ssize_t Region::writeEmpty(void* buffer, size_t size) +{ + const size_t sizeNeeded = sizeof(int32_t) + sizeof(Rect); + if (sizeNeeded > size) return NO_MEMORY; + int32_t* const p = static_cast(buffer); + memset(p, 0, sizeNeeded); + return ssize_t(sizeNeeded); +} + +bool Region::isEmpty(void* buffer) +{ + int32_t const* const p = static_cast(buffer); + Rect const* const b = reinterpret_cast(p+1); + return b->isEmpty(); } // ---------------------------------------------------------------------------- Region::const_iterator Region::begin() const { - return mStorage.array(); + return isRect() ? &mBounds : mStorage.array(); } Region::const_iterator Region::end() const { - size_t numRects = isRect() ? 1 : mStorage.size() - 1; - return mStorage.array() + numRects; + if (isRect()) { + if (isEmpty()) { + return &mBounds; + } else { + return &mBounds + 1; + } + } else { + return mStorage.array() + mStorage.size(); + } } Rect const* Region::getArray(size_t* count) const { - if (count) *count = static_cast(end() - begin()); - return begin(); + const_iterator const b(begin()); + const_iterator const e(end()); + if (count) *count = e-b; + return b; } -SharedBuffer const* Region::getSharedBuffer(size_t* count) const { - // We can get to the SharedBuffer of a Vector because Rect has - // a trivial destructor. - SharedBuffer const* sb = SharedBuffer::bufferFromData(mStorage.array()); - if (count) { - size_t numRects = isRect() ? 1 : mStorage.size() - 1; - count[0] = numRects; +size_t Region::getRects(Vector& rectList) const +{ + rectList = mStorage; + if (rectList.isEmpty()) { + rectList.clear(); + rectList.add(mBounds); } - sb->acquire(); - return sb; + return rectList.size(); } // ---------------------------------------------------------------------------- -void Region::dump(String8& out, const char* what, uint32_t /* flags */) const +void Region::dump(String8& out, const char* what, uint32_t flags) const { + (void)flags; const_iterator head = begin(); const_iterator const tail = end(); - out.appendFormat(" Region %s (this=%p, count=%" PRIdPTR ")\n", - what, this, tail - head); + size_t SIZE = 256; + char buffer[SIZE]; + + snprintf(buffer, SIZE, " Region %s (this=%p, count=%d)\n", + what, this, tail-head); + out.append(buffer); while (head != tail) { - out.appendFormat(" [%3d, %3d, %3d, %3d]\n", head->left, head->top, - head->right, head->bottom); - ++head; + snprintf(buffer, SIZE, " [%3d, %3d, %3d, %3d]\n", + head->left, head->top, head->right, head->bottom); + out.append(buffer); + head++; } } -void Region::dump(const char* what, uint32_t /* flags */) const +void Region::dump(const char* what, uint32_t flags) const { + (void)flags; const_iterator head = begin(); const_iterator const tail = end(); - ALOGD(" Region %s (this=%p, count=%" PRIdPTR ")\n", what, this, tail-head); + ALOGD(" Region %s (this=%p, count=%d)\n", what, this, tail-head); while (head != tail) { ALOGD(" [%3d, %3d, %3d, %3d]\n", head->left, head->top, head->right, head->bottom); diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/Android.mk android-platform-frameworks-native-21/libs/ui/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/tests/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,36 +1,6 @@ -# -# Copyright (C) 2014 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. -# - -LOCAL_PATH := $(call my-dir) - +# Build the unit tests. +LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_SHARED_LIBRARIES := libui -LOCAL_SRC_FILES := Region_test.cpp -LOCAL_MODULE := Region_test -include $(BUILD_NATIVE_TEST) -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_SRC_FILES := vec_test.cpp -LOCAL_MODULE := vec_test -include $(BUILD_NATIVE_TEST) - -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_SRC_FILES := mat_test.cpp -LOCAL_MODULE := mat_test -include $(BUILD_NATIVE_TEST) +# Build the manual test programs. +include $(call all-makefiles-under, $(LOCAL_PATH)) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/mat_test.cpp android-platform-frameworks-native-21/libs/ui/tests/mat_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/mat_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/tests/mat_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,139 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "RegionTest" - -#include -#include -#include -#include - -#include - -namespace android { - -class MatTest : public testing::Test { -protected: -}; - -TEST_F(MatTest, Basics) { - mat4 m0; - EXPECT_EQ(sizeof(mat4), sizeof(float)*16); -} - -TEST_F(MatTest, ComparisonOps) { - mat4 m0; - mat4 m1(2); - - EXPECT_TRUE(m0 == m0); - EXPECT_TRUE(m0 != m1); - EXPECT_FALSE(m0 != m0); - EXPECT_FALSE(m0 == m1); -} - -TEST_F(MatTest, Constructors) { - mat4 m0; - ASSERT_EQ(m0[0].x, 1); - ASSERT_EQ(m0[0].y, 0); - ASSERT_EQ(m0[0].z, 0); - ASSERT_EQ(m0[0].w, 0); - ASSERT_EQ(m0[1].x, 0); - ASSERT_EQ(m0[1].y, 1); - ASSERT_EQ(m0[1].z, 0); - ASSERT_EQ(m0[1].w, 0); - ASSERT_EQ(m0[2].x, 0); - ASSERT_EQ(m0[2].y, 0); - ASSERT_EQ(m0[2].z, 1); - ASSERT_EQ(m0[2].w, 0); - ASSERT_EQ(m0[3].x, 0); - ASSERT_EQ(m0[3].y, 0); - ASSERT_EQ(m0[3].z, 0); - ASSERT_EQ(m0[3].w, 1); - - mat4 m1(2); - mat4 m2(vec4(2)); - mat4 m3(m2); - - EXPECT_EQ(m1, m2); - EXPECT_EQ(m2, m3); - EXPECT_EQ(m3, m1); - - mat4 m4(vec4(1), vec4(2), vec4(3), vec4(4)); -} - -TEST_F(MatTest, ArithmeticOps) { - mat4 m0; - mat4 m1(2); - mat4 m2(vec4(2)); - - m1 += m2; - EXPECT_EQ(mat4(4), m1); - - m2 -= m1; - EXPECT_EQ(mat4(-2), m2); - - m1 *= 2; - EXPECT_EQ(mat4(8), m1); - - m1 /= 2; - EXPECT_EQ(mat4(4), m1); - - m0 = -m0; - EXPECT_EQ(mat4(-1), m0); -} - -TEST_F(MatTest, UnaryOps) { - const mat4 identity; - mat4 m0; - - ++m0; - EXPECT_EQ(mat4( vec4(2,1,1,1), vec4(1,2,1,1), vec4(1,1,2,1), vec4(1,1,1,2) ), m0); - EXPECT_EQ(mat4( -vec4(2,1,1,1), -vec4(1,2,1,1), -vec4(1,1,2,1), -vec4(1,1,1,2) ), -m0); - - --m0; - EXPECT_EQ(identity, m0); -} - -TEST_F(MatTest, MiscOps) { - const mat4 identity; - mat4 m0; - EXPECT_EQ(4, trace(m0)); - - mat4 m1(vec4(1,2,3,4), vec4(5,6,7,8), vec4(9,10,11,12), vec4(13,14,15,16)); - mat4 m2(vec4(1,5,9,13), vec4(2,6,10,14), vec4(3,7,11,15), vec4(4,8,12,16)); - EXPECT_EQ(m1, transpose(m2)); - EXPECT_EQ(m2, transpose(m1)); - EXPECT_EQ(vec4(1,6,11,16), diag(m1)); - - EXPECT_EQ(identity, inverse(identity)); - - mat4 m3(vec4(4,3,0,0), vec4(3,2,0,0), vec4(0,0,1,0), vec4(0,0,0,1)); - mat4 m3i(inverse(m3)); - EXPECT_FLOAT_EQ(-2, m3i[0][0]); - EXPECT_FLOAT_EQ( 3, m3i[0][1]); - EXPECT_FLOAT_EQ( 3, m3i[1][0]); - EXPECT_FLOAT_EQ(-4, m3i[1][1]); - - mat4 m3ii(inverse(m3i)); - EXPECT_FLOAT_EQ(m3[0][0], m3ii[0][0]); - EXPECT_FLOAT_EQ(m3[0][1], m3ii[0][1]); - EXPECT_FLOAT_EQ(m3[1][0], m3ii[1][0]); - EXPECT_FLOAT_EQ(m3[1][1], m3ii[1][1]); - - EXPECT_EQ(m1, m1*identity); -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/region/Android.mk android-platform-frameworks-native-21/libs/ui/tests/region/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/region/Android.mk 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/tests/region/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,16 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + region.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libui + +LOCAL_MODULE:= test-region + +LOCAL_MODULE_TAGS := tests + +include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/region/region.cpp android-platform-frameworks-native-21/libs/ui/tests/region/region.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/region/region.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/tests/region/region.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,69 @@ +/* + * Copyright (C) 2009 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. + */ + +#define LOG_TAG "Region" + +#include +#include +#include +#include + +using namespace android; + +int main() +{ + Region empty; + Region reg0( Rect( 0, 0, 100, 100 ) ); + Region reg1 = reg0; + Region reg2, reg3; + + Region reg4 = empty | reg1; + Region reg5 = reg1 | empty; + + reg4.dump("reg4"); + reg5.dump("reg5"); + + reg0.dump("reg0"); + reg1.dump("reg1"); + + reg0 = reg0 | reg0.translate(150, 0); + reg0.dump("reg0"); + reg1.dump("reg1"); + + reg0 = reg0 | reg0.translate(300, 0); + reg0.dump("reg0"); + reg1.dump("reg1"); + + //reg2 = reg0 | reg0.translate(0, 100); + //reg0.dump("reg0"); + //reg1.dump("reg1"); + //reg2.dump("reg2"); + + //reg3 = reg0 | reg0.translate(0, 150); + //reg0.dump("reg0"); + //reg1.dump("reg1"); + //reg2.dump("reg2"); + //reg3.dump("reg3"); + + ALOGD("---"); + reg2 = reg0 | reg0.translate(100, 0); + reg0.dump("reg0"); + reg1.dump("reg1"); + reg2.dump("reg2"); + + return 0; +} + diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/Region_test.cpp android-platform-frameworks-native-21/libs/ui/tests/Region_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/Region_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/tests/Region_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,156 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define LOG_TAG "RegionTest" - -#include -#include -#include -#include - -namespace android { - -class RegionTest : public testing::Test { -protected: - void checkVertTJunction(const Rect* lhs, const Rect* rhs) { - EXPECT_FALSE((rhs->right > lhs->left && rhs->right < lhs->right) || - (rhs->left > lhs->left && rhs->left < lhs->right)); - } - - void verifyNoTJunctions(const Region& r) { - for (const Rect* current = r.begin(); current < r.end(); current++) { - for (const Rect* other = current - 1; other >= r.begin(); other--) { - if (other->bottom < current->top) break; - if (other->bottom != current->top) continue; - checkVertTJunction(current, other); - } - for (const Rect* other = current + 1; other < r.end(); other++) { - if (other->top > current->bottom) break; - if (other->top != current->bottom) continue; - checkVertTJunction(current, other); - } - } - } - - void checkTJunctionFreeFromRegion(const Region& original, int expectedCount = -1) { - Region modified = Region::createTJunctionFreeRegion(original); - verifyNoTJunctions(modified); - if (expectedCount != -1) { - EXPECT_EQ(modified.end() - modified.begin(), expectedCount); - } - EXPECT_TRUE((original ^ modified).isEmpty()); - } -}; - -TEST_F(RegionTest, MinimalDivision_TJunction) { - Region r; - // | x | - // |xxx| - r.clear(); - r.orSelf(Rect(1, 0, 2, 1)); - r.orSelf(Rect(0, 1, 3, 2)); - checkTJunctionFreeFromRegion(r, 4); - - // | x | - // | | - // |xxx| - r.clear(); - r.orSelf(Rect(1, 0, 2, 1)); - r.orSelf(Rect(0, 2, 3, 3)); - checkTJunctionFreeFromRegion(r, 2); -} - -TEST_F(RegionTest, Trivial_TJunction) { - Region r; - checkTJunctionFreeFromRegion(r); - - r.orSelf(Rect(100, 100, 500, 500)); - checkTJunctionFreeFromRegion(r); -} - -TEST_F(RegionTest, Simple_TJunction) { - Region r; - // | x | - // |xxxx| - // |xxxx| - // |xxxx| - r.clear(); - r.orSelf(Rect(1, 0, 2, 1)); - r.orSelf(Rect(0, 1, 3, 3)); - checkTJunctionFreeFromRegion(r); - - // | x | - // |xx | - // |xxx| - r.clear(); - r.orSelf(Rect(2,0,4,2)); - r.orSelf(Rect(0,2,4,4)); - r.orSelf(Rect(0,4,6,6)); - checkTJunctionFreeFromRegion(r); - - // |x x| - // |xxx| - // |x x| - r.clear(); - r.orSelf(Rect(0,0,2,6)); - r.orSelf(Rect(4,0,6,6)); - r.orSelf(Rect(0,2,6,4)); - checkTJunctionFreeFromRegion(r); - - // |xxx| - // | x | - // | x | - r.clear(); - r.orSelf(Rect(0,0,6,2)); - r.orSelf(Rect(2,2,4,6)); - checkTJunctionFreeFromRegion(r); -} - -TEST_F(RegionTest, Bigger_TJunction) { - Region r; - // |xxxx | - // | xxxx | - // | xxxx | - // | xxxx| - for (int i = 0; i < 4; i++) { - r.orSelf(Rect(i,i,i+4,i+1)); - } - checkTJunctionFreeFromRegion(r, 16); -} - -#define ITER_MAX 1000 -#define X_MAX 8 -#define Y_MAX 8 - -TEST_F(RegionTest, Random_TJunction) { - Region r; - srandom(12345); - - for (int iter = 0; iter < ITER_MAX; iter++) { - r.clear(); - for (int i = 0; i < X_MAX; i++) { - for (int j = 0; j < Y_MAX; j++) { - if (random() % 2) { - r.orSelf(Rect(i, j, i + 1, j + 1)); - } - } - } - checkTJunctionFreeFromRegion(r); - } -} - -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/vec_test.cpp android-platform-frameworks-native-21/libs/ui/tests/vec_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/tests/vec_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/tests/vec_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,257 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define LOG_TAG "RegionTest" - -#include -#include - -#include -#include -#include - -#include - -namespace android { - -class VecTest : public testing::Test { -}; - -TEST_F(VecTest, Basics) { - vec4 v4; - vec3& v3(v4.xyz); - - EXPECT_EQ(sizeof(vec4), sizeof(float)*4); - EXPECT_EQ(sizeof(vec3), sizeof(float)*3); - EXPECT_EQ(sizeof(vec2), sizeof(float)*2); - EXPECT_EQ((void*)&v3, (void*)&v4); -} - -TEST_F(VecTest, Constructors) { - vec4 v0; - EXPECT_EQ(v0.x, 0); - EXPECT_EQ(v0.y, 0); - EXPECT_EQ(v0.z, 0); - EXPECT_EQ(v0.w, 0); - - vec4 v1(1); - EXPECT_EQ(v1.x, 1); - EXPECT_EQ(v1.y, 1); - EXPECT_EQ(v1.z, 1); - EXPECT_EQ(v1.w, 1); - - vec4 v2(1,2,3,4); - EXPECT_EQ(v2.x, 1); - EXPECT_EQ(v2.y, 2); - EXPECT_EQ(v2.z, 3); - EXPECT_EQ(v2.w, 4); - - vec4 v3(v2); - EXPECT_EQ(v3.x, 1); - EXPECT_EQ(v3.y, 2); - EXPECT_EQ(v3.z, 3); - EXPECT_EQ(v3.w, 4); - - vec4 v4(v3.xyz, 42); - EXPECT_EQ(v4.x, 1); - EXPECT_EQ(v4.y, 2); - EXPECT_EQ(v4.z, 3); - EXPECT_EQ(v4.w, 42); - - vec4 v5(vec3(v2.xy, 42), 24); - EXPECT_EQ(v5.x, 1); - EXPECT_EQ(v5.y, 2); - EXPECT_EQ(v5.z, 42); - EXPECT_EQ(v5.w, 24); - - tvec4 vd(2); - EXPECT_EQ(vd.x, 2); - EXPECT_EQ(vd.y, 2); - EXPECT_EQ(vd.z, 2); - EXPECT_EQ(vd.w, 2); -} - -TEST_F(VecTest, Access) { - vec4 v0(1,2,3,4); - v0.x = 10; - v0.y = 20; - v0.z = 30; - v0.w = 40; - EXPECT_EQ(v0.x, 10); - EXPECT_EQ(v0.y, 20); - EXPECT_EQ(v0.z, 30); - EXPECT_EQ(v0.w, 40); - - v0[0] = 100; - v0[1] = 200; - v0[2] = 300; - v0[3] = 400; - EXPECT_EQ(v0.x, 100); - EXPECT_EQ(v0.y, 200); - EXPECT_EQ(v0.z, 300); - EXPECT_EQ(v0.w, 400); - - v0.xyz = vec3(1,2,3); - EXPECT_EQ(v0.x, 1); - EXPECT_EQ(v0.y, 2); - EXPECT_EQ(v0.z, 3); - EXPECT_EQ(v0.w, 400); -} - -TEST_F(VecTest, UnaryOps) { - vec4 v0(1,2,3,4); - - v0 += 1; - EXPECT_EQ(v0.x, 2); - EXPECT_EQ(v0.y, 3); - EXPECT_EQ(v0.z, 4); - EXPECT_EQ(v0.w, 5); - - v0 -= 1; - EXPECT_EQ(v0.x, 1); - EXPECT_EQ(v0.y, 2); - EXPECT_EQ(v0.z, 3); - EXPECT_EQ(v0.w, 4); - - v0 *= 2; - EXPECT_EQ(v0.x, 2); - EXPECT_EQ(v0.y, 4); - EXPECT_EQ(v0.z, 6); - EXPECT_EQ(v0.w, 8); - - v0 /= 2; - EXPECT_EQ(v0.x, 1); - EXPECT_EQ(v0.y, 2); - EXPECT_EQ(v0.z, 3); - EXPECT_EQ(v0.w, 4); - - vec4 v1(10, 20, 30, 40); - - v0 += v1; - EXPECT_EQ(v0.x, 11); - EXPECT_EQ(v0.y, 22); - EXPECT_EQ(v0.z, 33); - EXPECT_EQ(v0.w, 44); - - v0 -= v1; - EXPECT_EQ(v0.x, 1); - EXPECT_EQ(v0.y, 2); - EXPECT_EQ(v0.z, 3); - EXPECT_EQ(v0.w, 4); - - v0 *= v1; - EXPECT_EQ(v0.x, 10); - EXPECT_EQ(v0.y, 40); - EXPECT_EQ(v0.z, 90); - EXPECT_EQ(v0.w, 160); - - v0 /= v1; - EXPECT_EQ(v0.x, 1); - EXPECT_EQ(v0.y, 2); - EXPECT_EQ(v0.z, 3); - EXPECT_EQ(v0.w, 4); - - ++v0; - EXPECT_EQ(v0.x, 2); - EXPECT_EQ(v0.y, 3); - EXPECT_EQ(v0.z, 4); - EXPECT_EQ(v0.w, 5); - - ++++v0; - EXPECT_EQ(v0.x, 4); - EXPECT_EQ(v0.y, 5); - EXPECT_EQ(v0.z, 6); - EXPECT_EQ(v0.w, 7); - - --v1; - EXPECT_EQ(v1.x, 9); - EXPECT_EQ(v1.y, 19); - EXPECT_EQ(v1.z, 29); - EXPECT_EQ(v1.w, 39); - - v1 = -v1; - EXPECT_EQ(v1.x, -9); - EXPECT_EQ(v1.y, -19); - EXPECT_EQ(v1.z, -29); - EXPECT_EQ(v1.w, -39); - - tvec4 dv(1,2,3,4); - v1 += dv; - EXPECT_EQ(v1.x, -8); - EXPECT_EQ(v1.y, -17); - EXPECT_EQ(v1.z, -26); - EXPECT_EQ(v1.w, -35); -} - -TEST_F(VecTest, ComparisonOps) { - vec4 v0(1,2,3,4); - vec4 v1(10,20,30,40); - - EXPECT_TRUE(v0 == v0); - EXPECT_TRUE(v0 != v1); - EXPECT_FALSE(v0 != v0); - EXPECT_FALSE(v0 == v1); -} - -TEST_F(VecTest, ArithmeticOps) { - vec4 v0(1,2,3,4); - vec4 v1(10,20,30,40); - - vec4 v2(v0 + v1); - EXPECT_EQ(v2.x, 11); - EXPECT_EQ(v2.y, 22); - EXPECT_EQ(v2.z, 33); - EXPECT_EQ(v2.w, 44); - - v0 = v1 * 2; - EXPECT_EQ(v0.x, 20); - EXPECT_EQ(v0.y, 40); - EXPECT_EQ(v0.z, 60); - EXPECT_EQ(v0.w, 80); - - v0 = 2 * v1; - EXPECT_EQ(v0.x, 20); - EXPECT_EQ(v0.y, 40); - EXPECT_EQ(v0.z, 60); - EXPECT_EQ(v0.w, 80); - - tvec4 vd(2); - v0 = v1 * vd; - EXPECT_EQ(v0.x, 20); - EXPECT_EQ(v0.y, 40); - EXPECT_EQ(v0.z, 60); - EXPECT_EQ(v0.w, 80); -} - -TEST_F(VecTest, ArithmeticFunc) { - vec3 east(1, 0, 0); - vec3 north(0, 1, 0); - vec3 up( cross(east, north) ); - EXPECT_EQ(up, vec3(0,0,1)); - EXPECT_EQ(dot(east, north), 0); - EXPECT_EQ(length(east), 1); - EXPECT_EQ(distance(east, north), sqrtf(2)); - - vec3 v0(1,2,3); - vec3 vn(normalize(v0)); - EXPECT_FLOAT_EQ(1, length(vn)); - EXPECT_FLOAT_EQ(length(v0), dot(v0, vn)); - - tvec3 vd(east); - EXPECT_EQ(length(vd), 1); -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/ui/UiConfig.cpp android-platform-frameworks-native-21/libs/ui/UiConfig.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/ui/UiConfig.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/libs/ui/UiConfig.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,39 +0,0 @@ -/* - * Copyright (C) 2012 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 - -namespace android { - -#ifdef FRAMEBUFFER_FORCE_FORMAT -// We need the two-level macro to stringify the contents of a macro argument -#define STRINGIFY(x) #x -#define TOSTRING(x) STRINGIFY(x) -#endif - -void appendUiConfigString(String8& configStr) -{ - static const char* config = - " [libui" -#ifdef FRAMEBUFFER_FORCE_FORMAT - " FRAMEBUFFER_FORCE_FORMAT=" TOSTRING(FRAMEBUFFER_FORCE_FORMAT) -#endif - "]"; - configStr.append(config); -} - - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Android.mk android-platform-frameworks-native-21/libs/utils/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Android.mk 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,136 @@ +# Copyright (C) 2008 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. + +LOCAL_PATH:= $(call my-dir) + +# libutils is a little unique: It's built twice, once for the host +# and once for the device. + +commonSources:= \ + BasicHashtable.cpp \ + BlobCache.cpp \ + BufferedTextOutput.cpp \ + CallStack.cpp \ + Debug.cpp \ + FileMap.cpp \ + Flattenable.cpp \ + LinearTransform.cpp \ + PropertyMap.cpp \ + RefBase.cpp \ + SharedBuffer.cpp \ + Static.cpp \ + StopWatch.cpp \ + String8.cpp \ + String16.cpp \ + StringArray.cpp \ + SystemClock.cpp \ + TextOutput.cpp \ + Threads.cpp \ + Timers.cpp \ + Tokenizer.cpp \ + Unicode.cpp \ + VectorImpl.cpp \ + WorkQueue.cpp \ + ZipFileCRO.cpp \ + ZipFileRO.cpp \ + ZipUtils.cpp \ + misc.cpp + +host_commonCflags := -DLIBUTILS_NATIVE=1 $(TOOL_CFLAGS) + +ifeq ($(HOST_OS),windows) +ifeq ($(strip $(USE_CYGWIN),),) +# Under MinGW, ctype.h doesn't need multi-byte support +host_commonCflags += -DMB_CUR_MAX=1 +endif +endif + +host_commonLdlibs := + +ifeq ($(TARGET_OS),linux) +host_commonLdlibs += -lrt -ldl +endif + + +# For the host +# ===================================================== +include $(CLEAR_VARS) +LOCAL_SRC_FILES:= $(commonSources) +ifeq ($(HOST_OS), linux) +LOCAL_SRC_FILES += Looper.cpp +endif +LOCAL_MODULE:= libutils +LOCAL_STATIC_LIBRARIES := libz +LOCAL_C_INCLUDES := \ + external/zlib +LOCAL_CFLAGS += $(host_commonCflags) +LOCAL_LDLIBS += $(host_commonLdlibs) +include $(BUILD_HOST_STATIC_LIBRARY) + + +# For the host, 64-bit +# ===================================================== +include $(CLEAR_VARS) +LOCAL_SRC_FILES:= $(commonSources) +ifeq ($(HOST_OS), linux) +LOCAL_SRC_FILES += Looper.cpp +endif +LOCAL_MODULE:= lib64utils +LOCAL_STATIC_LIBRARIES := libz +LOCAL_C_INCLUDES := \ + external/zlib +LOCAL_CFLAGS += $(host_commonCflags) -m64 +LOCAL_LDLIBS += $(host_commonLdlibs) +include $(BUILD_HOST_STATIC_LIBRARY) + + +# For the device +# ===================================================== +include $(CLEAR_VARS) + + +# we have the common sources, plus some device-specific stuff +LOCAL_SRC_FILES:= \ + $(commonSources) \ + Looper.cpp \ + Trace.cpp + +ifeq ($(TARGET_OS),linux) +LOCAL_LDLIBS += -lrt -ldl +endif + +LOCAL_C_INCLUDES += \ + bionic/libc/private \ + external/zlib + +LOCAL_LDLIBS += -lpthread + +LOCAL_SHARED_LIBRARIES := \ + liblog \ + libcutils \ + libdl \ + libcorkscrew \ + libz + +LOCAL_MODULE:= libutils +include $(BUILD_SHARED_LIBRARY) + +# Include subdirectory makefiles +# ============================================================ + +# If we're building with ONE_SHOT_MAKEFILE (mm, mmm), then what the framework +# team really wants is to build the stuff defined by this makefile. +ifeq (,$(ONE_SHOT_MAKEFILE)) +include $(call first-makefiles-under,$(LOCAL_PATH)) +endif diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/BasicHashtable.cpp android-platform-frameworks-native-21/libs/utils/BasicHashtable.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/BasicHashtable.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/BasicHashtable.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,338 @@ +/* + * 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. + */ + +#define LOG_TAG "BasicHashtable" + +#include + +#include +#include +#include + +namespace android { + +BasicHashtableImpl::BasicHashtableImpl(size_t entrySize, bool hasTrivialDestructor, + size_t minimumInitialCapacity, float loadFactor) : + mBucketSize(entrySize + sizeof(Bucket)), mHasTrivialDestructor(hasTrivialDestructor), + mLoadFactor(loadFactor), mSize(0), + mFilledBuckets(0), mBuckets(NULL) { + determineCapacity(minimumInitialCapacity, mLoadFactor, &mBucketCount, &mCapacity); +} + +BasicHashtableImpl::BasicHashtableImpl(const BasicHashtableImpl& other) : + mBucketSize(other.mBucketSize), mHasTrivialDestructor(other.mHasTrivialDestructor), + mCapacity(other.mCapacity), mLoadFactor(other.mLoadFactor), + mSize(other.mSize), mFilledBuckets(other.mFilledBuckets), + mBucketCount(other.mBucketCount), mBuckets(other.mBuckets) { + if (mBuckets) { + SharedBuffer::bufferFromData(mBuckets)->acquire(); + } +} + +void BasicHashtableImpl::dispose() { + if (mBuckets) { + releaseBuckets(mBuckets, mBucketCount); + } +} + +void BasicHashtableImpl::clone() { + if (mBuckets) { + void* newBuckets = allocateBuckets(mBucketCount); + copyBuckets(mBuckets, newBuckets, mBucketCount); + releaseBuckets(mBuckets, mBucketCount); + mBuckets = newBuckets; + } +} + +void BasicHashtableImpl::setTo(const BasicHashtableImpl& other) { + if (mBuckets) { + releaseBuckets(mBuckets, mBucketCount); + } + + mCapacity = other.mCapacity; + mLoadFactor = other.mLoadFactor; + mSize = other.mSize; + mFilledBuckets = other.mFilledBuckets; + mBucketCount = other.mBucketCount; + mBuckets = other.mBuckets; + + if (mBuckets) { + SharedBuffer::bufferFromData(mBuckets)->acquire(); + } +} + +void BasicHashtableImpl::clear() { + if (mBuckets) { + if (mFilledBuckets) { + SharedBuffer* sb = SharedBuffer::bufferFromData(mBuckets); + if (sb->onlyOwner()) { + destroyBuckets(mBuckets, mBucketCount); + for (size_t i = 0; i < mSize; i++) { + Bucket& bucket = bucketAt(mBuckets, i); + bucket.cookie = 0; + } + } else { + releaseBuckets(mBuckets, mBucketCount); + mBuckets = NULL; + } + mFilledBuckets = 0; + } + mSize = 0; + } +} + +ssize_t BasicHashtableImpl::next(ssize_t index) const { + if (mSize) { + while (size_t(++index) < mBucketCount) { + const Bucket& bucket = bucketAt(mBuckets, index); + if (bucket.cookie & Bucket::PRESENT) { + return index; + } + } + } + return -1; +} + +ssize_t BasicHashtableImpl::find(ssize_t index, hash_t hash, + const void* __restrict__ key) const { + if (!mSize) { + return -1; + } + + hash = trimHash(hash); + if (index < 0) { + index = chainStart(hash, mBucketCount); + + const Bucket& bucket = bucketAt(mBuckets, size_t(index)); + if (bucket.cookie & Bucket::PRESENT) { + if (compareBucketKey(bucket, key)) { + return index; + } + } else { + if (!(bucket.cookie & Bucket::COLLISION)) { + return -1; + } + } + } + + size_t inc = chainIncrement(hash, mBucketCount); + for (;;) { + index = chainSeek(index, inc, mBucketCount); + + const Bucket& bucket = bucketAt(mBuckets, size_t(index)); + if (bucket.cookie & Bucket::PRESENT) { + if ((bucket.cookie & Bucket::HASH_MASK) == hash + && compareBucketKey(bucket, key)) { + return index; + } + } + if (!(bucket.cookie & Bucket::COLLISION)) { + return -1; + } + } +} + +size_t BasicHashtableImpl::add(hash_t hash, const void* entry) { + if (!mBuckets) { + mBuckets = allocateBuckets(mBucketCount); + } else { + edit(); + } + + hash = trimHash(hash); + for (;;) { + size_t index = chainStart(hash, mBucketCount); + Bucket* bucket = &bucketAt(mBuckets, size_t(index)); + if (bucket->cookie & Bucket::PRESENT) { + size_t inc = chainIncrement(hash, mBucketCount); + do { + bucket->cookie |= Bucket::COLLISION; + index = chainSeek(index, inc, mBucketCount); + bucket = &bucketAt(mBuckets, size_t(index)); + } while (bucket->cookie & Bucket::PRESENT); + } + + uint32_t collision = bucket->cookie & Bucket::COLLISION; + if (!collision) { + if (mFilledBuckets >= mCapacity) { + rehash(mCapacity * 2, mLoadFactor); + continue; + } + mFilledBuckets += 1; + } + + bucket->cookie = collision | Bucket::PRESENT | hash; + mSize += 1; + initializeBucketEntry(*bucket, entry); + return index; + } +} + +void BasicHashtableImpl::removeAt(size_t index) { + edit(); + + Bucket& bucket = bucketAt(mBuckets, index); + bucket.cookie &= ~Bucket::PRESENT; + if (!(bucket.cookie & Bucket::COLLISION)) { + mFilledBuckets -= 1; + } + mSize -= 1; + if (!mHasTrivialDestructor) { + destroyBucketEntry(bucket); + } +} + +void BasicHashtableImpl::rehash(size_t minimumCapacity, float loadFactor) { + if (minimumCapacity < mSize) { + minimumCapacity = mSize; + } + size_t newBucketCount, newCapacity; + determineCapacity(minimumCapacity, loadFactor, &newBucketCount, &newCapacity); + + if (newBucketCount != mBucketCount || newCapacity != mCapacity) { + if (mBuckets) { + void* newBuckets; + if (mSize) { + newBuckets = allocateBuckets(newBucketCount); + for (size_t i = 0; i < mBucketCount; i++) { + const Bucket& fromBucket = bucketAt(mBuckets, i); + if (fromBucket.cookie & Bucket::PRESENT) { + hash_t hash = fromBucket.cookie & Bucket::HASH_MASK; + size_t index = chainStart(hash, newBucketCount); + Bucket* toBucket = &bucketAt(newBuckets, size_t(index)); + if (toBucket->cookie & Bucket::PRESENT) { + size_t inc = chainIncrement(hash, newBucketCount); + do { + toBucket->cookie |= Bucket::COLLISION; + index = chainSeek(index, inc, newBucketCount); + toBucket = &bucketAt(newBuckets, size_t(index)); + } while (toBucket->cookie & Bucket::PRESENT); + } + toBucket->cookie = Bucket::PRESENT | hash; + initializeBucketEntry(*toBucket, fromBucket.entry); + } + } + } else { + newBuckets = NULL; + } + releaseBuckets(mBuckets, mBucketCount); + mBuckets = newBuckets; + mFilledBuckets = mSize; + } + mBucketCount = newBucketCount; + mCapacity = newCapacity; + } + mLoadFactor = loadFactor; +} + +void* BasicHashtableImpl::allocateBuckets(size_t count) const { + size_t bytes = count * mBucketSize; + SharedBuffer* sb = SharedBuffer::alloc(bytes); + LOG_ALWAYS_FATAL_IF(!sb, "Could not allocate %u bytes for hashtable with %u buckets.", + uint32_t(bytes), uint32_t(count)); + void* buckets = sb->data(); + for (size_t i = 0; i < count; i++) { + Bucket& bucket = bucketAt(buckets, i); + bucket.cookie = 0; + } + return buckets; +} + +void BasicHashtableImpl::releaseBuckets(void* __restrict__ buckets, size_t count) const { + SharedBuffer* sb = SharedBuffer::bufferFromData(buckets); + if (sb->release(SharedBuffer::eKeepStorage) == 1) { + destroyBuckets(buckets, count); + SharedBuffer::dealloc(sb); + } +} + +void BasicHashtableImpl::destroyBuckets(void* __restrict__ buckets, size_t count) const { + if (!mHasTrivialDestructor) { + for (size_t i = 0; i < count; i++) { + Bucket& bucket = bucketAt(buckets, i); + if (bucket.cookie & Bucket::PRESENT) { + destroyBucketEntry(bucket); + } + } + } +} + +void BasicHashtableImpl::copyBuckets(const void* __restrict__ fromBuckets, + void* __restrict__ toBuckets, size_t count) const { + for (size_t i = 0; i < count; i++) { + const Bucket& fromBucket = bucketAt(fromBuckets, i); + Bucket& toBucket = bucketAt(toBuckets, i); + toBucket.cookie = fromBucket.cookie; + if (fromBucket.cookie & Bucket::PRESENT) { + initializeBucketEntry(toBucket, fromBucket.entry); + } + } +} + +// Table of 31-bit primes where each prime is no less than twice as large +// as the previous one. Generated by "primes.py". +static size_t PRIMES[] = { + 5, + 11, + 23, + 47, + 97, + 197, + 397, + 797, + 1597, + 3203, + 6421, + 12853, + 25717, + 51437, + 102877, + 205759, + 411527, + 823117, + 1646237, + 3292489, + 6584983, + 13169977, + 26339969, + 52679969, + 105359939, + 210719881, + 421439783, + 842879579, + 1685759167, + 0, +}; + +void BasicHashtableImpl::determineCapacity(size_t minimumCapacity, float loadFactor, + size_t* __restrict__ outBucketCount, size_t* __restrict__ outCapacity) { + LOG_ALWAYS_FATAL_IF(loadFactor <= 0.0f || loadFactor > 1.0f, + "Invalid load factor %0.3f. Must be in the range (0, 1].", loadFactor); + + size_t count = ceilf(minimumCapacity / loadFactor) + 1; + size_t i = 0; + while (count > PRIMES[i] && i < NELEM(PRIMES)) { + i++; + } + count = PRIMES[i]; + LOG_ALWAYS_FATAL_IF(!count, "Could not determine required number of buckets for " + "hashtable with minimum capacity %u and load factor %0.3f.", + uint32_t(minimumCapacity), loadFactor); + *outBucketCount = count; + *outCapacity = ceilf((count - 1) * loadFactor); +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/BlobCache.cpp android-platform-frameworks-native-21/libs/utils/BlobCache.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/BlobCache.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/BlobCache.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,378 @@ +/* + ** Copyright 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. + */ + +#define LOG_TAG "BlobCache" +//#define LOG_NDEBUG 0 + +#include +#include + +#include +#include +#include + +namespace android { + +// BlobCache::Header::mMagicNumber value +static const uint32_t blobCacheMagic = '_Bb$'; + +// BlobCache::Header::mBlobCacheVersion value +static const uint32_t blobCacheVersion = 1; + +// BlobCache::Header::mDeviceVersion value +static const uint32_t blobCacheDeviceVersion = 1; + +BlobCache::BlobCache(size_t maxKeySize, size_t maxValueSize, size_t maxTotalSize): + mMaxKeySize(maxKeySize), + mMaxValueSize(maxValueSize), + mMaxTotalSize(maxTotalSize), + mTotalSize(0) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); +#ifdef _WIN32 + srand(now); +#else + mRandState[0] = (now >> 0) & 0xFFFF; + mRandState[1] = (now >> 16) & 0xFFFF; + mRandState[2] = (now >> 32) & 0xFFFF; +#endif + ALOGV("initializing random seed using %lld", now); +} + +void BlobCache::set(const void* key, size_t keySize, const void* value, + size_t valueSize) { + if (mMaxKeySize < keySize) { + ALOGV("set: not caching because the key is too large: %d (limit: %d)", + keySize, mMaxKeySize); + return; + } + if (mMaxValueSize < valueSize) { + ALOGV("set: not caching because the value is too large: %d (limit: %d)", + valueSize, mMaxValueSize); + return; + } + if (mMaxTotalSize < keySize + valueSize) { + ALOGV("set: not caching because the combined key/value size is too " + "large: %d (limit: %d)", keySize + valueSize, mMaxTotalSize); + return; + } + if (keySize == 0) { + ALOGW("set: not caching because keySize is 0"); + return; + } + if (valueSize <= 0) { + ALOGW("set: not caching because valueSize is 0"); + return; + } + + sp dummyKey(new Blob(key, keySize, false)); + CacheEntry dummyEntry(dummyKey, NULL); + + while (true) { + ssize_t index = mCacheEntries.indexOf(dummyEntry); + if (index < 0) { + // Create a new cache entry. + sp keyBlob(new Blob(key, keySize, true)); + sp valueBlob(new Blob(value, valueSize, true)); + size_t newTotalSize = mTotalSize + keySize + valueSize; + if (mMaxTotalSize < newTotalSize) { + if (isCleanable()) { + // Clean the cache and try again. + clean(); + continue; + } else { + ALOGV("set: not caching new key/value pair because the " + "total cache size limit would be exceeded: %d " + "(limit: %d)", + keySize + valueSize, mMaxTotalSize); + break; + } + } + mCacheEntries.add(CacheEntry(keyBlob, valueBlob)); + mTotalSize = newTotalSize; + ALOGV("set: created new cache entry with %d byte key and %d byte value", + keySize, valueSize); + } else { + // Update the existing cache entry. + sp valueBlob(new Blob(value, valueSize, true)); + sp oldValueBlob(mCacheEntries[index].getValue()); + size_t newTotalSize = mTotalSize + valueSize - oldValueBlob->getSize(); + if (mMaxTotalSize < newTotalSize) { + if (isCleanable()) { + // Clean the cache and try again. + clean(); + continue; + } else { + ALOGV("set: not caching new value because the total cache " + "size limit would be exceeded: %d (limit: %d)", + keySize + valueSize, mMaxTotalSize); + break; + } + } + mCacheEntries.editItemAt(index).setValue(valueBlob); + mTotalSize = newTotalSize; + ALOGV("set: updated existing cache entry with %d byte key and %d byte " + "value", keySize, valueSize); + } + break; + } +} + +size_t BlobCache::get(const void* key, size_t keySize, void* value, + size_t valueSize) { + if (mMaxKeySize < keySize) { + ALOGV("get: not searching because the key is too large: %d (limit %d)", + keySize, mMaxKeySize); + return 0; + } + sp dummyKey(new Blob(key, keySize, false)); + CacheEntry dummyEntry(dummyKey, NULL); + ssize_t index = mCacheEntries.indexOf(dummyEntry); + if (index < 0) { + ALOGV("get: no cache entry found for key of size %d", keySize); + return 0; + } + + // The key was found. Return the value if the caller's buffer is large + // enough. + sp valueBlob(mCacheEntries[index].getValue()); + size_t valueBlobSize = valueBlob->getSize(); + if (valueBlobSize <= valueSize) { + ALOGV("get: copying %d bytes to caller's buffer", valueBlobSize); + memcpy(value, valueBlob->getData(), valueBlobSize); + } else { + ALOGV("get: caller's buffer is too small for value: %d (needs %d)", + valueSize, valueBlobSize); + } + return valueBlobSize; +} + +static inline size_t align4(size_t size) { + return (size + 3) & ~3; +} + +size_t BlobCache::getFlattenedSize() const { + size_t size = sizeof(Header); + for (size_t i = 0; i < mCacheEntries.size(); i++) { + const CacheEntry& e(mCacheEntries[i]); + sp keyBlob = e.getKey(); + sp valueBlob = e.getValue(); + size = align4(size); + size += sizeof(EntryHeader) + keyBlob->getSize() + + valueBlob->getSize(); + } + return size; +} + +size_t BlobCache::getFdCount() const { + return 0; +} + +status_t BlobCache::flatten(void* buffer, size_t size, int fds[], size_t count) + const { + if (count != 0) { + ALOGE("flatten: nonzero fd count: %zu", count); + return BAD_VALUE; + } + + // Write the cache header + if (size < sizeof(Header)) { + ALOGE("flatten: not enough room for cache header"); + return BAD_VALUE; + } + Header* header = reinterpret_cast(buffer); + header->mMagicNumber = blobCacheMagic; + header->mBlobCacheVersion = blobCacheVersion; + header->mDeviceVersion = blobCacheDeviceVersion; + header->mNumEntries = mCacheEntries.size(); + + // Write cache entries + uint8_t* byteBuffer = reinterpret_cast(buffer); + off_t byteOffset = align4(sizeof(Header)); + for (size_t i = 0; i < mCacheEntries.size(); i++) { + const CacheEntry& e(mCacheEntries[i]); + sp keyBlob = e.getKey(); + sp valueBlob = e.getValue(); + size_t keySize = keyBlob->getSize(); + size_t valueSize = valueBlob->getSize(); + + size_t entrySize = sizeof(EntryHeader) + keySize + valueSize; + if (byteOffset + entrySize > size) { + ALOGE("flatten: not enough room for cache entries"); + return BAD_VALUE; + } + + EntryHeader* eheader = reinterpret_cast( + &byteBuffer[byteOffset]); + eheader->mKeySize = keySize; + eheader->mValueSize = valueSize; + + memcpy(eheader->mData, keyBlob->getData(), keySize); + memcpy(eheader->mData + keySize, valueBlob->getData(), valueSize); + + byteOffset += align4(entrySize); + } + + return OK; +} + +status_t BlobCache::unflatten(void const* buffer, size_t size, int fds[], + size_t count) { + // All errors should result in the BlobCache being in an empty state. + mCacheEntries.clear(); + + if (count != 0) { + ALOGE("unflatten: nonzero fd count: %zu", count); + return BAD_VALUE; + } + + // Read the cache header + if (size < sizeof(Header)) { + ALOGE("unflatten: not enough room for cache header"); + return BAD_VALUE; + } + const Header* header = reinterpret_cast(buffer); + if (header->mMagicNumber != blobCacheMagic) { + ALOGE("unflatten: bad magic number: %d", header->mMagicNumber); + return BAD_VALUE; + } + if (header->mBlobCacheVersion != blobCacheVersion || + header->mDeviceVersion != blobCacheDeviceVersion) { + // We treat version mismatches as an empty cache. + return OK; + } + + // Read cache entries + const uint8_t* byteBuffer = reinterpret_cast(buffer); + off_t byteOffset = align4(sizeof(Header)); + size_t numEntries = header->mNumEntries; + for (size_t i = 0; i < numEntries; i++) { + if (byteOffset + sizeof(EntryHeader) > size) { + mCacheEntries.clear(); + ALOGE("unflatten: not enough room for cache entry headers"); + return BAD_VALUE; + } + + const EntryHeader* eheader = reinterpret_cast( + &byteBuffer[byteOffset]); + size_t keySize = eheader->mKeySize; + size_t valueSize = eheader->mValueSize; + size_t entrySize = sizeof(EntryHeader) + keySize + valueSize; + + if (byteOffset + entrySize > size) { + mCacheEntries.clear(); + ALOGE("unflatten: not enough room for cache entry headers"); + return BAD_VALUE; + } + + const uint8_t* data = eheader->mData; + set(data, keySize, data + keySize, valueSize); + + byteOffset += align4(entrySize); + } + + return OK; +} + +long int BlobCache::blob_random() { +#ifdef _WIN32 + return rand(); +#else + return nrand48(mRandState); +#endif +} + +void BlobCache::clean() { + // Remove a random cache entry until the total cache size gets below half + // the maximum total cache size. + while (mTotalSize > mMaxTotalSize / 2) { + size_t i = size_t(blob_random() % (mCacheEntries.size())); + const CacheEntry& entry(mCacheEntries[i]); + mTotalSize -= entry.getKey()->getSize() + entry.getValue()->getSize(); + mCacheEntries.removeAt(i); + } +} + +bool BlobCache::isCleanable() const { + return mTotalSize > mMaxTotalSize / 2; +} + +BlobCache::Blob::Blob(const void* data, size_t size, bool copyData): + mData(copyData ? malloc(size) : data), + mSize(size), + mOwnsData(copyData) { + if (data != NULL && copyData) { + memcpy(const_cast(mData), data, size); + } +} + +BlobCache::Blob::~Blob() { + if (mOwnsData) { + free(const_cast(mData)); + } +} + +bool BlobCache::Blob::operator<(const Blob& rhs) const { + if (mSize == rhs.mSize) { + return memcmp(mData, rhs.mData, mSize) < 0; + } else { + return mSize < rhs.mSize; + } +} + +const void* BlobCache::Blob::getData() const { + return mData; +} + +size_t BlobCache::Blob::getSize() const { + return mSize; +} + +BlobCache::CacheEntry::CacheEntry() { +} + +BlobCache::CacheEntry::CacheEntry(const sp& key, const sp& value): + mKey(key), + mValue(value) { +} + +BlobCache::CacheEntry::CacheEntry(const CacheEntry& ce): + mKey(ce.mKey), + mValue(ce.mValue) { +} + +bool BlobCache::CacheEntry::operator<(const CacheEntry& rhs) const { + return *mKey < *rhs.mKey; +} + +const BlobCache::CacheEntry& BlobCache::CacheEntry::operator=(const CacheEntry& rhs) { + mKey = rhs.mKey; + mValue = rhs.mValue; + return *this; +} + +sp BlobCache::CacheEntry::getKey() const { + return mKey; +} + +sp BlobCache::CacheEntry::getValue() const { + return mValue; +} + +void BlobCache::CacheEntry::setValue(const sp& value) { + mValue = value; +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/BufferedTextOutput.cpp android-platform-frameworks-native-21/libs/utils/BufferedTextOutput.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/BufferedTextOutput.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/BufferedTextOutput.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,279 @@ +/* + * Copyright (C) 2006 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 + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +struct BufferedTextOutput::BufferState : public RefBase +{ + BufferState(int32_t _seq) + : seq(_seq) + , buffer(NULL) + , bufferPos(0) + , bufferSize(0) + , atFront(true) + , indent(0) + , bundle(0) { + } + ~BufferState() { + free(buffer); + } + + status_t append(const char* txt, size_t len) { + if ((len+bufferPos) > bufferSize) { + void* b = realloc(buffer, ((len+bufferPos)*3)/2); + if (!b) return NO_MEMORY; + buffer = (char*)b; + } + memcpy(buffer+bufferPos, txt, len); + bufferPos += len; + return NO_ERROR; + } + + void restart() { + bufferPos = 0; + atFront = true; + if (bufferSize > 256) { + void* b = realloc(buffer, 256); + if (b) { + buffer = (char*)b; + bufferSize = 256; + } + } + } + + const int32_t seq; + char* buffer; + size_t bufferPos; + size_t bufferSize; + bool atFront; + int32_t indent; + int32_t bundle; +}; + +struct BufferedTextOutput::ThreadState +{ + Vector > states; +}; + +static mutex_t gMutex; + +static thread_store_t tls; + +BufferedTextOutput::ThreadState* BufferedTextOutput::getThreadState() +{ + ThreadState* ts = (ThreadState*) thread_store_get( &tls ); + if (ts) return ts; + ts = new ThreadState; + thread_store_set( &tls, ts, threadDestructor ); + return ts; +} + +void BufferedTextOutput::threadDestructor(void *st) +{ + delete ((ThreadState*)st); +} + +static volatile int32_t gSequence = 0; + +static volatile int32_t gFreeBufferIndex = -1; + +static int32_t allocBufferIndex() +{ + int32_t res = -1; + + mutex_lock(&gMutex); + + if (gFreeBufferIndex >= 0) { + res = gFreeBufferIndex; + gFreeBufferIndex = gTextBuffers[res]; + gTextBuffers.editItemAt(res) = -1; + + } else { + res = gTextBuffers.size(); + gTextBuffers.add(-1); + } + + mutex_unlock(&gMutex); + + return res; +} + +static void freeBufferIndex(int32_t idx) +{ + mutex_lock(&gMutex); + gTextBuffers.editItemAt(idx) = gFreeBufferIndex; + gFreeBufferIndex = idx; + mutex_unlock(&gMutex); +} + +// --------------------------------------------------------------------------- + +BufferedTextOutput::BufferedTextOutput(uint32_t flags) + : mFlags(flags) + , mSeq(android_atomic_inc(&gSequence)) + , mIndex(allocBufferIndex()) +{ + mGlobalState = new BufferState(mSeq); + if (mGlobalState) mGlobalState->incStrong(this); +} + +BufferedTextOutput::~BufferedTextOutput() +{ + if (mGlobalState) mGlobalState->decStrong(this); + freeBufferIndex(mIndex); +} + +status_t BufferedTextOutput::print(const char* txt, size_t len) +{ + //printf("BufferedTextOutput: printing %d\n", len); + + AutoMutex _l(mLock); + BufferState* b = getBuffer(); + + const char* const end = txt+len; + + status_t err; + + while (txt < end) { + // Find the next line. + const char* first = txt; + while (txt < end && *txt != '\n') txt++; + + // Include this and all following empty lines. + while (txt < end && *txt == '\n') txt++; + + // Special cases for first data on a line. + if (b->atFront) { + if (b->indent > 0) { + // If this is the start of a line, add the indent. + const char* prefix = stringForIndent(b->indent); + err = b->append(prefix, strlen(prefix)); + if (err != NO_ERROR) return err; + + } else if (*(txt-1) == '\n' && !b->bundle) { + // Fast path: if we are not indenting or bundling, and + // have been given one or more complete lines, just write + // them out without going through the buffer. + + // Slurp up all of the lines. + const char* lastLine = txt+1; + while (txt < end) { + if (*txt++ == '\n') lastLine = txt; + } + struct iovec vec; + vec.iov_base = (void*)first; + vec.iov_len = lastLine-first; + //printf("Writing %d bytes of data!\n", vec.iov_len); + writeLines(vec, 1); + txt = lastLine; + continue; + } + } + + // Append the new text to the buffer. + err = b->append(first, txt-first); + if (err != NO_ERROR) return err; + b->atFront = *(txt-1) == '\n'; + + // If we have finished a line and are not bundling, write + // it out. + //printf("Buffer is now %d bytes\n", b->bufferPos); + if (b->atFront && !b->bundle) { + struct iovec vec; + vec.iov_base = b->buffer; + vec.iov_len = b->bufferPos; + //printf("Writing %d bytes of data!\n", vec.iov_len); + writeLines(vec, 1); + b->restart(); + } + } + + return NO_ERROR; +} + +void BufferedTextOutput::moveIndent(int delta) +{ + AutoMutex _l(mLock); + BufferState* b = getBuffer(); + b->indent += delta; + if (b->indent < 0) b->indent = 0; +} + +void BufferedTextOutput::pushBundle() +{ + AutoMutex _l(mLock); + BufferState* b = getBuffer(); + b->bundle++; +} + +void BufferedTextOutput::popBundle() +{ + AutoMutex _l(mLock); + BufferState* b = getBuffer(); + b->bundle--; + LOG_FATAL_IF(b->bundle < 0, + "TextOutput::popBundle() called more times than pushBundle()"); + if (b->bundle < 0) b->bundle = 0; + + if (b->bundle == 0) { + // Last bundle, write out data if it is complete. If it is not + // complete, don't write until the last line is done... this may + // or may not be the write thing to do, but it's the easiest. + if (b->bufferPos > 0 && b->atFront) { + struct iovec vec; + vec.iov_base = b->buffer; + vec.iov_len = b->bufferPos; + writeLines(vec, 1); + b->restart(); + } + } +} + +BufferedTextOutput::BufferState* BufferedTextOutput::getBuffer() const +{ + if ((mFlags&MULTITHREADED) != 0) { + ThreadState* ts = getThreadState(); + if (ts) { + while (ts->states.size() <= (size_t)mIndex) ts->states.add(NULL); + BufferState* bs = ts->states[mIndex].get(); + if (bs != NULL && bs->seq == mSeq) return bs; + + ts->states.editItemAt(mIndex) = new BufferState(mIndex); + bs = ts->states[mIndex].get(); + if (bs != NULL) return bs; + } + } + + return mGlobalState; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/CallStack.cpp android-platform-frameworks-native-21/libs/utils/CallStack.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/CallStack.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/CallStack.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,129 @@ +/* + * Copyright (C) 2007 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. + */ + +#define LOG_TAG "CallStack" + +#include + +#include +#include +#include +#include + +/*****************************************************************************/ +namespace android { + +CallStack::CallStack() : + mCount(0) { +} + +CallStack::CallStack(const CallStack& rhs) : + mCount(rhs.mCount) { + if (mCount) { + memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)); + } +} + +CallStack::~CallStack() { +} + +CallStack& CallStack::operator = (const CallStack& rhs) { + mCount = rhs.mCount; + if (mCount) { + memcpy(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)); + } + return *this; +} + +bool CallStack::operator == (const CallStack& rhs) const { + if (mCount != rhs.mCount) + return false; + return !mCount || memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) == 0; +} + +bool CallStack::operator != (const CallStack& rhs) const { + return !operator == (rhs); +} + +bool CallStack::operator < (const CallStack& rhs) const { + if (mCount != rhs.mCount) + return mCount < rhs.mCount; + return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) < 0; +} + +bool CallStack::operator >= (const CallStack& rhs) const { + return !operator < (rhs); +} + +bool CallStack::operator > (const CallStack& rhs) const { + if (mCount != rhs.mCount) + return mCount > rhs.mCount; + return memcmp(mStack, rhs.mStack, mCount * sizeof(backtrace_frame_t)) > 0; +} + +bool CallStack::operator <= (const CallStack& rhs) const { + return !operator > (rhs); +} + +const void* CallStack::operator [] (int index) const { + if (index >= int(mCount)) + return 0; + return reinterpret_cast(mStack[index].absolute_pc); +} + +void CallStack::clear() { + mCount = 0; +} + +void CallStack::update(int32_t ignoreDepth, int32_t maxDepth) { + if (maxDepth > MAX_DEPTH) { + maxDepth = MAX_DEPTH; + } + ssize_t count = unwind_backtrace(mStack, ignoreDepth + 1, maxDepth); + mCount = count > 0 ? count : 0; +} + +void CallStack::dump(const char* prefix) const { + backtrace_symbol_t symbols[mCount]; + + get_backtrace_symbols(mStack, mCount, symbols); + for (size_t i = 0; i < mCount; i++) { + char line[MAX_BACKTRACE_LINE_LENGTH]; + format_backtrace_line(i, &mStack[i], &symbols[i], + line, MAX_BACKTRACE_LINE_LENGTH); + ALOGD("%s%s", prefix, line); + } + free_backtrace_symbols(symbols, mCount); +} + +String8 CallStack::toString(const char* prefix) const { + String8 str; + backtrace_symbol_t symbols[mCount]; + + get_backtrace_symbols(mStack, mCount, symbols); + for (size_t i = 0; i < mCount; i++) { + char line[MAX_BACKTRACE_LINE_LENGTH]; + format_backtrace_line(i, &mStack[i], &symbols[i], + line, MAX_BACKTRACE_LINE_LENGTH); + str.append(prefix); + str.append(line); + str.append("\n"); + } + free_backtrace_symbols(symbols, mCount); + return str; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Debug.cpp android-platform-frameworks-native-21/libs/utils/Debug.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Debug.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Debug.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,318 @@ +/* + * Copyright (C) 2005 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 + +#include + +#include +#include +#include + +namespace android { + +// --------------------------------------------------------------------- + +static const char indentStr[] = +" " +" "; + +const char* stringForIndent(int32_t indentLevel) +{ + ssize_t off = sizeof(indentStr)-1-(indentLevel*2); + return indentStr + (off < 0 ? 0 : off); +} + +// --------------------------------------------------------------------- + +static void defaultPrintFunc(void* cookie, const char* txt) +{ + printf("%s", txt); +} + +// --------------------------------------------------------------------- + +static inline int isident(int c) +{ + return isalnum(c) || c == '_'; +} + +static inline bool isasciitype(char c) +{ + if( c >= ' ' && c < 127 && c != '\'' && c != '\\' ) return true; + return false; +} + +static inline char makehexdigit(uint32_t val) +{ + return "0123456789abcdef"[val&0xF]; +} + +static char* appendhexnum(uint32_t val, char* out) +{ + for( int32_t i=28; i>=0; i-=4 ) { + *out++ = makehexdigit( val>>i ); + } + *out = 0; + return out; +} + +static inline char makeupperhexdigit(uint32_t val) +{ + return "0123456789ABCDEF"[val&0xF]; +} + +static char* appendupperhexnum(uint32_t val, char* out) +{ + for( int32_t i=28; i>=0; i-=4 ) { + *out++ = makeupperhexdigit( val>>i ); + } + *out = 0; + return out; +} + +static char* appendcharornum(char c, char* out, bool skipzero = true) +{ + if (skipzero && c == 0) return out; + + if (isasciitype(c)) { + *out++ = c; + return out; + } + + *out++ = '\\'; + *out++ = 'x'; + *out++ = makehexdigit(c>>4); + *out++ = makehexdigit(c); + return out; +} + +static char* typetostring(uint32_t type, char* out, + bool fullContext = true, + bool strict = false) +{ + char* pos = out; + char c[4]; + c[0] = (char)((type>>24)&0xFF); + c[1] = (char)((type>>16)&0xFF); + c[2] = (char)((type>>8)&0xFF); + c[3] = (char)(type&0xFF); + bool valid; + if( !strict ) { + // now even less strict! + // valid = isasciitype(c[3]); + valid = true; + int32_t i = 0; + bool zero = true; + while (valid && i<3) { + if (c[i] == 0) { + if (!zero) valid = false; + } else { + zero = false; + //if (!isasciitype(c[i])) valid = false; + } + i++; + } + // if all zeros, not a valid type code. + if (zero) valid = false; + } else { + valid = isident(c[3]) ? true : false; + int32_t i = 0; + bool zero = true; + while (valid && i<3) { + if (c[i] == 0) { + if (!zero) valid = false; + } else { + zero = false; + if (!isident(c[i])) valid = false; + } + i++; + } + } + if( valid && (!fullContext || c[0] != '0' || c[1] != 'x') ) { + if( fullContext ) *pos++ = '\''; + pos = appendcharornum(c[0], pos); + pos = appendcharornum(c[1], pos); + pos = appendcharornum(c[2], pos); + pos = appendcharornum(c[3], pos); + if( fullContext ) *pos++ = '\''; + *pos = 0; + return pos; + } + + if( fullContext ) { + *pos++ = '0'; + *pos++ = 'x'; + } + return appendhexnum(type, pos); +} + +void printTypeCode(uint32_t typeCode, debugPrintFunc func, void* cookie) +{ + char buffer[32]; + char* end = typetostring(typeCode, buffer); + *end = 0; + func ? (*func)(cookie, buffer) : defaultPrintFunc(cookie, buffer); +} + +void printHexData(int32_t indent, const void *buf, size_t length, + size_t bytesPerLine, int32_t singleLineBytesCutoff, + size_t alignment, bool cStyle, + debugPrintFunc func, void* cookie) +{ + if (alignment == 0) { + if (bytesPerLine >= 16) alignment = 4; + else if (bytesPerLine >= 8) alignment = 2; + else alignment = 1; + } + if (func == NULL) func = defaultPrintFunc; + + size_t offset; + + unsigned char *pos = (unsigned char *)buf; + + if (pos == NULL) { + if (singleLineBytesCutoff < 0) func(cookie, "\n"); + func(cookie, "(NULL)"); + return; + } + + if (length == 0) { + if (singleLineBytesCutoff < 0) func(cookie, "\n"); + func(cookie, "(empty)"); + return; + } + + if ((int32_t)length < 0) { + if (singleLineBytesCutoff < 0) func(cookie, "\n"); + char buf[64]; + sprintf(buf, "(bad length: %zu)", length); + func(cookie, buf); + return; + } + + char buffer[256]; + static const size_t maxBytesPerLine = (sizeof(buffer)-1-11-4)/(3+1); + + if (bytesPerLine > maxBytesPerLine) bytesPerLine = maxBytesPerLine; + + const bool oneLine = (int32_t)length <= singleLineBytesCutoff; + bool newLine = false; + if (cStyle) { + indent++; + func(cookie, "{\n"); + newLine = true; + } else if (!oneLine) { + func(cookie, "\n"); + newLine = true; + } + + for (offset = 0; ; offset += bytesPerLine, pos += bytesPerLine) { + long remain = length; + + char* c = buffer; + if (!oneLine && !cStyle) { + sprintf(c, "0x%08x: ", (int)offset); + c += 12; + } + + size_t index; + size_t word; + + for (word = 0; word < bytesPerLine; ) { + +#ifdef HAVE_LITTLE_ENDIAN + const size_t startIndex = word+(alignment-(alignment?1:0)); + const ssize_t dir = -1; +#else + const size_t startIndex = word; + const ssize_t dir = 1; +#endif + + for (index = 0; index < alignment || (alignment == 0 && index < bytesPerLine); index++) { + + if (!cStyle) { + if (index == 0 && word > 0 && alignment > 0) { + *c++ = ' '; + } + + if (remain-- > 0) { + const unsigned char val = *(pos+startIndex+(index*dir)); + *c++ = makehexdigit(val>>4); + *c++ = makehexdigit(val); + } else if (!oneLine) { + *c++ = ' '; + *c++ = ' '; + } + } else { + if (remain > 0) { + if (index == 0 && word > 0) { + *c++ = ','; + *c++ = ' '; + } + if (index == 0) { + *c++ = '0'; + *c++ = 'x'; + } + const unsigned char val = *(pos+startIndex+(index*dir)); + *c++ = makehexdigit(val>>4); + *c++ = makehexdigit(val); + remain--; + } + } + } + + word += index; + } + + if (!cStyle) { + remain = length; + *c++ = ' '; + *c++ = '\''; + for (index = 0; index < bytesPerLine; index++) { + + if (remain-- > 0) { + const unsigned char val = pos[index]; + *c++ = (val >= ' ' && val < 127) ? val : '.'; + } else if (!oneLine) { + *c++ = ' '; + } + } + + *c++ = '\''; + if (length > bytesPerLine) *c++ = '\n'; + } else { + if (remain > 0) *c++ = ','; + *c++ = '\n'; + } + + if (newLine && indent) func(cookie, stringForIndent(indent)); + *c = 0; + func(cookie, buffer); + newLine = true; + + if (length <= bytesPerLine) break; + length -= bytesPerLine; + } + + if (cStyle) { + if (indent > 0) func(cookie, stringForIndent(indent-1)); + func(cookie, "};"); + } +} + +}; // namespace android + diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/FileMap.cpp android-platform-frameworks-native-21/libs/utils/FileMap.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/FileMap.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/FileMap.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,225 @@ +/* + * Copyright (C) 2006 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. + */ + +// +// Shared file mapping class. +// + +#define LOG_TAG "filemap" + +#include +#include + +#include +#include + +#ifdef HAVE_POSIX_FILEMAP +#include +#endif + +#include +#include +#include +#include + +using namespace android; + +/*static*/ long FileMap::mPageSize = -1; + + +/* + * Constructor. Create an empty object. + */ +FileMap::FileMap(void) + : mRefCount(1), mFileName(NULL), mBasePtr(NULL), mBaseLength(0), + mDataPtr(NULL), mDataLength(0) +{ +} + +/* + * Destructor. + */ +FileMap::~FileMap(void) +{ + assert(mRefCount == 0); + + //printf("+++ removing FileMap %p %u\n", mDataPtr, mDataLength); + + mRefCount = -100; // help catch double-free + if (mFileName != NULL) { + free(mFileName); + } +#ifdef HAVE_POSIX_FILEMAP + if (mBasePtr && munmap(mBasePtr, mBaseLength) != 0) { + ALOGD("munmap(%p, %d) failed\n", mBasePtr, (int) mBaseLength); + } +#endif +#ifdef HAVE_WIN32_FILEMAP + if (mBasePtr && UnmapViewOfFile(mBasePtr) == 0) { + ALOGD("UnmapViewOfFile(%p) failed, error = %ld\n", mBasePtr, + GetLastError() ); + } + if (mFileMapping != INVALID_HANDLE_VALUE) { + CloseHandle(mFileMapping); + } + CloseHandle(mFileHandle); +#endif +} + + +/* + * Create a new mapping on an open file. + * + * Closing the file descriptor does not unmap the pages, so we don't + * claim ownership of the fd. + * + * Returns "false" on failure. + */ +bool FileMap::create(const char* origFileName, int fd, off64_t offset, size_t length, + bool readOnly) +{ +#ifdef HAVE_WIN32_FILEMAP + int adjust; + off64_t adjOffset; + size_t adjLength; + + if (mPageSize == -1) { + SYSTEM_INFO si; + + GetSystemInfo( &si ); + mPageSize = si.dwAllocationGranularity; + } + + DWORD protect = readOnly ? PAGE_READONLY : PAGE_READWRITE; + + mFileHandle = (HANDLE) _get_osfhandle(fd); + mFileMapping = CreateFileMapping( mFileHandle, NULL, protect, 0, 0, NULL); + if (mFileMapping == NULL) { + ALOGE("CreateFileMapping(%p, %lx) failed with error %ld\n", + mFileHandle, protect, GetLastError() ); + return false; + } + + adjust = offset % mPageSize; + adjOffset = offset - adjust; + adjLength = length + adjust; + + mBasePtr = MapViewOfFile( mFileMapping, + readOnly ? FILE_MAP_READ : FILE_MAP_ALL_ACCESS, + 0, + (DWORD)(adjOffset), + adjLength ); + if (mBasePtr == NULL) { + ALOGE("MapViewOfFile(%ld, %ld) failed with error %ld\n", + adjOffset, adjLength, GetLastError() ); + CloseHandle(mFileMapping); + mFileMapping = INVALID_HANDLE_VALUE; + return false; + } +#endif +#ifdef HAVE_POSIX_FILEMAP + int prot, flags, adjust; + off64_t adjOffset; + size_t adjLength; + + void* ptr; + + assert(mRefCount == 1); + assert(fd >= 0); + assert(offset >= 0); + assert(length > 0); + + /* init on first use */ + if (mPageSize == -1) { +#if NOT_USING_KLIBC + mPageSize = sysconf(_SC_PAGESIZE); + if (mPageSize == -1) { + ALOGE("could not get _SC_PAGESIZE\n"); + return false; + } +#else + /* this holds for Linux, Darwin, Cygwin, and doesn't pain the ARM */ + mPageSize = 4096; +#endif + } + + adjust = offset % mPageSize; +try_again: + adjOffset = offset - adjust; + adjLength = length + adjust; + + flags = MAP_SHARED; + prot = PROT_READ; + if (!readOnly) + prot |= PROT_WRITE; + + ptr = mmap(NULL, adjLength, prot, flags, fd, adjOffset); + if (ptr == MAP_FAILED) { + // Cygwin does not seem to like file mapping files from an offset. + // So if we fail, try again with offset zero + if (adjOffset > 0) { + adjust = offset; + goto try_again; + } + + ALOGE("mmap(%ld,%ld) failed: %s\n", + (long) adjOffset, (long) adjLength, strerror(errno)); + return false; + } + mBasePtr = ptr; +#endif /* HAVE_POSIX_FILEMAP */ + + mFileName = origFileName != NULL ? strdup(origFileName) : NULL; + mBaseLength = adjLength; + mDataOffset = offset; + mDataPtr = (char*) mBasePtr + adjust; + mDataLength = length; + + assert(mBasePtr != NULL); + + ALOGV("MAP: base %p/%d data %p/%d\n", + mBasePtr, (int) mBaseLength, mDataPtr, (int) mDataLength); + + return true; +} + +/* + * Provide guidance to the system. + */ +int FileMap::advise(MapAdvice advice) +{ +#if HAVE_MADVISE + int cc, sysAdvice; + + switch (advice) { + case NORMAL: sysAdvice = MADV_NORMAL; break; + case RANDOM: sysAdvice = MADV_RANDOM; break; + case SEQUENTIAL: sysAdvice = MADV_SEQUENTIAL; break; + case WILLNEED: sysAdvice = MADV_WILLNEED; break; + case DONTNEED: sysAdvice = MADV_DONTNEED; break; + default: + assert(false); + return -1; + } + + cc = madvise(mBasePtr, mBaseLength, sysAdvice); + if (cc != 0) + ALOGW("madvise(%d) failed: %s\n", sysAdvice, strerror(errno)); + return cc; +#else + return -1; +#endif // HAVE_MADVISE +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Flattenable.cpp android-platform-frameworks-native-21/libs/utils/Flattenable.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Flattenable.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Flattenable.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,24 @@ +/* + * Copyright (C) 2006 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 + +namespace android { + +Flattenable::~Flattenable() { +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/LinearTransform.cpp android-platform-frameworks-native-21/libs/utils/LinearTransform.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/LinearTransform.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/LinearTransform.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,262 @@ +/* + * 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. + */ + +#define __STDC_LIMIT_MACROS + +#include +#include + +#include + +namespace android { + +template static inline T ABS(T x) { return (x < 0) ? -x : x; } + +// Static math methods involving linear transformations +static bool scale_u64_to_u64( + uint64_t val, + uint32_t N, + uint32_t D, + uint64_t* res, + bool round_up_not_down) { + uint64_t tmp1, tmp2; + uint32_t r; + + assert(res); + assert(D); + + // Let U32(X) denote a uint32_t containing the upper 32 bits of a 64 bit + // integer X. + // Let L32(X) denote a uint32_t containing the lower 32 bits of a 64 bit + // integer X. + // Let X[A, B] with A <= B denote bits A through B of the integer X. + // Let (A | B) denote the concatination of two 32 bit ints, A and B. + // IOW X = (A | B) => U32(X) == A && L32(X) == B + // + // compute M = val * N (a 96 bit int) + // --------------------------------- + // tmp2 = U32(val) * N (a 64 bit int) + // tmp1 = L32(val) * N (a 64 bit int) + // which means + // M = val * N = (tmp2 << 32) + tmp1 + tmp2 = (val >> 32) * N; + tmp1 = (val & UINT32_MAX) * N; + + // compute M[32, 95] + // tmp2 = tmp2 + U32(tmp1) + // = (U32(val) * N) + U32(L32(val) * N) + // = M[32, 95] + tmp2 += tmp1 >> 32; + + // if M[64, 95] >= D, then M/D has bits > 63 set and we have + // an overflow. + if ((tmp2 >> 32) >= D) { + *res = UINT64_MAX; + return false; + } + + // Divide. Going in we know + // tmp2 = M[32, 95] + // U32(tmp2) < D + r = tmp2 % D; + tmp2 /= D; + + // At this point + // tmp1 = L32(val) * N + // tmp2 = M[32, 95] / D + // = (M / D)[32, 95] + // r = M[32, 95] % D + // U32(tmp2) = 0 + // + // compute tmp1 = (r | M[0, 31]) + tmp1 = (tmp1 & UINT32_MAX) | ((uint64_t)r << 32); + + // Divide again. Keep the remainder around in order to round properly. + r = tmp1 % D; + tmp1 /= D; + + // At this point + // tmp2 = (M / D)[32, 95] + // tmp1 = (M / D)[ 0, 31] + // r = M % D + // U32(tmp1) = 0 + // U32(tmp2) = 0 + + // Pack the result and deal with the round-up case (As well as the + // remote possiblility over overflow in such a case). + *res = (tmp2 << 32) | tmp1; + if (r && round_up_not_down) { + ++(*res); + if (!(*res)) { + *res = UINT64_MAX; + return false; + } + } + + return true; +} + +static bool linear_transform_s64_to_s64( + int64_t val, + int64_t basis1, + int32_t N, + uint32_t D, + int64_t basis2, + int64_t* out) { + uint64_t scaled, res; + uint64_t abs_val; + bool is_neg; + + if (!out) + return false; + + // Compute abs(val - basis_64). Keep track of whether or not this delta + // will be negative after the scale opertaion. + if (val < basis1) { + is_neg = true; + abs_val = basis1 - val; + } else { + is_neg = false; + abs_val = val - basis1; + } + + if (N < 0) + is_neg = !is_neg; + + if (!scale_u64_to_u64(abs_val, + ABS(N), + D, + &scaled, + is_neg)) + return false; // overflow/undeflow + + // if scaled is >= 0x8000, then we are going to overflow or + // underflow unless ABS(basis2) is large enough to pull us back into the + // non-overflow/underflow region. + if (scaled & INT64_MIN) { + if (is_neg && (basis2 < 0)) + return false; // certain underflow + + if (!is_neg && (basis2 >= 0)) + return false; // certain overflow + + if (ABS(basis2) <= static_cast(scaled & INT64_MAX)) + return false; // not enough + + // Looks like we are OK + *out = (is_neg ? (-scaled) : scaled) + basis2; + } else { + // Scaled fits within signed bounds, so we just need to check for + // over/underflow for two signed integers. Basically, if both scaled + // and basis2 have the same sign bit, and the result has a different + // sign bit, then we have under/overflow. An easy way to compute this + // is + // (scaled_signbit XNOR basis_signbit) && + // (scaled_signbit XOR res_signbit) + // == + // (scaled_signbit XOR basis_signbit XOR 1) && + // (scaled_signbit XOR res_signbit) + + if (is_neg) + scaled = -scaled; + res = scaled + basis2; + + if ((scaled ^ basis2 ^ INT64_MIN) & (scaled ^ res) & INT64_MIN) + return false; + + *out = res; + } + + return true; +} + +bool LinearTransform::doForwardTransform(int64_t a_in, int64_t* b_out) const { + if (0 == a_to_b_denom) + return false; + + return linear_transform_s64_to_s64(a_in, + a_zero, + a_to_b_numer, + a_to_b_denom, + b_zero, + b_out); +} + +bool LinearTransform::doReverseTransform(int64_t b_in, int64_t* a_out) const { + if (0 == a_to_b_numer) + return false; + + return linear_transform_s64_to_s64(b_in, + b_zero, + a_to_b_denom, + a_to_b_numer, + a_zero, + a_out); +} + +template void LinearTransform::reduce(T* N, T* D) { + T a, b; + if (!N || !D || !(*D)) { + assert(false); + return; + } + + a = *N; + b = *D; + + if (a == 0) { + *D = 1; + return; + } + + // This implements Euclid's method to find GCD. + if (a < b) { + T tmp = a; + a = b; + b = tmp; + } + + while (1) { + // a is now the greater of the two. + const T remainder = a % b; + if (remainder == 0) { + *N /= b; + *D /= b; + return; + } + // by swapping remainder and b, we are guaranteeing that a is + // still the greater of the two upon entrance to the loop. + a = b; + b = remainder; + } +}; + +template void LinearTransform::reduce(uint64_t* N, uint64_t* D); +template void LinearTransform::reduce(uint32_t* N, uint32_t* D); + +void LinearTransform::reduce(int32_t* N, uint32_t* D) { + if (N && D && *D) { + if (*N < 0) { + *N = -(*N); + reduce(reinterpret_cast(N), D); + *N = -(*N); + } else { + reduce(reinterpret_cast(N), D); + } + } +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Looper.cpp android-platform-frameworks-native-21/libs/utils/Looper.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Looper.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Looper.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,561 @@ +// +// Copyright 2010 The Android Open Source Project +// +// A looper implementation based on epoll(). +// +#define LOG_TAG "Looper" + +//#define LOG_NDEBUG 0 + +// Debugs poll and wake interactions. +#define DEBUG_POLL_AND_WAKE 0 + +// Debugs callback registration and invocation. +#define DEBUG_CALLBACKS 0 + +#include +#include +#include + +#include +#include +#include + + +namespace android { + +// --- WeakMessageHandler --- + +WeakMessageHandler::WeakMessageHandler(const wp& handler) : + mHandler(handler) { +} + +WeakMessageHandler::~WeakMessageHandler() { +} + +void WeakMessageHandler::handleMessage(const Message& message) { + sp handler = mHandler.promote(); + if (handler != NULL) { + handler->handleMessage(message); + } +} + + +// --- SimpleLooperCallback --- + +SimpleLooperCallback::SimpleLooperCallback(ALooper_callbackFunc callback) : + mCallback(callback) { +} + +SimpleLooperCallback::~SimpleLooperCallback() { +} + +int SimpleLooperCallback::handleEvent(int fd, int events, void* data) { + return mCallback(fd, events, data); +} + + +// --- Looper --- + +// Hint for number of file descriptors to be associated with the epoll instance. +static const int EPOLL_SIZE_HINT = 8; + +// Maximum number of file descriptors for which to retrieve poll events each iteration. +static const int EPOLL_MAX_EVENTS = 16; + +static pthread_once_t gTLSOnce = PTHREAD_ONCE_INIT; +static pthread_key_t gTLSKey = 0; + +Looper::Looper(bool allowNonCallbacks) : + mAllowNonCallbacks(allowNonCallbacks), mSendingMessage(false), + mResponseIndex(0), mNextMessageUptime(LLONG_MAX) { + int wakeFds[2]; + int result = pipe(wakeFds); + LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe. errno=%d", errno); + + mWakeReadPipeFd = wakeFds[0]; + mWakeWritePipeFd = wakeFds[1]; + + result = fcntl(mWakeReadPipeFd, F_SETFL, O_NONBLOCK); + LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake read pipe non-blocking. errno=%d", + errno); + + result = fcntl(mWakeWritePipeFd, F_SETFL, O_NONBLOCK); + LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake write pipe non-blocking. errno=%d", + errno); + + // Allocate the epoll instance and register the wake pipe. + mEpollFd = epoll_create(EPOLL_SIZE_HINT); + LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno); + + struct epoll_event eventItem; + memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union + eventItem.events = EPOLLIN; + eventItem.data.fd = mWakeReadPipeFd; + result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, & eventItem); + LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance. errno=%d", + errno); +} + +Looper::~Looper() { + close(mWakeReadPipeFd); + close(mWakeWritePipeFd); + close(mEpollFd); +} + +void Looper::initTLSKey() { + int result = pthread_key_create(& gTLSKey, threadDestructor); + LOG_ALWAYS_FATAL_IF(result != 0, "Could not allocate TLS key."); +} + +void Looper::threadDestructor(void *st) { + Looper* const self = static_cast(st); + if (self != NULL) { + self->decStrong((void*)threadDestructor); + } +} + +void Looper::setForThread(const sp& looper) { + sp old = getForThread(); // also has side-effect of initializing TLS + + if (looper != NULL) { + looper->incStrong((void*)threadDestructor); + } + + pthread_setspecific(gTLSKey, looper.get()); + + if (old != NULL) { + old->decStrong((void*)threadDestructor); + } +} + +sp Looper::getForThread() { + int result = pthread_once(& gTLSOnce, initTLSKey); + LOG_ALWAYS_FATAL_IF(result != 0, "pthread_once failed"); + + return (Looper*)pthread_getspecific(gTLSKey); +} + +sp Looper::prepare(int opts) { + bool allowNonCallbacks = opts & ALOOPER_PREPARE_ALLOW_NON_CALLBACKS; + sp looper = Looper::getForThread(); + if (looper == NULL) { + looper = new Looper(allowNonCallbacks); + Looper::setForThread(looper); + } + if (looper->getAllowNonCallbacks() != allowNonCallbacks) { + ALOGW("Looper already prepared for this thread with a different value for the " + "ALOOPER_PREPARE_ALLOW_NON_CALLBACKS option."); + } + return looper; +} + +bool Looper::getAllowNonCallbacks() const { + return mAllowNonCallbacks; +} + +int Looper::pollOnce(int timeoutMillis, int* outFd, int* outEvents, void** outData) { + int result = 0; + for (;;) { + while (mResponseIndex < mResponses.size()) { + const Response& response = mResponses.itemAt(mResponseIndex++); + int ident = response.request.ident; + if (ident >= 0) { + int fd = response.request.fd; + int events = response.events; + void* data = response.request.data; +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ pollOnce - returning signalled identifier %d: " + "fd=%d, events=0x%x, data=%p", + this, ident, fd, events, data); +#endif + if (outFd != NULL) *outFd = fd; + if (outEvents != NULL) *outEvents = events; + if (outData != NULL) *outData = data; + return ident; + } + } + + if (result != 0) { +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ pollOnce - returning result %d", this, result); +#endif + if (outFd != NULL) *outFd = 0; + if (outEvents != NULL) *outEvents = 0; + if (outData != NULL) *outData = NULL; + return result; + } + + result = pollInner(timeoutMillis); + } +} + +int Looper::pollInner(int timeoutMillis) { +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ pollOnce - waiting: timeoutMillis=%d", this, timeoutMillis); +#endif + + // Adjust the timeout based on when the next message is due. + if (timeoutMillis != 0 && mNextMessageUptime != LLONG_MAX) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + int messageTimeoutMillis = toMillisecondTimeoutDelay(now, mNextMessageUptime); + if (messageTimeoutMillis >= 0 + && (timeoutMillis < 0 || messageTimeoutMillis < timeoutMillis)) { + timeoutMillis = messageTimeoutMillis; + } +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ pollOnce - next message in %lldns, adjusted timeout: timeoutMillis=%d", + this, mNextMessageUptime - now, timeoutMillis); +#endif + } + + // Poll. + int result = ALOOPER_POLL_WAKE; + mResponses.clear(); + mResponseIndex = 0; + + struct epoll_event eventItems[EPOLL_MAX_EVENTS]; + int eventCount = epoll_wait(mEpollFd, eventItems, EPOLL_MAX_EVENTS, timeoutMillis); + + // Acquire lock. + mLock.lock(); + + // Check for poll error. + if (eventCount < 0) { + if (errno == EINTR) { + goto Done; + } + ALOGW("Poll failed with an unexpected error, errno=%d", errno); + result = ALOOPER_POLL_ERROR; + goto Done; + } + + // Check for poll timeout. + if (eventCount == 0) { +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ pollOnce - timeout", this); +#endif + result = ALOOPER_POLL_TIMEOUT; + goto Done; + } + + // Handle all events. +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ pollOnce - handling events from %d fds", this, eventCount); +#endif + + for (int i = 0; i < eventCount; i++) { + int fd = eventItems[i].data.fd; + uint32_t epollEvents = eventItems[i].events; + if (fd == mWakeReadPipeFd) { + if (epollEvents & EPOLLIN) { + awoken(); + } else { + ALOGW("Ignoring unexpected epoll events 0x%x on wake read pipe.", epollEvents); + } + } else { + ssize_t requestIndex = mRequests.indexOfKey(fd); + if (requestIndex >= 0) { + int events = 0; + if (epollEvents & EPOLLIN) events |= ALOOPER_EVENT_INPUT; + if (epollEvents & EPOLLOUT) events |= ALOOPER_EVENT_OUTPUT; + if (epollEvents & EPOLLERR) events |= ALOOPER_EVENT_ERROR; + if (epollEvents & EPOLLHUP) events |= ALOOPER_EVENT_HANGUP; + pushResponse(events, mRequests.valueAt(requestIndex)); + } else { + ALOGW("Ignoring unexpected epoll events 0x%x on fd %d that is " + "no longer registered.", epollEvents, fd); + } + } + } +Done: ; + + // Invoke pending message callbacks. + mNextMessageUptime = LLONG_MAX; + while (mMessageEnvelopes.size() != 0) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(0); + if (messageEnvelope.uptime <= now) { + // Remove the envelope from the list. + // We keep a strong reference to the handler until the call to handleMessage + // finishes. Then we drop it so that the handler can be deleted *before* + // we reacquire our lock. + { // obtain handler + sp handler = messageEnvelope.handler; + Message message = messageEnvelope.message; + mMessageEnvelopes.removeAt(0); + mSendingMessage = true; + mLock.unlock(); + +#if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS + ALOGD("%p ~ pollOnce - sending message: handler=%p, what=%d", + this, handler.get(), message.what); +#endif + handler->handleMessage(message); + } // release handler + + mLock.lock(); + mSendingMessage = false; + result = ALOOPER_POLL_CALLBACK; + } else { + // The last message left at the head of the queue determines the next wakeup time. + mNextMessageUptime = messageEnvelope.uptime; + break; + } + } + + // Release lock. + mLock.unlock(); + + // Invoke all response callbacks. + for (size_t i = 0; i < mResponses.size(); i++) { + Response& response = mResponses.editItemAt(i); + if (response.request.ident == ALOOPER_POLL_CALLBACK) { + int fd = response.request.fd; + int events = response.events; + void* data = response.request.data; +#if DEBUG_POLL_AND_WAKE || DEBUG_CALLBACKS + ALOGD("%p ~ pollOnce - invoking fd event callback %p: fd=%d, events=0x%x, data=%p", + this, response.request.callback.get(), fd, events, data); +#endif + int callbackResult = response.request.callback->handleEvent(fd, events, data); + if (callbackResult == 0) { + removeFd(fd); + } + // Clear the callback reference in the response structure promptly because we + // will not clear the response vector itself until the next poll. + response.request.callback.clear(); + result = ALOOPER_POLL_CALLBACK; + } + } + return result; +} + +int Looper::pollAll(int timeoutMillis, int* outFd, int* outEvents, void** outData) { + if (timeoutMillis <= 0) { + int result; + do { + result = pollOnce(timeoutMillis, outFd, outEvents, outData); + } while (result == ALOOPER_POLL_CALLBACK); + return result; + } else { + nsecs_t endTime = systemTime(SYSTEM_TIME_MONOTONIC) + + milliseconds_to_nanoseconds(timeoutMillis); + + for (;;) { + int result = pollOnce(timeoutMillis, outFd, outEvents, outData); + if (result != ALOOPER_POLL_CALLBACK) { + return result; + } + + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + timeoutMillis = toMillisecondTimeoutDelay(now, endTime); + if (timeoutMillis == 0) { + return ALOOPER_POLL_TIMEOUT; + } + } + } +} + +void Looper::wake() { +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ wake", this); +#endif + + ssize_t nWrite; + do { + nWrite = write(mWakeWritePipeFd, "W", 1); + } while (nWrite == -1 && errno == EINTR); + + if (nWrite != 1) { + if (errno != EAGAIN) { + ALOGW("Could not write wake signal, errno=%d", errno); + } + } +} + +void Looper::awoken() { +#if DEBUG_POLL_AND_WAKE + ALOGD("%p ~ awoken", this); +#endif + + char buffer[16]; + ssize_t nRead; + do { + nRead = read(mWakeReadPipeFd, buffer, sizeof(buffer)); + } while ((nRead == -1 && errno == EINTR) || nRead == sizeof(buffer)); +} + +void Looper::pushResponse(int events, const Request& request) { + Response response; + response.events = events; + response.request = request; + mResponses.push(response); +} + +int Looper::addFd(int fd, int ident, int events, ALooper_callbackFunc callback, void* data) { + return addFd(fd, ident, events, callback ? new SimpleLooperCallback(callback) : NULL, data); +} + +int Looper::addFd(int fd, int ident, int events, const sp& callback, void* data) { +#if DEBUG_CALLBACKS + ALOGD("%p ~ addFd - fd=%d, ident=%d, events=0x%x, callback=%p, data=%p", this, fd, ident, + events, callback.get(), data); +#endif + + if (!callback.get()) { + if (! mAllowNonCallbacks) { + ALOGE("Invalid attempt to set NULL callback but not allowed for this looper."); + return -1; + } + + if (ident < 0) { + ALOGE("Invalid attempt to set NULL callback with ident < 0."); + return -1; + } + } else { + ident = ALOOPER_POLL_CALLBACK; + } + + int epollEvents = 0; + if (events & ALOOPER_EVENT_INPUT) epollEvents |= EPOLLIN; + if (events & ALOOPER_EVENT_OUTPUT) epollEvents |= EPOLLOUT; + + { // acquire lock + AutoMutex _l(mLock); + + Request request; + request.fd = fd; + request.ident = ident; + request.callback = callback; + request.data = data; + + struct epoll_event eventItem; + memset(& eventItem, 0, sizeof(epoll_event)); // zero out unused members of data field union + eventItem.events = epollEvents; + eventItem.data.fd = fd; + + ssize_t requestIndex = mRequests.indexOfKey(fd); + if (requestIndex < 0) { + int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, & eventItem); + if (epollResult < 0) { + ALOGE("Error adding epoll events for fd %d, errno=%d", fd, errno); + return -1; + } + mRequests.add(fd, request); + } else { + int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_MOD, fd, & eventItem); + if (epollResult < 0) { + ALOGE("Error modifying epoll events for fd %d, errno=%d", fd, errno); + return -1; + } + mRequests.replaceValueAt(requestIndex, request); + } + } // release lock + return 1; +} + +int Looper::removeFd(int fd) { +#if DEBUG_CALLBACKS + ALOGD("%p ~ removeFd - fd=%d", this, fd); +#endif + + { // acquire lock + AutoMutex _l(mLock); + ssize_t requestIndex = mRequests.indexOfKey(fd); + if (requestIndex < 0) { + return 0; + } + + int epollResult = epoll_ctl(mEpollFd, EPOLL_CTL_DEL, fd, NULL); + if (epollResult < 0) { + ALOGE("Error removing epoll events for fd %d, errno=%d", fd, errno); + return -1; + } + + mRequests.removeItemsAt(requestIndex); + } // release lock + return 1; +} + +void Looper::sendMessage(const sp& handler, const Message& message) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + sendMessageAtTime(now, handler, message); +} + +void Looper::sendMessageDelayed(nsecs_t uptimeDelay, const sp& handler, + const Message& message) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + sendMessageAtTime(now + uptimeDelay, handler, message); +} + +void Looper::sendMessageAtTime(nsecs_t uptime, const sp& handler, + const Message& message) { +#if DEBUG_CALLBACKS + ALOGD("%p ~ sendMessageAtTime - uptime=%lld, handler=%p, what=%d", + this, uptime, handler.get(), message.what); +#endif + + size_t i = 0; + { // acquire lock + AutoMutex _l(mLock); + + size_t messageCount = mMessageEnvelopes.size(); + while (i < messageCount && uptime >= mMessageEnvelopes.itemAt(i).uptime) { + i += 1; + } + + MessageEnvelope messageEnvelope(uptime, handler, message); + mMessageEnvelopes.insertAt(messageEnvelope, i, 1); + + // Optimization: If the Looper is currently sending a message, then we can skip + // the call to wake() because the next thing the Looper will do after processing + // messages is to decide when the next wakeup time should be. In fact, it does + // not even matter whether this code is running on the Looper thread. + if (mSendingMessage) { + return; + } + } // release lock + + // Wake the poll loop only when we enqueue a new message at the head. + if (i == 0) { + wake(); + } +} + +void Looper::removeMessages(const sp& handler) { +#if DEBUG_CALLBACKS + ALOGD("%p ~ removeMessages - handler=%p", this, handler.get()); +#endif + + { // acquire lock + AutoMutex _l(mLock); + + for (size_t i = mMessageEnvelopes.size(); i != 0; ) { + const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(--i); + if (messageEnvelope.handler == handler) { + mMessageEnvelopes.removeAt(i); + } + } + } // release lock +} + +void Looper::removeMessages(const sp& handler, int what) { +#if DEBUG_CALLBACKS + ALOGD("%p ~ removeMessages - handler=%p, what=%d", this, handler.get(), what); +#endif + + { // acquire lock + AutoMutex _l(mLock); + + for (size_t i = mMessageEnvelopes.size(); i != 0; ) { + const MessageEnvelope& messageEnvelope = mMessageEnvelopes.itemAt(--i); + if (messageEnvelope.handler == handler + && messageEnvelope.message.what == what) { + mMessageEnvelopes.removeAt(i); + } + } + } // release lock +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/misc.cpp android-platform-frameworks-native-21/libs/utils/misc.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/misc.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/misc.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,243 @@ +/* + * Copyright (C) 2005 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. + */ + +#define LOG_TAG "misc" + +// +// Miscellaneous utility functions. +// +#include +#include + +#include +#include +#include +#include +#include + +#if defined(HAVE_PTHREADS) +# include +#endif + +#include + +using namespace android; + +namespace android { + +/* + * Like strdup(), but uses C++ "new" operator instead of malloc. + */ +char* strdupNew(const char* str) +{ + char* newStr; + int len; + + if (str == NULL) + return NULL; + + len = strlen(str); + newStr = new char[len+1]; + memcpy(newStr, str, len+1); + + return newStr; +} + +/* + * Concatenate an argument vector. + */ +char* concatArgv(int argc, const char* const argv[]) +{ + char* newStr = NULL; + int len, totalLen, posn, idx; + + /* + * First, figure out the total length. + */ + totalLen = idx = 0; + while (1) { + if (idx == argc || argv[idx] == NULL) + break; + if (idx) + totalLen++; // leave a space between args + totalLen += strlen(argv[idx]); + idx++; + } + + /* + * Alloc the string. + */ + newStr = new char[totalLen +1]; + if (newStr == NULL) + return NULL; + + /* + * Finally, allocate the string and copy data over. + */ + idx = posn = 0; + while (1) { + if (idx == argc || argv[idx] == NULL) + break; + if (idx) + newStr[posn++] = ' '; + + len = strlen(argv[idx]); + memcpy(&newStr[posn], argv[idx], len); + posn += len; + + idx++; + } + + assert(posn == totalLen); + newStr[posn] = '\0'; + + return newStr; +} + +/* + * Count the #of args in an argument vector. Don't count the final NULL. + */ +int countArgv(const char* const argv[]) +{ + int count = 0; + + while (argv[count] != NULL) + count++; + + return count; +} + + +#include +/* + * Get a file's type. + */ +FileType getFileType(const char* fileName) +{ + struct stat sb; + + if (stat(fileName, &sb) < 0) { + if (errno == ENOENT || errno == ENOTDIR) + return kFileTypeNonexistent; + else { + fprintf(stderr, "getFileType got errno=%d on '%s'\n", + errno, fileName); + return kFileTypeUnknown; + } + } else { + if (S_ISREG(sb.st_mode)) + return kFileTypeRegular; + else if (S_ISDIR(sb.st_mode)) + return kFileTypeDirectory; + else if (S_ISCHR(sb.st_mode)) + return kFileTypeCharDev; + else if (S_ISBLK(sb.st_mode)) + return kFileTypeBlockDev; + else if (S_ISFIFO(sb.st_mode)) + return kFileTypeFifo; +#ifdef HAVE_SYMLINKS + else if (S_ISLNK(sb.st_mode)) + return kFileTypeSymlink; + else if (S_ISSOCK(sb.st_mode)) + return kFileTypeSocket; +#endif + else + return kFileTypeUnknown; + } +} + +/* + * Get a file's modification date. + */ +time_t getFileModDate(const char* fileName) +{ + struct stat sb; + + if (stat(fileName, &sb) < 0) + return (time_t) -1; + + return sb.st_mtime; +} + +/* + * Round up to the next highest power of 2. + * + * Found on http://graphics.stanford.edu/~seander/bithacks.html. + */ +unsigned int roundUpPower2(unsigned int val) +{ + val--; + val |= val >> 1; + val |= val >> 2; + val |= val >> 4; + val |= val >> 8; + val |= val >> 16; + val++; + + return val; +} + +struct sysprop_change_callback_info { + sysprop_change_callback callback; + int priority; +}; + +#if defined(HAVE_PTHREADS) +static pthread_mutex_t gSyspropMutex = PTHREAD_MUTEX_INITIALIZER; +static Vector* gSyspropList = NULL; +#endif + +void add_sysprop_change_callback(sysprop_change_callback cb, int priority) { +#if defined(HAVE_PTHREADS) + pthread_mutex_lock(&gSyspropMutex); + if (gSyspropList == NULL) { + gSyspropList = new Vector(); + } + sysprop_change_callback_info info; + info.callback = cb; + info.priority = priority; + bool added = false; + for (size_t i=0; isize(); i++) { + if (priority >= gSyspropList->itemAt(i).priority) { + gSyspropList->insertAt(info, i); + added = true; + break; + } + } + if (!added) { + gSyspropList->add(info); + } + pthread_mutex_unlock(&gSyspropMutex); +#endif +} + +void report_sysprop_change() { +#if defined(HAVE_PTHREADS) + pthread_mutex_lock(&gSyspropMutex); + Vector listeners; + if (gSyspropList != NULL) { + listeners = *gSyspropList; + } + pthread_mutex_unlock(&gSyspropMutex); + + //ALOGI("Reporting sysprop change to %d listeners", listeners.size()); + for (size_t i=0; i +#include + +#include +#include + +// Enables debug output for the parser. +#define DEBUG_PARSER 0 + +// Enables debug output for parser performance. +#define DEBUG_PARSER_PERFORMANCE 0 + + +namespace android { + +static const char* WHITESPACE = " \t\r"; +static const char* WHITESPACE_OR_PROPERTY_DELIMITER = " \t\r="; + + +// --- PropertyMap --- + +PropertyMap::PropertyMap() { +} + +PropertyMap::~PropertyMap() { +} + +void PropertyMap::clear() { + mProperties.clear(); +} + +void PropertyMap::addProperty(const String8& key, const String8& value) { + mProperties.add(key, value); +} + +bool PropertyMap::hasProperty(const String8& key) const { + return mProperties.indexOfKey(key) >= 0; +} + +bool PropertyMap::tryGetProperty(const String8& key, String8& outValue) const { + ssize_t index = mProperties.indexOfKey(key); + if (index < 0) { + return false; + } + + outValue = mProperties.valueAt(index); + return true; +} + +bool PropertyMap::tryGetProperty(const String8& key, bool& outValue) const { + int32_t intValue; + if (!tryGetProperty(key, intValue)) { + return false; + } + + outValue = intValue; + return true; +} + +bool PropertyMap::tryGetProperty(const String8& key, int32_t& outValue) const { + String8 stringValue; + if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) { + return false; + } + + char* end; + int value = strtol(stringValue.string(), & end, 10); + if (*end != '\0') { + ALOGW("Property key '%s' has invalid value '%s'. Expected an integer.", + key.string(), stringValue.string()); + return false; + } + outValue = value; + return true; +} + +bool PropertyMap::tryGetProperty(const String8& key, float& outValue) const { + String8 stringValue; + if (! tryGetProperty(key, stringValue) || stringValue.length() == 0) { + return false; + } + + char* end; + float value = strtof(stringValue.string(), & end); + if (*end != '\0') { + ALOGW("Property key '%s' has invalid value '%s'. Expected a float.", + key.string(), stringValue.string()); + return false; + } + outValue = value; + return true; +} + +void PropertyMap::addAll(const PropertyMap* map) { + for (size_t i = 0; i < map->mProperties.size(); i++) { + mProperties.add(map->mProperties.keyAt(i), map->mProperties.valueAt(i)); + } +} + +status_t PropertyMap::load(const String8& filename, PropertyMap** outMap) { + *outMap = NULL; + + Tokenizer* tokenizer; + status_t status = Tokenizer::open(filename, &tokenizer); + if (status) { + ALOGE("Error %d opening property file %s.", status, filename.string()); + } else { + PropertyMap* map = new PropertyMap(); + if (!map) { + ALOGE("Error allocating property map."); + status = NO_MEMORY; + } else { +#if DEBUG_PARSER_PERFORMANCE + nsecs_t startTime = systemTime(SYSTEM_TIME_MONOTONIC); +#endif + Parser parser(map, tokenizer); + status = parser.parse(); +#if DEBUG_PARSER_PERFORMANCE + nsecs_t elapsedTime = systemTime(SYSTEM_TIME_MONOTONIC) - startTime; + ALOGD("Parsed property file '%s' %d lines in %0.3fms.", + tokenizer->getFilename().string(), tokenizer->getLineNumber(), + elapsedTime / 1000000.0); +#endif + if (status) { + delete map; + } else { + *outMap = map; + } + } + delete tokenizer; + } + return status; +} + + +// --- PropertyMap::Parser --- + +PropertyMap::Parser::Parser(PropertyMap* map, Tokenizer* tokenizer) : + mMap(map), mTokenizer(tokenizer) { +} + +PropertyMap::Parser::~Parser() { +} + +status_t PropertyMap::Parser::parse() { + while (!mTokenizer->isEof()) { +#if DEBUG_PARSER + ALOGD("Parsing %s: '%s'.", mTokenizer->getLocation().string(), + mTokenizer->peekRemainderOfLine().string()); +#endif + + mTokenizer->skipDelimiters(WHITESPACE); + + if (!mTokenizer->isEol() && mTokenizer->peekChar() != '#') { + String8 keyToken = mTokenizer->nextToken(WHITESPACE_OR_PROPERTY_DELIMITER); + if (keyToken.isEmpty()) { + ALOGE("%s: Expected non-empty property key.", mTokenizer->getLocation().string()); + return BAD_VALUE; + } + + mTokenizer->skipDelimiters(WHITESPACE); + + if (mTokenizer->nextChar() != '=') { + ALOGE("%s: Expected '=' between property key and value.", + mTokenizer->getLocation().string()); + return BAD_VALUE; + } + + mTokenizer->skipDelimiters(WHITESPACE); + + String8 valueToken = mTokenizer->nextToken(WHITESPACE); + if (valueToken.find("\\", 0) >= 0 || valueToken.find("\"", 0) >= 0) { + ALOGE("%s: Found reserved character '\\' or '\"' in property value.", + mTokenizer->getLocation().string()); + return BAD_VALUE; + } + + mTokenizer->skipDelimiters(WHITESPACE); + if (!mTokenizer->isEol()) { + ALOGE("%s: Expected end of line, got '%s'.", + mTokenizer->getLocation().string(), + mTokenizer->peekRemainderOfLine().string()); + return BAD_VALUE; + } + + if (mMap->hasProperty(keyToken)) { + ALOGE("%s: Duplicate property value for key '%s'.", + mTokenizer->getLocation().string(), keyToken.string()); + return BAD_VALUE; + } + + mMap->addProperty(keyToken, valueToken); + } + + mTokenizer->nextLine(); + } + return NO_ERROR; +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/README android-platform-frameworks-native-21/libs/utils/README --- android-platform-frameworks-native-6.0.1+r16/libs/utils/README 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/README 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,289 @@ +Android Utility Function Library +================================ + + +If you need a feature that is native to Linux but not present on other +platforms, construct a platform-dependent implementation that shares +the Linux interface. That way the actual device runs as "light" as +possible. + +If that isn't feasible, create a system-independent interface and hide +the details. + +The ultimate goal is *not* to create a super-duper platform abstraction +layer. The goal is to provide an optimized solution for Linux with +reasonable implementations for other platforms. + + + +Resource overlay +================ + + +Introduction +------------ + +Overlay packages are special .apk files which provide no code but +additional resource values (and possibly new configurations) for +resources in other packages. When an application requests resources, +the system will return values from either the application's original +package or any associated overlay package. Any redirection is completely +transparent to the calling application. + +Resource values have the following precedence table, listed in +descending precedence. + + * overlay package, matching config (eg res/values-en-land) + + * original package, matching config + + * overlay package, no config (eg res/values) + + * original package, no config + +During compilation, overlay packages are differentiated from regular +packages by passing the -o flag to aapt. + + +Background +---------- + +This section provides generic background material on resources in +Android. + + +How resources are bundled in .apk files +~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ +Android .apk files are .zip files, usually housing .dex code, +certificates and resources, though packages containing resources but +no code are possible. Resources can be divided into the following +categories; a `configuration' indicates a set of phone language, display +density, network operator, etc. + + * assets: uncompressed, raw files packaged as part of an .apk and + explicitly referenced by filename. These files are + independent of configuration. + + * res/drawable: bitmap or xml graphics. Each file may have different + values depending on configuration. + + * res/values: integers, strings, etc. Each resource may have different + values depending on configuration. + +Resource meta information and information proper is stored in a binary +format in a named file resources.arsc, bundled as part of the .apk. + +Resource IDs and lookup +~~~~~~~~~~~~~~~~~~~~~~~ +During compilation, the aapt tool gathers application resources and +generates a resources.arsc file. Each resource name is assigned an +integer ID 0xppttiii (translated to a symbolic name via R.java), where + + * pp: corresponds to the package namespace (details below). + + * tt: corresponds to the resource type (string, int, etc). Every + resource of the same type within the same package has the same + tt value, but depending on available types, the actual numerical + value may be different between packages. + + * iiii: sequential number, assigned in the order resources are found. + +Resource values are specified paired with a set of configuration +constraints (the default being the empty set), eg res/values-sv-port +which imposes restrictions on language (Swedish) and display orientation +(portrait). During lookup, every constraint set is matched against the +current configuration, and the value corresponding to the best matching +constraint set is returned (ResourceTypes.{h,cpp}). + +Parsing of resources.arsc is handled by ResourceTypes.cpp; this utility +is governed by AssetManager.cpp, which tracks loaded resources per +process. + +Assets are looked up by path and filename in AssetManager.cpp. The path +to resources in res/drawable are located by ResourceTypes.cpp and then +handled like assets by AssetManager.cpp. Other resources are handled +solely by ResourceTypes.cpp. + +Package ID as namespace +~~~~~~~~~~~~~~~~~~~~~~~ +The pp part of a resource ID defines a namespace. Android currently +defines two namespaces: + + * 0x01: system resources (pre-installed in framework-res.apk) + + * 0x7f: application resources (bundled in the application .apk) + +ResourceTypes.cpp supports package IDs between 0x01 and 0x7f +(inclusive); values outside this range are invalid. + +Each running (Dalvik) process is assigned a unique instance of +AssetManager, which in turn keeps a forest structure of loaded +resource.arsc files. Normally, this forest is structured as follows, +where mPackageMap is the internal vector employed in ResourceTypes.cpp. + +mPackageMap[0x00] -> system package +mPackageMap[0x01] -> NULL +mPackageMap[0x02] -> NULL +... +mPackageMap[0x7f - 2] -> NULL +mPackageMap[0x7f - 1] -> application package + + + +The resource overlay extension +------------------------------ + +The resource overlay mechanism aims to (partly) shadow and extend +existing resources with new values for defined and new configurations. +Technically, this is achieved by adding resource-only packages (called +overlay packages) to existing resource namespaces, like so: + +mPackageMap[0x00] -> system package -> system overlay package +mPackageMap[0x01] -> NULL +mPackageMap[0x02] -> NULL +... +mPackageMap[0x7f - 2] -> NULL +mPackageMap[0x7f - 1] -> application package -> overlay 1 -> overlay 2 + +The use of overlay resources is completely transparent to +applications; no additional resource identifiers are introduced, only +configuration/value pairs. Any number of overlay packages may be loaded +at a time; overlay packages are agnostic to what they target -- both +system and application resources are fair game. + +The package targeted by an overlay package is called the target or +original package. + +Resource overlay operates on symbolic resources names. Hence, to +override the string/str1 resources in a package, the overlay package +would include a resource also named string/str1. The end user does not +have to worry about the numeric resources IDs assigned by aapt, as this +is resolved automatically by the system. + +As of this writing, the use of resource overlay has not been fully +explored. Until it has, only OEMs are trusted to use resource overlay. +For this reason, overlay packages must reside in /system/overlay. + + +Resource ID mapping +~~~~~~~~~~~~~~~~~~~ +Resource identifiers must be coherent within the same namespace (ie +PackageGroup in ResourceTypes.cpp). Calling applications will refer to +resources using the IDs defined in the original package, but there is no +guarantee aapt has assigned the same ID to the corresponding resource in +an overlay package. To translate between the two, a resource ID mapping +{original ID -> overlay ID} is created during package installation +(PackageManagerService.java) and used during resource lookup. The +mapping is stored in /data/resource-cache, with a @idmap file name +suffix. + +The idmap file format is documented in a separate section, below. + + +Package management +~~~~~~~~~~~~~~~~~~ +Packages are managed by the PackageManagerService. Addition and removal +of packages are monitored via the inotify framework, exposed via +android.os.FileObserver. + +During initialization of a Dalvik process, ActivityThread.java requests +the process' AssetManager (by proxy, via AssetManager.java and JNI) +to load a list of packages. This list includes overlay packages, if +present. + +When a target package or a corresponding overlay package is installed, +the target package's process is stopped and a new idmap is generated. +This is similar to how applications are stopped when their packages are +upgraded. + + +Creating overlay packages +------------------------- + +Overlay packages should contain no code, define (some) resources with +the same type and name as in the original package, and be compiled with +the -o flag passed to aapt. + +The aapt -o flag instructs aapt to create an overlay package. +Technically, this means the package will be assigned package id 0x00. + +There are no restrictions on overlay packages names, though the naming +convention .overlay. is recommended. + + +Example overlay package +~~~~~~~~~~~~~~~~~~~~~~~ + +To overlay the resource bool/b in package com.foo.bar, to be applied +when the display is in landscape mode, create a new package with +no source code and a single .xml file under res/values-land, with +an entry for bool/b. Compile with aapt -o and place the results in +/system/overlay by adding the following to Android.mk: + +LOCAL_AAPT_FLAGS := -o com.foo.bar +LOCAL_MODULE_PATH := $(TARGET_OUT)/overlay + + +The ID map (idmap) file format +------------------------------ + +The idmap format is designed for lookup performance. However, leading +and trailing undefined overlay values are discarded to reduce the memory +footprint. + + +idmap grammar +~~~~~~~~~~~~~ +All atoms (names in square brackets) are uint32_t integers. The +idmap-magic constant spells "idmp" in ASCII. Offsets are given relative +to the data_header, not to the beginning of the file. + +map := header data +header := idmap-magic +idmap-magic := <0x706d6469> +data := data_header type_block+ +data_header := header_block{m} +header_block := <0> | +type_block := entry{n} +entry := + + +idmap example +~~~~~~~~~~~~~ +Given a pair of target and overlay packages with CRC sums 0x216a8fe2 +and 0x6b9beaec, each defining the following resources + +Name Target package Overlay package +string/str0 0x7f010000 - +string/str1 0x7f010001 0x7f010000 +string/str2 0x7f010002 - +string/str3 0x7f010003 0x7f010001 +string/str4 0x7f010004 - +bool/bool0 0x7f020000 - +integer/int0 0x7f030000 0x7f020000 +integer/int1 0x7f030001 - + +the corresponding resource map is + +0x706d6469 0x216a8fe2 0x6b9beaec 0x00000003 \ +0x00000004 0x00000000 0x00000009 0x00000003 \ +0x00000001 0x7f010000 0x00000000 0x7f010001 \ +0x00000001 0x00000000 0x7f020000 + +or, formatted differently + +0x706d6469 # magic: all idmap files begin with this constant +0x216a8fe2 # CRC32 of the resources.arsc file in the original package +0x6b9beaec # CRC32 of the resources.arsc file in the overlay package +0x00000003 # header; three types (string, bool, integer) in the target package +0x00000004 # header_block for type 0 (string) is located at offset 4 +0x00000000 # no bool type exists in overlay package -> no header_block +0x00000009 # header_block for type 2 (integer) is located at offset 9 +0x00000003 # header_block for string; overlay IDs span 3 elements +0x00000001 # the first string in target package is entry 1 == offset +0x7f010000 # target 0x7f01001 -> overlay 0x7f010000 +0x00000000 # str2 not defined in overlay package +0x7f010001 # target 0x7f010003 -> overlay 0x7f010001 +0x00000001 # header_block for integer; overlay IDs span 1 element +0x00000000 # offset == 0 +0x7f020000 # target 0x7f030000 -> overlay 0x7f020000 diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/RefBase.cpp android-platform-frameworks-native-21/libs/utils/RefBase.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/RefBase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/RefBase.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,628 @@ +/* + * Copyright (C) 2005 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. + */ + +#define LOG_TAG "RefBase" + +#include + +#include +#include +#include +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +// compile with refcounting debugging enabled +#define DEBUG_REFS 0 +#define DEBUG_REFS_FATAL_SANITY_CHECKS 0 +#define DEBUG_REFS_ENABLED_BY_DEFAULT 1 +#define DEBUG_REFS_CALLSTACK_ENABLED 1 + +// log all reference counting operations +#define PRINT_REFS 0 + +// --------------------------------------------------------------------------- + +namespace android { + +#define INITIAL_STRONG_VALUE (1<<28) + +// --------------------------------------------------------------------------- + +class RefBase::weakref_impl : public RefBase::weakref_type +{ +public: + volatile int32_t mStrong; + volatile int32_t mWeak; + RefBase* const mBase; + volatile int32_t mFlags; + +#if !DEBUG_REFS + + weakref_impl(RefBase* base) + : mStrong(INITIAL_STRONG_VALUE) + , mWeak(0) + , mBase(base) + , mFlags(0) + { + } + + void addStrongRef(const void* /*id*/) { } + void removeStrongRef(const void* /*id*/) { } + void renameStrongRefId(const void* /*old_id*/, const void* /*new_id*/) { } + void addWeakRef(const void* /*id*/) { } + void removeWeakRef(const void* /*id*/) { } + void renameWeakRefId(const void* /*old_id*/, const void* /*new_id*/) { } + void printRefs() const { } + void trackMe(bool, bool) { } + +#else + + weakref_impl(RefBase* base) + : mStrong(INITIAL_STRONG_VALUE) + , mWeak(0) + , mBase(base) + , mFlags(0) + , mStrongRefs(NULL) + , mWeakRefs(NULL) + , mTrackEnabled(!!DEBUG_REFS_ENABLED_BY_DEFAULT) + , mRetain(false) + { + } + + ~weakref_impl() + { + bool dumpStack = false; + if (!mRetain && mStrongRefs != NULL) { + dumpStack = true; +#if DEBUG_REFS_FATAL_SANITY_CHECKS + LOG_ALWAYS_FATAL("Strong references remain!"); +#else + ALOGE("Strong references remain:"); +#endif + ref_entry* refs = mStrongRefs; + while (refs) { + char inc = refs->ref >= 0 ? '+' : '-'; + ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); +#if DEBUG_REFS_CALLSTACK_ENABLED + refs->stack.dump(); +#endif + refs = refs->next; + } + } + + if (!mRetain && mWeakRefs != NULL) { + dumpStack = true; +#if DEBUG_REFS_FATAL_SANITY_CHECKS + LOG_ALWAYS_FATAL("Weak references remain:"); +#else + ALOGE("Weak references remain!"); +#endif + ref_entry* refs = mWeakRefs; + while (refs) { + char inc = refs->ref >= 0 ? '+' : '-'; + ALOGD("\t%c ID %p (ref %d):", inc, refs->id, refs->ref); +#if DEBUG_REFS_CALLSTACK_ENABLED + refs->stack.dump(); +#endif + refs = refs->next; + } + } + if (dumpStack) { + ALOGE("above errors at:"); + CallStack stack; + stack.update(); + stack.dump(); + } + } + + void addStrongRef(const void* id) { + //ALOGD_IF(mTrackEnabled, + // "addStrongRef: RefBase=%p, id=%p", mBase, id); + addRef(&mStrongRefs, id, mStrong); + } + + void removeStrongRef(const void* id) { + //ALOGD_IF(mTrackEnabled, + // "removeStrongRef: RefBase=%p, id=%p", mBase, id); + if (!mRetain) { + removeRef(&mStrongRefs, id); + } else { + addRef(&mStrongRefs, id, -mStrong); + } + } + + void renameStrongRefId(const void* old_id, const void* new_id) { + //ALOGD_IF(mTrackEnabled, + // "renameStrongRefId: RefBase=%p, oid=%p, nid=%p", + // mBase, old_id, new_id); + renameRefsId(mStrongRefs, old_id, new_id); + } + + void addWeakRef(const void* id) { + addRef(&mWeakRefs, id, mWeak); + } + + void removeWeakRef(const void* id) { + if (!mRetain) { + removeRef(&mWeakRefs, id); + } else { + addRef(&mWeakRefs, id, -mWeak); + } + } + + void renameWeakRefId(const void* old_id, const void* new_id) { + renameRefsId(mWeakRefs, old_id, new_id); + } + + void trackMe(bool track, bool retain) + { + mTrackEnabled = track; + mRetain = retain; + } + + void printRefs() const + { + String8 text; + + { + Mutex::Autolock _l(mMutex); + char buf[128]; + sprintf(buf, "Strong references on RefBase %p (weakref_type %p):\n", mBase, this); + text.append(buf); + printRefsLocked(&text, mStrongRefs); + sprintf(buf, "Weak references on RefBase %p (weakref_type %p):\n", mBase, this); + text.append(buf); + printRefsLocked(&text, mWeakRefs); + } + + { + char name[100]; + snprintf(name, 100, "/data/%p.stack", this); + int rc = open(name, O_RDWR | O_CREAT | O_APPEND); + if (rc >= 0) { + write(rc, text.string(), text.length()); + close(rc); + ALOGD("STACK TRACE for %p saved in %s", this, name); + } + else ALOGE("FAILED TO PRINT STACK TRACE for %p in %s: %s", this, + name, strerror(errno)); + } + } + +private: + struct ref_entry + { + ref_entry* next; + const void* id; +#if DEBUG_REFS_CALLSTACK_ENABLED + CallStack stack; +#endif + int32_t ref; + }; + + void addRef(ref_entry** refs, const void* id, int32_t mRef) + { + if (mTrackEnabled) { + AutoMutex _l(mMutex); + + ref_entry* ref = new ref_entry; + // Reference count at the time of the snapshot, but before the + // update. Positive value means we increment, negative--we + // decrement the reference count. + ref->ref = mRef; + ref->id = id; +#if DEBUG_REFS_CALLSTACK_ENABLED + ref->stack.update(2); +#endif + ref->next = *refs; + *refs = ref; + } + } + + void removeRef(ref_entry** refs, const void* id) + { + if (mTrackEnabled) { + AutoMutex _l(mMutex); + + ref_entry* const head = *refs; + ref_entry* ref = head; + while (ref != NULL) { + if (ref->id == id) { + *refs = ref->next; + delete ref; + return; + } + refs = &ref->next; + ref = *refs; + } + +#if DEBUG_REFS_FATAL_SANITY_CHECKS + LOG_ALWAYS_FATAL("RefBase: removing id %p on RefBase %p" + "(weakref_type %p) that doesn't exist!", + id, mBase, this); +#endif + + ALOGE("RefBase: removing id %p on RefBase %p" + "(weakref_type %p) that doesn't exist!", + id, mBase, this); + + ref = head; + while (ref) { + char inc = ref->ref >= 0 ? '+' : '-'; + ALOGD("\t%c ID %p (ref %d):", inc, ref->id, ref->ref); + ref = ref->next; + } + + CallStack stack; + stack.update(); + stack.dump(); + } + } + + void renameRefsId(ref_entry* r, const void* old_id, const void* new_id) + { + if (mTrackEnabled) { + AutoMutex _l(mMutex); + ref_entry* ref = r; + while (ref != NULL) { + if (ref->id == old_id) { + ref->id = new_id; + } + ref = ref->next; + } + } + } + + void printRefsLocked(String8* out, const ref_entry* refs) const + { + char buf[128]; + while (refs) { + char inc = refs->ref >= 0 ? '+' : '-'; + sprintf(buf, "\t%c ID %p (ref %d):\n", + inc, refs->id, refs->ref); + out->append(buf); +#if DEBUG_REFS_CALLSTACK_ENABLED + out->append(refs->stack.toString("\t\t")); +#else + out->append("\t\t(call stacks disabled)"); +#endif + refs = refs->next; + } + } + + mutable Mutex mMutex; + ref_entry* mStrongRefs; + ref_entry* mWeakRefs; + + bool mTrackEnabled; + // Collect stack traces on addref and removeref, instead of deleting the stack references + // on removeref that match the address ones. + bool mRetain; + +#endif +}; + +// --------------------------------------------------------------------------- + +void RefBase::incStrong(const void* id) const +{ + weakref_impl* const refs = mRefs; + refs->incWeak(id); + + refs->addStrongRef(id); + const int32_t c = android_atomic_inc(&refs->mStrong); + ALOG_ASSERT(c > 0, "incStrong() called on %p after last strong ref", refs); +#if PRINT_REFS + ALOGD("incStrong of %p from %p: cnt=%d\n", this, id, c); +#endif + if (c != INITIAL_STRONG_VALUE) { + return; + } + + android_atomic_add(-INITIAL_STRONG_VALUE, &refs->mStrong); + refs->mBase->onFirstRef(); +} + +void RefBase::decStrong(const void* id) const +{ + weakref_impl* const refs = mRefs; + refs->removeStrongRef(id); + const int32_t c = android_atomic_dec(&refs->mStrong); +#if PRINT_REFS + ALOGD("decStrong of %p from %p: cnt=%d\n", this, id, c); +#endif + ALOG_ASSERT(c >= 1, "decStrong() called on %p too many times", refs); + if (c == 1) { + refs->mBase->onLastStrongRef(id); + if ((refs->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_STRONG) { + delete this; + } + } + refs->decWeak(id); +} + +void RefBase::forceIncStrong(const void* id) const +{ + weakref_impl* const refs = mRefs; + refs->incWeak(id); + + refs->addStrongRef(id); + const int32_t c = android_atomic_inc(&refs->mStrong); + ALOG_ASSERT(c >= 0, "forceIncStrong called on %p after ref count underflow", + refs); +#if PRINT_REFS + ALOGD("forceIncStrong of %p from %p: cnt=%d\n", this, id, c); +#endif + + switch (c) { + case INITIAL_STRONG_VALUE: + android_atomic_add(-INITIAL_STRONG_VALUE, &refs->mStrong); + // fall through... + case 0: + refs->mBase->onFirstRef(); + } +} + +int32_t RefBase::getStrongCount() const +{ + return mRefs->mStrong; +} + +RefBase* RefBase::weakref_type::refBase() const +{ + return static_cast(this)->mBase; +} + +void RefBase::weakref_type::incWeak(const void* id) +{ + weakref_impl* const impl = static_cast(this); + impl->addWeakRef(id); + const int32_t c = android_atomic_inc(&impl->mWeak); + ALOG_ASSERT(c >= 0, "incWeak called on %p after last weak ref", this); +} + + +void RefBase::weakref_type::decWeak(const void* id) +{ + weakref_impl* const impl = static_cast(this); + impl->removeWeakRef(id); + const int32_t c = android_atomic_dec(&impl->mWeak); + ALOG_ASSERT(c >= 1, "decWeak called on %p too many times", this); + if (c != 1) return; + + if ((impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_STRONG) { + // This is the regular lifetime case. The object is destroyed + // when the last strong reference goes away. Since weakref_impl + // outlive the object, it is not destroyed in the dtor, and + // we'll have to do it here. + if (impl->mStrong == INITIAL_STRONG_VALUE) { + // Special case: we never had a strong reference, so we need to + // destroy the object now. + delete impl->mBase; + } else { + // ALOGV("Freeing refs %p of old RefBase %p\n", this, impl->mBase); + delete impl; + } + } else { + // less common case: lifetime is OBJECT_LIFETIME_{WEAK|FOREVER} + impl->mBase->onLastWeakRef(id); + if ((impl->mFlags&OBJECT_LIFETIME_MASK) == OBJECT_LIFETIME_WEAK) { + // this is the OBJECT_LIFETIME_WEAK case. The last weak-reference + // is gone, we can destroy the object. + delete impl->mBase; + } + } +} + +bool RefBase::weakref_type::attemptIncStrong(const void* id) +{ + incWeak(id); + + weakref_impl* const impl = static_cast(this); + + int32_t curCount = impl->mStrong; + ALOG_ASSERT(curCount >= 0, "attemptIncStrong called on %p after underflow", + this); + while (curCount > 0 && curCount != INITIAL_STRONG_VALUE) { + if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mStrong) == 0) { + break; + } + curCount = impl->mStrong; + } + + if (curCount <= 0 || curCount == INITIAL_STRONG_VALUE) { + bool allow; + if (curCount == INITIAL_STRONG_VALUE) { + // Attempting to acquire first strong reference... this is allowed + // if the object does NOT have a longer lifetime (meaning the + // implementation doesn't need to see this), or if the implementation + // allows it to happen. + allow = (impl->mFlags&OBJECT_LIFETIME_WEAK) != OBJECT_LIFETIME_WEAK + || impl->mBase->onIncStrongAttempted(FIRST_INC_STRONG, id); + } else { + // Attempting to revive the object... this is allowed + // if the object DOES have a longer lifetime (so we can safely + // call the object with only a weak ref) and the implementation + // allows it to happen. + allow = (impl->mFlags&OBJECT_LIFETIME_WEAK) == OBJECT_LIFETIME_WEAK + && impl->mBase->onIncStrongAttempted(FIRST_INC_STRONG, id); + } + if (!allow) { + decWeak(id); + return false; + } + curCount = android_atomic_inc(&impl->mStrong); + + // If the strong reference count has already been incremented by + // someone else, the implementor of onIncStrongAttempted() is holding + // an unneeded reference. So call onLastStrongRef() here to remove it. + // (No, this is not pretty.) Note that we MUST NOT do this if we + // are in fact acquiring the first reference. + if (curCount > 0 && curCount < INITIAL_STRONG_VALUE) { + impl->mBase->onLastStrongRef(id); + } + } + + impl->addStrongRef(id); + +#if PRINT_REFS + ALOGD("attemptIncStrong of %p from %p: cnt=%d\n", this, id, curCount); +#endif + + if (curCount == INITIAL_STRONG_VALUE) { + android_atomic_add(-INITIAL_STRONG_VALUE, &impl->mStrong); + impl->mBase->onFirstRef(); + } + + return true; +} + +bool RefBase::weakref_type::attemptIncWeak(const void* id) +{ + weakref_impl* const impl = static_cast(this); + + int32_t curCount = impl->mWeak; + ALOG_ASSERT(curCount >= 0, "attemptIncWeak called on %p after underflow", + this); + while (curCount > 0) { + if (android_atomic_cmpxchg(curCount, curCount+1, &impl->mWeak) == 0) { + break; + } + curCount = impl->mWeak; + } + + if (curCount > 0) { + impl->addWeakRef(id); + } + + return curCount > 0; +} + +int32_t RefBase::weakref_type::getWeakCount() const +{ + return static_cast(this)->mWeak; +} + +void RefBase::weakref_type::printRefs() const +{ + static_cast(this)->printRefs(); +} + +void RefBase::weakref_type::trackMe(bool enable, bool retain) +{ + static_cast(this)->trackMe(enable, retain); +} + +RefBase::weakref_type* RefBase::createWeak(const void* id) const +{ + mRefs->incWeak(id); + return mRefs; +} + +RefBase::weakref_type* RefBase::getWeakRefs() const +{ + return mRefs; +} + +RefBase::RefBase() + : mRefs(new weakref_impl(this)) +{ +} + +RefBase::~RefBase() +{ + if (mRefs->mStrong == INITIAL_STRONG_VALUE) { + // we never acquired a strong (and/or weak) reference on this object. + delete mRefs; + } else { + // life-time of this object is extended to WEAK or FOREVER, in + // which case weakref_impl doesn't out-live the object and we + // can free it now. + if ((mRefs->mFlags & OBJECT_LIFETIME_MASK) != OBJECT_LIFETIME_STRONG) { + // It's possible that the weak count is not 0 if the object + // re-acquired a weak reference in its destructor + if (mRefs->mWeak == 0) { + delete mRefs; + } + } + } + // for debugging purposes, clear this. + const_cast(mRefs) = NULL; +} + +void RefBase::extendObjectLifetime(int32_t mode) +{ + android_atomic_or(mode, &mRefs->mFlags); +} + +void RefBase::onFirstRef() +{ +} + +void RefBase::onLastStrongRef(const void* /*id*/) +{ +} + +bool RefBase::onIncStrongAttempted(uint32_t flags, const void* id) +{ + return (flags&FIRST_INC_STRONG) ? true : false; +} + +void RefBase::onLastWeakRef(const void* /*id*/) +{ +} + +// --------------------------------------------------------------------------- + +void RefBase::moveReferences(void* dst, void const* src, size_t n, + const ReferenceConverterBase& caster) +{ +#if DEBUG_REFS + const size_t itemSize = caster.getReferenceTypeSize(); + for (size_t i=0 ; i(intptr_t(dst) + i*itemSize); + void const* s = reinterpret_cast(intptr_t(src) + i*itemSize); + RefBase* ref(reinterpret_cast(caster.getReferenceBase(d))); + ref->mRefs->renameStrongRefId(s, d); + ref->mRefs->renameWeakRefId(s, d); + } +#endif +} + +// --------------------------------------------------------------------------- + +TextOutput& printStrongPointer(TextOutput& to, const void* val) +{ + to << "sp<>(" << val << ")"; + return to; +} + +TextOutput& printWeakPointer(TextOutput& to, const void* val) +{ + to << "wp<>(" << val << ")"; + return to; +} + + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/SharedBuffer.cpp android-platform-frameworks-native-21/libs/utils/SharedBuffer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/SharedBuffer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/SharedBuffer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2005 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 +#include + +#include +#include + +// --------------------------------------------------------------------------- + +namespace android { + +SharedBuffer* SharedBuffer::alloc(size_t size) +{ + SharedBuffer* sb = static_cast(malloc(sizeof(SharedBuffer) + size)); + if (sb) { + sb->mRefs = 1; + sb->mSize = size; + } + return sb; +} + + +ssize_t SharedBuffer::dealloc(const SharedBuffer* released) +{ + if (released->mRefs != 0) return -1; // XXX: invalid operation + free(const_cast(released)); + return 0; +} + +SharedBuffer* SharedBuffer::edit() const +{ + if (onlyOwner()) { + return const_cast(this); + } + SharedBuffer* sb = alloc(mSize); + if (sb) { + memcpy(sb->data(), data(), size()); + release(); + } + return sb; +} + +SharedBuffer* SharedBuffer::editResize(size_t newSize) const +{ + if (onlyOwner()) { + SharedBuffer* buf = const_cast(this); + if (buf->mSize == newSize) return buf; + buf = (SharedBuffer*)realloc(buf, sizeof(SharedBuffer) + newSize); + if (buf != NULL) { + buf->mSize = newSize; + return buf; + } + } + SharedBuffer* sb = alloc(newSize); + if (sb) { + const size_t mySize = mSize; + memcpy(sb->data(), data(), newSize < mySize ? newSize : mySize); + release(); + } + return sb; +} + +SharedBuffer* SharedBuffer::attemptEdit() const +{ + if (onlyOwner()) { + return const_cast(this); + } + return 0; +} + +SharedBuffer* SharedBuffer::reset(size_t new_size) const +{ + // cheap-o-reset. + SharedBuffer* sb = alloc(new_size); + if (sb) { + release(); + } + return sb; +} + +void SharedBuffer::acquire() const { + android_atomic_inc(&mRefs); +} + +int32_t SharedBuffer::release(uint32_t flags) const +{ + int32_t prev = 1; + if (onlyOwner() || ((prev = android_atomic_dec(&mRefs)) == 1)) { + mRefs = 0; + if ((flags & eKeepStorage) == 0) { + free(const_cast(this)); + } + } + return prev; +} + + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Static.cpp android-platform-frameworks-native-21/libs/utils/Static.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Static.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Static.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,91 @@ +/* + * Copyright (C) 2008 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. + */ + +// All static variables go here, to control initialization and +// destruction order in the library. + +#include + +#include +#include + +namespace android { + +class LibUtilsFirstStatics +{ +public: + LibUtilsFirstStatics() + { + initialize_string8(); + initialize_string16(); + } + + ~LibUtilsFirstStatics() + { + terminate_string16(); + terminate_string8(); + } +}; + +static LibUtilsFirstStatics gFirstStatics; +int gDarwinCantLoadAllObjects = 1; + +// ------------ Text output streams + +Vector gTextBuffers; + +class LogTextOutput : public BufferedTextOutput +{ +public: + LogTextOutput() : BufferedTextOutput(MULTITHREADED) { } + virtual ~LogTextOutput() { }; + +protected: + virtual status_t writeLines(const struct iovec& vec, size_t N) + { + //android_writevLog(&vec, N); <-- this is now a no-op + if (N != 1) ALOGI("WARNING: writeLines N=%zu\n", N); + ALOGI("%.*s", (int)vec.iov_len, (const char*) vec.iov_base); + return NO_ERROR; + } +}; + +class FdTextOutput : public BufferedTextOutput +{ +public: + FdTextOutput(int fd) : BufferedTextOutput(MULTITHREADED), mFD(fd) { } + virtual ~FdTextOutput() { }; + +protected: + virtual status_t writeLines(const struct iovec& vec, size_t N) + { + writev(mFD, &vec, N); + return NO_ERROR; + } + +private: + int mFD; +}; + +static LogTextOutput gLogTextOutput; +static FdTextOutput gStdoutTextOutput(STDOUT_FILENO); +static FdTextOutput gStderrTextOutput(STDERR_FILENO); + +TextOutput& alog(gLogTextOutput); +TextOutput& aout(gStdoutTextOutput); +TextOutput& aerr(gStderrTextOutput); + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/StopWatch.cpp android-platform-frameworks-native-21/libs/utils/StopWatch.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/StopWatch.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/StopWatch.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,88 @@ +/* + * Copyright (C) 2005 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. + */ + +#define LOG_TAG "StopWatch" + +#include +#include +#include + +/* for PRId64 */ +#define __STDC_FORMAT_MACROS 1 +#include + +#include +#include +#include + +/*****************************************************************************/ + +namespace android { + + +StopWatch::StopWatch(const char *name, int clock, uint32_t flags) + : mName(name), mClock(clock), mFlags(flags) +{ + reset(); +} + +StopWatch::~StopWatch() +{ + nsecs_t elapsed = elapsedTime(); + const int n = mNumLaps; + ALOGD("StopWatch %s (us): %" PRId64 " ", mName, ns2us(elapsed)); + for (int i=0 ; i= 8) { + elapsed = 0; + } else { + const int n = mNumLaps; + mLaps[n].soFar = elapsed; + mLaps[n].thisLap = n ? (elapsed - mLaps[n-1].soFar) : elapsed; + mNumLaps = n+1; + } + return elapsed; +} + +nsecs_t StopWatch::elapsedTime() const +{ + return systemTime(mClock) - mStartTime; +} + +void StopWatch::reset() +{ + mNumLaps = 0; + mStartTime = systemTime(mClock); +} + + +/*****************************************************************************/ + +}; // namespace android + diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/String16.cpp android-platform-frameworks-native-21/libs/utils/String16.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/String16.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/String16.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,418 @@ +/* + * Copyright (C) 2005 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 + +#include +#include +#include +#include +#include +#include + +#include + +#include +#include +#include + + +namespace android { + +static SharedBuffer* gEmptyStringBuf = NULL; +static char16_t* gEmptyString = NULL; + +static inline char16_t* getEmptyString() +{ + gEmptyStringBuf->acquire(); + return gEmptyString; +} + +void initialize_string16() +{ + SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)); + char16_t* str = (char16_t*)buf->data(); + *str = 0; + gEmptyStringBuf = buf; + gEmptyString = str; +} + +void terminate_string16() +{ + SharedBuffer::bufferFromData(gEmptyString)->release(); + gEmptyStringBuf = NULL; + gEmptyString = NULL; +} + +// --------------------------------------------------------------------------- + +static char16_t* allocFromUTF8(const char* u8str, size_t u8len) +{ + if (u8len == 0) return getEmptyString(); + + const uint8_t* u8cur = (const uint8_t*) u8str; + + const ssize_t u16len = utf8_to_utf16_length(u8cur, u8len); + if (u16len < 0) { + return getEmptyString(); + } + + const uint8_t* const u8end = u8cur + u8len; + + SharedBuffer* buf = SharedBuffer::alloc(sizeof(char16_t)*(u16len+1)); + if (buf) { + u8cur = (const uint8_t*) u8str; + char16_t* u16str = (char16_t*)buf->data(); + + utf8_to_utf16(u8cur, u8len, u16str); + + //printf("Created UTF-16 string from UTF-8 \"%s\":", in); + //printHexData(1, str, buf->size(), 16, 1); + //printf("\n"); + + return u16str; + } + + return getEmptyString(); +} + +// --------------------------------------------------------------------------- + +String16::String16() + : mString(getEmptyString()) +{ +} + +String16::String16(const String16& o) + : mString(o.mString) +{ + SharedBuffer::bufferFromData(mString)->acquire(); +} + +String16::String16(const String16& o, size_t len, size_t begin) + : mString(getEmptyString()) +{ + setTo(o, len, begin); +} + +String16::String16(const char16_t* o) +{ + size_t len = strlen16(o); + SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t)); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + strcpy16(str, o); + mString = str; + return; + } + + mString = getEmptyString(); +} + +String16::String16(const char16_t* o, size_t len) +{ + SharedBuffer* buf = SharedBuffer::alloc((len+1)*sizeof(char16_t)); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + memcpy(str, o, len*sizeof(char16_t)); + str[len] = 0; + mString = str; + return; + } + + mString = getEmptyString(); +} + +String16::String16(const String8& o) + : mString(allocFromUTF8(o.string(), o.size())) +{ +} + +String16::String16(const char* o) + : mString(allocFromUTF8(o, strlen(o))) +{ +} + +String16::String16(const char* o, size_t len) + : mString(allocFromUTF8(o, len)) +{ +} + +String16::~String16() +{ + SharedBuffer::bufferFromData(mString)->release(); +} + +void String16::setTo(const String16& other) +{ + SharedBuffer::bufferFromData(other.mString)->acquire(); + SharedBuffer::bufferFromData(mString)->release(); + mString = other.mString; +} + +status_t String16::setTo(const String16& other, size_t len, size_t begin) +{ + const size_t N = other.size(); + if (begin >= N) { + SharedBuffer::bufferFromData(mString)->release(); + mString = getEmptyString(); + return NO_ERROR; + } + if ((begin+len) > N) len = N-begin; + if (begin == 0 && len == N) { + setTo(other); + return NO_ERROR; + } + + if (&other == this) { + LOG_ALWAYS_FATAL("Not implemented"); + } + + return setTo(other.string()+begin, len); +} + +status_t String16::setTo(const char16_t* other) +{ + return setTo(other, strlen16(other)); +} + +status_t String16::setTo(const char16_t* other, size_t len) +{ + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize((len+1)*sizeof(char16_t)); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + memmove(str, other, len*sizeof(char16_t)); + str[len] = 0; + mString = str; + return NO_ERROR; + } + return NO_MEMORY; +} + +status_t String16::append(const String16& other) +{ + const size_t myLen = size(); + const size_t otherLen = other.size(); + if (myLen == 0) { + setTo(other); + return NO_ERROR; + } else if (otherLen == 0) { + return NO_ERROR; + } + + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize((myLen+otherLen+1)*sizeof(char16_t)); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + memcpy(str+myLen, other, (otherLen+1)*sizeof(char16_t)); + mString = str; + return NO_ERROR; + } + return NO_MEMORY; +} + +status_t String16::append(const char16_t* chrs, size_t otherLen) +{ + const size_t myLen = size(); + if (myLen == 0) { + setTo(chrs, otherLen); + return NO_ERROR; + } else if (otherLen == 0) { + return NO_ERROR; + } + + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize((myLen+otherLen+1)*sizeof(char16_t)); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + memcpy(str+myLen, chrs, otherLen*sizeof(char16_t)); + str[myLen+otherLen] = 0; + mString = str; + return NO_ERROR; + } + return NO_MEMORY; +} + +status_t String16::insert(size_t pos, const char16_t* chrs) +{ + return insert(pos, chrs, strlen16(chrs)); +} + +status_t String16::insert(size_t pos, const char16_t* chrs, size_t len) +{ + const size_t myLen = size(); + if (myLen == 0) { + return setTo(chrs, len); + return NO_ERROR; + } else if (len == 0) { + return NO_ERROR; + } + + if (pos > myLen) pos = myLen; + + #if 0 + printf("Insert in to %s: pos=%d, len=%d, myLen=%d, chrs=%s\n", + String8(*this).string(), pos, + len, myLen, String8(chrs, len).string()); + #endif + + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize((myLen+len+1)*sizeof(char16_t)); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + if (pos < myLen) { + memmove(str+pos+len, str+pos, (myLen-pos)*sizeof(char16_t)); + } + memcpy(str+pos, chrs, len*sizeof(char16_t)); + str[myLen+len] = 0; + mString = str; + #if 0 + printf("Result (%d chrs): %s\n", size(), String8(*this).string()); + #endif + return NO_ERROR; + } + return NO_MEMORY; +} + +ssize_t String16::findFirst(char16_t c) const +{ + const char16_t* str = string(); + const char16_t* p = str; + const char16_t* e = p + size(); + while (p < e) { + if (*p == c) { + return p-str; + } + p++; + } + return -1; +} + +ssize_t String16::findLast(char16_t c) const +{ + const char16_t* str = string(); + const char16_t* p = str; + const char16_t* e = p + size(); + while (p < e) { + e--; + if (*e == c) { + return e-str; + } + } + return -1; +} + +bool String16::startsWith(const String16& prefix) const +{ + const size_t ps = prefix.size(); + if (ps > size()) return false; + return strzcmp16(mString, ps, prefix.string(), ps) == 0; +} + +bool String16::startsWith(const char16_t* prefix) const +{ + const size_t ps = strlen16(prefix); + if (ps > size()) return false; + return strncmp16(mString, prefix, ps) == 0; +} + +status_t String16::makeLower() +{ + const size_t N = size(); + const char16_t* str = string(); + char16_t* edit = NULL; + for (size_t i=0; i= 'A' && v <= 'Z') { + if (!edit) { + SharedBuffer* buf = SharedBuffer::bufferFromData(mString)->edit(); + if (!buf) { + return NO_MEMORY; + } + edit = (char16_t*)buf->data(); + mString = str = edit; + } + edit[i] = tolower((char)v); + } + } + return NO_ERROR; +} + +status_t String16::replaceAll(char16_t replaceThis, char16_t withThis) +{ + const size_t N = size(); + const char16_t* str = string(); + char16_t* edit = NULL; + for (size_t i=0; iedit(); + if (!buf) { + return NO_MEMORY; + } + edit = (char16_t*)buf->data(); + mString = str = edit; + } + edit[i] = withThis; + } + } + return NO_ERROR; +} + +status_t String16::remove(size_t len, size_t begin) +{ + const size_t N = size(); + if (begin >= N) { + SharedBuffer::bufferFromData(mString)->release(); + mString = getEmptyString(); + return NO_ERROR; + } + if ((begin+len) > N) len = N-begin; + if (begin == 0 && len == N) { + return NO_ERROR; + } + + if (begin > 0) { + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize((N+1)*sizeof(char16_t)); + if (!buf) { + return NO_MEMORY; + } + char16_t* str = (char16_t*)buf->data(); + memmove(str, str+begin, (N-begin+1)*sizeof(char16_t)); + mString = str; + } + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize((len+1)*sizeof(char16_t)); + if (buf) { + char16_t* str = (char16_t*)buf->data(); + str[len] = 0; + mString = str; + return NO_ERROR; + } + return NO_MEMORY; +} + +TextOutput& operator<<(TextOutput& to, const String16& val) +{ + to << String8(val).string(); + return to; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/String8.cpp android-platform-frameworks-native-21/libs/utils/String8.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/String8.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/String8.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,634 @@ +/* + * Copyright (C) 2005 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 + +#include +#include +#include +#include +#include +#include + +#include + +#include + +/* + * Functions outside android is below the namespace android, since they use + * functions and constants in android namespace. + */ + +// --------------------------------------------------------------------------- + +namespace android { + +// Separator used by resource paths. This is not platform dependent contrary +// to OS_PATH_SEPARATOR. +#define RES_PATH_SEPARATOR '/' + +static SharedBuffer* gEmptyStringBuf = NULL; +static char* gEmptyString = NULL; + +extern int gDarwinCantLoadAllObjects; +int gDarwinIsReallyAnnoying; + +static inline char* getEmptyString() +{ + gEmptyStringBuf->acquire(); + return gEmptyString; +} + +void initialize_string8() +{ + // HACK: This dummy dependency forces linking libutils Static.cpp, + // which is needed to initialize String8/String16 classes. + // These variables are named for Darwin, but are needed elsewhere too, + // including static linking on any platform. + gDarwinIsReallyAnnoying = gDarwinCantLoadAllObjects; + + SharedBuffer* buf = SharedBuffer::alloc(1); + char* str = (char*)buf->data(); + *str = 0; + gEmptyStringBuf = buf; + gEmptyString = str; +} + +void terminate_string8() +{ + SharedBuffer::bufferFromData(gEmptyString)->release(); + gEmptyStringBuf = NULL; + gEmptyString = NULL; +} + +// --------------------------------------------------------------------------- + +static char* allocFromUTF8(const char* in, size_t len) +{ + if (len > 0) { + SharedBuffer* buf = SharedBuffer::alloc(len+1); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); + if (buf) { + char* str = (char*)buf->data(); + memcpy(str, in, len); + str[len] = 0; + return str; + } + return NULL; + } + + return getEmptyString(); +} + +static char* allocFromUTF16(const char16_t* in, size_t len) +{ + if (len == 0) return getEmptyString(); + + const ssize_t bytes = utf16_to_utf8_length(in, len); + if (bytes < 0) { + return getEmptyString(); + } + + SharedBuffer* buf = SharedBuffer::alloc(bytes+1); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); + if (!buf) { + return getEmptyString(); + } + + char* str = (char*)buf->data(); + utf16_to_utf8(in, len, str); + return str; +} + +static char* allocFromUTF32(const char32_t* in, size_t len) +{ + if (len == 0) { + return getEmptyString(); + } + + const ssize_t bytes = utf32_to_utf8_length(in, len); + if (bytes < 0) { + return getEmptyString(); + } + + SharedBuffer* buf = SharedBuffer::alloc(bytes+1); + ALOG_ASSERT(buf, "Unable to allocate shared buffer"); + if (!buf) { + return getEmptyString(); + } + + char* str = (char*) buf->data(); + utf32_to_utf8(in, len, str); + + return str; +} + +// --------------------------------------------------------------------------- + +String8::String8() + : mString(getEmptyString()) +{ +} + +String8::String8(const String8& o) + : mString(o.mString) +{ + SharedBuffer::bufferFromData(mString)->acquire(); +} + +String8::String8(const char* o) + : mString(allocFromUTF8(o, strlen(o))) +{ + if (mString == NULL) { + mString = getEmptyString(); + } +} + +String8::String8(const char* o, size_t len) + : mString(allocFromUTF8(o, len)) +{ + if (mString == NULL) { + mString = getEmptyString(); + } +} + +String8::String8(const String16& o) + : mString(allocFromUTF16(o.string(), o.size())) +{ +} + +String8::String8(const char16_t* o) + : mString(allocFromUTF16(o, strlen16(o))) +{ +} + +String8::String8(const char16_t* o, size_t len) + : mString(allocFromUTF16(o, len)) +{ +} + +String8::String8(const char32_t* o) + : mString(allocFromUTF32(o, strlen32(o))) +{ +} + +String8::String8(const char32_t* o, size_t len) + : mString(allocFromUTF32(o, len)) +{ +} + +String8::~String8() +{ + SharedBuffer::bufferFromData(mString)->release(); +} + +String8 String8::format(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + + String8 result(formatV(fmt, args)); + + va_end(args); + return result; +} + +String8 String8::formatV(const char* fmt, va_list args) +{ + String8 result; + result.appendFormatV(fmt, args); + return result; +} + +void String8::clear() { + SharedBuffer::bufferFromData(mString)->release(); + mString = getEmptyString(); +} + +void String8::setTo(const String8& other) +{ + SharedBuffer::bufferFromData(other.mString)->acquire(); + SharedBuffer::bufferFromData(mString)->release(); + mString = other.mString; +} + +status_t String8::setTo(const char* other) +{ + const char *newString = allocFromUTF8(other, strlen(other)); + SharedBuffer::bufferFromData(mString)->release(); + mString = newString; + if (mString) return NO_ERROR; + + mString = getEmptyString(); + return NO_MEMORY; +} + +status_t String8::setTo(const char* other, size_t len) +{ + const char *newString = allocFromUTF8(other, len); + SharedBuffer::bufferFromData(mString)->release(); + mString = newString; + if (mString) return NO_ERROR; + + mString = getEmptyString(); + return NO_MEMORY; +} + +status_t String8::setTo(const char16_t* other, size_t len) +{ + const char *newString = allocFromUTF16(other, len); + SharedBuffer::bufferFromData(mString)->release(); + mString = newString; + if (mString) return NO_ERROR; + + mString = getEmptyString(); + return NO_MEMORY; +} + +status_t String8::setTo(const char32_t* other, size_t len) +{ + const char *newString = allocFromUTF32(other, len); + SharedBuffer::bufferFromData(mString)->release(); + mString = newString; + if (mString) return NO_ERROR; + + mString = getEmptyString(); + return NO_MEMORY; +} + +status_t String8::append(const String8& other) +{ + const size_t otherLen = other.bytes(); + if (bytes() == 0) { + setTo(other); + return NO_ERROR; + } else if (otherLen == 0) { + return NO_ERROR; + } + + return real_append(other.string(), otherLen); +} + +status_t String8::append(const char* other) +{ + return append(other, strlen(other)); +} + +status_t String8::append(const char* other, size_t otherLen) +{ + if (bytes() == 0) { + return setTo(other, otherLen); + } else if (otherLen == 0) { + return NO_ERROR; + } + + return real_append(other, otherLen); +} + +status_t String8::appendFormat(const char* fmt, ...) +{ + va_list args; + va_start(args, fmt); + + status_t result = appendFormatV(fmt, args); + + va_end(args); + return result; +} + +status_t String8::appendFormatV(const char* fmt, va_list args) +{ + int result = NO_ERROR; + int n = vsnprintf(NULL, 0, fmt, args); + if (n != 0) { + size_t oldLength = length(); + char* buf = lockBuffer(oldLength + n); + if (buf) { + vsnprintf(buf + oldLength, n + 1, fmt, args); + } else { + result = NO_MEMORY; + } + } + return result; +} + +status_t String8::real_append(const char* other, size_t otherLen) +{ + const size_t myLen = bytes(); + + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize(myLen+otherLen+1); + if (buf) { + char* str = (char*)buf->data(); + mString = str; + str += myLen; + memcpy(str, other, otherLen); + str[otherLen] = '\0'; + return NO_ERROR; + } + return NO_MEMORY; +} + +char* String8::lockBuffer(size_t size) +{ + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize(size+1); + if (buf) { + char* str = (char*)buf->data(); + mString = str; + return str; + } + return NULL; +} + +void String8::unlockBuffer() +{ + unlockBuffer(strlen(mString)); +} + +status_t String8::unlockBuffer(size_t size) +{ + if (size != this->size()) { + SharedBuffer* buf = SharedBuffer::bufferFromData(mString) + ->editResize(size+1); + if (! buf) { + return NO_MEMORY; + } + + char* str = (char*)buf->data(); + str[size] = 0; + mString = str; + } + + return NO_ERROR; +} + +ssize_t String8::find(const char* other, size_t start) const +{ + size_t len = size(); + if (start >= len) { + return -1; + } + const char* s = mString+start; + const char* p = strstr(s, other); + return p ? p-mString : -1; +} + +void String8::toLower() +{ + toLower(0, size()); +} + +void String8::toLower(size_t start, size_t length) +{ + const size_t len = size(); + if (start >= len) { + return; + } + if (start+length > len) { + length = len-start; + } + char* buf = lockBuffer(len); + buf += start; + while (length > 0) { + *buf = tolower(*buf); + buf++; + length--; + } + unlockBuffer(len); +} + +void String8::toUpper() +{ + toUpper(0, size()); +} + +void String8::toUpper(size_t start, size_t length) +{ + const size_t len = size(); + if (start >= len) { + return; + } + if (start+length > len) { + length = len-start; + } + char* buf = lockBuffer(len); + buf += start; + while (length > 0) { + *buf = toupper(*buf); + buf++; + length--; + } + unlockBuffer(len); +} + +size_t String8::getUtf32Length() const +{ + return utf8_to_utf32_length(mString, length()); +} + +int32_t String8::getUtf32At(size_t index, size_t *next_index) const +{ + return utf32_from_utf8_at(mString, length(), index, next_index); +} + +void String8::getUtf32(char32_t* dst) const +{ + utf8_to_utf32(mString, length(), dst); +} + +TextOutput& operator<<(TextOutput& to, const String8& val) +{ + to << val.string(); + return to; +} + +// --------------------------------------------------------------------------- +// Path functions + +void String8::setPathName(const char* name) +{ + setPathName(name, strlen(name)); +} + +void String8::setPathName(const char* name, size_t len) +{ + char* buf = lockBuffer(len); + + memcpy(buf, name, len); + + // remove trailing path separator, if present + if (len > 0 && buf[len-1] == OS_PATH_SEPARATOR) + len--; + + buf[len] = '\0'; + + unlockBuffer(len); +} + +String8 String8::getPathLeaf(void) const +{ + const char* cp; + const char*const buf = mString; + + cp = strrchr(buf, OS_PATH_SEPARATOR); + if (cp == NULL) + return String8(*this); + else + return String8(cp+1); +} + +String8 String8::getPathDir(void) const +{ + const char* cp; + const char*const str = mString; + + cp = strrchr(str, OS_PATH_SEPARATOR); + if (cp == NULL) + return String8(""); + else + return String8(str, cp - str); +} + +String8 String8::walkPath(String8* outRemains) const +{ + const char* cp; + const char*const str = mString; + const char* buf = str; + + cp = strchr(buf, OS_PATH_SEPARATOR); + if (cp == buf) { + // don't include a leading '/'. + buf = buf+1; + cp = strchr(buf, OS_PATH_SEPARATOR); + } + + if (cp == NULL) { + String8 res = buf != str ? String8(buf) : *this; + if (outRemains) *outRemains = String8(""); + return res; + } + + String8 res(buf, cp-buf); + if (outRemains) *outRemains = String8(cp+1); + return res; +} + +/* + * Helper function for finding the start of an extension in a pathname. + * + * Returns a pointer inside mString, or NULL if no extension was found. + */ +char* String8::find_extension(void) const +{ + const char* lastSlash; + const char* lastDot; + int extLen; + const char* const str = mString; + + // only look at the filename + lastSlash = strrchr(str, OS_PATH_SEPARATOR); + if (lastSlash == NULL) + lastSlash = str; + else + lastSlash++; + + // find the last dot + lastDot = strrchr(lastSlash, '.'); + if (lastDot == NULL) + return NULL; + + // looks good, ship it + return const_cast(lastDot); +} + +String8 String8::getPathExtension(void) const +{ + char* ext; + + ext = find_extension(); + if (ext != NULL) + return String8(ext); + else + return String8(""); +} + +String8 String8::getBasePath(void) const +{ + char* ext; + const char* const str = mString; + + ext = find_extension(); + if (ext == NULL) + return String8(*this); + else + return String8(str, ext - str); +} + +String8& String8::appendPath(const char* name) +{ + // TODO: The test below will fail for Win32 paths. Fix later or ignore. + if (name[0] != OS_PATH_SEPARATOR) { + if (*name == '\0') { + // nothing to do + return *this; + } + + size_t len = length(); + if (len == 0) { + // no existing filename, just use the new one + setPathName(name); + return *this; + } + + // make room for oldPath + '/' + newPath + int newlen = strlen(name); + + char* buf = lockBuffer(len+1+newlen); + + // insert a '/' if needed + if (buf[len-1] != OS_PATH_SEPARATOR) + buf[len++] = OS_PATH_SEPARATOR; + + memcpy(buf+len, name, newlen+1); + len += newlen; + + unlockBuffer(len); + + return *this; + } else { + setPathName(name); + return *this; + } +} + +String8& String8::convertToResPath() +{ +#if OS_PATH_SEPARATOR != RES_PATH_SEPARATOR + size_t len = length(); + if (len > 0) { + char * buf = lockBuffer(len); + for (char * end = buf + len; buf < end; ++buf) { + if (*buf == OS_PATH_SEPARATOR) + *buf = RES_PATH_SEPARATOR; + } + unlockBuffer(len); + } +#endif + return *this; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/StringArray.cpp android-platform-frameworks-native-21/libs/utils/StringArray.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/StringArray.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/StringArray.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,113 @@ +/* + * Copyright (C) 2009 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. + */ + +// +// Sortable array of strings. STL-ish, but STL-free. +// + +#include +#include + +#include + +namespace android { + +// +// An expanding array of strings. Add, get, sort, delete. +// +StringArray::StringArray() + : mMax(0), mCurrent(0), mArray(NULL) +{ +} + +StringArray:: ~StringArray() { + for (int i = 0; i < mCurrent; i++) + delete[] mArray[i]; + delete[] mArray; +} + +// +// Add a string. A copy of the string is made. +// +bool StringArray::push_back(const char* str) { + if (mCurrent >= mMax) { + char** tmp; + + if (mMax == 0) + mMax = 16; // initial storage + else + mMax *= 2; + + tmp = new char*[mMax]; + if (tmp == NULL) + return false; + + memcpy(tmp, mArray, mCurrent * sizeof(char*)); + delete[] mArray; + mArray = tmp; + } + + int len = strlen(str); + mArray[mCurrent] = new char[len+1]; + memcpy(mArray[mCurrent], str, len+1); + mCurrent++; + + return true; +} + +// +// Delete an entry. +// +void StringArray::erase(int idx) { + if (idx < 0 || idx >= mCurrent) + return; + delete[] mArray[idx]; + if (idx < mCurrent-1) { + memmove(&mArray[idx], &mArray[idx+1], + (mCurrent-1 - idx) * sizeof(char*)); + } + mCurrent--; +} + +// +// Sort the array. +// +void StringArray::sort(int (*compare)(const void*, const void*)) { + qsort(mArray, mCurrent, sizeof(char*), compare); +} + +// +// Pass this to the sort routine to do an ascending alphabetical sort. +// +int StringArray::cmpAscendingAlpha(const void* pstr1, const void* pstr2) { + return strcmp(*(const char**)pstr1, *(const char**)pstr2); +} + +// +// Set entry N to specified string. +// [should use operator[] here] +// +void StringArray::setEntry(int idx, const char* str) { + if (idx < 0 || idx >= mCurrent) + return; + delete[] mArray[idx]; + int len = strlen(str); + mArray[idx] = new char[len+1]; + memcpy(mArray[idx], str, len+1); +} + + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/SystemClock.cpp android-platform-frameworks-native-21/libs/utils/SystemClock.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/SystemClock.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/SystemClock.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,139 @@ +/* + * Copyright (C) 2008 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. + */ + + +/* + * System clock functions. + */ + +#ifdef HAVE_ANDROID_OS +#include +#include +#include +#include +#endif + +#include +#include +#include +#include +#include + +#include +#include + +#define LOG_TAG "SystemClock" +#include "utils/Log.h" + +namespace android { + +/* + * Set the current time. This only works when running as root. + */ +int setCurrentTimeMillis(int64_t millis) +{ +#if WIN32 + // not implemented + return -1; +#else + struct timeval tv; +#ifdef HAVE_ANDROID_OS + struct timespec ts; + int fd; + int res; +#endif + int ret = 0; + + if (millis <= 0 || millis / 1000LL >= INT_MAX) { + return -1; + } + + tv.tv_sec = (time_t) (millis / 1000LL); + tv.tv_usec = (suseconds_t) ((millis % 1000LL) * 1000LL); + + ALOGD("Setting time of day to sec=%d\n", (int) tv.tv_sec); + +#ifdef HAVE_ANDROID_OS + fd = open("/dev/alarm", O_RDWR); + if(fd < 0) { + ALOGW("Unable to open alarm driver: %s\n", strerror(errno)); + return -1; + } + ts.tv_sec = tv.tv_sec; + ts.tv_nsec = tv.tv_usec * 1000; + res = ioctl(fd, ANDROID_ALARM_SET_RTC, &ts); + if(res < 0) { + ALOGW("Unable to set rtc to %ld: %s\n", tv.tv_sec, strerror(errno)); + ret = -1; + } + close(fd); +#else + if (settimeofday(&tv, NULL) != 0) { + ALOGW("Unable to set clock to %d.%d: %s\n", + (int) tv.tv_sec, (int) tv.tv_usec, strerror(errno)); + ret = -1; + } +#endif + + return ret; +#endif // WIN32 +} + +/* + * native public static long uptimeMillis(); + */ +int64_t uptimeMillis() +{ + int64_t when = systemTime(SYSTEM_TIME_MONOTONIC); + return (int64_t) nanoseconds_to_milliseconds(when); +} + +/* + * native public static long elapsedRealtime(); + */ +int64_t elapsedRealtime() +{ +#ifdef HAVE_ANDROID_OS + static int s_fd = -1; + + if (s_fd == -1) { + int fd = open("/dev/alarm", O_RDONLY); + if (android_atomic_cmpxchg(-1, fd, &s_fd)) { + close(fd); + } + } + + struct timespec ts; + int result = ioctl(s_fd, + ANDROID_ALARM_GET_TIME(ANDROID_ALARM_ELAPSED_REALTIME), &ts); + + if (result == 0) { + int64_t when = seconds_to_nanoseconds(ts.tv_sec) + ts.tv_nsec; + return (int64_t) nanoseconds_to_milliseconds(when); + } else { + // XXX: there was an error, probably because the driver didn't + // exist ... this should return + // a real error, like an exception! + int64_t when = systemTime(SYSTEM_TIME_MONOTONIC); + return (int64_t) nanoseconds_to_milliseconds(when); + } +#else + int64_t when = systemTime(SYSTEM_TIME_MONOTONIC); + return (int64_t) nanoseconds_to_milliseconds(when); +#endif +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Android.mk android-platform-frameworks-native-21/libs/utils/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,33 @@ +# Build the unit tests. +LOCAL_PATH := $(call my-dir) +include $(CLEAR_VARS) + +# Build the unit tests. +test_src_files := \ + BasicHashtable_test.cpp \ + BlobCache_test.cpp \ + Looper_test.cpp \ + String8_test.cpp \ + Unicode_test.cpp \ + Vector_test.cpp \ + ZipFileRO_test.cpp + +shared_libraries := \ + libz \ + liblog \ + libcutils \ + libutils \ + libstlport + +static_libraries := \ + libgtest \ + libgtest_main + +$(foreach file,$(test_src_files), \ + $(eval include $(CLEAR_VARS)) \ + $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ + $(eval LOCAL_STATIC_LIBRARIES := $(static_libraries)) \ + $(eval LOCAL_SRC_FILES := $(file)) \ + $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ + $(eval include $(BUILD_NATIVE_TEST)) \ +) diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/BasicHashtable_test.cpp android-platform-frameworks-native-21/libs/utils/tests/BasicHashtable_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/BasicHashtable_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/BasicHashtable_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,577 @@ +/* + * 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. + */ + +#define LOG_TAG "BasicHashtable_test" + +#include +#include +#include +#include + +namespace android { + +typedef int SimpleKey; +typedef int SimpleValue; +typedef key_value_pair_t SimpleEntry; +typedef BasicHashtable SimpleHashtable; + +struct ComplexKey { + int k; + + explicit ComplexKey(int k) : k(k) { + instanceCount += 1; + } + + ComplexKey(const ComplexKey& other) : k(other.k) { + instanceCount += 1; + } + + ~ComplexKey() { + instanceCount -= 1; + } + + bool operator ==(const ComplexKey& other) const { + return k == other.k; + } + + bool operator !=(const ComplexKey& other) const { + return k != other.k; + } + + static ssize_t instanceCount; +}; + +ssize_t ComplexKey::instanceCount = 0; + +template<> inline hash_t hash_type(const ComplexKey& value) { + return hash_type(value.k); +} + +struct ComplexValue { + int v; + + explicit ComplexValue(int v) : v(v) { + instanceCount += 1; + } + + ComplexValue(const ComplexValue& other) : v(other.v) { + instanceCount += 1; + } + + ~ComplexValue() { + instanceCount -= 1; + } + + static ssize_t instanceCount; +}; + +ssize_t ComplexValue::instanceCount = 0; + +typedef key_value_pair_t ComplexEntry; +typedef BasicHashtable ComplexHashtable; + +class BasicHashtableTest : public testing::Test { +protected: + virtual void SetUp() { + ComplexKey::instanceCount = 0; + ComplexValue::instanceCount = 0; + } + + virtual void TearDown() { + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + } + + void assertInstanceCount(ssize_t keys, ssize_t values) { + if (keys != ComplexKey::instanceCount || values != ComplexValue::instanceCount) { + FAIL() << "Expected " << keys << " keys and " << values << " values " + "but there were actually " << ComplexKey::instanceCount << " keys and " + << ComplexValue::instanceCount << " values"; + } + } + +public: + template + static void cookieAt(const BasicHashtable& h, size_t index, + bool* collision, bool* present, hash_t* hash) { + uint32_t cookie = h.cookieAt(index); + *collision = cookie & BasicHashtable::Bucket::COLLISION; + *present = cookie & BasicHashtable::Bucket::PRESENT; + *hash = cookie & BasicHashtable::Bucket::HASH_MASK; + } + + template + static const void* getBuckets(const BasicHashtable& h) { + return h.mBuckets; + } +}; + +template +static size_t add(BasicHashtable >& h, + const TKey& key, const TValue& value) { + return h.add(hash_type(key), key_value_pair_t(key, value)); +} + +template +static ssize_t find(BasicHashtable >& h, + ssize_t index, const TKey& key) { + return h.find(index, hash_type(key), key); +} + +template +static bool remove(BasicHashtable >& h, + const TKey& key) { + ssize_t index = find(h, -1, key); + if (index >= 0) { + h.removeAt(index); + return true; + } + return false; +} + +template +static void getKeyValue(const TEntry& entry, int* key, int* value); + +template <> void getKeyValue(const SimpleEntry& entry, int* key, int* value) { + *key = entry.key; + *value = entry.value; +} + +template <> void getKeyValue(const ComplexEntry& entry, int* key, int* value) { + *key = entry.key.k; + *value = entry.value.v; +} + +template +static void dump(BasicHashtable >& h) { + ALOGD("hashtable %p, size=%u, capacity=%u, bucketCount=%u", + &h, h.size(), h.capacity(), h.bucketCount()); + for (size_t i = 0; i < h.bucketCount(); i++) { + bool collision, present; + hash_t hash; + BasicHashtableTest::cookieAt(h, i, &collision, &present, &hash); + if (present) { + int key, value; + getKeyValue(h.entryAt(i), &key, &value); + ALOGD(" [%3u] = collision=%d, present=%d, hash=0x%08x, key=%3d, value=%3d, " + "hash_type(key)=0x%08x", + i, collision, present, hash, key, value, hash_type(key)); + } else { + ALOGD(" [%3u] = collision=%d, present=%d", + i, collision, present); + } + } +} + +TEST_F(BasicHashtableTest, DefaultConstructor_WithDefaultProperties) { + SimpleHashtable h; + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Constructor_WithNonUnityLoadFactor) { + SimpleHashtable h(52, 0.8f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(77U, h.capacity()); + EXPECT_EQ(97U, h.bucketCount()); + EXPECT_EQ(0.8f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Constructor_WithUnityLoadFactorAndExactCapacity) { + SimpleHashtable h(46, 1.0f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(46U, h.capacity()); // must be one less than bucketCount because loadFactor == 1.0f + EXPECT_EQ(47U, h.bucketCount()); + EXPECT_EQ(1.0f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Constructor_WithUnityLoadFactorAndInexactCapacity) { + SimpleHashtable h(42, 1.0f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(46U, h.capacity()); // must be one less than bucketCount because loadFactor == 1.0f + EXPECT_EQ(47U, h.bucketCount()); + EXPECT_EQ(1.0f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, FindAddFindRemoveFind_OneEntry) { + SimpleHashtable h; + ssize_t index = find(h, -1, 8); + ASSERT_EQ(-1, index); + + index = add(h, 8, 1); + ASSERT_EQ(1U, h.size()); + + ASSERT_EQ(index, find(h, -1, 8)); + ASSERT_EQ(8, h.entryAt(index).key); + ASSERT_EQ(1, h.entryAt(index).value); + + index = find(h, index, 8); + ASSERT_EQ(-1, index); + + ASSERT_TRUE(remove(h, 8)); + ASSERT_EQ(0U, h.size()); + + index = find(h, -1, 8); + ASSERT_EQ(-1, index); +} + +TEST_F(BasicHashtableTest, FindAddFindRemoveFind_MultipleEntryWithUniqueKey) { + const size_t N = 11; + + SimpleHashtable h; + for (size_t i = 0; i < N; i++) { + ssize_t index = find(h, -1, int(i)); + ASSERT_EQ(-1, index); + + index = add(h, int(i), int(i * 10)); + ASSERT_EQ(i + 1, h.size()); + + ASSERT_EQ(index, find(h, -1, int(i))); + ASSERT_EQ(int(i), h.entryAt(index).key); + ASSERT_EQ(int(i * 10), h.entryAt(index).value); + + index = find(h, index, int(i)); + ASSERT_EQ(-1, index); + } + + for (size_t i = N; --i > 0; ) { + ASSERT_TRUE(remove(h, int(i))) << "i = " << i; + ASSERT_EQ(i, h.size()); + + ssize_t index = find(h, -1, int(i)); + ASSERT_EQ(-1, index); + } +} + +TEST_F(BasicHashtableTest, FindAddFindRemoveFind_MultipleEntryWithDuplicateKey) { + const size_t N = 11; + const int K = 1; + + SimpleHashtable h; + for (size_t i = 0; i < N; i++) { + ssize_t index = find(h, -1, K); + if (i == 0) { + ASSERT_EQ(-1, index); + } else { + ASSERT_NE(-1, index); + } + + add(h, K, int(i)); + ASSERT_EQ(i + 1, h.size()); + + index = -1; + int values = 0; + for (size_t j = 0; j <= i; j++) { + index = find(h, index, K); + ASSERT_GE(index, 0); + ASSERT_EQ(K, h.entryAt(index).key); + values |= 1 << h.entryAt(index).value; + } + ASSERT_EQ(values, (1 << (i + 1)) - 1); + + index = find(h, index, K); + ASSERT_EQ(-1, index); + } + + for (size_t i = N; --i > 0; ) { + ASSERT_TRUE(remove(h, K)) << "i = " << i; + ASSERT_EQ(i, h.size()); + + ssize_t index = -1; + for (size_t j = 0; j < i; j++) { + index = find(h, index, K); + ASSERT_GE(index, 0); + ASSERT_EQ(K, h.entryAt(index).key); + } + + index = find(h, index, K); + ASSERT_EQ(-1, index); + } +} + +TEST_F(BasicHashtableTest, Clear_WhenAlreadyEmpty_DoesNothing) { + SimpleHashtable h; + h.clear(); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Clear_AfterElementsAdded_RemovesThem) { + SimpleHashtable h; + add(h, 0, 0); + add(h, 1, 0); + h.clear(); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Clear_AfterElementsAdded_DestroysThem) { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(0)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + + h.clear(); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Remove_AfterElementsAdded_DestroysThem) { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(0)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + + ASSERT_TRUE(remove(h, ComplexKey(0))); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1)); + + ASSERT_TRUE(remove(h, ComplexKey(1))); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); +} + +TEST_F(BasicHashtableTest, Destructor_AfterElementsAdded_DestroysThem) { + { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(0)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + } // h is destroyed here + + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); +} + +TEST_F(BasicHashtableTest, Next_WhenEmpty_ReturnsMinusOne) { + SimpleHashtable h; + + ASSERT_EQ(-1, h.next(-1)); +} + +TEST_F(BasicHashtableTest, Next_WhenNonEmpty_IteratesOverAllEntries) { + const int N = 88; + + SimpleHashtable h; + for (int i = 0; i < N; i++) { + add(h, i, i * 10); + } + + bool set[N]; + memset(set, 0, sizeof(bool) * N); + int count = 0; + for (ssize_t index = -1; (index = h.next(index)) != -1; ) { + ASSERT_GE(index, 0); + ASSERT_LT(size_t(index), h.bucketCount()); + + const SimpleEntry& entry = h.entryAt(index); + ASSERT_GE(entry.key, 0); + ASSERT_LT(entry.key, N); + ASSERT_EQ(false, set[entry.key]); + ASSERT_EQ(entry.key * 10, entry.value); + + set[entry.key] = true; + count += 1; + } + ASSERT_EQ(N, count); +} + +TEST_F(BasicHashtableTest, Add_RehashesOnDemand) { + SimpleHashtable h; + size_t initialCapacity = h.capacity(); + size_t initialBucketCount = h.bucketCount(); + + for (size_t i = 0; i < initialCapacity; i++) { + add(h, int(i), 0); + } + + EXPECT_EQ(initialCapacity, h.size()); + EXPECT_EQ(initialCapacity, h.capacity()); + EXPECT_EQ(initialBucketCount, h.bucketCount()); + + add(h, -1, -1); + + EXPECT_EQ(initialCapacity + 1, h.size()); + EXPECT_GT(h.capacity(), initialCapacity); + EXPECT_GT(h.bucketCount(), initialBucketCount); + EXPECT_GT(h.bucketCount(), h.capacity()); +} + +TEST_F(BasicHashtableTest, Rehash_WhenCapacityAndBucketCountUnchanged_DoesNothing) { + ComplexHashtable h; + add(h, ComplexKey(0), ComplexValue(0)); + const void* oldBuckets = getBuckets(h); + ASSERT_NE((void*)NULL, oldBuckets); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1)); + + h.rehash(h.capacity(), h.loadFactor()); + + ASSERT_EQ(oldBuckets, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(1, 1)); +} + +TEST_F(BasicHashtableTest, Rehash_WhenEmptyAndHasNoBuckets_ButDoesNotAllocateBuckets) { + ComplexHashtable h; + ASSERT_EQ((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + h.rehash(9, 1.0f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(10U, h.capacity()); + EXPECT_EQ(11U, h.bucketCount()); + EXPECT_EQ(1.0f, h.loadFactor()); + EXPECT_EQ((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); +} + +TEST_F(BasicHashtableTest, Rehash_WhenEmptyAndHasBuckets_ReleasesBucketsAndSetsCapacity) { + ComplexHashtable h(10); + add(h, ComplexKey(0), ComplexValue(0)); + ASSERT_TRUE(remove(h, ComplexKey(0))); + ASSERT_NE((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); + + h.rehash(0, 0.75f); + + EXPECT_EQ(0U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); + EXPECT_EQ((void*)NULL, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(0, 0)); +} + +TEST_F(BasicHashtableTest, Rehash_WhenLessThanCurrentCapacity_ShrinksBuckets) { + ComplexHashtable h(10); + add(h, ComplexKey(0), ComplexValue(0)); + add(h, ComplexKey(1), ComplexValue(1)); + const void* oldBuckets = getBuckets(h); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + + h.rehash(0, 0.75f); + + EXPECT_EQ(2U, h.size()); + EXPECT_EQ(3U, h.capacity()); + EXPECT_EQ(5U, h.bucketCount()); + EXPECT_EQ(0.75f, h.loadFactor()); + EXPECT_NE(oldBuckets, getBuckets(h)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); +} + +TEST_F(BasicHashtableTest, CopyOnWrite) { + ComplexHashtable h1; + add(h1, ComplexKey(0), ComplexValue(0)); + add(h1, ComplexKey(1), ComplexValue(1)); + const void* originalBuckets = getBuckets(h1); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ssize_t index0 = find(h1, -1, ComplexKey(0)); + EXPECT_GE(index0, 0); + + // copy constructor acquires shared reference + ComplexHashtable h2(h1); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h2)); + EXPECT_EQ(h1.size(), h2.size()); + EXPECT_EQ(h1.capacity(), h2.capacity()); + EXPECT_EQ(h1.bucketCount(), h2.bucketCount()); + EXPECT_EQ(h1.loadFactor(), h2.loadFactor()); + EXPECT_EQ(index0, find(h2, -1, ComplexKey(0))); + + // operator= acquires shared reference + ComplexHashtable h3; + h3 = h2; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h3)); + EXPECT_EQ(h1.size(), h3.size()); + EXPECT_EQ(h1.capacity(), h3.capacity()); + EXPECT_EQ(h1.bucketCount(), h3.bucketCount()); + EXPECT_EQ(h1.loadFactor(), h3.loadFactor()); + EXPECT_EQ(index0, find(h3, -1, ComplexKey(0))); + + // editEntryAt copies shared contents + h1.editEntryAt(index0).value.v = 42; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(42, h1.entryAt(index0).value.v); + EXPECT_EQ(0, h2.entryAt(index0).value.v); + EXPECT_EQ(0, h3.entryAt(index0).value.v); + + // clear releases reference to shared contents + h2.clear(); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4)); + EXPECT_EQ(0U, h2.size()); + ASSERT_NE(originalBuckets, getBuckets(h2)); + + // operator= acquires shared reference, destroys unshared contents + h1 = h3; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h1)); + EXPECT_EQ(h3.size(), h1.size()); + EXPECT_EQ(h3.capacity(), h1.capacity()); + EXPECT_EQ(h3.bucketCount(), h1.bucketCount()); + EXPECT_EQ(h3.loadFactor(), h1.loadFactor()); + EXPECT_EQ(index0, find(h1, -1, ComplexKey(0))); + + // add copies shared contents + add(h1, ComplexKey(2), ComplexValue(2)); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(5, 5)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(3U, h1.size()); + EXPECT_EQ(0U, h2.size()); + EXPECT_EQ(2U, h3.size()); + + // remove copies shared contents + h1 = h3; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h1)); + h1.removeAt(index0); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(3, 3)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(1U, h1.size()); + EXPECT_EQ(0U, h2.size()); + EXPECT_EQ(2U, h3.size()); + + // rehash copies shared contents + h1 = h3; + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(2, 2)); + ASSERT_EQ(originalBuckets, getBuckets(h1)); + h1.rehash(10, 1.0f); + ASSERT_NO_FATAL_FAILURE(assertInstanceCount(4, 4)); + ASSERT_NE(originalBuckets, getBuckets(h1)); + EXPECT_EQ(2U, h1.size()); + EXPECT_EQ(0U, h2.size()); + EXPECT_EQ(2U, h3.size()); +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/BlobCache_test.cpp android-platform-frameworks-native-21/libs/utils/tests/BlobCache_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/BlobCache_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/BlobCache_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,421 @@ +/* + ** Copyright 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 +#include + +#include + +#include +#include + +namespace android { + +class BlobCacheTest : public ::testing::Test { +protected: + enum { + MAX_KEY_SIZE = 6, + MAX_VALUE_SIZE = 8, + MAX_TOTAL_SIZE = 13, + }; + + virtual void SetUp() { + mBC = new BlobCache(MAX_KEY_SIZE, MAX_VALUE_SIZE, MAX_TOTAL_SIZE); + } + + virtual void TearDown() { + mBC.clear(); + } + + sp mBC; +}; + +TEST_F(BlobCacheTest, CacheSingleValueSucceeds) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); + ASSERT_EQ('e', buf[0]); + ASSERT_EQ('f', buf[1]); + ASSERT_EQ('g', buf[2]); + ASSERT_EQ('h', buf[3]); +} + +TEST_F(BlobCacheTest, CacheTwoValuesSucceeds) { + char buf[2] = { 0xee, 0xee }; + mBC->set("ab", 2, "cd", 2); + mBC->set("ef", 2, "gh", 2); + ASSERT_EQ(size_t(2), mBC->get("ab", 2, buf, 2)); + ASSERT_EQ('c', buf[0]); + ASSERT_EQ('d', buf[1]); + ASSERT_EQ(size_t(2), mBC->get("ef", 2, buf, 2)); + ASSERT_EQ('g', buf[0]); + ASSERT_EQ('h', buf[1]); +} + +TEST_F(BlobCacheTest, GetOnlyWritesInsideBounds) { + char buf[6] = { 0xee, 0xee, 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf+1, 4)); + ASSERT_EQ(0xee, buf[0]); + ASSERT_EQ('e', buf[1]); + ASSERT_EQ('f', buf[2]); + ASSERT_EQ('g', buf[3]); + ASSERT_EQ('h', buf[4]); + ASSERT_EQ(0xee, buf[5]); +} + +TEST_F(BlobCacheTest, GetOnlyWritesIfBufferIsLargeEnough) { + char buf[3] = { 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 3)); + ASSERT_EQ(0xee, buf[0]); + ASSERT_EQ(0xee, buf[1]); + ASSERT_EQ(0xee, buf[2]); +} + +TEST_F(BlobCacheTest, GetDoesntAccessNullBuffer) { + mBC->set("abcd", 4, "efgh", 4); + ASSERT_EQ(size_t(4), mBC->get("abcd", 4, NULL, 0)); +} + +TEST_F(BlobCacheTest, MultipleSetsCacheLatestValue) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + mBC->set("abcd", 4, "ijkl", 4); + ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); + ASSERT_EQ('i', buf[0]); + ASSERT_EQ('j', buf[1]); + ASSERT_EQ('k', buf[2]); + ASSERT_EQ('l', buf[3]); +} + +TEST_F(BlobCacheTest, SecondSetKeepsFirstValueIfTooLarge) { + char buf[MAX_VALUE_SIZE+1] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + mBC->set("abcd", 4, buf, MAX_VALUE_SIZE+1); + ASSERT_EQ(size_t(4), mBC->get("abcd", 4, buf, 4)); + ASSERT_EQ('e', buf[0]); + ASSERT_EQ('f', buf[1]); + ASSERT_EQ('g', buf[2]); + ASSERT_EQ('h', buf[3]); +} + +TEST_F(BlobCacheTest, DoesntCacheIfKeyIsTooBig) { + char key[MAX_KEY_SIZE+1]; + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + for (int i = 0; i < MAX_KEY_SIZE+1; i++) { + key[i] = 'a'; + } + mBC->set(key, MAX_KEY_SIZE+1, "bbbb", 4); + ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE+1, buf, 4)); + ASSERT_EQ(0xee, buf[0]); + ASSERT_EQ(0xee, buf[1]); + ASSERT_EQ(0xee, buf[2]); + ASSERT_EQ(0xee, buf[3]); +} + +TEST_F(BlobCacheTest, DoesntCacheIfValueIsTooBig) { + char buf[MAX_VALUE_SIZE+1]; + for (int i = 0; i < MAX_VALUE_SIZE+1; i++) { + buf[i] = 'b'; + } + mBC->set("abcd", 4, buf, MAX_VALUE_SIZE+1); + for (int i = 0; i < MAX_VALUE_SIZE+1; i++) { + buf[i] = 0xee; + } + ASSERT_EQ(size_t(0), mBC->get("abcd", 4, buf, MAX_VALUE_SIZE+1)); + for (int i = 0; i < MAX_VALUE_SIZE+1; i++) { + SCOPED_TRACE(i); + ASSERT_EQ(0xee, buf[i]); + } +} + +TEST_F(BlobCacheTest, DoesntCacheIfKeyValuePairIsTooBig) { + // Check a testing assumptions + ASSERT_TRUE(MAX_TOTAL_SIZE < MAX_KEY_SIZE + MAX_VALUE_SIZE); + ASSERT_TRUE(MAX_KEY_SIZE < MAX_TOTAL_SIZE); + + enum { bufSize = MAX_TOTAL_SIZE - MAX_KEY_SIZE + 1 }; + + char key[MAX_KEY_SIZE]; + char buf[bufSize]; + for (int i = 0; i < MAX_KEY_SIZE; i++) { + key[i] = 'a'; + } + for (int i = 0; i < bufSize; i++) { + buf[i] = 'b'; + } + + mBC->set(key, MAX_KEY_SIZE, buf, MAX_VALUE_SIZE); + ASSERT_EQ(size_t(0), mBC->get(key, MAX_KEY_SIZE, NULL, 0)); +} + +TEST_F(BlobCacheTest, CacheMaxKeySizeSucceeds) { + char key[MAX_KEY_SIZE]; + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + for (int i = 0; i < MAX_KEY_SIZE; i++) { + key[i] = 'a'; + } + mBC->set(key, MAX_KEY_SIZE, "wxyz", 4); + ASSERT_EQ(size_t(4), mBC->get(key, MAX_KEY_SIZE, buf, 4)); + ASSERT_EQ('w', buf[0]); + ASSERT_EQ('x', buf[1]); + ASSERT_EQ('y', buf[2]); + ASSERT_EQ('z', buf[3]); +} + +TEST_F(BlobCacheTest, CacheMaxValueSizeSucceeds) { + char buf[MAX_VALUE_SIZE]; + for (int i = 0; i < MAX_VALUE_SIZE; i++) { + buf[i] = 'b'; + } + mBC->set("abcd", 4, buf, MAX_VALUE_SIZE); + for (int i = 0; i < MAX_VALUE_SIZE; i++) { + buf[i] = 0xee; + } + ASSERT_EQ(size_t(MAX_VALUE_SIZE), mBC->get("abcd", 4, buf, + MAX_VALUE_SIZE)); + for (int i = 0; i < MAX_VALUE_SIZE; i++) { + SCOPED_TRACE(i); + ASSERT_EQ('b', buf[i]); + } +} + +TEST_F(BlobCacheTest, CacheMaxKeyValuePairSizeSucceeds) { + // Check a testing assumption + ASSERT_TRUE(MAX_KEY_SIZE < MAX_TOTAL_SIZE); + + enum { bufSize = MAX_TOTAL_SIZE - MAX_KEY_SIZE }; + + char key[MAX_KEY_SIZE]; + char buf[bufSize]; + for (int i = 0; i < MAX_KEY_SIZE; i++) { + key[i] = 'a'; + } + for (int i = 0; i < bufSize; i++) { + buf[i] = 'b'; + } + + mBC->set(key, MAX_KEY_SIZE, buf, bufSize); + ASSERT_EQ(size_t(bufSize), mBC->get(key, MAX_KEY_SIZE, NULL, 0)); +} + +TEST_F(BlobCacheTest, CacheMinKeyAndValueSizeSucceeds) { + char buf[1] = { 0xee }; + mBC->set("x", 1, "y", 1); + ASSERT_EQ(size_t(1), mBC->get("x", 1, buf, 1)); + ASSERT_EQ('y', buf[0]); +} + +TEST_F(BlobCacheTest, CacheSizeDoesntExceedTotalLimit) { + for (int i = 0; i < 256; i++) { + uint8_t k = i; + mBC->set(&k, 1, "x", 1); + } + int numCached = 0; + for (int i = 0; i < 256; i++) { + uint8_t k = i; + if (mBC->get(&k, 1, NULL, 0) == 1) { + numCached++; + } + } + ASSERT_GE(MAX_TOTAL_SIZE / 2, numCached); +} + +TEST_F(BlobCacheTest, ExceedingTotalLimitHalvesCacheSize) { + // Fill up the entire cache with 1 char key/value pairs. + const int maxEntries = MAX_TOTAL_SIZE / 2; + for (int i = 0; i < maxEntries; i++) { + uint8_t k = i; + mBC->set(&k, 1, "x", 1); + } + // Insert one more entry, causing a cache overflow. + { + uint8_t k = maxEntries; + mBC->set(&k, 1, "x", 1); + } + // Count the number of entries in the cache. + int numCached = 0; + for (int i = 0; i < maxEntries+1; i++) { + uint8_t k = i; + if (mBC->get(&k, 1, NULL, 0) == 1) { + numCached++; + } + } + ASSERT_EQ(maxEntries/2 + 1, numCached); +} + +class BlobCacheFlattenTest : public BlobCacheTest { +protected: + virtual void SetUp() { + BlobCacheTest::SetUp(); + mBC2 = new BlobCache(MAX_KEY_SIZE, MAX_VALUE_SIZE, MAX_TOTAL_SIZE); + } + + virtual void TearDown() { + mBC2.clear(); + BlobCacheTest::TearDown(); + } + + void roundTrip() { + size_t size = mBC->getFlattenedSize(); + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); + ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0)); + delete[] flat; + } + + sp mBC2; +}; + +TEST_F(BlobCacheFlattenTest, FlattenOneValue) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + roundTrip(); + ASSERT_EQ(size_t(4), mBC2->get("abcd", 4, buf, 4)); + ASSERT_EQ('e', buf[0]); + ASSERT_EQ('f', buf[1]); + ASSERT_EQ('g', buf[2]); + ASSERT_EQ('h', buf[3]); +} + +TEST_F(BlobCacheFlattenTest, FlattenFullCache) { + // Fill up the entire cache with 1 char key/value pairs. + const int maxEntries = MAX_TOTAL_SIZE / 2; + for (int i = 0; i < maxEntries; i++) { + uint8_t k = i; + mBC->set(&k, 1, &k, 1); + } + + roundTrip(); + + // Verify the deserialized cache + for (int i = 0; i < maxEntries; i++) { + uint8_t k = i; + uint8_t v = 0xee; + ASSERT_EQ(size_t(1), mBC2->get(&k, 1, &v, 1)); + ASSERT_EQ(k, v); + } +} + +TEST_F(BlobCacheFlattenTest, FlattenDoesntChangeCache) { + // Fill up the entire cache with 1 char key/value pairs. + const int maxEntries = MAX_TOTAL_SIZE / 2; + for (int i = 0; i < maxEntries; i++) { + uint8_t k = i; + mBC->set(&k, 1, &k, 1); + } + + size_t size = mBC->getFlattenedSize(); + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); + delete[] flat; + + // Verify the cache that we just serialized + for (int i = 0; i < maxEntries; i++) { + uint8_t k = i; + uint8_t v = 0xee; + ASSERT_EQ(size_t(1), mBC->get(&k, 1, &v, 1)); + ASSERT_EQ(k, v); + } +} + +TEST_F(BlobCacheFlattenTest, FlattenCatchesBufferTooSmall) { + // Fill up the entire cache with 1 char key/value pairs. + const int maxEntries = MAX_TOTAL_SIZE / 2; + for (int i = 0; i < maxEntries; i++) { + uint8_t k = i; + mBC->set(&k, 1, &k, 1); + } + + size_t size = mBC->getFlattenedSize() - 1; + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(BAD_VALUE, mBC->flatten(flat, size, NULL, 0)); + delete[] flat; +} + +TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadMagic) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + + size_t size = mBC->getFlattenedSize(); + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); + flat[1] = ~flat[1]; + + // Bad magic should cause an error. + ASSERT_EQ(BAD_VALUE, mBC2->unflatten(flat, size, NULL, 0)); + delete[] flat; + + // The error should cause the unflatten to result in an empty cache + ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); +} + +TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadBlobCacheVersion) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + + size_t size = mBC->getFlattenedSize(); + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); + flat[5] = ~flat[5]; + + // Version mismatches shouldn't cause errors, but should not use the + // serialized entries + ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0)); + delete[] flat; + + // The version mismatch should cause the unflatten to result in an empty + // cache + ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); +} + +TEST_F(BlobCacheFlattenTest, UnflattenCatchesBadBlobCacheDeviceVersion) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + + size_t size = mBC->getFlattenedSize(); + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); + flat[10] = ~flat[10]; + + // Version mismatches shouldn't cause errors, but should not use the + // serialized entries + ASSERT_EQ(OK, mBC2->unflatten(flat, size, NULL, 0)); + delete[] flat; + + // The version mismatch should cause the unflatten to result in an empty + // cache + ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); +} + +TEST_F(BlobCacheFlattenTest, UnflattenCatchesBufferTooSmall) { + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; + mBC->set("abcd", 4, "efgh", 4); + + size_t size = mBC->getFlattenedSize(); + uint8_t* flat = new uint8_t[size]; + ASSERT_EQ(OK, mBC->flatten(flat, size, NULL, 0)); + + // A buffer truncation shouldt cause an error + ASSERT_EQ(BAD_VALUE, mBC2->unflatten(flat, size-1, NULL, 0)); + delete[] flat; + + // The error should cause the unflatten to result in an empty cache + ASSERT_EQ(size_t(0), mBC2->get("abcd", 4, buf, 4)); +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Looper_test.cpp android-platform-frameworks-native-21/libs/utils/tests/Looper_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Looper_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/Looper_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,693 @@ +// +// Copyright 2010 The Android Open Source Project +// + +#include +#include +#include +#include +#include +#include + +#include "TestHelpers.h" + +// # of milliseconds to fudge stopwatch measurements +#define TIMING_TOLERANCE_MS 25 + +namespace android { + +enum { + MSG_TEST1 = 1, + MSG_TEST2 = 2, + MSG_TEST3 = 3, + MSG_TEST4 = 4, +}; + +class DelayedWake : public DelayedTask { + sp mLooper; + +public: + DelayedWake(int delayMillis, const sp looper) : + DelayedTask(delayMillis), mLooper(looper) { + } + +protected: + virtual void doTask() { + mLooper->wake(); + } +}; + +class DelayedWriteSignal : public DelayedTask { + Pipe* mPipe; + +public: + DelayedWriteSignal(int delayMillis, Pipe* pipe) : + DelayedTask(delayMillis), mPipe(pipe) { + } + +protected: + virtual void doTask() { + mPipe->writeSignal(); + } +}; + +class CallbackHandler { +public: + void setCallback(const sp& looper, int fd, int events) { + looper->addFd(fd, 0, events, staticHandler, this); + } + +protected: + virtual ~CallbackHandler() { } + + virtual int handler(int fd, int events) = 0; + +private: + static int staticHandler(int fd, int events, void* data) { + return static_cast(data)->handler(fd, events); + } +}; + +class StubCallbackHandler : public CallbackHandler { +public: + int nextResult; + int callbackCount; + + int fd; + int events; + + StubCallbackHandler(int nextResult) : nextResult(nextResult), + callbackCount(0), fd(-1), events(-1) { + } + +protected: + virtual int handler(int fd, int events) { + callbackCount += 1; + this->fd = fd; + this->events = events; + return nextResult; + } +}; + +class StubMessageHandler : public MessageHandler { +public: + Vector messages; + + virtual void handleMessage(const Message& message) { + messages.push(message); + } +}; + +class LooperTest : public testing::Test { +protected: + sp mLooper; + + virtual void SetUp() { + mLooper = new Looper(true); + } + + virtual void TearDown() { + mLooper.clear(); + } +}; + + +TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndNotAwoken_WaitsForTimeout) { + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal timeout"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; +} + +TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenBeforeWaiting_ImmediatelyReturns) { + mLooper->wake(); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(1000); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because wake() was called before waiting"; + EXPECT_EQ(ALOOPER_POLL_WAKE, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because loop was awoken"; +} + +TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndAwokenWhileWaiting_PromptlyReturns) { + sp delayedWake = new DelayedWake(100, mLooper); + delayedWake->run(); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(1000); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal wake delay"; + EXPECT_EQ(ALOOPER_POLL_WAKE, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because loop was awoken"; +} + +TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndNoRegisteredFDs_ImmediatelyReturns) { + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(0); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should be approx. zero"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; +} + +TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndNoSignalledFDs_ImmediatelyReturns) { + Pipe pipe; + StubCallbackHandler handler(true); + + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(0); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should be approx. zero"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; + EXPECT_EQ(0, handler.callbackCount) + << "callback should not have been invoked because FD was not signalled"; +} + +TEST_F(LooperTest, PollOnce_WhenZeroTimeoutAndSignalledFD_ImmediatelyInvokesCallbackAndReturns) { + Pipe pipe; + StubCallbackHandler handler(true); + + ASSERT_EQ(OK, pipe.writeSignal()); + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(0); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should be approx. zero"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; + EXPECT_EQ(1, handler.callbackCount) + << "callback should be invoked exactly once"; + EXPECT_EQ(pipe.receiveFd, handler.fd) + << "callback should have received pipe fd as parameter"; + EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events) + << "callback should have received ALOOPER_EVENT_INPUT as events"; +} + +TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndNoSignalledFDs_WaitsForTimeoutAndReturns) { + Pipe pipe; + StubCallbackHandler handler(true); + + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal timeout"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; + EXPECT_EQ(0, handler.callbackCount) + << "callback should not have been invoked because FD was not signalled"; +} + +TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDBeforeWaiting_ImmediatelyInvokesCallbackAndReturns) { + Pipe pipe; + StubCallbackHandler handler(true); + + pipe.writeSignal(); + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should be approx. zero"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; + EXPECT_EQ(1, handler.callbackCount) + << "callback should be invoked exactly once"; + EXPECT_EQ(pipe.receiveFd, handler.fd) + << "callback should have received pipe fd as parameter"; + EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events) + << "callback should have received ALOOPER_EVENT_INPUT as events"; +} + +TEST_F(LooperTest, PollOnce_WhenNonZeroTimeoutAndSignalledFDWhileWaiting_PromptlyInvokesCallbackAndReturns) { + Pipe pipe; + StubCallbackHandler handler(true); + sp delayedWriteSignal = new DelayedWriteSignal(100, & pipe); + + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + delayedWriteSignal->run(); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(1000); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal signal delay"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; + EXPECT_EQ(1, handler.callbackCount) + << "callback should be invoked exactly once"; + EXPECT_EQ(pipe.receiveFd, handler.fd) + << "callback should have received pipe fd as parameter"; + EXPECT_EQ(ALOOPER_EVENT_INPUT, handler.events) + << "callback should have received ALOOPER_EVENT_INPUT as events"; +} + +TEST_F(LooperTest, PollOnce_WhenCallbackAddedThenRemoved_CallbackShouldNotBeInvoked) { + Pipe pipe; + StubCallbackHandler handler(true); + + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + pipe.writeSignal(); // would cause FD to be considered signalled + mLooper->removeFd(pipe.receiveFd); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal timeout because FD was no longer registered"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; + EXPECT_EQ(0, handler.callbackCount) + << "callback should not be invoked"; +} + +TEST_F(LooperTest, PollOnce_WhenCallbackReturnsFalse_CallbackShouldNotBeInvokedAgainLater) { + Pipe pipe; + StubCallbackHandler handler(false); + + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + + // First loop: Callback is registered and FD is signalled. + pipe.writeSignal(); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(0); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal zero because FD was already signalled"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; + EXPECT_EQ(1, handler.callbackCount) + << "callback should be invoked"; + + // Second loop: Callback is no longer registered and FD is signalled. + pipe.writeSignal(); + + stopWatch.reset(); + result = mLooper->pollOnce(0); + elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. equal zero because timeout was zero"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT"; + EXPECT_EQ(1, handler.callbackCount) + << "callback should not be invoked this time"; +} + +TEST_F(LooperTest, PollOnce_WhenNonCallbackFdIsSignalled_ReturnsIdent) { + const int expectedIdent = 5; + void* expectedData = this; + + Pipe pipe; + + pipe.writeSignal(); + mLooper->addFd(pipe.receiveFd, expectedIdent, ALOOPER_EVENT_INPUT, NULL, expectedData); + + StopWatch stopWatch("pollOnce"); + int fd; + int events; + void* data; + int result = mLooper->pollOnce(100, &fd, &events, &data); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should be approx. zero"; + EXPECT_EQ(expectedIdent, result) + << "pollOnce result should be the ident of the FD that was signalled"; + EXPECT_EQ(pipe.receiveFd, fd) + << "pollOnce should have returned the received pipe fd"; + EXPECT_EQ(ALOOPER_EVENT_INPUT, events) + << "pollOnce should have returned ALOOPER_EVENT_INPUT as events"; + EXPECT_EQ(expectedData, data) + << "pollOnce should have returned the data"; +} + +TEST_F(LooperTest, AddFd_WhenCallbackAdded_ReturnsOne) { + Pipe pipe; + int result = mLooper->addFd(pipe.receiveFd, 0, ALOOPER_EVENT_INPUT, NULL, NULL); + + EXPECT_EQ(1, result) + << "addFd should return 1 because FD was added"; +} + +TEST_F(LooperTest, AddFd_WhenIdentIsNegativeAndCallbackIsNull_ReturnsError) { + Pipe pipe; + int result = mLooper->addFd(pipe.receiveFd, -1, ALOOPER_EVENT_INPUT, NULL, NULL); + + EXPECT_EQ(-1, result) + << "addFd should return -1 because arguments were invalid"; +} + +TEST_F(LooperTest, AddFd_WhenNoCallbackAndAllowNonCallbacksIsFalse_ReturnsError) { + Pipe pipe; + sp looper = new Looper(false /*allowNonCallbacks*/); + int result = looper->addFd(pipe.receiveFd, 0, 0, NULL, NULL); + + EXPECT_EQ(-1, result) + << "addFd should return -1 because arguments were invalid"; +} + +TEST_F(LooperTest, RemoveFd_WhenCallbackNotAdded_ReturnsZero) { + int result = mLooper->removeFd(1); + + EXPECT_EQ(0, result) + << "removeFd should return 0 because FD not registered"; +} + +TEST_F(LooperTest, RemoveFd_WhenCallbackAddedThenRemovedTwice_ReturnsOnceFirstTimeAndReturnsZeroSecondTime) { + Pipe pipe; + StubCallbackHandler handler(false); + handler.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + + // First time. + int result = mLooper->removeFd(pipe.receiveFd); + + EXPECT_EQ(1, result) + << "removeFd should return 1 first time because FD was registered"; + + // Second time. + result = mLooper->removeFd(pipe.receiveFd); + + EXPECT_EQ(0, result) + << "removeFd should return 0 second time because FD was no longer registered"; +} + +TEST_F(LooperTest, PollOnce_WhenCallbackAddedTwice_OnlySecondCallbackShouldBeInvoked) { + Pipe pipe; + StubCallbackHandler handler1(true); + StubCallbackHandler handler2(true); + + handler1.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); + handler2.setCallback(mLooper, pipe.receiveFd, ALOOPER_EVENT_INPUT); // replace it + pipe.writeSignal(); // would cause FD to be considered signalled + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + ASSERT_EQ(OK, pipe.readSignal()) + << "signal should actually have been written"; + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because FD was already signalled"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because FD was signalled"; + EXPECT_EQ(0, handler1.callbackCount) + << "original handler callback should not be invoked because it was replaced"; + EXPECT_EQ(1, handler2.callbackCount) + << "replacement handler callback should be invoked"; +} + +TEST_F(LooperTest, SendMessage_WhenOneMessageIsEnqueue_ShouldInvokeHandlerDuringNextPoll) { + sp handler = new StubMessageHandler(); + mLooper->sendMessage(handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was already sent"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; +} + +TEST_F(LooperTest, SendMessage_WhenMultipleMessagesAreEnqueued_ShouldInvokeHandlersInOrderDuringNextPoll) { + sp handler1 = new StubMessageHandler(); + sp handler2 = new StubMessageHandler(); + mLooper->sendMessage(handler1, Message(MSG_TEST1)); + mLooper->sendMessage(handler2, Message(MSG_TEST2)); + mLooper->sendMessage(handler1, Message(MSG_TEST3)); + mLooper->sendMessage(handler1, Message(MSG_TEST4)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(1000); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was already sent"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + EXPECT_EQ(size_t(3), handler1->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler1->messages[0].what) + << "handled message"; + EXPECT_EQ(MSG_TEST3, handler1->messages[1].what) + << "handled message"; + EXPECT_EQ(MSG_TEST4, handler1->messages[2].what) + << "handled message"; + EXPECT_EQ(size_t(1), handler2->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST2, handler2->messages[0].what) + << "handled message"; +} + +TEST_F(LooperTest, SendMessageDelayed_WhenSentToTheFuture_ShouldInvokeHandlerAfterDelayTime) { + sp handler = new StubMessageHandler(); + mLooper->sendMessageDelayed(ms2ns(100), handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(1000); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "first poll should end quickly because next message timeout was computed"; + EXPECT_EQ(ALOOPER_POLL_WAKE, result) + << "pollOnce result should be ALOOPER_POLL_WAKE due to wakeup"; + EXPECT_EQ(size_t(0), handler->messages.size()) + << "no message handled yet"; + + result = mLooper->pollOnce(1000); + elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "second poll should end around the time of the delayed message dispatch"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + + result = mLooper->pollOnce(100); + elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(100 + 100, elapsedMillis, TIMING_TOLERANCE_MS) + << "third poll should timeout"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there were no messages left"; +} + +TEST_F(LooperTest, SendMessageDelayed_WhenSentToThePast_ShouldInvokeHandlerDuringNextPoll) { + sp handler = new StubMessageHandler(); + mLooper->sendMessageDelayed(ms2ns(-1000), handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was already sent"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; +} + +TEST_F(LooperTest, SendMessageDelayed_WhenSentToThePresent_ShouldInvokeHandlerDuringNextPoll) { + sp handler = new StubMessageHandler(); + mLooper->sendMessageDelayed(0, handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was already sent"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; +} + +TEST_F(LooperTest, SendMessageAtTime_WhenSentToTheFuture_ShouldInvokeHandlerAfterDelayTime) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + sp handler = new StubMessageHandler(); + mLooper->sendMessageAtTime(now + ms2ns(100), handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(1000); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "first poll should end quickly because next message timeout was computed"; + EXPECT_EQ(ALOOPER_POLL_WAKE, result) + << "pollOnce result should be ALOOPER_POLL_WAKE due to wakeup"; + EXPECT_EQ(size_t(0), handler->messages.size()) + << "no message handled yet"; + + result = mLooper->pollOnce(1000); + elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; + EXPECT_NEAR(100, elapsedMillis, TIMING_TOLERANCE_MS) + << "second poll should end around the time of the delayed message dispatch"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + + result = mLooper->pollOnce(100); + elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(100 + 100, elapsedMillis, TIMING_TOLERANCE_MS) + << "third poll should timeout"; + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there were no messages left"; +} + +TEST_F(LooperTest, SendMessageAtTime_WhenSentToThePast_ShouldInvokeHandlerDuringNextPoll) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + sp handler = new StubMessageHandler(); + mLooper->sendMessageAtTime(now - ms2ns(1000), handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was already sent"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; +} + +TEST_F(LooperTest, SendMessageAtTime_WhenSentToThePresent_ShouldInvokeHandlerDuringNextPoll) { + nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); + sp handler = new StubMessageHandler(); + mLooper->sendMessageAtTime(now, handler, Message(MSG_TEST1)); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(100); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was already sent"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because message was sent"; + EXPECT_EQ(size_t(1), handler->messages.size()) + << "handled message"; + EXPECT_EQ(MSG_TEST1, handler->messages[0].what) + << "handled message"; +} + +TEST_F(LooperTest, RemoveMessage_WhenRemovingAllMessagesForHandler_ShouldRemoveThoseMessage) { + sp handler = new StubMessageHandler(); + mLooper->sendMessage(handler, Message(MSG_TEST1)); + mLooper->sendMessage(handler, Message(MSG_TEST2)); + mLooper->sendMessage(handler, Message(MSG_TEST3)); + mLooper->removeMessages(handler); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(0); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was sent so looper was awoken"; + EXPECT_EQ(ALOOPER_POLL_WAKE, result) + << "pollOnce result should be ALOOPER_POLL_WAKE because looper was awoken"; + EXPECT_EQ(size_t(0), handler->messages.size()) + << "no messages to handle"; + + result = mLooper->pollOnce(0); + + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there was nothing to do"; + EXPECT_EQ(size_t(0), handler->messages.size()) + << "no messages to handle"; +} + +TEST_F(LooperTest, RemoveMessage_WhenRemovingSomeMessagesForHandler_ShouldRemoveThoseMessage) { + sp handler = new StubMessageHandler(); + mLooper->sendMessage(handler, Message(MSG_TEST1)); + mLooper->sendMessage(handler, Message(MSG_TEST2)); + mLooper->sendMessage(handler, Message(MSG_TEST3)); + mLooper->sendMessage(handler, Message(MSG_TEST4)); + mLooper->removeMessages(handler, MSG_TEST3); + mLooper->removeMessages(handler, MSG_TEST1); + + StopWatch stopWatch("pollOnce"); + int result = mLooper->pollOnce(0); + int32_t elapsedMillis = ns2ms(stopWatch.elapsedTime()); + + EXPECT_NEAR(0, elapsedMillis, TIMING_TOLERANCE_MS) + << "elapsed time should approx. zero because message was sent so looper was awoken"; + EXPECT_EQ(ALOOPER_POLL_CALLBACK, result) + << "pollOnce result should be ALOOPER_POLL_CALLBACK because two messages were sent"; + EXPECT_EQ(size_t(2), handler->messages.size()) + << "no messages to handle"; + EXPECT_EQ(MSG_TEST2, handler->messages[0].what) + << "handled message"; + EXPECT_EQ(MSG_TEST4, handler->messages[1].what) + << "handled message"; + + result = mLooper->pollOnce(0); + + EXPECT_EQ(ALOOPER_POLL_TIMEOUT, result) + << "pollOnce result should be ALOOPER_POLL_TIMEOUT because there was nothing to do"; + EXPECT_EQ(size_t(2), handler->messages.size()) + << "no more messages to handle"; +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/String8_test.cpp android-platform-frameworks-native-21/libs/utils/tests/String8_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/String8_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/String8_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2010 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. + */ + +#define LOG_TAG "String8_test" +#include +#include + +#include + +namespace android { + +class String8Test : public testing::Test { +protected: + virtual void SetUp() { + } + + virtual void TearDown() { + } +}; + +TEST_F(String8Test, Cstr) { + String8 tmp("Hello, world!"); + + EXPECT_STREQ(tmp.string(), "Hello, world!"); +} + +TEST_F(String8Test, OperatorPlus) { + String8 src1("Hello, "); + + // Test adding String8 + const char* + const char* ccsrc2 = "world!"; + String8 dst1 = src1 + ccsrc2; + EXPECT_STREQ(dst1.string(), "Hello, world!"); + EXPECT_STREQ(src1.string(), "Hello, "); + EXPECT_STREQ(ccsrc2, "world!"); + + // Test adding String8 + String8 + String8 ssrc2("world!"); + String8 dst2 = src1 + ssrc2; + EXPECT_STREQ(dst2.string(), "Hello, world!"); + EXPECT_STREQ(src1.string(), "Hello, "); + EXPECT_STREQ(ssrc2.string(), "world!"); +} + +TEST_F(String8Test, OperatorPlusEquals) { + String8 src1("My voice"); + + // Testing String8 += String8 + String8 src2(" is my passport."); + src1 += src2; + EXPECT_STREQ(src1.string(), "My voice is my passport."); + EXPECT_STREQ(src2.string(), " is my passport."); + + // Adding const char* to the previous string. + const char* src3 = " Verify me."; + src1 += src3; + EXPECT_STREQ(src1.string(), "My voice is my passport. Verify me."); + EXPECT_STREQ(src2.string(), " is my passport."); + EXPECT_STREQ(src3, " Verify me."); +} + +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/TestHelpers.h android-platform-frameworks-native-21/libs/utils/tests/TestHelpers.h --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/TestHelpers.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/TestHelpers.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,79 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef TESTHELPERS_H +#define TESTHELPERS_H + +#include + +namespace android { + +class Pipe { +public: + int sendFd; + int receiveFd; + + Pipe() { + int fds[2]; + ::pipe(fds); + + receiveFd = fds[0]; + sendFd = fds[1]; + } + + ~Pipe() { + if (sendFd != -1) { + ::close(sendFd); + } + + if (receiveFd != -1) { + ::close(receiveFd); + } + } + + status_t writeSignal() { + ssize_t nWritten = ::write(sendFd, "*", 1); + return nWritten == 1 ? 0 : -errno; + } + + status_t readSignal() { + char buf[1]; + ssize_t nRead = ::read(receiveFd, buf, 1); + return nRead == 1 ? 0 : nRead == 0 ? -EPIPE : -errno; + } +}; + +class DelayedTask : public Thread { + int mDelayMillis; + +public: + DelayedTask(int delayMillis) : mDelayMillis(delayMillis) { } + +protected: + virtual ~DelayedTask() { } + + virtual void doTask() = 0; + + virtual bool threadLoop() { + usleep(mDelayMillis * 1000); + doTask(); + return false; + } +}; + +} // namespace android + +#endif // TESTHELPERS_H diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Unicode_test.cpp android-platform-frameworks-native-21/libs/utils/tests/Unicode_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Unicode_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/Unicode_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,115 @@ +/* + * Copyright (C) 2010 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. + */ + +#define LOG_TAG "Unicode_test" +#include +#include + +#include + +namespace android { + +class UnicodeTest : public testing::Test { +protected: + virtual void SetUp() { + } + + virtual void TearDown() { + } +}; + +TEST_F(UnicodeTest, UTF8toUTF16ZeroLength) { + ssize_t measured; + + const uint8_t str[] = { }; + + measured = utf8_to_utf16_length(str, 0); + EXPECT_EQ(0, measured) + << "Zero length input should return zero length output."; +} + +TEST_F(UnicodeTest, UTF8toUTF16ASCIILength) { + ssize_t measured; + + // U+0030 or ASCII '0' + const uint8_t str[] = { 0x30 }; + + measured = utf8_to_utf16_length(str, sizeof(str)); + EXPECT_EQ(1, measured) + << "ASCII glyphs should have a length of 1 char16_t"; +} + +TEST_F(UnicodeTest, UTF8toUTF16Plane1Length) { + ssize_t measured; + + // U+2323 SMILE + const uint8_t str[] = { 0xE2, 0x8C, 0xA3 }; + + measured = utf8_to_utf16_length(str, sizeof(str)); + EXPECT_EQ(1, measured) + << "Plane 1 glyphs should have a length of 1 char16_t"; +} + +TEST_F(UnicodeTest, UTF8toUTF16SurrogateLength) { + ssize_t measured; + + // U+10000 + const uint8_t str[] = { 0xF0, 0x90, 0x80, 0x80 }; + + measured = utf8_to_utf16_length(str, sizeof(str)); + EXPECT_EQ(2, measured) + << "Surrogate pairs should have a length of 2 char16_t"; +} + +TEST_F(UnicodeTest, UTF8toUTF16TruncatedUTF8) { + ssize_t measured; + + // Truncated U+2323 SMILE + // U+2323 SMILE + const uint8_t str[] = { 0xE2, 0x8C }; + + measured = utf8_to_utf16_length(str, sizeof(str)); + EXPECT_EQ(-1, measured) + << "Truncated UTF-8 should return -1 to indicate invalid"; +} + +TEST_F(UnicodeTest, UTF8toUTF16Normal) { + const uint8_t str[] = { + 0x30, // U+0030, 1 UTF-16 character + 0xC4, 0x80, // U+0100, 1 UTF-16 character + 0xE2, 0x8C, 0xA3, // U+2323, 1 UTF-16 character + 0xF0, 0x90, 0x80, 0x80, // U+10000, 2 UTF-16 character + }; + + char16_t output[1 + 1 + 1 + 2 + 1]; // Room for NULL + + utf8_to_utf16(str, sizeof(str), output); + + EXPECT_EQ(0x0030, output[0]) + << "should be U+0030"; + EXPECT_EQ(0x0100, output[1]) + << "should be U+0100"; + EXPECT_EQ(0x2323, output[2]) + << "should be U+2323"; + EXPECT_EQ(0xD800, output[3]) + << "should be first half of surrogate U+10000"; + EXPECT_EQ(0xDC00, output[4]) + << "should be second half of surrogate U+10000"; + EXPECT_EQ(NULL, output[5]) + << "should be NULL terminated"; +} + +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Vector_test.cpp android-platform-frameworks-native-21/libs/utils/tests/Vector_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/Vector_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/Vector_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2012 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. + */ + +#define LOG_TAG "Vector_test" + +#include +#include +#include +#include + +namespace android { + +class VectorTest : public testing::Test { +protected: + virtual void SetUp() { + } + + virtual void TearDown() { + } + +public: +}; + + +TEST_F(VectorTest, CopyOnWrite_CopyAndAddElements) { + + Vector vector; + Vector other; + vector.setCapacity(8); + + vector.add(1); + vector.add(2); + vector.add(3); + + EXPECT_EQ(vector.size(), 3); + + // copy the vector + other = vector; + + EXPECT_EQ(other.size(), 3); + + // add an element to the first vector + vector.add(4); + + // make sure the sizes are correct + EXPECT_EQ(vector.size(), 4); + EXPECT_EQ(other.size(), 3); + + // add an element to the copy + other.add(5); + + // make sure the sizes are correct + EXPECT_EQ(vector.size(), 4); + EXPECT_EQ(other.size(), 4); + + // make sure the content of both vectors are correct + EXPECT_EQ(vector[3], 4); + EXPECT_EQ(other[3], 5); +} + + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/ZipFileRO_test.cpp android-platform-frameworks-native-21/libs/utils/tests/ZipFileRO_test.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/tests/ZipFileRO_test.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/tests/ZipFileRO_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,64 @@ +/* + * 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. + */ + +#define LOG_TAG "ZipFileRO_test" +#include +#include + +#include + +#include +#include + +namespace android { + +class ZipFileROTest : public testing::Test { +protected: + virtual void SetUp() { + } + + virtual void TearDown() { + } +}; + +TEST_F(ZipFileROTest, ZipTimeConvertSuccess) { + struct tm t; + + // 2011-06-29 14:40:40 + long when = 0x3EDD7514; + + ZipFileRO::zipTimeToTimespec(when, &t); + + EXPECT_EQ(2011, t.tm_year + 1900) + << "Year was improperly converted."; + + EXPECT_EQ(6, t.tm_mon) + << "Month was improperly converted."; + + EXPECT_EQ(29, t.tm_mday) + << "Day was improperly converted."; + + EXPECT_EQ(14, t.tm_hour) + << "Hour was improperly converted."; + + EXPECT_EQ(40, t.tm_min) + << "Minute was improperly converted."; + + EXPECT_EQ(40, t.tm_sec) + << "Second was improperly converted."; +} + +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/TextOutput.cpp android-platform-frameworks-native-21/libs/utils/TextOutput.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/TextOutput.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/TextOutput.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,154 @@ +/* + * Copyright (C) 2005 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 + +#include + +#include +#include +#include + +namespace android { + +// --------------------------------------------------------------------------- + +TextOutput::TextOutput() { +} + +TextOutput::~TextOutput() { +} + +// --------------------------------------------------------------------------- + +TextOutput& operator<<(TextOutput& to, bool val) +{ + if (val) to.print("true", 4); + else to.print("false", 5); + return to; +} + +TextOutput& operator<<(TextOutput& to, int val) +{ + char buf[16]; + sprintf(buf, "%d", val); + to.print(buf, strlen(buf)); + return to; +} + +TextOutput& operator<<(TextOutput& to, long val) +{ + char buf[16]; + sprintf(buf, "%ld", val); + to.print(buf, strlen(buf)); + return to; +} + +TextOutput& operator<<(TextOutput& to, unsigned int val) +{ + char buf[16]; + sprintf(buf, "%u", val); + to.print(buf, strlen(buf)); + return to; +} + +TextOutput& operator<<(TextOutput& to, unsigned long val) +{ + char buf[16]; + sprintf(buf, "%lu", val); + to.print(buf, strlen(buf)); + return to; +} + +TextOutput& operator<<(TextOutput& to, long long val) +{ + char buf[32]; + sprintf(buf, "%Ld", val); + to.print(buf, strlen(buf)); + return to; +} + +TextOutput& operator<<(TextOutput& to, unsigned long long val) +{ + char buf[32]; + sprintf(buf, "%Lu", val); + to.print(buf, strlen(buf)); + return to; +} + +static TextOutput& print_float(TextOutput& to, double value) +{ + char buf[64]; + sprintf(buf, "%g", value); + if( !strchr(buf, '.') && !strchr(buf, 'e') && + !strchr(buf, 'E') ) { + strncat(buf, ".0", sizeof(buf)-1); + } + to.print(buf, strlen(buf)); + return to; +} + +TextOutput& operator<<(TextOutput& to, float val) +{ + return print_float(to,val); +} + +TextOutput& operator<<(TextOutput& to, double val) +{ + return print_float(to,val); +} + +TextOutput& operator<<(TextOutput& to, const void* val) +{ + char buf[16]; + sprintf(buf, "%p", val); + to.print(buf, strlen(buf)); + return to; +} + +static void textOutputPrinter(void* cookie, const char* txt) +{ + ((TextOutput*)cookie)->print(txt, strlen(txt)); +} + +TextOutput& operator<<(TextOutput& to, const TypeCode& val) +{ + printTypeCode(val.typeCode(), textOutputPrinter, (void*)&to); + return to; +} + +HexDump::HexDump(const void *buf, size_t size, size_t bytesPerLine) + : mBuffer(buf) + , mSize(size) + , mBytesPerLine(bytesPerLine) + , mSingleLineCutoff(16) + , mAlignment(4) + , mCArrayStyle(false) +{ + if (bytesPerLine >= 16) mAlignment = 4; + else if (bytesPerLine >= 8) mAlignment = 2; + else mAlignment = 1; +} + +TextOutput& operator<<(TextOutput& to, const HexDump& val) +{ + printHexData(0, val.buffer(), val.size(), val.bytesPerLine(), + val.singleLineCutoff(), val.alignment(), val.carrayStyle(), + textOutputPrinter, (void*)&to); + return to; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Threads.cpp android-platform-frameworks-native-21/libs/utils/Threads.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Threads.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Threads.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,899 @@ +/* + * Copyright (C) 2007 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. + */ + +// #define LOG_NDEBUG 0 +#define LOG_TAG "libutils.threads" + +#include +#include + +#include +#include + +#include +#include +#include +#include +#include +#include + +#if defined(HAVE_PTHREADS) +# include +# include +# include +#ifdef HAVE_ANDROID_OS +# include +#endif +#elif defined(HAVE_WIN32_THREADS) +# include +# include +# include +# define HAVE_CREATETHREAD // Cygwin, vs. HAVE__BEGINTHREADEX for MinGW +#endif + +#if defined(HAVE_PRCTL) +#include +#endif + +/* + * =========================================================================== + * Thread wrappers + * =========================================================================== + */ + +using namespace android; + +// ---------------------------------------------------------------------------- +#if defined(HAVE_PTHREADS) +// ---------------------------------------------------------------------------- + +/* + * Create and run a new thread. + * + * We create it "detached", so it cleans up after itself. + */ + +typedef void* (*android_pthread_entry)(void*); + +static pthread_once_t gDoSchedulingGroupOnce = PTHREAD_ONCE_INIT; +static bool gDoSchedulingGroup = true; + +static void checkDoSchedulingGroup(void) { + char buf[PROPERTY_VALUE_MAX]; + int len = property_get("debug.sys.noschedgroups", buf, ""); + if (len > 0) { + int temp; + if (sscanf(buf, "%d", &temp) == 1) { + gDoSchedulingGroup = temp == 0; + } + } +} + +struct thread_data_t { + thread_func_t entryFunction; + void* userData; + int priority; + char * threadName; + + // we use this trampoline when we need to set the priority with + // nice/setpriority, and name with prctl. + static int trampoline(const thread_data_t* t) { + thread_func_t f = t->entryFunction; + void* u = t->userData; + int prio = t->priority; + char * name = t->threadName; + delete t; + setpriority(PRIO_PROCESS, 0, prio); + pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); + if (gDoSchedulingGroup) { + if (prio >= ANDROID_PRIORITY_BACKGROUND) { + set_sched_policy(androidGetTid(), SP_BACKGROUND); + } else if (prio > ANDROID_PRIORITY_AUDIO) { + set_sched_policy(androidGetTid(), SP_FOREGROUND); + } else { + // defaults to that of parent, or as set by requestPriority() + } + } + + if (name) { +#if defined(HAVE_PRCTL) + // Mac OS doesn't have this, and we build libutil for the host too + int hasAt = 0; + int hasDot = 0; + char *s = name; + while (*s) { + if (*s == '.') hasDot = 1; + else if (*s == '@') hasAt = 1; + s++; + } + int len = s - name; + if (len < 15 || hasAt || !hasDot) { + s = name; + } else { + s = name + len - 15; + } + prctl(PR_SET_NAME, (unsigned long) s, 0, 0, 0); +#endif + free(name); + } + return f(u); + } +}; + +int androidCreateRawThreadEtc(android_thread_func_t entryFunction, + void *userData, + const char* threadName, + int32_t threadPriority, + size_t threadStackSize, + android_thread_id_t *threadId) +{ + pthread_attr_t attr; + pthread_attr_init(&attr); + pthread_attr_setdetachstate(&attr, PTHREAD_CREATE_DETACHED); + +#ifdef HAVE_ANDROID_OS /* valgrind is rejecting RT-priority create reqs */ + if (threadPriority != PRIORITY_DEFAULT || threadName != NULL) { + // Now that the pthread_t has a method to find the associated + // android_thread_id_t (pid) from pthread_t, it would be possible to avoid + // this trampoline in some cases as the parent could set the properties + // for the child. However, there would be a race condition because the + // child becomes ready immediately, and it doesn't work for the name. + // prctl(PR_SET_NAME) only works for self; prctl(PR_SET_THREAD_NAME) was + // proposed but not yet accepted. + thread_data_t* t = new thread_data_t; + t->priority = threadPriority; + t->threadName = threadName ? strdup(threadName) : NULL; + t->entryFunction = entryFunction; + t->userData = userData; + entryFunction = (android_thread_func_t)&thread_data_t::trampoline; + userData = t; + } +#endif + + if (threadStackSize) { + pthread_attr_setstacksize(&attr, threadStackSize); + } + + errno = 0; + pthread_t thread; + int result = pthread_create(&thread, &attr, + (android_pthread_entry)entryFunction, userData); + pthread_attr_destroy(&attr); + if (result != 0) { + ALOGE("androidCreateRawThreadEtc failed (entry=%p, res=%d, errno=%d)\n" + "(android threadPriority=%d)", + entryFunction, result, errno, threadPriority); + return 0; + } + + // Note that *threadID is directly available to the parent only, as it is + // assigned after the child starts. Use memory barrier / lock if the child + // or other threads also need access. + if (threadId != NULL) { + *threadId = (android_thread_id_t)thread; // XXX: this is not portable + } + return 1; +} + +#ifdef HAVE_ANDROID_OS +static pthread_t android_thread_id_t_to_pthread(android_thread_id_t thread) +{ + return (pthread_t) thread; +} +#endif + +android_thread_id_t androidGetThreadId() +{ + return (android_thread_id_t)pthread_self(); +} + +// ---------------------------------------------------------------------------- +#elif defined(HAVE_WIN32_THREADS) +// ---------------------------------------------------------------------------- + +/* + * Trampoline to make us __stdcall-compliant. + * + * We're expected to delete "vDetails" when we're done. + */ +struct threadDetails { + int (*func)(void*); + void* arg; +}; +static __stdcall unsigned int threadIntermediary(void* vDetails) +{ + struct threadDetails* pDetails = (struct threadDetails*) vDetails; + int result; + + result = (*(pDetails->func))(pDetails->arg); + + delete pDetails; + + ALOG(LOG_VERBOSE, "thread", "thread exiting\n"); + return (unsigned int) result; +} + +/* + * Create and run a new thread. + */ +static bool doCreateThread(android_thread_func_t fn, void* arg, android_thread_id_t *id) +{ + HANDLE hThread; + struct threadDetails* pDetails = new threadDetails; // must be on heap + unsigned int thrdaddr; + + pDetails->func = fn; + pDetails->arg = arg; + +#if defined(HAVE__BEGINTHREADEX) + hThread = (HANDLE) _beginthreadex(NULL, 0, threadIntermediary, pDetails, 0, + &thrdaddr); + if (hThread == 0) +#elif defined(HAVE_CREATETHREAD) + hThread = CreateThread(NULL, 0, + (LPTHREAD_START_ROUTINE) threadIntermediary, + (void*) pDetails, 0, (DWORD*) &thrdaddr); + if (hThread == NULL) +#endif + { + ALOG(LOG_WARN, "thread", "WARNING: thread create failed\n"); + return false; + } + +#if defined(HAVE_CREATETHREAD) + /* close the management handle */ + CloseHandle(hThread); +#endif + + if (id != NULL) { + *id = (android_thread_id_t)thrdaddr; + } + + return true; +} + +int androidCreateRawThreadEtc(android_thread_func_t fn, + void *userData, + const char* threadName, + int32_t threadPriority, + size_t threadStackSize, + android_thread_id_t *threadId) +{ + return doCreateThread( fn, userData, threadId); +} + +android_thread_id_t androidGetThreadId() +{ + return (android_thread_id_t)GetCurrentThreadId(); +} + +// ---------------------------------------------------------------------------- +#else +#error "Threads not supported" +#endif + +// ---------------------------------------------------------------------------- + +int androidCreateThread(android_thread_func_t fn, void* arg) +{ + return createThreadEtc(fn, arg); +} + +int androidCreateThreadGetID(android_thread_func_t fn, void *arg, android_thread_id_t *id) +{ + return createThreadEtc(fn, arg, "android:unnamed_thread", + PRIORITY_DEFAULT, 0, id); +} + +static android_create_thread_fn gCreateThreadFn = androidCreateRawThreadEtc; + +int androidCreateThreadEtc(android_thread_func_t entryFunction, + void *userData, + const char* threadName, + int32_t threadPriority, + size_t threadStackSize, + android_thread_id_t *threadId) +{ + return gCreateThreadFn(entryFunction, userData, threadName, + threadPriority, threadStackSize, threadId); +} + +void androidSetCreateThreadFunc(android_create_thread_fn func) +{ + gCreateThreadFn = func; +} + +pid_t androidGetTid() +{ +#ifdef HAVE_GETTID + return gettid(); +#else + return getpid(); +#endif +} + +#ifdef HAVE_ANDROID_OS +int androidSetThreadPriority(pid_t tid, int pri) +{ + int rc = 0; + +#if defined(HAVE_PTHREADS) + int lasterr = 0; + + pthread_once(&gDoSchedulingGroupOnce, checkDoSchedulingGroup); + if (gDoSchedulingGroup) { + // set_sched_policy does not support tid == 0 + int policy_tid; + if (tid == 0) { + policy_tid = androidGetTid(); + } else { + policy_tid = tid; + } + if (pri >= ANDROID_PRIORITY_BACKGROUND) { + rc = set_sched_policy(policy_tid, SP_BACKGROUND); + } else if (getpriority(PRIO_PROCESS, tid) >= ANDROID_PRIORITY_BACKGROUND) { + rc = set_sched_policy(policy_tid, SP_FOREGROUND); + } + } + + if (rc) { + lasterr = errno; + } + + if (setpriority(PRIO_PROCESS, tid, pri) < 0) { + rc = INVALID_OPERATION; + } else { + errno = lasterr; + } +#endif + + return rc; +} + +int androidGetThreadPriority(pid_t tid) { +#if defined(HAVE_PTHREADS) + return getpriority(PRIO_PROCESS, tid); +#else + return ANDROID_PRIORITY_NORMAL; +#endif +} + +#endif + +namespace android { + +/* + * =========================================================================== + * Mutex class + * =========================================================================== + */ + +#if defined(HAVE_PTHREADS) +// implemented as inlines in threads.h +#elif defined(HAVE_WIN32_THREADS) + +Mutex::Mutex() +{ + HANDLE hMutex; + + assert(sizeof(hMutex) == sizeof(mState)); + + hMutex = CreateMutex(NULL, FALSE, NULL); + mState = (void*) hMutex; +} + +Mutex::Mutex(const char* name) +{ + // XXX: name not used for now + HANDLE hMutex; + + assert(sizeof(hMutex) == sizeof(mState)); + + hMutex = CreateMutex(NULL, FALSE, NULL); + mState = (void*) hMutex; +} + +Mutex::Mutex(int type, const char* name) +{ + // XXX: type and name not used for now + HANDLE hMutex; + + assert(sizeof(hMutex) == sizeof(mState)); + + hMutex = CreateMutex(NULL, FALSE, NULL); + mState = (void*) hMutex; +} + +Mutex::~Mutex() +{ + CloseHandle((HANDLE) mState); +} + +status_t Mutex::lock() +{ + DWORD dwWaitResult; + dwWaitResult = WaitForSingleObject((HANDLE) mState, INFINITE); + return dwWaitResult != WAIT_OBJECT_0 ? -1 : NO_ERROR; +} + +void Mutex::unlock() +{ + if (!ReleaseMutex((HANDLE) mState)) + ALOG(LOG_WARN, "thread", "WARNING: bad result from unlocking mutex\n"); +} + +status_t Mutex::tryLock() +{ + DWORD dwWaitResult; + + dwWaitResult = WaitForSingleObject((HANDLE) mState, 0); + if (dwWaitResult != WAIT_OBJECT_0 && dwWaitResult != WAIT_TIMEOUT) + ALOG(LOG_WARN, "thread", "WARNING: bad result from try-locking mutex\n"); + return (dwWaitResult == WAIT_OBJECT_0) ? 0 : -1; +} + +#else +#error "Somebody forgot to implement threads for this platform." +#endif + + +/* + * =========================================================================== + * Condition class + * =========================================================================== + */ + +#if defined(HAVE_PTHREADS) +// implemented as inlines in threads.h +#elif defined(HAVE_WIN32_THREADS) + +/* + * Windows doesn't have a condition variable solution. It's possible + * to create one, but it's easy to get it wrong. For a discussion, and + * the origin of this implementation, see: + * + * http://www.cs.wustl.edu/~schmidt/win32-cv-1.html + * + * The implementation shown on the page does NOT follow POSIX semantics. + * As an optimization they require acquiring the external mutex before + * calling signal() and broadcast(), whereas POSIX only requires grabbing + * it before calling wait(). The implementation here has been un-optimized + * to have the correct behavior. + */ +typedef struct WinCondition { + // Number of waiting threads. + int waitersCount; + + // Serialize access to waitersCount. + CRITICAL_SECTION waitersCountLock; + + // Semaphore used to queue up threads waiting for the condition to + // become signaled. + HANDLE sema; + + // An auto-reset event used by the broadcast/signal thread to wait + // for all the waiting thread(s) to wake up and be released from + // the semaphore. + HANDLE waitersDone; + + // This mutex wouldn't be necessary if we required that the caller + // lock the external mutex before calling signal() and broadcast(). + // I'm trying to mimic pthread semantics though. + HANDLE internalMutex; + + // Keeps track of whether we were broadcasting or signaling. This + // allows us to optimize the code if we're just signaling. + bool wasBroadcast; + + status_t wait(WinCondition* condState, HANDLE hMutex, nsecs_t* abstime) + { + // Increment the wait count, avoiding race conditions. + EnterCriticalSection(&condState->waitersCountLock); + condState->waitersCount++; + //printf("+++ wait: incr waitersCount to %d (tid=%ld)\n", + // condState->waitersCount, getThreadId()); + LeaveCriticalSection(&condState->waitersCountLock); + + DWORD timeout = INFINITE; + if (abstime) { + nsecs_t reltime = *abstime - systemTime(); + if (reltime < 0) + reltime = 0; + timeout = reltime/1000000; + } + + // Atomically release the external mutex and wait on the semaphore. + DWORD res = + SignalObjectAndWait(hMutex, condState->sema, timeout, FALSE); + + //printf("+++ wait: awake (tid=%ld)\n", getThreadId()); + + // Reacquire lock to avoid race conditions. + EnterCriticalSection(&condState->waitersCountLock); + + // No longer waiting. + condState->waitersCount--; + + // Check to see if we're the last waiter after a broadcast. + bool lastWaiter = (condState->wasBroadcast && condState->waitersCount == 0); + + //printf("+++ wait: lastWaiter=%d (wasBc=%d wc=%d)\n", + // lastWaiter, condState->wasBroadcast, condState->waitersCount); + + LeaveCriticalSection(&condState->waitersCountLock); + + // If we're the last waiter thread during this particular broadcast + // then signal broadcast() that we're all awake. It'll drop the + // internal mutex. + if (lastWaiter) { + // Atomically signal the "waitersDone" event and wait until we + // can acquire the internal mutex. We want to do this in one step + // because it ensures that everybody is in the mutex FIFO before + // any thread has a chance to run. Without it, another thread + // could wake up, do work, and hop back in ahead of us. + SignalObjectAndWait(condState->waitersDone, condState->internalMutex, + INFINITE, FALSE); + } else { + // Grab the internal mutex. + WaitForSingleObject(condState->internalMutex, INFINITE); + } + + // Release the internal and grab the external. + ReleaseMutex(condState->internalMutex); + WaitForSingleObject(hMutex, INFINITE); + + return res == WAIT_OBJECT_0 ? NO_ERROR : -1; + } +} WinCondition; + +/* + * Constructor. Set up the WinCondition stuff. + */ +Condition::Condition() +{ + WinCondition* condState = new WinCondition; + + condState->waitersCount = 0; + condState->wasBroadcast = false; + // semaphore: no security, initial value of 0 + condState->sema = CreateSemaphore(NULL, 0, 0x7fffffff, NULL); + InitializeCriticalSection(&condState->waitersCountLock); + // auto-reset event, not signaled initially + condState->waitersDone = CreateEvent(NULL, FALSE, FALSE, NULL); + // used so we don't have to lock external mutex on signal/broadcast + condState->internalMutex = CreateMutex(NULL, FALSE, NULL); + + mState = condState; +} + +/* + * Destructor. Free Windows resources as well as our allocated storage. + */ +Condition::~Condition() +{ + WinCondition* condState = (WinCondition*) mState; + if (condState != NULL) { + CloseHandle(condState->sema); + CloseHandle(condState->waitersDone); + delete condState; + } +} + + +status_t Condition::wait(Mutex& mutex) +{ + WinCondition* condState = (WinCondition*) mState; + HANDLE hMutex = (HANDLE) mutex.mState; + + return ((WinCondition*)mState)->wait(condState, hMutex, NULL); +} + +status_t Condition::waitRelative(Mutex& mutex, nsecs_t reltime) +{ + WinCondition* condState = (WinCondition*) mState; + HANDLE hMutex = (HANDLE) mutex.mState; + nsecs_t absTime = systemTime()+reltime; + + return ((WinCondition*)mState)->wait(condState, hMutex, &absTime); +} + +/* + * Signal the condition variable, allowing one thread to continue. + */ +void Condition::signal() +{ + WinCondition* condState = (WinCondition*) mState; + + // Lock the internal mutex. This ensures that we don't clash with + // broadcast(). + WaitForSingleObject(condState->internalMutex, INFINITE); + + EnterCriticalSection(&condState->waitersCountLock); + bool haveWaiters = (condState->waitersCount > 0); + LeaveCriticalSection(&condState->waitersCountLock); + + // If no waiters, then this is a no-op. Otherwise, knock the semaphore + // down a notch. + if (haveWaiters) + ReleaseSemaphore(condState->sema, 1, 0); + + // Release internal mutex. + ReleaseMutex(condState->internalMutex); +} + +/* + * Signal the condition variable, allowing all threads to continue. + * + * First we have to wake up all threads waiting on the semaphore, then + * we wait until all of the threads have actually been woken before + * releasing the internal mutex. This ensures that all threads are woken. + */ +void Condition::broadcast() +{ + WinCondition* condState = (WinCondition*) mState; + + // Lock the internal mutex. This keeps the guys we're waking up + // from getting too far. + WaitForSingleObject(condState->internalMutex, INFINITE); + + EnterCriticalSection(&condState->waitersCountLock); + bool haveWaiters = false; + + if (condState->waitersCount > 0) { + haveWaiters = true; + condState->wasBroadcast = true; + } + + if (haveWaiters) { + // Wake up all the waiters. + ReleaseSemaphore(condState->sema, condState->waitersCount, 0); + + LeaveCriticalSection(&condState->waitersCountLock); + + // Wait for all awakened threads to acquire the counting semaphore. + // The last guy who was waiting sets this. + WaitForSingleObject(condState->waitersDone, INFINITE); + + // Reset wasBroadcast. (No crit section needed because nobody + // else can wake up to poke at it.) + condState->wasBroadcast = 0; + } else { + // nothing to do + LeaveCriticalSection(&condState->waitersCountLock); + } + + // Release internal mutex. + ReleaseMutex(condState->internalMutex); +} + +#else +#error "condition variables not supported on this platform" +#endif + +// ---------------------------------------------------------------------------- + +/* + * This is our thread object! + */ + +Thread::Thread(bool canCallJava) + : mCanCallJava(canCallJava), + mThread(thread_id_t(-1)), + mLock("Thread::mLock"), + mStatus(NO_ERROR), + mExitPending(false), mRunning(false) +#ifdef HAVE_ANDROID_OS + , mTid(-1) +#endif +{ +} + +Thread::~Thread() +{ +} + +status_t Thread::readyToRun() +{ + return NO_ERROR; +} + +status_t Thread::run(const char* name, int32_t priority, size_t stack) +{ + Mutex::Autolock _l(mLock); + + if (mRunning) { + // thread already started + return INVALID_OPERATION; + } + + // reset status and exitPending to their default value, so we can + // try again after an error happened (either below, or in readyToRun()) + mStatus = NO_ERROR; + mExitPending = false; + mThread = thread_id_t(-1); + + // hold a strong reference on ourself + mHoldSelf = this; + + mRunning = true; + + bool res; + if (mCanCallJava) { + res = createThreadEtc(_threadLoop, + this, name, priority, stack, &mThread); + } else { + res = androidCreateRawThreadEtc(_threadLoop, + this, name, priority, stack, &mThread); + } + + if (res == false) { + mStatus = UNKNOWN_ERROR; // something happened! + mRunning = false; + mThread = thread_id_t(-1); + mHoldSelf.clear(); // "this" may have gone away after this. + + return UNKNOWN_ERROR; + } + + // Do not refer to mStatus here: The thread is already running (may, in fact + // already have exited with a valid mStatus result). The NO_ERROR indication + // here merely indicates successfully starting the thread and does not + // imply successful termination/execution. + return NO_ERROR; + + // Exiting scope of mLock is a memory barrier and allows new thread to run +} + +int Thread::_threadLoop(void* user) +{ + Thread* const self = static_cast(user); + + sp strong(self->mHoldSelf); + wp weak(strong); + self->mHoldSelf.clear(); + +#ifdef HAVE_ANDROID_OS + // this is very useful for debugging with gdb + self->mTid = gettid(); +#endif + + bool first = true; + + do { + bool result; + if (first) { + first = false; + self->mStatus = self->readyToRun(); + result = (self->mStatus == NO_ERROR); + + if (result && !self->exitPending()) { + // Binder threads (and maybe others) rely on threadLoop + // running at least once after a successful ::readyToRun() + // (unless, of course, the thread has already been asked to exit + // at that point). + // This is because threads are essentially used like this: + // (new ThreadSubclass())->run(); + // The caller therefore does not retain a strong reference to + // the thread and the thread would simply disappear after the + // successful ::readyToRun() call instead of entering the + // threadLoop at least once. + result = self->threadLoop(); + } + } else { + result = self->threadLoop(); + } + + // establish a scope for mLock + { + Mutex::Autolock _l(self->mLock); + if (result == false || self->mExitPending) { + self->mExitPending = true; + self->mRunning = false; + // clear thread ID so that requestExitAndWait() does not exit if + // called by a new thread using the same thread ID as this one. + self->mThread = thread_id_t(-1); + // note that interested observers blocked in requestExitAndWait are + // awoken by broadcast, but blocked on mLock until break exits scope + self->mThreadExitedCondition.broadcast(); + break; + } + } + + // Release our strong reference, to let a chance to the thread + // to die a peaceful death. + strong.clear(); + // And immediately, re-acquire a strong reference for the next loop + strong = weak.promote(); + } while(strong != 0); + + return 0; +} + +void Thread::requestExit() +{ + Mutex::Autolock _l(mLock); + mExitPending = true; +} + +status_t Thread::requestExitAndWait() +{ + Mutex::Autolock _l(mLock); + if (mThread == getThreadId()) { + ALOGW( + "Thread (this=%p): don't call waitForExit() from this " + "Thread object's thread. It's a guaranteed deadlock!", + this); + + return WOULD_BLOCK; + } + + mExitPending = true; + + while (mRunning == true) { + mThreadExitedCondition.wait(mLock); + } + // This next line is probably not needed any more, but is being left for + // historical reference. Note that each interested party will clear flag. + mExitPending = false; + + return mStatus; +} + +status_t Thread::join() +{ + Mutex::Autolock _l(mLock); + if (mThread == getThreadId()) { + ALOGW( + "Thread (this=%p): don't call join() from this " + "Thread object's thread. It's a guaranteed deadlock!", + this); + + return WOULD_BLOCK; + } + + while (mRunning == true) { + mThreadExitedCondition.wait(mLock); + } + + return mStatus; +} + +#ifdef HAVE_ANDROID_OS +pid_t Thread::getTid() const +{ + // mTid is not defined until the child initializes it, and the caller may need it earlier + Mutex::Autolock _l(mLock); + pid_t tid; + if (mRunning) { + pthread_t pthread = android_thread_id_t_to_pthread(mThread); + tid = __pthread_gettid(pthread); + } else { + ALOGW("Thread (this=%p): getTid() is undefined before run()", this); + tid = -1; + } + return tid; +} +#endif + +bool Thread::exitPending() const +{ + Mutex::Autolock _l(mLock); + return mExitPending; +} + + + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Timers.cpp android-platform-frameworks-native-21/libs/utils/Timers.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Timers.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Timers.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,133 @@ +/* + * Copyright (C) 2005 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. + */ + +// +// Timer functions. +// +#include +#include + +#include +#include +#include +#include +#include +#include +#include + +#ifdef HAVE_WIN32_THREADS +#include +#endif + +nsecs_t systemTime(int clock) +{ +#if defined(HAVE_POSIX_CLOCKS) + static const clockid_t clocks[] = { + CLOCK_REALTIME, + CLOCK_MONOTONIC, + CLOCK_PROCESS_CPUTIME_ID, + CLOCK_THREAD_CPUTIME_ID + }; + struct timespec t; + t.tv_sec = t.tv_nsec = 0; + clock_gettime(clocks[clock], &t); + return nsecs_t(t.tv_sec)*1000000000LL + t.tv_nsec; +#else + // we don't support the clocks here. + struct timeval t; + t.tv_sec = t.tv_usec = 0; + gettimeofday(&t, NULL); + return nsecs_t(t.tv_sec)*1000000000LL + nsecs_t(t.tv_usec)*1000LL; +#endif +} + +int toMillisecondTimeoutDelay(nsecs_t referenceTime, nsecs_t timeoutTime) +{ + int timeoutDelayMillis; + if (timeoutTime > referenceTime) { + uint64_t timeoutDelay = uint64_t(timeoutTime - referenceTime); + if (timeoutDelay > uint64_t((INT_MAX - 1) * 1000000LL)) { + timeoutDelayMillis = -1; + } else { + timeoutDelayMillis = (timeoutDelay + 999999LL) / 1000000LL; + } + } else { + timeoutDelayMillis = 0; + } + return timeoutDelayMillis; +} + + +/* + * =========================================================================== + * DurationTimer + * =========================================================================== + */ + +using namespace android; + +// Start the timer. +void DurationTimer::start(void) +{ + gettimeofday(&mStartWhen, NULL); +} + +// Stop the timer. +void DurationTimer::stop(void) +{ + gettimeofday(&mStopWhen, NULL); +} + +// Get the duration in microseconds. +long long DurationTimer::durationUsecs(void) const +{ + return (long) subtractTimevals(&mStopWhen, &mStartWhen); +} + +// Subtract two timevals. Returns the difference (ptv1-ptv2) in +// microseconds. +/*static*/ long long DurationTimer::subtractTimevals(const struct timeval* ptv1, + const struct timeval* ptv2) +{ + long long stop = ((long long) ptv1->tv_sec) * 1000000LL + + ((long long) ptv1->tv_usec); + long long start = ((long long) ptv2->tv_sec) * 1000000LL + + ((long long) ptv2->tv_usec); + return stop - start; +} + +// Add the specified amount of time to the timeval. +/*static*/ void DurationTimer::addToTimeval(struct timeval* ptv, long usec) +{ + if (usec < 0) { + ALOG(LOG_WARN, "", "Negative values not supported in addToTimeval\n"); + return; + } + + // normalize tv_usec if necessary + if (ptv->tv_usec >= 1000000) { + ptv->tv_sec += ptv->tv_usec / 1000000; + ptv->tv_usec %= 1000000; + } + + ptv->tv_usec += usec % 1000000; + if (ptv->tv_usec >= 1000000) { + ptv->tv_usec -= 1000000; + ptv->tv_sec++; + } + ptv->tv_sec += usec / 1000000; +} + diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Tokenizer.cpp android-platform-frameworks-native-21/libs/utils/Tokenizer.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Tokenizer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Tokenizer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,175 @@ +/* + * Copyright (C) 2010 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. + */ + +#define LOG_TAG "Tokenizer" + +#include +#include +#include +#include +#include +#include +#include +#include + +// Enables debug output for the tokenizer. +#define DEBUG_TOKENIZER 0 + + +namespace android { + +static inline bool isDelimiter(char ch, const char* delimiters) { + return strchr(delimiters, ch) != NULL; +} + +Tokenizer::Tokenizer(const String8& filename, FileMap* fileMap, char* buffer, + bool ownBuffer, size_t length) : + mFilename(filename), mFileMap(fileMap), + mBuffer(buffer), mOwnBuffer(ownBuffer), mLength(length), + mCurrent(buffer), mLineNumber(1) { +} + +Tokenizer::~Tokenizer() { + if (mFileMap) { + mFileMap->release(); + } + if (mOwnBuffer) { + delete[] mBuffer; + } +} + +status_t Tokenizer::open(const String8& filename, Tokenizer** outTokenizer) { + *outTokenizer = NULL; + + int result = NO_ERROR; + int fd = ::open(filename.string(), O_RDONLY); + if (fd < 0) { + result = -errno; + ALOGE("Error opening file '%s', %s.", filename.string(), strerror(errno)); + } else { + struct stat stat; + if (fstat(fd, &stat)) { + result = -errno; + ALOGE("Error getting size of file '%s', %s.", filename.string(), strerror(errno)); + } else { + size_t length = size_t(stat.st_size); + + FileMap* fileMap = new FileMap(); + bool ownBuffer = false; + char* buffer; + if (fileMap->create(NULL, fd, 0, length, true)) { + fileMap->advise(FileMap::SEQUENTIAL); + buffer = static_cast(fileMap->getDataPtr()); + } else { + fileMap->release(); + fileMap = NULL; + + // Fall back to reading into a buffer since we can't mmap files in sysfs. + // The length we obtained from stat is wrong too (it will always be 4096) + // so we must trust that read will read the entire file. + buffer = new char[length]; + ownBuffer = true; + ssize_t nrd = read(fd, buffer, length); + if (nrd < 0) { + result = -errno; + ALOGE("Error reading file '%s', %s.", filename.string(), strerror(errno)); + delete[] buffer; + buffer = NULL; + } else { + length = size_t(nrd); + } + } + + if (!result) { + *outTokenizer = new Tokenizer(filename, fileMap, buffer, ownBuffer, length); + } + } + close(fd); + } + return result; +} + +status_t Tokenizer::fromContents(const String8& filename, + const char* contents, Tokenizer** outTokenizer) { + *outTokenizer = new Tokenizer(filename, NULL, + const_cast(contents), false, strlen(contents)); + return OK; +} + +String8 Tokenizer::getLocation() const { + String8 result; + result.appendFormat("%s:%d", mFilename.string(), mLineNumber); + return result; +} + +String8 Tokenizer::peekRemainderOfLine() const { + const char* end = getEnd(); + const char* eol = mCurrent; + while (eol != end) { + char ch = *eol; + if (ch == '\n') { + break; + } + eol += 1; + } + return String8(mCurrent, eol - mCurrent); +} + +String8 Tokenizer::nextToken(const char* delimiters) { +#if DEBUG_TOKENIZER + ALOGD("nextToken"); +#endif + const char* end = getEnd(); + const char* tokenStart = mCurrent; + while (mCurrent != end) { + char ch = *mCurrent; + if (ch == '\n' || isDelimiter(ch, delimiters)) { + break; + } + mCurrent += 1; + } + return String8(tokenStart, mCurrent - tokenStart); +} + +void Tokenizer::nextLine() { +#if DEBUG_TOKENIZER + ALOGD("nextLine"); +#endif + const char* end = getEnd(); + while (mCurrent != end) { + char ch = *(mCurrent++); + if (ch == '\n') { + mLineNumber += 1; + break; + } + } +} + +void Tokenizer::skipDelimiters(const char* delimiters) { +#if DEBUG_TOKENIZER + ALOGD("skipDelimiters"); +#endif + const char* end = getEnd(); + while (mCurrent != end) { + char ch = *mCurrent; + if (ch == '\n' || !isDelimiter(ch, delimiters)) { + break; + } + mCurrent += 1; + } +} + +} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Trace.cpp android-platform-frameworks-native-21/libs/utils/Trace.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Trace.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Trace.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * Copyright (C) 2012 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. + */ + +#define LOG_TAG "Trace" + +#include +#include +#include +#include + +namespace android { + +volatile int32_t Tracer::sIsReady = 0; +int Tracer::sTraceFD = -1; +uint64_t Tracer::sEnabledTags = 0; +Mutex Tracer::sMutex; + +void Tracer::changeCallback() { + Mutex::Autolock lock(sMutex); + if (sIsReady && sTraceFD >= 0) { + loadSystemProperty(); + } +} + +void Tracer::init() { + Mutex::Autolock lock(sMutex); + + if (!sIsReady) { + add_sysprop_change_callback(changeCallback, 0); + + const char* const traceFileName = + "/sys/kernel/debug/tracing/trace_marker"; + sTraceFD = open(traceFileName, O_WRONLY); + if (sTraceFD == -1) { + ALOGE("error opening trace file: %s (%d)", strerror(errno), errno); + // sEnabledTags remains zero indicating that no tracing can occur + } else { + loadSystemProperty(); + } + + android_atomic_release_store(1, &sIsReady); + } +} + +void Tracer::loadSystemProperty() { + char value[PROPERTY_VALUE_MAX]; + property_get("debug.atrace.tags.enableflags", value, "0"); + sEnabledTags = (strtoll(value, NULL, 0) & ATRACE_TAG_VALID_MASK) + | ATRACE_TAG_ALWAYS; +} + +} // namespace andoid diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/Unicode.cpp android-platform-frameworks-native-21/libs/utils/Unicode.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/Unicode.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/Unicode.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,576 @@ +/* + * Copyright (C) 2005 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 + +#include + +#ifdef HAVE_WINSOCK +# undef nhtol +# undef htonl +# undef nhtos +# undef htons + +# ifdef HAVE_LITTLE_ENDIAN +# define ntohl(x) ( ((x) << 24) | (((x) >> 24) & 255) | (((x) << 8) & 0xff0000) | (((x) >> 8) & 0xff00) ) +# define htonl(x) ntohl(x) +# define ntohs(x) ( (((x) << 8) & 0xff00) | (((x) >> 8) & 255) ) +# define htons(x) ntohs(x) +# else +# define ntohl(x) (x) +# define htonl(x) (x) +# define ntohs(x) (x) +# define htons(x) (x) +# endif +#else +# include +#endif + +extern "C" { + +static const char32_t kByteMask = 0x000000BF; +static const char32_t kByteMark = 0x00000080; + +// Surrogates aren't valid for UTF-32 characters, so define some +// constants that will let us screen them out. +static const char32_t kUnicodeSurrogateHighStart = 0x0000D800; +static const char32_t kUnicodeSurrogateHighEnd = 0x0000DBFF; +static const char32_t kUnicodeSurrogateLowStart = 0x0000DC00; +static const char32_t kUnicodeSurrogateLowEnd = 0x0000DFFF; +static const char32_t kUnicodeSurrogateStart = kUnicodeSurrogateHighStart; +static const char32_t kUnicodeSurrogateEnd = kUnicodeSurrogateLowEnd; +static const char32_t kUnicodeMaxCodepoint = 0x0010FFFF; + +// Mask used to set appropriate bits in first byte of UTF-8 sequence, +// indexed by number of bytes in the sequence. +// 0xxxxxxx +// -> (00-7f) 7bit. Bit mask for the first byte is 0x00000000 +// 110yyyyx 10xxxxxx +// -> (c0-df)(80-bf) 11bit. Bit mask is 0x000000C0 +// 1110yyyy 10yxxxxx 10xxxxxx +// -> (e0-ef)(80-bf)(80-bf) 16bit. Bit mask is 0x000000E0 +// 11110yyy 10yyxxxx 10xxxxxx 10xxxxxx +// -> (f0-f7)(80-bf)(80-bf)(80-bf) 21bit. Bit mask is 0x000000F0 +static const char32_t kFirstByteMark[] = { + 0x00000000, 0x00000000, 0x000000C0, 0x000000E0, 0x000000F0 +}; + +// -------------------------------------------------------------------------- +// UTF-32 +// -------------------------------------------------------------------------- + +/** + * Return number of UTF-8 bytes required for the character. If the character + * is invalid, return size of 0. + */ +static inline size_t utf32_codepoint_utf8_length(char32_t srcChar) +{ + // Figure out how many bytes the result will require. + if (srcChar < 0x00000080) { + return 1; + } else if (srcChar < 0x00000800) { + return 2; + } else if (srcChar < 0x00010000) { + if ((srcChar < kUnicodeSurrogateStart) || (srcChar > kUnicodeSurrogateEnd)) { + return 3; + } else { + // Surrogates are invalid UTF-32 characters. + return 0; + } + } + // Max code point for Unicode is 0x0010FFFF. + else if (srcChar <= kUnicodeMaxCodepoint) { + return 4; + } else { + // Invalid UTF-32 character. + return 0; + } +} + +// Write out the source character to . + +static inline void utf32_codepoint_to_utf8(uint8_t* dstP, char32_t srcChar, size_t bytes) +{ + dstP += bytes; + switch (bytes) + { /* note: everything falls through. */ + case 4: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; + case 3: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; + case 2: *--dstP = (uint8_t)((srcChar | kByteMark) & kByteMask); srcChar >>= 6; + case 1: *--dstP = (uint8_t)(srcChar | kFirstByteMark[bytes]); + } +} + +size_t strlen32(const char32_t *s) +{ + const char32_t *ss = s; + while ( *ss ) + ss++; + return ss-s; +} + +size_t strnlen32(const char32_t *s, size_t maxlen) +{ + const char32_t *ss = s; + while ((maxlen > 0) && *ss) { + ss++; + maxlen--; + } + return ss-s; +} + +static inline int32_t utf32_at_internal(const char* cur, size_t *num_read) +{ + const char first_char = *cur; + if ((first_char & 0x80) == 0) { // ASCII + *num_read = 1; + return *cur; + } + cur++; + char32_t mask, to_ignore_mask; + size_t num_to_read = 0; + char32_t utf32 = first_char; + for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0xFFFFFF80; + (first_char & mask); + num_to_read++, to_ignore_mask |= mask, mask >>= 1) { + // 0x3F == 00111111 + utf32 = (utf32 << 6) + (*cur++ & 0x3F); + } + to_ignore_mask |= mask; + utf32 &= ~(to_ignore_mask << (6 * (num_to_read - 1))); + + *num_read = num_to_read; + return static_cast(utf32); +} + +int32_t utf32_from_utf8_at(const char *src, size_t src_len, size_t index, size_t *next_index) +{ + if (index >= src_len) { + return -1; + } + size_t dummy_index; + if (next_index == NULL) { + next_index = &dummy_index; + } + size_t num_read; + int32_t ret = utf32_at_internal(src + index, &num_read); + if (ret >= 0) { + *next_index = index + num_read; + } + + return ret; +} + +ssize_t utf32_to_utf8_length(const char32_t *src, size_t src_len) +{ + if (src == NULL || src_len == 0) { + return -1; + } + + size_t ret = 0; + const char32_t *end = src + src_len; + while (src < end) { + ret += utf32_codepoint_utf8_length(*src++); + } + return ret; +} + +void utf32_to_utf8(const char32_t* src, size_t src_len, char* dst) +{ + if (src == NULL || src_len == 0 || dst == NULL) { + return; + } + + const char32_t *cur_utf32 = src; + const char32_t *end_utf32 = src + src_len; + char *cur = dst; + while (cur_utf32 < end_utf32) { + size_t len = utf32_codepoint_utf8_length(*cur_utf32); + utf32_codepoint_to_utf8((uint8_t *)cur, *cur_utf32++, len); + cur += len; + } + *cur = '\0'; +} + +// -------------------------------------------------------------------------- +// UTF-16 +// -------------------------------------------------------------------------- + +int strcmp16(const char16_t *s1, const char16_t *s2) +{ + char16_t ch; + int d = 0; + + while ( 1 ) { + d = (int)(ch = *s1++) - (int)*s2++; + if ( d || !ch ) + break; + } + + return d; +} + +int strncmp16(const char16_t *s1, const char16_t *s2, size_t n) +{ + char16_t ch; + int d = 0; + + while ( n-- ) { + d = (int)(ch = *s1++) - (int)*s2++; + if ( d || !ch ) + break; + } + + return d; +} + +char16_t *strcpy16(char16_t *dst, const char16_t *src) +{ + char16_t *q = dst; + const char16_t *p = src; + char16_t ch; + + do { + *q++ = ch = *p++; + } while ( ch ); + + return dst; +} + +size_t strlen16(const char16_t *s) +{ + const char16_t *ss = s; + while ( *ss ) + ss++; + return ss-s; +} + + +char16_t *strncpy16(char16_t *dst, const char16_t *src, size_t n) +{ + char16_t *q = dst; + const char16_t *p = src; + char ch; + + while (n) { + n--; + *q++ = ch = *p++; + if ( !ch ) + break; + } + + *q = 0; + + return dst; +} + +size_t strnlen16(const char16_t *s, size_t maxlen) +{ + const char16_t *ss = s; + + /* Important: the maxlen test must precede the reference through ss; + since the byte beyond the maximum may segfault */ + while ((maxlen > 0) && *ss) { + ss++; + maxlen--; + } + return ss-s; +} + +int strzcmp16(const char16_t *s1, size_t n1, const char16_t *s2, size_t n2) +{ + const char16_t* e1 = s1+n1; + const char16_t* e2 = s2+n2; + + while (s1 < e1 && s2 < e2) { + const int d = (int)*s1++ - (int)*s2++; + if (d) { + return d; + } + } + + return n1 < n2 + ? (0 - (int)*s2) + : (n1 > n2 + ? ((int)*s1 - 0) + : 0); +} + +int strzcmp16_h_n(const char16_t *s1H, size_t n1, const char16_t *s2N, size_t n2) +{ + const char16_t* e1 = s1H+n1; + const char16_t* e2 = s2N+n2; + + while (s1H < e1 && s2N < e2) { + const char16_t c2 = ntohs(*s2N); + const int d = (int)*s1H++ - (int)c2; + s2N++; + if (d) { + return d; + } + } + + return n1 < n2 + ? (0 - (int)ntohs(*s2N)) + : (n1 > n2 + ? ((int)*s1H - 0) + : 0); +} + +void utf16_to_utf8(const char16_t* src, size_t src_len, char* dst) +{ + if (src == NULL || src_len == 0 || dst == NULL) { + return; + } + + const char16_t* cur_utf16 = src; + const char16_t* const end_utf16 = src + src_len; + char *cur = dst; + while (cur_utf16 < end_utf16) { + char32_t utf32; + // surrogate pairs + if ((*cur_utf16 & 0xFC00) == 0xD800) { + utf32 = (*cur_utf16++ - 0xD800) << 10; + utf32 |= *cur_utf16++ - 0xDC00; + utf32 += 0x10000; + } else { + utf32 = (char32_t) *cur_utf16++; + } + const size_t len = utf32_codepoint_utf8_length(utf32); + utf32_codepoint_to_utf8((uint8_t*)cur, utf32, len); + cur += len; + } + *cur = '\0'; +} + +// -------------------------------------------------------------------------- +// UTF-8 +// -------------------------------------------------------------------------- + +ssize_t utf8_length(const char *src) +{ + const char *cur = src; + size_t ret = 0; + while (*cur != '\0') { + const char first_char = *cur++; + if ((first_char & 0x80) == 0) { // ASCII + ret += 1; + continue; + } + // (UTF-8's character must not be like 10xxxxxx, + // but 110xxxxx, 1110xxxx, ... or 1111110x) + if ((first_char & 0x40) == 0) { + return -1; + } + + int32_t mask, to_ignore_mask; + size_t num_to_read = 0; + char32_t utf32 = 0; + for (num_to_read = 1, mask = 0x40, to_ignore_mask = 0x80; + num_to_read < 5 && (first_char & mask); + num_to_read++, to_ignore_mask |= mask, mask >>= 1) { + if ((*cur & 0xC0) != 0x80) { // must be 10xxxxxx + return -1; + } + // 0x3F == 00111111 + utf32 = (utf32 << 6) + (*cur++ & 0x3F); + } + // "first_char" must be (110xxxxx - 11110xxx) + if (num_to_read == 5) { + return -1; + } + to_ignore_mask |= mask; + utf32 |= ((~to_ignore_mask) & first_char) << (6 * (num_to_read - 1)); + if (utf32 > kUnicodeMaxCodepoint) { + return -1; + } + + ret += num_to_read; + } + return ret; +} + +ssize_t utf16_to_utf8_length(const char16_t *src, size_t src_len) +{ + if (src == NULL || src_len == 0) { + return -1; + } + + size_t ret = 0; + const char16_t* const end = src + src_len; + while (src < end) { + if ((*src & 0xFC00) == 0xD800 && (src + 1) < end + && (*++src & 0xFC00) == 0xDC00) { + // surrogate pairs are always 4 bytes. + ret += 4; + src++; + } else { + ret += utf32_codepoint_utf8_length((char32_t) *src++); + } + } + return ret; +} + +/** + * Returns 1-4 based on the number of leading bits. + * + * 1111 -> 4 + * 1110 -> 3 + * 110x -> 2 + * 10xx -> 1 + * 0xxx -> 1 + */ +static inline size_t utf8_codepoint_len(uint8_t ch) +{ + return ((0xe5000000 >> ((ch >> 3) & 0x1e)) & 3) + 1; +} + +static inline void utf8_shift_and_mask(uint32_t* codePoint, const uint8_t byte) +{ + *codePoint <<= 6; + *codePoint |= 0x3F & byte; +} + +size_t utf8_to_utf32_length(const char *src, size_t src_len) +{ + if (src == NULL || src_len == 0) { + return 0; + } + size_t ret = 0; + const char* cur; + const char* end; + size_t num_to_skip; + for (cur = src, end = src + src_len, num_to_skip = 1; + cur < end; + cur += num_to_skip, ret++) { + const char first_char = *cur; + num_to_skip = 1; + if ((first_char & 0x80) == 0) { // ASCII + continue; + } + int32_t mask; + + for (mask = 0x40; (first_char & mask); num_to_skip++, mask >>= 1) { + } + } + return ret; +} + +void utf8_to_utf32(const char* src, size_t src_len, char32_t* dst) +{ + if (src == NULL || src_len == 0 || dst == NULL) { + return; + } + + const char* cur = src; + const char* const end = src + src_len; + char32_t* cur_utf32 = dst; + while (cur < end) { + size_t num_read; + *cur_utf32++ = static_cast(utf32_at_internal(cur, &num_read)); + cur += num_read; + } + *cur_utf32 = 0; +} + +static inline uint32_t utf8_to_utf32_codepoint(const uint8_t *src, size_t length) +{ + uint32_t unicode; + + switch (length) + { + case 1: + return src[0]; + case 2: + unicode = src[0] & 0x1f; + utf8_shift_and_mask(&unicode, src[1]); + return unicode; + case 3: + unicode = src[0] & 0x0f; + utf8_shift_and_mask(&unicode, src[1]); + utf8_shift_and_mask(&unicode, src[2]); + return unicode; + case 4: + unicode = src[0] & 0x07; + utf8_shift_and_mask(&unicode, src[1]); + utf8_shift_and_mask(&unicode, src[2]); + utf8_shift_and_mask(&unicode, src[3]); + return unicode; + default: + return 0xffff; + } + + //printf("Char at %p: len=%d, utf-16=%p\n", src, length, (void*)result); +} + +ssize_t utf8_to_utf16_length(const uint8_t* u8str, size_t u8len) +{ + const uint8_t* const u8end = u8str + u8len; + const uint8_t* u8cur = u8str; + + /* Validate that the UTF-8 is the correct len */ + size_t u16measuredLen = 0; + while (u8cur < u8end) { + u16measuredLen++; + int u8charLen = utf8_codepoint_len(*u8cur); + uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8charLen); + if (codepoint > 0xFFFF) u16measuredLen++; // this will be a surrogate pair in utf16 + u8cur += u8charLen; + } + + /** + * Make sure that we ended where we thought we would and the output UTF-16 + * will be exactly how long we were told it would be. + */ + if (u8cur != u8end) { + return -1; + } + + return u16measuredLen; +} + +char16_t* utf8_to_utf16_no_null_terminator(const uint8_t* u8str, size_t u8len, char16_t* u16str) +{ + const uint8_t* const u8end = u8str + u8len; + const uint8_t* u8cur = u8str; + char16_t* u16cur = u16str; + + while (u8cur < u8end) { + size_t u8len = utf8_codepoint_len(*u8cur); + uint32_t codepoint = utf8_to_utf32_codepoint(u8cur, u8len); + + // Convert the UTF32 codepoint to one or more UTF16 codepoints + if (codepoint <= 0xFFFF) { + // Single UTF16 character + *u16cur++ = (char16_t) codepoint; + } else { + // Multiple UTF16 characters with surrogates + codepoint = codepoint - 0x10000; + *u16cur++ = (char16_t) ((codepoint >> 10) + 0xD800); + *u16cur++ = (char16_t) ((codepoint & 0x3FF) + 0xDC00); + } + + u8cur += u8len; + } + return u16cur; +} + +void utf8_to_utf16(const uint8_t* u8str, size_t u8len, char16_t* u16str) { + char16_t* end = utf8_to_utf16_no_null_terminator(u8str, u8len, u16str); + *end = 0; +} + +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/VectorImpl.cpp android-platform-frameworks-native-21/libs/utils/VectorImpl.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/VectorImpl.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/VectorImpl.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,624 @@ +/* + * Copyright (C) 2005 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. + */ + +#define LOG_TAG "Vector" + +#include +#include +#include + +#include +#include +#include +#include + +/*****************************************************************************/ + + +namespace android { + +// ---------------------------------------------------------------------------- + +const size_t kMinVectorCapacity = 4; + +static inline size_t max(size_t a, size_t b) { + return a>b ? a : b; +} + +// ---------------------------------------------------------------------------- + +VectorImpl::VectorImpl(size_t itemSize, uint32_t flags) + : mStorage(0), mCount(0), mFlags(flags), mItemSize(itemSize) +{ +} + +VectorImpl::VectorImpl(const VectorImpl& rhs) + : mStorage(rhs.mStorage), mCount(rhs.mCount), + mFlags(rhs.mFlags), mItemSize(rhs.mItemSize) +{ + if (mStorage) { + SharedBuffer::sharedBuffer(mStorage)->acquire(); + } +} + +VectorImpl::~VectorImpl() +{ + ALOG_ASSERT(!mCount, + "[%p] " + "subclasses of VectorImpl must call finish_vector()" + " in their destructor. Leaking %d bytes.", + this, (int)(mCount*mItemSize)); + // We can't call _do_destroy() here because the vtable is already gone. +} + +VectorImpl& VectorImpl::operator = (const VectorImpl& rhs) +{ + ALOG_ASSERT(mItemSize == rhs.mItemSize, + "Vector<> have different types (this=%p, rhs=%p)", this, &rhs); + if (this != &rhs) { + release_storage(); + if (rhs.mCount) { + mStorage = rhs.mStorage; + mCount = rhs.mCount; + SharedBuffer::sharedBuffer(mStorage)->acquire(); + } else { + mStorage = 0; + mCount = 0; + } + } + return *this; +} + +void* VectorImpl::editArrayImpl() +{ + if (mStorage) { + SharedBuffer* sb = SharedBuffer::sharedBuffer(mStorage)->attemptEdit(); + if (sb == 0) { + sb = SharedBuffer::alloc(capacity() * mItemSize); + if (sb) { + _do_copy(sb->data(), mStorage, mCount); + release_storage(); + mStorage = sb->data(); + } + } + } + return mStorage; +} + +size_t VectorImpl::capacity() const +{ + if (mStorage) { + return SharedBuffer::sharedBuffer(mStorage)->size() / mItemSize; + } + return 0; +} + +ssize_t VectorImpl::insertVectorAt(const VectorImpl& vector, size_t index) +{ + return insertArrayAt(vector.arrayImpl(), index, vector.size()); +} + +ssize_t VectorImpl::appendVector(const VectorImpl& vector) +{ + return insertVectorAt(vector, size()); +} + +ssize_t VectorImpl::insertArrayAt(const void* array, size_t index, size_t length) +{ + if (index > size()) + return BAD_INDEX; + void* where = _grow(index, length); + if (where) { + _do_copy(where, array, length); + } + return where ? index : (ssize_t)NO_MEMORY; +} + +ssize_t VectorImpl::appendArray(const void* array, size_t length) +{ + return insertArrayAt(array, size(), length); +} + +ssize_t VectorImpl::insertAt(size_t index, size_t numItems) +{ + return insertAt(0, index, numItems); +} + +ssize_t VectorImpl::insertAt(const void* item, size_t index, size_t numItems) +{ + if (index > size()) + return BAD_INDEX; + void* where = _grow(index, numItems); + if (where) { + if (item) { + _do_splat(where, item, numItems); + } else { + _do_construct(where, numItems); + } + } + return where ? index : (ssize_t)NO_MEMORY; +} + +static int sortProxy(const void* lhs, const void* rhs, void* func) +{ + return (*(VectorImpl::compar_t)func)(lhs, rhs); +} + +status_t VectorImpl::sort(VectorImpl::compar_t cmp) +{ + return sort(sortProxy, (void*)cmp); +} + +status_t VectorImpl::sort(VectorImpl::compar_r_t cmp, void* state) +{ + // the sort must be stable. we're using insertion sort which + // is well suited for small and already sorted arrays + // for big arrays, it could be better to use mergesort + const ssize_t count = size(); + if (count > 1) { + void* array = const_cast(arrayImpl()); + void* temp = 0; + ssize_t i = 1; + while (i < count) { + void* item = reinterpret_cast(array) + mItemSize*(i); + void* curr = reinterpret_cast(array) + mItemSize*(i-1); + if (cmp(curr, item, state) > 0) { + + if (!temp) { + // we're going to have to modify the array... + array = editArrayImpl(); + if (!array) return NO_MEMORY; + temp = malloc(mItemSize); + if (!temp) return NO_MEMORY; + item = reinterpret_cast(array) + mItemSize*(i); + curr = reinterpret_cast(array) + mItemSize*(i-1); + } else { + _do_destroy(temp, 1); + } + + _do_copy(temp, item, 1); + + ssize_t j = i-1; + void* next = reinterpret_cast(array) + mItemSize*(i); + do { + _do_destroy(next, 1); + _do_copy(next, curr, 1); + next = curr; + --j; + curr = reinterpret_cast(array) + mItemSize*(j); + } while (j>=0 && (cmp(curr, temp, state) > 0)); + + _do_destroy(next, 1); + _do_copy(next, temp, 1); + } + i++; + } + + if (temp) { + _do_destroy(temp, 1); + free(temp); + } + } + return NO_ERROR; +} + +void VectorImpl::pop() +{ + if (size()) + removeItemsAt(size()-1, 1); +} + +void VectorImpl::push() +{ + push(0); +} + +void VectorImpl::push(const void* item) +{ + insertAt(item, size()); +} + +ssize_t VectorImpl::add() +{ + return add(0); +} + +ssize_t VectorImpl::add(const void* item) +{ + return insertAt(item, size()); +} + +ssize_t VectorImpl::replaceAt(size_t index) +{ + return replaceAt(0, index); +} + +ssize_t VectorImpl::replaceAt(const void* prototype, size_t index) +{ + ALOG_ASSERT(index size()) + return BAD_VALUE; + _shrink(index, count); + return index; +} + +void VectorImpl::finish_vector() +{ + release_storage(); + mStorage = 0; + mCount = 0; +} + +void VectorImpl::clear() +{ + _shrink(0, mCount); +} + +void* VectorImpl::editItemLocation(size_t index) +{ + ALOG_ASSERT(index(buffer) + index*mItemSize; + return 0; +} + +const void* VectorImpl::itemLocation(size_t index) const +{ + ALOG_ASSERT(index(buffer) + index*mItemSize; + return 0; +} + +ssize_t VectorImpl::setCapacity(size_t new_capacity) +{ + size_t current_capacity = capacity(); + ssize_t amount = new_capacity - size(); + if (amount <= 0) { + // we can't reduce the capacity + return current_capacity; + } + SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize); + if (sb) { + void* array = sb->data(); + _do_copy(array, mStorage, size()); + release_storage(); + mStorage = const_cast(array); + } else { + return NO_MEMORY; + } + return new_capacity; +} + +void VectorImpl::release_storage() +{ + if (mStorage) { + const SharedBuffer* sb = SharedBuffer::sharedBuffer(mStorage); + if (sb->release(SharedBuffer::eKeepStorage) == 1) { + _do_destroy(mStorage, mCount); + SharedBuffer::dealloc(sb); + } + } +} + +void* VectorImpl::_grow(size_t where, size_t amount) +{ +// ALOGV("_grow(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// this, (int)where, (int)amount, (int)mCount, (int)capacity()); + + ALOG_ASSERT(where <= mCount, + "[%p] _grow: where=%d, amount=%d, count=%d", + this, (int)where, (int)amount, (int)mCount); // caller already checked + + const size_t new_size = mCount + amount; + if (capacity() < new_size) { + const size_t new_capacity = max(kMinVectorCapacity, ((new_size*3)+1)/2); +// ALOGV("grow vector %p, new_capacity=%d", this, (int)new_capacity); + if ((mStorage) && + (mCount==where) && + (mFlags & HAS_TRIVIAL_COPY) && + (mFlags & HAS_TRIVIAL_DTOR)) + { + const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage); + SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize); + mStorage = sb->data(); + } else { + SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize); + if (sb) { + void* array = sb->data(); + if (where != 0) { + _do_copy(array, mStorage, where); + } + if (where != mCount) { + const void* from = reinterpret_cast(mStorage) + where*mItemSize; + void* dest = reinterpret_cast(array) + (where+amount)*mItemSize; + _do_copy(dest, from, mCount-where); + } + release_storage(); + mStorage = const_cast(array); + } + } + } else { + void* array = editArrayImpl(); + if (where != mCount) { + const void* from = reinterpret_cast(array) + where*mItemSize; + void* to = reinterpret_cast(array) + (where+amount)*mItemSize; + _do_move_forward(to, from, mCount - where); + } + } + mCount = new_size; + void* free_space = const_cast(itemLocation(where)); + return free_space; +} + +void VectorImpl::_shrink(size_t where, size_t amount) +{ + if (!mStorage) + return; + +// ALOGV("_shrink(this=%p, where=%d, amount=%d) count=%d, capacity=%d", +// this, (int)where, (int)amount, (int)mCount, (int)capacity()); + + ALOG_ASSERT(where + amount <= mCount, + "[%p] _shrink: where=%d, amount=%d, count=%d", + this, (int)where, (int)amount, (int)mCount); // caller already checked + + const size_t new_size = mCount - amount; + if (new_size*3 < capacity()) { + const size_t new_capacity = max(kMinVectorCapacity, new_size*2); +// ALOGV("shrink vector %p, new_capacity=%d", this, (int)new_capacity); + if ((where == new_size) && + (mFlags & HAS_TRIVIAL_COPY) && + (mFlags & HAS_TRIVIAL_DTOR)) + { + const SharedBuffer* cur_sb = SharedBuffer::sharedBuffer(mStorage); + SharedBuffer* sb = cur_sb->editResize(new_capacity * mItemSize); + mStorage = sb->data(); + } else { + SharedBuffer* sb = SharedBuffer::alloc(new_capacity * mItemSize); + if (sb) { + void* array = sb->data(); + if (where != 0) { + _do_copy(array, mStorage, where); + } + if (where != new_size) { + const void* from = reinterpret_cast(mStorage) + (where+amount)*mItemSize; + void* dest = reinterpret_cast(array) + where*mItemSize; + _do_copy(dest, from, new_size - where); + } + release_storage(); + mStorage = const_cast(array); + } + } + } else { + void* array = editArrayImpl(); + void* to = reinterpret_cast(array) + where*mItemSize; + _do_destroy(to, amount); + if (where != new_size) { + const void* from = reinterpret_cast(array) + (where+amount)*mItemSize; + _do_move_backward(to, from, new_size - where); + } + } + mCount = new_size; +} + +size_t VectorImpl::itemSize() const { + return mItemSize; +} + +void VectorImpl::_do_construct(void* storage, size_t num) const +{ + if (!(mFlags & HAS_TRIVIAL_CTOR)) { + do_construct(storage, num); + } +} + +void VectorImpl::_do_destroy(void* storage, size_t num) const +{ + if (!(mFlags & HAS_TRIVIAL_DTOR)) { + do_destroy(storage, num); + } +} + +void VectorImpl::_do_copy(void* dest, const void* from, size_t num) const +{ + if (!(mFlags & HAS_TRIVIAL_COPY)) { + do_copy(dest, from, num); + } else { + memcpy(dest, from, num*itemSize()); + } +} + +void VectorImpl::_do_splat(void* dest, const void* item, size_t num) const { + do_splat(dest, item, num); +} + +void VectorImpl::_do_move_forward(void* dest, const void* from, size_t num) const { + do_move_forward(dest, from, num); +} + +void VectorImpl::_do_move_backward(void* dest, const void* from, size_t num) const { + do_move_backward(dest, from, num); +} + +void VectorImpl::reservedVectorImpl1() { } +void VectorImpl::reservedVectorImpl2() { } +void VectorImpl::reservedVectorImpl3() { } +void VectorImpl::reservedVectorImpl4() { } +void VectorImpl::reservedVectorImpl5() { } +void VectorImpl::reservedVectorImpl6() { } +void VectorImpl::reservedVectorImpl7() { } +void VectorImpl::reservedVectorImpl8() { } + +/*****************************************************************************/ + +SortedVectorImpl::SortedVectorImpl(size_t itemSize, uint32_t flags) + : VectorImpl(itemSize, flags) +{ +} + +SortedVectorImpl::SortedVectorImpl(const VectorImpl& rhs) +: VectorImpl(rhs) +{ +} + +SortedVectorImpl::~SortedVectorImpl() +{ +} + +SortedVectorImpl& SortedVectorImpl::operator = (const SortedVectorImpl& rhs) +{ + return static_cast( VectorImpl::operator = (static_cast(rhs)) ); +} + +ssize_t SortedVectorImpl::indexOf(const void* item) const +{ + return _indexOrderOf(item); +} + +size_t SortedVectorImpl::orderOf(const void* item) const +{ + size_t o; + _indexOrderOf(item, &o); + return o; +} + +ssize_t SortedVectorImpl::_indexOrderOf(const void* item, size_t* order) const +{ + // binary search + ssize_t err = NAME_NOT_FOUND; + ssize_t l = 0; + ssize_t h = size()-1; + ssize_t mid; + const void* a = arrayImpl(); + const size_t s = itemSize(); + while (l <= h) { + mid = l + (h - l)/2; + const void* const curr = reinterpret_cast(a) + (mid*s); + const int c = do_compare(curr, item); + if (c == 0) { + err = l = mid; + break; + } else if (c < 0) { + l = mid + 1; + } else { + h = mid - 1; + } + } + if (order) *order = l; + return err; +} + +ssize_t SortedVectorImpl::add(const void* item) +{ + size_t order; + ssize_t index = _indexOrderOf(item, &order); + if (index < 0) { + index = VectorImpl::insertAt(item, order, 1); + } else { + index = VectorImpl::replaceAt(item, index); + } + return index; +} + +ssize_t SortedVectorImpl::merge(const VectorImpl& vector) +{ + // naive merge... + if (!vector.isEmpty()) { + const void* buffer = vector.arrayImpl(); + const size_t is = itemSize(); + size_t s = vector.size(); + for (size_t i=0 ; i(buffer) + i*is ); + if (err<0) { + return err; + } + } + } + return NO_ERROR; +} + +ssize_t SortedVectorImpl::merge(const SortedVectorImpl& vector) +{ + // we've merging a sorted vector... nice! + ssize_t err = NO_ERROR; + if (!vector.isEmpty()) { + // first take care of the case where the vectors are sorted together + if (do_compare(vector.itemLocation(vector.size()-1), arrayImpl()) <= 0) { + err = VectorImpl::insertVectorAt(static_cast(vector), 0); + } else if (do_compare(vector.arrayImpl(), itemLocation(size()-1)) >= 0) { + err = VectorImpl::appendVector(static_cast(vector)); + } else { + // this could be made a little better + err = merge(static_cast(vector)); + } + } + return err; +} + +ssize_t SortedVectorImpl::remove(const void* item) +{ + ssize_t i = indexOf(item); + if (i>=0) { + VectorImpl::removeItemsAt(i, 1); + } + return i; +} + +void SortedVectorImpl::reservedSortedVectorImpl1() { }; +void SortedVectorImpl::reservedSortedVectorImpl2() { }; +void SortedVectorImpl::reservedSortedVectorImpl3() { }; +void SortedVectorImpl::reservedSortedVectorImpl4() { }; +void SortedVectorImpl::reservedSortedVectorImpl5() { }; +void SortedVectorImpl::reservedSortedVectorImpl6() { }; +void SortedVectorImpl::reservedSortedVectorImpl7() { }; +void SortedVectorImpl::reservedSortedVectorImpl8() { }; + + +/*****************************************************************************/ + +}; // namespace android + diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/WorkQueue.cpp android-platform-frameworks-native-21/libs/utils/WorkQueue.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/WorkQueue.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/WorkQueue.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,171 @@ +/* + * Copyright (C) 2012 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. + */ + +// #define LOG_NDEBUG 0 +#define LOG_TAG "WorkQueue" + +#include +#include + +namespace android { + +// --- WorkQueue --- + +WorkQueue::WorkQueue(size_t maxThreads, bool canCallJava) : + mMaxThreads(maxThreads), mCanCallJava(canCallJava), + mCanceled(false), mFinished(false), mIdleThreads(0) { +} + +WorkQueue::~WorkQueue() { + if (!cancel()) { + finish(); + } +} + +status_t WorkQueue::schedule(WorkUnit* workUnit, size_t backlog) { + AutoMutex _l(mLock); + + if (mFinished || mCanceled) { + return INVALID_OPERATION; + } + + if (mWorkThreads.size() < mMaxThreads + && mIdleThreads < mWorkUnits.size() + 1) { + sp workThread = new WorkThread(this, mCanCallJava); + status_t status = workThread->run("WorkQueue::WorkThread"); + if (status) { + return status; + } + mWorkThreads.add(workThread); + mIdleThreads += 1; + } else if (backlog) { + while (mWorkUnits.size() >= mMaxThreads * backlog) { + mWorkDequeuedCondition.wait(mLock); + if (mFinished || mCanceled) { + return INVALID_OPERATION; + } + } + } + + mWorkUnits.add(workUnit); + mWorkChangedCondition.broadcast(); + return OK; +} + +status_t WorkQueue::cancel() { + AutoMutex _l(mLock); + + return cancelLocked(); +} + +status_t WorkQueue::cancelLocked() { + if (mFinished) { + return INVALID_OPERATION; + } + + if (!mCanceled) { + mCanceled = true; + + size_t count = mWorkUnits.size(); + for (size_t i = 0; i < count; i++) { + delete mWorkUnits.itemAt(i); + } + mWorkUnits.clear(); + mWorkChangedCondition.broadcast(); + mWorkDequeuedCondition.broadcast(); + } + return OK; +} + +status_t WorkQueue::finish() { + { // acquire lock + AutoMutex _l(mLock); + + if (mFinished) { + return INVALID_OPERATION; + } + + mFinished = true; + mWorkChangedCondition.broadcast(); + } // release lock + + // It is not possible for the list of work threads to change once the mFinished + // flag has been set, so we can access mWorkThreads outside of the lock here. + size_t count = mWorkThreads.size(); + for (size_t i = 0; i < count; i++) { + mWorkThreads.itemAt(i)->join(); + } + mWorkThreads.clear(); + return OK; +} + +bool WorkQueue::threadLoop() { + WorkUnit* workUnit; + { // acquire lock + AutoMutex _l(mLock); + + for (;;) { + if (mCanceled) { + return false; + } + + if (!mWorkUnits.isEmpty()) { + workUnit = mWorkUnits.itemAt(0); + mWorkUnits.removeAt(0); + mIdleThreads -= 1; + mWorkDequeuedCondition.broadcast(); + break; + } + + if (mFinished) { + return false; + } + + mWorkChangedCondition.wait(mLock); + } + } // release lock + + bool shouldContinue = workUnit->run(); + delete workUnit; + + { // acquire lock + AutoMutex _l(mLock); + + mIdleThreads += 1; + + if (!shouldContinue) { + cancelLocked(); + return false; + } + } // release lock + + return true; +} + +// --- WorkQueue::WorkThread --- + +WorkQueue::WorkThread::WorkThread(WorkQueue* workQueue, bool canCallJava) : + Thread(canCallJava), mWorkQueue(workQueue) { +} + +WorkQueue::WorkThread::~WorkThread() { +} + +bool WorkQueue::WorkThread::threadLoop() { + return mWorkQueue->threadLoop(); +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/ZipFileCRO.cpp android-platform-frameworks-native-21/libs/utils/ZipFileCRO.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/ZipFileCRO.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/ZipFileCRO.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,54 @@ +/* + * Copyright (C) 2008 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 +#include + +using namespace android; + +ZipFileCRO ZipFileXRO_open(const char* path) { + ZipFileRO* zip = new ZipFileRO(); + if (zip->open(path) == NO_ERROR) { + return (ZipFileCRO)zip; + } + return NULL; +} + +void ZipFileCRO_destroy(ZipFileCRO zipToken) { + ZipFileRO* zip = (ZipFileRO*)zipToken; + delete zip; +} + +ZipEntryCRO ZipFileCRO_findEntryByName(ZipFileCRO zipToken, + const char* fileName) { + ZipFileRO* zip = (ZipFileRO*)zipToken; + return (ZipEntryCRO)zip->findEntryByName(fileName); +} + +bool ZipFileCRO_getEntryInfo(ZipFileCRO zipToken, ZipEntryRO entryToken, + int* pMethod, size_t* pUncompLen, + size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) { + ZipFileRO* zip = (ZipFileRO*)zipToken; + ZipEntryRO entry = (ZipEntryRO)entryToken; + return zip->getEntryInfo(entry, pMethod, pUncompLen, pCompLen, pOffset, + pModWhen, pCrc32); +} + +bool ZipFileCRO_uncompressEntry(ZipFileCRO zipToken, ZipEntryRO entryToken, int fd) { + ZipFileRO* zip = (ZipFileRO*)zipToken; + ZipEntryRO entry = (ZipEntryRO)entryToken; + return zip->uncompressEntry(entry, fd); +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/ZipFileRO.cpp android-platform-frameworks-native-21/libs/utils/ZipFileRO.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/ZipFileRO.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/ZipFileRO.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,909 @@ +/* + * Copyright (C) 2007 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. + */ + +// +// Read-only access to Zip archives, with minimal heap allocation. +// +#define LOG_TAG "zipro" +//#define LOG_NDEBUG 0 +#include +#include +#include +#include +#include + +#include + +#include +#include +#include +#include +#include + +/* + * We must open binary files using open(path, ... | O_BINARY) under Windows. + * Otherwise strange read errors will happen. + */ +#ifndef O_BINARY +# define O_BINARY 0 +#endif + +using namespace android; + +/* + * Zip file constants. + */ +#define kEOCDSignature 0x06054b50 +#define kEOCDLen 22 +#define kEOCDNumEntries 8 // offset to #of entries in file +#define kEOCDSize 12 // size of the central directory +#define kEOCDFileOffset 16 // offset to central directory + +#define kMaxCommentLen 65535 // longest possible in ushort +#define kMaxEOCDSearch (kMaxCommentLen + kEOCDLen) + +#define kLFHSignature 0x04034b50 +#define kLFHLen 30 // excluding variable-len fields +#define kLFHNameLen 26 // offset to filename length +#define kLFHExtraLen 28 // offset to extra length + +#define kCDESignature 0x02014b50 +#define kCDELen 46 // excluding variable-len fields +#define kCDEMethod 10 // offset to compression method +#define kCDEModWhen 12 // offset to modification timestamp +#define kCDECRC 16 // offset to entry CRC +#define kCDECompLen 20 // offset to compressed length +#define kCDEUncompLen 24 // offset to uncompressed length +#define kCDENameLen 28 // offset to filename length +#define kCDEExtraLen 30 // offset to extra length +#define kCDECommentLen 32 // offset to comment length +#define kCDELocalOffset 42 // offset to local hdr + +/* + * The values we return for ZipEntryRO use 0 as an invalid value, so we + * want to adjust the hash table index by a fixed amount. Using a large + * value helps insure that people don't mix & match arguments, e.g. to + * findEntryByIndex(). + */ +#define kZipEntryAdj 10000 + +ZipFileRO::~ZipFileRO() { + free(mHashTable); + if (mDirectoryMap) + mDirectoryMap->release(); + if (mFd >= 0) + TEMP_FAILURE_RETRY(close(mFd)); + if (mFileName) + free(mFileName); +} + +/* + * Convert a ZipEntryRO to a hash table index, verifying that it's in a + * valid range. + */ +int ZipFileRO::entryToIndex(const ZipEntryRO entry) const +{ + long ent = ((long) entry) - kZipEntryAdj; + if (ent < 0 || ent >= mHashTableSize || mHashTable[ent].name == NULL) { + ALOGW("Invalid ZipEntryRO %p (%ld)\n", entry, ent); + return -1; + } + return ent; +} + + +/* + * Open the specified file read-only. We memory-map the entire thing and + * close the file before returning. + */ +status_t ZipFileRO::open(const char* zipFileName) +{ + int fd = -1; + + assert(mDirectoryMap == NULL); + + /* + * Open and map the specified file. + */ + fd = ::open(zipFileName, O_RDONLY | O_BINARY); + if (fd < 0) { + ALOGW("Unable to open zip '%s': %s\n", zipFileName, strerror(errno)); + return NAME_NOT_FOUND; + } + + mFileLength = lseek64(fd, 0, SEEK_END); + if (mFileLength < kEOCDLen) { + TEMP_FAILURE_RETRY(close(fd)); + return UNKNOWN_ERROR; + } + + if (mFileName != NULL) { + free(mFileName); + } + mFileName = strdup(zipFileName); + + mFd = fd; + + /* + * Find the Central Directory and store its size and number of entries. + */ + if (!mapCentralDirectory()) { + goto bail; + } + + /* + * Verify Central Directory and create data structures for fast access. + */ + if (!parseZipArchive()) { + goto bail; + } + + return OK; + +bail: + free(mFileName); + mFileName = NULL; + TEMP_FAILURE_RETRY(close(fd)); + return UNKNOWN_ERROR; +} + +/* + * Parse the Zip archive, verifying its contents and initializing internal + * data structures. + */ +bool ZipFileRO::mapCentralDirectory(void) +{ + ssize_t readAmount = kMaxEOCDSearch; + if (readAmount > (ssize_t) mFileLength) + readAmount = mFileLength; + + unsigned char* scanBuf = (unsigned char*) malloc(readAmount); + if (scanBuf == NULL) { + ALOGW("couldn't allocate scanBuf: %s", strerror(errno)); + free(scanBuf); + return false; + } + + /* + * Make sure this is a Zip archive. + */ + if (lseek64(mFd, 0, SEEK_SET) != 0) { + ALOGW("seek to start failed: %s", strerror(errno)); + free(scanBuf); + return false; + } + + ssize_t actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, sizeof(int32_t))); + if (actual != (ssize_t) sizeof(int32_t)) { + ALOGI("couldn't read first signature from zip archive: %s", strerror(errno)); + free(scanBuf); + return false; + } + + { + unsigned int header = get4LE(scanBuf); + if (header == kEOCDSignature) { + ALOGI("Found Zip archive, but it looks empty\n"); + free(scanBuf); + return false; + } else if (header != kLFHSignature) { + ALOGV("Not a Zip archive (found 0x%08x)\n", header); + free(scanBuf); + return false; + } + } + + /* + * Perform the traditional EOCD snipe hunt. + * + * We're searching for the End of Central Directory magic number, + * which appears at the start of the EOCD block. It's followed by + * 18 bytes of EOCD stuff and up to 64KB of archive comment. We + * need to read the last part of the file into a buffer, dig through + * it to find the magic number, parse some values out, and use those + * to determine the extent of the CD. + * + * We start by pulling in the last part of the file. + */ + off64_t searchStart = mFileLength - readAmount; + + if (lseek64(mFd, searchStart, SEEK_SET) != searchStart) { + ALOGW("seek %ld failed: %s\n", (long) searchStart, strerror(errno)); + free(scanBuf); + return false; + } + actual = TEMP_FAILURE_RETRY(read(mFd, scanBuf, readAmount)); + if (actual != (ssize_t) readAmount) { + ALOGW("Zip: read " ZD ", expected " ZD ". Failed: %s\n", + (ZD_TYPE) actual, (ZD_TYPE) readAmount, strerror(errno)); + free(scanBuf); + return false; + } + + /* + * Scan backward for the EOCD magic. In an archive without a trailing + * comment, we'll find it on the first try. (We may want to consider + * doing an initial minimal read; if we don't find it, retry with a + * second read as above.) + */ + int i; + for (i = readAmount - kEOCDLen; i >= 0; i--) { + if (scanBuf[i] == 0x50 && get4LE(&scanBuf[i]) == kEOCDSignature) { + ALOGV("+++ Found EOCD at buf+%d\n", i); + break; + } + } + if (i < 0) { + ALOGD("Zip: EOCD not found, %s is not zip\n", mFileName); + free(scanBuf); + return false; + } + + off64_t eocdOffset = searchStart + i; + const unsigned char* eocdPtr = scanBuf + i; + + assert(eocdOffset < mFileLength); + + /* + * Grab the CD offset and size, and the number of entries in the + * archive. After that, we can release our EOCD hunt buffer. + */ + unsigned int numEntries = get2LE(eocdPtr + kEOCDNumEntries); + unsigned int dirSize = get4LE(eocdPtr + kEOCDSize); + unsigned int dirOffset = get4LE(eocdPtr + kEOCDFileOffset); + free(scanBuf); + + // Verify that they look reasonable. + if ((long long) dirOffset + (long long) dirSize > (long long) eocdOffset) { + ALOGW("bad offsets (dir %ld, size %u, eocd %ld)\n", + (long) dirOffset, dirSize, (long) eocdOffset); + return false; + } + if (numEntries == 0) { + ALOGW("empty archive?\n"); + return false; + } + + ALOGV("+++ numEntries=%d dirSize=%d dirOffset=%d\n", + numEntries, dirSize, dirOffset); + + mDirectoryMap = new FileMap(); + if (mDirectoryMap == NULL) { + ALOGW("Unable to create directory map: %s", strerror(errno)); + return false; + } + + if (!mDirectoryMap->create(mFileName, mFd, dirOffset, dirSize, true)) { + ALOGW("Unable to map '%s' (" ZD " to " ZD "): %s\n", mFileName, + (ZD_TYPE) dirOffset, (ZD_TYPE) (dirOffset + dirSize), strerror(errno)); + return false; + } + + mNumEntries = numEntries; + mDirectoryOffset = dirOffset; + + return true; +} + +bool ZipFileRO::parseZipArchive(void) +{ + bool result = false; + const unsigned char* cdPtr = (const unsigned char*) mDirectoryMap->getDataPtr(); + size_t cdLength = mDirectoryMap->getDataLength(); + int numEntries = mNumEntries; + + /* + * Create hash table. We have a minimum 75% load factor, possibly as + * low as 50% after we round off to a power of 2. + */ + mHashTableSize = roundUpPower2(1 + (numEntries * 4) / 3); + mHashTable = (HashEntry*) calloc(mHashTableSize, sizeof(HashEntry)); + + /* + * Walk through the central directory, adding entries to the hash + * table. + */ + const unsigned char* ptr = cdPtr; + for (int i = 0; i < numEntries; i++) { + if (get4LE(ptr) != kCDESignature) { + ALOGW("Missed a central dir sig (at %d)\n", i); + goto bail; + } + if (ptr + kCDELen > cdPtr + cdLength) { + ALOGW("Ran off the end (at %d)\n", i); + goto bail; + } + + long localHdrOffset = (long) get4LE(ptr + kCDELocalOffset); + if (localHdrOffset >= mDirectoryOffset) { + ALOGW("bad LFH offset %ld at entry %d\n", localHdrOffset, i); + goto bail; + } + + unsigned int fileNameLen, extraLen, commentLen, hash; + + fileNameLen = get2LE(ptr + kCDENameLen); + extraLen = get2LE(ptr + kCDEExtraLen); + commentLen = get2LE(ptr + kCDECommentLen); + + /* add the CDE filename to the hash table */ + hash = computeHash((const char*)ptr + kCDELen, fileNameLen); + addToHash((const char*)ptr + kCDELen, fileNameLen, hash); + + ptr += kCDELen + fileNameLen + extraLen + commentLen; + if ((size_t)(ptr - cdPtr) > cdLength) { + ALOGW("bad CD advance (%d vs " ZD ") at entry %d\n", + (int) (ptr - cdPtr), (ZD_TYPE) cdLength, i); + goto bail; + } + } + ALOGV("+++ zip good scan %d entries\n", numEntries); + result = true; + +bail: + return result; +} + +/* + * Simple string hash function for non-null-terminated strings. + */ +/*static*/ unsigned int ZipFileRO::computeHash(const char* str, int len) +{ + unsigned int hash = 0; + + while (len--) + hash = hash * 31 + *str++; + + return hash; +} + +/* + * Add a new entry to the hash table. + */ +void ZipFileRO::addToHash(const char* str, int strLen, unsigned int hash) +{ + int ent = hash & (mHashTableSize-1); + + /* + * We over-allocate the table, so we're guaranteed to find an empty slot. + */ + while (mHashTable[ent].name != NULL) + ent = (ent + 1) & (mHashTableSize-1); + + mHashTable[ent].name = str; + mHashTable[ent].nameLen = strLen; +} + +/* + * Find a matching entry. + * + * Returns NULL if not found. + */ +ZipEntryRO ZipFileRO::findEntryByName(const char* fileName) const +{ + /* + * If the ZipFileRO instance is not initialized, the entry number will + * end up being garbage since mHashTableSize is -1. + */ + if (mHashTableSize <= 0) { + return NULL; + } + + int nameLen = strlen(fileName); + unsigned int hash = computeHash(fileName, nameLen); + int ent = hash & (mHashTableSize-1); + + while (mHashTable[ent].name != NULL) { + if (mHashTable[ent].nameLen == nameLen && + memcmp(mHashTable[ent].name, fileName, nameLen) == 0) + { + /* match */ + return (ZipEntryRO)(long)(ent + kZipEntryAdj); + } + + ent = (ent + 1) & (mHashTableSize-1); + } + + return NULL; +} + +/* + * Find the Nth entry. + * + * This currently involves walking through the sparse hash table, counting + * non-empty entries. If we need to speed this up we can either allocate + * a parallel lookup table or (perhaps better) provide an iterator interface. + */ +ZipEntryRO ZipFileRO::findEntryByIndex(int idx) const +{ + if (idx < 0 || idx >= mNumEntries) { + ALOGW("Invalid index %d\n", idx); + return NULL; + } + + for (int ent = 0; ent < mHashTableSize; ent++) { + if (mHashTable[ent].name != NULL) { + if (idx-- == 0) + return (ZipEntryRO) (ent + kZipEntryAdj); + } + } + + return NULL; +} + +/* + * Get the useful fields from the zip entry. + * + * Returns "false" if the offsets to the fields or the contents of the fields + * appear to be bogus. + */ +bool ZipFileRO::getEntryInfo(ZipEntryRO entry, int* pMethod, size_t* pUncompLen, + size_t* pCompLen, off64_t* pOffset, long* pModWhen, long* pCrc32) const +{ + bool ret = false; + + const int ent = entryToIndex(entry); + if (ent < 0) + return false; + + HashEntry hashEntry = mHashTable[ent]; + + /* + * Recover the start of the central directory entry from the filename + * pointer. The filename is the first entry past the fixed-size data, + * so we can just subtract back from that. + */ + const unsigned char* ptr = (const unsigned char*) hashEntry.name; + off64_t cdOffset = mDirectoryOffset; + + ptr -= kCDELen; + + int method = get2LE(ptr + kCDEMethod); + if (pMethod != NULL) + *pMethod = method; + + if (pModWhen != NULL) + *pModWhen = get4LE(ptr + kCDEModWhen); + if (pCrc32 != NULL) + *pCrc32 = get4LE(ptr + kCDECRC); + + size_t compLen = get4LE(ptr + kCDECompLen); + if (pCompLen != NULL) + *pCompLen = compLen; + size_t uncompLen = get4LE(ptr + kCDEUncompLen); + if (pUncompLen != NULL) + *pUncompLen = uncompLen; + + /* + * If requested, determine the offset of the start of the data. All we + * have is the offset to the Local File Header, which is variable size, + * so we have to read the contents of the struct to figure out where + * the actual data starts. + * + * We also need to make sure that the lengths are not so large that + * somebody trying to map the compressed or uncompressed data runs + * off the end of the mapped region. + * + * Note we don't verify compLen/uncompLen if they don't request the + * dataOffset, because dataOffset is expensive to determine. However, + * if they don't have the file offset, they're not likely to be doing + * anything with the contents. + */ + if (pOffset != NULL) { + long localHdrOffset = get4LE(ptr + kCDELocalOffset); + if (localHdrOffset + kLFHLen >= cdOffset) { + ALOGE("ERROR: bad local hdr offset in zip\n"); + return false; + } + + unsigned char lfhBuf[kLFHLen]; + +#ifdef HAVE_PREAD + /* + * This file descriptor might be from zygote's preloaded assets, + * so we need to do an pread64() instead of a lseek64() + read() to + * guarantee atomicity across the processes with the shared file + * descriptors. + */ + ssize_t actual = + TEMP_FAILURE_RETRY(pread64(mFd, lfhBuf, sizeof(lfhBuf), localHdrOffset)); + + if (actual != sizeof(lfhBuf)) { + ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); + return false; + } + + if (get4LE(lfhBuf) != kLFHSignature) { + ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " + "got: data=0x%08lx\n", + localHdrOffset, kLFHSignature, get4LE(lfhBuf)); + return false; + } +#else /* HAVE_PREAD */ + /* + * For hosts don't have pread64() we cannot guarantee atomic reads from + * an offset in a file. Android should never run on those platforms. + * File descriptors inherited from a fork() share file offsets and + * there would be nothing to protect from two different processes + * calling lseek64() concurrently. + */ + + { + AutoMutex _l(mFdLock); + + if (lseek64(mFd, localHdrOffset, SEEK_SET) != localHdrOffset) { + ALOGW("failed seeking to lfh at offset %ld\n", localHdrOffset); + return false; + } + + ssize_t actual = + TEMP_FAILURE_RETRY(read(mFd, lfhBuf, sizeof(lfhBuf))); + if (actual != sizeof(lfhBuf)) { + ALOGW("failed reading lfh from offset %ld\n", localHdrOffset); + return false; + } + + if (get4LE(lfhBuf) != kLFHSignature) { + off64_t actualOffset = lseek64(mFd, 0, SEEK_CUR); + ALOGW("didn't find signature at start of lfh; wanted: offset=%ld data=0x%08x; " + "got: offset=" ZD " data=0x%08lx\n", + localHdrOffset, kLFHSignature, (ZD_TYPE) actualOffset, get4LE(lfhBuf)); + return false; + } + } +#endif /* HAVE_PREAD */ + + off64_t dataOffset = localHdrOffset + kLFHLen + + get2LE(lfhBuf + kLFHNameLen) + get2LE(lfhBuf + kLFHExtraLen); + if (dataOffset >= cdOffset) { + ALOGW("bad data offset %ld in zip\n", (long) dataOffset); + return false; + } + + /* check lengths */ + if ((off64_t)(dataOffset + compLen) > cdOffset) { + ALOGW("bad compressed length in zip (%ld + " ZD " > %ld)\n", + (long) dataOffset, (ZD_TYPE) compLen, (long) cdOffset); + return false; + } + + if (method == kCompressStored && + (off64_t)(dataOffset + uncompLen) > cdOffset) + { + ALOGE("ERROR: bad uncompressed length in zip (%ld + " ZD " > %ld)\n", + (long) dataOffset, (ZD_TYPE) uncompLen, (long) cdOffset); + return false; + } + + *pOffset = dataOffset; + } + + return true; +} + +/* + * Copy the entry's filename to the buffer. + */ +int ZipFileRO::getEntryFileName(ZipEntryRO entry, char* buffer, int bufLen) + const +{ + int ent = entryToIndex(entry); + if (ent < 0) + return -1; + + int nameLen = mHashTable[ent].nameLen; + if (bufLen < nameLen+1) + return nameLen+1; + + memcpy(buffer, mHashTable[ent].name, nameLen); + buffer[nameLen] = '\0'; + return 0; +} + +/* + * Create a new FileMap object that spans the data in "entry". + */ +FileMap* ZipFileRO::createEntryFileMap(ZipEntryRO entry) const +{ + /* + * TODO: the efficient way to do this is to modify FileMap to allow + * sub-regions of a file to be mapped. A reference-counting scheme + * can manage the base memory mapping. For now, we just create a brand + * new mapping off of the Zip archive file descriptor. + */ + + FileMap* newMap; + size_t compLen; + off64_t offset; + + if (!getEntryInfo(entry, NULL, NULL, &compLen, &offset, NULL, NULL)) + return NULL; + + newMap = new FileMap(); + if (!newMap->create(mFileName, mFd, offset, compLen, true)) { + newMap->release(); + return NULL; + } + + return newMap; +} + +/* + * Uncompress an entry, in its entirety, into the provided output buffer. + * + * This doesn't verify the data's CRC, which might be useful for + * uncompressed data. The caller should be able to manage it. + */ +bool ZipFileRO::uncompressEntry(ZipEntryRO entry, void* buffer) const +{ + const size_t kSequentialMin = 32768; + bool result = false; + int ent = entryToIndex(entry); + if (ent < 0) + return -1; + + int method; + size_t uncompLen, compLen; + off64_t offset; + const unsigned char* ptr; + + getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL); + + FileMap* file = createEntryFileMap(entry); + if (file == NULL) { + goto bail; + } + + ptr = (const unsigned char*) file->getDataPtr(); + + /* + * Experiment with madvise hint. When we want to uncompress a file, + * we pull some stuff out of the central dir entry and then hit a + * bunch of compressed or uncompressed data sequentially. The CDE + * visit will cause a limited amount of read-ahead because it's at + * the end of the file. We could end up doing lots of extra disk + * access if the file we're prying open is small. Bottom line is we + * probably don't want to turn MADV_SEQUENTIAL on and leave it on. + * + * So, if the compressed size of the file is above a certain minimum + * size, temporarily boost the read-ahead in the hope that the extra + * pair of system calls are negated by a reduction in page faults. + */ + if (compLen > kSequentialMin) + file->advise(FileMap::SEQUENTIAL); + + if (method == kCompressStored) { + memcpy(buffer, ptr, uncompLen); + } else { + if (!inflateBuffer(buffer, ptr, uncompLen, compLen)) + goto unmap; + } + + if (compLen > kSequentialMin) + file->advise(FileMap::NORMAL); + + result = true; + +unmap: + file->release(); +bail: + return result; +} + +/* + * Uncompress an entry, in its entirety, to an open file descriptor. + * + * This doesn't verify the data's CRC, but probably should. + */ +bool ZipFileRO::uncompressEntry(ZipEntryRO entry, int fd) const +{ + bool result = false; + int ent = entryToIndex(entry); + if (ent < 0) + return -1; + + int method; + size_t uncompLen, compLen; + off64_t offset; + const unsigned char* ptr; + + getEntryInfo(entry, &method, &uncompLen, &compLen, &offset, NULL, NULL); + + FileMap* file = createEntryFileMap(entry); + if (file == NULL) { + goto bail; + } + + ptr = (const unsigned char*) file->getDataPtr(); + + if (method == kCompressStored) { + ssize_t actual = write(fd, ptr, uncompLen); + if (actual < 0) { + ALOGE("Write failed: %s\n", strerror(errno)); + goto unmap; + } else if ((size_t) actual != uncompLen) { + ALOGE("Partial write during uncompress (" ZD " of " ZD ")\n", + (ZD_TYPE) actual, (ZD_TYPE) uncompLen); + goto unmap; + } else { + ALOGI("+++ successful write\n"); + } + } else { + if (!inflateBuffer(fd, ptr, uncompLen, compLen)) + goto unmap; + } + + result = true; + +unmap: + file->release(); +bail: + return result; +} + +/* + * Uncompress "deflate" data from one buffer to another. + */ +/*static*/ bool ZipFileRO::inflateBuffer(void* outBuf, const void* inBuf, + size_t uncompLen, size_t compLen) +{ + bool result = false; + z_stream zstream; + int zerr; + + /* + * Initialize the zlib stream struct. + */ + memset(&zstream, 0, sizeof(zstream)); + zstream.zalloc = Z_NULL; + zstream.zfree = Z_NULL; + zstream.opaque = Z_NULL; + zstream.next_in = (Bytef*)inBuf; + zstream.avail_in = compLen; + zstream.next_out = (Bytef*) outBuf; + zstream.avail_out = uncompLen; + zstream.data_type = Z_UNKNOWN; + + /* + * Use the undocumented "negative window bits" feature to tell zlib + * that there's no zlib header waiting for it. + */ + zerr = inflateInit2(&zstream, -MAX_WBITS); + if (zerr != Z_OK) { + if (zerr == Z_VERSION_ERROR) { + ALOGE("Installed zlib is not compatible with linked version (%s)\n", + ZLIB_VERSION); + } else { + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + } + goto bail; + } + + /* + * Expand data. + */ + zerr = inflate(&zstream, Z_FINISH); + if (zerr != Z_STREAM_END) { + ALOGW("Zip inflate failed, zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + zerr, zstream.next_in, zstream.avail_in, + zstream.next_out, zstream.avail_out); + goto z_bail; + } + + /* paranoia */ + if (zstream.total_out != uncompLen) { + ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", + zstream.total_out, (ZD_TYPE) uncompLen); + goto z_bail; + } + + result = true; + +z_bail: + inflateEnd(&zstream); /* free up any allocated structures */ + +bail: + return result; +} + +/* + * Uncompress "deflate" data from one buffer to an open file descriptor. + */ +/*static*/ bool ZipFileRO::inflateBuffer(int fd, const void* inBuf, + size_t uncompLen, size_t compLen) +{ + bool result = false; + const size_t kWriteBufSize = 32768; + unsigned char writeBuf[kWriteBufSize]; + z_stream zstream; + int zerr; + + /* + * Initialize the zlib stream struct. + */ + memset(&zstream, 0, sizeof(zstream)); + zstream.zalloc = Z_NULL; + zstream.zfree = Z_NULL; + zstream.opaque = Z_NULL; + zstream.next_in = (Bytef*)inBuf; + zstream.avail_in = compLen; + zstream.next_out = (Bytef*) writeBuf; + zstream.avail_out = sizeof(writeBuf); + zstream.data_type = Z_UNKNOWN; + + /* + * Use the undocumented "negative window bits" feature to tell zlib + * that there's no zlib header waiting for it. + */ + zerr = inflateInit2(&zstream, -MAX_WBITS); + if (zerr != Z_OK) { + if (zerr == Z_VERSION_ERROR) { + ALOGE("Installed zlib is not compatible with linked version (%s)\n", + ZLIB_VERSION); + } else { + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + } + goto bail; + } + + /* + * Loop while we have more to do. + */ + do { + /* + * Expand data. + */ + zerr = inflate(&zstream, Z_NO_FLUSH); + if (zerr != Z_OK && zerr != Z_STREAM_END) { + ALOGW("zlib inflate: zerr=%d (nIn=%p aIn=%u nOut=%p aOut=%u)\n", + zerr, zstream.next_in, zstream.avail_in, + zstream.next_out, zstream.avail_out); + goto z_bail; + } + + /* write when we're full or when we're done */ + if (zstream.avail_out == 0 || + (zerr == Z_STREAM_END && zstream.avail_out != sizeof(writeBuf))) + { + long writeSize = zstream.next_out - writeBuf; + int cc = write(fd, writeBuf, writeSize); + if (cc != (int) writeSize) { + ALOGW("write failed in inflate (%d vs %ld)\n", cc, writeSize); + goto z_bail; + } + + zstream.next_out = writeBuf; + zstream.avail_out = sizeof(writeBuf); + } + } while (zerr == Z_OK); + + assert(zerr == Z_STREAM_END); /* other errors should've been caught */ + + /* paranoia */ + if (zstream.total_out != uncompLen) { + ALOGW("Size mismatch on inflated file (%ld vs " ZD ")\n", + zstream.total_out, (ZD_TYPE) uncompLen); + goto z_bail; + } + + result = true; + +z_bail: + inflateEnd(&zstream); /* free up any allocated structures */ + +bail: + return result; +} diff -Nru android-platform-frameworks-native-6.0.1+r16/libs/utils/ZipUtils.cpp android-platform-frameworks-native-21/libs/utils/ZipUtils.cpp --- android-platform-frameworks-native-6.0.1+r16/libs/utils/ZipUtils.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/libs/utils/ZipUtils.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,345 @@ +/* + * Copyright (C) 2007 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. + */ + +// +// Misc zip/gzip utility functions. +// + +#define LOG_TAG "ziputil" + +#include +#include +#include +#include + +#include +#include +#include + +#include + +using namespace android; + +/* + * Utility function that expands zip/gzip "deflate" compressed data + * into a buffer. + * + * "fd" is an open file positioned at the start of the "deflate" data + * "buf" must hold at least "uncompressedLen" bytes. + */ +/*static*/ bool ZipUtils::inflateToBuffer(int fd, void* buf, + long uncompressedLen, long compressedLen) +{ + bool result = false; + const unsigned long kReadBufSize = 32768; + unsigned char* readBuf = NULL; + z_stream zstream; + int zerr; + unsigned long compRemaining; + + assert(uncompressedLen >= 0); + assert(compressedLen >= 0); + + readBuf = new unsigned char[kReadBufSize]; + if (readBuf == NULL) + goto bail; + compRemaining = compressedLen; + + /* + * Initialize the zlib stream. + */ + memset(&zstream, 0, sizeof(zstream)); + zstream.zalloc = Z_NULL; + zstream.zfree = Z_NULL; + zstream.opaque = Z_NULL; + zstream.next_in = NULL; + zstream.avail_in = 0; + zstream.next_out = (Bytef*) buf; + zstream.avail_out = uncompressedLen; + zstream.data_type = Z_UNKNOWN; + + /* + * Use the undocumented "negative window bits" feature to tell zlib + * that there's no zlib header waiting for it. + */ + zerr = inflateInit2(&zstream, -MAX_WBITS); + if (zerr != Z_OK) { + if (zerr == Z_VERSION_ERROR) { + ALOGE("Installed zlib is not compatible with linked version (%s)\n", + ZLIB_VERSION); + } else { + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + } + goto bail; + } + + /* + * Loop while we have data. + */ + do { + unsigned long getSize; + + /* read as much as we can */ + if (zstream.avail_in == 0) { + getSize = (compRemaining > kReadBufSize) ? + kReadBufSize : compRemaining; + ALOGV("+++ reading %ld bytes (%ld left)\n", + getSize, compRemaining); + + int cc = TEMP_FAILURE_RETRY(read(fd, readBuf, getSize)); + if (cc < 0) { + ALOGW("inflate read failed: %s", strerror(errno)); + } else if (cc != (int) getSize) { + ALOGW("inflate read failed (%d vs %ld)", cc, getSize); + goto z_bail; + } + + compRemaining -= getSize; + + zstream.next_in = readBuf; + zstream.avail_in = getSize; + } + + /* uncompress the data */ + zerr = inflate(&zstream, Z_NO_FLUSH); + if (zerr != Z_OK && zerr != Z_STREAM_END) { + ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); + goto z_bail; + } + + /* output buffer holds all, so no need to write the output */ + } while (zerr == Z_OK); + + assert(zerr == Z_STREAM_END); /* other errors should've been caught */ + + if ((long) zstream.total_out != uncompressedLen) { + ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", + zstream.total_out, uncompressedLen); + goto z_bail; + } + + // success! + result = true; + +z_bail: + inflateEnd(&zstream); /* free up any allocated structures */ + +bail: + delete[] readBuf; + return result; +} + +/* + * Utility function that expands zip/gzip "deflate" compressed data + * into a buffer. + * + * (This is a clone of the previous function, but it takes a FILE* instead + * of an fd. We could pass fileno(fd) to the above, but we can run into + * trouble when "fp" has a different notion of what fd's file position is.) + * + * "fp" is an open file positioned at the start of the "deflate" data + * "buf" must hold at least "uncompressedLen" bytes. + */ +/*static*/ bool ZipUtils::inflateToBuffer(FILE* fp, void* buf, + long uncompressedLen, long compressedLen) +{ + bool result = false; + const unsigned long kReadBufSize = 32768; + unsigned char* readBuf = NULL; + z_stream zstream; + int zerr; + unsigned long compRemaining; + + assert(uncompressedLen >= 0); + assert(compressedLen >= 0); + + readBuf = new unsigned char[kReadBufSize]; + if (readBuf == NULL) + goto bail; + compRemaining = compressedLen; + + /* + * Initialize the zlib stream. + */ + memset(&zstream, 0, sizeof(zstream)); + zstream.zalloc = Z_NULL; + zstream.zfree = Z_NULL; + zstream.opaque = Z_NULL; + zstream.next_in = NULL; + zstream.avail_in = 0; + zstream.next_out = (Bytef*) buf; + zstream.avail_out = uncompressedLen; + zstream.data_type = Z_UNKNOWN; + + /* + * Use the undocumented "negative window bits" feature to tell zlib + * that there's no zlib header waiting for it. + */ + zerr = inflateInit2(&zstream, -MAX_WBITS); + if (zerr != Z_OK) { + if (zerr == Z_VERSION_ERROR) { + ALOGE("Installed zlib is not compatible with linked version (%s)\n", + ZLIB_VERSION); + } else { + ALOGE("Call to inflateInit2 failed (zerr=%d)\n", zerr); + } + goto bail; + } + + /* + * Loop while we have data. + */ + do { + unsigned long getSize; + + /* read as much as we can */ + if (zstream.avail_in == 0) { + getSize = (compRemaining > kReadBufSize) ? + kReadBufSize : compRemaining; + ALOGV("+++ reading %ld bytes (%ld left)\n", + getSize, compRemaining); + + int cc = fread(readBuf, 1, getSize, fp); + if (cc != (int) getSize) { + ALOGD("inflate read failed (%d vs %ld)\n", + cc, getSize); + goto z_bail; + } + + compRemaining -= getSize; + + zstream.next_in = readBuf; + zstream.avail_in = getSize; + } + + /* uncompress the data */ + zerr = inflate(&zstream, Z_NO_FLUSH); + if (zerr != Z_OK && zerr != Z_STREAM_END) { + ALOGD("zlib inflate call failed (zerr=%d)\n", zerr); + goto z_bail; + } + + /* output buffer holds all, so no need to write the output */ + } while (zerr == Z_OK); + + assert(zerr == Z_STREAM_END); /* other errors should've been caught */ + + if ((long) zstream.total_out != uncompressedLen) { + ALOGW("Size mismatch on inflated file (%ld vs %ld)\n", + zstream.total_out, uncompressedLen); + goto z_bail; + } + + // success! + result = true; + +z_bail: + inflateEnd(&zstream); /* free up any allocated structures */ + +bail: + delete[] readBuf; + return result; +} + +/* + * Look at the contents of a gzip archive. We want to know where the + * data starts, and how long it will be after it is uncompressed. + * + * We expect to find the CRC and length as the last 8 bytes on the file. + * This is a pretty reasonable thing to expect for locally-compressed + * files, but there's a small chance that some extra padding got thrown + * on (the man page talks about compressed data written to tape). We + * don't currently deal with that here. If "gzip -l" whines, we're going + * to fail too. + * + * On exit, "fp" is pointing at the start of the compressed data. + */ +/*static*/ bool ZipUtils::examineGzip(FILE* fp, int* pCompressionMethod, + long* pUncompressedLen, long* pCompressedLen, unsigned long* pCRC32) +{ + enum { // flags + FTEXT = 0x01, + FHCRC = 0x02, + FEXTRA = 0x04, + FNAME = 0x08, + FCOMMENT = 0x10, + }; + int ic; + int method, flags; + int i; + + ic = getc(fp); + if (ic != 0x1f || getc(fp) != 0x8b) + return false; // not gzip + method = getc(fp); + flags = getc(fp); + + /* quick sanity checks */ + if (method == EOF || flags == EOF) + return false; + if (method != ZipFileRO::kCompressDeflated) + return false; + + /* skip over 4 bytes of mod time, 1 byte XFL, 1 byte OS */ + for (i = 0; i < 6; i++) + (void) getc(fp); + /* consume "extra" field, if present */ + if ((flags & FEXTRA) != 0) { + int len; + + len = getc(fp); + len |= getc(fp) << 8; + while (len-- && getc(fp) != EOF) + ; + } + /* consume filename, if present */ + if ((flags & FNAME) != 0) { + do { + ic = getc(fp); + } while (ic != 0 && ic != EOF); + } + /* consume comment, if present */ + if ((flags & FCOMMENT) != 0) { + do { + ic = getc(fp); + } while (ic != 0 && ic != EOF); + } + /* consume 16-bit header CRC, if present */ + if ((flags & FHCRC) != 0) { + (void) getc(fp); + (void) getc(fp); + } + + if (feof(fp) || ferror(fp)) + return false; + + /* seek to the end; CRC and length are in the last 8 bytes */ + long curPosn = ftell(fp); + unsigned char buf[8]; + fseek(fp, -8, SEEK_END); + *pCompressedLen = ftell(fp) - curPosn; + + if (fread(buf, 1, 8, fp) != 8) + return false; + /* seek back to start of compressed data */ + fseek(fp, curPosn, SEEK_SET); + + *pCompressionMethod = method; + *pCRC32 = ZipFileRO::get4LE(&buf[0]); + *pUncompressedLen = ZipFileRO::get4LE(&buf[4]); + + return true; +} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/EGL/eglext.h android-platform-frameworks-native-21/opengl/include/EGL/eglext.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/EGL/eglext.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/EGL/eglext.h 2012-10-16 22:57:11.000000000 +0000 @@ -6,7 +6,7 @@ #endif /* -** Copyright (c) 2007-2013 The Khronos Group Inc. +** Copyright (c) 2007-2010 The Khronos Group Inc. ** ** Permission is hereby granted, free of charge, to any person obtaining a ** copy of this software and/or associated documentation files (the @@ -34,8 +34,8 @@ /* Header file version number */ /* Current version at http://www.khronos.org/registry/egl/ */ -/* $Revision: 20690 $ on $Date: 2013-02-22 17:15:05 -0800 (Fri, 22 Feb 2013) $ */ -#define EGL_EGLEXT_VERSION 15 +/* $Revision: 11249 $ on $Date: 2010-05-05 09:54:28 -0700 (Wed, 05 May 2010) $ */ +#define EGL_EGLEXT_VERSION 5 #ifndef EGL_KHR_config_attribs #define EGL_KHR_config_attribs 1 @@ -120,7 +120,6 @@ #define EGL_GL_RENDERBUFFER_KHR 0x30B9 /* eglCreateImageKHR target */ #endif -#if KHRONOS_SUPPORT_INT64 /* EGLTimeKHR requires 64-bit uint support */ #ifndef EGL_KHR_reusable_sync #define EGL_KHR_reusable_sync 1 @@ -150,7 +149,6 @@ typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBKHRPROC) (EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value); #endif -#endif #ifndef EGL_KHR_image_base #define EGL_KHR_image_base 1 @@ -171,34 +169,19 @@ #define EGL_CONTEXT_PRIORITY_LOW_IMG 0x3103 #endif -#ifndef EGL_KHR_lock_surface2 -#define EGL_KHR_lock_surface2 1 -#define EGL_BITMAP_PIXEL_SIZE_KHR 0x3110 -#endif - -#ifndef EGL_KHR_partial_update -#define EGL_KHR_partial_update 1 -#define EGL_BUFFER_AGE_KHR 0x313D -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSETDAMAGEREGIONKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSetDamageRegionKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); -#endif -#endif /* EGL_KHR_partial_update */ - #ifndef EGL_NV_coverage_sample #define EGL_NV_coverage_sample 1 -#define EGL_COVERAGE_BUFFERS_NV 0x30E0 -#define EGL_COVERAGE_SAMPLES_NV 0x30E1 +#define EGL_COVERAGE_BUFFERS_NV 0x30E0 +#define EGL_COVERAGE_SAMPLES_NV 0x30E1 #endif #ifndef EGL_NV_depth_nonlinear #define EGL_NV_depth_nonlinear 1 -#define EGL_DEPTH_ENCODING_NV 0x30E2 +#define EGL_DEPTH_ENCODING_NV 0x30E2 #define EGL_DEPTH_ENCODING_NONE_NV 0 -#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 +#define EGL_DEPTH_ENCODING_NONLINEAR_NV 0x30E3 #endif -#if KHRONOS_SUPPORT_INT64 /* EGLTimeNV requires 64-bit uint support */ #ifndef EGL_NV_sync #define EGL_NV_sync 1 #define EGL_SYNC_PRIOR_COMMANDS_COMPLETE_NV 0x30E6 @@ -215,14 +198,14 @@ #define EGL_SYNC_FENCE_NV 0x30EF #define EGL_NO_SYNC_NV ((EGLSyncNV)0) typedef void* EGLSyncNV; -typedef khronos_utime_nanoseconds_t EGLTimeNV; +typedef unsigned long long EGLTimeNV; #ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSyncNV EGLAPIENTRY eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroySyncNV (EGLSyncNV sync); -EGLAPI EGLBoolean EGLAPIENTRY eglFenceNV (EGLSyncNV sync); -EGLAPI EGLint EGLAPIENTRY eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); -EGLAPI EGLBoolean EGLAPIENTRY eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); -EGLAPI EGLBoolean EGLAPIENTRY eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); +EGLSyncNV eglCreateFenceSyncNV (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); +EGLBoolean eglDestroySyncNV (EGLSyncNV sync); +EGLBoolean eglFenceNV (EGLSyncNV sync); +EGLint eglClientWaitSyncNV (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); +EGLBoolean eglSignalSyncNV (EGLSyncNV sync, EGLenum mode); +EGLBoolean eglGetSyncAttribNV (EGLSyncNV sync, EGLint attribute, EGLint *value); #endif /* EGL_EGLEXT_PROTOTYPES */ typedef EGLSyncNV (EGLAPIENTRYP PFNEGLCREATEFENCESYNCNVPROC) (EGLDisplay dpy, EGLenum condition, const EGLint *attrib_list); typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSYNCNVPROC) (EGLSyncNV sync); @@ -230,10 +213,9 @@ typedef EGLint (EGLAPIENTRYP PFNEGLCLIENTWAITSYNCNVPROC) (EGLSyncNV sync, EGLint flags, EGLTimeNV timeout); typedef EGLBoolean (EGLAPIENTRYP PFNEGLSIGNALSYNCNVPROC) (EGLSyncNV sync, EGLenum mode); typedef EGLBoolean (EGLAPIENTRYP PFNEGLGETSYNCATTRIBNVPROC) (EGLSyncNV sync, EGLint attribute, EGLint *value); -#endif +typedef EGLClientBuffer (EGLAPIENTRYP PFNEGLGETRENDERBUFFERANDROIDPROC) (EGLDisplay dpy, EGLSurface draw); #endif -#if KHRONOS_SUPPORT_INT64 /* Dependent on EGL_KHR_reusable_sync which requires 64-bit uint support */ #ifndef EGL_KHR_fence_sync #define EGL_KHR_fence_sync 1 /* Reuses most tokens and entry points from EGL_KHR_reusable_sync */ @@ -241,365 +223,65 @@ #define EGL_SYNC_CONDITION_KHR 0x30F8 #define EGL_SYNC_FENCE_KHR 0x30F9 #endif -#endif - -#ifndef EGL_HI_clientpixmap -#define EGL_HI_clientpixmap 1 - -/* Surface Attribute */ -#define EGL_CLIENT_PIXMAP_POINTER_HI 0x8F74 -/* - * Structure representing a client pixmap - * (pixmap's data is in client-space memory). - */ -struct EGLClientPixmapHI -{ - void* pData; - EGLint iWidth; - EGLint iHeight; - EGLint iStride; -}; -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSurface EGLAPIENTRY eglCreatePixmapSurfaceHI(EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATEPIXMAPSURFACEHIPROC) (EGLDisplay dpy, EGLConfig config, struct EGLClientPixmapHI* pixmap); -#endif /* EGL_HI_clientpixmap */ - -#ifndef EGL_HI_colorformats -#define EGL_HI_colorformats 1 -/* Config Attribute */ -#define EGL_COLOR_FORMAT_HI 0x8F70 -/* Color Formats */ -#define EGL_COLOR_RGB_HI 0x8F71 -#define EGL_COLOR_RGBA_HI 0x8F72 -#define EGL_COLOR_ARGB_HI 0x8F73 -#endif /* EGL_HI_colorformats */ - -#ifndef EGL_MESA_drm_image -#define EGL_MESA_drm_image 1 -#define EGL_DRM_BUFFER_FORMAT_MESA 0x31D0 /* CreateDRMImageMESA attribute */ -#define EGL_DRM_BUFFER_USE_MESA 0x31D1 /* CreateDRMImageMESA attribute */ -#define EGL_DRM_BUFFER_FORMAT_ARGB32_MESA 0x31D2 /* EGL_IMAGE_FORMAT_MESA attribute value */ -#define EGL_DRM_BUFFER_MESA 0x31D3 /* eglCreateImageKHR target */ -#define EGL_DRM_BUFFER_STRIDE_MESA 0x31D4 -#define EGL_DRM_BUFFER_USE_SCANOUT_MESA 0x00000001 /* EGL_DRM_BUFFER_USE_MESA bits */ -#define EGL_DRM_BUFFER_USE_SHARE_MESA 0x00000002 /* EGL_DRM_BUFFER_USE_MESA bits */ -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLImageKHR EGLAPIENTRY eglCreateDRMImageMESA (EGLDisplay dpy, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglExportDRMImageMESA (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLImageKHR (EGLAPIENTRYP PFNEGLCREATEDRMIMAGEMESAPROC) (EGLDisplay dpy, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLEXPORTDRMIMAGEMESAPROC) (EGLDisplay dpy, EGLImageKHR image, EGLint *name, EGLint *handle, EGLint *stride); -#endif - -#ifndef EGL_NV_post_sub_buffer -#define EGL_NV_post_sub_buffer 1 -#define EGL_POST_SUB_BUFFER_SUPPORTED_NV 0x30BE -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglPostSubBufferNV (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLPOSTSUBBUFFERNVPROC) (EGLDisplay dpy, EGLSurface surface, EGLint x, EGLint y, EGLint width, EGLint height); -#endif - -#ifndef EGL_ANGLE_query_surface_pointer -#define EGL_ANGLE_query_surface_pointer 1 -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean eglQuerySurfacePointerANGLE(EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); -#endif -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSURFACEPOINTERANGLEPROC) (EGLDisplay dpy, EGLSurface surface, EGLint attribute, void **value); -#endif -#ifndef EGL_ANGLE_surface_d3d_texture_2d_share_handle -#define EGL_ANGLE_surface_d3d_texture_2d_share_handle 1 -#define EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE 0x3200 +#ifndef EGL_ANDROID_image_native_buffer +#define EGL_ANDROID_image_native_buffer 1 +struct ANativeWindowBuffer; +#define EGL_NATIVE_BUFFER_ANDROID 0x3140 /* eglCreateImageKHR target */ #endif -#ifndef EGL_NV_coverage_sample_resolve -#define EGL_NV_coverage_sample_resolve 1 -#define EGL_COVERAGE_SAMPLE_RESOLVE_NV 0x3131 -#define EGL_COVERAGE_SAMPLE_RESOLVE_DEFAULT_NV 0x3132 -#define EGL_COVERAGE_SAMPLE_RESOLVE_NONE_NV 0x3133 +#ifndef EGL_ANDROID_recordable +#define EGL_ANDROID_recordable 1 +#define EGL_RECORDABLE_ANDROID 0x3142 /* EGLConfig attribute */ #endif -#if KHRONOS_SUPPORT_INT64 /* EGLuint64NV requires 64-bit uint support */ +/* EGL_NV_system_time + */ #ifndef EGL_NV_system_time #define EGL_NV_system_time 1 -typedef khronos_utime_nanoseconds_t EGLuint64NV; +typedef khronos_int64_t EGLint64NV; +typedef khronos_uint64_t EGLuint64NV; #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeFrequencyNV(void); EGLAPI EGLuint64NV EGLAPIENTRY eglGetSystemTimeNV(void); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC) (void); -typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC) (void); -#endif -#endif - -#if KHRONOS_SUPPORT_INT64 /* EGLuint64KHR requires 64-bit uint support */ -#ifndef EGL_KHR_stream -#define EGL_KHR_stream 1 -typedef void* EGLStreamKHR; -typedef khronos_uint64_t EGLuint64KHR; -#define EGL_NO_STREAM_KHR ((EGLStreamKHR)0) -#define EGL_CONSUMER_LATENCY_USEC_KHR 0x3210 -#define EGL_PRODUCER_FRAME_KHR 0x3212 -#define EGL_CONSUMER_FRAME_KHR 0x3213 -#define EGL_STREAM_STATE_KHR 0x3214 -#define EGL_STREAM_STATE_CREATED_KHR 0x3215 -#define EGL_STREAM_STATE_CONNECTING_KHR 0x3216 -#define EGL_STREAM_STATE_EMPTY_KHR 0x3217 -#define EGL_STREAM_STATE_NEW_FRAME_AVAILABLE_KHR 0x3218 -#define EGL_STREAM_STATE_OLD_FRAME_AVAILABLE_KHR 0x3219 -#define EGL_STREAM_STATE_DISCONNECTED_KHR 0x321A -#define EGL_BAD_STREAM_KHR 0x321B -#define EGL_BAD_STATE_KHR 0x321C -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list); -EGLAPI EGLBoolean EGLAPIENTRY eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLBoolean EGLAPIENTRY eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMKHRPROC)(EGLDisplay dpy, const EGLint *attrib_list); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLDESTROYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMATTRIBKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint value); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLint *value); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMU64KHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLuint64KHR *value); -#endif -#endif - -#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ -#ifndef EGL_KHR_stream_consumer_gltexture -#define EGL_KHR_stream_consumer_gltexture 1 -#define EGL_CONSUMER_ACQUIRE_TIMEOUT_USEC_KHR 0x321E -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerAcquireKHR(EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLBoolean EGLAPIENTRY eglStreamConsumerReleaseKHR(EGLDisplay dpy, EGLStreamKHR stream); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERGLTEXTUREEXTERNALKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERACQUIREKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSTREAMCONSUMERRELEASEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); -#endif -#endif - -#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ -#ifndef EGL_KHR_stream_producer_eglsurface -#define EGL_KHR_stream_producer_eglsurface 1 -#define EGL_STREAM_BIT_KHR 0x0800 -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLSurface EGLAPIENTRY eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLSurface (EGLAPIENTRYP PFNEGLCREATESTREAMPRODUCERSURFACEKHRPROC)(EGLDisplay dpy, EGLConfig config, EGLStreamKHR stream, const EGLint *attrib_list); -#endif -#endif - -#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ -#ifndef EGL_KHR_stream_producer_aldatalocator -#define EGL_KHR_stream_producer_aldatalocator 1 -#endif -#endif - -#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ -#ifndef EGL_KHR_stream_fifo -#define EGL_KHR_stream_fifo 1 -/* reuse EGLTimeKHR */ -#define EGL_STREAM_FIFO_LENGTH_KHR 0x31FC -#define EGL_STREAM_TIME_NOW_KHR 0x31FD -#define EGL_STREAM_TIME_CONSUMER_KHR 0x31FE -#define EGL_STREAM_TIME_PRODUCER_KHR 0x31FF -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYSTREAMTIMEKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream, EGLenum attribute, EGLTimeKHR *value); -#endif -#endif - -#ifndef EGL_EXT_create_context_robustness -#define EGL_EXT_create_context_robustness 1 -#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_EXT 0x30BF -#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_EXT 0x3138 -#define EGL_NO_RESET_NOTIFICATION_EXT 0x31BE -#define EGL_LOSE_CONTEXT_ON_RESET_EXT 0x31BF -#endif - -#ifndef EGL_ANGLE_d3d_share_handle_client_buffer -#define EGL_ANGLE_d3d_share_handle_client_buffer 1 -/* reuse EGL_D3D_TEXTURE_2D_SHARE_HANDLE_ANGLE */ -#endif - -#ifndef EGL_KHR_create_context -#define EGL_KHR_create_context 1 -#define EGL_CONTEXT_MAJOR_VERSION_KHR EGL_CONTEXT_CLIENT_VERSION -#define EGL_CONTEXT_MINOR_VERSION_KHR 0x30FB -#define EGL_CONTEXT_FLAGS_KHR 0x30FC -#define EGL_CONTEXT_OPENGL_PROFILE_MASK_KHR 0x30FD -#define EGL_CONTEXT_OPENGL_RESET_NOTIFICATION_STRATEGY_KHR 0x31BD -#define EGL_NO_RESET_NOTIFICATION_KHR 0x31BE -#define EGL_LOSE_CONTEXT_ON_RESET_KHR 0x31BF -#define EGL_CONTEXT_OPENGL_DEBUG_BIT_KHR 0x00000001 -#define EGL_CONTEXT_OPENGL_FORWARD_COMPATIBLE_BIT_KHR 0x00000002 -#define EGL_CONTEXT_OPENGL_ROBUST_ACCESS_BIT_KHR 0x00000004 -#define EGL_CONTEXT_OPENGL_CORE_PROFILE_BIT_KHR 0x00000001 -#define EGL_CONTEXT_OPENGL_COMPATIBILITY_PROFILE_BIT_KHR 0x00000002 -#define EGL_OPENGL_ES3_BIT_KHR 0x00000040 -#endif - -#ifndef EGL_KHR_create_context_no_error -#define EGL_KHR_create_context_no_error 1 -#define EGL_CONTEXT_OPENGL_NO_ERROR_KHR 0x31B3 -#endif /* EGL_KHR_create_context_no_error */ - -#ifndef EGL_KHR_surfaceless_context -#define EGL_KHR_surfaceless_context 1 -/* No tokens/entry points, just relaxes an error condition */ -#endif - -#ifndef EGL_KHR_swap_buffers_with_damage -#define EGL_KHR_swap_buffers_with_damage 1 -typedef EGLBoolean (EGLAPIENTRYP PFNEGLSWAPBUFFERSWITHDAMAGEKHRPROC) (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglSwapBuffersWithDamageKHR (EGLDisplay dpy, EGLSurface surface, EGLint *rects, EGLint n_rects); -#endif -#endif /* EGL_KHR_swap_buffers_with_damage */ - -#ifdef EGL_KHR_stream /* Requires KHR_stream extension */ -#ifndef EGL_KHR_stream_cross_process_fd -#define EGL_KHR_stream_cross_process_fd 1 -typedef int EGLNativeFileDescriptorKHR; -#define EGL_NO_FILE_DESCRIPTOR_KHR ((EGLNativeFileDescriptorKHR)(-1)) -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLNativeFileDescriptorKHR EGLAPIENTRY eglGetStreamFileDescriptorKHR(EGLDisplay dpy, EGLStreamKHR stream); -EGLAPI EGLStreamKHR EGLAPIENTRY eglCreateStreamFromFileDescriptorKHR(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLNativeFileDescriptorKHR (EGLAPIENTRYP PFNEGLGETSTREAMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLStreamKHR stream); -typedef EGLStreamKHR (EGLAPIENTRYP PFNEGLCREATESTREAMFROMFILEDESCRIPTORKHRPROC)(EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor); -#endif -#endif - -#ifndef EGL_EXT_multiview_window -#define EGL_EXT_multiview_window 1 -#define EGL_MULTIVIEW_VIEW_COUNT_EXT 0x3134 -#endif - -#ifndef EGL_KHR_wait_sync -#define EGL_KHR_wait_sync 1 -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLint EGLAPIENTRY eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLint (EGLAPIENTRYP PFNEGLWAITSYNCKHRPROC)(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags); #endif - -#ifndef EGL_NV_post_convert_rounding -#define EGL_NV_post_convert_rounding 1 -/* No tokens or entry points, just relaxes behavior of SwapBuffers */ -#endif - -#ifndef EGL_NV_native_query -#define EGL_NV_native_query 1 -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeDisplayNV( EGLDisplay dpy, EGLNativeDisplayType* display_id); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativeWindowNV( EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType* window); -EGLAPI EGLBoolean EGLAPIENTRY eglQueryNativePixmapNV( EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType* pixmap); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEDISPLAYNVPROC)(EGLDisplay dpy, EGLNativeDisplayType *display_id); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEWINDOWNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativeWindowType *window); -typedef EGLBoolean (EGLAPIENTRYP PFNEGLQUERYNATIVEPIXMAPNVPROC)(EGLDisplay dpy, EGLSurface surf, EGLNativePixmapType *pixmap); -#endif - -#ifndef EGL_NV_3dvision_surface -#define EGL_NV_3dvision_surface 1 -#define EGL_AUTO_STEREO_NV 0x3136 -#endif - -#ifndef EGL_ANDROID_framebuffer_target -#define EGL_ANDROID_framebuffer_target 1 -#define EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 -#endif - -#ifndef EGL_ANDROID_image_crop -#define EGL_ANDROID_image_crop 1 -#define EGL_IMAGE_CROP_LEFT_ANDROID 0x3148 -#define EGL_IMAGE_CROP_TOP_ANDROID 0x3149 -#define EGL_IMAGE_CROP_RIGHT_ANDROID 0x314A -#define EGL_IMAGE_CROP_BOTTOM_ANDROID 0x314B +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMEFREQUENCYNVPROC)(void); +typedef EGLuint64NV (EGLAPIENTRYP PFNEGLGETSYSTEMTIMENVPROC)(void); #endif +/* EGL_ANDROID_blob_cache + */ #ifndef EGL_ANDROID_blob_cache #define EGL_ANDROID_blob_cache 1 typedef khronos_ssize_t EGLsizeiANDROID; -typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); -typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); +typedef void (*EGLSetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, const void* value, EGLsizeiANDROID valueSize); +typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void* key, EGLsizeiANDROID keySize, void* value, EGLsizeiANDROID valueSize); #ifdef EGL_EGLEXT_PROTOTYPES EGLAPI void EGLAPIENTRY eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #endif /* EGL_EGLEXT_PROTOTYPES */ -typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC)(EGLDisplay dpy, EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); +typedef void (EGLAPIENTRYP PFNEGLSETBLOBCACHEFUNCSANDROIDPROC) (EGLDisplay dpy, + EGLSetBlobFuncANDROID set, EGLGetBlobFuncANDROID get); #endif -#ifndef EGL_ANDROID_image_native_buffer -#define EGL_ANDROID_image_native_buffer 1 -#define EGL_NATIVE_BUFFER_ANDROID 0x3140 -#endif - -#ifndef EGL_ANDROID_native_fence_sync -#define EGL_ANDROID_native_fence_sync 1 -#define EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 -#define EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 -#define EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 -#define EGL_NO_NATIVE_FENCE_FD_ANDROID -1 +/* EGL_ANDROID_get_render_buffer + */ +#ifndef EGL_ANDROID_get_render_buffer +#define EGL_ANDROID_get_render_buffer 1 #ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLint EGLAPIENTRY eglDupNativeFenceFDANDROID( EGLDisplay dpy, EGLSyncKHR); -#endif /* EGL_EGLEXT_PROTOTYPES */ -typedef EGLint (EGLAPIENTRYP PFNEGLDUPNATIVEFENCEFDANDROIDPROC)(EGLDisplay dpy, EGLSyncKHR); +EGLAPI EGLClientBuffer EGLAPIENTRY eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw); #endif - -#ifndef EGL_ANDROID_recordable -#define EGL_ANDROID_recordable 1 -#define EGL_RECORDABLE_ANDROID 0x3142 #endif -#ifndef EGL_EXT_buffer_age -#define EGL_EXT_buffer_age 1 -#define EGL_BUFFER_AGE_EXT 0x313D -#endif - -#ifndef EGL_EXT_image_dma_buf_import -#define EGL_EXT_image_dma_buf_import 1 -#define EGL_LINUX_DMA_BUF_EXT 0x3270 -#define EGL_LINUX_DRM_FOURCC_EXT 0x3271 -#define EGL_DMA_BUF_PLANE0_FD_EXT 0x3272 -#define EGL_DMA_BUF_PLANE0_OFFSET_EXT 0x3273 -#define EGL_DMA_BUF_PLANE0_PITCH_EXT 0x3274 -#define EGL_DMA_BUF_PLANE1_FD_EXT 0x3275 -#define EGL_DMA_BUF_PLANE1_OFFSET_EXT 0x3276 -#define EGL_DMA_BUF_PLANE1_PITCH_EXT 0x3277 -#define EGL_DMA_BUF_PLANE2_FD_EXT 0x3278 -#define EGL_DMA_BUF_PLANE2_OFFSET_EXT 0x3279 -#define EGL_DMA_BUF_PLANE2_PITCH_EXT 0x327A -#define EGL_YUV_COLOR_SPACE_HINT_EXT 0x327B -#define EGL_SAMPLE_RANGE_HINT_EXT 0x327C -#define EGL_YUV_CHROMA_HORIZONTAL_SITING_HINT_EXT 0x327D -#define EGL_YUV_CHROMA_VERTICAL_SITING_HINT_EXT 0x327E -#define EGL_ITU_REC601_EXT 0x327F -#define EGL_ITU_REC709_EXT 0x3280 -#define EGL_ITU_REC2020_EXT 0x3281 -#define EGL_YUV_FULL_RANGE_EXT 0x3282 -#define EGL_YUV_NARROW_RANGE_EXT 0x3283 -#define EGL_YUV_CHROMA_SITING_0_EXT 0x3284 -#define EGL_YUV_CHROMA_SITING_0_5_EXT 0x3285 -#endif - -#ifndef EGL_ANDROID_presentation_time -#define EGL_ANDROID_presentation_time 1 -typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; -#ifdef EGL_EGLEXT_PROTOTYPES -EGLAPI EGLBoolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time); -#else -typedef EGLBoolean (EGLAPIENTRYP PFNEGLPRESENTATIONTIMEANDROID) (EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time); -#endif +/* EGL_IMG_hibernate_process + */ +#ifndef EGL_IMG_hibernate_process +#define EGL_IMG_hibernate_process 1 +typedef EGLBoolean (EGLAPIENTRYP PFEGLHIBERNATEPROCESSIMGPROC)(void); +typedef EGLBoolean (EGLAPIENTRYP PFEGLAWAKENPROCESSIMGPROC)(void); #endif #ifdef __cplusplus } #endif -#endif /* __eglext_h_ */ +#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/EGL/eglplatform.h android-platform-frameworks-native-21/opengl/include/EGL/eglplatform.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/EGL/eglplatform.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/EGL/eglplatform.h 2012-10-16 22:57:11.000000000 +0000 @@ -25,7 +25,7 @@ */ /* Platform-specific types and definitions for egl.h - * $Revision: 12306 $ on $Date: 2010-08-25 09:51:28 -0700 (Wed, 25 Aug 2010) $ + * $Revision: 9724 $ on $Date: 2009-12-02 02:05:33 -0800 (Wed, 02 Dec 2009) $ * * Adopters may modify khrplatform.h and this file to suit their platform. * You are encouraged to submit all modifications to the Khronos group so that @@ -60,11 +60,6 @@ * Windows Device Context. They must be defined in platform-specific * code below. The EGL-prefixed versions of Native*Type are the same * types, renamed in EGL 1.3 so all types in the API start with "EGL". - * - * Khronos STRONGLY RECOMMENDS that you use the default definitions - * provided below, since these changes affect both binary and source - * portability of applications using EGL running on different EGL - * implementations. */ #if defined(_WIN32) || defined(__VC32__) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__) /* Win32 and WinCE */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES/glext.h android-platform-frameworks-native-21/opengl/include/GLES/glext.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES/glext.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES/glext.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,7 +1,7 @@ #ifndef __glext_h_ #define __glext_h_ -/* $Revision: 20798 $ on $Date:: 2013-03-07 01:19:34 -0800 #$ */ +/* $Revision: 16481 $ on $Date:: 2012-01-04 10:43:56 -0800 #$ */ #ifdef __cplusplus extern "C" { @@ -165,9 +165,6 @@ #define GL_DEPTH24_STENCIL8_OES 0x88F0 #endif -/* GL_OES_required_internalformat */ -/* No new tokens introduced by this extension. */ - /* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 #define GL_RGB8_OES 0x8051 @@ -243,7 +240,7 @@ * APPLE extension tokens *------------------------------------------------------------------------*/ -/* GL_APPLE_copy_texture_levels */ +/* GL_APPLE_texture_2D_limited_npot */ /* No new tokens introduced by this extension. */ /* GL_APPLE_framebuffer_multisample */ @@ -257,41 +254,6 @@ #define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA #endif -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync - -/* These types are defined with reference to - * in the Apple extension spec, but here we use the Khronos - * portable types in khrplatform.h, and assume those types - * are always defined. - * If any other extensions using these types are defined, - * the typedefs must move out of this block and be shared. - */ -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef struct __GLsync *GLsync; - -#define GL_SYNC_OBJECT_APPLE 0x8A53 -#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 -#define GL_OBJECT_TYPE_APPLE 0x9112 -#define GL_SYNC_CONDITION_APPLE 0x9113 -#define GL_SYNC_STATUS_APPLE 0x9114 -#define GL_SYNC_FLAGS_APPLE 0x9115 -#define GL_SYNC_FENCE_APPLE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 -#define GL_UNSIGNALED_APPLE 0x9118 -#define GL_SIGNALED_APPLE 0x9119 -#define GL_ALREADY_SIGNALED_APPLE 0x911A -#define GL_TIMEOUT_EXPIRED_APPLE 0x911B -#define GL_CONDITION_SATISFIED_APPLE 0x911C -#define GL_WAIT_FAILED_APPLE 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 -#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull -#endif - -/* GL_APPLE_texture_2D_limited_npot */ -/* No new tokens introduced by this extension. */ - /* GL_APPLE_texture_format_BGRA8888 */ #ifndef GL_APPLE_texture_format_BGRA8888 #define GL_BGRA_EXT 0x80E1 @@ -326,23 +288,12 @@ #define GL_STENCIL_EXT 0x1802 #endif -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_MAP_READ_BIT_EXT 0x0001 -#define GL_MAP_WRITE_BIT_EXT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 -#endif - /* GL_EXT_multisampled_render_to_texture */ #ifndef GL_EXT_multisampled_render_to_texture #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -/* reuse values from GL_EXT_framebuffer_multisample (desktop extension) */ -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 +#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 +#define GL_MAX_SAMPLES_EXT 0x9135 #endif /* GL_EXT_multi_draw_arrays */ @@ -402,10 +353,10 @@ /* GL_EXT_texture_storage */ #ifndef GL_EXT_texture_storage #define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C +#define GL_ALPHA8_EXT 0x803C #define GL_LUMINANCE8_EXT 0x8040 #define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 +#define GL_RGBA32F_EXT 0x8814 #define GL_RGB32F_EXT 0x8815 #define GL_ALPHA32F_EXT 0x8816 #define GL_LUMINANCE32F_EXT 0x8818 @@ -415,7 +366,7 @@ #define GL_ALPHA16F_EXT 0x881C #define GL_LUMINANCE16F_EXT 0x881E #define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_A2_EXT 0x8059 #define GL_RGB10_EXT 0x8052 #define GL_BGRA8_EXT 0x93A1 #endif @@ -820,11 +771,6 @@ #define GL_OES_packed_depth_stencil 1 #endif -/* GL_OES_required_internalformat */ -#ifndef GL_OES_required_internalformat -#define GL_OES_required_internalformat 1 -#endif - /* GL_OES_query_matrix */ #ifndef GL_OES_query_matrix #define GL_OES_query_matrix 1 @@ -946,52 +892,22 @@ * APPLE extension functions *------------------------------------------------------------------------*/ -/* GL_APPLE_copy_texture_levels */ -#ifndef GL_APPLE_copy_texture_levels -#define GL_APPLE_copy_texture_levels 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#endif -typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +/* GL_APPLE_texture_2D_limited_npot */ +#ifndef GL_APPLE_texture_2D_limited_npot +#define GL_APPLE_texture_2D_limited_npot 1 #endif /* GL_APPLE_framebuffer_multisample */ #ifndef GL_APPLE_framebuffer_multisample #define GL_APPLE_framebuffer_multisample 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum, GLsizei, GLenum, GLsizei, GLsizei); +GL_API void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GL_API void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); #endif /* GL_GLEXT_PROTOTYPES */ typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #endif -/* GL_APPLE_sync */ -#ifndef GL_APPLE_sync -#define GL_APPLE_sync 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); -GL_API GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); -GL_API void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); -GL_API GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_API void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_API void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); -GL_API void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif -typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); -typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); -typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif - -/* GL_APPLE_texture_2D_limited_npot */ -#ifndef GL_APPLE_texture_2D_limited_npot -#define GL_APPLE_texture_2D_limited_npot 1 -#endif - /* GL_APPLE_texture_format_BGRA8888 */ #ifndef GL_APPLE_texture_format_BGRA8888 #define GL_APPLE_texture_format_BGRA8888 1 @@ -1029,23 +945,12 @@ typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); #endif -/* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_map_buffer_range -#define GL_EXT_map_buffer_range 1 -#ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY *glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_API void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); -#endif -typedef void* (GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); -#endif - /* GL_EXT_multisampled_render_to_texture */ #ifndef GL_EXT_multisampled_render_to_texture #define GL_EXT_multisampled_render_to_texture 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +GL_API void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); @@ -1055,11 +960,11 @@ #ifndef GL_EXT_multi_draw_arrays #define GL_EXT_multi_draw_arrays 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum, const GLint *, const GLsizei *, GLsizei); -GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum, const GLsizei *, GLenum, const GLvoid* const*, GLsizei); +GL_API void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +GL_API void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif /* GL_GLEXT_PROTOTYPES */ -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* const*indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif /* GL_EXT_read_format_bgra */ @@ -1149,8 +1054,8 @@ #ifndef GL_IMG_user_clip_plane #define GL_IMG_user_clip_plane 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glClipPlanefIMG (GLenum, const GLfloat *); -GL_API void GL_APIENTRY glClipPlanexIMG (GLenum, const GLfixed *); +GL_API void GL_APIENTRY glClipPlanefIMG (GLenum p, const GLfloat *eqn); +GL_API void GL_APIENTRY glClipPlanexIMG (GLenum p, const GLfixed *eqn); #endif typedef void (GL_APIENTRYP PFNGLCLIPPLANEFIMGPROC) (GLenum p, const GLfloat *eqn); typedef void (GL_APIENTRYP PFNGLCLIPPLANEXIMGPROC) (GLenum p, const GLfixed *eqn); @@ -1160,11 +1065,11 @@ #ifndef GL_IMG_multisampled_render_to_texture #define GL_IMG_multisampled_render_to_texture 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum, GLsizei, GLenum, GLsizei, GLsizei); -GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum, GLenum, GLenum, GLuint, GLint, GLsizei); +GL_API void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_API void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif /*------------------------------------------------------------------------* @@ -1175,13 +1080,13 @@ #ifndef GL_NV_fence #define GL_NV_fence 1 #ifdef GL_GLEXT_PROTOTYPES -GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei, const GLuint *); -GL_API void GL_APIENTRY glGenFencesNV (GLsizei, GLuint *); -GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint); -GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint); -GL_API void GL_APIENTRY glGetFenceivNV (GLuint, GLenum, GLint *); -GL_API void GL_APIENTRY glFinishFenceNV (GLuint); -GL_API void GL_APIENTRY glSetFenceNV (GLuint, GLenum); +GL_API void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); +GL_API void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); +GL_API GLboolean GL_APIENTRY glIsFenceNV (GLuint fence); +GL_API GLboolean GL_APIENTRY glTestFenceNV (GLuint fence); +GL_API void GL_APIENTRY glGetFenceivNV (GLuint fence, GLenum pname, GLint *params); +GL_API void GL_APIENTRY glFinishFenceNV (GLuint fence); +GL_API void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #endif typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES2/gl2ext.h android-platform-frameworks-native-21/opengl/include/GLES2/gl2ext.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES2/gl2ext.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES2/gl2ext.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,1359 +1,1160 @@ #ifndef __gl2ext_h_ -#define __gl2ext_h_ 1 +#define __gl2ext_h_ + +/* $Revision: 16619 $ on $Date:: 2012-01-18 10:00:14 -0800 #$ */ #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision$ on $Date$ -*/ + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ #ifndef GL_APIENTRYP -#define GL_APIENTRYP GL_APIENTRY* +# define GL_APIENTRYP GL_APIENTRY* #endif -/* Generated on date 20140519 */ +/*------------------------------------------------------------------------* + * OES extension tokens + *------------------------------------------------------------------------*/ -/* Generated C header for: - * API: gles2 - * Profile: common - * Versions considered: 2\.[0-9] - * Versions emitted: _nomatch_^ - * Default extensions included: gles2 - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ +/* GL_OES_compressed_ETC1_RGB8_texture */ +#ifndef GL_OES_compressed_ETC1_RGB8_texture +#define GL_ETC1_RGB8_OES 0x8D64 +#endif + +/* GL_OES_compressed_paletted_texture */ +#ifndef GL_OES_compressed_paletted_texture +#define GL_PALETTE4_RGB8_OES 0x8B90 +#define GL_PALETTE4_RGBA8_OES 0x8B91 +#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 +#define GL_PALETTE4_RGBA4_OES 0x8B93 +#define GL_PALETTE4_RGB5_A1_OES 0x8B94 +#define GL_PALETTE8_RGB8_OES 0x8B95 +#define GL_PALETTE8_RGBA8_OES 0x8B96 +#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 +#define GL_PALETTE8_RGBA4_OES 0x8B98 +#define GL_PALETTE8_RGB5_A1_OES 0x8B99 +#endif + +/* GL_OES_depth24 */ +#ifndef GL_OES_depth24 +#define GL_DEPTH_COMPONENT24_OES 0x81A6 +#endif -#ifndef GL_KHR_blend_equation_advanced -#define GL_KHR_blend_equation_advanced 1 -#define GL_BLEND_ADVANCED_COHERENT_KHR 0x9285 -#define GL_MULTIPLY_KHR 0x9294 -#define GL_SCREEN_KHR 0x9295 -#define GL_OVERLAY_KHR 0x9296 -#define GL_DARKEN_KHR 0x9297 -#define GL_LIGHTEN_KHR 0x9298 -#define GL_COLORDODGE_KHR 0x9299 -#define GL_COLORBURN_KHR 0x929A -#define GL_HARDLIGHT_KHR 0x929B -#define GL_SOFTLIGHT_KHR 0x929C -#define GL_DIFFERENCE_KHR 0x929E -#define GL_EXCLUSION_KHR 0x92A0 -#define GL_HSL_HUE_KHR 0x92AD -#define GL_HSL_SATURATION_KHR 0x92AE -#define GL_HSL_COLOR_KHR 0x92AF -#define GL_HSL_LUMINOSITY_KHR 0x92B0 -typedef void (GL_APIENTRYP PFNGLBLENDBARRIERKHRPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlendBarrierKHR (void); -#endif -#endif /* GL_KHR_blend_equation_advanced */ - -#ifndef GL_KHR_debug -#define GL_KHR_debug 1 -typedef void (GL_APIENTRY *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); -#define GL_SAMPLER 0x82E6 -#define GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR 0x8242 -#define GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR 0x8243 -#define GL_DEBUG_CALLBACK_FUNCTION_KHR 0x8244 -#define GL_DEBUG_CALLBACK_USER_PARAM_KHR 0x8245 -#define GL_DEBUG_SOURCE_API_KHR 0x8246 -#define GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR 0x8247 -#define GL_DEBUG_SOURCE_SHADER_COMPILER_KHR 0x8248 -#define GL_DEBUG_SOURCE_THIRD_PARTY_KHR 0x8249 -#define GL_DEBUG_SOURCE_APPLICATION_KHR 0x824A -#define GL_DEBUG_SOURCE_OTHER_KHR 0x824B -#define GL_DEBUG_TYPE_ERROR_KHR 0x824C -#define GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR 0x824D -#define GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR 0x824E -#define GL_DEBUG_TYPE_PORTABILITY_KHR 0x824F -#define GL_DEBUG_TYPE_PERFORMANCE_KHR 0x8250 -#define GL_DEBUG_TYPE_OTHER_KHR 0x8251 -#define GL_DEBUG_TYPE_MARKER_KHR 0x8268 -#define GL_DEBUG_TYPE_PUSH_GROUP_KHR 0x8269 -#define GL_DEBUG_TYPE_POP_GROUP_KHR 0x826A -#define GL_DEBUG_SEVERITY_NOTIFICATION_KHR 0x826B -#define GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR 0x826C -#define GL_DEBUG_GROUP_STACK_DEPTH_KHR 0x826D -#define GL_BUFFER_KHR 0x82E0 -#define GL_SHADER_KHR 0x82E1 -#define GL_PROGRAM_KHR 0x82E2 -#define GL_VERTEX_ARRAY_KHR 0x8074 -#define GL_QUERY_KHR 0x82E3 -#define GL_SAMPLER_KHR 0x82E6 -#define GL_MAX_LABEL_LENGTH_KHR 0x82E8 -#define GL_MAX_DEBUG_MESSAGE_LENGTH_KHR 0x9143 -#define GL_MAX_DEBUG_LOGGED_MESSAGES_KHR 0x9144 -#define GL_DEBUG_LOGGED_MESSAGES_KHR 0x9145 -#define GL_DEBUG_SEVERITY_HIGH_KHR 0x9146 -#define GL_DEBUG_SEVERITY_MEDIUM_KHR 0x9147 -#define GL_DEBUG_SEVERITY_LOW_KHR 0x9148 -#define GL_DEBUG_OUTPUT_KHR 0x92E0 -#define GL_CONTEXT_FLAG_DEBUG_BIT_KHR 0x00000002 -#define GL_STACK_OVERFLOW_KHR 0x0503 -#define GL_STACK_UNDERFLOW_KHR 0x0504 -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECONTROLKHRPROC) (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGEINSERTKHRPROC) (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -typedef void (GL_APIENTRYP PFNGLDEBUGMESSAGECALLBACKKHRPROC) (GLDEBUGPROCKHR callback, const void *userParam); -typedef GLuint (GL_APIENTRYP PFNGLGETDEBUGMESSAGELOGKHRPROC) (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -typedef void (GL_APIENTRYP PFNGLPUSHDEBUGGROUPKHRPROC) (GLenum source, GLuint id, GLsizei length, const GLchar *message); -typedef void (GL_APIENTRYP PFNGLPOPDEBUGGROUPKHRPROC) (void); -typedef void (GL_APIENTRYP PFNGLOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELKHRPROC) (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTPTRLABELKHRPROC) (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETPOINTERVKHRPROC) (GLenum pname, void **params); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDebugMessageControlKHR (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled); -GL_APICALL void GL_APIENTRY glDebugMessageInsertKHR (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf); -GL_APICALL void GL_APIENTRY glDebugMessageCallbackKHR (GLDEBUGPROCKHR callback, const void *userParam); -GL_APICALL GLuint GL_APIENTRY glGetDebugMessageLogKHR (GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog); -GL_APICALL void GL_APIENTRY glPushDebugGroupKHR (GLenum source, GLuint id, GLsizei length, const GLchar *message); -GL_APICALL void GL_APIENTRY glPopDebugGroupKHR (void); -GL_APICALL void GL_APIENTRY glObjectLabelKHR (GLenum identifier, GLuint name, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabelKHR (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glObjectPtrLabelKHR (const void *ptr, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectPtrLabelKHR (const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label); -GL_APICALL void GL_APIENTRY glGetPointervKHR (GLenum pname, void **params); -#endif -#endif /* GL_KHR_debug */ - -#ifndef GL_KHR_texture_compression_astc_hdr -#define GL_KHR_texture_compression_astc_hdr 1 -#define GL_COMPRESSED_RGBA_ASTC_4x4_KHR 0x93B0 -#define GL_COMPRESSED_RGBA_ASTC_5x4_KHR 0x93B1 -#define GL_COMPRESSED_RGBA_ASTC_5x5_KHR 0x93B2 -#define GL_COMPRESSED_RGBA_ASTC_6x5_KHR 0x93B3 -#define GL_COMPRESSED_RGBA_ASTC_6x6_KHR 0x93B4 -#define GL_COMPRESSED_RGBA_ASTC_8x5_KHR 0x93B5 -#define GL_COMPRESSED_RGBA_ASTC_8x6_KHR 0x93B6 -#define GL_COMPRESSED_RGBA_ASTC_8x8_KHR 0x93B7 -#define GL_COMPRESSED_RGBA_ASTC_10x5_KHR 0x93B8 -#define GL_COMPRESSED_RGBA_ASTC_10x6_KHR 0x93B9 -#define GL_COMPRESSED_RGBA_ASTC_10x8_KHR 0x93BA -#define GL_COMPRESSED_RGBA_ASTC_10x10_KHR 0x93BB -#define GL_COMPRESSED_RGBA_ASTC_12x10_KHR 0x93BC -#define GL_COMPRESSED_RGBA_ASTC_12x12_KHR 0x93BD -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR 0x93D0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR 0x93D1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR 0x93D2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR 0x93D3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR 0x93D4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR 0x93D5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR 0x93D6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR 0x93D7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR 0x93D8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR 0x93D9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR 0x93DA -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR 0x93DB -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR 0x93DC -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR 0x93DD -#endif /* GL_KHR_texture_compression_astc_hdr */ - -#ifndef GL_KHR_texture_compression_astc_ldr -#define GL_KHR_texture_compression_astc_ldr 1 -#endif /* GL_KHR_texture_compression_astc_ldr */ +/* GL_OES_depth32 */ +#ifndef GL_OES_depth32 +#define GL_DEPTH_COMPONENT32_OES 0x81A7 +#endif + +/* GL_OES_depth_texture */ +/* No new tokens introduced by this extension. */ +/* GL_OES_EGL_image */ #ifndef GL_OES_EGL_image -#define GL_OES_EGL_image 1 -typedef void *GLeglImageOES; -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); -typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); -GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +typedef void* GLeglImageOES; #endif -#endif /* GL_OES_EGL_image */ +/* GL_OES_EGL_image_external */ #ifndef GL_OES_EGL_image_external -#define GL_OES_EGL_image_external 1 -#define GL_TEXTURE_EXTERNAL_OES 0x8D65 -#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 -#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 -#define GL_SAMPLER_EXTERNAL_OES 0x8D66 -#endif /* GL_OES_EGL_image_external */ +/* GLeglImageOES defined in GL_OES_EGL_image already. */ +#define GL_TEXTURE_EXTERNAL_OES 0x8D65 +#define GL_SAMPLER_EXTERNAL_OES 0x8D66 +#define GL_TEXTURE_BINDING_EXTERNAL_OES 0x8D67 +#define GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES 0x8D68 +#endif + +/* GL_OES_element_index_uint */ +#ifndef GL_OES_element_index_uint +#define GL_UNSIGNED_INT 0x1405 +#endif + +/* GL_OES_get_program_binary */ +#ifndef GL_OES_get_program_binary +#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 +#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE +#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF +#endif + +/* GL_OES_mapbuffer */ +#ifndef GL_OES_mapbuffer +#define GL_WRITE_ONLY_OES 0x88B9 +#define GL_BUFFER_ACCESS_OES 0x88BB +#define GL_BUFFER_MAPPED_OES 0x88BC +#define GL_BUFFER_MAP_POINTER_OES 0x88BD +#endif + +/* GL_OES_packed_depth_stencil */ +#ifndef GL_OES_packed_depth_stencil +#define GL_DEPTH_STENCIL_OES 0x84F9 +#define GL_UNSIGNED_INT_24_8_OES 0x84FA +#define GL_DEPTH24_STENCIL8_OES 0x88F0 +#endif + +/* GL_OES_rgb8_rgba8 */ +#ifndef GL_OES_rgb8_rgba8 +#define GL_RGB8_OES 0x8051 +#define GL_RGBA8_OES 0x8058 +#endif + +/* GL_OES_standard_derivatives */ +#ifndef GL_OES_standard_derivatives +#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B +#endif + +/* GL_OES_stencil1 */ +#ifndef GL_OES_stencil1 +#define GL_STENCIL_INDEX1_OES 0x8D46 +#endif + +/* GL_OES_stencil4 */ +#ifndef GL_OES_stencil4 +#define GL_STENCIL_INDEX4_OES 0x8D47 +#endif + +/* GL_OES_texture_3D */ +#ifndef GL_OES_texture_3D +#define GL_TEXTURE_WRAP_R_OES 0x8072 +#define GL_TEXTURE_3D_OES 0x806F +#define GL_TEXTURE_BINDING_3D_OES 0x806A +#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 +#define GL_SAMPLER_3D_OES 0x8B5F +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 +#endif + +/* GL_OES_texture_float */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_half_float */ +#ifndef GL_OES_texture_half_float +#define GL_HALF_FLOAT_OES 0x8D61 +#endif + +/* GL_OES_texture_half_float_linear */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_texture_npot */ +/* No new tokens introduced by this extension. */ + +/* GL_OES_vertex_array_object */ +#ifndef GL_OES_vertex_array_object +#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 +#endif + +/* GL_OES_vertex_half_float */ +/* GL_HALF_FLOAT_OES defined in GL_OES_texture_half_float already. */ + +/* GL_OES_vertex_type_10_10_10_2 */ +#ifndef GL_OES_vertex_type_10_10_10_2 +#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 +#define GL_INT_10_10_10_2_OES 0x8DF7 +#endif + +/*------------------------------------------------------------------------* + * AMD extension tokens + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ +#ifndef GL_AMD_compressed_3DC_texture +#define GL_3DC_X_AMD 0x87F9 +#define GL_3DC_XY_AMD 0x87FA +#endif + +/* GL_AMD_compressed_ATC_texture */ +#ifndef GL_AMD_compressed_ATC_texture +#define GL_ATC_RGB_AMD 0x8C92 +#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 +#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE +#endif + +/* GL_AMD_performance_monitor */ +#ifndef GL_AMD_performance_monitor +#define GL_COUNTER_TYPE_AMD 0x8BC0 +#define GL_COUNTER_RANGE_AMD 0x8BC1 +#define GL_UNSIGNED_INT64_AMD 0x8BC2 +#define GL_PERCENTAGE_AMD 0x8BC3 +#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 +#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 +#define GL_PERFMON_RESULT_AMD 0x8BC6 +#endif + +/* GL_AMD_program_binary_Z400 */ +#ifndef GL_AMD_program_binary_Z400 +#define GL_Z400_BINARY_AMD 0x8740 +#endif + +/*------------------------------------------------------------------------* + * ANGLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ANGLE_framebuffer_blit */ +#ifndef GL_ANGLE_framebuffer_blit +#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA +#endif + +/* GL_ANGLE_framebuffer_multisample */ +#ifndef GL_ANGLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 +#define GL_MAX_SAMPLES_ANGLE 0x8D57 +#endif + +/*------------------------------------------------------------------------* + * APPLE extension tokens + *------------------------------------------------------------------------*/ + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_RGB_422_APPLE 0x8A1F +#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA +#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB +#endif + +/* GL_APPLE_framebuffer_multisample */ +#ifndef GL_APPLE_framebuffer_multisample +#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 +#define GL_MAX_SAMPLES_APPLE 0x8D57 +#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 +#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 +#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 +#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA +#endif + +/* GL_APPLE_texture_format_BGRA8888 */ +#ifndef GL_APPLE_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_APPLE_texture_max_level */ +#ifndef GL_APPLE_texture_max_level +#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D +#endif + +/*------------------------------------------------------------------------* + * ARM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_ARM_mali_shader_binary */ +#ifndef GL_ARM_mali_shader_binary +#define GL_MALI_SHADER_BINARY_ARM 0x8F60 +#endif + +/* GL_ARM_rgba8 */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * EXT extension tokens + *------------------------------------------------------------------------*/ + +/* GL_EXT_blend_minmax */ +#ifndef GL_EXT_blend_minmax +#define GL_MIN_EXT 0x8007 +#define GL_MAX_EXT 0x8008 +#endif + +/* GL_EXT_color_buffer_half_float */ +#ifndef GL_EXT_color_buffer_half_float +#define GL_RGBA16F_EXT 0x881A +#define GL_RGB16F_EXT 0x881B +#define GL_RG16F_EXT 0x822F +#define GL_R16F_EXT 0x822D +#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 +#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 +#endif + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F +#define GL_PROGRAM_OBJECT_EXT 0x8B40 +#define GL_SHADER_OBJECT_EXT 0x8B48 +#define GL_BUFFER_OBJECT_EXT 0x9151 +#define GL_QUERY_OBJECT_EXT 0x9153 +#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 +#endif + +/* GL_EXT_debug_marker */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_COLOR_EXT 0x1800 +#define GL_DEPTH_EXT 0x1801 +#define GL_STENCIL_EXT 0x1802 +#endif + +/* GL_EXT_multisampled_render_to_texture */ +#ifndef GL_EXT_multisampled_render_to_texture +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C +#define GL_RENDERBUFFER_SAMPLES_EXT 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x9134 +#define GL_MAX_SAMPLES_EXT 0x9135 +#endif + +/* GL_EXT_multi_draw_arrays */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_occlusion_query_boolean */ +#ifndef GL_EXT_occlusion_query_boolean +#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F +#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A +#define GL_CURRENT_QUERY_EXT 0x8865 +#define GL_QUERY_RESULT_EXT 0x8866 +#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 +#endif + +/* GL_EXT_read_format_bgra */ +#ifndef GL_EXT_read_format_bgra +#define GL_BGRA_EXT 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 +#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 +#endif + +/* GL_EXT_robustness */ +#ifndef GL_EXT_robustness +/* reuse GL_NO_ERROR */ +#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 +#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 +#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 +#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 +#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 +#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 +#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 +#endif + +/* GL_EXT_separate_shader_objects */ +#ifndef GL_EXT_separate_shader_objects +#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 +#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 +#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF +#define GL_PROGRAM_SEPARABLE_EXT 0x8258 +#define GL_ACTIVE_PROGRAM_EXT 0x8259 +#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A +#endif + +/* GL_EXT_shader_texture_lod */ +/* No new tokens introduced by this extension. */ + +/* GL_EXT_shadow_samplers */ +#ifndef GL_EXT_shadow_samplers +#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C +#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D +#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E +#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 +#endif + +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_SRGB_EXT 0x8C40 +#define GL_SRGB_ALPHA_EXT 0x8C42 +#define GL_SRGB8_ALPHA8_EXT 0x8C43 +#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 +#endif + +/* GL_EXT_texture_compression_dxt1 */ +#ifndef GL_EXT_texture_compression_dxt1 +#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 +#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 +#endif + +/* GL_EXT_texture_filter_anisotropic */ +#ifndef GL_EXT_texture_filter_anisotropic +#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE +#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF +#endif + +/* GL_EXT_texture_format_BGRA8888 */ +#ifndef GL_EXT_texture_format_BGRA8888 +#define GL_BGRA_EXT 0x80E1 +#endif + +/* GL_EXT_texture_rg */ +#ifndef GL_EXT_texture_rg +#define GL_RED_EXT 0x1903 +#define GL_RG_EXT 0x8227 +#define GL_R8_EXT 0x8229 +#define GL_RG8_EXT 0x822B +#endif + +/* GL_EXT_texture_storage */ +#ifndef GL_EXT_texture_storage +#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F +#define GL_ALPHA8_EXT 0x803C +#define GL_LUMINANCE8_EXT 0x8040 +#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 +#define GL_RGBA32F_EXT 0x8814 +#define GL_RGB32F_EXT 0x8815 +#define GL_ALPHA32F_EXT 0x8816 +#define GL_LUMINANCE32F_EXT 0x8818 +#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 +/* reuse GL_RGBA16F_EXT */ +#define GL_RGB16F_EXT 0x881B +#define GL_ALPHA16F_EXT 0x881C +#define GL_LUMINANCE16F_EXT 0x881E +#define GL_LUMINANCE_ALPHA16F_EXT 0x881F +#define GL_RGB10_A2_EXT 0x8059 +#define GL_RGB10_EXT 0x8052 +#define GL_BGRA8_EXT 0x93A1 +#endif + +/* GL_EXT_texture_type_2_10_10_10_REV */ +#ifndef GL_EXT_texture_type_2_10_10_10_REV +#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 +#endif + +/* GL_EXT_unpack_subimage */ +#ifndef GL_EXT_unpack_subimage +#define GL_UNPACK_ROW_LENGTH 0x0CF2 +#define GL_UNPACK_SKIP_ROWS 0x0CF3 +#define GL_UNPACK_SKIP_PIXELS 0x0CF4 +#endif + +/*------------------------------------------------------------------------* + * DMP extension tokens + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_SHADER_BINARY_DMP 0x9250 +#endif + +/*------------------------------------------------------------------------* + * IMG extension tokens + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ +#ifndef GL_IMG_program_binary +#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 +#endif + +/* GL_IMG_read_format */ +#ifndef GL_IMG_read_format +#define GL_BGRA_IMG 0x80E1 +#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 +#endif + +/* GL_IMG_shader_binary */ +#ifndef GL_IMG_shader_binary +#define GL_SGX_BINARY_IMG 0x8C0A +#endif + +/* GL_IMG_texture_compression_pvrtc */ +#ifndef GL_IMG_texture_compression_pvrtc +#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 +#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 +#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 +#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 +#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 +#define GL_MAX_SAMPLES_IMG 0x9135 +#define GL_TEXTURE_SAMPLES_IMG 0x9136 +#endif + +/*------------------------------------------------------------------------* + * NV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ +#ifndef GL_NV_coverage_sample +#define GL_COVERAGE_COMPONENT_NV 0x8ED0 +#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 +#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 +#define GL_COVERAGE_BUFFERS_NV 0x8ED3 +#define GL_COVERAGE_SAMPLES_NV 0x8ED4 +#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 +#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 +#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 +#define GL_COVERAGE_BUFFER_BIT_NV 0x8000 +#endif + +/* GL_NV_depth_nonlinear */ +#ifndef GL_NV_depth_nonlinear +#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C +#endif +/* GL_NV_draw_buffers */ +#ifndef GL_NV_draw_buffers +#define GL_MAX_DRAW_BUFFERS_NV 0x8824 +#define GL_DRAW_BUFFER0_NV 0x8825 +#define GL_DRAW_BUFFER1_NV 0x8826 +#define GL_DRAW_BUFFER2_NV 0x8827 +#define GL_DRAW_BUFFER3_NV 0x8828 +#define GL_DRAW_BUFFER4_NV 0x8829 +#define GL_DRAW_BUFFER5_NV 0x882A +#define GL_DRAW_BUFFER6_NV 0x882B +#define GL_DRAW_BUFFER7_NV 0x882C +#define GL_DRAW_BUFFER8_NV 0x882D +#define GL_DRAW_BUFFER9_NV 0x882E +#define GL_DRAW_BUFFER10_NV 0x882F +#define GL_DRAW_BUFFER11_NV 0x8830 +#define GL_DRAW_BUFFER12_NV 0x8831 +#define GL_DRAW_BUFFER13_NV 0x8832 +#define GL_DRAW_BUFFER14_NV 0x8833 +#define GL_DRAW_BUFFER15_NV 0x8834 +#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 +#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 +#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 +#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 +#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 +#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 +#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 +#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 +#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 +#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 +#define GL_COLOR_ATTACHMENT10_NV 0x8CEA +#define GL_COLOR_ATTACHMENT11_NV 0x8CEB +#define GL_COLOR_ATTACHMENT12_NV 0x8CEC +#define GL_COLOR_ATTACHMENT13_NV 0x8CED +#define GL_COLOR_ATTACHMENT14_NV 0x8CEE +#define GL_COLOR_ATTACHMENT15_NV 0x8CEF +#endif + +/* GL_NV_fbo_color_attachments */ +#ifndef GL_NV_fbo_color_attachments +#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF +/* GL_COLOR_ATTACHMENT{0-15}_NV defined in GL_NV_draw_buffers already. */ +#endif + +/* GL_NV_fence */ +#ifndef GL_NV_fence +#define GL_ALL_COMPLETED_NV 0x84F2 +#define GL_FENCE_STATUS_NV 0x84F3 +#define GL_FENCE_CONDITION_NV 0x84F4 +#endif + +/* GL_NV_read_buffer */ +#ifndef GL_NV_read_buffer +#define GL_READ_BUFFER_NV 0x0C02 +#endif + +/* GL_NV_read_buffer_front */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_depth_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_read_stencil */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_compression_s3tc_update */ +/* No new tokens introduced by this extension. */ + +/* GL_NV_texture_npot_2D_mipmap */ +/* No new tokens introduced by this extension. */ + +/*------------------------------------------------------------------------* + * QCOM extension tokens + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ +#ifndef GL_QCOM_alpha_test +#define GL_ALPHA_TEST_QCOM 0x0BC0 +#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 +#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 +#endif + +/* GL_QCOM_driver_control */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_extended_get */ +#ifndef GL_QCOM_extended_get +#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 +#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 +#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 +#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 +#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 +#define GL_TEXTURE_TYPE_QCOM 0x8BD7 +#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 +#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 +#define GL_TEXTURE_TARGET_QCOM 0x8BDA +#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB +#define GL_STATE_RESTORE 0x8BDC +#endif + +/* GL_QCOM_extended_get2 */ +/* No new tokens introduced by this extension. */ + +/* GL_QCOM_perfmon_global_mode */ +#ifndef GL_QCOM_perfmon_global_mode +#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_WRITEONLY_RENDERING_QCOM 0x8823 +#endif + +/* GL_QCOM_tiled_rendering */ +#ifndef GL_QCOM_tiled_rendering +#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 +#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 +#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 +#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 +#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 +#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 +#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 +#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 +#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 +#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 +#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 +#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 +#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 +#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 +#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 +#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 +#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 +#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 +#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 +#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 +#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 +#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 +#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 +#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 +#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 +#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 +#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 +#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 +#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 +#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 +#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 +#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 +#endif + +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ + +/* GL_VIV_shader_binary */ +#ifndef GL_VIV_shader_binary +#define GL_SHADER_BINARY_VIV 0x8FC4 +#endif + +/*------------------------------------------------------------------------* + * End of extension tokens, start of corresponding extension functions + *------------------------------------------------------------------------*/ + +/*------------------------------------------------------------------------* + * OES extension functions + *------------------------------------------------------------------------*/ + +/* GL_OES_compressed_ETC1_RGB8_texture */ #ifndef GL_OES_compressed_ETC1_RGB8_texture #define GL_OES_compressed_ETC1_RGB8_texture 1 -#define GL_ETC1_RGB8_OES 0x8D64 -#endif /* GL_OES_compressed_ETC1_RGB8_texture */ +#endif +/* GL_OES_compressed_paletted_texture */ #ifndef GL_OES_compressed_paletted_texture #define GL_OES_compressed_paletted_texture 1 -#define GL_PALETTE4_RGB8_OES 0x8B90 -#define GL_PALETTE4_RGBA8_OES 0x8B91 -#define GL_PALETTE4_R5_G6_B5_OES 0x8B92 -#define GL_PALETTE4_RGBA4_OES 0x8B93 -#define GL_PALETTE4_RGB5_A1_OES 0x8B94 -#define GL_PALETTE8_RGB8_OES 0x8B95 -#define GL_PALETTE8_RGBA8_OES 0x8B96 -#define GL_PALETTE8_R5_G6_B5_OES 0x8B97 -#define GL_PALETTE8_RGBA4_OES 0x8B98 -#define GL_PALETTE8_RGB5_A1_OES 0x8B99 -#endif /* GL_OES_compressed_paletted_texture */ +#endif +/* GL_OES_depth24 */ #ifndef GL_OES_depth24 #define GL_OES_depth24 1 -#define GL_DEPTH_COMPONENT24_OES 0x81A6 -#endif /* GL_OES_depth24 */ +#endif +/* GL_OES_depth32 */ #ifndef GL_OES_depth32 #define GL_OES_depth32 1 -#define GL_DEPTH_COMPONENT32_OES 0x81A7 -#endif /* GL_OES_depth32 */ +#endif +/* GL_OES_depth_texture */ #ifndef GL_OES_depth_texture #define GL_OES_depth_texture 1 -#endif /* GL_OES_depth_texture */ +#endif + +/* GL_OES_EGL_image */ +#ifndef GL_OES_EGL_image +#define GL_OES_EGL_image 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glEGLImageTargetTexture2DOES (GLenum target, GLeglImageOES image); +GL_APICALL void GL_APIENTRY glEGLImageTargetRenderbufferStorageOES (GLenum target, GLeglImageOES image); +#endif +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETTEXTURE2DOESPROC) (GLenum target, GLeglImageOES image); +typedef void (GL_APIENTRYP PFNGLEGLIMAGETARGETRENDERBUFFERSTORAGEOESPROC) (GLenum target, GLeglImageOES image); +#endif + +/* GL_OES_EGL_image_external */ +#ifndef GL_OES_EGL_image_external +#define GL_OES_EGL_image_external 1 +/* glEGLImageTargetTexture2DOES defined in GL_OES_EGL_image already. */ +#endif +/* GL_OES_element_index_uint */ #ifndef GL_OES_element_index_uint #define GL_OES_element_index_uint 1 -#endif /* GL_OES_element_index_uint */ +#endif +/* GL_OES_fbo_render_mipmap */ #ifndef GL_OES_fbo_render_mipmap #define GL_OES_fbo_render_mipmap 1 -#endif /* GL_OES_fbo_render_mipmap */ +#endif +/* GL_OES_fragment_precision_high */ #ifndef GL_OES_fragment_precision_high #define GL_OES_fragment_precision_high 1 -#endif /* GL_OES_fragment_precision_high */ +#endif +/* GL_OES_get_program_binary */ #ifndef GL_OES_get_program_binary #define GL_OES_get_program_binary 1 -#define GL_PROGRAM_BINARY_LENGTH_OES 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS_OES 0x87FE -#define GL_PROGRAM_BINARY_FORMATS_OES 0x87FF -typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const void *binary, GLint length); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const void *binary, GLint length); +GL_APICALL void GL_APIENTRY glGetProgramBinaryOES (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +GL_APICALL void GL_APIENTRY glProgramBinaryOES (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +#endif +typedef void (GL_APIENTRYP PFNGLGETPROGRAMBINARYOESPROC) (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +typedef void (GL_APIENTRYP PFNGLPROGRAMBINARYOESPROC) (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); #endif -#endif /* GL_OES_get_program_binary */ +/* GL_OES_mapbuffer */ #ifndef GL_OES_mapbuffer #define GL_OES_mapbuffer 1 -#define GL_WRITE_ONLY_OES 0x88B9 -#define GL_BUFFER_ACCESS_OES 0x88BB -#define GL_BUFFER_MAPPED_OES 0x88BC -#define GL_BUFFER_MAP_POINTER_OES 0x88BD -typedef void *(GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); -typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, void **params); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void *GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); +GL_APICALL void* GL_APIENTRY glMapBufferOES (GLenum target, GLenum access); GL_APICALL GLboolean GL_APIENTRY glUnmapBufferOES (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, void **params); +GL_APICALL void GL_APIENTRY glGetBufferPointervOES (GLenum target, GLenum pname, GLvoid** params); +#endif +typedef void* (GL_APIENTRYP PFNGLMAPBUFFEROESPROC) (GLenum target, GLenum access); +typedef GLboolean (GL_APIENTRYP PFNGLUNMAPBUFFEROESPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETBUFFERPOINTERVOESPROC) (GLenum target, GLenum pname, GLvoid** params); #endif -#endif /* GL_OES_mapbuffer */ +/* GL_OES_packed_depth_stencil */ #ifndef GL_OES_packed_depth_stencil #define GL_OES_packed_depth_stencil 1 -#define GL_DEPTH_STENCIL_OES 0x84F9 -#define GL_UNSIGNED_INT_24_8_OES 0x84FA -#define GL_DEPTH24_STENCIL8_OES 0x88F0 -#endif /* GL_OES_packed_depth_stencil */ - -#ifndef GL_OES_required_internalformat -#define GL_OES_required_internalformat 1 -#define GL_ALPHA8_OES 0x803C -#define GL_DEPTH_COMPONENT16_OES 0x81A5 -#define GL_LUMINANCE4_ALPHA4_OES 0x8043 -#define GL_LUMINANCE8_ALPHA8_OES 0x8045 -#define GL_LUMINANCE8_OES 0x8040 -#define GL_RGBA4_OES 0x8056 -#define GL_RGB5_A1_OES 0x8057 -#define GL_RGB565_OES 0x8D62 -#define GL_RGB8_OES 0x8051 -#define GL_RGBA8_OES 0x8058 -#define GL_RGB10_EXT 0x8052 -#define GL_RGB10_A2_EXT 0x8059 -#endif /* GL_OES_required_internalformat */ +#endif +/* GL_OES_rgb8_rgba8 */ #ifndef GL_OES_rgb8_rgba8 #define GL_OES_rgb8_rgba8 1 -#endif /* GL_OES_rgb8_rgba8 */ - -#ifndef GL_OES_sample_shading -#define GL_OES_sample_shading 1 -#define GL_SAMPLE_SHADING_OES 0x8C36 -#define GL_MIN_SAMPLE_SHADING_VALUE_OES 0x8C37 -typedef void (GL_APIENTRYP PFNGLMINSAMPLESHADINGOESPROC) (GLfloat value); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMinSampleShadingOES (GLfloat value); -#endif -#endif /* GL_OES_sample_shading */ - -#ifndef GL_OES_sample_variables -#define GL_OES_sample_variables 1 -#endif /* GL_OES_sample_variables */ - -#ifndef GL_OES_shader_image_atomic -#define GL_OES_shader_image_atomic 1 -#endif /* GL_OES_shader_image_atomic */ - -#ifndef GL_OES_shader_multisample_interpolation -#define GL_OES_shader_multisample_interpolation 1 -#define GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5B -#define GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES 0x8E5C -#define GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES 0x8E5D -#endif /* GL_OES_shader_multisample_interpolation */ +#endif +/* GL_OES_standard_derivatives */ #ifndef GL_OES_standard_derivatives #define GL_OES_standard_derivatives 1 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES 0x8B8B -#endif /* GL_OES_standard_derivatives */ +#endif +/* GL_OES_stencil1 */ #ifndef GL_OES_stencil1 #define GL_OES_stencil1 1 -#define GL_STENCIL_INDEX1_OES 0x8D46 -#endif /* GL_OES_stencil1 */ +#endif +/* GL_OES_stencil4 */ #ifndef GL_OES_stencil4 #define GL_OES_stencil4 1 -#define GL_STENCIL_INDEX4_OES 0x8D47 -#endif /* GL_OES_stencil4 */ - -#ifndef GL_OES_surfaceless_context -#define GL_OES_surfaceless_context 1 -#define GL_FRAMEBUFFER_UNDEFINED_OES 0x8219 -#endif /* GL_OES_surfaceless_context */ +#endif +/* GL_OES_texture_3D */ #ifndef GL_OES_texture_3D #define GL_OES_texture_3D 1 -#define GL_TEXTURE_WRAP_R_OES 0x8072 -#define GL_TEXTURE_3D_OES 0x806F -#define GL_TEXTURE_BINDING_3D_OES 0x806A -#define GL_MAX_3D_TEXTURE_SIZE_OES 0x8073 -#define GL_SAMPLER_3D_OES 0x8B5F -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES 0x8CD4 -typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOESPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); +GL_APICALL void GL_APIENTRY glTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); GL_APICALL void GL_APIENTRY glCopyTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); +GL_APICALL void GL_APIENTRY glCompressedTexImage3DOES (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage3DOES (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); GL_APICALL void GL_APIENTRY glFramebufferTexture3DOES (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); #endif -#endif /* GL_OES_texture_3D */ - -#ifndef GL_OES_texture_compression_astc -#define GL_OES_texture_compression_astc 1 -#define GL_COMPRESSED_RGBA_ASTC_3x3x3_OES 0x93C0 -#define GL_COMPRESSED_RGBA_ASTC_4x3x3_OES 0x93C1 -#define GL_COMPRESSED_RGBA_ASTC_4x4x3_OES 0x93C2 -#define GL_COMPRESSED_RGBA_ASTC_4x4x4_OES 0x93C3 -#define GL_COMPRESSED_RGBA_ASTC_5x4x4_OES 0x93C4 -#define GL_COMPRESSED_RGBA_ASTC_5x5x4_OES 0x93C5 -#define GL_COMPRESSED_RGBA_ASTC_5x5x5_OES 0x93C6 -#define GL_COMPRESSED_RGBA_ASTC_6x5x5_OES 0x93C7 -#define GL_COMPRESSED_RGBA_ASTC_6x6x5_OES 0x93C8 -#define GL_COMPRESSED_RGBA_ASTC_6x6x6_OES 0x93C9 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES 0x93E0 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES 0x93E1 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES 0x93E2 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES 0x93E3 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES 0x93E4 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES 0x93E5 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES 0x93E6 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES 0x93E7 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES 0x93E8 -#define GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES 0x93E9 -#endif /* GL_OES_texture_compression_astc */ +typedef void (GL_APIENTRYP PFNGLTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); +typedef void (GL_APIENTRYP PFNGLCOPYTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXIMAGE3DOESPROC) (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLCOMPRESSEDTEXSUBIMAGE3DOESPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE3DOES) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); +#endif +/* GL_OES_texture_float */ #ifndef GL_OES_texture_float #define GL_OES_texture_float 1 -#endif /* GL_OES_texture_float */ +#endif +/* GL_OES_texture_float_linear */ #ifndef GL_OES_texture_float_linear #define GL_OES_texture_float_linear 1 -#endif /* GL_OES_texture_float_linear */ +#endif +/* GL_OES_texture_half_float */ #ifndef GL_OES_texture_half_float #define GL_OES_texture_half_float 1 -#define GL_HALF_FLOAT_OES 0x8D61 -#endif /* GL_OES_texture_half_float */ +#endif +/* GL_OES_texture_half_float_linear */ #ifndef GL_OES_texture_half_float_linear #define GL_OES_texture_half_float_linear 1 -#endif /* GL_OES_texture_half_float_linear */ +#endif +/* GL_OES_texture_npot */ #ifndef GL_OES_texture_npot #define GL_OES_texture_npot 1 -#endif /* GL_OES_texture_npot */ - -#ifndef GL_OES_texture_stencil8 -#define GL_OES_texture_stencil8 1 -#define GL_STENCIL_INDEX_OES 0x1901 -#define GL_STENCIL_INDEX8_OES 0x8D48 -#endif /* GL_OES_texture_stencil8 */ - -#ifndef GL_OES_texture_storage_multisample_2d_array -#define GL_OES_texture_storage_multisample_2d_array 1 -#define GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES 0x9102 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES 0x9105 -#define GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910B -#define GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910C -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES 0x910D -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DMULTISAMPLEOESPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexStorage3DMultisampleOES (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); #endif -#endif /* GL_OES_texture_storage_multisample_2d_array */ +/* GL_OES_vertex_array_object */ #ifndef GL_OES_vertex_array_object #define GL_OES_vertex_array_object 1 -#define GL_VERTEX_ARRAY_BINDING_OES 0x85B5 -typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); -typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); -typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); -typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glBindVertexArrayOES (GLuint array); GL_APICALL void GL_APIENTRY glDeleteVertexArraysOES (GLsizei n, const GLuint *arrays); GL_APICALL void GL_APIENTRY glGenVertexArraysOES (GLsizei n, GLuint *arrays); GL_APICALL GLboolean GL_APIENTRY glIsVertexArrayOES (GLuint array); #endif -#endif /* GL_OES_vertex_array_object */ +typedef void (GL_APIENTRYP PFNGLBINDVERTEXARRAYOESPROC) (GLuint array); +typedef void (GL_APIENTRYP PFNGLDELETEVERTEXARRAYSOESPROC) (GLsizei n, const GLuint *arrays); +typedef void (GL_APIENTRYP PFNGLGENVERTEXARRAYSOESPROC) (GLsizei n, GLuint *arrays); +typedef GLboolean (GL_APIENTRYP PFNGLISVERTEXARRAYOESPROC) (GLuint array); +#endif +/* GL_OES_vertex_half_float */ #ifndef GL_OES_vertex_half_float #define GL_OES_vertex_half_float 1 -#endif /* GL_OES_vertex_half_float */ +#endif +/* GL_OES_vertex_type_10_10_10_2 */ #ifndef GL_OES_vertex_type_10_10_10_2 #define GL_OES_vertex_type_10_10_10_2 1 -#define GL_UNSIGNED_INT_10_10_10_2_OES 0x8DF6 -#define GL_INT_10_10_10_2_OES 0x8DF7 -#endif /* GL_OES_vertex_type_10_10_10_2 */ +#endif +/*------------------------------------------------------------------------* + * AMD extension functions + *------------------------------------------------------------------------*/ + +/* GL_AMD_compressed_3DC_texture */ #ifndef GL_AMD_compressed_3DC_texture #define GL_AMD_compressed_3DC_texture 1 -#define GL_3DC_X_AMD 0x87F9 -#define GL_3DC_XY_AMD 0x87FA -#endif /* GL_AMD_compressed_3DC_texture */ +#endif +/* GL_AMD_compressed_ATC_texture */ #ifndef GL_AMD_compressed_ATC_texture #define GL_AMD_compressed_ATC_texture 1 -#define GL_ATC_RGB_AMD 0x8C92 -#define GL_ATC_RGBA_EXPLICIT_ALPHA_AMD 0x8C93 -#define GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD 0x87EE -#endif /* GL_AMD_compressed_ATC_texture */ +#endif +/* AMD_performance_monitor */ #ifndef GL_AMD_performance_monitor #define GL_AMD_performance_monitor 1 -#define GL_COUNTER_TYPE_AMD 0x8BC0 -#define GL_COUNTER_RANGE_AMD 0x8BC1 -#define GL_UNSIGNED_INT64_AMD 0x8BC2 -#define GL_PERCENTAGE_AMD 0x8BC3 -#define GL_PERFMON_RESULT_AVAILABLE_AMD 0x8BC4 -#define GL_PERFMON_RESULT_SIZE_AMD 0x8BC5 -#define GL_PERFMON_RESULT_AMD 0x8BC6 -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, void *data); -typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); -typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); -typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); -typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupsAMD (GLint *numGroups, GLsizei groupsSize, GLuint *groups); GL_APICALL void GL_APIENTRY glGetPerfMonitorCountersAMD (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); GL_APICALL void GL_APIENTRY glGetPerfMonitorGroupStringAMD (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterStringAMD (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); -GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, void *data); +GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterInfoAMD (GLuint group, GLuint counter, GLenum pname, GLvoid *data); GL_APICALL void GL_APIENTRY glGenPerfMonitorsAMD (GLsizei n, GLuint *monitors); GL_APICALL void GL_APIENTRY glDeletePerfMonitorsAMD (GLsizei n, GLuint *monitors); -GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *counterList); +GL_APICALL void GL_APIENTRY glSelectPerfMonitorCountersAMD (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); GL_APICALL void GL_APIENTRY glBeginPerfMonitorAMD (GLuint monitor); GL_APICALL void GL_APIENTRY glEndPerfMonitorAMD (GLuint monitor); GL_APICALL void GL_APIENTRY glGetPerfMonitorCounterDataAMD (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); #endif -#endif /* GL_AMD_performance_monitor */ +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSAMDPROC) (GLint *numGroups, GLsizei groupsSize, GLuint *groups); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSAMDPROC) (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORGROUPSTRINGAMDPROC) (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERSTRINGAMDPROC) (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERINFOAMDPROC) (GLuint group, GLuint counter, GLenum pname, GLvoid *data); +typedef void (GL_APIENTRYP PFNGLGENPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLDELETEPERFMONITORSAMDPROC) (GLsizei n, GLuint *monitors); +typedef void (GL_APIENTRYP PFNGLSELECTPERFMONITORCOUNTERSAMDPROC) (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); +typedef void (GL_APIENTRYP PFNGLBEGINPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLENDPERFMONITORAMDPROC) (GLuint monitor); +typedef void (GL_APIENTRYP PFNGLGETPERFMONITORCOUNTERDATAAMDPROC) (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); +#endif +/* GL_AMD_program_binary_Z400 */ #ifndef GL_AMD_program_binary_Z400 #define GL_AMD_program_binary_Z400 1 -#define GL_Z400_BINARY_AMD 0x8740 -#endif /* GL_AMD_program_binary_Z400 */ +#endif -#ifndef GL_ANGLE_depth_texture -#define GL_ANGLE_depth_texture 1 -#endif /* GL_ANGLE_depth_texture */ +/*------------------------------------------------------------------------* + * ANGLE extension functions + *------------------------------------------------------------------------*/ +/* GL_ANGLE_framebuffer_blit */ #ifndef GL_ANGLE_framebuffer_blit #define GL_ANGLE_framebuffer_blit 1 -#define GL_READ_FRAMEBUFFER_ANGLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_ANGLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_ANGLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_ANGLE 0x8CAA -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glBlitFramebufferANGLE (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); #endif -#endif /* GL_ANGLE_framebuffer_blit */ +typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERANGLEPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); +#endif +/* GL_ANGLE_framebuffer_multisample */ #ifndef GL_ANGLE_framebuffer_multisample #define GL_ANGLE_framebuffer_multisample 1 -#define GL_RENDERBUFFER_SAMPLES_ANGLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_ANGLE 0x8D56 -#define GL_MAX_SAMPLES_ANGLE 0x8D57 -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleANGLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); #endif -#endif /* GL_ANGLE_framebuffer_multisample */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEANGLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +#endif -#ifndef GL_ANGLE_instanced_arrays -#define GL_ANGLE_instanced_arrays 1 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_ANGLE 0x88FE -typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDANGLEPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDANGLEPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORANGLEPROC) (GLuint index, GLuint divisor); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedANGLE (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedANGLE (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -GL_APICALL void GL_APIENTRY glVertexAttribDivisorANGLE (GLuint index, GLuint divisor); -#endif -#endif /* GL_ANGLE_instanced_arrays */ - -#ifndef GL_ANGLE_pack_reverse_row_order -#define GL_ANGLE_pack_reverse_row_order 1 -#define GL_PACK_REVERSE_ROW_ORDER_ANGLE 0x93A4 -#endif /* GL_ANGLE_pack_reverse_row_order */ - -#ifndef GL_ANGLE_program_binary -#define GL_ANGLE_program_binary 1 -#define GL_PROGRAM_BINARY_ANGLE 0x93A6 -#endif /* GL_ANGLE_program_binary */ - -#ifndef GL_ANGLE_texture_compression_dxt3 -#define GL_ANGLE_texture_compression_dxt3 1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE 0x83F2 -#endif /* GL_ANGLE_texture_compression_dxt3 */ - -#ifndef GL_ANGLE_texture_compression_dxt5 -#define GL_ANGLE_texture_compression_dxt5 1 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE 0x83F3 -#endif /* GL_ANGLE_texture_compression_dxt5 */ - -#ifndef GL_ANGLE_texture_usage -#define GL_ANGLE_texture_usage 1 -#define GL_TEXTURE_USAGE_ANGLE 0x93A2 -#define GL_FRAMEBUFFER_ATTACHMENT_ANGLE 0x93A3 -#endif /* GL_ANGLE_texture_usage */ - -#ifndef GL_ANGLE_translated_shader_source -#define GL_ANGLE_translated_shader_source 1 -#define GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE 0x93A0 -typedef void (GL_APIENTRYP PFNGLGETTRANSLATEDSHADERSOURCEANGLEPROC) (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGetTranslatedShaderSourceANGLE (GLuint shader, GLsizei bufsize, GLsizei *length, GLchar *source); -#endif -#endif /* GL_ANGLE_translated_shader_source */ - -#ifndef GL_APPLE_copy_texture_levels -#define GL_APPLE_copy_texture_levels 1 -typedef void (GL_APIENTRYP PFNGLCOPYTEXTURELEVELSAPPLEPROC) (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCopyTextureLevelsAPPLE (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); +/*------------------------------------------------------------------------* + * APPLE extension functions + *------------------------------------------------------------------------*/ + +/* GL_APPLE_rgb_422 */ +#ifndef GL_APPLE_rgb_422 +#define GL_APPLE_rgb_422 1 #endif -#endif /* GL_APPLE_copy_texture_levels */ +/* GL_APPLE_framebuffer_multisample */ #ifndef GL_APPLE_framebuffer_multisample #define GL_APPLE_framebuffer_multisample 1 -#define GL_RENDERBUFFER_SAMPLES_APPLE 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE 0x8D56 -#define GL_MAX_SAMPLES_APPLE 0x8D57 -#define GL_READ_FRAMEBUFFER_APPLE 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_APPLE 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_APPLE 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_APPLE 0x8CAA -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleAPPLE (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glResolveMultisampleFramebufferAPPLE (void); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEAPPLEPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLRESOLVEMULTISAMPLEFRAMEBUFFERAPPLEPROC) (void); #endif -#endif /* GL_APPLE_framebuffer_multisample */ - -#ifndef GL_APPLE_rgb_422 -#define GL_APPLE_rgb_422 1 -#define GL_RGB_422_APPLE 0x8A1F -#define GL_UNSIGNED_SHORT_8_8_APPLE 0x85BA -#define GL_UNSIGNED_SHORT_8_8_REV_APPLE 0x85BB -#define GL_RGB_RAW_422_APPLE 0x8A51 -#endif /* GL_APPLE_rgb_422 */ - -#ifndef GL_APPLE_sync -#define GL_APPLE_sync 1 -#define GL_SYNC_OBJECT_APPLE 0x8A53 -#define GL_MAX_SERVER_WAIT_TIMEOUT_APPLE 0x9111 -#define GL_OBJECT_TYPE_APPLE 0x9112 -#define GL_SYNC_CONDITION_APPLE 0x9113 -#define GL_SYNC_STATUS_APPLE 0x9114 -#define GL_SYNC_FLAGS_APPLE 0x9115 -#define GL_SYNC_FENCE_APPLE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE_APPLE 0x9117 -#define GL_UNSIGNALED_APPLE 0x9118 -#define GL_SIGNALED_APPLE 0x9119 -#define GL_ALREADY_SIGNALED_APPLE 0x911A -#define GL_TIMEOUT_EXPIRED_APPLE 0x911B -#define GL_CONDITION_SATISFIED_APPLE 0x911C -#define GL_WAIT_FAILED_APPLE 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT_APPLE 0x00000001 -#define GL_TIMEOUT_IGNORED_APPLE 0xFFFFFFFFFFFFFFFFull -typedef GLsync (GL_APIENTRYP PFNGLFENCESYNCAPPLEPROC) (GLenum condition, GLbitfield flags); -typedef GLboolean (GL_APIENTRYP PFNGLISSYNCAPPLEPROC) (GLsync sync); -typedef void (GL_APIENTRYP PFNGLDELETESYNCAPPLEPROC) (GLsync sync); -typedef GLenum (GL_APIENTRYP PFNGLCLIENTWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLWAITSYNCAPPLEPROC) (GLsync sync, GLbitfield flags, GLuint64 timeout); -typedef void (GL_APIENTRYP PFNGLGETINTEGER64VAPPLEPROC) (GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETSYNCIVAPPLEPROC) (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL GLsync GL_APIENTRY glFenceSyncAPPLE (GLenum condition, GLbitfield flags); -GL_APICALL GLboolean GL_APIENTRY glIsSyncAPPLE (GLsync sync); -GL_APICALL void GL_APIENTRY glDeleteSyncAPPLE (GLsync sync); -GL_APICALL GLenum GL_APIENTRY glClientWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glWaitSyncAPPLE (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glGetInteger64vAPPLE (GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGetSyncivAPPLE (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -#endif -#endif /* GL_APPLE_sync */ +/* GL_APPLE_texture_format_BGRA8888 */ #ifndef GL_APPLE_texture_format_BGRA8888 #define GL_APPLE_texture_format_BGRA8888 1 -#define GL_BGRA_EXT 0x80E1 -#define GL_BGRA8_EXT 0x93A1 -#endif /* GL_APPLE_texture_format_BGRA8888 */ +#endif +/* GL_APPLE_texture_max_level */ #ifndef GL_APPLE_texture_max_level #define GL_APPLE_texture_max_level 1 -#define GL_TEXTURE_MAX_LEVEL_APPLE 0x813D -#endif /* GL_APPLE_texture_max_level */ +#endif -#ifndef GL_ARM_mali_program_binary -#define GL_ARM_mali_program_binary 1 -#define GL_MALI_PROGRAM_BINARY_ARM 0x8F61 -#endif /* GL_ARM_mali_program_binary */ +/*------------------------------------------------------------------------* + * ARM extension functions + *------------------------------------------------------------------------*/ +/* GL_ARM_mali_shader_binary */ #ifndef GL_ARM_mali_shader_binary #define GL_ARM_mali_shader_binary 1 -#define GL_MALI_SHADER_BINARY_ARM 0x8F60 -#endif /* GL_ARM_mali_shader_binary */ +#endif +/* GL_ARM_rgba8 */ #ifndef GL_ARM_rgba8 #define GL_ARM_rgba8 1 -#endif /* GL_ARM_rgba8 */ +#endif -#ifndef GL_ARM_shader_framebuffer_fetch -#define GL_ARM_shader_framebuffer_fetch 1 -#define GL_FETCH_PER_SAMPLE_ARM 0x8F65 -#define GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM 0x8F66 -#endif /* GL_ARM_shader_framebuffer_fetch */ - -#ifndef GL_ARM_shader_framebuffer_fetch_depth_stencil -#define GL_ARM_shader_framebuffer_fetch_depth_stencil 1 -#endif /* GL_ARM_shader_framebuffer_fetch_depth_stencil */ - -#ifndef GL_DMP_shader_binary -#define GL_DMP_shader_binary 1 -#define GL_SHADER_BINARY_DMP 0x9250 -#endif /* GL_DMP_shader_binary */ +/*------------------------------------------------------------------------* + * EXT extension functions + *------------------------------------------------------------------------*/ +/* GL_EXT_blend_minmax */ #ifndef GL_EXT_blend_minmax #define GL_EXT_blend_minmax 1 -#define GL_MIN_EXT 0x8007 -#define GL_MAX_EXT 0x8008 -#endif /* GL_EXT_blend_minmax */ +#endif +/* GL_EXT_color_buffer_half_float */ #ifndef GL_EXT_color_buffer_half_float #define GL_EXT_color_buffer_half_float 1 -#define GL_RGBA16F_EXT 0x881A -#define GL_RGB16F_EXT 0x881B -#define GL_RG16F_EXT 0x822F -#define GL_R16F_EXT 0x822D -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT 0x8211 -#define GL_UNSIGNED_NORMALIZED_EXT 0x8C17 -#endif /* GL_EXT_color_buffer_half_float */ - -#ifndef GL_EXT_copy_image -#define GL_EXT_copy_image 1 -typedef void (GL_APIENTRYP PFNGLCOPYIMAGESUBDATAEXTPROC) (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCopyImageSubDataEXT (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -#endif -#endif /* GL_EXT_copy_image */ - -#ifndef GL_EXT_debug_label -#define GL_EXT_debug_label 1 -#define GL_PROGRAM_PIPELINE_OBJECT_EXT 0x8A4F -#define GL_PROGRAM_OBJECT_EXT 0x8B40 -#define GL_SHADER_OBJECT_EXT 0x8B48 -#define GL_BUFFER_OBJECT_EXT 0x9151 -#define GL_QUERY_OBJECT_EXT 0x9153 -#define GL_VERTEX_ARRAY_OBJECT_EXT 0x9154 -#define GL_TRANSFORM_FEEDBACK 0x8E22 -typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); -typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); -GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); -#endif -#endif /* GL_EXT_debug_label */ - -#ifndef GL_EXT_debug_marker -#define GL_EXT_debug_marker 1 -typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); -typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); -GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); #endif -#endif /* GL_EXT_debug_marker */ - -#ifndef GL_EXT_discard_framebuffer -#define GL_EXT_discard_framebuffer 1 -#define GL_COLOR_EXT 0x1800 -#define GL_DEPTH_EXT 0x1801 -#define GL_STENCIL_EXT 0x1802 -typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); -#endif -#endif /* GL_EXT_discard_framebuffer */ - -#ifndef GL_EXT_disjoint_timer_query -#define GL_EXT_disjoint_timer_query 1 -#define GL_QUERY_COUNTER_BITS_EXT 0x8864 -#define GL_CURRENT_QUERY_EXT 0x8865 -#define GL_QUERY_RESULT_EXT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE_EXT 0x8867 -#define GL_TIME_ELAPSED_EXT 0x88BF -#define GL_TIMESTAMP_EXT 0x8E28 -#define GL_GPU_DISJOINT_EXT 0x8FBB -typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); -typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); -typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); -typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); -typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); -typedef void (GL_APIENTRYP PFNGLQUERYCOUNTEREXTPROC) (GLuint id, GLenum target); -typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTIVEXTPROC) (GLuint id, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTI64VEXTPROC) (GLuint id, GLenum pname, GLint64 *params); -typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUI64VEXTPROC) (GLuint id, GLenum pname, GLuint64 *params); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); -GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); -GL_APICALL void GL_APIENTRY glQueryCounterEXT (GLuint id, GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectivEXT (GLuint id, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjecti64vEXT (GLuint id, GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectui64vEXT (GLuint id, GLenum pname, GLuint64 *params); + +/* GL_EXT_debug_label */ +#ifndef GL_EXT_debug_label +#define GL_EXT_debug_label 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glLabelObjectEXT (GLenum type, GLuint object, GLsizei length, const GLchar *label); +GL_APICALL void GL_APIENTRY glGetObjectLabelEXT (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +#endif +typedef void (GL_APIENTRYP PFNGLLABELOBJECTEXTPROC) (GLenum type, GLuint object, GLsizei length, const GLchar *label); +typedef void (GL_APIENTRYP PFNGLGETOBJECTLABELEXTPROC) (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); #endif -#endif /* GL_EXT_disjoint_timer_query */ -#ifndef GL_EXT_draw_buffers -#define GL_EXT_draw_buffers 1 -#define GL_MAX_COLOR_ATTACHMENTS_EXT 0x8CDF -#define GL_MAX_DRAW_BUFFERS_EXT 0x8824 -#define GL_DRAW_BUFFER0_EXT 0x8825 -#define GL_DRAW_BUFFER1_EXT 0x8826 -#define GL_DRAW_BUFFER2_EXT 0x8827 -#define GL_DRAW_BUFFER3_EXT 0x8828 -#define GL_DRAW_BUFFER4_EXT 0x8829 -#define GL_DRAW_BUFFER5_EXT 0x882A -#define GL_DRAW_BUFFER6_EXT 0x882B -#define GL_DRAW_BUFFER7_EXT 0x882C -#define GL_DRAW_BUFFER8_EXT 0x882D -#define GL_DRAW_BUFFER9_EXT 0x882E -#define GL_DRAW_BUFFER10_EXT 0x882F -#define GL_DRAW_BUFFER11_EXT 0x8830 -#define GL_DRAW_BUFFER12_EXT 0x8831 -#define GL_DRAW_BUFFER13_EXT 0x8832 -#define GL_DRAW_BUFFER14_EXT 0x8833 -#define GL_DRAW_BUFFER15_EXT 0x8834 -#define GL_COLOR_ATTACHMENT0_EXT 0x8CE0 -#define GL_COLOR_ATTACHMENT1_EXT 0x8CE1 -#define GL_COLOR_ATTACHMENT2_EXT 0x8CE2 -#define GL_COLOR_ATTACHMENT3_EXT 0x8CE3 -#define GL_COLOR_ATTACHMENT4_EXT 0x8CE4 -#define GL_COLOR_ATTACHMENT5_EXT 0x8CE5 -#define GL_COLOR_ATTACHMENT6_EXT 0x8CE6 -#define GL_COLOR_ATTACHMENT7_EXT 0x8CE7 -#define GL_COLOR_ATTACHMENT8_EXT 0x8CE8 -#define GL_COLOR_ATTACHMENT9_EXT 0x8CE9 -#define GL_COLOR_ATTACHMENT10_EXT 0x8CEA -#define GL_COLOR_ATTACHMENT11_EXT 0x8CEB -#define GL_COLOR_ATTACHMENT12_EXT 0x8CEC -#define GL_COLOR_ATTACHMENT13_EXT 0x8CED -#define GL_COLOR_ATTACHMENT14_EXT 0x8CEE -#define GL_COLOR_ATTACHMENT15_EXT 0x8CEF -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSEXTPROC) (GLsizei n, const GLenum *bufs); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawBuffersEXT (GLsizei n, const GLenum *bufs); -#endif -#endif /* GL_EXT_draw_buffers */ - -#ifndef GL_EXT_draw_buffers_indexed -#define GL_EXT_draw_buffers_indexed 1 -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -typedef void (GL_APIENTRYP PFNGLENABLEIEXTPROC) (GLenum target, GLuint index); -typedef void (GL_APIENTRYP PFNGLDISABLEIEXTPROC) (GLenum target, GLuint index); -typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONIEXTPROC) (GLuint buf, GLenum mode); -typedef void (GL_APIENTRYP PFNGLBLENDEQUATIONSEPARATEIEXTPROC) (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -typedef void (GL_APIENTRYP PFNGLBLENDFUNCIEXTPROC) (GLuint buf, GLenum src, GLenum dst); -typedef void (GL_APIENTRYP PFNGLBLENDFUNCSEPARATEIEXTPROC) (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -typedef void (GL_APIENTRYP PFNGLCOLORMASKIEXTPROC) (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -typedef GLboolean (GL_APIENTRYP PFNGLISENABLEDIEXTPROC) (GLenum target, GLuint index); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glEnableiEXT (GLenum target, GLuint index); -GL_APICALL void GL_APIENTRY glDisableiEXT (GLenum target, GLuint index); -GL_APICALL void GL_APIENTRY glBlendEquationiEXT (GLuint buf, GLenum mode); -GL_APICALL void GL_APIENTRY glBlendEquationSeparateiEXT (GLuint buf, GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunciEXT (GLuint buf, GLenum src, GLenum dst); -GL_APICALL void GL_APIENTRY glBlendFuncSeparateiEXT (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -GL_APICALL void GL_APIENTRY glColorMaskiEXT (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GL_APICALL GLboolean GL_APIENTRY glIsEnablediEXT (GLenum target, GLuint index); -#endif -#endif /* GL_EXT_draw_buffers_indexed */ - -#ifndef GL_EXT_draw_instanced -#define GL_EXT_draw_instanced 1 -typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDEXTPROC) (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDEXTPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedEXT (GLenum mode, GLint start, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedEXT (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#endif -#endif /* GL_EXT_draw_instanced */ - -#ifndef GL_EXT_geometry_shader -#define GL_EXT_geometry_shader 1 -#define GL_GEOMETRY_SHADER_EXT 0x8DD9 -#define GL_GEOMETRY_SHADER_BIT_EXT 0x00000004 -#define GL_GEOMETRY_LINKED_VERTICES_OUT_EXT 0x8916 -#define GL_GEOMETRY_LINKED_INPUT_TYPE_EXT 0x8917 -#define GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT 0x8918 -#define GL_GEOMETRY_SHADER_INVOCATIONS_EXT 0x887F -#define GL_LAYER_PROVOKING_VERTEX_EXT 0x825E -#define GL_LINES_ADJACENCY_EXT 0x000A -#define GL_LINE_STRIP_ADJACENCY_EXT 0x000B -#define GL_TRIANGLES_ADJACENCY_EXT 0x000C -#define GL_TRIANGLE_STRIP_ADJACENCY_EXT 0x000D -#define GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8DDF -#define GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT 0x8A2C -#define GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT 0x8A32 -#define GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT 0x9123 -#define GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT 0x9124 -#define GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT 0x8DE0 -#define GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT 0x8DE1 -#define GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT 0x8E5A -#define GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT 0x8C29 -#define GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT 0x92CF -#define GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT 0x92D5 -#define GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT 0x90CD -#define GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT 0x90D7 -#define GL_FIRST_VERTEX_CONVENTION_EXT 0x8E4D -#define GL_LAST_VERTEX_CONVENTION_EXT 0x8E4E -#define GL_UNDEFINED_VERTEX_EXT 0x8260 -#define GL_PRIMITIVES_GENERATED_EXT 0x8C87 -#define GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT 0x9312 -#define GL_MAX_FRAMEBUFFER_LAYERS_EXT 0x9317 -#define GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT 0x8DA8 -#define GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT 0x8DA7 -#define GL_REFERENCED_BY_GEOMETRY_SHADER_EXT 0x9309 -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTUREEXTPROC) (GLenum target, GLenum attachment, GLuint texture, GLint level); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glFramebufferTextureEXT (GLenum target, GLenum attachment, GLuint texture, GLint level); -#endif -#endif /* GL_EXT_geometry_shader */ - -#ifndef GL_EXT_gpu_shader5 -#define GL_EXT_gpu_shader5 1 -#endif /* GL_EXT_gpu_shader5 */ - -#ifndef GL_EXT_instanced_arrays -#define GL_EXT_instanced_arrays 1 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_EXT 0x88FE -typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISOREXTPROC) (GLuint index, GLuint divisor); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glVertexAttribDivisorEXT (GLuint index, GLuint divisor); -#endif -#endif /* GL_EXT_instanced_arrays */ - -#ifndef GL_EXT_map_buffer_range -#define GL_EXT_map_buffer_range 1 -#define GL_MAP_READ_BIT_EXT 0x0001 -#define GL_MAP_WRITE_BIT_EXT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT_EXT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT_EXT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT_EXT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT_EXT 0x0020 -typedef void *(GL_APIENTRYP PFNGLMAPBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -typedef void (GL_APIENTRYP PFNGLFLUSHMAPPEDBUFFERRANGEEXTPROC) (GLenum target, GLintptr offset, GLsizeiptr length); +/* GL_EXT_debug_marker */ +#ifndef GL_EXT_debug_marker +#define GL_EXT_debug_marker 1 #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void *GL_APIENTRY glMapBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_APICALL void GL_APIENTRY glFlushMappedBufferRangeEXT (GLenum target, GLintptr offset, GLsizeiptr length); +GL_APICALL void GL_APIENTRY glInsertEventMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPushGroupMarkerEXT (GLsizei length, const GLchar *marker); +GL_APICALL void GL_APIENTRY glPopGroupMarkerEXT (void); +#endif +typedef void (GL_APIENTRYP PFNGLINSERTEVENTMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPUSHGROUPMARKEREXTPROC) (GLsizei length, const GLchar *marker); +typedef void (GL_APIENTRYP PFNGLPOPGROUPMARKEREXTPROC) (void); #endif -#endif /* GL_EXT_map_buffer_range */ -#ifndef GL_EXT_multi_draw_arrays -#define GL_EXT_multi_draw_arrays 1 -typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +/* GL_EXT_discard_framebuffer */ +#ifndef GL_EXT_discard_framebuffer +#define GL_EXT_discard_framebuffer 1 #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, const GLint *first, const GLsizei *count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const void *const*indices, GLsizei primcount); +GL_APICALL void GL_APIENTRY glDiscardFramebufferEXT (GLenum target, GLsizei numAttachments, const GLenum *attachments); +#endif +typedef void (GL_APIENTRYP PFNGLDISCARDFRAMEBUFFEREXTPROC) (GLenum target, GLsizei numAttachments, const GLenum *attachments); #endif -#endif /* GL_EXT_multi_draw_arrays */ +/* GL_EXT_multisampled_render_to_texture */ #ifndef GL_EXT_multisampled_render_to_texture #define GL_EXT_multisampled_render_to_texture 1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT 0x8D6C -#define GL_RENDERBUFFER_SAMPLES_EXT 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT 0x8D56 -#define GL_MAX_SAMPLES_EXT 0x8D57 -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleEXT (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleEXT (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif -#endif /* GL_EXT_multisampled_render_to_texture */ +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEEXTPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEEXTPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif -#ifndef GL_EXT_multiview_draw_buffers -#define GL_EXT_multiview_draw_buffers 1 -#define GL_COLOR_ATTACHMENT_EXT 0x90F0 -#define GL_MULTIVIEW_EXT 0x90F1 -#define GL_DRAW_BUFFER_EXT 0x0C01 -#define GL_READ_BUFFER_EXT 0x0C02 -#define GL_MAX_MULTIVIEW_BUFFERS_EXT 0x90F2 -typedef void (GL_APIENTRYP PFNGLREADBUFFERINDEXEDEXTPROC) (GLenum src, GLint index); -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSINDEXEDEXTPROC) (GLint n, const GLenum *location, const GLint *indices); -typedef void (GL_APIENTRYP PFNGLGETINTEGERI_VEXTPROC) (GLenum target, GLuint index, GLint *data); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glReadBufferIndexedEXT (GLenum src, GLint index); -GL_APICALL void GL_APIENTRY glDrawBuffersIndexedEXT (GLint n, const GLenum *location, const GLint *indices); -GL_APICALL void GL_APIENTRY glGetIntegeri_vEXT (GLenum target, GLuint index, GLint *data); +#ifndef GL_EXT_multi_draw_arrays +#define GL_EXT_multi_draw_arrays 1 +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glMultiDrawArraysEXT (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +GL_APICALL void GL_APIENTRY glMultiDrawElementsEXT (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +#endif /* GL_GLEXT_PROTOTYPES */ +typedef void (GL_APIENTRYP PFNGLMULTIDRAWARRAYSEXTPROC) (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLMULTIDRAWELEMENTSEXTPROC) (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); #endif -#endif /* GL_EXT_multiview_draw_buffers */ +/* GL_EXT_occlusion_query_boolean */ #ifndef GL_EXT_occlusion_query_boolean #define GL_EXT_occlusion_query_boolean 1 -#define GL_ANY_SAMPLES_PASSED_EXT 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT 0x8D6A -#endif /* GL_EXT_occlusion_query_boolean */ - -#ifndef GL_EXT_primitive_bounding_box -#define GL_EXT_primitive_bounding_box 1 -#define GL_PRIMITIVE_BOUNDING_BOX_EXT 0x92BE -typedef void (GL_APIENTRYP PFNGLPRIMITIVEBOUNDINGBOXEXTPROC) (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glPrimitiveBoundingBoxEXT (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); -#endif -#endif /* GL_EXT_primitive_bounding_box */ - -#ifndef GL_EXT_pvrtc_sRGB -#define GL_EXT_pvrtc_sRGB 1 -#define GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT 0x8A54 -#define GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT 0x8A55 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT 0x8A56 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT 0x8A57 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG 0x93F0 -#define GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG 0x93F1 -#endif /* GL_EXT_pvrtc_sRGB */ +#ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glGenQueriesEXT (GLsizei n, GLuint *ids); +GL_APICALL void GL_APIENTRY glDeleteQueriesEXT (GLsizei n, const GLuint *ids); +GL_APICALL GLboolean GL_APIENTRY glIsQueryEXT (GLuint id); +GL_APICALL void GL_APIENTRY glBeginQueryEXT (GLenum target, GLuint id); +GL_APICALL void GL_APIENTRY glEndQueryEXT (GLenum target); +GL_APICALL void GL_APIENTRY glGetQueryivEXT (GLenum target, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glGetQueryObjectuivEXT (GLuint id, GLenum pname, GLuint *params); +#endif +typedef void (GL_APIENTRYP PFNGLGENQUERIESEXTPROC) (GLsizei n, GLuint *ids); +typedef void (GL_APIENTRYP PFNGLDELETEQUERIESEXTPROC) (GLsizei n, const GLuint *ids); +typedef GLboolean (GL_APIENTRYP PFNGLISQUERYEXTPROC) (GLuint id); +typedef void (GL_APIENTRYP PFNGLBEGINQUERYEXTPROC) (GLenum target, GLuint id); +typedef void (GL_APIENTRYP PFNGLENDQUERYEXTPROC) (GLenum target); +typedef void (GL_APIENTRYP PFNGLGETQUERYIVEXTPROC) (GLenum target, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLGETQUERYOBJECTUIVEXTPROC) (GLuint id, GLenum pname, GLuint *params); +#endif +/* GL_EXT_read_format_bgra */ #ifndef GL_EXT_read_format_bgra #define GL_EXT_read_format_bgra 1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT 0x8365 -#define GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT 0x8366 -#endif /* GL_EXT_read_format_bgra */ +#endif +/* GL_EXT_robustness */ #ifndef GL_EXT_robustness #define GL_EXT_robustness 1 -#define GL_GUILTY_CONTEXT_RESET_EXT 0x8253 -#define GL_INNOCENT_CONTEXT_RESET_EXT 0x8254 -#define GL_UNKNOWN_CONTEXT_RESET_EXT 0x8255 -#define GL_CONTEXT_ROBUST_ACCESS_EXT 0x90F3 -#define GL_RESET_NOTIFICATION_STRATEGY_EXT 0x8256 -#define GL_LOSE_CONTEXT_ON_RESET_EXT 0x8252 -#define GL_NO_RESET_NOTIFICATION_EXT 0x8261 -typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); -typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); -typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL GLenum GL_APIENTRY glGetGraphicsResetStatusEXT (void); GL_APICALL void GL_APIENTRY glReadnPixelsEXT (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); -GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, GLfloat *params); +GL_APICALL void GL_APIENTRY glGetnUniformfvEXT (GLuint program, GLint location, GLsizei bufSize, float *params); GL_APICALL void GL_APIENTRY glGetnUniformivEXT (GLuint program, GLint location, GLsizei bufSize, GLint *params); #endif -#endif /* GL_EXT_robustness */ - -#ifndef GL_EXT_sRGB -#define GL_EXT_sRGB 1 -#define GL_SRGB_EXT 0x8C40 -#define GL_SRGB_ALPHA_EXT 0x8C42 -#define GL_SRGB8_ALPHA8_EXT 0x8C43 -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT 0x8210 -#endif /* GL_EXT_sRGB */ - -#ifndef GL_EXT_sRGB_write_control -#define GL_EXT_sRGB_write_control 1 -#define GL_FRAMEBUFFER_SRGB_EXT 0x8DB9 -#endif /* GL_EXT_sRGB_write_control */ +typedef GLenum (GL_APIENTRYP PFNGLGETGRAPHICSRESETSTATUSEXTPROC) (void); +typedef void (GL_APIENTRYP PFNGLREADNPIXELSEXTPROC) (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMFVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, float *params); +typedef void (GL_APIENTRYP PFNGLGETNUNIFORMIVEXTPROC) (GLuint program, GLint location, GLsizei bufSize, GLint *params); +#endif +/* GL_EXT_separate_shader_objects */ #ifndef GL_EXT_separate_shader_objects #define GL_EXT_separate_shader_objects 1 -#define GL_ACTIVE_PROGRAM_EXT 0x8259 -#define GL_VERTEX_SHADER_BIT_EXT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT_EXT 0x00000002 -#define GL_ALL_SHADER_BITS_EXT 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE_EXT 0x8258 -#define GL_PROGRAM_PIPELINE_BINDING_EXT 0x825A -typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); -typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); -typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); -typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); -typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat v0); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint v0); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); -typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIEXTPROC) (GLuint program, GLint location, GLuint v0); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIEXTPROC) (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4UIVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLuint *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3X4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4X3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); #ifdef GL_GLEXT_PROTOTYPES +GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); GL_APICALL void GL_APIENTRY glActiveShaderProgramEXT (GLuint pipeline, GLuint program); -GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramvEXT (GLenum type, GLsizei count, const GLchar **strings); +GL_APICALL void GL_APIENTRY glBindProgramPipelineEXT (GLuint pipeline); GL_APICALL void GL_APIENTRY glDeleteProgramPipelinesEXT (GLsizei n, const GLuint *pipelines); GL_APICALL void GL_APIENTRY glGenProgramPipelinesEXT (GLsizei n, GLuint *pipelines); -GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); GL_APICALL GLboolean GL_APIENTRY glIsProgramPipelineEXT (GLuint pipeline); GL_APICALL void GL_APIENTRY glProgramParameteriEXT (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat v0); -GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint v0); +GL_APICALL void GL_APIENTRY glGetProgramPipelineivEXT (GLuint pipeline, GLenum pname, GLint *params); +GL_APICALL void GL_APIENTRY glProgramUniform1iEXT (GLuint program, GLint location, GLint x); +GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glProgramUniform1fEXT (GLuint program, GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); GL_APICALL void GL_APIENTRY glProgramUniform1ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform2iEXT (GLuint program, GLint location, GLint v0, GLint v1); GL_APICALL void GL_APIENTRY glProgramUniform2ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform3iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); GL_APICALL void GL_APIENTRY glProgramUniform3ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4fEXT (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform4iEXT (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); GL_APICALL void GL_APIENTRY glProgramUniform4ivEXT (GLuint program, GLint location, GLsizei count, const GLint *value); +GL_APICALL void GL_APIENTRY glProgramUniform1fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform2fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform3fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); +GL_APICALL void GL_APIENTRY glProgramUniform4fvEXT (GLuint program, GLint location, GLsizei count, const GLfloat *value); GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUseProgramStagesEXT (GLuint pipeline, GLbitfield stages, GLuint program); GL_APICALL void GL_APIENTRY glValidateProgramPipelineEXT (GLuint pipeline); -GL_APICALL void GL_APIENTRY glProgramUniform1uiEXT (GLuint program, GLint location, GLuint v0); -GL_APICALL void GL_APIENTRY glProgramUniform2uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1); -GL_APICALL void GL_APIENTRY glProgramUniform3uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GL_APICALL void GL_APIENTRY glProgramUniform4uiEXT (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GL_APICALL void GL_APIENTRY glProgramUniform1uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4uivEXT (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fvEXT (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#endif -#endif /* GL_EXT_separate_shader_objects */ - -#ifndef GL_EXT_shader_framebuffer_fetch -#define GL_EXT_shader_framebuffer_fetch 1 -#define GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT 0x8A52 -#endif /* GL_EXT_shader_framebuffer_fetch */ - -#ifndef GL_EXT_shader_implicit_conversions -#define GL_EXT_shader_implicit_conversions 1 -#endif /* GL_EXT_shader_implicit_conversions */ - -#ifndef GL_EXT_shader_integer_mix -#define GL_EXT_shader_integer_mix 1 -#endif /* GL_EXT_shader_integer_mix */ - -#ifndef GL_EXT_shader_io_blocks -#define GL_EXT_shader_io_blocks 1 -#endif /* GL_EXT_shader_io_blocks */ - -#ifndef GL_EXT_shader_pixel_local_storage -#define GL_EXT_shader_pixel_local_storage 1 -#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT 0x8F63 -#define GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT 0x8F67 -#define GL_SHADER_PIXEL_LOCAL_STORAGE_EXT 0x8F64 -#endif /* GL_EXT_shader_pixel_local_storage */ +GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLogEXT (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif +typedef void (GL_APIENTRYP PFNGLUSEPROGRAMSTAGESEXTPROC) (GLuint pipeline, GLbitfield stages, GLuint program); +typedef void (GL_APIENTRYP PFNGLACTIVESHADERPROGRAMEXTPROC) (GLuint pipeline, GLuint program); +typedef GLuint (GL_APIENTRYP PFNGLCREATESHADERPROGRAMVEXTPROC) (GLenum type, GLsizei count, const GLchar **strings); +typedef void (GL_APIENTRYP PFNGLBINDPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLDELETEPROGRAMPIPELINESEXTPROC) (GLsizei n, const GLuint *pipelines); +typedef void (GL_APIENTRYP PFNGLGENPROGRAMPIPELINESEXTPROC) (GLsizei n, GLuint *pipelines); +typedef GLboolean (GL_APIENTRYP PFNGLISPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLPROGRAMPARAMETERIEXTPROC) (GLuint program, GLenum pname, GLint value); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEIVEXTPROC) (GLuint pipeline, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IEXTPROC) (GLuint program, GLint location, GLint x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IEXTPROC) (GLuint program, GLint location, GLint x, GLint y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IEXTPROC) (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FEXTPROC) (GLuint program, GLint location, GLfloat x); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FEXTPROC) (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4IVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLint *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM1FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM2FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM3FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORM4FVEXTPROC) (GLuint program, GLint location, GLsizei count, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX2FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX3FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLPROGRAMUNIFORMMATRIX4FVEXTPROC) (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLVALIDATEPROGRAMPIPELINEEXTPROC) (GLuint pipeline); +typedef void (GL_APIENTRYP PFNGLGETPROGRAMPIPELINEINFOLOGEXTPROC) (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); +#endif +/* GL_EXT_shader_texture_lod */ #ifndef GL_EXT_shader_texture_lod #define GL_EXT_shader_texture_lod 1 -#endif /* GL_EXT_shader_texture_lod */ +#endif +/* GL_EXT_shadow_samplers */ #ifndef GL_EXT_shadow_samplers #define GL_EXT_shadow_samplers 1 -#define GL_TEXTURE_COMPARE_MODE_EXT 0x884C -#define GL_TEXTURE_COMPARE_FUNC_EXT 0x884D -#define GL_COMPARE_REF_TO_TEXTURE_EXT 0x884E -#define GL_SAMPLER_2D_SHADOW_EXT 0x8B62 -#endif /* GL_EXT_shadow_samplers */ - -#ifndef GL_EXT_tessellation_shader -#define GL_EXT_tessellation_shader 1 -#define GL_PATCHES_EXT 0x000E -#define GL_PATCH_VERTICES_EXT 0x8E72 -#define GL_TESS_CONTROL_OUTPUT_VERTICES_EXT 0x8E75 -#define GL_TESS_GEN_MODE_EXT 0x8E76 -#define GL_TESS_GEN_SPACING_EXT 0x8E77 -#define GL_TESS_GEN_VERTEX_ORDER_EXT 0x8E78 -#define GL_TESS_GEN_POINT_MODE_EXT 0x8E79 -#define GL_ISOLINES_EXT 0x8E7A -#define GL_QUADS_EXT 0x0007 -#define GL_FRACTIONAL_ODD_EXT 0x8E7B -#define GL_FRACTIONAL_EVEN_EXT 0x8E7C -#define GL_MAX_PATCH_VERTICES_EXT 0x8E7D -#define GL_MAX_TESS_GEN_LEVEL_EXT 0x8E7E -#define GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E7F -#define GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E80 -#define GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT 0x8E81 -#define GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT 0x8E82 -#define GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT 0x8E83 -#define GL_MAX_TESS_PATCH_COMPONENTS_EXT 0x8E84 -#define GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT 0x8E85 -#define GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT 0x8E86 -#define GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT 0x8E89 -#define GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT 0x8E8A -#define GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT 0x886C -#define GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT 0x886D -#define GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT 0x8E1E -#define GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT 0x8E1F -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT 0x92CD -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT 0x92CE -#define GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT 0x92D3 -#define GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT 0x92D4 -#define GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT 0x90CB -#define GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT 0x90CC -#define GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT 0x90D8 -#define GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT 0x90D9 -#define GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED 0x8221 -#define GL_IS_PER_PATCH_EXT 0x92E7 -#define GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT 0x9307 -#define GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT 0x9308 -#define GL_TESS_CONTROL_SHADER_EXT 0x8E88 -#define GL_TESS_EVALUATION_SHADER_EXT 0x8E87 -#define GL_TESS_CONTROL_SHADER_BIT_EXT 0x00000008 -#define GL_TESS_EVALUATION_SHADER_BIT_EXT 0x00000010 -typedef void (GL_APIENTRYP PFNGLPATCHPARAMETERIEXTPROC) (GLenum pname, GLint value); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glPatchParameteriEXT (GLenum pname, GLint value); -#endif -#endif /* GL_EXT_tessellation_shader */ - -#ifndef GL_EXT_texture_border_clamp -#define GL_EXT_texture_border_clamp 1 -#define GL_TEXTURE_BORDER_COLOR_EXT 0x1004 -#define GL_CLAMP_TO_BORDER_EXT 0x812D -typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, const GLint *params); -typedef void (GL_APIENTRYP PFNGLTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, const GLuint *params); -typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIIVEXTPROC) (GLenum target, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETTEXPARAMETERIUIVEXTPROC) (GLenum target, GLenum pname, GLuint *params); -typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, const GLint *param); -typedef void (GL_APIENTRYP PFNGLSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, const GLuint *param); -typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIIVEXTPROC) (GLuint sampler, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLGETSAMPLERPARAMETERIUIVEXTPROC) (GLuint sampler, GLenum pname, GLuint *params); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexParameterIivEXT (GLenum target, GLenum pname, const GLint *params); -GL_APICALL void GL_APIENTRY glTexParameterIuivEXT (GLenum target, GLenum pname, const GLuint *params); -GL_APICALL void GL_APIENTRY glGetTexParameterIivEXT (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetTexParameterIuivEXT (GLenum target, GLenum pname, GLuint *params); -GL_APICALL void GL_APIENTRY glSamplerParameterIivEXT (GLuint sampler, GLenum pname, const GLint *param); -GL_APICALL void GL_APIENTRY glSamplerParameterIuivEXT (GLuint sampler, GLenum pname, const GLuint *param); -GL_APICALL void GL_APIENTRY glGetSamplerParameterIivEXT (GLuint sampler, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetSamplerParameterIuivEXT (GLuint sampler, GLenum pname, GLuint *params); -#endif -#endif /* GL_EXT_texture_border_clamp */ - -#ifndef GL_EXT_texture_buffer -#define GL_EXT_texture_buffer 1 -#define GL_TEXTURE_BUFFER_EXT 0x8C2A -#define GL_TEXTURE_BUFFER_BINDING_EXT 0x8C2A -#define GL_MAX_TEXTURE_BUFFER_SIZE_EXT 0x8C2B -#define GL_TEXTURE_BINDING_BUFFER_EXT 0x8C2C -#define GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT 0x8C2D -#define GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT 0x919F -#define GL_SAMPLER_BUFFER_EXT 0x8DC2 -#define GL_INT_SAMPLER_BUFFER_EXT 0x8DD0 -#define GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT 0x8DD8 -#define GL_IMAGE_BUFFER_EXT 0x9051 -#define GL_INT_IMAGE_BUFFER_EXT 0x905C -#define GL_UNSIGNED_INT_IMAGE_BUFFER_EXT 0x9067 -#define GL_TEXTURE_BUFFER_OFFSET_EXT 0x919D -#define GL_TEXTURE_BUFFER_SIZE_EXT 0x919E -typedef void (GL_APIENTRYP PFNGLTEXBUFFEREXTPROC) (GLenum target, GLenum internalformat, GLuint buffer); -typedef void (GL_APIENTRYP PFNGLTEXBUFFERRANGEEXTPROC) (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTexBufferEXT (GLenum target, GLenum internalformat, GLuint buffer); -GL_APICALL void GL_APIENTRY glTexBufferRangeEXT (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); #endif -#endif /* GL_EXT_texture_buffer */ +/* GL_EXT_sRGB */ +#ifndef GL_EXT_sRGB +#define GL_EXT_sRGB 1 +#endif + +/* GL_EXT_texture_compression_dxt1 */ #ifndef GL_EXT_texture_compression_dxt1 #define GL_EXT_texture_compression_dxt1 1 -#define GL_COMPRESSED_RGB_S3TC_DXT1_EXT 0x83F0 -#define GL_COMPRESSED_RGBA_S3TC_DXT1_EXT 0x83F1 -#endif /* GL_EXT_texture_compression_dxt1 */ - -#ifndef GL_EXT_texture_compression_s3tc -#define GL_EXT_texture_compression_s3tc 1 -#define GL_COMPRESSED_RGBA_S3TC_DXT3_EXT 0x83F2 -#define GL_COMPRESSED_RGBA_S3TC_DXT5_EXT 0x83F3 -#endif /* GL_EXT_texture_compression_s3tc */ - -#ifndef GL_EXT_texture_cube_map_array -#define GL_EXT_texture_cube_map_array 1 -#define GL_TEXTURE_CUBE_MAP_ARRAY_EXT 0x9009 -#define GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT 0x900A -#define GL_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900C -#define GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT 0x900D -#define GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900E -#define GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT 0x900F -#define GL_IMAGE_CUBE_MAP_ARRAY_EXT 0x9054 -#define GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x905F -#define GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT 0x906A -#endif /* GL_EXT_texture_cube_map_array */ +#endif +/* GL_EXT_texture_filter_anisotropic */ #ifndef GL_EXT_texture_filter_anisotropic #define GL_EXT_texture_filter_anisotropic 1 -#define GL_TEXTURE_MAX_ANISOTROPY_EXT 0x84FE -#define GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT 0x84FF -#endif /* GL_EXT_texture_filter_anisotropic */ +#endif +/* GL_EXT_texture_format_BGRA8888 */ #ifndef GL_EXT_texture_format_BGRA8888 #define GL_EXT_texture_format_BGRA8888 1 -#endif /* GL_EXT_texture_format_BGRA8888 */ +#endif +/* GL_EXT_texture_rg */ #ifndef GL_EXT_texture_rg #define GL_EXT_texture_rg 1 -#define GL_RED_EXT 0x1903 -#define GL_RG_EXT 0x8227 -#define GL_R8_EXT 0x8229 -#define GL_RG8_EXT 0x822B -#endif /* GL_EXT_texture_rg */ - -#ifndef GL_EXT_texture_sRGB_decode -#define GL_EXT_texture_sRGB_decode 1 -#define GL_TEXTURE_SRGB_DECODE_EXT 0x8A48 -#define GL_DECODE_EXT 0x8A49 -#define GL_SKIP_DECODE_EXT 0x8A4A -#endif /* GL_EXT_texture_sRGB_decode */ +#endif +/* GL_EXT_texture_storage */ #ifndef GL_EXT_texture_storage #define GL_EXT_texture_storage 1 -#define GL_TEXTURE_IMMUTABLE_FORMAT_EXT 0x912F -#define GL_ALPHA8_EXT 0x803C -#define GL_LUMINANCE8_EXT 0x8040 -#define GL_LUMINANCE8_ALPHA8_EXT 0x8045 -#define GL_RGBA32F_EXT 0x8814 -#define GL_RGB32F_EXT 0x8815 -#define GL_ALPHA32F_EXT 0x8816 -#define GL_LUMINANCE32F_EXT 0x8818 -#define GL_LUMINANCE_ALPHA32F_EXT 0x8819 -#define GL_ALPHA16F_EXT 0x881C -#define GL_LUMINANCE16F_EXT 0x881E -#define GL_LUMINANCE_ALPHA16F_EXT 0x881F -#define GL_R32F_EXT 0x822E -#define GL_RG32F_EXT 0x8230 -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glTexStorage1DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); GL_APICALL void GL_APIENTRY glTexStorage2DEXT (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); @@ -1362,298 +1163,105 @@ GL_APICALL void GL_APIENTRY glTextureStorage2DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); GL_APICALL void GL_APIENTRY glTextureStorage3DEXT (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); #endif -#endif /* GL_EXT_texture_storage */ +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE1DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE2DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXSTORAGE3DEXTPROC) (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE1DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE2DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLTEXTURESTORAGE3DEXTPROC) (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); +#endif +/* GL_EXT_texture_type_2_10_10_10_REV */ #ifndef GL_EXT_texture_type_2_10_10_10_REV #define GL_EXT_texture_type_2_10_10_10_REV 1 -#define GL_UNSIGNED_INT_2_10_10_10_REV_EXT 0x8368 -#endif /* GL_EXT_texture_type_2_10_10_10_REV */ - -#ifndef GL_EXT_texture_view -#define GL_EXT_texture_view 1 -#define GL_TEXTURE_VIEW_MIN_LEVEL_EXT 0x82DB -#define GL_TEXTURE_VIEW_NUM_LEVELS_EXT 0x82DC -#define GL_TEXTURE_VIEW_MIN_LAYER_EXT 0x82DD -#define GL_TEXTURE_VIEW_NUM_LAYERS_EXT 0x82DE -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -typedef void (GL_APIENTRYP PFNGLTEXTUREVIEWEXTPROC) (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glTextureViewEXT (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); #endif -#endif /* GL_EXT_texture_view */ +/* GL_EXT_unpack_subimage */ #ifndef GL_EXT_unpack_subimage #define GL_EXT_unpack_subimage 1 -#define GL_UNPACK_ROW_LENGTH_EXT 0x0CF2 -#define GL_UNPACK_SKIP_ROWS_EXT 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS_EXT 0x0CF4 -#endif /* GL_EXT_unpack_subimage */ - -#ifndef GL_FJ_shader_binary_GCCSO -#define GL_FJ_shader_binary_GCCSO 1 -#define GL_GCCSO_SHADER_BINARY_FJ 0x9260 -#endif /* GL_FJ_shader_binary_GCCSO */ +#endif -#ifndef GL_IMG_multisampled_render_to_texture -#define GL_IMG_multisampled_render_to_texture 1 -#define GL_RENDERBUFFER_SAMPLES_IMG 0x9133 -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG 0x9134 -#define GL_MAX_SAMPLES_IMG 0x9135 -#define GL_TEXTURE_SAMPLES_IMG 0x9136 -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMGPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMGPROC) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +/*------------------------------------------------------------------------* + * DMP extension functions + *------------------------------------------------------------------------*/ + +/* GL_DMP_shader_binary */ +#ifndef GL_DMP_shader_binary +#define GL_DMP_shader_binary 1 #endif -#endif /* GL_IMG_multisampled_render_to_texture */ +/*------------------------------------------------------------------------* + * IMG extension functions + *------------------------------------------------------------------------*/ + +/* GL_IMG_program_binary */ #ifndef GL_IMG_program_binary #define GL_IMG_program_binary 1 -#define GL_SGX_PROGRAM_BINARY_IMG 0x9130 -#endif /* GL_IMG_program_binary */ +#endif +/* GL_IMG_read_format */ #ifndef GL_IMG_read_format #define GL_IMG_read_format 1 -#define GL_BGRA_IMG 0x80E1 -#define GL_UNSIGNED_SHORT_4_4_4_4_REV_IMG 0x8365 -#endif /* GL_IMG_read_format */ +#endif +/* GL_IMG_shader_binary */ #ifndef GL_IMG_shader_binary #define GL_IMG_shader_binary 1 -#define GL_SGX_BINARY_IMG 0x8C0A -#endif /* GL_IMG_shader_binary */ +#endif +/* GL_IMG_texture_compression_pvrtc */ #ifndef GL_IMG_texture_compression_pvrtc #define GL_IMG_texture_compression_pvrtc 1 -#define GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG 0x8C00 -#define GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG 0x8C01 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG 0x8C02 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG 0x8C03 -#endif /* GL_IMG_texture_compression_pvrtc */ - -#ifndef GL_IMG_texture_compression_pvrtc2 -#define GL_IMG_texture_compression_pvrtc2 1 -#define GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG 0x9137 -#define GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG 0x9138 -#endif /* GL_IMG_texture_compression_pvrtc2 */ - -#ifndef GL_INTEL_performance_query -#define GL_INTEL_performance_query 1 -#define GL_PERFQUERY_SINGLE_CONTEXT_INTEL 0x00000000 -#define GL_PERFQUERY_GLOBAL_CONTEXT_INTEL 0x00000001 -#define GL_PERFQUERY_WAIT_INTEL 0x83FB -#define GL_PERFQUERY_FLUSH_INTEL 0x83FA -#define GL_PERFQUERY_DONOT_FLUSH_INTEL 0x83F9 -#define GL_PERFQUERY_COUNTER_EVENT_INTEL 0x94F0 -#define GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL 0x94F1 -#define GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL 0x94F2 -#define GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL 0x94F3 -#define GL_PERFQUERY_COUNTER_RAW_INTEL 0x94F4 -#define GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL 0x94F5 -#define GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL 0x94F8 -#define GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL 0x94F9 -#define GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL 0x94FA -#define GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL 0x94FB -#define GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL 0x94FC -#define GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL 0x94FD -#define GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL 0x94FE -#define GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL 0x94FF -#define GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL 0x9500 -typedef void (GL_APIENTRYP PFNGLBEGINPERFQUERYINTELPROC) (GLuint queryHandle); -typedef void (GL_APIENTRYP PFNGLCREATEPERFQUERYINTELPROC) (GLuint queryId, GLuint *queryHandle); -typedef void (GL_APIENTRYP PFNGLDELETEPERFQUERYINTELPROC) (GLuint queryHandle); -typedef void (GL_APIENTRYP PFNGLENDPERFQUERYINTELPROC) (GLuint queryHandle); -typedef void (GL_APIENTRYP PFNGLGETFIRSTPERFQUERYIDINTELPROC) (GLuint *queryId); -typedef void (GL_APIENTRYP PFNGLGETNEXTPERFQUERYIDINTELPROC) (GLuint queryId, GLuint *nextQueryId); -typedef void (GL_APIENTRYP PFNGLGETPERFCOUNTERINFOINTELPROC) (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); -typedef void (GL_APIENTRYP PFNGLGETPERFQUERYDATAINTELPROC) (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); -typedef void (GL_APIENTRYP PFNGLGETPERFQUERYIDBYNAMEINTELPROC) (GLchar *queryName, GLuint *queryId); -typedef void (GL_APIENTRYP PFNGLGETPERFQUERYINFOINTELPROC) (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBeginPerfQueryINTEL (GLuint queryHandle); -GL_APICALL void GL_APIENTRY glCreatePerfQueryINTEL (GLuint queryId, GLuint *queryHandle); -GL_APICALL void GL_APIENTRY glDeletePerfQueryINTEL (GLuint queryHandle); -GL_APICALL void GL_APIENTRY glEndPerfQueryINTEL (GLuint queryHandle); -GL_APICALL void GL_APIENTRY glGetFirstPerfQueryIdINTEL (GLuint *queryId); -GL_APICALL void GL_APIENTRY glGetNextPerfQueryIdINTEL (GLuint queryId, GLuint *nextQueryId); -GL_APICALL void GL_APIENTRY glGetPerfCounterInfoINTEL (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar *counterName, GLuint counterDescLength, GLchar *counterDesc, GLuint *counterOffset, GLuint *counterDataSize, GLuint *counterTypeEnum, GLuint *counterDataTypeEnum, GLuint64 *rawCounterMaxValue); -GL_APICALL void GL_APIENTRY glGetPerfQueryDataINTEL (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid *data, GLuint *bytesWritten); -GL_APICALL void GL_APIENTRY glGetPerfQueryIdByNameINTEL (GLchar *queryName, GLuint *queryId); -GL_APICALL void GL_APIENTRY glGetPerfQueryInfoINTEL (GLuint queryId, GLuint queryNameLength, GLchar *queryName, GLuint *dataSize, GLuint *noCounters, GLuint *noInstances, GLuint *capsMask); -#endif -#endif /* GL_INTEL_performance_query */ - -#ifndef GL_NV_blend_equation_advanced -#define GL_NV_blend_equation_advanced 1 -#define GL_BLEND_OVERLAP_NV 0x9281 -#define GL_BLEND_PREMULTIPLIED_SRC_NV 0x9280 -#define GL_BLUE_NV 0x1905 -#define GL_COLORBURN_NV 0x929A -#define GL_COLORDODGE_NV 0x9299 -#define GL_CONJOINT_NV 0x9284 -#define GL_CONTRAST_NV 0x92A1 -#define GL_DARKEN_NV 0x9297 -#define GL_DIFFERENCE_NV 0x929E -#define GL_DISJOINT_NV 0x9283 -#define GL_DST_ATOP_NV 0x928F -#define GL_DST_IN_NV 0x928B -#define GL_DST_NV 0x9287 -#define GL_DST_OUT_NV 0x928D -#define GL_DST_OVER_NV 0x9289 -#define GL_EXCLUSION_NV 0x92A0 -#define GL_GREEN_NV 0x1904 -#define GL_HARDLIGHT_NV 0x929B -#define GL_HARDMIX_NV 0x92A9 -#define GL_HSL_COLOR_NV 0x92AF -#define GL_HSL_HUE_NV 0x92AD -#define GL_HSL_LUMINOSITY_NV 0x92B0 -#define GL_HSL_SATURATION_NV 0x92AE -#define GL_INVERT_OVG_NV 0x92B4 -#define GL_INVERT_RGB_NV 0x92A3 -#define GL_LIGHTEN_NV 0x9298 -#define GL_LINEARBURN_NV 0x92A5 -#define GL_LINEARDODGE_NV 0x92A4 -#define GL_LINEARLIGHT_NV 0x92A7 -#define GL_MINUS_CLAMPED_NV 0x92B3 -#define GL_MINUS_NV 0x929F -#define GL_MULTIPLY_NV 0x9294 -#define GL_OVERLAY_NV 0x9296 -#define GL_PINLIGHT_NV 0x92A8 -#define GL_PLUS_CLAMPED_ALPHA_NV 0x92B2 -#define GL_PLUS_CLAMPED_NV 0x92B1 -#define GL_PLUS_DARKER_NV 0x9292 -#define GL_PLUS_NV 0x9291 -#define GL_RED_NV 0x1903 -#define GL_SCREEN_NV 0x9295 -#define GL_SOFTLIGHT_NV 0x929C -#define GL_SRC_ATOP_NV 0x928E -#define GL_SRC_IN_NV 0x928A -#define GL_SRC_NV 0x9286 -#define GL_SRC_OUT_NV 0x928C -#define GL_SRC_OVER_NV 0x9288 -#define GL_UNCORRELATED_NV 0x9282 -#define GL_VIVIDLIGHT_NV 0x92A6 -#define GL_XOR_NV 0x1506 -typedef void (GL_APIENTRYP PFNGLBLENDPARAMETERINVPROC) (GLenum pname, GLint value); -typedef void (GL_APIENTRYP PFNGLBLENDBARRIERNVPROC) (void); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlendParameteriNV (GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glBlendBarrierNV (void); -#endif -#endif /* GL_NV_blend_equation_advanced */ - -#ifndef GL_NV_blend_equation_advanced_coherent -#define GL_NV_blend_equation_advanced_coherent 1 -#define GL_BLEND_ADVANCED_COHERENT_NV 0x9285 -#endif /* GL_NV_blend_equation_advanced_coherent */ - -#ifndef GL_NV_copy_buffer -#define GL_NV_copy_buffer 1 -#define GL_COPY_READ_BUFFER_NV 0x8F36 -#define GL_COPY_WRITE_BUFFER_NV 0x8F37 -typedef void (GL_APIENTRYP PFNGLCOPYBUFFERSUBDATANVPROC) (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +#endif + +/* GL_IMG_multisampled_render_to_texture */ +#ifndef GL_IMG_multisampled_render_to_texture +#define GL_IMG_multisampled_render_to_texture 1 #ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glCopyBufferSubDataNV (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); +GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleIMG (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glFramebufferTexture2DMultisampleIMG (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +#endif +typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLEIMG) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +typedef void (GL_APIENTRYP PFNGLFRAMEBUFFERTEXTURE2DMULTISAMPLEIMG) (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); #endif -#endif /* GL_NV_copy_buffer */ +/*------------------------------------------------------------------------* + * NV extension functions + *------------------------------------------------------------------------*/ + +/* GL_NV_coverage_sample */ #ifndef GL_NV_coverage_sample #define GL_NV_coverage_sample 1 -#define GL_COVERAGE_COMPONENT_NV 0x8ED0 -#define GL_COVERAGE_COMPONENT4_NV 0x8ED1 -#define GL_COVERAGE_ATTACHMENT_NV 0x8ED2 -#define GL_COVERAGE_BUFFERS_NV 0x8ED3 -#define GL_COVERAGE_SAMPLES_NV 0x8ED4 -#define GL_COVERAGE_ALL_FRAGMENTS_NV 0x8ED5 -#define GL_COVERAGE_EDGE_FRAGMENTS_NV 0x8ED6 -#define GL_COVERAGE_AUTOMATIC_NV 0x8ED7 -#define GL_COVERAGE_BUFFER_BIT_NV 0x00008000 -typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); -typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glCoverageMaskNV (GLboolean mask); GL_APICALL void GL_APIENTRY glCoverageOperationNV (GLenum operation); #endif -#endif /* GL_NV_coverage_sample */ +typedef void (GL_APIENTRYP PFNGLCOVERAGEMASKNVPROC) (GLboolean mask); +typedef void (GL_APIENTRYP PFNGLCOVERAGEOPERATIONNVPROC) (GLenum operation); +#endif +/* GL_NV_depth_nonlinear */ #ifndef GL_NV_depth_nonlinear #define GL_NV_depth_nonlinear 1 -#define GL_DEPTH_COMPONENT16_NONLINEAR_NV 0x8E2C -#endif /* GL_NV_depth_nonlinear */ +#endif +/* GL_NV_draw_buffers */ #ifndef GL_NV_draw_buffers #define GL_NV_draw_buffers 1 -#define GL_MAX_DRAW_BUFFERS_NV 0x8824 -#define GL_DRAW_BUFFER0_NV 0x8825 -#define GL_DRAW_BUFFER1_NV 0x8826 -#define GL_DRAW_BUFFER2_NV 0x8827 -#define GL_DRAW_BUFFER3_NV 0x8828 -#define GL_DRAW_BUFFER4_NV 0x8829 -#define GL_DRAW_BUFFER5_NV 0x882A -#define GL_DRAW_BUFFER6_NV 0x882B -#define GL_DRAW_BUFFER7_NV 0x882C -#define GL_DRAW_BUFFER8_NV 0x882D -#define GL_DRAW_BUFFER9_NV 0x882E -#define GL_DRAW_BUFFER10_NV 0x882F -#define GL_DRAW_BUFFER11_NV 0x8830 -#define GL_DRAW_BUFFER12_NV 0x8831 -#define GL_DRAW_BUFFER13_NV 0x8832 -#define GL_DRAW_BUFFER14_NV 0x8833 -#define GL_DRAW_BUFFER15_NV 0x8834 -#define GL_COLOR_ATTACHMENT0_NV 0x8CE0 -#define GL_COLOR_ATTACHMENT1_NV 0x8CE1 -#define GL_COLOR_ATTACHMENT2_NV 0x8CE2 -#define GL_COLOR_ATTACHMENT3_NV 0x8CE3 -#define GL_COLOR_ATTACHMENT4_NV 0x8CE4 -#define GL_COLOR_ATTACHMENT5_NV 0x8CE5 -#define GL_COLOR_ATTACHMENT6_NV 0x8CE6 -#define GL_COLOR_ATTACHMENT7_NV 0x8CE7 -#define GL_COLOR_ATTACHMENT8_NV 0x8CE8 -#define GL_COLOR_ATTACHMENT9_NV 0x8CE9 -#define GL_COLOR_ATTACHMENT10_NV 0x8CEA -#define GL_COLOR_ATTACHMENT11_NV 0x8CEB -#define GL_COLOR_ATTACHMENT12_NV 0x8CEC -#define GL_COLOR_ATTACHMENT13_NV 0x8CED -#define GL_COLOR_ATTACHMENT14_NV 0x8CEE -#define GL_COLOR_ATTACHMENT15_NV 0x8CEF -typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDrawBuffersNV (GLsizei n, const GLenum *bufs); #endif -#endif /* GL_NV_draw_buffers */ - -#ifndef GL_NV_draw_instanced -#define GL_NV_draw_instanced 1 -typedef void (GL_APIENTRYP PFNGLDRAWARRAYSINSTANCEDNVPROC) (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -typedef void (GL_APIENTRYP PFNGLDRAWELEMENTSINSTANCEDNVPROC) (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glDrawArraysInstancedNV (GLenum mode, GLint first, GLsizei count, GLsizei primcount); -GL_APICALL void GL_APIENTRY glDrawElementsInstancedNV (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei primcount); +typedef void (GL_APIENTRYP PFNGLDRAWBUFFERSNVPROC) (GLsizei n, const GLenum *bufs); #endif -#endif /* GL_NV_draw_instanced */ - -#ifndef GL_NV_explicit_attrib_location -#define GL_NV_explicit_attrib_location 1 -#endif /* GL_NV_explicit_attrib_location */ +/* GL_NV_fbo_color_attachments */ #ifndef GL_NV_fbo_color_attachments #define GL_NV_fbo_color_attachments 1 -#define GL_MAX_COLOR_ATTACHMENTS_NV 0x8CDF -#endif /* GL_NV_fbo_color_attachments */ +#endif +/* GL_NV_fence */ #ifndef GL_NV_fence #define GL_NV_fence 1 -#define GL_ALL_COMPLETED_NV 0x84F2 -#define GL_FENCE_STATUS_NV 0x84F3 -#define GL_FENCE_CONDITION_NV 0x84F4 -typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); -typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); -typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); -typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); -typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glDeleteFencesNV (GLsizei n, const GLuint *fences); GL_APICALL void GL_APIENTRY glGenFencesNV (GLsizei n, GLuint *fences); @@ -1663,185 +1271,85 @@ GL_APICALL void GL_APIENTRY glFinishFenceNV (GLuint fence); GL_APICALL void GL_APIENTRY glSetFenceNV (GLuint fence, GLenum condition); #endif -#endif /* GL_NV_fence */ - -#ifndef GL_NV_framebuffer_blit -#define GL_NV_framebuffer_blit 1 -#define GL_READ_FRAMEBUFFER_NV 0x8CA8 -#define GL_DRAW_FRAMEBUFFER_NV 0x8CA9 -#define GL_DRAW_FRAMEBUFFER_BINDING_NV 0x8CA6 -#define GL_READ_FRAMEBUFFER_BINDING_NV 0x8CAA -typedef void (GL_APIENTRYP PFNGLBLITFRAMEBUFFERNVPROC) (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glBlitFramebufferNV (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -#endif -#endif /* GL_NV_framebuffer_blit */ - -#ifndef GL_NV_framebuffer_multisample -#define GL_NV_framebuffer_multisample 1 -#define GL_RENDERBUFFER_SAMPLES_NV 0x8CAB -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_NV 0x8D56 -#define GL_MAX_SAMPLES_NV 0x8D57 -typedef void (GL_APIENTRYP PFNGLRENDERBUFFERSTORAGEMULTISAMPLENVPROC) (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisampleNV (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -#endif -#endif /* GL_NV_framebuffer_multisample */ - -#ifndef GL_NV_generate_mipmap_sRGB -#define GL_NV_generate_mipmap_sRGB 1 -#endif /* GL_NV_generate_mipmap_sRGB */ - -#ifndef GL_NV_instanced_arrays -#define GL_NV_instanced_arrays 1 -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR_NV 0x88FE -typedef void (GL_APIENTRYP PFNGLVERTEXATTRIBDIVISORNVPROC) (GLuint index, GLuint divisor); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glVertexAttribDivisorNV (GLuint index, GLuint divisor); -#endif -#endif /* GL_NV_instanced_arrays */ - -#ifndef GL_NV_non_square_matrices -#define GL_NV_non_square_matrices 1 -#define GL_FLOAT_MAT2x3_NV 0x8B65 -#define GL_FLOAT_MAT2x4_NV 0x8B66 -#define GL_FLOAT_MAT3x2_NV 0x8B67 -#define GL_FLOAT_MAT3x4_NV 0x8B68 -#define GL_FLOAT_MAT4x2_NV 0x8B69 -#define GL_FLOAT_MAT4x3_NV 0x8B6A -typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX2X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X2FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX3X4FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -typedef void (GL_APIENTRYP PFNGLUNIFORMMATRIX4X3FVNVPROC) (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -#ifdef GL_GLEXT_PROTOTYPES -GL_APICALL void GL_APIENTRY glUniformMatrix2x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix2x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x2fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x4fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x3fvNV (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +typedef void (GL_APIENTRYP PFNGLDELETEFENCESNVPROC) (GLsizei n, const GLuint *fences); +typedef void (GL_APIENTRYP PFNGLGENFENCESNVPROC) (GLsizei n, GLuint *fences); +typedef GLboolean (GL_APIENTRYP PFNGLISFENCENVPROC) (GLuint fence); +typedef GLboolean (GL_APIENTRYP PFNGLTESTFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLGETFENCEIVNVPROC) (GLuint fence, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLFINISHFENCENVPROC) (GLuint fence); +typedef void (GL_APIENTRYP PFNGLSETFENCENVPROC) (GLuint fence, GLenum condition); #endif -#endif /* GL_NV_non_square_matrices */ +/* GL_NV_read_buffer */ #ifndef GL_NV_read_buffer #define GL_NV_read_buffer 1 -#define GL_READ_BUFFER_NV 0x0C02 -typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glReadBufferNV (GLenum mode); #endif -#endif /* GL_NV_read_buffer */ +typedef void (GL_APIENTRYP PFNGLREADBUFFERNVPROC) (GLenum mode); +#endif +/* GL_NV_read_buffer_front */ #ifndef GL_NV_read_buffer_front #define GL_NV_read_buffer_front 1 -#endif /* GL_NV_read_buffer_front */ +#endif +/* GL_NV_read_depth */ #ifndef GL_NV_read_depth #define GL_NV_read_depth 1 -#endif /* GL_NV_read_depth */ +#endif +/* GL_NV_read_depth_stencil */ #ifndef GL_NV_read_depth_stencil #define GL_NV_read_depth_stencil 1 -#endif /* GL_NV_read_depth_stencil */ +#endif +/* GL_NV_read_stencil */ #ifndef GL_NV_read_stencil #define GL_NV_read_stencil 1 -#endif /* GL_NV_read_stencil */ - -#ifndef GL_NV_sRGB_formats -#define GL_NV_sRGB_formats 1 -#define GL_SLUMINANCE_NV 0x8C46 -#define GL_SLUMINANCE_ALPHA_NV 0x8C44 -#define GL_SRGB8_NV 0x8C41 -#define GL_SLUMINANCE8_NV 0x8C47 -#define GL_SLUMINANCE8_ALPHA8_NV 0x8C45 -#define GL_COMPRESSED_SRGB_S3TC_DXT1_NV 0x8C4C -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV 0x8C4D -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV 0x8C4E -#define GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV 0x8C4F -#define GL_ETC1_SRGB8_NV 0x88EE -#endif /* GL_NV_sRGB_formats */ - -#ifndef GL_NV_shadow_samplers_array -#define GL_NV_shadow_samplers_array 1 -#define GL_SAMPLER_2D_ARRAY_SHADOW_NV 0x8DC4 -#endif /* GL_NV_shadow_samplers_array */ - -#ifndef GL_NV_shadow_samplers_cube -#define GL_NV_shadow_samplers_cube 1 -#define GL_SAMPLER_CUBE_SHADOW_NV 0x8DC5 -#endif /* GL_NV_shadow_samplers_cube */ - -#ifndef GL_NV_texture_border_clamp -#define GL_NV_texture_border_clamp 1 -#define GL_TEXTURE_BORDER_COLOR_NV 0x1004 -#define GL_CLAMP_TO_BORDER_NV 0x812D -#endif /* GL_NV_texture_border_clamp */ +#endif +/* GL_NV_texture_compression_s3tc_update */ #ifndef GL_NV_texture_compression_s3tc_update #define GL_NV_texture_compression_s3tc_update 1 -#endif /* GL_NV_texture_compression_s3tc_update */ +#endif +/* GL_NV_texture_npot_2D_mipmap */ #ifndef GL_NV_texture_npot_2D_mipmap #define GL_NV_texture_npot_2D_mipmap 1 -#endif /* GL_NV_texture_npot_2D_mipmap */ +#endif +/*------------------------------------------------------------------------* + * QCOM extension functions + *------------------------------------------------------------------------*/ + +/* GL_QCOM_alpha_test */ #ifndef GL_QCOM_alpha_test #define GL_QCOM_alpha_test 1 -#define GL_ALPHA_TEST_QCOM 0x0BC0 -#define GL_ALPHA_TEST_FUNC_QCOM 0x0BC1 -#define GL_ALPHA_TEST_REF_QCOM 0x0BC2 -typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glAlphaFuncQCOM (GLenum func, GLclampf ref); #endif -#endif /* GL_QCOM_alpha_test */ - -#ifndef GL_QCOM_binning_control -#define GL_QCOM_binning_control 1 -#define GL_BINNING_CONTROL_HINT_QCOM 0x8FB0 -#define GL_CPU_OPTIMIZED_QCOM 0x8FB1 -#define GL_GPU_OPTIMIZED_QCOM 0x8FB2 -#define GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM 0x8FB3 -#endif /* GL_QCOM_binning_control */ +typedef void (GL_APIENTRYP PFNGLALPHAFUNCQCOMPROC) (GLenum func, GLclampf ref); +#endif +/* GL_QCOM_driver_control */ #ifndef GL_QCOM_driver_control #define GL_QCOM_driver_control 1 -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); -typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); -typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); -typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glGetDriverControlsQCOM (GLint *num, GLsizei size, GLuint *driverControls); GL_APICALL void GL_APIENTRY glGetDriverControlStringQCOM (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); GL_APICALL void GL_APIENTRY glEnableDriverControlQCOM (GLuint driverControl); GL_APICALL void GL_APIENTRY glDisableDriverControlQCOM (GLuint driverControl); #endif -#endif /* GL_QCOM_driver_control */ +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSQCOMPROC) (GLint *num, GLsizei size, GLuint *driverControls); +typedef void (GL_APIENTRYP PFNGLGETDRIVERCONTROLSTRINGQCOMPROC) (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); +typedef void (GL_APIENTRYP PFNGLENABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +typedef void (GL_APIENTRYP PFNGLDISABLEDRIVERCONTROLQCOMPROC) (GLuint driverControl); +#endif +/* GL_QCOM_extended_get */ #ifndef GL_QCOM_extended_get #define GL_QCOM_extended_get 1 -#define GL_TEXTURE_WIDTH_QCOM 0x8BD2 -#define GL_TEXTURE_HEIGHT_QCOM 0x8BD3 -#define GL_TEXTURE_DEPTH_QCOM 0x8BD4 -#define GL_TEXTURE_INTERNAL_FORMAT_QCOM 0x8BD5 -#define GL_TEXTURE_FORMAT_QCOM 0x8BD6 -#define GL_TEXTURE_TYPE_QCOM 0x8BD7 -#define GL_TEXTURE_IMAGE_VALID_QCOM 0x8BD8 -#define GL_TEXTURE_NUM_LEVELS_QCOM 0x8BD9 -#define GL_TEXTURE_TARGET_QCOM 0x8BDA -#define GL_TEXTURE_OBJECT_VALID_QCOM 0x8BDB -#define GL_STATE_RESTORE 0x8BDC -typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); -typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); -typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); -typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, void **params); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glExtGetTexturesQCOM (GLuint *textures, GLint maxTextures, GLint *numTextures); GL_APICALL void GL_APIENTRY glExtGetBuffersQCOM (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); @@ -1849,84 +1357,66 @@ GL_APICALL void GL_APIENTRY glExtGetFramebuffersQCOM (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); GL_APICALL void GL_APIENTRY glExtGetTexLevelParameterivQCOM (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); GL_APICALL void GL_APIENTRY glExtTexObjectStateOverrideiQCOM (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void *texels); -GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, void **params); +GL_APICALL void GL_APIENTRY glExtGetTexSubImageQCOM (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +GL_APICALL void GL_APIENTRY glExtGetBufferPointervQCOM (GLenum target, GLvoid **params); +#endif +typedef void (GL_APIENTRYP PFNGLEXTGETTEXTURESQCOMPROC) (GLuint *textures, GLint maxTextures, GLint *numTextures); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERSQCOMPROC) (GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETRENDERBUFFERSQCOMPROC) (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETFRAMEBUFFERSQCOMPROC) (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXLEVELPARAMETERIVQCOMPROC) (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); +typedef void (GL_APIENTRYP PFNGLEXTTEXOBJECTSTATEOVERRIDEIQCOMPROC) (GLenum target, GLenum pname, GLint param); +typedef void (GL_APIENTRYP PFNGLEXTGETTEXSUBIMAGEQCOMPROC) (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +typedef void (GL_APIENTRYP PFNGLEXTGETBUFFERPOINTERVQCOMPROC) (GLenum target, GLvoid **params); #endif -#endif /* GL_QCOM_extended_get */ +/* GL_QCOM_extended_get2 */ #ifndef GL_QCOM_extended_get2 #define GL_QCOM_extended_get2 1 -typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); -typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); -typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glExtGetShadersQCOM (GLuint *shaders, GLint maxShaders, GLint *numShaders); GL_APICALL void GL_APIENTRY glExtGetProgramsQCOM (GLuint *programs, GLint maxPrograms, GLint *numPrograms); GL_APICALL GLboolean GL_APIENTRY glExtIsProgramBinaryQCOM (GLuint program); GL_APICALL void GL_APIENTRY glExtGetProgramBinarySourceQCOM (GLuint program, GLenum shadertype, GLchar *source, GLint *length); #endif -#endif /* GL_QCOM_extended_get2 */ +typedef void (GL_APIENTRYP PFNGLEXTGETSHADERSQCOMPROC) (GLuint *shaders, GLint maxShaders, GLint *numShaders); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMSQCOMPROC) (GLuint *programs, GLint maxPrograms, GLint *numPrograms); +typedef GLboolean (GL_APIENTRYP PFNGLEXTISPROGRAMBINARYQCOMPROC) (GLuint program); +typedef void (GL_APIENTRYP PFNGLEXTGETPROGRAMBINARYSOURCEQCOMPROC) (GLuint program, GLenum shadertype, GLchar *source, GLint *length); +#endif +/* GL_QCOM_perfmon_global_mode */ #ifndef GL_QCOM_perfmon_global_mode #define GL_QCOM_perfmon_global_mode 1 -#define GL_PERFMON_GLOBAL_MODE_QCOM 0x8FA0 -#endif /* GL_QCOM_perfmon_global_mode */ +#endif + +/* GL_QCOM_writeonly_rendering */ +#ifndef GL_QCOM_writeonly_rendering +#define GL_QCOM_writeonly_rendering 1 +#endif +/* GL_QCOM_tiled_rendering */ #ifndef GL_QCOM_tiled_rendering #define GL_QCOM_tiled_rendering 1 -#define GL_COLOR_BUFFER_BIT0_QCOM 0x00000001 -#define GL_COLOR_BUFFER_BIT1_QCOM 0x00000002 -#define GL_COLOR_BUFFER_BIT2_QCOM 0x00000004 -#define GL_COLOR_BUFFER_BIT3_QCOM 0x00000008 -#define GL_COLOR_BUFFER_BIT4_QCOM 0x00000010 -#define GL_COLOR_BUFFER_BIT5_QCOM 0x00000020 -#define GL_COLOR_BUFFER_BIT6_QCOM 0x00000040 -#define GL_COLOR_BUFFER_BIT7_QCOM 0x00000080 -#define GL_DEPTH_BUFFER_BIT0_QCOM 0x00000100 -#define GL_DEPTH_BUFFER_BIT1_QCOM 0x00000200 -#define GL_DEPTH_BUFFER_BIT2_QCOM 0x00000400 -#define GL_DEPTH_BUFFER_BIT3_QCOM 0x00000800 -#define GL_DEPTH_BUFFER_BIT4_QCOM 0x00001000 -#define GL_DEPTH_BUFFER_BIT5_QCOM 0x00002000 -#define GL_DEPTH_BUFFER_BIT6_QCOM 0x00004000 -#define GL_DEPTH_BUFFER_BIT7_QCOM 0x00008000 -#define GL_STENCIL_BUFFER_BIT0_QCOM 0x00010000 -#define GL_STENCIL_BUFFER_BIT1_QCOM 0x00020000 -#define GL_STENCIL_BUFFER_BIT2_QCOM 0x00040000 -#define GL_STENCIL_BUFFER_BIT3_QCOM 0x00080000 -#define GL_STENCIL_BUFFER_BIT4_QCOM 0x00100000 -#define GL_STENCIL_BUFFER_BIT5_QCOM 0x00200000 -#define GL_STENCIL_BUFFER_BIT6_QCOM 0x00400000 -#define GL_STENCIL_BUFFER_BIT7_QCOM 0x00800000 -#define GL_MULTISAMPLE_BUFFER_BIT0_QCOM 0x01000000 -#define GL_MULTISAMPLE_BUFFER_BIT1_QCOM 0x02000000 -#define GL_MULTISAMPLE_BUFFER_BIT2_QCOM 0x04000000 -#define GL_MULTISAMPLE_BUFFER_BIT3_QCOM 0x08000000 -#define GL_MULTISAMPLE_BUFFER_BIT4_QCOM 0x10000000 -#define GL_MULTISAMPLE_BUFFER_BIT5_QCOM 0x20000000 -#define GL_MULTISAMPLE_BUFFER_BIT6_QCOM 0x40000000 -#define GL_MULTISAMPLE_BUFFER_BIT7_QCOM 0x80000000 -typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); -typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); #ifdef GL_GLEXT_PROTOTYPES GL_APICALL void GL_APIENTRY glStartTilingQCOM (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); GL_APICALL void GL_APIENTRY glEndTilingQCOM (GLbitfield preserveMask); #endif -#endif /* GL_QCOM_tiled_rendering */ +typedef void (GL_APIENTRYP PFNGLSTARTTILINGQCOMPROC) (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); +typedef void (GL_APIENTRYP PFNGLENDTILINGQCOMPROC) (GLbitfield preserveMask); +#endif -#ifndef GL_QCOM_writeonly_rendering -#define GL_QCOM_writeonly_rendering 1 -#define GL_WRITEONLY_RENDERING_QCOM 0x8823 -#endif /* GL_QCOM_writeonly_rendering */ +/*------------------------------------------------------------------------* + * VIV extension tokens + *------------------------------------------------------------------------*/ +/* GL_VIV_shader_binary */ #ifndef GL_VIV_shader_binary #define GL_VIV_shader_binary 1 -#define GL_SHADER_BINARY_VIV 0x8FC4 -#endif /* GL_VIV_shader_binary */ +#endif #ifdef __cplusplus } #endif -#endif +#endif /* __gl2ext_h_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES2/gl2.h android-platform-frameworks-native-21/opengl/include/GLES2/gl2.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES2/gl2.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES2/gl2.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,83 +1,56 @@ #ifndef __gl2_h_ -#define __gl2_h_ 1 +#define __gl2_h_ + +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ + +#include #ifdef __cplusplus extern "C" { #endif /* -** Copyright (c) 2013-2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 26696 $ on $Date: 2014-05-17 14:48:55 -0700 (Sat, 17 May 2014) $ -*/ - -#include + * This document is licensed under the SGI Free Software B License Version + * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . + */ -/* Generated on date 20140517 */ +/*------------------------------------------------------------------------- + * Data type definitions + *-----------------------------------------------------------------------*/ -/* Generated C header for: - * API: gles2 - * Profile: common - * Versions considered: 2\.[0-9] - * Versions emitted: .* - * Default extensions included: None - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ +typedef void GLvoid; +typedef char GLchar; +typedef unsigned int GLenum; +typedef unsigned char GLboolean; +typedef unsigned int GLbitfield; +typedef khronos_int8_t GLbyte; +typedef short GLshort; +typedef int GLint; +typedef int GLsizei; +typedef khronos_uint8_t GLubyte; +typedef unsigned short GLushort; +typedef unsigned int GLuint; +typedef khronos_float_t GLfloat; +typedef khronos_float_t GLclampf; +typedef khronos_int32_t GLfixed; -#ifndef GL_ES_VERSION_2_0 -#define GL_ES_VERSION_2_0 1 -#include -typedef khronos_int8_t GLbyte; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; -typedef short GLshort; -typedef unsigned short GLushort; -typedef void GLvoid; -typedef struct __GLsync *GLsync; -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef unsigned int GLenum; -typedef unsigned int GLuint; -typedef char GLchar; -typedef khronos_float_t GLfloat; -typedef khronos_ssize_t GLsizeiptr; +/* GL types for handling large vertex buffer objects */ typedef khronos_intptr_t GLintptr; -typedef unsigned int GLbitfield; -typedef int GLint; -typedef unsigned char GLboolean; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; +typedef khronos_ssize_t GLsizeiptr; + +/* OpenGL ES core versions */ +#define GL_ES_VERSION_2_0 1 + +/* ClearBufferMask */ #define GL_DEPTH_BUFFER_BIT 0x00000100 #define GL_STENCIL_BUFFER_BIT 0x00000400 #define GL_COLOR_BUFFER_BIT 0x00004000 + +/* Boolean */ #define GL_FALSE 0 #define GL_TRUE 1 + +/* BeginMode */ #define GL_POINTS 0x0000 #define GL_LINES 0x0001 #define GL_LINE_LOOP 0x0002 @@ -85,6 +58,18 @@ #define GL_TRIANGLES 0x0004 #define GL_TRIANGLE_STRIP 0x0005 #define GL_TRIANGLE_FAN 0x0006 + +/* AlphaFunction (not supported in ES20) */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* BlendingFactorDest */ #define GL_ZERO 0 #define GL_ONE 1 #define GL_SRC_COLOR 0x0300 @@ -93,15 +78,29 @@ #define GL_ONE_MINUS_SRC_ALPHA 0x0303 #define GL_DST_ALPHA 0x0304 #define GL_ONE_MINUS_DST_ALPHA 0x0305 + +/* BlendingFactorSrc */ +/* GL_ZERO */ +/* GL_ONE */ #define GL_DST_COLOR 0x0306 #define GL_ONE_MINUS_DST_COLOR 0x0307 #define GL_SRC_ALPHA_SATURATE 0x0308 +/* GL_SRC_ALPHA */ +/* GL_ONE_MINUS_SRC_ALPHA */ +/* GL_DST_ALPHA */ +/* GL_ONE_MINUS_DST_ALPHA */ + +/* BlendEquationSeparate */ #define GL_FUNC_ADD 0x8006 #define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 +#define GL_BLEND_EQUATION_RGB 0x8009 /* same as BLEND_EQUATION */ #define GL_BLEND_EQUATION_ALPHA 0x883D + +/* BlendSubtract */ #define GL_FUNC_SUBTRACT 0x800A #define GL_FUNC_REVERSE_SUBTRACT 0x800B + +/* Separate Blend Functions */ #define GL_BLEND_DST_RGB 0x80C8 #define GL_BLEND_SRC_RGB 0x80C9 #define GL_BLEND_DST_ALPHA 0x80CA @@ -111,19 +110,38 @@ #define GL_CONSTANT_ALPHA 0x8003 #define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 #define GL_BLEND_COLOR 0x8005 + +/* Buffer Objects */ #define GL_ARRAY_BUFFER 0x8892 #define GL_ELEMENT_ARRAY_BUFFER 0x8893 #define GL_ARRAY_BUFFER_BINDING 0x8894 #define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 + #define GL_STREAM_DRAW 0x88E0 #define GL_STATIC_DRAW 0x88E4 #define GL_DYNAMIC_DRAW 0x88E8 + #define GL_BUFFER_SIZE 0x8764 #define GL_BUFFER_USAGE 0x8765 + #define GL_CURRENT_VERTEX_ATTRIB 0x8626 + +/* CullFaceMode */ #define GL_FRONT 0x0404 #define GL_BACK 0x0405 #define GL_FRONT_AND_BACK 0x0408 + +/* DepthFunction */ +/* GL_NEVER */ +/* GL_LESS */ +/* GL_EQUAL */ +/* GL_LEQUAL */ +/* GL_GREATER */ +/* GL_NOTEQUAL */ +/* GL_GEQUAL */ +/* GL_ALWAYS */ + +/* EnableCap */ #define GL_TEXTURE_2D 0x0DE1 #define GL_CULL_FACE 0x0B44 #define GL_BLEND 0x0BE2 @@ -134,13 +152,19 @@ #define GL_POLYGON_OFFSET_FILL 0x8037 #define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E #define GL_SAMPLE_COVERAGE 0x80A0 + +/* ErrorCode */ #define GL_NO_ERROR 0 #define GL_INVALID_ENUM 0x0500 #define GL_INVALID_VALUE 0x0501 #define GL_INVALID_OPERATION 0x0502 #define GL_OUT_OF_MEMORY 0x0505 + +/* FrontFaceDirection */ #define GL_CW 0x0900 #define GL_CCW 0x0901 + +/* GetPName */ #define GL_LINE_WIDTH 0x0B21 #define GL_ALIASED_POINT_SIZE_RANGE 0x846D #define GL_ALIASED_LINE_WIDTH_RANGE 0x846E @@ -167,6 +191,7 @@ #define GL_STENCIL_BACK_WRITEMASK 0x8CA5 #define GL_VIEWPORT 0x0BA2 #define GL_SCISSOR_BOX 0x0C10 +/* GL_SCISSOR_TEST */ #define GL_COLOR_CLEAR_VALUE 0x0C22 #define GL_COLOR_WRITEMASK 0x0C23 #define GL_UNPACK_ALIGNMENT 0x0CF5 @@ -181,18 +206,32 @@ #define GL_DEPTH_BITS 0x0D56 #define GL_STENCIL_BITS 0x0D57 #define GL_POLYGON_OFFSET_UNITS 0x2A00 +/* GL_POLYGON_OFFSET_FILL */ #define GL_POLYGON_OFFSET_FACTOR 0x8038 #define GL_TEXTURE_BINDING_2D 0x8069 #define GL_SAMPLE_BUFFERS 0x80A8 #define GL_SAMPLES 0x80A9 #define GL_SAMPLE_COVERAGE_VALUE 0x80AA #define GL_SAMPLE_COVERAGE_INVERT 0x80AB + +/* GetTextureParameter */ +/* GL_TEXTURE_MAG_FILTER */ +/* GL_TEXTURE_MIN_FILTER */ +/* GL_TEXTURE_WRAP_S */ +/* GL_TEXTURE_WRAP_T */ + #define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 #define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 + +/* HintMode */ #define GL_DONT_CARE 0x1100 #define GL_FASTEST 0x1101 #define GL_NICEST 0x1102 -#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* HintTarget */ +#define GL_GENERATE_MIPMAP_HINT 0x8192 + +/* DataType */ #define GL_BYTE 0x1400 #define GL_UNSIGNED_BYTE 0x1401 #define GL_SHORT 0x1402 @@ -201,35 +240,44 @@ #define GL_UNSIGNED_INT 0x1405 #define GL_FLOAT 0x1406 #define GL_FIXED 0x140C + +/* PixelFormat */ #define GL_DEPTH_COMPONENT 0x1902 #define GL_ALPHA 0x1906 #define GL_RGB 0x1907 #define GL_RGBA 0x1908 #define GL_LUMINANCE 0x1909 #define GL_LUMINANCE_ALPHA 0x190A + +/* PixelType */ +/* GL_UNSIGNED_BYTE */ #define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 #define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 #define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC + +/* Shaders */ +#define GL_FRAGMENT_SHADER 0x8B30 +#define GL_VERTEX_SHADER 0x8B31 +#define GL_MAX_VERTEX_ATTRIBS 0x8869 +#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB +#define GL_MAX_VARYING_VECTORS 0x8DFC #define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D +#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C +#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 +#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD +#define GL_SHADER_TYPE 0x8B4F +#define GL_DELETE_STATUS 0x8B80 +#define GL_LINK_STATUS 0x8B82 +#define GL_VALIDATE_STATUS 0x8B83 +#define GL_ATTACHED_SHADERS 0x8B85 +#define GL_ACTIVE_UNIFORMS 0x8B86 +#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 +#define GL_ACTIVE_ATTRIBUTES 0x8B89 +#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A +#define GL_SHADING_LANGUAGE_VERSION 0x8B8C +#define GL_CURRENT_PROGRAM 0x8B8D + +/* StencilFunction */ #define GL_NEVER 0x0200 #define GL_LESS 0x0201 #define GL_EQUAL 0x0202 @@ -238,6 +286,9 @@ #define GL_NOTEQUAL 0x0205 #define GL_GEQUAL 0x0206 #define GL_ALWAYS 0x0207 + +/* StencilOp */ +/* GL_ZERO */ #define GL_KEEP 0x1E00 #define GL_REPLACE 0x1E01 #define GL_INCR 0x1E02 @@ -245,21 +296,35 @@ #define GL_INVERT 0x150A #define GL_INCR_WRAP 0x8507 #define GL_DECR_WRAP 0x8508 + +/* StringName */ #define GL_VENDOR 0x1F00 #define GL_RENDERER 0x1F01 #define GL_VERSION 0x1F02 #define GL_EXTENSIONS 0x1F03 + +/* TextureMagFilter */ #define GL_NEAREST 0x2600 #define GL_LINEAR 0x2601 + +/* TextureMinFilter */ +/* GL_NEAREST */ +/* GL_LINEAR */ #define GL_NEAREST_MIPMAP_NEAREST 0x2700 #define GL_LINEAR_MIPMAP_NEAREST 0x2701 #define GL_NEAREST_MIPMAP_LINEAR 0x2702 #define GL_LINEAR_MIPMAP_LINEAR 0x2703 + +/* TextureParameterName */ #define GL_TEXTURE_MAG_FILTER 0x2800 #define GL_TEXTURE_MIN_FILTER 0x2801 #define GL_TEXTURE_WRAP_S 0x2802 #define GL_TEXTURE_WRAP_T 0x2803 + +/* TextureTarget */ +/* GL_TEXTURE_2D */ #define GL_TEXTURE 0x1702 + #define GL_TEXTURE_CUBE_MAP 0x8513 #define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 #define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 @@ -269,6 +334,8 @@ #define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 #define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A #define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C + +/* TextureUnit */ #define GL_TEXTURE0 0x84C0 #define GL_TEXTURE1 0x84C1 #define GL_TEXTURE2 0x84C2 @@ -302,9 +369,13 @@ #define GL_TEXTURE30 0x84DE #define GL_TEXTURE31 0x84DF #define GL_ACTIVE_TEXTURE 0x84E0 + +/* TextureWrapMode */ #define GL_REPEAT 0x2901 #define GL_CLAMP_TO_EDGE 0x812F #define GL_MIRRORED_REPEAT 0x8370 + +/* Uniform Types */ #define GL_FLOAT_VEC2 0x8B50 #define GL_FLOAT_VEC3 0x8B51 #define GL_FLOAT_VEC4 0x8B52 @@ -320,34 +391,49 @@ #define GL_FLOAT_MAT4 0x8B5C #define GL_SAMPLER_2D 0x8B5E #define GL_SAMPLER_CUBE 0x8B60 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 + +/* Vertex Arrays */ +#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 +#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 +#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 +#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 +#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A +#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 #define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A + +/* Read Format */ +#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A #define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B + +/* Shader Source */ #define GL_COMPILE_STATUS 0x8B81 #define GL_INFO_LOG_LENGTH 0x8B84 #define GL_SHADER_SOURCE_LENGTH 0x8B88 #define GL_SHADER_COMPILER 0x8DFA + +/* Shader Binary */ #define GL_SHADER_BINARY_FORMATS 0x8DF8 #define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 + +/* Shader Precision-Specified Types */ #define GL_LOW_FLOAT 0x8DF0 #define GL_MEDIUM_FLOAT 0x8DF1 #define GL_HIGH_FLOAT 0x8DF2 #define GL_LOW_INT 0x8DF3 #define GL_MEDIUM_INT 0x8DF4 #define GL_HIGH_INT 0x8DF5 + +/* Framebuffer Object. */ #define GL_FRAMEBUFFER 0x8D40 #define GL_RENDERBUFFER 0x8D41 + #define GL_RGBA4 0x8056 #define GL_RGB5_A1 0x8057 #define GL_RGB565 0x8D62 #define GL_DEPTH_COMPONENT16 0x81A5 +#define GL_STENCIL_INDEX 0x1901 #define GL_STENCIL_INDEX8 0x8D48 + #define GL_RENDERBUFFER_WIDTH 0x8D42 #define GL_RENDERBUFFER_HEIGHT 0x8D43 #define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 @@ -357,169 +443,179 @@ #define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 #define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 #define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 + +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 +#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 +#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 #define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 + #define GL_COLOR_ATTACHMENT0 0x8CE0 #define GL_DEPTH_ATTACHMENT 0x8D00 #define GL_STENCIL_ATTACHMENT 0x8D20 + #define GL_NONE 0 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 + +#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 +#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 #define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD +#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 +#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD + #define GL_FRAMEBUFFER_BINDING 0x8CA6 #define GL_RENDERBUFFER_BINDING 0x8CA7 #define GL_MAX_RENDERBUFFER_SIZE 0x84E8 + #define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_ES_VERSION_2_0 */ + +/*------------------------------------------------------------------------- + * GL core functions. + *-----------------------------------------------------------------------*/ + +GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); +GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar* name); +GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); +GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); +GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); +GL_APICALL void GL_APIENTRY glBlendColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glBlendEquation ( GLenum mode ); +GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); +GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); +GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); +GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); +GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); +GL_APICALL void GL_APIENTRY glClearColor (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +GL_APICALL void GL_APIENTRY glClearDepthf (GLclampf depth); +GL_APICALL void GL_APIENTRY glClearStencil (GLint s); +GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); +GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); +GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); +GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); +GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); +GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); +GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); +GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint* buffers); +GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); +GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); +GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint* textures); +GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); +GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); +GL_APICALL void GL_APIENTRY glDepthRangef (GLclampf zNear, GLclampf zFar); +GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); +GL_APICALL void GL_APIENTRY glDisable (GLenum cap); +GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); +GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); +GL_APICALL void GL_APIENTRY glEnable (GLenum cap); +GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); +GL_APICALL void GL_APIENTRY glFinish (void); +GL_APICALL void GL_APIENTRY glFlush (void); +GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); +GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); +GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); +GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint* buffers); +GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); +GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint* framebuffers); +GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint* renderbuffers); +GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint* textures); +GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +GL_APICALL int GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean* params); +GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL GLenum GL_APIENTRY glGetError (void); +GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +GL_APICALL const GLubyte* GL_APIENTRY glGetString (GLenum name); +GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint* params); +GL_APICALL int GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar* name); +GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint* params); +GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, GLvoid** pointer); +GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); +GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); +GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); +GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); +GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); +GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); +GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); +GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); +GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); +GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); +GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); +GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); +GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); +GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glSampleCoverage (GLclampf value, GLboolean invert); +GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); +GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar** string, const GLint* length); +GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); +GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); +GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); +GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat* params); +GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); +GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint* params); +GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat x); +GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint x); +GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint x, GLint y); +GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint x, GLint y, GLint z); +GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat* v); +GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint x, GLint y, GLint z, GLint w); +GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint* v); +GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); +GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); +GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint indx, GLfloat x); +GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint indx, GLfloat x, GLfloat y); +GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint indx, GLfloat x, GLfloat y, GLfloat z); +GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint indx, const GLfloat* values); +GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); +GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); #ifdef __cplusplus } #endif -#endif +#endif /* __gl2_h_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES2/gl2platform.h android-platform-frameworks-native-21/opengl/include/GLES2/gl2platform.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES2/gl2platform.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES2/gl2platform.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,7 +1,7 @@ #ifndef __gl2platform_h_ #define __gl2platform_h_ -/* $Revision: 23328 $ on $Date:: 2013-10-02 02:28:28 -0700 #$ */ +/* $Revision: 10602 $ on $Date:: 2010-03-04 22:35:34 -0800 #$ */ /* * This document is licensed under the SGI Free Software B License Version diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl31.h android-platform-frameworks-native-21/opengl/include/GLES3/gl31.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl31.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES3/gl31.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1184 +0,0 @@ -#ifndef __gl31_h_ -#define __gl31_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision$ on $Date$ -*/ - -#include - -/* Generated on date 20140517 */ - -/* Generated C header for: - * API: gles2 - * Profile: common - * Versions considered: 2.[0-9]|3.[01] - * Versions emitted: .* - * Default extensions included: None - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef GL_ES_VERSION_2_0 -#define GL_ES_VERSION_2_0 1 -#include -typedef khronos_int8_t GLbyte; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; -typedef short GLshort; -typedef unsigned short GLushort; -typedef void GLvoid; -typedef struct __GLsync *GLsync; -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef unsigned int GLenum; -typedef unsigned int GLuint; -typedef char GLchar; -typedef khronos_float_t GLfloat; -typedef khronos_ssize_t GLsizeiptr; -typedef khronos_intptr_t GLintptr; -typedef unsigned int GLbitfield; -typedef int GLint; -typedef unsigned char GLboolean; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_FUNC_ADD 0x8006 -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_STREAM_DRAW 0x88E0 -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_BLEND 0x0BE2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_LINE_WIDTH 0x0B21 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VIEWPORT 0x0BA2 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_INVERT 0x150A -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_TEXTURE 0x1702 -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_COMPILE_STATUS 0x8B81 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGB565 0x8D62 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_NONE 0 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_ES_VERSION_2_0 */ - -#ifndef GL_ES_VERSION_3_0 -#define GL_ES_VERSION_3_0 1 -typedef unsigned short GLhalf; -#define GL_READ_BUFFER 0x0C02 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_RED 0x1903 -#define GL_RGB8 0x8051 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_RG8 0x822B -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_INT_2_10_10_10_REV 0x8D9F -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode); -GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids); -GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQuery (GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); -GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); -GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); -GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); -GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array); -GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); -GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GL_APICALL void GL_APIENTRY glEndTransformFeedback (void); -GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); -GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); -GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); -GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); -GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0); -GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); -GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); -GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); -GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index); -GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); -GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync); -GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync); -GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); -GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); -GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); -GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler); -GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); -GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); -GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); -GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id); -GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void); -GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void); -GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); -GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -#endif /* GL_ES_VERSION_3_0 */ - -#ifndef GL_ES_VERSION_3_1 -#define GL_ES_VERSION_3_1 1 -#define GL_COMPUTE_SHADER 0x91B9 -#define GL_MAX_COMPUTE_UNIFORM_BLOCKS 0x91BB -#define GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS 0x91BC -#define GL_MAX_COMPUTE_IMAGE_UNIFORMS 0x91BD -#define GL_MAX_COMPUTE_SHARED_MEMORY_SIZE 0x8262 -#define GL_MAX_COMPUTE_UNIFORM_COMPONENTS 0x8263 -#define GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS 0x8264 -#define GL_MAX_COMPUTE_ATOMIC_COUNTERS 0x8265 -#define GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS 0x8266 -#define GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS 0x90EB -#define GL_MAX_COMPUTE_WORK_GROUP_COUNT 0x91BE -#define GL_MAX_COMPUTE_WORK_GROUP_SIZE 0x91BF -#define GL_COMPUTE_WORK_GROUP_SIZE 0x8267 -#define GL_DISPATCH_INDIRECT_BUFFER 0x90EE -#define GL_DISPATCH_INDIRECT_BUFFER_BINDING 0x90EF -#define GL_COMPUTE_SHADER_BIT 0x00000020 -#define GL_DRAW_INDIRECT_BUFFER 0x8F3F -#define GL_DRAW_INDIRECT_BUFFER_BINDING 0x8F43 -#define GL_MAX_UNIFORM_LOCATIONS 0x826E -#define GL_FRAMEBUFFER_DEFAULT_WIDTH 0x9310 -#define GL_FRAMEBUFFER_DEFAULT_HEIGHT 0x9311 -#define GL_FRAMEBUFFER_DEFAULT_SAMPLES 0x9313 -#define GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS 0x9314 -#define GL_MAX_FRAMEBUFFER_WIDTH 0x9315 -#define GL_MAX_FRAMEBUFFER_HEIGHT 0x9316 -#define GL_MAX_FRAMEBUFFER_SAMPLES 0x9318 -#define GL_UNIFORM 0x92E1 -#define GL_UNIFORM_BLOCK 0x92E2 -#define GL_PROGRAM_INPUT 0x92E3 -#define GL_PROGRAM_OUTPUT 0x92E4 -#define GL_BUFFER_VARIABLE 0x92E5 -#define GL_SHADER_STORAGE_BLOCK 0x92E6 -#define GL_ATOMIC_COUNTER_BUFFER 0x92C0 -#define GL_TRANSFORM_FEEDBACK_VARYING 0x92F4 -#define GL_ACTIVE_RESOURCES 0x92F5 -#define GL_MAX_NAME_LENGTH 0x92F6 -#define GL_MAX_NUM_ACTIVE_VARIABLES 0x92F7 -#define GL_NAME_LENGTH 0x92F9 -#define GL_TYPE 0x92FA -#define GL_ARRAY_SIZE 0x92FB -#define GL_OFFSET 0x92FC -#define GL_BLOCK_INDEX 0x92FD -#define GL_ARRAY_STRIDE 0x92FE -#define GL_MATRIX_STRIDE 0x92FF -#define GL_IS_ROW_MAJOR 0x9300 -#define GL_ATOMIC_COUNTER_BUFFER_INDEX 0x9301 -#define GL_BUFFER_BINDING 0x9302 -#define GL_BUFFER_DATA_SIZE 0x9303 -#define GL_NUM_ACTIVE_VARIABLES 0x9304 -#define GL_ACTIVE_VARIABLES 0x9305 -#define GL_REFERENCED_BY_VERTEX_SHADER 0x9306 -#define GL_REFERENCED_BY_FRAGMENT_SHADER 0x930A -#define GL_REFERENCED_BY_COMPUTE_SHADER 0x930B -#define GL_TOP_LEVEL_ARRAY_SIZE 0x930C -#define GL_TOP_LEVEL_ARRAY_STRIDE 0x930D -#define GL_LOCATION 0x930E -#define GL_VERTEX_SHADER_BIT 0x00000001 -#define GL_FRAGMENT_SHADER_BIT 0x00000002 -#define GL_ALL_SHADER_BITS 0xFFFFFFFF -#define GL_PROGRAM_SEPARABLE 0x8258 -#define GL_ACTIVE_PROGRAM 0x8259 -#define GL_PROGRAM_PIPELINE_BINDING 0x825A -#define GL_ATOMIC_COUNTER_BUFFER_BINDING 0x92C1 -#define GL_ATOMIC_COUNTER_BUFFER_START 0x92C2 -#define GL_ATOMIC_COUNTER_BUFFER_SIZE 0x92C3 -#define GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS 0x92CC -#define GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS 0x92D0 -#define GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS 0x92D1 -#define GL_MAX_VERTEX_ATOMIC_COUNTERS 0x92D2 -#define GL_MAX_FRAGMENT_ATOMIC_COUNTERS 0x92D6 -#define GL_MAX_COMBINED_ATOMIC_COUNTERS 0x92D7 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE 0x92D8 -#define GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS 0x92DC -#define GL_ACTIVE_ATOMIC_COUNTER_BUFFERS 0x92D9 -#define GL_UNSIGNED_INT_ATOMIC_COUNTER 0x92DB -#define GL_MAX_IMAGE_UNITS 0x8F38 -#define GL_MAX_VERTEX_IMAGE_UNIFORMS 0x90CA -#define GL_MAX_FRAGMENT_IMAGE_UNIFORMS 0x90CE -#define GL_MAX_COMBINED_IMAGE_UNIFORMS 0x90CF -#define GL_IMAGE_BINDING_NAME 0x8F3A -#define GL_IMAGE_BINDING_LEVEL 0x8F3B -#define GL_IMAGE_BINDING_LAYERED 0x8F3C -#define GL_IMAGE_BINDING_LAYER 0x8F3D -#define GL_IMAGE_BINDING_ACCESS 0x8F3E -#define GL_IMAGE_BINDING_FORMAT 0x906E -#define GL_VERTEX_ATTRIB_ARRAY_BARRIER_BIT 0x00000001 -#define GL_ELEMENT_ARRAY_BARRIER_BIT 0x00000002 -#define GL_UNIFORM_BARRIER_BIT 0x00000004 -#define GL_TEXTURE_FETCH_BARRIER_BIT 0x00000008 -#define GL_SHADER_IMAGE_ACCESS_BARRIER_BIT 0x00000020 -#define GL_COMMAND_BARRIER_BIT 0x00000040 -#define GL_PIXEL_BUFFER_BARRIER_BIT 0x00000080 -#define GL_TEXTURE_UPDATE_BARRIER_BIT 0x00000100 -#define GL_BUFFER_UPDATE_BARRIER_BIT 0x00000200 -#define GL_FRAMEBUFFER_BARRIER_BIT 0x00000400 -#define GL_TRANSFORM_FEEDBACK_BARRIER_BIT 0x00000800 -#define GL_ATOMIC_COUNTER_BARRIER_BIT 0x00001000 -#define GL_ALL_BARRIER_BITS 0xFFFFFFFF -#define GL_IMAGE_2D 0x904D -#define GL_IMAGE_3D 0x904E -#define GL_IMAGE_CUBE 0x9050 -#define GL_IMAGE_2D_ARRAY 0x9053 -#define GL_INT_IMAGE_2D 0x9058 -#define GL_INT_IMAGE_3D 0x9059 -#define GL_INT_IMAGE_CUBE 0x905B -#define GL_INT_IMAGE_2D_ARRAY 0x905E -#define GL_UNSIGNED_INT_IMAGE_2D 0x9063 -#define GL_UNSIGNED_INT_IMAGE_3D 0x9064 -#define GL_UNSIGNED_INT_IMAGE_CUBE 0x9066 -#define GL_UNSIGNED_INT_IMAGE_2D_ARRAY 0x9069 -#define GL_IMAGE_FORMAT_COMPATIBILITY_TYPE 0x90C7 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE 0x90C8 -#define GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS 0x90C9 -#define GL_READ_ONLY 0x88B8 -#define GL_WRITE_ONLY 0x88B9 -#define GL_READ_WRITE 0x88BA -#define GL_SHADER_STORAGE_BUFFER 0x90D2 -#define GL_SHADER_STORAGE_BUFFER_BINDING 0x90D3 -#define GL_SHADER_STORAGE_BUFFER_START 0x90D4 -#define GL_SHADER_STORAGE_BUFFER_SIZE 0x90D5 -#define GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS 0x90D6 -#define GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS 0x90DA -#define GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS 0x90DB -#define GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS 0x90DC -#define GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS 0x90DD -#define GL_MAX_SHADER_STORAGE_BLOCK_SIZE 0x90DE -#define GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT 0x90DF -#define GL_SHADER_STORAGE_BARRIER_BIT 0x00002000 -#define GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES 0x8F39 -#define GL_DEPTH_STENCIL_TEXTURE_MODE 0x90EA -#define GL_STENCIL_INDEX 0x1901 -#define GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5E -#define GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET 0x8E5F -#define GL_SAMPLE_POSITION 0x8E50 -#define GL_SAMPLE_MASK 0x8E51 -#define GL_SAMPLE_MASK_VALUE 0x8E52 -#define GL_TEXTURE_2D_MULTISAMPLE 0x9100 -#define GL_MAX_SAMPLE_MASK_WORDS 0x8E59 -#define GL_MAX_COLOR_TEXTURE_SAMPLES 0x910E -#define GL_MAX_DEPTH_TEXTURE_SAMPLES 0x910F -#define GL_MAX_INTEGER_SAMPLES 0x9110 -#define GL_TEXTURE_BINDING_2D_MULTISAMPLE 0x9104 -#define GL_TEXTURE_SAMPLES 0x9106 -#define GL_TEXTURE_FIXED_SAMPLE_LOCATIONS 0x9107 -#define GL_TEXTURE_WIDTH 0x1000 -#define GL_TEXTURE_HEIGHT 0x1001 -#define GL_TEXTURE_DEPTH 0x8071 -#define GL_TEXTURE_INTERNAL_FORMAT 0x1003 -#define GL_TEXTURE_RED_SIZE 0x805C -#define GL_TEXTURE_GREEN_SIZE 0x805D -#define GL_TEXTURE_BLUE_SIZE 0x805E -#define GL_TEXTURE_ALPHA_SIZE 0x805F -#define GL_TEXTURE_DEPTH_SIZE 0x884A -#define GL_TEXTURE_STENCIL_SIZE 0x88F1 -#define GL_TEXTURE_SHARED_SIZE 0x8C3F -#define GL_TEXTURE_RED_TYPE 0x8C10 -#define GL_TEXTURE_GREEN_TYPE 0x8C11 -#define GL_TEXTURE_BLUE_TYPE 0x8C12 -#define GL_TEXTURE_ALPHA_TYPE 0x8C13 -#define GL_TEXTURE_DEPTH_TYPE 0x8C16 -#define GL_TEXTURE_COMPRESSED 0x86A1 -#define GL_SAMPLER_2D_MULTISAMPLE 0x9108 -#define GL_INT_SAMPLER_2D_MULTISAMPLE 0x9109 -#define GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE 0x910A -#define GL_VERTEX_ATTRIB_BINDING 0x82D4 -#define GL_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D5 -#define GL_VERTEX_BINDING_DIVISOR 0x82D6 -#define GL_VERTEX_BINDING_OFFSET 0x82D7 -#define GL_VERTEX_BINDING_STRIDE 0x82D8 -#define GL_VERTEX_BINDING_BUFFER 0x8F4F -#define GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET 0x82D9 -#define GL_MAX_VERTEX_ATTRIB_BINDINGS 0x82DA -#define GL_MAX_VERTEX_ATTRIB_STRIDE 0x82E5 -GL_APICALL void GL_APIENTRY glDispatchCompute (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -GL_APICALL void GL_APIENTRY glDispatchComputeIndirect (GLintptr indirect); -GL_APICALL void GL_APIENTRY glDrawArraysIndirect (GLenum mode, const void *indirect); -GL_APICALL void GL_APIENTRY glDrawElementsIndirect (GLenum mode, GLenum type, const void *indirect); -GL_APICALL void GL_APIENTRY glFramebufferParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glGetFramebufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetProgramInterfaceiv (GLuint program, GLenum programInterface, GLenum pname, GLint *params); -GL_APICALL GLuint GL_APIENTRY glGetProgramResourceIndex (GLuint program, GLenum programInterface, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetProgramResourceName (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name); -GL_APICALL void GL_APIENTRY glGetProgramResourceiv (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params); -GL_APICALL GLint GL_APIENTRY glGetProgramResourceLocation (GLuint program, GLenum programInterface, const GLchar *name); -GL_APICALL void GL_APIENTRY glUseProgramStages (GLuint pipeline, GLbitfield stages, GLuint program); -GL_APICALL void GL_APIENTRY glActiveShaderProgram (GLuint pipeline, GLuint program); -GL_APICALL GLuint GL_APIENTRY glCreateShaderProgramv (GLenum type, GLsizei count, const GLchar *const*strings); -GL_APICALL void GL_APIENTRY glBindProgramPipeline (GLuint pipeline); -GL_APICALL void GL_APIENTRY glDeleteProgramPipelines (GLsizei n, const GLuint *pipelines); -GL_APICALL void GL_APIENTRY glGenProgramPipelines (GLsizei n, GLuint *pipelines); -GL_APICALL GLboolean GL_APIENTRY glIsProgramPipeline (GLuint pipeline); -GL_APICALL void GL_APIENTRY glGetProgramPipelineiv (GLuint pipeline, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glProgramUniform1i (GLuint program, GLint location, GLint v0); -GL_APICALL void GL_APIENTRY glProgramUniform2i (GLuint program, GLint location, GLint v0, GLint v1); -GL_APICALL void GL_APIENTRY glProgramUniform3i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -GL_APICALL void GL_APIENTRY glProgramUniform4i (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GL_APICALL void GL_APIENTRY glProgramUniform1ui (GLuint program, GLint location, GLuint v0); -GL_APICALL void GL_APIENTRY glProgramUniform2ui (GLuint program, GLint location, GLuint v0, GLuint v1); -GL_APICALL void GL_APIENTRY glProgramUniform3ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -GL_APICALL void GL_APIENTRY glProgramUniform4ui (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GL_APICALL void GL_APIENTRY glProgramUniform1f (GLuint program, GLint location, GLfloat v0); -GL_APICALL void GL_APIENTRY glProgramUniform2f (GLuint program, GLint location, GLfloat v0, GLfloat v1); -GL_APICALL void GL_APIENTRY glProgramUniform3f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GL_APICALL void GL_APIENTRY glProgramUniform4f (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GL_APICALL void GL_APIENTRY glProgramUniform1iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4iv (GLuint program, GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glProgramUniform1uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform2uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform3uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform4uiv (GLuint program, GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glProgramUniform1fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform2fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform3fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniform4fv (GLuint program, GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix2x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x2fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix3x4fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glProgramUniformMatrix4x3fv (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glValidateProgramPipeline (GLuint pipeline); -GL_APICALL void GL_APIENTRY glGetProgramPipelineInfoLog (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glBindImageTexture (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -GL_APICALL void GL_APIENTRY glGetBooleani_v (GLenum target, GLuint index, GLboolean *data); -GL_APICALL void GL_APIENTRY glMemoryBarrier (GLbitfield barriers); -GL_APICALL void GL_APIENTRY glMemoryBarrierByRegion (GLbitfield barriers); -GL_APICALL void GL_APIENTRY glTexStorage2DMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -GL_APICALL void GL_APIENTRY glGetMultisamplefv (GLenum pname, GLuint index, GLfloat *val); -GL_APICALL void GL_APIENTRY glSampleMaski (GLuint maskNumber, GLbitfield mask); -GL_APICALL void GL_APIENTRY glGetTexLevelParameteriv (GLenum target, GLint level, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetTexLevelParameterfv (GLenum target, GLint level, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glBindVertexBuffer (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -GL_APICALL void GL_APIENTRY glVertexAttribFormat (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -GL_APICALL void GL_APIENTRY glVertexAttribIFormat (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -GL_APICALL void GL_APIENTRY glVertexAttribBinding (GLuint attribindex, GLuint bindingindex); -GL_APICALL void GL_APIENTRY glVertexBindingDivisor (GLuint bindingindex, GLuint divisor); -#endif /* GL_ES_VERSION_3_1 */ - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl3ext.h android-platform-frameworks-native-21/opengl/include/GLES3/gl3ext.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl3ext.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES3/gl3ext.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -#ifndef __gl3ext_h_ -#define __gl3ext_h_ - -/* $Revision: 17809 $ on $Date:: 2012-05-14 08:03:36 -0700 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* OpenGL ES 3 Extensions - * - * After an OES extension's interactions with OpenGl ES 3.0 have been documented, - * its tokens and function definitions should be added to this file in a manner - * that does not conflict with gl2ext.h or gl3.h. - * - * Tokens and function definitions for extensions that have become standard - * features in OpenGL ES 3.0 will not be added to this file. - * - * Applications using OpenGL-ES-2-only extensions should include gl2ext.h - */ - -#endif /* __gl3ext_h_ */ - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl3.h android-platform-frameworks-native-21/opengl/include/GLES3/gl3.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl3.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES3/gl3.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,939 +0,0 @@ -#ifndef __gl3_h_ -#define __gl3_h_ 1 - -#ifdef __cplusplus -extern "C" { -#endif - -/* -** Copyright (c) 2013-2014 The Khronos Group Inc. -** -** Permission is hereby granted, free of charge, to any person obtaining a -** copy of this software and/or associated documentation files (the -** "Materials"), to deal in the Materials without restriction, including -** without limitation the rights to use, copy, modify, merge, publish, -** distribute, sublicense, and/or sell copies of the Materials, and to -** permit persons to whom the Materials are furnished to do so, subject to -** the following conditions: -** -** The above copyright notice and this permission notice shall be included -** in all copies or substantial portions of the Materials. -** -** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. -*/ -/* -** This header is generated from the Khronos OpenGL / OpenGL ES XML -** API Registry. The current version of the Registry, generator scripts -** used to make the header, and the header can be found at -** http://www.opengl.org/registry/ -** -** Khronos $Revision: 26696 $ on $Date: 2014-05-17 14:48:55 -0700 (Sat, 17 May 2014) $ -*/ - -#include - -/* Generated on date 20140517 */ - -/* Generated C header for: - * API: gles2 - * Profile: common - * Versions considered: 2\.[0-9]|3.0 - * Versions emitted: .* - * Default extensions included: None - * Additional extensions included: _nomatch_^ - * Extensions removed: _nomatch_^ - */ - -#ifndef GL_ES_VERSION_2_0 -#define GL_ES_VERSION_2_0 1 -#include -typedef khronos_int8_t GLbyte; -typedef khronos_float_t GLclampf; -typedef khronos_int32_t GLfixed; -typedef short GLshort; -typedef unsigned short GLushort; -typedef void GLvoid; -typedef struct __GLsync *GLsync; -typedef khronos_int64_t GLint64; -typedef khronos_uint64_t GLuint64; -typedef unsigned int GLenum; -typedef unsigned int GLuint; -typedef char GLchar; -typedef khronos_float_t GLfloat; -typedef khronos_ssize_t GLsizeiptr; -typedef khronos_intptr_t GLintptr; -typedef unsigned int GLbitfield; -typedef int GLint; -typedef unsigned char GLboolean; -typedef int GLsizei; -typedef khronos_uint8_t GLubyte; -#define GL_DEPTH_BUFFER_BIT 0x00000100 -#define GL_STENCIL_BUFFER_BIT 0x00000400 -#define GL_COLOR_BUFFER_BIT 0x00004000 -#define GL_FALSE 0 -#define GL_TRUE 1 -#define GL_POINTS 0x0000 -#define GL_LINES 0x0001 -#define GL_LINE_LOOP 0x0002 -#define GL_LINE_STRIP 0x0003 -#define GL_TRIANGLES 0x0004 -#define GL_TRIANGLE_STRIP 0x0005 -#define GL_TRIANGLE_FAN 0x0006 -#define GL_ZERO 0 -#define GL_ONE 1 -#define GL_SRC_COLOR 0x0300 -#define GL_ONE_MINUS_SRC_COLOR 0x0301 -#define GL_SRC_ALPHA 0x0302 -#define GL_ONE_MINUS_SRC_ALPHA 0x0303 -#define GL_DST_ALPHA 0x0304 -#define GL_ONE_MINUS_DST_ALPHA 0x0305 -#define GL_DST_COLOR 0x0306 -#define GL_ONE_MINUS_DST_COLOR 0x0307 -#define GL_SRC_ALPHA_SATURATE 0x0308 -#define GL_FUNC_ADD 0x8006 -#define GL_BLEND_EQUATION 0x8009 -#define GL_BLEND_EQUATION_RGB 0x8009 -#define GL_BLEND_EQUATION_ALPHA 0x883D -#define GL_FUNC_SUBTRACT 0x800A -#define GL_FUNC_REVERSE_SUBTRACT 0x800B -#define GL_BLEND_DST_RGB 0x80C8 -#define GL_BLEND_SRC_RGB 0x80C9 -#define GL_BLEND_DST_ALPHA 0x80CA -#define GL_BLEND_SRC_ALPHA 0x80CB -#define GL_CONSTANT_COLOR 0x8001 -#define GL_ONE_MINUS_CONSTANT_COLOR 0x8002 -#define GL_CONSTANT_ALPHA 0x8003 -#define GL_ONE_MINUS_CONSTANT_ALPHA 0x8004 -#define GL_BLEND_COLOR 0x8005 -#define GL_ARRAY_BUFFER 0x8892 -#define GL_ELEMENT_ARRAY_BUFFER 0x8893 -#define GL_ARRAY_BUFFER_BINDING 0x8894 -#define GL_ELEMENT_ARRAY_BUFFER_BINDING 0x8895 -#define GL_STREAM_DRAW 0x88E0 -#define GL_STATIC_DRAW 0x88E4 -#define GL_DYNAMIC_DRAW 0x88E8 -#define GL_BUFFER_SIZE 0x8764 -#define GL_BUFFER_USAGE 0x8765 -#define GL_CURRENT_VERTEX_ATTRIB 0x8626 -#define GL_FRONT 0x0404 -#define GL_BACK 0x0405 -#define GL_FRONT_AND_BACK 0x0408 -#define GL_TEXTURE_2D 0x0DE1 -#define GL_CULL_FACE 0x0B44 -#define GL_BLEND 0x0BE2 -#define GL_DITHER 0x0BD0 -#define GL_STENCIL_TEST 0x0B90 -#define GL_DEPTH_TEST 0x0B71 -#define GL_SCISSOR_TEST 0x0C11 -#define GL_POLYGON_OFFSET_FILL 0x8037 -#define GL_SAMPLE_ALPHA_TO_COVERAGE 0x809E -#define GL_SAMPLE_COVERAGE 0x80A0 -#define GL_NO_ERROR 0 -#define GL_INVALID_ENUM 0x0500 -#define GL_INVALID_VALUE 0x0501 -#define GL_INVALID_OPERATION 0x0502 -#define GL_OUT_OF_MEMORY 0x0505 -#define GL_CW 0x0900 -#define GL_CCW 0x0901 -#define GL_LINE_WIDTH 0x0B21 -#define GL_ALIASED_POINT_SIZE_RANGE 0x846D -#define GL_ALIASED_LINE_WIDTH_RANGE 0x846E -#define GL_CULL_FACE_MODE 0x0B45 -#define GL_FRONT_FACE 0x0B46 -#define GL_DEPTH_RANGE 0x0B70 -#define GL_DEPTH_WRITEMASK 0x0B72 -#define GL_DEPTH_CLEAR_VALUE 0x0B73 -#define GL_DEPTH_FUNC 0x0B74 -#define GL_STENCIL_CLEAR_VALUE 0x0B91 -#define GL_STENCIL_FUNC 0x0B92 -#define GL_STENCIL_FAIL 0x0B94 -#define GL_STENCIL_PASS_DEPTH_FAIL 0x0B95 -#define GL_STENCIL_PASS_DEPTH_PASS 0x0B96 -#define GL_STENCIL_REF 0x0B97 -#define GL_STENCIL_VALUE_MASK 0x0B93 -#define GL_STENCIL_WRITEMASK 0x0B98 -#define GL_STENCIL_BACK_FUNC 0x8800 -#define GL_STENCIL_BACK_FAIL 0x8801 -#define GL_STENCIL_BACK_PASS_DEPTH_FAIL 0x8802 -#define GL_STENCIL_BACK_PASS_DEPTH_PASS 0x8803 -#define GL_STENCIL_BACK_REF 0x8CA3 -#define GL_STENCIL_BACK_VALUE_MASK 0x8CA4 -#define GL_STENCIL_BACK_WRITEMASK 0x8CA5 -#define GL_VIEWPORT 0x0BA2 -#define GL_SCISSOR_BOX 0x0C10 -#define GL_COLOR_CLEAR_VALUE 0x0C22 -#define GL_COLOR_WRITEMASK 0x0C23 -#define GL_UNPACK_ALIGNMENT 0x0CF5 -#define GL_PACK_ALIGNMENT 0x0D05 -#define GL_MAX_TEXTURE_SIZE 0x0D33 -#define GL_MAX_VIEWPORT_DIMS 0x0D3A -#define GL_SUBPIXEL_BITS 0x0D50 -#define GL_RED_BITS 0x0D52 -#define GL_GREEN_BITS 0x0D53 -#define GL_BLUE_BITS 0x0D54 -#define GL_ALPHA_BITS 0x0D55 -#define GL_DEPTH_BITS 0x0D56 -#define GL_STENCIL_BITS 0x0D57 -#define GL_POLYGON_OFFSET_UNITS 0x2A00 -#define GL_POLYGON_OFFSET_FACTOR 0x8038 -#define GL_TEXTURE_BINDING_2D 0x8069 -#define GL_SAMPLE_BUFFERS 0x80A8 -#define GL_SAMPLES 0x80A9 -#define GL_SAMPLE_COVERAGE_VALUE 0x80AA -#define GL_SAMPLE_COVERAGE_INVERT 0x80AB -#define GL_NUM_COMPRESSED_TEXTURE_FORMATS 0x86A2 -#define GL_COMPRESSED_TEXTURE_FORMATS 0x86A3 -#define GL_DONT_CARE 0x1100 -#define GL_FASTEST 0x1101 -#define GL_NICEST 0x1102 -#define GL_GENERATE_MIPMAP_HINT 0x8192 -#define GL_BYTE 0x1400 -#define GL_UNSIGNED_BYTE 0x1401 -#define GL_SHORT 0x1402 -#define GL_UNSIGNED_SHORT 0x1403 -#define GL_INT 0x1404 -#define GL_UNSIGNED_INT 0x1405 -#define GL_FLOAT 0x1406 -#define GL_FIXED 0x140C -#define GL_DEPTH_COMPONENT 0x1902 -#define GL_ALPHA 0x1906 -#define GL_RGB 0x1907 -#define GL_RGBA 0x1908 -#define GL_LUMINANCE 0x1909 -#define GL_LUMINANCE_ALPHA 0x190A -#define GL_UNSIGNED_SHORT_4_4_4_4 0x8033 -#define GL_UNSIGNED_SHORT_5_5_5_1 0x8034 -#define GL_UNSIGNED_SHORT_5_6_5 0x8363 -#define GL_FRAGMENT_SHADER 0x8B30 -#define GL_VERTEX_SHADER 0x8B31 -#define GL_MAX_VERTEX_ATTRIBS 0x8869 -#define GL_MAX_VERTEX_UNIFORM_VECTORS 0x8DFB -#define GL_MAX_VARYING_VECTORS 0x8DFC -#define GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS 0x8B4D -#define GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS 0x8B4C -#define GL_MAX_TEXTURE_IMAGE_UNITS 0x8872 -#define GL_MAX_FRAGMENT_UNIFORM_VECTORS 0x8DFD -#define GL_SHADER_TYPE 0x8B4F -#define GL_DELETE_STATUS 0x8B80 -#define GL_LINK_STATUS 0x8B82 -#define GL_VALIDATE_STATUS 0x8B83 -#define GL_ATTACHED_SHADERS 0x8B85 -#define GL_ACTIVE_UNIFORMS 0x8B86 -#define GL_ACTIVE_UNIFORM_MAX_LENGTH 0x8B87 -#define GL_ACTIVE_ATTRIBUTES 0x8B89 -#define GL_ACTIVE_ATTRIBUTE_MAX_LENGTH 0x8B8A -#define GL_SHADING_LANGUAGE_VERSION 0x8B8C -#define GL_CURRENT_PROGRAM 0x8B8D -#define GL_NEVER 0x0200 -#define GL_LESS 0x0201 -#define GL_EQUAL 0x0202 -#define GL_LEQUAL 0x0203 -#define GL_GREATER 0x0204 -#define GL_NOTEQUAL 0x0205 -#define GL_GEQUAL 0x0206 -#define GL_ALWAYS 0x0207 -#define GL_KEEP 0x1E00 -#define GL_REPLACE 0x1E01 -#define GL_INCR 0x1E02 -#define GL_DECR 0x1E03 -#define GL_INVERT 0x150A -#define GL_INCR_WRAP 0x8507 -#define GL_DECR_WRAP 0x8508 -#define GL_VENDOR 0x1F00 -#define GL_RENDERER 0x1F01 -#define GL_VERSION 0x1F02 -#define GL_EXTENSIONS 0x1F03 -#define GL_NEAREST 0x2600 -#define GL_LINEAR 0x2601 -#define GL_NEAREST_MIPMAP_NEAREST 0x2700 -#define GL_LINEAR_MIPMAP_NEAREST 0x2701 -#define GL_NEAREST_MIPMAP_LINEAR 0x2702 -#define GL_LINEAR_MIPMAP_LINEAR 0x2703 -#define GL_TEXTURE_MAG_FILTER 0x2800 -#define GL_TEXTURE_MIN_FILTER 0x2801 -#define GL_TEXTURE_WRAP_S 0x2802 -#define GL_TEXTURE_WRAP_T 0x2803 -#define GL_TEXTURE 0x1702 -#define GL_TEXTURE_CUBE_MAP 0x8513 -#define GL_TEXTURE_BINDING_CUBE_MAP 0x8514 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_X 0x8515 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_X 0x8516 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Y 0x8517 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Y 0x8518 -#define GL_TEXTURE_CUBE_MAP_POSITIVE_Z 0x8519 -#define GL_TEXTURE_CUBE_MAP_NEGATIVE_Z 0x851A -#define GL_MAX_CUBE_MAP_TEXTURE_SIZE 0x851C -#define GL_TEXTURE0 0x84C0 -#define GL_TEXTURE1 0x84C1 -#define GL_TEXTURE2 0x84C2 -#define GL_TEXTURE3 0x84C3 -#define GL_TEXTURE4 0x84C4 -#define GL_TEXTURE5 0x84C5 -#define GL_TEXTURE6 0x84C6 -#define GL_TEXTURE7 0x84C7 -#define GL_TEXTURE8 0x84C8 -#define GL_TEXTURE9 0x84C9 -#define GL_TEXTURE10 0x84CA -#define GL_TEXTURE11 0x84CB -#define GL_TEXTURE12 0x84CC -#define GL_TEXTURE13 0x84CD -#define GL_TEXTURE14 0x84CE -#define GL_TEXTURE15 0x84CF -#define GL_TEXTURE16 0x84D0 -#define GL_TEXTURE17 0x84D1 -#define GL_TEXTURE18 0x84D2 -#define GL_TEXTURE19 0x84D3 -#define GL_TEXTURE20 0x84D4 -#define GL_TEXTURE21 0x84D5 -#define GL_TEXTURE22 0x84D6 -#define GL_TEXTURE23 0x84D7 -#define GL_TEXTURE24 0x84D8 -#define GL_TEXTURE25 0x84D9 -#define GL_TEXTURE26 0x84DA -#define GL_TEXTURE27 0x84DB -#define GL_TEXTURE28 0x84DC -#define GL_TEXTURE29 0x84DD -#define GL_TEXTURE30 0x84DE -#define GL_TEXTURE31 0x84DF -#define GL_ACTIVE_TEXTURE 0x84E0 -#define GL_REPEAT 0x2901 -#define GL_CLAMP_TO_EDGE 0x812F -#define GL_MIRRORED_REPEAT 0x8370 -#define GL_FLOAT_VEC2 0x8B50 -#define GL_FLOAT_VEC3 0x8B51 -#define GL_FLOAT_VEC4 0x8B52 -#define GL_INT_VEC2 0x8B53 -#define GL_INT_VEC3 0x8B54 -#define GL_INT_VEC4 0x8B55 -#define GL_BOOL 0x8B56 -#define GL_BOOL_VEC2 0x8B57 -#define GL_BOOL_VEC3 0x8B58 -#define GL_BOOL_VEC4 0x8B59 -#define GL_FLOAT_MAT2 0x8B5A -#define GL_FLOAT_MAT3 0x8B5B -#define GL_FLOAT_MAT4 0x8B5C -#define GL_SAMPLER_2D 0x8B5E -#define GL_SAMPLER_CUBE 0x8B60 -#define GL_VERTEX_ATTRIB_ARRAY_ENABLED 0x8622 -#define GL_VERTEX_ATTRIB_ARRAY_SIZE 0x8623 -#define GL_VERTEX_ATTRIB_ARRAY_STRIDE 0x8624 -#define GL_VERTEX_ATTRIB_ARRAY_TYPE 0x8625 -#define GL_VERTEX_ATTRIB_ARRAY_NORMALIZED 0x886A -#define GL_VERTEX_ATTRIB_ARRAY_POINTER 0x8645 -#define GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING 0x889F -#define GL_IMPLEMENTATION_COLOR_READ_TYPE 0x8B9A -#define GL_IMPLEMENTATION_COLOR_READ_FORMAT 0x8B9B -#define GL_COMPILE_STATUS 0x8B81 -#define GL_INFO_LOG_LENGTH 0x8B84 -#define GL_SHADER_SOURCE_LENGTH 0x8B88 -#define GL_SHADER_COMPILER 0x8DFA -#define GL_SHADER_BINARY_FORMATS 0x8DF8 -#define GL_NUM_SHADER_BINARY_FORMATS 0x8DF9 -#define GL_LOW_FLOAT 0x8DF0 -#define GL_MEDIUM_FLOAT 0x8DF1 -#define GL_HIGH_FLOAT 0x8DF2 -#define GL_LOW_INT 0x8DF3 -#define GL_MEDIUM_INT 0x8DF4 -#define GL_HIGH_INT 0x8DF5 -#define GL_FRAMEBUFFER 0x8D40 -#define GL_RENDERBUFFER 0x8D41 -#define GL_RGBA4 0x8056 -#define GL_RGB5_A1 0x8057 -#define GL_RGB565 0x8D62 -#define GL_DEPTH_COMPONENT16 0x81A5 -#define GL_STENCIL_INDEX8 0x8D48 -#define GL_RENDERBUFFER_WIDTH 0x8D42 -#define GL_RENDERBUFFER_HEIGHT 0x8D43 -#define GL_RENDERBUFFER_INTERNAL_FORMAT 0x8D44 -#define GL_RENDERBUFFER_RED_SIZE 0x8D50 -#define GL_RENDERBUFFER_GREEN_SIZE 0x8D51 -#define GL_RENDERBUFFER_BLUE_SIZE 0x8D52 -#define GL_RENDERBUFFER_ALPHA_SIZE 0x8D53 -#define GL_RENDERBUFFER_DEPTH_SIZE 0x8D54 -#define GL_RENDERBUFFER_STENCIL_SIZE 0x8D55 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE 0x8CD0 -#define GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME 0x8CD1 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL 0x8CD2 -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE 0x8CD3 -#define GL_COLOR_ATTACHMENT0 0x8CE0 -#define GL_DEPTH_ATTACHMENT 0x8D00 -#define GL_STENCIL_ATTACHMENT 0x8D20 -#define GL_NONE 0 -#define GL_FRAMEBUFFER_COMPLETE 0x8CD5 -#define GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT 0x8CD6 -#define GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT 0x8CD7 -#define GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS 0x8CD9 -#define GL_FRAMEBUFFER_UNSUPPORTED 0x8CDD -#define GL_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_RENDERBUFFER_BINDING 0x8CA7 -#define GL_MAX_RENDERBUFFER_SIZE 0x84E8 -#define GL_INVALID_FRAMEBUFFER_OPERATION 0x0506 -GL_APICALL void GL_APIENTRY glActiveTexture (GLenum texture); -GL_APICALL void GL_APIENTRY glAttachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glBindAttribLocation (GLuint program, GLuint index, const GLchar *name); -GL_APICALL void GL_APIENTRY glBindBuffer (GLenum target, GLuint buffer); -GL_APICALL void GL_APIENTRY glBindFramebuffer (GLenum target, GLuint framebuffer); -GL_APICALL void GL_APIENTRY glBindRenderbuffer (GLenum target, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glBindTexture (GLenum target, GLuint texture); -GL_APICALL void GL_APIENTRY glBlendColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glBlendEquation (GLenum mode); -GL_APICALL void GL_APIENTRY glBlendEquationSeparate (GLenum modeRGB, GLenum modeAlpha); -GL_APICALL void GL_APIENTRY glBlendFunc (GLenum sfactor, GLenum dfactor); -GL_APICALL void GL_APIENTRY glBlendFuncSeparate (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -GL_APICALL void GL_APIENTRY glBufferData (GLenum target, GLsizeiptr size, const void *data, GLenum usage); -GL_APICALL void GL_APIENTRY glBufferSubData (GLenum target, GLintptr offset, GLsizeiptr size, const void *data); -GL_APICALL GLenum GL_APIENTRY glCheckFramebufferStatus (GLenum target); -GL_APICALL void GL_APIENTRY glClear (GLbitfield mask); -GL_APICALL void GL_APIENTRY glClearColor (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -GL_APICALL void GL_APIENTRY glClearDepthf (GLfloat d); -GL_APICALL void GL_APIENTRY glClearStencil (GLint s); -GL_APICALL void GL_APIENTRY glColorMask (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); -GL_APICALL void GL_APIENTRY glCompileShader (GLuint shader); -GL_APICALL void GL_APIENTRY glCompressedTexImage2D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCopyTexImage2D (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); -GL_APICALL void GL_APIENTRY glCopyTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL GLuint GL_APIENTRY glCreateProgram (void); -GL_APICALL GLuint GL_APIENTRY glCreateShader (GLenum type); -GL_APICALL void GL_APIENTRY glCullFace (GLenum mode); -GL_APICALL void GL_APIENTRY glDeleteBuffers (GLsizei n, const GLuint *buffers); -GL_APICALL void GL_APIENTRY glDeleteFramebuffers (GLsizei n, const GLuint *framebuffers); -GL_APICALL void GL_APIENTRY glDeleteProgram (GLuint program); -GL_APICALL void GL_APIENTRY glDeleteRenderbuffers (GLsizei n, const GLuint *renderbuffers); -GL_APICALL void GL_APIENTRY glDeleteShader (GLuint shader); -GL_APICALL void GL_APIENTRY glDeleteTextures (GLsizei n, const GLuint *textures); -GL_APICALL void GL_APIENTRY glDepthFunc (GLenum func); -GL_APICALL void GL_APIENTRY glDepthMask (GLboolean flag); -GL_APICALL void GL_APIENTRY glDepthRangef (GLfloat n, GLfloat f); -GL_APICALL void GL_APIENTRY glDetachShader (GLuint program, GLuint shader); -GL_APICALL void GL_APIENTRY glDisable (GLenum cap); -GL_APICALL void GL_APIENTRY glDisableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glDrawArrays (GLenum mode, GLint first, GLsizei count); -GL_APICALL void GL_APIENTRY glDrawElements (GLenum mode, GLsizei count, GLenum type, const void *indices); -GL_APICALL void GL_APIENTRY glEnable (GLenum cap); -GL_APICALL void GL_APIENTRY glEnableVertexAttribArray (GLuint index); -GL_APICALL void GL_APIENTRY glFinish (void); -GL_APICALL void GL_APIENTRY glFlush (void); -GL_APICALL void GL_APIENTRY glFramebufferRenderbuffer (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); -GL_APICALL void GL_APIENTRY glFramebufferTexture2D (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -GL_APICALL void GL_APIENTRY glFrontFace (GLenum mode); -GL_APICALL void GL_APIENTRY glGenBuffers (GLsizei n, GLuint *buffers); -GL_APICALL void GL_APIENTRY glGenerateMipmap (GLenum target); -GL_APICALL void GL_APIENTRY glGenFramebuffers (GLsizei n, GLuint *framebuffers); -GL_APICALL void GL_APIENTRY glGenRenderbuffers (GLsizei n, GLuint *renderbuffers); -GL_APICALL void GL_APIENTRY glGenTextures (GLsizei n, GLuint *textures); -GL_APICALL void GL_APIENTRY glGetActiveAttrib (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glGetActiveUniform (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glGetAttachedShaders (GLuint program, GLsizei maxCount, GLsizei *count, GLuint *shaders); -GL_APICALL GLint GL_APIENTRY glGetAttribLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetBooleanv (GLenum pname, GLboolean *data); -GL_APICALL void GL_APIENTRY glGetBufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL GLenum GL_APIENTRY glGetError (void); -GL_APICALL void GL_APIENTRY glGetFloatv (GLenum pname, GLfloat *data); -GL_APICALL void GL_APIENTRY glGetFramebufferAttachmentParameteriv (GLenum target, GLenum attachment, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetIntegerv (GLenum pname, GLint *data); -GL_APICALL void GL_APIENTRY glGetProgramiv (GLuint program, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetProgramInfoLog (GLuint program, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetRenderbufferParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetShaderiv (GLuint shader, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetShaderInfoLog (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *infoLog); -GL_APICALL void GL_APIENTRY glGetShaderPrecisionFormat (GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision); -GL_APICALL void GL_APIENTRY glGetShaderSource (GLuint shader, GLsizei bufSize, GLsizei *length, GLchar *source); -GL_APICALL const GLubyte *GL_APIENTRY glGetString (GLenum name); -GL_APICALL void GL_APIENTRY glGetTexParameterfv (GLenum target, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetTexParameteriv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetUniformfv (GLuint program, GLint location, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetUniformiv (GLuint program, GLint location, GLint *params); -GL_APICALL GLint GL_APIENTRY glGetUniformLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glGetVertexAttribfv (GLuint index, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribiv (GLuint index, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribPointerv (GLuint index, GLenum pname, void **pointer); -GL_APICALL void GL_APIENTRY glHint (GLenum target, GLenum mode); -GL_APICALL GLboolean GL_APIENTRY glIsBuffer (GLuint buffer); -GL_APICALL GLboolean GL_APIENTRY glIsEnabled (GLenum cap); -GL_APICALL GLboolean GL_APIENTRY glIsFramebuffer (GLuint framebuffer); -GL_APICALL GLboolean GL_APIENTRY glIsProgram (GLuint program); -GL_APICALL GLboolean GL_APIENTRY glIsRenderbuffer (GLuint renderbuffer); -GL_APICALL GLboolean GL_APIENTRY glIsShader (GLuint shader); -GL_APICALL GLboolean GL_APIENTRY glIsTexture (GLuint texture); -GL_APICALL void GL_APIENTRY glLineWidth (GLfloat width); -GL_APICALL void GL_APIENTRY glLinkProgram (GLuint program); -GL_APICALL void GL_APIENTRY glPixelStorei (GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glPolygonOffset (GLfloat factor, GLfloat units); -GL_APICALL void GL_APIENTRY glReadPixels (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void *pixels); -GL_APICALL void GL_APIENTRY glReleaseShaderCompiler (void); -GL_APICALL void GL_APIENTRY glRenderbufferStorage (GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glSampleCoverage (GLfloat value, GLboolean invert); -GL_APICALL void GL_APIENTRY glScissor (GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glShaderBinary (GLsizei count, const GLuint *shaders, GLenum binaryformat, const void *binary, GLsizei length); -GL_APICALL void GL_APIENTRY glShaderSource (GLuint shader, GLsizei count, const GLchar *const*string, const GLint *length); -GL_APICALL void GL_APIENTRY glStencilFunc (GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilFuncSeparate (GLenum face, GLenum func, GLint ref, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMask (GLuint mask); -GL_APICALL void GL_APIENTRY glStencilMaskSeparate (GLenum face, GLuint mask); -GL_APICALL void GL_APIENTRY glStencilOp (GLenum fail, GLenum zfail, GLenum zpass); -GL_APICALL void GL_APIENTRY glStencilOpSeparate (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -GL_APICALL void GL_APIENTRY glTexImage2D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glTexParameterf (GLenum target, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glTexParameterfv (GLenum target, GLenum pname, const GLfloat *params); -GL_APICALL void GL_APIENTRY glTexParameteri (GLenum target, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glTexParameteriv (GLenum target, GLenum pname, const GLint *params); -GL_APICALL void GL_APIENTRY glTexSubImage2D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glUniform1f (GLint location, GLfloat v0); -GL_APICALL void GL_APIENTRY glUniform1fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform1i (GLint location, GLint v0); -GL_APICALL void GL_APIENTRY glUniform1iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform2f (GLint location, GLfloat v0, GLfloat v1); -GL_APICALL void GL_APIENTRY glUniform2fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform2i (GLint location, GLint v0, GLint v1); -GL_APICALL void GL_APIENTRY glUniform2iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform3f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -GL_APICALL void GL_APIENTRY glUniform3fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform3i (GLint location, GLint v0, GLint v1, GLint v2); -GL_APICALL void GL_APIENTRY glUniform3iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniform4f (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -GL_APICALL void GL_APIENTRY glUniform4fv (GLint location, GLsizei count, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniform4i (GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -GL_APICALL void GL_APIENTRY glUniform4iv (GLint location, GLsizei count, const GLint *value); -GL_APICALL void GL_APIENTRY glUniformMatrix2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUseProgram (GLuint program); -GL_APICALL void GL_APIENTRY glValidateProgram (GLuint program); -GL_APICALL void GL_APIENTRY glVertexAttrib1f (GLuint index, GLfloat x); -GL_APICALL void GL_APIENTRY glVertexAttrib1fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib2f (GLuint index, GLfloat x, GLfloat y); -GL_APICALL void GL_APIENTRY glVertexAttrib2fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib3f (GLuint index, GLfloat x, GLfloat y, GLfloat z); -GL_APICALL void GL_APIENTRY glVertexAttrib3fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttrib4f (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -GL_APICALL void GL_APIENTRY glVertexAttrib4fv (GLuint index, const GLfloat *v); -GL_APICALL void GL_APIENTRY glVertexAttribPointer (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void *pointer); -GL_APICALL void GL_APIENTRY glViewport (GLint x, GLint y, GLsizei width, GLsizei height); -#endif /* GL_ES_VERSION_2_0 */ - -#ifndef GL_ES_VERSION_3_0 -#define GL_ES_VERSION_3_0 1 -typedef unsigned short GLhalf; -#define GL_READ_BUFFER 0x0C02 -#define GL_UNPACK_ROW_LENGTH 0x0CF2 -#define GL_UNPACK_SKIP_ROWS 0x0CF3 -#define GL_UNPACK_SKIP_PIXELS 0x0CF4 -#define GL_PACK_ROW_LENGTH 0x0D02 -#define GL_PACK_SKIP_ROWS 0x0D03 -#define GL_PACK_SKIP_PIXELS 0x0D04 -#define GL_COLOR 0x1800 -#define GL_DEPTH 0x1801 -#define GL_STENCIL 0x1802 -#define GL_RED 0x1903 -#define GL_RGB8 0x8051 -#define GL_RGBA8 0x8058 -#define GL_RGB10_A2 0x8059 -#define GL_TEXTURE_BINDING_3D 0x806A -#define GL_UNPACK_SKIP_IMAGES 0x806D -#define GL_UNPACK_IMAGE_HEIGHT 0x806E -#define GL_TEXTURE_3D 0x806F -#define GL_TEXTURE_WRAP_R 0x8072 -#define GL_MAX_3D_TEXTURE_SIZE 0x8073 -#define GL_UNSIGNED_INT_2_10_10_10_REV 0x8368 -#define GL_MAX_ELEMENTS_VERTICES 0x80E8 -#define GL_MAX_ELEMENTS_INDICES 0x80E9 -#define GL_TEXTURE_MIN_LOD 0x813A -#define GL_TEXTURE_MAX_LOD 0x813B -#define GL_TEXTURE_BASE_LEVEL 0x813C -#define GL_TEXTURE_MAX_LEVEL 0x813D -#define GL_MIN 0x8007 -#define GL_MAX 0x8008 -#define GL_DEPTH_COMPONENT24 0x81A6 -#define GL_MAX_TEXTURE_LOD_BIAS 0x84FD -#define GL_TEXTURE_COMPARE_MODE 0x884C -#define GL_TEXTURE_COMPARE_FUNC 0x884D -#define GL_CURRENT_QUERY 0x8865 -#define GL_QUERY_RESULT 0x8866 -#define GL_QUERY_RESULT_AVAILABLE 0x8867 -#define GL_BUFFER_MAPPED 0x88BC -#define GL_BUFFER_MAP_POINTER 0x88BD -#define GL_STREAM_READ 0x88E1 -#define GL_STREAM_COPY 0x88E2 -#define GL_STATIC_READ 0x88E5 -#define GL_STATIC_COPY 0x88E6 -#define GL_DYNAMIC_READ 0x88E9 -#define GL_DYNAMIC_COPY 0x88EA -#define GL_MAX_DRAW_BUFFERS 0x8824 -#define GL_DRAW_BUFFER0 0x8825 -#define GL_DRAW_BUFFER1 0x8826 -#define GL_DRAW_BUFFER2 0x8827 -#define GL_DRAW_BUFFER3 0x8828 -#define GL_DRAW_BUFFER4 0x8829 -#define GL_DRAW_BUFFER5 0x882A -#define GL_DRAW_BUFFER6 0x882B -#define GL_DRAW_BUFFER7 0x882C -#define GL_DRAW_BUFFER8 0x882D -#define GL_DRAW_BUFFER9 0x882E -#define GL_DRAW_BUFFER10 0x882F -#define GL_DRAW_BUFFER11 0x8830 -#define GL_DRAW_BUFFER12 0x8831 -#define GL_DRAW_BUFFER13 0x8832 -#define GL_DRAW_BUFFER14 0x8833 -#define GL_DRAW_BUFFER15 0x8834 -#define GL_MAX_FRAGMENT_UNIFORM_COMPONENTS 0x8B49 -#define GL_MAX_VERTEX_UNIFORM_COMPONENTS 0x8B4A -#define GL_SAMPLER_3D 0x8B5F -#define GL_SAMPLER_2D_SHADOW 0x8B62 -#define GL_FRAGMENT_SHADER_DERIVATIVE_HINT 0x8B8B -#define GL_PIXEL_PACK_BUFFER 0x88EB -#define GL_PIXEL_UNPACK_BUFFER 0x88EC -#define GL_PIXEL_PACK_BUFFER_BINDING 0x88ED -#define GL_PIXEL_UNPACK_BUFFER_BINDING 0x88EF -#define GL_FLOAT_MAT2x3 0x8B65 -#define GL_FLOAT_MAT2x4 0x8B66 -#define GL_FLOAT_MAT3x2 0x8B67 -#define GL_FLOAT_MAT3x4 0x8B68 -#define GL_FLOAT_MAT4x2 0x8B69 -#define GL_FLOAT_MAT4x3 0x8B6A -#define GL_SRGB 0x8C40 -#define GL_SRGB8 0x8C41 -#define GL_SRGB8_ALPHA8 0x8C43 -#define GL_COMPARE_REF_TO_TEXTURE 0x884E -#define GL_MAJOR_VERSION 0x821B -#define GL_MINOR_VERSION 0x821C -#define GL_NUM_EXTENSIONS 0x821D -#define GL_RGBA32F 0x8814 -#define GL_RGB32F 0x8815 -#define GL_RGBA16F 0x881A -#define GL_RGB16F 0x881B -#define GL_VERTEX_ATTRIB_ARRAY_INTEGER 0x88FD -#define GL_MAX_ARRAY_TEXTURE_LAYERS 0x88FF -#define GL_MIN_PROGRAM_TEXEL_OFFSET 0x8904 -#define GL_MAX_PROGRAM_TEXEL_OFFSET 0x8905 -#define GL_MAX_VARYING_COMPONENTS 0x8B4B -#define GL_TEXTURE_2D_ARRAY 0x8C1A -#define GL_TEXTURE_BINDING_2D_ARRAY 0x8C1D -#define GL_R11F_G11F_B10F 0x8C3A -#define GL_UNSIGNED_INT_10F_11F_11F_REV 0x8C3B -#define GL_RGB9_E5 0x8C3D -#define GL_UNSIGNED_INT_5_9_9_9_REV 0x8C3E -#define GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH 0x8C76 -#define GL_TRANSFORM_FEEDBACK_BUFFER_MODE 0x8C7F -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS 0x8C80 -#define GL_TRANSFORM_FEEDBACK_VARYINGS 0x8C83 -#define GL_TRANSFORM_FEEDBACK_BUFFER_START 0x8C84 -#define GL_TRANSFORM_FEEDBACK_BUFFER_SIZE 0x8C85 -#define GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN 0x8C88 -#define GL_RASTERIZER_DISCARD 0x8C89 -#define GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS 0x8C8A -#define GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS 0x8C8B -#define GL_INTERLEAVED_ATTRIBS 0x8C8C -#define GL_SEPARATE_ATTRIBS 0x8C8D -#define GL_TRANSFORM_FEEDBACK_BUFFER 0x8C8E -#define GL_TRANSFORM_FEEDBACK_BUFFER_BINDING 0x8C8F -#define GL_RGBA32UI 0x8D70 -#define GL_RGB32UI 0x8D71 -#define GL_RGBA16UI 0x8D76 -#define GL_RGB16UI 0x8D77 -#define GL_RGBA8UI 0x8D7C -#define GL_RGB8UI 0x8D7D -#define GL_RGBA32I 0x8D82 -#define GL_RGB32I 0x8D83 -#define GL_RGBA16I 0x8D88 -#define GL_RGB16I 0x8D89 -#define GL_RGBA8I 0x8D8E -#define GL_RGB8I 0x8D8F -#define GL_RED_INTEGER 0x8D94 -#define GL_RGB_INTEGER 0x8D98 -#define GL_RGBA_INTEGER 0x8D99 -#define GL_SAMPLER_2D_ARRAY 0x8DC1 -#define GL_SAMPLER_2D_ARRAY_SHADOW 0x8DC4 -#define GL_SAMPLER_CUBE_SHADOW 0x8DC5 -#define GL_UNSIGNED_INT_VEC2 0x8DC6 -#define GL_UNSIGNED_INT_VEC3 0x8DC7 -#define GL_UNSIGNED_INT_VEC4 0x8DC8 -#define GL_INT_SAMPLER_2D 0x8DCA -#define GL_INT_SAMPLER_3D 0x8DCB -#define GL_INT_SAMPLER_CUBE 0x8DCC -#define GL_INT_SAMPLER_2D_ARRAY 0x8DCF -#define GL_UNSIGNED_INT_SAMPLER_2D 0x8DD2 -#define GL_UNSIGNED_INT_SAMPLER_3D 0x8DD3 -#define GL_UNSIGNED_INT_SAMPLER_CUBE 0x8DD4 -#define GL_UNSIGNED_INT_SAMPLER_2D_ARRAY 0x8DD7 -#define GL_BUFFER_ACCESS_FLAGS 0x911F -#define GL_BUFFER_MAP_LENGTH 0x9120 -#define GL_BUFFER_MAP_OFFSET 0x9121 -#define GL_DEPTH_COMPONENT32F 0x8CAC -#define GL_DEPTH32F_STENCIL8 0x8CAD -#define GL_FLOAT_32_UNSIGNED_INT_24_8_REV 0x8DAD -#define GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING 0x8210 -#define GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE 0x8211 -#define GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE 0x8212 -#define GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE 0x8213 -#define GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE 0x8214 -#define GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE 0x8215 -#define GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE 0x8216 -#define GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE 0x8217 -#define GL_FRAMEBUFFER_DEFAULT 0x8218 -#define GL_FRAMEBUFFER_UNDEFINED 0x8219 -#define GL_DEPTH_STENCIL_ATTACHMENT 0x821A -#define GL_DEPTH_STENCIL 0x84F9 -#define GL_UNSIGNED_INT_24_8 0x84FA -#define GL_DEPTH24_STENCIL8 0x88F0 -#define GL_UNSIGNED_NORMALIZED 0x8C17 -#define GL_DRAW_FRAMEBUFFER_BINDING 0x8CA6 -#define GL_READ_FRAMEBUFFER 0x8CA8 -#define GL_DRAW_FRAMEBUFFER 0x8CA9 -#define GL_READ_FRAMEBUFFER_BINDING 0x8CAA -#define GL_RENDERBUFFER_SAMPLES 0x8CAB -#define GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER 0x8CD4 -#define GL_MAX_COLOR_ATTACHMENTS 0x8CDF -#define GL_COLOR_ATTACHMENT1 0x8CE1 -#define GL_COLOR_ATTACHMENT2 0x8CE2 -#define GL_COLOR_ATTACHMENT3 0x8CE3 -#define GL_COLOR_ATTACHMENT4 0x8CE4 -#define GL_COLOR_ATTACHMENT5 0x8CE5 -#define GL_COLOR_ATTACHMENT6 0x8CE6 -#define GL_COLOR_ATTACHMENT7 0x8CE7 -#define GL_COLOR_ATTACHMENT8 0x8CE8 -#define GL_COLOR_ATTACHMENT9 0x8CE9 -#define GL_COLOR_ATTACHMENT10 0x8CEA -#define GL_COLOR_ATTACHMENT11 0x8CEB -#define GL_COLOR_ATTACHMENT12 0x8CEC -#define GL_COLOR_ATTACHMENT13 0x8CED -#define GL_COLOR_ATTACHMENT14 0x8CEE -#define GL_COLOR_ATTACHMENT15 0x8CEF -#define GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE 0x8D56 -#define GL_MAX_SAMPLES 0x8D57 -#define GL_HALF_FLOAT 0x140B -#define GL_MAP_READ_BIT 0x0001 -#define GL_MAP_WRITE_BIT 0x0002 -#define GL_MAP_INVALIDATE_RANGE_BIT 0x0004 -#define GL_MAP_INVALIDATE_BUFFER_BIT 0x0008 -#define GL_MAP_FLUSH_EXPLICIT_BIT 0x0010 -#define GL_MAP_UNSYNCHRONIZED_BIT 0x0020 -#define GL_RG 0x8227 -#define GL_RG_INTEGER 0x8228 -#define GL_R8 0x8229 -#define GL_RG8 0x822B -#define GL_R16F 0x822D -#define GL_R32F 0x822E -#define GL_RG16F 0x822F -#define GL_RG32F 0x8230 -#define GL_R8I 0x8231 -#define GL_R8UI 0x8232 -#define GL_R16I 0x8233 -#define GL_R16UI 0x8234 -#define GL_R32I 0x8235 -#define GL_R32UI 0x8236 -#define GL_RG8I 0x8237 -#define GL_RG8UI 0x8238 -#define GL_RG16I 0x8239 -#define GL_RG16UI 0x823A -#define GL_RG32I 0x823B -#define GL_RG32UI 0x823C -#define GL_VERTEX_ARRAY_BINDING 0x85B5 -#define GL_R8_SNORM 0x8F94 -#define GL_RG8_SNORM 0x8F95 -#define GL_RGB8_SNORM 0x8F96 -#define GL_RGBA8_SNORM 0x8F97 -#define GL_SIGNED_NORMALIZED 0x8F9C -#define GL_PRIMITIVE_RESTART_FIXED_INDEX 0x8D69 -#define GL_COPY_READ_BUFFER 0x8F36 -#define GL_COPY_WRITE_BUFFER 0x8F37 -#define GL_COPY_READ_BUFFER_BINDING 0x8F36 -#define GL_COPY_WRITE_BUFFER_BINDING 0x8F37 -#define GL_UNIFORM_BUFFER 0x8A11 -#define GL_UNIFORM_BUFFER_BINDING 0x8A28 -#define GL_UNIFORM_BUFFER_START 0x8A29 -#define GL_UNIFORM_BUFFER_SIZE 0x8A2A -#define GL_MAX_VERTEX_UNIFORM_BLOCKS 0x8A2B -#define GL_MAX_FRAGMENT_UNIFORM_BLOCKS 0x8A2D -#define GL_MAX_COMBINED_UNIFORM_BLOCKS 0x8A2E -#define GL_MAX_UNIFORM_BUFFER_BINDINGS 0x8A2F -#define GL_MAX_UNIFORM_BLOCK_SIZE 0x8A30 -#define GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS 0x8A31 -#define GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS 0x8A33 -#define GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT 0x8A34 -#define GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH 0x8A35 -#define GL_ACTIVE_UNIFORM_BLOCKS 0x8A36 -#define GL_UNIFORM_TYPE 0x8A37 -#define GL_UNIFORM_SIZE 0x8A38 -#define GL_UNIFORM_NAME_LENGTH 0x8A39 -#define GL_UNIFORM_BLOCK_INDEX 0x8A3A -#define GL_UNIFORM_OFFSET 0x8A3B -#define GL_UNIFORM_ARRAY_STRIDE 0x8A3C -#define GL_UNIFORM_MATRIX_STRIDE 0x8A3D -#define GL_UNIFORM_IS_ROW_MAJOR 0x8A3E -#define GL_UNIFORM_BLOCK_BINDING 0x8A3F -#define GL_UNIFORM_BLOCK_DATA_SIZE 0x8A40 -#define GL_UNIFORM_BLOCK_NAME_LENGTH 0x8A41 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS 0x8A42 -#define GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES 0x8A43 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER 0x8A44 -#define GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER 0x8A46 -#define GL_INVALID_INDEX 0xFFFFFFFFu -#define GL_MAX_VERTEX_OUTPUT_COMPONENTS 0x9122 -#define GL_MAX_FRAGMENT_INPUT_COMPONENTS 0x9125 -#define GL_MAX_SERVER_WAIT_TIMEOUT 0x9111 -#define GL_OBJECT_TYPE 0x9112 -#define GL_SYNC_CONDITION 0x9113 -#define GL_SYNC_STATUS 0x9114 -#define GL_SYNC_FLAGS 0x9115 -#define GL_SYNC_FENCE 0x9116 -#define GL_SYNC_GPU_COMMANDS_COMPLETE 0x9117 -#define GL_UNSIGNALED 0x9118 -#define GL_SIGNALED 0x9119 -#define GL_ALREADY_SIGNALED 0x911A -#define GL_TIMEOUT_EXPIRED 0x911B -#define GL_CONDITION_SATISFIED 0x911C -#define GL_WAIT_FAILED 0x911D -#define GL_SYNC_FLUSH_COMMANDS_BIT 0x00000001 -#define GL_TIMEOUT_IGNORED 0xFFFFFFFFFFFFFFFFull -#define GL_VERTEX_ATTRIB_ARRAY_DIVISOR 0x88FE -#define GL_ANY_SAMPLES_PASSED 0x8C2F -#define GL_ANY_SAMPLES_PASSED_CONSERVATIVE 0x8D6A -#define GL_SAMPLER_BINDING 0x8919 -#define GL_RGB10_A2UI 0x906F -#define GL_TEXTURE_SWIZZLE_R 0x8E42 -#define GL_TEXTURE_SWIZZLE_G 0x8E43 -#define GL_TEXTURE_SWIZZLE_B 0x8E44 -#define GL_TEXTURE_SWIZZLE_A 0x8E45 -#define GL_GREEN 0x1904 -#define GL_BLUE 0x1905 -#define GL_INT_2_10_10_10_REV 0x8D9F -#define GL_TRANSFORM_FEEDBACK 0x8E22 -#define GL_TRANSFORM_FEEDBACK_PAUSED 0x8E23 -#define GL_TRANSFORM_FEEDBACK_ACTIVE 0x8E24 -#define GL_TRANSFORM_FEEDBACK_BINDING 0x8E25 -#define GL_PROGRAM_BINARY_RETRIEVABLE_HINT 0x8257 -#define GL_PROGRAM_BINARY_LENGTH 0x8741 -#define GL_NUM_PROGRAM_BINARY_FORMATS 0x87FE -#define GL_PROGRAM_BINARY_FORMATS 0x87FF -#define GL_COMPRESSED_R11_EAC 0x9270 -#define GL_COMPRESSED_SIGNED_R11_EAC 0x9271 -#define GL_COMPRESSED_RG11_EAC 0x9272 -#define GL_COMPRESSED_SIGNED_RG11_EAC 0x9273 -#define GL_COMPRESSED_RGB8_ETC2 0x9274 -#define GL_COMPRESSED_SRGB8_ETC2 0x9275 -#define GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9276 -#define GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 0x9277 -#define GL_COMPRESSED_RGBA8_ETC2_EAC 0x9278 -#define GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC 0x9279 -#define GL_TEXTURE_IMMUTABLE_FORMAT 0x912F -#define GL_MAX_ELEMENT_INDEX 0x8D6B -#define GL_NUM_SAMPLE_COUNTS 0x9380 -#define GL_TEXTURE_IMMUTABLE_LEVELS 0x82DF -GL_APICALL void GL_APIENTRY glReadBuffer (GLenum mode); -GL_APICALL void GL_APIENTRY glDrawRangeElements (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void *indices); -GL_APICALL void GL_APIENTRY glTexImage3D (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void *pixels); -GL_APICALL void GL_APIENTRY glCopyTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glCompressedTexImage3D (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glCompressedTexSubImage3D (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void *data); -GL_APICALL void GL_APIENTRY glGenQueries (GLsizei n, GLuint *ids); -GL_APICALL void GL_APIENTRY glDeleteQueries (GLsizei n, const GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsQuery (GLuint id); -GL_APICALL void GL_APIENTRY glBeginQuery (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glEndQuery (GLenum target); -GL_APICALL void GL_APIENTRY glGetQueryiv (GLenum target, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetQueryObjectuiv (GLuint id, GLenum pname, GLuint *params); -GL_APICALL GLboolean GL_APIENTRY glUnmapBuffer (GLenum target); -GL_APICALL void GL_APIENTRY glGetBufferPointerv (GLenum target, GLenum pname, void **params); -GL_APICALL void GL_APIENTRY glDrawBuffers (GLsizei n, const GLenum *bufs); -GL_APICALL void GL_APIENTRY glUniformMatrix2x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix2x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x2fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix3x4fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glUniformMatrix4x3fv (GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); -GL_APICALL void GL_APIENTRY glBlitFramebuffer (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -GL_APICALL void GL_APIENTRY glRenderbufferStorageMultisample (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glFramebufferTextureLayer (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -GL_APICALL void *GL_APIENTRY glMapBufferRange (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -GL_APICALL void GL_APIENTRY glFlushMappedBufferRange (GLenum target, GLintptr offset, GLsizeiptr length); -GL_APICALL void GL_APIENTRY glBindVertexArray (GLuint array); -GL_APICALL void GL_APIENTRY glDeleteVertexArrays (GLsizei n, const GLuint *arrays); -GL_APICALL void GL_APIENTRY glGenVertexArrays (GLsizei n, GLuint *arrays); -GL_APICALL GLboolean GL_APIENTRY glIsVertexArray (GLuint array); -GL_APICALL void GL_APIENTRY glGetIntegeri_v (GLenum target, GLuint index, GLint *data); -GL_APICALL void GL_APIENTRY glBeginTransformFeedback (GLenum primitiveMode); -GL_APICALL void GL_APIENTRY glEndTransformFeedback (void); -GL_APICALL void GL_APIENTRY glBindBufferRange (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -GL_APICALL void GL_APIENTRY glBindBufferBase (GLenum target, GLuint index, GLuint buffer); -GL_APICALL void GL_APIENTRY glTransformFeedbackVaryings (GLuint program, GLsizei count, const GLchar *const*varyings, GLenum bufferMode); -GL_APICALL void GL_APIENTRY glGetTransformFeedbackVarying (GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name); -GL_APICALL void GL_APIENTRY glVertexAttribIPointer (GLuint index, GLint size, GLenum type, GLsizei stride, const void *pointer); -GL_APICALL void GL_APIENTRY glGetVertexAttribIiv (GLuint index, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetVertexAttribIuiv (GLuint index, GLenum pname, GLuint *params); -GL_APICALL void GL_APIENTRY glVertexAttribI4i (GLuint index, GLint x, GLint y, GLint z, GLint w); -GL_APICALL void GL_APIENTRY glVertexAttribI4ui (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -GL_APICALL void GL_APIENTRY glVertexAttribI4iv (GLuint index, const GLint *v); -GL_APICALL void GL_APIENTRY glVertexAttribI4uiv (GLuint index, const GLuint *v); -GL_APICALL void GL_APIENTRY glGetUniformuiv (GLuint program, GLint location, GLuint *params); -GL_APICALL GLint GL_APIENTRY glGetFragDataLocation (GLuint program, const GLchar *name); -GL_APICALL void GL_APIENTRY glUniform1ui (GLint location, GLuint v0); -GL_APICALL void GL_APIENTRY glUniform2ui (GLint location, GLuint v0, GLuint v1); -GL_APICALL void GL_APIENTRY glUniform3ui (GLint location, GLuint v0, GLuint v1, GLuint v2); -GL_APICALL void GL_APIENTRY glUniform4ui (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -GL_APICALL void GL_APIENTRY glUniform1uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glUniform2uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glUniform3uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glUniform4uiv (GLint location, GLsizei count, const GLuint *value); -GL_APICALL void GL_APIENTRY glClearBufferiv (GLenum buffer, GLint drawbuffer, const GLint *value); -GL_APICALL void GL_APIENTRY glClearBufferuiv (GLenum buffer, GLint drawbuffer, const GLuint *value); -GL_APICALL void GL_APIENTRY glClearBufferfv (GLenum buffer, GLint drawbuffer, const GLfloat *value); -GL_APICALL void GL_APIENTRY glClearBufferfi (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -GL_APICALL const GLubyte *GL_APIENTRY glGetStringi (GLenum name, GLuint index); -GL_APICALL void GL_APIENTRY glCopyBufferSubData (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -GL_APICALL void GL_APIENTRY glGetUniformIndices (GLuint program, GLsizei uniformCount, const GLchar *const*uniformNames, GLuint *uniformIndices); -GL_APICALL void GL_APIENTRY glGetActiveUniformsiv (GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params); -GL_APICALL GLuint GL_APIENTRY glGetUniformBlockIndex (GLuint program, const GLchar *uniformBlockName); -GL_APICALL void GL_APIENTRY glGetActiveUniformBlockiv (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetActiveUniformBlockName (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName); -GL_APICALL void GL_APIENTRY glUniformBlockBinding (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -GL_APICALL void GL_APIENTRY glDrawArraysInstanced (GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -GL_APICALL void GL_APIENTRY glDrawElementsInstanced (GLenum mode, GLsizei count, GLenum type, const void *indices, GLsizei instancecount); -GL_APICALL GLsync GL_APIENTRY glFenceSync (GLenum condition, GLbitfield flags); -GL_APICALL GLboolean GL_APIENTRY glIsSync (GLsync sync); -GL_APICALL void GL_APIENTRY glDeleteSync (GLsync sync); -GL_APICALL GLenum GL_APIENTRY glClientWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glWaitSync (GLsync sync, GLbitfield flags, GLuint64 timeout); -GL_APICALL void GL_APIENTRY glGetInteger64v (GLenum pname, GLint64 *data); -GL_APICALL void GL_APIENTRY glGetSynciv (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values); -GL_APICALL void GL_APIENTRY glGetInteger64i_v (GLenum target, GLuint index, GLint64 *data); -GL_APICALL void GL_APIENTRY glGetBufferParameteri64v (GLenum target, GLenum pname, GLint64 *params); -GL_APICALL void GL_APIENTRY glGenSamplers (GLsizei count, GLuint *samplers); -GL_APICALL void GL_APIENTRY glDeleteSamplers (GLsizei count, const GLuint *samplers); -GL_APICALL GLboolean GL_APIENTRY glIsSampler (GLuint sampler); -GL_APICALL void GL_APIENTRY glBindSampler (GLuint unit, GLuint sampler); -GL_APICALL void GL_APIENTRY glSamplerParameteri (GLuint sampler, GLenum pname, GLint param); -GL_APICALL void GL_APIENTRY glSamplerParameteriv (GLuint sampler, GLenum pname, const GLint *param); -GL_APICALL void GL_APIENTRY glSamplerParameterf (GLuint sampler, GLenum pname, GLfloat param); -GL_APICALL void GL_APIENTRY glSamplerParameterfv (GLuint sampler, GLenum pname, const GLfloat *param); -GL_APICALL void GL_APIENTRY glGetSamplerParameteriv (GLuint sampler, GLenum pname, GLint *params); -GL_APICALL void GL_APIENTRY glGetSamplerParameterfv (GLuint sampler, GLenum pname, GLfloat *params); -GL_APICALL void GL_APIENTRY glVertexAttribDivisor (GLuint index, GLuint divisor); -GL_APICALL void GL_APIENTRY glBindTransformFeedback (GLenum target, GLuint id); -GL_APICALL void GL_APIENTRY glDeleteTransformFeedbacks (GLsizei n, const GLuint *ids); -GL_APICALL void GL_APIENTRY glGenTransformFeedbacks (GLsizei n, GLuint *ids); -GL_APICALL GLboolean GL_APIENTRY glIsTransformFeedback (GLuint id); -GL_APICALL void GL_APIENTRY glPauseTransformFeedback (void); -GL_APICALL void GL_APIENTRY glResumeTransformFeedback (void); -GL_APICALL void GL_APIENTRY glGetProgramBinary (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, void *binary); -GL_APICALL void GL_APIENTRY glProgramBinary (GLuint program, GLenum binaryFormat, const void *binary, GLsizei length); -GL_APICALL void GL_APIENTRY glProgramParameteri (GLuint program, GLenum pname, GLint value); -GL_APICALL void GL_APIENTRY glInvalidateFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments); -GL_APICALL void GL_APIENTRY glInvalidateSubFramebuffer (GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage2D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -GL_APICALL void GL_APIENTRY glTexStorage3D (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -GL_APICALL void GL_APIENTRY glGetInternalformativ (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params); -#endif /* GL_ES_VERSION_3_0 */ - -#ifdef __cplusplus -} -#endif - -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl3platform.h android-platform-frameworks-native-21/opengl/include/GLES3/gl3platform.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/GLES3/gl3platform.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/GLES3/gl3platform.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,30 +0,0 @@ -#ifndef __gl3platform_h_ -#define __gl3platform_h_ - -/* $Revision: 18437 $ on $Date:: 2012-07-08 23:31:39 -0700 #$ */ - -/* - * This document is licensed under the SGI Free Software B License Version - * 2.0. For details, see http://oss.sgi.com/projects/FreeB/ . - */ - -/* Platform-specific types and definitions for OpenGL ES 3.X gl3.h - * - * Adopters may modify khrplatform.h and this file to suit their platform. - * You are encouraged to submit all modifications to the Khronos group so that - * they can be included in future versions of this file. Please submit changes - * by sending them to the public Khronos Bugzilla (http://khronos.org/bugzilla) - * by filing a bug against product "OpenGL-ES" component "Registry". - */ - -#include - -#ifndef GL_APICALL -#define GL_APICALL KHRONOS_APICALL -#endif - -#ifndef GL_APIENTRY -#define GL_APIENTRY KHRONOS_APIENTRY -#endif - -#endif /* __gl3platform_h_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/include/KHR/khrplatform.h android-platform-frameworks-native-21/opengl/include/KHR/khrplatform.h --- android-platform-frameworks-native-6.0.1+r16/opengl/include/KHR/khrplatform.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/include/KHR/khrplatform.h 2012-10-16 22:57:11.000000000 +0000 @@ -24,10 +24,9 @@ ** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. */ -/* Khronos platform-specific types and definitions. - * - * $Revision: 9356 $ on $Date: 2009-10-21 02:52:25 -0700 (Wed, 21 Oct 2009) $ - * +/* Platform-specific types and definitions. + * $Revision: 7244 $ on $Date: 2009-01-20 17:06:59 -0800 (Tue, 20 Jan 2009) $ + * * Adopters may modify this file to suit their platform. Adopters are * encouraged to submit platform specific modifications to the Khronos * group so that they can be included in future versions of this file. @@ -38,19 +37,19 @@ * A predefined template which fills in some of the bug fields can be * reached using http://tinyurl.com/khrplatform-h-bugreport, but you * must create a Bugzilla login first. - * + * * * See the Implementer's Guidelines for information about where this file - * should be located on your system and for more details of its use: + * should be located on your system. * http://www.khronos.org/registry/implementers_guide.pdf * + * * This file should be included as * #include - * by Khronos client API header files that use its types and defines. - * - * The types in khrplatform.h should only be used to define API-specific types. + * by the Khronos API header file that uses its types and defines. * - * Types defined in khrplatform.h: + * The types in this file should only be used to define API-specific types. + * Types defined in this file: * khronos_int8_t signed 8 bit * khronos_uint8_t unsigned 8 bit * khronos_int16_t signed 16 bit @@ -68,25 +67,16 @@ * khronos_utime_nanoseconds_t unsigned time interval or absolute time in * nanoseconds * khronos_stime_nanoseconds_t signed time interval in nanoseconds - * khronos_boolean_enum_t enumerated boolean type. This should - * only be used as a base type when a client API's boolean type is - * an enum. Client APIs which use an integer or other type for - * booleans cannot use this as the base type for their boolean. * - * Tokens defined in khrplatform.h: + * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. + * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. + * * - * KHRONOS_FALSE, KHRONOS_TRUE Enumerated boolean false/true values. - * - * KHRONOS_SUPPORT_INT64 is 1 if 64 bit integers are supported; otherwise 0. - * KHRONOS_SUPPORT_FLOAT is 1 if floats are supported; otherwise 0. - * - * Calling convention macros defined in this file: + * Macros defined in this file: * KHRONOS_APICALL * KHRONOS_APIENTRY * KHRONOS_APIATTRIBUTES - * * These may be used in function prototypes as: - * * KHRONOS_APICALL void KHRONOS_APIENTRY funcname( * int arg1, * int arg2) KHRONOS_APIATTRIBUTES; @@ -238,34 +228,16 @@ #if KHRONOS_SUPPORT_INT64 /* Time types * - * These types can be used to represent a time interval in nanoseconds or - * an absolute Unadjusted System Time. Unadjusted System Time is the number - * of nanoseconds since some arbitrary system event (e.g. since the last - * time the system booted). The Unadjusted System Time is an unsigned - * 64 bit value that wraps back to 0 every 584 years. Time intervals + * These types can be used to represent a time interval in nanoseconds or + * an absolute Unadjusted System Time. Unadjusted System Time is the number + * of nanoseconds since some arbitrary system event (e.g. since the last + * time the system booted). The Unadjusted System Time is an unsigned + * 64 bit value that wraps back to 0 every 584 years. Time intervals * may be either signed or unsigned. */ typedef khronos_uint64_t khronos_utime_nanoseconds_t; typedef khronos_int64_t khronos_stime_nanoseconds_t; #endif -/* - * Dummy value used to pad enum types to 32 bits. - */ -#ifndef KHRONOS_MAX_ENUM -#define KHRONOS_MAX_ENUM 0x7FFFFFFF -#endif - -/* - * Enumerated boolean type - * - * Values other than zero should be considered to be true. Therefore - * comparisons should not be made against KHRONOS_TRUE. - */ -typedef enum { - KHRONOS_FALSE = 0, - KHRONOS_TRUE = 1, - KHRONOS_BOOLEAN_ENUM_FORCE_SIZE = KHRONOS_MAX_ENUM -} khronos_boolean_enum_t; #endif /* __khrplatform_h_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/Android.mk android-platform-frameworks-native-21/opengl/libagl/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -26,22 +26,27 @@ LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -fvisibility=hidden -LOCAL_SHARED_LIBRARIES := libcutils libhardware libutils liblog libpixelflinger libETC1 libui +LOCAL_SHARED_LIBRARIES := libcutils libhardware libutils libpixelflinger libETC1 +LOCAL_LDLIBS := -lpthread -ldl -LOCAL_SRC_FILES_arm += fixed_asm.S iterators.S -LOCAL_CFLAGS_arm += -fstrict-aliasing +ifeq ($(TARGET_ARCH),arm) + LOCAL_SRC_FILES += fixed_asm.S iterators.S + LOCAL_CFLAGS += -fstrict-aliasing +endif -ifndef ARCH_MIPS_REV6 -LOCAL_SRC_FILES_mips += arch-mips/fixed_asm.S +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER endif -LOCAL_CFLAGS_mips += -fstrict-aliasing -# The graphics code can generate division by zero -LOCAL_CFLAGS_mips += -mno-check-zero-division # we need to access the private Bionic header +# on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER +# behavior from the bionic Android.mk file +ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif LOCAL_C_INCLUDES += bionic/libc/private -LOCAL_MODULE_RELATIVE_PATH := egl +LOCAL_MODULE_PATH := $(TARGET_OUT_SHARED_LIBRARIES)/egl LOCAL_MODULE:= libGLES_android include $(BUILD_SHARED_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/arch-mips/fixed_asm.S android-platform-frameworks-native-21/opengl/libagl/arch-mips/fixed_asm.S --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/arch-mips/fixed_asm.S 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/arch-mips/fixed_asm.S 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* libs/opengles/arch-mips/fixed_asm.S -** -** Copyright 2012, 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. -*/ - - - .text - .align - -/* - * this version rounds-to-nearest and saturates numbers - * outside the range (but not NaNs). - */ - - .global gglFloatToFixed - .ent gglFloatToFixed - .type gglFloatToFixed, @function -gglFloatToFixed: -#if !defined(__mips_soft_float) - mfc1 $a0,$f12 -#endif - srl $t0,$a0,31 /* t0 <- sign bit */ - srl $t1,$a0,23 - andi $t1,$t1,0xff /* get the e */ - li $t2,0x8e - subu $t1,$t2,$t1 /* t1=127+15-e */ - blez $t1,0f /* t1<=0? */ - sll $t2,$a0,8 /* mantissa<<8 */ - lui $t3,0x8000 - or $t2,$t2,$t3 /* add the missing 1 */ - subu $t1,$t1,1 - srl $v0,$t2,$t1 - sltiu $t3,$t1,32 /* t3=1 if t1<32, else t3=0. t1>=32 means the float value is too small. */ - andi $t4,$v0,0x1 - srl $v0,$v0,1 /* scale to 16.16 */ - addu $v0,$v0,$t4 /* round-to-nearest */ - subu $t2,$zero,$v0 - movn $v0,$t2,$t0 /* if negative? */ - or $t1,$a0,$zero /* a0=0? */ - movz $v0,$zero,$t1 - movz $v0,$zero,$t3 /* t3=0 then res=0 */ - jr $ra -0: - lui $t1,0x8000 - and $v0,$a0,$t1 /* keep only the sign bit */ - li $t1,0x7fffffff - movz $v0,$t1,$t0 /* positive, maximum value */ - jr $ra - .end gglFloatToFixed diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/array.cpp android-platform-frameworks-native-21/opengl/libagl/array.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/array.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/array.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -397,9 +397,9 @@ } } -#if VC_CACHE_STATISTICS void vertex_cache_t::dump_stats(GLenum mode) { +#if VC_CACHE_STATISTICS nsecs_t time = systemTime(SYSTEM_TIME_THREAD) - startTime; uint32_t hits = total - misses; uint32_t prim_count; @@ -418,12 +418,8 @@ total, hits, misses, (hits*100)/total, prim_count, int(ns2us(time)), int(prim_count*float(seconds(1))/time), float(misses) / prim_count); -} -#else -void vertex_cache_t::dump_stats(GLenum /*mode*/) -{ -} #endif +} // ---------------------------------------------------------------------------- #if 0 diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/BufferObjectManager.h android-platform-frameworks-native-21/opengl/libagl/BufferObjectManager.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/BufferObjectManager.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/BufferObjectManager.h 2012-10-16 22:57:11.000000000 +0000 @@ -69,10 +69,10 @@ KeyedVector mBuffers; }; -void EGLBufferObjectManager::incStrong(const void* /*id*/) const { +void EGLBufferObjectManager::incStrong(const void* id) const { android_atomic_inc(&mCount); } -void EGLBufferObjectManager::decStrong(const void* /*id*/) const { +void EGLBufferObjectManager::decStrong(const void* id) const { if (android_atomic_dec(&mCount) == 1) { delete this; } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/context.h android-platform-frameworks-native-21/opengl/libagl/context.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/context.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/context.h 2012-10-16 22:57:11.000000000 +0000 @@ -147,11 +147,7 @@ vec4_t color; vec4_t texture[GGL_TEXTURE_UNIT_COUNT]; -#ifdef __LP64__ - uint32_t reserved1[2]; -#else uint32_t reserved1[4]; -#endif inline void clear() { flags = index = locked = mru = 0; @@ -582,10 +578,10 @@ #ifdef HAVE_ANDROID_OS // We have a dedicated TLS slot in bionic inline void setGlThreadSpecific(ogles_context_t *value) { - __get_tls()[TLS_SLOT_OPENGL] = value; + ((uint32_t *)__get_tls())[TLS_SLOT_OPENGL] = (uint32_t)value; } inline ogles_context_t* getGlThreadSpecific() { - return static_cast(__get_tls()[TLS_SLOT_OPENGL]); + return (ogles_context_t *)(((unsigned *)__get_tls())[TLS_SLOT_OPENGL]); } #else extern pthread_key_t gGLKey; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/egl.cpp android-platform-frameworks-native-21/opengl/libagl/egl.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/egl.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/egl.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -31,7 +31,6 @@ #include #include -#include #include #include @@ -78,20 +77,20 @@ pthread_key_create(&gEGLErrorKey, NULL); pthread_mutex_unlock(&gErrorKeyMutex); } - pthread_setspecific(gEGLErrorKey, (void*)(uintptr_t)error); + pthread_setspecific(gEGLErrorKey, (void*)error); return returnValue; } static GLint getError() { if (ggl_unlikely(gEGLErrorKey == -1)) return EGL_SUCCESS; - GLint error = (GLint)(uintptr_t)pthread_getspecific(gEGLErrorKey); + GLint error = (GLint)pthread_getspecific(gEGLErrorKey); if (error == 0) { // The TLS key has been created by another thread, but the value for // this thread has not been initialized. return EGL_SUCCESS; } - pthread_setspecific(gEGLErrorKey, (void*)(uintptr_t)EGL_SUCCESS); + pthread_setspecific(gEGLErrorKey, (void*)EGL_SUCCESS); return error; } @@ -147,7 +146,6 @@ EGLDisplay dpy; EGLConfig config; EGLContext ctx; - bool zombie; egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat); virtual ~egl_surface_t(); @@ -167,6 +165,7 @@ virtual EGLint getSwapBehavior() const; virtual EGLBoolean swapBuffers(); virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h); + virtual EGLClientBuffer getRenderBuffer() const; protected: GGLSurface depth; }; @@ -174,7 +173,7 @@ egl_surface_t::egl_surface_t(EGLDisplay dpy, EGLConfig config, int32_t depthFormat) - : magic(MAGIC), dpy(dpy), config(config), ctx(0), zombie(false) + : magic(MAGIC), dpy(dpy), config(config), ctx(0) { depth.version = sizeof(GGLSurface); depth.data = 0; @@ -206,10 +205,13 @@ return EGL_BUFFER_PRESERVED; } EGLBoolean egl_surface_t::setSwapRectangle( - EGLint /*l*/, EGLint /*t*/, EGLint /*w*/, EGLint /*h*/) + EGLint l, EGLint t, EGLint w, EGLint h) { return EGL_FALSE; } +EGLClientBuffer egl_surface_t::getRenderBuffer() const { + return 0; +} // ---------------------------------------------------------------------------- @@ -235,6 +237,7 @@ virtual EGLint getRefreshRate() const; virtual EGLint getSwapBehavior() const; virtual EGLBoolean setSwapRectangle(EGLint l, EGLint t, EGLint w, EGLint h); + virtual EGLClientBuffer getRenderBuffer() const; private: status_t lock(ANativeWindowBuffer* buf, int usage, void** vaddr); @@ -374,16 +377,7 @@ GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN); // dequeue a buffer - int fenceFd = -1; - if (nativeWindow->dequeueBuffer(nativeWindow, &buffer, - &fenceFd) != NO_ERROR) { - return setError(EGL_BAD_ALLOC, EGL_FALSE); - } - - // wait for the buffer - sp fence(new Fence(fenceFd)); - if (fence->wait(Fence::TIMEOUT_NEVER) != NO_ERROR) { - nativeWindow->cancelBuffer(nativeWindow, buffer, fenceFd); + if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) != NO_ERROR) { return setError(EGL_BAD_ALLOC, EGL_FALSE); } @@ -394,13 +388,7 @@ depth.width = width; depth.height = height; depth.stride = depth.width; // use the width here - uint64_t allocSize = static_cast(depth.stride) * - static_cast(depth.height) * 2; - if (depth.stride < 0 || depth.height > INT_MAX || - allocSize > UINT32_MAX) { - return setError(EGL_BAD_ALLOC, EGL_FALSE); - } - depth.data = (GGLubyte*)malloc(allocSize); + depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2); if (depth.data == 0) { return setError(EGL_BAD_ALLOC, EGL_FALSE); } @@ -409,6 +397,8 @@ // keep a reference on the buffer buffer->common.incRef(&buffer->common); + // Lock the buffer + nativeWindow->lockBuffer(nativeWindow, buffer); // pin the buffer down if (lock(buffer, GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN, &bits) != NO_ERROR) { @@ -426,8 +416,9 @@ bits = NULL; unlock(buffer); } + // enqueue the last frame + nativeWindow->queueBuffer(nativeWindow, buffer); if (buffer) { - nativeWindow->cancelBuffer(nativeWindow, buffer, -1); buffer->common.decRef(&buffer->common); buffer = 0; } @@ -531,17 +522,15 @@ unlock(buffer); previousBuffer = buffer; - nativeWindow->queueBuffer(nativeWindow, buffer, -1); + nativeWindow->queueBuffer(nativeWindow, buffer); buffer = 0; // dequeue a new buffer - int fenceFd = -1; - if (nativeWindow->dequeueBuffer(nativeWindow, &buffer, &fenceFd) == NO_ERROR) { - sp fence(new Fence(fenceFd)); - if (fence->wait(Fence::TIMEOUT_NEVER)) { - nativeWindow->cancelBuffer(nativeWindow, buffer, fenceFd); - return setError(EGL_BAD_ALLOC, EGL_FALSE); - } + if (nativeWindow->dequeueBuffer(nativeWindow, &buffer) == NO_ERROR) { + + // TODO: lockBuffer should rather be executed when the very first + // direct rendering occurs. + nativeWindow->lockBuffer(nativeWindow, buffer); // reallocate the depth-buffer if needed if ((width != buffer->width) || (height != buffer->height)) { @@ -554,14 +543,7 @@ depth.width = width; depth.height = height; depth.stride = buffer->stride; - uint64_t allocSize = static_cast(depth.stride) * - static_cast(depth.height) * 2; - if (depth.stride < 0 || depth.height > INT_MAX || - allocSize > UINT32_MAX) { - setError(EGL_BAD_ALLOC, EGL_FALSE); - return EGL_FALSE; - } - depth.data = (GGLubyte*)malloc(allocSize); + depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2); if (depth.data == 0) { setError(EGL_BAD_ALLOC, EGL_FALSE); return EGL_FALSE; @@ -594,6 +576,11 @@ return EGL_TRUE; } +EGLClientBuffer egl_window_surface_v2_t::getRenderBuffer() const +{ + return buffer; +} + EGLBoolean egl_window_surface_v2_t::bindDrawSurface(ogles_context_t* gl) { GGLSurface buffer; @@ -679,14 +666,7 @@ depth.width = pixmap->width; depth.height = pixmap->height; depth.stride = depth.width; // use the width here - uint64_t allocSize = static_cast(depth.stride) * - static_cast(depth.height) * 2; - if (depth.stride < 0 || depth.height > INT_MAX || - allocSize > UINT32_MAX) { - setError(EGL_BAD_ALLOC, EGL_NO_SURFACE); - return; - } - depth.data = (GGLubyte*)malloc(allocSize); + depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2); if (depth.data == 0) { setError(EGL_BAD_ALLOC, EGL_NO_SURFACE); } @@ -766,14 +746,7 @@ depth.width = pbuffer.width; depth.height = pbuffer.height; depth.stride = depth.width; // use the width here - uint64_t allocSize = static_cast(depth.stride) * - static_cast(depth.height) * 2; - if (depth.stride < 0 || depth.height > INT_MAX || - allocSize > UINT32_MAX) { - setError(EGL_BAD_ALLOC, EGL_NO_SURFACE); - return; - } - depth.data = (GGLubyte*)malloc(allocSize); + depth.data = (GGLubyte*)malloc(depth.stride*depth.height*2); if (depth.data == 0) { setError(EGL_BAD_ALLOC, EGL_NO_SURFACE); return; @@ -820,7 +793,7 @@ static bool mask(GLint reqValue, GLint confValue) { return (confValue & reqValue) == reqValue; } - static bool ignore(GLint /*reqValue*/, GLint /*confValue*/) { + static bool ignore(GLint reqValue, GLint confValue) { return true; } }; @@ -838,6 +811,7 @@ // "KHR_image_pixmap " "EGL_ANDROID_image_native_buffer " "EGL_ANDROID_swap_rectangle " + "EGL_ANDROID_get_render_buffer " ; // ---------------------------------------------------------------------------- @@ -898,6 +872,8 @@ (__eglMustCastToProperFunctionPointerType)&eglGetSyncAttribKHR }, { "eglSetSwapRectangleANDROID", (__eglMustCastToProperFunctionPointerType)&eglSetSwapRectangleANDROID }, + { "eglGetRenderBufferANDROID", + (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID }, }; /* @@ -1224,11 +1200,11 @@ return 0; } -static EGLBoolean getConfigAttrib(EGLDisplay /*dpy*/, EGLConfig config, +static EGLBoolean getConfigAttrib(EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value) { size_t numConfigs = NELEM(gConfigs); - int index = (int)(uintptr_t)config; + int index = (int)config; if (uint32_t(index) >= numConfigs) return setError(EGL_BAD_CONFIG, EGL_FALSE); @@ -1254,7 +1230,7 @@ } static EGLSurface createWindowSurface(EGLDisplay dpy, EGLConfig config, - NativeWindowType window, const EGLint* /*attrib_list*/) + NativeWindowType window, const EGLint *attrib_list) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE); @@ -1303,7 +1279,7 @@ } static EGLSurface createPixmapSurface(EGLDisplay dpy, EGLConfig config, - NativePixmapType pixmap, const EGLint* /*attrib_list*/) + NativePixmapType pixmap, const EGLint *attrib_list) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE); @@ -1475,7 +1451,7 @@ } GLint i; for (i=0 ; idpy != dpy) return setError(EGL_BAD_DISPLAY, EGL_FALSE); if (surface->ctx) { - // defer disconnect/delete until no longer current - surface->zombie = true; - } else { + // FIXME: this surface is current check what the spec says surface->disconnect(); - delete surface; + surface->ctx = 0; } + delete surface; } return EGL_TRUE; } @@ -1682,7 +1657,7 @@ } EGLContext eglCreateContext(EGLDisplay dpy, EGLConfig config, - EGLContext /*share_list*/, const EGLint* /*attrib_list*/) + EGLContext share_list, const EGLint *attrib_list) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE); @@ -1764,9 +1739,6 @@ if (c->draw) { egl_surface_t* s = reinterpret_cast(c->draw); s->disconnect(); - s->ctx = EGL_NO_CONTEXT; - if (s->zombie) - delete s; } if (c->read) { // FIXME: unlock/disconnect the read surface too @@ -1808,10 +1780,8 @@ egl_surface_t* r = (egl_surface_t*)c->read; if (d) { c->draw = 0; - d->disconnect(); d->ctx = EGL_NO_CONTEXT; - if (d->zombie) - delete d; + d->disconnect(); } if (r) { c->read = 0; @@ -1880,7 +1850,7 @@ return EGL_TRUE; } -EGLBoolean eglWaitNative(EGLint /*engine*/) +EGLBoolean eglWaitNative(EGLint engine) { return EGL_TRUE; } @@ -1914,8 +1884,8 @@ return EGL_TRUE; } -EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface /*surface*/, - NativePixmapType /*target*/) +EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface, + NativePixmapType target) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); @@ -1951,7 +1921,7 @@ // ---------------------------------------------------------------------------- EGLBoolean eglSurfaceAttrib( - EGLDisplay dpy, EGLSurface /*surface*/, EGLint /*attribute*/, EGLint /*value*/) + EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); @@ -1960,7 +1930,7 @@ } EGLBoolean eglBindTexImage( - EGLDisplay dpy, EGLSurface /*surface*/, EGLint /*buffer*/) + EGLDisplay dpy, EGLSurface surface, EGLint buffer) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); @@ -1969,7 +1939,7 @@ } EGLBoolean eglReleaseTexImage( - EGLDisplay dpy, EGLSurface /*surface*/, EGLint /*buffer*/) + EGLDisplay dpy, EGLSurface surface, EGLint buffer) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); @@ -1977,7 +1947,7 @@ return setError(EGL_BAD_PARAMETER, EGL_FALSE); } -EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint /*interval*/) +EGLBoolean eglSwapInterval(EGLDisplay dpy, EGLint interval) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_FALSE); @@ -2014,8 +1984,8 @@ } EGLSurface eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, EGLenum /*buftype*/, EGLClientBuffer /*buffer*/, - EGLConfig /*config*/, const EGLint* /*attrib_list*/) + EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, + EGLConfig config, const EGLint *attrib_list) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) return setError(EGL_BAD_DISPLAY, EGL_NO_SURFACE); @@ -2038,21 +2008,21 @@ return NULL; } -EGLBoolean eglLockSurfaceKHR(EGLDisplay /*dpy*/, EGLSurface /*surface*/, - const EGLint* /*attrib_list*/) +EGLBoolean eglLockSurfaceKHR(EGLDisplay dpy, EGLSurface surface, + const EGLint *attrib_list) { EGLBoolean result = EGL_FALSE; return result; } -EGLBoolean eglUnlockSurfaceKHR(EGLDisplay /*dpy*/, EGLSurface /*surface*/) +EGLBoolean eglUnlockSurfaceKHR(EGLDisplay dpy, EGLSurface surface) { EGLBoolean result = EGL_FALSE; return result; } EGLImageKHR eglCreateImageKHR(EGLDisplay dpy, EGLContext ctx, EGLenum target, - EGLClientBuffer buffer, const EGLint* /*attrib_list*/) + EGLClientBuffer buffer, const EGLint *attrib_list) { if (egl_display_t::is_valid(dpy) == EGL_FALSE) { return setError(EGL_BAD_DISPLAY, EGL_NO_IMAGE_KHR); @@ -2078,6 +2048,8 @@ case HAL_PIXEL_FORMAT_RGB_888: case HAL_PIXEL_FORMAT_RGB_565: case HAL_PIXEL_FORMAT_BGRA_8888: + case HAL_PIXEL_FORMAT_RGBA_5551: + case HAL_PIXEL_FORMAT_RGBA_4444: break; default: return setError(EGL_BAD_PARAMETER, EGL_NO_IMAGE_KHR); @@ -2133,7 +2105,7 @@ return FENCE_SYNC_HANDLE; } -EGLBoolean eglDestroySyncKHR(EGLDisplay /*dpy*/, EGLSyncKHR sync) +EGLBoolean eglDestroySyncKHR(EGLDisplay dpy, EGLSyncKHR sync) { if (sync != FENCE_SYNC_HANDLE) { return setError(EGL_BAD_PARAMETER, EGL_FALSE); @@ -2142,8 +2114,8 @@ return EGL_TRUE; } -EGLint eglClientWaitSyncKHR(EGLDisplay /*dpy*/, EGLSyncKHR sync, EGLint /*flags*/, - EGLTimeKHR /*timeout*/) +EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, + EGLTimeKHR timeout) { if (sync != FENCE_SYNC_HANDLE) { return setError(EGL_BAD_PARAMETER, EGL_FALSE); @@ -2152,7 +2124,7 @@ return EGL_CONDITION_SATISFIED_KHR; } -EGLBoolean eglGetSyncAttribKHR(EGLDisplay /*dpy*/, EGLSyncKHR sync, +EGLBoolean eglGetSyncAttribKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint attribute, EGLint *value) { if (sync != FENCE_SYNC_HANDLE) { @@ -2195,3 +2167,18 @@ return EGL_TRUE; } + +EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw) +{ + if (egl_display_t::is_valid(dpy) == EGL_FALSE) + return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0); + + egl_surface_t* d = static_cast(draw); + if (!d->isValid()) + return setError(EGL_BAD_SURFACE, (EGLClientBuffer)0); + if (d->dpy != dpy) + return setError(EGL_BAD_DISPLAY, (EGLClientBuffer)0); + + // post the surface + return d->getRenderBuffer(); +} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/fixed_asm.S android-platform-frameworks-native-21/opengl/libagl/fixed_asm.S --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/fixed_asm.S 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/fixed_asm.S 2012-10-16 22:57:11.000000000 +0000 @@ -17,7 +17,7 @@ .text - .align 2 + .align .global gglFloatToFixed .type gglFloatToFixed, %function diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/fp.cpp android-platform-frameworks-native-21/opengl/libagl/fp.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/fp.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/fp.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,7 @@ // ---------------------------------------------------------------------------- -#if !(defined(__arm__) || (defined(__mips__) && !defined(__LP64__) && __mips_isa_rev < 6)) +#if !defined(__arm__) GGLfixed gglFloatToFixed(float v) { return GGLfixed(floorf(v * 65536.0f + 0.5f)); } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/iterators.S android-platform-frameworks-native-21/opengl/libagl/iterators.S --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/iterators.S 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/iterators.S 2012-10-16 22:57:11.000000000 +0000 @@ -17,7 +17,7 @@ .text - .align 2 + .align .arm .global iterators0032 diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/light.cpp android-platform-frameworks-native-21/opengl/libagl/light.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/light.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/light.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -105,7 +105,7 @@ c->lighting.shadeModel = GL_SMOOTH; } -void ogles_uninit_light(ogles_context_t* /*c*/) +void ogles_uninit_light(ogles_context_t* c) { } @@ -285,7 +285,7 @@ invalidate_lighting(c); } -void lightVertexNop(ogles_context_t*, vertex_t* /*v*/) +void lightVertexNop(ogles_context_t*, vertex_t* v) { // we should never end-up here } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/matrix.h android-platform-frameworks-native-21/opengl/libagl/matrix.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/matrix.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/matrix.h 2012-10-16 22:57:11.000000000 +0000 @@ -74,30 +74,6 @@ ); return r; -#elif defined(__mips__) && !defined(__LP64__) && __mips_isa_rev < 6 - - GLfixed res; - int32_t t1,t2,t3; - asm( - "mult %[a], %[a] \r\n" - "li %[res],0x8000 \r\n" - "madd %[b],%[b] \r\n" - "move %[t3],$zero \r\n" - "madd %[c],%[c] \r\n" - "mflo %[t1]\r\n" - "mfhi %[t2]\r\n" - "addu %[t1],%[res],%[t1]\r\n" /*add 0x8000*/ - "sltu %[t3],%[t1],%[res]\r\n" - "addu %[t2],%[t2],%[t3]\r\n" - "srl %[res],%[t1],16\r\n" - "sll %[t2],%[t2],16\r\n" - "or %[res],%[res],%[t2]\r\n" - : [res]"=&r"(res),[t1]"=&r"(t1),[t2]"=&r"(t2),[t3]"=&r"(t3) - : [a] "r" (a),[b] "r" (b),[c] "r" (c) - : "%hi","%lo" - ); - return res; - #else return (( int64_t(a)*a + @@ -160,26 +136,6 @@ ); return r; -#elif defined(__mips__) && !defined(__LP64__) && __mips_isa_rev < 6 - - GLfixed res; - int32_t t1,t2; - asm( - "mult %[a0],%[b0] \r\n" - "madd %[a1],%[b1] \r\n" - "madd %[a2],%[b2] \r\n" - "mflo %[t2]\r\n" - "mfhi %[t1]\r\n" - "srl %[t2],%[t2],16\r\n" - "sll %[t1],%[t1],16\r\n" - "or %[t2],%[t2],%[t1]\r\n" - "addu %[res],%[t2],%[c]" - : [res]"=&r"(res),[t1]"=&r"(t1),[t2]"=&r"(t2) - : [a0] "r" (a0),[b0] "r" (b0),[a1] "r" (a1),[b1] "r" (b1),[a2] "r" (a2),[b2] "r" (b2),[c] "r" (c) - : "%hi","%lo" - ); - return res; - #else return (( int64_t(a0)*b0 + diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/primitives.cpp android-platform-frameworks-native-21/opengl/libagl/primitives.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/primitives.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/primitives.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -94,7 +94,7 @@ } static void lightTriangleDarkFlat(ogles_context_t* c, - vertex_t* /*v0*/, vertex_t* /*v1*/, vertex_t* v2) + vertex_t* v0, vertex_t* v1, vertex_t* v2) { if (!(v2->flags & vertex_t::LIT)) { v2->flags |= vertex_t::LIT; @@ -118,7 +118,7 @@ } static void lightTriangleFlat(ogles_context_t* c, - vertex_t* /*v0*/, vertex_t* /*v1*/, vertex_t* v2) + vertex_t* v0, vertex_t* v1, vertex_t* v2) { if (!(v2->flags & vertex_t::LIT)) c->lighting.lightVertex(c, v2); @@ -567,8 +567,8 @@ #pragma mark Triangle #endif -void primitive_nop_triangle(ogles_context_t* /*c*/, - vertex_t* /*v0*/, vertex_t* /*v1*/, vertex_t* /*v2*/) { +void primitive_nop_triangle(ogles_context_t* c, + vertex_t* v0, vertex_t* v1, vertex_t* v2) { } void primitive_clip_triangle(ogles_context_t* c, @@ -823,7 +823,7 @@ static inline -bool cull_triangle(ogles_context_t* c, vertex_t* /*v0*/, vertex_t* /*v1*/, vertex_t* /*v2*/) +bool cull_triangle(ogles_context_t* c, vertex_t* v0, vertex_t* v1, vertex_t* v2) { if (ggl_likely(c->cull.enable)) { const GLenum winding = (c->lerp.area() > 0) ? GL_CW : GL_CCW; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/state.cpp android-platform-frameworks-native-21/opengl/libagl/state.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/state.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/state.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -219,11 +219,11 @@ #endif // These ones are super-easy, we're not supporting those features! -void glSampleCoverage(GLclampf /*value*/, GLboolean /*invert*/) { +void glSampleCoverage(GLclampf value, GLboolean invert) { } -void glSampleCoveragex(GLclampx /*value*/, GLboolean /*invert*/) { +void glSampleCoveragex(GLclampx value, GLboolean invert) { } -void glStencilFunc(GLenum func, GLint /*ref*/, GLuint /*mask*/) { +void glStencilFunc(GLenum func, GLint ref, GLuint mask) { ogles_context_t* c = ogles_context_t::get(); if (func < GL_NEVER || func > GL_ALWAYS) { ogles_error(c, GL_INVALID_ENUM); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/texture.cpp android-platform-frameworks-native-21/opengl/libagl/texture.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/texture.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/texture.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1223,10 +1223,10 @@ // ---------------------------------------------------------------------------- void glCompressedTexSubImage2D( - GLenum /*target*/, GLint /*level*/, GLint /*xoffset*/, - GLint /*yoffset*/, GLsizei /*width*/, GLsizei /*height*/, - GLenum /*format*/, GLsizei /*imageSize*/, - const GLvoid* /*data*/) + GLenum target, GLint level, GLint xoffset, + GLint yoffset, GLsizei width, GLsizei height, + GLenum format, GLsizei imageSize, + const GLvoid *data) { ogles_context_t* c = ogles_context_t::get(); ogles_error(c, GL_INVALID_ENUM); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libagl/Tokenizer.cpp android-platform-frameworks-native-21/opengl/libagl/Tokenizer.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libagl/Tokenizer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libagl/Tokenizer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -163,9 +163,9 @@ { const run_t* ranges = mRanges.array(); const size_t c = mRanges.size(); - ALOGD("Tokenizer (%p, size = %zu)\n", this, c); + ALOGD("Tokenizer (%p, size = %u)\n", this, c); for (size_t i=0 ; icurrentNormal.z = 0x10000; } -void ogles_uninit_vertex(ogles_context_t* /*c*/) +void ogles_uninit_vertex(ogles_context_t* c) { } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/Android.mk android-platform-frameworks-native-21/opengl/libs/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -4,20 +4,6 @@ # Build META EGL library # -egl.cfg_config_module := -# OpenGL drivers config file -ifneq ($(BOARD_EGL_CFG),) - -include $(CLEAR_VARS) -LOCAL_MODULE := egl.cfg -LOCAL_MODULE_TAGS := optional -LOCAL_MODULE_CLASS := ETC -LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl -LOCAL_SRC_FILES := ../../../../$(BOARD_EGL_CFG) -include $(BUILD_PREBUILT) -egl.cfg_config_module := $(LOCAL_MODULE) -endif - include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ @@ -32,10 +18,16 @@ EGL/Loader.cpp \ # -LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libGLES_trace +LOCAL_SHARED_LIBRARIES += libcutils libutils libGLES_trace +LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libEGL LOCAL_LDFLAGS += -Wl,--exclude-libs=ALL LOCAL_SHARED_LIBRARIES += libdl +# Bionic's private TLS header relies on the ARCH_ARM_HAVE_TLS_REGISTER to +# select the appropriate TLS codepath +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif # we need to access the private Bionic header LOCAL_C_INCLUDES += bionic/libc/private @@ -47,22 +39,46 @@ ifeq ($(BOARD_ALLOW_EGL_HIBERNATION),true) LOCAL_CFLAGS += -DBOARD_ALLOW_EGL_HIBERNATION endif -ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),) - LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE) + +ifeq ($(TARGET_BOARD_PLATFORM),msm7k) + LOCAL_CFLAGS += -DADRENO130=1 endif -ifneq ($(MAX_EGL_CACHE_KEY_SIZE),) - LOCAL_CFLAGS += -DMAX_EGL_CACHE_KEY_SIZE=$(MAX_EGL_CACHE_KEY_SIZE) +ifeq ($(TARGET_BOARD_PLATFORM), s5pc110) + # see Loader.cpp for details + LOCAL_CFLAGS += -DSYSTEMUI_PBSIZE_HACK=1 +endif + +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif + +ifneq ($(MAX_EGL_CACHE_ENTRY_SIZE),) + LOCAL_CFLAGS += -DMAX_EGL_CACHE_ENTRY_SIZE=$(MAX_EGL_CACHE_ENTRY_SIZE) endif ifneq ($(MAX_EGL_CACHE_SIZE),) LOCAL_CFLAGS += -DMAX_EGL_CACHE_SIZE=$(MAX_EGL_CACHE_SIZE) endif -LOCAL_REQUIRED_MODULES := $(egl.cfg_config_module) -egl.cfg_config_module := - include $(BUILD_SHARED_LIBRARY) +installed_libEGL := $(LOCAL_INSTALLED_MODULE) + +# OpenGL drivers config file +ifneq ($(BOARD_EGL_CFG),) + +include $(CLEAR_VARS) +LOCAL_MODULE := egl.cfg +LOCAL_MODULE_TAGS := optional +LOCAL_MODULE_CLASS := ETC +LOCAL_MODULE_PATH := $(TARGET_OUT)/lib/egl +LOCAL_SRC_FILES := ../../../../$(BOARD_EGL_CFG) +include $(BUILD_PREBUILT) + +# make sure we depend on egl.cfg, so it gets installed +$(installed_libEGL): | egl.cfg + +endif ############################################################################### # Build the wrapper OpenGL ES 1.x library @@ -74,20 +90,24 @@ GLES_CM/gl.cpp.arm \ # -LOCAL_CLANG := false -LOCAL_SHARED_LIBRARIES += libcutils liblog libEGL +LOCAL_SHARED_LIBRARIES += libcutils libEGL +LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libGLESv1_CM LOCAL_SHARED_LIBRARIES += libdl # we need to access the private Bionic header +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif LOCAL_C_INCLUDES += bionic/libc/private LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv1\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -fvisibility=hidden -# TODO: This is to work around b/20093774. Remove after root cause is fixed -LOCAL_LDFLAGS_arm += -Wl,--hash-style,both +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif include $(BUILD_SHARED_LIBRARY) @@ -102,29 +122,24 @@ GLES2/gl2.cpp.arm \ # -LOCAL_CLANG := false -LOCAL_SHARED_LIBRARIES += libcutils libutils liblog libEGL +LOCAL_SHARED_LIBRARIES += libcutils libEGL +LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libGLESv2 LOCAL_SHARED_LIBRARIES += libdl # we need to access the private Bionic header +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif LOCAL_C_INCLUDES += bionic/libc/private LOCAL_CFLAGS += -DLOG_TAG=\"libGLESv2\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES LOCAL_CFLAGS += -fvisibility=hidden -# TODO: This is to work around b/20093774. Remove after root cause is fixed -LOCAL_LDFLAGS_arm += -Wl,--hash-style,both - -# Symlink libGLESv3.so -> libGLESv2.so -# Platform modules should link against libGLESv2.so (-lGLESv2), but NDK apps -# will be linked against libGLESv3.so. -# Note we defer the evaluation of the LOCAL_POST_INSTALL_CMD, -# so $(LOCAL_INSTALLED_MODULE) will be expanded to correct value, -# even for both 32-bit and 64-bit installed files in multilib build. -LOCAL_POST_INSTALL_CMD = \ - $(hide) ln -sf $(notdir $(LOCAL_INSTALLED_MODULE)) $(dir $(LOCAL_INSTALLED_MODULE))libGLESv3.so +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif include $(BUILD_SHARED_LIBRARY) @@ -138,6 +153,7 @@ ETC1/etc1.cpp \ # +LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libETC1 include $(BUILD_HOST_STATIC_LIBRARY) @@ -152,6 +168,7 @@ ETC1/etc1.cpp \ # +LOCAL_LDLIBS := -lpthread -ldl LOCAL_MODULE:= libETC1 include $(BUILD_SHARED_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/debug.in android-platform-frameworks-native-21/opengl/libs/debug.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/debug.in 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/debug.in 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,235 @@ +// the following functions are not defined in GLESv2_dbg +TRACE_GL_VOID(glAlphaFunc, (GLenum func, GLclampf ref), (func, ref), 2, "GLenum", func, "GLclampf", ref) +TRACE_GL_VOID(glAlphaFuncx, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref) +TRACE_GL_VOID(glAlphaFuncxOES, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref) +TRACE_GL_VOID(glBeginPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor) +TRACE_GL_VOID(glBindFramebufferOES, (GLenum target, GLuint framebuffer), (target, framebuffer), 2, "GLenum", target, "GLuint", framebuffer) +TRACE_GL_VOID(glBindRenderbufferOES, (GLenum target, GLuint renderbuffer), (target, renderbuffer), 2, "GLenum", target, "GLuint", renderbuffer) +TRACE_GL_VOID(glBindVertexArrayOES, (GLuint array), (array), 1, "GLuint", array) +TRACE_GL_VOID(glBlendEquationOES, (GLenum mode), (mode), 1, "GLenum", mode) +TRACE_GL_VOID(glBlendEquationSeparateOES, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha), 2, "GLenum", modeRGB, "GLenum", modeAlpha) +TRACE_GL_VOID(glBlendFuncSeparateOES, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha), 4, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha) +TRACE_GL(GLenum, glCheckFramebufferStatusOES, (GLenum target), (target), 1, "GLenum", target) +TRACE_GL_VOID(glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha) +TRACE_GL_VOID(glClearColorxOES, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha) +TRACE_GL_VOID(glClearDepthfOES, (GLclampf depth), (depth), 1, "GLclampf", depth) +TRACE_GL_VOID(glClearDepthx, (GLclampx depth), (depth), 1, "GLclampx", depth) +TRACE_GL_VOID(glClearDepthxOES, (GLclampx depth), (depth), 1, "GLclampx", depth) +TRACE_GL_VOID(glClientActiveTexture, (GLenum texture), (texture), 1, "GLenum", texture) +TRACE_GL_VOID(glClipPlanef, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation) +TRACE_GL_VOID(glClipPlanefIMG, (GLenum p, const GLfloat *eqn), (p, eqn), 2, "GLenum", p, "const GLfloat *", eqn) +TRACE_GL_VOID(glClipPlanefOES, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation) +TRACE_GL_VOID(glClipPlanex, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation) +TRACE_GL_VOID(glClipPlanexIMG, (GLenum p, const GLfixed *eqn), (p, eqn), 2, "GLenum", p, "const GLfixed *", eqn) +TRACE_GL_VOID(glClipPlanexOES, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation) +TRACE_GL_VOID(glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha), 4, "GLfloat", red, "GLfloat", green, "GLfloat", blue, "GLfloat", alpha) +TRACE_GL_VOID(glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha), 4, "GLubyte", red, "GLubyte", green, "GLubyte", blue, "GLubyte", alpha) +TRACE_GL_VOID(glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha) +TRACE_GL_VOID(glColor4xOES, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha) +TRACE_GL_VOID(glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data), (target, level, internalformat, width, height, depth, border, imageSize, data), 9, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLsizei", imageSize, "const GLvoid*", data) +TRACE_GL_VOID(glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLsizei", imageSize, "const GLvoid*", data) +TRACE_GL_VOID(glCopyTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, zoffset, x, y, width, height), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) +TRACE_GL_VOID(glCoverageMaskNV, (GLboolean mask), (mask), 1, "GLboolean", mask) +TRACE_GL_VOID(glCoverageOperationNV, (GLenum operation), (operation), 1, "GLenum", operation) +TRACE_GL_VOID(glCurrentPaletteMatrixOES, (GLuint matrixpaletteindex), (matrixpaletteindex), 1, "GLuint", matrixpaletteindex) +TRACE_GL_VOID(glDeleteFencesNV, (GLsizei n, const GLuint *fences), (n, fences), 2, "GLsizei", n, "const GLuint *", fences) +TRACE_GL_VOID(glDeleteFramebuffersOES, (GLsizei n, const GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint*", framebuffers) +TRACE_GL_VOID(glDeletePerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors) +TRACE_GL_VOID(glDeleteRenderbuffersOES, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint*", renderbuffers) +TRACE_GL_VOID(glDeleteVertexArraysOES, (GLsizei n, const GLuint *arrays), (n, arrays), 2, "GLsizei", n, "const GLuint *", arrays) +TRACE_GL_VOID(glDepthRangefOES, (GLclampf zNear, GLclampf zFar), (zNear, zFar), 2, "GLclampf", zNear, "GLclampf", zFar) +TRACE_GL_VOID(glDepthRangex, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar) +TRACE_GL_VOID(glDepthRangexOES, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar) +TRACE_GL_VOID(glDisableClientState, (GLenum array), (array), 1, "GLenum", array) +TRACE_GL_VOID(glDisableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl) +TRACE_GL_VOID(glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum *attachments), (target, numAttachments, attachments), 3, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments) +TRACE_GL_VOID(glDrawTexfOES, (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), (x, y, z, width, height), 5, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", width, "GLfloat", height) +TRACE_GL_VOID(glDrawTexfvOES, (const GLfloat *coords), (coords), 1, "const GLfloat *", coords) +TRACE_GL_VOID(glDrawTexiOES, (GLint x, GLint y, GLint z, GLint width, GLint height), (x, y, z, width, height), 5, "GLint", x, "GLint", y, "GLint", z, "GLint", width, "GLint", height) +TRACE_GL_VOID(glDrawTexivOES, (const GLint *coords), (coords), 1, "const GLint *", coords) +TRACE_GL_VOID(glDrawTexsOES, (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), (x, y, z, width, height), 5, "GLshort", x, "GLshort", y, "GLshort", z, "GLshort", width, "GLshort", height) +TRACE_GL_VOID(glDrawTexsvOES, (const GLshort *coords), (coords), 1, "const GLshort *", coords) +TRACE_GL_VOID(glDrawTexxOES, (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), (x, y, z, width, height), 5, "GLfixed", x, "GLfixed", y, "GLfixed", z, "GLfixed", width, "GLfixed", height) +TRACE_GL_VOID(glDrawTexxvOES, (const GLfixed *coords), (coords), 1, "const GLfixed *", coords) +TRACE_GL_VOID(glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image) +TRACE_GL_VOID(glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image) +TRACE_GL_VOID(glEnableClientState, (GLenum array), (array), 1, "GLenum", array) +TRACE_GL_VOID(glEnableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl) +TRACE_GL_VOID(glEndPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor) +TRACE_GL_VOID(glEndTilingQCOM, (GLbitfield preserveMask), (preserveMask), 1, "GLbitfield", preserveMask) +TRACE_GL_VOID(glExtGetBufferPointervQCOM, (GLenum target, GLvoid **params), (target, params), 2, "GLenum", target, "GLvoid **", params) +TRACE_GL_VOID(glExtGetBuffersQCOM, (GLuint *buffers, GLint maxBuffers, GLint *numBuffers), (buffers, maxBuffers, numBuffers), 3, "GLuint *", buffers, "GLint", maxBuffers, "GLint *", numBuffers) +TRACE_GL_VOID(glExtGetFramebuffersQCOM, (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers), (framebuffers, maxFramebuffers, numFramebuffers), 3, "GLuint *", framebuffers, "GLint", maxFramebuffers, "GLint *", numFramebuffers) +TRACE_GL_VOID(glExtGetProgramBinarySourceQCOM, (GLuint program, GLenum shadertype, GLchar *source, GLint *length), (program, shadertype, source, length), 4, "GLuint", program, "GLenum", shadertype, "GLchar *", source, "GLint *", length) +TRACE_GL_VOID(glExtGetProgramsQCOM, (GLuint *programs, GLint maxPrograms, GLint *numPrograms), (programs, maxPrograms, numPrograms), 3, "GLuint *", programs, "GLint", maxPrograms, "GLint *", numPrograms) +TRACE_GL_VOID(glExtGetRenderbuffersQCOM, (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers), (renderbuffers, maxRenderbuffers, numRenderbuffers), 3, "GLuint *", renderbuffers, "GLint", maxRenderbuffers, "GLint *", numRenderbuffers) +TRACE_GL_VOID(glExtGetShadersQCOM, (GLuint *shaders, GLint maxShaders, GLint *numShaders), (shaders, maxShaders, numShaders), 3, "GLuint *", shaders, "GLint", maxShaders, "GLint *", numShaders) +TRACE_GL_VOID(glExtGetTexLevelParameterivQCOM, (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params), (texture, face, level, pname, params), 5, "GLuint", texture, "GLenum", face, "GLint", level, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glExtGetTexSubImageQCOM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "GLvoid *", texels) +TRACE_GL_VOID(glExtGetTexturesQCOM, (GLuint *textures, GLint maxTextures, GLint *numTextures), (textures, maxTextures, numTextures), 3, "GLuint *", textures, "GLint", maxTextures, "GLint *", numTextures) +TRACE_GL(GLboolean, glExtIsProgramBinaryQCOM, (GLuint program), (program), 1, "GLuint", program) +TRACE_GL_VOID(glExtTexObjectStateOverrideiQCOM, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param) +TRACE_GL_VOID(glFinishFenceNV, (GLuint fence), (fence), 1, "GLuint", fence) +TRACE_GL_VOID(glFogf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glFogfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glFogx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glFogxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glFogxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glFogxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glFramebufferRenderbufferOES, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer), 4, "GLenum", target, "GLenum", attachment, "GLenum", renderbuffertarget, "GLuint", renderbuffer) +TRACE_GL_VOID(glFramebufferTexture2DMultisampleIMG, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples), (target, attachment, textarget, texture, level, samples), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLsizei", samples) +TRACE_GL_VOID(glFramebufferTexture2DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level), 5, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level) +TRACE_GL_VOID(glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset), (target, attachment, textarget, texture, level, zoffset), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLint", zoffset) +TRACE_GL_VOID(glFrustumf, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glFrustumfOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glFrustumxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glGenFencesNV, (GLsizei n, GLuint *fences), (n, fences), 2, "GLsizei", n, "GLuint *", fences) +TRACE_GL_VOID(glGenFramebuffersOES, (GLsizei n, GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint*", framebuffers) +TRACE_GL_VOID(glGenPerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors) +TRACE_GL_VOID(glGenRenderbuffersOES, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint*", renderbuffers) +TRACE_GL_VOID(glGenVertexArraysOES, (GLsizei n, GLuint *arrays), (n, arrays), 2, "GLsizei", n, "GLuint *", arrays) +TRACE_GL_VOID(glGenerateMipmapOES, (GLenum target), (target), 1, "GLenum", target) +TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params) +TRACE_GL_VOID(glGetClipPlanef, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn) +TRACE_GL_VOID(glGetClipPlanefOES, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn) +TRACE_GL_VOID(glGetClipPlanex, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn) +TRACE_GL_VOID(glGetClipPlanexOES, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn) +TRACE_GL_VOID(glGetDriverControlStringQCOM, (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString), (driverControl, bufSize, length, driverControlString), 4, "GLuint", driverControl, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", driverControlString) +TRACE_GL_VOID(glGetDriverControlsQCOM, (GLint *num, GLsizei size, GLuint *driverControls), (num, size, driverControls), 3, "GLint *", num, "GLsizei", size, "GLuint *", driverControls) +TRACE_GL_VOID(glGetFenceivNV, (GLuint fence, GLenum pname, GLint *params), (fence, pname, params), 3, "GLuint", fence, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetFixedv, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetFixedvOES, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetFramebufferAttachmentParameterivOES, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetLightfv, (GLenum light, GLenum pname, GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetLightxv, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetLightxvOES, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetMaterialxv, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetMaterialxvOES, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetPerfMonitorCounterDataAMD, (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten), (monitor, pname, dataSize, data, bytesWritten), 5, "GLuint", monitor, "GLenum", pname, "GLsizei", dataSize, "GLuint *", data, "GLint *", bytesWritten) +TRACE_GL_VOID(glGetPerfMonitorCounterInfoAMD, (GLuint group, GLuint counter, GLenum pname, GLvoid *data), (group, counter, pname, data), 4, "GLuint", group, "GLuint", counter, "GLenum", pname, "GLvoid *", data) +TRACE_GL_VOID(glGetPerfMonitorCounterStringAMD, (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString), (group, counter, bufSize, length, counterString), 5, "GLuint", group, "GLuint", counter, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", counterString) +TRACE_GL_VOID(glGetPerfMonitorCountersAMD, (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters), (group, numCounters, maxActiveCounters, counterSize, counters), 5, "GLuint", group, "GLint *", numCounters, "GLint *", maxActiveCounters, "GLsizei", counterSize, "GLuint *", counters) +TRACE_GL_VOID(glGetPerfMonitorGroupStringAMD, (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString), (group, bufSize, length, groupString), 4, "GLuint", group, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", groupString) +TRACE_GL_VOID(glGetPerfMonitorGroupsAMD, (GLint *numGroups, GLsizei groupsSize, GLuint *groups), (numGroups, groupsSize, groups), 3, "GLint *", numGroups, "GLsizei", groupsSize, "GLuint *", groups) +TRACE_GL_VOID(glGetPointerv, (GLenum pname, GLvoid **params), (pname, params), 2, "GLenum", pname, "GLvoid **", params) +TRACE_GL_VOID(glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary), (program, bufSize, length, binaryFormat, binary), 5, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLenum *", binaryFormat, "GLvoid *", binary) +TRACE_GL_VOID(glGetRenderbufferParameterivOES, (GLenum target, GLenum pname, GLint* params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetTexEnvfv, (GLenum env, GLenum pname, GLfloat *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetTexEnviv, (GLenum env, GLenum pname, GLint *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetTexEnvxv, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexEnvxvOES, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexGenfvOES, (GLenum coord, GLenum pname, GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetTexGenivOES, (GLenum coord, GLenum pname, GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetTexGenxvOES, (GLenum coord, GLenum pname, GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) +TRACE_GL(GLboolean, glIsFenceNV, (GLuint fence), (fence), 1, "GLuint", fence) +TRACE_GL(GLboolean, glIsFramebufferOES, (GLuint framebuffer), (framebuffer), 1, "GLuint", framebuffer) +TRACE_GL(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer), (renderbuffer), 1, "GLuint", renderbuffer) +TRACE_GL(GLboolean, glIsVertexArrayOES, (GLuint array), (array), 1, "GLuint", array) +TRACE_GL_VOID(glLightModelf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glLightModelfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glLightModelx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glLightModelxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glLightModelxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLightModelxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLightf, (GLenum light, GLenum pname, GLfloat param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glLightfv, (GLenum light, GLenum pname, const GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glLightx, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glLightxOES, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glLightxv, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLightxvOES, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLineWidthx, (GLfixed width), (width), 1, "GLfixed", width) +TRACE_GL_VOID(glLineWidthxOES, (GLfixed width), (width), 1, "GLfixed", width) +TRACE_GL_VOID(glLoadIdentity, (void), (), 0) +TRACE_GL_VOID(glLoadMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m) +TRACE_GL_VOID(glLoadMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glLoadMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glLoadPaletteFromModelViewMatrixOES, (void), (), 0) +TRACE_GL_VOID(glLogicOp, (GLenum opcode), (opcode), 1, "GLenum", opcode) +TRACE_GL(void*, glMapBufferOES, (GLenum target, GLenum access), (target, access), 2, "GLenum", target, "GLenum", access) +TRACE_GL_VOID(glMaterialf, (GLenum face, GLenum pname, GLfloat param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glMaterialx, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glMaterialxOES, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glMaterialxvOES, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glMatrixIndexPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glMatrixMode, (GLenum mode), (mode), 1, "GLenum", mode) +TRACE_GL_VOID(glMultMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m) +TRACE_GL_VOID(glMultMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glMultMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glMultiDrawArraysEXT, (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "GLint *", first, "GLsizei *", count, "GLsizei", primcount) +TRACE_GL_VOID(glMultiDrawElementsEXT, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "const GLsizei *", count, "GLenum", type, "const GLvoid* *", indices, "GLsizei", primcount) +TRACE_GL_VOID(glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), (target, s, t, r, q), 5, "GLenum", target, "GLfloat", s, "GLfloat", t, "GLfloat", r, "GLfloat", q) +TRACE_GL_VOID(glMultiTexCoord4x, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q) +TRACE_GL_VOID(glMultiTexCoord4xOES, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q) +TRACE_GL_VOID(glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz), 3, "GLfloat", nx, "GLfloat", ny, "GLfloat", nz) +TRACE_GL_VOID(glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz) +TRACE_GL_VOID(glNormal3xOES, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz) +TRACE_GL_VOID(glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glOrthofOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glOrthox, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glOrthoxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glPointParameterf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glPointParameterfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glPointParameterx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glPointParameterxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glPointParameterxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glPointParameterxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glPointSize, (GLfloat size), (size), 1, "GLfloat", size) +TRACE_GL_VOID(glPointSizePointerOES, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glPointSizex, (GLfixed size), (size), 1, "GLfixed", size) +TRACE_GL_VOID(glPointSizexOES, (GLfixed size), (size), 1, "GLfixed", size) +TRACE_GL_VOID(glPolygonOffsetx, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units) +TRACE_GL_VOID(glPolygonOffsetxOES, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units) +TRACE_GL_VOID(glPopMatrix, (void), (), 0) +TRACE_GL_VOID(glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length), (program, binaryFormat, binary, length), 4, "GLuint", program, "GLenum", binaryFormat, "const GLvoid *", binary, "GLint", length) +TRACE_GL_VOID(glPushMatrix, (void), (), 0) +TRACE_GL(GLbitfield, glQueryMatrixxOES, (GLfixed mantissa[16], GLint exponent[16]), (mantissa, exponent), 2, "GLfixed", mantissa, "GLint", exponent) +TRACE_GL_VOID(glRenderbufferStorageMultisampleIMG, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) +TRACE_GL_VOID(glRenderbufferStorageOES, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height), 4, "GLenum", target, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) +TRACE_GL_VOID(glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z), 4, "GLfloat", angle, "GLfloat", x, "GLfloat", y, "GLfloat", z) +TRACE_GL_VOID(glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z) +TRACE_GL_VOID(glRotatexOES, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z) +TRACE_GL_VOID(glSampleCoveragex, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert) +TRACE_GL_VOID(glSampleCoveragexOES, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert) +TRACE_GL_VOID(glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z) +TRACE_GL_VOID(glScalex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) +TRACE_GL_VOID(glScalexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) +TRACE_GL_VOID(glSelectPerfMonitorCountersAMD, (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList), (monitor, enable, group, numCounters, countersList), 5, "GLuint", monitor, "GLboolean", enable, "GLuint", group, "GLint", numCounters, "GLuint *", countersList) +TRACE_GL_VOID(glSetFenceNV, (GLuint fence, GLenum condition), (fence, condition), 2, "GLuint", fence, "GLenum", condition) +TRACE_GL_VOID(glShadeModel, (GLenum mode), (mode), 1, "GLenum", mode) +TRACE_GL_VOID(glStartTilingQCOM, (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask), (x, y, width, height, preserveMask), 5, "GLuint", x, "GLuint", y, "GLuint", width, "GLuint", height, "GLbitfield", preserveMask) +TRACE_GL(GLboolean, glTestFenceNV, (GLuint fence), (fence), 1, "GLuint", fence) +TRACE_GL_VOID(glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param) +TRACE_GL_VOID(glTexEnviv, (GLenum target, GLenum pname, const GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params) +TRACE_GL_VOID(glTexEnvx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glTexEnvxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glTexEnvxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexEnvxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexGenfOES, (GLenum coord, GLenum pname, GLfloat param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfloat", param) +TRACE_GL_VOID(glTexGenfvOES, (GLenum coord, GLenum pname, const GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glTexGeniOES, (GLenum coord, GLenum pname, GLint param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLint", param) +TRACE_GL_VOID(glTexGenivOES, (GLenum coord, GLenum pname, const GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLint *", params) +TRACE_GL_VOID(glTexGenxOES, (GLenum coord, GLenum pname, GLfixed param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glTexGenxvOES, (GLenum coord, GLenum pname, const GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels), (target, level, internalformat, width, height, depth, border, format, type, pixels), 10, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLenum", format, "GLenum", type, "const GLvoid*", pixels) +TRACE_GL_VOID(glTexParameterx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glTexParameterxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) +TRACE_GL_VOID(glTexParameterxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexParameterxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "const GLvoid*", pixels) +TRACE_GL_VOID(glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z) +TRACE_GL_VOID(glTranslatex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) +TRACE_GL_VOID(glTranslatexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) +TRACE_GL(GLboolean, glUnmapBufferOES, (GLenum target), (target), 1, "GLenum", target) +TRACE_GL_VOID(glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glWeightPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/eglApi.cpp android-platform-frameworks-native-21/opengl/libs/EGL/eglApi.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/eglApi.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/eglApi.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,22 +1,21 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ #define ATRACE_TAG ATRACE_TAG_GRAPHICS -#include #include #include #include @@ -26,6 +25,8 @@ #include #include +#include +#include #include #include @@ -38,179 +39,45 @@ #include #include -#include "../egl_impl.h" -#include "../glestrace.h" -#include "../hooks.h" +#include "egl_impl.h" +#include "egl_tls.h" +#include "glestrace.h" +#include "hooks.h" #include "egl_display.h" +#include "egl_impl.h" #include "egl_object.h" #include "egl_tls.h" #include "egldefs.h" using namespace android; -// This extension has not been ratified yet, so can't be shipped. -// Implementation is incomplete and untested. -#define ENABLE_EGL_KHR_GL_COLORSPACE 0 - // ---------------------------------------------------------------------------- -namespace android { +#define EGL_VERSION_HW_ANDROID 0x3143 struct extention_map_t { const char* name; __eglMustCastToProperFunctionPointerType address; }; -/* - * This is the list of EGL extensions exposed to applications. - * - * Some of them (gBuiltinExtensionString) are implemented entirely in this EGL - * wrapper and are always available. - * - * The rest (gExtensionString) depend on support in the EGL driver, and are - * only available if the driver supports them. However, some of these must be - * supported because they are used by the Android system itself; these are - * listd as mandatory below and are required by the CDD. The system *assumes* - * the mandatory extensions are present and may not function properly if some - * are missing. - * - * NOTE: Both strings MUST have a single space as the last character. - */ -extern char const * const gBuiltinExtensionString = - "EGL_KHR_get_all_proc_addresses " - "EGL_ANDROID_presentation_time " - "EGL_KHR_swap_buffers_with_damage " - ; -extern char const * const gExtensionString = - "EGL_KHR_image " // mandatory - "EGL_KHR_image_base " // mandatory - "EGL_KHR_image_pixmap " - "EGL_KHR_lock_surface " -#if (ENABLE_EGL_KHR_GL_COLORSPACE != 0) - "EGL_KHR_gl_colorspace " -#endif - "EGL_KHR_gl_texture_2D_image " - "EGL_KHR_gl_texture_3D_image " - "EGL_KHR_gl_texture_cubemap_image " - "EGL_KHR_gl_renderbuffer_image " - "EGL_KHR_reusable_sync " - "EGL_KHR_fence_sync " - "EGL_KHR_create_context " - "EGL_KHR_config_attribs " - "EGL_KHR_surfaceless_context " - "EGL_KHR_stream " - "EGL_KHR_stream_fifo " - "EGL_KHR_stream_producer_eglsurface " - "EGL_KHR_stream_consumer_gltexture " - "EGL_KHR_stream_cross_process_fd " - "EGL_EXT_create_context_robustness " - "EGL_NV_system_time " - "EGL_ANDROID_image_native_buffer " // mandatory - "EGL_KHR_wait_sync " // strongly recommended - "EGL_ANDROID_recordable " // mandatory - "EGL_KHR_partial_update " // strongly recommended - "EGL_EXT_buffer_age " // strongly recommended with partial_update - "EGL_KHR_create_context_no_error " - ; - -// extensions not exposed to applications but used by the ANDROID system -// "EGL_ANDROID_blob_cache " // strongly recommended -// "EGL_IMG_hibernate_process " // optional -// "EGL_ANDROID_native_fence_sync " // strongly recommended -// "EGL_ANDROID_framebuffer_target " // mandatory for HWC 1.1 -// "EGL_ANDROID_image_crop " // optional - -/* - * EGL Extensions entry-points exposed to 3rd party applications - * (keep in sync with gExtensionString above) - * - */ -static const extention_map_t sExtensionMap[] = { - // EGL_KHR_lock_surface +static const extention_map_t sExtentionMap[] = { { "eglLockSurfaceKHR", (__eglMustCastToProperFunctionPointerType)&eglLockSurfaceKHR }, { "eglUnlockSurfaceKHR", (__eglMustCastToProperFunctionPointerType)&eglUnlockSurfaceKHR }, - - // EGL_KHR_image, EGL_KHR_image_base { "eglCreateImageKHR", (__eglMustCastToProperFunctionPointerType)&eglCreateImageKHR }, { "eglDestroyImageKHR", (__eglMustCastToProperFunctionPointerType)&eglDestroyImageKHR }, - - // EGL_KHR_reusable_sync, EGL_KHR_fence_sync - { "eglCreateSyncKHR", - (__eglMustCastToProperFunctionPointerType)&eglCreateSyncKHR }, - { "eglDestroySyncKHR", - (__eglMustCastToProperFunctionPointerType)&eglDestroySyncKHR }, - { "eglClientWaitSyncKHR", - (__eglMustCastToProperFunctionPointerType)&eglClientWaitSyncKHR }, - { "eglSignalSyncKHR", - (__eglMustCastToProperFunctionPointerType)&eglSignalSyncKHR }, - { "eglGetSyncAttribKHR", - (__eglMustCastToProperFunctionPointerType)&eglGetSyncAttribKHR }, - - // EGL_NV_system_time + { "eglGetRenderBufferANDROID", + (__eglMustCastToProperFunctionPointerType)&eglGetRenderBufferANDROID }, { "eglGetSystemTimeFrequencyNV", (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeFrequencyNV }, { "eglGetSystemTimeNV", (__eglMustCastToProperFunctionPointerType)&eglGetSystemTimeNV }, - - // EGL_KHR_wait_sync - { "eglWaitSyncKHR", - (__eglMustCastToProperFunctionPointerType)&eglWaitSyncKHR }, - - // EGL_ANDROID_presentation_time - { "eglPresentationTimeANDROID", - (__eglMustCastToProperFunctionPointerType)&eglPresentationTimeANDROID }, - - // EGL_KHR_swap_buffers_with_damage - { "eglSwapBuffersWithDamageKHR", - (__eglMustCastToProperFunctionPointerType)&eglSwapBuffersWithDamageKHR }, - - // EGL_KHR_partial_update - { "eglSetDamageRegionKHR", - (__eglMustCastToProperFunctionPointerType)&eglSetDamageRegionKHR }, - - { "eglCreateStreamKHR", - (__eglMustCastToProperFunctionPointerType)&eglCreateStreamKHR }, - { "eglDestroyStreamKHR", - (__eglMustCastToProperFunctionPointerType)&eglDestroyStreamKHR }, - { "eglStreamAttribKHR", - (__eglMustCastToProperFunctionPointerType)&eglStreamAttribKHR }, - { "eglQueryStreamKHR", - (__eglMustCastToProperFunctionPointerType)&eglQueryStreamKHR }, - { "eglQueryStreamu64KHR", - (__eglMustCastToProperFunctionPointerType)&eglQueryStreamu64KHR }, - { "eglQueryStreamTimeKHR", - (__eglMustCastToProperFunctionPointerType)&eglQueryStreamTimeKHR }, - { "eglCreateStreamProducerSurfaceKHR", - (__eglMustCastToProperFunctionPointerType)&eglCreateStreamProducerSurfaceKHR }, - { "eglStreamConsumerGLTextureExternalKHR", - (__eglMustCastToProperFunctionPointerType)&eglStreamConsumerGLTextureExternalKHR }, - { "eglStreamConsumerAcquireKHR", - (__eglMustCastToProperFunctionPointerType)&eglStreamConsumerAcquireKHR }, - { "eglStreamConsumerReleaseKHR", - (__eglMustCastToProperFunctionPointerType)&eglStreamConsumerReleaseKHR }, - { "eglGetStreamFileDescriptorKHR", - (__eglMustCastToProperFunctionPointerType)&eglGetStreamFileDescriptorKHR }, - { "eglCreateStreamFromFileDescriptorKHR", - (__eglMustCastToProperFunctionPointerType)&eglCreateStreamFromFileDescriptorKHR }, }; -/* - * These extensions entry-points should not be exposed to applications. - * They're used internally by the Android EGL layer. - */ -#define FILTER_EXTENSIONS(procname) \ - (!strcmp((procname), "eglSetBlobCacheFuncsANDROID") || \ - !strcmp((procname), "eglHibernateProcessIMG") || \ - !strcmp((procname), "eglAwakenProcessIMG") || \ - !strcmp((procname), "eglDupNativeFenceFDANDROID")) - - - // accesses protected by sExtensionMapMutex static DefaultKeyedVector sGLExtentionMap; static int sGLExtentionSlot = 0; @@ -228,16 +95,14 @@ // ---------------------------------------------------------------------------- +namespace android { extern void setGLHooksThreadSpecific(gl_hooks_t const *value); extern EGLBoolean egl_init_drivers(); extern const __eglMustCastToProperFunctionPointerType gExtensionForwarders[MAX_NUMBER_OF_GL_EXTENSIONS]; -extern int getEGLDebugLevel(); -extern void setEGLDebugLevel(int level); +extern int gEGLDebugLevel; extern gl_hooks_t gHooksTrace; - } // namespace android; - // ---------------------------------------------------------------------------- static inline void clearError() { egl_tls_t::clearError(); } @@ -249,7 +114,7 @@ { clearError(); - uintptr_t index = reinterpret_cast(display); + uint32_t index = uint32_t(display); if (index >= NUM_DISPLAYS) { return setError(EGL_BAD_PARAMETER, EGL_NO_DISPLAY); } @@ -290,7 +155,7 @@ if (!dp) return setError(EGL_BAD_DISPLAY, EGL_FALSE); EGLBoolean res = dp->terminate(); - + return res; } @@ -341,59 +206,6 @@ egl_connection_t* const cnx = &gEGLImpl; if (cnx->dso) { - if (attrib_list) { - char value[PROPERTY_VALUE_MAX]; - property_get("debug.egl.force_msaa", value, "false"); - - if (!strcmp(value, "true")) { - size_t attribCount = 0; - EGLint attrib = attrib_list[0]; - - // Only enable MSAA if the context is OpenGL ES 2.0 and - // if no caveat is requested - const EGLint *attribRendererable = NULL; - const EGLint *attribCaveat = NULL; - - // Count the number of attributes and look for - // EGL_RENDERABLE_TYPE and EGL_CONFIG_CAVEAT - while (attrib != EGL_NONE) { - attrib = attrib_list[attribCount]; - switch (attrib) { - case EGL_RENDERABLE_TYPE: - attribRendererable = &attrib_list[attribCount]; - break; - case EGL_CONFIG_CAVEAT: - attribCaveat = &attrib_list[attribCount]; - break; - } - attribCount++; - } - - if (attribRendererable && attribRendererable[1] == EGL_OPENGL_ES2_BIT && - (!attribCaveat || attribCaveat[1] != EGL_NONE)) { - - // Insert 2 extra attributes to force-enable MSAA 4x - EGLint aaAttribs[attribCount + 4]; - aaAttribs[0] = EGL_SAMPLE_BUFFERS; - aaAttribs[1] = 1; - aaAttribs[2] = EGL_SAMPLES; - aaAttribs[3] = 4; - - memcpy(&aaAttribs[4], attrib_list, attribCount * sizeof(EGLint)); - - EGLint numConfigAA; - EGLBoolean resAA = cnx->egl.eglChooseConfig( - dp->disp.dpy, aaAttribs, configs, config_size, &numConfigAA); - - if (resAA == EGL_TRUE && numConfigAA > 0) { - ALOGD("Enabling MSAA 4x"); - *num_config = numConfigAA; - return resAA; - } - } - } - } - res = cnx->egl.eglChooseConfig( dp->disp.dpy, attrib_list, configs, config_size, num_config); } @@ -408,7 +220,7 @@ egl_connection_t* cnx = NULL; const egl_display_ptr dp = validate_display_connection(dpy, cnx); if (!dp) return EGL_FALSE; - + return cnx->egl.eglGetConfigAttrib( dp->disp.dpy, config, attribute, value); } @@ -417,26 +229,6 @@ // surfaces // ---------------------------------------------------------------------------- -// The EGL_KHR_gl_colorspace spec hasn't been ratified yet, so these haven't -// been added to the Khronos egl.h. -#define EGL_GL_COLORSPACE_KHR EGL_VG_COLORSPACE -#define EGL_GL_COLORSPACE_SRGB_KHR EGL_VG_COLORSPACE_sRGB -#define EGL_GL_COLORSPACE_LINEAR_KHR EGL_VG_COLORSPACE_LINEAR - -// Turn linear formats into corresponding sRGB formats when colorspace is -// EGL_GL_COLORSPACE_SRGB_KHR, or turn sRGB formats into corresponding linear -// formats when colorspace is EGL_GL_COLORSPACE_LINEAR_KHR. In any cases where -// the modification isn't possible, the original dataSpace is returned. -static android_dataspace modifyBufferDataspace( android_dataspace dataSpace, - EGLint colorspace) { - if (colorspace == EGL_GL_COLORSPACE_LINEAR_KHR) { - return HAL_DATASPACE_SRGB_LINEAR; - } else if (colorspace == EGL_GL_COLORSPACE_SRGB_KHR) { - return HAL_DATASPACE_SRGB; - } - return dataSpace; -} - EGLSurface eglCreateWindowSurface( EGLDisplay dpy, EGLConfig config, NativeWindowType window, const EGLint *attrib_list) @@ -447,83 +239,28 @@ egl_display_ptr dp = validate_display_connection(dpy, cnx); if (dp) { EGLDisplay iDpy = dp->disp.dpy; + EGLint format; - int result = native_window_api_connect(window, NATIVE_WINDOW_API_EGL); - if (result != OK) { - ALOGE("eglCreateWindowSurface: native_window_api_connect (win=%p) " - "failed (%#x) (already connected to another API?)", - window, result); - return setError(EGL_BAD_ALLOC, EGL_NO_SURFACE); - } - - // Set the native window's buffers format to match what this config requests. - // Whether to use sRGB gamma is not part of the EGLconfig, but is part - // of our native format. So if sRGB gamma is requested, we have to - // modify the EGLconfig's format before setting the native window's - // format. - - // by default, just pick RGBA_8888 - EGLint format = HAL_PIXEL_FORMAT_RGBA_8888; - android_dataspace dataSpace = HAL_DATASPACE_UNKNOWN; - - EGLint a = 0; - cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_ALPHA_SIZE, &a); - if (a > 0) { - // alpha-channel requested, there's really only one suitable format - format = HAL_PIXEL_FORMAT_RGBA_8888; - } else { - EGLint r, g, b; - r = g = b = 0; - cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_RED_SIZE, &r); - cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_GREEN_SIZE, &g); - cnx->egl.eglGetConfigAttrib(iDpy, config, EGL_BLUE_SIZE, &b); - EGLint colorDepth = r + g + b; - if (colorDepth <= 16) { - format = HAL_PIXEL_FORMAT_RGB_565; - } else { - format = HAL_PIXEL_FORMAT_RGBX_8888; - } - } - - // now select a corresponding sRGB format if needed - if (attrib_list && dp->haveExtension("EGL_KHR_gl_colorspace")) { - for (const EGLint* attr = attrib_list; *attr != EGL_NONE; attr += 2) { - if (*attr == EGL_GL_COLORSPACE_KHR) { - if (ENABLE_EGL_KHR_GL_COLORSPACE) { - dataSpace = modifyBufferDataspace(dataSpace, *(attr+1)); - } else { - // Normally we'd pass through unhandled attributes to - // the driver. But in case the driver implements this - // extension but we're disabling it, we want to prevent - // it getting through -- support will be broken without - // our help. - ALOGE("sRGB window surfaces not supported"); - return setError(EGL_BAD_ATTRIBUTE, EGL_NO_SURFACE); - } + if (native_window_api_connect(window, NATIVE_WINDOW_API_EGL) != OK) { + ALOGE("EGLNativeWindowType %p already connected to another API", + window); + return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); + } + + // set the native window's buffers format to match this config + if (cnx->egl.eglGetConfigAttrib(iDpy, + config, EGL_NATIVE_VISUAL_ID, &format)) { + if (format != 0) { + int err = native_window_set_buffers_format(window, format); + if (err != 0) { + ALOGE("error setting native window pixel format: %s (%d)", + strerror(-err), err); + native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL); + return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); } } } - if (format != 0) { - int err = native_window_set_buffers_format(window, format); - if (err != 0) { - ALOGE("error setting native window pixel format: %s (%d)", - strerror(-err), err); - native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL); - return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); - } - } - - if (dataSpace != 0) { - int err = native_window_set_buffers_data_space(window, dataSpace); - if (err != 0) { - ALOGE("error setting native window pixel dataSpace: %s (%d)", - strerror(-err), err); - native_window_api_disconnect(window, NATIVE_WINDOW_API_EGL); - return setError(EGL_BAD_NATIVE_WINDOW, EGL_NO_SURFACE); - } - } - // the EGL spec requires that a new EGLSurface default to swap interval // 1, so explicitly set that on the window here. ANativeWindow* anw = reinterpret_cast(window); @@ -582,7 +319,7 @@ } return EGL_NO_SURFACE; } - + EGLBoolean eglDestroySurface(EGLDisplay dpy, EGLSurface surface) { clearError(); @@ -633,6 +370,11 @@ setError(EGL_BAD_SURFACE, EGL_FALSE); return; } + + int64_t timestamp = systemTime(SYSTEM_TIME_MONOTONIC); + + egl_surface_t const * const s = get_surface(surface); + native_window_set_buffers_timestamp(s->win.get(), timestamp); } // ---------------------------------------------------------------------------- @@ -646,11 +388,8 @@ egl_connection_t* cnx = NULL; const egl_display_ptr dp = validate_display_connection(dpy, cnx); - if (dp) { + if (dpy) { if (share_list != EGL_NO_CONTEXT) { - if (!ContextRef(dp.get(), share_list).get()) { - return setError(EGL_BAD_CONTEXT, EGL_NO_CONTEXT); - } egl_context_t* const c = get_context(share_list); share_list = c->context; } @@ -666,7 +405,7 @@ if (attr == EGL_CONTEXT_CLIENT_VERSION) { if (value == 1) { version = egl_connection_t::GLESv1_INDEX; - } else if (value == 2 || value == 3) { + } else if (value == 2) { version = egl_connection_t::GLESv2_INDEX; } } @@ -675,7 +414,7 @@ egl_context_t* c = new egl_context_t(dpy, context, config, cnx, version); #if EGL_TRACE - if (getEGLDebugLevel() > 0) + if (gEGLDebugLevel > 0) GLTrace_eglCreateContext(version, c); #endif return c; @@ -695,7 +434,7 @@ ContextRef _c(dp.get(), ctx); if (!_c.get()) return setError(EGL_BAD_CONTEXT, EGL_FALSE); - + egl_context_t * const c = get_context(ctx); EGLBoolean result = c->cnx->egl.eglDestroyContext(dp->disp.dpy, c->context); if (result == EGL_TRUE) { @@ -728,7 +467,7 @@ // validate the context (if not EGL_NO_CONTEXT) if ((ctx != EGL_NO_CONTEXT) && !_c.get()) { // EGL_NO_CONTEXT is valid - return setError(EGL_BAD_CONTEXT, EGL_FALSE); + return EGL_FALSE; } // these are the underlying implementation's object @@ -743,18 +482,18 @@ // these are the current objects structs egl_context_t * cur_c = get_context(getContext()); - + if (ctx != EGL_NO_CONTEXT) { c = get_context(ctx); impl_ctx = c->context; } else { // no context given, use the implementation of the current context - if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) { - // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT); - return setError(EGL_BAD_MATCH, EGL_FALSE); - } if (cur_c == NULL) { // no current context + if (draw != EGL_NO_SURFACE || read != EGL_NO_SURFACE) { + // calling eglMakeCurrent( ..., !=0, !=0, EGL_NO_CONTEXT); + return setError(EGL_BAD_MATCH, EGL_FALSE); + } // not an error, there is just no current context. return EGL_TRUE; } @@ -762,14 +501,12 @@ // retrieve the underlying implementation's draw EGLSurface if (draw != EGL_NO_SURFACE) { - if (!_d.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE); d = get_surface(draw); impl_draw = d->surface; } // retrieve the underlying implementation's read EGLSurface if (read != EGL_NO_SURFACE) { - if (!_r.get()) return setError(EGL_BAD_SURFACE, EGL_FALSE); r = get_surface(read); impl_read = r->surface; } @@ -784,7 +521,7 @@ setGLHooksThreadSpecific(c->cnx->hooks[c->version]); egl_tls_t::setContext(ctx); #if EGL_TRACE - if (getEGLDebugLevel() > 0) + if (gEGLDebugLevel > 0) GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version], ctx); #endif _c.acquire(); @@ -796,8 +533,7 @@ } } else { // this will ALOGE the error - egl_connection_t* const cnx = &gEGLImpl; - result = setError(cnx->egl.eglGetError(), EGL_FALSE); + result = setError(c->cnx->egl.eglGetError(), EGL_FALSE); } return result; } @@ -844,7 +580,7 @@ if (!c) return setError(EGL_BAD_CONTEXT, EGL_NO_SURFACE); switch (readdraw) { case EGL_READ: return c->read; - case EGL_DRAW: return c->draw; + case EGL_DRAW: return c->draw; default: return setError(EGL_BAD_PARAMETER, EGL_NO_SURFACE); } } @@ -902,23 +638,6 @@ return err; } -static __eglMustCastToProperFunctionPointerType findBuiltinWrapper( - const char* procname) { - const egl_connection_t* cnx = &gEGLImpl; - void* proc = NULL; - - proc = dlsym(cnx->libEgl, procname); - if (proc) return (__eglMustCastToProperFunctionPointerType)proc; - - proc = dlsym(cnx->libGles2, procname); - if (proc) return (__eglMustCastToProperFunctionPointerType)proc; - - proc = dlsym(cnx->libGles1, procname); - if (proc) return (__eglMustCastToProperFunctionPointerType)proc; - - return NULL; -} - __eglMustCastToProperFunctionPointerType eglGetProcAddress(const char *procname) { // eglGetProcAddress() could be the very first function called @@ -932,16 +651,18 @@ return NULL; } - if (FILTER_EXTENSIONS(procname)) { + // These extensions should not be exposed to applications. They're used + // internally by the Android EGL layer. + if (!strcmp(procname, "eglSetBlobCacheFuncsANDROID") || + !strcmp(procname, "eglHibernateProcessIMG") || + !strcmp(procname, "eglAwakenProcessIMG")) { return NULL; } __eglMustCastToProperFunctionPointerType addr; - addr = findProcAddress(procname, sExtensionMap, NELEM(sExtensionMap)); + addr = findProcAddress(procname, sExtentionMap, NELEM(sExtentionMap)); if (addr) return addr; - addr = findBuiltinWrapper(procname); - if (addr) return addr; // this protects accesses to sGLExtentionMap and sGLExtentionSlot pthread_mutex_lock(&sExtensionMapMutex); @@ -980,8 +701,8 @@ egl_connection_t* const cnx = &gEGLImpl; if (cnx->dso && cnx->egl.eglGetProcAddress) { + found = true; // Extensions are independent of the bound context - addr = cnx->hooks[egl_connection_t::GLESv1_INDEX]->ext.extensions[slot] = cnx->hooks[egl_connection_t::GLESv2_INDEX]->ext.extensions[slot] = #if EGL_TRACE @@ -989,7 +710,6 @@ gHooksTrace.ext.extensions[slot] = #endif cnx->egl.eglGetProcAddress(procname); - if (addr) found = true; } if (found) { @@ -1066,8 +786,7 @@ Mutex mMutex; }; -EGLBoolean eglSwapBuffersWithDamageKHR(EGLDisplay dpy, EGLSurface draw, - EGLint *rects, EGLint n_rects) +EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface draw) { ATRACE_CALL(); clearError(); @@ -1080,42 +799,12 @@ return setError(EGL_BAD_SURFACE, EGL_FALSE); #if EGL_TRACE - gl_hooks_t const *trace_hooks = getGLTraceThreadSpecific(); - if (getEGLDebugLevel() > 0) { - if (trace_hooks == NULL) { - if (GLTrace_start() < 0) { - ALOGE("Disabling Tracer for OpenGL ES"); - setEGLDebugLevel(0); - } else { - // switch over to the trace version of hooks - EGLContext ctx = egl_tls_t::getContext(); - egl_context_t * const c = get_context(ctx); - if (c) { - setGLHooksThreadSpecific(c->cnx->hooks[c->version]); - GLTrace_eglMakeCurrent(c->version, c->cnx->hooks[c->version], ctx); - } - } - } - + if (gEGLDebugLevel > 0) GLTrace_eglSwapBuffers(dpy, draw); - } else if (trace_hooks != NULL) { - // tracing is now disabled, so switch back to the non trace version - EGLContext ctx = egl_tls_t::getContext(); - egl_context_t * const c = get_context(ctx); - if (c) setGLHooksThreadSpecific(c->cnx->hooks[c->version]); - GLTrace_stop(); - } #endif egl_surface_t const * const s = get_surface(draw); - if (CC_UNLIKELY(dp->traceGpuCompletion)) { - EGLSyncKHR sync = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); - if (sync != EGL_NO_SYNC_KHR) { - FrameCompletionThread::queueSync(sync); - } - } - if (CC_UNLIKELY(dp->finishOnSwap)) { uint32_t pixel; egl_context_t * const c = get_context( egl_tls_t::getContext() ); @@ -1126,38 +815,19 @@ } } - if (n_rects == 0) { - return s->cnx->egl.eglSwapBuffers(dp->disp.dpy, s->surface); - } + EGLBoolean result = s->cnx->egl.eglSwapBuffers(dp->disp.dpy, s->surface); - Vector androidRects; - for (int r = 0; r < n_rects; ++r) { - int offset = r * 4; - int x = rects[offset]; - int y = rects[offset + 1]; - int width = rects[offset + 2]; - int height = rects[offset + 3]; - android_native_rect_t androidRect; - androidRect.left = x; - androidRect.top = y + height; - androidRect.right = x + width; - androidRect.bottom = y; - androidRects.push_back(androidRect); - } - native_window_set_surface_damage(s->win.get(), androidRects.array(), - androidRects.size()); - - if (s->cnx->egl.eglSwapBuffersWithDamageKHR) { - return s->cnx->egl.eglSwapBuffersWithDamageKHR(dp->disp.dpy, s->surface, - rects, n_rects); - } else { - return s->cnx->egl.eglSwapBuffers(dp->disp.dpy, s->surface); + if (CC_UNLIKELY(dp->traceGpuCompletion)) { + EGLSyncKHR sync = EGL_NO_SYNC_KHR; + { + sync = eglCreateSyncKHR(dpy, EGL_SYNC_FENCE_KHR, NULL); + } + if (sync != EGL_NO_SYNC_KHR) { + FrameCompletionThread::queueSync(sync); + } } -} -EGLBoolean eglSwapBuffers(EGLDisplay dpy, EGLSurface surface) -{ - return eglSwapBuffersWithDamageKHR(dpy, surface, NULL, 0); + return result; } EGLBoolean eglCopyBuffers( EGLDisplay dpy, EGLSurface surface, @@ -1192,30 +862,13 @@ return dp->getExtensionString(); case EGL_CLIENT_APIS: return dp->getClientApiString(); - } - return setError(EGL_BAD_PARAMETER, (const char *)0); -} - -EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return (const char *) NULL; - - switch (name) { - case EGL_VENDOR: - return dp->disp.queryString.vendor; - case EGL_VERSION: + case EGL_VERSION_HW_ANDROID: return dp->disp.queryString.version; - case EGL_EXTENSIONS: - return dp->disp.queryString.extensions; - case EGL_CLIENT_APIS: - return dp->disp.queryString.clientApi; } return setError(EGL_BAD_PARAMETER, (const char *)0); } + // ---------------------------------------------------------------------------- // EGL 1.1 // ---------------------------------------------------------------------------- @@ -1356,11 +1009,6 @@ { clearError(); -#if EGL_TRACE - if (getEGLDebugLevel() > 0) - GLTrace_eglReleaseThread(); -#endif - // If there is context bound to the thread, release it egl_display_t::loseCurrent(get_context(getContext())); @@ -1368,7 +1016,12 @@ if (cnx->dso && cnx->egl.eglReleaseThread) { cnx->egl.eglReleaseThread(); } + egl_tls_t::clearTLS(); +#if EGL_TRACE + if (gEGLDebugLevel > 0) + GLTrace_eglReleaseThread(); +#endif return EGL_TRUE; } @@ -1502,21 +1155,6 @@ return result; } -EGLBoolean eglSignalSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLenum mode) { - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglSignalSyncKHR) { - result = cnx->egl.eglSignalSyncKHR( - dp->disp.dpy, sync, mode); - } - return result; -} - EGLint eglClientWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags, EGLTimeKHR timeout) { @@ -1551,267 +1189,24 @@ return result; } -EGLStreamKHR eglCreateStreamKHR(EGLDisplay dpy, const EGLint *attrib_list) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_NO_STREAM_KHR; - - EGLStreamKHR result = EGL_NO_STREAM_KHR; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglCreateStreamKHR) { - result = cnx->egl.eglCreateStreamKHR( - dp->disp.dpy, attrib_list); - } - return result; -} - -EGLBoolean eglDestroyStreamKHR(EGLDisplay dpy, EGLStreamKHR stream) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglDestroyStreamKHR) { - result = cnx->egl.eglDestroyStreamKHR( - dp->disp.dpy, stream); - } - return result; -} - -EGLBoolean eglStreamAttribKHR(EGLDisplay dpy, EGLStreamKHR stream, - EGLenum attribute, EGLint value) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglStreamAttribKHR) { - result = cnx->egl.eglStreamAttribKHR( - dp->disp.dpy, stream, attribute, value); - } - return result; -} - -EGLBoolean eglQueryStreamKHR(EGLDisplay dpy, EGLStreamKHR stream, - EGLenum attribute, EGLint *value) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglQueryStreamKHR) { - result = cnx->egl.eglQueryStreamKHR( - dp->disp.dpy, stream, attribute, value); - } - return result; -} - -EGLBoolean eglQueryStreamu64KHR(EGLDisplay dpy, EGLStreamKHR stream, - EGLenum attribute, EGLuint64KHR *value) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglQueryStreamu64KHR) { - result = cnx->egl.eglQueryStreamu64KHR( - dp->disp.dpy, stream, attribute, value); - } - return result; -} - -EGLBoolean eglQueryStreamTimeKHR(EGLDisplay dpy, EGLStreamKHR stream, - EGLenum attribute, EGLTimeKHR *value) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglQueryStreamTimeKHR) { - result = cnx->egl.eglQueryStreamTimeKHR( - dp->disp.dpy, stream, attribute, value); - } - return result; -} - -EGLSurface eglCreateStreamProducerSurfaceKHR(EGLDisplay dpy, EGLConfig config, - EGLStreamKHR stream, const EGLint *attrib_list) -{ - clearError(); - - egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_NO_SURFACE; - - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglCreateStreamProducerSurfaceKHR) { - EGLSurface surface = cnx->egl.eglCreateStreamProducerSurfaceKHR( - dp->disp.dpy, config, stream, attrib_list); - if (surface != EGL_NO_SURFACE) { - egl_surface_t* s = new egl_surface_t(dp.get(), config, NULL, - surface, cnx); - return s; - } - } - return EGL_NO_SURFACE; -} - -EGLBoolean eglStreamConsumerGLTextureExternalKHR(EGLDisplay dpy, - EGLStreamKHR stream) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglStreamConsumerGLTextureExternalKHR) { - result = cnx->egl.eglStreamConsumerGLTextureExternalKHR( - dp->disp.dpy, stream); - } - return result; -} - -EGLBoolean eglStreamConsumerAcquireKHR(EGLDisplay dpy, - EGLStreamKHR stream) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglStreamConsumerAcquireKHR) { - result = cnx->egl.eglStreamConsumerAcquireKHR( - dp->disp.dpy, stream); - } - return result; -} - -EGLBoolean eglStreamConsumerReleaseKHR(EGLDisplay dpy, - EGLStreamKHR stream) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - - EGLBoolean result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglStreamConsumerReleaseKHR) { - result = cnx->egl.eglStreamConsumerReleaseKHR( - dp->disp.dpy, stream); - } - return result; -} - -EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR( - EGLDisplay dpy, EGLStreamKHR stream) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_NO_FILE_DESCRIPTOR_KHR; - - EGLNativeFileDescriptorKHR result = EGL_NO_FILE_DESCRIPTOR_KHR; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglGetStreamFileDescriptorKHR) { - result = cnx->egl.eglGetStreamFileDescriptorKHR( - dp->disp.dpy, stream); - } - return result; -} - -EGLStreamKHR eglCreateStreamFromFileDescriptorKHR( - EGLDisplay dpy, EGLNativeFileDescriptorKHR file_descriptor) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_NO_STREAM_KHR; - - EGLStreamKHR result = EGL_NO_STREAM_KHR; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglCreateStreamFromFileDescriptorKHR) { - result = cnx->egl.eglCreateStreamFromFileDescriptorKHR( - dp->disp.dpy, file_descriptor); - } - return result; -} - -// ---------------------------------------------------------------------------- -// EGL_EGLEXT_VERSION 15 -// ---------------------------------------------------------------------------- - -EGLint eglWaitSyncKHR(EGLDisplay dpy, EGLSyncKHR sync, EGLint flags) { - clearError(); - const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_FALSE; - EGLint result = EGL_FALSE; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglWaitSyncKHR) { - result = cnx->egl.eglWaitSyncKHR(dp->disp.dpy, sync, flags); - } - return result; -} - // ---------------------------------------------------------------------------- // ANDROID extensions // ---------------------------------------------------------------------------- -EGLint eglDupNativeFenceFDANDROID(EGLDisplay dpy, EGLSyncKHR sync) +EGLClientBuffer eglGetRenderBufferANDROID(EGLDisplay dpy, EGLSurface draw) { clearError(); const egl_display_ptr dp = validate_display(dpy); - if (!dp) return EGL_NO_NATIVE_FENCE_FD_ANDROID; - - EGLint result = EGL_NO_NATIVE_FENCE_FD_ANDROID; - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && cnx->egl.eglDupNativeFenceFDANDROID) { - result = cnx->egl.eglDupNativeFenceFDANDROID(dp->disp.dpy, sync); - } - return result; -} - -EGLBoolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface surface, - EGLnsecsANDROID time) -{ - clearError(); + if (!dp) return EGL_FALSE; - const egl_display_ptr dp = validate_display(dpy); - if (!dp) { - return EGL_FALSE; - } + egl_surface_t const * const s = get_surface(draw); - SurfaceRef _s(dp.get(), surface); - if (!_s.get()) { - setError(EGL_BAD_SURFACE, EGL_FALSE); - return EGL_FALSE; + egl_connection_t* const cnx = &gEGLImpl; + if (cnx->dso && cnx->egl.eglGetRenderBufferANDROID) { + return cnx->egl.eglGetRenderBufferANDROID(dp->disp.dpy, s->surface); } - - egl_surface_t const * const s = get_surface(surface); - native_window_set_buffers_timestamp(s->win.get(), time); - - return EGL_TRUE; + return setError(EGL_BAD_DISPLAY, (EGLClientBuffer*)0); } // ---------------------------------------------------------------------------- @@ -1852,32 +1247,3 @@ return setErrorQuiet(EGL_BAD_DISPLAY, 0); } - -// ---------------------------------------------------------------------------- -// Partial update extension -// ---------------------------------------------------------------------------- -EGLBoolean eglSetDamageRegionKHR(EGLDisplay dpy, EGLSurface surface, - EGLint *rects, EGLint n_rects) -{ - clearError(); - - const egl_display_ptr dp = validate_display(dpy); - if (!dp) { - setError(EGL_BAD_DISPLAY, EGL_FALSE); - return EGL_FALSE; - } - - SurfaceRef _s(dp.get(), surface); - if (!_s.get()) { - setError(EGL_BAD_SURFACE, EGL_FALSE); - return EGL_FALSE; - } - - egl_surface_t const * const s = get_surface(surface); - if (s->cnx->egl.eglSetDamageRegionKHR) { - return s->cnx->egl.eglSetDamageRegionKHR(dp->disp.dpy, s->surface, - rects, n_rects); - } - - return EGL_FALSE; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_cache.cpp android-platform-frameworks-native-21/opengl/libs/EGL/egl_cache.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_cache.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_cache.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -14,10 +14,9 @@ ** limitations under the License. */ -#include "../egl_impl.h" - #include "egl_cache.h" #include "egl_display.h" +#include "egl_impl.h" #include "egldefs.h" #include @@ -30,16 +29,12 @@ #define MAX_EGL_CACHE_ENTRY_SIZE (16 * 1024); #endif -#ifndef MAX_EGL_CACHE_KEY_SIZE -#define MAX_EGL_CACHE_KEY_SIZE (1024); -#endif - #ifndef MAX_EGL_CACHE_SIZE #define MAX_EGL_CACHE_SIZE (64 * 1024); #endif // Cache size limits. -static const size_t maxKeySize = MAX_EGL_CACHE_KEY_SIZE; +static const size_t maxKeySize = 1024; static const size_t maxValueSize = MAX_EGL_CACHE_ENTRY_SIZE; static const size_t maxTotalSize = MAX_EGL_CACHE_SIZE; @@ -126,8 +121,11 @@ void egl_cache_t::terminate() { Mutex::Autolock lock(mMutex); - saveBlobCacheLocked(); - mBlobCache = NULL; + if (mBlobCache != NULL) { + saveBlobCacheLocked(); + mBlobCache = NULL; + } + mInitialized = false; } void egl_cache_t::setBlob(const void* key, EGLsizeiANDROID keySize, @@ -215,7 +213,7 @@ } void egl_cache_t::saveBlobCacheLocked() { - if (mFilename.length() > 0 && mBlobCache != NULL) { + if (mFilename.length() > 0) { size_t cacheSize = mBlobCache->getFlattenedSize(); size_t headerSize = cacheFileHeaderSize; const char* fname = mFilename.string(); @@ -253,7 +251,8 @@ return; } - status_t err = mBlobCache->flatten(buf + headerSize, cacheSize); + status_t err = mBlobCache->flatten(buf + headerSize, cacheSize, NULL, + 0); if (err != OK) { ALOGE("error writing cache contents: %s (%d)", strerror(-err), -err); @@ -334,7 +333,8 @@ return; } - status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize); + status_t err = mBlobCache->unflatten(buf + headerSize, cacheSize, NULL, + 0); if (err != OK) { ALOGE("error reading cache contents: %s (%d)", strerror(-err), -err); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl.cpp android-platform-frameworks-native-21/opengl/libs/EGL/egl.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -23,26 +23,27 @@ #include #include +#include +#include #include #include #include +#include #include #include -#include "../egl_impl.h" -#include "../glestrace.h" - -#include "egl_tls.h" #include "egldefs.h" +#include "egl_impl.h" +#include "egl_tls.h" +#include "glestrace.h" +#include "hooks.h" #include "Loader.h" #include "egl_display.h" #include "egl_object.h" -typedef __eglMustCastToProperFunctionPointerType EGLFuncPointer; - // ---------------------------------------------------------------------------- namespace android { // ---------------------------------------------------------------------------- @@ -61,18 +62,12 @@ // ---------------------------------------------------------------------------- /** - * There are three different tracing methods: - * 1. libs/EGL/trace.cpp: Traces all functions to systrace. - * To enable: - * - set system property "debug.egl.trace" to "systrace" to trace all apps. - * 2. libs/EGL/trace.cpp: Logs a stack trace for GL errors after each function call. - * To enable: - * - set system property "debug.egl.trace" to "error" to trace all apps. - * 3. libs/EGL/trace.cpp: Traces all functions to logcat. + * There are two different tracing methods: + * 1. libs/EGL/trace.cpp: Traces all functions to logcat. * To enable: * - set system property "debug.egl.trace" to 1 to trace all apps. * - or call setGLTraceLevel(1) from an app to enable tracing for that app. - * 4. libs/GLES_trace: Traces all functions via protobuf to host. + * 2. libs/GLES_trace: Traces all functions via protobuf to host. * To enable: * - set system property "debug.egl.debug_proc" to the application name. * - or call setGLDebugLevel(1) from the app. @@ -80,22 +75,10 @@ static int sEGLTraceLevel; static int sEGLApplicationTraceLevel; -static bool sEGLSystraceEnabled; -static bool sEGLGetErrorEnabled; - -static volatile int sEGLDebugLevel; +int gEGLDebugLevel; +static int sEGLApplicationDebugLevel; extern gl_hooks_t gHooksTrace; -extern gl_hooks_t gHooksSystrace; -extern gl_hooks_t gHooksErrorTrace; - -int getEGLDebugLevel() { - return sEGLDebugLevel; -} - -void setEGLDebugLevel(int level) { - sEGLDebugLevel = level; -} static inline void setGlTraceThreadSpecific(gl_hooks_t const *value) { pthread_setspecific(gGLTraceKey, value); @@ -108,74 +91,47 @@ void initEglTraceLevel() { char value[PROPERTY_VALUE_MAX]; property_get("debug.egl.trace", value, "0"); - - sEGLGetErrorEnabled = !strcasecmp(value, "error"); - if (sEGLGetErrorEnabled) { - sEGLSystraceEnabled = false; - sEGLTraceLevel = 0; - return; - } - - sEGLSystraceEnabled = !strcasecmp(value, "systrace"); - if (sEGLSystraceEnabled) { - sEGLTraceLevel = 0; - return; - } - int propertyLevel = atoi(value); int applicationLevel = sEGLApplicationTraceLevel; sEGLTraceLevel = propertyLevel > applicationLevel ? propertyLevel : applicationLevel; } void initEglDebugLevel() { - if (getEGLDebugLevel() == 0) { - char value[PROPERTY_VALUE_MAX]; - - // check system property only on userdebug or eng builds - property_get("ro.debuggable", value, "0"); - if (value[0] == '0') - return; - - property_get("debug.egl.debug_proc", value, ""); - if (strlen(value) > 0) { - FILE * file = fopen("/proc/self/cmdline", "r"); - if (file) { - char cmdline[256]; - if (fgets(cmdline, sizeof(cmdline), file)) { - if (!strncmp(value, cmdline, strlen(value))) { - // set EGL debug if the "debug.egl.debug_proc" property - // matches the prefix of this application's command line - setEGLDebugLevel(1); - } + int propertyLevel = 0; + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.debug_proc", value, ""); + if (strlen(value) > 0) { + long pid = getpid(); + char procPath[128] = {}; + sprintf(procPath, "/proc/%ld/cmdline", pid); + FILE * file = fopen(procPath, "r"); + if (file) { + char cmdline[256] = {}; + if (fgets(cmdline, sizeof(cmdline) - 1, file)) { + if (!strncmp(value, cmdline, strlen(value))) { + // set EGL debug if the "debug.egl.debug_proc" property + // matches the prefix of this application's command line + propertyLevel = 1; } - fclose(file); } + fclose(file); } } - if (getEGLDebugLevel() > 0) { - if (GLTrace_start() < 0) { - ALOGE("Error starting Tracer for OpenGL ES. Disabling.."); - setEGLDebugLevel(0); - } + gEGLDebugLevel = propertyLevel || sEGLApplicationDebugLevel; + if (gEGLDebugLevel > 0) { + GLTrace_start(); } } void setGLHooksThreadSpecific(gl_hooks_t const *value) { - if (sEGLGetErrorEnabled) { - setGlTraceThreadSpecific(value); - setGlThreadSpecific(&gHooksErrorTrace); - } else if (sEGLSystraceEnabled) { - setGlTraceThreadSpecific(value); - setGlThreadSpecific(&gHooksSystrace); - } else if (sEGLTraceLevel > 0) { + if (sEGLTraceLevel > 0) { setGlTraceThreadSpecific(value); setGlThreadSpecific(&gHooksTrace); - } else if (getEGLDebugLevel() > 0 && value != &gHooksNoContext) { + } else if (gEGLDebugLevel > 0 && value != &gHooksNoContext) { setGlTraceThreadSpecific(value); setGlThreadSpecific(GLTrace_getGLHooks()); } else { - setGlTraceThreadSpecific(NULL); setGlThreadSpecific(value); } } @@ -193,12 +149,9 @@ * Global entry point to allow applications to modify their own debug level. * Debugging is enabled if either the application requested it, or if the system property * matches the application's name. - * Note that this only sets the debug level. The value is read and used either in - * initEglDebugLevel() if the application hasn't initialized its display yet, or when - * eglSwapBuffers() is called next. */ void EGLAPI setGLDebugLevel(int level) { - setEGLDebugLevel(level); + sEGLApplicationDebugLevel = level; } #else @@ -213,33 +166,34 @@ static int gl_no_context() { if (egl_tls_t::logNoContextCall()) { - char const* const error = "call to OpenGL ES API with " - "no current context (logged once per thread)"; - if (LOG_NDEBUG) { - ALOGE(error); - } else { - LOG_ALWAYS_FATAL(error); - } + ALOGE("call to OpenGL ES API with no current context " + "(logged once per thread)"); char value[PROPERTY_VALUE_MAX]; property_get("debug.egl.callstack", value, "0"); if (atoi(value)) { - CallStack stack(LOG_TAG); + CallStack stack; + stack.update(); + stack.dump(); } } return 0; } -static void early_egl_init(void) +static void early_egl_init(void) { +#if !USE_FAST_TLS_KEY + pthread_key_create(&gGLWrapperKey, NULL); +#endif #if EGL_TRACE pthread_key_create(&gGLTraceKey, NULL); initEglTraceLevel(); + initEglDebugLevel(); #endif - int numHooks = sizeof(gHooksNoContext) / sizeof(EGLFuncPointer); - EGLFuncPointer *iter = reinterpret_cast(&gHooksNoContext); - for (int hook = 0; hook < numHooks; ++hook) { - *(iter++) = reinterpret_cast(gl_no_context); - } + uint32_t addr = (uint32_t)((void*)gl_no_context); + android_memset32( + (uint32_t*)(void*)&gHooksNoContext, + addr, + sizeof(gHooksNoContext)); setGLHooksThreadSpecific(&gHooksNoContext); } @@ -292,44 +246,6 @@ return (const GLubyte *)c->gl_extensions.string(); } -const GLubyte * egl_get_string_for_current_context(GLenum name, GLuint index) { - // NOTE: returning NULL here will fall-back to the default - // implementation. - - EGLContext context = egl_tls_t::getContext(); - if (context == EGL_NO_CONTEXT) - return NULL; - - egl_context_t const * const c = get_context(context); - if (c == NULL) // this should never happen, by construction - return NULL; - - if (name != GL_EXTENSIONS) - return NULL; - - // if index is out of bounds, assume it will be in the default - // implementation too, so we don't have to generate a GL error here - if (index >= c->tokenized_gl_extensions.size()) - return NULL; - - return (const GLubyte *)c->tokenized_gl_extensions.itemAt(index).string(); -} - -GLint egl_get_num_extensions_for_current_context() { - // NOTE: returning -1 here will fall-back to the default - // implementation. - - EGLContext context = egl_tls_t::getContext(); - if (context == EGL_NO_CONTEXT) - return -1; - - egl_context_t const * const c = get_context(context); - if (c == NULL) // this should never happen, by construction - return -1; - - return (GLint)c->tokenized_gl_extensions.size(); -} - // ---------------------------------------------------------------------------- // this mutex protects: @@ -368,27 +284,8 @@ return res; } -static pthread_mutex_t sLogPrintMutex = PTHREAD_MUTEX_INITIALIZER; -static nsecs_t sLogPrintTime = 0; -#define NSECS_DURATION 1000000000 - void gl_unimplemented() { - bool printLog = false; - nsecs_t now = systemTime(); - pthread_mutex_lock(&sLogPrintMutex); - if ((now - sLogPrintTime) > NSECS_DURATION) { - sLogPrintTime = now; - printLog = true; - } - pthread_mutex_unlock(&sLogPrintMutex); - if (printLog) { - ALOGE("called unimplemented OpenGL ES API"); - char value[PROPERTY_VALUE_MAX]; - property_get("debug.egl.callstack", value, "0"); - if (atoi(value)) { - CallStack stack(LOG_TAG); - } - } + ALOGE("called unimplemented OpenGL ES API"); } void gl_noop() { @@ -396,11 +293,42 @@ // ---------------------------------------------------------------------------- +#if USE_FAST_TLS_KEY + +// We have a dedicated TLS slot in bionic +static inline gl_hooks_t const * volatile * get_tls_hooks() { + volatile void *tls_base = __get_tls(); + gl_hooks_t const * volatile * tls_hooks = + reinterpret_cast(tls_base); + return tls_hooks; +} + void setGlThreadSpecific(gl_hooks_t const *value) { gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); tls_hooks[TLS_SLOT_OPENGL_API] = value; } +gl_hooks_t const* getGlThreadSpecific() { + gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); + gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; + if (hooks) return hooks; + return &gHooksNoContext; +} + +#else + +void setGlThreadSpecific(gl_hooks_t const *value) { + pthread_setspecific(gGLWrapperKey, value); +} + +gl_hooks_t const* getGlThreadSpecific() { + gl_hooks_t const* hooks = static_cast(pthread_getspecific(gGLWrapperKey)); + if (hooks) return hooks; + return &gHooksNoContext; +} + +#endif + // ---------------------------------------------------------------------------- // GL / EGL hooks // ---------------------------------------------------------------------------- @@ -411,7 +339,7 @@ #define EGL_ENTRY(_r, _api, ...) #_api, char const * const gl_names[] = { - #include "../entries.in" + #include "entries.in" NULL }; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egldefs.h android-platform-frameworks-native-21/opengl/libs/EGL/egldefs.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egldefs.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egldefs.h 2012-10-16 22:57:11.000000000 +0000 @@ -17,7 +17,7 @@ #ifndef ANDROID_EGLDEFS_H #define ANDROID_EGLDEFS_H -#include "../hooks.h" +#include "hooks.h" #define VERSION_MAJOR 1 #define VERSION_MINOR 4 @@ -43,10 +43,6 @@ EGLint major; EGLint minor; egl_t egl; - - void* libEgl; - void* libGles1; - void* libGles2; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_display.cpp android-platform-frameworks-native-21/opengl/libs/EGL/egl_display.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_display.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_display.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -18,12 +18,11 @@ #include -#include "../egl_impl.h" - #include "egl_cache.h" #include "egl_display.h" #include "egl_object.h" #include "egl_tls.h" +#include "egl_impl.h" #include "Loader.h" #include @@ -35,8 +34,32 @@ static char const * const sVersionString = "1.4 Android META-EGL"; static char const * const sClientApiString = "OpenGL_ES"; -extern char const * const gBuiltinExtensionString; -extern char const * const gExtensionString; +// this is the list of EGL extensions that are exposed to applications +// some of them are mandatory because used by the ANDROID system. +// +// mandatory extensions are required per the CDD and not explicitly +// checked during EGL initialization. the system *assumes* these extensions +// are present. the system may not function properly if some mandatory +// extensions are missing. +// +// NOTE: sExtensionString MUST be have a single space as the last character. +// +static char const * const sExtensionString = + "EGL_KHR_image " // mandatory + "EGL_KHR_image_base " // mandatory + "EGL_KHR_image_pixmap " + "EGL_KHR_gl_texture_2D_image " + "EGL_KHR_gl_texture_cubemap_image " + "EGL_KHR_gl_renderbuffer_image " + "EGL_KHR_fence_sync " + "EGL_NV_system_time " + "EGL_ANDROID_image_native_buffer " // mandatory + ; + +// extensions not exposed to applications but used by the ANDROID system +// "EGL_ANDROID_recordable " // mandatory +// "EGL_ANDROID_blob_cache " // strongly recommended +// "EGL_IMG_hibernate_process " // optional extern void initEglTraceLevel(); extern void initEglDebugLevel(); @@ -44,20 +67,10 @@ // ---------------------------------------------------------------------------- -static bool findExtension(const char* exts, const char* name, size_t nameLen) { - if (exts) { - const char* match = strstr(exts, name); - if (match && (match[nameLen] == '\0' || match[nameLen] == ' ')) { - return true; - } - } - return false; -} - egl_display_t egl_display_t::sDisplay[NUM_DISPLAYS]; egl_display_t::egl_display_t() : - magic('_dpy'), finishOnSwap(false), traceGpuCompletion(false), refs(0), eglIsInitialized(false) { + magic('_dpy'), finishOnSwap(false), traceGpuCompletion(false), refs(0) { } egl_display_t::~egl_display_t() { @@ -120,188 +133,173 @@ EGLBoolean egl_display_t::initialize(EGLint *major, EGLint *minor) { - { - Mutex::Autolock _rf(refLock); + Mutex::Autolock _l(lock); + if (refs > 0) { + if (major != NULL) + *major = VERSION_MAJOR; + if (minor != NULL) + *minor = VERSION_MINOR; refs++; - if (refs > 1) { - if (major != NULL) - *major = VERSION_MAJOR; - if (minor != NULL) - *minor = VERSION_MINOR; - while(!eglIsInitialized) refCond.wait(refLock); - return EGL_TRUE; - } - - while(eglIsInitialized) refCond.wait(refLock); + return EGL_TRUE; } - { - Mutex::Autolock _l(lock); - #if EGL_TRACE - // Called both at early_init time and at this time. (Early_init is pre-zygote, so - // the information from that call may be stale.) - initEglTraceLevel(); - initEglDebugLevel(); + // Called both at early_init time and at this time. (Early_init is pre-zygote, so + // the information from that call may be stale.) + initEglTraceLevel(); + initEglDebugLevel(); #endif - setGLHooksThreadSpecific(&gHooksNoContext); + setGLHooksThreadSpecific(&gHooksNoContext); - // initialize each EGL and - // build our own extension string first, based on the extension we know - // and the extension supported by our client implementation - - egl_connection_t* const cnx = &gEGLImpl; - cnx->major = -1; - cnx->minor = -1; - if (cnx->dso) { - EGLDisplay idpy = disp.dpy; - if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) { - //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p", - // idpy, cnx->major, cnx->minor, cnx); - - // display is now initialized - disp.state = egl_display_t::INITIALIZED; - - // get the query-strings for this display for each implementation - disp.queryString.vendor = cnx->egl.eglQueryString(idpy, - EGL_VENDOR); - disp.queryString.version = cnx->egl.eglQueryString(idpy, - EGL_VERSION); - disp.queryString.extensions = cnx->egl.eglQueryString(idpy, - EGL_EXTENSIONS); - disp.queryString.clientApi = cnx->egl.eglQueryString(idpy, - EGL_CLIENT_APIS); - - } else { - ALOGW("eglInitialize(%p) failed (%s)", idpy, - egl_tls_t::egl_strerror(cnx->egl.eglGetError())); - } + // initialize each EGL and + // build our own extension string first, based on the extension we know + // and the extension supported by our client implementation + + egl_connection_t* const cnx = &gEGLImpl; + cnx->major = -1; + cnx->minor = -1; + if (cnx->dso) { + +#if defined(ADRENO130) +#warning "Adreno-130 eglInitialize() workaround" + /* + * The ADRENO 130 driver returns a different EGLDisplay each time + * eglGetDisplay() is called, but also makes the EGLDisplay invalid + * after eglTerminate() has been called, so that eglInitialize() + * cannot be called again. Therefore, we need to make sure to call + * eglGetDisplay() before calling eglInitialize(); + */ + if (i == IMPL_HARDWARE) { + disp[i].dpy = cnx->egl.eglGetDisplay(EGL_DEFAULT_DISPLAY); } +#endif - // the query strings are per-display - mVendorString.setTo(sVendorString); - mVersionString.setTo(sVersionString); - mClientApiString.setTo(sClientApiString); - - mExtensionString.setTo(gBuiltinExtensionString); - char const* start = gExtensionString; - char const* end; - do { - // find the space separating this extension for the next one - end = strchr(start, ' '); - if (end) { - // length of the extension string - const size_t len = end - start; - if (len) { - // NOTE: we could avoid the copy if we had strnstr. - const String8 ext(start, len); - if (findExtension(disp.queryString.extensions, ext.string(), - len)) { + EGLDisplay idpy = disp.dpy; + if (cnx->egl.eglInitialize(idpy, &cnx->major, &cnx->minor)) { + //ALOGD("initialized dpy=%p, ver=%d.%d, cnx=%p", + // idpy, cnx->major, cnx->minor, cnx); + + // display is now initialized + disp.state = egl_display_t::INITIALIZED; + + // get the query-strings for this display for each implementation + disp.queryString.vendor = cnx->egl.eglQueryString(idpy, + EGL_VENDOR); + disp.queryString.version = cnx->egl.eglQueryString(idpy, + EGL_VERSION); + disp.queryString.extensions = cnx->egl.eglQueryString(idpy, + EGL_EXTENSIONS); + disp.queryString.clientApi = cnx->egl.eglQueryString(idpy, + EGL_CLIENT_APIS); + + } else { + ALOGW("eglInitialize(%p) failed (%s)", idpy, + egl_tls_t::egl_strerror(cnx->egl.eglGetError())); + } + } + + // the query strings are per-display + mVendorString.setTo(sVendorString); + mVersionString.setTo(sVersionString); + mClientApiString.setTo(sClientApiString); + + // we only add extensions that exist in the implementation + char const* start = sExtensionString; + char const* end; + do { + // find the space separating this extension for the next one + end = strchr(start, ' '); + if (end) { + // length of the extension string + const size_t len = end - start; + if (len) { + // NOTE: we could avoid the copy if we had strnstr. + const String8 ext(start, len); + // now look for this extension + if (disp.queryString.extensions) { + // if we find it, add this extension string to our list + // (and don't forget the space) + const char* match = strstr(disp.queryString.extensions, ext.string()); + if (match && (match[len] == ' ' || match[len] == 0)) { mExtensionString.append(start, len+1); } } - // process the next extension string, and skip the space. - start = end + 1; } - } while (end); - - egl_cache_t::get()->initialize(this); - - char value[PROPERTY_VALUE_MAX]; - property_get("debug.egl.finish", value, "0"); - if (atoi(value)) { - finishOnSwap = true; - } - - property_get("debug.egl.traceGpuCompletion", value, "0"); - if (atoi(value)) { - traceGpuCompletion = true; + // process the next extension string, and skip the space. + start = end + 1; } + } while (end); - if (major != NULL) - *major = VERSION_MAJOR; - if (minor != NULL) - *minor = VERSION_MINOR; + egl_cache_t::get()->initialize(this); - mHibernation.setDisplayValid(true); + char value[PROPERTY_VALUE_MAX]; + property_get("debug.egl.finish", value, "0"); + if (atoi(value)) { + finishOnSwap = true; } - { - Mutex::Autolock _rf(refLock); - eglIsInitialized = true; - refCond.broadcast(); + property_get("debug.egl.traceGpuCompletion", value, "0"); + if (atoi(value)) { + traceGpuCompletion = true; } + refs++; + if (major != NULL) + *major = VERSION_MAJOR; + if (minor != NULL) + *minor = VERSION_MINOR; + + mHibernation.setDisplayValid(true); + return EGL_TRUE; } EGLBoolean egl_display_t::terminate() { - { - Mutex::Autolock _rl(refLock); - if (refs == 0) { - /* - * From the EGL spec (3.2): - * "Termination of a display that has already been terminated, - * (...), is allowed, but the only effect of such a call is - * to return EGL_TRUE (...) - */ - return EGL_TRUE; - } + Mutex::Autolock _l(lock); + + if (refs == 0) { + return setError(EGL_NOT_INITIALIZED, EGL_FALSE); + } - // this is specific to Android, display termination is ref-counted. + // this is specific to Android, display termination is ref-counted. + if (refs > 1) { refs--; - if (refs > 0) { - return EGL_TRUE; - } + return EGL_TRUE; } EGLBoolean res = EGL_FALSE; - - { - Mutex::Autolock _l(lock); - - egl_connection_t* const cnx = &gEGLImpl; - if (cnx->dso && disp.state == egl_display_t::INITIALIZED) { - if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) { - ALOGW("eglTerminate(%p) failed (%s)", disp.dpy, - egl_tls_t::egl_strerror(cnx->egl.eglGetError())); - } - // REVISIT: it's unclear what to do if eglTerminate() fails - disp.state = egl_display_t::TERMINATED; - res = EGL_TRUE; + egl_connection_t* const cnx = &gEGLImpl; + if (cnx->dso && disp.state == egl_display_t::INITIALIZED) { + if (cnx->egl.eglTerminate(disp.dpy) == EGL_FALSE) { + ALOGW("eglTerminate(%p) failed (%s)", disp.dpy, + egl_tls_t::egl_strerror(cnx->egl.eglGetError())); } + // REVISIT: it's unclear what to do if eglTerminate() fails + disp.state = egl_display_t::TERMINATED; + res = EGL_TRUE; + } - mHibernation.setDisplayValid(false); - - // Reset the extension string since it will be regenerated if we get - // reinitialized. - mExtensionString.setTo(""); - - // Mark all objects remaining in the list as terminated, unless - // there are no reference to them, it which case, we're free to - // delete them. - size_t count = objects.size(); - ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count); - for (size_t i=0 ; idestroy(); - } + mHibernation.setDisplayValid(false); - // this marks all object handles are "terminated" - objects.clear(); + // Mark all objects remaining in the list as terminated, unless + // there are no reference to them, it which case, we're free to + // delete them. + size_t count = objects.size(); + ALOGW_IF(count, "eglTerminate() called w/ %d objects remaining", count); + for (size_t i=0 ; idestroy(); } - { - Mutex::Autolock _rl(refLock); - eglIsInitialized = false; - refCond.broadcast(); - } + // this marks all object handles are "terminated" + objects.clear(); + refs--; return res; } @@ -338,7 +336,7 @@ } EGLBoolean egl_display_t::makeCurrent(egl_context_t* c, egl_context_t* cur_c, - EGLSurface draw, EGLSurface read, EGLContext /*ctx*/, + EGLSurface draw, EGLSurface read, EGLContext ctx, EGLSurface impl_draw, EGLSurface impl_read, EGLContext impl_ctx) { EGLBoolean result; @@ -382,13 +380,6 @@ return result; } -bool egl_display_t::haveExtension(const char* name, size_t nameLen) const { - if (!nameLen) { - nameLen = strlen(name); - } - return findExtension(mExtensionString.string(), name, nameLen); -} - // ---------------------------------------------------------------------------- bool egl_display_t::HibernationMachine::incWakeCount(WakeRefStrength strength) { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_display.h android-platform-frameworks-native-21/opengl/libs/EGL/egl_display.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_display.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_display.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -24,6 +24,8 @@ #include #include +#include +#include #include #include @@ -31,7 +33,7 @@ #include #include "egldefs.h" -#include "../hooks.h" +#include "hooks.h" // ---------------------------------------------------------------------------- namespace android { @@ -39,7 +41,7 @@ class egl_object_t; class egl_context_t; -struct egl_connection_t; +class egl_connection_t; // ---------------------------------------------------------------------------- @@ -99,8 +101,6 @@ char const * getClientApiString() const { return mClientApiString.string(); } char const * getExtensionString() const { return mExtensionString.string(); } - bool haveExtension(const char* name, size_t nameLen = 0) const; - inline uint32_t getRefsCount() const { return refs; } struct strings_t { @@ -131,9 +131,7 @@ void leave() { return mHibernation.decWakeCount(HibernationMachine::WEAK); } uint32_t refs; - bool eglIsInitialized; - mutable Mutex lock, refLock; - mutable Condition refCond; + mutable Mutex lock; SortedVector objects; String8 mVendorString; String8 mVersionString; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_entries.in android-platform-frameworks-native-21/opengl/libs/EGL/egl_entries.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_entries.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_entries.in 2012-10-16 22:57:11.000000000 +0000 @@ -56,30 +56,12 @@ EGL_ENTRY(EGLSyncKHR, eglCreateSyncKHR, EGLDisplay, EGLenum, const EGLint *) EGL_ENTRY(EGLBoolean, eglDestroySyncKHR, EGLDisplay, EGLSyncKHR) EGL_ENTRY(EGLint, eglClientWaitSyncKHR, EGLDisplay, EGLSyncKHR, EGLint, EGLTimeKHR) -EGL_ENTRY(EGLBoolean, eglSignalSyncKHR, EGLDisplay, EGLSyncKHR, EGLenum) EGL_ENTRY(EGLBoolean, eglGetSyncAttribKHR, EGLDisplay, EGLSyncKHR, EGLint, EGLint *) -/* EGL_EGLEXT_VERSION 15 */ - -EGL_ENTRY(EGLStreamKHR, eglCreateStreamKHR, EGLDisplay, const EGLint *) -EGL_ENTRY(EGLBoolean, eglDestroyStreamKHR, EGLDisplay, EGLStreamKHR) -EGL_ENTRY(EGLBoolean, eglStreamAttribKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint) -EGL_ENTRY(EGLBoolean, eglQueryStreamKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLint *) -EGL_ENTRY(EGLBoolean, eglQueryStreamu64KHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLuint64KHR *) -EGL_ENTRY(EGLBoolean, eglStreamConsumerGLTextureExternalKHR, EGLDisplay, EGLStreamKHR) -EGL_ENTRY(EGLBoolean, eglStreamConsumerAcquireKHR, EGLDisplay, EGLStreamKHR) -EGL_ENTRY(EGLBoolean, eglStreamConsumerReleaseKHR, EGLDisplay, EGLStreamKHR) -EGL_ENTRY(EGLSurface, eglCreateStreamProducerSurfaceKHR, EGLDisplay, EGLConfig, EGLStreamKHR, const EGLint *) -EGL_ENTRY(EGLBoolean, eglQueryStreamTimeKHR, EGLDisplay, EGLStreamKHR, EGLenum, EGLTimeKHR*) -EGL_ENTRY(EGLNativeFileDescriptorKHR, eglGetStreamFileDescriptorKHR, EGLDisplay, EGLStreamKHR) -EGL_ENTRY(EGLStreamKHR, eglCreateStreamFromFileDescriptorKHR, EGLDisplay, EGLNativeFileDescriptorKHR) -EGL_ENTRY(EGLint, eglWaitSyncKHR, EGLDisplay, EGLSyncKHR, EGLint) - /* ANDROID extensions */ EGL_ENTRY(EGLBoolean, eglSetSwapRectangleANDROID, EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint) EGL_ENTRY(EGLClientBuffer, eglGetRenderBufferANDROID, EGLDisplay, EGLSurface) -EGL_ENTRY(EGLint, eglDupNativeFenceFDANDROID, EGLDisplay, EGLSyncKHR) /* NVIDIA extensions */ @@ -89,9 +71,4 @@ /* IMG extensions */ EGL_ENTRY(EGLBoolean, eglHibernateProcessIMG, void) -EGL_ENTRY(EGLBoolean, eglAwakenProcessIMG, void) - -/* Partial update extensions */ - -EGL_ENTRY(EGLBoolean, eglSwapBuffersWithDamageKHR, EGLDisplay, EGLSurface, EGLint *, EGLint) -EGL_ENTRY(EGLBoolean, eglSetDamageRegionKHR, EGLDisplay, EGLSurface, EGLint *, EGLint) +EGL_ENTRY(EGLBoolean, eglAwakenProcessIMG, void) \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_object.cpp android-platform-frameworks-native-21/opengl/libs/EGL/egl_object.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_object.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_object.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,28 +1,27 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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 -#include - #include #include #include #include #include +#include +#include #include @@ -116,14 +115,6 @@ temp.append(gl_extensions); gl_extensions.setTo(temp); } - - // tokenize the supported extensions for the glGetStringi() wrapper - std::stringstream ss; - std::string str; - ss << gl_extensions.string(); - while (ss >> str) { - tokenized_gl_extensions.push(String8(str.c_str())); - } } } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_object.h android-platform-frameworks-native-21/opengl/libs/EGL/egl_object.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_object.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_object.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -24,10 +24,11 @@ #include #include +#include +#include #include #include -#include #include @@ -160,7 +161,6 @@ egl_connection_t const* cnx; int version; String8 gl_extensions; - Vector tokenized_gl_extensions; }; // ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_tls.cpp android-platform-frameworks-native-21/opengl/libs/EGL/egl_tls.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_tls.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_tls.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -29,8 +29,8 @@ namespace android { -pthread_key_t egl_tls_t::sKey = TLS_KEY_NOT_INITIALIZED; -pthread_once_t egl_tls_t::sOnceKey = PTHREAD_ONCE_INIT; +pthread_key_t egl_tls_t::sKey = -1; +pthread_mutex_t egl_tls_t::sLockKey = PTHREAD_MUTEX_INITIALIZER; egl_tls_t::egl_tls_t() : error(EGL_SUCCESS), ctx(0), logCallWithNoContext(EGL_TRUE) { @@ -59,12 +59,12 @@ void egl_tls_t::validateTLSKey() { - struct TlsKeyInitializer { - static void create() { - pthread_key_create(&sKey, (void (*)(void*))&eglReleaseThread); - } - }; - pthread_once(&sOnceKey, TlsKeyInitializer::create); + if (sKey == -1) { + pthread_mutex_lock(&sLockKey); + if (sKey == -1) + pthread_key_create(&sKey, NULL); + pthread_mutex_unlock(&sLockKey); + } } void egl_tls_t::setErrorEtcImpl( @@ -78,7 +78,9 @@ char value[PROPERTY_VALUE_MAX]; property_get("debug.egl.callstack", value, "0"); if (atoi(value)) { - CallStack stack(LOG_TAG); + CallStack stack; + stack.update(); + stack.dump(); } } tls->error = error; @@ -104,11 +106,11 @@ } void egl_tls_t::clearTLS() { - if (sKey != TLS_KEY_NOT_INITIALIZED) { + if (sKey != -1) { egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey); if (tls) { - pthread_setspecific(sKey, 0); delete tls; + pthread_setspecific(sKey, 0); } } } @@ -120,13 +122,10 @@ } EGLint egl_tls_t::getError() { - if (sKey == TLS_KEY_NOT_INITIALIZED) { + if (sKey == -1) return EGL_SUCCESS; - } egl_tls_t* tls = (egl_tls_t*)pthread_getspecific(sKey); - if (!tls) { - return EGL_SUCCESS; - } + if (!tls) return EGL_SUCCESS; EGLint error = tls->error; tls->error = EGL_SUCCESS; return error; @@ -138,9 +137,8 @@ } EGLContext egl_tls_t::getContext() { - if (sKey == TLS_KEY_NOT_INITIALIZED) { + if (sKey == -1) return EGL_NO_CONTEXT; - } egl_tls_t* tls = (egl_tls_t *)pthread_getspecific(sKey); if (!tls) return EGL_NO_CONTEXT; return tls->ctx; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_tls.h android-platform-frameworks-native-21/opengl/libs/EGL/egl_tls.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/egl_tls.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/egl_tls.h 2012-10-16 22:57:11.000000000 +0000 @@ -22,6 +22,7 @@ #include #include "egldefs.h" +#include "hooks.h" // ---------------------------------------------------------------------------- namespace android { @@ -30,9 +31,8 @@ class DbgContext; class egl_tls_t { - enum { TLS_KEY_NOT_INITIALIZED = -1 }; static pthread_key_t sKey; - static pthread_once_t sOnceKey; + static pthread_mutex_t sLockKey; EGLint error; EGLContext ctx; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/getProcAddress.cpp android-platform-frameworks-native-21/opengl/libs/EGL/getProcAddress.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/getProcAddress.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/getProcAddress.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -21,6 +21,7 @@ #include #include "egldefs.h" +#include "hooks.h" // ---------------------------------------------------------------------------- namespace android { @@ -34,9 +35,16 @@ #undef GL_EXTENSION_LIST #undef GET_TLS -#if defined(__arm__) +#if USE_FAST_TLS_KEY - #define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n" + #ifdef HAVE_ARM_TLS_REGISTER + #define GET_TLS(reg) \ + "mrc p15, 0, " #reg ", c13, c0, 3 \n" + #else + #define GET_TLS(reg) \ + "mov " #reg ", #0xFFFF0FFF \n" \ + "ldr " #reg ", [" #reg ", #-15] \n" + #endif #define API_ENTRY(_api) __attribute__((naked)) _api @@ -53,153 +61,25 @@ : [tls] "J"(TLS_SLOT_OPENGL_API*4), \ [api] "J"(__builtin_offsetof(gl_hooks_t, \ ext.extensions[_api])) \ - : "r12" \ - ); - -#elif defined(__aarch64__) - - #define API_ENTRY(_api) __attribute__((noinline)) _api - - #define CALL_GL_EXTENSION_API(_api) \ - asm volatile( \ - "mrs x16, tpidr_el0\n" \ - "ldr x16, [x16, %[tls]]\n" \ - "cbz x16, 1f\n" \ - "ldr x16, [x16, %[api]]\n" \ - "cbz x16, 1f\n" \ - "br x16\n" \ - "1:\n" \ - : \ - : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, \ - ext.extensions[_api])) \ - : "x16" \ - ); - -#elif defined(__i386__) - - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api - - #define CALL_GL_EXTENSION_API(_api) \ - register void** fn; \ - __asm__ volatile( \ - "mov %%gs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "cmovne %P[api](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "je 1f\n" \ - "jmp *%[fn]\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ - : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, \ - ext.extensions[_api])) \ - : "cc" \ - ); - -#elif defined(__x86_64__) - - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api - - #define CALL_GL_EXTENSION_API(_api) \ - register void** fn; \ - __asm__ volatile( \ - "mov %%fs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "cmovne %P[api](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "je 1f\n" \ - "jmp *%[fn]\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ - : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, \ - ext.extensions[_api])) \ - : "cc" \ - ); - -#elif defined(__mips64) - - #define API_ENTRY(_api) __attribute__((noinline)) _api - - #define CALL_GL_EXTENSION_API(_api, ...) \ - register unsigned int _t0 asm("$12"); \ - register unsigned int _fn asm("$25"); \ - register unsigned int _tls asm("$3"); \ - asm volatile( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - "rdhwr %[tls], $29\n\t" \ - "ld %[t0], %[OPENGL_API](%[tls])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " move %[fn], $ra\n\t" \ - "ld %[t0], %[API](%[t0])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " nop\n\t" \ - "move %[fn], %[t0]\n\t" \ - "1:\n\t" \ - "jalr $0, %[fn]\n\t" \ - " nop\n\t" \ - ".set pop\n\t" \ - : [fn] "=c"(_fn), \ - [tls] "=&r"(_tls), \ - [t0] "=&r"(_t0) \ - : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*4), \ - [API] "I"(__builtin_offsetof(gl_hooks_t, \ - ext.extensions[_api])) \ - : \ - ); - -#elif defined(__mips__) - - #define API_ENTRY(_api) __attribute__((noinline)) _api - - #define CALL_GL_EXTENSION_API(_api, ...) \ - register unsigned int _t0 asm("$8"); \ - register unsigned int _fn asm("$25"); \ - register unsigned int _tls asm("$3"); \ - asm volatile( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - ".set mips32r2\n\t" \ - "rdhwr %[tls], $29\n\t" \ - "lw %[t0], %[OPENGL_API](%[tls])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " move %[fn], $ra\n\t" \ - "lw %[t0], %[API](%[t0])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " nop\n\t" \ - "move %[fn], %[t0]\n\t" \ - "1:\n\t" \ - "jalr $0, %[fn]\n\t" \ - " nop\n\t" \ - ".set pop\n\t" \ - : [fn] "=c"(_fn), \ - [tls] "=&r"(_tls), \ - [t0] "=&r"(_t0) \ - : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*4), \ - [API] "I"(__builtin_offsetof(gl_hooks_t, \ - ext.extensions[_api])) \ - : \ + : \ ); -#endif - -#if defined(CALL_GL_EXTENSION_API) #define GL_EXTENSION_NAME(_n) __glExtFwd##_n #define GL_EXTENSION(_n) \ void API_ENTRY(GL_EXTENSION_NAME(_n))() { \ CALL_GL_EXTENSION_API(_n); \ } + + #else - #define GL_EXTENSION_NAME(_n) NULL - #define GL_EXTENSION(_n) + #define GL_EXTENSION_NAME(_n) NULL + + #define GL_EXTENSION(_n) + + #warning "eglGetProcAddress() partially supported" - #warning "eglGetProcAddress() partially supported" #endif diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/Loader.cpp android-platform-frameworks-native-21/opengl/libs/EGL/Loader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/Loader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/Loader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -21,16 +21,15 @@ #include #include #include -#include #include #include #include -#include "../glestrace.h" - #include "egldefs.h" +#include "glestrace.h" +#include "hooks.h" #include "Loader.h" // ---------------------------------------------------------------------------- @@ -39,26 +38,10 @@ /* - * EGL userspace drivers must be provided either: - * - as a single library: - * /vendor/lib/egl/libGLES.so - * - * - as separate libraries: - * /vendor/lib/egl/libEGL.so - * /vendor/lib/egl/libGLESv1_CM.so - * /vendor/lib/egl/libGLESv2.so - * - * The software renderer for the emulator must be provided as a single - * library at: - * - * /system/lib/egl/libGLES_android.so - * - * - * For backward compatibility and to facilitate the transition to - * this new naming scheme, the loader will additionally look for: - * - * /{vendor|system}/lib/egl/lib{GLES | [EGL|GLESv1_CM|GLESv2]}_*.so - * + * EGL drivers are called + * + * /system/lib/egl/lib{[EGL|GLESv1_CM|GLESv2] | GLES}_$TAG.so + * */ ANDROID_SINGLETON_STATIC_INSTANCE( Loader ) @@ -116,14 +99,14 @@ // ---------------------------------------------------------------------------- -Loader::driver_t::driver_t(void* gles) +Loader::driver_t::driver_t(void* gles) { dso[0] = gles; for (size_t i=1 ; i>> %u %u %s", dpy, impl, tag); + // We only load the h/w accelerated implementation + if (tag != String8("android")) { + mDriverTag = tag; + } + } + } + fclose(cfg); + } } -static void* load_wrapper(const char* path) { - void* so = dlopen(path, RTLD_NOW | RTLD_LOCAL); - ALOGE_IF(!so, "dlopen(\"%s\") failed: %s", path, dlerror()); - return so; +Loader::~Loader() +{ + GLTrace_stop(); } void* Loader::open(egl_connection_t* cnx) { void* dso; driver_t* hnd = 0; - - dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2); - if (dso) { - hnd = new driver_t(dso); - } else { - // Always load EGL first - dso = load_driver("EGL", cnx, EGL); + + char const* tag = mDriverTag.string(); + if (tag) { + dso = load_driver("GLES", tag, cnx, EGL | GLESv1_CM | GLESv2); if (dso) { hnd = new driver_t(dso); - hnd->set( load_driver("GLESv1_CM", cnx, GLESv1_CM), GLESv1_CM ); - hnd->set( load_driver("GLESv2", cnx, GLESv2), GLESv2 ); + } else { + // Always load EGL first + dso = load_driver("EGL", tag, cnx, EGL); + if (dso) { + hnd = new driver_t(dso); + // TODO: make this more automated + hnd->set( load_driver("GLESv1_CM", tag, cnx, GLESv1_CM), GLESv1_CM ); + hnd->set( load_driver("GLESv2", tag, cnx, GLESv2), GLESv2 ); + } } } - LOG_ALWAYS_FATAL_IF(!hnd, "couldn't find an OpenGL ES implementation"); - -#if defined(__LP64__) - cnx->libEgl = load_wrapper("/system/lib64/libEGL.so"); - cnx->libGles2 = load_wrapper("/system/lib64/libGLESv2.so"); - cnx->libGles1 = load_wrapper("/system/lib64/libGLESv1_CM.so"); -#else - cnx->libEgl = load_wrapper("/system/lib/libEGL.so"); - cnx->libGles2 = load_wrapper("/system/lib/libGLESv2.so"); - cnx->libGles1 = load_wrapper("/system/lib/libGLESv1_CM.so"); -#endif - LOG_ALWAYS_FATAL_IF(!cnx->libEgl, - "couldn't load system EGL wrapper libraries"); - - LOG_ALWAYS_FATAL_IF(!cnx->libGles2 || !cnx->libGles1, - "couldn't load system OpenGL ES wrapper libraries"); - + LOG_FATAL_IF(!index && !hnd, + "couldn't find the default OpenGL ES implementation " + "for default display"); + return (void*)hnd; } @@ -212,16 +211,16 @@ return NO_ERROR; } -void Loader::init_api(void* dso, - char const * const * api, - __eglMustCastToProperFunctionPointerType* curr, - getProcAddressType getProcAddress) +void Loader::init_api(void* dso, + char const * const * api, + __eglMustCastToProperFunctionPointerType* curr, + getProcAddressType getProcAddress) { const ssize_t SIZE = 256; char scrap[SIZE]; while (*api) { char const * name = *api; - __eglMustCastToProperFunctionPointerType f = + __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { // couldn't find the entry-point, use eglGetProcAddress() @@ -268,115 +267,21 @@ } } -void *Loader::load_driver(const char* kind, +void *Loader::load_driver(const char* kind, const char *tag, egl_connection_t* cnx, uint32_t mask) { - class MatchFile { - public: - static String8 find(const char* kind) { - String8 result; - String8 pattern; - pattern.appendFormat("lib%s", kind); - const char* const searchPaths[] = { -#if defined(__LP64__) - "/vendor/lib64/egl", - "/system/lib64/egl" -#else - "/vendor/lib/egl", - "/system/lib/egl" -#endif - }; - - // first, we search for the exact name of the GLES userspace - // driver in both locations. - // i.e.: - // libGLES.so, or: - // libEGL.so, libGLESv1_CM.so, libGLESv2.so - - for (size_t i=0 ; id_type == DT_DIR) { - continue; - } - if (!strcmp(e->d_name, "libGLES_android.so")) { - // always skip the software renderer - continue; - } - if (strstr(e->d_name, pattern.string()) == e->d_name) { - if (!strcmp(e->d_name + strlen(e->d_name) - 3, ".so")) { - result.clear(); - result.appendFormat("%s/%s", search, e->d_name); - closedir(d); - return true; - } - } - } - closedir(d); - } - return false; + char driver_absolute_path[PATH_MAX]; + const char* const search1 = "/vendor/lib/egl/lib%s_%s.so"; + const char* const search2 = "/system/lib/egl/lib%s_%s.so"; + + snprintf(driver_absolute_path, PATH_MAX, search1, kind, tag); + if (access(driver_absolute_path, R_OK)) { + snprintf(driver_absolute_path, PATH_MAX, search2, kind, tag); + if (access(driver_absolute_path, R_OK)) { + // this happens often, we don't want to log an error + return 0; } - }; - - - String8 absolutePath = MatchFile::find(kind); - if (absolutePath.isEmpty()) { - // this happens often, we don't want to log an error - return 0; } - const char* const driver_absolute_path = absolutePath.string(); void* dso = dlopen(driver_absolute_path, RTLD_NOW | RTLD_LOCAL); if (dso == 0) { @@ -390,16 +295,45 @@ if (mask & EGL) { getProcAddress = (getProcAddressType)dlsym(dso, "eglGetProcAddress"); - ALOGE_IF(!getProcAddress, + ALOGE_IF(!getProcAddress, "can't find eglGetProcAddress() in %s", driver_absolute_path); +#ifdef SYSTEMUI_PBSIZE_HACK +#warning "SYSTEMUI_PBSIZE_HACK enabled" + /* + * TODO: replace SYSTEMUI_PBSIZE_HACK by something less hackish + * + * Here we adjust the PB size from its default value to 512KB which + * is the minimum acceptable for the systemui process. + * We do this on low-end devices only because it allows us to enable + * h/w acceleration in the systemui process while keeping the + * memory usage down. + * + * Obviously, this is the wrong place and wrong way to make this + * adjustment, but at the time of this writing this was the safest + * solution. + */ + const char *cmdline = getProcessCmdline(); + if (strstr(cmdline, "systemui")) { + void *imgegl = dlopen("/vendor/lib/libIMGegl.so", RTLD_LAZY); + if (imgegl) { + unsigned int *PVRDefaultPBS = + (unsigned int *)dlsym(imgegl, "PVRDefaultPBS"); + if (PVRDefaultPBS) { + ALOGD("setting default PBS to 512KB, was %d KB", *PVRDefaultPBS / 1024); + *PVRDefaultPBS = 512*1024; + } + } + } +#endif + egl_t* egl = &cnx->egl; __eglMustCastToProperFunctionPointerType* curr = (__eglMustCastToProperFunctionPointerType*)egl; char const * const * api = egl_names; while (*api) { char const * name = *api; - __eglMustCastToProperFunctionPointerType f = + __eglMustCastToProperFunctionPointerType f = (__eglMustCastToProperFunctionPointerType)dlsym(dso, name); if (f == NULL) { // couldn't find the entry-point, use eglGetProcAddress() @@ -412,7 +346,7 @@ api++; } } - + if (mask & GLESv1_CM) { init_api(dso, gl_names, (__eglMustCastToProperFunctionPointerType*) @@ -426,7 +360,7 @@ &cnx->hooks[egl_connection_t::GLESv2_INDEX]->gl, getProcAddress); } - + return dso; } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/Loader.h android-platform-frameworks-native-21/opengl/libs/EGL/Loader.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/Loader.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/Loader.h 2012-10-16 22:57:11.000000000 +0000 @@ -52,6 +52,7 @@ void* dso[3]; }; + String8 mDriverTag; getProcAddressType getProcAddress; public: @@ -62,7 +63,7 @@ private: Loader(); - void *load_driver(const char* kind, egl_connection_t* cnx, uint32_t mask); + void *load_driver(const char* kind, const char *tag, egl_connection_t* cnx, uint32_t mask); static __attribute__((noinline)) void init_api(void* dso, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/trace.cpp android-platform-frameworks-native-21/opengl/libs/EGL/trace.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/EGL/trace.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/EGL/trace.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -21,14 +21,11 @@ #include #include +#include +#include #include -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -#include - -#include - #include "egl_tls.h" #include "hooks.h" @@ -37,8 +34,7 @@ // ---------------------------------------------------------------------------- struct GLenumString { - // The GL_TIMEOUT_IGNORED "enum" doesn't fit in a GLenum, so use GLuint64 - GLuint64 e; + GLenum e; const char* s; }; @@ -318,10 +314,6 @@ va_end(argp); } -/////////////////////////////////////////////////////////////////////////// -// Log trace -/////////////////////////////////////////////////////////////////////////// - #undef TRACE_GL_VOID #undef TRACE_GL @@ -357,104 +349,31 @@ }; #undef GL_ENTRY -#undef TRACE_GL_VOID -#undef TRACE_GL - -/////////////////////////////////////////////////////////////////////////// -// Systrace -/////////////////////////////////////////////////////////////////////////// #undef TRACE_GL_VOID #undef TRACE_GL +// define the ES 1.0 Debug_gl* functions as Tracing_gl functions #define TRACE_GL_VOID(_api, _args, _argList, ...) \ -static void Systrace_ ## _api _args { \ - ATRACE_NAME(#_api); \ +static void Debug_ ## _api _args { \ + TraceGL(#_api, __VA_ARGS__); \ gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \ _c->_api _argList; \ } #define TRACE_GL(_type, _api, _args, _argList, ...) \ -static _type Systrace_ ## _api _args { \ - ATRACE_NAME(#_api); \ +static _type Debug_ ## _api _args { \ + TraceGL(#_api, __VA_ARGS__); \ gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \ return _c->_api _argList; \ } extern "C" { -#include "../trace.in" +#include "../debug.in" } #undef TRACE_GL_VOID #undef TRACE_GL - -#define GL_ENTRY(_r, _api, ...) Systrace_ ## _api, -EGLAPI gl_hooks_t gHooksSystrace = { - { - #include "entries.in" - }, - { - {0} - } -}; -#undef GL_ENTRY - -/////////////////////////////////////////////////////////////////////////// -// -/////////////////////////////////////////////////////////////////////////// - -#undef TRACE_GL_VOID -#undef TRACE_GL - -#define CHECK_ERROR(_c, _api) \ - GLenum status = GL_NO_ERROR; \ - bool error = false; \ - while ((status = _c->glGetError()) != GL_NO_ERROR) { \ - ALOGD("[" #_api "] 0x%x", status); \ - error = true; \ - } \ - if (error) { \ - CallStack s; \ - s.update(); \ - s.log("glGetError:" #_api); \ - } \ - -#define TRACE_GL_VOID(_api, _args, _argList, ...) \ -static void ErrorTrace_ ## _api _args { \ - gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \ - _c->_api _argList; \ - CHECK_ERROR(_c, _api); \ -} - -#define TRACE_GL(_type, _api, _args, _argList, ...) \ -static _type ErrorTrace_ ## _api _args { \ - gl_hooks_t::gl_t const * const _c = &getGLTraceThreadSpecific()->gl; \ - _type _r = _c->_api _argList; \ - CHECK_ERROR(_c, _api); \ - return _r; \ -} - -extern "C" { -#include "../trace.in" -} - -#undef TRACE_GL_VOID -#undef TRACE_GL - -#define GL_ENTRY(_r, _api, ...) ErrorTrace_ ## _api, -EGLAPI gl_hooks_t gHooksErrorTrace = { - { - #include "entries.in" - }, - { - {0} - } -}; -#undef GL_ENTRY -#undef CHECK_ERROR - -#undef TRACE_GL_VOID -#undef TRACE_GL // ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/egl_impl.h android-platform-frameworks-native-21/opengl/libs/egl_impl.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/egl_impl.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/egl_impl.h 2012-10-16 22:57:11.000000000 +0000 @@ -30,9 +30,6 @@ // ---------------------------------------------------------------------------- EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name); -EGLAPI const GLubyte * egl_get_string_for_current_context(GLenum name, - GLuint index); -EGLAPI GLint egl_get_num_extensions_for_current_context(); // ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/entries.in android-platform-frameworks-native-21/opengl/libs/entries.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/entries.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/entries.in 2012-10-16 22:57:11.000000000 +0000 @@ -1,211 +1,137 @@ -GL_ENTRY(void, glActiveShaderProgram, GLuint pipeline, GLuint program) GL_ENTRY(void, glActiveShaderProgramEXT, GLuint pipeline, GLuint program) GL_ENTRY(void, glActiveTexture, GLenum texture) -GL_ENTRY(void, glAlphaFunc, GLenum func, GLfloat ref) +GL_ENTRY(void, glAlphaFunc, GLenum func, GLclampf ref) GL_ENTRY(void, glAlphaFuncQCOM, GLenum func, GLclampf ref) -GL_ENTRY(void, glAlphaFuncx, GLenum func, GLfixed ref) -GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLfixed ref) +GL_ENTRY(void, glAlphaFuncx, GLenum func, GLclampx ref) +GL_ENTRY(void, glAlphaFuncxOES, GLenum func, GLclampx ref) GL_ENTRY(void, glAttachShader, GLuint program, GLuint shader) GL_ENTRY(void, glBeginPerfMonitorAMD, GLuint monitor) -GL_ENTRY(void, glBeginPerfQueryINTEL, GLuint queryHandle) -GL_ENTRY(void, glBeginQuery, GLenum target, GLuint id) GL_ENTRY(void, glBeginQueryEXT, GLenum target, GLuint id) -GL_ENTRY(void, glBeginTransformFeedback, GLenum primitiveMode) -GL_ENTRY(void, glBindAttribLocation, GLuint program, GLuint index, const GLchar * name) +GL_ENTRY(void, glBindAttribLocation, GLuint program, GLuint index, const GLchar* name) GL_ENTRY(void, glBindBuffer, GLenum target, GLuint buffer) -GL_ENTRY(void, glBindBufferBase, GLenum target, GLuint index, GLuint buffer) -GL_ENTRY(void, glBindBufferRange, GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) GL_ENTRY(void, glBindFramebuffer, GLenum target, GLuint framebuffer) GL_ENTRY(void, glBindFramebufferOES, GLenum target, GLuint framebuffer) -GL_ENTRY(void, glBindImageTexture, GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) -GL_ENTRY(void, glBindProgramPipeline, GLuint pipeline) GL_ENTRY(void, glBindProgramPipelineEXT, GLuint pipeline) GL_ENTRY(void, glBindRenderbuffer, GLenum target, GLuint renderbuffer) GL_ENTRY(void, glBindRenderbufferOES, GLenum target, GLuint renderbuffer) -GL_ENTRY(void, glBindSampler, GLuint unit, GLuint sampler) GL_ENTRY(void, glBindTexture, GLenum target, GLuint texture) -GL_ENTRY(void, glBindTransformFeedback, GLenum target, GLuint id) -GL_ENTRY(void, glBindVertexArray, GLuint array) GL_ENTRY(void, glBindVertexArrayOES, GLuint array) -GL_ENTRY(void, glBindVertexBuffer, GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) -GL_ENTRY(void, glBlendBarrierKHR, void) -GL_ENTRY(void, glBlendBarrierNV, void) -GL_ENTRY(void, glBlendColor, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -GL_ENTRY(void, glBlendEquation, GLenum mode) +GL_ENTRY(void, glBlendColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +GL_ENTRY(void, glBlendEquation, GLenum mode ) GL_ENTRY(void, glBlendEquationOES, GLenum mode) GL_ENTRY(void, glBlendEquationSeparate, GLenum modeRGB, GLenum modeAlpha) GL_ENTRY(void, glBlendEquationSeparateOES, GLenum modeRGB, GLenum modeAlpha) -GL_ENTRY(void, glBlendEquationSeparateiEXT, GLuint buf, GLenum modeRGB, GLenum modeAlpha) -GL_ENTRY(void, glBlendEquationiEXT, GLuint buf, GLenum mode) GL_ENTRY(void, glBlendFunc, GLenum sfactor, GLenum dfactor) -GL_ENTRY(void, glBlendFuncSeparate, GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) +GL_ENTRY(void, glBlendFuncSeparate, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) GL_ENTRY(void, glBlendFuncSeparateOES, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -GL_ENTRY(void, glBlendFuncSeparateiEXT, GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) -GL_ENTRY(void, glBlendFunciEXT, GLuint buf, GLenum src, GLenum dst) -GL_ENTRY(void, glBlendParameteriNV, GLenum pname, GLint value) -GL_ENTRY(void, glBlitFramebuffer, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) GL_ENTRY(void, glBlitFramebufferANGLE, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) -GL_ENTRY(void, glBlitFramebufferNV, GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) -GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const void * data, GLenum usage) -GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const void * data) +GL_ENTRY(void, glBufferData, GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) +GL_ENTRY(void, glBufferSubData, GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) GL_ENTRY(GLenum, glCheckFramebufferStatus, GLenum target) GL_ENTRY(GLenum, glCheckFramebufferStatusOES, GLenum target) GL_ENTRY(void, glClear, GLbitfield mask) -GL_ENTRY(void, glClearBufferfi, GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) -GL_ENTRY(void, glClearBufferfv, GLenum buffer, GLint drawbuffer, const GLfloat * value) -GL_ENTRY(void, glClearBufferiv, GLenum buffer, GLint drawbuffer, const GLint * value) -GL_ENTRY(void, glClearBufferuiv, GLenum buffer, GLint drawbuffer, const GLuint * value) -GL_ENTRY(void, glClearColor, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) -GL_ENTRY(void, glClearColorx, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -GL_ENTRY(void, glClearColorxOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) -GL_ENTRY(void, glClearDepthf, GLfloat d) +GL_ENTRY(void, glClearColor, GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) +GL_ENTRY(void, glClearColorx, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) +GL_ENTRY(void, glClearColorxOES, GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) +GL_ENTRY(void, glClearDepthf, GLclampf depth) GL_ENTRY(void, glClearDepthfOES, GLclampf depth) -GL_ENTRY(void, glClearDepthx, GLfixed depth) -GL_ENTRY(void, glClearDepthxOES, GLfixed depth) +GL_ENTRY(void, glClearDepthx, GLclampx depth) +GL_ENTRY(void, glClearDepthxOES, GLclampx depth) GL_ENTRY(void, glClearStencil, GLint s) GL_ENTRY(void, glClientActiveTexture, GLenum texture) -GL_ENTRY(GLenum, glClientWaitSync, GLsync sync, GLbitfield flags, GLuint64 timeout) -GL_ENTRY(GLenum, glClientWaitSyncAPPLE, GLsync sync, GLbitfield flags, GLuint64 timeout) -GL_ENTRY(void, glClipPlanef, GLenum p, const GLfloat * eqn) -GL_ENTRY(void, glClipPlanefIMG, GLenum p, const GLfloat * eqn) -GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat * equation) -GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed * equation) -GL_ENTRY(void, glClipPlanexIMG, GLenum p, const GLfixed * eqn) -GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed * equation) +GL_ENTRY(void, glClipPlanef, GLenum plane, const GLfloat *equation) +GL_ENTRY(void, glClipPlanefIMG, GLenum p, const GLfloat *eqn) +GL_ENTRY(void, glClipPlanefOES, GLenum plane, const GLfloat *equation) +GL_ENTRY(void, glClipPlanex, GLenum plane, const GLfixed *equation) +GL_ENTRY(void, glClipPlanexIMG, GLenum p, const GLfixed *eqn) +GL_ENTRY(void, glClipPlanexOES, GLenum plane, const GLfixed *equation) GL_ENTRY(void, glColor4f, GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) GL_ENTRY(void, glColor4ub, GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) GL_ENTRY(void, glColor4x, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) GL_ENTRY(void, glColor4xOES, GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) GL_ENTRY(void, glColorMask, GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) -GL_ENTRY(void, glColorMaskiEXT, GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) -GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const void * pointer) +GL_ENTRY(void, glColorPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) GL_ENTRY(void, glCompileShader, GLuint shader) -GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) -GL_ENTRY(void, glCompressedTexImage3D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) -GL_ENTRY(void, glCompressedTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) -GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) -GL_ENTRY(void, glCompressedTexSubImage3D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) -GL_ENTRY(void, glCompressedTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) -GL_ENTRY(void, glCopyBufferSubData, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) -GL_ENTRY(void, glCopyBufferSubDataNV, GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) -GL_ENTRY(void, glCopyImageSubDataEXT, GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) +GL_ENTRY(void, glCompressedTexImage2D, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) +GL_ENTRY(void, glCompressedTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) +GL_ENTRY(void, glCompressedTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) +GL_ENTRY(void, glCompressedTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) GL_ENTRY(void, glCopyTexImage2D, GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) GL_ENTRY(void, glCopyTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glCopyTexSubImage3D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) GL_ENTRY(void, glCopyTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glCopyTextureLevelsAPPLE, GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount) GL_ENTRY(void, glCoverageMaskNV, GLboolean mask) GL_ENTRY(void, glCoverageOperationNV, GLenum operation) -GL_ENTRY(void, glCreatePerfQueryINTEL, GLuint queryId, GLuint * queryHandle) GL_ENTRY(GLuint, glCreateProgram, void) GL_ENTRY(GLuint, glCreateShader, GLenum type) -GL_ENTRY(GLuint, glCreateShaderProgramv, GLenum type, GLsizei count, const GLchar *const* strings) -GL_ENTRY(GLuint, glCreateShaderProgramvEXT, GLenum type, GLsizei count, const GLchar ** strings) +GL_ENTRY(GLuint, glCreateShaderProgramvEXT, GLenum type, GLsizei count, const GLchar **strings) GL_ENTRY(void, glCullFace, GLenum mode) GL_ENTRY(void, glCurrentPaletteMatrixOES, GLuint matrixpaletteindex) -GL_ENTRY(void, glDebugMessageCallbackKHR, GLDEBUGPROCKHR callback, const void * userParam) -GL_ENTRY(void, glDebugMessageControlKHR, GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled) -GL_ENTRY(void, glDebugMessageInsertKHR, GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf) -GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint * buffers) -GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint * fences) -GL_ENTRY(void, glDeleteFramebuffers, GLsizei n, const GLuint * framebuffers) -GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint * framebuffers) -GL_ENTRY(void, glDeletePerfMonitorsAMD, GLsizei n, GLuint * monitors) -GL_ENTRY(void, glDeletePerfQueryINTEL, GLuint queryHandle) +GL_ENTRY(void, glDeleteBuffers, GLsizei n, const GLuint *buffers) +GL_ENTRY(void, glDeleteFencesNV, GLsizei n, const GLuint *fences) +GL_ENTRY(void, glDeleteFramebuffers, GLsizei n, const GLuint* framebuffers) +GL_ENTRY(void, glDeleteFramebuffersOES, GLsizei n, const GLuint* framebuffers) +GL_ENTRY(void, glDeletePerfMonitorsAMD, GLsizei n, GLuint *monitors) GL_ENTRY(void, glDeleteProgram, GLuint program) -GL_ENTRY(void, glDeleteProgramPipelines, GLsizei n, const GLuint * pipelines) -GL_ENTRY(void, glDeleteProgramPipelinesEXT, GLsizei n, const GLuint * pipelines) -GL_ENTRY(void, glDeleteQueries, GLsizei n, const GLuint * ids) -GL_ENTRY(void, glDeleteQueriesEXT, GLsizei n, const GLuint * ids) -GL_ENTRY(void, glDeleteRenderbuffers, GLsizei n, const GLuint * renderbuffers) -GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint * renderbuffers) -GL_ENTRY(void, glDeleteSamplers, GLsizei count, const GLuint * samplers) +GL_ENTRY(void, glDeleteProgramPipelinesEXT, GLsizei n, const GLuint *pipelines) +GL_ENTRY(void, glDeleteQueriesEXT, GLsizei n, const GLuint *ids) +GL_ENTRY(void, glDeleteRenderbuffers, GLsizei n, const GLuint* renderbuffers) +GL_ENTRY(void, glDeleteRenderbuffersOES, GLsizei n, const GLuint* renderbuffers) GL_ENTRY(void, glDeleteShader, GLuint shader) -GL_ENTRY(void, glDeleteSync, GLsync sync) -GL_ENTRY(void, glDeleteSyncAPPLE, GLsync sync) -GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint * textures) -GL_ENTRY(void, glDeleteTransformFeedbacks, GLsizei n, const GLuint * ids) -GL_ENTRY(void, glDeleteVertexArrays, GLsizei n, const GLuint * arrays) -GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint * arrays) +GL_ENTRY(void, glDeleteTextures, GLsizei n, const GLuint *textures) +GL_ENTRY(void, glDeleteVertexArraysOES, GLsizei n, const GLuint *arrays) GL_ENTRY(void, glDepthFunc, GLenum func) GL_ENTRY(void, glDepthMask, GLboolean flag) -GL_ENTRY(void, glDepthRangef, GLfloat n, GLfloat f) -GL_ENTRY(void, glDepthRangefOES, GLclampf n, GLclampf f) -GL_ENTRY(void, glDepthRangex, GLfixed n, GLfixed f) -GL_ENTRY(void, glDepthRangexOES, GLfixed n, GLfixed f) +GL_ENTRY(void, glDepthRangef, GLclampf zNear, GLclampf zFar) +GL_ENTRY(void, glDepthRangefOES, GLclampf zNear, GLclampf zFar) +GL_ENTRY(void, glDepthRangex, GLclampx zNear, GLclampx zFar) +GL_ENTRY(void, glDepthRangexOES, GLclampx zNear, GLclampx zFar) GL_ENTRY(void, glDetachShader, GLuint program, GLuint shader) GL_ENTRY(void, glDisable, GLenum cap) GL_ENTRY(void, glDisableClientState, GLenum array) GL_ENTRY(void, glDisableDriverControlQCOM, GLuint driverControl) GL_ENTRY(void, glDisableVertexAttribArray, GLuint index) -GL_ENTRY(void, glDisableiEXT, GLenum target, GLuint index) -GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum * attachments) -GL_ENTRY(void, glDispatchCompute, GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) -GL_ENTRY(void, glDispatchComputeIndirect, GLintptr indirect) +GL_ENTRY(void, glDiscardFramebufferEXT, GLenum target, GLsizei numAttachments, const GLenum *attachments) GL_ENTRY(void, glDrawArrays, GLenum mode, GLint first, GLsizei count) -GL_ENTRY(void, glDrawArraysIndirect, GLenum mode, const void * indirect) -GL_ENTRY(void, glDrawArraysInstanced, GLenum mode, GLint first, GLsizei count, GLsizei instancecount) -GL_ENTRY(void, glDrawArraysInstancedANGLE, GLenum mode, GLint first, GLsizei count, GLsizei primcount) -GL_ENTRY(void, glDrawArraysInstancedEXT, GLenum mode, GLint start, GLsizei count, GLsizei primcount) -GL_ENTRY(void, glDrawArraysInstancedNV, GLenum mode, GLint first, GLsizei count, GLsizei primcount) -GL_ENTRY(void, glDrawBuffers, GLsizei n, const GLenum * bufs) -GL_ENTRY(void, glDrawBuffersEXT, GLsizei n, const GLenum * bufs) -GL_ENTRY(void, glDrawBuffersIndexedEXT, GLint n, const GLenum * location, const GLint * indices) -GL_ENTRY(void, glDrawBuffersNV, GLsizei n, const GLenum * bufs) -GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const void * indices) -GL_ENTRY(void, glDrawElementsIndirect, GLenum mode, GLenum type, const void * indirect) -GL_ENTRY(void, glDrawElementsInstanced, GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount) -GL_ENTRY(void, glDrawElementsInstancedANGLE, GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) -GL_ENTRY(void, glDrawElementsInstancedEXT, GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) -GL_ENTRY(void, glDrawElementsInstancedNV, GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) -GL_ENTRY(void, glDrawRangeElements, GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices) +GL_ENTRY(void, glDrawBuffersNV, GLsizei n, const GLenum *bufs) +GL_ENTRY(void, glDrawElements, GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) GL_ENTRY(void, glDrawTexfOES, GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) -GL_ENTRY(void, glDrawTexfvOES, const GLfloat * coords) +GL_ENTRY(void, glDrawTexfvOES, const GLfloat *coords) GL_ENTRY(void, glDrawTexiOES, GLint x, GLint y, GLint z, GLint width, GLint height) -GL_ENTRY(void, glDrawTexivOES, const GLint * coords) +GL_ENTRY(void, glDrawTexivOES, const GLint *coords) GL_ENTRY(void, glDrawTexsOES, GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) -GL_ENTRY(void, glDrawTexsvOES, const GLshort * coords) +GL_ENTRY(void, glDrawTexsvOES, const GLshort *coords) GL_ENTRY(void, glDrawTexxOES, GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) -GL_ENTRY(void, glDrawTexxvOES, const GLfixed * coords) +GL_ENTRY(void, glDrawTexxvOES, const GLfixed *coords) GL_ENTRY(void, glEGLImageTargetRenderbufferStorageOES, GLenum target, GLeglImageOES image) GL_ENTRY(void, glEGLImageTargetTexture2DOES, GLenum target, GLeglImageOES image) GL_ENTRY(void, glEnable, GLenum cap) GL_ENTRY(void, glEnableClientState, GLenum array) GL_ENTRY(void, glEnableDriverControlQCOM, GLuint driverControl) GL_ENTRY(void, glEnableVertexAttribArray, GLuint index) -GL_ENTRY(void, glEnableiEXT, GLenum target, GLuint index) GL_ENTRY(void, glEndPerfMonitorAMD, GLuint monitor) -GL_ENTRY(void, glEndPerfQueryINTEL, GLuint queryHandle) -GL_ENTRY(void, glEndQuery, GLenum target) GL_ENTRY(void, glEndQueryEXT, GLenum target) GL_ENTRY(void, glEndTilingQCOM, GLbitfield preserveMask) -GL_ENTRY(void, glEndTransformFeedback, void) -GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, void ** params) -GL_ENTRY(void, glExtGetBuffersQCOM, GLuint * buffers, GLint maxBuffers, GLint * numBuffers) -GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint * framebuffers, GLint maxFramebuffers, GLint * numFramebuffers) -GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar * source, GLint * length) -GL_ENTRY(void, glExtGetProgramsQCOM, GLuint * programs, GLint maxPrograms, GLint * numPrograms) -GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers) -GL_ENTRY(void, glExtGetShadersQCOM, GLuint * shaders, GLint maxShaders, GLint * numShaders) -GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint * params) -GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void * texels) -GL_ENTRY(void, glExtGetTexturesQCOM, GLuint * textures, GLint maxTextures, GLint * numTextures) +GL_ENTRY(void, glExtGetBufferPointervQCOM, GLenum target, GLvoid **params) +GL_ENTRY(void, glExtGetBuffersQCOM, GLuint *buffers, GLint maxBuffers, GLint *numBuffers) +GL_ENTRY(void, glExtGetFramebuffersQCOM, GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) +GL_ENTRY(void, glExtGetProgramBinarySourceQCOM, GLuint program, GLenum shadertype, GLchar *source, GLint *length) +GL_ENTRY(void, glExtGetProgramsQCOM, GLuint *programs, GLint maxPrograms, GLint *numPrograms) +GL_ENTRY(void, glExtGetRenderbuffersQCOM, GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) +GL_ENTRY(void, glExtGetShadersQCOM, GLuint *shaders, GLint maxShaders, GLint *numShaders) +GL_ENTRY(void, glExtGetTexLevelParameterivQCOM, GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) +GL_ENTRY(void, glExtGetTexSubImageQCOM, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) +GL_ENTRY(void, glExtGetTexturesQCOM, GLuint *textures, GLint maxTextures, GLint *numTextures) GL_ENTRY(GLboolean, glExtIsProgramBinaryQCOM, GLuint program) GL_ENTRY(void, glExtTexObjectStateOverrideiQCOM, GLenum target, GLenum pname, GLint param) -GL_ENTRY(GLsync, glFenceSync, GLenum condition, GLbitfield flags) -GL_ENTRY(GLsync, glFenceSyncAPPLE, GLenum condition, GLbitfield flags) GL_ENTRY(void, glFinish, void) GL_ENTRY(void, glFinishFenceNV, GLuint fence) GL_ENTRY(void, glFlush, void) -GL_ENTRY(void, glFlushMappedBufferRange, GLenum target, GLintptr offset, GLsizeiptr length) -GL_ENTRY(void, glFlushMappedBufferRangeEXT, GLenum target, GLintptr offset, GLsizeiptr length) GL_ENTRY(void, glFogf, GLenum pname, GLfloat param) -GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glFogfv, GLenum pname, const GLfloat *params) GL_ENTRY(void, glFogx, GLenum pname, GLfixed param) GL_ENTRY(void, glFogxOES, GLenum pname, GLfixed param) -GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed * param) -GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed * param) -GL_ENTRY(void, glFramebufferParameteri, GLenum target, GLenum pname, GLint param) +GL_ENTRY(void, glFogxv, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glFogxvOES, GLenum pname, const GLfixed *params) GL_ENTRY(void, glFramebufferRenderbuffer, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) GL_ENTRY(void, glFramebufferRenderbufferOES, GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer) GL_ENTRY(void, glFramebufferTexture2D, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) @@ -213,520 +139,299 @@ GL_ENTRY(void, glFramebufferTexture2DMultisampleIMG, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) GL_ENTRY(void, glFramebufferTexture2DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) GL_ENTRY(void, glFramebufferTexture3DOES, GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) -GL_ENTRY(void, glFramebufferTextureEXT, GLenum target, GLenum attachment, GLuint texture, GLint level) -GL_ENTRY(void, glFramebufferTextureLayer, GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) GL_ENTRY(void, glFrontFace, GLenum mode) -GL_ENTRY(void, glFrustumf, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -GL_ENTRY(void, glFrustumfOES, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -GL_ENTRY(void, glFrustumx, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) -GL_ENTRY(void, glFrustumxOES, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) -GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint * buffers) -GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint * fences) -GL_ENTRY(void, glGenFramebuffers, GLsizei n, GLuint * framebuffers) -GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint * framebuffers) -GL_ENTRY(void, glGenPerfMonitorsAMD, GLsizei n, GLuint * monitors) -GL_ENTRY(void, glGenProgramPipelines, GLsizei n, GLuint * pipelines) -GL_ENTRY(void, glGenProgramPipelinesEXT, GLsizei n, GLuint * pipelines) -GL_ENTRY(void, glGenQueries, GLsizei n, GLuint * ids) -GL_ENTRY(void, glGenQueriesEXT, GLsizei n, GLuint * ids) -GL_ENTRY(void, glGenRenderbuffers, GLsizei n, GLuint * renderbuffers) -GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint * renderbuffers) -GL_ENTRY(void, glGenSamplers, GLsizei count, GLuint * samplers) -GL_ENTRY(void, glGenTextures, GLsizei n, GLuint * textures) -GL_ENTRY(void, glGenTransformFeedbacks, GLsizei n, GLuint * ids) -GL_ENTRY(void, glGenVertexArrays, GLsizei n, GLuint * arrays) -GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint * arrays) +GL_ENTRY(void, glFrustumf, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) +GL_ENTRY(void, glFrustumfOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) +GL_ENTRY(void, glFrustumx, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) +GL_ENTRY(void, glFrustumxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) +GL_ENTRY(void, glGenBuffers, GLsizei n, GLuint *buffers) +GL_ENTRY(void, glGenFencesNV, GLsizei n, GLuint *fences) +GL_ENTRY(void, glGenFramebuffers, GLsizei n, GLuint* framebuffers) +GL_ENTRY(void, glGenFramebuffersOES, GLsizei n, GLuint* framebuffers) +GL_ENTRY(void, glGenPerfMonitorsAMD, GLsizei n, GLuint *monitors) +GL_ENTRY(void, glGenProgramPipelinesEXT, GLsizei n, GLuint *pipelines) +GL_ENTRY(void, glGenQueriesEXT, GLsizei n, GLuint *ids) +GL_ENTRY(void, glGenRenderbuffers, GLsizei n, GLuint* renderbuffers) +GL_ENTRY(void, glGenRenderbuffersOES, GLsizei n, GLuint* renderbuffers) +GL_ENTRY(void, glGenTextures, GLsizei n, GLuint *textures) +GL_ENTRY(void, glGenVertexArraysOES, GLsizei n, GLuint *arrays) GL_ENTRY(void, glGenerateMipmap, GLenum target) GL_ENTRY(void, glGenerateMipmapOES, GLenum target) -GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) -GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) -GL_ENTRY(void, glGetActiveUniformBlockName, GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName) -GL_ENTRY(void, glGetActiveUniformBlockiv, GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params) -GL_ENTRY(void, glGetActiveUniformsiv, GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params) -GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders) -GL_ENTRY(GLint, glGetAttribLocation, GLuint program, const GLchar * name) -GL_ENTRY(void, glGetBooleani_v, GLenum target, GLuint index, GLboolean * data) -GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean * data) -GL_ENTRY(void, glGetBufferParameteri64v, GLenum target, GLenum pname, GLint64 * params) -GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetBufferPointerv, GLenum target, GLenum pname, void ** params) -GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, void ** params) -GL_ENTRY(void, glGetClipPlanef, GLenum plane, GLfloat * equation) -GL_ENTRY(void, glGetClipPlanefOES, GLenum plane, GLfloat * equation) -GL_ENTRY(void, glGetClipPlanex, GLenum plane, GLfixed * equation) -GL_ENTRY(void, glGetClipPlanexOES, GLenum plane, GLfixed * equation) -GL_ENTRY(GLuint, glGetDebugMessageLogKHR, GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog) -GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei * length, GLchar * driverControlString) -GL_ENTRY(void, glGetDriverControlsQCOM, GLint * num, GLsizei size, GLuint * driverControls) +GL_ENTRY(void, glGetActiveAttrib, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) +GL_ENTRY(void, glGetActiveUniform, GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) +GL_ENTRY(void, glGetAttachedShaders, GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) +GL_ENTRY(int, glGetAttribLocation, GLuint program, const GLchar* name) +GL_ENTRY(void, glGetBooleanv, GLenum pname, GLboolean *params) +GL_ENTRY(void, glGetBufferParameteriv, GLenum target, GLenum pname, GLint *params) +GL_ENTRY(void, glGetBufferPointervOES, GLenum target, GLenum pname, GLvoid ** params) +GL_ENTRY(void, glGetClipPlanef, GLenum pname, GLfloat eqn[4]) +GL_ENTRY(void, glGetClipPlanefOES, GLenum pname, GLfloat eqn[4]) +GL_ENTRY(void, glGetClipPlanex, GLenum pname, GLfixed eqn[4]) +GL_ENTRY(void, glGetClipPlanexOES, GLenum pname, GLfixed eqn[4]) +GL_ENTRY(void, glGetDriverControlStringQCOM, GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) +GL_ENTRY(void, glGetDriverControlsQCOM, GLint *num, GLsizei size, GLuint *driverControls) GL_ENTRY(GLenum, glGetError, void) -GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint * params) -GL_ENTRY(void, glGetFirstPerfQueryIdINTEL, GLuint * queryId) -GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat * data) -GL_ENTRY(GLint, glGetFragDataLocation, GLuint program, const GLchar * name) -GL_ENTRY(void, glGetFramebufferAttachmentParameteriv, GLenum target, GLenum attachment, GLenum pname, GLint * params) -GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint * params) -GL_ENTRY(void, glGetFramebufferParameteriv, GLenum target, GLenum pname, GLint * params) +GL_ENTRY(void, glGetFenceivNV, GLuint fence, GLenum pname, GLint *params) +GL_ENTRY(void, glGetFixedv, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetFixedvOES, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetFloatv, GLenum pname, GLfloat *params) +GL_ENTRY(void, glGetFramebufferAttachmentParameteriv, GLenum target, GLenum attachment, GLenum pname, GLint* params) +GL_ENTRY(void, glGetFramebufferAttachmentParameterivOES, GLenum target, GLenum attachment, GLenum pname, GLint* params) GL_ENTRY(GLenum, glGetGraphicsResetStatusEXT, void) -GL_ENTRY(void, glGetInteger64i_v, GLenum target, GLuint index, GLint64 * data) -GL_ENTRY(void, glGetInteger64v, GLenum pname, GLint64 * data) -GL_ENTRY(void, glGetInteger64vAPPLE, GLenum pname, GLint64 * params) -GL_ENTRY(void, glGetIntegeri_v, GLenum target, GLuint index, GLint * data) -GL_ENTRY(void, glGetIntegeri_vEXT, GLenum target, GLuint index, GLint * data) -GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint * data) -GL_ENTRY(void, glGetInternalformativ, GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint * params) -GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetMultisamplefv, GLenum pname, GLuint index, GLfloat * val) -GL_ENTRY(void, glGetNextPerfQueryIdINTEL, GLuint queryId, GLuint * nextQueryId) -GL_ENTRY(void, glGetObjectLabelEXT, GLenum type, GLuint object, GLsizei bufSize, GLsizei * length, GLchar * label) -GL_ENTRY(void, glGetObjectLabelKHR, GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label) -GL_ENTRY(void, glGetObjectPtrLabelKHR, const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label) -GL_ENTRY(void, glGetPerfCounterInfoINTEL, GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar * counterName, GLuint counterDescLength, GLchar * counterDesc, GLuint * counterOffset, GLuint * counterDataSize, GLuint * counterTypeEnum, GLuint * counterDataTypeEnum, GLuint64 * rawCounterMaxValue) -GL_ENTRY(void, glGetPerfMonitorCounterDataAMD, GLuint monitor, GLenum pname, GLsizei dataSize, GLuint * data, GLint * bytesWritten) -GL_ENTRY(void, glGetPerfMonitorCounterInfoAMD, GLuint group, GLuint counter, GLenum pname, void * data) -GL_ENTRY(void, glGetPerfMonitorCounterStringAMD, GLuint group, GLuint counter, GLsizei bufSize, GLsizei * length, GLchar * counterString) -GL_ENTRY(void, glGetPerfMonitorCountersAMD, GLuint group, GLint * numCounters, GLint * maxActiveCounters, GLsizei counterSize, GLuint * counters) -GL_ENTRY(void, glGetPerfMonitorGroupStringAMD, GLuint group, GLsizei bufSize, GLsizei * length, GLchar * groupString) -GL_ENTRY(void, glGetPerfMonitorGroupsAMD, GLint * numGroups, GLsizei groupsSize, GLuint * groups) -GL_ENTRY(void, glGetPerfQueryDataINTEL, GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid * data, GLuint * bytesWritten) -GL_ENTRY(void, glGetPerfQueryIdByNameINTEL, GLchar * queryName, GLuint * queryId) -GL_ENTRY(void, glGetPerfQueryInfoINTEL, GLuint queryId, GLuint queryNameLength, GLchar * queryName, GLuint * dataSize, GLuint * noCounters, GLuint * noInstances, GLuint * capsMask) -GL_ENTRY(void, glGetPointerv, GLenum pname, void ** params) -GL_ENTRY(void, glGetPointervKHR, GLenum pname, void ** params) -GL_ENTRY(void, glGetProgramBinary, GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) -GL_ENTRY(void, glGetProgramBinaryOES, GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) -GL_ENTRY(void, glGetProgramInfoLog, GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -GL_ENTRY(void, glGetProgramInterfaceiv, GLuint program, GLenum programInterface, GLenum pname, GLint * params) -GL_ENTRY(void, glGetProgramPipelineInfoLog, GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -GL_ENTRY(void, glGetProgramPipelineInfoLogEXT, GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -GL_ENTRY(void, glGetProgramPipelineiv, GLuint pipeline, GLenum pname, GLint * params) -GL_ENTRY(void, glGetProgramPipelineivEXT, GLuint pipeline, GLenum pname, GLint * params) -GL_ENTRY(GLuint, glGetProgramResourceIndex, GLuint program, GLenum programInterface, const GLchar * name) -GL_ENTRY(GLint, glGetProgramResourceLocation, GLuint program, GLenum programInterface, const GLchar * name) -GL_ENTRY(void, glGetProgramResourceName, GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) -GL_ENTRY(void, glGetProgramResourceiv, GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params) -GL_ENTRY(void, glGetProgramiv, GLuint program, GLenum pname, GLint * params) -GL_ENTRY(void, glGetQueryObjecti64vEXT, GLuint id, GLenum pname, GLint64 * params) -GL_ENTRY(void, glGetQueryObjectivEXT, GLuint id, GLenum pname, GLint * params) -GL_ENTRY(void, glGetQueryObjectui64vEXT, GLuint id, GLenum pname, GLuint64 * params) -GL_ENTRY(void, glGetQueryObjectuiv, GLuint id, GLenum pname, GLuint * params) -GL_ENTRY(void, glGetQueryObjectuivEXT, GLuint id, GLenum pname, GLuint * params) -GL_ENTRY(void, glGetQueryiv, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetQueryivEXT, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetRenderbufferParameteriv, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetSamplerParameterIivEXT, GLuint sampler, GLenum pname, GLint * params) -GL_ENTRY(void, glGetSamplerParameterIuivEXT, GLuint sampler, GLenum pname, GLuint * params) -GL_ENTRY(void, glGetSamplerParameterfv, GLuint sampler, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetSamplerParameteriv, GLuint sampler, GLenum pname, GLint * params) -GL_ENTRY(void, glGetShaderInfoLog, GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog) -GL_ENTRY(void, glGetShaderPrecisionFormat, GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision) -GL_ENTRY(void, glGetShaderSource, GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source) -GL_ENTRY(void, glGetShaderiv, GLuint shader, GLenum pname, GLint * params) +GL_ENTRY(void, glGetIntegerv, GLenum pname, GLint *params) +GL_ENTRY(void, glGetLightfv, GLenum light, GLenum pname, GLfloat *params) +GL_ENTRY(void, glGetLightxv, GLenum light, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetLightxvOES, GLenum light, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetMaterialfv, GLenum face, GLenum pname, GLfloat *params) +GL_ENTRY(void, glGetMaterialxv, GLenum face, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetMaterialxvOES, GLenum face, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetObjectLabelEXT, GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label) +GL_ENTRY(void, glGetPerfMonitorCounterDataAMD, GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) +GL_ENTRY(void, glGetPerfMonitorCounterInfoAMD, GLuint group, GLuint counter, GLenum pname, GLvoid *data) +GL_ENTRY(void, glGetPerfMonitorCounterStringAMD, GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) +GL_ENTRY(void, glGetPerfMonitorCountersAMD, GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) +GL_ENTRY(void, glGetPerfMonitorGroupStringAMD, GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) +GL_ENTRY(void, glGetPerfMonitorGroupsAMD, GLint *numGroups, GLsizei groupsSize, GLuint *groups) +GL_ENTRY(void, glGetPointerv, GLenum pname, GLvoid **params) +GL_ENTRY(void, glGetProgramBinaryOES, GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) +GL_ENTRY(void, glGetProgramInfoLog, GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) +GL_ENTRY(void, glGetProgramPipelineInfoLogEXT, GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) +GL_ENTRY(void, glGetProgramPipelineivEXT, GLuint pipeline, GLenum pname, GLint *params) +GL_ENTRY(void, glGetProgramiv, GLuint program, GLenum pname, GLint* params) +GL_ENTRY(void, glGetQueryObjectuivEXT, GLuint id, GLenum pname, GLuint *params) +GL_ENTRY(void, glGetQueryivEXT, GLenum target, GLenum pname, GLint *params) +GL_ENTRY(void, glGetRenderbufferParameteriv, GLenum target, GLenum pname, GLint* params) +GL_ENTRY(void, glGetRenderbufferParameterivOES, GLenum target, GLenum pname, GLint* params) +GL_ENTRY(void, glGetShaderInfoLog, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) +GL_ENTRY(void, glGetShaderPrecisionFormat, GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) +GL_ENTRY(void, glGetShaderSource, GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) +GL_ENTRY(void, glGetShaderiv, GLuint shader, GLenum pname, GLint* params) GL_ENTRY(const GLubyte *, glGetString, GLenum name) -GL_ENTRY(const GLubyte *, glGetStringi, GLenum name, GLuint index) -GL_ENTRY(void, glGetSynciv, GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) -GL_ENTRY(void, glGetSyncivAPPLE, GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) -GL_ENTRY(void, glGetTexEnvfv, GLenum target, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetTexEnviv, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetTexEnvxv, GLenum target, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetTexEnvxvOES, GLenum target, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint * params) -GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetTexLevelParameterfv, GLenum target, GLint level, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetTexLevelParameteriv, GLenum target, GLint level, GLenum pname, GLint * params) -GL_ENTRY(void, glGetTexParameterIivEXT, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetTexParameterIuivEXT, GLenum target, GLenum pname, GLuint * params) -GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint * params) -GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed * params) -GL_ENTRY(void, glGetTransformFeedbackVarying, GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) -GL_ENTRY(void, glGetTranslatedShaderSourceANGLE, GLuint shader, GLsizei bufsize, GLsizei * length, GLchar * source) -GL_ENTRY(GLuint, glGetUniformBlockIndex, GLuint program, const GLchar * uniformBlockName) -GL_ENTRY(void, glGetUniformIndices, GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices) -GL_ENTRY(GLint, glGetUniformLocation, GLuint program, const GLchar * name) -GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat * params) -GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint * params) -GL_ENTRY(void, glGetUniformuiv, GLuint program, GLint location, GLuint * params) -GL_ENTRY(void, glGetVertexAttribIiv, GLuint index, GLenum pname, GLint * params) -GL_ENTRY(void, glGetVertexAttribIuiv, GLuint index, GLenum pname, GLuint * params) -GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, void ** pointer) -GL_ENTRY(void, glGetVertexAttribfv, GLuint index, GLenum pname, GLfloat * params) -GL_ENTRY(void, glGetVertexAttribiv, GLuint index, GLenum pname, GLint * params) -GL_ENTRY(void, glGetnUniformfvEXT, GLuint program, GLint location, GLsizei bufSize, GLfloat * params) -GL_ENTRY(void, glGetnUniformivEXT, GLuint program, GLint location, GLsizei bufSize, GLint * params) +GL_ENTRY(void, glGetTexEnvfv, GLenum env, GLenum pname, GLfloat *params) +GL_ENTRY(void, glGetTexEnviv, GLenum env, GLenum pname, GLint *params) +GL_ENTRY(void, glGetTexEnvxv, GLenum env, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetTexEnvxvOES, GLenum env, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetTexGenfvOES, GLenum coord, GLenum pname, GLfloat *params) +GL_ENTRY(void, glGetTexGenivOES, GLenum coord, GLenum pname, GLint *params) +GL_ENTRY(void, glGetTexGenxvOES, GLenum coord, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetTexParameterfv, GLenum target, GLenum pname, GLfloat *params) +GL_ENTRY(void, glGetTexParameteriv, GLenum target, GLenum pname, GLint *params) +GL_ENTRY(void, glGetTexParameterxv, GLenum target, GLenum pname, GLfixed *params) +GL_ENTRY(void, glGetTexParameterxvOES, GLenum target, GLenum pname, GLfixed *params) +GL_ENTRY(int, glGetUniformLocation, GLuint program, const GLchar* name) +GL_ENTRY(void, glGetUniformfv, GLuint program, GLint location, GLfloat* params) +GL_ENTRY(void, glGetUniformiv, GLuint program, GLint location, GLint* params) +GL_ENTRY(void, glGetVertexAttribPointerv, GLuint index, GLenum pname, GLvoid** pointer) +GL_ENTRY(void, glGetVertexAttribfv, GLuint index, GLenum pname, GLfloat* params) +GL_ENTRY(void, glGetVertexAttribiv, GLuint index, GLenum pname, GLint* params) +GL_ENTRY(void, glGetnUniformfvEXT, GLuint program, GLint location, GLsizei bufSize, float *params) +GL_ENTRY(void, glGetnUniformivEXT, GLuint program, GLint location, GLsizei bufSize, GLint *params) GL_ENTRY(void, glHint, GLenum target, GLenum mode) -GL_ENTRY(void, glInsertEventMarkerEXT, GLsizei length, const GLchar * marker) -GL_ENTRY(void, glInvalidateFramebuffer, GLenum target, GLsizei numAttachments, const GLenum * attachments) -GL_ENTRY(void, glInvalidateSubFramebuffer, GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height) +GL_ENTRY(void, glInsertEventMarkerEXT, GLsizei length, const GLchar *marker) GL_ENTRY(GLboolean, glIsBuffer, GLuint buffer) GL_ENTRY(GLboolean, glIsEnabled, GLenum cap) -GL_ENTRY(GLboolean, glIsEnablediEXT, GLenum target, GLuint index) GL_ENTRY(GLboolean, glIsFenceNV, GLuint fence) GL_ENTRY(GLboolean, glIsFramebuffer, GLuint framebuffer) GL_ENTRY(GLboolean, glIsFramebufferOES, GLuint framebuffer) GL_ENTRY(GLboolean, glIsProgram, GLuint program) -GL_ENTRY(GLboolean, glIsProgramPipeline, GLuint pipeline) GL_ENTRY(GLboolean, glIsProgramPipelineEXT, GLuint pipeline) -GL_ENTRY(GLboolean, glIsQuery, GLuint id) GL_ENTRY(GLboolean, glIsQueryEXT, GLuint id) GL_ENTRY(GLboolean, glIsRenderbuffer, GLuint renderbuffer) GL_ENTRY(GLboolean, glIsRenderbufferOES, GLuint renderbuffer) -GL_ENTRY(GLboolean, glIsSampler, GLuint sampler) GL_ENTRY(GLboolean, glIsShader, GLuint shader) -GL_ENTRY(GLboolean, glIsSync, GLsync sync) -GL_ENTRY(GLboolean, glIsSyncAPPLE, GLsync sync) GL_ENTRY(GLboolean, glIsTexture, GLuint texture) -GL_ENTRY(GLboolean, glIsTransformFeedback, GLuint id) -GL_ENTRY(GLboolean, glIsVertexArray, GLuint array) GL_ENTRY(GLboolean, glIsVertexArrayOES, GLuint array) -GL_ENTRY(void, glLabelObjectEXT, GLenum type, GLuint object, GLsizei length, const GLchar * label) +GL_ENTRY(void, glLabelObjectEXT, GLenum type, GLuint object, GLsizei length, const GLchar *label) GL_ENTRY(void, glLightModelf, GLenum pname, GLfloat param) -GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glLightModelfv, GLenum pname, const GLfloat *params) GL_ENTRY(void, glLightModelx, GLenum pname, GLfixed param) GL_ENTRY(void, glLightModelxOES, GLenum pname, GLfixed param) -GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed * param) -GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed * param) +GL_ENTRY(void, glLightModelxv, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glLightModelxvOES, GLenum pname, const GLfixed *params) GL_ENTRY(void, glLightf, GLenum light, GLenum pname, GLfloat param) -GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glLightfv, GLenum light, GLenum pname, const GLfloat *params) GL_ENTRY(void, glLightx, GLenum light, GLenum pname, GLfixed param) GL_ENTRY(void, glLightxOES, GLenum light, GLenum pname, GLfixed param) -GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed * params) -GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed * params) +GL_ENTRY(void, glLightxv, GLenum light, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glLightxvOES, GLenum light, GLenum pname, const GLfixed *params) GL_ENTRY(void, glLineWidth, GLfloat width) GL_ENTRY(void, glLineWidthx, GLfixed width) GL_ENTRY(void, glLineWidthxOES, GLfixed width) GL_ENTRY(void, glLinkProgram, GLuint program) GL_ENTRY(void, glLoadIdentity, void) -GL_ENTRY(void, glLoadMatrixf, const GLfloat * m) -GL_ENTRY(void, glLoadMatrixx, const GLfixed * m) -GL_ENTRY(void, glLoadMatrixxOES, const GLfixed * m) +GL_ENTRY(void, glLoadMatrixf, const GLfloat *m) +GL_ENTRY(void, glLoadMatrixx, const GLfixed *m) +GL_ENTRY(void, glLoadMatrixxOES, const GLfixed *m) GL_ENTRY(void, glLoadPaletteFromModelViewMatrixOES, void) GL_ENTRY(void, glLogicOp, GLenum opcode) -GL_ENTRY(void *, glMapBufferOES, GLenum target, GLenum access) -GL_ENTRY(void *, glMapBufferRange, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) -GL_ENTRY(void *, glMapBufferRangeEXT, GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) +GL_ENTRY(void*, glMapBufferOES, GLenum target, GLenum access) GL_ENTRY(void, glMaterialf, GLenum face, GLenum pname, GLfloat param) -GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glMaterialfv, GLenum face, GLenum pname, const GLfloat *params) GL_ENTRY(void, glMaterialx, GLenum face, GLenum pname, GLfixed param) GL_ENTRY(void, glMaterialxOES, GLenum face, GLenum pname, GLfixed param) -GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed * param) -GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed * param) -GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const void * pointer) +GL_ENTRY(void, glMaterialxv, GLenum face, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glMaterialxvOES, GLenum face, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glMatrixIndexPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) GL_ENTRY(void, glMatrixMode, GLenum mode) -GL_ENTRY(void, glMemoryBarrier, GLbitfield barriers) -GL_ENTRY(void, glMemoryBarrierByRegion, GLbitfield barriers) -GL_ENTRY(void, glMinSampleShadingOES, GLfloat value) -GL_ENTRY(void, glMultMatrixf, const GLfloat * m) -GL_ENTRY(void, glMultMatrixx, const GLfixed * m) -GL_ENTRY(void, glMultMatrixxOES, const GLfixed * m) -GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount) -GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei primcount) -GL_ENTRY(void, glMultiTexCoord1bOES, GLenum texture, GLbyte s) -GL_ENTRY(void, glMultiTexCoord1bvOES, GLenum texture, const GLbyte * coords) -GL_ENTRY(void, glMultiTexCoord2bOES, GLenum texture, GLbyte s, GLbyte t) -GL_ENTRY(void, glMultiTexCoord2bvOES, GLenum texture, const GLbyte * coords) -GL_ENTRY(void, glMultiTexCoord3bOES, GLenum texture, GLbyte s, GLbyte t, GLbyte r) -GL_ENTRY(void, glMultiTexCoord3bvOES, GLenum texture, const GLbyte * coords) -GL_ENTRY(void, glMultiTexCoord4bOES, GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q) -GL_ENTRY(void, glMultiTexCoord4bvOES, GLenum texture, const GLbyte * coords) +GL_ENTRY(void, glMultMatrixf, const GLfloat *m) +GL_ENTRY(void, glMultMatrixx, const GLfixed *m) +GL_ENTRY(void, glMultMatrixxOES, const GLfixed *m) +GL_ENTRY(void, glMultiDrawArraysEXT, GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) +GL_ENTRY(void, glMultiDrawElementsEXT, GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) GL_ENTRY(void, glMultiTexCoord4f, GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) -GL_ENTRY(void, glMultiTexCoord4x, GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) -GL_ENTRY(void, glMultiTexCoord4xOES, GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) +GL_ENTRY(void, glMultiTexCoord4x, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) +GL_ENTRY(void, glMultiTexCoord4xOES, GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) GL_ENTRY(void, glNormal3f, GLfloat nx, GLfloat ny, GLfloat nz) GL_ENTRY(void, glNormal3x, GLfixed nx, GLfixed ny, GLfixed nz) GL_ENTRY(void, glNormal3xOES, GLfixed nx, GLfixed ny, GLfixed nz) -GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const void * pointer) -GL_ENTRY(void, glObjectLabelKHR, GLenum identifier, GLuint name, GLsizei length, const GLchar * label) -GL_ENTRY(void, glObjectPtrLabelKHR, const void * ptr, GLsizei length, const GLchar * label) -GL_ENTRY(void, glOrthof, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -GL_ENTRY(void, glOrthofOES, GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) -GL_ENTRY(void, glOrthox, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) -GL_ENTRY(void, glOrthoxOES, GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) -GL_ENTRY(void, glPatchParameteriEXT, GLenum pname, GLint value) -GL_ENTRY(void, glPauseTransformFeedback, void) +GL_ENTRY(void, glNormalPointer, GLenum type, GLsizei stride, const GLvoid *pointer) +GL_ENTRY(void, glOrthof, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) +GL_ENTRY(void, glOrthofOES, GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) +GL_ENTRY(void, glOrthox, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) +GL_ENTRY(void, glOrthoxOES, GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) GL_ENTRY(void, glPixelStorei, GLenum pname, GLint param) GL_ENTRY(void, glPointParameterf, GLenum pname, GLfloat param) -GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glPointParameterfv, GLenum pname, const GLfloat *params) GL_ENTRY(void, glPointParameterx, GLenum pname, GLfixed param) GL_ENTRY(void, glPointParameterxOES, GLenum pname, GLfixed param) -GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed * params) -GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed * params) +GL_ENTRY(void, glPointParameterxv, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glPointParameterxvOES, GLenum pname, const GLfixed *params) GL_ENTRY(void, glPointSize, GLfloat size) -GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const void * pointer) +GL_ENTRY(void, glPointSizePointerOES, GLenum type, GLsizei stride, const GLvoid *pointer) GL_ENTRY(void, glPointSizex, GLfixed size) GL_ENTRY(void, glPointSizexOES, GLfixed size) GL_ENTRY(void, glPolygonOffset, GLfloat factor, GLfloat units) GL_ENTRY(void, glPolygonOffsetx, GLfixed factor, GLfixed units) GL_ENTRY(void, glPolygonOffsetxOES, GLfixed factor, GLfixed units) -GL_ENTRY(void, glPopDebugGroupKHR, void) GL_ENTRY(void, glPopGroupMarkerEXT, void) GL_ENTRY(void, glPopMatrix, void) -GL_ENTRY(void, glPrimitiveBoundingBoxEXT, GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) -GL_ENTRY(void, glProgramBinary, GLuint program, GLenum binaryFormat, const void * binary, GLsizei length) -GL_ENTRY(void, glProgramBinaryOES, GLuint program, GLenum binaryFormat, const void * binary, GLint length) -GL_ENTRY(void, glProgramParameteri, GLuint program, GLenum pname, GLint value) +GL_ENTRY(void, glProgramBinaryOES, GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) GL_ENTRY(void, glProgramParameteriEXT, GLuint program, GLenum pname, GLint value) -GL_ENTRY(void, glProgramUniform1f, GLuint program, GLint location, GLfloat v0) -GL_ENTRY(void, glProgramUniform1fEXT, GLuint program, GLint location, GLfloat v0) -GL_ENTRY(void, glProgramUniform1fv, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform1fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform1i, GLuint program, GLint location, GLint v0) -GL_ENTRY(void, glProgramUniform1iEXT, GLuint program, GLint location, GLint v0) -GL_ENTRY(void, glProgramUniform1iv, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform1ivEXT, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform1ui, GLuint program, GLint location, GLuint v0) -GL_ENTRY(void, glProgramUniform1uiEXT, GLuint program, GLint location, GLuint v0) -GL_ENTRY(void, glProgramUniform1uiv, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform1uivEXT, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform2f, GLuint program, GLint location, GLfloat v0, GLfloat v1) -GL_ENTRY(void, glProgramUniform2fEXT, GLuint program, GLint location, GLfloat v0, GLfloat v1) -GL_ENTRY(void, glProgramUniform2fv, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform2fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform2i, GLuint program, GLint location, GLint v0, GLint v1) -GL_ENTRY(void, glProgramUniform2iEXT, GLuint program, GLint location, GLint v0, GLint v1) -GL_ENTRY(void, glProgramUniform2iv, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform2ivEXT, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform2ui, GLuint program, GLint location, GLuint v0, GLuint v1) -GL_ENTRY(void, glProgramUniform2uiEXT, GLuint program, GLint location, GLuint v0, GLuint v1) -GL_ENTRY(void, glProgramUniform2uiv, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform2uivEXT, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform3f, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -GL_ENTRY(void, glProgramUniform3fEXT, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -GL_ENTRY(void, glProgramUniform3fv, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform3fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform3i, GLuint program, GLint location, GLint v0, GLint v1, GLint v2) -GL_ENTRY(void, glProgramUniform3iEXT, GLuint program, GLint location, GLint v0, GLint v1, GLint v2) -GL_ENTRY(void, glProgramUniform3iv, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform3ivEXT, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform3ui, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) -GL_ENTRY(void, glProgramUniform3uiEXT, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) -GL_ENTRY(void, glProgramUniform3uiv, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform3uivEXT, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform4f, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) -GL_ENTRY(void, glProgramUniform4fEXT, GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) -GL_ENTRY(void, glProgramUniform4fv, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform4fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glProgramUniform4i, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -GL_ENTRY(void, glProgramUniform4iEXT, GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -GL_ENTRY(void, glProgramUniform4iv, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform4ivEXT, GLuint program, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glProgramUniform4ui, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -GL_ENTRY(void, glProgramUniform4uiEXT, GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -GL_ENTRY(void, glProgramUniform4uiv, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniform4uivEXT, GLuint program, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glProgramUniformMatrix2fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix2fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix2x3fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix2x3fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix2x4fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix2x4fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix3fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix3fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix3x2fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix3x2fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix3x4fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix3x4fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix4fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix4fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix4x2fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix4x2fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix4x3fv, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glProgramUniformMatrix4x3fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glPushDebugGroupKHR, GLenum source, GLuint id, GLsizei length, const GLchar * message) -GL_ENTRY(void, glPushGroupMarkerEXT, GLsizei length, const GLchar * marker) +GL_ENTRY(void, glProgramUniform1fEXT, GLuint program, GLint location, GLfloat x) +GL_ENTRY(void, glProgramUniform1fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value) +GL_ENTRY(void, glProgramUniform1iEXT, GLuint program, GLint location, GLint x) +GL_ENTRY(void, glProgramUniform1ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value) +GL_ENTRY(void, glProgramUniform2fEXT, GLuint program, GLint location, GLfloat x, GLfloat y) +GL_ENTRY(void, glProgramUniform2fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value) +GL_ENTRY(void, glProgramUniform2iEXT, GLuint program, GLint location, GLint x, GLint y) +GL_ENTRY(void, glProgramUniform2ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value) +GL_ENTRY(void, glProgramUniform3fEXT, GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z) +GL_ENTRY(void, glProgramUniform3fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value) +GL_ENTRY(void, glProgramUniform3iEXT, GLuint program, GLint location, GLint x, GLint y, GLint z) +GL_ENTRY(void, glProgramUniform3ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value) +GL_ENTRY(void, glProgramUniform4fEXT, GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +GL_ENTRY(void, glProgramUniform4fvEXT, GLuint program, GLint location, GLsizei count, const GLfloat *value) +GL_ENTRY(void, glProgramUniform4iEXT, GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w) +GL_ENTRY(void, glProgramUniform4ivEXT, GLuint program, GLint location, GLsizei count, const GLint *value) +GL_ENTRY(void, glProgramUniformMatrix2fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +GL_ENTRY(void, glProgramUniformMatrix3fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +GL_ENTRY(void, glProgramUniformMatrix4fvEXT, GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) +GL_ENTRY(void, glPushGroupMarkerEXT, GLsizei length, const GLchar *marker) GL_ENTRY(void, glPushMatrix, void) -GL_ENTRY(void, glQueryCounterEXT, GLuint id, GLenum target) -GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed * mantissa, GLint * exponent) -GL_ENTRY(void, glReadBuffer, GLenum mode) -GL_ENTRY(void, glReadBufferIndexedEXT, GLenum src, GLint index) +GL_ENTRY(GLbitfield, glQueryMatrixxOES, GLfixed mantissa[16], GLint exponent[16]) GL_ENTRY(void, glReadBufferNV, GLenum mode) -GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) -GL_ENTRY(void, glReadnPixelsEXT, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data) +GL_ENTRY(void, glReadPixels, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) +GL_ENTRY(void, glReadnPixelsEXT, GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) GL_ENTRY(void, glReleaseShaderCompiler, void) GL_ENTRY(void, glRenderbufferStorage, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) -GL_ENTRY(void, glRenderbufferStorageMultisample, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glRenderbufferStorageMultisampleANGLE, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glRenderbufferStorageMultisampleAPPLE, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glRenderbufferStorageMultisampleEXT, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glRenderbufferStorageMultisampleIMG, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) -GL_ENTRY(void, glRenderbufferStorageMultisampleNV, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glRenderbufferStorageOES, GLenum target, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glResolveMultisampleFramebufferAPPLE, void) -GL_ENTRY(void, glResumeTransformFeedback, void) GL_ENTRY(void, glRotatef, GLfloat angle, GLfloat x, GLfloat y, GLfloat z) GL_ENTRY(void, glRotatex, GLfixed angle, GLfixed x, GLfixed y, GLfixed z) GL_ENTRY(void, glRotatexOES, GLfixed angle, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glSampleCoverage, GLfloat value, GLboolean invert) -GL_ENTRY(void, glSampleCoverageOES, GLfixed value, GLboolean invert) +GL_ENTRY(void, glSampleCoverage, GLclampf value, GLboolean invert) GL_ENTRY(void, glSampleCoveragex, GLclampx value, GLboolean invert) GL_ENTRY(void, glSampleCoveragexOES, GLclampx value, GLboolean invert) -GL_ENTRY(void, glSampleMaski, GLuint maskNumber, GLbitfield mask) -GL_ENTRY(void, glSamplerParameterIivEXT, GLuint sampler, GLenum pname, const GLint * param) -GL_ENTRY(void, glSamplerParameterIuivEXT, GLuint sampler, GLenum pname, const GLuint * param) -GL_ENTRY(void, glSamplerParameterf, GLuint sampler, GLenum pname, GLfloat param) -GL_ENTRY(void, glSamplerParameterfv, GLuint sampler, GLenum pname, const GLfloat * param) -GL_ENTRY(void, glSamplerParameteri, GLuint sampler, GLenum pname, GLint param) -GL_ENTRY(void, glSamplerParameteriv, GLuint sampler, GLenum pname, const GLint * param) GL_ENTRY(void, glScalef, GLfloat x, GLfloat y, GLfloat z) GL_ENTRY(void, glScalex, GLfixed x, GLfixed y, GLfixed z) GL_ENTRY(void, glScalexOES, GLfixed x, GLfixed y, GLfixed z) GL_ENTRY(void, glScissor, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glSelectPerfMonitorCountersAMD, GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint * counterList) +GL_ENTRY(void, glSelectPerfMonitorCountersAMD, GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) GL_ENTRY(void, glSetFenceNV, GLuint fence, GLenum condition) GL_ENTRY(void, glShadeModel, GLenum mode) -GL_ENTRY(void, glShaderBinary, GLsizei count, const GLuint * shaders, GLenum binaryformat, const void * binary, GLsizei length) -GL_ENTRY(void, glShaderSource, GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) +GL_ENTRY(void, glShaderBinary, GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) +GL_ENTRY(void, glShaderSource, GLuint shader, GLsizei count, const GLchar** string, const GLint* length) GL_ENTRY(void, glStartTilingQCOM, GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) GL_ENTRY(void, glStencilFunc, GLenum func, GLint ref, GLuint mask) GL_ENTRY(void, glStencilFuncSeparate, GLenum face, GLenum func, GLint ref, GLuint mask) GL_ENTRY(void, glStencilMask, GLuint mask) GL_ENTRY(void, glStencilMaskSeparate, GLenum face, GLuint mask) GL_ENTRY(void, glStencilOp, GLenum fail, GLenum zfail, GLenum zpass) -GL_ENTRY(void, glStencilOpSeparate, GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) +GL_ENTRY(void, glStencilOpSeparate, GLenum face, GLenum fail, GLenum zfail, GLenum zpass) GL_ENTRY(GLboolean, glTestFenceNV, GLuint fence) -GL_ENTRY(void, glTexBufferEXT, GLenum target, GLenum internalformat, GLuint buffer) -GL_ENTRY(void, glTexBufferRangeEXT, GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) -GL_ENTRY(void, glTexCoord1bOES, GLbyte s) -GL_ENTRY(void, glTexCoord1bvOES, const GLbyte * coords) -GL_ENTRY(void, glTexCoord2bOES, GLbyte s, GLbyte t) -GL_ENTRY(void, glTexCoord2bvOES, const GLbyte * coords) -GL_ENTRY(void, glTexCoord3bOES, GLbyte s, GLbyte t, GLbyte r) -GL_ENTRY(void, glTexCoord3bvOES, const GLbyte * coords) -GL_ENTRY(void, glTexCoord4bOES, GLbyte s, GLbyte t, GLbyte r, GLbyte q) -GL_ENTRY(void, glTexCoord4bvOES, const GLbyte * coords) -GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const void * pointer) +GL_ENTRY(void, glTexCoordPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) GL_ENTRY(void, glTexEnvf, GLenum target, GLenum pname, GLfloat param) -GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glTexEnvfv, GLenum target, GLenum pname, const GLfloat *params) GL_ENTRY(void, glTexEnvi, GLenum target, GLenum pname, GLint param) -GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint * params) +GL_ENTRY(void, glTexEnviv, GLenum target, GLenum pname, const GLint *params) GL_ENTRY(void, glTexEnvx, GLenum target, GLenum pname, GLfixed param) GL_ENTRY(void, glTexEnvxOES, GLenum target, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed * params) -GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed * params) +GL_ENTRY(void, glTexEnvxv, GLenum target, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glTexEnvxvOES, GLenum target, GLenum pname, const GLfixed *params) GL_ENTRY(void, glTexGenfOES, GLenum coord, GLenum pname, GLfloat param) -GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glTexGenfvOES, GLenum coord, GLenum pname, const GLfloat *params) GL_ENTRY(void, glTexGeniOES, GLenum coord, GLenum pname, GLint param) -GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint * params) +GL_ENTRY(void, glTexGenivOES, GLenum coord, GLenum pname, const GLint *params) GL_ENTRY(void, glTexGenxOES, GLenum coord, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed * params) -GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) -GL_ENTRY(void, glTexImage3D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) -GL_ENTRY(void, glTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) -GL_ENTRY(void, glTexParameterIivEXT, GLenum target, GLenum pname, const GLint * params) -GL_ENTRY(void, glTexParameterIuivEXT, GLenum target, GLenum pname, const GLuint * params) +GL_ENTRY(void, glTexGenxvOES, GLenum coord, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glTexImage2D, GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) +GL_ENTRY(void, glTexImage3DOES, GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) GL_ENTRY(void, glTexParameterf, GLenum target, GLenum pname, GLfloat param) -GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat * params) +GL_ENTRY(void, glTexParameterfv, GLenum target, GLenum pname, const GLfloat *params) GL_ENTRY(void, glTexParameteri, GLenum target, GLenum pname, GLint param) -GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint * params) +GL_ENTRY(void, glTexParameteriv, GLenum target, GLenum pname, const GLint *params) GL_ENTRY(void, glTexParameterx, GLenum target, GLenum pname, GLfixed param) GL_ENTRY(void, glTexParameterxOES, GLenum target, GLenum pname, GLfixed param) -GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed * params) -GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed * params) +GL_ENTRY(void, glTexParameterxv, GLenum target, GLenum pname, const GLfixed *params) +GL_ENTRY(void, glTexParameterxvOES, GLenum target, GLenum pname, const GLfixed *params) GL_ENTRY(void, glTexStorage1DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) -GL_ENTRY(void, glTexStorage2D, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glTexStorage2DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) -GL_ENTRY(void, glTexStorage2DMultisample, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) -GL_ENTRY(void, glTexStorage3D, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) GL_ENTRY(void, glTexStorage3DEXT, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) -GL_ENTRY(void, glTexStorage3DMultisampleOES, GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) -GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) -GL_ENTRY(void, glTexSubImage3D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) -GL_ENTRY(void, glTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) +GL_ENTRY(void, glTexSubImage2D, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) +GL_ENTRY(void, glTexSubImage3DOES, GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) GL_ENTRY(void, glTextureStorage1DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) GL_ENTRY(void, glTextureStorage2DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) GL_ENTRY(void, glTextureStorage3DEXT, GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) -GL_ENTRY(void, glTextureViewEXT, GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) -GL_ENTRY(void, glTransformFeedbackVaryings, GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode) GL_ENTRY(void, glTranslatef, GLfloat x, GLfloat y, GLfloat z) GL_ENTRY(void, glTranslatex, GLfixed x, GLfixed y, GLfixed z) GL_ENTRY(void, glTranslatexOES, GLfixed x, GLfixed y, GLfixed z) -GL_ENTRY(void, glUniform1f, GLint location, GLfloat v0) -GL_ENTRY(void, glUniform1fv, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glUniform1i, GLint location, GLint v0) -GL_ENTRY(void, glUniform1iv, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glUniform1ui, GLint location, GLuint v0) -GL_ENTRY(void, glUniform1uiv, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glUniform2f, GLint location, GLfloat v0, GLfloat v1) -GL_ENTRY(void, glUniform2fv, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glUniform2i, GLint location, GLint v0, GLint v1) -GL_ENTRY(void, glUniform2iv, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glUniform2ui, GLint location, GLuint v0, GLuint v1) -GL_ENTRY(void, glUniform2uiv, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glUniform3f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) -GL_ENTRY(void, glUniform3fv, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glUniform3i, GLint location, GLint v0, GLint v1, GLint v2) -GL_ENTRY(void, glUniform3iv, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glUniform3ui, GLint location, GLuint v0, GLuint v1, GLuint v2) -GL_ENTRY(void, glUniform3uiv, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glUniform4f, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) -GL_ENTRY(void, glUniform4fv, GLint location, GLsizei count, const GLfloat * value) -GL_ENTRY(void, glUniform4i, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) -GL_ENTRY(void, glUniform4iv, GLint location, GLsizei count, const GLint * value) -GL_ENTRY(void, glUniform4ui, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) -GL_ENTRY(void, glUniform4uiv, GLint location, GLsizei count, const GLuint * value) -GL_ENTRY(void, glUniformBlockBinding, GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) -GL_ENTRY(void, glUniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix2x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix2x3fvNV, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix2x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix2x4fvNV, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix3x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix3x2fvNV, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix3x4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix3x4fvNV, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix4x2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix4x2fvNV, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix4x3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(void, glUniformMatrix4x3fvNV, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) -GL_ENTRY(GLboolean, glUnmapBuffer, GLenum target) +GL_ENTRY(void, glUniform1f, GLint location, GLfloat x) +GL_ENTRY(void, glUniform1fv, GLint location, GLsizei count, const GLfloat* v) +GL_ENTRY(void, glUniform1i, GLint location, GLint x) +GL_ENTRY(void, glUniform1iv, GLint location, GLsizei count, const GLint* v) +GL_ENTRY(void, glUniform2f, GLint location, GLfloat x, GLfloat y) +GL_ENTRY(void, glUniform2fv, GLint location, GLsizei count, const GLfloat* v) +GL_ENTRY(void, glUniform2i, GLint location, GLint x, GLint y) +GL_ENTRY(void, glUniform2iv, GLint location, GLsizei count, const GLint* v) +GL_ENTRY(void, glUniform3f, GLint location, GLfloat x, GLfloat y, GLfloat z) +GL_ENTRY(void, glUniform3fv, GLint location, GLsizei count, const GLfloat* v) +GL_ENTRY(void, glUniform3i, GLint location, GLint x, GLint y, GLint z) +GL_ENTRY(void, glUniform3iv, GLint location, GLsizei count, const GLint* v) +GL_ENTRY(void, glUniform4f, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +GL_ENTRY(void, glUniform4fv, GLint location, GLsizei count, const GLfloat* v) +GL_ENTRY(void, glUniform4i, GLint location, GLint x, GLint y, GLint z, GLint w) +GL_ENTRY(void, glUniform4iv, GLint location, GLsizei count, const GLint* v) +GL_ENTRY(void, glUniformMatrix2fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +GL_ENTRY(void, glUniformMatrix3fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) +GL_ENTRY(void, glUniformMatrix4fv, GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) GL_ENTRY(GLboolean, glUnmapBufferOES, GLenum target) GL_ENTRY(void, glUseProgram, GLuint program) -GL_ENTRY(void, glUseProgramStages, GLuint pipeline, GLbitfield stages, GLuint program) GL_ENTRY(void, glUseProgramStagesEXT, GLuint pipeline, GLbitfield stages, GLuint program) GL_ENTRY(void, glValidateProgram, GLuint program) -GL_ENTRY(void, glValidateProgramPipeline, GLuint pipeline) GL_ENTRY(void, glValidateProgramPipelineEXT, GLuint pipeline) -GL_ENTRY(void, glVertex2bOES, GLbyte x) -GL_ENTRY(void, glVertex2bvOES, const GLbyte * coords) -GL_ENTRY(void, glVertex3bOES, GLbyte x, GLbyte y) -GL_ENTRY(void, glVertex3bvOES, const GLbyte * coords) -GL_ENTRY(void, glVertex4bOES, GLbyte x, GLbyte y, GLbyte z) -GL_ENTRY(void, glVertex4bvOES, const GLbyte * coords) -GL_ENTRY(void, glVertexAttrib1f, GLuint index, GLfloat x) -GL_ENTRY(void, glVertexAttrib1fv, GLuint index, const GLfloat * v) -GL_ENTRY(void, glVertexAttrib2f, GLuint index, GLfloat x, GLfloat y) -GL_ENTRY(void, glVertexAttrib2fv, GLuint index, const GLfloat * v) -GL_ENTRY(void, glVertexAttrib3f, GLuint index, GLfloat x, GLfloat y, GLfloat z) -GL_ENTRY(void, glVertexAttrib3fv, GLuint index, const GLfloat * v) -GL_ENTRY(void, glVertexAttrib4f, GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) -GL_ENTRY(void, glVertexAttrib4fv, GLuint index, const GLfloat * v) -GL_ENTRY(void, glVertexAttribBinding, GLuint attribindex, GLuint bindingindex) -GL_ENTRY(void, glVertexAttribDivisor, GLuint index, GLuint divisor) -GL_ENTRY(void, glVertexAttribDivisorANGLE, GLuint index, GLuint divisor) -GL_ENTRY(void, glVertexAttribDivisorEXT, GLuint index, GLuint divisor) -GL_ENTRY(void, glVertexAttribDivisorNV, GLuint index, GLuint divisor) -GL_ENTRY(void, glVertexAttribFormat, GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) -GL_ENTRY(void, glVertexAttribI4i, GLuint index, GLint x, GLint y, GLint z, GLint w) -GL_ENTRY(void, glVertexAttribI4iv, GLuint index, const GLint * v) -GL_ENTRY(void, glVertexAttribI4ui, GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) -GL_ENTRY(void, glVertexAttribI4uiv, GLuint index, const GLuint * v) -GL_ENTRY(void, glVertexAttribIFormat, GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) -GL_ENTRY(void, glVertexAttribIPointer, GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) -GL_ENTRY(void, glVertexAttribPointer, GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) -GL_ENTRY(void, glVertexBindingDivisor, GLuint bindingindex, GLuint divisor) -GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const void * pointer) +GL_ENTRY(void, glVertexAttrib1f, GLuint indx, GLfloat x) +GL_ENTRY(void, glVertexAttrib1fv, GLuint indx, const GLfloat* values) +GL_ENTRY(void, glVertexAttrib2f, GLuint indx, GLfloat x, GLfloat y) +GL_ENTRY(void, glVertexAttrib2fv, GLuint indx, const GLfloat* values) +GL_ENTRY(void, glVertexAttrib3f, GLuint indx, GLfloat x, GLfloat y, GLfloat z) +GL_ENTRY(void, glVertexAttrib3fv, GLuint indx, const GLfloat* values) +GL_ENTRY(void, glVertexAttrib4f, GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) +GL_ENTRY(void, glVertexAttrib4fv, GLuint indx, const GLfloat* values) +GL_ENTRY(void, glVertexAttribPointer, GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) +GL_ENTRY(void, glVertexPointer, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) GL_ENTRY(void, glViewport, GLint x, GLint y, GLsizei width, GLsizei height) -GL_ENTRY(void, glWaitSync, GLsync sync, GLbitfield flags, GLuint64 timeout) -GL_ENTRY(void, glWaitSyncAPPLE, GLsync sync, GLbitfield flags, GLuint64 timeout) -GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const void * pointer) +GL_ENTRY(void, glWeightPointerOES, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/enums.in android-platform-frameworks-native-21/opengl/libs/enums.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/enums.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/enums.in 2012-10-16 22:57:11.000000000 +0000 @@ -1,10 +1,13 @@ GL_ENUM(0x0000,GL_POINTS) +GL_ENUM(0x00000001,GL_VERTEX_SHADER_BIT_EXT) +GL_ENUM(0x00000002,GL_FRAGMENT_SHADER_BIT_EXT) GL_ENUM(0x0001,GL_LINES) GL_ENUM(0x0002,GL_LINE_LOOP) GL_ENUM(0x0003,GL_LINE_STRIP) GL_ENUM(0x0004,GL_TRIANGLES) GL_ENUM(0x0005,GL_TRIANGLE_STRIP) GL_ENUM(0x0006,GL_TRIANGLE_FAN) +GL_ENUM(0x0104,GL_ADD) GL_ENUM(0x0200,GL_NEVER) GL_ENUM(0x0201,GL_LESS) GL_ENUM(0x0202,GL_EQUAL) @@ -22,74 +25,49 @@ GL_ENUM(0x0306,GL_DST_COLOR) GL_ENUM(0x0307,GL_ONE_MINUS_DST_COLOR) GL_ENUM(0x0308,GL_SRC_ALPHA_SATURATE) -GL_ENUM(0x3000,GL_CLIP_PLANE0) -GL_ENUM(0x3001,GL_CLIP_PLANE1) -GL_ENUM(0x3002,GL_CLIP_PLANE2) -GL_ENUM(0x3003,GL_CLIP_PLANE3) -GL_ENUM(0x3004,GL_CLIP_PLANE4) -GL_ENUM(0x3005,GL_CLIP_PLANE5) GL_ENUM(0x0404,GL_FRONT) GL_ENUM(0x0405,GL_BACK) GL_ENUM(0x0408,GL_FRONT_AND_BACK) -GL_ENUM(0x0B60,GL_FOG) -GL_ENUM(0x0B50,GL_LIGHTING) -GL_ENUM(0x0DE1,GL_TEXTURE_2D) -GL_ENUM(0x0B44,GL_CULL_FACE) -GL_ENUM(0x0BC0,GL_ALPHA_TEST) -GL_ENUM(0x0BE2,GL_BLEND) -GL_ENUM(0x0BF2,GL_COLOR_LOGIC_OP) -GL_ENUM(0x0BD0,GL_DITHER) -GL_ENUM(0x0B90,GL_STENCIL_TEST) -GL_ENUM(0x0B71,GL_DEPTH_TEST) -GL_ENUM(0x0B10,GL_POINT_SMOOTH) -GL_ENUM(0x0B20,GL_LINE_SMOOTH) -GL_ENUM(0x0C11,GL_SCISSOR_TEST) -GL_ENUM(0x0B57,GL_COLOR_MATERIAL) -GL_ENUM(0x0BA1,GL_NORMALIZE) -GL_ENUM(0x803A,GL_RESCALE_NORMAL) -GL_ENUM(0x8074,GL_VERTEX_ARRAY) -GL_ENUM(0x8075,GL_NORMAL_ARRAY) -GL_ENUM(0x8076,GL_COLOR_ARRAY) -GL_ENUM(0x8078,GL_TEXTURE_COORD_ARRAY) -GL_ENUM(0x809D,GL_MULTISAMPLE) -GL_ENUM(0x809E,GL_SAMPLE_ALPHA_TO_COVERAGE) -GL_ENUM(0x809F,GL_SAMPLE_ALPHA_TO_ONE) -GL_ENUM(0x80A0,GL_SAMPLE_COVERAGE) GL_ENUM(0x0500,GL_INVALID_ENUM) GL_ENUM(0x0501,GL_INVALID_VALUE) GL_ENUM(0x0502,GL_INVALID_OPERATION) GL_ENUM(0x0503,GL_STACK_OVERFLOW) GL_ENUM(0x0504,GL_STACK_UNDERFLOW) GL_ENUM(0x0505,GL_OUT_OF_MEMORY) +GL_ENUM(0x0506,GL_INVALID_FRAMEBUFFER_OPERATION_OES) GL_ENUM(0x0800,GL_EXP) GL_ENUM(0x0801,GL_EXP2) -GL_ENUM(0x0B62,GL_FOG_DENSITY) -GL_ENUM(0x0B63,GL_FOG_START) -GL_ENUM(0x0B64,GL_FOG_END) -GL_ENUM(0x0B65,GL_FOG_MODE) -GL_ENUM(0x0B66,GL_FOG_COLOR) GL_ENUM(0x0900,GL_CW) GL_ENUM(0x0901,GL_CCW) GL_ENUM(0x0B00,GL_CURRENT_COLOR) GL_ENUM(0x0B02,GL_CURRENT_NORMAL) GL_ENUM(0x0B03,GL_CURRENT_TEXTURE_COORDS) +GL_ENUM(0x0B10,GL_POINT_SMOOTH) GL_ENUM(0x0B11,GL_POINT_SIZE) -GL_ENUM(0x8126,GL_POINT_SIZE_MIN) -GL_ENUM(0x8127,GL_POINT_SIZE_MAX) -GL_ENUM(0x8128,GL_POINT_FADE_THRESHOLD_SIZE) -GL_ENUM(0x8129,GL_POINT_DISTANCE_ATTENUATION) GL_ENUM(0x0B12,GL_SMOOTH_POINT_SIZE_RANGE) +GL_ENUM(0x0B20,GL_LINE_SMOOTH) GL_ENUM(0x0B21,GL_LINE_WIDTH) GL_ENUM(0x0B22,GL_SMOOTH_LINE_WIDTH_RANGE) -GL_ENUM(0x846D,GL_ALIASED_POINT_SIZE_RANGE) -GL_ENUM(0x846E,GL_ALIASED_LINE_WIDTH_RANGE) +GL_ENUM(0x0B44,GL_CULL_FACE) GL_ENUM(0x0B45,GL_CULL_FACE_MODE) GL_ENUM(0x0B46,GL_FRONT_FACE) +GL_ENUM(0x0B50,GL_LIGHTING) +GL_ENUM(0x0B52,GL_LIGHT_MODEL_TWO_SIDE) +GL_ENUM(0x0B53,GL_LIGHT_MODEL_AMBIENT) GL_ENUM(0x0B54,GL_SHADE_MODEL) +GL_ENUM(0x0B57,GL_COLOR_MATERIAL) +GL_ENUM(0x0B60,GL_FOG) +GL_ENUM(0x0B62,GL_FOG_DENSITY) +GL_ENUM(0x0B63,GL_FOG_START) +GL_ENUM(0x0B64,GL_FOG_END) +GL_ENUM(0x0B65,GL_FOG_MODE) +GL_ENUM(0x0B66,GL_FOG_COLOR) GL_ENUM(0x0B70,GL_DEPTH_RANGE) +GL_ENUM(0x0B71,GL_DEPTH_TEST) GL_ENUM(0x0B72,GL_DEPTH_WRITEMASK) GL_ENUM(0x0B73,GL_DEPTH_CLEAR_VALUE) GL_ENUM(0x0B74,GL_DEPTH_FUNC) +GL_ENUM(0x0B90,GL_STENCIL_TEST) GL_ENUM(0x0B91,GL_STENCIL_CLEAR_VALUE) GL_ENUM(0x0B92,GL_STENCIL_FUNC) GL_ENUM(0x0B93,GL_STENCIL_VALUE_MASK) @@ -99,6 +77,7 @@ GL_ENUM(0x0B97,GL_STENCIL_REF) GL_ENUM(0x0B98,GL_STENCIL_WRITEMASK) GL_ENUM(0x0BA0,GL_MATRIX_MODE) +GL_ENUM(0x0BA1,GL_NORMALIZE) GL_ENUM(0x0BA2,GL_VIEWPORT) GL_ENUM(0x0BA3,GL_MODELVIEW_STACK_DEPTH) GL_ENUM(0x0BA4,GL_PROJECTION_STACK_DEPTH) @@ -106,14 +85,30 @@ GL_ENUM(0x0BA6,GL_MODELVIEW_MATRIX) GL_ENUM(0x0BA7,GL_PROJECTION_MATRIX) GL_ENUM(0x0BA8,GL_TEXTURE_MATRIX) +GL_ENUM(0x0BC0,GL_ALPHA_TEST) GL_ENUM(0x0BC1,GL_ALPHA_TEST_FUNC) GL_ENUM(0x0BC2,GL_ALPHA_TEST_REF) +GL_ENUM(0x0BD0,GL_DITHER) GL_ENUM(0x0BE0,GL_BLEND_DST) GL_ENUM(0x0BE1,GL_BLEND_SRC) +GL_ENUM(0x0BE2,GL_BLEND) GL_ENUM(0x0BF0,GL_LOGIC_OP_MODE) +GL_ENUM(0x0BF2,GL_COLOR_LOGIC_OP) +GL_ENUM(0x0C02,GL_READ_BUFFER_NV) GL_ENUM(0x0C10,GL_SCISSOR_BOX) +GL_ENUM(0x0C11,GL_SCISSOR_TEST) GL_ENUM(0x0C22,GL_COLOR_CLEAR_VALUE) GL_ENUM(0x0C23,GL_COLOR_WRITEMASK) +GL_ENUM(0x0C50,GL_PERSPECTIVE_CORRECTION_HINT) +GL_ENUM(0x0C51,GL_POINT_SMOOTH_HINT) +GL_ENUM(0x0C52,GL_LINE_SMOOTH_HINT) +GL_ENUM(0x0C54,GL_FOG_HINT) +GL_ENUM(0x0CF2,GL_UNPACK_ROW_LENGTH) +GL_ENUM(0x0CF3,GL_UNPACK_SKIP_ROWS) +GL_ENUM(0x0CF4,GL_UNPACK_SKIP_PIXELS) +GL_ENUM(0x0CF5,GL_UNPACK_ALIGNMENT) +GL_ENUM(0x0D05,GL_PACK_ALIGNMENT) +GL_ENUM(0x0D1C,GL_ALPHA_SCALE) GL_ENUM(0x0D31,GL_MAX_LIGHTS) GL_ENUM(0x0D32,GL_MAX_CLIP_PLANES) GL_ENUM(0x0D33,GL_MAX_TEXTURE_SIZE) @@ -121,7 +116,6 @@ GL_ENUM(0x0D38,GL_MAX_PROJECTION_STACK_DEPTH) GL_ENUM(0x0D39,GL_MAX_TEXTURE_STACK_DEPTH) GL_ENUM(0x0D3A,GL_MAX_VIEWPORT_DIMS) -GL_ENUM(0x84E2,GL_MAX_TEXTURE_UNITS) GL_ENUM(0x0D50,GL_SUBPIXEL_BITS) GL_ENUM(0x0D52,GL_RED_BITS) GL_ENUM(0x0D53,GL_GREEN_BITS) @@ -129,41 +123,10 @@ GL_ENUM(0x0D55,GL_ALPHA_BITS) GL_ENUM(0x0D56,GL_DEPTH_BITS) GL_ENUM(0x0D57,GL_STENCIL_BITS) -GL_ENUM(0x2A00,GL_POLYGON_OFFSET_UNITS) -GL_ENUM(0x8037,GL_POLYGON_OFFSET_FILL) -GL_ENUM(0x8038,GL_POLYGON_OFFSET_FACTOR) -GL_ENUM(0x8069,GL_TEXTURE_BINDING_2D) -GL_ENUM(0x807A,GL_VERTEX_ARRAY_SIZE) -GL_ENUM(0x807B,GL_VERTEX_ARRAY_TYPE) -GL_ENUM(0x807C,GL_VERTEX_ARRAY_STRIDE) -GL_ENUM(0x807E,GL_NORMAL_ARRAY_TYPE) -GL_ENUM(0x807F,GL_NORMAL_ARRAY_STRIDE) -GL_ENUM(0x8081,GL_COLOR_ARRAY_SIZE) -GL_ENUM(0x8082,GL_COLOR_ARRAY_TYPE) -GL_ENUM(0x8083,GL_COLOR_ARRAY_STRIDE) -GL_ENUM(0x8088,GL_TEXTURE_COORD_ARRAY_SIZE) -GL_ENUM(0x8089,GL_TEXTURE_COORD_ARRAY_TYPE) -GL_ENUM(0x808A,GL_TEXTURE_COORD_ARRAY_STRIDE) -GL_ENUM(0x808E,GL_VERTEX_ARRAY_POINTER) -GL_ENUM(0x808F,GL_NORMAL_ARRAY_POINTER) -GL_ENUM(0x8090,GL_COLOR_ARRAY_POINTER) -GL_ENUM(0x8092,GL_TEXTURE_COORD_ARRAY_POINTER) -GL_ENUM(0x80A8,GL_SAMPLE_BUFFERS) -GL_ENUM(0x80A9,GL_SAMPLES) -GL_ENUM(0x80AA,GL_SAMPLE_COVERAGE_VALUE) -GL_ENUM(0x80AB,GL_SAMPLE_COVERAGE_INVERT) -GL_ENUM(0x86A2,GL_NUM_COMPRESSED_TEXTURE_FORMATS) -GL_ENUM(0x86A3,GL_COMPRESSED_TEXTURE_FORMATS) +GL_ENUM(0x0DE1,GL_TEXTURE_2D) GL_ENUM(0x1100,GL_DONT_CARE) GL_ENUM(0x1101,GL_FASTEST) GL_ENUM(0x1102,GL_NICEST) -GL_ENUM(0x0C50,GL_PERSPECTIVE_CORRECTION_HINT) -GL_ENUM(0x0C51,GL_POINT_SMOOTH_HINT) -GL_ENUM(0x0C52,GL_LINE_SMOOTH_HINT) -GL_ENUM(0x0C54,GL_FOG_HINT) -GL_ENUM(0x8192,GL_GENERATE_MIPMAP_HINT) -GL_ENUM(0x0B53,GL_LIGHT_MODEL_AMBIENT) -GL_ENUM(0x0B52,GL_LIGHT_MODEL_TWO_SIDE) GL_ENUM(0x1200,GL_AMBIENT) GL_ENUM(0x1201,GL_DIFFUSE) GL_ENUM(0x1202,GL_SPECULAR) @@ -178,6 +141,8 @@ GL_ENUM(0x1401,GL_UNSIGNED_BYTE) GL_ENUM(0x1402,GL_SHORT) GL_ENUM(0x1403,GL_UNSIGNED_SHORT) +GL_ENUM(0x1404,GL_INT) +GL_ENUM(0x1405,GL_UNSIGNED_INT) GL_ENUM(0x1406,GL_FLOAT) GL_ENUM(0x140C,GL_FIXED) GL_ENUM(0x1500,GL_CLEAR) @@ -202,16 +167,17 @@ GL_ENUM(0x1700,GL_MODELVIEW) GL_ENUM(0x1701,GL_PROJECTION) GL_ENUM(0x1702,GL_TEXTURE) +GL_ENUM(0x1800,GL_COLOR_EXT) +GL_ENUM(0x1801,GL_DEPTH_EXT) +GL_ENUM(0x1802,GL_STENCIL_EXT) +GL_ENUM(0x1901,GL_STENCIL_INDEX) +GL_ENUM(0x1902,GL_DEPTH_COMPONENT) +GL_ENUM(0x1903,GL_RED_EXT) GL_ENUM(0x1906,GL_ALPHA) GL_ENUM(0x1907,GL_RGB) GL_ENUM(0x1908,GL_RGBA) GL_ENUM(0x1909,GL_LUMINANCE) GL_ENUM(0x190A,GL_LUMINANCE_ALPHA) -GL_ENUM(0x0CF5,GL_UNPACK_ALIGNMENT) -GL_ENUM(0x0D05,GL_PACK_ALIGNMENT) -GL_ENUM(0x8033,GL_UNSIGNED_SHORT_4_4_4_4) -GL_ENUM(0x8034,GL_UNSIGNED_SHORT_5_5_5_1) -GL_ENUM(0x8363,GL_UNSIGNED_SHORT_5_6_5) GL_ENUM(0x1D00,GL_FLAT) GL_ENUM(0x1D01,GL_SMOOTH) GL_ENUM(0x1E00,GL_KEEP) @@ -224,10 +190,10 @@ GL_ENUM(0x1F03,GL_EXTENSIONS) GL_ENUM(0x2100,GL_MODULATE) GL_ENUM(0x2101,GL_DECAL) -GL_ENUM(0x0104,GL_ADD) GL_ENUM(0x2200,GL_TEXTURE_ENV_MODE) GL_ENUM(0x2201,GL_TEXTURE_ENV_COLOR) GL_ENUM(0x2300,GL_TEXTURE_ENV) +GL_ENUM(0x2500,GL_TEXTURE_GEN_MODE_OES) GL_ENUM(0x2600,GL_NEAREST) GL_ENUM(0x2601,GL_LINEAR) GL_ENUM(0x2700,GL_NEAREST_MIPMAP_NEAREST) @@ -238,7 +204,121 @@ GL_ENUM(0x2801,GL_TEXTURE_MIN_FILTER) GL_ENUM(0x2802,GL_TEXTURE_WRAP_S) GL_ENUM(0x2803,GL_TEXTURE_WRAP_T) +GL_ENUM(0x2901,GL_REPEAT) +GL_ENUM(0x2A00,GL_POLYGON_OFFSET_UNITS) +GL_ENUM(0x3000,GL_CLIP_PLANE0) +GL_ENUM(0x3001,GL_CLIP_PLANE1) +GL_ENUM(0x3002,GL_CLIP_PLANE2) +GL_ENUM(0x3003,GL_CLIP_PLANE3) +GL_ENUM(0x3004,GL_CLIP_PLANE4) +GL_ENUM(0x3005,GL_CLIP_PLANE5) +GL_ENUM(0x4000,GL_LIGHT0) +GL_ENUM(0x4001,GL_LIGHT1) +GL_ENUM(0x4002,GL_LIGHT2) +GL_ENUM(0x4003,GL_LIGHT3) +GL_ENUM(0x4004,GL_LIGHT4) +GL_ENUM(0x4005,GL_LIGHT5) +GL_ENUM(0x4006,GL_LIGHT6) +GL_ENUM(0x4007,GL_LIGHT7) +GL_ENUM(0x8000,GL_COVERAGE_BUFFER_BIT_NV) +GL_ENUM(0x8001,GL_CONSTANT_COLOR) +GL_ENUM(0x8002,GL_ONE_MINUS_CONSTANT_COLOR) +GL_ENUM(0x8003,GL_CONSTANT_ALPHA) +GL_ENUM(0x8004,GL_ONE_MINUS_CONSTANT_ALPHA) +GL_ENUM(0x8005,GL_BLEND_COLOR) +GL_ENUM(0x8006,GL_FUNC_ADD_OES) +GL_ENUM(0x8007,GL_MIN_EXT) +GL_ENUM(0x8008,GL_MAX_EXT) +GL_ENUM(0x8009,GL_BLEND_EQUATION_RGB_OES) +GL_ENUM(0x800A,GL_FUNC_SUBTRACT_OES) +GL_ENUM(0x800B,GL_FUNC_REVERSE_SUBTRACT_OES) +GL_ENUM(0x8033,GL_UNSIGNED_SHORT_4_4_4_4) +GL_ENUM(0x8034,GL_UNSIGNED_SHORT_5_5_5_1) +GL_ENUM(0x8037,GL_POLYGON_OFFSET_FILL) +GL_ENUM(0x8038,GL_POLYGON_OFFSET_FACTOR) +GL_ENUM(0x803A,GL_RESCALE_NORMAL) +GL_ENUM(0x803C,GL_ALPHA8_EXT) +GL_ENUM(0x8040,GL_LUMINANCE8_EXT) +GL_ENUM(0x8045,GL_LUMINANCE8_ALPHA8_EXT) +GL_ENUM(0x8051,GL_RGB8_OES) +GL_ENUM(0x8052,GL_RGB10_EXT) +GL_ENUM(0x8056,GL_RGBA4_OES) +GL_ENUM(0x8057,GL_RGB5_A1_OES) +GL_ENUM(0x8058,GL_RGBA8_OES) +GL_ENUM(0x8059,GL_RGB10_A2_EXT) +GL_ENUM(0x8069,GL_TEXTURE_BINDING_2D) +GL_ENUM(0x806A,GL_TEXTURE_BINDING_3D_OES) +GL_ENUM(0x806F,GL_TEXTURE_3D_OES) +GL_ENUM(0x8072,GL_TEXTURE_WRAP_R_OES) +GL_ENUM(0x8073,GL_MAX_3D_TEXTURE_SIZE_OES) +GL_ENUM(0x8074,GL_VERTEX_ARRAY) +GL_ENUM(0x8075,GL_NORMAL_ARRAY) +GL_ENUM(0x8076,GL_COLOR_ARRAY) +GL_ENUM(0x8078,GL_TEXTURE_COORD_ARRAY) +GL_ENUM(0x807A,GL_VERTEX_ARRAY_SIZE) +GL_ENUM(0x807B,GL_VERTEX_ARRAY_TYPE) +GL_ENUM(0x807C,GL_VERTEX_ARRAY_STRIDE) +GL_ENUM(0x807E,GL_NORMAL_ARRAY_TYPE) +GL_ENUM(0x807F,GL_NORMAL_ARRAY_STRIDE) +GL_ENUM(0x8081,GL_COLOR_ARRAY_SIZE) +GL_ENUM(0x8082,GL_COLOR_ARRAY_TYPE) +GL_ENUM(0x8083,GL_COLOR_ARRAY_STRIDE) +GL_ENUM(0x8088,GL_TEXTURE_COORD_ARRAY_SIZE) +GL_ENUM(0x8089,GL_TEXTURE_COORD_ARRAY_TYPE) +GL_ENUM(0x808A,GL_TEXTURE_COORD_ARRAY_STRIDE) +GL_ENUM(0x808E,GL_VERTEX_ARRAY_POINTER) +GL_ENUM(0x808F,GL_NORMAL_ARRAY_POINTER) +GL_ENUM(0x8090,GL_COLOR_ARRAY_POINTER) +GL_ENUM(0x8092,GL_TEXTURE_COORD_ARRAY_POINTER) +GL_ENUM(0x809D,GL_MULTISAMPLE) +GL_ENUM(0x809E,GL_SAMPLE_ALPHA_TO_COVERAGE) +GL_ENUM(0x809F,GL_SAMPLE_ALPHA_TO_ONE) +GL_ENUM(0x80A0,GL_SAMPLE_COVERAGE) +GL_ENUM(0x80A8,GL_SAMPLE_BUFFERS) +GL_ENUM(0x80A9,GL_SAMPLES) +GL_ENUM(0x80AA,GL_SAMPLE_COVERAGE_VALUE) +GL_ENUM(0x80AB,GL_SAMPLE_COVERAGE_INVERT) +GL_ENUM(0x80C8,GL_BLEND_DST_RGB_OES) +GL_ENUM(0x80C9,GL_BLEND_SRC_RGB_OES) +GL_ENUM(0x80CA,GL_BLEND_DST_ALPHA_OES) +GL_ENUM(0x80CB,GL_BLEND_SRC_ALPHA_OES) +GL_ENUM(0x80E1,GL_BGRA_EXT) +GL_ENUM(0x8126,GL_POINT_SIZE_MIN) +GL_ENUM(0x8127,GL_POINT_SIZE_MAX) +GL_ENUM(0x8128,GL_POINT_FADE_THRESHOLD_SIZE) +GL_ENUM(0x8129,GL_POINT_DISTANCE_ATTENUATION) +GL_ENUM(0x812F,GL_CLAMP_TO_EDGE) +GL_ENUM(0x813D,GL_TEXTURE_MAX_LEVEL_APPLE) GL_ENUM(0x8191,GL_GENERATE_MIPMAP) +GL_ENUM(0x8192,GL_GENERATE_MIPMAP_HINT) +GL_ENUM(0x81A5,GL_DEPTH_COMPONENT16_OES) +GL_ENUM(0x81A6,GL_DEPTH_COMPONENT24_OES) +GL_ENUM(0x81A7,GL_DEPTH_COMPONENT32_OES) +GL_ENUM(0x8210,GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING_EXT) +GL_ENUM(0x8211,GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE_EXT) +GL_ENUM(0x8227,GL_RG_EXT) +GL_ENUM(0x8229,GL_R8_EXT) +GL_ENUM(0x822B,GL_RG8_EXT) +GL_ENUM(0x822D,GL_R16F_EXT) +GL_ENUM(0x822F,GL_RG16F_EXT) +GL_ENUM(0x8252,GL_LOSE_CONTEXT_ON_RESET_EXT) +GL_ENUM(0x8253,GL_GUILTY_CONTEXT_RESET_EXT) +GL_ENUM(0x8254,GL_INNOCENT_CONTEXT_RESET_EXT) +GL_ENUM(0x8255,GL_UNKNOWN_CONTEXT_RESET_EXT) +GL_ENUM(0x8256,GL_RESET_NOTIFICATION_STRATEGY_EXT) +GL_ENUM(0x8258,GL_PROGRAM_SEPARABLE_EXT) +GL_ENUM(0x8259,GL_ACTIVE_PROGRAM_EXT) +GL_ENUM(0x825A,GL_PROGRAM_PIPELINE_BINDING_EXT) +GL_ENUM(0x8261,GL_NO_RESET_NOTIFICATION_EXT) +GL_ENUM(0x8363,GL_UNSIGNED_SHORT_5_6_5) +GL_ENUM(0x8365,GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT) +GL_ENUM(0x8366,GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT) +GL_ENUM(0x8368,GL_UNSIGNED_INT_2_10_10_10_REV_EXT) +GL_ENUM(0x8370,GL_MIRRORED_REPEAT_OES) +GL_ENUM(0x83F0,GL_COMPRESSED_RGB_S3TC_DXT1_EXT) +GL_ENUM(0x83F1,GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) +GL_ENUM(0x846D,GL_ALIASED_POINT_SIZE_RANGE) +GL_ENUM(0x846E,GL_ALIASED_LINE_WIDTH_RANGE) GL_ENUM(0x84C0,GL_TEXTURE0) GL_ENUM(0x84C1,GL_TEXTURE1) GL_ENUM(0x84C2,GL_TEXTURE2) @@ -273,29 +353,32 @@ GL_ENUM(0x84DF,GL_TEXTURE31) GL_ENUM(0x84E0,GL_ACTIVE_TEXTURE) GL_ENUM(0x84E1,GL_CLIENT_ACTIVE_TEXTURE) -GL_ENUM(0x2901,GL_REPEAT) -GL_ENUM(0x812F,GL_CLAMP_TO_EDGE) -GL_ENUM(0x4000,GL_LIGHT0) -GL_ENUM(0x4001,GL_LIGHT1) -GL_ENUM(0x4002,GL_LIGHT2) -GL_ENUM(0x4003,GL_LIGHT3) -GL_ENUM(0x4004,GL_LIGHT4) -GL_ENUM(0x4005,GL_LIGHT5) -GL_ENUM(0x4006,GL_LIGHT6) -GL_ENUM(0x4007,GL_LIGHT7) -GL_ENUM(0x8892,GL_ARRAY_BUFFER) -GL_ENUM(0x8893,GL_ELEMENT_ARRAY_BUFFER) -GL_ENUM(0x8894,GL_ARRAY_BUFFER_BINDING) -GL_ENUM(0x8895,GL_ELEMENT_ARRAY_BUFFER_BINDING) -GL_ENUM(0x8896,GL_VERTEX_ARRAY_BUFFER_BINDING) -GL_ENUM(0x8897,GL_NORMAL_ARRAY_BUFFER_BINDING) -GL_ENUM(0x8898,GL_COLOR_ARRAY_BUFFER_BINDING) -GL_ENUM(0x889A,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) -GL_ENUM(0x88E4,GL_STATIC_DRAW) -GL_ENUM(0x88E8,GL_DYNAMIC_DRAW) -GL_ENUM(0x8764,GL_BUFFER_SIZE) -GL_ENUM(0x8765,GL_BUFFER_USAGE) +GL_ENUM(0x84E2,GL_MAX_TEXTURE_UNITS) GL_ENUM(0x84E7,GL_SUBTRACT) +GL_ENUM(0x84E8,GL_MAX_RENDERBUFFER_SIZE_OES) +GL_ENUM(0x84F2,GL_ALL_COMPLETED_NV) +GL_ENUM(0x84F3,GL_FENCE_STATUS_NV) +GL_ENUM(0x84F4,GL_FENCE_CONDITION_NV) +GL_ENUM(0x84F9,GL_DEPTH_STENCIL_OES) +GL_ENUM(0x84FA,GL_UNSIGNED_INT_24_8_OES) +GL_ENUM(0x84FD,GL_MAX_TEXTURE_LOD_BIAS_EXT) +GL_ENUM(0x84FE,GL_TEXTURE_MAX_ANISOTROPY_EXT) +GL_ENUM(0x84FF,GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) +GL_ENUM(0x8500,GL_TEXTURE_FILTER_CONTROL_EXT) +GL_ENUM(0x8501,GL_TEXTURE_LOD_BIAS_EXT) +GL_ENUM(0x8507,GL_INCR_WRAP_OES) +GL_ENUM(0x8508,GL_DECR_WRAP_OES) +GL_ENUM(0x8511,GL_NORMAL_MAP_OES) +GL_ENUM(0x8512,GL_REFLECTION_MAP_OES) +GL_ENUM(0x8513,GL_TEXTURE_CUBE_MAP_OES) +GL_ENUM(0x8514,GL_TEXTURE_BINDING_CUBE_MAP_OES) +GL_ENUM(0x8515,GL_TEXTURE_CUBE_MAP_POSITIVE_X_OES) +GL_ENUM(0x8516,GL_TEXTURE_CUBE_MAP_NEGATIVE_X_OES) +GL_ENUM(0x8517,GL_TEXTURE_CUBE_MAP_POSITIVE_Y_OES) +GL_ENUM(0x8518,GL_TEXTURE_CUBE_MAP_NEGATIVE_Y_OES) +GL_ENUM(0x8519,GL_TEXTURE_CUBE_MAP_POSITIVE_Z_OES) +GL_ENUM(0x851A,GL_TEXTURE_CUBE_MAP_NEGATIVE_Z_OES) +GL_ENUM(0x851C,GL_MAX_CUBE_MAP_TEXTURE_SIZE_OES) GL_ENUM(0x8570,GL_COMBINE) GL_ENUM(0x8571,GL_COMBINE_RGB) GL_ENUM(0x8572,GL_COMBINE_ALPHA) @@ -305,79 +388,131 @@ GL_ENUM(0x8576,GL_CONSTANT) GL_ENUM(0x8577,GL_PRIMARY_COLOR) GL_ENUM(0x8578,GL_PREVIOUS) -GL_ENUM(0x8590,GL_OPERAND0_RGB) -GL_ENUM(0x8591,GL_OPERAND1_RGB) -GL_ENUM(0x8592,GL_OPERAND2_RGB) -GL_ENUM(0x8598,GL_OPERAND0_ALPHA) -GL_ENUM(0x8599,GL_OPERAND1_ALPHA) -GL_ENUM(0x859A,GL_OPERAND2_ALPHA) -GL_ENUM(0x0D1C,GL_ALPHA_SCALE) GL_ENUM(0x8580,GL_SRC0_RGB) GL_ENUM(0x8581,GL_SRC1_RGB) GL_ENUM(0x8582,GL_SRC2_RGB) GL_ENUM(0x8588,GL_SRC0_ALPHA) GL_ENUM(0x8589,GL_SRC1_ALPHA) GL_ENUM(0x858A,GL_SRC2_ALPHA) +GL_ENUM(0x8590,GL_OPERAND0_RGB) +GL_ENUM(0x8591,GL_OPERAND1_RGB) +GL_ENUM(0x8592,GL_OPERAND2_RGB) +GL_ENUM(0x8598,GL_OPERAND0_ALPHA) +GL_ENUM(0x8599,GL_OPERAND1_ALPHA) +GL_ENUM(0x859A,GL_OPERAND2_ALPHA) +GL_ENUM(0x85B5,GL_VERTEX_ARRAY_BINDING_OES) +GL_ENUM(0x85BA,GL_UNSIGNED_SHORT_8_8_APPLE) +GL_ENUM(0x85BB,GL_UNSIGNED_SHORT_8_8_REV_APPLE) +GL_ENUM(0x8622,GL_VERTEX_ATTRIB_ARRAY_ENABLED) +GL_ENUM(0x8623,GL_VERTEX_ATTRIB_ARRAY_SIZE) +GL_ENUM(0x8624,GL_VERTEX_ATTRIB_ARRAY_STRIDE) +GL_ENUM(0x8625,GL_VERTEX_ATTRIB_ARRAY_TYPE) +GL_ENUM(0x8626,GL_CURRENT_VERTEX_ATTRIB) +GL_ENUM(0x8645,GL_VERTEX_ATTRIB_ARRAY_POINTER) +GL_ENUM(0x86A2,GL_NUM_COMPRESSED_TEXTURE_FORMATS) +GL_ENUM(0x86A3,GL_COMPRESSED_TEXTURE_FORMATS) +GL_ENUM(0x86A4,GL_MAX_VERTEX_UNITS_OES) +GL_ENUM(0x86A9,GL_WEIGHT_ARRAY_TYPE_OES) +GL_ENUM(0x86AA,GL_WEIGHT_ARRAY_STRIDE_OES) +GL_ENUM(0x86AB,GL_WEIGHT_ARRAY_SIZE_OES) +GL_ENUM(0x86AC,GL_WEIGHT_ARRAY_POINTER_OES) +GL_ENUM(0x86AD,GL_WEIGHT_ARRAY_OES) GL_ENUM(0x86AE,GL_DOT3_RGB) GL_ENUM(0x86AF,GL_DOT3_RGBA) -GL_ENUM(0x8006,GL_FUNC_ADD) -GL_ENUM(0x8009,GL_BLEND_EQUATION) -GL_ENUM(0x883D,GL_BLEND_EQUATION_ALPHA) -GL_ENUM(0x800A,GL_FUNC_SUBTRACT) -GL_ENUM(0x800B,GL_FUNC_REVERSE_SUBTRACT) -GL_ENUM(0x80C8,GL_BLEND_DST_RGB) -GL_ENUM(0x80C9,GL_BLEND_SRC_RGB) -GL_ENUM(0x80CA,GL_BLEND_DST_ALPHA) -GL_ENUM(0x80CB,GL_BLEND_SRC_ALPHA) -GL_ENUM(0x8001,GL_CONSTANT_COLOR) -GL_ENUM(0x8002,GL_ONE_MINUS_CONSTANT_COLOR) -GL_ENUM(0x8003,GL_CONSTANT_ALPHA) -GL_ENUM(0x8004,GL_ONE_MINUS_CONSTANT_ALPHA) -GL_ENUM(0x8005,GL_BLEND_COLOR) -GL_ENUM(0x88E0,GL_STREAM_DRAW) -GL_ENUM(0x8626,GL_CURRENT_VERTEX_ATTRIB) +GL_ENUM(0x8740,GL_Z400_BINARY_AMD) +GL_ENUM(0x8741,GL_PROGRAM_BINARY_LENGTH_OES) +GL_ENUM(0x8764,GL_BUFFER_SIZE) +GL_ENUM(0x8765,GL_BUFFER_USAGE) +GL_ENUM(0x87EE,GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD) +GL_ENUM(0x87F9,GL_3DC_X_AMD) +GL_ENUM(0x87FA,GL_3DC_XY_AMD) +GL_ENUM(0x87FE,GL_NUM_PROGRAM_BINARY_FORMATS_OES) +GL_ENUM(0x87FF,GL_PROGRAM_BINARY_FORMATS_OES) GL_ENUM(0x8800,GL_STENCIL_BACK_FUNC) GL_ENUM(0x8801,GL_STENCIL_BACK_FAIL) GL_ENUM(0x8802,GL_STENCIL_BACK_PASS_DEPTH_FAIL) GL_ENUM(0x8803,GL_STENCIL_BACK_PASS_DEPTH_PASS) -GL_ENUM(0x8CA3,GL_STENCIL_BACK_REF) -GL_ENUM(0x8CA4,GL_STENCIL_BACK_VALUE_MASK) -GL_ENUM(0x8CA5,GL_STENCIL_BACK_WRITEMASK) -GL_ENUM(0x1404,GL_INT) -GL_ENUM(0x1405,GL_UNSIGNED_INT) -GL_ENUM(0x1902,GL_DEPTH_COMPONENT) +GL_ENUM(0x8814,GL_RGBA32F_EXT) +GL_ENUM(0x8815,GL_RGB32F_EXT) +GL_ENUM(0x8816,GL_ALPHA32F_EXT) +GL_ENUM(0x8818,GL_LUMINANCE32F_EXT) +GL_ENUM(0x8819,GL_LUMINANCE_ALPHA32F_EXT) +GL_ENUM(0x881A,GL_RGBA16F_EXT) +GL_ENUM(0x881B,GL_RGB16F_EXT) +GL_ENUM(0x881C,GL_ALPHA16F_EXT) +GL_ENUM(0x881E,GL_LUMINANCE16F_EXT) +GL_ENUM(0x881F,GL_LUMINANCE_ALPHA16F_EXT) +GL_ENUM(0x8823,GL_WRITEONLY_RENDERING_QCOM) +GL_ENUM(0x8824,GL_MAX_DRAW_BUFFERS_NV) +GL_ENUM(0x8825,GL_DRAW_BUFFER0_NV) +GL_ENUM(0x8826,GL_DRAW_BUFFER1_NV) +GL_ENUM(0x8827,GL_DRAW_BUFFER2_NV) +GL_ENUM(0x8828,GL_DRAW_BUFFER3_NV) +GL_ENUM(0x8829,GL_DRAW_BUFFER4_NV) +GL_ENUM(0x882A,GL_DRAW_BUFFER5_NV) +GL_ENUM(0x882B,GL_DRAW_BUFFER6_NV) +GL_ENUM(0x882C,GL_DRAW_BUFFER7_NV) +GL_ENUM(0x882D,GL_DRAW_BUFFER8_NV) +GL_ENUM(0x882E,GL_DRAW_BUFFER9_NV) +GL_ENUM(0x882F,GL_DRAW_BUFFER10_NV) +GL_ENUM(0x8830,GL_DRAW_BUFFER11_NV) +GL_ENUM(0x8831,GL_DRAW_BUFFER12_NV) +GL_ENUM(0x8832,GL_DRAW_BUFFER13_NV) +GL_ENUM(0x8833,GL_DRAW_BUFFER14_NV) +GL_ENUM(0x8834,GL_DRAW_BUFFER15_NV) +GL_ENUM(0x883D,GL_BLEND_EQUATION_ALPHA_OES) +GL_ENUM(0x8840,GL_MATRIX_PALETTE_OES) +GL_ENUM(0x8842,GL_MAX_PALETTE_MATRICES_OES) +GL_ENUM(0x8843,GL_CURRENT_PALETTE_MATRIX_OES) +GL_ENUM(0x8844,GL_MATRIX_INDEX_ARRAY_OES) +GL_ENUM(0x8846,GL_MATRIX_INDEX_ARRAY_SIZE_OES) +GL_ENUM(0x8847,GL_MATRIX_INDEX_ARRAY_TYPE_OES) +GL_ENUM(0x8848,GL_MATRIX_INDEX_ARRAY_STRIDE_OES) +GL_ENUM(0x8849,GL_MATRIX_INDEX_ARRAY_POINTER_OES) +GL_ENUM(0x884C,GL_TEXTURE_COMPARE_MODE_EXT) +GL_ENUM(0x884D,GL_TEXTURE_COMPARE_FUNC_EXT) +GL_ENUM(0x884E,GL_COMPARE_REF_TO_TEXTURE_EXT) +GL_ENUM(0x8861,GL_POINT_SPRITE_OES) +GL_ENUM(0x8862,GL_COORD_REPLACE_OES) +GL_ENUM(0x8865,GL_CURRENT_QUERY_EXT) +GL_ENUM(0x8866,GL_QUERY_RESULT_EXT) +GL_ENUM(0x8867,GL_QUERY_RESULT_AVAILABLE_EXT) +GL_ENUM(0x8869,GL_MAX_VERTEX_ATTRIBS) +GL_ENUM(0x886A,GL_VERTEX_ATTRIB_ARRAY_NORMALIZED) +GL_ENUM(0x8872,GL_MAX_TEXTURE_IMAGE_UNITS) +GL_ENUM(0x8892,GL_ARRAY_BUFFER) +GL_ENUM(0x8893,GL_ELEMENT_ARRAY_BUFFER) +GL_ENUM(0x8894,GL_ARRAY_BUFFER_BINDING) +GL_ENUM(0x8895,GL_ELEMENT_ARRAY_BUFFER_BINDING) +GL_ENUM(0x8896,GL_VERTEX_ARRAY_BUFFER_BINDING) +GL_ENUM(0x8897,GL_NORMAL_ARRAY_BUFFER_BINDING) +GL_ENUM(0x8898,GL_COLOR_ARRAY_BUFFER_BINDING) +GL_ENUM(0x889A,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING) +GL_ENUM(0x889E,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) +GL_ENUM(0x889F,GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) +GL_ENUM(0x88B9,GL_WRITE_ONLY_OES) +GL_ENUM(0x88BB,GL_BUFFER_ACCESS_OES) +GL_ENUM(0x88BC,GL_BUFFER_MAPPED_OES) +GL_ENUM(0x88BD,GL_BUFFER_MAP_POINTER_OES) +GL_ENUM(0x88E0,GL_STREAM_DRAW) +GL_ENUM(0x88E4,GL_STATIC_DRAW) +GL_ENUM(0x88E8,GL_DYNAMIC_DRAW) +GL_ENUM(0x88F0,GL_DEPTH24_STENCIL8_OES) +GL_ENUM(0x898A,GL_POINT_SIZE_ARRAY_TYPE_OES) +GL_ENUM(0x898B,GL_POINT_SIZE_ARRAY_STRIDE_OES) +GL_ENUM(0x898C,GL_POINT_SIZE_ARRAY_POINTER_OES) +GL_ENUM(0x898D,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) +GL_ENUM(0x898E,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) +GL_ENUM(0x898F,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) +GL_ENUM(0x8A1F,GL_RGB_422_APPLE) +GL_ENUM(0x8A4F,GL_PROGRAM_PIPELINE_OBJECT_EXT) GL_ENUM(0x8B30,GL_FRAGMENT_SHADER) GL_ENUM(0x8B31,GL_VERTEX_SHADER) -GL_ENUM(0x8869,GL_MAX_VERTEX_ATTRIBS) -GL_ENUM(0x8DFB,GL_MAX_VERTEX_UNIFORM_VECTORS) -GL_ENUM(0x8DFC,GL_MAX_VARYING_VECTORS) -GL_ENUM(0x8B4D,GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS) +GL_ENUM(0x8B40,GL_PROGRAM_OBJECT_EXT) +GL_ENUM(0x8B48,GL_SHADER_OBJECT_EXT) GL_ENUM(0x8B4C,GL_MAX_VERTEX_TEXTURE_IMAGE_UNITS) -GL_ENUM(0x8872,GL_MAX_TEXTURE_IMAGE_UNITS) -GL_ENUM(0x8DFD,GL_MAX_FRAGMENT_UNIFORM_VECTORS) +GL_ENUM(0x8B4D,GL_MAX_COMBINED_TEXTURE_IMAGE_UNITS) GL_ENUM(0x8B4F,GL_SHADER_TYPE) -GL_ENUM(0x8B80,GL_DELETE_STATUS) -GL_ENUM(0x8B82,GL_LINK_STATUS) -GL_ENUM(0x8B83,GL_VALIDATE_STATUS) -GL_ENUM(0x8B85,GL_ATTACHED_SHADERS) -GL_ENUM(0x8B86,GL_ACTIVE_UNIFORMS) -GL_ENUM(0x8B87,GL_ACTIVE_UNIFORM_MAX_LENGTH) -GL_ENUM(0x8B89,GL_ACTIVE_ATTRIBUTES) -GL_ENUM(0x8B8A,GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) -GL_ENUM(0x8B8C,GL_SHADING_LANGUAGE_VERSION) -GL_ENUM(0x8B8D,GL_CURRENT_PROGRAM) -GL_ENUM(0x8507,GL_INCR_WRAP) -GL_ENUM(0x8508,GL_DECR_WRAP) -GL_ENUM(0x8513,GL_TEXTURE_CUBE_MAP) -GL_ENUM(0x8514,GL_TEXTURE_BINDING_CUBE_MAP) -GL_ENUM(0x8515,GL_TEXTURE_CUBE_MAP_POSITIVE_X) -GL_ENUM(0x8516,GL_TEXTURE_CUBE_MAP_NEGATIVE_X) -GL_ENUM(0x8517,GL_TEXTURE_CUBE_MAP_POSITIVE_Y) -GL_ENUM(0x8518,GL_TEXTURE_CUBE_MAP_NEGATIVE_Y) -GL_ENUM(0x8519,GL_TEXTURE_CUBE_MAP_POSITIVE_Z) -GL_ENUM(0x851A,GL_TEXTURE_CUBE_MAP_NEGATIVE_Z) -GL_ENUM(0x851C,GL_MAX_CUBE_MAP_TEXTURE_SIZE) -GL_ENUM(0x8370,GL_MIRRORED_REPEAT) GL_ENUM(0x8B50,GL_FLOAT_VEC2) GL_ENUM(0x8B51,GL_FLOAT_VEC3) GL_ENUM(0x8B52,GL_FLOAT_VEC4) @@ -392,515 +527,23 @@ GL_ENUM(0x8B5B,GL_FLOAT_MAT3) GL_ENUM(0x8B5C,GL_FLOAT_MAT4) GL_ENUM(0x8B5E,GL_SAMPLER_2D) +GL_ENUM(0x8B5F,GL_SAMPLER_3D_OES) GL_ENUM(0x8B60,GL_SAMPLER_CUBE) -GL_ENUM(0x8622,GL_VERTEX_ATTRIB_ARRAY_ENABLED) -GL_ENUM(0x8623,GL_VERTEX_ATTRIB_ARRAY_SIZE) -GL_ENUM(0x8624,GL_VERTEX_ATTRIB_ARRAY_STRIDE) -GL_ENUM(0x8625,GL_VERTEX_ATTRIB_ARRAY_TYPE) -GL_ENUM(0x886A,GL_VERTEX_ATTRIB_ARRAY_NORMALIZED) -GL_ENUM(0x8645,GL_VERTEX_ATTRIB_ARRAY_POINTER) -GL_ENUM(0x889F,GL_VERTEX_ATTRIB_ARRAY_BUFFER_BINDING) -GL_ENUM(0x8B9A,GL_IMPLEMENTATION_COLOR_READ_TYPE) -GL_ENUM(0x8B9B,GL_IMPLEMENTATION_COLOR_READ_FORMAT) +GL_ENUM(0x8B62,GL_SAMPLER_2D_SHADOW_EXT) +GL_ENUM(0x8B80,GL_DELETE_STATUS) GL_ENUM(0x8B81,GL_COMPILE_STATUS) +GL_ENUM(0x8B82,GL_LINK_STATUS) +GL_ENUM(0x8B83,GL_VALIDATE_STATUS) GL_ENUM(0x8B84,GL_INFO_LOG_LENGTH) +GL_ENUM(0x8B85,GL_ATTACHED_SHADERS) +GL_ENUM(0x8B86,GL_ACTIVE_UNIFORMS) +GL_ENUM(0x8B87,GL_ACTIVE_UNIFORM_MAX_LENGTH) GL_ENUM(0x8B88,GL_SHADER_SOURCE_LENGTH) -GL_ENUM(0x8DFA,GL_SHADER_COMPILER) -GL_ENUM(0x8DF8,GL_SHADER_BINARY_FORMATS) -GL_ENUM(0x8DF9,GL_NUM_SHADER_BINARY_FORMATS) -GL_ENUM(0x8DF0,GL_LOW_FLOAT) -GL_ENUM(0x8DF1,GL_MEDIUM_FLOAT) -GL_ENUM(0x8DF2,GL_HIGH_FLOAT) -GL_ENUM(0x8DF3,GL_LOW_INT) -GL_ENUM(0x8DF4,GL_MEDIUM_INT) -GL_ENUM(0x8DF5,GL_HIGH_INT) -GL_ENUM(0x8D40,GL_FRAMEBUFFER) -GL_ENUM(0x8D41,GL_RENDERBUFFER) -GL_ENUM(0x8056,GL_RGBA4) -GL_ENUM(0x8057,GL_RGB5_A1) -GL_ENUM(0x8D62,GL_RGB565) -GL_ENUM(0x81A5,GL_DEPTH_COMPONENT16) -GL_ENUM(0x8D48,GL_STENCIL_INDEX8) -GL_ENUM(0x8D42,GL_RENDERBUFFER_WIDTH) -GL_ENUM(0x8D43,GL_RENDERBUFFER_HEIGHT) -GL_ENUM(0x8D44,GL_RENDERBUFFER_INTERNAL_FORMAT) -GL_ENUM(0x8D50,GL_RENDERBUFFER_RED_SIZE) -GL_ENUM(0x8D51,GL_RENDERBUFFER_GREEN_SIZE) -GL_ENUM(0x8D52,GL_RENDERBUFFER_BLUE_SIZE) -GL_ENUM(0x8D53,GL_RENDERBUFFER_ALPHA_SIZE) -GL_ENUM(0x8D54,GL_RENDERBUFFER_DEPTH_SIZE) -GL_ENUM(0x8D55,GL_RENDERBUFFER_STENCIL_SIZE) -GL_ENUM(0x8CD0,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE) -GL_ENUM(0x8CD1,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME) -GL_ENUM(0x8CD2,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL) -GL_ENUM(0x8CD3,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE) -GL_ENUM(0x8CE0,GL_COLOR_ATTACHMENT0) -GL_ENUM(0x8D00,GL_DEPTH_ATTACHMENT) -GL_ENUM(0x8D20,GL_STENCIL_ATTACHMENT) -GL_ENUM(0x8CD5,GL_FRAMEBUFFER_COMPLETE) -GL_ENUM(0x8CD6,GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT) -GL_ENUM(0x8CD7,GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT) -GL_ENUM(0x8CD9,GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS) -GL_ENUM(0x8CDD,GL_FRAMEBUFFER_UNSUPPORTED) -GL_ENUM(0x8CA6,GL_FRAMEBUFFER_BINDING) -GL_ENUM(0x8CA7,GL_RENDERBUFFER_BINDING) -GL_ENUM(0x84E8,GL_MAX_RENDERBUFFER_SIZE) -GL_ENUM(0x0506,GL_INVALID_FRAMEBUFFER_OPERATION) -GL_ENUM(0x0C02,GL_READ_BUFFER) -GL_ENUM(0x0CF2,GL_UNPACK_ROW_LENGTH) -GL_ENUM(0x0CF3,GL_UNPACK_SKIP_ROWS) -GL_ENUM(0x0CF4,GL_UNPACK_SKIP_PIXELS) -GL_ENUM(0x0D02,GL_PACK_ROW_LENGTH) -GL_ENUM(0x0D03,GL_PACK_SKIP_ROWS) -GL_ENUM(0x0D04,GL_PACK_SKIP_PIXELS) -GL_ENUM(0x1800,GL_COLOR) -GL_ENUM(0x1801,GL_DEPTH) -GL_ENUM(0x1802,GL_STENCIL) -GL_ENUM(0x1903,GL_RED) -GL_ENUM(0x8051,GL_RGB8) -GL_ENUM(0x8058,GL_RGBA8) -GL_ENUM(0x8059,GL_RGB10_A2) -GL_ENUM(0x806A,GL_TEXTURE_BINDING_3D) -GL_ENUM(0x806D,GL_UNPACK_SKIP_IMAGES) -GL_ENUM(0x806E,GL_UNPACK_IMAGE_HEIGHT) -GL_ENUM(0x806F,GL_TEXTURE_3D) -GL_ENUM(0x8072,GL_TEXTURE_WRAP_R) -GL_ENUM(0x8073,GL_MAX_3D_TEXTURE_SIZE) -GL_ENUM(0x8368,GL_UNSIGNED_INT_2_10_10_10_REV) -GL_ENUM(0x80E8,GL_MAX_ELEMENTS_VERTICES) -GL_ENUM(0x80E9,GL_MAX_ELEMENTS_INDICES) -GL_ENUM(0x813A,GL_TEXTURE_MIN_LOD) -GL_ENUM(0x813B,GL_TEXTURE_MAX_LOD) -GL_ENUM(0x813C,GL_TEXTURE_BASE_LEVEL) -GL_ENUM(0x813D,GL_TEXTURE_MAX_LEVEL) -GL_ENUM(0x8007,GL_MIN) -GL_ENUM(0x8008,GL_MAX) -GL_ENUM(0x81A6,GL_DEPTH_COMPONENT24) -GL_ENUM(0x84FD,GL_MAX_TEXTURE_LOD_BIAS) -GL_ENUM(0x884C,GL_TEXTURE_COMPARE_MODE) -GL_ENUM(0x884D,GL_TEXTURE_COMPARE_FUNC) -GL_ENUM(0x8865,GL_CURRENT_QUERY) -GL_ENUM(0x8866,GL_QUERY_RESULT) -GL_ENUM(0x8867,GL_QUERY_RESULT_AVAILABLE) -GL_ENUM(0x88BC,GL_BUFFER_MAPPED) -GL_ENUM(0x88BD,GL_BUFFER_MAP_POINTER) -GL_ENUM(0x88E1,GL_STREAM_READ) -GL_ENUM(0x88E2,GL_STREAM_COPY) -GL_ENUM(0x88E5,GL_STATIC_READ) -GL_ENUM(0x88E6,GL_STATIC_COPY) -GL_ENUM(0x88E9,GL_DYNAMIC_READ) -GL_ENUM(0x88EA,GL_DYNAMIC_COPY) -GL_ENUM(0x8824,GL_MAX_DRAW_BUFFERS) -GL_ENUM(0x8825,GL_DRAW_BUFFER0) -GL_ENUM(0x8826,GL_DRAW_BUFFER1) -GL_ENUM(0x8827,GL_DRAW_BUFFER2) -GL_ENUM(0x8828,GL_DRAW_BUFFER3) -GL_ENUM(0x8829,GL_DRAW_BUFFER4) -GL_ENUM(0x882A,GL_DRAW_BUFFER5) -GL_ENUM(0x882B,GL_DRAW_BUFFER6) -GL_ENUM(0x882C,GL_DRAW_BUFFER7) -GL_ENUM(0x882D,GL_DRAW_BUFFER8) -GL_ENUM(0x882E,GL_DRAW_BUFFER9) -GL_ENUM(0x882F,GL_DRAW_BUFFER10) -GL_ENUM(0x8830,GL_DRAW_BUFFER11) -GL_ENUM(0x8831,GL_DRAW_BUFFER12) -GL_ENUM(0x8832,GL_DRAW_BUFFER13) -GL_ENUM(0x8833,GL_DRAW_BUFFER14) -GL_ENUM(0x8834,GL_DRAW_BUFFER15) -GL_ENUM(0x8B49,GL_MAX_FRAGMENT_UNIFORM_COMPONENTS) -GL_ENUM(0x8B4A,GL_MAX_VERTEX_UNIFORM_COMPONENTS) -GL_ENUM(0x8B5F,GL_SAMPLER_3D) -GL_ENUM(0x8B62,GL_SAMPLER_2D_SHADOW) -GL_ENUM(0x8B8B,GL_FRAGMENT_SHADER_DERIVATIVE_HINT) -GL_ENUM(0x88EB,GL_PIXEL_PACK_BUFFER) -GL_ENUM(0x88EC,GL_PIXEL_UNPACK_BUFFER) -GL_ENUM(0x88ED,GL_PIXEL_PACK_BUFFER_BINDING) -GL_ENUM(0x88EF,GL_PIXEL_UNPACK_BUFFER_BINDING) -GL_ENUM(0x8B65,GL_FLOAT_MAT2x3) -GL_ENUM(0x8B66,GL_FLOAT_MAT2x4) -GL_ENUM(0x8B67,GL_FLOAT_MAT3x2) -GL_ENUM(0x8B68,GL_FLOAT_MAT3x4) -GL_ENUM(0x8B69,GL_FLOAT_MAT4x2) -GL_ENUM(0x8B6A,GL_FLOAT_MAT4x3) -GL_ENUM(0x8C40,GL_SRGB) -GL_ENUM(0x8C41,GL_SRGB8) -GL_ENUM(0x8C43,GL_SRGB8_ALPHA8) -GL_ENUM(0x884E,GL_COMPARE_REF_TO_TEXTURE) -GL_ENUM(0x821B,GL_MAJOR_VERSION) -GL_ENUM(0x821C,GL_MINOR_VERSION) -GL_ENUM(0x821D,GL_NUM_EXTENSIONS) -GL_ENUM(0x8814,GL_RGBA32F) -GL_ENUM(0x8815,GL_RGB32F) -GL_ENUM(0x881A,GL_RGBA16F) -GL_ENUM(0x881B,GL_RGB16F) -GL_ENUM(0x88FD,GL_VERTEX_ATTRIB_ARRAY_INTEGER) -GL_ENUM(0x88FF,GL_MAX_ARRAY_TEXTURE_LAYERS) -GL_ENUM(0x8904,GL_MIN_PROGRAM_TEXEL_OFFSET) -GL_ENUM(0x8905,GL_MAX_PROGRAM_TEXEL_OFFSET) -GL_ENUM(0x8B4B,GL_MAX_VARYING_COMPONENTS) -GL_ENUM(0x8C1A,GL_TEXTURE_2D_ARRAY) -GL_ENUM(0x8C1D,GL_TEXTURE_BINDING_2D_ARRAY) -GL_ENUM(0x8C3A,GL_R11F_G11F_B10F) -GL_ENUM(0x8C3B,GL_UNSIGNED_INT_10F_11F_11F_REV) -GL_ENUM(0x8C3D,GL_RGB9_E5) -GL_ENUM(0x8C3E,GL_UNSIGNED_INT_5_9_9_9_REV) -GL_ENUM(0x8C76,GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH) -GL_ENUM(0x8C7F,GL_TRANSFORM_FEEDBACK_BUFFER_MODE) -GL_ENUM(0x8C80,GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS) -GL_ENUM(0x8C83,GL_TRANSFORM_FEEDBACK_VARYINGS) -GL_ENUM(0x8C84,GL_TRANSFORM_FEEDBACK_BUFFER_START) -GL_ENUM(0x8C85,GL_TRANSFORM_FEEDBACK_BUFFER_SIZE) -GL_ENUM(0x8C88,GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN) -GL_ENUM(0x8C89,GL_RASTERIZER_DISCARD) -GL_ENUM(0x8C8A,GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS) -GL_ENUM(0x8C8B,GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS) -GL_ENUM(0x8C8C,GL_INTERLEAVED_ATTRIBS) -GL_ENUM(0x8C8D,GL_SEPARATE_ATTRIBS) -GL_ENUM(0x8C8E,GL_TRANSFORM_FEEDBACK_BUFFER) -GL_ENUM(0x8C8F,GL_TRANSFORM_FEEDBACK_BUFFER_BINDING) -GL_ENUM(0x8D70,GL_RGBA32UI) -GL_ENUM(0x8D71,GL_RGB32UI) -GL_ENUM(0x8D76,GL_RGBA16UI) -GL_ENUM(0x8D77,GL_RGB16UI) -GL_ENUM(0x8D7C,GL_RGBA8UI) -GL_ENUM(0x8D7D,GL_RGB8UI) -GL_ENUM(0x8D82,GL_RGBA32I) -GL_ENUM(0x8D83,GL_RGB32I) -GL_ENUM(0x8D88,GL_RGBA16I) -GL_ENUM(0x8D89,GL_RGB16I) -GL_ENUM(0x8D8E,GL_RGBA8I) -GL_ENUM(0x8D8F,GL_RGB8I) -GL_ENUM(0x8D94,GL_RED_INTEGER) -GL_ENUM(0x8D98,GL_RGB_INTEGER) -GL_ENUM(0x8D99,GL_RGBA_INTEGER) -GL_ENUM(0x8DC1,GL_SAMPLER_2D_ARRAY) -GL_ENUM(0x8DC4,GL_SAMPLER_2D_ARRAY_SHADOW) -GL_ENUM(0x8DC5,GL_SAMPLER_CUBE_SHADOW) -GL_ENUM(0x8DC6,GL_UNSIGNED_INT_VEC2) -GL_ENUM(0x8DC7,GL_UNSIGNED_INT_VEC3) -GL_ENUM(0x8DC8,GL_UNSIGNED_INT_VEC4) -GL_ENUM(0x8DCA,GL_INT_SAMPLER_2D) -GL_ENUM(0x8DCB,GL_INT_SAMPLER_3D) -GL_ENUM(0x8DCC,GL_INT_SAMPLER_CUBE) -GL_ENUM(0x8DCF,GL_INT_SAMPLER_2D_ARRAY) -GL_ENUM(0x8DD2,GL_UNSIGNED_INT_SAMPLER_2D) -GL_ENUM(0x8DD3,GL_UNSIGNED_INT_SAMPLER_3D) -GL_ENUM(0x8DD4,GL_UNSIGNED_INT_SAMPLER_CUBE) -GL_ENUM(0x8DD7,GL_UNSIGNED_INT_SAMPLER_2D_ARRAY) -GL_ENUM(0x911F,GL_BUFFER_ACCESS_FLAGS) -GL_ENUM(0x9120,GL_BUFFER_MAP_LENGTH) -GL_ENUM(0x9121,GL_BUFFER_MAP_OFFSET) -GL_ENUM(0x8CAC,GL_DEPTH_COMPONENT32F) -GL_ENUM(0x8CAD,GL_DEPTH32F_STENCIL8) -GL_ENUM(0x8DAD,GL_FLOAT_32_UNSIGNED_INT_24_8_REV) -GL_ENUM(0x8210,GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING) -GL_ENUM(0x8211,GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE) -GL_ENUM(0x8212,GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE) -GL_ENUM(0x8213,GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE) -GL_ENUM(0x8214,GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE) -GL_ENUM(0x8215,GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE) -GL_ENUM(0x8216,GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE) -GL_ENUM(0x8217,GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE) -GL_ENUM(0x8218,GL_FRAMEBUFFER_DEFAULT) -GL_ENUM(0x8219,GL_FRAMEBUFFER_UNDEFINED) -GL_ENUM(0x821A,GL_DEPTH_STENCIL_ATTACHMENT) -GL_ENUM(0x84F9,GL_DEPTH_STENCIL) -GL_ENUM(0x84FA,GL_UNSIGNED_INT_24_8) -GL_ENUM(0x88F0,GL_DEPTH24_STENCIL8) -GL_ENUM(0x8C17,GL_UNSIGNED_NORMALIZED) -GL_ENUM(0x8CA8,GL_READ_FRAMEBUFFER) -GL_ENUM(0x8CA9,GL_DRAW_FRAMEBUFFER) -GL_ENUM(0x8CAA,GL_READ_FRAMEBUFFER_BINDING) -GL_ENUM(0x8CAB,GL_RENDERBUFFER_SAMPLES) -GL_ENUM(0x8CD4,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER) -GL_ENUM(0x8CDF,GL_MAX_COLOR_ATTACHMENTS) -GL_ENUM(0x8CE1,GL_COLOR_ATTACHMENT1) -GL_ENUM(0x8CE2,GL_COLOR_ATTACHMENT2) -GL_ENUM(0x8CE3,GL_COLOR_ATTACHMENT3) -GL_ENUM(0x8CE4,GL_COLOR_ATTACHMENT4) -GL_ENUM(0x8CE5,GL_COLOR_ATTACHMENT5) -GL_ENUM(0x8CE6,GL_COLOR_ATTACHMENT6) -GL_ENUM(0x8CE7,GL_COLOR_ATTACHMENT7) -GL_ENUM(0x8CE8,GL_COLOR_ATTACHMENT8) -GL_ENUM(0x8CE9,GL_COLOR_ATTACHMENT9) -GL_ENUM(0x8CEA,GL_COLOR_ATTACHMENT10) -GL_ENUM(0x8CEB,GL_COLOR_ATTACHMENT11) -GL_ENUM(0x8CEC,GL_COLOR_ATTACHMENT12) -GL_ENUM(0x8CED,GL_COLOR_ATTACHMENT13) -GL_ENUM(0x8CEE,GL_COLOR_ATTACHMENT14) -GL_ENUM(0x8CEF,GL_COLOR_ATTACHMENT15) -GL_ENUM(0x8D56,GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE) -GL_ENUM(0x8D57,GL_MAX_SAMPLES) -GL_ENUM(0x140B,GL_HALF_FLOAT) -GL_ENUM(0x8227,GL_RG) -GL_ENUM(0x8228,GL_RG_INTEGER) -GL_ENUM(0x8229,GL_R8) -GL_ENUM(0x822B,GL_RG8) -GL_ENUM(0x822D,GL_R16F) -GL_ENUM(0x822E,GL_R32F) -GL_ENUM(0x822F,GL_RG16F) -GL_ENUM(0x8230,GL_RG32F) -GL_ENUM(0x8231,GL_R8I) -GL_ENUM(0x8232,GL_R8UI) -GL_ENUM(0x8233,GL_R16I) -GL_ENUM(0x8234,GL_R16UI) -GL_ENUM(0x8235,GL_R32I) -GL_ENUM(0x8236,GL_R32UI) -GL_ENUM(0x8237,GL_RG8I) -GL_ENUM(0x8238,GL_RG8UI) -GL_ENUM(0x8239,GL_RG16I) -GL_ENUM(0x823A,GL_RG16UI) -GL_ENUM(0x823B,GL_RG32I) -GL_ENUM(0x823C,GL_RG32UI) -GL_ENUM(0x85B5,GL_VERTEX_ARRAY_BINDING) -GL_ENUM(0x8F94,GL_R8_SNORM) -GL_ENUM(0x8F95,GL_RG8_SNORM) -GL_ENUM(0x8F96,GL_RGB8_SNORM) -GL_ENUM(0x8F97,GL_RGBA8_SNORM) -GL_ENUM(0x8F9C,GL_SIGNED_NORMALIZED) -GL_ENUM(0x8D69,GL_PRIMITIVE_RESTART_FIXED_INDEX) -GL_ENUM(0x8F36,GL_COPY_READ_BUFFER) -GL_ENUM(0x8F37,GL_COPY_WRITE_BUFFER) -GL_ENUM(0x8A11,GL_UNIFORM_BUFFER) -GL_ENUM(0x8A28,GL_UNIFORM_BUFFER_BINDING) -GL_ENUM(0x8A29,GL_UNIFORM_BUFFER_START) -GL_ENUM(0x8A2A,GL_UNIFORM_BUFFER_SIZE) -GL_ENUM(0x8A2B,GL_MAX_VERTEX_UNIFORM_BLOCKS) -GL_ENUM(0x8A2D,GL_MAX_FRAGMENT_UNIFORM_BLOCKS) -GL_ENUM(0x8A2E,GL_MAX_COMBINED_UNIFORM_BLOCKS) -GL_ENUM(0x8A2F,GL_MAX_UNIFORM_BUFFER_BINDINGS) -GL_ENUM(0x8A30,GL_MAX_UNIFORM_BLOCK_SIZE) -GL_ENUM(0x8A31,GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS) -GL_ENUM(0x8A33,GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS) -GL_ENUM(0x8A34,GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT) -GL_ENUM(0x8A35,GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH) -GL_ENUM(0x8A36,GL_ACTIVE_UNIFORM_BLOCKS) -GL_ENUM(0x8A37,GL_UNIFORM_TYPE) -GL_ENUM(0x8A38,GL_UNIFORM_SIZE) -GL_ENUM(0x8A39,GL_UNIFORM_NAME_LENGTH) -GL_ENUM(0x8A3A,GL_UNIFORM_BLOCK_INDEX) -GL_ENUM(0x8A3B,GL_UNIFORM_OFFSET) -GL_ENUM(0x8A3C,GL_UNIFORM_ARRAY_STRIDE) -GL_ENUM(0x8A3D,GL_UNIFORM_MATRIX_STRIDE) -GL_ENUM(0x8A3E,GL_UNIFORM_IS_ROW_MAJOR) -GL_ENUM(0x8A3F,GL_UNIFORM_BLOCK_BINDING) -GL_ENUM(0x8A40,GL_UNIFORM_BLOCK_DATA_SIZE) -GL_ENUM(0x8A41,GL_UNIFORM_BLOCK_NAME_LENGTH) -GL_ENUM(0x8A42,GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS) -GL_ENUM(0x8A43,GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES) -GL_ENUM(0x8A44,GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER) -GL_ENUM(0x8A46,GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER) -GL_ENUM(0xFFFFFFFFu,GL_INVALID_INDEX) -GL_ENUM(0x9122,GL_MAX_VERTEX_OUTPUT_COMPONENTS) -GL_ENUM(0x9125,GL_MAX_FRAGMENT_INPUT_COMPONENTS) -GL_ENUM(0x9111,GL_MAX_SERVER_WAIT_TIMEOUT) -GL_ENUM(0x9112,GL_OBJECT_TYPE) -GL_ENUM(0x9113,GL_SYNC_CONDITION) -GL_ENUM(0x9114,GL_SYNC_STATUS) -GL_ENUM(0x9115,GL_SYNC_FLAGS) -GL_ENUM(0x9116,GL_SYNC_FENCE) -GL_ENUM(0x9117,GL_SYNC_GPU_COMMANDS_COMPLETE) -GL_ENUM(0x9118,GL_UNSIGNALED) -GL_ENUM(0x9119,GL_SIGNALED) -GL_ENUM(0x911A,GL_ALREADY_SIGNALED) -GL_ENUM(0x911B,GL_TIMEOUT_EXPIRED) -GL_ENUM(0x911C,GL_CONDITION_SATISFIED) -GL_ENUM(0x911D,GL_WAIT_FAILED) -GL_ENUM(0xFFFFFFFFFFFFFFFFull,GL_TIMEOUT_IGNORED) -GL_ENUM(0x88FE,GL_VERTEX_ATTRIB_ARRAY_DIVISOR) -GL_ENUM(0x8C2F,GL_ANY_SAMPLES_PASSED) -GL_ENUM(0x8D6A,GL_ANY_SAMPLES_PASSED_CONSERVATIVE) -GL_ENUM(0x8919,GL_SAMPLER_BINDING) -GL_ENUM(0x906F,GL_RGB10_A2UI) -GL_ENUM(0x8E42,GL_TEXTURE_SWIZZLE_R) -GL_ENUM(0x8E43,GL_TEXTURE_SWIZZLE_G) -GL_ENUM(0x8E44,GL_TEXTURE_SWIZZLE_B) -GL_ENUM(0x8E45,GL_TEXTURE_SWIZZLE_A) -GL_ENUM(0x1904,GL_GREEN) -GL_ENUM(0x1905,GL_BLUE) -GL_ENUM(0x8D9F,GL_INT_2_10_10_10_REV) -GL_ENUM(0x8E22,GL_TRANSFORM_FEEDBACK) -GL_ENUM(0x8E23,GL_TRANSFORM_FEEDBACK_PAUSED) -GL_ENUM(0x8E24,GL_TRANSFORM_FEEDBACK_ACTIVE) -GL_ENUM(0x8E25,GL_TRANSFORM_FEEDBACK_BINDING) -GL_ENUM(0x8257,GL_PROGRAM_BINARY_RETRIEVABLE_HINT) -GL_ENUM(0x8741,GL_PROGRAM_BINARY_LENGTH) -GL_ENUM(0x87FE,GL_NUM_PROGRAM_BINARY_FORMATS) -GL_ENUM(0x87FF,GL_PROGRAM_BINARY_FORMATS) -GL_ENUM(0x9270,GL_COMPRESSED_R11_EAC) -GL_ENUM(0x9271,GL_COMPRESSED_SIGNED_R11_EAC) -GL_ENUM(0x9272,GL_COMPRESSED_RG11_EAC) -GL_ENUM(0x9273,GL_COMPRESSED_SIGNED_RG11_EAC) -GL_ENUM(0x9274,GL_COMPRESSED_RGB8_ETC2) -GL_ENUM(0x9275,GL_COMPRESSED_SRGB8_ETC2) -GL_ENUM(0x9276,GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2) -GL_ENUM(0x9277,GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2) -GL_ENUM(0x9278,GL_COMPRESSED_RGBA8_ETC2_EAC) -GL_ENUM(0x9279,GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC) -GL_ENUM(0x912F,GL_TEXTURE_IMMUTABLE_FORMAT) -GL_ENUM(0x8D6B,GL_MAX_ELEMENT_INDEX) -GL_ENUM(0x9380,GL_NUM_SAMPLE_COUNTS) -GL_ENUM(0x82DF,GL_TEXTURE_IMMUTABLE_LEVELS) -GL_ENUM(0x91B9,GL_COMPUTE_SHADER) -GL_ENUM(0x91BB,GL_MAX_COMPUTE_UNIFORM_BLOCKS) -GL_ENUM(0x91BC,GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS) -GL_ENUM(0x91BD,GL_MAX_COMPUTE_IMAGE_UNIFORMS) -GL_ENUM(0x8262,GL_MAX_COMPUTE_SHARED_MEMORY_SIZE) -GL_ENUM(0x8263,GL_MAX_COMPUTE_UNIFORM_COMPONENTS) -GL_ENUM(0x8264,GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS) -GL_ENUM(0x8265,GL_MAX_COMPUTE_ATOMIC_COUNTERS) -GL_ENUM(0x8266,GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS) -GL_ENUM(0x90EB,GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS) -GL_ENUM(0x91BE,GL_MAX_COMPUTE_WORK_GROUP_COUNT) -GL_ENUM(0x91BF,GL_MAX_COMPUTE_WORK_GROUP_SIZE) -GL_ENUM(0x8267,GL_COMPUTE_WORK_GROUP_SIZE) -GL_ENUM(0x90EE,GL_DISPATCH_INDIRECT_BUFFER) -GL_ENUM(0x90EF,GL_DISPATCH_INDIRECT_BUFFER_BINDING) -GL_ENUM(0x8F3F,GL_DRAW_INDIRECT_BUFFER) -GL_ENUM(0x8F43,GL_DRAW_INDIRECT_BUFFER_BINDING) -GL_ENUM(0x826E,GL_MAX_UNIFORM_LOCATIONS) -GL_ENUM(0x9310,GL_FRAMEBUFFER_DEFAULT_WIDTH) -GL_ENUM(0x9311,GL_FRAMEBUFFER_DEFAULT_HEIGHT) -GL_ENUM(0x9313,GL_FRAMEBUFFER_DEFAULT_SAMPLES) -GL_ENUM(0x9314,GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS) -GL_ENUM(0x9315,GL_MAX_FRAMEBUFFER_WIDTH) -GL_ENUM(0x9316,GL_MAX_FRAMEBUFFER_HEIGHT) -GL_ENUM(0x9318,GL_MAX_FRAMEBUFFER_SAMPLES) -GL_ENUM(0x92E1,GL_UNIFORM) -GL_ENUM(0x92E2,GL_UNIFORM_BLOCK) -GL_ENUM(0x92E3,GL_PROGRAM_INPUT) -GL_ENUM(0x92E4,GL_PROGRAM_OUTPUT) -GL_ENUM(0x92E5,GL_BUFFER_VARIABLE) -GL_ENUM(0x92E6,GL_SHADER_STORAGE_BLOCK) -GL_ENUM(0x92C0,GL_ATOMIC_COUNTER_BUFFER) -GL_ENUM(0x92F4,GL_TRANSFORM_FEEDBACK_VARYING) -GL_ENUM(0x92F5,GL_ACTIVE_RESOURCES) -GL_ENUM(0x92F6,GL_MAX_NAME_LENGTH) -GL_ENUM(0x92F7,GL_MAX_NUM_ACTIVE_VARIABLES) -GL_ENUM(0x92F9,GL_NAME_LENGTH) -GL_ENUM(0x92FA,GL_TYPE) -GL_ENUM(0x92FB,GL_ARRAY_SIZE) -GL_ENUM(0x92FC,GL_OFFSET) -GL_ENUM(0x92FD,GL_BLOCK_INDEX) -GL_ENUM(0x92FE,GL_ARRAY_STRIDE) -GL_ENUM(0x92FF,GL_MATRIX_STRIDE) -GL_ENUM(0x9300,GL_IS_ROW_MAJOR) -GL_ENUM(0x9301,GL_ATOMIC_COUNTER_BUFFER_INDEX) -GL_ENUM(0x9302,GL_BUFFER_BINDING) -GL_ENUM(0x9303,GL_BUFFER_DATA_SIZE) -GL_ENUM(0x9304,GL_NUM_ACTIVE_VARIABLES) -GL_ENUM(0x9305,GL_ACTIVE_VARIABLES) -GL_ENUM(0x9306,GL_REFERENCED_BY_VERTEX_SHADER) -GL_ENUM(0x930A,GL_REFERENCED_BY_FRAGMENT_SHADER) -GL_ENUM(0x930B,GL_REFERENCED_BY_COMPUTE_SHADER) -GL_ENUM(0x930C,GL_TOP_LEVEL_ARRAY_SIZE) -GL_ENUM(0x930D,GL_TOP_LEVEL_ARRAY_STRIDE) -GL_ENUM(0x930E,GL_LOCATION) -GL_ENUM(0xFFFFFFFF,GL_ALL_SHADER_BITS) -GL_ENUM(0x8258,GL_PROGRAM_SEPARABLE) -GL_ENUM(0x8259,GL_ACTIVE_PROGRAM) -GL_ENUM(0x825A,GL_PROGRAM_PIPELINE_BINDING) -GL_ENUM(0x92C1,GL_ATOMIC_COUNTER_BUFFER_BINDING) -GL_ENUM(0x92C2,GL_ATOMIC_COUNTER_BUFFER_START) -GL_ENUM(0x92C3,GL_ATOMIC_COUNTER_BUFFER_SIZE) -GL_ENUM(0x92CC,GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS) -GL_ENUM(0x92D0,GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS) -GL_ENUM(0x92D1,GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS) -GL_ENUM(0x92D2,GL_MAX_VERTEX_ATOMIC_COUNTERS) -GL_ENUM(0x92D6,GL_MAX_FRAGMENT_ATOMIC_COUNTERS) -GL_ENUM(0x92D7,GL_MAX_COMBINED_ATOMIC_COUNTERS) -GL_ENUM(0x92D8,GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE) -GL_ENUM(0x92DC,GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS) -GL_ENUM(0x92D9,GL_ACTIVE_ATOMIC_COUNTER_BUFFERS) -GL_ENUM(0x92DB,GL_UNSIGNED_INT_ATOMIC_COUNTER) -GL_ENUM(0x8F38,GL_MAX_IMAGE_UNITS) -GL_ENUM(0x90CA,GL_MAX_VERTEX_IMAGE_UNIFORMS) -GL_ENUM(0x90CE,GL_MAX_FRAGMENT_IMAGE_UNIFORMS) -GL_ENUM(0x90CF,GL_MAX_COMBINED_IMAGE_UNIFORMS) -GL_ENUM(0x8F3A,GL_IMAGE_BINDING_NAME) -GL_ENUM(0x8F3B,GL_IMAGE_BINDING_LEVEL) -GL_ENUM(0x8F3C,GL_IMAGE_BINDING_LAYERED) -GL_ENUM(0x8F3D,GL_IMAGE_BINDING_LAYER) -GL_ENUM(0x8F3E,GL_IMAGE_BINDING_ACCESS) -GL_ENUM(0x906E,GL_IMAGE_BINDING_FORMAT) -GL_ENUM(0x904D,GL_IMAGE_2D) -GL_ENUM(0x904E,GL_IMAGE_3D) -GL_ENUM(0x9050,GL_IMAGE_CUBE) -GL_ENUM(0x9053,GL_IMAGE_2D_ARRAY) -GL_ENUM(0x9058,GL_INT_IMAGE_2D) -GL_ENUM(0x9059,GL_INT_IMAGE_3D) -GL_ENUM(0x905B,GL_INT_IMAGE_CUBE) -GL_ENUM(0x905E,GL_INT_IMAGE_2D_ARRAY) -GL_ENUM(0x9063,GL_UNSIGNED_INT_IMAGE_2D) -GL_ENUM(0x9064,GL_UNSIGNED_INT_IMAGE_3D) -GL_ENUM(0x9066,GL_UNSIGNED_INT_IMAGE_CUBE) -GL_ENUM(0x9069,GL_UNSIGNED_INT_IMAGE_2D_ARRAY) -GL_ENUM(0x90C7,GL_IMAGE_FORMAT_COMPATIBILITY_TYPE) -GL_ENUM(0x90C8,GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE) -GL_ENUM(0x90C9,GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS) -GL_ENUM(0x88B8,GL_READ_ONLY) -GL_ENUM(0x88B9,GL_WRITE_ONLY) -GL_ENUM(0x88BA,GL_READ_WRITE) -GL_ENUM(0x90D2,GL_SHADER_STORAGE_BUFFER) -GL_ENUM(0x90D3,GL_SHADER_STORAGE_BUFFER_BINDING) -GL_ENUM(0x90D4,GL_SHADER_STORAGE_BUFFER_START) -GL_ENUM(0x90D5,GL_SHADER_STORAGE_BUFFER_SIZE) -GL_ENUM(0x90D6,GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS) -GL_ENUM(0x90DA,GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS) -GL_ENUM(0x90DB,GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS) -GL_ENUM(0x90DC,GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS) -GL_ENUM(0x90DD,GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS) -GL_ENUM(0x90DE,GL_MAX_SHADER_STORAGE_BLOCK_SIZE) -GL_ENUM(0x90DF,GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT) -GL_ENUM(0x8F39,GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES) -GL_ENUM(0x90EA,GL_DEPTH_STENCIL_TEXTURE_MODE) -GL_ENUM(0x1901,GL_STENCIL_INDEX) -GL_ENUM(0x8E5E,GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET) -GL_ENUM(0x8E5F,GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET) -GL_ENUM(0x8E50,GL_SAMPLE_POSITION) -GL_ENUM(0x8E51,GL_SAMPLE_MASK) -GL_ENUM(0x8E52,GL_SAMPLE_MASK_VALUE) -GL_ENUM(0x9100,GL_TEXTURE_2D_MULTISAMPLE) -GL_ENUM(0x8E59,GL_MAX_SAMPLE_MASK_WORDS) -GL_ENUM(0x910E,GL_MAX_COLOR_TEXTURE_SAMPLES) -GL_ENUM(0x910F,GL_MAX_DEPTH_TEXTURE_SAMPLES) -GL_ENUM(0x9110,GL_MAX_INTEGER_SAMPLES) -GL_ENUM(0x9104,GL_TEXTURE_BINDING_2D_MULTISAMPLE) -GL_ENUM(0x9106,GL_TEXTURE_SAMPLES) -GL_ENUM(0x9107,GL_TEXTURE_FIXED_SAMPLE_LOCATIONS) -GL_ENUM(0x1000,GL_TEXTURE_WIDTH) -GL_ENUM(0x1001,GL_TEXTURE_HEIGHT) -GL_ENUM(0x8071,GL_TEXTURE_DEPTH) -GL_ENUM(0x1003,GL_TEXTURE_INTERNAL_FORMAT) -GL_ENUM(0x805C,GL_TEXTURE_RED_SIZE) -GL_ENUM(0x805D,GL_TEXTURE_GREEN_SIZE) -GL_ENUM(0x805E,GL_TEXTURE_BLUE_SIZE) -GL_ENUM(0x805F,GL_TEXTURE_ALPHA_SIZE) -GL_ENUM(0x884A,GL_TEXTURE_DEPTH_SIZE) -GL_ENUM(0x88F1,GL_TEXTURE_STENCIL_SIZE) -GL_ENUM(0x8C3F,GL_TEXTURE_SHARED_SIZE) -GL_ENUM(0x8C10,GL_TEXTURE_RED_TYPE) -GL_ENUM(0x8C11,GL_TEXTURE_GREEN_TYPE) -GL_ENUM(0x8C12,GL_TEXTURE_BLUE_TYPE) -GL_ENUM(0x8C13,GL_TEXTURE_ALPHA_TYPE) -GL_ENUM(0x8C16,GL_TEXTURE_DEPTH_TYPE) -GL_ENUM(0x86A1,GL_TEXTURE_COMPRESSED) -GL_ENUM(0x9108,GL_SAMPLER_2D_MULTISAMPLE) -GL_ENUM(0x9109,GL_INT_SAMPLER_2D_MULTISAMPLE) -GL_ENUM(0x910A,GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE) -GL_ENUM(0x82D4,GL_VERTEX_ATTRIB_BINDING) -GL_ENUM(0x82D5,GL_VERTEX_ATTRIB_RELATIVE_OFFSET) -GL_ENUM(0x82D6,GL_VERTEX_BINDING_DIVISOR) -GL_ENUM(0x82D7,GL_VERTEX_BINDING_OFFSET) -GL_ENUM(0x82D8,GL_VERTEX_BINDING_STRIDE) -GL_ENUM(0x8F4F,GL_VERTEX_BINDING_BUFFER) -GL_ENUM(0x82D9,GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET) -GL_ENUM(0x82DA,GL_MAX_VERTEX_ATTRIB_BINDINGS) -GL_ENUM(0x82E5,GL_MAX_VERTEX_ATTRIB_STRIDE) -GL_ENUM(0x8D65,GL_TEXTURE_EXTERNAL_OES) -GL_ENUM(0x8D67,GL_TEXTURE_BINDING_EXTERNAL_OES) -GL_ENUM(0x8D68,GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES) -GL_ENUM(0x8D64,GL_ETC1_RGB8_OES) +GL_ENUM(0x8B89,GL_ACTIVE_ATTRIBUTES) +GL_ENUM(0x8B8A,GL_ACTIVE_ATTRIBUTE_MAX_LENGTH) +GL_ENUM(0x8B8B,GL_FRAGMENT_SHADER_DERIVATIVE_HINT_OES) +GL_ENUM(0x8B8C,GL_SHADING_LANGUAGE_VERSION) +GL_ENUM(0x8B8D,GL_CURRENT_PROGRAM) GL_ENUM(0x8B90,GL_PALETTE4_RGB8_OES) GL_ENUM(0x8B91,GL_PALETTE4_RGBA8_OES) GL_ENUM(0x8B92,GL_PALETTE4_R5_G6_B5_OES) @@ -911,95 +554,19 @@ GL_ENUM(0x8B97,GL_PALETTE8_R5_G6_B5_OES) GL_ENUM(0x8B98,GL_PALETTE8_RGBA4_OES) GL_ENUM(0x8B99,GL_PALETTE8_RGB5_A1_OES) -GL_ENUM(0x81A7,GL_DEPTH_COMPONENT32_OES) +GL_ENUM(0x8B9A,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES) +GL_ENUM(0x8B9B,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES) +GL_ENUM(0x8B9C,GL_POINT_SIZE_ARRAY_OES) GL_ENUM(0x8B9D,GL_TEXTURE_CROP_RECT_OES) -GL_ENUM(0x8CDA,GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES) -GL_ENUM(0x88BB,GL_BUFFER_ACCESS_OES) -GL_ENUM(0x898D,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES) -GL_ENUM(0x898E,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES) -GL_ENUM(0x898F,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES) -GL_ENUM(0x86A4,GL_MAX_VERTEX_UNITS_OES) -GL_ENUM(0x8842,GL_MAX_PALETTE_MATRICES_OES) -GL_ENUM(0x8840,GL_MATRIX_PALETTE_OES) -GL_ENUM(0x8844,GL_MATRIX_INDEX_ARRAY_OES) -GL_ENUM(0x86AD,GL_WEIGHT_ARRAY_OES) -GL_ENUM(0x8843,GL_CURRENT_PALETTE_MATRIX_OES) -GL_ENUM(0x8846,GL_MATRIX_INDEX_ARRAY_SIZE_OES) -GL_ENUM(0x8847,GL_MATRIX_INDEX_ARRAY_TYPE_OES) -GL_ENUM(0x8848,GL_MATRIX_INDEX_ARRAY_STRIDE_OES) -GL_ENUM(0x8849,GL_MATRIX_INDEX_ARRAY_POINTER_OES) GL_ENUM(0x8B9E,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES) -GL_ENUM(0x86AB,GL_WEIGHT_ARRAY_SIZE_OES) -GL_ENUM(0x86A9,GL_WEIGHT_ARRAY_TYPE_OES) -GL_ENUM(0x86AA,GL_WEIGHT_ARRAY_STRIDE_OES) -GL_ENUM(0x86AC,GL_WEIGHT_ARRAY_POINTER_OES) -GL_ENUM(0x889E,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES) -GL_ENUM(0x8B9C,GL_POINT_SIZE_ARRAY_OES) -GL_ENUM(0x898A,GL_POINT_SIZE_ARRAY_TYPE_OES) -GL_ENUM(0x898B,GL_POINT_SIZE_ARRAY_STRIDE_OES) -GL_ENUM(0x898C,GL_POINT_SIZE_ARRAY_POINTER_OES) GL_ENUM(0x8B9F,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES) -GL_ENUM(0x8861,GL_POINT_SPRITE_OES) -GL_ENUM(0x8862,GL_COORD_REPLACE_OES) -GL_ENUM(0x803C,GL_ALPHA8_OES) -GL_ENUM(0x8043,GL_LUMINANCE4_ALPHA4_OES) -GL_ENUM(0x8045,GL_LUMINANCE8_ALPHA8_OES) -GL_ENUM(0x8040,GL_LUMINANCE8_OES) -GL_ENUM(0x8052,GL_RGB10_EXT) -GL_ENUM(0x8D46,GL_STENCIL_INDEX1_OES) -GL_ENUM(0x8D47,GL_STENCIL_INDEX4_OES) -GL_ENUM(0x8511,GL_NORMAL_MAP_OES) -GL_ENUM(0x8512,GL_REFLECTION_MAP_OES) -GL_ENUM(0x2500,GL_TEXTURE_GEN_MODE_OES) -GL_ENUM(0x8D60,GL_TEXTURE_GEN_STR_OES) -GL_ENUM(0x87F9,GL_3DC_X_AMD) -GL_ENUM(0x87FA,GL_3DC_XY_AMD) -GL_ENUM(0x8C92,GL_ATC_RGB_AMD) -GL_ENUM(0x8C93,GL_ATC_RGBA_EXPLICIT_ALPHA_AMD) -GL_ENUM(0x87EE,GL_ATC_RGBA_INTERPOLATED_ALPHA_AMD) -GL_ENUM(0x8A53,GL_SYNC_OBJECT_APPLE) -GL_ENUM(0x80E1,GL_BGRA_EXT) -GL_ENUM(0x93A1,GL_BGRA8_EXT) -GL_ENUM(0x8D6C,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT) -GL_ENUM(0x8365,GL_UNSIGNED_SHORT_4_4_4_4_REV_EXT) -GL_ENUM(0x8366,GL_UNSIGNED_SHORT_1_5_5_5_REV_EXT) -GL_ENUM(0x8253,GL_GUILTY_CONTEXT_RESET_EXT) -GL_ENUM(0x8254,GL_INNOCENT_CONTEXT_RESET_EXT) -GL_ENUM(0x8255,GL_UNKNOWN_CONTEXT_RESET_EXT) -GL_ENUM(0x90F3,GL_CONTEXT_ROBUST_ACCESS_EXT) -GL_ENUM(0x8256,GL_RESET_NOTIFICATION_STRATEGY_EXT) -GL_ENUM(0x8252,GL_LOSE_CONTEXT_ON_RESET_EXT) -GL_ENUM(0x8261,GL_NO_RESET_NOTIFICATION_EXT) -GL_ENUM(0x8C42,GL_SRGB_ALPHA_EXT) -GL_ENUM(0x83F0,GL_COMPRESSED_RGB_S3TC_DXT1_EXT) -GL_ENUM(0x83F1,GL_COMPRESSED_RGBA_S3TC_DXT1_EXT) -GL_ENUM(0x84FE,GL_TEXTURE_MAX_ANISOTROPY_EXT) -GL_ENUM(0x84FF,GL_MAX_TEXTURE_MAX_ANISOTROPY_EXT) -GL_ENUM(0x8500,GL_TEXTURE_FILTER_CONTROL_EXT) -GL_ENUM(0x8501,GL_TEXTURE_LOD_BIAS_EXT) -GL_ENUM(0x8816,GL_ALPHA32F_EXT) -GL_ENUM(0x8818,GL_LUMINANCE32F_EXT) -GL_ENUM(0x8819,GL_LUMINANCE_ALPHA32F_EXT) -GL_ENUM(0x881C,GL_ALPHA16F_EXT) -GL_ENUM(0x881E,GL_LUMINANCE16F_EXT) -GL_ENUM(0x881F,GL_LUMINANCE_ALPHA16F_EXT) -GL_ENUM(0x9133,GL_RENDERBUFFER_SAMPLES_IMG) -GL_ENUM(0x9134,GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_IMG) -GL_ENUM(0x9135,GL_MAX_SAMPLES_IMG) -GL_ENUM(0x9136,GL_TEXTURE_SAMPLES_IMG) -GL_ENUM(0x8C00,GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG) -GL_ENUM(0x8C01,GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG) -GL_ENUM(0x8C02,GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG) -GL_ENUM(0x8C03,GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG) -GL_ENUM(0x8C04,GL_MODULATE_COLOR_IMG) -GL_ENUM(0x8C05,GL_RECIP_ADD_SIGNED_ALPHA_IMG) -GL_ENUM(0x8C06,GL_TEXTURE_ALPHA_MODULATE_IMG) -GL_ENUM(0x8C07,GL_FACTOR_ALPHA_MODULATE_IMG) -GL_ENUM(0x8C08,GL_FRAGMENT_ALPHA_MODULATE_IMG) -GL_ENUM(0x8C09,GL_ADD_BLEND_IMG) -GL_ENUM(0x84F2,GL_ALL_COMPLETED_NV) -GL_ENUM(0x84F3,GL_FENCE_STATUS_NV) -GL_ENUM(0x84F4,GL_FENCE_CONDITION_NV) +GL_ENUM(0x8BC0,GL_COUNTER_TYPE_AMD) +GL_ENUM(0x8BC1,GL_COUNTER_RANGE_AMD) +GL_ENUM(0x8BC2,GL_UNSIGNED_INT64_AMD) +GL_ENUM(0x8BC3,GL_PERCENTAGE_AMD) +GL_ENUM(0x8BC4,GL_PERFMON_RESULT_AVAILABLE_AMD) +GL_ENUM(0x8BC5,GL_PERFMON_RESULT_SIZE_AMD) +GL_ENUM(0x8BC6,GL_PERFMON_RESULT_AMD) GL_ENUM(0x8BD2,GL_TEXTURE_WIDTH_QCOM) GL_ENUM(0x8BD3,GL_TEXTURE_HEIGHT_QCOM) GL_ENUM(0x8BD4,GL_TEXTURE_DEPTH_QCOM) @@ -1011,330 +578,104 @@ GL_ENUM(0x8BDA,GL_TEXTURE_TARGET_QCOM) GL_ENUM(0x8BDB,GL_TEXTURE_OBJECT_VALID_QCOM) GL_ENUM(0x8BDC,GL_STATE_RESTORE) -GL_ENUM(0x8FA0,GL_PERFMON_GLOBAL_MODE_QCOM) -GL_ENUM(0x8823,GL_WRITEONLY_RENDERING_QCOM) -GL_ENUM(0x9285,GL_BLEND_ADVANCED_COHERENT_KHR) -GL_ENUM(0x9294,GL_MULTIPLY_KHR) -GL_ENUM(0x9295,GL_SCREEN_KHR) -GL_ENUM(0x9296,GL_OVERLAY_KHR) -GL_ENUM(0x9297,GL_DARKEN_KHR) -GL_ENUM(0x9298,GL_LIGHTEN_KHR) -GL_ENUM(0x9299,GL_COLORDODGE_KHR) -GL_ENUM(0x929A,GL_COLORBURN_KHR) -GL_ENUM(0x929B,GL_HARDLIGHT_KHR) -GL_ENUM(0x929C,GL_SOFTLIGHT_KHR) -GL_ENUM(0x929E,GL_DIFFERENCE_KHR) -GL_ENUM(0x92A0,GL_EXCLUSION_KHR) -GL_ENUM(0x92AD,GL_HSL_HUE_KHR) -GL_ENUM(0x92AE,GL_HSL_SATURATION_KHR) -GL_ENUM(0x92AF,GL_HSL_COLOR_KHR) -GL_ENUM(0x92B0,GL_HSL_LUMINOSITY_KHR) -GL_ENUM(0x82E6,GL_SAMPLER) -GL_ENUM(0x8242,GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR) -GL_ENUM(0x8243,GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR) -GL_ENUM(0x8244,GL_DEBUG_CALLBACK_FUNCTION_KHR) -GL_ENUM(0x8245,GL_DEBUG_CALLBACK_USER_PARAM_KHR) -GL_ENUM(0x8246,GL_DEBUG_SOURCE_API_KHR) -GL_ENUM(0x8247,GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR) -GL_ENUM(0x8248,GL_DEBUG_SOURCE_SHADER_COMPILER_KHR) -GL_ENUM(0x8249,GL_DEBUG_SOURCE_THIRD_PARTY_KHR) -GL_ENUM(0x824A,GL_DEBUG_SOURCE_APPLICATION_KHR) -GL_ENUM(0x824B,GL_DEBUG_SOURCE_OTHER_KHR) -GL_ENUM(0x824C,GL_DEBUG_TYPE_ERROR_KHR) -GL_ENUM(0x824D,GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR) -GL_ENUM(0x824E,GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR) -GL_ENUM(0x824F,GL_DEBUG_TYPE_PORTABILITY_KHR) -GL_ENUM(0x8250,GL_DEBUG_TYPE_PERFORMANCE_KHR) -GL_ENUM(0x8251,GL_DEBUG_TYPE_OTHER_KHR) -GL_ENUM(0x8268,GL_DEBUG_TYPE_MARKER_KHR) -GL_ENUM(0x8269,GL_DEBUG_TYPE_PUSH_GROUP_KHR) -GL_ENUM(0x826A,GL_DEBUG_TYPE_POP_GROUP_KHR) -GL_ENUM(0x826B,GL_DEBUG_SEVERITY_NOTIFICATION_KHR) -GL_ENUM(0x826C,GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR) -GL_ENUM(0x826D,GL_DEBUG_GROUP_STACK_DEPTH_KHR) -GL_ENUM(0x82E0,GL_BUFFER_KHR) -GL_ENUM(0x82E1,GL_SHADER_KHR) -GL_ENUM(0x82E2,GL_PROGRAM_KHR) -GL_ENUM(0x82E3,GL_QUERY_KHR) -GL_ENUM(0x82E8,GL_MAX_LABEL_LENGTH_KHR) -GL_ENUM(0x9143,GL_MAX_DEBUG_MESSAGE_LENGTH_KHR) -GL_ENUM(0x9144,GL_MAX_DEBUG_LOGGED_MESSAGES_KHR) -GL_ENUM(0x9145,GL_DEBUG_LOGGED_MESSAGES_KHR) -GL_ENUM(0x9146,GL_DEBUG_SEVERITY_HIGH_KHR) -GL_ENUM(0x9147,GL_DEBUG_SEVERITY_MEDIUM_KHR) -GL_ENUM(0x9148,GL_DEBUG_SEVERITY_LOW_KHR) -GL_ENUM(0x92E0,GL_DEBUG_OUTPUT_KHR) -GL_ENUM(0x93B0,GL_COMPRESSED_RGBA_ASTC_4x4_KHR) -GL_ENUM(0x93B1,GL_COMPRESSED_RGBA_ASTC_5x4_KHR) -GL_ENUM(0x93B2,GL_COMPRESSED_RGBA_ASTC_5x5_KHR) -GL_ENUM(0x93B3,GL_COMPRESSED_RGBA_ASTC_6x5_KHR) -GL_ENUM(0x93B4,GL_COMPRESSED_RGBA_ASTC_6x6_KHR) -GL_ENUM(0x93B5,GL_COMPRESSED_RGBA_ASTC_8x5_KHR) -GL_ENUM(0x93B6,GL_COMPRESSED_RGBA_ASTC_8x6_KHR) -GL_ENUM(0x93B7,GL_COMPRESSED_RGBA_ASTC_8x8_KHR) -GL_ENUM(0x93B8,GL_COMPRESSED_RGBA_ASTC_10x5_KHR) -GL_ENUM(0x93B9,GL_COMPRESSED_RGBA_ASTC_10x6_KHR) -GL_ENUM(0x93BA,GL_COMPRESSED_RGBA_ASTC_10x8_KHR) -GL_ENUM(0x93BB,GL_COMPRESSED_RGBA_ASTC_10x10_KHR) -GL_ENUM(0x93BC,GL_COMPRESSED_RGBA_ASTC_12x10_KHR) -GL_ENUM(0x93BD,GL_COMPRESSED_RGBA_ASTC_12x12_KHR) -GL_ENUM(0x93D0,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR) -GL_ENUM(0x93D1,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR) -GL_ENUM(0x93D2,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR) -GL_ENUM(0x93D3,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR) -GL_ENUM(0x93D4,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR) -GL_ENUM(0x93D5,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR) -GL_ENUM(0x93D6,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR) -GL_ENUM(0x93D7,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR) -GL_ENUM(0x93D8,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR) -GL_ENUM(0x93D9,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR) -GL_ENUM(0x93DA,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR) -GL_ENUM(0x93DB,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR) -GL_ENUM(0x93DC,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR) -GL_ENUM(0x93DD,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR) -GL_ENUM(0x8D66,GL_SAMPLER_EXTERNAL_OES) -GL_ENUM(0x8C36,GL_SAMPLE_SHADING_OES) -GL_ENUM(0x8C37,GL_MIN_SAMPLE_SHADING_VALUE_OES) -GL_ENUM(0x8E5B,GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES) -GL_ENUM(0x8E5C,GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES) -GL_ENUM(0x8E5D,GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES) -GL_ENUM(0x93C0,GL_COMPRESSED_RGBA_ASTC_3x3x3_OES) -GL_ENUM(0x93C1,GL_COMPRESSED_RGBA_ASTC_4x3x3_OES) -GL_ENUM(0x93C2,GL_COMPRESSED_RGBA_ASTC_4x4x3_OES) -GL_ENUM(0x93C3,GL_COMPRESSED_RGBA_ASTC_4x4x4_OES) -GL_ENUM(0x93C4,GL_COMPRESSED_RGBA_ASTC_5x4x4_OES) -GL_ENUM(0x93C5,GL_COMPRESSED_RGBA_ASTC_5x5x4_OES) -GL_ENUM(0x93C6,GL_COMPRESSED_RGBA_ASTC_5x5x5_OES) -GL_ENUM(0x93C7,GL_COMPRESSED_RGBA_ASTC_6x5x5_OES) -GL_ENUM(0x93C8,GL_COMPRESSED_RGBA_ASTC_6x6x5_OES) -GL_ENUM(0x93C9,GL_COMPRESSED_RGBA_ASTC_6x6x6_OES) -GL_ENUM(0x93E0,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_3x3x3_OES) -GL_ENUM(0x93E1,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x3x3_OES) -GL_ENUM(0x93E2,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x3_OES) -GL_ENUM(0x93E3,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4x4_OES) -GL_ENUM(0x93E4,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4x4_OES) -GL_ENUM(0x93E5,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x4_OES) -GL_ENUM(0x93E6,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5x5_OES) -GL_ENUM(0x93E7,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5x5_OES) -GL_ENUM(0x93E8,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x5_OES) -GL_ENUM(0x93E9,GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6x6_OES) +GL_ENUM(0x8C00,GL_COMPRESSED_RGB_PVRTC_4BPPV1_IMG) +GL_ENUM(0x8C01,GL_COMPRESSED_RGB_PVRTC_2BPPV1_IMG) +GL_ENUM(0x8C02,GL_COMPRESSED_RGBA_PVRTC_4BPPV1_IMG) +GL_ENUM(0x8C03,GL_COMPRESSED_RGBA_PVRTC_2BPPV1_IMG) +GL_ENUM(0x8C04,GL_MODULATE_COLOR_IMG) +GL_ENUM(0x8C05,GL_RECIP_ADD_SIGNED_ALPHA_IMG) +GL_ENUM(0x8C06,GL_TEXTURE_ALPHA_MODULATE_IMG) +GL_ENUM(0x8C07,GL_FACTOR_ALPHA_MODULATE_IMG) +GL_ENUM(0x8C08,GL_FRAGMENT_ALPHA_MODULATE_IMG) +GL_ENUM(0x8C09,GL_ADD_BLEND_IMG) +GL_ENUM(0x8C0A,GL_SGX_BINARY_IMG) +GL_ENUM(0x8C17,GL_UNSIGNED_NORMALIZED_EXT) +GL_ENUM(0x8C2F,GL_ANY_SAMPLES_PASSED_EXT) +GL_ENUM(0x8C40,GL_SRGB_EXT) +GL_ENUM(0x8C42,GL_SRGB_ALPHA_EXT) +GL_ENUM(0x8C43,GL_SRGB8_ALPHA8_EXT) +GL_ENUM(0x8C92,GL_ATC_RGB_AMD) +GL_ENUM(0x8C93,GL_ATC_RGBA_EXPLICIT_ALPHA_AMD) +GL_ENUM(0x8CA3,GL_STENCIL_BACK_REF) +GL_ENUM(0x8CA4,GL_STENCIL_BACK_VALUE_MASK) +GL_ENUM(0x8CA5,GL_STENCIL_BACK_WRITEMASK) +GL_ENUM(0x8CA6,GL_FRAMEBUFFER_BINDING_OES) +GL_ENUM(0x8CA7,GL_RENDERBUFFER_BINDING_OES) +GL_ENUM(0x8CA8,GL_READ_FRAMEBUFFER_APPLE) +GL_ENUM(0x8CA9,GL_DRAW_FRAMEBUFFER_APPLE) +GL_ENUM(0x8CAA,GL_READ_FRAMEBUFFER_BINDING_APPLE) +GL_ENUM(0x8CAB,GL_RENDERBUFFER_SAMPLES_APPLE) +GL_ENUM(0x8CD0,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_TYPE_OES) +GL_ENUM(0x8CD1,GL_FRAMEBUFFER_ATTACHMENT_OBJECT_NAME_OES) +GL_ENUM(0x8CD2,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LEVEL_OES) +GL_ENUM(0x8CD3,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_CUBE_MAP_FACE_OES) +GL_ENUM(0x8CD4,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_3D_ZOFFSET_OES) +GL_ENUM(0x8CD5,GL_FRAMEBUFFER_COMPLETE_OES) +GL_ENUM(0x8CD6,GL_FRAMEBUFFER_INCOMPLETE_ATTACHMENT_OES) +GL_ENUM(0x8CD7,GL_FRAMEBUFFER_INCOMPLETE_MISSING_ATTACHMENT_OES) +GL_ENUM(0x8CD9,GL_FRAMEBUFFER_INCOMPLETE_DIMENSIONS_OES) +GL_ENUM(0x8CDA,GL_FRAMEBUFFER_INCOMPLETE_FORMATS_OES) +GL_ENUM(0x8CDD,GL_FRAMEBUFFER_UNSUPPORTED_OES) +GL_ENUM(0x8CDF,GL_MAX_COLOR_ATTACHMENTS_NV) +GL_ENUM(0x8CE0,GL_COLOR_ATTACHMENT0_OES) +GL_ENUM(0x8CE1,GL_COLOR_ATTACHMENT1_NV) +GL_ENUM(0x8CE2,GL_COLOR_ATTACHMENT2_NV) +GL_ENUM(0x8CE3,GL_COLOR_ATTACHMENT3_NV) +GL_ENUM(0x8CE4,GL_COLOR_ATTACHMENT4_NV) +GL_ENUM(0x8CE5,GL_COLOR_ATTACHMENT5_NV) +GL_ENUM(0x8CE6,GL_COLOR_ATTACHMENT6_NV) +GL_ENUM(0x8CE7,GL_COLOR_ATTACHMENT7_NV) +GL_ENUM(0x8CE8,GL_COLOR_ATTACHMENT8_NV) +GL_ENUM(0x8CE9,GL_COLOR_ATTACHMENT9_NV) +GL_ENUM(0x8CEA,GL_COLOR_ATTACHMENT10_NV) +GL_ENUM(0x8CEB,GL_COLOR_ATTACHMENT11_NV) +GL_ENUM(0x8CEC,GL_COLOR_ATTACHMENT12_NV) +GL_ENUM(0x8CED,GL_COLOR_ATTACHMENT13_NV) +GL_ENUM(0x8CEE,GL_COLOR_ATTACHMENT14_NV) +GL_ENUM(0x8CEF,GL_COLOR_ATTACHMENT15_NV) +GL_ENUM(0x8D00,GL_DEPTH_ATTACHMENT_OES) +GL_ENUM(0x8D20,GL_STENCIL_ATTACHMENT_OES) +GL_ENUM(0x8D40,GL_FRAMEBUFFER_OES) +GL_ENUM(0x8D41,GL_RENDERBUFFER_OES) +GL_ENUM(0x8D42,GL_RENDERBUFFER_WIDTH_OES) +GL_ENUM(0x8D43,GL_RENDERBUFFER_HEIGHT_OES) +GL_ENUM(0x8D44,GL_RENDERBUFFER_INTERNAL_FORMAT_OES) +GL_ENUM(0x8D46,GL_STENCIL_INDEX1_OES) +GL_ENUM(0x8D47,GL_STENCIL_INDEX4_OES) +GL_ENUM(0x8D48,GL_STENCIL_INDEX8_OES) +GL_ENUM(0x8D50,GL_RENDERBUFFER_RED_SIZE_OES) +GL_ENUM(0x8D51,GL_RENDERBUFFER_GREEN_SIZE_OES) +GL_ENUM(0x8D52,GL_RENDERBUFFER_BLUE_SIZE_OES) +GL_ENUM(0x8D53,GL_RENDERBUFFER_ALPHA_SIZE_OES) +GL_ENUM(0x8D54,GL_RENDERBUFFER_DEPTH_SIZE_OES) +GL_ENUM(0x8D55,GL_RENDERBUFFER_STENCIL_SIZE_OES) +GL_ENUM(0x8D56,GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_APPLE) +GL_ENUM(0x8D57,GL_MAX_SAMPLES_APPLE) +GL_ENUM(0x8D60,GL_TEXTURE_GEN_STR_OES) GL_ENUM(0x8D61,GL_HALF_FLOAT_OES) -GL_ENUM(0x9102,GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES) -GL_ENUM(0x9105,GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES) -GL_ENUM(0x910B,GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES) -GL_ENUM(0x910C,GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES) -GL_ENUM(0x910D,GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES) +GL_ENUM(0x8D62,GL_RGB565_OES) +GL_ENUM(0x8D64,GL_ETC1_RGB8_OES) +GL_ENUM(0x8D65,GL_TEXTURE_EXTERNAL_OES) +GL_ENUM(0x8D66,GL_SAMPLER_EXTERNAL_OES) +GL_ENUM(0x8D67,GL_TEXTURE_BINDING_EXTERNAL_OES) +GL_ENUM(0x8D68,GL_REQUIRED_TEXTURE_IMAGE_UNITS_OES) +GL_ENUM(0x8D6A,GL_ANY_SAMPLES_PASSED_CONSERVATIVE_EXT) +GL_ENUM(0x8D6C,GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_SAMPLES_EXT) +GL_ENUM(0x8DF0,GL_LOW_FLOAT) +GL_ENUM(0x8DF1,GL_MEDIUM_FLOAT) +GL_ENUM(0x8DF2,GL_HIGH_FLOAT) +GL_ENUM(0x8DF3,GL_LOW_INT) +GL_ENUM(0x8DF4,GL_MEDIUM_INT) +GL_ENUM(0x8DF5,GL_HIGH_INT) GL_ENUM(0x8DF6,GL_UNSIGNED_INT_10_10_10_2_OES) GL_ENUM(0x8DF7,GL_INT_10_10_10_2_OES) -GL_ENUM(0x8BC0,GL_COUNTER_TYPE_AMD) -GL_ENUM(0x8BC1,GL_COUNTER_RANGE_AMD) -GL_ENUM(0x8BC2,GL_UNSIGNED_INT64_AMD) -GL_ENUM(0x8BC3,GL_PERCENTAGE_AMD) -GL_ENUM(0x8BC4,GL_PERFMON_RESULT_AVAILABLE_AMD) -GL_ENUM(0x8BC5,GL_PERFMON_RESULT_SIZE_AMD) -GL_ENUM(0x8BC6,GL_PERFMON_RESULT_AMD) -GL_ENUM(0x8740,GL_Z400_BINARY_AMD) -GL_ENUM(0x93A4,GL_PACK_REVERSE_ROW_ORDER_ANGLE) -GL_ENUM(0x93A6,GL_PROGRAM_BINARY_ANGLE) -GL_ENUM(0x83F2,GL_COMPRESSED_RGBA_S3TC_DXT3_ANGLE) -GL_ENUM(0x83F3,GL_COMPRESSED_RGBA_S3TC_DXT5_ANGLE) -GL_ENUM(0x93A2,GL_TEXTURE_USAGE_ANGLE) -GL_ENUM(0x93A3,GL_FRAMEBUFFER_ATTACHMENT_ANGLE) -GL_ENUM(0x93A0,GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE) -GL_ENUM(0x8A1F,GL_RGB_422_APPLE) -GL_ENUM(0x85BA,GL_UNSIGNED_SHORT_8_8_APPLE) -GL_ENUM(0x85BB,GL_UNSIGNED_SHORT_8_8_REV_APPLE) -GL_ENUM(0x8A51,GL_RGB_RAW_422_APPLE) -GL_ENUM(0x8F61,GL_MALI_PROGRAM_BINARY_ARM) -GL_ENUM(0x8F60,GL_MALI_SHADER_BINARY_ARM) -GL_ENUM(0x8F65,GL_FETCH_PER_SAMPLE_ARM) -GL_ENUM(0x8F66,GL_FRAGMENT_SHADER_FRAMEBUFFER_FETCH_MRT_ARM) -GL_ENUM(0x9250,GL_SHADER_BINARY_DMP) -GL_ENUM(0x8A4F,GL_PROGRAM_PIPELINE_OBJECT_EXT) -GL_ENUM(0x8B40,GL_PROGRAM_OBJECT_EXT) -GL_ENUM(0x8B48,GL_SHADER_OBJECT_EXT) -GL_ENUM(0x9151,GL_BUFFER_OBJECT_EXT) -GL_ENUM(0x9153,GL_QUERY_OBJECT_EXT) -GL_ENUM(0x9154,GL_VERTEX_ARRAY_OBJECT_EXT) -GL_ENUM(0x8864,GL_QUERY_COUNTER_BITS_EXT) -GL_ENUM(0x88BF,GL_TIME_ELAPSED_EXT) -GL_ENUM(0x8E28,GL_TIMESTAMP_EXT) -GL_ENUM(0x8FBB,GL_GPU_DISJOINT_EXT) -GL_ENUM(0x8DD9,GL_GEOMETRY_SHADER_EXT) -GL_ENUM(0x8916,GL_GEOMETRY_LINKED_VERTICES_OUT_EXT) -GL_ENUM(0x8917,GL_GEOMETRY_LINKED_INPUT_TYPE_EXT) -GL_ENUM(0x8918,GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT) -GL_ENUM(0x887F,GL_GEOMETRY_SHADER_INVOCATIONS_EXT) -GL_ENUM(0x825E,GL_LAYER_PROVOKING_VERTEX_EXT) -GL_ENUM(0x000A,GL_LINES_ADJACENCY_EXT) -GL_ENUM(0x000B,GL_LINE_STRIP_ADJACENCY_EXT) -GL_ENUM(0x000C,GL_TRIANGLES_ADJACENCY_EXT) -GL_ENUM(0x000D,GL_TRIANGLE_STRIP_ADJACENCY_EXT) -GL_ENUM(0x8DDF,GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT) -GL_ENUM(0x8A2C,GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT) -GL_ENUM(0x8A32,GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT) -GL_ENUM(0x9123,GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT) -GL_ENUM(0x9124,GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT) -GL_ENUM(0x8DE0,GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT) -GL_ENUM(0x8DE1,GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT) -GL_ENUM(0x8E5A,GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT) -GL_ENUM(0x8C29,GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT) -GL_ENUM(0x92CF,GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT) -GL_ENUM(0x92D5,GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT) -GL_ENUM(0x90CD,GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT) -GL_ENUM(0x90D7,GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT) -GL_ENUM(0x8E4D,GL_FIRST_VERTEX_CONVENTION_EXT) -GL_ENUM(0x8E4E,GL_LAST_VERTEX_CONVENTION_EXT) -GL_ENUM(0x8260,GL_UNDEFINED_VERTEX_EXT) -GL_ENUM(0x8C87,GL_PRIMITIVES_GENERATED_EXT) -GL_ENUM(0x9312,GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT) -GL_ENUM(0x9317,GL_MAX_FRAMEBUFFER_LAYERS_EXT) -GL_ENUM(0x8DA8,GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT) -GL_ENUM(0x8DA7,GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT) -GL_ENUM(0x9309,GL_REFERENCED_BY_GEOMETRY_SHADER_EXT) -GL_ENUM(0x90F0,GL_COLOR_ATTACHMENT_EXT) -GL_ENUM(0x90F1,GL_MULTIVIEW_EXT) -GL_ENUM(0x0C01,GL_DRAW_BUFFER_EXT) -GL_ENUM(0x90F2,GL_MAX_MULTIVIEW_BUFFERS_EXT) -GL_ENUM(0x92BE,GL_PRIMITIVE_BOUNDING_BOX_EXT) -GL_ENUM(0x8A54,GL_COMPRESSED_SRGB_PVRTC_2BPPV1_EXT) -GL_ENUM(0x8A55,GL_COMPRESSED_SRGB_PVRTC_4BPPV1_EXT) -GL_ENUM(0x8A56,GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV1_EXT) -GL_ENUM(0x8A57,GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV1_EXT) -GL_ENUM(0x93F0,GL_COMPRESSED_SRGB_ALPHA_PVRTC_2BPPV2_IMG) -GL_ENUM(0x93F1,GL_COMPRESSED_SRGB_ALPHA_PVRTC_4BPPV2_IMG) -GL_ENUM(0x8DB9,GL_FRAMEBUFFER_SRGB_EXT) -GL_ENUM(0x8A52,GL_FRAGMENT_SHADER_DISCARDS_SAMPLES_EXT) -GL_ENUM(0x8F63,GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_FAST_SIZE_EXT) -GL_ENUM(0x8F67,GL_MAX_SHADER_PIXEL_LOCAL_STORAGE_SIZE_EXT) -GL_ENUM(0x8F64,GL_SHADER_PIXEL_LOCAL_STORAGE_EXT) -GL_ENUM(0x000E,GL_PATCHES_EXT) -GL_ENUM(0x8E72,GL_PATCH_VERTICES_EXT) -GL_ENUM(0x8E75,GL_TESS_CONTROL_OUTPUT_VERTICES_EXT) -GL_ENUM(0x8E76,GL_TESS_GEN_MODE_EXT) -GL_ENUM(0x8E77,GL_TESS_GEN_SPACING_EXT) -GL_ENUM(0x8E78,GL_TESS_GEN_VERTEX_ORDER_EXT) -GL_ENUM(0x8E79,GL_TESS_GEN_POINT_MODE_EXT) -GL_ENUM(0x8E7A,GL_ISOLINES_EXT) -GL_ENUM(0x0007,GL_QUADS_EXT) -GL_ENUM(0x8E7B,GL_FRACTIONAL_ODD_EXT) -GL_ENUM(0x8E7C,GL_FRACTIONAL_EVEN_EXT) -GL_ENUM(0x8E7D,GL_MAX_PATCH_VERTICES_EXT) -GL_ENUM(0x8E7E,GL_MAX_TESS_GEN_LEVEL_EXT) -GL_ENUM(0x8E7F,GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT) -GL_ENUM(0x8E80,GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT) -GL_ENUM(0x8E81,GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT) -GL_ENUM(0x8E82,GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT) -GL_ENUM(0x8E83,GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT) -GL_ENUM(0x8E84,GL_MAX_TESS_PATCH_COMPONENTS_EXT) -GL_ENUM(0x8E85,GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT) -GL_ENUM(0x8E86,GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT) -GL_ENUM(0x8E89,GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT) -GL_ENUM(0x8E8A,GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT) -GL_ENUM(0x886C,GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT) -GL_ENUM(0x886D,GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT) -GL_ENUM(0x8E1E,GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT) -GL_ENUM(0x8E1F,GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT) -GL_ENUM(0x92CD,GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT) -GL_ENUM(0x92CE,GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT) -GL_ENUM(0x92D3,GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT) -GL_ENUM(0x92D4,GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT) -GL_ENUM(0x90CB,GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT) -GL_ENUM(0x90CC,GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT) -GL_ENUM(0x90D8,GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT) -GL_ENUM(0x90D9,GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT) -GL_ENUM(0x8221,GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED) -GL_ENUM(0x92E7,GL_IS_PER_PATCH_EXT) -GL_ENUM(0x9307,GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT) -GL_ENUM(0x9308,GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT) -GL_ENUM(0x8E88,GL_TESS_CONTROL_SHADER_EXT) -GL_ENUM(0x8E87,GL_TESS_EVALUATION_SHADER_EXT) -GL_ENUM(0x1004,GL_TEXTURE_BORDER_COLOR_EXT) -GL_ENUM(0x812D,GL_CLAMP_TO_BORDER_EXT) -GL_ENUM(0x8C2A,GL_TEXTURE_BUFFER_EXT) -GL_ENUM(0x8C2B,GL_MAX_TEXTURE_BUFFER_SIZE_EXT) -GL_ENUM(0x8C2C,GL_TEXTURE_BINDING_BUFFER_EXT) -GL_ENUM(0x8C2D,GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT) -GL_ENUM(0x919F,GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT) -GL_ENUM(0x8DC2,GL_SAMPLER_BUFFER_EXT) -GL_ENUM(0x8DD0,GL_INT_SAMPLER_BUFFER_EXT) -GL_ENUM(0x8DD8,GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT) -GL_ENUM(0x9051,GL_IMAGE_BUFFER_EXT) -GL_ENUM(0x905C,GL_INT_IMAGE_BUFFER_EXT) -GL_ENUM(0x9067,GL_UNSIGNED_INT_IMAGE_BUFFER_EXT) -GL_ENUM(0x919D,GL_TEXTURE_BUFFER_OFFSET_EXT) -GL_ENUM(0x919E,GL_TEXTURE_BUFFER_SIZE_EXT) -GL_ENUM(0x9009,GL_TEXTURE_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x900A,GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x900C,GL_SAMPLER_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x900D,GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT) -GL_ENUM(0x900E,GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x900F,GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x9054,GL_IMAGE_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x905F,GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x906A,GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT) -GL_ENUM(0x8A48,GL_TEXTURE_SRGB_DECODE_EXT) -GL_ENUM(0x8A49,GL_DECODE_EXT) -GL_ENUM(0x8A4A,GL_SKIP_DECODE_EXT) -GL_ENUM(0x82DB,GL_TEXTURE_VIEW_MIN_LEVEL_EXT) -GL_ENUM(0x82DC,GL_TEXTURE_VIEW_NUM_LEVELS_EXT) -GL_ENUM(0x82DD,GL_TEXTURE_VIEW_MIN_LAYER_EXT) -GL_ENUM(0x82DE,GL_TEXTURE_VIEW_NUM_LAYERS_EXT) -GL_ENUM(0x9260,GL_GCCSO_SHADER_BINARY_FJ) -GL_ENUM(0x9130,GL_SGX_PROGRAM_BINARY_IMG) -GL_ENUM(0x8C0A,GL_SGX_BINARY_IMG) -GL_ENUM(0x9137,GL_COMPRESSED_RGBA_PVRTC_2BPPV2_IMG) -GL_ENUM(0x9138,GL_COMPRESSED_RGBA_PVRTC_4BPPV2_IMG) -GL_ENUM(0x00000000,GL_PERFQUERY_SINGLE_CONTEXT_INTEL) -GL_ENUM(0x00000001,GL_PERFQUERY_GLOBAL_CONTEXT_INTEL) -GL_ENUM(0x83FB,GL_PERFQUERY_WAIT_INTEL) -GL_ENUM(0x83FA,GL_PERFQUERY_FLUSH_INTEL) -GL_ENUM(0x83F9,GL_PERFQUERY_DONOT_FLUSH_INTEL) -GL_ENUM(0x94F0,GL_PERFQUERY_COUNTER_EVENT_INTEL) -GL_ENUM(0x94F1,GL_PERFQUERY_COUNTER_DURATION_NORM_INTEL) -GL_ENUM(0x94F2,GL_PERFQUERY_COUNTER_DURATION_RAW_INTEL) -GL_ENUM(0x94F3,GL_PERFQUERY_COUNTER_THROUGHPUT_INTEL) -GL_ENUM(0x94F4,GL_PERFQUERY_COUNTER_RAW_INTEL) -GL_ENUM(0x94F5,GL_PERFQUERY_COUNTER_TIMESTAMP_INTEL) -GL_ENUM(0x94F8,GL_PERFQUERY_COUNTER_DATA_UINT32_INTEL) -GL_ENUM(0x94F9,GL_PERFQUERY_COUNTER_DATA_UINT64_INTEL) -GL_ENUM(0x94FA,GL_PERFQUERY_COUNTER_DATA_FLOAT_INTEL) -GL_ENUM(0x94FB,GL_PERFQUERY_COUNTER_DATA_DOUBLE_INTEL) -GL_ENUM(0x94FC,GL_PERFQUERY_COUNTER_DATA_BOOL32_INTEL) -GL_ENUM(0x94FD,GL_PERFQUERY_QUERY_NAME_LENGTH_MAX_INTEL) -GL_ENUM(0x94FE,GL_PERFQUERY_COUNTER_NAME_LENGTH_MAX_INTEL) -GL_ENUM(0x94FF,GL_PERFQUERY_COUNTER_DESC_LENGTH_MAX_INTEL) -GL_ENUM(0x9500,GL_PERFQUERY_GPA_EXTENDED_COUNTERS_INTEL) -GL_ENUM(0x9281,GL_BLEND_OVERLAP_NV) -GL_ENUM(0x9280,GL_BLEND_PREMULTIPLIED_SRC_NV) -GL_ENUM(0x9284,GL_CONJOINT_NV) -GL_ENUM(0x92A1,GL_CONTRAST_NV) -GL_ENUM(0x9283,GL_DISJOINT_NV) -GL_ENUM(0x928F,GL_DST_ATOP_NV) -GL_ENUM(0x928B,GL_DST_IN_NV) -GL_ENUM(0x9287,GL_DST_NV) -GL_ENUM(0x928D,GL_DST_OUT_NV) -GL_ENUM(0x9289,GL_DST_OVER_NV) -GL_ENUM(0x92A9,GL_HARDMIX_NV) -GL_ENUM(0x92B4,GL_INVERT_OVG_NV) -GL_ENUM(0x92A3,GL_INVERT_RGB_NV) -GL_ENUM(0x92A5,GL_LINEARBURN_NV) -GL_ENUM(0x92A4,GL_LINEARDODGE_NV) -GL_ENUM(0x92A7,GL_LINEARLIGHT_NV) -GL_ENUM(0x92B3,GL_MINUS_CLAMPED_NV) -GL_ENUM(0x929F,GL_MINUS_NV) -GL_ENUM(0x92A8,GL_PINLIGHT_NV) -GL_ENUM(0x92B2,GL_PLUS_CLAMPED_ALPHA_NV) -GL_ENUM(0x92B1,GL_PLUS_CLAMPED_NV) -GL_ENUM(0x9292,GL_PLUS_DARKER_NV) -GL_ENUM(0x9291,GL_PLUS_NV) -GL_ENUM(0x928E,GL_SRC_ATOP_NV) -GL_ENUM(0x928A,GL_SRC_IN_NV) -GL_ENUM(0x9286,GL_SRC_NV) -GL_ENUM(0x928C,GL_SRC_OUT_NV) -GL_ENUM(0x9288,GL_SRC_OVER_NV) -GL_ENUM(0x9282,GL_UNCORRELATED_NV) -GL_ENUM(0x92A6,GL_VIVIDLIGHT_NV) +GL_ENUM(0x8DF8,GL_SHADER_BINARY_FORMATS) +GL_ENUM(0x8DF9,GL_NUM_SHADER_BINARY_FORMATS) +GL_ENUM(0x8DFA,GL_SHADER_COMPILER) +GL_ENUM(0x8DFB,GL_MAX_VERTEX_UNIFORM_VECTORS) +GL_ENUM(0x8DFC,GL_MAX_VARYING_VECTORS) +GL_ENUM(0x8DFD,GL_MAX_FRAGMENT_UNIFORM_VECTORS) +GL_ENUM(0x8E2C,GL_DEPTH_COMPONENT16_NONLINEAR_NV) GL_ENUM(0x8ED0,GL_COVERAGE_COMPONENT_NV) GL_ENUM(0x8ED1,GL_COVERAGE_COMPONENT4_NV) GL_ENUM(0x8ED2,GL_COVERAGE_ATTACHMENT_NV) @@ -1343,18 +684,19 @@ GL_ENUM(0x8ED5,GL_COVERAGE_ALL_FRAGMENTS_NV) GL_ENUM(0x8ED6,GL_COVERAGE_EDGE_FRAGMENTS_NV) GL_ENUM(0x8ED7,GL_COVERAGE_AUTOMATIC_NV) -GL_ENUM(0x8E2C,GL_DEPTH_COMPONENT16_NONLINEAR_NV) -GL_ENUM(0x8C46,GL_SLUMINANCE_NV) -GL_ENUM(0x8C44,GL_SLUMINANCE_ALPHA_NV) -GL_ENUM(0x8C47,GL_SLUMINANCE8_NV) -GL_ENUM(0x8C45,GL_SLUMINANCE8_ALPHA8_NV) -GL_ENUM(0x8C4C,GL_COMPRESSED_SRGB_S3TC_DXT1_NV) -GL_ENUM(0x8C4D,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT1_NV) -GL_ENUM(0x8C4E,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT3_NV) -GL_ENUM(0x8C4F,GL_COMPRESSED_SRGB_ALPHA_S3TC_DXT5_NV) -GL_ENUM(0x88EE,GL_ETC1_SRGB8_NV) -GL_ENUM(0x8FB0,GL_BINNING_CONTROL_HINT_QCOM) -GL_ENUM(0x8FB1,GL_CPU_OPTIMIZED_QCOM) -GL_ENUM(0x8FB2,GL_GPU_OPTIMIZED_QCOM) -GL_ENUM(0x8FB3,GL_RENDER_DIRECT_TO_FRAMEBUFFER_QCOM) +GL_ENUM(0x8F60,GL_MALI_SHADER_BINARY_ARM) +GL_ENUM(0x8FA0,GL_PERFMON_GLOBAL_MODE_QCOM) GL_ENUM(0x8FC4,GL_SHADER_BINARY_VIV) +GL_ENUM(0x90F3,GL_CONTEXT_ROBUST_ACCESS_EXT) +GL_ENUM(0x912F,GL_TEXTURE_IMMUTABLE_FORMAT_EXT) +GL_ENUM(0x9130,GL_SGX_PROGRAM_BINARY_IMG) +GL_ENUM(0x9133,GL_RENDERBUFFER_SAMPLES_EXT) +GL_ENUM(0x9134,GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE_EXT) +GL_ENUM(0x9135,GL_MAX_SAMPLES_EXT) +GL_ENUM(0x9136,GL_TEXTURE_SAMPLES_IMG) +GL_ENUM(0x9151,GL_BUFFER_OBJECT_EXT) +GL_ENUM(0x9153,GL_QUERY_OBJECT_EXT) +GL_ENUM(0x9154,GL_VERTEX_ARRAY_OBJECT_EXT) +GL_ENUM(0x9250,GL_SHADER_BINARY_DMP) +GL_ENUM(0x93A1,GL_BGRA8_EXT) +GL_ENUM(0xFFFFFFFF,GL_ALL_SHADER_BITS_EXT) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES2/gl2_api.in android-platform-frameworks-native-21/opengl/libs/GLES2/gl2_api.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES2/gl2_api.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES2/gl2_api.in 2012-10-16 22:57:11.000000000 +0000 @@ -4,7 +4,7 @@ void API_ENTRY(glAttachShader)(GLuint program, GLuint shader) { CALL_GL_API(glAttachShader, program, shader); } -void API_ENTRY(glBindAttribLocation)(GLuint program, GLuint index, const GLchar * name) { +void API_ENTRY(glBindAttribLocation)(GLuint program, GLuint index, const GLchar* name) { CALL_GL_API(glBindAttribLocation, program, index, name); } void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) { @@ -19,10 +19,10 @@ void API_ENTRY(glBindTexture)(GLenum target, GLuint texture) { CALL_GL_API(glBindTexture, target, texture); } -void API_ENTRY(glBlendColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { +void API_ENTRY(glBlendColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { CALL_GL_API(glBlendColor, red, green, blue, alpha); } -void API_ENTRY(glBlendEquation)(GLenum mode) { +void API_ENTRY(glBlendEquation)( GLenum mode ) { CALL_GL_API(glBlendEquation, mode); } void API_ENTRY(glBlendEquationSeparate)(GLenum modeRGB, GLenum modeAlpha) { @@ -31,13 +31,13 @@ void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) { CALL_GL_API(glBlendFunc, sfactor, dfactor); } -void API_ENTRY(glBlendFuncSeparate)(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { - CALL_GL_API(glBlendFuncSeparate, sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); +void API_ENTRY(glBlendFuncSeparate)(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { + CALL_GL_API(glBlendFuncSeparate, srcRGB, dstRGB, srcAlpha, dstAlpha); } -void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const void * data, GLenum usage) { +void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) { CALL_GL_API(glBufferData, target, size, data, usage); } -void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) { +void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { CALL_GL_API(glBufferSubData, target, offset, size, data); } GLenum API_ENTRY(glCheckFramebufferStatus)(GLenum target) { @@ -46,11 +46,11 @@ void API_ENTRY(glClear)(GLbitfield mask) { CALL_GL_API(glClear, mask); } -void API_ENTRY(glClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { +void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { CALL_GL_API(glClearColor, red, green, blue, alpha); } -void API_ENTRY(glClearDepthf)(GLfloat d) { - CALL_GL_API(glClearDepthf, d); +void API_ENTRY(glClearDepthf)(GLclampf depth) { + CALL_GL_API(glClearDepthf, depth); } void API_ENTRY(glClearStencil)(GLint s) { CALL_GL_API(glClearStencil, s); @@ -61,10 +61,10 @@ void API_ENTRY(glCompileShader)(GLuint shader) { CALL_GL_API(glCompileShader, shader); } -void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) { +void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) { CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, width, height, border, imageSize, data); } -void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) { +void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) { CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, width, height, format, imageSize, data); } void API_ENTRY(glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { @@ -82,22 +82,22 @@ void API_ENTRY(glCullFace)(GLenum mode) { CALL_GL_API(glCullFace, mode); } -void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint * buffers) { +void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint* buffers) { CALL_GL_API(glDeleteBuffers, n, buffers); } -void API_ENTRY(glDeleteFramebuffers)(GLsizei n, const GLuint * framebuffers) { +void API_ENTRY(glDeleteFramebuffers)(GLsizei n, const GLuint* framebuffers) { CALL_GL_API(glDeleteFramebuffers, n, framebuffers); } void API_ENTRY(glDeleteProgram)(GLuint program) { CALL_GL_API(glDeleteProgram, program); } -void API_ENTRY(glDeleteRenderbuffers)(GLsizei n, const GLuint * renderbuffers) { +void API_ENTRY(glDeleteRenderbuffers)(GLsizei n, const GLuint* renderbuffers) { CALL_GL_API(glDeleteRenderbuffers, n, renderbuffers); } void API_ENTRY(glDeleteShader)(GLuint shader) { CALL_GL_API(glDeleteShader, shader); } -void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint * textures) { +void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint* textures) { CALL_GL_API(glDeleteTextures, n, textures); } void API_ENTRY(glDepthFunc)(GLenum func) { @@ -106,8 +106,8 @@ void API_ENTRY(glDepthMask)(GLboolean flag) { CALL_GL_API(glDepthMask, flag); } -void API_ENTRY(glDepthRangef)(GLfloat n, GLfloat f) { - CALL_GL_API(glDepthRangef, n, f); +void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) { + CALL_GL_API(glDepthRangef, zNear, zFar); } void API_ENTRY(glDetachShader)(GLuint program, GLuint shader) { CALL_GL_API(glDetachShader, program, shader); @@ -121,7 +121,7 @@ void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) { CALL_GL_API(glDrawArrays, mode, first, count); } -void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const void * indices) { +void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) { CALL_GL_API(glDrawElements, mode, count, type, indices); } void API_ENTRY(glEnable)(GLenum cap) { @@ -145,97 +145,97 @@ void API_ENTRY(glFrontFace)(GLenum mode) { CALL_GL_API(glFrontFace, mode); } -void API_ENTRY(glGenBuffers)(GLsizei n, GLuint * buffers) { +void API_ENTRY(glGenBuffers)(GLsizei n, GLuint* buffers) { CALL_GL_API(glGenBuffers, n, buffers); } void API_ENTRY(glGenerateMipmap)(GLenum target) { CALL_GL_API(glGenerateMipmap, target); } -void API_ENTRY(glGenFramebuffers)(GLsizei n, GLuint * framebuffers) { +void API_ENTRY(glGenFramebuffers)(GLsizei n, GLuint* framebuffers) { CALL_GL_API(glGenFramebuffers, n, framebuffers); } -void API_ENTRY(glGenRenderbuffers)(GLsizei n, GLuint * renderbuffers) { +void API_ENTRY(glGenRenderbuffers)(GLsizei n, GLuint* renderbuffers) { CALL_GL_API(glGenRenderbuffers, n, renderbuffers); } -void API_ENTRY(glGenTextures)(GLsizei n, GLuint * textures) { +void API_ENTRY(glGenTextures)(GLsizei n, GLuint* textures) { CALL_GL_API(glGenTextures, n, textures); } -void API_ENTRY(glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) { - CALL_GL_API(glGetActiveAttrib, program, index, bufSize, length, size, type, name); +void API_ENTRY(glGetActiveAttrib)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + CALL_GL_API(glGetActiveAttrib, program, index, bufsize, length, size, type, name); } -void API_ENTRY(glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) { - CALL_GL_API(glGetActiveUniform, program, index, bufSize, length, size, type, name); +void API_ENTRY(glGetActiveUniform)(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { + CALL_GL_API(glGetActiveUniform, program, index, bufsize, length, size, type, name); } -void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders) { - CALL_GL_API(glGetAttachedShaders, program, maxCount, count, shaders); +void API_ENTRY(glGetAttachedShaders)(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { + CALL_GL_API(glGetAttachedShaders, program, maxcount, count, shaders); } -GLint API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar * name) { +int API_ENTRY(glGetAttribLocation)(GLuint program, const GLchar* name) { CALL_GL_API_RETURN(glGetAttribLocation, program, name); } -void API_ENTRY(__glGetBooleanv)(GLenum pname, GLboolean * data) { - CALL_GL_API(glGetBooleanv, pname, data); +void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean* params) { + CALL_GL_API(glGetBooleanv, pname, params); } -void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint* params) { CALL_GL_API(glGetBufferParameteriv, target, pname, params); } GLenum API_ENTRY(glGetError)(void) { CALL_GL_API_RETURN(glGetError); } -void API_ENTRY(__glGetFloatv)(GLenum pname, GLfloat * data) { - CALL_GL_API(glGetFloatv, pname, data); +void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat* params) { + CALL_GL_API(glGetFloatv, pname, params); } -void API_ENTRY(glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint * params) { +void API_ENTRY(glGetFramebufferAttachmentParameteriv)(GLenum target, GLenum attachment, GLenum pname, GLint* params) { CALL_GL_API(glGetFramebufferAttachmentParameteriv, target, attachment, pname, params); } -void API_ENTRY(__glGetIntegerv)(GLenum pname, GLint * data) { - CALL_GL_API(glGetIntegerv, pname, data); +void API_ENTRY(glGetIntegerv)(GLenum pname, GLint* params) { + CALL_GL_API(glGetIntegerv, pname, params); } -void API_ENTRY(glGetProgramiv)(GLuint program, GLenum pname, GLint * params) { +void API_ENTRY(glGetProgramiv)(GLuint program, GLenum pname, GLint* params) { CALL_GL_API(glGetProgramiv, program, pname, params); } -void API_ENTRY(glGetProgramInfoLog)(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { - CALL_GL_API(glGetProgramInfoLog, program, bufSize, length, infoLog); +void API_ENTRY(glGetProgramInfoLog)(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) { + CALL_GL_API(glGetProgramInfoLog, program, bufsize, length, infolog); } -void API_ENTRY(glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetRenderbufferParameteriv)(GLenum target, GLenum pname, GLint* params) { CALL_GL_API(glGetRenderbufferParameteriv, target, pname, params); } -void API_ENTRY(glGetShaderiv)(GLuint shader, GLenum pname, GLint * params) { +void API_ENTRY(glGetShaderiv)(GLuint shader, GLenum pname, GLint* params) { CALL_GL_API(glGetShaderiv, shader, pname, params); } -void API_ENTRY(glGetShaderInfoLog)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { - CALL_GL_API(glGetShaderInfoLog, shader, bufSize, length, infoLog); +void API_ENTRY(glGetShaderInfoLog)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) { + CALL_GL_API(glGetShaderInfoLog, shader, bufsize, length, infolog); } -void API_ENTRY(glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision) { +void API_ENTRY(glGetShaderPrecisionFormat)(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { CALL_GL_API(glGetShaderPrecisionFormat, shadertype, precisiontype, range, precision); } -void API_ENTRY(glGetShaderSource)(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source) { - CALL_GL_API(glGetShaderSource, shader, bufSize, length, source); +void API_ENTRY(glGetShaderSource)(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) { + CALL_GL_API(glGetShaderSource, shader, bufsize, length, source); } -const GLubyte * API_ENTRY(__glGetString)(GLenum name) { +const GLubyte* API_ENTRY(__glGetString)(GLenum name) { CALL_GL_API_RETURN(glGetString, name); } -void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) { +void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat* params) { CALL_GL_API(glGetTexParameterfv, target, pname, params); } -void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint* params) { CALL_GL_API(glGetTexParameteriv, target, pname, params); } -void API_ENTRY(glGetUniformfv)(GLuint program, GLint location, GLfloat * params) { +void API_ENTRY(glGetUniformfv)(GLuint program, GLint location, GLfloat* params) { CALL_GL_API(glGetUniformfv, program, location, params); } -void API_ENTRY(glGetUniformiv)(GLuint program, GLint location, GLint * params) { +void API_ENTRY(glGetUniformiv)(GLuint program, GLint location, GLint* params) { CALL_GL_API(glGetUniformiv, program, location, params); } -GLint API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar * name) { +int API_ENTRY(glGetUniformLocation)(GLuint program, const GLchar* name) { CALL_GL_API_RETURN(glGetUniformLocation, program, name); } -void API_ENTRY(glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat * params) { +void API_ENTRY(glGetVertexAttribfv)(GLuint index, GLenum pname, GLfloat* params) { CALL_GL_API(glGetVertexAttribfv, index, pname, params); } -void API_ENTRY(glGetVertexAttribiv)(GLuint index, GLenum pname, GLint * params) { +void API_ENTRY(glGetVertexAttribiv)(GLuint index, GLenum pname, GLint* params) { CALL_GL_API(glGetVertexAttribiv, index, pname, params); } -void API_ENTRY(glGetVertexAttribPointerv)(GLuint index, GLenum pname, void ** pointer) { +void API_ENTRY(glGetVertexAttribPointerv)(GLuint index, GLenum pname, GLvoid** pointer) { CALL_GL_API(glGetVertexAttribPointerv, index, pname, pointer); } void API_ENTRY(glHint)(GLenum target, GLenum mode) { @@ -274,7 +274,7 @@ void API_ENTRY(glPolygonOffset)(GLfloat factor, GLfloat units) { CALL_GL_API(glPolygonOffset, factor, units); } -void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) { +void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels); } void API_ENTRY(glReleaseShaderCompiler)(void) { @@ -283,16 +283,16 @@ void API_ENTRY(glRenderbufferStorage)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorage, target, internalformat, width, height); } -void API_ENTRY(glSampleCoverage)(GLfloat value, GLboolean invert) { +void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) { CALL_GL_API(glSampleCoverage, value, invert); } void API_ENTRY(glScissor)(GLint x, GLint y, GLsizei width, GLsizei height) { CALL_GL_API(glScissor, x, y, width, height); } -void API_ENTRY(glShaderBinary)(GLsizei count, const GLuint * shaders, GLenum binaryformat, const void * binary, GLsizei length) { - CALL_GL_API(glShaderBinary, count, shaders, binaryformat, binary, length); +void API_ENTRY(glShaderBinary)(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) { + CALL_GL_API(glShaderBinary, n, shaders, binaryformat, binary, length); } -void API_ENTRY(glShaderSource)(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) { +void API_ENTRY(glShaderSource)(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { CALL_GL_API(glShaderSource, shader, count, string, length); } void API_ENTRY(glStencilFunc)(GLenum func, GLint ref, GLuint mask) { @@ -310,82 +310,82 @@ void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { CALL_GL_API(glStencilOp, fail, zfail, zpass); } -void API_ENTRY(glStencilOpSeparate)(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) { - CALL_GL_API(glStencilOpSeparate, face, sfail, dpfail, dppass); +void API_ENTRY(glStencilOpSeparate)(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { + CALL_GL_API(glStencilOpSeparate, face, fail, zfail, zpass); } -void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) { +void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, border, format, type, pixels); } void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) { CALL_GL_API(glTexParameterf, target, pname, param); } -void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { +void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat* params) { CALL_GL_API(glTexParameterfv, target, pname, params); } void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) { CALL_GL_API(glTexParameteri, target, pname, param); } -void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint * params) { +void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint* params) { CALL_GL_API(glTexParameteriv, target, pname, params); } -void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) { +void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) { CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels); } -void API_ENTRY(glUniform1f)(GLint location, GLfloat v0) { - CALL_GL_API(glUniform1f, location, v0); +void API_ENTRY(glUniform1f)(GLint location, GLfloat x) { + CALL_GL_API(glUniform1f, location, x); } -void API_ENTRY(glUniform1fv)(GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glUniform1fv, location, count, value); +void API_ENTRY(glUniform1fv)(GLint location, GLsizei count, const GLfloat* v) { + CALL_GL_API(glUniform1fv, location, count, v); } -void API_ENTRY(glUniform1i)(GLint location, GLint v0) { - CALL_GL_API(glUniform1i, location, v0); +void API_ENTRY(glUniform1i)(GLint location, GLint x) { + CALL_GL_API(glUniform1i, location, x); } -void API_ENTRY(glUniform1iv)(GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glUniform1iv, location, count, value); +void API_ENTRY(glUniform1iv)(GLint location, GLsizei count, const GLint* v) { + CALL_GL_API(glUniform1iv, location, count, v); } -void API_ENTRY(glUniform2f)(GLint location, GLfloat v0, GLfloat v1) { - CALL_GL_API(glUniform2f, location, v0, v1); +void API_ENTRY(glUniform2f)(GLint location, GLfloat x, GLfloat y) { + CALL_GL_API(glUniform2f, location, x, y); } -void API_ENTRY(glUniform2fv)(GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glUniform2fv, location, count, value); +void API_ENTRY(glUniform2fv)(GLint location, GLsizei count, const GLfloat* v) { + CALL_GL_API(glUniform2fv, location, count, v); } -void API_ENTRY(glUniform2i)(GLint location, GLint v0, GLint v1) { - CALL_GL_API(glUniform2i, location, v0, v1); +void API_ENTRY(glUniform2i)(GLint location, GLint x, GLint y) { + CALL_GL_API(glUniform2i, location, x, y); } -void API_ENTRY(glUniform2iv)(GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glUniform2iv, location, count, value); +void API_ENTRY(glUniform2iv)(GLint location, GLsizei count, const GLint* v) { + CALL_GL_API(glUniform2iv, location, count, v); } -void API_ENTRY(glUniform3f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { - CALL_GL_API(glUniform3f, location, v0, v1, v2); +void API_ENTRY(glUniform3f)(GLint location, GLfloat x, GLfloat y, GLfloat z) { + CALL_GL_API(glUniform3f, location, x, y, z); } -void API_ENTRY(glUniform3fv)(GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glUniform3fv, location, count, value); +void API_ENTRY(glUniform3fv)(GLint location, GLsizei count, const GLfloat* v) { + CALL_GL_API(glUniform3fv, location, count, v); } -void API_ENTRY(glUniform3i)(GLint location, GLint v0, GLint v1, GLint v2) { - CALL_GL_API(glUniform3i, location, v0, v1, v2); +void API_ENTRY(glUniform3i)(GLint location, GLint x, GLint y, GLint z) { + CALL_GL_API(glUniform3i, location, x, y, z); } -void API_ENTRY(glUniform3iv)(GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glUniform3iv, location, count, value); +void API_ENTRY(glUniform3iv)(GLint location, GLsizei count, const GLint* v) { + CALL_GL_API(glUniform3iv, location, count, v); } -void API_ENTRY(glUniform4f)(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { - CALL_GL_API(glUniform4f, location, v0, v1, v2, v3); +void API_ENTRY(glUniform4f)(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + CALL_GL_API(glUniform4f, location, x, y, z, w); } -void API_ENTRY(glUniform4fv)(GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glUniform4fv, location, count, value); +void API_ENTRY(glUniform4fv)(GLint location, GLsizei count, const GLfloat* v) { + CALL_GL_API(glUniform4fv, location, count, v); } -void API_ENTRY(glUniform4i)(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { - CALL_GL_API(glUniform4i, location, v0, v1, v2, v3); +void API_ENTRY(glUniform4i)(GLint location, GLint x, GLint y, GLint z, GLint w) { + CALL_GL_API(glUniform4i, location, x, y, z, w); } -void API_ENTRY(glUniform4iv)(GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glUniform4iv, location, count, value); +void API_ENTRY(glUniform4iv)(GLint location, GLsizei count, const GLint* v) { + CALL_GL_API(glUniform4iv, location, count, v); } -void API_ENTRY(glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void API_ENTRY(glUniformMatrix2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { CALL_GL_API(glUniformMatrix2fv, location, count, transpose, value); } -void API_ENTRY(glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void API_ENTRY(glUniformMatrix3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { CALL_GL_API(glUniformMatrix3fv, location, count, transpose, value); } -void API_ENTRY(glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void API_ENTRY(glUniformMatrix4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { CALL_GL_API(glUniformMatrix4fv, location, count, transpose, value); } void API_ENTRY(glUseProgram)(GLuint program) { @@ -394,549 +394,33 @@ void API_ENTRY(glValidateProgram)(GLuint program) { CALL_GL_API(glValidateProgram, program); } -void API_ENTRY(glVertexAttrib1f)(GLuint index, GLfloat x) { - CALL_GL_API(glVertexAttrib1f, index, x); +void API_ENTRY(glVertexAttrib1f)(GLuint indx, GLfloat x) { + CALL_GL_API(glVertexAttrib1f, indx, x); } -void API_ENTRY(glVertexAttrib1fv)(GLuint index, const GLfloat * v) { - CALL_GL_API(glVertexAttrib1fv, index, v); +void API_ENTRY(glVertexAttrib1fv)(GLuint indx, const GLfloat* values) { + CALL_GL_API(glVertexAttrib1fv, indx, values); } -void API_ENTRY(glVertexAttrib2f)(GLuint index, GLfloat x, GLfloat y) { - CALL_GL_API(glVertexAttrib2f, index, x, y); +void API_ENTRY(glVertexAttrib2f)(GLuint indx, GLfloat x, GLfloat y) { + CALL_GL_API(glVertexAttrib2f, indx, x, y); } -void API_ENTRY(glVertexAttrib2fv)(GLuint index, const GLfloat * v) { - CALL_GL_API(glVertexAttrib2fv, index, v); +void API_ENTRY(glVertexAttrib2fv)(GLuint indx, const GLfloat* values) { + CALL_GL_API(glVertexAttrib2fv, indx, values); } -void API_ENTRY(glVertexAttrib3f)(GLuint index, GLfloat x, GLfloat y, GLfloat z) { - CALL_GL_API(glVertexAttrib3f, index, x, y, z); +void API_ENTRY(glVertexAttrib3f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { + CALL_GL_API(glVertexAttrib3f, indx, x, y, z); } -void API_ENTRY(glVertexAttrib3fv)(GLuint index, const GLfloat * v) { - CALL_GL_API(glVertexAttrib3fv, index, v); +void API_ENTRY(glVertexAttrib3fv)(GLuint indx, const GLfloat* values) { + CALL_GL_API(glVertexAttrib3fv, indx, values); } -void API_ENTRY(glVertexAttrib4f)(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { - CALL_GL_API(glVertexAttrib4f, index, x, y, z, w); +void API_ENTRY(glVertexAttrib4f)(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + CALL_GL_API(glVertexAttrib4f, indx, x, y, z, w); } -void API_ENTRY(glVertexAttrib4fv)(GLuint index, const GLfloat * v) { - CALL_GL_API(glVertexAttrib4fv, index, v); +void API_ENTRY(glVertexAttrib4fv)(GLuint indx, const GLfloat* values) { + CALL_GL_API(glVertexAttrib4fv, indx, values); } -void API_ENTRY(glVertexAttribPointer)(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) { - CALL_GL_API(glVertexAttribPointer, index, size, type, normalized, stride, pointer); +void API_ENTRY(glVertexAttribPointer)(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) { + CALL_GL_API(glVertexAttribPointer, indx, size, type, normalized, stride, ptr); } void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) { CALL_GL_API(glViewport, x, y, width, height); } -void API_ENTRY(glReadBuffer)(GLenum mode) { - CALL_GL_API(glReadBuffer, mode); -} -void API_ENTRY(glDrawRangeElements)(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices) { - CALL_GL_API(glDrawRangeElements, mode, start, end, count, type, indices); -} -void API_ENTRY(glTexImage3D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) { - CALL_GL_API(glTexImage3D, target, level, internalformat, width, height, depth, border, format, type, pixels); -} -void API_ENTRY(glTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) { - CALL_GL_API(glTexSubImage3D, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); -} -void API_ENTRY(glCopyTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - CALL_GL_API(glCopyTexSubImage3D, target, level, xoffset, yoffset, zoffset, x, y, width, height); -} -void API_ENTRY(glCompressedTexImage3D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) { - CALL_GL_API(glCompressedTexImage3D, target, level, internalformat, width, height, depth, border, imageSize, data); -} -void API_ENTRY(glCompressedTexSubImage3D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) { - CALL_GL_API(glCompressedTexSubImage3D, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); -} -void API_ENTRY(glGenQueries)(GLsizei n, GLuint * ids) { - CALL_GL_API(glGenQueries, n, ids); -} -void API_ENTRY(glDeleteQueries)(GLsizei n, const GLuint * ids) { - CALL_GL_API(glDeleteQueries, n, ids); -} -GLboolean API_ENTRY(glIsQuery)(GLuint id) { - CALL_GL_API_RETURN(glIsQuery, id); -} -void API_ENTRY(glBeginQuery)(GLenum target, GLuint id) { - CALL_GL_API(glBeginQuery, target, id); -} -void API_ENTRY(glEndQuery)(GLenum target) { - CALL_GL_API(glEndQuery, target); -} -void API_ENTRY(glGetQueryiv)(GLenum target, GLenum pname, GLint * params) { - CALL_GL_API(glGetQueryiv, target, pname, params); -} -void API_ENTRY(glGetQueryObjectuiv)(GLuint id, GLenum pname, GLuint * params) { - CALL_GL_API(glGetQueryObjectuiv, id, pname, params); -} -GLboolean API_ENTRY(glUnmapBuffer)(GLenum target) { - CALL_GL_API_RETURN(glUnmapBuffer, target); -} -void API_ENTRY(glGetBufferPointerv)(GLenum target, GLenum pname, void ** params) { - CALL_GL_API(glGetBufferPointerv, target, pname, params); -} -void API_ENTRY(glDrawBuffers)(GLsizei n, const GLenum * bufs) { - CALL_GL_API(glDrawBuffers, n, bufs); -} -void API_ENTRY(glUniformMatrix2x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix2x3fv, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix3x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix3x2fv, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix2x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix2x4fv, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix4x2fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix4x2fv, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix3x4fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix3x4fv, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix4x3fv)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix4x3fv, location, count, transpose, value); -} -void API_ENTRY(glBlitFramebuffer)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - CALL_GL_API(glBlitFramebuffer, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); -} -void API_ENTRY(glRenderbufferStorageMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - CALL_GL_API(glRenderbufferStorageMultisample, target, samples, internalformat, width, height); -} -void API_ENTRY(glFramebufferTextureLayer)(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { - CALL_GL_API(glFramebufferTextureLayer, target, attachment, texture, level, layer); -} -void * API_ENTRY(glMapBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { - CALL_GL_API_RETURN(glMapBufferRange, target, offset, length, access); -} -void API_ENTRY(glFlushMappedBufferRange)(GLenum target, GLintptr offset, GLsizeiptr length) { - CALL_GL_API(glFlushMappedBufferRange, target, offset, length); -} -void API_ENTRY(glBindVertexArray)(GLuint array) { - CALL_GL_API(glBindVertexArray, array); -} -void API_ENTRY(glDeleteVertexArrays)(GLsizei n, const GLuint * arrays) { - CALL_GL_API(glDeleteVertexArrays, n, arrays); -} -void API_ENTRY(glGenVertexArrays)(GLsizei n, GLuint * arrays) { - CALL_GL_API(glGenVertexArrays, n, arrays); -} -GLboolean API_ENTRY(glIsVertexArray)(GLuint array) { - CALL_GL_API_RETURN(glIsVertexArray, array); -} -void API_ENTRY(glGetIntegeri_v)(GLenum target, GLuint index, GLint * data) { - CALL_GL_API(glGetIntegeri_v, target, index, data); -} -void API_ENTRY(glBeginTransformFeedback)(GLenum primitiveMode) { - CALL_GL_API(glBeginTransformFeedback, primitiveMode); -} -void API_ENTRY(glEndTransformFeedback)(void) { - CALL_GL_API(glEndTransformFeedback); -} -void API_ENTRY(glBindBufferRange)(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { - CALL_GL_API(glBindBufferRange, target, index, buffer, offset, size); -} -void API_ENTRY(glBindBufferBase)(GLenum target, GLuint index, GLuint buffer) { - CALL_GL_API(glBindBufferBase, target, index, buffer); -} -void API_ENTRY(glTransformFeedbackVaryings)(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode) { - CALL_GL_API(glTransformFeedbackVaryings, program, count, varyings, bufferMode); -} -void API_ENTRY(glGetTransformFeedbackVarying)(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) { - CALL_GL_API(glGetTransformFeedbackVarying, program, index, bufSize, length, size, type, name); -} -void API_ENTRY(glVertexAttribIPointer)(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) { - CALL_GL_API(glVertexAttribIPointer, index, size, type, stride, pointer); -} -void API_ENTRY(glGetVertexAttribIiv)(GLuint index, GLenum pname, GLint * params) { - CALL_GL_API(glGetVertexAttribIiv, index, pname, params); -} -void API_ENTRY(glGetVertexAttribIuiv)(GLuint index, GLenum pname, GLuint * params) { - CALL_GL_API(glGetVertexAttribIuiv, index, pname, params); -} -void API_ENTRY(glVertexAttribI4i)(GLuint index, GLint x, GLint y, GLint z, GLint w) { - CALL_GL_API(glVertexAttribI4i, index, x, y, z, w); -} -void API_ENTRY(glVertexAttribI4ui)(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { - CALL_GL_API(glVertexAttribI4ui, index, x, y, z, w); -} -void API_ENTRY(glVertexAttribI4iv)(GLuint index, const GLint * v) { - CALL_GL_API(glVertexAttribI4iv, index, v); -} -void API_ENTRY(glVertexAttribI4uiv)(GLuint index, const GLuint * v) { - CALL_GL_API(glVertexAttribI4uiv, index, v); -} -void API_ENTRY(glGetUniformuiv)(GLuint program, GLint location, GLuint * params) { - CALL_GL_API(glGetUniformuiv, program, location, params); -} -GLint API_ENTRY(glGetFragDataLocation)(GLuint program, const GLchar * name) { - CALL_GL_API_RETURN(glGetFragDataLocation, program, name); -} -void API_ENTRY(glUniform1ui)(GLint location, GLuint v0) { - CALL_GL_API(glUniform1ui, location, v0); -} -void API_ENTRY(glUniform2ui)(GLint location, GLuint v0, GLuint v1) { - CALL_GL_API(glUniform2ui, location, v0, v1); -} -void API_ENTRY(glUniform3ui)(GLint location, GLuint v0, GLuint v1, GLuint v2) { - CALL_GL_API(glUniform3ui, location, v0, v1, v2); -} -void API_ENTRY(glUniform4ui)(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { - CALL_GL_API(glUniform4ui, location, v0, v1, v2, v3); -} -void API_ENTRY(glUniform1uiv)(GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glUniform1uiv, location, count, value); -} -void API_ENTRY(glUniform2uiv)(GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glUniform2uiv, location, count, value); -} -void API_ENTRY(glUniform3uiv)(GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glUniform3uiv, location, count, value); -} -void API_ENTRY(glUniform4uiv)(GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glUniform4uiv, location, count, value); -} -void API_ENTRY(glClearBufferiv)(GLenum buffer, GLint drawbuffer, const GLint * value) { - CALL_GL_API(glClearBufferiv, buffer, drawbuffer, value); -} -void API_ENTRY(glClearBufferuiv)(GLenum buffer, GLint drawbuffer, const GLuint * value) { - CALL_GL_API(glClearBufferuiv, buffer, drawbuffer, value); -} -void API_ENTRY(glClearBufferfv)(GLenum buffer, GLint drawbuffer, const GLfloat * value) { - CALL_GL_API(glClearBufferfv, buffer, drawbuffer, value); -} -void API_ENTRY(glClearBufferfi)(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { - CALL_GL_API(glClearBufferfi, buffer, drawbuffer, depth, stencil); -} -const GLubyte * API_ENTRY(__glGetStringi)(GLenum name, GLuint index) { - CALL_GL_API_RETURN(glGetStringi, name, index); -} -void API_ENTRY(glCopyBufferSubData)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { - CALL_GL_API(glCopyBufferSubData, readTarget, writeTarget, readOffset, writeOffset, size); -} -void API_ENTRY(glGetUniformIndices)(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices) { - CALL_GL_API(glGetUniformIndices, program, uniformCount, uniformNames, uniformIndices); -} -void API_ENTRY(glGetActiveUniformsiv)(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params) { - CALL_GL_API(glGetActiveUniformsiv, program, uniformCount, uniformIndices, pname, params); -} -GLuint API_ENTRY(glGetUniformBlockIndex)(GLuint program, const GLchar * uniformBlockName) { - CALL_GL_API_RETURN(glGetUniformBlockIndex, program, uniformBlockName); -} -void API_ENTRY(glGetActiveUniformBlockiv)(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params) { - CALL_GL_API(glGetActiveUniformBlockiv, program, uniformBlockIndex, pname, params); -} -void API_ENTRY(glGetActiveUniformBlockName)(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName) { - CALL_GL_API(glGetActiveUniformBlockName, program, uniformBlockIndex, bufSize, length, uniformBlockName); -} -void API_ENTRY(glUniformBlockBinding)(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { - CALL_GL_API(glUniformBlockBinding, program, uniformBlockIndex, uniformBlockBinding); -} -void API_ENTRY(glDrawArraysInstanced)(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) { - CALL_GL_API(glDrawArraysInstanced, mode, first, count, instancecount); -} -void API_ENTRY(glDrawElementsInstanced)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount) { - CALL_GL_API(glDrawElementsInstanced, mode, count, type, indices, instancecount); -} -GLsync API_ENTRY(glFenceSync)(GLenum condition, GLbitfield flags) { - CALL_GL_API_RETURN(glFenceSync, condition, flags); -} -GLboolean API_ENTRY(glIsSync)(GLsync sync) { - CALL_GL_API_RETURN(glIsSync, sync); -} -void API_ENTRY(glDeleteSync)(GLsync sync) { - CALL_GL_API(glDeleteSync, sync); -} -GLenum API_ENTRY(glClientWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) { - CALL_GL_API_RETURN(glClientWaitSync, sync, flags, timeout); -} -void API_ENTRY(glWaitSync)(GLsync sync, GLbitfield flags, GLuint64 timeout) { - CALL_GL_API(glWaitSync, sync, flags, timeout); -} -void API_ENTRY(__glGetInteger64v)(GLenum pname, GLint64 * data) { - CALL_GL_API(glGetInteger64v, pname, data); -} -void API_ENTRY(glGetSynciv)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) { - CALL_GL_API(glGetSynciv, sync, pname, bufSize, length, values); -} -void API_ENTRY(glGetInteger64i_v)(GLenum target, GLuint index, GLint64 * data) { - CALL_GL_API(glGetInteger64i_v, target, index, data); -} -void API_ENTRY(glGetBufferParameteri64v)(GLenum target, GLenum pname, GLint64 * params) { - CALL_GL_API(glGetBufferParameteri64v, target, pname, params); -} -void API_ENTRY(glGenSamplers)(GLsizei count, GLuint * samplers) { - CALL_GL_API(glGenSamplers, count, samplers); -} -void API_ENTRY(glDeleteSamplers)(GLsizei count, const GLuint * samplers) { - CALL_GL_API(glDeleteSamplers, count, samplers); -} -GLboolean API_ENTRY(glIsSampler)(GLuint sampler) { - CALL_GL_API_RETURN(glIsSampler, sampler); -} -void API_ENTRY(glBindSampler)(GLuint unit, GLuint sampler) { - CALL_GL_API(glBindSampler, unit, sampler); -} -void API_ENTRY(glSamplerParameteri)(GLuint sampler, GLenum pname, GLint param) { - CALL_GL_API(glSamplerParameteri, sampler, pname, param); -} -void API_ENTRY(glSamplerParameteriv)(GLuint sampler, GLenum pname, const GLint * param) { - CALL_GL_API(glSamplerParameteriv, sampler, pname, param); -} -void API_ENTRY(glSamplerParameterf)(GLuint sampler, GLenum pname, GLfloat param) { - CALL_GL_API(glSamplerParameterf, sampler, pname, param); -} -void API_ENTRY(glSamplerParameterfv)(GLuint sampler, GLenum pname, const GLfloat * param) { - CALL_GL_API(glSamplerParameterfv, sampler, pname, param); -} -void API_ENTRY(glGetSamplerParameteriv)(GLuint sampler, GLenum pname, GLint * params) { - CALL_GL_API(glGetSamplerParameteriv, sampler, pname, params); -} -void API_ENTRY(glGetSamplerParameterfv)(GLuint sampler, GLenum pname, GLfloat * params) { - CALL_GL_API(glGetSamplerParameterfv, sampler, pname, params); -} -void API_ENTRY(glVertexAttribDivisor)(GLuint index, GLuint divisor) { - CALL_GL_API(glVertexAttribDivisor, index, divisor); -} -void API_ENTRY(glBindTransformFeedback)(GLenum target, GLuint id) { - CALL_GL_API(glBindTransformFeedback, target, id); -} -void API_ENTRY(glDeleteTransformFeedbacks)(GLsizei n, const GLuint * ids) { - CALL_GL_API(glDeleteTransformFeedbacks, n, ids); -} -void API_ENTRY(glGenTransformFeedbacks)(GLsizei n, GLuint * ids) { - CALL_GL_API(glGenTransformFeedbacks, n, ids); -} -GLboolean API_ENTRY(glIsTransformFeedback)(GLuint id) { - CALL_GL_API_RETURN(glIsTransformFeedback, id); -} -void API_ENTRY(glPauseTransformFeedback)(void) { - CALL_GL_API(glPauseTransformFeedback); -} -void API_ENTRY(glResumeTransformFeedback)(void) { - CALL_GL_API(glResumeTransformFeedback); -} -void API_ENTRY(glGetProgramBinary)(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) { - CALL_GL_API(glGetProgramBinary, program, bufSize, length, binaryFormat, binary); -} -void API_ENTRY(glProgramBinary)(GLuint program, GLenum binaryFormat, const void * binary, GLsizei length) { - CALL_GL_API(glProgramBinary, program, binaryFormat, binary, length); -} -void API_ENTRY(glProgramParameteri)(GLuint program, GLenum pname, GLint value) { - CALL_GL_API(glProgramParameteri, program, pname, value); -} -void API_ENTRY(glInvalidateFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum * attachments) { - CALL_GL_API(glInvalidateFramebuffer, target, numAttachments, attachments); -} -void API_ENTRY(glInvalidateSubFramebuffer)(GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height) { - CALL_GL_API(glInvalidateSubFramebuffer, target, numAttachments, attachments, x, y, width, height); -} -void API_ENTRY(glTexStorage2D)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { - CALL_GL_API(glTexStorage2D, target, levels, internalformat, width, height); -} -void API_ENTRY(glTexStorage3D)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { - CALL_GL_API(glTexStorage3D, target, levels, internalformat, width, height, depth); -} -void API_ENTRY(glGetInternalformativ)(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint * params) { - CALL_GL_API(glGetInternalformativ, target, internalformat, pname, bufSize, params); -} -void API_ENTRY(glDispatchCompute)(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) { - CALL_GL_API(glDispatchCompute, num_groups_x, num_groups_y, num_groups_z); -} -void API_ENTRY(glDispatchComputeIndirect)(GLintptr indirect) { - CALL_GL_API(glDispatchComputeIndirect, indirect); -} -void API_ENTRY(glDrawArraysIndirect)(GLenum mode, const void * indirect) { - CALL_GL_API(glDrawArraysIndirect, mode, indirect); -} -void API_ENTRY(glDrawElementsIndirect)(GLenum mode, GLenum type, const void * indirect) { - CALL_GL_API(glDrawElementsIndirect, mode, type, indirect); -} -void API_ENTRY(glFramebufferParameteri)(GLenum target, GLenum pname, GLint param) { - CALL_GL_API(glFramebufferParameteri, target, pname, param); -} -void API_ENTRY(glGetFramebufferParameteriv)(GLenum target, GLenum pname, GLint * params) { - CALL_GL_API(glGetFramebufferParameteriv, target, pname, params); -} -void API_ENTRY(glGetProgramInterfaceiv)(GLuint program, GLenum programInterface, GLenum pname, GLint * params) { - CALL_GL_API(glGetProgramInterfaceiv, program, programInterface, pname, params); -} -GLuint API_ENTRY(glGetProgramResourceIndex)(GLuint program, GLenum programInterface, const GLchar * name) { - CALL_GL_API_RETURN(glGetProgramResourceIndex, program, programInterface, name); -} -void API_ENTRY(glGetProgramResourceName)(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) { - CALL_GL_API(glGetProgramResourceName, program, programInterface, index, bufSize, length, name); -} -void API_ENTRY(glGetProgramResourceiv)(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params) { - CALL_GL_API(glGetProgramResourceiv, program, programInterface, index, propCount, props, bufSize, length, params); -} -GLint API_ENTRY(glGetProgramResourceLocation)(GLuint program, GLenum programInterface, const GLchar * name) { - CALL_GL_API_RETURN(glGetProgramResourceLocation, program, programInterface, name); -} -void API_ENTRY(glUseProgramStages)(GLuint pipeline, GLbitfield stages, GLuint program) { - CALL_GL_API(glUseProgramStages, pipeline, stages, program); -} -void API_ENTRY(glActiveShaderProgram)(GLuint pipeline, GLuint program) { - CALL_GL_API(glActiveShaderProgram, pipeline, program); -} -GLuint API_ENTRY(glCreateShaderProgramv)(GLenum type, GLsizei count, const GLchar *const* strings) { - CALL_GL_API_RETURN(glCreateShaderProgramv, type, count, strings); -} -void API_ENTRY(glBindProgramPipeline)(GLuint pipeline) { - CALL_GL_API(glBindProgramPipeline, pipeline); -} -void API_ENTRY(glDeleteProgramPipelines)(GLsizei n, const GLuint * pipelines) { - CALL_GL_API(glDeleteProgramPipelines, n, pipelines); -} -void API_ENTRY(glGenProgramPipelines)(GLsizei n, GLuint * pipelines) { - CALL_GL_API(glGenProgramPipelines, n, pipelines); -} -GLboolean API_ENTRY(glIsProgramPipeline)(GLuint pipeline) { - CALL_GL_API_RETURN(glIsProgramPipeline, pipeline); -} -void API_ENTRY(glGetProgramPipelineiv)(GLuint pipeline, GLenum pname, GLint * params) { - CALL_GL_API(glGetProgramPipelineiv, pipeline, pname, params); -} -void API_ENTRY(glProgramUniform1i)(GLuint program, GLint location, GLint v0) { - CALL_GL_API(glProgramUniform1i, program, location, v0); -} -void API_ENTRY(glProgramUniform2i)(GLuint program, GLint location, GLint v0, GLint v1) { - CALL_GL_API(glProgramUniform2i, program, location, v0, v1); -} -void API_ENTRY(glProgramUniform3i)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) { - CALL_GL_API(glProgramUniform3i, program, location, v0, v1, v2); -} -void API_ENTRY(glProgramUniform4i)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { - CALL_GL_API(glProgramUniform4i, program, location, v0, v1, v2, v3); -} -void API_ENTRY(glProgramUniform1ui)(GLuint program, GLint location, GLuint v0) { - CALL_GL_API(glProgramUniform1ui, program, location, v0); -} -void API_ENTRY(glProgramUniform2ui)(GLuint program, GLint location, GLuint v0, GLuint v1) { - CALL_GL_API(glProgramUniform2ui, program, location, v0, v1); -} -void API_ENTRY(glProgramUniform3ui)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) { - CALL_GL_API(glProgramUniform3ui, program, location, v0, v1, v2); -} -void API_ENTRY(glProgramUniform4ui)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { - CALL_GL_API(glProgramUniform4ui, program, location, v0, v1, v2, v3); -} -void API_ENTRY(glProgramUniform1f)(GLuint program, GLint location, GLfloat v0) { - CALL_GL_API(glProgramUniform1f, program, location, v0); -} -void API_ENTRY(glProgramUniform2f)(GLuint program, GLint location, GLfloat v0, GLfloat v1) { - CALL_GL_API(glProgramUniform2f, program, location, v0, v1); -} -void API_ENTRY(glProgramUniform3f)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { - CALL_GL_API(glProgramUniform3f, program, location, v0, v1, v2); -} -void API_ENTRY(glProgramUniform4f)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { - CALL_GL_API(glProgramUniform4f, program, location, v0, v1, v2, v3); -} -void API_ENTRY(glProgramUniform1iv)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform1iv, program, location, count, value); -} -void API_ENTRY(glProgramUniform2iv)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform2iv, program, location, count, value); -} -void API_ENTRY(glProgramUniform3iv)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform3iv, program, location, count, value); -} -void API_ENTRY(glProgramUniform4iv)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform4iv, program, location, count, value); -} -void API_ENTRY(glProgramUniform1uiv)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform1uiv, program, location, count, value); -} -void API_ENTRY(glProgramUniform2uiv)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform2uiv, program, location, count, value); -} -void API_ENTRY(glProgramUniform3uiv)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform3uiv, program, location, count, value); -} -void API_ENTRY(glProgramUniform4uiv)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform4uiv, program, location, count, value); -} -void API_ENTRY(glProgramUniform1fv)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform1fv, program, location, count, value); -} -void API_ENTRY(glProgramUniform2fv)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform2fv, program, location, count, value); -} -void API_ENTRY(glProgramUniform3fv)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform3fv, program, location, count, value); -} -void API_ENTRY(glProgramUniform4fv)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform4fv, program, location, count, value); -} -void API_ENTRY(glProgramUniformMatrix2fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix2fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix3fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix3fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix4fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix4fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix2x3fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix2x3fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix3x2fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix3x2fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix2x4fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix2x4fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix4x2fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix4x2fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix3x4fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix3x4fv, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix4x3fv)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix4x3fv, program, location, count, transpose, value); -} -void API_ENTRY(glValidateProgramPipeline)(GLuint pipeline) { - CALL_GL_API(glValidateProgramPipeline, pipeline); -} -void API_ENTRY(glGetProgramPipelineInfoLog)(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { - CALL_GL_API(glGetProgramPipelineInfoLog, pipeline, bufSize, length, infoLog); -} -void API_ENTRY(glBindImageTexture)(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) { - CALL_GL_API(glBindImageTexture, unit, texture, level, layered, layer, access, format); -} -void API_ENTRY(glGetBooleani_v)(GLenum target, GLuint index, GLboolean * data) { - CALL_GL_API(glGetBooleani_v, target, index, data); -} -void API_ENTRY(glMemoryBarrier)(GLbitfield barriers) { - CALL_GL_API(glMemoryBarrier, barriers); -} -void API_ENTRY(glMemoryBarrierByRegion)(GLbitfield barriers) { - CALL_GL_API(glMemoryBarrierByRegion, barriers); -} -void API_ENTRY(glTexStorage2DMultisample)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { - CALL_GL_API(glTexStorage2DMultisample, target, samples, internalformat, width, height, fixedsamplelocations); -} -void API_ENTRY(glGetMultisamplefv)(GLenum pname, GLuint index, GLfloat * val) { - CALL_GL_API(glGetMultisamplefv, pname, index, val); -} -void API_ENTRY(glSampleMaski)(GLuint maskNumber, GLbitfield mask) { - CALL_GL_API(glSampleMaski, maskNumber, mask); -} -void API_ENTRY(glGetTexLevelParameteriv)(GLenum target, GLint level, GLenum pname, GLint * params) { - CALL_GL_API(glGetTexLevelParameteriv, target, level, pname, params); -} -void API_ENTRY(glGetTexLevelParameterfv)(GLenum target, GLint level, GLenum pname, GLfloat * params) { - CALL_GL_API(glGetTexLevelParameterfv, target, level, pname, params); -} -void API_ENTRY(glBindVertexBuffer)(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) { - CALL_GL_API(glBindVertexBuffer, bindingindex, buffer, offset, stride); -} -void API_ENTRY(glVertexAttribFormat)(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) { - CALL_GL_API(glVertexAttribFormat, attribindex, size, type, normalized, relativeoffset); -} -void API_ENTRY(glVertexAttribIFormat)(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { - CALL_GL_API(glVertexAttribIFormat, attribindex, size, type, relativeoffset); -} -void API_ENTRY(glVertexAttribBinding)(GLuint attribindex, GLuint bindingindex) { - CALL_GL_API(glVertexAttribBinding, attribindex, bindingindex); -} -void API_ENTRY(glVertexBindingDivisor)(GLuint bindingindex, GLuint divisor) { - CALL_GL_API(glVertexBindingDivisor, bindingindex, divisor); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES2/gl2.cpp android-platform-frameworks-native-21/opengl/libs/GLES2/gl2.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES2/gl2.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES2/gl2.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -20,11 +20,14 @@ #include +#include +#include + #include #include -#include "../hooks.h" -#include "../egl_impl.h" +#include "hooks.h" +#include "egl_impl.h" using namespace android; @@ -36,19 +39,20 @@ #undef CALL_GL_API #undef CALL_GL_API_RETURN -#if USE_SLOW_BINDING - - #define API_ENTRY(_api) _api - - #define CALL_GL_API(_api, ...) \ - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ - if (_c) return _c->_api(__VA_ARGS__); +#define DEBUG_CALL_GL_API 0 -#elif defined(__arm__) +#if USE_FAST_TLS_KEY - #define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n" + #ifdef HAVE_ARM_TLS_REGISTER + #define GET_TLS(reg) \ + "mrc p15, 0, " #reg ", c13, c0, 3 \n" + #else + #define GET_TLS(reg) \ + "mov " #reg ", #0xFFFF0FFF \n" \ + "ldr " #reg ", [" #reg ", #-15] \n" + #endif - #define API_ENTRY(_api) __attribute__((noinline)) _api + #define API_ENTRY(_api) __attribute__((naked)) _api #define CALL_GL_API(_api, ...) \ asm volatile( \ @@ -56,148 +60,50 @@ "ldr r12, [r12, %[tls]] \n" \ "cmp r12, #0 \n" \ "ldrne pc, [r12, %[api]] \n" \ + "mov r0, #0 \n" \ + "bx lr \n" \ : \ : [tls] "J"(TLS_SLOT_OPENGL_API*4), \ [api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "r12" \ + : \ ); -#elif defined(__aarch64__) - - #define API_ENTRY(_api) __attribute__((noinline)) _api + #define CALL_GL_API_RETURN(_api, ...) \ + CALL_GL_API(_api, __VA_ARGS__) \ + return 0; // placate gcc's warnings. never reached. - #define CALL_GL_API(_api, ...) \ - asm volatile( \ - "mrs x16, tpidr_el0\n" \ - "ldr x16, [x16, %[tls]]\n" \ - "cbz x16, 1f\n" \ - "ldr x16, [x16, %[api]]\n" \ - "br x16\n" \ - "1:\n" \ - : \ - : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "x16" \ - ); - -#elif defined(__i386__) - - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api - - #define CALL_GL_API(_api, ...) \ - register void** fn; \ - __asm__ volatile( \ - "mov %%gs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "je 1f\n" \ - "jmp *%P[api](%[fn])\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ - : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "cc" \ - ); - -#elif defined(__x86_64__) +#else - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api + #define API_ENTRY(_api) _api - #define CALL_GL_API(_api, ...) \ - register void** fn; \ - __asm__ volatile( \ - "mov %%fs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "je 1f\n" \ - "jmp *%P[api](%[fn])\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ - : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "cc" \ - ); +#if DEBUG_CALL_GL_API -#elif defined(__mips64) + #define CALL_GL_API(_api, ...) \ + gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ + _c->_api(__VA_ARGS__); \ + GLenum status = GL_NO_ERROR; \ + while ((status = glGetError()) != GL_NO_ERROR) { \ + ALOGD("[" #_api "] 0x%x", status); \ + } - #define API_ENTRY(_api) __attribute__((noinline)) _api +#else - #define CALL_GL_API(_api, ...) \ - register unsigned long _t0 asm("$12"); \ - register unsigned long _fn asm("$25"); \ - register unsigned long _tls asm("$3"); \ - register unsigned long _v0 asm("$2"); \ - asm volatile( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - "rdhwr %[tls], $29\n\t" \ - "ld %[t0], %[OPENGL_API](%[tls])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " move %[fn], $ra\n\t" \ - "ld %[t0], %[API](%[t0])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " nop\n\t" \ - "move %[fn], %[t0]\n\t" \ - "1:\n\t" \ - "jalr $0, %[fn]\n\t" \ - " move %[v0], $0\n\t" \ - ".set pop\n\t" \ - : [fn] "=c"(_fn), \ - [tls] "=&r"(_tls), \ - [t0] "=&r"(_t0), \ - [v0] "=&r"(_v0) \ - : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*sizeof(void*)),\ - [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : \ - ); - -#elif defined(__mips__) - - #define API_ENTRY(_api) __attribute__((noinline)) _api - - #define CALL_GL_API(_api, ...) \ - register unsigned int _t0 asm("$8"); \ - register unsigned int _fn asm("$25"); \ - register unsigned int _tls asm("$3"); \ - register unsigned int _v0 asm("$2"); \ - asm volatile( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - ".set mips32r2\n\t" \ - "rdhwr %[tls], $29\n\t" \ - "lw %[t0], %[OPENGL_API](%[tls])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " move %[fn],$ra\n\t" \ - "lw %[t0], %[API](%[t0])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " nop\n\t" \ - "move %[fn], %[t0]\n\t" \ - "1:\n\t" \ - "jalr $0, %[fn]\n\t" \ - " move %[v0], $0\n\t" \ - ".set pop\n\t" \ - : [fn] "=c"(_fn), \ - [tls] "=&r"(_tls), \ - [t0] "=&r"(_t0), \ - [v0] "=&r"(_v0) \ - : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*4), \ - [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : \ - ); + #define CALL_GL_API(_api, ...) \ + gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ + _c->_api(__VA_ARGS__); #endif -#define CALL_GL_API_RETURN(_api, ...) \ - CALL_GL_API(_api, __VA_ARGS__) \ - return 0; + #define CALL_GL_API_RETURN(_api, ...) \ + gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ + return _c->_api(__VA_ARGS__) +#endif extern "C" { -#pragma GCC diagnostic ignored "-Wunused-parameter" #include "gl2_api.in" #include "gl2ext_api.in" -#pragma GCC diagnostic warning "-Wunused-parameter" } #undef API_ENTRY @@ -205,87 +111,16 @@ #undef CALL_GL_API_RETURN /* - * glGetString() and glGetStringi() are special because we expose some - * extensions in the wrapper. Also, wrapping glGetXXX() is required because - * the value returned for GL_NUM_EXTENSIONS may have been altered by the - * injection of the additional extensions. + * glGetString() is special because we expose some extensions in the wrapper */ -extern "C" { - const GLubyte * __glGetString(GLenum name); - const GLubyte * __glGetStringi(GLenum name, GLuint index); - void __glGetBooleanv(GLenum pname, GLboolean * data); - void __glGetFloatv(GLenum pname, GLfloat * data); - void __glGetIntegerv(GLenum pname, GLint * data); - void __glGetInteger64v(GLenum pname, GLint64 * data); -} +extern "C" const GLubyte * __glGetString(GLenum name); -const GLubyte * glGetString(GLenum name) { +const GLubyte * glGetString(GLenum name) +{ const GLubyte * ret = egl_get_string_for_current_context(name); if (ret == NULL) { - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - if(_c) ret = _c->glGetString(name); - } - return ret; -} - -const GLubyte * glGetStringi(GLenum name, GLuint index) { - const GLubyte * ret = egl_get_string_for_current_context(name, index); - if (ret == NULL) { - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - if(_c) ret = _c->glGetStringi(name, index); + ret = __glGetString(name); } return ret; } - -void glGetBooleanv(GLenum pname, GLboolean * data) { - if (pname == GL_NUM_EXTENSIONS) { - int num_exts = egl_get_num_extensions_for_current_context(); - if (num_exts >= 0) { - *data = num_exts > 0 ? GL_TRUE : GL_FALSE; - return; - } - } - - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - if (_c) _c->glGetBooleanv(pname, data); -} - -void glGetFloatv(GLenum pname, GLfloat * data) { - if (pname == GL_NUM_EXTENSIONS) { - int num_exts = egl_get_num_extensions_for_current_context(); - if (num_exts >= 0) { - *data = (GLfloat)num_exts; - return; - } - } - - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - if (_c) _c->glGetFloatv(pname, data); -} - -void glGetIntegerv(GLenum pname, GLint * data) { - if (pname == GL_NUM_EXTENSIONS) { - int num_exts = egl_get_num_extensions_for_current_context(); - if (num_exts >= 0) { - *data = (GLint)num_exts; - return; - } - } - - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - if (_c) _c->glGetIntegerv(pname, data); -} - -void glGetInteger64v(GLenum pname, GLint64 * data) { - if (pname == GL_NUM_EXTENSIONS) { - int num_exts = egl_get_num_extensions_for_current_context(); - if (num_exts >= 0) { - *data = (GLint64)num_exts; - return; - } - } - - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - if (_c) _c->glGetInteger64v(pname, data); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES2/gl2ext_api.in android-platform-frameworks-native-21/opengl/libs/GLES2/gl2ext_api.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES2/gl2ext_api.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES2/gl2ext_api.in 2012-10-16 22:57:11.000000000 +0000 @@ -1,119 +1,77 @@ -void API_ENTRY(glBlendBarrierKHR)(void) { - CALL_GL_API(glBlendBarrierKHR); -} -void API_ENTRY(glDebugMessageControlKHR)(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled) { - CALL_GL_API(glDebugMessageControlKHR, source, type, severity, count, ids, enabled); -} -void API_ENTRY(glDebugMessageInsertKHR)(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf) { - CALL_GL_API(glDebugMessageInsertKHR, source, type, id, severity, length, buf); -} -void API_ENTRY(glDebugMessageCallbackKHR)(GLDEBUGPROCKHR callback, const void * userParam) { - CALL_GL_API(glDebugMessageCallbackKHR, callback, userParam); -} -GLuint API_ENTRY(glGetDebugMessageLogKHR)(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog) { - CALL_GL_API_RETURN(glGetDebugMessageLogKHR, count, bufSize, sources, types, ids, severities, lengths, messageLog); -} -void API_ENTRY(glPushDebugGroupKHR)(GLenum source, GLuint id, GLsizei length, const GLchar * message) { - CALL_GL_API(glPushDebugGroupKHR, source, id, length, message); -} -void API_ENTRY(glPopDebugGroupKHR)(void) { - CALL_GL_API(glPopDebugGroupKHR); -} -void API_ENTRY(glObjectLabelKHR)(GLenum identifier, GLuint name, GLsizei length, const GLchar * label) { - CALL_GL_API(glObjectLabelKHR, identifier, name, length, label); -} -void API_ENTRY(glGetObjectLabelKHR)(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label) { - CALL_GL_API(glGetObjectLabelKHR, identifier, name, bufSize, length, label); -} -void API_ENTRY(glObjectPtrLabelKHR)(const void * ptr, GLsizei length, const GLchar * label) { - CALL_GL_API(glObjectPtrLabelKHR, ptr, length, label); -} -void API_ENTRY(glGetObjectPtrLabelKHR)(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label) { - CALL_GL_API(glGetObjectPtrLabelKHR, ptr, bufSize, length, label); -} -void API_ENTRY(glGetPointervKHR)(GLenum pname, void ** params) { - CALL_GL_API(glGetPointervKHR, pname, params); -} void API_ENTRY(glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) { CALL_GL_API(glEGLImageTargetTexture2DOES, target, image); } void API_ENTRY(glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) { CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image); } -void API_ENTRY(glGetProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) { +void API_ENTRY(glGetProgramBinaryOES)(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) { CALL_GL_API(glGetProgramBinaryOES, program, bufSize, length, binaryFormat, binary); } -void API_ENTRY(glProgramBinaryOES)(GLuint program, GLenum binaryFormat, const void * binary, GLint length) { +void API_ENTRY(glProgramBinaryOES)(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) { CALL_GL_API(glProgramBinaryOES, program, binaryFormat, binary, length); } -void * API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) { +void* API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) { CALL_GL_API_RETURN(glMapBufferOES, target, access); } GLboolean API_ENTRY(glUnmapBufferOES)(GLenum target) { CALL_GL_API_RETURN(glUnmapBufferOES, target); } -void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, void ** params) { +void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, GLvoid** params) { CALL_GL_API(glGetBufferPointervOES, target, pname, params); } -void API_ENTRY(glMinSampleShadingOES)(GLfloat value) { - CALL_GL_API(glMinSampleShadingOES, value); -} -void API_ENTRY(glTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) { +void API_ENTRY(glTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { CALL_GL_API(glTexImage3DOES, target, level, internalformat, width, height, depth, border, format, type, pixels); } -void API_ENTRY(glTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) { +void API_ENTRY(glTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) { CALL_GL_API(glTexSubImage3DOES, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); } void API_ENTRY(glCopyTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { CALL_GL_API(glCopyTexSubImage3DOES, target, level, xoffset, yoffset, zoffset, x, y, width, height); } -void API_ENTRY(glCompressedTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) { +void API_ENTRY(glCompressedTexImage3DOES)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) { CALL_GL_API(glCompressedTexImage3DOES, target, level, internalformat, width, height, depth, border, imageSize, data); } -void API_ENTRY(glCompressedTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) { +void API_ENTRY(glCompressedTexSubImage3DOES)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) { CALL_GL_API(glCompressedTexSubImage3DOES, target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); } void API_ENTRY(glFramebufferTexture3DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { CALL_GL_API(glFramebufferTexture3DOES, target, attachment, textarget, texture, level, zoffset); } -void API_ENTRY(glTexStorage3DMultisampleOES)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { - CALL_GL_API(glTexStorage3DMultisampleOES, target, samples, internalformat, width, height, depth, fixedsamplelocations); -} void API_ENTRY(glBindVertexArrayOES)(GLuint array) { CALL_GL_API(glBindVertexArrayOES, array); } -void API_ENTRY(glDeleteVertexArraysOES)(GLsizei n, const GLuint * arrays) { +void API_ENTRY(glDeleteVertexArraysOES)(GLsizei n, const GLuint *arrays) { CALL_GL_API(glDeleteVertexArraysOES, n, arrays); } -void API_ENTRY(glGenVertexArraysOES)(GLsizei n, GLuint * arrays) { +void API_ENTRY(glGenVertexArraysOES)(GLsizei n, GLuint *arrays) { CALL_GL_API(glGenVertexArraysOES, n, arrays); } GLboolean API_ENTRY(glIsVertexArrayOES)(GLuint array) { CALL_GL_API_RETURN(glIsVertexArrayOES, array); } -void API_ENTRY(glGetPerfMonitorGroupsAMD)(GLint * numGroups, GLsizei groupsSize, GLuint * groups) { +void API_ENTRY(glGetPerfMonitorGroupsAMD)(GLint *numGroups, GLsizei groupsSize, GLuint *groups) { CALL_GL_API(glGetPerfMonitorGroupsAMD, numGroups, groupsSize, groups); } -void API_ENTRY(glGetPerfMonitorCountersAMD)(GLuint group, GLint * numCounters, GLint * maxActiveCounters, GLsizei counterSize, GLuint * counters) { +void API_ENTRY(glGetPerfMonitorCountersAMD)(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) { CALL_GL_API(glGetPerfMonitorCountersAMD, group, numCounters, maxActiveCounters, counterSize, counters); } -void API_ENTRY(glGetPerfMonitorGroupStringAMD)(GLuint group, GLsizei bufSize, GLsizei * length, GLchar * groupString) { +void API_ENTRY(glGetPerfMonitorGroupStringAMD)(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) { CALL_GL_API(glGetPerfMonitorGroupStringAMD, group, bufSize, length, groupString); } -void API_ENTRY(glGetPerfMonitorCounterStringAMD)(GLuint group, GLuint counter, GLsizei bufSize, GLsizei * length, GLchar * counterString) { +void API_ENTRY(glGetPerfMonitorCounterStringAMD)(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) { CALL_GL_API(glGetPerfMonitorCounterStringAMD, group, counter, bufSize, length, counterString); } -void API_ENTRY(glGetPerfMonitorCounterInfoAMD)(GLuint group, GLuint counter, GLenum pname, void * data) { +void API_ENTRY(glGetPerfMonitorCounterInfoAMD)(GLuint group, GLuint counter, GLenum pname, GLvoid *data) { CALL_GL_API(glGetPerfMonitorCounterInfoAMD, group, counter, pname, data); } -void API_ENTRY(glGenPerfMonitorsAMD)(GLsizei n, GLuint * monitors) { +void API_ENTRY(glGenPerfMonitorsAMD)(GLsizei n, GLuint *monitors) { CALL_GL_API(glGenPerfMonitorsAMD, n, monitors); } -void API_ENTRY(glDeletePerfMonitorsAMD)(GLsizei n, GLuint * monitors) { +void API_ENTRY(glDeletePerfMonitorsAMD)(GLsizei n, GLuint *monitors) { CALL_GL_API(glDeletePerfMonitorsAMD, n, monitors); } -void API_ENTRY(glSelectPerfMonitorCountersAMD)(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint * counterList) { - CALL_GL_API(glSelectPerfMonitorCountersAMD, monitor, enable, group, numCounters, counterList); +void API_ENTRY(glSelectPerfMonitorCountersAMD)(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) { + CALL_GL_API(glSelectPerfMonitorCountersAMD, monitor, enable, group, numCounters, countersList); } void API_ENTRY(glBeginPerfMonitorAMD)(GLuint monitor) { CALL_GL_API(glBeginPerfMonitorAMD, monitor); @@ -121,7 +79,7 @@ void API_ENTRY(glEndPerfMonitorAMD)(GLuint monitor) { CALL_GL_API(glEndPerfMonitorAMD, monitor); } -void API_ENTRY(glGetPerfMonitorCounterDataAMD)(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint * data, GLint * bytesWritten) { +void API_ENTRY(glGetPerfMonitorCounterDataAMD)(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) { CALL_GL_API(glGetPerfMonitorCounterDataAMD, monitor, pname, dataSize, data, bytesWritten); } void API_ENTRY(glBlitFramebufferANGLE)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { @@ -130,73 +88,46 @@ void API_ENTRY(glRenderbufferStorageMultisampleANGLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageMultisampleANGLE, target, samples, internalformat, width, height); } -void API_ENTRY(glDrawArraysInstancedANGLE)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { - CALL_GL_API(glDrawArraysInstancedANGLE, mode, first, count, primcount); -} -void API_ENTRY(glDrawElementsInstancedANGLE)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) { - CALL_GL_API(glDrawElementsInstancedANGLE, mode, count, type, indices, primcount); -} -void API_ENTRY(glVertexAttribDivisorANGLE)(GLuint index, GLuint divisor) { - CALL_GL_API(glVertexAttribDivisorANGLE, index, divisor); -} -void API_ENTRY(glGetTranslatedShaderSourceANGLE)(GLuint shader, GLsizei bufsize, GLsizei * length, GLchar * source) { - CALL_GL_API(glGetTranslatedShaderSourceANGLE, shader, bufsize, length, source); -} -void API_ENTRY(glCopyTextureLevelsAPPLE)(GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount) { - CALL_GL_API(glCopyTextureLevelsAPPLE, destinationTexture, sourceTexture, sourceBaseLevel, sourceLevelCount); -} void API_ENTRY(glRenderbufferStorageMultisampleAPPLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageMultisampleAPPLE, target, samples, internalformat, width, height); } void API_ENTRY(glResolveMultisampleFramebufferAPPLE)(void) { CALL_GL_API(glResolveMultisampleFramebufferAPPLE); } -GLsync API_ENTRY(glFenceSyncAPPLE)(GLenum condition, GLbitfield flags) { - CALL_GL_API_RETURN(glFenceSyncAPPLE, condition, flags); -} -GLboolean API_ENTRY(glIsSyncAPPLE)(GLsync sync) { - CALL_GL_API_RETURN(glIsSyncAPPLE, sync); -} -void API_ENTRY(glDeleteSyncAPPLE)(GLsync sync) { - CALL_GL_API(glDeleteSyncAPPLE, sync); -} -GLenum API_ENTRY(glClientWaitSyncAPPLE)(GLsync sync, GLbitfield flags, GLuint64 timeout) { - CALL_GL_API_RETURN(glClientWaitSyncAPPLE, sync, flags, timeout); -} -void API_ENTRY(glWaitSyncAPPLE)(GLsync sync, GLbitfield flags, GLuint64 timeout) { - CALL_GL_API(glWaitSyncAPPLE, sync, flags, timeout); -} -void API_ENTRY(glGetInteger64vAPPLE)(GLenum pname, GLint64 * params) { - CALL_GL_API(glGetInteger64vAPPLE, pname, params); -} -void API_ENTRY(glGetSyncivAPPLE)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) { - CALL_GL_API(glGetSyncivAPPLE, sync, pname, bufSize, length, values); -} -void API_ENTRY(glCopyImageSubDataEXT)(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) { - CALL_GL_API(glCopyImageSubDataEXT, srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth); -} -void API_ENTRY(glLabelObjectEXT)(GLenum type, GLuint object, GLsizei length, const GLchar * label) { +void API_ENTRY(glLabelObjectEXT)(GLenum type, GLuint object, GLsizei length, const GLchar *label) { CALL_GL_API(glLabelObjectEXT, type, object, length, label); } -void API_ENTRY(glGetObjectLabelEXT)(GLenum type, GLuint object, GLsizei bufSize, GLsizei * length, GLchar * label) { +void API_ENTRY(glGetObjectLabelEXT)(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label) { CALL_GL_API(glGetObjectLabelEXT, type, object, bufSize, length, label); } -void API_ENTRY(glInsertEventMarkerEXT)(GLsizei length, const GLchar * marker) { +void API_ENTRY(glInsertEventMarkerEXT)(GLsizei length, const GLchar *marker) { CALL_GL_API(glInsertEventMarkerEXT, length, marker); } -void API_ENTRY(glPushGroupMarkerEXT)(GLsizei length, const GLchar * marker) { +void API_ENTRY(glPushGroupMarkerEXT)(GLsizei length, const GLchar *marker) { CALL_GL_API(glPushGroupMarkerEXT, length, marker); } void API_ENTRY(glPopGroupMarkerEXT)(void) { CALL_GL_API(glPopGroupMarkerEXT); } -void API_ENTRY(glDiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum * attachments) { +void API_ENTRY(glDiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum *attachments) { CALL_GL_API(glDiscardFramebufferEXT, target, numAttachments, attachments); } -void API_ENTRY(glGenQueriesEXT)(GLsizei n, GLuint * ids) { +void API_ENTRY(glRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { + CALL_GL_API(glRenderbufferStorageMultisampleEXT, target, samples, internalformat, width, height); +} +void API_ENTRY(glFramebufferTexture2DMultisampleEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { + CALL_GL_API(glFramebufferTexture2DMultisampleEXT, target, attachment, textarget, texture, level, samples); +} +void API_ENTRY(glMultiDrawArraysEXT)(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) { + CALL_GL_API(glMultiDrawArraysEXT, mode, first, count, primcount); +} +void API_ENTRY(glMultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) { + CALL_GL_API(glMultiDrawElementsEXT, mode, count, type, indices, primcount); +} +void API_ENTRY(glGenQueriesEXT)(GLsizei n, GLuint *ids) { CALL_GL_API(glGenQueriesEXT, n, ids); } -void API_ENTRY(glDeleteQueriesEXT)(GLsizei n, const GLuint * ids) { +void API_ENTRY(glDeleteQueriesEXT)(GLsizei n, const GLuint *ids) { CALL_GL_API(glDeleteQueriesEXT, n, ids); } GLboolean API_ENTRY(glIsQueryEXT)(GLuint id) { @@ -208,269 +139,113 @@ void API_ENTRY(glEndQueryEXT)(GLenum target) { CALL_GL_API(glEndQueryEXT, target); } -void API_ENTRY(glQueryCounterEXT)(GLuint id, GLenum target) { - CALL_GL_API(glQueryCounterEXT, id, target); -} -void API_ENTRY(glGetQueryivEXT)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetQueryivEXT)(GLenum target, GLenum pname, GLint *params) { CALL_GL_API(glGetQueryivEXT, target, pname, params); } -void API_ENTRY(glGetQueryObjectivEXT)(GLuint id, GLenum pname, GLint * params) { - CALL_GL_API(glGetQueryObjectivEXT, id, pname, params); -} -void API_ENTRY(glGetQueryObjectuivEXT)(GLuint id, GLenum pname, GLuint * params) { +void API_ENTRY(glGetQueryObjectuivEXT)(GLuint id, GLenum pname, GLuint *params) { CALL_GL_API(glGetQueryObjectuivEXT, id, pname, params); } -void API_ENTRY(glGetQueryObjecti64vEXT)(GLuint id, GLenum pname, GLint64 * params) { - CALL_GL_API(glGetQueryObjecti64vEXT, id, pname, params); -} -void API_ENTRY(glGetQueryObjectui64vEXT)(GLuint id, GLenum pname, GLuint64 * params) { - CALL_GL_API(glGetQueryObjectui64vEXT, id, pname, params); -} -void API_ENTRY(glDrawBuffersEXT)(GLsizei n, const GLenum * bufs) { - CALL_GL_API(glDrawBuffersEXT, n, bufs); -} -void API_ENTRY(glEnableiEXT)(GLenum target, GLuint index) { - CALL_GL_API(glEnableiEXT, target, index); -} -void API_ENTRY(glDisableiEXT)(GLenum target, GLuint index) { - CALL_GL_API(glDisableiEXT, target, index); -} -void API_ENTRY(glBlendEquationiEXT)(GLuint buf, GLenum mode) { - CALL_GL_API(glBlendEquationiEXT, buf, mode); -} -void API_ENTRY(glBlendEquationSeparateiEXT)(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { - CALL_GL_API(glBlendEquationSeparateiEXT, buf, modeRGB, modeAlpha); -} -void API_ENTRY(glBlendFunciEXT)(GLuint buf, GLenum src, GLenum dst) { - CALL_GL_API(glBlendFunciEXT, buf, src, dst); -} -void API_ENTRY(glBlendFuncSeparateiEXT)(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - CALL_GL_API(glBlendFuncSeparateiEXT, buf, srcRGB, dstRGB, srcAlpha, dstAlpha); -} -void API_ENTRY(glColorMaskiEXT)(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { - CALL_GL_API(glColorMaskiEXT, index, r, g, b, a); -} -GLboolean API_ENTRY(glIsEnablediEXT)(GLenum target, GLuint index) { - CALL_GL_API_RETURN(glIsEnablediEXT, target, index); -} -void API_ENTRY(glDrawArraysInstancedEXT)(GLenum mode, GLint start, GLsizei count, GLsizei primcount) { - CALL_GL_API(glDrawArraysInstancedEXT, mode, start, count, primcount); -} -void API_ENTRY(glDrawElementsInstancedEXT)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) { - CALL_GL_API(glDrawElementsInstancedEXT, mode, count, type, indices, primcount); -} -void API_ENTRY(glFramebufferTextureEXT)(GLenum target, GLenum attachment, GLuint texture, GLint level) { - CALL_GL_API(glFramebufferTextureEXT, target, attachment, texture, level); -} -void API_ENTRY(glVertexAttribDivisorEXT)(GLuint index, GLuint divisor) { - CALL_GL_API(glVertexAttribDivisorEXT, index, divisor); -} -void * API_ENTRY(glMapBufferRangeEXT)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { - CALL_GL_API_RETURN(glMapBufferRangeEXT, target, offset, length, access); -} -void API_ENTRY(glFlushMappedBufferRangeEXT)(GLenum target, GLintptr offset, GLsizeiptr length) { - CALL_GL_API(glFlushMappedBufferRangeEXT, target, offset, length); -} -void API_ENTRY(glMultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount) { - CALL_GL_API(glMultiDrawArraysEXT, mode, first, count, primcount); -} -void API_ENTRY(glMultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei primcount) { - CALL_GL_API(glMultiDrawElementsEXT, mode, count, type, indices, primcount); -} -void API_ENTRY(glRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - CALL_GL_API(glRenderbufferStorageMultisampleEXT, target, samples, internalformat, width, height); -} -void API_ENTRY(glFramebufferTexture2DMultisampleEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { - CALL_GL_API(glFramebufferTexture2DMultisampleEXT, target, attachment, textarget, texture, level, samples); -} -void API_ENTRY(glReadBufferIndexedEXT)(GLenum src, GLint index) { - CALL_GL_API(glReadBufferIndexedEXT, src, index); -} -void API_ENTRY(glDrawBuffersIndexedEXT)(GLint n, const GLenum * location, const GLint * indices) { - CALL_GL_API(glDrawBuffersIndexedEXT, n, location, indices); -} -void API_ENTRY(glGetIntegeri_vEXT)(GLenum target, GLuint index, GLint * data) { - CALL_GL_API(glGetIntegeri_vEXT, target, index, data); -} -void API_ENTRY(glPrimitiveBoundingBoxEXT)(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) { - CALL_GL_API(glPrimitiveBoundingBoxEXT, minX, minY, minZ, minW, maxX, maxY, maxZ, maxW); -} GLenum API_ENTRY(glGetGraphicsResetStatusEXT)(void) { CALL_GL_API_RETURN(glGetGraphicsResetStatusEXT); } -void API_ENTRY(glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data) { +void API_ENTRY(glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) { CALL_GL_API(glReadnPixelsEXT, x, y, width, height, format, type, bufSize, data); } -void API_ENTRY(glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, GLfloat * params) { +void API_ENTRY(glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, float *params) { CALL_GL_API(glGetnUniformfvEXT, program, location, bufSize, params); } -void API_ENTRY(glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint * params) { +void API_ENTRY(glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint *params) { CALL_GL_API(glGetnUniformivEXT, program, location, bufSize, params); } +void API_ENTRY(glUseProgramStagesEXT)(GLuint pipeline, GLbitfield stages, GLuint program) { + CALL_GL_API(glUseProgramStagesEXT, pipeline, stages, program); +} void API_ENTRY(glActiveShaderProgramEXT)(GLuint pipeline, GLuint program) { CALL_GL_API(glActiveShaderProgramEXT, pipeline, program); } +GLuint API_ENTRY(glCreateShaderProgramvEXT)(GLenum type, GLsizei count, const GLchar **strings) { + CALL_GL_API_RETURN(glCreateShaderProgramvEXT, type, count, strings); +} void API_ENTRY(glBindProgramPipelineEXT)(GLuint pipeline) { CALL_GL_API(glBindProgramPipelineEXT, pipeline); } -GLuint API_ENTRY(glCreateShaderProgramvEXT)(GLenum type, GLsizei count, const GLchar ** strings) { - CALL_GL_API_RETURN(glCreateShaderProgramvEXT, type, count, strings); -} -void API_ENTRY(glDeleteProgramPipelinesEXT)(GLsizei n, const GLuint * pipelines) { +void API_ENTRY(glDeleteProgramPipelinesEXT)(GLsizei n, const GLuint *pipelines) { CALL_GL_API(glDeleteProgramPipelinesEXT, n, pipelines); } -void API_ENTRY(glGenProgramPipelinesEXT)(GLsizei n, GLuint * pipelines) { +void API_ENTRY(glGenProgramPipelinesEXT)(GLsizei n, GLuint *pipelines) { CALL_GL_API(glGenProgramPipelinesEXT, n, pipelines); } -void API_ENTRY(glGetProgramPipelineInfoLogEXT)(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { - CALL_GL_API(glGetProgramPipelineInfoLogEXT, pipeline, bufSize, length, infoLog); -} -void API_ENTRY(glGetProgramPipelineivEXT)(GLuint pipeline, GLenum pname, GLint * params) { - CALL_GL_API(glGetProgramPipelineivEXT, pipeline, pname, params); -} GLboolean API_ENTRY(glIsProgramPipelineEXT)(GLuint pipeline) { CALL_GL_API_RETURN(glIsProgramPipelineEXT, pipeline); } void API_ENTRY(glProgramParameteriEXT)(GLuint program, GLenum pname, GLint value) { CALL_GL_API(glProgramParameteriEXT, program, pname, value); } -void API_ENTRY(glProgramUniform1fEXT)(GLuint program, GLint location, GLfloat v0) { - CALL_GL_API(glProgramUniform1fEXT, program, location, v0); +void API_ENTRY(glGetProgramPipelineivEXT)(GLuint pipeline, GLenum pname, GLint *params) { + CALL_GL_API(glGetProgramPipelineivEXT, pipeline, pname, params); } -void API_ENTRY(glProgramUniform1fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform1fvEXT, program, location, count, value); +void API_ENTRY(glProgramUniform1iEXT)(GLuint program, GLint location, GLint x) { + CALL_GL_API(glProgramUniform1iEXT, program, location, x); } -void API_ENTRY(glProgramUniform1iEXT)(GLuint program, GLint location, GLint v0) { - CALL_GL_API(glProgramUniform1iEXT, program, location, v0); +void API_ENTRY(glProgramUniform2iEXT)(GLuint program, GLint location, GLint x, GLint y) { + CALL_GL_API(glProgramUniform2iEXT, program, location, x, y); } -void API_ENTRY(glProgramUniform1ivEXT)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform1ivEXT, program, location, count, value); +void API_ENTRY(glProgramUniform3iEXT)(GLuint program, GLint location, GLint x, GLint y, GLint z) { + CALL_GL_API(glProgramUniform3iEXT, program, location, x, y, z); } -void API_ENTRY(glProgramUniform2fEXT)(GLuint program, GLint location, GLfloat v0, GLfloat v1) { - CALL_GL_API(glProgramUniform2fEXT, program, location, v0, v1); +void API_ENTRY(glProgramUniform4iEXT)(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w) { + CALL_GL_API(glProgramUniform4iEXT, program, location, x, y, z, w); } -void API_ENTRY(glProgramUniform2fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform2fvEXT, program, location, count, value); +void API_ENTRY(glProgramUniform1fEXT)(GLuint program, GLint location, GLfloat x) { + CALL_GL_API(glProgramUniform1fEXT, program, location, x); } -void API_ENTRY(glProgramUniform2iEXT)(GLuint program, GLint location, GLint v0, GLint v1) { - CALL_GL_API(glProgramUniform2iEXT, program, location, v0, v1); +void API_ENTRY(glProgramUniform2fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y) { + CALL_GL_API(glProgramUniform2fEXT, program, location, x, y); } -void API_ENTRY(glProgramUniform2ivEXT)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform2ivEXT, program, location, count, value); +void API_ENTRY(glProgramUniform3fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z) { + CALL_GL_API(glProgramUniform3fEXT, program, location, x, y, z); } -void API_ENTRY(glProgramUniform3fEXT)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { - CALL_GL_API(glProgramUniform3fEXT, program, location, v0, v1, v2); +void API_ENTRY(glProgramUniform4fEXT)(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { + CALL_GL_API(glProgramUniform4fEXT, program, location, x, y, z, w); } -void API_ENTRY(glProgramUniform3fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform3fvEXT, program, location, count, value); +void API_ENTRY(glProgramUniform1ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) { + CALL_GL_API(glProgramUniform1ivEXT, program, location, count, value); } -void API_ENTRY(glProgramUniform3iEXT)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) { - CALL_GL_API(glProgramUniform3iEXT, program, location, v0, v1, v2); +void API_ENTRY(glProgramUniform2ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) { + CALL_GL_API(glProgramUniform2ivEXT, program, location, count, value); } -void API_ENTRY(glProgramUniform3ivEXT)(GLuint program, GLint location, GLsizei count, const GLint * value) { +void API_ENTRY(glProgramUniform3ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) { CALL_GL_API(glProgramUniform3ivEXT, program, location, count, value); } -void API_ENTRY(glProgramUniform4fEXT)(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { - CALL_GL_API(glProgramUniform4fEXT, program, location, v0, v1, v2, v3); +void API_ENTRY(glProgramUniform4ivEXT)(GLuint program, GLint location, GLsizei count, const GLint *value) { + CALL_GL_API(glProgramUniform4ivEXT, program, location, count, value); } -void API_ENTRY(glProgramUniform4fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - CALL_GL_API(glProgramUniform4fvEXT, program, location, count, value); +void API_ENTRY(glProgramUniform1fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) { + CALL_GL_API(glProgramUniform1fvEXT, program, location, count, value); } -void API_ENTRY(glProgramUniform4iEXT)(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { - CALL_GL_API(glProgramUniform4iEXT, program, location, v0, v1, v2, v3); +void API_ENTRY(glProgramUniform2fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) { + CALL_GL_API(glProgramUniform2fvEXT, program, location, count, value); } -void API_ENTRY(glProgramUniform4ivEXT)(GLuint program, GLint location, GLsizei count, const GLint * value) { - CALL_GL_API(glProgramUniform4ivEXT, program, location, count, value); +void API_ENTRY(glProgramUniform3fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) { + CALL_GL_API(glProgramUniform3fvEXT, program, location, count, value); +} +void API_ENTRY(glProgramUniform4fvEXT)(GLuint program, GLint location, GLsizei count, const GLfloat *value) { + CALL_GL_API(glProgramUniform4fvEXT, program, location, count, value); } -void API_ENTRY(glProgramUniformMatrix2fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void API_ENTRY(glProgramUniformMatrix2fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { CALL_GL_API(glProgramUniformMatrix2fvEXT, program, location, count, transpose, value); } -void API_ENTRY(glProgramUniformMatrix3fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void API_ENTRY(glProgramUniformMatrix3fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { CALL_GL_API(glProgramUniformMatrix3fvEXT, program, location, count, transpose, value); } -void API_ENTRY(glProgramUniformMatrix4fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void API_ENTRY(glProgramUniformMatrix4fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { CALL_GL_API(glProgramUniformMatrix4fvEXT, program, location, count, transpose, value); } -void API_ENTRY(glUseProgramStagesEXT)(GLuint pipeline, GLbitfield stages, GLuint program) { - CALL_GL_API(glUseProgramStagesEXT, pipeline, stages, program); -} void API_ENTRY(glValidateProgramPipelineEXT)(GLuint pipeline) { CALL_GL_API(glValidateProgramPipelineEXT, pipeline); } -void API_ENTRY(glProgramUniform1uiEXT)(GLuint program, GLint location, GLuint v0) { - CALL_GL_API(glProgramUniform1uiEXT, program, location, v0); -} -void API_ENTRY(glProgramUniform2uiEXT)(GLuint program, GLint location, GLuint v0, GLuint v1) { - CALL_GL_API(glProgramUniform2uiEXT, program, location, v0, v1); -} -void API_ENTRY(glProgramUniform3uiEXT)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) { - CALL_GL_API(glProgramUniform3uiEXT, program, location, v0, v1, v2); -} -void API_ENTRY(glProgramUniform4uiEXT)(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { - CALL_GL_API(glProgramUniform4uiEXT, program, location, v0, v1, v2, v3); -} -void API_ENTRY(glProgramUniform1uivEXT)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform1uivEXT, program, location, count, value); -} -void API_ENTRY(glProgramUniform2uivEXT)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform2uivEXT, program, location, count, value); -} -void API_ENTRY(glProgramUniform3uivEXT)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform3uivEXT, program, location, count, value); -} -void API_ENTRY(glProgramUniform4uivEXT)(GLuint program, GLint location, GLsizei count, const GLuint * value) { - CALL_GL_API(glProgramUniform4uivEXT, program, location, count, value); -} -void API_ENTRY(glProgramUniformMatrix2x3fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix2x3fvEXT, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix3x2fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix3x2fvEXT, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix2x4fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix2x4fvEXT, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix4x2fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix4x2fvEXT, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix3x4fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix3x4fvEXT, program, location, count, transpose, value); -} -void API_ENTRY(glProgramUniformMatrix4x3fvEXT)(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glProgramUniformMatrix4x3fvEXT, program, location, count, transpose, value); -} -void API_ENTRY(glPatchParameteriEXT)(GLenum pname, GLint value) { - CALL_GL_API(glPatchParameteriEXT, pname, value); -} -void API_ENTRY(glTexParameterIivEXT)(GLenum target, GLenum pname, const GLint * params) { - CALL_GL_API(glTexParameterIivEXT, target, pname, params); -} -void API_ENTRY(glTexParameterIuivEXT)(GLenum target, GLenum pname, const GLuint * params) { - CALL_GL_API(glTexParameterIuivEXT, target, pname, params); -} -void API_ENTRY(glGetTexParameterIivEXT)(GLenum target, GLenum pname, GLint * params) { - CALL_GL_API(glGetTexParameterIivEXT, target, pname, params); -} -void API_ENTRY(glGetTexParameterIuivEXT)(GLenum target, GLenum pname, GLuint * params) { - CALL_GL_API(glGetTexParameterIuivEXT, target, pname, params); -} -void API_ENTRY(glSamplerParameterIivEXT)(GLuint sampler, GLenum pname, const GLint * param) { - CALL_GL_API(glSamplerParameterIivEXT, sampler, pname, param); -} -void API_ENTRY(glSamplerParameterIuivEXT)(GLuint sampler, GLenum pname, const GLuint * param) { - CALL_GL_API(glSamplerParameterIuivEXT, sampler, pname, param); -} -void API_ENTRY(glGetSamplerParameterIivEXT)(GLuint sampler, GLenum pname, GLint * params) { - CALL_GL_API(glGetSamplerParameterIivEXT, sampler, pname, params); -} -void API_ENTRY(glGetSamplerParameterIuivEXT)(GLuint sampler, GLenum pname, GLuint * params) { - CALL_GL_API(glGetSamplerParameterIuivEXT, sampler, pname, params); -} -void API_ENTRY(glTexBufferEXT)(GLenum target, GLenum internalformat, GLuint buffer) { - CALL_GL_API(glTexBufferEXT, target, internalformat, buffer); -} -void API_ENTRY(glTexBufferRangeEXT)(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { - CALL_GL_API(glTexBufferRangeEXT, target, internalformat, buffer, offset, size); +void API_ENTRY(glGetProgramPipelineInfoLogEXT)(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { + CALL_GL_API(glGetProgramPipelineInfoLogEXT, pipeline, bufSize, length, infoLog); } void API_ENTRY(glTexStorage1DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { CALL_GL_API(glTexStorage1DEXT, target, levels, internalformat, width); @@ -490,73 +265,25 @@ void API_ENTRY(glTextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { CALL_GL_API(glTextureStorage3DEXT, texture, target, levels, internalformat, width, height, depth); } -void API_ENTRY(glTextureViewEXT)(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) { - CALL_GL_API(glTextureViewEXT, texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); -} void API_ENTRY(glRenderbufferStorageMultisampleIMG)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageMultisampleIMG, target, samples, internalformat, width, height); } void API_ENTRY(glFramebufferTexture2DMultisampleIMG)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { CALL_GL_API(glFramebufferTexture2DMultisampleIMG, target, attachment, textarget, texture, level, samples); } -void API_ENTRY(glBeginPerfQueryINTEL)(GLuint queryHandle) { - CALL_GL_API(glBeginPerfQueryINTEL, queryHandle); -} -void API_ENTRY(glCreatePerfQueryINTEL)(GLuint queryId, GLuint * queryHandle) { - CALL_GL_API(glCreatePerfQueryINTEL, queryId, queryHandle); -} -void API_ENTRY(glDeletePerfQueryINTEL)(GLuint queryHandle) { - CALL_GL_API(glDeletePerfQueryINTEL, queryHandle); -} -void API_ENTRY(glEndPerfQueryINTEL)(GLuint queryHandle) { - CALL_GL_API(glEndPerfQueryINTEL, queryHandle); -} -void API_ENTRY(glGetFirstPerfQueryIdINTEL)(GLuint * queryId) { - CALL_GL_API(glGetFirstPerfQueryIdINTEL, queryId); -} -void API_ENTRY(glGetNextPerfQueryIdINTEL)(GLuint queryId, GLuint * nextQueryId) { - CALL_GL_API(glGetNextPerfQueryIdINTEL, queryId, nextQueryId); -} -void API_ENTRY(glGetPerfCounterInfoINTEL)(GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar * counterName, GLuint counterDescLength, GLchar * counterDesc, GLuint * counterOffset, GLuint * counterDataSize, GLuint * counterTypeEnum, GLuint * counterDataTypeEnum, GLuint64 * rawCounterMaxValue) { - CALL_GL_API(glGetPerfCounterInfoINTEL, queryId, counterId, counterNameLength, counterName, counterDescLength, counterDesc, counterOffset, counterDataSize, counterTypeEnum, counterDataTypeEnum, rawCounterMaxValue); -} -void API_ENTRY(glGetPerfQueryDataINTEL)(GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid * data, GLuint * bytesWritten) { - CALL_GL_API(glGetPerfQueryDataINTEL, queryHandle, flags, dataSize, data, bytesWritten); -} -void API_ENTRY(glGetPerfQueryIdByNameINTEL)(GLchar * queryName, GLuint * queryId) { - CALL_GL_API(glGetPerfQueryIdByNameINTEL, queryName, queryId); -} -void API_ENTRY(glGetPerfQueryInfoINTEL)(GLuint queryId, GLuint queryNameLength, GLchar * queryName, GLuint * dataSize, GLuint * noCounters, GLuint * noInstances, GLuint * capsMask) { - CALL_GL_API(glGetPerfQueryInfoINTEL, queryId, queryNameLength, queryName, dataSize, noCounters, noInstances, capsMask); -} -void API_ENTRY(glBlendParameteriNV)(GLenum pname, GLint value) { - CALL_GL_API(glBlendParameteriNV, pname, value); -} -void API_ENTRY(glBlendBarrierNV)(void) { - CALL_GL_API(glBlendBarrierNV); -} -void API_ENTRY(glCopyBufferSubDataNV)(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { - CALL_GL_API(glCopyBufferSubDataNV, readTarget, writeTarget, readOffset, writeOffset, size); -} void API_ENTRY(glCoverageMaskNV)(GLboolean mask) { CALL_GL_API(glCoverageMaskNV, mask); } void API_ENTRY(glCoverageOperationNV)(GLenum operation) { CALL_GL_API(glCoverageOperationNV, operation); } -void API_ENTRY(glDrawBuffersNV)(GLsizei n, const GLenum * bufs) { +void API_ENTRY(glDrawBuffersNV)(GLsizei n, const GLenum *bufs) { CALL_GL_API(glDrawBuffersNV, n, bufs); } -void API_ENTRY(glDrawArraysInstancedNV)(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { - CALL_GL_API(glDrawArraysInstancedNV, mode, first, count, primcount); -} -void API_ENTRY(glDrawElementsInstancedNV)(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) { - CALL_GL_API(glDrawElementsInstancedNV, mode, count, type, indices, primcount); -} -void API_ENTRY(glDeleteFencesNV)(GLsizei n, const GLuint * fences) { +void API_ENTRY(glDeleteFencesNV)(GLsizei n, const GLuint *fences) { CALL_GL_API(glDeleteFencesNV, n, fences); } -void API_ENTRY(glGenFencesNV)(GLsizei n, GLuint * fences) { +void API_ENTRY(glGenFencesNV)(GLsizei n, GLuint *fences) { CALL_GL_API(glGenFencesNV, n, fences); } GLboolean API_ENTRY(glIsFenceNV)(GLuint fence) { @@ -565,7 +292,7 @@ GLboolean API_ENTRY(glTestFenceNV)(GLuint fence) { CALL_GL_API_RETURN(glTestFenceNV, fence); } -void API_ENTRY(glGetFenceivNV)(GLuint fence, GLenum pname, GLint * params) { +void API_ENTRY(glGetFenceivNV)(GLuint fence, GLenum pname, GLint *params) { CALL_GL_API(glGetFenceivNV, fence, pname, params); } void API_ENTRY(glFinishFenceNV)(GLuint fence) { @@ -574,43 +301,16 @@ void API_ENTRY(glSetFenceNV)(GLuint fence, GLenum condition) { CALL_GL_API(glSetFenceNV, fence, condition); } -void API_ENTRY(glBlitFramebufferNV)(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - CALL_GL_API(glBlitFramebufferNV, srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); -} -void API_ENTRY(glRenderbufferStorageMultisampleNV)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - CALL_GL_API(glRenderbufferStorageMultisampleNV, target, samples, internalformat, width, height); -} -void API_ENTRY(glVertexAttribDivisorNV)(GLuint index, GLuint divisor) { - CALL_GL_API(glVertexAttribDivisorNV, index, divisor); -} -void API_ENTRY(glUniformMatrix2x3fvNV)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix2x3fvNV, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix3x2fvNV)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix3x2fvNV, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix2x4fvNV)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix2x4fvNV, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix4x2fvNV)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix4x2fvNV, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix3x4fvNV)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix3x4fvNV, location, count, transpose, value); -} -void API_ENTRY(glUniformMatrix4x3fvNV)(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - CALL_GL_API(glUniformMatrix4x3fvNV, location, count, transpose, value); -} void API_ENTRY(glReadBufferNV)(GLenum mode) { CALL_GL_API(glReadBufferNV, mode); } void API_ENTRY(glAlphaFuncQCOM)(GLenum func, GLclampf ref) { CALL_GL_API(glAlphaFuncQCOM, func, ref); } -void API_ENTRY(glGetDriverControlsQCOM)(GLint * num, GLsizei size, GLuint * driverControls) { +void API_ENTRY(glGetDriverControlsQCOM)(GLint *num, GLsizei size, GLuint *driverControls) { CALL_GL_API(glGetDriverControlsQCOM, num, size, driverControls); } -void API_ENTRY(glGetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei * length, GLchar * driverControlString) { +void API_ENTRY(glGetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) { CALL_GL_API(glGetDriverControlStringQCOM, driverControl, bufSize, length, driverControlString); } void API_ENTRY(glEnableDriverControlQCOM)(GLuint driverControl) { @@ -619,40 +319,40 @@ void API_ENTRY(glDisableDriverControlQCOM)(GLuint driverControl) { CALL_GL_API(glDisableDriverControlQCOM, driverControl); } -void API_ENTRY(glExtGetTexturesQCOM)(GLuint * textures, GLint maxTextures, GLint * numTextures) { +void API_ENTRY(glExtGetTexturesQCOM)(GLuint *textures, GLint maxTextures, GLint *numTextures) { CALL_GL_API(glExtGetTexturesQCOM, textures, maxTextures, numTextures); } -void API_ENTRY(glExtGetBuffersQCOM)(GLuint * buffers, GLint maxBuffers, GLint * numBuffers) { +void API_ENTRY(glExtGetBuffersQCOM)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) { CALL_GL_API(glExtGetBuffersQCOM, buffers, maxBuffers, numBuffers); } -void API_ENTRY(glExtGetRenderbuffersQCOM)(GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers) { +void API_ENTRY(glExtGetRenderbuffersQCOM)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) { CALL_GL_API(glExtGetRenderbuffersQCOM, renderbuffers, maxRenderbuffers, numRenderbuffers); } -void API_ENTRY(glExtGetFramebuffersQCOM)(GLuint * framebuffers, GLint maxFramebuffers, GLint * numFramebuffers) { +void API_ENTRY(glExtGetFramebuffersQCOM)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) { CALL_GL_API(glExtGetFramebuffersQCOM, framebuffers, maxFramebuffers, numFramebuffers); } -void API_ENTRY(glExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint * params) { +void API_ENTRY(glExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) { CALL_GL_API(glExtGetTexLevelParameterivQCOM, texture, face, level, pname, params); } void API_ENTRY(glExtTexObjectStateOverrideiQCOM)(GLenum target, GLenum pname, GLint param) { CALL_GL_API(glExtTexObjectStateOverrideiQCOM, target, pname, param); } -void API_ENTRY(glExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void * texels) { +void API_ENTRY(glExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) { CALL_GL_API(glExtGetTexSubImageQCOM, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); } -void API_ENTRY(glExtGetBufferPointervQCOM)(GLenum target, void ** params) { +void API_ENTRY(glExtGetBufferPointervQCOM)(GLenum target, GLvoid **params) { CALL_GL_API(glExtGetBufferPointervQCOM, target, params); } -void API_ENTRY(glExtGetShadersQCOM)(GLuint * shaders, GLint maxShaders, GLint * numShaders) { +void API_ENTRY(glExtGetShadersQCOM)(GLuint *shaders, GLint maxShaders, GLint *numShaders) { CALL_GL_API(glExtGetShadersQCOM, shaders, maxShaders, numShaders); } -void API_ENTRY(glExtGetProgramsQCOM)(GLuint * programs, GLint maxPrograms, GLint * numPrograms) { +void API_ENTRY(glExtGetProgramsQCOM)(GLuint *programs, GLint maxPrograms, GLint *numPrograms) { CALL_GL_API(glExtGetProgramsQCOM, programs, maxPrograms, numPrograms); } GLboolean API_ENTRY(glExtIsProgramBinaryQCOM)(GLuint program) { CALL_GL_API_RETURN(glExtIsProgramBinaryQCOM, program); } -void API_ENTRY(glExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar * source, GLint * length) { +void API_ENTRY(glExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar *source, GLint *length) { CALL_GL_API(glExtGetProgramBinarySourceQCOM, program, shadertype, source, length); } void API_ENTRY(glStartTilingQCOM)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_CM/gl_api.in android-platform-frameworks-native-21/opengl/libs/GLES_CM/gl_api.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_CM/gl_api.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_CM/gl_api.in 2012-10-16 22:57:11.000000000 +0000 @@ -1,73 +1,73 @@ -void API_ENTRY(glAlphaFunc)(GLenum func, GLfloat ref) { +void API_ENTRY(glAlphaFunc)(GLenum func, GLclampf ref) { CALL_GL_API(glAlphaFunc, func, ref); } -void API_ENTRY(glClearColor)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { +void API_ENTRY(glClearColor)(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { CALL_GL_API(glClearColor, red, green, blue, alpha); } -void API_ENTRY(glClearDepthf)(GLfloat d) { - CALL_GL_API(glClearDepthf, d); +void API_ENTRY(glClearDepthf)(GLclampf depth) { + CALL_GL_API(glClearDepthf, depth); } -void API_ENTRY(glClipPlanef)(GLenum p, const GLfloat * eqn) { - CALL_GL_API(glClipPlanef, p, eqn); +void API_ENTRY(glClipPlanef)(GLenum plane, const GLfloat *equation) { + CALL_GL_API(glClipPlanef, plane, equation); } void API_ENTRY(glColor4f)(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { CALL_GL_API(glColor4f, red, green, blue, alpha); } -void API_ENTRY(glDepthRangef)(GLfloat n, GLfloat f) { - CALL_GL_API(glDepthRangef, n, f); +void API_ENTRY(glDepthRangef)(GLclampf zNear, GLclampf zFar) { + CALL_GL_API(glDepthRangef, zNear, zFar); } void API_ENTRY(glFogf)(GLenum pname, GLfloat param) { CALL_GL_API(glFogf, pname, param); } -void API_ENTRY(glFogfv)(GLenum pname, const GLfloat * params) { +void API_ENTRY(glFogfv)(GLenum pname, const GLfloat *params) { CALL_GL_API(glFogfv, pname, params); } -void API_ENTRY(glFrustumf)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { - CALL_GL_API(glFrustumf, l, r, b, t, n, f); +void API_ENTRY(glFrustumf)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + CALL_GL_API(glFrustumf, left, right, bottom, top, zNear, zFar); } -void API_ENTRY(glGetClipPlanef)(GLenum plane, GLfloat * equation) { - CALL_GL_API(glGetClipPlanef, plane, equation); +void API_ENTRY(glGetClipPlanef)(GLenum pname, GLfloat eqn[4]) { + CALL_GL_API(glGetClipPlanef, pname, eqn); } -void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat * data) { - CALL_GL_API(glGetFloatv, pname, data); +void API_ENTRY(glGetFloatv)(GLenum pname, GLfloat *params) { + CALL_GL_API(glGetFloatv, pname, params); } -void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat * params) { +void API_ENTRY(glGetLightfv)(GLenum light, GLenum pname, GLfloat *params) { CALL_GL_API(glGetLightfv, light, pname, params); } -void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat * params) { +void API_ENTRY(glGetMaterialfv)(GLenum face, GLenum pname, GLfloat *params) { CALL_GL_API(glGetMaterialfv, face, pname, params); } -void API_ENTRY(glGetTexEnvfv)(GLenum target, GLenum pname, GLfloat * params) { - CALL_GL_API(glGetTexEnvfv, target, pname, params); +void API_ENTRY(glGetTexEnvfv)(GLenum env, GLenum pname, GLfloat *params) { + CALL_GL_API(glGetTexEnvfv, env, pname, params); } -void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat * params) { +void API_ENTRY(glGetTexParameterfv)(GLenum target, GLenum pname, GLfloat *params) { CALL_GL_API(glGetTexParameterfv, target, pname, params); } void API_ENTRY(glLightModelf)(GLenum pname, GLfloat param) { CALL_GL_API(glLightModelf, pname, param); } -void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat * params) { +void API_ENTRY(glLightModelfv)(GLenum pname, const GLfloat *params) { CALL_GL_API(glLightModelfv, pname, params); } void API_ENTRY(glLightf)(GLenum light, GLenum pname, GLfloat param) { CALL_GL_API(glLightf, light, pname, param); } -void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat * params) { +void API_ENTRY(glLightfv)(GLenum light, GLenum pname, const GLfloat *params) { CALL_GL_API(glLightfv, light, pname, params); } void API_ENTRY(glLineWidth)(GLfloat width) { CALL_GL_API(glLineWidth, width); } -void API_ENTRY(glLoadMatrixf)(const GLfloat * m) { +void API_ENTRY(glLoadMatrixf)(const GLfloat *m) { CALL_GL_API(glLoadMatrixf, m); } void API_ENTRY(glMaterialf)(GLenum face, GLenum pname, GLfloat param) { CALL_GL_API(glMaterialf, face, pname, param); } -void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat * params) { +void API_ENTRY(glMaterialfv)(GLenum face, GLenum pname, const GLfloat *params) { CALL_GL_API(glMaterialfv, face, pname, params); } -void API_ENTRY(glMultMatrixf)(const GLfloat * m) { +void API_ENTRY(glMultMatrixf)(const GLfloat *m) { CALL_GL_API(glMultMatrixf, m); } void API_ENTRY(glMultiTexCoord4f)(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { @@ -76,13 +76,13 @@ void API_ENTRY(glNormal3f)(GLfloat nx, GLfloat ny, GLfloat nz) { CALL_GL_API(glNormal3f, nx, ny, nz); } -void API_ENTRY(glOrthof)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { - CALL_GL_API(glOrthof, l, r, b, t, n, f); +void API_ENTRY(glOrthof)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + CALL_GL_API(glOrthof, left, right, bottom, top, zNear, zFar); } void API_ENTRY(glPointParameterf)(GLenum pname, GLfloat param) { CALL_GL_API(glPointParameterf, pname, param); } -void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat * params) { +void API_ENTRY(glPointParameterfv)(GLenum pname, const GLfloat *params) { CALL_GL_API(glPointParameterfv, pname, params); } void API_ENTRY(glPointSize)(GLfloat size) { @@ -100,13 +100,13 @@ void API_ENTRY(glTexEnvf)(GLenum target, GLenum pname, GLfloat param) { CALL_GL_API(glTexEnvf, target, pname, param); } -void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat * params) { +void API_ENTRY(glTexEnvfv)(GLenum target, GLenum pname, const GLfloat *params) { CALL_GL_API(glTexEnvfv, target, pname, params); } void API_ENTRY(glTexParameterf)(GLenum target, GLenum pname, GLfloat param) { CALL_GL_API(glTexParameterf, target, pname, param); } -void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat * params) { +void API_ENTRY(glTexParameterfv)(GLenum target, GLenum pname, const GLfloat *params) { CALL_GL_API(glTexParameterfv, target, pname, params); } void API_ENTRY(glTranslatef)(GLfloat x, GLfloat y, GLfloat z) { @@ -115,7 +115,7 @@ void API_ENTRY(glActiveTexture)(GLenum texture) { CALL_GL_API(glActiveTexture, texture); } -void API_ENTRY(glAlphaFuncx)(GLenum func, GLfixed ref) { +void API_ENTRY(glAlphaFuncx)(GLenum func, GLclampx ref) { CALL_GL_API(glAlphaFuncx, func, ref); } void API_ENTRY(glBindBuffer)(GLenum target, GLuint buffer) { @@ -127,19 +127,19 @@ void API_ENTRY(glBlendFunc)(GLenum sfactor, GLenum dfactor) { CALL_GL_API(glBlendFunc, sfactor, dfactor); } -void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const void * data, GLenum usage) { +void API_ENTRY(glBufferData)(GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage) { CALL_GL_API(glBufferData, target, size, data, usage); } -void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) { +void API_ENTRY(glBufferSubData)(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data) { CALL_GL_API(glBufferSubData, target, offset, size, data); } void API_ENTRY(glClear)(GLbitfield mask) { CALL_GL_API(glClear, mask); } -void API_ENTRY(glClearColorx)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { +void API_ENTRY(glClearColorx)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { CALL_GL_API(glClearColorx, red, green, blue, alpha); } -void API_ENTRY(glClearDepthx)(GLfixed depth) { +void API_ENTRY(glClearDepthx)(GLclampx depth) { CALL_GL_API(glClearDepthx, depth); } void API_ENTRY(glClearStencil)(GLint s) { @@ -148,7 +148,7 @@ void API_ENTRY(glClientActiveTexture)(GLenum texture) { CALL_GL_API(glClientActiveTexture, texture); } -void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed * equation) { +void API_ENTRY(glClipPlanex)(GLenum plane, const GLfixed *equation) { CALL_GL_API(glClipPlanex, plane, equation); } void API_ENTRY(glColor4ub)(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { @@ -160,13 +160,13 @@ void API_ENTRY(glColorMask)(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha) { CALL_GL_API(glColorMask, red, green, blue, alpha); } -void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void API_ENTRY(glColorPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { CALL_GL_API(glColorPointer, size, type, stride, pointer); } -void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) { +void API_ENTRY(glCompressedTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data) { CALL_GL_API(glCompressedTexImage2D, target, level, internalformat, width, height, border, imageSize, data); } -void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) { +void API_ENTRY(glCompressedTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data) { CALL_GL_API(glCompressedTexSubImage2D, target, level, xoffset, yoffset, width, height, format, imageSize, data); } void API_ENTRY(glCopyTexImage2D)(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border) { @@ -178,10 +178,10 @@ void API_ENTRY(glCullFace)(GLenum mode) { CALL_GL_API(glCullFace, mode); } -void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint * buffers) { +void API_ENTRY(glDeleteBuffers)(GLsizei n, const GLuint *buffers) { CALL_GL_API(glDeleteBuffers, n, buffers); } -void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint * textures) { +void API_ENTRY(glDeleteTextures)(GLsizei n, const GLuint *textures) { CALL_GL_API(glDeleteTextures, n, textures); } void API_ENTRY(glDepthFunc)(GLenum func) { @@ -190,8 +190,8 @@ void API_ENTRY(glDepthMask)(GLboolean flag) { CALL_GL_API(glDepthMask, flag); } -void API_ENTRY(glDepthRangex)(GLfixed n, GLfixed f) { - CALL_GL_API(glDepthRangex, n, f); +void API_ENTRY(glDepthRangex)(GLclampx zNear, GLclampx zFar) { + CALL_GL_API(glDepthRangex, zNear, zFar); } void API_ENTRY(glDisable)(GLenum cap) { CALL_GL_API(glDisable, cap); @@ -202,7 +202,7 @@ void API_ENTRY(glDrawArrays)(GLenum mode, GLint first, GLsizei count) { CALL_GL_API(glDrawArrays, mode, first, count); } -void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const void * indices) { +void API_ENTRY(glDrawElements)(GLenum mode, GLsizei count, GLenum type, const GLvoid *indices) { CALL_GL_API(glDrawElements, mode, count, type, indices); } void API_ENTRY(glEnable)(GLenum cap) { @@ -220,61 +220,61 @@ void API_ENTRY(glFogx)(GLenum pname, GLfixed param) { CALL_GL_API(glFogx, pname, param); } -void API_ENTRY(glFogxv)(GLenum pname, const GLfixed * param) { - CALL_GL_API(glFogxv, pname, param); +void API_ENTRY(glFogxv)(GLenum pname, const GLfixed *params) { + CALL_GL_API(glFogxv, pname, params); } void API_ENTRY(glFrontFace)(GLenum mode) { CALL_GL_API(glFrontFace, mode); } -void API_ENTRY(glFrustumx)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { - CALL_GL_API(glFrustumx, l, r, b, t, n, f); +void API_ENTRY(glFrustumx)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + CALL_GL_API(glFrustumx, left, right, bottom, top, zNear, zFar); } -void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean * data) { - CALL_GL_API(glGetBooleanv, pname, data); +void API_ENTRY(glGetBooleanv)(GLenum pname, GLboolean *params) { + CALL_GL_API(glGetBooleanv, pname, params); } -void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetBufferParameteriv)(GLenum target, GLenum pname, GLint *params) { CALL_GL_API(glGetBufferParameteriv, target, pname, params); } -void API_ENTRY(glGetClipPlanex)(GLenum plane, GLfixed * equation) { - CALL_GL_API(glGetClipPlanex, plane, equation); +void API_ENTRY(glGetClipPlanex)(GLenum pname, GLfixed eqn[4]) { + CALL_GL_API(glGetClipPlanex, pname, eqn); } -void API_ENTRY(glGenBuffers)(GLsizei n, GLuint * buffers) { +void API_ENTRY(glGenBuffers)(GLsizei n, GLuint *buffers) { CALL_GL_API(glGenBuffers, n, buffers); } -void API_ENTRY(glGenTextures)(GLsizei n, GLuint * textures) { +void API_ENTRY(glGenTextures)(GLsizei n, GLuint *textures) { CALL_GL_API(glGenTextures, n, textures); } GLenum API_ENTRY(glGetError)(void) { CALL_GL_API_RETURN(glGetError); } -void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed * params) { +void API_ENTRY(glGetFixedv)(GLenum pname, GLfixed *params) { CALL_GL_API(glGetFixedv, pname, params); } -void API_ENTRY(glGetIntegerv)(GLenum pname, GLint * data) { - CALL_GL_API(glGetIntegerv, pname, data); +void API_ENTRY(glGetIntegerv)(GLenum pname, GLint *params) { + CALL_GL_API(glGetIntegerv, pname, params); } -void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed * params) { +void API_ENTRY(glGetLightxv)(GLenum light, GLenum pname, GLfixed *params) { CALL_GL_API(glGetLightxv, light, pname, params); } -void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed * params) { +void API_ENTRY(glGetMaterialxv)(GLenum face, GLenum pname, GLfixed *params) { CALL_GL_API(glGetMaterialxv, face, pname, params); } -void API_ENTRY(glGetPointerv)(GLenum pname, void ** params) { +void API_ENTRY(glGetPointerv)(GLenum pname, GLvoid **params) { CALL_GL_API(glGetPointerv, pname, params); } const GLubyte * API_ENTRY(__glGetString)(GLenum name) { CALL_GL_API_RETURN(glGetString, name); } -void API_ENTRY(glGetTexEnviv)(GLenum target, GLenum pname, GLint * params) { - CALL_GL_API(glGetTexEnviv, target, pname, params); +void API_ENTRY(glGetTexEnviv)(GLenum env, GLenum pname, GLint *params) { + CALL_GL_API(glGetTexEnviv, env, pname, params); } -void API_ENTRY(glGetTexEnvxv)(GLenum target, GLenum pname, GLfixed * params) { - CALL_GL_API(glGetTexEnvxv, target, pname, params); +void API_ENTRY(glGetTexEnvxv)(GLenum env, GLenum pname, GLfixed *params) { + CALL_GL_API(glGetTexEnvxv, env, pname, params); } -void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetTexParameteriv)(GLenum target, GLenum pname, GLint *params) { CALL_GL_API(glGetTexParameteriv, target, pname, params); } -void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed * params) { +void API_ENTRY(glGetTexParameterxv)(GLenum target, GLenum pname, GLfixed *params) { CALL_GL_API(glGetTexParameterxv, target, pname, params); } void API_ENTRY(glHint)(GLenum target, GLenum mode) { @@ -292,13 +292,13 @@ void API_ENTRY(glLightModelx)(GLenum pname, GLfixed param) { CALL_GL_API(glLightModelx, pname, param); } -void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed * param) { - CALL_GL_API(glLightModelxv, pname, param); +void API_ENTRY(glLightModelxv)(GLenum pname, const GLfixed *params) { + CALL_GL_API(glLightModelxv, pname, params); } void API_ENTRY(glLightx)(GLenum light, GLenum pname, GLfixed param) { CALL_GL_API(glLightx, light, pname, param); } -void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed * params) { +void API_ENTRY(glLightxv)(GLenum light, GLenum pname, const GLfixed *params) { CALL_GL_API(glLightxv, light, pname, params); } void API_ENTRY(glLineWidthx)(GLfixed width) { @@ -307,7 +307,7 @@ void API_ENTRY(glLoadIdentity)(void) { CALL_GL_API(glLoadIdentity); } -void API_ENTRY(glLoadMatrixx)(const GLfixed * m) { +void API_ENTRY(glLoadMatrixx)(const GLfixed *m) { CALL_GL_API(glLoadMatrixx, m); } void API_ENTRY(glLogicOp)(GLenum opcode) { @@ -316,26 +316,26 @@ void API_ENTRY(glMaterialx)(GLenum face, GLenum pname, GLfixed param) { CALL_GL_API(glMaterialx, face, pname, param); } -void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed * param) { - CALL_GL_API(glMaterialxv, face, pname, param); +void API_ENTRY(glMaterialxv)(GLenum face, GLenum pname, const GLfixed *params) { + CALL_GL_API(glMaterialxv, face, pname, params); } void API_ENTRY(glMatrixMode)(GLenum mode) { CALL_GL_API(glMatrixMode, mode); } -void API_ENTRY(glMultMatrixx)(const GLfixed * m) { +void API_ENTRY(glMultMatrixx)(const GLfixed *m) { CALL_GL_API(glMultMatrixx, m); } -void API_ENTRY(glMultiTexCoord4x)(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { - CALL_GL_API(glMultiTexCoord4x, texture, s, t, r, q); +void API_ENTRY(glMultiTexCoord4x)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { + CALL_GL_API(glMultiTexCoord4x, target, s, t, r, q); } void API_ENTRY(glNormal3x)(GLfixed nx, GLfixed ny, GLfixed nz) { CALL_GL_API(glNormal3x, nx, ny, nz); } -void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const void * pointer) { +void API_ENTRY(glNormalPointer)(GLenum type, GLsizei stride, const GLvoid *pointer) { CALL_GL_API(glNormalPointer, type, stride, pointer); } -void API_ENTRY(glOrthox)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { - CALL_GL_API(glOrthox, l, r, b, t, n, f); +void API_ENTRY(glOrthox)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + CALL_GL_API(glOrthox, left, right, bottom, top, zNear, zFar); } void API_ENTRY(glPixelStorei)(GLenum pname, GLint param) { CALL_GL_API(glPixelStorei, pname, param); @@ -343,7 +343,7 @@ void API_ENTRY(glPointParameterx)(GLenum pname, GLfixed param) { CALL_GL_API(glPointParameterx, pname, param); } -void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed * params) { +void API_ENTRY(glPointParameterxv)(GLenum pname, const GLfixed *params) { CALL_GL_API(glPointParameterxv, pname, params); } void API_ENTRY(glPointSizex)(GLfixed size) { @@ -358,13 +358,13 @@ void API_ENTRY(glPushMatrix)(void) { CALL_GL_API(glPushMatrix); } -void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) { +void API_ENTRY(glReadPixels)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels) { CALL_GL_API(glReadPixels, x, y, width, height, format, type, pixels); } void API_ENTRY(glRotatex)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { CALL_GL_API(glRotatex, angle, x, y, z); } -void API_ENTRY(glSampleCoverage)(GLfloat value, GLboolean invert) { +void API_ENTRY(glSampleCoverage)(GLclampf value, GLboolean invert) { CALL_GL_API(glSampleCoverage, value, invert); } void API_ENTRY(glSampleCoveragex)(GLclampx value, GLboolean invert) { @@ -388,7 +388,7 @@ void API_ENTRY(glStencilOp)(GLenum fail, GLenum zfail, GLenum zpass) { CALL_GL_API(glStencilOp, fail, zfail, zpass); } -void API_ENTRY(glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void API_ENTRY(glTexCoordPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { CALL_GL_API(glTexCoordPointer, size, type, stride, pointer); } void API_ENTRY(glTexEnvi)(GLenum target, GLenum pname, GLint param) { @@ -397,13 +397,13 @@ void API_ENTRY(glTexEnvx)(GLenum target, GLenum pname, GLfixed param) { CALL_GL_API(glTexEnvx, target, pname, param); } -void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint * params) { +void API_ENTRY(glTexEnviv)(GLenum target, GLenum pname, const GLint *params) { CALL_GL_API(glTexEnviv, target, pname, params); } -void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed * params) { +void API_ENTRY(glTexEnvxv)(GLenum target, GLenum pname, const GLfixed *params) { CALL_GL_API(glTexEnvxv, target, pname, params); } -void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) { +void API_ENTRY(glTexImage2D)(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels) { CALL_GL_API(glTexImage2D, target, level, internalformat, width, height, border, format, type, pixels); } void API_ENTRY(glTexParameteri)(GLenum target, GLenum pname, GLint param) { @@ -412,21 +412,24 @@ void API_ENTRY(glTexParameterx)(GLenum target, GLenum pname, GLfixed param) { CALL_GL_API(glTexParameterx, target, pname, param); } -void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint * params) { +void API_ENTRY(glTexParameteriv)(GLenum target, GLenum pname, const GLint *params) { CALL_GL_API(glTexParameteriv, target, pname, params); } -void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed * params) { +void API_ENTRY(glTexParameterxv)(GLenum target, GLenum pname, const GLfixed *params) { CALL_GL_API(glTexParameterxv, target, pname, params); } -void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) { +void API_ENTRY(glTexSubImage2D)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels) { CALL_GL_API(glTexSubImage2D, target, level, xoffset, yoffset, width, height, format, type, pixels); } void API_ENTRY(glTranslatex)(GLfixed x, GLfixed y, GLfixed z) { CALL_GL_API(glTranslatex, x, y, z); } -void API_ENTRY(glVertexPointer)(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void API_ENTRY(glVertexPointer)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { CALL_GL_API(glVertexPointer, size, type, stride, pointer); } void API_ENTRY(glViewport)(GLint x, GLint y, GLsizei width, GLsizei height) { CALL_GL_API(glViewport, x, y, width, height); } +void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const GLvoid *pointer) { + CALL_GL_API(glPointSizePointerOES, type, stride, pointer); +} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_CM/gl.cpp android-platform-frameworks-native-21/opengl/libs/GLES_CM/gl.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_CM/gl.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_CM/gl.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -26,11 +26,14 @@ #include #include -#include "../hooks.h" -#include "../egl_impl.h" +#include "hooks.h" +#include "egl_impl.h" using namespace android; +// set this to 1 for crude GL debugging +#define CHECK_FOR_GL_ERRORS 0 + // ---------------------------------------------------------------------------- // extensions for the framework // ---------------------------------------------------------------------------- @@ -53,34 +56,34 @@ } void glColorPointerBounds(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei /*count*/) { + const GLvoid *ptr, GLsizei count) { glColorPointer(size, type, stride, ptr); } void glNormalPointerBounds(GLenum type, GLsizei stride, - const GLvoid *pointer, GLsizei /*count*/) { + const GLvoid *pointer, GLsizei count) { glNormalPointer(type, stride, pointer); } void glTexCoordPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei /*count*/) { + GLsizei stride, const GLvoid *pointer, GLsizei count) { glTexCoordPointer(size, type, stride, pointer); } void glVertexPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei /*count*/) { + GLsizei stride, const GLvoid *pointer, GLsizei count) { glVertexPointer(size, type, stride, pointer); } void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei /*count*/) { + GLsizei stride, const GLvoid *pointer, GLsizei count) { glPointSizePointerOES(type, stride, pointer); } GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei /*count*/) { + GLsizei stride, const GLvoid *pointer, GLsizei count) { glMatrixIndexPointerOES(size, type, stride, pointer); } GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei /*count*/) { + GLsizei stride, const GLvoid *pointer, GLsizei count) { glWeightPointerOES(size, type, stride, pointer); } @@ -92,19 +95,18 @@ #undef CALL_GL_API #undef CALL_GL_API_RETURN -#if USE_SLOW_BINDING - - #define API_ENTRY(_api) _api - - #define CALL_GL_API(_api, ...) \ - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ - if (_c) return _c->_api(__VA_ARGS__); - -#elif defined(__arm__) +#if USE_FAST_TLS_KEY && !CHECK_FOR_GL_ERRORS - #define GET_TLS(reg) "mrc p15, 0, " #reg ", c13, c0, 3 \n" + #ifdef HAVE_ARM_TLS_REGISTER + #define GET_TLS(reg) \ + "mrc p15, 0, " #reg ", c13, c0, 3 \n" + #else + #define GET_TLS(reg) \ + "mov " #reg ", #0xFFFF0FFF \n" \ + "ldr " #reg ", [" #reg ", #-15] \n" + #endif - #define API_ENTRY(_api) __attribute__((noinline)) _api + #define API_ENTRY(_api) __attribute__((naked)) _api #define CALL_GL_API(_api, ...) \ asm volatile( \ @@ -112,147 +114,51 @@ "ldr r12, [r12, %[tls]] \n" \ "cmp r12, #0 \n" \ "ldrne pc, [r12, %[api]] \n" \ + "mov r0, #0 \n" \ + "bx lr \n" \ : \ : [tls] "J"(TLS_SLOT_OPENGL_API*4), \ [api] "J"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "r12" \ + : \ ); -#elif defined(__aarch64__) + #define CALL_GL_API_RETURN(_api, ...) \ + CALL_GL_API(_api, __VA_ARGS__) \ + return 0; // placate gcc's warnings. never reached. - #define API_ENTRY(_api) __attribute__((noinline)) _api +#else - #define CALL_GL_API(_api, ...) \ - asm volatile( \ - "mrs x16, tpidr_el0\n" \ - "ldr x16, [x16, %[tls]]\n" \ - "cbz x16, 1f\n" \ - "ldr x16, [x16, %[api]]\n" \ - "br x16\n" \ - "1:\n" \ - : \ - : [tls] "i" (TLS_SLOT_OPENGL_API * sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "x16" \ - ); - -#elif defined(__i386__) - - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api - - #define CALL_GL_API(_api, ...) \ - register void* fn; \ - __asm__ volatile( \ - "mov %%gs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "je 1f\n" \ - "jmp *%P[api](%[fn])\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ - : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "cc" \ - ); + #if CHECK_FOR_GL_ERRORS + + #define CHECK_GL_ERRORS(_api) \ + do { GLint err = glGetError(); \ + ALOGE_IF(err != GL_NO_ERROR, "%s failed (0x%04X)", #_api, err); \ + } while(false); -#elif defined(__x86_64__) + #else - #define API_ENTRY(_api) __attribute__((noinline,optimize("omit-frame-pointer"))) _api + #define CHECK_GL_ERRORS(_api) do { } while(false); - #define CALL_GL_API(_api, ...) \ - register void** fn; \ - __asm__ volatile( \ - "mov %%fs:0, %[fn]\n" \ - "mov %P[tls](%[fn]), %[fn]\n" \ - "test %[fn], %[fn]\n" \ - "je 1f\n" \ - "jmp *%P[api](%[fn])\n" \ - "1:\n" \ - : [fn] "=r" (fn) \ - : [tls] "i" (TLS_SLOT_OPENGL_API*sizeof(void*)), \ - [api] "i" (__builtin_offsetof(gl_hooks_t, gl._api)) \ - : "cc" \ - ); + #endif -#elif defined(__mips64) - #define API_ENTRY(_api) __attribute__((noinline)) _api + #define API_ENTRY(_api) _api - #define CALL_GL_API(_api, ...) \ - register unsigned long _t0 asm("$12"); \ - register unsigned long _fn asm("$25"); \ - register unsigned long _tls asm("$3"); \ - register unsigned long _v0 asm("$2"); \ - asm volatile( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - "rdhwr %[tls], $29\n\t" \ - "ld %[t0], %[OPENGL_API](%[tls])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " move %[fn], $ra\n\t" \ - "ld %[t0], %[API](%[t0])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " nop\n\t" \ - "move %[fn], %[t0]\n\t" \ - "1:\n\t" \ - "jalr $0, %[fn]\n\t" \ - " move %[v0], $0\n\t" \ - ".set pop\n\t" \ - : [fn] "=c"(_fn), \ - [tls] "=&r"(_tls), \ - [t0] "=&r"(_t0), \ - [v0] "=&r"(_v0) \ - : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*sizeof(void*)),\ - [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : \ - ); - -#elif defined(__mips__) - - #define API_ENTRY(_api) __attribute__((noinline)) _api - - #define CALL_GL_API(_api, ...) \ - register unsigned int _t0 asm("$8"); \ - register unsigned int _fn asm("$25"); \ - register unsigned int _tls asm("$3"); \ - register unsigned int _v0 asm("$2"); \ - asm volatile( \ - ".set push\n\t" \ - ".set noreorder\n\t" \ - ".set mips32r2\n\t" \ - "rdhwr %[tls], $29\n\t" \ - "lw %[t0], %[OPENGL_API](%[tls])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " move %[fn], $ra\n\t" \ - "lw %[t0], %[API](%[t0])\n\t" \ - "beqz %[t0], 1f\n\t" \ - " nop\n\t" \ - "move %[fn], %[t0]\n\t" \ - "1:\n\t" \ - "jalr $0, %[fn]\n\t" \ - " move %[v0], $0\n\t" \ - ".set pop\n\t" \ - : [fn] "=c"(_fn), \ - [tls] "=&r"(_tls), \ - [t0] "=&r"(_t0), \ - [v0] "=&r"(_v0) \ - : [OPENGL_API] "I"(TLS_SLOT_OPENGL_API*4), \ - [API] "I"(__builtin_offsetof(gl_hooks_t, gl._api)) \ - : \ - ); + #define CALL_GL_API(_api, ...) \ + gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ + _c->_api(__VA_ARGS__); \ + CHECK_GL_ERRORS(_api) + + #define CALL_GL_API_RETURN(_api, ...) \ + gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; \ + return _c->_api(__VA_ARGS__) #endif -#define CALL_GL_API_RETURN(_api, ...) \ - CALL_GL_API(_api, __VA_ARGS__) \ - return 0; - extern "C" { -#pragma GCC diagnostic ignored "-Wunused-parameter" #include "gl_api.in" #include "glext_api.in" -#pragma GCC diagnostic warning "-Wunused-parameter" } #undef API_ENTRY @@ -265,11 +171,11 @@ extern "C" const GLubyte * __glGetString(GLenum name); -const GLubyte * glGetString(GLenum name) { +const GLubyte * glGetString(GLenum name) +{ const GLubyte * ret = egl_get_string_for_current_context(name); if (ret == NULL) { - gl_hooks_t::gl_t const * const _c = &getGlThreadSpecific()->gl; - ret = _c->glGetString(name); + ret = __glGetString(name); } return ret; } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_CM/glext_api.in android-platform-frameworks-native-21/opengl/libs/GLES_CM/glext_api.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_CM/glext_api.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_CM/glext_api.in 2012-10-16 22:57:11.000000000 +0000 @@ -1,9 +1,3 @@ -void API_ENTRY(glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) { - CALL_GL_API(glEGLImageTargetTexture2DOES, target, image); -} -void API_ENTRY(glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) { - CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image); -} void API_ENTRY(glBlendEquationSeparateOES)(GLenum modeRGB, GLenum modeAlpha) { CALL_GL_API(glBlendEquationSeparateOES, modeRGB, modeAlpha); } @@ -13,72 +7,6 @@ void API_ENTRY(glBlendEquationOES)(GLenum mode) { CALL_GL_API(glBlendEquationOES, mode); } -void API_ENTRY(glMultiTexCoord1bOES)(GLenum texture, GLbyte s) { - CALL_GL_API(glMultiTexCoord1bOES, texture, s); -} -void API_ENTRY(glMultiTexCoord1bvOES)(GLenum texture, const GLbyte * coords) { - CALL_GL_API(glMultiTexCoord1bvOES, texture, coords); -} -void API_ENTRY(glMultiTexCoord2bOES)(GLenum texture, GLbyte s, GLbyte t) { - CALL_GL_API(glMultiTexCoord2bOES, texture, s, t); -} -void API_ENTRY(glMultiTexCoord2bvOES)(GLenum texture, const GLbyte * coords) { - CALL_GL_API(glMultiTexCoord2bvOES, texture, coords); -} -void API_ENTRY(glMultiTexCoord3bOES)(GLenum texture, GLbyte s, GLbyte t, GLbyte r) { - CALL_GL_API(glMultiTexCoord3bOES, texture, s, t, r); -} -void API_ENTRY(glMultiTexCoord3bvOES)(GLenum texture, const GLbyte * coords) { - CALL_GL_API(glMultiTexCoord3bvOES, texture, coords); -} -void API_ENTRY(glMultiTexCoord4bOES)(GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q) { - CALL_GL_API(glMultiTexCoord4bOES, texture, s, t, r, q); -} -void API_ENTRY(glMultiTexCoord4bvOES)(GLenum texture, const GLbyte * coords) { - CALL_GL_API(glMultiTexCoord4bvOES, texture, coords); -} -void API_ENTRY(glTexCoord1bOES)(GLbyte s) { - CALL_GL_API(glTexCoord1bOES, s); -} -void API_ENTRY(glTexCoord1bvOES)(const GLbyte * coords) { - CALL_GL_API(glTexCoord1bvOES, coords); -} -void API_ENTRY(glTexCoord2bOES)(GLbyte s, GLbyte t) { - CALL_GL_API(glTexCoord2bOES, s, t); -} -void API_ENTRY(glTexCoord2bvOES)(const GLbyte * coords) { - CALL_GL_API(glTexCoord2bvOES, coords); -} -void API_ENTRY(glTexCoord3bOES)(GLbyte s, GLbyte t, GLbyte r) { - CALL_GL_API(glTexCoord3bOES, s, t, r); -} -void API_ENTRY(glTexCoord3bvOES)(const GLbyte * coords) { - CALL_GL_API(glTexCoord3bvOES, coords); -} -void API_ENTRY(glTexCoord4bOES)(GLbyte s, GLbyte t, GLbyte r, GLbyte q) { - CALL_GL_API(glTexCoord4bOES, s, t, r, q); -} -void API_ENTRY(glTexCoord4bvOES)(const GLbyte * coords) { - CALL_GL_API(glTexCoord4bvOES, coords); -} -void API_ENTRY(glVertex2bOES)(GLbyte x) { - CALL_GL_API(glVertex2bOES, x); -} -void API_ENTRY(glVertex2bvOES)(const GLbyte * coords) { - CALL_GL_API(glVertex2bvOES, coords); -} -void API_ENTRY(glVertex3bOES)(GLbyte x, GLbyte y) { - CALL_GL_API(glVertex3bOES, x, y); -} -void API_ENTRY(glVertex3bvOES)(const GLbyte * coords) { - CALL_GL_API(glVertex3bvOES, coords); -} -void API_ENTRY(glVertex4bOES)(GLbyte x, GLbyte y, GLbyte z) { - CALL_GL_API(glVertex4bOES, x, y, z); -} -void API_ENTRY(glVertex4bvOES)(const GLbyte * coords) { - CALL_GL_API(glVertex4bvOES, coords); -} void API_ENTRY(glDrawTexsOES)(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height) { CALL_GL_API(glDrawTexsOES, x, y, z, width, height); } @@ -88,97 +16,112 @@ void API_ENTRY(glDrawTexxOES)(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height) { CALL_GL_API(glDrawTexxOES, x, y, z, width, height); } -void API_ENTRY(glDrawTexsvOES)(const GLshort * coords) { +void API_ENTRY(glDrawTexsvOES)(const GLshort *coords) { CALL_GL_API(glDrawTexsvOES, coords); } -void API_ENTRY(glDrawTexivOES)(const GLint * coords) { +void API_ENTRY(glDrawTexivOES)(const GLint *coords) { CALL_GL_API(glDrawTexivOES, coords); } -void API_ENTRY(glDrawTexxvOES)(const GLfixed * coords) { +void API_ENTRY(glDrawTexxvOES)(const GLfixed *coords) { CALL_GL_API(glDrawTexxvOES, coords); } void API_ENTRY(glDrawTexfOES)(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height) { CALL_GL_API(glDrawTexfOES, x, y, z, width, height); } -void API_ENTRY(glDrawTexfvOES)(const GLfloat * coords) { +void API_ENTRY(glDrawTexfvOES)(const GLfloat *coords) { CALL_GL_API(glDrawTexfvOES, coords); } -void API_ENTRY(glAlphaFuncxOES)(GLenum func, GLfixed ref) { +void API_ENTRY(glEGLImageTargetTexture2DOES)(GLenum target, GLeglImageOES image) { + CALL_GL_API(glEGLImageTargetTexture2DOES, target, image); +} +void API_ENTRY(glEGLImageTargetRenderbufferStorageOES)(GLenum target, GLeglImageOES image) { + CALL_GL_API(glEGLImageTargetRenderbufferStorageOES, target, image); +} +void API_ENTRY(glAlphaFuncxOES)(GLenum func, GLclampx ref) { CALL_GL_API(glAlphaFuncxOES, func, ref); } -void API_ENTRY(glClearColorxOES)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { +void API_ENTRY(glClearColorxOES)(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { CALL_GL_API(glClearColorxOES, red, green, blue, alpha); } -void API_ENTRY(glClearDepthxOES)(GLfixed depth) { +void API_ENTRY(glClearDepthxOES)(GLclampx depth) { CALL_GL_API(glClearDepthxOES, depth); } -void API_ENTRY(glClipPlanexOES)(GLenum plane, const GLfixed * equation) { +void API_ENTRY(glClipPlanexOES)(GLenum plane, const GLfixed *equation) { CALL_GL_API(glClipPlanexOES, plane, equation); } void API_ENTRY(glColor4xOES)(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { CALL_GL_API(glColor4xOES, red, green, blue, alpha); } -void API_ENTRY(glDepthRangexOES)(GLfixed n, GLfixed f) { - CALL_GL_API(glDepthRangexOES, n, f); +void API_ENTRY(glDepthRangexOES)(GLclampx zNear, GLclampx zFar) { + CALL_GL_API(glDepthRangexOES, zNear, zFar); } void API_ENTRY(glFogxOES)(GLenum pname, GLfixed param) { CALL_GL_API(glFogxOES, pname, param); } -void API_ENTRY(glFogxvOES)(GLenum pname, const GLfixed * param) { - CALL_GL_API(glFogxvOES, pname, param); +void API_ENTRY(glFogxvOES)(GLenum pname, const GLfixed *params) { + CALL_GL_API(glFogxvOES, pname, params); } -void API_ENTRY(glFrustumxOES)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { - CALL_GL_API(glFrustumxOES, l, r, b, t, n, f); +void API_ENTRY(glFrustumxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + CALL_GL_API(glFrustumxOES, left, right, bottom, top, zNear, zFar); } -void API_ENTRY(glGetClipPlanexOES)(GLenum plane, GLfixed * equation) { - CALL_GL_API(glGetClipPlanexOES, plane, equation); +void API_ENTRY(glGetClipPlanexOES)(GLenum pname, GLfixed eqn[4]) { + CALL_GL_API(glGetClipPlanexOES, pname, eqn); } -void API_ENTRY(glGetFixedvOES)(GLenum pname, GLfixed * params) { +void API_ENTRY(glGetFixedvOES)(GLenum pname, GLfixed *params) { CALL_GL_API(glGetFixedvOES, pname, params); } -void API_ENTRY(glGetTexEnvxvOES)(GLenum target, GLenum pname, GLfixed * params) { - CALL_GL_API(glGetTexEnvxvOES, target, pname, params); +void API_ENTRY(glGetLightxvOES)(GLenum light, GLenum pname, GLfixed *params) { + CALL_GL_API(glGetLightxvOES, light, pname, params); +} +void API_ENTRY(glGetMaterialxvOES)(GLenum face, GLenum pname, GLfixed *params) { + CALL_GL_API(glGetMaterialxvOES, face, pname, params); +} +void API_ENTRY(glGetTexEnvxvOES)(GLenum env, GLenum pname, GLfixed *params) { + CALL_GL_API(glGetTexEnvxvOES, env, pname, params); } -void API_ENTRY(glGetTexParameterxvOES)(GLenum target, GLenum pname, GLfixed * params) { +void API_ENTRY(glGetTexParameterxvOES)(GLenum target, GLenum pname, GLfixed *params) { CALL_GL_API(glGetTexParameterxvOES, target, pname, params); } void API_ENTRY(glLightModelxOES)(GLenum pname, GLfixed param) { CALL_GL_API(glLightModelxOES, pname, param); } -void API_ENTRY(glLightModelxvOES)(GLenum pname, const GLfixed * param) { - CALL_GL_API(glLightModelxvOES, pname, param); +void API_ENTRY(glLightModelxvOES)(GLenum pname, const GLfixed *params) { + CALL_GL_API(glLightModelxvOES, pname, params); } void API_ENTRY(glLightxOES)(GLenum light, GLenum pname, GLfixed param) { CALL_GL_API(glLightxOES, light, pname, param); } -void API_ENTRY(glLightxvOES)(GLenum light, GLenum pname, const GLfixed * params) { +void API_ENTRY(glLightxvOES)(GLenum light, GLenum pname, const GLfixed *params) { CALL_GL_API(glLightxvOES, light, pname, params); } void API_ENTRY(glLineWidthxOES)(GLfixed width) { CALL_GL_API(glLineWidthxOES, width); } -void API_ENTRY(glLoadMatrixxOES)(const GLfixed * m) { +void API_ENTRY(glLoadMatrixxOES)(const GLfixed *m) { CALL_GL_API(glLoadMatrixxOES, m); } void API_ENTRY(glMaterialxOES)(GLenum face, GLenum pname, GLfixed param) { CALL_GL_API(glMaterialxOES, face, pname, param); } -void API_ENTRY(glMaterialxvOES)(GLenum face, GLenum pname, const GLfixed * param) { - CALL_GL_API(glMaterialxvOES, face, pname, param); +void API_ENTRY(glMaterialxvOES)(GLenum face, GLenum pname, const GLfixed *params) { + CALL_GL_API(glMaterialxvOES, face, pname, params); } -void API_ENTRY(glMultMatrixxOES)(const GLfixed * m) { +void API_ENTRY(glMultMatrixxOES)(const GLfixed *m) { CALL_GL_API(glMultMatrixxOES, m); } -void API_ENTRY(glMultiTexCoord4xOES)(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { - CALL_GL_API(glMultiTexCoord4xOES, texture, s, t, r, q); +void API_ENTRY(glMultiTexCoord4xOES)(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { + CALL_GL_API(glMultiTexCoord4xOES, target, s, t, r, q); } void API_ENTRY(glNormal3xOES)(GLfixed nx, GLfixed ny, GLfixed nz) { CALL_GL_API(glNormal3xOES, nx, ny, nz); } -void API_ENTRY(glOrthoxOES)(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { - CALL_GL_API(glOrthoxOES, l, r, b, t, n, f); +void API_ENTRY(glOrthoxOES)(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { + CALL_GL_API(glOrthoxOES, left, right, bottom, top, zNear, zFar); } -void API_ENTRY(glPointParameterxvOES)(GLenum pname, const GLfixed * params) { +void API_ENTRY(glPointParameterxOES)(GLenum pname, GLfixed param) { + CALL_GL_API(glPointParameterxOES, pname, param); +} +void API_ENTRY(glPointParameterxvOES)(GLenum pname, const GLfixed *params) { CALL_GL_API(glPointParameterxvOES, pname, params); } void API_ENTRY(glPointSizexOES)(GLfixed size) { @@ -190,8 +133,8 @@ void API_ENTRY(glRotatexOES)(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { CALL_GL_API(glRotatexOES, angle, x, y, z); } -void API_ENTRY(glSampleCoverageOES)(GLfixed value, GLboolean invert) { - CALL_GL_API(glSampleCoverageOES, value, invert); +void API_ENTRY(glSampleCoveragexOES)(GLclampx value, GLboolean invert) { + CALL_GL_API(glSampleCoveragexOES, value, invert); } void API_ENTRY(glScalexOES)(GLfixed x, GLfixed y, GLfixed z) { CALL_GL_API(glScalexOES, x, y, z); @@ -199,55 +142,34 @@ void API_ENTRY(glTexEnvxOES)(GLenum target, GLenum pname, GLfixed param) { CALL_GL_API(glTexEnvxOES, target, pname, param); } -void API_ENTRY(glTexEnvxvOES)(GLenum target, GLenum pname, const GLfixed * params) { +void API_ENTRY(glTexEnvxvOES)(GLenum target, GLenum pname, const GLfixed *params) { CALL_GL_API(glTexEnvxvOES, target, pname, params); } void API_ENTRY(glTexParameterxOES)(GLenum target, GLenum pname, GLfixed param) { CALL_GL_API(glTexParameterxOES, target, pname, param); } -void API_ENTRY(glTexParameterxvOES)(GLenum target, GLenum pname, const GLfixed * params) { +void API_ENTRY(glTexParameterxvOES)(GLenum target, GLenum pname, const GLfixed *params) { CALL_GL_API(glTexParameterxvOES, target, pname, params); } void API_ENTRY(glTranslatexOES)(GLfixed x, GLfixed y, GLfixed z) { CALL_GL_API(glTranslatexOES, x, y, z); } -void API_ENTRY(glGetLightxvOES)(GLenum light, GLenum pname, GLfixed * params) { - CALL_GL_API(glGetLightxvOES, light, pname, params); -} -void API_ENTRY(glGetMaterialxvOES)(GLenum face, GLenum pname, GLfixed * params) { - CALL_GL_API(glGetMaterialxvOES, face, pname, params); -} -void API_ENTRY(glPointParameterxOES)(GLenum pname, GLfixed param) { - CALL_GL_API(glPointParameterxOES, pname, param); -} -void API_ENTRY(glSampleCoveragexOES)(GLclampx value, GLboolean invert) { - CALL_GL_API(glSampleCoveragexOES, value, invert); -} -void API_ENTRY(glGetTexGenxvOES)(GLenum coord, GLenum pname, GLfixed * params) { - CALL_GL_API(glGetTexGenxvOES, coord, pname, params); -} -void API_ENTRY(glTexGenxOES)(GLenum coord, GLenum pname, GLfixed param) { - CALL_GL_API(glTexGenxOES, coord, pname, param); -} -void API_ENTRY(glTexGenxvOES)(GLenum coord, GLenum pname, const GLfixed * params) { - CALL_GL_API(glTexGenxvOES, coord, pname, params); -} GLboolean API_ENTRY(glIsRenderbufferOES)(GLuint renderbuffer) { CALL_GL_API_RETURN(glIsRenderbufferOES, renderbuffer); } void API_ENTRY(glBindRenderbufferOES)(GLenum target, GLuint renderbuffer) { CALL_GL_API(glBindRenderbufferOES, target, renderbuffer); } -void API_ENTRY(glDeleteRenderbuffersOES)(GLsizei n, const GLuint * renderbuffers) { +void API_ENTRY(glDeleteRenderbuffersOES)(GLsizei n, const GLuint* renderbuffers) { CALL_GL_API(glDeleteRenderbuffersOES, n, renderbuffers); } -void API_ENTRY(glGenRenderbuffersOES)(GLsizei n, GLuint * renderbuffers) { +void API_ENTRY(glGenRenderbuffersOES)(GLsizei n, GLuint* renderbuffers) { CALL_GL_API(glGenRenderbuffersOES, n, renderbuffers); } void API_ENTRY(glRenderbufferStorageOES)(GLenum target, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageOES, target, internalformat, width, height); } -void API_ENTRY(glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint * params) { +void API_ENTRY(glGetRenderbufferParameterivOES)(GLenum target, GLenum pname, GLint* params) { CALL_GL_API(glGetRenderbufferParameterivOES, target, pname, params); } GLboolean API_ENTRY(glIsFramebufferOES)(GLuint framebuffer) { @@ -256,10 +178,10 @@ void API_ENTRY(glBindFramebufferOES)(GLenum target, GLuint framebuffer) { CALL_GL_API(glBindFramebufferOES, target, framebuffer); } -void API_ENTRY(glDeleteFramebuffersOES)(GLsizei n, const GLuint * framebuffers) { +void API_ENTRY(glDeleteFramebuffersOES)(GLsizei n, const GLuint* framebuffers) { CALL_GL_API(glDeleteFramebuffersOES, n, framebuffers); } -void API_ENTRY(glGenFramebuffersOES)(GLsizei n, GLuint * framebuffers) { +void API_ENTRY(glGenFramebuffersOES)(GLsizei n, GLuint* framebuffers) { CALL_GL_API(glGenFramebuffersOES, n, framebuffers); } GLenum API_ENTRY(glCheckFramebufferStatusOES)(GLenum target) { @@ -271,19 +193,19 @@ void API_ENTRY(glFramebufferTexture2DOES)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level) { CALL_GL_API(glFramebufferTexture2DOES, target, attachment, textarget, texture, level); } -void API_ENTRY(glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint * params) { +void API_ENTRY(glGetFramebufferAttachmentParameterivOES)(GLenum target, GLenum attachment, GLenum pname, GLint* params) { CALL_GL_API(glGetFramebufferAttachmentParameterivOES, target, attachment, pname, params); } void API_ENTRY(glGenerateMipmapOES)(GLenum target) { CALL_GL_API(glGenerateMipmapOES, target); } -void * API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) { +void* API_ENTRY(glMapBufferOES)(GLenum target, GLenum access) { CALL_GL_API_RETURN(glMapBufferOES, target, access); } GLboolean API_ENTRY(glUnmapBufferOES)(GLenum target) { CALL_GL_API_RETURN(glUnmapBufferOES, target); } -void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, void ** params) { +void API_ENTRY(glGetBufferPointervOES)(GLenum target, GLenum pname, GLvoid ** params) { CALL_GL_API(glGetBufferPointervOES, target, pname, params); } void API_ENTRY(glCurrentPaletteMatrixOES)(GLuint matrixpaletteindex) { @@ -292,127 +214,103 @@ void API_ENTRY(glLoadPaletteFromModelViewMatrixOES)(void) { CALL_GL_API(glLoadPaletteFromModelViewMatrixOES); } -void API_ENTRY(glMatrixIndexPointerOES)(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void API_ENTRY(glMatrixIndexPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { CALL_GL_API(glMatrixIndexPointerOES, size, type, stride, pointer); } -void API_ENTRY(glWeightPointerOES)(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void API_ENTRY(glWeightPointerOES)(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { CALL_GL_API(glWeightPointerOES, size, type, stride, pointer); } -void API_ENTRY(glPointSizePointerOES)(GLenum type, GLsizei stride, const void * pointer) { - CALL_GL_API(glPointSizePointerOES, type, stride, pointer); -} -GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed * mantissa, GLint * exponent) { +GLbitfield API_ENTRY(glQueryMatrixxOES)(GLfixed mantissa[16], GLint exponent[16]) { CALL_GL_API_RETURN(glQueryMatrixxOES, mantissa, exponent); } -void API_ENTRY(glClearDepthfOES)(GLclampf depth) { - CALL_GL_API(glClearDepthfOES, depth); +void API_ENTRY(glDepthRangefOES)(GLclampf zNear, GLclampf zFar) { + CALL_GL_API(glDepthRangefOES, zNear, zFar); } -void API_ENTRY(glClipPlanefOES)(GLenum plane, const GLfloat * equation) { - CALL_GL_API(glClipPlanefOES, plane, equation); +void API_ENTRY(glFrustumfOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + CALL_GL_API(glFrustumfOES, left, right, bottom, top, zNear, zFar); } -void API_ENTRY(glDepthRangefOES)(GLclampf n, GLclampf f) { - CALL_GL_API(glDepthRangefOES, n, f); +void API_ENTRY(glOrthofOES)(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { + CALL_GL_API(glOrthofOES, left, right, bottom, top, zNear, zFar); } -void API_ENTRY(glFrustumfOES)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { - CALL_GL_API(glFrustumfOES, l, r, b, t, n, f); +void API_ENTRY(glClipPlanefOES)(GLenum plane, const GLfloat *equation) { + CALL_GL_API(glClipPlanefOES, plane, equation); } -void API_ENTRY(glGetClipPlanefOES)(GLenum plane, GLfloat * equation) { - CALL_GL_API(glGetClipPlanefOES, plane, equation); +void API_ENTRY(glGetClipPlanefOES)(GLenum pname, GLfloat eqn[4]) { + CALL_GL_API(glGetClipPlanefOES, pname, eqn); } -void API_ENTRY(glOrthofOES)(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { - CALL_GL_API(glOrthofOES, l, r, b, t, n, f); +void API_ENTRY(glClearDepthfOES)(GLclampf depth) { + CALL_GL_API(glClearDepthfOES, depth); } void API_ENTRY(glTexGenfOES)(GLenum coord, GLenum pname, GLfloat param) { CALL_GL_API(glTexGenfOES, coord, pname, param); } -void API_ENTRY(glTexGenfvOES)(GLenum coord, GLenum pname, const GLfloat * params) { +void API_ENTRY(glTexGenfvOES)(GLenum coord, GLenum pname, const GLfloat *params) { CALL_GL_API(glTexGenfvOES, coord, pname, params); } void API_ENTRY(glTexGeniOES)(GLenum coord, GLenum pname, GLint param) { CALL_GL_API(glTexGeniOES, coord, pname, param); } -void API_ENTRY(glTexGenivOES)(GLenum coord, GLenum pname, const GLint * params) { +void API_ENTRY(glTexGenivOES)(GLenum coord, GLenum pname, const GLint *params) { CALL_GL_API(glTexGenivOES, coord, pname, params); } -void API_ENTRY(glGetTexGenfvOES)(GLenum coord, GLenum pname, GLfloat * params) { +void API_ENTRY(glTexGenxOES)(GLenum coord, GLenum pname, GLfixed param) { + CALL_GL_API(glTexGenxOES, coord, pname, param); +} +void API_ENTRY(glTexGenxvOES)(GLenum coord, GLenum pname, const GLfixed *params) { + CALL_GL_API(glTexGenxvOES, coord, pname, params); +} +void API_ENTRY(glGetTexGenfvOES)(GLenum coord, GLenum pname, GLfloat *params) { CALL_GL_API(glGetTexGenfvOES, coord, pname, params); } -void API_ENTRY(glGetTexGenivOES)(GLenum coord, GLenum pname, GLint * params) { +void API_ENTRY(glGetTexGenivOES)(GLenum coord, GLenum pname, GLint *params) { CALL_GL_API(glGetTexGenivOES, coord, pname, params); } +void API_ENTRY(glGetTexGenxvOES)(GLenum coord, GLenum pname, GLfixed *params) { + CALL_GL_API(glGetTexGenxvOES, coord, pname, params); +} void API_ENTRY(glBindVertexArrayOES)(GLuint array) { CALL_GL_API(glBindVertexArrayOES, array); } -void API_ENTRY(glDeleteVertexArraysOES)(GLsizei n, const GLuint * arrays) { +void API_ENTRY(glDeleteVertexArraysOES)(GLsizei n, const GLuint *arrays) { CALL_GL_API(glDeleteVertexArraysOES, n, arrays); } -void API_ENTRY(glGenVertexArraysOES)(GLsizei n, GLuint * arrays) { +void API_ENTRY(glGenVertexArraysOES)(GLsizei n, GLuint *arrays) { CALL_GL_API(glGenVertexArraysOES, n, arrays); } GLboolean API_ENTRY(glIsVertexArrayOES)(GLuint array) { CALL_GL_API_RETURN(glIsVertexArrayOES, array); } -void API_ENTRY(glCopyTextureLevelsAPPLE)(GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount) { - CALL_GL_API(glCopyTextureLevelsAPPLE, destinationTexture, sourceTexture, sourceBaseLevel, sourceLevelCount); -} void API_ENTRY(glRenderbufferStorageMultisampleAPPLE)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageMultisampleAPPLE, target, samples, internalformat, width, height); } void API_ENTRY(glResolveMultisampleFramebufferAPPLE)(void) { CALL_GL_API(glResolveMultisampleFramebufferAPPLE); } -GLsync API_ENTRY(glFenceSyncAPPLE)(GLenum condition, GLbitfield flags) { - CALL_GL_API_RETURN(glFenceSyncAPPLE, condition, flags); -} -GLboolean API_ENTRY(glIsSyncAPPLE)(GLsync sync) { - CALL_GL_API_RETURN(glIsSyncAPPLE, sync); -} -void API_ENTRY(glDeleteSyncAPPLE)(GLsync sync) { - CALL_GL_API(glDeleteSyncAPPLE, sync); -} -GLenum API_ENTRY(glClientWaitSyncAPPLE)(GLsync sync, GLbitfield flags, GLuint64 timeout) { - CALL_GL_API_RETURN(glClientWaitSyncAPPLE, sync, flags, timeout); -} -void API_ENTRY(glWaitSyncAPPLE)(GLsync sync, GLbitfield flags, GLuint64 timeout) { - CALL_GL_API(glWaitSyncAPPLE, sync, flags, timeout); -} -void API_ENTRY(glGetInteger64vAPPLE)(GLenum pname, GLint64 * params) { - CALL_GL_API(glGetInteger64vAPPLE, pname, params); -} -void API_ENTRY(glGetSyncivAPPLE)(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) { - CALL_GL_API(glGetSyncivAPPLE, sync, pname, bufSize, length, values); -} -void API_ENTRY(glDiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum * attachments) { +void API_ENTRY(glDiscardFramebufferEXT)(GLenum target, GLsizei numAttachments, const GLenum *attachments) { CALL_GL_API(glDiscardFramebufferEXT, target, numAttachments, attachments); } -void * API_ENTRY(glMapBufferRangeEXT)(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { - CALL_GL_API_RETURN(glMapBufferRangeEXT, target, offset, length, access); -} -void API_ENTRY(glFlushMappedBufferRangeEXT)(GLenum target, GLintptr offset, GLsizeiptr length) { - CALL_GL_API(glFlushMappedBufferRangeEXT, target, offset, length); -} -void API_ENTRY(glMultiDrawArraysEXT)(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount) { - CALL_GL_API(glMultiDrawArraysEXT, mode, first, count, primcount); -} -void API_ENTRY(glMultiDrawElementsEXT)(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei primcount) { - CALL_GL_API(glMultiDrawElementsEXT, mode, count, type, indices, primcount); -} void API_ENTRY(glRenderbufferStorageMultisampleEXT)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageMultisampleEXT, target, samples, internalformat, width, height); } void API_ENTRY(glFramebufferTexture2DMultisampleEXT)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { CALL_GL_API(glFramebufferTexture2DMultisampleEXT, target, attachment, textarget, texture, level, samples); } +void API_ENTRY(glMultiDrawArraysEXT)(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) { + CALL_GL_API(glMultiDrawArraysEXT, mode, first, count, primcount); +} +void API_ENTRY(glMultiDrawElementsEXT)(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) { + CALL_GL_API(glMultiDrawElementsEXT, mode, count, type, indices, primcount); +} GLenum API_ENTRY(glGetGraphicsResetStatusEXT)(void) { CALL_GL_API_RETURN(glGetGraphicsResetStatusEXT); } -void API_ENTRY(glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data) { +void API_ENTRY(glReadnPixelsEXT)(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) { CALL_GL_API(glReadnPixelsEXT, x, y, width, height, format, type, bufSize, data); } -void API_ENTRY(glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, GLfloat * params) { +void API_ENTRY(glGetnUniformfvEXT)(GLuint program, GLint location, GLsizei bufSize, float *params) { CALL_GL_API(glGetnUniformfvEXT, program, location, bufSize, params); } -void API_ENTRY(glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint * params) { +void API_ENTRY(glGetnUniformivEXT)(GLuint program, GLint location, GLsizei bufSize, GLint *params) { CALL_GL_API(glGetnUniformivEXT, program, location, bufSize, params); } void API_ENTRY(glTexStorage1DEXT)(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { @@ -433,22 +331,22 @@ void API_ENTRY(glTextureStorage3DEXT)(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { CALL_GL_API(glTextureStorage3DEXT, texture, target, levels, internalformat, width, height, depth); } +void API_ENTRY(glClipPlanefIMG)(GLenum p, const GLfloat *eqn) { + CALL_GL_API(glClipPlanefIMG, p, eqn); +} +void API_ENTRY(glClipPlanexIMG)(GLenum p, const GLfixed *eqn) { + CALL_GL_API(glClipPlanexIMG, p, eqn); +} void API_ENTRY(glRenderbufferStorageMultisampleIMG)(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { CALL_GL_API(glRenderbufferStorageMultisampleIMG, target, samples, internalformat, width, height); } void API_ENTRY(glFramebufferTexture2DMultisampleIMG)(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { CALL_GL_API(glFramebufferTexture2DMultisampleIMG, target, attachment, textarget, texture, level, samples); } -void API_ENTRY(glClipPlanefIMG)(GLenum p, const GLfloat * eqn) { - CALL_GL_API(glClipPlanefIMG, p, eqn); -} -void API_ENTRY(glClipPlanexIMG)(GLenum p, const GLfixed * eqn) { - CALL_GL_API(glClipPlanexIMG, p, eqn); -} -void API_ENTRY(glDeleteFencesNV)(GLsizei n, const GLuint * fences) { +void API_ENTRY(glDeleteFencesNV)(GLsizei n, const GLuint *fences) { CALL_GL_API(glDeleteFencesNV, n, fences); } -void API_ENTRY(glGenFencesNV)(GLsizei n, GLuint * fences) { +void API_ENTRY(glGenFencesNV)(GLsizei n, GLuint *fences) { CALL_GL_API(glGenFencesNV, n, fences); } GLboolean API_ENTRY(glIsFenceNV)(GLuint fence) { @@ -457,7 +355,7 @@ GLboolean API_ENTRY(glTestFenceNV)(GLuint fence) { CALL_GL_API_RETURN(glTestFenceNV, fence); } -void API_ENTRY(glGetFenceivNV)(GLuint fence, GLenum pname, GLint * params) { +void API_ENTRY(glGetFenceivNV)(GLuint fence, GLenum pname, GLint *params) { CALL_GL_API(glGetFenceivNV, fence, pname, params); } void API_ENTRY(glFinishFenceNV)(GLuint fence) { @@ -466,10 +364,10 @@ void API_ENTRY(glSetFenceNV)(GLuint fence, GLenum condition) { CALL_GL_API(glSetFenceNV, fence, condition); } -void API_ENTRY(glGetDriverControlsQCOM)(GLint * num, GLsizei size, GLuint * driverControls) { +void API_ENTRY(glGetDriverControlsQCOM)(GLint *num, GLsizei size, GLuint *driverControls) { CALL_GL_API(glGetDriverControlsQCOM, num, size, driverControls); } -void API_ENTRY(glGetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei * length, GLchar * driverControlString) { +void API_ENTRY(glGetDriverControlStringQCOM)(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) { CALL_GL_API(glGetDriverControlStringQCOM, driverControl, bufSize, length, driverControlString); } void API_ENTRY(glEnableDriverControlQCOM)(GLuint driverControl) { @@ -478,40 +376,40 @@ void API_ENTRY(glDisableDriverControlQCOM)(GLuint driverControl) { CALL_GL_API(glDisableDriverControlQCOM, driverControl); } -void API_ENTRY(glExtGetTexturesQCOM)(GLuint * textures, GLint maxTextures, GLint * numTextures) { +void API_ENTRY(glExtGetTexturesQCOM)(GLuint *textures, GLint maxTextures, GLint *numTextures) { CALL_GL_API(glExtGetTexturesQCOM, textures, maxTextures, numTextures); } -void API_ENTRY(glExtGetBuffersQCOM)(GLuint * buffers, GLint maxBuffers, GLint * numBuffers) { +void API_ENTRY(glExtGetBuffersQCOM)(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) { CALL_GL_API(glExtGetBuffersQCOM, buffers, maxBuffers, numBuffers); } -void API_ENTRY(glExtGetRenderbuffersQCOM)(GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers) { +void API_ENTRY(glExtGetRenderbuffersQCOM)(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) { CALL_GL_API(glExtGetRenderbuffersQCOM, renderbuffers, maxRenderbuffers, numRenderbuffers); } -void API_ENTRY(glExtGetFramebuffersQCOM)(GLuint * framebuffers, GLint maxFramebuffers, GLint * numFramebuffers) { +void API_ENTRY(glExtGetFramebuffersQCOM)(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) { CALL_GL_API(glExtGetFramebuffersQCOM, framebuffers, maxFramebuffers, numFramebuffers); } -void API_ENTRY(glExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint * params) { +void API_ENTRY(glExtGetTexLevelParameterivQCOM)(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) { CALL_GL_API(glExtGetTexLevelParameterivQCOM, texture, face, level, pname, params); } void API_ENTRY(glExtTexObjectStateOverrideiQCOM)(GLenum target, GLenum pname, GLint param) { CALL_GL_API(glExtTexObjectStateOverrideiQCOM, target, pname, param); } -void API_ENTRY(glExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void * texels) { +void API_ENTRY(glExtGetTexSubImageQCOM)(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) { CALL_GL_API(glExtGetTexSubImageQCOM, target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); } -void API_ENTRY(glExtGetBufferPointervQCOM)(GLenum target, void ** params) { +void API_ENTRY(glExtGetBufferPointervQCOM)(GLenum target, GLvoid **params) { CALL_GL_API(glExtGetBufferPointervQCOM, target, params); } -void API_ENTRY(glExtGetShadersQCOM)(GLuint * shaders, GLint maxShaders, GLint * numShaders) { +void API_ENTRY(glExtGetShadersQCOM)(GLuint *shaders, GLint maxShaders, GLint *numShaders) { CALL_GL_API(glExtGetShadersQCOM, shaders, maxShaders, numShaders); } -void API_ENTRY(glExtGetProgramsQCOM)(GLuint * programs, GLint maxPrograms, GLint * numPrograms) { +void API_ENTRY(glExtGetProgramsQCOM)(GLuint *programs, GLint maxPrograms, GLint *numPrograms) { CALL_GL_API(glExtGetProgramsQCOM, programs, maxPrograms, numPrograms); } GLboolean API_ENTRY(glExtIsProgramBinaryQCOM)(GLuint program) { CALL_GL_API_RETURN(glExtIsProgramBinaryQCOM, program); } -void API_ENTRY(glExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar * source, GLint * length) { +void API_ENTRY(glExtGetProgramBinarySourceQCOM)(GLuint program, GLenum shadertype, GLchar *source, GLint *length) { CALL_GL_API(glExtGetProgramBinarySourceQCOM, program, shadertype, source, length); } void API_ENTRY(glStartTilingQCOM)(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/Android.mk android-platform-frameworks-native-21/opengl/libs/GLES_trace/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,7 +1,6 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_SRC_FILES := \ src/gltrace_api.cpp \ @@ -10,22 +9,33 @@ src/gltrace_eglapi.cpp \ src/gltrace_fixup.cpp \ src/gltrace_hooks.cpp \ - src/gltrace_transport.cpp \ - $(call all-proto-files-under, proto) + src/gltrace.pb.cpp \ + src/gltrace_transport.cpp LOCAL_C_INCLUDES := \ $(LOCAL_PATH) \ $(LOCAL_PATH)/../ \ - external - -LOCAL_STATIC_LIBRARIES := liblzf -LOCAL_SHARED_LIBRARIES := libcutils libutils liblog - -LOCAL_PROTOC_OPTIMIZE_TYPE := lite + external/stlport/stlport \ + external/protobuf/src \ + external \ + bionic + +LOCAL_CFLAGS := -DGOOGLE_PROTOBUF_NO_RTTI +LOCAL_STATIC_LIBRARIES := libprotobuf-cpp-2.3.0-lite liblzf +LOCAL_SHARED_LIBRARIES := libcutils libutils libstlport + +ifeq ($(ARCH_ARM_HAVE_TLS_REGISTER),true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif LOCAL_CFLAGS += -DLOG_TAG=\"libGLES_trace\" # we need to access the private Bionic header +# on ARM platforms, we need to mirror the ARCH_ARM_HAVE_TLS_REGISTER +# behavior from the bionic Android.mk file +ifeq ($(TARGET_ARCH)-$(ARCH_ARM_HAVE_TLS_REGISTER),arm-true) + LOCAL_CFLAGS += -DHAVE_ARM_TLS_REGISTER +endif LOCAL_C_INCLUDES += bionic/libc/private LOCAL_MODULE:= libGLES_trace diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/DESIGN.txt android-platform-frameworks-native-21/opengl/libs/GLES_trace/DESIGN.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/DESIGN.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/DESIGN.txt 2012-10-16 22:57:11.000000000 +0000 @@ -9,6 +9,9 @@ control whether tracing should be enabled for a certain process. If tracing is enabled, this calls GLTrace_start() to start the trace server. + Note that initEglTraceLevel() is also called from early_egl_init(), but that happens in the + context of the zygote, so that invocation has no effect. + egl_display_t::initialize() then calls setGLHooksThreadSpecific() where we set the thread specific gl_hooks structure to point to the trace implementation. From this point on, every GLES call is redirected to the trace implementation. @@ -27,37 +30,6 @@ to explore if a more graceful method of stopping the application, or detaching tracing from the application is required. - -Enabling tracing while the application is running: - - In order to allow tracing of an already running application, we allow DdmServer to enable - OpenGL tracing. In such a case, the application already has its GL hooks set up to point to the - real GL implementation, and we need to switch them to point to the trace implementation. - - This is achieved by checking whether tracing should be enabled at every eglSwap call. - (Note: We were already checking for tracing at every eglSwap, the only change now is that - the tracing could actually be ON/OFF at runtime - earlier it was set once and never changed). - - If eglSwap detects that tracing should be enabled now, then it performs the following steps: - - switch the gl hooks to point to the trace implementation. - - call trace eglMakeCurrent to indicate that there is now a new context that is current. - - continue on with tracing the eglSwap call. - This switches the hooks to point to the trace implementation only for the current context. - But the other contexts have their gl hooks updated when they perform eglMakeCurrent. - - The GLTrace version of eglMakeCurrent now has to be updated to allow switching to a context - it may not know of. In such a case, it creates a context matching the version that it is now - switching to. - -Disabling tracing: - - We disable tracing under two conditions: - - stop tracing request from DdmServer - - gltrace transport gets disconnected from the host. - In either case, both actions simply disable the tracing flag. The current context gets its - gl hooks restored in the next eglSwap, and the other traced contexts get their gl hooks - restored when they perform a eglMakeCurrent. - Code Structure: glestrace.h declares all the hooks exposed by libglestrace. These are used by EGL/egl.cpp and diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/dev.make android-platform-frameworks-native-21/opengl/libs/GLES_trace/dev.make --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/dev.make 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/dev.make 2012-10-16 22:57:11.000000000 +0000 @@ -1,6 +1,11 @@ ## NOTE ## This file is used for development purposes only. It is not used by the build system. +# generate protocol buffer files +genproto: gltrace.proto + aprotoc --cpp_out=src --java_out=java gltrace.proto + mv src/gltrace.pb.cc src/gltrace.pb.cpp + sync: adb root adb remount diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/gltrace.proto android-platform-frameworks-native-21/opengl/libs/GLES_trace/gltrace.proto --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/gltrace.proto 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/gltrace.proto 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,555 @@ +/* + * 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. + */ + +package android.gltrace; + +option optimize_for = LITE_RUNTIME; + +option java_package = "com.android.ide.eclipse.gltrace"; +option java_outer_classname = "GLProtoBuf"; + +message GLMessage { + enum Function { + glActiveTexture = 0; + glAlphaFunc = 1; + glAlphaFuncx = 2; + glAlphaFuncxOES = 3; + glAttachShader = 4; + glBeginPerfMonitorAMD = 5; + glBindAttribLocation = 6; + glBindBuffer = 7; + glBindFramebuffer = 8; + glBindFramebufferOES = 9; + glBindRenderbuffer = 10; + glBindRenderbufferOES = 11; + glBindTexture = 12; + glBindVertexArrayOES = 13; + glBlendColor = 14; + glBlendEquation = 15; + glBlendEquationOES = 16; + glBlendEquationSeparate = 17; + glBlendEquationSeparateOES = 18; + glBlendFunc = 19; + glBlendFuncSeparate = 20; + glBlendFuncSeparateOES = 21; + glBufferData = 22; + glBufferSubData = 23; + glCheckFramebufferStatus = 24; + glCheckFramebufferStatusOES = 25; + glClearColor = 26; + glClearColorx = 27; + glClearColorxOES = 28; + glClearDepthf = 29; + glClearDepthfOES = 30; + glClearDepthx = 31; + glClearDepthxOES = 32; + glClear = 33; + glClearStencil = 34; + glClientActiveTexture = 35; + glClipPlanef = 36; + glClipPlanefIMG = 37; + glClipPlanefOES = 38; + glClipPlanex = 39; + glClipPlanexIMG = 40; + glClipPlanexOES = 41; + glColor4f = 42; + glColor4ub = 43; + glColor4x = 44; + glColor4xOES = 45; + glColorMask = 46; + glColorPointer = 47; + glCompileShader = 48; + glCompressedTexImage2D = 49; + glCompressedTexImage3DOES = 50; + glCompressedTexSubImage2D = 51; + glCompressedTexSubImage3DOES = 52; + glCopyTexImage2D = 53; + glCopyTexSubImage2D = 54; + glCopyTexSubImage3DOES = 55; + glCoverageMaskNV = 56; + glCoverageOperationNV = 57; + glCreateProgram = 58; + glCreateShader = 59; + glCullFace = 60; + glCurrentPaletteMatrixOES = 61; + glDeleteBuffers = 62; + glDeleteFencesNV = 63; + glDeleteFramebuffers = 64; + glDeleteFramebuffersOES = 65; + glDeletePerfMonitorsAMD = 66; + glDeleteProgram = 67; + glDeleteRenderbuffers = 68; + glDeleteRenderbuffersOES = 69; + glDeleteShader = 70; + glDeleteTextures = 71; + glDeleteVertexArraysOES = 72; + glDepthFunc = 73; + glDepthMask = 74; + glDepthRangef = 75; + glDepthRangefOES = 76; + glDepthRangex = 77; + glDepthRangexOES = 78; + glDetachShader = 79; + glDisableClientState = 80; + glDisableDriverControlQCOM = 81; + glDisable = 82; + glDisableVertexAttribArray = 83; + glDiscardFramebufferEXT = 84; + glDrawArrays = 85; + glDrawElements = 86; + glDrawTexfOES = 87; + glDrawTexfvOES = 88; + glDrawTexiOES = 89; + glDrawTexivOES = 90; + glDrawTexsOES = 91; + glDrawTexsvOES = 92; + glDrawTexxOES = 93; + glDrawTexxvOES = 94; + glEGLImageTargetRenderbufferStorageOES = 95; + glEGLImageTargetTexture2DOES = 96; + glEnableClientState = 97; + glEnableDriverControlQCOM = 98; + glEnable = 99; + glEnableVertexAttribArray = 100; + glEndPerfMonitorAMD = 101; + glEndTilingQCOM = 102; + glExtGetBufferPointervQCOM = 103; + glExtGetBuffersQCOM = 104; + glExtGetFramebuffersQCOM = 105; + glExtGetProgramBinarySourceQCOM = 106; + glExtGetProgramsQCOM = 107; + glExtGetRenderbuffersQCOM = 108; + glExtGetShadersQCOM = 109; + glExtGetTexLevelParameterivQCOM = 110; + glExtGetTexSubImageQCOM = 111; + glExtGetTexturesQCOM = 112; + glExtIsProgramBinaryQCOM = 113; + glExtTexObjectStateOverrideiQCOM = 114; + glFinishFenceNV = 115; + glFinish = 116; + glFlush = 117; + glFogf = 118; + glFogfv = 119; + glFogx = 120; + glFogxOES = 121; + glFogxv = 122; + glFogxvOES = 123; + glFramebufferRenderbuffer = 124; + glFramebufferRenderbufferOES = 125; + glFramebufferTexture2D = 126; + glFramebufferTexture2DMultisampleIMG = 127; + glFramebufferTexture2DOES = 128; + glFramebufferTexture3DOES = 129; + glFrontFace = 130; + glFrustumf = 131; + glFrustumfOES = 132; + glFrustumx = 133; + glFrustumxOES = 134; + glGenBuffers = 135; + glGenerateMipmap = 136; + glGenerateMipmapOES = 137; + glGenFencesNV = 138; + glGenFramebuffers = 139; + glGenFramebuffersOES = 140; + glGenPerfMonitorsAMD = 141; + glGenRenderbuffers = 142; + glGenRenderbuffersOES = 143; + glGenTextures = 144; + glGenVertexArraysOES = 145; + glGetActiveAttrib = 146; + glGetActiveUniform = 147; + glGetAttachedShaders = 148; + glGetAttribLocation = 149; + glGetBooleanv = 150; + glGetBufferParameteriv = 151; + glGetBufferPointervOES = 152; + glGetClipPlanef = 153; + glGetClipPlanefOES = 154; + glGetClipPlanex = 155; + glGetClipPlanexOES = 156; + glGetDriverControlsQCOM = 157; + glGetDriverControlStringQCOM = 158; + glGetError = 159; + glGetFenceivNV = 160; + glGetFixedv = 161; + glGetFixedvOES = 162; + glGetFloatv = 163; + glGetFramebufferAttachmentParameteriv = 164; + glGetFramebufferAttachmentParameterivOES = 165; + glGetIntegerv = 166; + glGetLightfv = 167; + glGetLightxv = 168; + glGetLightxvOES = 169; + glGetMaterialfv = 170; + glGetMaterialxv = 171; + glGetMaterialxvOES = 172; + glGetPerfMonitorCounterDataAMD = 173; + glGetPerfMonitorCounterInfoAMD = 174; + glGetPerfMonitorCountersAMD = 175; + glGetPerfMonitorCounterStringAMD = 176; + glGetPerfMonitorGroupsAMD = 177; + glGetPerfMonitorGroupStringAMD = 178; + glGetPointerv = 179; + glGetProgramBinaryOES = 180; + glGetProgramInfoLog = 181; + glGetProgramiv = 182; + glGetRenderbufferParameteriv = 183; + glGetRenderbufferParameterivOES = 184; + glGetShaderInfoLog = 185; + glGetShaderiv = 186; + glGetShaderPrecisionFormat = 187; + glGetShaderSource = 188; + glGetString = 189; + glGetTexEnvfv = 190; + glGetTexEnviv = 191; + glGetTexEnvxv = 192; + glGetTexEnvxvOES = 193; + glGetTexGenfvOES = 194; + glGetTexGenivOES = 195; + glGetTexGenxvOES = 196; + glGetTexParameterfv = 197; + glGetTexParameteriv = 198; + glGetTexParameterxv = 199; + glGetTexParameterxvOES = 200; + glGetUniformfv = 201; + glGetUniformiv = 202; + glGetUniformLocation = 203; + glGetVertexAttribfv = 204; + glGetVertexAttribiv = 205; + glGetVertexAttribPointerv = 206; + glHint = 207; + glIsBuffer = 208; + glIsEnabled = 209; + glIsFenceNV = 210; + glIsFramebuffer = 211; + glIsFramebufferOES = 212; + glIsProgram = 213; + glIsRenderbuffer = 214; + glIsRenderbufferOES = 215; + glIsShader = 216; + glIsTexture = 217; + glIsVertexArrayOES = 218; + glLightf = 219; + glLightfv = 220; + glLightModelf = 221; + glLightModelfv = 222; + glLightModelx = 223; + glLightModelxOES = 224; + glLightModelxv = 225; + glLightModelxvOES = 226; + glLightx = 227; + glLightxOES = 228; + glLightxv = 229; + glLightxvOES = 230; + glLineWidth = 231; + glLineWidthx = 232; + glLineWidthxOES = 233; + glLinkProgram = 234; + glLoadIdentity = 235; + glLoadMatrixf = 236; + glLoadMatrixx = 237; + glLoadMatrixxOES = 238; + glLoadPaletteFromModelViewMatrixOES = 239; + glLogicOp = 240; + glMapBufferOES = 241; + glMaterialf = 242; + glMaterialfv = 243; + glMaterialx = 244; + glMaterialxOES = 245; + glMaterialxv = 246; + glMaterialxvOES = 247; + glMatrixIndexPointerOES = 248; + glMatrixMode = 249; + glMultiDrawArraysEXT = 250; + glMultiDrawElementsEXT = 251; + glMultiTexCoord4f = 252; + glMultiTexCoord4x = 253; + glMultiTexCoord4xOES = 254; + glMultMatrixf = 255; + glMultMatrixx = 256; + glMultMatrixxOES = 257; + glNormal3f = 258; + glNormal3x = 259; + glNormal3xOES = 260; + glNormalPointer = 261; + glOrthof = 262; + glOrthofOES = 263; + glOrthox = 264; + glOrthoxOES = 265; + glPixelStorei = 266; + glPointParameterf = 267; + glPointParameterfv = 268; + glPointParameterx = 269; + glPointParameterxOES = 270; + glPointParameterxv = 271; + glPointParameterxvOES = 272; + glPointSize = 273; + glPointSizePointerOES = 274; + glPointSizex = 275; + glPointSizexOES = 276; + glPolygonOffset = 277; + glPolygonOffsetx = 278; + glPolygonOffsetxOES = 279; + glPopMatrix = 280; + glProgramBinaryOES = 281; + glPushMatrix = 282; + glQueryMatrixxOES = 283; + glReadPixels = 284; + glReleaseShaderCompiler = 285; + glRenderbufferStorage = 286; + glRenderbufferStorageMultisampleIMG = 287; + glRenderbufferStorageOES = 288; + glRotatef = 289; + glRotatex = 290; + glRotatexOES = 291; + glSampleCoverage = 292; + glSampleCoveragex = 293; + glSampleCoveragexOES = 294; + glScalef = 295; + glScalex = 296; + glScalexOES = 297; + glScissor = 298; + glSelectPerfMonitorCountersAMD = 299; + glSetFenceNV = 300; + glShadeModel = 301; + glShaderBinary = 302; + glShaderSource = 303; + glStartTilingQCOM = 304; + glStencilFunc = 305; + glStencilFuncSeparate = 306; + glStencilMask = 307; + glStencilMaskSeparate = 308; + glStencilOp = 309; + glStencilOpSeparate = 310; + glTestFenceNV = 311; + glTexCoordPointer = 312; + glTexEnvf = 313; + glTexEnvfv = 314; + glTexEnvi = 315; + glTexEnviv = 316; + glTexEnvx = 317; + glTexEnvxOES = 318; + glTexEnvxv = 319; + glTexEnvxvOES = 320; + glTexGenfOES = 321; + glTexGenfvOES = 322; + glTexGeniOES = 323; + glTexGenivOES = 324; + glTexGenxOES = 325; + glTexGenxvOES = 326; + glTexImage2D = 327; + glTexImage3DOES = 328; + glTexParameterf = 329; + glTexParameterfv = 330; + glTexParameteri = 331; + glTexParameteriv = 332; + glTexParameterx = 333; + glTexParameterxOES = 334; + glTexParameterxv = 335; + glTexParameterxvOES = 336; + glTexSubImage2D = 337; + glTexSubImage3DOES = 338; + glTranslatef = 339; + glTranslatex = 340; + glTranslatexOES = 341; + glUniform1f = 342; + glUniform1fv = 343; + glUniform1i = 344; + glUniform1iv = 345; + glUniform2f = 346; + glUniform2fv = 347; + glUniform2i = 348; + glUniform2iv = 349; + glUniform3f = 350; + glUniform3fv = 351; + glUniform3i = 352; + glUniform3iv = 353; + glUniform4f = 354; + glUniform4fv = 355; + glUniform4i = 356; + glUniform4iv = 357; + glUniformMatrix2fv = 358; + glUniformMatrix3fv = 359; + glUniformMatrix4fv = 360; + glUnmapBufferOES = 361; + glUseProgram = 362; + glValidateProgram = 363; + glVertexAttrib1f = 364; + glVertexAttrib1fv = 365; + glVertexAttrib2f = 366; + glVertexAttrib2fv = 367; + glVertexAttrib3f = 368; + glVertexAttrib3fv = 369; + glVertexAttrib4f = 370; + glVertexAttrib4fv = 371; + glVertexAttribPointer = 372; + glVertexPointer = 373; + glViewport = 374; + glWeightPointerOES = 375; + + glActiveShaderProgramEXT = 502; + glAlphaFuncQCOM = 503; + glBeginQueryEXT = 504; + glBindProgramPipelineEXT = 505; + glBlitFramebufferANGLE = 506; + glCreateShaderProgramvEXT = 507; + glDeleteProgramPipelinesEXT = 508; + glDeleteQueriesEXT = 509; + glDrawBuffersNV = 510; + glEndQueryEXT = 511; + glFramebufferTexture2DMultisampleEXT = 512; + glGenProgramPipelinesEXT = 513; + glGenQueriesEXT = 514; + glGetGraphicsResetStatusEXT = 515; + glGetObjectLabelEXT = 516; + glGetProgramPipelineInfoLogEXT = 517; + glGetProgramPipelineivEXT = 518; + glGetQueryObjectuivEXT = 519; + glGetQueryivEXT = 520; + glGetnUniformfvEXT = 521; + glGetnUniformivEXT = 521; + glInsertEventMarkerEXT = 522; + glIsProgramPipelineEXT = 523; + glIsQueryEXT = 524; + glLabelObjectEXT = 525; + glPopGroupMarkerEXT = 526; + glProgramParameteriEXT = 527; + glProgramUniform1fEXT = 528; + glProgramUniform1fvEXT = 529; + glProgramUniform1iEXT = 530; + glProgramUniform1ivEXT = 531; + glProgramUniform2fEXT = 532; + glProgramUniform2fvEXT = 533; + glProgramUniform2iEXT = 534; + glProgramUniform2ivEXT = 535; + glProgramUniform3fEXT = 536; + glProgramUniform3fvEXT = 537; + glProgramUniform3iEXT = 538; + glProgramUniform3ivEXT = 539; + glProgramUniform4fEXT = 540; + glProgramUniform4fvEXT = 541; + glProgramUniform4iEXT = 542; + glProgramUniform4ivEXT = 543; + glProgramUniformMatrix2fvEXT = 544; + glProgramUniformMatrix3fvEXT = 545; + glProgramUniformMatrix4fvEXT = 546; + glPushGroupMarkerEXT = 547; + glReadBufferNV = 548; + glReadnPixelsEXT = 549; + glRenderbufferStorageMultisampleANGLE = 550; + glRenderbufferStorageMultisampleAPPLE = 551; + glRenderbufferStorageMultisampleEXT = 552; + glResolveMultisampleFramebufferAPPLE = 553; + glTexStorage1DEXT = 554; + glTexStorage2DEXT = 555; + glTexStorage3DEXT = 556; + glTextureStorage1DEXT = 557; + glTextureStorage2DEXT = 558; + glTextureStorage3DEXT = 559; + glUseProgramStagesEXT = 560; + glValidateProgramPipelineEXT = 561; + + eglGetDisplay = 2000; + eglInitialize = 2001; + eglTerminate = 2002; + eglGetConfigs = 2003; + eglChooseConfig = 2004; + eglGetConfigAttrib = 2005; + eglCreateWindowSurface = 2006; + eglCreatePixmapSurface = 2007; + eglCreatePbufferSurface = 2008; + eglDestroySurface = 2009; + eglQuerySurface = 2010; + eglCreateContext = 2011; + eglDestroyContext = 2012; + eglMakeCurrent = 2013; + eglGetCurrentContext = 2014; + eglGetCurrentSurface = 2015; + eglGetCurrentDisplay = 2016; + eglQueryContext = 2017; + eglWaitGL = 2018; + eglWaitNative = 2019; + eglSwapBuffers = 2020; + eglCopyBuffers = 2021; + eglGetError = 2022; + eglQueryString = 2023; + eglGetProcAddress = 2024; + eglSurfaceAttrib = 2025; + eglBindTexImage = 2026; + eglReleaseTexImage = 2027; + eglSwapInterval = 2028; + eglBindAPI = 2029; + eglQueryAPI = 2030; + eglWaitClient = 2031; + eglReleaseThread = 2032; + eglCreatePbufferFromClientBuffer = 2033; + eglLockSurfaceKHR = 2034; + eglUnlockSurfaceKHR = 2035; + eglCreateImageKHR = 2036; + eglDestroyImageKHR = 2037; + eglCreateSyncKHR = 2038; + eglDestroySyncKHR = 2039; + eglClientWaitSyncKHR = 2040; + eglGetSyncAttribKHR = 2041; + eglSetSwapRectangleANDROID = 2042; + eglGetRenderBufferANDROID = 2043; + eglGetSystemTimeFrequencyNV = 2044; + eglGetSystemTimeNV = 2045; + + invalid = 3000; + glVertexAttribPointerData = 3001; + } + + // A GL call's return data and arguments are formatted into this DataType + message DataType { + enum Type { + VOID = 1; // GLvoid + CHAR = 2; // GLchar + BYTE = 3; // GLbyte, GLubyte + INT = 4; // GLbitfield, GLshort, GLint, GLsizei, GLushort, GLuint, GLfixed + FLOAT = 5; // GLfloat, GLclampf + BOOL = 6; // GLboolean + ENUM = 7; // GLenum + }; + + required Type type = 1 [default = VOID]; + required bool isArray = 2 [default = false]; + + repeated int32 intValue = 3; + repeated float floatValue = 4; + repeated bytes charValue = 5; + repeated bytes rawBytes = 6; + repeated bool boolValue = 7; + } + + message FrameBuffer { + required int32 width = 1; + required int32 height = 2; + repeated bytes contents = 3; + } + + required int32 context_id = 1; // GL context ID + required int64 start_time = 2; // time when call was invoked + required int32 duration = 3; // duration of the call (MONOTONIC TIME) + + required Function function = 4 [default = invalid]; // GL function called + repeated DataType args = 5; // GL function's arguments + optional DataType returnValue = 6; // GL function's return value + + optional FrameBuffer fb = 7; // contents of the framebuffer + + optional int32 threadtime = 8; // duration of the call (THREAD TIME) +}; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/proto/gltrace.proto android-platform-frameworks-native-21/opengl/libs/GLES_trace/proto/gltrace.proto --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/proto/gltrace.proto 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/proto/gltrace.proto 1970-01-01 00:00:00.000000000 +0000 @@ -1,853 +0,0 @@ -/* - * 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. - */ - -package android.gltrace; - -option optimize_for = LITE_RUNTIME; - -option java_package = "com.android.ide.eclipse.gltrace"; -option java_outer_classname = "GLProtoBuf"; - -message GLMessage { - enum Function { - option allow_alias = true; - - glActiveTexture = 0; - glAlphaFunc = 1; - glAlphaFuncx = 2; - glAlphaFuncxOES = 3; - glAttachShader = 4; - glBeginPerfMonitorAMD = 5; - glBindAttribLocation = 6; - glBindBuffer = 7; - glBindFramebuffer = 8; - glBindFramebufferOES = 9; - glBindRenderbuffer = 10; - glBindRenderbufferOES = 11; - glBindTexture = 12; - glBindVertexArrayOES = 13; - glBlendColor = 14; - glBlendEquation = 15; - glBlendEquationOES = 16; - glBlendEquationSeparate = 17; - glBlendEquationSeparateOES = 18; - glBlendFunc = 19; - glBlendFuncSeparate = 20; - glBlendFuncSeparateOES = 21; - glBufferData = 22; - glBufferSubData = 23; - glCheckFramebufferStatus = 24; - glCheckFramebufferStatusOES = 25; - glClearColor = 26; - glClearColorx = 27; - glClearColorxOES = 28; - glClearDepthf = 29; - glClearDepthfOES = 30; - glClearDepthx = 31; - glClearDepthxOES = 32; - glClear = 33; - glClearStencil = 34; - glClientActiveTexture = 35; - glClipPlanef = 36; - glClipPlanefIMG = 37; - glClipPlanefOES = 38; - glClipPlanex = 39; - glClipPlanexIMG = 40; - glClipPlanexOES = 41; - glColor4f = 42; - glColor4ub = 43; - glColor4x = 44; - glColor4xOES = 45; - glColorMask = 46; - glColorPointer = 47; - glCompileShader = 48; - glCompressedTexImage2D = 49; - glCompressedTexImage3DOES = 50; - glCompressedTexSubImage2D = 51; - glCompressedTexSubImage3DOES = 52; - glCopyTexImage2D = 53; - glCopyTexSubImage2D = 54; - glCopyTexSubImage3DOES = 55; - glCoverageMaskNV = 56; - glCoverageOperationNV = 57; - glCreateProgram = 58; - glCreateShader = 59; - glCullFace = 60; - glCurrentPaletteMatrixOES = 61; - glDeleteBuffers = 62; - glDeleteFencesNV = 63; - glDeleteFramebuffers = 64; - glDeleteFramebuffersOES = 65; - glDeletePerfMonitorsAMD = 66; - glDeleteProgram = 67; - glDeleteRenderbuffers = 68; - glDeleteRenderbuffersOES = 69; - glDeleteShader = 70; - glDeleteTextures = 71; - glDeleteVertexArraysOES = 72; - glDepthFunc = 73; - glDepthMask = 74; - glDepthRangef = 75; - glDepthRangefOES = 76; - glDepthRangex = 77; - glDepthRangexOES = 78; - glDetachShader = 79; - glDisableClientState = 80; - glDisableDriverControlQCOM = 81; - glDisable = 82; - glDisableVertexAttribArray = 83; - glDiscardFramebufferEXT = 84; - glDrawArrays = 85; - glDrawElements = 86; - glDrawTexfOES = 87; - glDrawTexfvOES = 88; - glDrawTexiOES = 89; - glDrawTexivOES = 90; - glDrawTexsOES = 91; - glDrawTexsvOES = 92; - glDrawTexxOES = 93; - glDrawTexxvOES = 94; - glEGLImageTargetRenderbufferStorageOES = 95; - glEGLImageTargetTexture2DOES = 96; - glEnableClientState = 97; - glEnableDriverControlQCOM = 98; - glEnable = 99; - glEnableVertexAttribArray = 100; - glEndPerfMonitorAMD = 101; - glEndTilingQCOM = 102; - glExtGetBufferPointervQCOM = 103; - glExtGetBuffersQCOM = 104; - glExtGetFramebuffersQCOM = 105; - glExtGetProgramBinarySourceQCOM = 106; - glExtGetProgramsQCOM = 107; - glExtGetRenderbuffersQCOM = 108; - glExtGetShadersQCOM = 109; - glExtGetTexLevelParameterivQCOM = 110; - glExtGetTexSubImageQCOM = 111; - glExtGetTexturesQCOM = 112; - glExtIsProgramBinaryQCOM = 113; - glExtTexObjectStateOverrideiQCOM = 114; - glFinishFenceNV = 115; - glFinish = 116; - glFlush = 117; - glFogf = 118; - glFogfv = 119; - glFogx = 120; - glFogxOES = 121; - glFogxv = 122; - glFogxvOES = 123; - glFramebufferRenderbuffer = 124; - glFramebufferRenderbufferOES = 125; - glFramebufferTexture2D = 126; - glFramebufferTexture2DMultisampleIMG = 127; - glFramebufferTexture2DOES = 128; - glFramebufferTexture3DOES = 129; - glFrontFace = 130; - glFrustumf = 131; - glFrustumfOES = 132; - glFrustumx = 133; - glFrustumxOES = 134; - glGenBuffers = 135; - glGenerateMipmap = 136; - glGenerateMipmapOES = 137; - glGenFencesNV = 138; - glGenFramebuffers = 139; - glGenFramebuffersOES = 140; - glGenPerfMonitorsAMD = 141; - glGenRenderbuffers = 142; - glGenRenderbuffersOES = 143; - glGenTextures = 144; - glGenVertexArraysOES = 145; - glGetActiveAttrib = 146; - glGetActiveUniform = 147; - glGetAttachedShaders = 148; - glGetAttribLocation = 149; - glGetBooleanv = 150; - glGetBufferParameteriv = 151; - glGetBufferPointervOES = 152; - glGetClipPlanef = 153; - glGetClipPlanefOES = 154; - glGetClipPlanex = 155; - glGetClipPlanexOES = 156; - glGetDriverControlsQCOM = 157; - glGetDriverControlStringQCOM = 158; - glGetError = 159; - glGetFenceivNV = 160; - glGetFixedv = 161; - glGetFixedvOES = 162; - glGetFloatv = 163; - glGetFramebufferAttachmentParameteriv = 164; - glGetFramebufferAttachmentParameterivOES = 165; - glGetIntegerv = 166; - glGetLightfv = 167; - glGetLightxv = 168; - glGetLightxvOES = 169; - glGetMaterialfv = 170; - glGetMaterialxv = 171; - glGetMaterialxvOES = 172; - glGetPerfMonitorCounterDataAMD = 173; - glGetPerfMonitorCounterInfoAMD = 174; - glGetPerfMonitorCountersAMD = 175; - glGetPerfMonitorCounterStringAMD = 176; - glGetPerfMonitorGroupsAMD = 177; - glGetPerfMonitorGroupStringAMD = 178; - glGetPointerv = 179; - glGetProgramBinaryOES = 180; - glGetProgramInfoLog = 181; - glGetProgramiv = 182; - glGetRenderbufferParameteriv = 183; - glGetRenderbufferParameterivOES = 184; - glGetShaderInfoLog = 185; - glGetShaderiv = 186; - glGetShaderPrecisionFormat = 187; - glGetShaderSource = 188; - glGetString = 189; - glGetTexEnvfv = 190; - glGetTexEnviv = 191; - glGetTexEnvxv = 192; - glGetTexEnvxvOES = 193; - glGetTexGenfvOES = 194; - glGetTexGenivOES = 195; - glGetTexGenxvOES = 196; - glGetTexParameterfv = 197; - glGetTexParameteriv = 198; - glGetTexParameterxv = 199; - glGetTexParameterxvOES = 200; - glGetUniformfv = 201; - glGetUniformiv = 202; - glGetUniformLocation = 203; - glGetVertexAttribfv = 204; - glGetVertexAttribiv = 205; - glGetVertexAttribPointerv = 206; - glHint = 207; - glIsBuffer = 208; - glIsEnabled = 209; - glIsFenceNV = 210; - glIsFramebuffer = 211; - glIsFramebufferOES = 212; - glIsProgram = 213; - glIsRenderbuffer = 214; - glIsRenderbufferOES = 215; - glIsShader = 216; - glIsTexture = 217; - glIsVertexArrayOES = 218; - glLightf = 219; - glLightfv = 220; - glLightModelf = 221; - glLightModelfv = 222; - glLightModelx = 223; - glLightModelxOES = 224; - glLightModelxv = 225; - glLightModelxvOES = 226; - glLightx = 227; - glLightxOES = 228; - glLightxv = 229; - glLightxvOES = 230; - glLineWidth = 231; - glLineWidthx = 232; - glLineWidthxOES = 233; - glLinkProgram = 234; - glLoadIdentity = 235; - glLoadMatrixf = 236; - glLoadMatrixx = 237; - glLoadMatrixxOES = 238; - glLoadPaletteFromModelViewMatrixOES = 239; - glLogicOp = 240; - glMapBufferOES = 241; - glMaterialf = 242; - glMaterialfv = 243; - glMaterialx = 244; - glMaterialxOES = 245; - glMaterialxv = 246; - glMaterialxvOES = 247; - glMatrixIndexPointerOES = 248; - glMatrixMode = 249; - glMultiDrawArraysEXT = 250; - glMultiDrawElementsEXT = 251; - glMultiTexCoord4f = 252; - glMultiTexCoord4x = 253; - glMultiTexCoord4xOES = 254; - glMultMatrixf = 255; - glMultMatrixx = 256; - glMultMatrixxOES = 257; - glNormal3f = 258; - glNormal3x = 259; - glNormal3xOES = 260; - glNormalPointer = 261; - glOrthof = 262; - glOrthofOES = 263; - glOrthox = 264; - glOrthoxOES = 265; - glPixelStorei = 266; - glPointParameterf = 267; - glPointParameterfv = 268; - glPointParameterx = 269; - glPointParameterxOES = 270; - glPointParameterxv = 271; - glPointParameterxvOES = 272; - glPointSize = 273; - glPointSizePointerOES = 274; - glPointSizex = 275; - glPointSizexOES = 276; - glPolygonOffset = 277; - glPolygonOffsetx = 278; - glPolygonOffsetxOES = 279; - glPopMatrix = 280; - glProgramBinaryOES = 281; - glPushMatrix = 282; - glQueryMatrixxOES = 283; - glReadPixels = 284; - glReleaseShaderCompiler = 285; - glRenderbufferStorage = 286; - glRenderbufferStorageMultisampleIMG = 287; - glRenderbufferStorageOES = 288; - glRotatef = 289; - glRotatex = 290; - glRotatexOES = 291; - glSampleCoverage = 292; - glSampleCoveragex = 293; - glSampleCoveragexOES = 294; - glScalef = 295; - glScalex = 296; - glScalexOES = 297; - glScissor = 298; - glSelectPerfMonitorCountersAMD = 299; - glSetFenceNV = 300; - glShadeModel = 301; - glShaderBinary = 302; - glShaderSource = 303; - glStartTilingQCOM = 304; - glStencilFunc = 305; - glStencilFuncSeparate = 306; - glStencilMask = 307; - glStencilMaskSeparate = 308; - glStencilOp = 309; - glStencilOpSeparate = 310; - glTestFenceNV = 311; - glTexCoordPointer = 312; - glTexEnvf = 313; - glTexEnvfv = 314; - glTexEnvi = 315; - glTexEnviv = 316; - glTexEnvx = 317; - glTexEnvxOES = 318; - glTexEnvxv = 319; - glTexEnvxvOES = 320; - glTexGenfOES = 321; - glTexGenfvOES = 322; - glTexGeniOES = 323; - glTexGenivOES = 324; - glTexGenxOES = 325; - glTexGenxvOES = 326; - glTexImage2D = 327; - glTexImage3DOES = 328; - glTexParameterf = 329; - glTexParameterfv = 330; - glTexParameteri = 331; - glTexParameteriv = 332; - glTexParameterx = 333; - glTexParameterxOES = 334; - glTexParameterxv = 335; - glTexParameterxvOES = 336; - glTexSubImage2D = 337; - glTexSubImage3DOES = 338; - glTranslatef = 339; - glTranslatex = 340; - glTranslatexOES = 341; - glUniform1f = 342; - glUniform1fv = 343; - glUniform1i = 344; - glUniform1iv = 345; - glUniform2f = 346; - glUniform2fv = 347; - glUniform2i = 348; - glUniform2iv = 349; - glUniform3f = 350; - glUniform3fv = 351; - glUniform3i = 352; - glUniform3iv = 353; - glUniform4f = 354; - glUniform4fv = 355; - glUniform4i = 356; - glUniform4iv = 357; - glUniformMatrix2fv = 358; - glUniformMatrix3fv = 359; - glUniformMatrix4fv = 360; - glUnmapBufferOES = 361; - glUseProgram = 362; - glValidateProgram = 363; - glVertexAttrib1f = 364; - glVertexAttrib1fv = 365; - glVertexAttrib2f = 366; - glVertexAttrib2fv = 367; - glVertexAttrib3f = 368; - glVertexAttrib3fv = 369; - glVertexAttrib4f = 370; - glVertexAttrib4fv = 371; - glVertexAttribPointer = 372; - glVertexPointer = 373; - glViewport = 374; - glWeightPointerOES = 375; - glReadBuffer = 376; - glDrawRangeElements = 377; - glTexImage3D = 378; - glTexSubImage3D = 379; - glCopyTexSubImage3D = 380; - glCompressedTexImage3D = 381; - glCompressedTexSubImage3D = 382; - glGenQueries = 383; - glDeleteQueries = 384; - glIsQuery = 385; - glBeginQuery = 386; - glEndQuery = 387; - glGetQueryiv = 388; - glGetQueryObjectuiv = 389; - glUnmapBuffer = 390; - glGetBufferPointerv = 391; - glDrawBuffers = 392; - glUniformMatrix2x3fv = 393; - glUniformMatrix3x2fv = 394; - glUniformMatrix2x4fv = 395; - glUniformMatrix4x2fv = 396; - glUniformMatrix3x4fv = 397; - glUniformMatrix4x3fv = 398; - glBlitFramebuffer = 399; - glRenderbufferStorageMultisample = 400; - glFramebufferTextureLayer = 401; - glMapBufferRange = 402; - glFlushMappedBufferRange = 403; - glBindVertexArray = 404; - glDeleteVertexArrays = 405; - glGenVertexArrays = 406; - glIsVertexArray = 407; - glGetIntegeri_v = 408; - glBeginTransformFeedback = 409; - glEndTransformFeedback = 410; - glBindBufferRange = 411; - glBindBufferBase = 412; - glTransformFeedbackVaryings = 413; - glGetTransformFeedbackVarying = 414; - glVertexAttribIPointer = 415; - glGetVertexAttribIiv = 416; - glGetVertexAttribIuiv = 417; - glVertexAttribI4i = 418; - glVertexAttribI4ui = 419; - glVertexAttribI4iv = 420; - glVertexAttribI4uiv = 421; - glGetUniformuiv = 422; - glGetFragDataLocation = 423; - glUniform1ui = 424; - glUniform2ui = 425; - glUniform3ui = 426; - glUniform4ui = 427; - glUniform1uiv = 428; - glUniform2uiv = 429; - glUniform3uiv = 430; - glUniform4uiv = 431; - glClearBufferiv = 432; - glClearBufferuiv = 433; - glClearBufferfv = 434; - glClearBufferfi = 435; - glGetStringi = 436; - glCopyBufferSubData = 437; - glGetUniformIndices = 438; - glGetActiveUniformsiv = 439; - glGetUniformBlockIndex = 440; - glGetActiveUniformBlockiv = 441; - glGetActiveUniformBlockName = 442; - glUniformBlockBinding = 443; - glDrawArraysInstanced = 444; - glDrawElementsInstanced = 445; - glFenceSync = 446; - glIsSync = 447; - glDeleteSync = 448; - glClientWaitSync = 449; - glWaitSync = 450; - glGetInteger64v = 451; - glGetSynciv = 452; - glGetInteger64i_v = 453; - glGetBufferParameteri64v = 454; - glGenSamplers = 455; - glDeleteSamplers = 456; - glIsSampler = 457; - glBindSampler = 458; - glSamplerParameteri = 459; - glSamplerParameteriv = 460; - glSamplerParameterf = 461; - glSamplerParameterfv = 462; - glGetSamplerParameteriv = 463; - glGetSamplerParameterfv = 464; - glVertexAttribDivisor = 465; - glBindTransformFeedback = 466; - glDeleteTransformFeedbacks = 467; - glGenTransformFeedbacks = 468; - glIsTransformFeedback = 469; - glPauseTransformFeedback = 470; - glResumeTransformFeedback = 471; - glGetProgramBinary = 472; - glProgramBinary = 473; - glProgramParameteri = 474; - glInvalidateFramebuffer = 475; - glInvalidateSubFramebuffer = 476; - glTexStorage2D = 477; - glTexStorage3D = 478; - glGetInternalformativ = 479; - glBeginPerfQueryINTEL = 480; - glCreatePerfQueryINTEL = 481; - glDeletePerfQueryINTEL = 482; - glEndPerfQueryINTEL = 483; - glGetFirstPerfQueryIdINTEL = 484; - glGetNextPerfQueryIdINTEL = 485; - glGetPerfCounterInfoINTEL = 486; - glGetPerfQueryDataINTEL = 487; - glGetPerfQueryIdByNameINTEL = 488; - glGetPerfQueryInfoINTEL = 489; - glBlendBarrierKHR = 490; - glBlendBarrierNV = 491; - glBlendParameteriNV = 492; - glBlitFramebufferNV = 493; - glFenceSyncAPPLE = 494; - glIsSyncAPPLE = 495; - glDeleteSyncAPPLE = 496; - glClientWaitSyncAPPLE = 497; - glWaitSyncAPPLE = 498; - glGetInteger64vAPPLE = 499; - glGetSyncivAPPLE = 500; - glCopyBufferSubDataNV = 501; - glActiveShaderProgramEXT = 502; - glAlphaFuncQCOM = 503; - glBeginQueryEXT = 504; - glBindProgramPipelineEXT = 505; - glBlitFramebufferANGLE = 506; - glCreateShaderProgramvEXT = 507; - glDeleteProgramPipelinesEXT = 508; - glDeleteQueriesEXT = 509; - glDrawBuffersNV = 510; - glEndQueryEXT = 511; - glFramebufferTexture2DMultisampleEXT = 512; - glGenProgramPipelinesEXT = 513; - glGenQueriesEXT = 514; - glGetGraphicsResetStatusEXT = 515; - glGetObjectLabelEXT = 516; - glGetProgramPipelineInfoLogEXT = 517; - glGetProgramPipelineivEXT = 518; - glGetQueryObjectuivEXT = 519; - glGetQueryivEXT = 520; - glGetnUniformfvEXT = 521; - glGetnUniformivEXT = 521; - glInsertEventMarkerEXT = 522; - glIsProgramPipelineEXT = 523; - glIsQueryEXT = 524; - glLabelObjectEXT = 525; - glPopGroupMarkerEXT = 526; - glProgramParameteriEXT = 527; - glProgramUniform1fEXT = 528; - glProgramUniform1fvEXT = 529; - glProgramUniform1iEXT = 530; - glProgramUniform1ivEXT = 531; - glProgramUniform2fEXT = 532; - glProgramUniform2fvEXT = 533; - glProgramUniform2iEXT = 534; - glProgramUniform2ivEXT = 535; - glProgramUniform3fEXT = 536; - glProgramUniform3fvEXT = 537; - glProgramUniform3iEXT = 538; - glProgramUniform3ivEXT = 539; - glProgramUniform4fEXT = 540; - glProgramUniform4fvEXT = 541; - glProgramUniform4iEXT = 542; - glProgramUniform4ivEXT = 543; - glProgramUniformMatrix2fvEXT = 544; - glProgramUniformMatrix3fvEXT = 545; - glProgramUniformMatrix4fvEXT = 546; - glPushGroupMarkerEXT = 547; - glReadBufferNV = 548; - glReadnPixelsEXT = 549; - glRenderbufferStorageMultisampleANGLE = 550; - glRenderbufferStorageMultisampleAPPLE = 551; - glRenderbufferStorageMultisampleEXT = 552; - glResolveMultisampleFramebufferAPPLE = 553; - glTexStorage1DEXT = 554; - glTexStorage2DEXT = 555; - glTexStorage3DEXT = 556; - glTextureStorage1DEXT = 557; - glTextureStorage2DEXT = 558; - glTextureStorage3DEXT = 559; - glUseProgramStagesEXT = 560; - glValidateProgramPipelineEXT = 561; - glCopyTextureLevelsAPPLE = 562; - glDebugMessageControlKHR = 563; - glDebugMessageInsertKHR = 564; - glDebugMessageCallbackKHR = 565; - glGetDebugMessageLogKHR = 566; - glPushDebugGroupKHR = 567; - glPopDebugGroupKHR = 568; - glObjectLabelKHR = 569; - glGetObjectLabelKHR = 570; - glObjectPtrLabelKHR = 571; - glGetObjectPtrLabelKHR = 572; - glGetPointervKHR = 573; - glDrawArraysInstancedANGLE = 574; - glDrawElementsInstancedANGLE = 575; - glVertexAttribDivisorANGLE = 576; - glDrawArraysInstancedEXT = 577; - glDrawElementsInstancedEXT = 578; - glVertexAttribDivisorEXT = 579; - glDrawArraysInstancedNV = 580; - glDrawElementsInstancedNV = 581; - glVertexAttribDivisorNV = 582; - glDrawBuffersEXT = 583; - glReadBufferIndexedEXT = 584; - glDrawBuffersIndexedEXT = 585; - glGetIntegeri_vEXT = 586; - glMapBufferRangeEXT = 587; - glFlushMappedBufferRangeEXT = 588; - glQueryCounterEXT = 589; - glGetQueryObjecti64vEXT = 590; - glGetQueryObjectivEXT = 591; - glGetQueryObjectui64vEXT = 592; - glGetTranslatedShaderSourceANGLE = 593; - glMinSampleShadingOES = 594; - glMultiTexCoord1bOES = 595; - glMultiTexCoord1bvOES = 596; - glMultiTexCoord2bOES = 597; - glMultiTexCoord2bvOES = 598; - glMultiTexCoord3bOES = 599; - glMultiTexCoord3bvOES = 600; - glMultiTexCoord4bOES = 601; - glMultiTexCoord4bvOES = 602; - glTexCoord1bOES = 603; - glTexCoord1bvOES = 604; - glTexCoord2bOES = 605; - glTexCoord2bvOES = 606; - glTexCoord3bOES = 607; - glTexCoord3bvOES = 608; - glTexCoord4bOES = 609; - glTexCoord4bvOES = 610; - glVertex2bOES = 611; - glVertex2bvOES = 612; - glVertex3bOES = 613; - glVertex3bvOES = 614; - glVertex4bOES = 615; - glVertex4bvOES = 616; - glProgramUniform1uiEXT = 617; - glProgramUniform2uiEXT = 618; - glProgramUniform3uiEXT = 619; - glProgramUniform4uiEXT = 620; - glProgramUniform1uivEXT = 621; - glProgramUniform2uivEXT = 622; - glProgramUniform3uivEXT = 623; - glProgramUniform4uivEXT = 624; - glProgramUniformMatrix2x3fvEXT = 625; - glProgramUniformMatrix3x2fvEXT = 626; - glProgramUniformMatrix2x4fvEXT = 627; - glProgramUniformMatrix4x2fvEXT = 628; - glProgramUniformMatrix3x4fvEXT = 629; - glProgramUniformMatrix4x3fvEXT = 630; - glRenderbufferStorageMultisampleNV = 631; - glSampleCoverageOES = 632; - glTexStorage3DMultisampleOES = 633; - glUniformMatrix2x3fvNV = 634; - glUniformMatrix3x2fvNV = 635; - glUniformMatrix2x4fvNV = 636; - glUniformMatrix4x2fvNV = 637; - glUniformMatrix3x4fvNV = 638; - glUniformMatrix4x3fvNV = 639; - glActiveShaderProgram = 640; - glBindImageTexture = 641; - glBindProgramPipeline = 642; - glBindVertexBuffer = 643; - glCreateShaderProgramv = 644; - glDeleteProgramPipelines = 645; - glDispatchCompute = 646; - glDispatchComputeIndirect = 647; - glDrawArraysIndirect = 648; - glDrawElementsIndirect = 649; - glFramebufferParameteri = 650; - glGenProgramPipelines = 651; - glGetBooleani_v = 652; - glGetFramebufferParameteriv = 653; - glGetMultisamplefv = 654; - glGetProgramInterfaceiv = 655; - glGetProgramPipelineInfoLog = 656; - glGetProgramPipelineiv = 657; - glGetProgramResourceIndex = 658; - glGetProgramResourceLocation = 659; - glGetProgramResourceName = 660; - glGetProgramResourceiv = 661; - glGetTexLevelParameterfv = 662; - glGetTexLevelParameteriv = 663; - glIsProgramPipeline = 664; - glMemoryBarrier = 665; - glMemoryBarrierByRegion = 666; - glProgramUniform1f = 667; - glProgramUniform1fv = 668; - glProgramUniform1i = 669; - glProgramUniform1iv = 670; - glProgramUniform1ui = 671; - glProgramUniform1uiv = 672; - glProgramUniform2f = 673; - glProgramUniform2fv = 674; - glProgramUniform2i = 675; - glProgramUniform2iv = 676; - glProgramUniform2ui = 677; - glProgramUniform2uiv = 678; - glProgramUniform3f = 679; - glProgramUniform3fv = 680; - glProgramUniform3i = 681; - glProgramUniform3iv = 682; - glProgramUniform3ui = 683; - glProgramUniform3uiv = 684; - glProgramUniform4f = 685; - glProgramUniform4fv = 686; - glProgramUniform4i = 687; - glProgramUniform4iv = 688; - glProgramUniform4ui = 689; - glProgramUniform4uiv = 690; - glProgramUniformMatrix2fv = 691; - glProgramUniformMatrix2x3fv = 692; - glProgramUniformMatrix2x4fv = 693; - glProgramUniformMatrix3fv = 694; - glProgramUniformMatrix3x2fv = 695; - glProgramUniformMatrix3x4fv = 696; - glProgramUniformMatrix4fv = 697; - glProgramUniformMatrix4x2fv = 698; - glProgramUniformMatrix4x3fv = 699; - glSampleMaski = 700; - glTexStorage2DMultisample = 701; - glUseProgramStages = 702; - glValidateProgramPipeline = 703; - glVertexAttribBinding = 704; - glVertexAttribFormat = 705; - glVertexAttribIFormat = 706; - glVertexBindingDivisor = 707; - glBlendEquationSeparateiEXT = 708; - glBlendEquationiEXT = 709; - glBlendFuncSeparateiEXT = 710; - glBlendFunciEXT = 711; - glColorMaskiEXT = 712; - glCopyImageSubDataEXT = 713; - glDisableiEXT = 714; - glEnableiEXT = 715; - glFramebufferTextureEXT = 716; - glGetSamplerParameterIivEXT = 717; - glGetSamplerParameterIuivEXT = 718; - glGetTexParameterIivEXT = 719; - glGetTexParameterIuivEXT = 720; - glIsEnablediEXT = 721; - glPatchParameteriEXT = 722; - glPrimitiveBoundingBoxEXT = 723; - glSamplerParameterIivEXT = 724; - glSamplerParameterIuivEXT = 725; - glTexBufferEXT = 726; - glTexBufferRangeEXT = 727; - glTexParameterIivEXT = 728; - glTexParameterIuivEXT = 729; - glTextureViewEXT = 730; - - eglGetDisplay = 2000; - eglInitialize = 2001; - eglTerminate = 2002; - eglGetConfigs = 2003; - eglChooseConfig = 2004; - eglGetConfigAttrib = 2005; - eglCreateWindowSurface = 2006; - eglCreatePixmapSurface = 2007; - eglCreatePbufferSurface = 2008; - eglDestroySurface = 2009; - eglQuerySurface = 2010; - eglCreateContext = 2011; - eglDestroyContext = 2012; - eglMakeCurrent = 2013; - eglGetCurrentContext = 2014; - eglGetCurrentSurface = 2015; - eglGetCurrentDisplay = 2016; - eglQueryContext = 2017; - eglWaitGL = 2018; - eglWaitNative = 2019; - eglSwapBuffers = 2020; - eglCopyBuffers = 2021; - eglGetError = 2022; - eglQueryString = 2023; - eglGetProcAddress = 2024; - eglSurfaceAttrib = 2025; - eglBindTexImage = 2026; - eglReleaseTexImage = 2027; - eglSwapInterval = 2028; - eglBindAPI = 2029; - eglQueryAPI = 2030; - eglWaitClient = 2031; - eglReleaseThread = 2032; - eglCreatePbufferFromClientBuffer = 2033; - eglLockSurfaceKHR = 2034; - eglUnlockSurfaceKHR = 2035; - eglCreateImageKHR = 2036; - eglDestroyImageKHR = 2037; - eglCreateSyncKHR = 2038; - eglDestroySyncKHR = 2039; - eglClientWaitSyncKHR = 2040; - eglGetSyncAttribKHR = 2041; - eglSetSwapRectangleANDROID = 2042; - eglGetRenderBufferANDROID = 2043; - eglGetSystemTimeFrequencyNV = 2044; - eglGetSystemTimeNV = 2045; - - invalid = 3000; - glVertexAttribPointerData = 3001; - } - - // A GL call's return data and arguments are formatted into this DataType - message DataType { - enum Type { - VOID = 1; // GLvoid - CHAR = 2; // GLchar - BYTE = 3; // GLbyte, GLubyte - INT = 4; // GLbitfield, GLshort, GLint, GLsizei, GLushort, GLuint, GLfixed - FLOAT = 5; // GLfloat, GLclampf - BOOL = 6; // GLboolean - ENUM = 7; // GLenum - INT64 = 8; // GLint64, GLuint64 - }; - - required Type type = 1 [default = VOID]; - required bool isArray = 2 [default = false]; - - repeated int32 intValue = 3; - repeated float floatValue = 4; - repeated bytes charValue = 5; - repeated bytes rawBytes = 6; - repeated bool boolValue = 7; - repeated int64 int64Value = 8; - } - - message FrameBuffer { - required int32 width = 1; - required int32 height = 2; - repeated bytes contents = 3; - } - - required int32 context_id = 1; // GL context ID - required int64 start_time = 2; // time when call was invoked - required int32 duration = 3; // duration of the call (MONOTONIC TIME) - - required Function function = 4 [default = invalid]; // GL function called - repeated DataType args = 5; // GL function's arguments - optional DataType returnValue = 6; // GL function's return value - - optional FrameBuffer fb = 7; // contents of the framebuffer - - optional int32 threadtime = 8; // duration of the call (THREAD TIME) -}; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_api.cpp android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_api.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_api.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_api.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -18,8 +18,9 @@ #include #include +#include -#include "frameworks/native/opengl/libs/GLES_trace/proto/gltrace.pb.h" +#include "gltrace.pb.h" #include "gltrace_context.h" #include "gltrace_fixup.h" #include "gltrace_transport.h" @@ -91,7 +92,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar * name) { +void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -112,8 +113,8 @@ // copy argument name GLMessage_DataType *arg_name = glmsg.add_args(); arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -268,7 +269,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { +void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -410,40 +411,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha) { +void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glBlendFuncSeparate); - // copy argument sfactorRGB - GLMessage_DataType *arg_sfactorRGB = glmsg.add_args(); - arg_sfactorRGB->set_isarray(false); - arg_sfactorRGB->set_type(GLMessage::DataType::ENUM); - arg_sfactorRGB->add_intvalue((int)sfactorRGB); + // copy argument srcRGB + GLMessage_DataType *arg_srcRGB = glmsg.add_args(); + arg_srcRGB->set_isarray(false); + arg_srcRGB->set_type(GLMessage::DataType::ENUM); + arg_srcRGB->add_intvalue((int)srcRGB); - // copy argument dfactorRGB - GLMessage_DataType *arg_dfactorRGB = glmsg.add_args(); - arg_dfactorRGB->set_isarray(false); - arg_dfactorRGB->set_type(GLMessage::DataType::ENUM); - arg_dfactorRGB->add_intvalue((int)dfactorRGB); + // copy argument dstRGB + GLMessage_DataType *arg_dstRGB = glmsg.add_args(); + arg_dstRGB->set_isarray(false); + arg_dstRGB->set_type(GLMessage::DataType::ENUM); + arg_dstRGB->add_intvalue((int)dstRGB); - // copy argument sfactorAlpha - GLMessage_DataType *arg_sfactorAlpha = glmsg.add_args(); - arg_sfactorAlpha->set_isarray(false); - arg_sfactorAlpha->set_type(GLMessage::DataType::ENUM); - arg_sfactorAlpha->add_intvalue((int)sfactorAlpha); + // copy argument srcAlpha + GLMessage_DataType *arg_srcAlpha = glmsg.add_args(); + arg_srcAlpha->set_isarray(false); + arg_srcAlpha->set_type(GLMessage::DataType::ENUM); + arg_srcAlpha->add_intvalue((int)srcAlpha); - // copy argument dfactorAlpha - GLMessage_DataType *arg_dfactorAlpha = glmsg.add_args(); - arg_dfactorAlpha->set_isarray(false); - arg_dfactorAlpha->set_type(GLMessage::DataType::ENUM); - arg_dfactorAlpha->add_intvalue((int)dfactorAlpha); + // copy argument dstAlpha + GLMessage_DataType *arg_dstAlpha = glmsg.add_args(); + arg_dstAlpha->set_isarray(false); + arg_dstAlpha->set_type(GLMessage::DataType::ENUM); + arg_dstAlpha->add_intvalue((int)dstAlpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendFuncSeparate(sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha); + glContext->hooks->gl.glBlendFuncSeparate(srcRGB, dstRGB, srcAlpha, dstAlpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -456,7 +457,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const void * data, GLenum usage) { +void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -477,8 +478,8 @@ // copy argument data GLMessage_DataType *arg_data = glmsg.add_args(); arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // copy argument usage GLMessage_DataType *arg_usage = glmsg.add_args(); @@ -503,7 +504,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void * data) { +void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -530,8 +531,8 @@ // copy argument data GLMessage_DataType *arg_data = glmsg.add_args(); arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -614,7 +615,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { +void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -660,22 +661,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearDepthf(GLfloat d) { +void GLTrace_glClearDepthf(GLclampf depth) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glClearDepthf); - // copy argument d - GLMessage_DataType *arg_d = glmsg.add_args(); - arg_d->set_isarray(false); - arg_d->set_type(GLMessage::DataType::FLOAT); - arg_d->add_floatvalue(d); + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::FLOAT); + arg_depth->add_floatvalue(depth); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearDepthf(d); + glContext->hooks->gl.glClearDepthf(depth); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -790,7 +791,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data) { +void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -841,8 +842,8 @@ // copy argument data GLMessage_DataType *arg_data = glmsg.add_args(); arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -861,7 +862,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data) { +void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -918,8 +919,8 @@ // copy argument data GLMessage_DataType *arg_data = glmsg.add_args(); arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1172,7 +1173,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteBuffers(GLsizei n, const GLuint * buffers) { +void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1187,8 +1188,8 @@ // copy argument buffers GLMessage_DataType *arg_buffers = glmsg.add_args(); arg_buffers->set_isarray(false); - arg_buffers->set_type(GLMessage::DataType::INT64); - arg_buffers->add_int64value((uintptr_t)buffers); + arg_buffers->set_type(GLMessage::DataType::INT); + arg_buffers->add_intvalue((int)buffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1207,7 +1208,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint * framebuffers) { +void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1222,8 +1223,8 @@ // copy argument framebuffers GLMessage_DataType *arg_framebuffers = glmsg.add_args(); arg_framebuffers->set_isarray(false); - arg_framebuffers->set_type(GLMessage::DataType::INT64); - arg_framebuffers->add_int64value((uintptr_t)framebuffers); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1270,7 +1271,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint * renderbuffers) { +void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1285,8 +1286,8 @@ // copy argument renderbuffers GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); arg_renderbuffers->set_isarray(false); - arg_renderbuffers->set_type(GLMessage::DataType::INT64); - arg_renderbuffers->add_int64value((uintptr_t)renderbuffers); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1333,7 +1334,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteTextures(GLsizei n, const GLuint * textures) { +void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1348,8 +1349,8 @@ // copy argument textures GLMessage_DataType *arg_textures = glmsg.add_args(); arg_textures->set_isarray(false); - arg_textures->set_type(GLMessage::DataType::INT64); - arg_textures->add_int64value((uintptr_t)textures); + arg_textures->set_type(GLMessage::DataType::INT); + arg_textures->add_intvalue((int)textures); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1424,28 +1425,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDepthRangef(GLfloat n, GLfloat f) { +void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glDepthRangef); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::FLOAT); - arg_n->add_floatvalue(n); + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::FLOAT); - arg_f->add_floatvalue(f); + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDepthRangef(n, f); + glContext->hooks->gl.glDepthRangef(zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1588,7 +1589,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void * indices) { +void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1615,8 +1616,8 @@ // copy argument indices GLMessage_DataType *arg_indices = glmsg.add_args(); arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); + arg_indices->set_type(GLMessage::DataType::INT); + arg_indices->add_intvalue((int)indices); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1861,7 +1862,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenBuffers(GLsizei n, GLuint * buffers) { +void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1876,8 +1877,8 @@ // copy argument buffers GLMessage_DataType *arg_buffers = glmsg.add_args(); arg_buffers->set_isarray(false); - arg_buffers->set_type(GLMessage::DataType::INT64); - arg_buffers->add_int64value((uintptr_t)buffers); + arg_buffers->set_type(GLMessage::DataType::INT); + arg_buffers->add_intvalue((int)buffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1924,7 +1925,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenFramebuffers(GLsizei n, GLuint * framebuffers) { +void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1939,8 +1940,8 @@ // copy argument framebuffers GLMessage_DataType *arg_framebuffers = glmsg.add_args(); arg_framebuffers->set_isarray(false); - arg_framebuffers->set_type(GLMessage::DataType::INT64); - arg_framebuffers->add_int64value((uintptr_t)framebuffers); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1959,7 +1960,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenRenderbuffers(GLsizei n, GLuint * renderbuffers) { +void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -1974,8 +1975,8 @@ // copy argument renderbuffers GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); arg_renderbuffers->set_isarray(false); - arg_renderbuffers->set_type(GLMessage::DataType::INT64); - arg_renderbuffers->add_int64value((uintptr_t)renderbuffers); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -1994,7 +1995,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenTextures(GLsizei n, GLuint * textures) { +void GLTrace_glGenTextures(GLsizei n, GLuint* textures) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2009,8 +2010,8 @@ // copy argument textures GLMessage_DataType *arg_textures = glmsg.add_args(); arg_textures->set_isarray(false); - arg_textures->set_type(GLMessage::DataType::INT64); - arg_textures->add_int64value((uintptr_t)textures); + arg_textures->set_type(GLMessage::DataType::INT); + arg_textures->add_intvalue((int)textures); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2029,7 +2030,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) { +void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2047,40 +2048,40 @@ arg_index->set_type(GLMessage::DataType::INT); arg_index->add_intvalue(index); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); // copy argument size GLMessage_DataType *arg_size = glmsg.add_args(); arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT64); - arg_size->add_int64value((uintptr_t)size); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue((int)size); // copy argument type GLMessage_DataType *arg_type = glmsg.add_args(); arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::INT64); - arg_type->add_int64value((uintptr_t)type); + arg_type->set_type(GLMessage::DataType::INT); + arg_type->add_intvalue((int)type); // copy argument name GLMessage_DataType *arg_name = glmsg.add_args(); arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetActiveAttrib(program, index, bufSize, length, size, type, name); + glContext->hooks->gl.glGetActiveAttrib(program, index, bufsize, length, size, type, name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2097,7 +2098,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name) { +void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2115,40 +2116,40 @@ arg_index->set_type(GLMessage::DataType::INT); arg_index->add_intvalue(index); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); // copy argument size GLMessage_DataType *arg_size = glmsg.add_args(); arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT64); - arg_size->add_int64value((uintptr_t)size); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue((int)size); // copy argument type GLMessage_DataType *arg_type = glmsg.add_args(); arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::INT64); - arg_type->add_int64value((uintptr_t)type); + arg_type->set_type(GLMessage::DataType::INT); + arg_type->add_intvalue((int)type); // copy argument name GLMessage_DataType *arg_name = glmsg.add_args(); arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetActiveUniform(program, index, bufSize, length, size, type, name); + glContext->hooks->gl.glGetActiveUniform(program, index, bufsize, length, size, type, name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2165,7 +2166,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders) { +void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2177,28 +2178,28 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument maxCount - GLMessage_DataType *arg_maxCount = glmsg.add_args(); - arg_maxCount->set_isarray(false); - arg_maxCount->set_type(GLMessage::DataType::INT); - arg_maxCount->add_intvalue(maxCount); + // copy argument maxcount + GLMessage_DataType *arg_maxcount = glmsg.add_args(); + arg_maxcount->set_isarray(false); + arg_maxcount->set_type(GLMessage::DataType::INT); + arg_maxcount->add_intvalue(maxcount); // copy argument count GLMessage_DataType *arg_count = glmsg.add_args(); arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT64); - arg_count->add_int64value((uintptr_t)count); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue((int)count); // copy argument shaders GLMessage_DataType *arg_shaders = glmsg.add_args(); arg_shaders->set_isarray(false); - arg_shaders->set_type(GLMessage::DataType::INT64); - arg_shaders->add_int64value((uintptr_t)shaders); + arg_shaders->set_type(GLMessage::DataType::INT); + arg_shaders->add_intvalue((int)shaders); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetAttachedShaders(program, maxCount, count, shaders); + glContext->hooks->gl.glGetAttachedShaders(program, maxcount, count, shaders); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2213,7 +2214,7 @@ glContext->traceGLMessage(&glmsg); } -GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar * name) { +int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2228,13 +2229,13 @@ // copy argument name GLMessage_DataType *arg_name = glmsg.add_args(); arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLint retValue = glContext->hooks->gl.glGetAttribLocation(program, name); + int retValue = glContext->hooks->gl.glGetAttribLocation(program, name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2256,7 +2257,7 @@ return retValue; } -void GLTrace_glGetBooleanv(GLenum pname, GLboolean * data) { +void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2268,21 +2269,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetBooleanv(pname, data); + glContext->hooks->gl.glGetBooleanv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) data, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -2291,7 +2292,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint * params) { +void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2312,8 +2313,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2362,7 +2363,7 @@ return retValue; } -void GLTrace_glGetFloatv(GLenum pname, GLfloat * data) { +void GLTrace_glGetFloatv(GLenum pname, GLfloat* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2374,21 +2375,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetFloatv(pname, data); + glContext->hooks->gl.glGetFloatv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) data, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -2397,7 +2398,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint * params) { +void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2424,8 +2425,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2444,7 +2445,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetIntegerv(GLenum pname, GLint * data) { +void GLTrace_glGetIntegerv(GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2456,21 +2457,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetIntegerv(pname, data); + glContext->hooks->gl.glGetIntegerv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) data, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -2479,7 +2480,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint * params) { +void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2500,8 +2501,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2520,7 +2521,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { +void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2532,34 +2533,34 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); - // copy argument infoLog - GLMessage_DataType *arg_infoLog = glmsg.add_args(); - arg_infoLog->set_isarray(false); - arg_infoLog->set_type(GLMessage::DataType::INT64); - arg_infoLog->add_int64value((uintptr_t)infoLog); + // copy argument infolog + GLMessage_DataType *arg_infolog = glmsg.add_args(); + arg_infolog->set_isarray(false); + arg_infolog->set_type(GLMessage::DataType::INT); + arg_infolog->add_intvalue((int)infolog); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramInfoLog(program, bufSize, length, infoLog); + glContext->hooks->gl.glGetProgramInfoLog(program, bufsize, length, infolog); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { (void *) length, - (void *) infoLog, + (void *) infolog, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -2568,7 +2569,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint * params) { +void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2589,8 +2590,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2609,7 +2610,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint * params) { +void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2630,8 +2631,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2650,7 +2651,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { +void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2662,34 +2663,34 @@ arg_shader->set_type(GLMessage::DataType::INT); arg_shader->add_intvalue(shader); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); - // copy argument infoLog - GLMessage_DataType *arg_infoLog = glmsg.add_args(); - arg_infoLog->set_isarray(false); - arg_infoLog->set_type(GLMessage::DataType::INT64); - arg_infoLog->add_int64value((uintptr_t)infoLog); + // copy argument infolog + GLMessage_DataType *arg_infolog = glmsg.add_args(); + arg_infolog->set_isarray(false); + arg_infolog->set_type(GLMessage::DataType::INT); + arg_infolog->add_intvalue((int)infolog); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetShaderInfoLog(shader, bufSize, length, infoLog); + glContext->hooks->gl.glGetShaderInfoLog(shader, bufsize, length, infolog); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { (void *) length, - (void *) infoLog, + (void *) infolog, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -2698,7 +2699,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision) { +void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2719,14 +2720,14 @@ // copy argument range GLMessage_DataType *arg_range = glmsg.add_args(); arg_range->set_isarray(false); - arg_range->set_type(GLMessage::DataType::INT64); - arg_range->add_int64value((uintptr_t)range); + arg_range->set_type(GLMessage::DataType::INT); + arg_range->add_intvalue((int)range); // copy argument precision GLMessage_DataType *arg_precision = glmsg.add_args(); arg_precision->set_isarray(false); - arg_precision->set_type(GLMessage::DataType::INT64); - arg_precision->add_int64value((uintptr_t)precision); + arg_precision->set_type(GLMessage::DataType::INT); + arg_precision->add_intvalue((int)precision); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2746,7 +2747,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source) { +void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2758,28 +2759,28 @@ arg_shader->set_type(GLMessage::DataType::INT); arg_shader->add_intvalue(shader); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument bufsize + GLMessage_DataType *arg_bufsize = glmsg.add_args(); + arg_bufsize->set_isarray(false); + arg_bufsize->set_type(GLMessage::DataType::INT); + arg_bufsize->add_intvalue(bufsize); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); // copy argument source GLMessage_DataType *arg_source = glmsg.add_args(); arg_source->set_isarray(false); - arg_source->set_type(GLMessage::DataType::INT64); - arg_source->add_int64value((uintptr_t)source); + arg_source->set_type(GLMessage::DataType::INT); + arg_source->add_intvalue((int)source); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetShaderSource(shader, bufSize, length, source); + glContext->hooks->gl.glGetShaderSource(shader, bufsize, length, source); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2794,7 +2795,7 @@ glContext->traceGLMessage(&glmsg); } -const GLubyte * GLTrace_glGetString(GLenum name) { +const GLubyte* GLTrace_glGetString(GLenum name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2809,15 +2810,15 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - const GLubyte * retValue = glContext->hooks->gl.glGetString(name); + const GLubyte* retValue = glContext->hooks->gl.glGetString(name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); // set return value GLMessage_DataType *rt = glmsg.mutable_returnvalue(); rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue((int)retValue); void *pointerArgs[] = { (void *) retValue, @@ -2831,7 +2832,7 @@ return retValue; } -void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params) { +void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2852,8 +2853,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2872,7 +2873,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params) { +void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2893,8 +2894,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2913,7 +2914,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat * params) { +void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2934,8 +2935,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2954,7 +2955,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint * params) { +void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -2975,8 +2976,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -2995,7 +2996,7 @@ glContext->traceGLMessage(&glmsg); } -GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar * name) { +int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3010,13 +3011,13 @@ // copy argument name GLMessage_DataType *arg_name = glmsg.add_args(); arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + arg_name->set_type(GLMessage::DataType::INT); + arg_name->add_intvalue((int)name); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLint retValue = glContext->hooks->gl.glGetUniformLocation(program, name); + int retValue = glContext->hooks->gl.glGetUniformLocation(program, name); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -3038,7 +3039,7 @@ return retValue; } -void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat * params) { +void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3059,8 +3060,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -3079,7 +3080,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint * params) { +void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3100,8 +3101,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -3120,7 +3121,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, void ** pointer) { +void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3141,8 +3142,8 @@ // copy argument pointer GLMessage_DataType *arg_pointer = glmsg.add_args(); arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -3571,7 +3572,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels) { +void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3616,8 +3617,8 @@ // copy argument pixels GLMessage_DataType *arg_pixels = glmsg.add_args(); arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -3704,7 +3705,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSampleCoverage(GLfloat value, GLboolean invert) { +void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3784,23 +3785,23 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glShaderBinary(GLsizei count, const GLuint * shaders, GLenum binaryformat, const void * binary, GLsizei length) { +void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glShaderBinary); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); // copy argument shaders GLMessage_DataType *arg_shaders = glmsg.add_args(); arg_shaders->set_isarray(false); - arg_shaders->set_type(GLMessage::DataType::INT64); - arg_shaders->add_int64value((uintptr_t)shaders); + arg_shaders->set_type(GLMessage::DataType::INT); + arg_shaders->add_intvalue((int)shaders); // copy argument binaryformat GLMessage_DataType *arg_binaryformat = glmsg.add_args(); @@ -3811,8 +3812,8 @@ // copy argument binary GLMessage_DataType *arg_binary = glmsg.add_args(); arg_binary->set_isarray(false); - arg_binary->set_type(GLMessage::DataType::INT64); - arg_binary->add_int64value((uintptr_t)binary); + arg_binary->set_type(GLMessage::DataType::INT); + arg_binary->add_intvalue((int)binary); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); @@ -3823,7 +3824,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glShaderBinary(count, shaders, binaryformat, binary, length); + glContext->hooks->gl.glShaderBinary(n, shaders, binaryformat, binary, length); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -3838,7 +3839,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length) { +void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -3859,14 +3860,14 @@ // copy argument string GLMessage_DataType *arg_string = glmsg.add_args(); arg_string->set_isarray(false); - arg_string->set_type(GLMessage::DataType::INT64); - arg_string->add_int64value((uintptr_t)string); + arg_string->set_type(GLMessage::DataType::INT); + arg_string->add_intvalue((int)string); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4074,7 +4075,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass) { +void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4086,28 +4087,28 @@ arg_face->set_type(GLMessage::DataType::ENUM); arg_face->add_intvalue((int)face); - // copy argument sfail - GLMessage_DataType *arg_sfail = glmsg.add_args(); - arg_sfail->set_isarray(false); - arg_sfail->set_type(GLMessage::DataType::ENUM); - arg_sfail->add_intvalue((int)sfail); + // copy argument fail + GLMessage_DataType *arg_fail = glmsg.add_args(); + arg_fail->set_isarray(false); + arg_fail->set_type(GLMessage::DataType::ENUM); + arg_fail->add_intvalue((int)fail); - // copy argument dpfail - GLMessage_DataType *arg_dpfail = glmsg.add_args(); - arg_dpfail->set_isarray(false); - arg_dpfail->set_type(GLMessage::DataType::ENUM); - arg_dpfail->add_intvalue((int)dpfail); + // copy argument zfail + GLMessage_DataType *arg_zfail = glmsg.add_args(); + arg_zfail->set_isarray(false); + arg_zfail->set_type(GLMessage::DataType::ENUM); + arg_zfail->add_intvalue((int)zfail); - // copy argument dppass - GLMessage_DataType *arg_dppass = glmsg.add_args(); - arg_dppass->set_isarray(false); - arg_dppass->set_type(GLMessage::DataType::ENUM); - arg_dppass->add_intvalue((int)dppass); + // copy argument zpass + GLMessage_DataType *arg_zpass = glmsg.add_args(); + arg_zpass->set_isarray(false); + arg_zpass->set_type(GLMessage::DataType::ENUM); + arg_zpass->add_intvalue((int)zpass); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glStencilOpSeparate(face, sfail, dpfail, dppass); + glContext->hooks->gl.glStencilOpSeparate(face, fail, zfail, zpass); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4120,7 +4121,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels) { +void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4177,8 +4178,8 @@ // copy argument pixels GLMessage_DataType *arg_pixels = glmsg.add_args(); arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4237,7 +4238,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params) { +void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4258,8 +4259,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4318,7 +4319,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint * params) { +void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4339,8 +4340,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4359,7 +4360,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels) { +void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4416,8 +4417,8 @@ // copy argument pixels GLMessage_DataType *arg_pixels = glmsg.add_args(); arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4436,7 +4437,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform1f(GLint location, GLfloat v0) { +void GLTrace_glUniform1f(GLint location, GLfloat x) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4448,16 +4449,16 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform1f(location, v0); + glContext->hooks->gl.glUniform1f(location, x); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4470,7 +4471,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat * value) { +void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4488,21 +4489,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform1fv(location, count, value); + glContext->hooks->gl.glUniform1fv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -4511,7 +4512,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform1i(GLint location, GLint v0) { +void GLTrace_glUniform1i(GLint location, GLint x) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4523,16 +4524,16 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform1i(location, v0); + glContext->hooks->gl.glUniform1i(location, x); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4545,7 +4546,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint * value) { +void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4563,21 +4564,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform1iv(location, count, value); + glContext->hooks->gl.glUniform1iv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -4586,7 +4587,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform2f(GLint location, GLfloat v0, GLfloat v1) { +void GLTrace_glUniform2f(GLint location, GLfloat x, GLfloat y) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4598,22 +4599,22 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform2f(location, v0, v1); + glContext->hooks->gl.glUniform2f(location, x, y); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4626,7 +4627,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat * value) { +void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4644,21 +4645,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform2fv(location, count, value); + glContext->hooks->gl.glUniform2fv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -4667,7 +4668,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform2i(GLint location, GLint v0, GLint v1) { +void GLTrace_glUniform2i(GLint location, GLint x, GLint y) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4679,22 +4680,22 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform2i(location, v0, v1); + glContext->hooks->gl.glUniform2i(location, x, y); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4707,7 +4708,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint * value) { +void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4725,21 +4726,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform2iv(location, count, value); + glContext->hooks->gl.glUniform2iv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -4748,7 +4749,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { +void GLTrace_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4760,28 +4761,28 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::FLOAT); - arg_v2->add_floatvalue(v2); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform3f(location, v0, v1, v2); + glContext->hooks->gl.glUniform3f(location, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4794,7 +4795,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat * value) { +void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4812,21 +4813,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform3fv(location, count, value); + glContext->hooks->gl.glUniform3fv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -4835,7 +4836,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform3i(GLint location, GLint v0, GLint v1, GLint v2) { +void GLTrace_glUniform3i(GLint location, GLint x, GLint y, GLint z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4847,28 +4848,28 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // call function + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform3i(location, v0, v1, v2); + glContext->hooks->gl.glUniform3i(location, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4881,7 +4882,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint * value) { +void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4899,21 +4900,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform3iv(location, count, value); + glContext->hooks->gl.glUniform3iv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -4922,7 +4923,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { +void GLTrace_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4934,34 +4935,34 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::FLOAT); - arg_v2->add_floatvalue(v2); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::FLOAT); - arg_v3->add_floatvalue(v3); + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::FLOAT); + arg_w->add_floatvalue(w); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform4f(location, v0, v1, v2, v3); + glContext->hooks->gl.glUniform4f(location, x, y, z, w); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -4974,7 +4975,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat * value) { +void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -4992,21 +4993,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform4fv(location, count, value); + glContext->hooks->gl.glUniform4fv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5015,7 +5016,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { +void GLTrace_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -5027,34 +5028,34 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::INT); - arg_v3->add_intvalue(v3); + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::INT); + arg_w->add_intvalue(w); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform4i(location, v0, v1, v2, v3); + glContext->hooks->gl.glUniform4i(location, x, y, z, w); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5067,7 +5068,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint * value) { +void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint* v) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -5085,21 +5086,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument v + GLMessage_DataType *arg_v = glmsg.add_args(); + arg_v->set_isarray(false); + arg_v->set_type(GLMessage::DataType::INT); + arg_v->add_intvalue((int)v); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform4iv(location, count, value); + glContext->hooks->gl.glUniform4iv(location, count, v); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5108,7 +5109,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -5135,8 +5136,8 @@ // copy argument value GLMessage_DataType *arg_value = glmsg.add_args(); arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5155,7 +5156,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -5182,8 +5183,8 @@ // copy argument value GLMessage_DataType *arg_value = glmsg.add_args(); arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5202,7 +5203,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -5229,8 +5230,8 @@ // copy argument value GLMessage_DataType *arg_value = glmsg.add_args(); arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5305,17 +5306,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib1f(GLuint index, GLfloat x) { +void GLTrace_glVertexAttrib1f(GLuint indx, GLfloat x) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib1f); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); // copy argument x GLMessage_DataType *arg_x = glmsg.add_args(); @@ -5326,7 +5327,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib1f(index, x); + glContext->hooks->gl.glVertexAttrib1f(indx, x); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5339,33 +5340,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib1fv(GLuint index, const GLfloat * v) { +void GLTrace_glVertexAttrib1fv(GLuint indx, const GLfloat* values) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib1fv); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); - // copy argument v - GLMessage_DataType *arg_v = glmsg.add_args(); - arg_v->set_isarray(false); - arg_v->set_type(GLMessage::DataType::INT64); - arg_v->add_int64value((uintptr_t)v); + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib1fv(index, v); + glContext->hooks->gl.glVertexAttrib1fv(indx, values); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) v, + (void *) values, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5374,17 +5375,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y) { +void GLTrace_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib2f); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); // copy argument x GLMessage_DataType *arg_x = glmsg.add_args(); @@ -5401,7 +5402,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib2f(index, x, y); + glContext->hooks->gl.glVertexAttrib2f(indx, x, y); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5414,33 +5415,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib2fv(GLuint index, const GLfloat * v) { +void GLTrace_glVertexAttrib2fv(GLuint indx, const GLfloat* values) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib2fv); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); - // copy argument v - GLMessage_DataType *arg_v = glmsg.add_args(); - arg_v->set_isarray(false); - arg_v->set_type(GLMessage::DataType::INT64); - arg_v->add_int64value((uintptr_t)v); + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib2fv(index, v); + glContext->hooks->gl.glVertexAttrib2fv(indx, values); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) v, + (void *) values, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5449,17 +5450,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z) { +void GLTrace_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib3f); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); // copy argument x GLMessage_DataType *arg_x = glmsg.add_args(); @@ -5482,7 +5483,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib3f(index, x, y, z); + glContext->hooks->gl.glVertexAttrib3f(indx, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5495,33 +5496,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib3fv(GLuint index, const GLfloat * v) { +void GLTrace_glVertexAttrib3fv(GLuint indx, const GLfloat* values) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib3fv); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); - // copy argument v - GLMessage_DataType *arg_v = glmsg.add_args(); - arg_v->set_isarray(false); - arg_v->set_type(GLMessage::DataType::INT64); - arg_v->add_int64value((uintptr_t)v); + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib3fv(index, v); + glContext->hooks->gl.glVertexAttrib3fv(indx, values); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) v, + (void *) values, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5530,17 +5531,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { +void GLTrace_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib4f); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); // copy argument x GLMessage_DataType *arg_x = glmsg.add_args(); @@ -5569,7 +5570,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib4f(index, x, y, z, w); + glContext->hooks->gl.glVertexAttrib4f(indx, x, y, z, w); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5582,33 +5583,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttrib4fv(GLuint index, const GLfloat * v) { +void GLTrace_glVertexAttrib4fv(GLuint indx, const GLfloat* values) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttrib4fv); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); - // copy argument v - GLMessage_DataType *arg_v = glmsg.add_args(); - arg_v->set_isarray(false); - arg_v->set_type(GLMessage::DataType::INT64); - arg_v->add_int64value((uintptr_t)v); + // copy argument values + GLMessage_DataType *arg_values = glmsg.add_args(); + arg_values->set_isarray(false); + arg_values->set_type(GLMessage::DataType::INT); + arg_values->add_intvalue((int)values); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttrib4fv(index, v); + glContext->hooks->gl.glVertexAttrib4fv(indx, values); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) v, + (void *) values, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5617,17 +5618,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer) { +void GLTrace_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glVertexAttribPointer); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument indx + GLMessage_DataType *arg_indx = glmsg.add_args(); + arg_indx->set_isarray(false); + arg_indx->set_type(GLMessage::DataType::INT); + arg_indx->add_intvalue(indx); // copy argument size GLMessage_DataType *arg_size = glmsg.add_args(); @@ -5653,21 +5654,21 @@ arg_stride->set_type(GLMessage::DataType::INT); arg_stride->add_intvalue(stride); - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + // copy argument ptr + GLMessage_DataType *arg_ptr = glmsg.add_args(); + arg_ptr->set_isarray(false); + arg_ptr->set_type(GLMessage::DataType::INT); + arg_ptr->add_intvalue((int)ptr); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribPointer(index, size, type, normalized, stride, pointer); + glContext->hooks->gl.glVertexAttribPointer(indx, size, type, normalized, stride, ptr); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) pointer, + (void *) ptr, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5722,26 +5723,36 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glReadBuffer(GLenum mode) { + +// Definitions for GL2Ext APIs + +void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glReadBuffer); + glmsg.set_function(GLMessage::glEGLImageTargetTexture2DOES); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument image + GLMessage_DataType *arg_image = glmsg.add_args(); + arg_image->set_isarray(false); + arg_image->set_type(GLMessage::DataType::INT); + arg_image->add_intvalue((int)image); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glReadBuffer(mode); + glContext->hooks->gl.glEGLImageTargetTexture2DOES(target, image); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) image, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5750,57 +5761,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices) { +void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDrawRangeElements); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument start - GLMessage_DataType *arg_start = glmsg.add_args(); - arg_start->set_isarray(false); - arg_start->set_type(GLMessage::DataType::INT); - arg_start->add_intvalue(start); - - // copy argument end - GLMessage_DataType *arg_end = glmsg.add_args(); - arg_end->set_isarray(false); - arg_end->set_type(GLMessage::DataType::INT); - arg_end->add_intvalue(end); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + glmsg.set_function(GLMessage::glEGLImageTargetRenderbufferStorageOES); - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); + // copy argument image + GLMessage_DataType *arg_image = glmsg.add_args(); + arg_image->set_isarray(false); + arg_image->set_type(GLMessage::DataType::INT); + arg_image->add_intvalue((int)image); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawRangeElements(mode, start, end, count, type, indices); + glContext->hooks->gl.glEGLImageTargetRenderbufferStorageOES(target, image); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) indices, + (void *) image, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -5809,39 +5796,261 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) { +void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexImage3D); + glmsg.set_function(GLMessage::glGetProgramBinaryOES); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::INT); - arg_internalformat->add_intvalue(internalformat); + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); + // copy argument binaryFormat + GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); + arg_binaryFormat->set_isarray(false); + arg_binaryFormat->set_type(GLMessage::DataType::INT); + arg_binaryFormat->add_intvalue((int)binaryFormat); - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); + // copy argument binary + GLMessage_DataType *arg_binary = glmsg.add_args(); + arg_binary->set_isarray(false); + arg_binary->set_type(GLMessage::DataType::INT); + arg_binary->add_intvalue((int)binary); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + (void *) length, + (void *) binaryFormat, + (void *) binary, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glProgramBinaryOES); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument binaryFormat + GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); + arg_binaryFormat->set_isarray(false); + arg_binaryFormat->set_type(GLMessage::DataType::ENUM); + arg_binaryFormat->add_intvalue((int)binaryFormat); + + // copy argument binary + GLMessage_DataType *arg_binary = glmsg.add_args(); + arg_binary->set_isarray(false); + arg_binary->set_type(GLMessage::DataType::INT); + arg_binary->add_intvalue((int)binary); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue(length); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glProgramBinaryOES(program, binaryFormat, binary, length); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + (void *) binary, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void* GLTrace_glMapBufferOES(GLenum target, GLenum access) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glMapBufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument access + GLMessage_DataType *arg_access = glmsg.add_args(); + arg_access->set_isarray(false); + arg_access->set_type(GLMessage::DataType::ENUM); + arg_access->add_intvalue((int)access); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + void* retValue = glContext->hooks->gl.glMapBufferOES(target, access); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue((int)retValue); + + void *pointerArgs[] = { + (void *) retValue, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +GLboolean GLTrace_glUnmapBufferOES(GLenum target) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glUnmapBufferOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + GLboolean retValue = glContext->hooks->gl.glUnmapBufferOES(target); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + + void *pointerArgs[] = { + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); + + return retValue; +} + +void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetBufferPointervOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGetBufferPointervOES(target, pname, params); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + (void *) params, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexImage3DOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); arg_height->set_type(GLMessage::DataType::INT); arg_height->add_intvalue(height); @@ -5872,13 +6081,13 @@ // copy argument pixels GLMessage_DataType *arg_pixels = glmsg.add_args(); arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexImage3D(target, level, internalformat, width, height, depth, border, format, type, pixels); + glContext->hooks->gl.glTexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5892,11 +6101,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) { +void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexSubImage3D); + glmsg.set_function(GLMessage::glTexSubImage3DOES); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -5961,13 +6170,13 @@ // copy argument pixels GLMessage_DataType *arg_pixels = glmsg.add_args(); arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); + arg_pixels->set_type(GLMessage::DataType::INT); + arg_pixels->add_intvalue((int)pixels); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); + glContext->hooks->gl.glTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -5981,11 +6190,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { +void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glCopyTexSubImage3D); + glmsg.set_function(GLMessage::glCopyTexSubImage3DOES); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -6044,7 +6253,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCopyTexSubImage3D(target, level, xoffset, yoffset, zoffset, x, y, width, height); + glContext->hooks->gl.glCopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -6057,11 +6266,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) { +void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glCompressedTexImage3D); + glmsg.set_function(GLMessage::glCompressedTexImage3DOES); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -6114,13 +6323,13 @@ // copy argument data GLMessage_DataType *arg_data = glmsg.add_args(); arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCompressedTexImage3D(target, level, internalformat, width, height, depth, border, imageSize, data); + glContext->hooks->gl.glCompressedTexImage3DOES(target, level, internalformat, width, height, depth, border, imageSize, data); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -6134,11 +6343,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) { +void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glCompressedTexSubImage3D); + glmsg.set_function(GLMessage::glCompressedTexSubImage3DOES); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -6203,13 +6412,13 @@ // copy argument data GLMessage_DataType *arg_data = glmsg.add_args(); arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCompressedTexSubImage3D(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); + glContext->hooks->gl.glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -6223,68 +6432,56 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenQueries(GLsizei n, GLuint * ids) { +void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGenQueries); + glmsg.set_function(GLMessage::glFramebufferTexture3DOES); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenQueries(n, ids); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); - void *pointerArgs[] = { - (void *) ids, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeleteQueries(GLsizei n, const GLuint * ids) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteQueries); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteQueries(n, ids); + glContext->hooks->gl.glFramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) ids, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6293,31 +6490,25 @@ glContext->traceGLMessage(&glmsg); } -GLboolean GLTrace_glIsQuery(GLuint id) { +void GLTrace_glBindVertexArrayOES(GLuint array) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glIsQuery); + glmsg.set_function(GLMessage::glBindVertexArrayOES); - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::INT); + arg_array->add_intvalue(array); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsQuery(id); + glContext->hooks->gl.glBindVertexArrayOES(array); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - void *pointerArgs[] = { }; @@ -6325,36 +6516,35 @@ threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glBeginQuery(GLenum target, GLuint id) { +void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBeginQuery); + glmsg.set_function(GLMessage::glDeleteVertexArraysOES); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); + // copy argument arrays + GLMessage_DataType *arg_arrays = glmsg.add_args(); + arg_arrays->set_isarray(false); + arg_arrays->set_type(GLMessage::DataType::INT); + arg_arrays->add_intvalue((int)arrays); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBeginQuery(target, id); + glContext->hooks->gl.glDeleteVertexArraysOES(n, arrays); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) arrays, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6363,26 +6553,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glEndQuery(GLenum target) { +void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint *arrays) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glEndQuery); + glmsg.set_function(GLMessage::glGenVertexArraysOES); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument arrays + GLMessage_DataType *arg_arrays = glmsg.add_args(); + arg_arrays->set_isarray(false); + arg_arrays->set_type(GLMessage::DataType::INT); + arg_arrays->add_intvalue((int)arrays); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEndQuery(target); + glContext->hooks->gl.glGenVertexArraysOES(n, arrays); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) arrays, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6391,80 +6588,76 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetQueryiv(GLenum target, GLenum pname, GLint * params) { +GLboolean GLTrace_glIsVertexArrayOES(GLuint array) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetQueryiv); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glIsVertexArrayOES); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::INT); + arg_array->add_intvalue(array); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryiv(target, pname, params); + GLboolean retValue = glContext->hooks->gl.glIsVertexArrayOES(array); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); + + return retValue; } -void GLTrace_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint * params) { +void GLTrace_glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetQueryObjectuiv); + glmsg.set_function(GLMessage::glGetPerfMonitorGroupsAMD); - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); + // copy argument numGroups + GLMessage_DataType *arg_numGroups = glmsg.add_args(); + arg_numGroups->set_isarray(false); + arg_numGroups->set_type(GLMessage::DataType::INT); + arg_numGroups->add_intvalue((int)numGroups); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument groupsSize + GLMessage_DataType *arg_groupsSize = glmsg.add_args(); + arg_groupsSize->set_isarray(false); + arg_groupsSize->set_type(GLMessage::DataType::INT); + arg_groupsSize->add_intvalue(groupsSize); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument groups + GLMessage_DataType *arg_groups = glmsg.add_args(); + arg_groups->set_isarray(false); + arg_groups->set_type(GLMessage::DataType::INT); + arg_groups->add_intvalue((int)groups); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryObjectuiv(id, pname, params); + glContext->hooks->gl.glGetPerfMonitorGroupsAMD(numGroups, groupsSize, groups); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, + (void *) numGroups, + (void *) groups, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6473,75 +6666,101 @@ glContext->traceGLMessage(&glmsg); } -GLboolean GLTrace_glUnmapBuffer(GLenum target) { +void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUnmapBuffer); + glmsg.set_function(GLMessage::glGetPerfMonitorCountersAMD); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); + + // copy argument numCounters + GLMessage_DataType *arg_numCounters = glmsg.add_args(); + arg_numCounters->set_isarray(false); + arg_numCounters->set_type(GLMessage::DataType::INT); + arg_numCounters->add_intvalue((int)numCounters); + + // copy argument maxActiveCounters + GLMessage_DataType *arg_maxActiveCounters = glmsg.add_args(); + arg_maxActiveCounters->set_isarray(false); + arg_maxActiveCounters->set_type(GLMessage::DataType::INT); + arg_maxActiveCounters->add_intvalue((int)maxActiveCounters); + + // copy argument counterSize + GLMessage_DataType *arg_counterSize = glmsg.add_args(); + arg_counterSize->set_isarray(false); + arg_counterSize->set_type(GLMessage::DataType::INT); + arg_counterSize->add_intvalue(counterSize); + + // copy argument counters + GLMessage_DataType *arg_counters = glmsg.add_args(); + arg_counters->set_isarray(false); + arg_counters->set_type(GLMessage::DataType::INT); + arg_counters->add_intvalue((int)counters); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glUnmapBuffer(target); + glContext->hooks->gl.glGetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - void *pointerArgs[] = { + (void *) numCounters, + (void *) maxActiveCounters, + (void *) counters, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glGetBufferPointerv(GLenum target, GLenum pname, void ** params) { +void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetBufferPointerv); + glmsg.set_function(GLMessage::glGetPerfMonitorGroupStringAMD); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument groupString + GLMessage_DataType *arg_groupString = glmsg.add_args(); + arg_groupString->set_isarray(false); + arg_groupString->set_type(GLMessage::DataType::INT); + arg_groupString->add_intvalue((int)groupString); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetBufferPointerv(target, pname, params); + glContext->hooks->gl.glGetPerfMonitorGroupStringAMD(group, bufSize, length, groupString); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, + (void *) length, + (void *) groupString, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6550,33 +6769,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawBuffers(GLsizei n, const GLenum * bufs) { +void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDrawBuffers); + glmsg.set_function(GLMessage::glGetPerfMonitorCounterStringAMD); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); - // copy argument bufs - GLMessage_DataType *arg_bufs = glmsg.add_args(); - arg_bufs->set_isarray(false); - arg_bufs->set_type(GLMessage::DataType::INT64); - arg_bufs->add_int64value((uintptr_t)bufs); + // copy argument counter + GLMessage_DataType *arg_counter = glmsg.add_args(); + arg_counter->set_isarray(false); + arg_counter->set_type(GLMessage::DataType::INT); + arg_counter->add_intvalue(counter); - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawBuffers(n, bufs); + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument counterString + GLMessage_DataType *arg_counterString = glmsg.add_args(); + arg_counterString->set_isarray(false); + arg_counterString->set_type(GLMessage::DataType::INT); + arg_counterString->add_intvalue((int)counterString); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) bufs, + (void *) length, + (void *) counterString, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6585,45 +6823,45 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformMatrix2x3fv); + glmsg.set_function(GLMessage::glGetPerfMonitorCounterInfoAMD); - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument counter + GLMessage_DataType *arg_counter = glmsg.add_args(); + arg_counter->set_isarray(false); + arg_counter->set_type(GLMessage::DataType::INT); + arg_counter->add_intvalue(counter); - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix2x3fv(location, count, transpose, value); + glContext->hooks->gl.glGetPerfMonitorCounterInfoAMD(group, counter, pname, data); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) data, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6632,45 +6870,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformMatrix3x2fv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + glmsg.set_function(GLMessage::glGenPerfMonitorsAMD); - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument monitors + GLMessage_DataType *arg_monitors = glmsg.add_args(); + arg_monitors->set_isarray(false); + arg_monitors->set_type(GLMessage::DataType::INT); + arg_monitors->add_intvalue((int)monitors); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix3x2fv(location, count, transpose, value); + glContext->hooks->gl.glGenPerfMonitorsAMD(n, monitors); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) monitors, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6679,45 +6905,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformMatrix2x4fv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + glmsg.set_function(GLMessage::glDeletePerfMonitorsAMD); - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument monitors + GLMessage_DataType *arg_monitors = glmsg.add_args(); + arg_monitors->set_isarray(false); + arg_monitors->set_type(GLMessage::DataType::INT); + arg_monitors->add_intvalue((int)monitors); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix2x4fv(location, count, transpose, value); + glContext->hooks->gl.glDeletePerfMonitorsAMD(n, monitors); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) monitors, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6726,45 +6940,51 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformMatrix4x2fv); + glmsg.set_function(GLMessage::glSelectPerfMonitorCountersAMD); - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument enable + GLMessage_DataType *arg_enable = glmsg.add_args(); + arg_enable->set_isarray(false); + arg_enable->set_type(GLMessage::DataType::BOOL); + arg_enable->add_boolvalue(enable); - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); + // copy argument group + GLMessage_DataType *arg_group = glmsg.add_args(); + arg_group->set_isarray(false); + arg_group->set_type(GLMessage::DataType::INT); + arg_group->add_intvalue(group); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument numCounters + GLMessage_DataType *arg_numCounters = glmsg.add_args(); + arg_numCounters->set_isarray(false); + arg_numCounters->set_type(GLMessage::DataType::INT); + arg_numCounters->add_intvalue(numCounters); + + // copy argument countersList + GLMessage_DataType *arg_countersList = glmsg.add_args(); + arg_countersList->set_isarray(false); + arg_countersList->set_type(GLMessage::DataType::INT); + arg_countersList->add_intvalue((int)countersList); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix4x2fv(location, count, transpose, value); + glContext->hooks->gl.glSelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, countersList); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) countersList, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6773,45 +6993,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glBeginPerfMonitorAMD(GLuint monitor) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformMatrix3x4fv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); + glmsg.set_function(GLMessage::glBeginPerfMonitorAMD); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix3x4fv(location, count, transpose, value); + glContext->hooks->gl.glBeginPerfMonitorAMD(monitor); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6820,45 +7021,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { +void GLTrace_glEndPerfMonitorAMD(GLuint monitor) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformMatrix4x3fv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); + glmsg.set_function(GLMessage::glEndPerfMonitorAMD); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix4x3fv(location, count, transpose, value); + glContext->hooks->gl.glEndPerfMonitorAMD(monitor); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -6867,32 +7049,86 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { +void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBlitFramebuffer); - - // copy argument srcX0 - GLMessage_DataType *arg_srcX0 = glmsg.add_args(); - arg_srcX0->set_isarray(false); - arg_srcX0->set_type(GLMessage::DataType::INT); - arg_srcX0->add_intvalue(srcX0); + glmsg.set_function(GLMessage::glGetPerfMonitorCounterDataAMD); - // copy argument srcY0 - GLMessage_DataType *arg_srcY0 = glmsg.add_args(); - arg_srcY0->set_isarray(false); - arg_srcY0->set_type(GLMessage::DataType::INT); - arg_srcY0->add_intvalue(srcY0); + // copy argument monitor + GLMessage_DataType *arg_monitor = glmsg.add_args(); + arg_monitor->set_isarray(false); + arg_monitor->set_type(GLMessage::DataType::INT); + arg_monitor->add_intvalue(monitor); - // copy argument srcX1 - GLMessage_DataType *arg_srcX1 = glmsg.add_args(); - arg_srcX1->set_isarray(false); - arg_srcX1->set_type(GLMessage::DataType::INT); - arg_srcX1->add_intvalue(srcX1); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument srcY1 - GLMessage_DataType *arg_srcY1 = glmsg.add_args(); + // copy argument dataSize + GLMessage_DataType *arg_dataSize = glmsg.add_args(); + arg_dataSize->set_isarray(false); + arg_dataSize->set_type(GLMessage::DataType::INT); + arg_dataSize->add_intvalue(dataSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); + + // copy argument bytesWritten + GLMessage_DataType *arg_bytesWritten = glmsg.add_args(); + arg_bytesWritten->set_isarray(false); + arg_bytesWritten->set_type(GLMessage::DataType::INT); + arg_bytesWritten->add_intvalue((int)bytesWritten); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + (void *) data, + (void *) bytesWritten, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glBlitFramebufferANGLE); + + // copy argument srcX0 + GLMessage_DataType *arg_srcX0 = glmsg.add_args(); + arg_srcX0->set_isarray(false); + arg_srcX0->set_type(GLMessage::DataType::INT); + arg_srcX0->add_intvalue(srcX0); + + // copy argument srcY0 + GLMessage_DataType *arg_srcY0 = glmsg.add_args(); + arg_srcY0->set_isarray(false); + arg_srcY0->set_type(GLMessage::DataType::INT); + arg_srcY0->add_intvalue(srcY0); + + // copy argument srcX1 + GLMessage_DataType *arg_srcX1 = glmsg.add_args(); + arg_srcX1->set_isarray(false); + arg_srcX1->set_type(GLMessage::DataType::INT); + arg_srcX1->add_intvalue(srcX1); + + // copy argument srcY1 + GLMessage_DataType *arg_srcY1 = glmsg.add_args(); arg_srcY1->set_isarray(false); arg_srcY1->set_type(GLMessage::DataType::INT); arg_srcY1->add_intvalue(srcY1); @@ -6936,7 +7172,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlitFramebuffer(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); + glContext->hooks->gl.glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -6949,11 +7185,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { +void GLTrace_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glRenderbufferStorageMultisample); + glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleANGLE); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -6988,7 +7224,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRenderbufferStorageMultisample(target, samples, internalformat, width, height); + glContext->hooks->gl.glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -7001,11 +7237,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer) { +void GLTrace_glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFramebufferTextureLayer); + glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleAPPLE); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -7013,34 +7249,34 @@ arg_target->set_type(GLMessage::DataType::ENUM); arg_target->add_intvalue((int)target); - // copy argument attachment - GLMessage_DataType *arg_attachment = glmsg.add_args(); - arg_attachment->set_isarray(false); - arg_attachment->set_type(GLMessage::DataType::ENUM); - arg_attachment->add_intvalue((int)attachment); + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); - // copy argument layer - GLMessage_DataType *arg_layer = glmsg.add_args(); - arg_layer->set_isarray(false); - arg_layer->set_type(GLMessage::DataType::INT); - arg_layer->add_intvalue(layer); + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFramebufferTextureLayer(target, attachment, texture, level, layer); + glContext->hooks->gl.glRenderbufferStorageMultisampleAPPLE(target, samples, internalformat, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -7053,78 +7289,45 @@ glContext->traceGLMessage(&glmsg); } -void * GLTrace_glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { +void GLTrace_glResolveMultisampleFramebufferAPPLE(void) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMapBufferRange); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument access - GLMessage_DataType *arg_access = glmsg.add_args(); - arg_access->set_isarray(false); - arg_access->set_type(GLMessage::DataType::INT); - arg_access->add_intvalue(access); + glmsg.set_function(GLMessage::glResolveMultisampleFramebufferAPPLE); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - void * retValue = glContext->hooks->gl.glMapBufferRange(target, offset, length, access); + glContext->hooks->gl.glResolveMultisampleFramebufferAPPLE(); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); - void *pointerArgs[] = { - (void *) retValue, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length) { +void GLTrace_glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFlushMappedBufferRange); + glmsg.set_function(GLMessage::glLabelObjectEXT); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); + // copy argument object + GLMessage_DataType *arg_object = glmsg.add_args(); + arg_object->set_isarray(false); + arg_object->set_type(GLMessage::DataType::INT); + arg_object->add_intvalue(object); // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); @@ -7132,14 +7335,21 @@ arg_length->set_type(GLMessage::DataType::INT); arg_length->add_intvalue(length); + // copy argument label + GLMessage_DataType *arg_label = glmsg.add_args(); + arg_label->set_isarray(false); + arg_label->set_type(GLMessage::DataType::INT); + arg_label->add_intvalue((int)label); + // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFlushMappedBufferRange(target, offset, length); + glContext->hooks->gl.glLabelObjectEXT(type, object, length, label); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) label, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7148,26 +7358,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBindVertexArray(GLuint array) { +void GLTrace_glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBindVertexArray); + glmsg.set_function(GLMessage::glGetObjectLabelEXT); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument array - GLMessage_DataType *arg_array = glmsg.add_args(); - arg_array->set_isarray(false); - arg_array->set_type(GLMessage::DataType::INT); - arg_array->add_intvalue(array); + // copy argument object + GLMessage_DataType *arg_object = glmsg.add_args(); + arg_object->set_isarray(false); + arg_object->set_type(GLMessage::DataType::INT); + arg_object->add_intvalue(object); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); + + // copy argument label + GLMessage_DataType *arg_label = glmsg.add_args(); + arg_label->set_isarray(false); + arg_label->set_type(GLMessage::DataType::INT); + arg_label->add_intvalue((int)label); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindVertexArray(array); + glContext->hooks->gl.glGetObjectLabelEXT(type, object, bufSize, length, label); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) length, + (void *) label, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7176,33 +7412,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteVertexArrays(GLsizei n, const GLuint * arrays) { +void GLTrace_glInsertEventMarkerEXT(GLsizei length, const GLchar *marker) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDeleteVertexArrays); + glmsg.set_function(GLMessage::glInsertEventMarkerEXT); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue(length); - // copy argument arrays - GLMessage_DataType *arg_arrays = glmsg.add_args(); - arg_arrays->set_isarray(false); - arg_arrays->set_type(GLMessage::DataType::INT64); - arg_arrays->add_int64value((uintptr_t)arrays); + // copy argument marker + GLMessage_DataType *arg_marker = glmsg.add_args(); + arg_marker->set_isarray(false); + arg_marker->set_type(GLMessage::DataType::INT); + arg_marker->add_intvalue((int)marker); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteVertexArrays(n, arrays); + glContext->hooks->gl.glInsertEventMarkerEXT(length, marker); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) arrays, + (void *) marker, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7211,33 +7447,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenVertexArrays(GLsizei n, GLuint * arrays) { +void GLTrace_glPushGroupMarkerEXT(GLsizei length, const GLchar *marker) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGenVertexArrays); + glmsg.set_function(GLMessage::glPushGroupMarkerEXT); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue(length); - // copy argument arrays - GLMessage_DataType *arg_arrays = glmsg.add_args(); - arg_arrays->set_isarray(false); - arg_arrays->set_type(GLMessage::DataType::INT64); - arg_arrays->add_int64value((uintptr_t)arrays); + // copy argument marker + GLMessage_DataType *arg_marker = glmsg.add_args(); + arg_marker->set_isarray(false); + arg_marker->set_type(GLMessage::DataType::INT); + arg_marker->add_intvalue((int)marker); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenVertexArrays(n, arrays); + glContext->hooks->gl.glPushGroupMarkerEXT(length, marker); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) arrays, + (void *) marker, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7246,31 +7482,19 @@ glContext->traceGLMessage(&glmsg); } -GLboolean GLTrace_glIsVertexArray(GLuint array) { +void GLTrace_glPopGroupMarkerEXT(void) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glIsVertexArray); - - // copy argument array - GLMessage_DataType *arg_array = glmsg.add_args(); - arg_array->set_isarray(false); - arg_array->set_type(GLMessage::DataType::INT); - arg_array->add_intvalue(array); + glmsg.set_function(GLMessage::glPopGroupMarkerEXT); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsVertexArray(array); + glContext->hooks->gl.glPopGroupMarkerEXT(); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - void *pointerArgs[] = { }; @@ -7278,15 +7502,13 @@ threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glGetIntegeri_v(GLenum target, GLuint index, GLint * data) { +void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetIntegeri_v); + glmsg.set_function(GLMessage::glDiscardFramebufferEXT); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -7294,27 +7516,27 @@ arg_target->set_type(GLMessage::DataType::ENUM); arg_target->add_intvalue((int)target); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument numAttachments + GLMessage_DataType *arg_numAttachments = glmsg.add_args(); + arg_numAttachments->set_isarray(false); + arg_numAttachments->set_type(GLMessage::DataType::INT); + arg_numAttachments->add_intvalue(numAttachments); - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + // copy argument attachments + GLMessage_DataType *arg_attachments = glmsg.add_args(); + arg_attachments->set_isarray(false); + arg_attachments->set_type(GLMessage::DataType::INT); + arg_attachments->add_intvalue((int)attachments); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetIntegeri_v(target, index, data); + glContext->hooks->gl.glDiscardFramebufferEXT(target, numAttachments, attachments); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) data, + (void *) attachments, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7323,44 +7545,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBeginTransformFeedback(GLenum primitiveMode) { +void GLTrace_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBeginTransformFeedback); - - // copy argument primitiveMode - GLMessage_DataType *arg_primitiveMode = glmsg.add_args(); - arg_primitiveMode->set_isarray(false); - arg_primitiveMode->set_type(GLMessage::DataType::ENUM); - arg_primitiveMode->add_intvalue((int)primitiveMode); + glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleEXT); - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBeginTransformFeedback(primitiveMode); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - void *pointerArgs[] = { - }; + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); -void GLTrace_glEndTransformFeedback(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); - glmsg.set_function(GLMessage::glEndTransformFeedback); + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEndTransformFeedback(); + glContext->hooks->gl.glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -7373,11 +7597,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size) { +void GLTrace_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBindBufferRange); + glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleEXT); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -7385,34 +7609,40 @@ arg_target->set_type(GLMessage::DataType::ENUM); arg_target->add_intvalue((int)target); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::INT); - arg_buffer->add_intvalue(buffer); + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindBufferRange(target, index, buffer, offset, size); + glContext->hooks->gl.glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -7425,38 +7655,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBindBufferBase(GLenum target, GLuint index, GLuint buffer) { +void GLTrace_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBindBufferBase); + glmsg.set_function(GLMessage::glMultiDrawArraysEXT); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument first + GLMessage_DataType *arg_first = glmsg.add_args(); + arg_first->set_isarray(false); + arg_first->set_type(GLMessage::DataType::INT); + arg_first->add_intvalue((int)first); - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::INT); - arg_buffer->add_intvalue(buffer); + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue((int)count); + + // copy argument primcount + GLMessage_DataType *arg_primcount = glmsg.add_args(); + arg_primcount->set_isarray(false); + arg_primcount->set_type(GLMessage::DataType::INT); + arg_primcount->add_intvalue(primcount); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindBufferBase(target, index, buffer); + glContext->hooks->gl.glMultiDrawArraysEXT(mode, first, count, primcount); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) first, + (void *) count, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7465,45 +7703,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode) { +void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTransformFeedbackVaryings); + glmsg.set_function(GLMessage::glMultiDrawElementsEXT); - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); // copy argument count GLMessage_DataType *arg_count = glmsg.add_args(); arg_count->set_isarray(false); arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + arg_count->add_intvalue((int)count); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument varyings - GLMessage_DataType *arg_varyings = glmsg.add_args(); - arg_varyings->set_isarray(false); - arg_varyings->set_type(GLMessage::DataType::INT64); - arg_varyings->add_int64value((uintptr_t)varyings); + // copy argument indices + GLMessage_DataType *arg_indices = glmsg.add_args(); + arg_indices->set_isarray(false); + arg_indices->set_type(GLMessage::DataType::INT); + arg_indices->add_intvalue((int)indices); - // copy argument bufferMode - GLMessage_DataType *arg_bufferMode = glmsg.add_args(); - arg_bufferMode->set_isarray(false); - arg_bufferMode->set_type(GLMessage::DataType::ENUM); - arg_bufferMode->add_intvalue((int)bufferMode); + // copy argument primcount + GLMessage_DataType *arg_primcount = glmsg.add_args(); + arg_primcount->set_isarray(false); + arg_primcount->set_type(GLMessage::DataType::INT); + arg_primcount->add_intvalue(primcount); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTransformFeedbackVaryings(program, count, varyings, bufferMode); + glContext->hooks->gl.glMultiDrawElementsEXT(mode, count, type, indices, primcount); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) varyings, + (void *) count, + (void *) indices, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7512,66 +7757,68 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name) { +void GLTrace_glGenQueriesEXT(GLsizei n, GLuint *ids) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetTransformFeedbackVarying); + glmsg.set_function(GLMessage::glGenQueriesEXT); - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument ids + GLMessage_DataType *arg_ids = glmsg.add_args(); + arg_ids->set_isarray(false); + arg_ids->set_type(GLMessage::DataType::INT); + arg_ids->add_intvalue((int)ids); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGenQueriesEXT(n, ids); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + void *pointerArgs[] = { + (void *) ids, + }; - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT64); - arg_size->add_int64value((uintptr_t)size); + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::INT64); - arg_type->add_int64value((uintptr_t)type); +void GLTrace_glDeleteQueriesEXT(GLsizei n, const GLuint *ids) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + glmsg.set_function(GLMessage::glDeleteQueriesEXT); + + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); + + // copy argument ids + GLMessage_DataType *arg_ids = glmsg.add_args(); + arg_ids->set_isarray(false); + arg_ids->set_type(GLMessage::DataType::INT); + arg_ids->add_intvalue((int)ids); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTransformFeedbackVarying(program, index, bufSize, length, size, type, name); + glContext->hooks->gl.glDeleteQueriesEXT(n, ids); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) length, - (void *) size, - (void *) type, - (void *) name, + (void *) ids, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7580,92 +7827,68 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer) { +GLboolean GLTrace_glIsQueryEXT(GLuint id) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexAttribIPointer); + glmsg.set_function(GLMessage::glIsQueryEXT); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); - - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + // copy argument id + GLMessage_DataType *arg_id = glmsg.add_args(); + arg_id->set_isarray(false); + arg_id->set_type(GLMessage::DataType::INT); + arg_id->add_intvalue(id); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribIPointer(index, size, type, stride, pointer); + GLboolean retValue = glContext->hooks->gl.glIsQueryEXT(id); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + void *pointerArgs[] = { - (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); + + return retValue; } -void GLTrace_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint * params) { +void GLTrace_glBeginQueryEXT(GLenum target, GLuint id) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetVertexAttribIiv); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + glmsg.set_function(GLMessage::glBeginQueryEXT); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument id + GLMessage_DataType *arg_id = glmsg.add_args(); + arg_id->set_isarray(false); + arg_id->set_type(GLMessage::DataType::INT); + arg_id->add_intvalue(id); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetVertexAttribIiv(index, pname, params); + glContext->hooks->gl.glBeginQueryEXT(target, id); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7674,39 +7897,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint * params) { +void GLTrace_glEndQueryEXT(GLenum target) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetVertexAttribIuiv); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glEndQueryEXT); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetVertexAttribIuiv(index, pname, params); + glContext->hooks->gl.glEndQueryEXT(target); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7715,50 +7925,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w) { +void GLTrace_glGetQueryivEXT(GLenum target, GLenum pname, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexAttribI4i); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); + glmsg.set_function(GLMessage::glGetQueryivEXT); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument w - GLMessage_DataType *arg_w = glmsg.add_args(); - arg_w->set_isarray(false); - arg_w->set_type(GLMessage::DataType::INT); - arg_w->add_intvalue(w); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribI4i(index, x, y, z, w); + glContext->hooks->gl.glGetQueryivEXT(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7767,50 +7966,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w) { +void GLTrace_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexAttribI4ui); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); + glmsg.set_function(GLMessage::glGetQueryObjectuivEXT); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + // copy argument id + GLMessage_DataType *arg_id = glmsg.add_args(); + arg_id->set_isarray(false); + arg_id->set_type(GLMessage::DataType::INT); + arg_id->add_intvalue(id); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument w - GLMessage_DataType *arg_w = glmsg.add_args(); - arg_w->set_isarray(false); - arg_w->set_type(GLMessage::DataType::INT); - arg_w->add_intvalue(w); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribI4ui(index, x, y, z, w); + glContext->hooks->gl.glGetQueryObjectuivEXT(id, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7819,68 +8007,99 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttribI4iv(GLuint index, const GLint * v) { +GLenum GLTrace_glGetGraphicsResetStatusEXT(void) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexAttribI4iv); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument v - GLMessage_DataType *arg_v = glmsg.add_args(); - arg_v->set_isarray(false); - arg_v->set_type(GLMessage::DataType::INT64); - arg_v->add_int64value((uintptr_t)v); + glmsg.set_function(GLMessage::glGetGraphicsResetStatusEXT); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribI4iv(index, v); + GLenum retValue = glContext->hooks->gl.glGetGraphicsResetStatusEXT(); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::ENUM); + rt->add_intvalue((int)retValue); + void *pointerArgs[] = { - (void *) v, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); + + return retValue; } -void GLTrace_glVertexAttribI4uiv(GLuint index, const GLuint * v) { +void GLTrace_glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexAttribI4uiv); + glmsg.set_function(GLMessage::glReadnPixelsEXT); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // copy argument v - GLMessage_DataType *arg_v = glmsg.add_args(); - arg_v->set_isarray(false); - arg_v->set_type(GLMessage::DataType::INT64); - arg_v->add_int64value((uintptr_t)v); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument data + GLMessage_DataType *arg_data = glmsg.add_args(); + arg_data->set_isarray(false); + arg_data->set_type(GLMessage::DataType::INT); + arg_data->add_intvalue((int)data); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribI4uiv(index, v); + glContext->hooks->gl.glReadnPixelsEXT(x, y, width, height, format, type, bufSize, data); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) v, + (void *) data, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -7889,11 +8108,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetUniformuiv(GLuint program, GLint location, GLuint * params) { +void GLTrace_glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetUniformuiv); + glmsg.set_function(GLMessage::glGetnUniformfvEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -7907,16 +8126,22 @@ arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetUniformuiv(program, location, params); + glContext->hooks->gl.glGetnUniformfvEXT(program, location, bufSize, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -7930,11 +8155,11 @@ glContext->traceGLMessage(&glmsg); } -GLint GLTrace_glGetFragDataLocation(GLuint program, const GLchar * name) { +void GLTrace_glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetFragDataLocation); + glmsg.set_function(GLMessage::glGetnUniformivEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -7942,59 +8167,69 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLint retValue = glContext->hooks->gl.glGetFragDataLocation(program, name); + glContext->hooks->gl.glGetnUniformivEXT(program, location, bufSize, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); - void *pointerArgs[] = { - (void *) name, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glUniform1ui(GLint location, GLuint v0) { +void GLTrace_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform1ui); + glmsg.set_function(GLMessage::glUseProgramStagesEXT); - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); + + // copy argument stages + GLMessage_DataType *arg_stages = glmsg.add_args(); + arg_stages->set_isarray(false); + arg_stages->set_type(GLMessage::DataType::INT); + arg_stages->add_intvalue(stages); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform1ui(location, v0); + glContext->hooks->gl.glUseProgramStagesEXT(pipeline, stages, program); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -8007,34 +8242,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform2ui(GLint location, GLuint v0, GLuint v1) { +void GLTrace_glActiveShaderProgramEXT(GLuint pipeline, GLuint program) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform2ui); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + glmsg.set_function(GLMessage::glActiveShaderProgramEXT); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform2ui(location, v0, v1); + glContext->hooks->gl.glActiveShaderProgramEXT(pipeline, program); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -8047,92 +8276,71 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2) { +GLuint GLTrace_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform3ui); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + glmsg.set_function(GLMessage::glCreateShaderProgramvEXT); - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); + // copy argument strings + GLMessage_DataType *arg_strings = glmsg.add_args(); + arg_strings->set_isarray(false); + arg_strings->set_type(GLMessage::DataType::INT); + arg_strings->add_intvalue((int)strings); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform3ui(location, v0, v1, v2); + GLuint retValue = glContext->hooks->gl.glCreateShaderProgramvEXT(type, count, strings); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::INT); + rt->add_intvalue(retValue); + void *pointerArgs[] = { + (void *) strings, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); + + return retValue; } -void GLTrace_glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { +void GLTrace_glBindProgramPipelineEXT(GLuint pipeline) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform4ui); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); + glmsg.set_function(GLMessage::glBindProgramPipelineEXT); - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::INT); - arg_v3->add_intvalue(v3); + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform4ui(location, v0, v1, v2, v3); + glContext->hooks->gl.glBindProgramPipelineEXT(pipeline); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -8145,39 +8353,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform1uiv(GLint location, GLsizei count, const GLuint * value) { +void GLTrace_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform1uiv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + glmsg.set_function(GLMessage::glDeleteProgramPipelinesEXT); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument pipelines + GLMessage_DataType *arg_pipelines = glmsg.add_args(); + arg_pipelines->set_isarray(false); + arg_pipelines->set_type(GLMessage::DataType::INT); + arg_pipelines->add_intvalue((int)pipelines); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform1uiv(location, count, value); + glContext->hooks->gl.glDeleteProgramPipelinesEXT(n, pipelines); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) pipelines, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8186,39 +8388,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform2uiv(GLint location, GLsizei count, const GLuint * value) { +void GLTrace_glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform2uiv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + glmsg.set_function(GLMessage::glGenProgramPipelinesEXT); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument pipelines + GLMessage_DataType *arg_pipelines = glmsg.add_args(); + arg_pipelines->set_isarray(false); + arg_pipelines->set_type(GLMessage::DataType::INT); + arg_pipelines->add_intvalue((int)pipelines); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform2uiv(location, count, value); + glContext->hooks->gl.glGenProgramPipelinesEXT(n, pipelines); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) pipelines, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8227,80 +8423,74 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniform3uiv(GLint location, GLsizei count, const GLuint * value) { +GLboolean GLTrace_glIsProgramPipelineEXT(GLuint pipeline) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform3uiv); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + glmsg.set_function(GLMessage::glIsProgramPipelineEXT); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform3uiv(location, count, value); + GLboolean retValue = glContext->hooks->gl.glIsProgramPipelineEXT(pipeline); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + void *pointerArgs[] = { - (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); + + return retValue; } -void GLTrace_glUniform4uiv(GLint location, GLsizei count, const GLuint * value) { +void GLTrace_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniform4uiv); + glmsg.set_function(GLMessage::glProgramParameteriEXT); - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); // copy argument value GLMessage_DataType *arg_value = glmsg.add_args(); arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue(value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniform4uiv(location, count, value); + glContext->hooks->gl.glProgramParameteriEXT(program, pname, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8309,39 +8499,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint * value) { +void GLTrace_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearBufferiv); + glmsg.set_function(GLMessage::glGetProgramPipelineivEXT); - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::ENUM); - arg_buffer->add_intvalue((int)buffer); + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); - // copy argument drawbuffer - GLMessage_DataType *arg_drawbuffer = glmsg.add_args(); - arg_drawbuffer->set_isarray(false); - arg_drawbuffer->set_type(GLMessage::DataType::INT); - arg_drawbuffer->add_intvalue(drawbuffer); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearBufferiv(buffer, drawbuffer, value); + glContext->hooks->gl.glGetProgramPipelineivEXT(pipeline, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8350,39 +8540,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint * value) { +void GLTrace_glProgramUniform1iEXT(GLuint program, GLint location, GLint x) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearBufferuiv); + glmsg.set_function(GLMessage::glProgramUniform1iEXT); - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::ENUM); - arg_buffer->add_intvalue((int)buffer); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument drawbuffer - GLMessage_DataType *arg_drawbuffer = glmsg.add_args(); - arg_drawbuffer->set_isarray(false); - arg_drawbuffer->set_type(GLMessage::DataType::INT); - arg_drawbuffer->add_intvalue(drawbuffer); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearBufferuiv(buffer, drawbuffer, value); + glContext->hooks->gl.glProgramUniform1iEXT(program, location, x); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8391,39 +8580,44 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat * value) { +void GLTrace_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearBufferfv); + glmsg.set_function(GLMessage::glProgramUniform2iEXT); - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::ENUM); - arg_buffer->add_intvalue((int)buffer); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument drawbuffer - GLMessage_DataType *arg_drawbuffer = glmsg.add_args(); - arg_drawbuffer->set_isarray(false); - arg_drawbuffer->set_type(GLMessage::DataType::INT); - arg_drawbuffer->add_intvalue(drawbuffer); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearBufferfv(buffer, drawbuffer, value); + glContext->hooks->gl.glProgramUniform2iEXT(program, location, x, y); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8432,40 +8626,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil) { +void GLTrace_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearBufferfi); + glmsg.set_function(GLMessage::glProgramUniform3iEXT); - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::ENUM); - arg_buffer->add_intvalue((int)buffer); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument drawbuffer - GLMessage_DataType *arg_drawbuffer = glmsg.add_args(); - arg_drawbuffer->set_isarray(false); - arg_drawbuffer->set_type(GLMessage::DataType::INT); - arg_drawbuffer->add_intvalue(drawbuffer); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::FLOAT); - arg_depth->add_floatvalue(depth); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument stencil - GLMessage_DataType *arg_stencil = glmsg.add_args(); - arg_stencil->set_isarray(false); - arg_stencil->set_type(GLMessage::DataType::INT); - arg_stencil->add_intvalue(stencil); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearBufferfi(buffer, drawbuffer, depth, stencil); + glContext->hooks->gl.glProgramUniform3iEXT(program, location, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -8478,89 +8678,92 @@ glContext->traceGLMessage(&glmsg); } -const GLubyte * GLTrace_glGetStringi(GLenum name, GLuint index) { +void GLTrace_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetStringi); + glmsg.set_function(GLMessage::glProgramUniform4iEXT); - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::ENUM); - arg_name->add_intvalue((int)name); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); + + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::INT); + arg_w->add_intvalue(w); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - const GLubyte * retValue = glContext->hooks->gl.glGetStringi(name, index); + glContext->hooks->gl.glProgramUniform4iEXT(program, location, x, y, z, w); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); - void *pointerArgs[] = { - (void *) retValue, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { +void GLTrace_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glCopyBufferSubData); + glmsg.set_function(GLMessage::glProgramUniform1fEXT); - // copy argument readTarget - GLMessage_DataType *arg_readTarget = glmsg.add_args(); - arg_readTarget->set_isarray(false); - arg_readTarget->set_type(GLMessage::DataType::ENUM); - arg_readTarget->add_intvalue((int)readTarget); - - // copy argument writeTarget - GLMessage_DataType *arg_writeTarget = glmsg.add_args(); - arg_writeTarget->set_isarray(false); - arg_writeTarget->set_type(GLMessage::DataType::ENUM); - arg_writeTarget->add_intvalue((int)writeTarget); - - // copy argument readOffset - GLMessage_DataType *arg_readOffset = glmsg.add_args(); - arg_readOffset->set_isarray(false); - arg_readOffset->set_type(GLMessage::DataType::INT); - arg_readOffset->add_intvalue(readOffset); - - // copy argument writeOffset - GLMessage_DataType *arg_writeOffset = glmsg.add_args(); - arg_writeOffset->set_isarray(false); - arg_writeOffset->set_type(GLMessage::DataType::INT); - arg_writeOffset->add_intvalue(writeOffset); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCopyBufferSubData(readTarget, writeTarget, readOffset, writeOffset, size); + glContext->hooks->gl.glProgramUniform1fEXT(program, location, x); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -8573,11 +8776,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices) { +void GLTrace_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetUniformIndices); + glmsg.set_function(GLMessage::glProgramUniform2fEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -8585,34 +8788,32 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument uniformCount - GLMessage_DataType *arg_uniformCount = glmsg.add_args(); - arg_uniformCount->set_isarray(false); - arg_uniformCount->set_type(GLMessage::DataType::INT); - arg_uniformCount->add_intvalue(uniformCount); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument uniformNames - GLMessage_DataType *arg_uniformNames = glmsg.add_args(); - arg_uniformNames->set_isarray(false); - arg_uniformNames->set_type(GLMessage::DataType::INT64); - arg_uniformNames->add_int64value((uintptr_t)uniformNames); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument uniformIndices - GLMessage_DataType *arg_uniformIndices = glmsg.add_args(); - arg_uniformIndices->set_isarray(false); - arg_uniformIndices->set_type(GLMessage::DataType::INT64); - arg_uniformIndices->add_int64value((uintptr_t)uniformIndices); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetUniformIndices(program, uniformCount, uniformNames, uniformIndices); + glContext->hooks->gl.glProgramUniform2fEXT(program, location, x, y); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) uniformNames, - (void *) uniformIndices, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8621,11 +8822,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params) { +void GLTrace_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetActiveUniformsiv); + glmsg.set_function(GLMessage::glProgramUniform3fEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -8633,40 +8834,38 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument uniformCount - GLMessage_DataType *arg_uniformCount = glmsg.add_args(); - arg_uniformCount->set_isarray(false); - arg_uniformCount->set_type(GLMessage::DataType::INT); - arg_uniformCount->add_intvalue(uniformCount); - - // copy argument uniformIndices - GLMessage_DataType *arg_uniformIndices = glmsg.add_args(); - arg_uniformIndices->set_isarray(false); - arg_uniformIndices->set_type(GLMessage::DataType::INT64); - arg_uniformIndices->add_int64value((uintptr_t)uniformIndices); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetActiveUniformsiv(program, uniformCount, uniformIndices, pname, params); + glContext->hooks->gl.glProgramUniform3fEXT(program, location, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) uniformIndices, - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8675,11 +8874,11 @@ glContext->traceGLMessage(&glmsg); } -GLuint GLTrace_glGetUniformBlockIndex(GLuint program, const GLchar * uniformBlockName) { +void GLTrace_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetUniformBlockIndex); + glmsg.set_function(GLMessage::glProgramUniform4fEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -8687,42 +8886,57 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument uniformBlockName - GLMessage_DataType *arg_uniformBlockName = glmsg.add_args(); - arg_uniformBlockName->set_isarray(false); - arg_uniformBlockName->set_type(GLMessage::DataType::INT64); - arg_uniformBlockName->add_int64value((uintptr_t)uniformBlockName); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); + + // copy argument w + GLMessage_DataType *arg_w = glmsg.add_args(); + arg_w->set_isarray(false); + arg_w->set_type(GLMessage::DataType::FLOAT); + arg_w->add_floatvalue(w); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLuint retValue = glContext->hooks->gl.glGetUniformBlockIndex(program, uniformBlockName); + glContext->hooks->gl.glProgramUniform4fEXT(program, location, x, y, z, w); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); - void *pointerArgs[] = { - (void *) uniformBlockName, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params) { +void GLTrace_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetActiveUniformBlockiv); + glmsg.set_function(GLMessage::glProgramUniform1ivEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -8730,33 +8944,33 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument uniformBlockIndex - GLMessage_DataType *arg_uniformBlockIndex = glmsg.add_args(); - arg_uniformBlockIndex->set_isarray(false); - arg_uniformBlockIndex->set_type(GLMessage::DataType::INT); - arg_uniformBlockIndex->add_intvalue(uniformBlockIndex); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetActiveUniformBlockiv(program, uniformBlockIndex, pname, params); + glContext->hooks->gl.glProgramUniform1ivEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8765,11 +8979,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName) { +void GLTrace_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetActiveUniformBlockName); + glmsg.set_function(GLMessage::glProgramUniform2ivEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -8777,40 +8991,33 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument uniformBlockIndex - GLMessage_DataType *arg_uniformBlockIndex = glmsg.add_args(); - arg_uniformBlockIndex->set_isarray(false); - arg_uniformBlockIndex->set_type(GLMessage::DataType::INT); - arg_uniformBlockIndex->add_intvalue(uniformBlockIndex); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument uniformBlockName - GLMessage_DataType *arg_uniformBlockName = glmsg.add_args(); - arg_uniformBlockName->set_isarray(false); - arg_uniformBlockName->set_type(GLMessage::DataType::INT64); - arg_uniformBlockName->add_int64value((uintptr_t)uniformBlockName); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetActiveUniformBlockName(program, uniformBlockIndex, bufSize, length, uniformBlockName); + glContext->hooks->gl.glProgramUniform2ivEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) length, - (void *) uniformBlockName, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8819,11 +9026,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding) { +void GLTrace_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUniformBlockBinding); + glmsg.set_function(GLMessage::glProgramUniform3ivEXT); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -8831,26 +9038,33 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument uniformBlockIndex - GLMessage_DataType *arg_uniformBlockIndex = glmsg.add_args(); - arg_uniformBlockIndex->set_isarray(false); - arg_uniformBlockIndex->set_type(GLMessage::DataType::INT); - arg_uniformBlockIndex->add_intvalue(uniformBlockIndex); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument uniformBlockBinding - GLMessage_DataType *arg_uniformBlockBinding = glmsg.add_args(); - arg_uniformBlockBinding->set_isarray(false); - arg_uniformBlockBinding->set_type(GLMessage::DataType::INT); - arg_uniformBlockBinding->add_intvalue(uniformBlockBinding); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformBlockBinding(program, uniformBlockIndex, uniformBlockBinding); + glContext->hooks->gl.glProgramUniform3ivEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8859,23 +9073,23 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount) { +void GLTrace_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDrawArraysInstanced); + glmsg.set_function(GLMessage::glProgramUniform4ivEXT); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument first - GLMessage_DataType *arg_first = glmsg.add_args(); - arg_first->set_isarray(false); - arg_first->set_type(GLMessage::DataType::INT); - arg_first->add_intvalue(first); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); // copy argument count GLMessage_DataType *arg_count = glmsg.add_args(); @@ -8883,20 +9097,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument instancecount - GLMessage_DataType *arg_instancecount = glmsg.add_args(); - arg_instancecount->set_isarray(false); - arg_instancecount->set_type(GLMessage::DataType::INT); - arg_instancecount->add_intvalue(instancecount); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawArraysInstanced(mode, first, count, instancecount); + glContext->hooks->gl.glProgramUniform4ivEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8905,17 +9120,23 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount) { +void GLTrace_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDrawElementsInstanced); + glmsg.set_function(GLMessage::glProgramUniform1fvEXT); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); // copy argument count GLMessage_DataType *arg_count = glmsg.add_args(); @@ -8923,33 +9144,21 @@ arg_count->set_type(GLMessage::DataType::INT); arg_count->add_intvalue(count); - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); - - // copy argument instancecount - GLMessage_DataType *arg_instancecount = glmsg.add_args(); - arg_instancecount->set_isarray(false); - arg_instancecount->set_type(GLMessage::DataType::INT); - arg_instancecount->add_intvalue(instancecount); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawElementsInstanced(mode, count, type, indices, instancecount); + glContext->hooks->gl.glProgramUniform1fvEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) indices, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -8958,107 +9167,139 @@ glContext->traceGLMessage(&glmsg); } -GLsync GLTrace_glFenceSync(GLenum condition, GLbitfield flags) { +void GLTrace_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFenceSync); + glmsg.set_function(GLMessage::glProgramUniform2fvEXT); - // copy argument condition - GLMessage_DataType *arg_condition = glmsg.add_args(); - arg_condition->set_isarray(false); - arg_condition->set_type(GLMessage::DataType::ENUM); - arg_condition->add_intvalue((int)condition); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLsync retValue = glContext->hooks->gl.glFenceSync(condition, flags); + glContext->hooks->gl.glProgramUniform2fvEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); - void *pointerArgs[] = { - (void *) retValue, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -GLboolean GLTrace_glIsSync(GLsync sync) { +void GLTrace_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glIsSync); + glmsg.set_function(GLMessage::glProgramUniform3fvEXT); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsSync(sync); + glContext->hooks->gl.glProgramUniform3fvEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - void *pointerArgs[] = { - (void *) sync, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glDeleteSync(GLsync sync) { +void GLTrace_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDeleteSync); + glmsg.set_function(GLMessage::glProgramUniform4fvEXT); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteSync(sync); + glContext->hooks->gl.glProgramUniform4fvEXT(program, location, count, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) sync, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9067,88 +9308,104 @@ glContext->traceGLMessage(&glmsg); } -GLenum GLTrace_glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { +void GLTrace_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClientWaitSync); + glmsg.set_function(GLMessage::glProgramUniformMatrix2fvEXT); + + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); + // copy argument transpose + GLMessage_DataType *arg_transpose = glmsg.add_args(); + arg_transpose->set_isarray(false); + arg_transpose->set_type(GLMessage::DataType::BOOL); + arg_transpose->add_boolvalue(transpose); - // copy argument timeout - GLMessage_DataType *arg_timeout = glmsg.add_args(); - arg_timeout->set_isarray(false); - arg_timeout->set_type(GLMessage::DataType::INT64); - arg_timeout->add_int64value(timeout); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLenum retValue = glContext->hooks->gl.glClientWaitSync(sync, flags, timeout); + glContext->hooks->gl.glProgramUniformMatrix2fvEXT(program, location, count, transpose, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::ENUM); - rt->add_intvalue((int)retValue); - void *pointerArgs[] = { - (void *) sync, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout) { +void GLTrace_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glWaitSync); - - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); - - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); - - // copy argument timeout - GLMessage_DataType *arg_timeout = glmsg.add_args(); - arg_timeout->set_isarray(false); - arg_timeout->set_type(GLMessage::DataType::INT64); - arg_timeout->add_int64value(timeout); + glmsg.set_function(GLMessage::glProgramUniformMatrix3fvEXT); - // call function + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); + + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument transpose + GLMessage_DataType *arg_transpose = glmsg.add_args(); + arg_transpose->set_isarray(false); + arg_transpose->set_type(GLMessage::DataType::BOOL); + arg_transpose->add_boolvalue(transpose); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); + + // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glWaitSync(sync, flags, timeout); + glContext->hooks->gl.glProgramUniformMatrix3fvEXT(program, location, count, transpose, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) sync, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9157,33 +9414,51 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetInteger64v(GLenum pname, GLint64 * data) { +void GLTrace_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetInteger64v); + glmsg.set_function(GLMessage::glProgramUniformMatrix4fvEXT); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument program + GLMessage_DataType *arg_program = glmsg.add_args(); + arg_program->set_isarray(false); + arg_program->set_type(GLMessage::DataType::INT); + arg_program->add_intvalue(program); - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + // copy argument location + GLMessage_DataType *arg_location = glmsg.add_args(); + arg_location->set_isarray(false); + arg_location->set_type(GLMessage::DataType::INT); + arg_location->add_intvalue(location); + + // copy argument count + GLMessage_DataType *arg_count = glmsg.add_args(); + arg_count->set_isarray(false); + arg_count->set_type(GLMessage::DataType::INT); + arg_count->add_intvalue(count); + + // copy argument transpose + GLMessage_DataType *arg_transpose = glmsg.add_args(); + arg_transpose->set_isarray(false); + arg_transpose->set_type(GLMessage::DataType::BOOL); + arg_transpose->add_boolvalue(transpose); + + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue((int)value); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetInteger64v(pname, data); + glContext->hooks->gl.glProgramUniformMatrix4fvEXT(program, location, count, transpose, value); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) data, + (void *) value, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9192,23 +9467,45 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) { +void GLTrace_glValidateProgramPipelineEXT(GLuint pipeline) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetSynciv); + glmsg.set_function(GLMessage::glValidateProgramPipelineEXT); - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glValidateProgramPipelineEXT(pipeline); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetProgramPipelineInfoLogEXT); + + // copy argument pipeline + GLMessage_DataType *arg_pipeline = glmsg.add_args(); + arg_pipeline->set_isarray(false); + arg_pipeline->set_type(GLMessage::DataType::INT); + arg_pipeline->add_intvalue(pipeline); // copy argument bufSize GLMessage_DataType *arg_bufSize = glmsg.add_args(); @@ -9219,26 +9516,25 @@ // copy argument length GLMessage_DataType *arg_length = glmsg.add_args(); arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); - // copy argument values - GLMessage_DataType *arg_values = glmsg.add_args(); - arg_values->set_isarray(false); - arg_values->set_type(GLMessage::DataType::INT64); - arg_values->add_int64value((uintptr_t)values); + // copy argument infoLog + GLMessage_DataType *arg_infoLog = glmsg.add_args(); + arg_infoLog->set_isarray(false); + arg_infoLog->set_type(GLMessage::DataType::INT); + arg_infoLog->add_intvalue((int)infoLog); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetSynciv(sync, pname, bufSize, length, values); + glContext->hooks->gl.glGetProgramPipelineInfoLogEXT(pipeline, bufSize, length, infoLog); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) sync, (void *) length, - (void *) values, + (void *) infoLog, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9247,11 +9543,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetInteger64i_v(GLenum target, GLuint index, GLint64 * data) { +void GLTrace_glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetInteger64i_v); + glmsg.set_function(GLMessage::glTexStorage1DEXT); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -9259,27 +9555,32 @@ arg_target->set_type(GLMessage::DataType::ENUM); arg_target->add_intvalue((int)target); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument levels + GLMessage_DataType *arg_levels = glmsg.add_args(); + arg_levels->set_isarray(false); + arg_levels->set_type(GLMessage::DataType::INT); + arg_levels->add_intvalue(levels); - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetInteger64i_v(target, index, data); + glContext->hooks->gl.glTexStorage1DEXT(target, levels, internalformat, width); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) data, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9288,11 +9589,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 * params) { +void GLTrace_glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetBufferParameteri64v); + glmsg.set_function(GLMessage::glTexStorage2DEXT); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -9300,27 +9601,38 @@ arg_target->set_type(GLMessage::DataType::ENUM); arg_target->add_intvalue((int)target); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument levels + GLMessage_DataType *arg_levels = glmsg.add_args(); + arg_levels->set_isarray(false); + arg_levels->set_type(GLMessage::DataType::INT); + arg_levels->add_intvalue(levels); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetBufferParameteri64v(target, pname, params); + glContext->hooks->gl.glTexStorage2DEXT(target, levels, internalformat, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9329,68 +9641,56 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenSamplers(GLsizei count, GLuint * samplers) { +void GLTrace_glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGenSamplers); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument samplers - GLMessage_DataType *arg_samplers = glmsg.add_args(); - arg_samplers->set_isarray(false); - arg_samplers->set_type(GLMessage::DataType::INT64); - arg_samplers->add_int64value((uintptr_t)samplers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenSamplers(count, samplers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + glmsg.set_function(GLMessage::glTexStorage3DEXT); - void *pointerArgs[] = { - (void *) samplers, - }; + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} + // copy argument levels + GLMessage_DataType *arg_levels = glmsg.add_args(); + arg_levels->set_isarray(false); + arg_levels->set_type(GLMessage::DataType::INT); + arg_levels->add_intvalue(levels); -void GLTrace_glDeleteSamplers(GLsizei count, const GLuint * samplers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); - glmsg.set_function(GLMessage::glDeleteSamplers); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); - // copy argument samplers - GLMessage_DataType *arg_samplers = glmsg.add_args(); - arg_samplers->set_isarray(false); - arg_samplers->set_type(GLMessage::DataType::INT64); - arg_samplers->add_int64value((uintptr_t)samplers); + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteSamplers(count, samplers); + glContext->hooks->gl.glTexStorage3DEXT(target, levels, internalformat, width, height, depth); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) samplers, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9399,64 +9699,46 @@ glContext->traceGLMessage(&glmsg); } -GLboolean GLTrace_glIsSampler(GLuint sampler) { +void GLTrace_glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glIsSampler); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); + glmsg.set_function(GLMessage::glTextureStorage1DEXT); - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsSampler(sampler); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glBindSampler(GLuint unit, GLuint sampler) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - glmsg.set_function(GLMessage::glBindSampler); + // copy argument levels + GLMessage_DataType *arg_levels = glmsg.add_args(); + arg_levels->set_isarray(false); + arg_levels->set_type(GLMessage::DataType::INT); + arg_levels->add_intvalue(levels); - // copy argument unit - GLMessage_DataType *arg_unit = glmsg.add_args(); - arg_unit->set_isarray(false); - arg_unit->set_type(GLMessage::DataType::INT); - arg_unit->add_intvalue(unit); + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindSampler(unit, sampler); + glContext->hooks->gl.glTextureStorage1DEXT(texture, target, levels, internalformat, width); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -9469,34 +9751,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param) { +void GLTrace_glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSamplerParameteri); + glmsg.set_function(GLMessage::glTextureStorage2DEXT); - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument levels + GLMessage_DataType *arg_levels = glmsg.add_args(); + arg_levels->set_isarray(false); + arg_levels->set_type(GLMessage::DataType::INT); + arg_levels->add_intvalue(levels); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSamplerParameteri(sampler, pname, param); + glContext->hooks->gl.glTextureStorage2DEXT(texture, target, levels, internalformat, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -9509,39 +9809,62 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint * param) { +void GLTrace_glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSamplerParameteriv); + glmsg.set_function(GLMessage::glTextureStorage3DEXT); - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + // copy argument levels + GLMessage_DataType *arg_levels = glmsg.add_args(); + arg_levels->set_isarray(false); + arg_levels->set_type(GLMessage::DataType::INT); + arg_levels->add_intvalue(levels); + + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSamplerParameteriv(sampler, pname, param); + glContext->hooks->gl.glTextureStorage3DEXT(texture, target, levels, internalformat, width, height, depth); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9550,34 +9873,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param) { +void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSamplerParameterf); + glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleIMG); - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); + // copy argument internalformat + GLMessage_DataType *arg_internalformat = glmsg.add_args(); + arg_internalformat->set_isarray(false); + arg_internalformat->set_type(GLMessage::DataType::ENUM); + arg_internalformat->add_intvalue((int)internalformat); + + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); + + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSamplerParameterf(sampler, pname, param); + glContext->hooks->gl.glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -9590,39 +9925,56 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat * param) { +void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSamplerParameterfv); + glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleIMG); - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument attachment + GLMessage_DataType *arg_attachment = glmsg.add_args(); + arg_attachment->set_isarray(false); + arg_attachment->set_type(GLMessage::DataType::ENUM); + arg_attachment->add_intvalue((int)attachment); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + // copy argument textarget + GLMessage_DataType *arg_textarget = glmsg.add_args(); + arg_textarget->set_isarray(false); + arg_textarget->set_type(GLMessage::DataType::ENUM); + arg_textarget->add_intvalue((int)textarget); + + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument samples + GLMessage_DataType *arg_samples = glmsg.add_args(); + arg_samples->set_isarray(false); + arg_samples->set_type(GLMessage::DataType::INT); + arg_samples->add_intvalue(samples); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSamplerParameterfv(sampler, pname, param); + glContext->hooks->gl.glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9631,39 +9983,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint * params) { +void GLTrace_glCoverageMaskNV(GLboolean mask) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetSamplerParameteriv); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glCoverageMaskNV); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument mask + GLMessage_DataType *arg_mask = glmsg.add_args(); + arg_mask->set_isarray(false); + arg_mask->set_type(GLMessage::DataType::BOOL); + arg_mask->add_boolvalue(mask); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetSamplerParameteriv(sampler, pname, params); + glContext->hooks->gl.glCoverageMaskNV(mask); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9672,39 +10011,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat * params) { +void GLTrace_glCoverageOperationNV(GLenum operation) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetSamplerParameterfv); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glCoverageOperationNV); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument operation + GLMessage_DataType *arg_operation = glmsg.add_args(); + arg_operation->set_isarray(false); + arg_operation->set_type(GLMessage::DataType::ENUM); + arg_operation->add_intvalue((int)operation); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetSamplerParameterfv(sampler, pname, params); + glContext->hooks->gl.glCoverageOperationNV(operation); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9713,32 +10039,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexAttribDivisor(GLuint index, GLuint divisor) { +void GLTrace_glDrawBuffersNV(GLsizei n, const GLenum *bufs) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexAttribDivisor); + glmsg.set_function(GLMessage::glDrawBuffersNV); - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument divisor - GLMessage_DataType *arg_divisor = glmsg.add_args(); - arg_divisor->set_isarray(false); - arg_divisor->set_type(GLMessage::DataType::INT); - arg_divisor->add_intvalue(divisor); + // copy argument bufs + GLMessage_DataType *arg_bufs = glmsg.add_args(); + arg_bufs->set_isarray(false); + arg_bufs->set_type(GLMessage::DataType::INT); + arg_bufs->add_intvalue((int)bufs); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribDivisor(index, divisor); + glContext->hooks->gl.glDrawBuffersNV(n, bufs); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) bufs, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9747,32 +10074,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBindTransformFeedback(GLenum target, GLuint id) { +void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint *fences) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBindTransformFeedback); + glmsg.set_function(GLMessage::glDeleteFencesNV); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument n + GLMessage_DataType *arg_n = glmsg.add_args(); + arg_n->set_isarray(false); + arg_n->set_type(GLMessage::DataType::INT); + arg_n->add_intvalue(n); - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); + // copy argument fences + GLMessage_DataType *arg_fences = glmsg.add_args(); + arg_fences->set_isarray(false); + arg_fences->set_type(GLMessage::DataType::INT); + arg_fences->add_intvalue((int)fences); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindTransformFeedback(target, id); + glContext->hooks->gl.glDeleteFencesNV(n, fences); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) fences, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9781,11 +10109,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteTransformFeedbacks(GLsizei n, const GLuint * ids) { +void GLTrace_glGenFencesNV(GLsizei n, GLuint *fences) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDeleteTransformFeedbacks); + glmsg.set_function(GLMessage::glGenFencesNV); // copy argument n GLMessage_DataType *arg_n = glmsg.add_args(); @@ -9793,21 +10121,21 @@ arg_n->set_type(GLMessage::DataType::INT); arg_n->add_intvalue(n); - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); + // copy argument fences + GLMessage_DataType *arg_fences = glmsg.add_args(); + arg_fences->set_isarray(false); + arg_fences->set_type(GLMessage::DataType::INT); + arg_fences->add_intvalue((int)fences); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteTransformFeedbacks(n, ids); + glContext->hooks->gl.glGenFencesNV(n, fences); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) ids, + (void *) fences, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9816,57 +10144,58 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenTransformFeedbacks(GLsizei n, GLuint * ids) { +GLboolean GLTrace_glIsFenceNV(GLuint fence) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGenTransformFeedbacks); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + glmsg.set_function(GLMessage::glIsFenceNV); - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenTransformFeedbacks(n, ids); + GLboolean retValue = glContext->hooks->gl.glIsFenceNV(fence); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // set return value + GLMessage_DataType *rt = glmsg.mutable_returnvalue(); + rt->set_isarray(false); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); + void *pointerArgs[] = { - (void *) ids, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); + + return retValue; } -GLboolean GLTrace_glIsTransformFeedback(GLuint id) { +GLboolean GLTrace_glTestFenceNV(GLuint fence) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glIsTransformFeedback); + glmsg.set_function(GLMessage::glTestFenceNV); - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsTransformFeedback(id); + GLboolean retValue = glContext->hooks->gl.glTestFenceNV(fence); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -9887,20 +10216,39 @@ return retValue; } -void GLTrace_glPauseTransformFeedback(void) { +void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPauseTransformFeedback); + glmsg.set_function(GLMessage::glGetFenceivNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPauseTransformFeedback(); + glContext->hooks->gl.glGetFenceivNV(fence, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9909,16 +10257,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glResumeTransformFeedback(void) { +void GLTrace_glFinishFenceNV(GLuint fence) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glResumeTransformFeedback); + glmsg.set_function(GLMessage::glFinishFenceNV); + + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glResumeTransformFeedback(); + glContext->hooks->gl.glFinishFenceNV(fence); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -9931,53 +10285,32 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) { +void GLTrace_glSetFenceNV(GLuint fence, GLenum condition) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetProgramBinary); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + glmsg.set_function(GLMessage::glSetFenceNV); - // copy argument binaryFormat - GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); - arg_binaryFormat->set_isarray(false); - arg_binaryFormat->set_type(GLMessage::DataType::INT64); - arg_binaryFormat->add_int64value((uintptr_t)binaryFormat); + // copy argument fence + GLMessage_DataType *arg_fence = glmsg.add_args(); + arg_fence->set_isarray(false); + arg_fence->set_type(GLMessage::DataType::INT); + arg_fence->add_intvalue(fence); - // copy argument binary - GLMessage_DataType *arg_binary = glmsg.add_args(); - arg_binary->set_isarray(false); - arg_binary->set_type(GLMessage::DataType::INT64); - arg_binary->add_int64value((uintptr_t)binary); + // copy argument condition + GLMessage_DataType *arg_condition = glmsg.add_args(); + arg_condition->set_isarray(false); + arg_condition->set_type(GLMessage::DataType::ENUM); + arg_condition->add_intvalue((int)condition); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramBinary(program, bufSize, length, binaryFormat, binary); + glContext->hooks->gl.glSetFenceNV(fence, condition); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) length, - (void *) binaryFormat, - (void *) binary, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -9986,45 +10319,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glProgramBinary(GLuint program, GLenum binaryFormat, const void * binary, GLsizei length) { +void GLTrace_glReadBufferNV(GLenum mode) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glProgramBinary); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument binaryFormat - GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); - arg_binaryFormat->set_isarray(false); - arg_binaryFormat->set_type(GLMessage::DataType::ENUM); - arg_binaryFormat->add_intvalue((int)binaryFormat); - - // copy argument binary - GLMessage_DataType *arg_binary = glmsg.add_args(); - arg_binary->set_isarray(false); - arg_binary->set_type(GLMessage::DataType::INT64); - arg_binary->add_int64value((uintptr_t)binary); + glmsg.set_function(GLMessage::glReadBufferNV); - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramBinary(program, binaryFormat, binary, length); + glContext->hooks->gl.glReadBufferNV(mode); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) binary, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10033,34 +10347,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glProgramParameteri(GLuint program, GLenum pname, GLint value) { +void GLTrace_glAlphaFuncQCOM(GLenum func, GLclampf ref) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glProgramParameteri); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); + glmsg.set_function(GLMessage::glAlphaFuncQCOM); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::FLOAT); + arg_ref->add_floatvalue(ref); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramParameteri(program, pname, value); + glContext->hooks->gl.glAlphaFuncQCOM(func, ref); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -10073,39 +10381,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum * attachments) { +void GLTrace_glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glInvalidateFramebuffer); + glmsg.set_function(GLMessage::glGetDriverControlsQCOM); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument num + GLMessage_DataType *arg_num = glmsg.add_args(); + arg_num->set_isarray(false); + arg_num->set_type(GLMessage::DataType::INT); + arg_num->add_intvalue((int)num); - // copy argument numAttachments - GLMessage_DataType *arg_numAttachments = glmsg.add_args(); - arg_numAttachments->set_isarray(false); - arg_numAttachments->set_type(GLMessage::DataType::INT); - arg_numAttachments->add_intvalue(numAttachments); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); - // copy argument attachments - GLMessage_DataType *arg_attachments = glmsg.add_args(); - arg_attachments->set_isarray(false); - arg_attachments->set_type(GLMessage::DataType::INT64); - arg_attachments->add_int64value((uintptr_t)attachments); + // copy argument driverControls + GLMessage_DataType *arg_driverControls = glmsg.add_args(); + arg_driverControls->set_isarray(false); + arg_driverControls->set_type(GLMessage::DataType::INT); + arg_driverControls->add_intvalue((int)driverControls); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glInvalidateFramebuffer(target, numAttachments, attachments); + glContext->hooks->gl.glGetDriverControlsQCOM(num, size, driverControls); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) attachments, + (void *) num, + (void *) driverControls, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10114,63 +10423,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height) { +void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glInvalidateSubFramebuffer); + glmsg.set_function(GLMessage::glGetDriverControlStringQCOM); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument driverControl + GLMessage_DataType *arg_driverControl = glmsg.add_args(); + arg_driverControl->set_isarray(false); + arg_driverControl->set_type(GLMessage::DataType::INT); + arg_driverControl->add_intvalue(driverControl); - // copy argument numAttachments - GLMessage_DataType *arg_numAttachments = glmsg.add_args(); - arg_numAttachments->set_isarray(false); - arg_numAttachments->set_type(GLMessage::DataType::INT); - arg_numAttachments->add_intvalue(numAttachments); - - // copy argument attachments - GLMessage_DataType *arg_attachments = glmsg.add_args(); - arg_attachments->set_isarray(false); - arg_attachments->set_type(GLMessage::DataType::INT64); - arg_attachments->add_int64value((uintptr_t)attachments); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + // copy argument bufSize + GLMessage_DataType *arg_bufSize = glmsg.add_args(); + arg_bufSize->set_isarray(false); + arg_bufSize->set_type(GLMessage::DataType::INT); + arg_bufSize->add_intvalue(bufSize); - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); + // copy argument driverControlString + GLMessage_DataType *arg_driverControlString = glmsg.add_args(); + arg_driverControlString->set_isarray(false); + arg_driverControlString->set_type(GLMessage::DataType::INT); + arg_driverControlString->add_intvalue((int)driverControlString); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glInvalidateSubFramebuffer(target, numAttachments, attachments, x, y, width, height); + glContext->hooks->gl.glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) attachments, + (void *) length, + (void *) driverControlString, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10179,46 +10471,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { +void GLTrace_glEnableDriverControlQCOM(GLuint driverControl) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexStorage2D); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); + glmsg.set_function(GLMessage::glEnableDriverControlQCOM); - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); + // copy argument driverControl + GLMessage_DataType *arg_driverControl = glmsg.add_args(); + arg_driverControl->set_isarray(false); + arg_driverControl->set_type(GLMessage::DataType::INT); + arg_driverControl->add_intvalue(driverControl); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage2D(target, levels, internalformat, width, height); + glContext->hooks->gl.glEnableDriverControlQCOM(driverControl); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -10231,52 +10499,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { +void GLTrace_glDisableDriverControlQCOM(GLuint driverControl) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexStorage3D); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); + glmsg.set_function(GLMessage::glDisableDriverControlQCOM); - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); + // copy argument driverControl + GLMessage_DataType *arg_driverControl = glmsg.add_args(); + arg_driverControl->set_isarray(false); + arg_driverControl->set_type(GLMessage::DataType::INT); + arg_driverControl->add_intvalue(driverControl); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage3D(target, levels, internalformat, width, height, depth); + glContext->hooks->gl.glDisableDriverControlQCOM(driverControl); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -10289,51 +10527,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint * params) { +void GLTrace_glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetInternalformativ); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); + glmsg.set_function(GLMessage::glExtGetTexturesQCOM); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument textures + GLMessage_DataType *arg_textures = glmsg.add_args(); + arg_textures->set_isarray(false); + arg_textures->set_type(GLMessage::DataType::INT); + arg_textures->add_intvalue((int)textures); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument maxTextures + GLMessage_DataType *arg_maxTextures = glmsg.add_args(); + arg_maxTextures->set_isarray(false); + arg_maxTextures->set_type(GLMessage::DataType::INT); + arg_maxTextures->add_intvalue(maxTextures); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument numTextures + GLMessage_DataType *arg_numTextures = glmsg.add_args(); + arg_numTextures->set_isarray(false); + arg_numTextures->set_type(GLMessage::DataType::INT); + arg_numTextures->add_intvalue((int)numTextures); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetInternalformativ(target, internalformat, pname, bufSize, params); + glContext->hooks->gl.glExtGetTexturesQCOM(textures, maxTextures, numTextures); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, + (void *) textures, + (void *) numTextures, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10342,38 +10569,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z) { +void GLTrace_glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDispatchCompute); + glmsg.set_function(GLMessage::glExtGetBuffersQCOM); - // copy argument num_groups_x - GLMessage_DataType *arg_num_groups_x = glmsg.add_args(); - arg_num_groups_x->set_isarray(false); - arg_num_groups_x->set_type(GLMessage::DataType::INT); - arg_num_groups_x->add_intvalue(num_groups_x); + // copy argument buffers + GLMessage_DataType *arg_buffers = glmsg.add_args(); + arg_buffers->set_isarray(false); + arg_buffers->set_type(GLMessage::DataType::INT); + arg_buffers->add_intvalue((int)buffers); - // copy argument num_groups_y - GLMessage_DataType *arg_num_groups_y = glmsg.add_args(); - arg_num_groups_y->set_isarray(false); - arg_num_groups_y->set_type(GLMessage::DataType::INT); - arg_num_groups_y->add_intvalue(num_groups_y); + // copy argument maxBuffers + GLMessage_DataType *arg_maxBuffers = glmsg.add_args(); + arg_maxBuffers->set_isarray(false); + arg_maxBuffers->set_type(GLMessage::DataType::INT); + arg_maxBuffers->add_intvalue(maxBuffers); - // copy argument num_groups_z - GLMessage_DataType *arg_num_groups_z = glmsg.add_args(); - arg_num_groups_z->set_isarray(false); - arg_num_groups_z->set_type(GLMessage::DataType::INT); - arg_num_groups_z->add_intvalue(num_groups_z); + // copy argument numBuffers + GLMessage_DataType *arg_numBuffers = glmsg.add_args(); + arg_numBuffers->set_isarray(false); + arg_numBuffers->set_type(GLMessage::DataType::INT); + arg_numBuffers->add_intvalue((int)numBuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDispatchCompute(num_groups_x, num_groups_y, num_groups_z); + glContext->hooks->gl.glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) buffers, + (void *) numBuffers, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10382,26 +10611,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDispatchComputeIndirect(GLintptr indirect) { +void GLTrace_glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDispatchComputeIndirect); + glmsg.set_function(GLMessage::glExtGetRenderbuffersQCOM); + + // copy argument renderbuffers + GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); + arg_renderbuffers->set_isarray(false); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); + + // copy argument maxRenderbuffers + GLMessage_DataType *arg_maxRenderbuffers = glmsg.add_args(); + arg_maxRenderbuffers->set_isarray(false); + arg_maxRenderbuffers->set_type(GLMessage::DataType::INT); + arg_maxRenderbuffers->add_intvalue(maxRenderbuffers); - // copy argument indirect - GLMessage_DataType *arg_indirect = glmsg.add_args(); - arg_indirect->set_isarray(false); - arg_indirect->set_type(GLMessage::DataType::INT); - arg_indirect->add_intvalue(indirect); + // copy argument numRenderbuffers + GLMessage_DataType *arg_numRenderbuffers = glmsg.add_args(); + arg_numRenderbuffers->set_isarray(false); + arg_numRenderbuffers->set_type(GLMessage::DataType::INT); + arg_numRenderbuffers->add_intvalue((int)numRenderbuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDispatchComputeIndirect(indirect); + glContext->hooks->gl.glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) renderbuffers, + (void *) numRenderbuffers, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10410,33 +10653,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawArraysIndirect(GLenum mode, const void * indirect) { +void GLTrace_glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDrawArraysIndirect); + glmsg.set_function(GLMessage::glExtGetFramebuffersQCOM); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument framebuffers + GLMessage_DataType *arg_framebuffers = glmsg.add_args(); + arg_framebuffers->set_isarray(false); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); + + // copy argument maxFramebuffers + GLMessage_DataType *arg_maxFramebuffers = glmsg.add_args(); + arg_maxFramebuffers->set_isarray(false); + arg_maxFramebuffers->set_type(GLMessage::DataType::INT); + arg_maxFramebuffers->add_intvalue(maxFramebuffers); - // copy argument indirect - GLMessage_DataType *arg_indirect = glmsg.add_args(); - arg_indirect->set_isarray(false); - arg_indirect->set_type(GLMessage::DataType::INT64); - arg_indirect->add_int64value((uintptr_t)indirect); + // copy argument numFramebuffers + GLMessage_DataType *arg_numFramebuffers = glmsg.add_args(); + arg_numFramebuffers->set_isarray(false); + arg_numFramebuffers->set_type(GLMessage::DataType::INT); + arg_numFramebuffers->add_intvalue((int)numFramebuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawArraysIndirect(mode, indirect); + glContext->hooks->gl.glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) indirect, + (void *) framebuffers, + (void *) numFramebuffers, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10445,39 +10695,51 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawElementsIndirect(GLenum mode, GLenum type, const void * indirect) { +void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDrawElementsIndirect); + glmsg.set_function(GLMessage::glExtGetTexLevelParameterivQCOM); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::INT); + arg_texture->add_intvalue(texture); - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument indirect - GLMessage_DataType *arg_indirect = glmsg.add_args(); - arg_indirect->set_isarray(false); - arg_indirect->set_type(GLMessage::DataType::INT64); - arg_indirect->add_int64value((uintptr_t)indirect); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawElementsIndirect(mode, type, indirect); + glContext->hooks->gl.glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) indirect, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10486,11 +10748,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFramebufferParameteri(GLenum target, GLenum pname, GLint param) { +void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFramebufferParameteri); + glmsg.set_function(GLMessage::glExtTexObjectStateOverrideiQCOM); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -10513,7 +10775,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFramebufferParameteri(target, pname, param); + glContext->hooks->gl.glExtTexObjectStateOverrideiQCOM(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -10526,11 +10788,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint * params) { +void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetFramebufferParameteriv); + glmsg.set_function(GLMessage::glExtGetTexSubImageQCOM); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -10538,74 +10800,75 @@ arg_target->set_type(GLMessage::DataType::ENUM); arg_target->add_intvalue((int)target); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument level + GLMessage_DataType *arg_level = glmsg.add_args(); + arg_level->set_isarray(false); + arg_level->set_type(GLMessage::DataType::INT); + arg_level->add_intvalue(level); - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetFramebufferParameteriv(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + // copy argument xoffset + GLMessage_DataType *arg_xoffset = glmsg.add_args(); + arg_xoffset->set_isarray(false); + arg_xoffset->set_type(GLMessage::DataType::INT); + arg_xoffset->add_intvalue(xoffset); - void *pointerArgs[] = { - (void *) params, - }; + // copy argument yoffset + GLMessage_DataType *arg_yoffset = glmsg.add_args(); + arg_yoffset->set_isarray(false); + arg_yoffset->set_type(GLMessage::DataType::INT); + arg_yoffset->add_intvalue(yoffset); - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} + // copy argument zoffset + GLMessage_DataType *arg_zoffset = glmsg.add_args(); + arg_zoffset->set_isarray(false); + arg_zoffset->set_type(GLMessage::DataType::INT); + arg_zoffset->add_intvalue(zoffset); -void GLTrace_glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); - glmsg.set_function(GLMessage::glGetProgramInterfaceiv); + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); - // copy argument programInterface - GLMessage_DataType *arg_programInterface = glmsg.add_args(); - arg_programInterface->set_isarray(false); - arg_programInterface->set_type(GLMessage::DataType::ENUM); - arg_programInterface->add_intvalue((int)programInterface); + // copy argument format + GLMessage_DataType *arg_format = glmsg.add_args(); + arg_format->set_isarray(false); + arg_format->set_type(GLMessage::DataType::ENUM); + arg_format->add_intvalue((int)format); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument texels + GLMessage_DataType *arg_texels = glmsg.add_args(); + arg_texels->set_isarray(false); + arg_texels->set_type(GLMessage::DataType::INT); + arg_texels->add_intvalue((int)texels); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramInterfaceiv(program, programInterface, pname, params); + glContext->hooks->gl.glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, + (void *) texels, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10614,107 +10877,75 @@ glContext->traceGLMessage(&glmsg); } -GLuint GLTrace_glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar * name) { +void GLTrace_glExtGetBufferPointervQCOM(GLenum target, GLvoid **params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetProgramResourceIndex); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); + glmsg.set_function(GLMessage::glExtGetBufferPointervQCOM); - // copy argument programInterface - GLMessage_DataType *arg_programInterface = glmsg.add_args(); - arg_programInterface->set_isarray(false); - arg_programInterface->set_type(GLMessage::DataType::ENUM); - arg_programInterface->add_intvalue((int)programInterface); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLuint retValue = glContext->hooks->gl.glGetProgramResourceIndex(program, programInterface, name); + glContext->hooks->gl.glExtGetBufferPointervQCOM(target, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); - void *pointerArgs[] = { - (void *) name, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); glContext->traceGLMessage(&glmsg); - - return retValue; } -void GLTrace_glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name) { +void GLTrace_glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetProgramResourceName); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument programInterface - GLMessage_DataType *arg_programInterface = glmsg.add_args(); - arg_programInterface->set_isarray(false); - arg_programInterface->set_type(GLMessage::DataType::ENUM); - arg_programInterface->add_intvalue((int)programInterface); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); + glmsg.set_function(GLMessage::glExtGetShadersQCOM); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument shaders + GLMessage_DataType *arg_shaders = glmsg.add_args(); + arg_shaders->set_isarray(false); + arg_shaders->set_type(GLMessage::DataType::INT); + arg_shaders->add_intvalue((int)shaders); - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + // copy argument maxShaders + GLMessage_DataType *arg_maxShaders = glmsg.add_args(); + arg_maxShaders->set_isarray(false); + arg_maxShaders->set_type(GLMessage::DataType::INT); + arg_maxShaders->add_intvalue(maxShaders); - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); + // copy argument numShaders + GLMessage_DataType *arg_numShaders = glmsg.add_args(); + arg_numShaders->set_isarray(false); + arg_numShaders->set_type(GLMessage::DataType::INT); + arg_numShaders->add_intvalue((int)numShaders); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramResourceName(program, programInterface, index, bufSize, length, name); + glContext->hooks->gl.glExtGetShadersQCOM(shaders, maxShaders, numShaders); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) length, - (void *) name, + (void *) shaders, + (void *) numShaders, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10723,71 +10954,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params) { +void GLTrace_glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetProgramResourceiv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument programInterface - GLMessage_DataType *arg_programInterface = glmsg.add_args(); - arg_programInterface->set_isarray(false); - arg_programInterface->set_type(GLMessage::DataType::ENUM); - arg_programInterface->add_intvalue((int)programInterface); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument propCount - GLMessage_DataType *arg_propCount = glmsg.add_args(); - arg_propCount->set_isarray(false); - arg_propCount->set_type(GLMessage::DataType::INT); - arg_propCount->add_intvalue(propCount); - - // copy argument props - GLMessage_DataType *arg_props = glmsg.add_args(); - arg_props->set_isarray(false); - arg_props->set_type(GLMessage::DataType::INT64); - arg_props->add_int64value((uintptr_t)props); + glmsg.set_function(GLMessage::glExtGetProgramsQCOM); - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); + // copy argument programs + GLMessage_DataType *arg_programs = glmsg.add_args(); + arg_programs->set_isarray(false); + arg_programs->set_type(GLMessage::DataType::INT); + arg_programs->add_intvalue((int)programs); - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); + // copy argument maxPrograms + GLMessage_DataType *arg_maxPrograms = glmsg.add_args(); + arg_maxPrograms->set_isarray(false); + arg_maxPrograms->set_type(GLMessage::DataType::INT); + arg_maxPrograms->add_intvalue(maxPrograms); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument numPrograms + GLMessage_DataType *arg_numPrograms = glmsg.add_args(); + arg_numPrograms->set_isarray(false); + arg_numPrograms->set_type(GLMessage::DataType::INT); + arg_numPrograms->add_intvalue((int)numPrograms); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramResourceiv(program, programInterface, index, propCount, props, bufSize, length, params); + glContext->hooks->gl.glExtGetProgramsQCOM(programs, maxPrograms, numPrograms); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) props, - (void *) length, - (void *) params, + (void *) programs, + (void *) numPrograms, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10796,11 +10996,11 @@ glContext->traceGLMessage(&glmsg); } -GLint GLTrace_glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar * name) { +GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetProgramResourceLocation); + glmsg.set_function(GLMessage::glExtIsProgramBinaryQCOM); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -10808,33 +11008,20 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // copy argument programInterface - GLMessage_DataType *arg_programInterface = glmsg.add_args(); - arg_programInterface->set_isarray(false); - arg_programInterface->set_type(GLMessage::DataType::ENUM); - arg_programInterface->add_intvalue((int)programInterface); - - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT64); - arg_name->add_int64value((uintptr_t)name); - // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLint retValue = glContext->hooks->gl.glGetProgramResourceLocation(program, programInterface, name); + GLboolean retValue = glContext->hooks->gl.glExtIsProgramBinaryQCOM(program); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); // set return value GLMessage_DataType *rt = glmsg.mutable_returnvalue(); rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); + rt->set_type(GLMessage::DataType::BOOL); + rt->add_boolvalue(retValue); void *pointerArgs[] = { - (void *) name, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -10845,23 +11032,11 @@ return retValue; } -void GLTrace_glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program) { +void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glUseProgramStages); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument stages - GLMessage_DataType *arg_stages = glmsg.add_args(); - arg_stages->set_isarray(false); - arg_stages->set_type(GLMessage::DataType::INT); - arg_stages->add_intvalue(stages); + glmsg.set_function(GLMessage::glExtGetProgramBinarySourceQCOM); // copy argument program GLMessage_DataType *arg_program = glmsg.add_args(); @@ -10869,13375 +11044,34 @@ arg_program->set_type(GLMessage::DataType::INT); arg_program->add_intvalue(program); - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUseProgramStages(pipeline, stages, program); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glActiveShaderProgram(GLuint pipeline, GLuint program) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glActiveShaderProgram); + // copy argument shadertype + GLMessage_DataType *arg_shadertype = glmsg.add_args(); + arg_shadertype->set_isarray(false); + arg_shadertype->set_type(GLMessage::DataType::ENUM); + arg_shadertype->add_intvalue((int)shadertype); - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glActiveShaderProgram(pipeline, program); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLuint GLTrace_glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const* strings) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCreateShaderProgramv); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument strings - GLMessage_DataType *arg_strings = glmsg.add_args(); - arg_strings->set_isarray(false); - arg_strings->set_type(GLMessage::DataType::INT64); - arg_strings->add_int64value((uintptr_t)strings); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLuint retValue = glContext->hooks->gl.glCreateShaderProgramv(type, count, strings); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); - - void *pointerArgs[] = { - (void *) strings, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glBindProgramPipeline(GLuint pipeline) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBindProgramPipeline); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindProgramPipeline(pipeline); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeleteProgramPipelines(GLsizei n, const GLuint * pipelines) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteProgramPipelines); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument pipelines - GLMessage_DataType *arg_pipelines = glmsg.add_args(); - arg_pipelines->set_isarray(false); - arg_pipelines->set_type(GLMessage::DataType::INT64); - arg_pipelines->add_int64value((uintptr_t)pipelines); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteProgramPipelines(n, pipelines); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) pipelines, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGenProgramPipelines(GLsizei n, GLuint * pipelines) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGenProgramPipelines); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument pipelines - GLMessage_DataType *arg_pipelines = glmsg.add_args(); - arg_pipelines->set_isarray(false); - arg_pipelines->set_type(GLMessage::DataType::INT64); - arg_pipelines->add_int64value((uintptr_t)pipelines); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenProgramPipelines(n, pipelines); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) pipelines, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glIsProgramPipeline(GLuint pipeline) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsProgramPipeline); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsProgramPipeline(pipeline); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetProgramPipelineiv); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramPipelineiv(pipeline, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1i(GLuint program, GLint location, GLint v0) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1i); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1i(program, location, v0); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2i); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2i(program, location, v0, v1); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3i); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3i(program, location, v0, v1, v2); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4i); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::INT); - arg_v3->add_intvalue(v3); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4i(program, location, v0, v1, v2, v3); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1ui(GLuint program, GLint location, GLuint v0) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1ui); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1ui(program, location, v0); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2ui); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2ui(program, location, v0, v1); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3ui); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3ui(program, location, v0, v1, v2); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4ui); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::INT); - arg_v3->add_intvalue(v3); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4ui(program, location, v0, v1, v2, v3); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1f(GLuint program, GLint location, GLfloat v0) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1f); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1f(program, location, v0); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2f); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2f(program, location, v0, v1); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3f); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::FLOAT); - arg_v2->add_floatvalue(v2); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3f(program, location, v0, v1, v2); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4f); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::FLOAT); - arg_v2->add_floatvalue(v2); - - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::FLOAT); - arg_v3->add_floatvalue(v3); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4f(program, location, v0, v1, v2, v3); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1iv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1iv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2iv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2iv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3iv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3iv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4iv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4iv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1uiv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1uiv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2uiv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2uiv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3uiv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3uiv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4uiv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4uiv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1fv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2fv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3fv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4fv(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix2fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix2fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix3fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix3fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix4fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix4fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix2x3fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix2x3fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix3x2fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix3x2fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix2x4fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix2x4fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix4x2fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix4x2fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix3x4fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix3x4fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix4x3fv); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix4x3fv(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glValidateProgramPipeline(GLuint pipeline) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glValidateProgramPipeline); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glValidateProgramPipeline(pipeline); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetProgramPipelineInfoLog); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument infoLog - GLMessage_DataType *arg_infoLog = glmsg.add_args(); - arg_infoLog->set_isarray(false); - arg_infoLog->set_type(GLMessage::DataType::INT64); - arg_infoLog->add_int64value((uintptr_t)infoLog); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramPipelineInfoLog(pipeline, bufSize, length, infoLog); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) infoLog, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBindImageTexture); - - // copy argument unit - GLMessage_DataType *arg_unit = glmsg.add_args(); - arg_unit->set_isarray(false); - arg_unit->set_type(GLMessage::DataType::INT); - arg_unit->add_intvalue(unit); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument layered - GLMessage_DataType *arg_layered = glmsg.add_args(); - arg_layered->set_isarray(false); - arg_layered->set_type(GLMessage::DataType::BOOL); - arg_layered->add_boolvalue(layered); - - // copy argument layer - GLMessage_DataType *arg_layer = glmsg.add_args(); - arg_layer->set_isarray(false); - arg_layer->set_type(GLMessage::DataType::INT); - arg_layer->add_intvalue(layer); - - // copy argument access - GLMessage_DataType *arg_access = glmsg.add_args(); - arg_access->set_isarray(false); - arg_access->set_type(GLMessage::DataType::ENUM); - arg_access->add_intvalue((int)access); - - // copy argument format - GLMessage_DataType *arg_format = glmsg.add_args(); - arg_format->set_isarray(false); - arg_format->set_type(GLMessage::DataType::ENUM); - arg_format->add_intvalue((int)format); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindImageTexture(unit, texture, level, layered, layer, access, format); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetBooleani_v(GLenum target, GLuint index, GLboolean * data) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetBooleani_v); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetBooleani_v(target, index, data); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMemoryBarrier(GLbitfield barriers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMemoryBarrier); - - // copy argument barriers - GLMessage_DataType *arg_barriers = glmsg.add_args(); - arg_barriers->set_isarray(false); - arg_barriers->set_type(GLMessage::DataType::INT); - arg_barriers->add_intvalue(barriers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMemoryBarrier(barriers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMemoryBarrierByRegion(GLbitfield barriers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMemoryBarrierByRegion); - - // copy argument barriers - GLMessage_DataType *arg_barriers = glmsg.add_args(); - arg_barriers->set_isarray(false); - arg_barriers->set_type(GLMessage::DataType::INT); - arg_barriers->add_intvalue(barriers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMemoryBarrierByRegion(barriers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexStorage2DMultisample); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument fixedsamplelocations - GLMessage_DataType *arg_fixedsamplelocations = glmsg.add_args(); - arg_fixedsamplelocations->set_isarray(false); - arg_fixedsamplelocations->set_type(GLMessage::DataType::BOOL); - arg_fixedsamplelocations->add_boolvalue(fixedsamplelocations); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage2DMultisample(target, samples, internalformat, width, height, fixedsamplelocations); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetMultisamplefv(GLenum pname, GLuint index, GLfloat * val) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetMultisamplefv); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument val - GLMessage_DataType *arg_val = glmsg.add_args(); - arg_val->set_isarray(false); - arg_val->set_type(GLMessage::DataType::INT64); - arg_val->add_int64value((uintptr_t)val); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetMultisamplefv(pname, index, val); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) val, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glSampleMaski(GLuint maskNumber, GLbitfield mask) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glSampleMaski); - - // copy argument maskNumber - GLMessage_DataType *arg_maskNumber = glmsg.add_args(); - arg_maskNumber->set_isarray(false); - arg_maskNumber->set_type(GLMessage::DataType::INT); - arg_maskNumber->add_intvalue(maskNumber); - - // copy argument mask - GLMessage_DataType *arg_mask = glmsg.add_args(); - arg_mask->set_isarray(false); - arg_mask->set_type(GLMessage::DataType::INT); - arg_mask->add_intvalue(mask); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSampleMaski(maskNumber, mask); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTexLevelParameteriv); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexLevelParameteriv(target, level, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTexLevelParameterfv); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexLevelParameterfv(target, level, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBindVertexBuffer); - - // copy argument bindingindex - GLMessage_DataType *arg_bindingindex = glmsg.add_args(); - arg_bindingindex->set_isarray(false); - arg_bindingindex->set_type(GLMessage::DataType::INT); - arg_bindingindex->add_intvalue(bindingindex); - - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::INT); - arg_buffer->add_intvalue(buffer); - - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); - - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindVertexBuffer(bindingindex, buffer, offset, stride); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexAttribFormat); - - // copy argument attribindex - GLMessage_DataType *arg_attribindex = glmsg.add_args(); - arg_attribindex->set_isarray(false); - arg_attribindex->set_type(GLMessage::DataType::INT); - arg_attribindex->add_intvalue(attribindex); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument normalized - GLMessage_DataType *arg_normalized = glmsg.add_args(); - arg_normalized->set_isarray(false); - arg_normalized->set_type(GLMessage::DataType::BOOL); - arg_normalized->add_boolvalue(normalized); - - // copy argument relativeoffset - GLMessage_DataType *arg_relativeoffset = glmsg.add_args(); - arg_relativeoffset->set_isarray(false); - arg_relativeoffset->set_type(GLMessage::DataType::INT); - arg_relativeoffset->add_intvalue(relativeoffset); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribFormat(attribindex, size, type, normalized, relativeoffset); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexAttribIFormat); - - // copy argument attribindex - GLMessage_DataType *arg_attribindex = glmsg.add_args(); - arg_attribindex->set_isarray(false); - arg_attribindex->set_type(GLMessage::DataType::INT); - arg_attribindex->add_intvalue(attribindex); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument relativeoffset - GLMessage_DataType *arg_relativeoffset = glmsg.add_args(); - arg_relativeoffset->set_isarray(false); - arg_relativeoffset->set_type(GLMessage::DataType::INT); - arg_relativeoffset->add_intvalue(relativeoffset); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribIFormat(attribindex, size, type, relativeoffset); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexAttribBinding(GLuint attribindex, GLuint bindingindex) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexAttribBinding); - - // copy argument attribindex - GLMessage_DataType *arg_attribindex = glmsg.add_args(); - arg_attribindex->set_isarray(false); - arg_attribindex->set_type(GLMessage::DataType::INT); - arg_attribindex->add_intvalue(attribindex); - - // copy argument bindingindex - GLMessage_DataType *arg_bindingindex = glmsg.add_args(); - arg_bindingindex->set_isarray(false); - arg_bindingindex->set_type(GLMessage::DataType::INT); - arg_bindingindex->add_intvalue(bindingindex); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribBinding(attribindex, bindingindex); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexBindingDivisor(GLuint bindingindex, GLuint divisor) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexBindingDivisor); - - // copy argument bindingindex - GLMessage_DataType *arg_bindingindex = glmsg.add_args(); - arg_bindingindex->set_isarray(false); - arg_bindingindex->set_type(GLMessage::DataType::INT); - arg_bindingindex->add_intvalue(bindingindex); - - // copy argument divisor - GLMessage_DataType *arg_divisor = glmsg.add_args(); - arg_divisor->set_isarray(false); - arg_divisor->set_type(GLMessage::DataType::INT); - arg_divisor->add_intvalue(divisor); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexBindingDivisor(bindingindex, divisor); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - - -// Definitions for GL2Ext APIs - -void GLTrace_glBlendBarrierKHR(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendBarrierKHR); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendBarrierKHR(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDebugMessageControlKHR(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDebugMessageControlKHR); - - // copy argument source - GLMessage_DataType *arg_source = glmsg.add_args(); - arg_source->set_isarray(false); - arg_source->set_type(GLMessage::DataType::ENUM); - arg_source->add_intvalue((int)source); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument severity - GLMessage_DataType *arg_severity = glmsg.add_args(); - arg_severity->set_isarray(false); - arg_severity->set_type(GLMessage::DataType::ENUM); - arg_severity->add_intvalue((int)severity); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); - - // copy argument enabled - GLMessage_DataType *arg_enabled = glmsg.add_args(); - arg_enabled->set_isarray(false); - arg_enabled->set_type(GLMessage::DataType::BOOL); - arg_enabled->add_boolvalue(enabled); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDebugMessageControlKHR(source, type, severity, count, ids, enabled); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) ids, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDebugMessageInsertKHR(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDebugMessageInsertKHR); - - // copy argument source - GLMessage_DataType *arg_source = glmsg.add_args(); - arg_source->set_isarray(false); - arg_source->set_type(GLMessage::DataType::ENUM); - arg_source->add_intvalue((int)source); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument severity - GLMessage_DataType *arg_severity = glmsg.add_args(); - arg_severity->set_isarray(false); - arg_severity->set_type(GLMessage::DataType::ENUM); - arg_severity->add_intvalue((int)severity); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument buf - GLMessage_DataType *arg_buf = glmsg.add_args(); - arg_buf->set_isarray(false); - arg_buf->set_type(GLMessage::DataType::INT64); - arg_buf->add_int64value((uintptr_t)buf); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDebugMessageInsertKHR(source, type, id, severity, length, buf); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) buf, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void * userParam) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDebugMessageCallbackKHR); - - // copy argument callback - GLMessage_DataType *arg_callback = glmsg.add_args(); - arg_callback->set_isarray(false); - arg_callback->set_type(GLMessage::DataType::INT64); - arg_callback->add_int64value((uintptr_t)callback); - - // copy argument userParam - GLMessage_DataType *arg_userParam = glmsg.add_args(); - arg_userParam->set_isarray(false); - arg_userParam->set_type(GLMessage::DataType::INT64); - arg_userParam->add_int64value((uintptr_t)userParam); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDebugMessageCallbackKHR(callback, userParam); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) callback, - (void *) userParam, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLuint GLTrace_glGetDebugMessageLogKHR(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetDebugMessageLogKHR); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument sources - GLMessage_DataType *arg_sources = glmsg.add_args(); - arg_sources->set_isarray(false); - arg_sources->set_type(GLMessage::DataType::INT64); - arg_sources->add_int64value((uintptr_t)sources); - - // copy argument types - GLMessage_DataType *arg_types = glmsg.add_args(); - arg_types->set_isarray(false); - arg_types->set_type(GLMessage::DataType::INT64); - arg_types->add_int64value((uintptr_t)types); - - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); - - // copy argument severities - GLMessage_DataType *arg_severities = glmsg.add_args(); - arg_severities->set_isarray(false); - arg_severities->set_type(GLMessage::DataType::INT64); - arg_severities->add_int64value((uintptr_t)severities); - - // copy argument lengths - GLMessage_DataType *arg_lengths = glmsg.add_args(); - arg_lengths->set_isarray(false); - arg_lengths->set_type(GLMessage::DataType::INT64); - arg_lengths->add_int64value((uintptr_t)lengths); - - // copy argument messageLog - GLMessage_DataType *arg_messageLog = glmsg.add_args(); - arg_messageLog->set_isarray(false); - arg_messageLog->set_type(GLMessage::DataType::INT64); - arg_messageLog->add_int64value((uintptr_t)messageLog); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLuint retValue = glContext->hooks->gl.glGetDebugMessageLogKHR(count, bufSize, sources, types, ids, severities, lengths, messageLog); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); - - void *pointerArgs[] = { - (void *) sources, - (void *) types, - (void *) ids, - (void *) severities, - (void *) lengths, - (void *) messageLog, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glPushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar * message) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glPushDebugGroupKHR); - - // copy argument source - GLMessage_DataType *arg_source = glmsg.add_args(); - arg_source->set_isarray(false); - arg_source->set_type(GLMessage::DataType::ENUM); - arg_source->add_intvalue((int)source); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument message - GLMessage_DataType *arg_message = glmsg.add_args(); - arg_message->set_isarray(false); - arg_message->set_type(GLMessage::DataType::INT64); - arg_message->add_int64value((uintptr_t)message); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPushDebugGroupKHR(source, id, length, message); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) message, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glPopDebugGroupKHR(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glPopDebugGroupKHR); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPopDebugGroupKHR(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar * label) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glObjectLabelKHR); - - // copy argument identifier - GLMessage_DataType *arg_identifier = glmsg.add_args(); - arg_identifier->set_isarray(false); - arg_identifier->set_type(GLMessage::DataType::ENUM); - arg_identifier->add_intvalue((int)identifier); - - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT); - arg_name->add_intvalue(name); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument label - GLMessage_DataType *arg_label = glmsg.add_args(); - arg_label->set_isarray(false); - arg_label->set_type(GLMessage::DataType::INT64); - arg_label->add_int64value((uintptr_t)label); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glObjectLabelKHR(identifier, name, length, label); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) label, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetObjectLabelKHR); - - // copy argument identifier - GLMessage_DataType *arg_identifier = glmsg.add_args(); - arg_identifier->set_isarray(false); - arg_identifier->set_type(GLMessage::DataType::ENUM); - arg_identifier->add_intvalue((int)identifier); - - // copy argument name - GLMessage_DataType *arg_name = glmsg.add_args(); - arg_name->set_isarray(false); - arg_name->set_type(GLMessage::DataType::INT); - arg_name->add_intvalue(name); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument label - GLMessage_DataType *arg_label = glmsg.add_args(); - arg_label->set_isarray(false); - arg_label->set_type(GLMessage::DataType::INT64); - arg_label->add_int64value((uintptr_t)label); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetObjectLabelKHR(identifier, name, bufSize, length, label); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) label, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glObjectPtrLabelKHR(const void * ptr, GLsizei length, const GLchar * label) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glObjectPtrLabelKHR); - - // copy argument ptr - GLMessage_DataType *arg_ptr = glmsg.add_args(); - arg_ptr->set_isarray(false); - arg_ptr->set_type(GLMessage::DataType::INT64); - arg_ptr->add_int64value((uintptr_t)ptr); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument label - GLMessage_DataType *arg_label = glmsg.add_args(); - arg_label->set_isarray(false); - arg_label->set_type(GLMessage::DataType::INT64); - arg_label->add_int64value((uintptr_t)label); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glObjectPtrLabelKHR(ptr, length, label); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) ptr, - (void *) label, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetObjectPtrLabelKHR(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetObjectPtrLabelKHR); - - // copy argument ptr - GLMessage_DataType *arg_ptr = glmsg.add_args(); - arg_ptr->set_isarray(false); - arg_ptr->set_type(GLMessage::DataType::INT64); - arg_ptr->add_int64value((uintptr_t)ptr); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument label - GLMessage_DataType *arg_label = glmsg.add_args(); - arg_label->set_isarray(false); - arg_label->set_type(GLMessage::DataType::INT64); - arg_label->add_int64value((uintptr_t)label); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetObjectPtrLabelKHR(ptr, bufSize, length, label); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) ptr, - (void *) length, - (void *) label, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPointervKHR(GLenum pname, void ** params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPointervKHR); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPointervKHR(pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEGLImageTargetTexture2DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument image - GLMessage_DataType *arg_image = glmsg.add_args(); - arg_image->set_isarray(false); - arg_image->set_type(GLMessage::DataType::INT64); - arg_image->add_int64value((uintptr_t)image); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEGLImageTargetTexture2DOES(target, image); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) image, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEGLImageTargetRenderbufferStorageOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument image - GLMessage_DataType *arg_image = glmsg.add_args(); - arg_image->set_isarray(false); - arg_image->set_type(GLMessage::DataType::INT64); - arg_image->add_int64value((uintptr_t)image); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEGLImageTargetRenderbufferStorageOES(target, image); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) image, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetProgramBinaryOES); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument binaryFormat - GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); - arg_binaryFormat->set_isarray(false); - arg_binaryFormat->set_type(GLMessage::DataType::INT64); - arg_binaryFormat->add_int64value((uintptr_t)binaryFormat); - - // copy argument binary - GLMessage_DataType *arg_binary = glmsg.add_args(); - arg_binary->set_isarray(false); - arg_binary->set_type(GLMessage::DataType::INT64); - arg_binary->add_int64value((uintptr_t)binary); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramBinaryOES(program, bufSize, length, binaryFormat, binary); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) binaryFormat, - (void *) binary, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const void * binary, GLint length) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramBinaryOES); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument binaryFormat - GLMessage_DataType *arg_binaryFormat = glmsg.add_args(); - arg_binaryFormat->set_isarray(false); - arg_binaryFormat->set_type(GLMessage::DataType::ENUM); - arg_binaryFormat->add_intvalue((int)binaryFormat); - - // copy argument binary - GLMessage_DataType *arg_binary = glmsg.add_args(); - arg_binary->set_isarray(false); - arg_binary->set_type(GLMessage::DataType::INT64); - arg_binary->add_int64value((uintptr_t)binary); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramBinaryOES(program, binaryFormat, binary, length); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) binary, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void * GLTrace_glMapBufferOES(GLenum target, GLenum access) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMapBufferOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument access - GLMessage_DataType *arg_access = glmsg.add_args(); - arg_access->set_isarray(false); - arg_access->set_type(GLMessage::DataType::ENUM); - arg_access->add_intvalue((int)access); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - void * retValue = glContext->hooks->gl.glMapBufferOES(target, access); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); - - void *pointerArgs[] = { - (void *) retValue, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -GLboolean GLTrace_glUnmapBufferOES(GLenum target) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUnmapBufferOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glUnmapBufferOES(target); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, void ** params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetBufferPointervOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetBufferPointervOES(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMinSampleShadingOES(GLfloat value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMinSampleShadingOES); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::FLOAT); - arg_value->add_floatvalue(value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMinSampleShadingOES(value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexImage3DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // copy argument border - GLMessage_DataType *arg_border = glmsg.add_args(); - arg_border->set_isarray(false); - arg_border->set_type(GLMessage::DataType::INT); - arg_border->add_intvalue(border); - - // copy argument format - GLMessage_DataType *arg_format = glmsg.add_args(); - arg_format->set_isarray(false); - arg_format->set_type(GLMessage::DataType::ENUM); - arg_format->add_intvalue((int)format); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument pixels - GLMessage_DataType *arg_pixels = glmsg.add_args(); - arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexImage3DOES(target, level, internalformat, width, height, depth, border, format, type, pixels); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) pixels, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexSubImage3DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument xoffset - GLMessage_DataType *arg_xoffset = glmsg.add_args(); - arg_xoffset->set_isarray(false); - arg_xoffset->set_type(GLMessage::DataType::INT); - arg_xoffset->add_intvalue(xoffset); - - // copy argument yoffset - GLMessage_DataType *arg_yoffset = glmsg.add_args(); - arg_yoffset->set_isarray(false); - arg_yoffset->set_type(GLMessage::DataType::INT); - arg_yoffset->add_intvalue(yoffset); - - // copy argument zoffset - GLMessage_DataType *arg_zoffset = glmsg.add_args(); - arg_zoffset->set_isarray(false); - arg_zoffset->set_type(GLMessage::DataType::INT); - arg_zoffset->add_intvalue(zoffset); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // copy argument format - GLMessage_DataType *arg_format = glmsg.add_args(); - arg_format->set_isarray(false); - arg_format->set_type(GLMessage::DataType::ENUM); - arg_format->add_intvalue((int)format); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument pixels - GLMessage_DataType *arg_pixels = glmsg.add_args(); - arg_pixels->set_isarray(false); - arg_pixels->set_type(GLMessage::DataType::INT64); - arg_pixels->add_int64value((uintptr_t)pixels); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) pixels, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCopyTexSubImage3DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument xoffset - GLMessage_DataType *arg_xoffset = glmsg.add_args(); - arg_xoffset->set_isarray(false); - arg_xoffset->set_type(GLMessage::DataType::INT); - arg_xoffset->add_intvalue(xoffset); - - // copy argument yoffset - GLMessage_DataType *arg_yoffset = glmsg.add_args(); - arg_yoffset->set_isarray(false); - arg_yoffset->set_type(GLMessage::DataType::INT); - arg_yoffset->add_intvalue(yoffset); - - // copy argument zoffset - GLMessage_DataType *arg_zoffset = glmsg.add_args(); - arg_zoffset->set_isarray(false); - arg_zoffset->set_type(GLMessage::DataType::INT); - arg_zoffset->add_intvalue(zoffset); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCopyTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, x, y, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCompressedTexImage3DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // copy argument border - GLMessage_DataType *arg_border = glmsg.add_args(); - arg_border->set_isarray(false); - arg_border->set_type(GLMessage::DataType::INT); - arg_border->add_intvalue(border); - - // copy argument imageSize - GLMessage_DataType *arg_imageSize = glmsg.add_args(); - arg_imageSize->set_isarray(false); - arg_imageSize->set_type(GLMessage::DataType::INT); - arg_imageSize->add_intvalue(imageSize); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCompressedTexImage3DOES(target, level, internalformat, width, height, depth, border, imageSize, data); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCompressedTexSubImage3DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument xoffset - GLMessage_DataType *arg_xoffset = glmsg.add_args(); - arg_xoffset->set_isarray(false); - arg_xoffset->set_type(GLMessage::DataType::INT); - arg_xoffset->add_intvalue(xoffset); - - // copy argument yoffset - GLMessage_DataType *arg_yoffset = glmsg.add_args(); - arg_yoffset->set_isarray(false); - arg_yoffset->set_type(GLMessage::DataType::INT); - arg_yoffset->add_intvalue(yoffset); - - // copy argument zoffset - GLMessage_DataType *arg_zoffset = glmsg.add_args(); - arg_zoffset->set_isarray(false); - arg_zoffset->set_type(GLMessage::DataType::INT); - arg_zoffset->add_intvalue(zoffset); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // copy argument format - GLMessage_DataType *arg_format = glmsg.add_args(); - arg_format->set_isarray(false); - arg_format->set_type(GLMessage::DataType::ENUM); - arg_format->add_intvalue((int)format); - - // copy argument imageSize - GLMessage_DataType *arg_imageSize = glmsg.add_args(); - arg_imageSize->set_isarray(false); - arg_imageSize->set_type(GLMessage::DataType::INT); - arg_imageSize->add_intvalue(imageSize); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCompressedTexSubImage3DOES(target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFramebufferTexture3DOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument attachment - GLMessage_DataType *arg_attachment = glmsg.add_args(); - arg_attachment->set_isarray(false); - arg_attachment->set_type(GLMessage::DataType::ENUM); - arg_attachment->add_intvalue((int)attachment); - - // copy argument textarget - GLMessage_DataType *arg_textarget = glmsg.add_args(); - arg_textarget->set_isarray(false); - arg_textarget->set_type(GLMessage::DataType::ENUM); - arg_textarget->add_intvalue((int)textarget); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument zoffset - GLMessage_DataType *arg_zoffset = glmsg.add_args(); - arg_zoffset->set_isarray(false); - arg_zoffset->set_type(GLMessage::DataType::INT); - arg_zoffset->add_intvalue(zoffset); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFramebufferTexture3DOES(target, attachment, textarget, texture, level, zoffset); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexStorage3DMultisampleOES(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexStorage3DMultisampleOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // copy argument fixedsamplelocations - GLMessage_DataType *arg_fixedsamplelocations = glmsg.add_args(); - arg_fixedsamplelocations->set_isarray(false); - arg_fixedsamplelocations->set_type(GLMessage::DataType::BOOL); - arg_fixedsamplelocations->add_boolvalue(fixedsamplelocations); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage3DMultisampleOES(target, samples, internalformat, width, height, depth, fixedsamplelocations); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBindVertexArrayOES(GLuint array) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBindVertexArrayOES); - - // copy argument array - GLMessage_DataType *arg_array = glmsg.add_args(); - arg_array->set_isarray(false); - arg_array->set_type(GLMessage::DataType::INT); - arg_array->add_intvalue(array); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindVertexArrayOES(array); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint * arrays) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteVertexArraysOES); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument arrays - GLMessage_DataType *arg_arrays = glmsg.add_args(); - arg_arrays->set_isarray(false); - arg_arrays->set_type(GLMessage::DataType::INT64); - arg_arrays->add_int64value((uintptr_t)arrays); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteVertexArraysOES(n, arrays); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) arrays, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint * arrays) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGenVertexArraysOES); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument arrays - GLMessage_DataType *arg_arrays = glmsg.add_args(); - arg_arrays->set_isarray(false); - arg_arrays->set_type(GLMessage::DataType::INT64); - arg_arrays->add_int64value((uintptr_t)arrays); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenVertexArraysOES(n, arrays); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) arrays, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glIsVertexArrayOES(GLuint array) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsVertexArrayOES); - - // copy argument array - GLMessage_DataType *arg_array = glmsg.add_args(); - arg_array->set_isarray(false); - arg_array->set_type(GLMessage::DataType::INT); - arg_array->add_intvalue(array); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsVertexArrayOES(array); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glGetPerfMonitorGroupsAMD(GLint * numGroups, GLsizei groupsSize, GLuint * groups) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfMonitorGroupsAMD); - - // copy argument numGroups - GLMessage_DataType *arg_numGroups = glmsg.add_args(); - arg_numGroups->set_isarray(false); - arg_numGroups->set_type(GLMessage::DataType::INT64); - arg_numGroups->add_int64value((uintptr_t)numGroups); - - // copy argument groupsSize - GLMessage_DataType *arg_groupsSize = glmsg.add_args(); - arg_groupsSize->set_isarray(false); - arg_groupsSize->set_type(GLMessage::DataType::INT); - arg_groupsSize->add_intvalue(groupsSize); - - // copy argument groups - GLMessage_DataType *arg_groups = glmsg.add_args(); - arg_groups->set_isarray(false); - arg_groups->set_type(GLMessage::DataType::INT64); - arg_groups->add_int64value((uintptr_t)groups); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfMonitorGroupsAMD(numGroups, groupsSize, groups); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) numGroups, - (void *) groups, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint * numCounters, GLint * maxActiveCounters, GLsizei counterSize, GLuint * counters) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfMonitorCountersAMD); - - // copy argument group - GLMessage_DataType *arg_group = glmsg.add_args(); - arg_group->set_isarray(false); - arg_group->set_type(GLMessage::DataType::INT); - arg_group->add_intvalue(group); - - // copy argument numCounters - GLMessage_DataType *arg_numCounters = glmsg.add_args(); - arg_numCounters->set_isarray(false); - arg_numCounters->set_type(GLMessage::DataType::INT64); - arg_numCounters->add_int64value((uintptr_t)numCounters); - - // copy argument maxActiveCounters - GLMessage_DataType *arg_maxActiveCounters = glmsg.add_args(); - arg_maxActiveCounters->set_isarray(false); - arg_maxActiveCounters->set_type(GLMessage::DataType::INT64); - arg_maxActiveCounters->add_int64value((uintptr_t)maxActiveCounters); - - // copy argument counterSize - GLMessage_DataType *arg_counterSize = glmsg.add_args(); - arg_counterSize->set_isarray(false); - arg_counterSize->set_type(GLMessage::DataType::INT); - arg_counterSize->add_intvalue(counterSize); - - // copy argument counters - GLMessage_DataType *arg_counters = glmsg.add_args(); - arg_counters->set_isarray(false); - arg_counters->set_type(GLMessage::DataType::INT64); - arg_counters->add_int64value((uintptr_t)counters); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfMonitorCountersAMD(group, numCounters, maxActiveCounters, counterSize, counters); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) numCounters, - (void *) maxActiveCounters, - (void *) counters, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei * length, GLchar * groupString) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfMonitorGroupStringAMD); - - // copy argument group - GLMessage_DataType *arg_group = glmsg.add_args(); - arg_group->set_isarray(false); - arg_group->set_type(GLMessage::DataType::INT); - arg_group->add_intvalue(group); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument groupString - GLMessage_DataType *arg_groupString = glmsg.add_args(); - arg_groupString->set_isarray(false); - arg_groupString->set_type(GLMessage::DataType::INT64); - arg_groupString->add_int64value((uintptr_t)groupString); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfMonitorGroupStringAMD(group, bufSize, length, groupString); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) groupString, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei * length, GLchar * counterString) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfMonitorCounterStringAMD); - - // copy argument group - GLMessage_DataType *arg_group = glmsg.add_args(); - arg_group->set_isarray(false); - arg_group->set_type(GLMessage::DataType::INT); - arg_group->add_intvalue(group); - - // copy argument counter - GLMessage_DataType *arg_counter = glmsg.add_args(); - arg_counter->set_isarray(false); - arg_counter->set_type(GLMessage::DataType::INT); - arg_counter->add_intvalue(counter); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument counterString - GLMessage_DataType *arg_counterString = glmsg.add_args(); - arg_counterString->set_isarray(false); - arg_counterString->set_type(GLMessage::DataType::INT64); - arg_counterString->add_int64value((uintptr_t)counterString); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfMonitorCounterStringAMD(group, counter, bufSize, length, counterString); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) counterString, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, void * data) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfMonitorCounterInfoAMD); - - // copy argument group - GLMessage_DataType *arg_group = glmsg.add_args(); - arg_group->set_isarray(false); - arg_group->set_type(GLMessage::DataType::INT); - arg_group->add_intvalue(group); - - // copy argument counter - GLMessage_DataType *arg_counter = glmsg.add_args(); - arg_counter->set_isarray(false); - arg_counter->set_type(GLMessage::DataType::INT); - arg_counter->add_intvalue(counter); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfMonitorCounterInfoAMD(group, counter, pname, data); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint * monitors) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGenPerfMonitorsAMD); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument monitors - GLMessage_DataType *arg_monitors = glmsg.add_args(); - arg_monitors->set_isarray(false); - arg_monitors->set_type(GLMessage::DataType::INT64); - arg_monitors->add_int64value((uintptr_t)monitors); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenPerfMonitorsAMD(n, monitors); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) monitors, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint * monitors) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeletePerfMonitorsAMD); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument monitors - GLMessage_DataType *arg_monitors = glmsg.add_args(); - arg_monitors->set_isarray(false); - arg_monitors->set_type(GLMessage::DataType::INT64); - arg_monitors->add_int64value((uintptr_t)monitors); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeletePerfMonitorsAMD(n, monitors); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) monitors, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint * counterList) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glSelectPerfMonitorCountersAMD); - - // copy argument monitor - GLMessage_DataType *arg_monitor = glmsg.add_args(); - arg_monitor->set_isarray(false); - arg_monitor->set_type(GLMessage::DataType::INT); - arg_monitor->add_intvalue(monitor); - - // copy argument enable - GLMessage_DataType *arg_enable = glmsg.add_args(); - arg_enable->set_isarray(false); - arg_enable->set_type(GLMessage::DataType::BOOL); - arg_enable->add_boolvalue(enable); - - // copy argument group - GLMessage_DataType *arg_group = glmsg.add_args(); - arg_group->set_isarray(false); - arg_group->set_type(GLMessage::DataType::INT); - arg_group->add_intvalue(group); - - // copy argument numCounters - GLMessage_DataType *arg_numCounters = glmsg.add_args(); - arg_numCounters->set_isarray(false); - arg_numCounters->set_type(GLMessage::DataType::INT); - arg_numCounters->add_intvalue(numCounters); - - // copy argument counterList - GLMessage_DataType *arg_counterList = glmsg.add_args(); - arg_counterList->set_isarray(false); - arg_counterList->set_type(GLMessage::DataType::INT64); - arg_counterList->add_int64value((uintptr_t)counterList); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSelectPerfMonitorCountersAMD(monitor, enable, group, numCounters, counterList); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) counterList, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBeginPerfMonitorAMD(GLuint monitor) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBeginPerfMonitorAMD); - - // copy argument monitor - GLMessage_DataType *arg_monitor = glmsg.add_args(); - arg_monitor->set_isarray(false); - arg_monitor->set_type(GLMessage::DataType::INT); - arg_monitor->add_intvalue(monitor); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBeginPerfMonitorAMD(monitor); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEndPerfMonitorAMD(GLuint monitor) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEndPerfMonitorAMD); - - // copy argument monitor - GLMessage_DataType *arg_monitor = glmsg.add_args(); - arg_monitor->set_isarray(false); - arg_monitor->set_type(GLMessage::DataType::INT); - arg_monitor->add_intvalue(monitor); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEndPerfMonitorAMD(monitor); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint * data, GLint * bytesWritten) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfMonitorCounterDataAMD); - - // copy argument monitor - GLMessage_DataType *arg_monitor = glmsg.add_args(); - arg_monitor->set_isarray(false); - arg_monitor->set_type(GLMessage::DataType::INT); - arg_monitor->add_intvalue(monitor); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument dataSize - GLMessage_DataType *arg_dataSize = glmsg.add_args(); - arg_dataSize->set_isarray(false); - arg_dataSize->set_type(GLMessage::DataType::INT); - arg_dataSize->add_intvalue(dataSize); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // copy argument bytesWritten - GLMessage_DataType *arg_bytesWritten = glmsg.add_args(); - arg_bytesWritten->set_isarray(false); - arg_bytesWritten->set_type(GLMessage::DataType::INT64); - arg_bytesWritten->add_int64value((uintptr_t)bytesWritten); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfMonitorCounterDataAMD(monitor, pname, dataSize, data, bytesWritten); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - (void *) bytesWritten, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlitFramebufferANGLE); - - // copy argument srcX0 - GLMessage_DataType *arg_srcX0 = glmsg.add_args(); - arg_srcX0->set_isarray(false); - arg_srcX0->set_type(GLMessage::DataType::INT); - arg_srcX0->add_intvalue(srcX0); - - // copy argument srcY0 - GLMessage_DataType *arg_srcY0 = glmsg.add_args(); - arg_srcY0->set_isarray(false); - arg_srcY0->set_type(GLMessage::DataType::INT); - arg_srcY0->add_intvalue(srcY0); - - // copy argument srcX1 - GLMessage_DataType *arg_srcX1 = glmsg.add_args(); - arg_srcX1->set_isarray(false); - arg_srcX1->set_type(GLMessage::DataType::INT); - arg_srcX1->add_intvalue(srcX1); - - // copy argument srcY1 - GLMessage_DataType *arg_srcY1 = glmsg.add_args(); - arg_srcY1->set_isarray(false); - arg_srcY1->set_type(GLMessage::DataType::INT); - arg_srcY1->add_intvalue(srcY1); - - // copy argument dstX0 - GLMessage_DataType *arg_dstX0 = glmsg.add_args(); - arg_dstX0->set_isarray(false); - arg_dstX0->set_type(GLMessage::DataType::INT); - arg_dstX0->add_intvalue(dstX0); - - // copy argument dstY0 - GLMessage_DataType *arg_dstY0 = glmsg.add_args(); - arg_dstY0->set_isarray(false); - arg_dstY0->set_type(GLMessage::DataType::INT); - arg_dstY0->add_intvalue(dstY0); - - // copy argument dstX1 - GLMessage_DataType *arg_dstX1 = glmsg.add_args(); - arg_dstX1->set_isarray(false); - arg_dstX1->set_type(GLMessage::DataType::INT); - arg_dstX1->add_intvalue(dstX1); - - // copy argument dstY1 - GLMessage_DataType *arg_dstY1 = glmsg.add_args(); - arg_dstY1->set_isarray(false); - arg_dstY1->set_type(GLMessage::DataType::INT); - arg_dstY1->add_intvalue(dstY1); - - // copy argument mask - GLMessage_DataType *arg_mask = glmsg.add_args(); - arg_mask->set_isarray(false); - arg_mask->set_type(GLMessage::DataType::INT); - arg_mask->add_intvalue(mask); - - // copy argument filter - GLMessage_DataType *arg_filter = glmsg.add_args(); - arg_filter->set_isarray(false); - arg_filter->set_type(GLMessage::DataType::ENUM); - arg_filter->add_intvalue((int)filter); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlitFramebufferANGLE(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleANGLE); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRenderbufferStorageMultisampleANGLE(target, samples, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawArraysInstancedANGLE); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument first - GLMessage_DataType *arg_first = glmsg.add_args(); - arg_first->set_isarray(false); - arg_first->set_type(GLMessage::DataType::INT); - arg_first->add_intvalue(first); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawArraysInstancedANGLE(mode, first, count, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawElementsInstancedANGLE); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawElementsInstancedANGLE(mode, count, type, indices, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) indices, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexAttribDivisorANGLE(GLuint index, GLuint divisor) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexAttribDivisorANGLE); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument divisor - GLMessage_DataType *arg_divisor = glmsg.add_args(); - arg_divisor->set_isarray(false); - arg_divisor->set_type(GLMessage::DataType::INT); - arg_divisor->add_intvalue(divisor); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribDivisorANGLE(index, divisor); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei * length, GLchar * source) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTranslatedShaderSourceANGLE); - - // copy argument shader - GLMessage_DataType *arg_shader = glmsg.add_args(); - arg_shader->set_isarray(false); - arg_shader->set_type(GLMessage::DataType::INT); - arg_shader->add_intvalue(shader); - - // copy argument bufsize - GLMessage_DataType *arg_bufsize = glmsg.add_args(); - arg_bufsize->set_isarray(false); - arg_bufsize->set_type(GLMessage::DataType::INT); - arg_bufsize->add_intvalue(bufsize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument source - GLMessage_DataType *arg_source = glmsg.add_args(); - arg_source->set_isarray(false); - arg_source->set_type(GLMessage::DataType::INT64); - arg_source->add_int64value((uintptr_t)source); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTranslatedShaderSourceANGLE(shader, bufsize, length, source); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) source, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCopyTextureLevelsAPPLE(GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCopyTextureLevelsAPPLE); - - // copy argument destinationTexture - GLMessage_DataType *arg_destinationTexture = glmsg.add_args(); - arg_destinationTexture->set_isarray(false); - arg_destinationTexture->set_type(GLMessage::DataType::INT); - arg_destinationTexture->add_intvalue(destinationTexture); - - // copy argument sourceTexture - GLMessage_DataType *arg_sourceTexture = glmsg.add_args(); - arg_sourceTexture->set_isarray(false); - arg_sourceTexture->set_type(GLMessage::DataType::INT); - arg_sourceTexture->add_intvalue(sourceTexture); - - // copy argument sourceBaseLevel - GLMessage_DataType *arg_sourceBaseLevel = glmsg.add_args(); - arg_sourceBaseLevel->set_isarray(false); - arg_sourceBaseLevel->set_type(GLMessage::DataType::INT); - arg_sourceBaseLevel->add_intvalue(sourceBaseLevel); - - // copy argument sourceLevelCount - GLMessage_DataType *arg_sourceLevelCount = glmsg.add_args(); - arg_sourceLevelCount->set_isarray(false); - arg_sourceLevelCount->set_type(GLMessage::DataType::INT); - arg_sourceLevelCount->add_intvalue(sourceLevelCount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCopyTextureLevelsAPPLE(destinationTexture, sourceTexture, sourceBaseLevel, sourceLevelCount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleAPPLE); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRenderbufferStorageMultisampleAPPLE(target, samples, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glResolveMultisampleFramebufferAPPLE(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glResolveMultisampleFramebufferAPPLE); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glResolveMultisampleFramebufferAPPLE(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLsync GLTrace_glFenceSyncAPPLE(GLenum condition, GLbitfield flags) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFenceSyncAPPLE); - - // copy argument condition - GLMessage_DataType *arg_condition = glmsg.add_args(); - arg_condition->set_isarray(false); - arg_condition->set_type(GLMessage::DataType::ENUM); - arg_condition->add_intvalue((int)condition); - - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLsync retValue = glContext->hooks->gl.glFenceSyncAPPLE(condition, flags); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); - - void *pointerArgs[] = { - (void *) retValue, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -GLboolean GLTrace_glIsSyncAPPLE(GLsync sync) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsSyncAPPLE); - - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsSyncAPPLE(sync); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - (void *) sync, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glDeleteSyncAPPLE(GLsync sync) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteSyncAPPLE); - - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteSyncAPPLE(sync); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) sync, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLenum GLTrace_glClientWaitSyncAPPLE(GLsync sync, GLbitfield flags, GLuint64 timeout) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glClientWaitSyncAPPLE); - - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); - - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); - - // copy argument timeout - GLMessage_DataType *arg_timeout = glmsg.add_args(); - arg_timeout->set_isarray(false); - arg_timeout->set_type(GLMessage::DataType::INT64); - arg_timeout->add_int64value(timeout); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLenum retValue = glContext->hooks->gl.glClientWaitSyncAPPLE(sync, flags, timeout); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::ENUM); - rt->add_intvalue((int)retValue); - - void *pointerArgs[] = { - (void *) sync, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glWaitSyncAPPLE(GLsync sync, GLbitfield flags, GLuint64 timeout) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glWaitSyncAPPLE); - - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); - - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); - - // copy argument timeout - GLMessage_DataType *arg_timeout = glmsg.add_args(); - arg_timeout->set_isarray(false); - arg_timeout->set_type(GLMessage::DataType::INT64); - arg_timeout->add_int64value(timeout); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glWaitSyncAPPLE(sync, flags, timeout); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) sync, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetInteger64vAPPLE(GLenum pname, GLint64 * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetInteger64vAPPLE); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetInteger64vAPPLE(pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetSyncivAPPLE(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetSyncivAPPLE); - - // copy argument sync - GLMessage_DataType *arg_sync = glmsg.add_args(); - arg_sync->set_isarray(false); - arg_sync->set_type(GLMessage::DataType::INT64); - arg_sync->add_int64value((uintptr_t)sync); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument values - GLMessage_DataType *arg_values = glmsg.add_args(); - arg_values->set_isarray(false); - arg_values->set_type(GLMessage::DataType::INT64); - arg_values->add_int64value((uintptr_t)values); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetSyncivAPPLE(sync, pname, bufSize, length, values); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) sync, - (void *) length, - (void *) values, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCopyImageSubDataEXT(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCopyImageSubDataEXT); - - // copy argument srcName - GLMessage_DataType *arg_srcName = glmsg.add_args(); - arg_srcName->set_isarray(false); - arg_srcName->set_type(GLMessage::DataType::INT); - arg_srcName->add_intvalue(srcName); - - // copy argument srcTarget - GLMessage_DataType *arg_srcTarget = glmsg.add_args(); - arg_srcTarget->set_isarray(false); - arg_srcTarget->set_type(GLMessage::DataType::ENUM); - arg_srcTarget->add_intvalue((int)srcTarget); - - // copy argument srcLevel - GLMessage_DataType *arg_srcLevel = glmsg.add_args(); - arg_srcLevel->set_isarray(false); - arg_srcLevel->set_type(GLMessage::DataType::INT); - arg_srcLevel->add_intvalue(srcLevel); - - // copy argument srcX - GLMessage_DataType *arg_srcX = glmsg.add_args(); - arg_srcX->set_isarray(false); - arg_srcX->set_type(GLMessage::DataType::INT); - arg_srcX->add_intvalue(srcX); - - // copy argument srcY - GLMessage_DataType *arg_srcY = glmsg.add_args(); - arg_srcY->set_isarray(false); - arg_srcY->set_type(GLMessage::DataType::INT); - arg_srcY->add_intvalue(srcY); - - // copy argument srcZ - GLMessage_DataType *arg_srcZ = glmsg.add_args(); - arg_srcZ->set_isarray(false); - arg_srcZ->set_type(GLMessage::DataType::INT); - arg_srcZ->add_intvalue(srcZ); - - // copy argument dstName - GLMessage_DataType *arg_dstName = glmsg.add_args(); - arg_dstName->set_isarray(false); - arg_dstName->set_type(GLMessage::DataType::INT); - arg_dstName->add_intvalue(dstName); - - // copy argument dstTarget - GLMessage_DataType *arg_dstTarget = glmsg.add_args(); - arg_dstTarget->set_isarray(false); - arg_dstTarget->set_type(GLMessage::DataType::ENUM); - arg_dstTarget->add_intvalue((int)dstTarget); - - // copy argument dstLevel - GLMessage_DataType *arg_dstLevel = glmsg.add_args(); - arg_dstLevel->set_isarray(false); - arg_dstLevel->set_type(GLMessage::DataType::INT); - arg_dstLevel->add_intvalue(dstLevel); - - // copy argument dstX - GLMessage_DataType *arg_dstX = glmsg.add_args(); - arg_dstX->set_isarray(false); - arg_dstX->set_type(GLMessage::DataType::INT); - arg_dstX->add_intvalue(dstX); - - // copy argument dstY - GLMessage_DataType *arg_dstY = glmsg.add_args(); - arg_dstY->set_isarray(false); - arg_dstY->set_type(GLMessage::DataType::INT); - arg_dstY->add_intvalue(dstY); - - // copy argument dstZ - GLMessage_DataType *arg_dstZ = glmsg.add_args(); - arg_dstZ->set_isarray(false); - arg_dstZ->set_type(GLMessage::DataType::INT); - arg_dstZ->add_intvalue(dstZ); - - // copy argument srcWidth - GLMessage_DataType *arg_srcWidth = glmsg.add_args(); - arg_srcWidth->set_isarray(false); - arg_srcWidth->set_type(GLMessage::DataType::INT); - arg_srcWidth->add_intvalue(srcWidth); - - // copy argument srcHeight - GLMessage_DataType *arg_srcHeight = glmsg.add_args(); - arg_srcHeight->set_isarray(false); - arg_srcHeight->set_type(GLMessage::DataType::INT); - arg_srcHeight->add_intvalue(srcHeight); - - // copy argument srcDepth - GLMessage_DataType *arg_srcDepth = glmsg.add_args(); - arg_srcDepth->set_isarray(false); - arg_srcDepth->set_type(GLMessage::DataType::INT); - arg_srcDepth->add_intvalue(srcDepth); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCopyImageSubDataEXT(srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar * label) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLabelObjectEXT); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument object - GLMessage_DataType *arg_object = glmsg.add_args(); - arg_object->set_isarray(false); - arg_object->set_type(GLMessage::DataType::INT); - arg_object->add_intvalue(object); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument label - GLMessage_DataType *arg_label = glmsg.add_args(); - arg_label->set_isarray(false); - arg_label->set_type(GLMessage::DataType::INT64); - arg_label->add_int64value((uintptr_t)label); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLabelObjectEXT(type, object, length, label); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) label, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei * length, GLchar * label) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetObjectLabelEXT); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument object - GLMessage_DataType *arg_object = glmsg.add_args(); - arg_object->set_isarray(false); - arg_object->set_type(GLMessage::DataType::INT); - arg_object->add_intvalue(object); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument label - GLMessage_DataType *arg_label = glmsg.add_args(); - arg_label->set_isarray(false); - arg_label->set_type(GLMessage::DataType::INT64); - arg_label->add_int64value((uintptr_t)label); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetObjectLabelEXT(type, object, bufSize, length, label); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) label, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glInsertEventMarkerEXT(GLsizei length, const GLchar * marker) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glInsertEventMarkerEXT); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument marker - GLMessage_DataType *arg_marker = glmsg.add_args(); - arg_marker->set_isarray(false); - arg_marker->set_type(GLMessage::DataType::INT64); - arg_marker->add_int64value((uintptr_t)marker); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glInsertEventMarkerEXT(length, marker); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) marker, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glPushGroupMarkerEXT(GLsizei length, const GLchar * marker) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glPushGroupMarkerEXT); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument marker - GLMessage_DataType *arg_marker = glmsg.add_args(); - arg_marker->set_isarray(false); - arg_marker->set_type(GLMessage::DataType::INT64); - arg_marker->add_int64value((uintptr_t)marker); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPushGroupMarkerEXT(length, marker); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) marker, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glPopGroupMarkerEXT(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glPopGroupMarkerEXT); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPopGroupMarkerEXT(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum * attachments) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDiscardFramebufferEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument numAttachments - GLMessage_DataType *arg_numAttachments = glmsg.add_args(); - arg_numAttachments->set_isarray(false); - arg_numAttachments->set_type(GLMessage::DataType::INT); - arg_numAttachments->add_intvalue(numAttachments); - - // copy argument attachments - GLMessage_DataType *arg_attachments = glmsg.add_args(); - arg_attachments->set_isarray(false); - arg_attachments->set_type(GLMessage::DataType::INT64); - arg_attachments->add_int64value((uintptr_t)attachments); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDiscardFramebufferEXT(target, numAttachments, attachments); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) attachments, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGenQueriesEXT(GLsizei n, GLuint * ids) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGenQueriesEXT); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenQueriesEXT(n, ids); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) ids, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeleteQueriesEXT(GLsizei n, const GLuint * ids) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteQueriesEXT); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument ids - GLMessage_DataType *arg_ids = glmsg.add_args(); - arg_ids->set_isarray(false); - arg_ids->set_type(GLMessage::DataType::INT64); - arg_ids->add_int64value((uintptr_t)ids); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteQueriesEXT(n, ids); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) ids, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glIsQueryEXT(GLuint id) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsQueryEXT); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsQueryEXT(id); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glBeginQueryEXT(GLenum target, GLuint id) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBeginQueryEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBeginQueryEXT(target, id); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEndQueryEXT(GLenum target) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEndQueryEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEndQueryEXT(target); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glQueryCounterEXT(GLuint id, GLenum target) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glQueryCounterEXT); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glQueryCounterEXT(id, target); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetQueryivEXT(GLenum target, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetQueryivEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryivEXT(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetQueryObjectivEXT); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryObjectivEXT(id, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetQueryObjectuivEXT); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryObjectuivEXT(id, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetQueryObjecti64vEXT); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryObjecti64vEXT(id, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetQueryObjectui64vEXT); - - // copy argument id - GLMessage_DataType *arg_id = glmsg.add_args(); - arg_id->set_isarray(false); - arg_id->set_type(GLMessage::DataType::INT); - arg_id->add_intvalue(id); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetQueryObjectui64vEXT(id, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawBuffersEXT(GLsizei n, const GLenum * bufs) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawBuffersEXT); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument bufs - GLMessage_DataType *arg_bufs = glmsg.add_args(); - arg_bufs->set_isarray(false); - arg_bufs->set_type(GLMessage::DataType::INT64); - arg_bufs->add_int64value((uintptr_t)bufs); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawBuffersEXT(n, bufs); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) bufs, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEnableiEXT(GLenum target, GLuint index) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEnableiEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEnableiEXT(target, index); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDisableiEXT(GLenum target, GLuint index) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDisableiEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDisableiEXT(target, index); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlendEquationiEXT(GLuint buf, GLenum mode) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendEquationiEXT); - - // copy argument buf - GLMessage_DataType *arg_buf = glmsg.add_args(); - arg_buf->set_isarray(false); - arg_buf->set_type(GLMessage::DataType::INT); - arg_buf->add_intvalue(buf); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendEquationiEXT(buf, mode); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlendEquationSeparateiEXT(GLuint buf, GLenum modeRGB, GLenum modeAlpha) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendEquationSeparateiEXT); - - // copy argument buf - GLMessage_DataType *arg_buf = glmsg.add_args(); - arg_buf->set_isarray(false); - arg_buf->set_type(GLMessage::DataType::INT); - arg_buf->add_intvalue(buf); - - // copy argument modeRGB - GLMessage_DataType *arg_modeRGB = glmsg.add_args(); - arg_modeRGB->set_isarray(false); - arg_modeRGB->set_type(GLMessage::DataType::ENUM); - arg_modeRGB->add_intvalue((int)modeRGB); - - // copy argument modeAlpha - GLMessage_DataType *arg_modeAlpha = glmsg.add_args(); - arg_modeAlpha->set_isarray(false); - arg_modeAlpha->set_type(GLMessage::DataType::ENUM); - arg_modeAlpha->add_intvalue((int)modeAlpha); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendEquationSeparateiEXT(buf, modeRGB, modeAlpha); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlendFunciEXT(GLuint buf, GLenum src, GLenum dst) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendFunciEXT); - - // copy argument buf - GLMessage_DataType *arg_buf = glmsg.add_args(); - arg_buf->set_isarray(false); - arg_buf->set_type(GLMessage::DataType::INT); - arg_buf->add_intvalue(buf); - - // copy argument src - GLMessage_DataType *arg_src = glmsg.add_args(); - arg_src->set_isarray(false); - arg_src->set_type(GLMessage::DataType::ENUM); - arg_src->add_intvalue((int)src); - - // copy argument dst - GLMessage_DataType *arg_dst = glmsg.add_args(); - arg_dst->set_isarray(false); - arg_dst->set_type(GLMessage::DataType::ENUM); - arg_dst->add_intvalue((int)dst); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendFunciEXT(buf, src, dst); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlendFuncSeparateiEXT(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendFuncSeparateiEXT); - - // copy argument buf - GLMessage_DataType *arg_buf = glmsg.add_args(); - arg_buf->set_isarray(false); - arg_buf->set_type(GLMessage::DataType::INT); - arg_buf->add_intvalue(buf); - - // copy argument srcRGB - GLMessage_DataType *arg_srcRGB = glmsg.add_args(); - arg_srcRGB->set_isarray(false); - arg_srcRGB->set_type(GLMessage::DataType::ENUM); - arg_srcRGB->add_intvalue((int)srcRGB); - - // copy argument dstRGB - GLMessage_DataType *arg_dstRGB = glmsg.add_args(); - arg_dstRGB->set_isarray(false); - arg_dstRGB->set_type(GLMessage::DataType::ENUM); - arg_dstRGB->add_intvalue((int)dstRGB); - - // copy argument srcAlpha - GLMessage_DataType *arg_srcAlpha = glmsg.add_args(); - arg_srcAlpha->set_isarray(false); - arg_srcAlpha->set_type(GLMessage::DataType::ENUM); - arg_srcAlpha->add_intvalue((int)srcAlpha); - - // copy argument dstAlpha - GLMessage_DataType *arg_dstAlpha = glmsg.add_args(); - arg_dstAlpha->set_isarray(false); - arg_dstAlpha->set_type(GLMessage::DataType::ENUM); - arg_dstAlpha->add_intvalue((int)dstAlpha); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendFuncSeparateiEXT(buf, srcRGB, dstRGB, srcAlpha, dstAlpha); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glColorMaskiEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glColorMaskiEXT); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::BOOL); - arg_r->add_boolvalue(r); - - // copy argument g - GLMessage_DataType *arg_g = glmsg.add_args(); - arg_g->set_isarray(false); - arg_g->set_type(GLMessage::DataType::BOOL); - arg_g->add_boolvalue(g); - - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::BOOL); - arg_b->add_boolvalue(b); - - // copy argument a - GLMessage_DataType *arg_a = glmsg.add_args(); - arg_a->set_isarray(false); - arg_a->set_type(GLMessage::DataType::BOOL); - arg_a->add_boolvalue(a); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glColorMaskiEXT(index, r, g, b, a); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glIsEnablediEXT(GLenum target, GLuint index) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsEnablediEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsEnablediEXT(target, index); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glDrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawArraysInstancedEXT); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument start - GLMessage_DataType *arg_start = glmsg.add_args(); - arg_start->set_isarray(false); - arg_start->set_type(GLMessage::DataType::INT); - arg_start->add_intvalue(start); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawArraysInstancedEXT(mode, start, count, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawElementsInstancedEXT); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawElementsInstancedEXT(mode, count, type, indices, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) indices, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFramebufferTextureEXT(GLenum target, GLenum attachment, GLuint texture, GLint level) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFramebufferTextureEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument attachment - GLMessage_DataType *arg_attachment = glmsg.add_args(); - arg_attachment->set_isarray(false); - arg_attachment->set_type(GLMessage::DataType::ENUM); - arg_attachment->add_intvalue((int)attachment); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFramebufferTextureEXT(target, attachment, texture, level); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexAttribDivisorEXT(GLuint index, GLuint divisor) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexAttribDivisorEXT); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument divisor - GLMessage_DataType *arg_divisor = glmsg.add_args(); - arg_divisor->set_isarray(false); - arg_divisor->set_type(GLMessage::DataType::INT); - arg_divisor->add_intvalue(divisor); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribDivisorEXT(index, divisor); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void * GLTrace_glMapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMapBufferRangeEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // copy argument access - GLMessage_DataType *arg_access = glmsg.add_args(); - arg_access->set_isarray(false); - arg_access->set_type(GLMessage::DataType::INT); - arg_access->add_intvalue(access); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - void * retValue = glContext->hooks->gl.glMapBufferRangeEXT(target, offset, length, access); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT64); - rt->add_int64value((uintptr_t)retValue); - - void *pointerArgs[] = { - (void *) retValue, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFlushMappedBufferRangeEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT); - arg_length->add_intvalue(length); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFlushMappedBufferRangeEXT(target, offset, length); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMultiDrawArraysEXT(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMultiDrawArraysEXT); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument first - GLMessage_DataType *arg_first = glmsg.add_args(); - arg_first->set_isarray(false); - arg_first->set_type(GLMessage::DataType::INT64); - arg_first->add_int64value((uintptr_t)first); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT64); - arg_count->add_int64value((uintptr_t)count); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiDrawArraysEXT(mode, first, count, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) first, - (void *) count, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMultiDrawElementsEXT); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT64); - arg_count->add_int64value((uintptr_t)count); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiDrawElementsEXT(mode, count, type, indices, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) count, - (void *) indices, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRenderbufferStorageMultisampleEXT(target, samples, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument attachment - GLMessage_DataType *arg_attachment = glmsg.add_args(); - arg_attachment->set_isarray(false); - arg_attachment->set_type(GLMessage::DataType::ENUM); - arg_attachment->add_intvalue((int)attachment); - - // copy argument textarget - GLMessage_DataType *arg_textarget = glmsg.add_args(); - arg_textarget->set_isarray(false); - arg_textarget->set_type(GLMessage::DataType::ENUM); - arg_textarget->add_intvalue((int)textarget); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFramebufferTexture2DMultisampleEXT(target, attachment, textarget, texture, level, samples); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glReadBufferIndexedEXT(GLenum src, GLint index) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glReadBufferIndexedEXT); - - // copy argument src - GLMessage_DataType *arg_src = glmsg.add_args(); - arg_src->set_isarray(false); - arg_src->set_type(GLMessage::DataType::ENUM); - arg_src->add_intvalue((int)src); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glReadBufferIndexedEXT(src, index); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawBuffersIndexedEXT(GLint n, const GLenum * location, const GLint * indices) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawBuffersIndexedEXT); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT64); - arg_location->add_int64value((uintptr_t)location); - - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawBuffersIndexedEXT(n, location, indices); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) location, - (void *) indices, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetIntegeri_vEXT(GLenum target, GLuint index, GLint * data) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetIntegeri_vEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetIntegeri_vEXT(target, index, data); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glPrimitiveBoundingBoxEXT(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glPrimitiveBoundingBoxEXT); - - // copy argument minX - GLMessage_DataType *arg_minX = glmsg.add_args(); - arg_minX->set_isarray(false); - arg_minX->set_type(GLMessage::DataType::FLOAT); - arg_minX->add_floatvalue(minX); - - // copy argument minY - GLMessage_DataType *arg_minY = glmsg.add_args(); - arg_minY->set_isarray(false); - arg_minY->set_type(GLMessage::DataType::FLOAT); - arg_minY->add_floatvalue(minY); - - // copy argument minZ - GLMessage_DataType *arg_minZ = glmsg.add_args(); - arg_minZ->set_isarray(false); - arg_minZ->set_type(GLMessage::DataType::FLOAT); - arg_minZ->add_floatvalue(minZ); - - // copy argument minW - GLMessage_DataType *arg_minW = glmsg.add_args(); - arg_minW->set_isarray(false); - arg_minW->set_type(GLMessage::DataType::FLOAT); - arg_minW->add_floatvalue(minW); - - // copy argument maxX - GLMessage_DataType *arg_maxX = glmsg.add_args(); - arg_maxX->set_isarray(false); - arg_maxX->set_type(GLMessage::DataType::FLOAT); - arg_maxX->add_floatvalue(maxX); - - // copy argument maxY - GLMessage_DataType *arg_maxY = glmsg.add_args(); - arg_maxY->set_isarray(false); - arg_maxY->set_type(GLMessage::DataType::FLOAT); - arg_maxY->add_floatvalue(maxY); - - // copy argument maxZ - GLMessage_DataType *arg_maxZ = glmsg.add_args(); - arg_maxZ->set_isarray(false); - arg_maxZ->set_type(GLMessage::DataType::FLOAT); - arg_maxZ->add_floatvalue(maxZ); - - // copy argument maxW - GLMessage_DataType *arg_maxW = glmsg.add_args(); - arg_maxW->set_isarray(false); - arg_maxW->set_type(GLMessage::DataType::FLOAT); - arg_maxW->add_floatvalue(maxW); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPrimitiveBoundingBoxEXT(minX, minY, minZ, minW, maxX, maxY, maxZ, maxW); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLenum GLTrace_glGetGraphicsResetStatusEXT(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetGraphicsResetStatusEXT); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLenum retValue = glContext->hooks->gl.glGetGraphicsResetStatusEXT(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::ENUM); - rt->add_intvalue((int)retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glReadnPixelsEXT); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument format - GLMessage_DataType *arg_format = glmsg.add_args(); - arg_format->set_isarray(false); - arg_format->set_type(GLMessage::DataType::ENUM); - arg_format->add_intvalue((int)format); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glReadnPixelsEXT(x, y, width, height, format, type, bufSize, data); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetnUniformfvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetnUniformfvEXT(program, location, bufSize, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetnUniformivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetnUniformivEXT(program, location, bufSize, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glActiveShaderProgramEXT(GLuint pipeline, GLuint program) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glActiveShaderProgramEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glActiveShaderProgramEXT(pipeline, program); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBindProgramPipelineEXT(GLuint pipeline) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBindProgramPipelineEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBindProgramPipelineEXT(pipeline); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLuint GLTrace_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar ** strings) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCreateShaderProgramvEXT); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument strings - GLMessage_DataType *arg_strings = glmsg.add_args(); - arg_strings->set_isarray(false); - arg_strings->set_type(GLMessage::DataType::INT64); - arg_strings->add_int64value((uintptr_t)strings); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLuint retValue = glContext->hooks->gl.glCreateShaderProgramvEXT(type, count, strings); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::INT); - rt->add_intvalue(retValue); - - void *pointerArgs[] = { - (void *) strings, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint * pipelines) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteProgramPipelinesEXT); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument pipelines - GLMessage_DataType *arg_pipelines = glmsg.add_args(); - arg_pipelines->set_isarray(false); - arg_pipelines->set_type(GLMessage::DataType::INT64); - arg_pipelines->add_int64value((uintptr_t)pipelines); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteProgramPipelinesEXT(n, pipelines); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) pipelines, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGenProgramPipelinesEXT(GLsizei n, GLuint * pipelines) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGenProgramPipelinesEXT); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument pipelines - GLMessage_DataType *arg_pipelines = glmsg.add_args(); - arg_pipelines->set_isarray(false); - arg_pipelines->set_type(GLMessage::DataType::INT64); - arg_pipelines->add_int64value((uintptr_t)pipelines); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenProgramPipelinesEXT(n, pipelines); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) pipelines, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetProgramPipelineInfoLogEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument infoLog - GLMessage_DataType *arg_infoLog = glmsg.add_args(); - arg_infoLog->set_isarray(false); - arg_infoLog->set_type(GLMessage::DataType::INT64); - arg_infoLog->add_int64value((uintptr_t)infoLog); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramPipelineInfoLogEXT(pipeline, bufSize, length, infoLog); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) infoLog, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetProgramPipelineivEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetProgramPipelineivEXT(pipeline, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glIsProgramPipelineEXT(GLuint pipeline) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsProgramPipelineEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsProgramPipelineEXT(pipeline); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramParameteriEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramParameteriEXT(program, pname, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat v0) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1fEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1fEXT(program, location, v0); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1fvEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1iEXT(GLuint program, GLint location, GLint v0) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1iEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1iEXT(program, location, v0); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1ivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1ivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2fEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2fEXT(program, location, v0, v1); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2fvEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2iEXT(GLuint program, GLint location, GLint v0, GLint v1) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2iEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2iEXT(program, location, v0, v1); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2ivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2ivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3fEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::FLOAT); - arg_v2->add_floatvalue(v2); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3fEXT(program, location, v0, v1, v2); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3fvEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3iEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3iEXT(program, location, v0, v1, v2); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3ivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3ivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4fEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::FLOAT); - arg_v0->add_floatvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::FLOAT); - arg_v1->add_floatvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::FLOAT); - arg_v2->add_floatvalue(v2); - - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::FLOAT); - arg_v3->add_floatvalue(v3); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4fEXT(program, location, v0, v1, v2, v3); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4fvEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4iEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::INT); - arg_v3->add_intvalue(v3); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4iEXT(program, location, v0, v1, v2, v3); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4ivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4ivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix2fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix2fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix3fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix3fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix4fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix4fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUseProgramStagesEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // copy argument stages - GLMessage_DataType *arg_stages = glmsg.add_args(); - arg_stages->set_isarray(false); - arg_stages->set_type(GLMessage::DataType::INT); - arg_stages->add_intvalue(stages); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUseProgramStagesEXT(pipeline, stages, program); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glValidateProgramPipelineEXT(GLuint pipeline) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glValidateProgramPipelineEXT); - - // copy argument pipeline - GLMessage_DataType *arg_pipeline = glmsg.add_args(); - arg_pipeline->set_isarray(false); - arg_pipeline->set_type(GLMessage::DataType::INT); - arg_pipeline->add_intvalue(pipeline); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glValidateProgramPipelineEXT(pipeline); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1uiEXT(GLuint program, GLint location, GLuint v0) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1uiEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1uiEXT(program, location, v0); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2uiEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2uiEXT(program, location, v0, v1); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3uiEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3uiEXT(program, location, v0, v1, v2); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4uiEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument v0 - GLMessage_DataType *arg_v0 = glmsg.add_args(); - arg_v0->set_isarray(false); - arg_v0->set_type(GLMessage::DataType::INT); - arg_v0->add_intvalue(v0); - - // copy argument v1 - GLMessage_DataType *arg_v1 = glmsg.add_args(); - arg_v1->set_isarray(false); - arg_v1->set_type(GLMessage::DataType::INT); - arg_v1->add_intvalue(v1); - - // copy argument v2 - GLMessage_DataType *arg_v2 = glmsg.add_args(); - arg_v2->set_isarray(false); - arg_v2->set_type(GLMessage::DataType::INT); - arg_v2->add_intvalue(v2); - - // copy argument v3 - GLMessage_DataType *arg_v3 = glmsg.add_args(); - arg_v3->set_isarray(false); - arg_v3->set_type(GLMessage::DataType::INT); - arg_v3->add_intvalue(v3); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4uiEXT(program, location, v0, v1, v2, v3); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform1uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform1uivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform1uivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform2uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform2uivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform2uivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform3uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform3uivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform3uivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniform4uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniform4uivEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniform4uivEXT(program, location, count, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix2x3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix2x3fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix2x3fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix3x2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix3x2fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix3x2fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix2x4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix2x4fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix2x4fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix4x2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix4x2fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix4x2fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix3x4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix3x4fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix3x4fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glProgramUniformMatrix4x3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glProgramUniformMatrix4x3fvEXT); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glProgramUniformMatrix4x3fvEXT(program, location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glPatchParameteriEXT(GLenum pname, GLint value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glPatchParameteriEXT); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPatchParameteriEXT(pname, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexParameterIivEXT(GLenum target, GLenum pname, const GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexParameterIivEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexParameterIivEXT(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexParameterIuivEXT(GLenum target, GLenum pname, const GLuint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexParameterIuivEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexParameterIuivEXT(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexParameterIivEXT(GLenum target, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTexParameterIivEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexParameterIivEXT(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexParameterIuivEXT(GLenum target, GLenum pname, GLuint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTexParameterIuivEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexParameterIuivEXT(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glSamplerParameterIivEXT(GLuint sampler, GLenum pname, const GLint * param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glSamplerParameterIivEXT); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSamplerParameterIivEXT(sampler, pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) param, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glSamplerParameterIuivEXT(GLuint sampler, GLenum pname, const GLuint * param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glSamplerParameterIuivEXT); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSamplerParameterIuivEXT(sampler, pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) param, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetSamplerParameterIivEXT(GLuint sampler, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetSamplerParameterIivEXT); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetSamplerParameterIivEXT(sampler, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetSamplerParameterIuivEXT(GLuint sampler, GLenum pname, GLuint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetSamplerParameterIuivEXT); - - // copy argument sampler - GLMessage_DataType *arg_sampler = glmsg.add_args(); - arg_sampler->set_isarray(false); - arg_sampler->set_type(GLMessage::DataType::INT); - arg_sampler->add_intvalue(sampler); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetSamplerParameterIuivEXT(sampler, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexBufferEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::INT); - arg_buffer->add_intvalue(buffer); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexBufferEXT(target, internalformat, buffer); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexBufferRangeEXT(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexBufferRangeEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument buffer - GLMessage_DataType *arg_buffer = glmsg.add_args(); - arg_buffer->set_isarray(false); - arg_buffer->set_type(GLMessage::DataType::INT); - arg_buffer->add_intvalue(buffer); - - // copy argument offset - GLMessage_DataType *arg_offset = glmsg.add_args(); - arg_offset->set_isarray(false); - arg_offset->set_type(GLMessage::DataType::INT); - arg_offset->add_intvalue(offset); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexBufferRangeEXT(target, internalformat, buffer, offset, size); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexStorage1DEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage1DEXT(target, levels, internalformat, width); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexStorage2DEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage2DEXT(target, levels, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTexStorage3DEXT); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexStorage3DEXT(target, levels, internalformat, width, height, depth); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTextureStorage1DEXT); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTextureStorage1DEXT(texture, target, levels, internalformat, width); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTextureStorage2DEXT); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTextureStorage2DEXT(texture, target, levels, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTextureStorage3DEXT); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument levels - GLMessage_DataType *arg_levels = glmsg.add_args(); - arg_levels->set_isarray(false); - arg_levels->set_type(GLMessage::DataType::INT); - arg_levels->add_intvalue(levels); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTextureStorage3DEXT(texture, target, levels, internalformat, width, height, depth); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glTextureViewEXT(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTextureViewEXT); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument origtexture - GLMessage_DataType *arg_origtexture = glmsg.add_args(); - arg_origtexture->set_isarray(false); - arg_origtexture->set_type(GLMessage::DataType::INT); - arg_origtexture->add_intvalue(origtexture); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument minlevel - GLMessage_DataType *arg_minlevel = glmsg.add_args(); - arg_minlevel->set_isarray(false); - arg_minlevel->set_type(GLMessage::DataType::INT); - arg_minlevel->add_intvalue(minlevel); - - // copy argument numlevels - GLMessage_DataType *arg_numlevels = glmsg.add_args(); - arg_numlevels->set_isarray(false); - arg_numlevels->set_type(GLMessage::DataType::INT); - arg_numlevels->add_intvalue(numlevels); - - // copy argument minlayer - GLMessage_DataType *arg_minlayer = glmsg.add_args(); - arg_minlayer->set_isarray(false); - arg_minlayer->set_type(GLMessage::DataType::INT); - arg_minlayer->add_intvalue(minlayer); - - // copy argument numlayers - GLMessage_DataType *arg_numlayers = glmsg.add_args(); - arg_numlayers->set_isarray(false); - arg_numlayers->set_type(GLMessage::DataType::INT); - arg_numlayers->add_intvalue(numlayers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTextureViewEXT(texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleIMG); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRenderbufferStorageMultisampleIMG(target, samples, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFramebufferTexture2DMultisampleIMG); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument attachment - GLMessage_DataType *arg_attachment = glmsg.add_args(); - arg_attachment->set_isarray(false); - arg_attachment->set_type(GLMessage::DataType::ENUM); - arg_attachment->add_intvalue((int)attachment); - - // copy argument textarget - GLMessage_DataType *arg_textarget = glmsg.add_args(); - arg_textarget->set_isarray(false); - arg_textarget->set_type(GLMessage::DataType::ENUM); - arg_textarget->add_intvalue((int)textarget); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFramebufferTexture2DMultisampleIMG(target, attachment, textarget, texture, level, samples); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBeginPerfQueryINTEL(GLuint queryHandle) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBeginPerfQueryINTEL); - - // copy argument queryHandle - GLMessage_DataType *arg_queryHandle = glmsg.add_args(); - arg_queryHandle->set_isarray(false); - arg_queryHandle->set_type(GLMessage::DataType::INT); - arg_queryHandle->add_intvalue(queryHandle); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBeginPerfQueryINTEL(queryHandle); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCreatePerfQueryINTEL(GLuint queryId, GLuint * queryHandle) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCreatePerfQueryINTEL); - - // copy argument queryId - GLMessage_DataType *arg_queryId = glmsg.add_args(); - arg_queryId->set_isarray(false); - arg_queryId->set_type(GLMessage::DataType::INT); - arg_queryId->add_intvalue(queryId); - - // copy argument queryHandle - GLMessage_DataType *arg_queryHandle = glmsg.add_args(); - arg_queryHandle->set_isarray(false); - arg_queryHandle->set_type(GLMessage::DataType::INT64); - arg_queryHandle->add_int64value((uintptr_t)queryHandle); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCreatePerfQueryINTEL(queryId, queryHandle); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) queryHandle, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeletePerfQueryINTEL(GLuint queryHandle) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeletePerfQueryINTEL); - - // copy argument queryHandle - GLMessage_DataType *arg_queryHandle = glmsg.add_args(); - arg_queryHandle->set_isarray(false); - arg_queryHandle->set_type(GLMessage::DataType::INT); - arg_queryHandle->add_intvalue(queryHandle); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeletePerfQueryINTEL(queryHandle); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEndPerfQueryINTEL(GLuint queryHandle) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEndPerfQueryINTEL); - - // copy argument queryHandle - GLMessage_DataType *arg_queryHandle = glmsg.add_args(); - arg_queryHandle->set_isarray(false); - arg_queryHandle->set_type(GLMessage::DataType::INT); - arg_queryHandle->add_intvalue(queryHandle); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEndPerfQueryINTEL(queryHandle); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetFirstPerfQueryIdINTEL(GLuint * queryId) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetFirstPerfQueryIdINTEL); - - // copy argument queryId - GLMessage_DataType *arg_queryId = glmsg.add_args(); - arg_queryId->set_isarray(false); - arg_queryId->set_type(GLMessage::DataType::INT64); - arg_queryId->add_int64value((uintptr_t)queryId); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetFirstPerfQueryIdINTEL(queryId); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) queryId, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetNextPerfQueryIdINTEL(GLuint queryId, GLuint * nextQueryId) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetNextPerfQueryIdINTEL); - - // copy argument queryId - GLMessage_DataType *arg_queryId = glmsg.add_args(); - arg_queryId->set_isarray(false); - arg_queryId->set_type(GLMessage::DataType::INT); - arg_queryId->add_intvalue(queryId); - - // copy argument nextQueryId - GLMessage_DataType *arg_nextQueryId = glmsg.add_args(); - arg_nextQueryId->set_isarray(false); - arg_nextQueryId->set_type(GLMessage::DataType::INT64); - arg_nextQueryId->add_int64value((uintptr_t)nextQueryId); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetNextPerfQueryIdINTEL(queryId, nextQueryId); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) nextQueryId, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar * counterName, GLuint counterDescLength, GLchar * counterDesc, GLuint * counterOffset, GLuint * counterDataSize, GLuint * counterTypeEnum, GLuint * counterDataTypeEnum, GLuint64 * rawCounterMaxValue) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfCounterInfoINTEL); - - // copy argument queryId - GLMessage_DataType *arg_queryId = glmsg.add_args(); - arg_queryId->set_isarray(false); - arg_queryId->set_type(GLMessage::DataType::INT); - arg_queryId->add_intvalue(queryId); - - // copy argument counterId - GLMessage_DataType *arg_counterId = glmsg.add_args(); - arg_counterId->set_isarray(false); - arg_counterId->set_type(GLMessage::DataType::INT); - arg_counterId->add_intvalue(counterId); - - // copy argument counterNameLength - GLMessage_DataType *arg_counterNameLength = glmsg.add_args(); - arg_counterNameLength->set_isarray(false); - arg_counterNameLength->set_type(GLMessage::DataType::INT); - arg_counterNameLength->add_intvalue(counterNameLength); - - // copy argument counterName - GLMessage_DataType *arg_counterName = glmsg.add_args(); - arg_counterName->set_isarray(false); - arg_counterName->set_type(GLMessage::DataType::INT64); - arg_counterName->add_int64value((uintptr_t)counterName); - - // copy argument counterDescLength - GLMessage_DataType *arg_counterDescLength = glmsg.add_args(); - arg_counterDescLength->set_isarray(false); - arg_counterDescLength->set_type(GLMessage::DataType::INT); - arg_counterDescLength->add_intvalue(counterDescLength); - - // copy argument counterDesc - GLMessage_DataType *arg_counterDesc = glmsg.add_args(); - arg_counterDesc->set_isarray(false); - arg_counterDesc->set_type(GLMessage::DataType::INT64); - arg_counterDesc->add_int64value((uintptr_t)counterDesc); - - // copy argument counterOffset - GLMessage_DataType *arg_counterOffset = glmsg.add_args(); - arg_counterOffset->set_isarray(false); - arg_counterOffset->set_type(GLMessage::DataType::INT64); - arg_counterOffset->add_int64value((uintptr_t)counterOffset); - - // copy argument counterDataSize - GLMessage_DataType *arg_counterDataSize = glmsg.add_args(); - arg_counterDataSize->set_isarray(false); - arg_counterDataSize->set_type(GLMessage::DataType::INT64); - arg_counterDataSize->add_int64value((uintptr_t)counterDataSize); - - // copy argument counterTypeEnum - GLMessage_DataType *arg_counterTypeEnum = glmsg.add_args(); - arg_counterTypeEnum->set_isarray(false); - arg_counterTypeEnum->set_type(GLMessage::DataType::INT64); - arg_counterTypeEnum->add_int64value((uintptr_t)counterTypeEnum); - - // copy argument counterDataTypeEnum - GLMessage_DataType *arg_counterDataTypeEnum = glmsg.add_args(); - arg_counterDataTypeEnum->set_isarray(false); - arg_counterDataTypeEnum->set_type(GLMessage::DataType::INT64); - arg_counterDataTypeEnum->add_int64value((uintptr_t)counterDataTypeEnum); - - // copy argument rawCounterMaxValue - GLMessage_DataType *arg_rawCounterMaxValue = glmsg.add_args(); - arg_rawCounterMaxValue->set_isarray(false); - arg_rawCounterMaxValue->set_type(GLMessage::DataType::INT64); - arg_rawCounterMaxValue->add_int64value((uintptr_t)rawCounterMaxValue); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfCounterInfoINTEL(queryId, counterId, counterNameLength, counterName, counterDescLength, counterDesc, counterOffset, counterDataSize, counterTypeEnum, counterDataTypeEnum, rawCounterMaxValue); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) counterName, - (void *) counterDesc, - (void *) counterOffset, - (void *) counterDataSize, - (void *) counterTypeEnum, - (void *) counterDataTypeEnum, - (void *) rawCounterMaxValue, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid * data, GLuint * bytesWritten) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfQueryDataINTEL); - - // copy argument queryHandle - GLMessage_DataType *arg_queryHandle = glmsg.add_args(); - arg_queryHandle->set_isarray(false); - arg_queryHandle->set_type(GLMessage::DataType::INT); - arg_queryHandle->add_intvalue(queryHandle); - - // copy argument flags - GLMessage_DataType *arg_flags = glmsg.add_args(); - arg_flags->set_isarray(false); - arg_flags->set_type(GLMessage::DataType::INT); - arg_flags->add_intvalue(flags); - - // copy argument dataSize - GLMessage_DataType *arg_dataSize = glmsg.add_args(); - arg_dataSize->set_isarray(false); - arg_dataSize->set_type(GLMessage::DataType::INT); - arg_dataSize->add_intvalue(dataSize); - - // copy argument data - GLMessage_DataType *arg_data = glmsg.add_args(); - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::INT64); - arg_data->add_int64value((uintptr_t)data); - - // copy argument bytesWritten - GLMessage_DataType *arg_bytesWritten = glmsg.add_args(); - arg_bytesWritten->set_isarray(false); - arg_bytesWritten->set_type(GLMessage::DataType::INT64); - arg_bytesWritten->add_int64value((uintptr_t)bytesWritten); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfQueryDataINTEL(queryHandle, flags, dataSize, data, bytesWritten); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) data, - (void *) bytesWritten, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfQueryIdByNameINTEL(GLchar * queryName, GLuint * queryId) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfQueryIdByNameINTEL); - - // copy argument queryName - GLMessage_DataType *arg_queryName = glmsg.add_args(); - arg_queryName->set_isarray(false); - arg_queryName->set_type(GLMessage::DataType::INT64); - arg_queryName->add_int64value((uintptr_t)queryName); - - // copy argument queryId - GLMessage_DataType *arg_queryId = glmsg.add_args(); - arg_queryId->set_isarray(false); - arg_queryId->set_type(GLMessage::DataType::INT64); - arg_queryId->add_int64value((uintptr_t)queryId); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfQueryIdByNameINTEL(queryName, queryId); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) queryName, - (void *) queryId, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetPerfQueryInfoINTEL(GLuint queryId, GLuint queryNameLength, GLchar * queryName, GLuint * dataSize, GLuint * noCounters, GLuint * noInstances, GLuint * capsMask) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetPerfQueryInfoINTEL); - - // copy argument queryId - GLMessage_DataType *arg_queryId = glmsg.add_args(); - arg_queryId->set_isarray(false); - arg_queryId->set_type(GLMessage::DataType::INT); - arg_queryId->add_intvalue(queryId); - - // copy argument queryNameLength - GLMessage_DataType *arg_queryNameLength = glmsg.add_args(); - arg_queryNameLength->set_isarray(false); - arg_queryNameLength->set_type(GLMessage::DataType::INT); - arg_queryNameLength->add_intvalue(queryNameLength); - - // copy argument queryName - GLMessage_DataType *arg_queryName = glmsg.add_args(); - arg_queryName->set_isarray(false); - arg_queryName->set_type(GLMessage::DataType::INT64); - arg_queryName->add_int64value((uintptr_t)queryName); - - // copy argument dataSize - GLMessage_DataType *arg_dataSize = glmsg.add_args(); - arg_dataSize->set_isarray(false); - arg_dataSize->set_type(GLMessage::DataType::INT64); - arg_dataSize->add_int64value((uintptr_t)dataSize); - - // copy argument noCounters - GLMessage_DataType *arg_noCounters = glmsg.add_args(); - arg_noCounters->set_isarray(false); - arg_noCounters->set_type(GLMessage::DataType::INT64); - arg_noCounters->add_int64value((uintptr_t)noCounters); - - // copy argument noInstances - GLMessage_DataType *arg_noInstances = glmsg.add_args(); - arg_noInstances->set_isarray(false); - arg_noInstances->set_type(GLMessage::DataType::INT64); - arg_noInstances->add_int64value((uintptr_t)noInstances); - - // copy argument capsMask - GLMessage_DataType *arg_capsMask = glmsg.add_args(); - arg_capsMask->set_isarray(false); - arg_capsMask->set_type(GLMessage::DataType::INT64); - arg_capsMask->add_int64value((uintptr_t)capsMask); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPerfQueryInfoINTEL(queryId, queryNameLength, queryName, dataSize, noCounters, noInstances, capsMask); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) queryName, - (void *) dataSize, - (void *) noCounters, - (void *) noInstances, - (void *) capsMask, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlendParameteriNV(GLenum pname, GLint value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendParameteriNV); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendParameteriNV(pname, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlendBarrierNV(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlendBarrierNV); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendBarrierNV(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCopyBufferSubDataNV(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCopyBufferSubDataNV); - - // copy argument readTarget - GLMessage_DataType *arg_readTarget = glmsg.add_args(); - arg_readTarget->set_isarray(false); - arg_readTarget->set_type(GLMessage::DataType::ENUM); - arg_readTarget->add_intvalue((int)readTarget); - - // copy argument writeTarget - GLMessage_DataType *arg_writeTarget = glmsg.add_args(); - arg_writeTarget->set_isarray(false); - arg_writeTarget->set_type(GLMessage::DataType::ENUM); - arg_writeTarget->add_intvalue((int)writeTarget); - - // copy argument readOffset - GLMessage_DataType *arg_readOffset = glmsg.add_args(); - arg_readOffset->set_isarray(false); - arg_readOffset->set_type(GLMessage::DataType::INT); - arg_readOffset->add_intvalue(readOffset); - - // copy argument writeOffset - GLMessage_DataType *arg_writeOffset = glmsg.add_args(); - arg_writeOffset->set_isarray(false); - arg_writeOffset->set_type(GLMessage::DataType::INT); - arg_writeOffset->add_intvalue(writeOffset); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCopyBufferSubDataNV(readTarget, writeTarget, readOffset, writeOffset, size); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCoverageMaskNV(GLboolean mask) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCoverageMaskNV); - - // copy argument mask - GLMessage_DataType *arg_mask = glmsg.add_args(); - arg_mask->set_isarray(false); - arg_mask->set_type(GLMessage::DataType::BOOL); - arg_mask->add_boolvalue(mask); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCoverageMaskNV(mask); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glCoverageOperationNV(GLenum operation) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glCoverageOperationNV); - - // copy argument operation - GLMessage_DataType *arg_operation = glmsg.add_args(); - arg_operation->set_isarray(false); - arg_operation->set_type(GLMessage::DataType::ENUM); - arg_operation->add_intvalue((int)operation); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glCoverageOperationNV(operation); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawBuffersNV(GLsizei n, const GLenum * bufs) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawBuffersNV); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument bufs - GLMessage_DataType *arg_bufs = glmsg.add_args(); - arg_bufs->set_isarray(false); - arg_bufs->set_type(GLMessage::DataType::INT64); - arg_bufs->add_int64value((uintptr_t)bufs); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawBuffersNV(n, bufs); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) bufs, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawArraysInstancedNV(GLenum mode, GLint first, GLsizei count, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawArraysInstancedNV); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument first - GLMessage_DataType *arg_first = glmsg.add_args(); - arg_first->set_isarray(false); - arg_first->set_type(GLMessage::DataType::INT); - arg_first->add_intvalue(first); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawArraysInstancedNV(mode, first, count, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDrawElementsInstancedNV(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDrawElementsInstancedNV); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument indices - GLMessage_DataType *arg_indices = glmsg.add_args(); - arg_indices->set_isarray(false); - arg_indices->set_type(GLMessage::DataType::INT64); - arg_indices->add_int64value((uintptr_t)indices); - - // copy argument primcount - GLMessage_DataType *arg_primcount = glmsg.add_args(); - arg_primcount->set_isarray(false); - arg_primcount->set_type(GLMessage::DataType::INT); - arg_primcount->add_intvalue(primcount); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDrawElementsInstancedNV(mode, count, type, indices, primcount); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) indices, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint * fences) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDeleteFencesNV); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument fences - GLMessage_DataType *arg_fences = glmsg.add_args(); - arg_fences->set_isarray(false); - arg_fences->set_type(GLMessage::DataType::INT64); - arg_fences->add_int64value((uintptr_t)fences); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDeleteFencesNV(n, fences); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) fences, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGenFencesNV(GLsizei n, GLuint * fences) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGenFencesNV); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument fences - GLMessage_DataType *arg_fences = glmsg.add_args(); - arg_fences->set_isarray(false); - arg_fences->set_type(GLMessage::DataType::INT64); - arg_fences->add_int64value((uintptr_t)fences); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGenFencesNV(n, fences); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) fences, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glIsFenceNV(GLuint fence) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glIsFenceNV); - - // copy argument fence - GLMessage_DataType *arg_fence = glmsg.add_args(); - arg_fence->set_isarray(false); - arg_fence->set_type(GLMessage::DataType::INT); - arg_fence->add_intvalue(fence); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glIsFenceNV(fence); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -GLboolean GLTrace_glTestFenceNV(GLuint fence) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTestFenceNV); - - // copy argument fence - GLMessage_DataType *arg_fence = glmsg.add_args(); - arg_fence->set_isarray(false); - arg_fence->set_type(GLMessage::DataType::INT); - arg_fence->add_intvalue(fence); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glTestFenceNV(fence); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetFenceivNV); - - // copy argument fence - GLMessage_DataType *arg_fence = glmsg.add_args(); - arg_fence->set_isarray(false); - arg_fence->set_type(GLMessage::DataType::INT); - arg_fence->add_intvalue(fence); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetFenceivNV(fence, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFinishFenceNV(GLuint fence) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFinishFenceNV); - - // copy argument fence - GLMessage_DataType *arg_fence = glmsg.add_args(); - arg_fence->set_isarray(false); - arg_fence->set_type(GLMessage::DataType::INT); - arg_fence->add_intvalue(fence); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFinishFenceNV(fence); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glSetFenceNV(GLuint fence, GLenum condition) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glSetFenceNV); - - // copy argument fence - GLMessage_DataType *arg_fence = glmsg.add_args(); - arg_fence->set_isarray(false); - arg_fence->set_type(GLMessage::DataType::INT); - arg_fence->add_intvalue(fence); - - // copy argument condition - GLMessage_DataType *arg_condition = glmsg.add_args(); - arg_condition->set_isarray(false); - arg_condition->set_type(GLMessage::DataType::ENUM); - arg_condition->add_intvalue((int)condition); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSetFenceNV(fence, condition); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glBlitFramebufferNV(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glBlitFramebufferNV); - - // copy argument srcX0 - GLMessage_DataType *arg_srcX0 = glmsg.add_args(); - arg_srcX0->set_isarray(false); - arg_srcX0->set_type(GLMessage::DataType::INT); - arg_srcX0->add_intvalue(srcX0); - - // copy argument srcY0 - GLMessage_DataType *arg_srcY0 = glmsg.add_args(); - arg_srcY0->set_isarray(false); - arg_srcY0->set_type(GLMessage::DataType::INT); - arg_srcY0->add_intvalue(srcY0); - - // copy argument srcX1 - GLMessage_DataType *arg_srcX1 = glmsg.add_args(); - arg_srcX1->set_isarray(false); - arg_srcX1->set_type(GLMessage::DataType::INT); - arg_srcX1->add_intvalue(srcX1); - - // copy argument srcY1 - GLMessage_DataType *arg_srcY1 = glmsg.add_args(); - arg_srcY1->set_isarray(false); - arg_srcY1->set_type(GLMessage::DataType::INT); - arg_srcY1->add_intvalue(srcY1); - - // copy argument dstX0 - GLMessage_DataType *arg_dstX0 = glmsg.add_args(); - arg_dstX0->set_isarray(false); - arg_dstX0->set_type(GLMessage::DataType::INT); - arg_dstX0->add_intvalue(dstX0); - - // copy argument dstY0 - GLMessage_DataType *arg_dstY0 = glmsg.add_args(); - arg_dstY0->set_isarray(false); - arg_dstY0->set_type(GLMessage::DataType::INT); - arg_dstY0->add_intvalue(dstY0); - - // copy argument dstX1 - GLMessage_DataType *arg_dstX1 = glmsg.add_args(); - arg_dstX1->set_isarray(false); - arg_dstX1->set_type(GLMessage::DataType::INT); - arg_dstX1->add_intvalue(dstX1); - - // copy argument dstY1 - GLMessage_DataType *arg_dstY1 = glmsg.add_args(); - arg_dstY1->set_isarray(false); - arg_dstY1->set_type(GLMessage::DataType::INT); - arg_dstY1->add_intvalue(dstY1); - - // copy argument mask - GLMessage_DataType *arg_mask = glmsg.add_args(); - arg_mask->set_isarray(false); - arg_mask->set_type(GLMessage::DataType::INT); - arg_mask->add_intvalue(mask); - - // copy argument filter - GLMessage_DataType *arg_filter = glmsg.add_args(); - arg_filter->set_isarray(false); - arg_filter->set_type(GLMessage::DataType::ENUM); - arg_filter->add_intvalue((int)filter); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlitFramebufferNV(srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glRenderbufferStorageMultisampleNV(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glRenderbufferStorageMultisampleNV); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument samples - GLMessage_DataType *arg_samples = glmsg.add_args(); - arg_samples->set_isarray(false); - arg_samples->set_type(GLMessage::DataType::INT); - arg_samples->add_intvalue(samples); - - // copy argument internalformat - GLMessage_DataType *arg_internalformat = glmsg.add_args(); - arg_internalformat->set_isarray(false); - arg_internalformat->set_type(GLMessage::DataType::ENUM); - arg_internalformat->add_intvalue((int)internalformat); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRenderbufferStorageMultisampleNV(target, samples, internalformat, width, height); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glVertexAttribDivisorNV(GLuint index, GLuint divisor) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glVertexAttribDivisorNV); - - // copy argument index - GLMessage_DataType *arg_index = glmsg.add_args(); - arg_index->set_isarray(false); - arg_index->set_type(GLMessage::DataType::INT); - arg_index->add_intvalue(index); - - // copy argument divisor - GLMessage_DataType *arg_divisor = glmsg.add_args(); - arg_divisor->set_isarray(false); - arg_divisor->set_type(GLMessage::DataType::INT); - arg_divisor->add_intvalue(divisor); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexAttribDivisorNV(index, divisor); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUniformMatrix2x3fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUniformMatrix2x3fvNV); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix2x3fvNV(location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUniformMatrix3x2fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUniformMatrix3x2fvNV); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix3x2fvNV(location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUniformMatrix2x4fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUniformMatrix2x4fvNV); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix2x4fvNV(location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUniformMatrix4x2fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUniformMatrix4x2fvNV); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix4x2fvNV(location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUniformMatrix3x4fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUniformMatrix3x4fvNV); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix3x4fvNV(location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glUniformMatrix4x3fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glUniformMatrix4x3fvNV); - - // copy argument location - GLMessage_DataType *arg_location = glmsg.add_args(); - arg_location->set_isarray(false); - arg_location->set_type(GLMessage::DataType::INT); - arg_location->add_intvalue(location); - - // copy argument count - GLMessage_DataType *arg_count = glmsg.add_args(); - arg_count->set_isarray(false); - arg_count->set_type(GLMessage::DataType::INT); - arg_count->add_intvalue(count); - - // copy argument transpose - GLMessage_DataType *arg_transpose = glmsg.add_args(); - arg_transpose->set_isarray(false); - arg_transpose->set_type(GLMessage::DataType::BOOL); - arg_transpose->add_boolvalue(transpose); - - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT64); - arg_value->add_int64value((uintptr_t)value); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glUniformMatrix4x3fvNV(location, count, transpose, value); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) value, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glReadBufferNV(GLenum mode) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glReadBufferNV); - - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glReadBufferNV(mode); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glAlphaFuncQCOM(GLenum func, GLclampf ref) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glAlphaFuncQCOM); - - // copy argument func - GLMessage_DataType *arg_func = glmsg.add_args(); - arg_func->set_isarray(false); - arg_func->set_type(GLMessage::DataType::ENUM); - arg_func->add_intvalue((int)func); - - // copy argument ref - GLMessage_DataType *arg_ref = glmsg.add_args(); - arg_ref->set_isarray(false); - arg_ref->set_type(GLMessage::DataType::FLOAT); - arg_ref->add_floatvalue(ref); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glAlphaFuncQCOM(func, ref); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetDriverControlsQCOM(GLint * num, GLsizei size, GLuint * driverControls) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetDriverControlsQCOM); - - // copy argument num - GLMessage_DataType *arg_num = glmsg.add_args(); - arg_num->set_isarray(false); - arg_num->set_type(GLMessage::DataType::INT64); - arg_num->add_int64value((uintptr_t)num); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument driverControls - GLMessage_DataType *arg_driverControls = glmsg.add_args(); - arg_driverControls->set_isarray(false); - arg_driverControls->set_type(GLMessage::DataType::INT64); - arg_driverControls->add_int64value((uintptr_t)driverControls); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetDriverControlsQCOM(num, size, driverControls); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) num, - (void *) driverControls, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei * length, GLchar * driverControlString) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetDriverControlStringQCOM); - - // copy argument driverControl - GLMessage_DataType *arg_driverControl = glmsg.add_args(); - arg_driverControl->set_isarray(false); - arg_driverControl->set_type(GLMessage::DataType::INT); - arg_driverControl->add_intvalue(driverControl); - - // copy argument bufSize - GLMessage_DataType *arg_bufSize = glmsg.add_args(); - arg_bufSize->set_isarray(false); - arg_bufSize->set_type(GLMessage::DataType::INT); - arg_bufSize->add_intvalue(bufSize); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // copy argument driverControlString - GLMessage_DataType *arg_driverControlString = glmsg.add_args(); - arg_driverControlString->set_isarray(false); - arg_driverControlString->set_type(GLMessage::DataType::INT64); - arg_driverControlString->add_int64value((uintptr_t)driverControlString); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetDriverControlStringQCOM(driverControl, bufSize, length, driverControlString); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) length, - (void *) driverControlString, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEnableDriverControlQCOM(GLuint driverControl) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEnableDriverControlQCOM); - - // copy argument driverControl - GLMessage_DataType *arg_driverControl = glmsg.add_args(); - arg_driverControl->set_isarray(false); - arg_driverControl->set_type(GLMessage::DataType::INT); - arg_driverControl->add_intvalue(driverControl); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEnableDriverControlQCOM(driverControl); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glDisableDriverControlQCOM(GLuint driverControl) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glDisableDriverControlQCOM); - - // copy argument driverControl - GLMessage_DataType *arg_driverControl = glmsg.add_args(); - arg_driverControl->set_isarray(false); - arg_driverControl->set_type(GLMessage::DataType::INT); - arg_driverControl->add_intvalue(driverControl); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDisableDriverControlQCOM(driverControl); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetTexturesQCOM(GLuint * textures, GLint maxTextures, GLint * numTextures) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetTexturesQCOM); - - // copy argument textures - GLMessage_DataType *arg_textures = glmsg.add_args(); - arg_textures->set_isarray(false); - arg_textures->set_type(GLMessage::DataType::INT64); - arg_textures->add_int64value((uintptr_t)textures); - - // copy argument maxTextures - GLMessage_DataType *arg_maxTextures = glmsg.add_args(); - arg_maxTextures->set_isarray(false); - arg_maxTextures->set_type(GLMessage::DataType::INT); - arg_maxTextures->add_intvalue(maxTextures); - - // copy argument numTextures - GLMessage_DataType *arg_numTextures = glmsg.add_args(); - arg_numTextures->set_isarray(false); - arg_numTextures->set_type(GLMessage::DataType::INT64); - arg_numTextures->add_int64value((uintptr_t)numTextures); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetTexturesQCOM(textures, maxTextures, numTextures); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) textures, - (void *) numTextures, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetBuffersQCOM(GLuint * buffers, GLint maxBuffers, GLint * numBuffers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetBuffersQCOM); - - // copy argument buffers - GLMessage_DataType *arg_buffers = glmsg.add_args(); - arg_buffers->set_isarray(false); - arg_buffers->set_type(GLMessage::DataType::INT64); - arg_buffers->add_int64value((uintptr_t)buffers); - - // copy argument maxBuffers - GLMessage_DataType *arg_maxBuffers = glmsg.add_args(); - arg_maxBuffers->set_isarray(false); - arg_maxBuffers->set_type(GLMessage::DataType::INT); - arg_maxBuffers->add_intvalue(maxBuffers); - - // copy argument numBuffers - GLMessage_DataType *arg_numBuffers = glmsg.add_args(); - arg_numBuffers->set_isarray(false); - arg_numBuffers->set_type(GLMessage::DataType::INT64); - arg_numBuffers->add_int64value((uintptr_t)numBuffers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetBuffersQCOM(buffers, maxBuffers, numBuffers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) buffers, - (void *) numBuffers, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetRenderbuffersQCOM(GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetRenderbuffersQCOM); - - // copy argument renderbuffers - GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); - arg_renderbuffers->set_isarray(false); - arg_renderbuffers->set_type(GLMessage::DataType::INT64); - arg_renderbuffers->add_int64value((uintptr_t)renderbuffers); - - // copy argument maxRenderbuffers - GLMessage_DataType *arg_maxRenderbuffers = glmsg.add_args(); - arg_maxRenderbuffers->set_isarray(false); - arg_maxRenderbuffers->set_type(GLMessage::DataType::INT); - arg_maxRenderbuffers->add_intvalue(maxRenderbuffers); - - // copy argument numRenderbuffers - GLMessage_DataType *arg_numRenderbuffers = glmsg.add_args(); - arg_numRenderbuffers->set_isarray(false); - arg_numRenderbuffers->set_type(GLMessage::DataType::INT64); - arg_numRenderbuffers->add_int64value((uintptr_t)numRenderbuffers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetRenderbuffersQCOM(renderbuffers, maxRenderbuffers, numRenderbuffers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) renderbuffers, - (void *) numRenderbuffers, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetFramebuffersQCOM(GLuint * framebuffers, GLint maxFramebuffers, GLint * numFramebuffers) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetFramebuffersQCOM); - - // copy argument framebuffers - GLMessage_DataType *arg_framebuffers = glmsg.add_args(); - arg_framebuffers->set_isarray(false); - arg_framebuffers->set_type(GLMessage::DataType::INT64); - arg_framebuffers->add_int64value((uintptr_t)framebuffers); - - // copy argument maxFramebuffers - GLMessage_DataType *arg_maxFramebuffers = glmsg.add_args(); - arg_maxFramebuffers->set_isarray(false); - arg_maxFramebuffers->set_type(GLMessage::DataType::INT); - arg_maxFramebuffers->add_intvalue(maxFramebuffers); - - // copy argument numFramebuffers - GLMessage_DataType *arg_numFramebuffers = glmsg.add_args(); - arg_numFramebuffers->set_isarray(false); - arg_numFramebuffers->set_type(GLMessage::DataType::INT64); - arg_numFramebuffers->add_int64value((uintptr_t)numFramebuffers); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetFramebuffersQCOM(framebuffers, maxFramebuffers, numFramebuffers); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) framebuffers, - (void *) numFramebuffers, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetTexLevelParameterivQCOM); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::INT); - arg_texture->add_intvalue(texture); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetTexLevelParameterivQCOM(texture, face, level, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtTexObjectStateOverrideiQCOM); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtTexObjectStateOverrideiQCOM(target, pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void * texels) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetTexSubImageQCOM); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument level - GLMessage_DataType *arg_level = glmsg.add_args(); - arg_level->set_isarray(false); - arg_level->set_type(GLMessage::DataType::INT); - arg_level->add_intvalue(level); - - // copy argument xoffset - GLMessage_DataType *arg_xoffset = glmsg.add_args(); - arg_xoffset->set_isarray(false); - arg_xoffset->set_type(GLMessage::DataType::INT); - arg_xoffset->add_intvalue(xoffset); - - // copy argument yoffset - GLMessage_DataType *arg_yoffset = glmsg.add_args(); - arg_yoffset->set_isarray(false); - arg_yoffset->set_type(GLMessage::DataType::INT); - arg_yoffset->add_intvalue(yoffset); - - // copy argument zoffset - GLMessage_DataType *arg_zoffset = glmsg.add_args(); - arg_zoffset->set_isarray(false); - arg_zoffset->set_type(GLMessage::DataType::INT); - arg_zoffset->add_intvalue(zoffset); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); - - // copy argument format - GLMessage_DataType *arg_format = glmsg.add_args(); - arg_format->set_isarray(false); - arg_format->set_type(GLMessage::DataType::ENUM); - arg_format->add_intvalue((int)format); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument texels - GLMessage_DataType *arg_texels = glmsg.add_args(); - arg_texels->set_isarray(false); - arg_texels->set_type(GLMessage::DataType::INT64); - arg_texels->add_int64value((uintptr_t)texels); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetTexSubImageQCOM(target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) texels, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetBufferPointervQCOM(GLenum target, void ** params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetBufferPointervQCOM); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetBufferPointervQCOM(target, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetShadersQCOM(GLuint * shaders, GLint maxShaders, GLint * numShaders) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetShadersQCOM); - - // copy argument shaders - GLMessage_DataType *arg_shaders = glmsg.add_args(); - arg_shaders->set_isarray(false); - arg_shaders->set_type(GLMessage::DataType::INT64); - arg_shaders->add_int64value((uintptr_t)shaders); - - // copy argument maxShaders - GLMessage_DataType *arg_maxShaders = glmsg.add_args(); - arg_maxShaders->set_isarray(false); - arg_maxShaders->set_type(GLMessage::DataType::INT); - arg_maxShaders->add_intvalue(maxShaders); - - // copy argument numShaders - GLMessage_DataType *arg_numShaders = glmsg.add_args(); - arg_numShaders->set_isarray(false); - arg_numShaders->set_type(GLMessage::DataType::INT64); - arg_numShaders->add_int64value((uintptr_t)numShaders); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetShadersQCOM(shaders, maxShaders, numShaders); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) shaders, - (void *) numShaders, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glExtGetProgramsQCOM(GLuint * programs, GLint maxPrograms, GLint * numPrograms) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetProgramsQCOM); - - // copy argument programs - GLMessage_DataType *arg_programs = glmsg.add_args(); - arg_programs->set_isarray(false); - arg_programs->set_type(GLMessage::DataType::INT64); - arg_programs->add_int64value((uintptr_t)programs); - - // copy argument maxPrograms - GLMessage_DataType *arg_maxPrograms = glmsg.add_args(); - arg_maxPrograms->set_isarray(false); - arg_maxPrograms->set_type(GLMessage::DataType::INT); - arg_maxPrograms->add_intvalue(maxPrograms); - - // copy argument numPrograms - GLMessage_DataType *arg_numPrograms = glmsg.add_args(); - arg_numPrograms->set_isarray(false); - arg_numPrograms->set_type(GLMessage::DataType::INT64); - arg_numPrograms->add_int64value((uintptr_t)numPrograms); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetProgramsQCOM(programs, maxPrograms, numPrograms); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) programs, - (void *) numPrograms, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtIsProgramBinaryQCOM); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - GLboolean retValue = glContext->hooks->gl.glExtIsProgramBinaryQCOM(program); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - // set return value - GLMessage_DataType *rt = glmsg.mutable_returnvalue(); - rt->set_isarray(false); - rt->set_type(GLMessage::DataType::BOOL); - rt->add_boolvalue(retValue); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); - - return retValue; -} - -void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar * source, GLint * length) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glExtGetProgramBinarySourceQCOM); - - // copy argument program - GLMessage_DataType *arg_program = glmsg.add_args(); - arg_program->set_isarray(false); - arg_program->set_type(GLMessage::DataType::INT); - arg_program->add_intvalue(program); - - // copy argument shadertype - GLMessage_DataType *arg_shadertype = glmsg.add_args(); - arg_shadertype->set_isarray(false); - arg_shadertype->set_type(GLMessage::DataType::ENUM); - arg_shadertype->add_intvalue((int)shadertype); - - // copy argument source - GLMessage_DataType *arg_source = glmsg.add_args(); - arg_source->set_isarray(false); - arg_source->set_type(GLMessage::DataType::INT64); - arg_source->add_int64value((uintptr_t)source); - - // copy argument length - GLMessage_DataType *arg_length = glmsg.add_args(); - arg_length->set_isarray(false); - arg_length->set_type(GLMessage::DataType::INT64); - arg_length->add_int64value((uintptr_t)length); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glExtGetProgramBinarySourceQCOM(program, shadertype, source, length); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) source, - (void *) length, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glStartTilingQCOM); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); - - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); - - // copy argument height - GLMessage_DataType *arg_height = glmsg.add_args(); - arg_height->set_isarray(false); - arg_height->set_type(GLMessage::DataType::INT); - arg_height->add_intvalue(height); - - // copy argument preserveMask - GLMessage_DataType *arg_preserveMask = glmsg.add_args(); - arg_preserveMask->set_isarray(false); - arg_preserveMask->set_type(GLMessage::DataType::INT); - arg_preserveMask->add_intvalue(preserveMask); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glStartTilingQCOM(x, y, width, height, preserveMask); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glEndTilingQCOM(GLbitfield preserveMask) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glEndTilingQCOM); - - // copy argument preserveMask - GLMessage_DataType *arg_preserveMask = glmsg.add_args(); - arg_preserveMask->set_isarray(false); - arg_preserveMask->set_type(GLMessage::DataType::INT); - arg_preserveMask->add_intvalue(preserveMask); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEndTilingQCOM(preserveMask); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - - -// Definitions for GL1 APIs - -void GLTrace_glAlphaFunc(GLenum func, GLfloat ref) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glAlphaFunc); - - // copy argument func - GLMessage_DataType *arg_func = glmsg.add_args(); - arg_func->set_isarray(false); - arg_func->set_type(GLMessage::DataType::ENUM); - arg_func->add_intvalue((int)func); - - // copy argument ref - GLMessage_DataType *arg_ref = glmsg.add_args(); - arg_ref->set_isarray(false); - arg_ref->set_type(GLMessage::DataType::FLOAT); - arg_ref->add_floatvalue(ref); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glAlphaFunc(func, ref); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glClipPlanef(GLenum p, const GLfloat * eqn) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glClipPlanef); - - // copy argument p - GLMessage_DataType *arg_p = glmsg.add_args(); - arg_p->set_isarray(false); - arg_p->set_type(GLMessage::DataType::ENUM); - arg_p->add_intvalue((int)p); - - // copy argument eqn - GLMessage_DataType *arg_eqn = glmsg.add_args(); - arg_eqn->set_isarray(false); - arg_eqn->set_type(GLMessage::DataType::INT64); - arg_eqn->add_int64value((uintptr_t)eqn); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClipPlanef(p, eqn); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) eqn, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glColor4f); - - // copy argument red - GLMessage_DataType *arg_red = glmsg.add_args(); - arg_red->set_isarray(false); - arg_red->set_type(GLMessage::DataType::FLOAT); - arg_red->add_floatvalue(red); - - // copy argument green - GLMessage_DataType *arg_green = glmsg.add_args(); - arg_green->set_isarray(false); - arg_green->set_type(GLMessage::DataType::FLOAT); - arg_green->add_floatvalue(green); - - // copy argument blue - GLMessage_DataType *arg_blue = glmsg.add_args(); - arg_blue->set_isarray(false); - arg_blue->set_type(GLMessage::DataType::FLOAT); - arg_blue->add_floatvalue(blue); - - // copy argument alpha - GLMessage_DataType *arg_alpha = glmsg.add_args(); - arg_alpha->set_isarray(false); - arg_alpha->set_type(GLMessage::DataType::FLOAT); - arg_alpha->add_floatvalue(alpha); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glColor4f(red, green, blue, alpha); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFogf(GLenum pname, GLfloat param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFogf); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFogf(pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFogfv(GLenum pname, const GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFogfv); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFogfv(pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFrustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFrustumf); - - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::FLOAT); - arg_l->add_floatvalue(l); - - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::FLOAT); - arg_r->add_floatvalue(r); - - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::FLOAT); - arg_b->add_floatvalue(b); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::FLOAT); - arg_t->add_floatvalue(t); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::FLOAT); - arg_n->add_floatvalue(n); - - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::FLOAT); - arg_f->add_floatvalue(f); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFrustumf(l, r, b, t, n, f); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetClipPlanef(GLenum plane, GLfloat * equation) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetClipPlanef); - - // copy argument plane - GLMessage_DataType *arg_plane = glmsg.add_args(); - arg_plane->set_isarray(false); - arg_plane->set_type(GLMessage::DataType::ENUM); - arg_plane->add_intvalue((int)plane); - - // copy argument equation - GLMessage_DataType *arg_equation = glmsg.add_args(); - arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetClipPlanef(plane, equation); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) equation, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetLightfv); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetLightfv(light, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetMaterialfv); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetMaterialfv(face, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTexEnvfv); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexEnvfv(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLightModelf(GLenum pname, GLfloat param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLightModelf); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightModelf(pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLightModelfv(GLenum pname, const GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLightModelfv); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightModelfv(pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLightf); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightf(light, pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLightfv); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightfv(light, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLoadMatrixf(const GLfloat * m) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLoadMatrixf); - - // copy argument m - GLMessage_DataType *arg_m = glmsg.add_args(); - arg_m->set_isarray(false); - arg_m->set_type(GLMessage::DataType::INT64); - arg_m->add_int64value((uintptr_t)m); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLoadMatrixf(m); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) m, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMaterialf); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMaterialf(face, pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMaterialfv); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMaterialfv(face, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMultMatrixf(const GLfloat * m) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMultMatrixf); - - // copy argument m - GLMessage_DataType *arg_m = glmsg.add_args(); - arg_m->set_isarray(false); - arg_m->set_type(GLMessage::DataType::INT64); - arg_m->add_int64value((uintptr_t)m); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultMatrixf(m); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) m, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMultiTexCoord4f); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::FLOAT); - arg_s->add_floatvalue(s); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::FLOAT); - arg_t->add_floatvalue(t); - - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::FLOAT); - arg_r->add_floatvalue(r); - - // copy argument q - GLMessage_DataType *arg_q = glmsg.add_args(); - arg_q->set_isarray(false); - arg_q->set_type(GLMessage::DataType::FLOAT); - arg_q->add_floatvalue(q); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord4f(target, s, t, r, q); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glNormal3f); - - // copy argument nx - GLMessage_DataType *arg_nx = glmsg.add_args(); - arg_nx->set_isarray(false); - arg_nx->set_type(GLMessage::DataType::FLOAT); - arg_nx->add_floatvalue(nx); - - // copy argument ny - GLMessage_DataType *arg_ny = glmsg.add_args(); - arg_ny->set_isarray(false); - arg_ny->set_type(GLMessage::DataType::FLOAT); - arg_ny->add_floatvalue(ny); - - // copy argument nz - GLMessage_DataType *arg_nz = glmsg.add_args(); - arg_nz->set_isarray(false); - arg_nz->set_type(GLMessage::DataType::FLOAT); - arg_nz->add_floatvalue(nz); + // copy argument source + GLMessage_DataType *arg_source = glmsg.add_args(); + arg_source->set_isarray(false); + arg_source->set_type(GLMessage::DataType::INT); + arg_source->add_intvalue((int)source); + + // copy argument length + GLMessage_DataType *arg_length = glmsg.add_args(); + arg_length->set_isarray(false); + arg_length->set_type(GLMessage::DataType::INT); + arg_length->add_intvalue((int)length); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glNormal3f(nx, ny, nz); + glContext->hooks->gl.glExtGetProgramBinarySourceQCOM(program, shadertype, source, length); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) source, + (void *) length, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24246,52 +11080,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glOrthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { +void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glOrthof); - - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::FLOAT); - arg_l->add_floatvalue(l); + glmsg.set_function(GLMessage::glStartTilingQCOM); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::FLOAT); - arg_r->add_floatvalue(r); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::FLOAT); - arg_b->add_floatvalue(b); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::FLOAT); - arg_t->add_floatvalue(t); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::FLOAT); - arg_n->add_floatvalue(n); + // copy argument height + GLMessage_DataType *arg_height = glmsg.add_args(); + arg_height->set_isarray(false); + arg_height->set_type(GLMessage::DataType::INT); + arg_height->add_intvalue(height); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::FLOAT); - arg_f->add_floatvalue(f); + // copy argument preserveMask + GLMessage_DataType *arg_preserveMask = glmsg.add_args(); + arg_preserveMask->set_isarray(false); + arg_preserveMask->set_type(GLMessage::DataType::INT); + arg_preserveMask->add_intvalue(preserveMask); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glOrthof(l, r, b, t, n, f); + glContext->hooks->gl.glStartTilingQCOM(x, y, width, height, preserveMask); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24304,28 +11132,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointParameterf(GLenum pname, GLfloat param) { +void GLTrace_glEndTilingQCOM(GLbitfield preserveMask) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointParameterf); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glEndTilingQCOM); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); + // copy argument preserveMask + GLMessage_DataType *arg_preserveMask = glmsg.add_args(); + arg_preserveMask->set_isarray(false); + arg_preserveMask->set_type(GLMessage::DataType::INT); + arg_preserveMask->add_intvalue(preserveMask); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointParameterf(pname, param); + glContext->hooks->gl.glEndTilingQCOM(preserveMask); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24338,33 +11160,35 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointParameterfv(GLenum pname, const GLfloat * params) { + +// Definitions for GL1 APIs + +void GLTrace_glAlphaFunc(GLenum func, GLclampf ref) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointParameterfv); + glmsg.set_function(GLMessage::glAlphaFunc); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::FLOAT); + arg_ref->add_floatvalue(ref); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointParameterfv(pname, params); + glContext->hooks->gl.glAlphaFunc(func, ref); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24373,26 +11197,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointSize(GLfloat size) { +void GLTrace_glClipPlanef(GLenum plane, const GLfloat *equation) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointSize); + glmsg.set_function(GLMessage::glClipPlanef); - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::FLOAT); - arg_size->add_floatvalue(size); + // copy argument plane + GLMessage_DataType *arg_plane = glmsg.add_args(); + arg_plane->set_isarray(false); + arg_plane->set_type(GLMessage::DataType::ENUM); + arg_plane->add_intvalue((int)plane); + + // copy argument equation + GLMessage_DataType *arg_equation = glmsg.add_args(); + arg_equation->set_isarray(false); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointSize(size); + glContext->hooks->gl.glClipPlanef(plane, equation); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) equation, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24401,40 +11232,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { +void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glRotatef); + glmsg.set_function(GLMessage::glColor4f); - // copy argument angle - GLMessage_DataType *arg_angle = glmsg.add_args(); - arg_angle->set_isarray(false); - arg_angle->set_type(GLMessage::DataType::FLOAT); - arg_angle->add_floatvalue(angle); + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::FLOAT); + arg_red->add_floatvalue(red); - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::FLOAT); - arg_x->add_floatvalue(x); + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::FLOAT); + arg_green->add_floatvalue(green); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::FLOAT); - arg_y->add_floatvalue(y); + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::FLOAT); + arg_blue->add_floatvalue(blue); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::FLOAT); - arg_z->add_floatvalue(z); + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::FLOAT); + arg_alpha->add_floatvalue(alpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRotatef(angle, x, y, z); + glContext->hooks->gl.glColor4f(red, green, blue, alpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24447,34 +11278,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z) { +void GLTrace_glFogf(GLenum pname, GLfloat param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glScalef); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::FLOAT); - arg_x->add_floatvalue(x); + glmsg.set_function(GLMessage::glFogf); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::FLOAT); - arg_y->add_floatvalue(y); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::FLOAT); - arg_z->add_floatvalue(z); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glScalef(x, y, z); + glContext->hooks->gl.glFogf(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24487,17 +11312,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param) { +void GLTrace_glFogfv(GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvf); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + glmsg.set_function(GLMessage::glFogfv); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -24505,20 +11324,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::FLOAT); - arg_param->add_floatvalue(param); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvf(target, pname, param); + glContext->hooks->gl.glFogfv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24527,39 +11347,56 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params) { +void GLTrace_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvfv); + glmsg.set_function(GLMessage::glFrustumf); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvfv(target, pname, params); + glContext->hooks->gl.glFrustumf(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24568,38 +11405,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z) { +void GLTrace_glGetClipPlanef(GLenum pname, GLfloat eqn[4]) { GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glTranslatef); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::FLOAT); - arg_x->add_floatvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::FLOAT); - arg_y->add_floatvalue(y); + GLTraceContext *glContext = getGLTraceContext(); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::FLOAT); - arg_z->add_floatvalue(z); + glmsg.set_function(GLMessage::glGetClipPlanef); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTranslatef(x, y, z); + glContext->hooks->gl.glGetClipPlanef(pname, eqn); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) eqn, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24608,32 +11440,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glAlphaFuncx(GLenum func, GLfixed ref) { +void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glAlphaFuncx); + glmsg.set_function(GLMessage::glGetLightfv); - // copy argument func - GLMessage_DataType *arg_func = glmsg.add_args(); - arg_func->set_isarray(false); - arg_func->set_type(GLMessage::DataType::ENUM); - arg_func->add_intvalue((int)func); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); - // copy argument ref - GLMessage_DataType *arg_ref = glmsg.add_args(); - arg_ref->set_isarray(false); - arg_ref->set_type(GLMessage::DataType::INT); - arg_ref->add_intvalue(ref); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glAlphaFuncx(func, ref); + glContext->hooks->gl.glGetLightfv(light, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24642,44 +11481,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { +void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearColorx); - - // copy argument red - GLMessage_DataType *arg_red = glmsg.add_args(); - arg_red->set_isarray(false); - arg_red->set_type(GLMessage::DataType::INT); - arg_red->add_intvalue(red); + glmsg.set_function(GLMessage::glGetMaterialfv); - // copy argument green - GLMessage_DataType *arg_green = glmsg.add_args(); - arg_green->set_isarray(false); - arg_green->set_type(GLMessage::DataType::INT); - arg_green->add_intvalue(green); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); - // copy argument blue - GLMessage_DataType *arg_blue = glmsg.add_args(); - arg_blue->set_isarray(false); - arg_blue->set_type(GLMessage::DataType::INT); - arg_blue->add_intvalue(blue); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument alpha - GLMessage_DataType *arg_alpha = glmsg.add_args(); - arg_alpha->set_isarray(false); - arg_alpha->set_type(GLMessage::DataType::INT); - arg_alpha->add_intvalue(alpha); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearColorx(red, green, blue, alpha); + glContext->hooks->gl.glGetMaterialfv(face, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24688,26 +11522,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearDepthx(GLfixed depth) { +void GLTrace_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearDepthx); + glmsg.set_function(GLMessage::glGetTexEnvfv); - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::INT); - arg_depth->add_intvalue(depth); + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearDepthx(depth); + glContext->hooks->gl.glGetTexEnvfv(env, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24716,22 +11563,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClientActiveTexture(GLenum texture) { +void GLTrace_glLightModelf(GLenum pname, GLfloat param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClientActiveTexture); + glmsg.set_function(GLMessage::glLightModelf); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClientActiveTexture(texture); + glContext->hooks->gl.glLightModelf(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24744,33 +11597,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClipPlanex(GLenum plane, const GLfixed * equation) { +void GLTrace_glLightModelfv(GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClipPlanex); + glmsg.set_function(GLMessage::glLightModelfv); - // copy argument plane - GLMessage_DataType *arg_plane = glmsg.add_args(); - arg_plane->set_isarray(false); - arg_plane->set_type(GLMessage::DataType::ENUM); - arg_plane->add_intvalue((int)plane); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument equation - GLMessage_DataType *arg_equation = glmsg.add_args(); - arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClipPlanex(plane, equation); + glContext->hooks->gl.glLightModelfv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) equation, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24779,40 +11632,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { +void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glColor4ub); - - // copy argument red - GLMessage_DataType *arg_red = glmsg.add_args(); - arg_red->set_isarray(false); - arg_red->set_type(GLMessage::DataType::BYTE); - arg_red->add_intvalue((int)red); + glmsg.set_function(GLMessage::glLightf); - // copy argument green - GLMessage_DataType *arg_green = glmsg.add_args(); - arg_green->set_isarray(false); - arg_green->set_type(GLMessage::DataType::BYTE); - arg_green->add_intvalue((int)green); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); - // copy argument blue - GLMessage_DataType *arg_blue = glmsg.add_args(); - arg_blue->set_isarray(false); - arg_blue->set_type(GLMessage::DataType::BYTE); - arg_blue->add_intvalue((int)blue); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument alpha - GLMessage_DataType *arg_alpha = glmsg.add_args(); - arg_alpha->set_isarray(false); - arg_alpha->set_type(GLMessage::DataType::BYTE); - arg_alpha->add_intvalue((int)alpha); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glColor4ub(red, green, blue, alpha); + glContext->hooks->gl.glLightf(light, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24825,44 +11672,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { +void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glColor4x); - - // copy argument red - GLMessage_DataType *arg_red = glmsg.add_args(); - arg_red->set_isarray(false); - arg_red->set_type(GLMessage::DataType::INT); - arg_red->add_intvalue(red); + glmsg.set_function(GLMessage::glLightfv); - // copy argument green - GLMessage_DataType *arg_green = glmsg.add_args(); - arg_green->set_isarray(false); - arg_green->set_type(GLMessage::DataType::INT); - arg_green->add_intvalue(green); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); - // copy argument blue - GLMessage_DataType *arg_blue = glmsg.add_args(); - arg_blue->set_isarray(false); - arg_blue->set_type(GLMessage::DataType::INT); - arg_blue->add_intvalue(blue); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument alpha - GLMessage_DataType *arg_alpha = glmsg.add_args(); - arg_alpha->set_isarray(false); - arg_alpha->set_type(GLMessage::DataType::INT); - arg_alpha->add_intvalue(alpha); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glColor4x(red, green, blue, alpha); + glContext->hooks->gl.glLightfv(light, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24871,45 +11713,27 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void GLTrace_glLoadMatrixf(const GLfloat *m) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glColorPointer); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); + glmsg.set_function(GLMessage::glLoadMatrixf); - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glColorPointer(size, type, stride, pointer); + glContext->hooks->gl.glLoadMatrixf(m); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) pointer, + (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24918,28 +11742,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDepthRangex(GLfixed n, GLfixed f) { +void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDepthRangex); + glmsg.set_function(GLMessage::glMaterialf); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::INT); - arg_f->add_intvalue(f); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDepthRangex(n, f); + glContext->hooks->gl.glMaterialf(face, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -24952,26 +11782,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDisableClientState(GLenum array) { +void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glDisableClientState); + glmsg.set_function(GLMessage::glMaterialfv); - // copy argument array - GLMessage_DataType *arg_array = glmsg.add_args(); - arg_array->set_isarray(false); - arg_array->set_type(GLMessage::DataType::ENUM); - arg_array->add_intvalue((int)array); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDisableClientState(array); + glContext->hooks->gl.glMaterialfv(face, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -24980,26 +11823,27 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glEnableClientState(GLenum array) { +void GLTrace_glMultMatrixf(const GLfloat *m) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glEnableClientState); + glmsg.set_function(GLMessage::glMultMatrixf); - // copy argument array - GLMessage_DataType *arg_array = glmsg.add_args(); - arg_array->set_isarray(false); - arg_array->set_type(GLMessage::DataType::ENUM); - arg_array->add_intvalue((int)array); + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glEnableClientState(array); + glContext->hooks->gl.glMultMatrixf(m); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25008,28 +11852,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFogx(GLenum pname, GLfixed param) { +void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFogx); + glmsg.set_function(GLMessage::glMultiTexCoord4f); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::FLOAT); + arg_s->add_floatvalue(s); + + // copy argument t + GLMessage_DataType *arg_t = glmsg.add_args(); + arg_t->set_isarray(false); + arg_t->set_type(GLMessage::DataType::FLOAT); + arg_t->add_floatvalue(t); + + // copy argument r + GLMessage_DataType *arg_r = glmsg.add_args(); + arg_r->set_isarray(false); + arg_r->set_type(GLMessage::DataType::FLOAT); + arg_r->add_floatvalue(r); + + // copy argument q + GLMessage_DataType *arg_q = glmsg.add_args(); + arg_q->set_isarray(false); + arg_q->set_type(GLMessage::DataType::FLOAT); + arg_q->add_floatvalue(q); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFogx(pname, param); + glContext->hooks->gl.glMultiTexCoord4f(target, s, t, r, q); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25042,33 +11904,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFogxv(GLenum pname, const GLfixed * param) { +void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFogxv); + glmsg.set_function(GLMessage::glNormal3f); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument nx + GLMessage_DataType *arg_nx = glmsg.add_args(); + arg_nx->set_isarray(false); + arg_nx->set_type(GLMessage::DataType::FLOAT); + arg_nx->add_floatvalue(nx); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + // copy argument ny + GLMessage_DataType *arg_ny = glmsg.add_args(); + arg_ny->set_isarray(false); + arg_ny->set_type(GLMessage::DataType::FLOAT); + arg_ny->add_floatvalue(ny); + + // copy argument nz + GLMessage_DataType *arg_nz = glmsg.add_args(); + arg_nz->set_isarray(false); + arg_nz->set_type(GLMessage::DataType::FLOAT); + arg_nz->add_floatvalue(nz); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFogxv(pname, param); + glContext->hooks->gl.glNormal3f(nx, ny, nz); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25077,52 +11944,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFrustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { +void GLTrace_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFrustumx); - - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::INT); - arg_l->add_intvalue(l); - - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::INT); - arg_r->add_intvalue(r); - - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::INT); - arg_b->add_intvalue(b); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::INT); - arg_t->add_intvalue(t); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + glmsg.set_function(GLMessage::glOrthof); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::INT); - arg_f->add_intvalue(f); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFrustumx(l, r, b, t, n, f); + glContext->hooks->gl.glOrthof(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25135,33 +12002,32 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetClipPlanex(GLenum plane, GLfixed * equation) { +void GLTrace_glPointParameterf(GLenum pname, GLfloat param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetClipPlanex); + glmsg.set_function(GLMessage::glPointParameterf); - // copy argument plane - GLMessage_DataType *arg_plane = glmsg.add_args(); - arg_plane->set_isarray(false); - arg_plane->set_type(GLMessage::DataType::ENUM); - arg_plane->add_intvalue((int)plane); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument equation - GLMessage_DataType *arg_equation = glmsg.add_args(); - arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetClipPlanex(plane, equation); + glContext->hooks->gl.glPointParameterf(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) equation, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25170,11 +12036,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetFixedv(GLenum pname, GLfixed * params) { +void GLTrace_glPointParameterfv(GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetFixedv); + glmsg.set_function(GLMessage::glPointParameterfv); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -25185,13 +12051,13 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetFixedv(pname, params); + glContext->hooks->gl.glPointParameterfv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25205,39 +12071,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed * params) { +void GLTrace_glPointSize(GLfloat size) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetLightxv); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glPointSize); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::FLOAT); + arg_size->add_floatvalue(size); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetLightxv(light, pname, params); + glContext->hooks->gl.glPointSize(size); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25246,39 +12099,44 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed * params) { +void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetMaterialxv); + glmsg.set_function(GLMessage::glRotatef); - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); + // copy argument angle + GLMessage_DataType *arg_angle = glmsg.add_args(); + arg_angle->set_isarray(false); + arg_angle->set_type(GLMessage::DataType::FLOAT); + arg_angle->add_floatvalue(angle); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetMaterialxv(face, pname, params); + glContext->hooks->gl.glRotatef(angle, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25287,33 +12145,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetPointerv(GLenum pname, void ** params) { +void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetPointerv); + glmsg.set_function(GLMessage::glScalef); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetPointerv(pname, params); + glContext->hooks->gl.glScalef(x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25322,11 +12185,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexEnviv(GLenum target, GLenum pname, GLint * params) { +void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetTexEnviv); + glmsg.set_function(GLMessage::glTexEnvf); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -25340,21 +12203,20 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::FLOAT); + arg_param->add_floatvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexEnviv(target, pname, params); + glContext->hooks->gl.glTexEnvf(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25363,11 +12225,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexEnvxv(GLenum target, GLenum pname, GLfixed * params) { +void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetTexEnvxv); + glmsg.set_function(GLMessage::glTexEnvfv); // copy argument target GLMessage_DataType *arg_target = glmsg.add_args(); @@ -25384,13 +12246,13 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexEnvxv(target, pname, params); + glContext->hooks->gl.glTexEnvfv(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25404,39 +12266,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed * params) { +void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetTexParameterxv); + glmsg.set_function(GLMessage::glTranslatef); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::FLOAT); + arg_x->add_floatvalue(x); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::FLOAT); + arg_y->add_floatvalue(y); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::FLOAT); + arg_z->add_floatvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexParameterxv(target, pname, params); + glContext->hooks->gl.glTranslatef(x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25445,28 +12306,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightModelx(GLenum pname, GLfixed param) { +void GLTrace_glAlphaFuncx(GLenum func, GLclampx ref) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightModelx); + glmsg.set_function(GLMessage::glAlphaFuncx); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument func + GLMessage_DataType *arg_func = glmsg.add_args(); + arg_func->set_isarray(false); + arg_func->set_type(GLMessage::DataType::ENUM); + arg_func->add_intvalue((int)func); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument ref + GLMessage_DataType *arg_ref = glmsg.add_args(); + arg_ref->set_isarray(false); + arg_ref->set_type(GLMessage::DataType::INT); + arg_ref->add_intvalue(ref); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightModelx(pname, param); + glContext->hooks->gl.glAlphaFuncx(func, ref); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25479,33 +12340,44 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightModelxv(GLenum pname, const GLfixed * param) { +void GLTrace_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightModelxv); + glmsg.set_function(GLMessage::glClearColorx); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::INT); + arg_red->add_intvalue(red); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::INT); + arg_green->add_intvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::INT); + arg_blue->add_intvalue(blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::INT); + arg_alpha->add_intvalue(alpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightModelxv(pname, param); + glContext->hooks->gl.glClearColorx(red, green, blue, alpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25514,34 +12386,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param) { +void GLTrace_glClearDepthx(GLclampx depth) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightx); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glClearDepthx); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::INT); + arg_depth->add_intvalue(depth); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightx(light, pname, param); + glContext->hooks->gl.glClearDepthx(depth); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25554,39 +12414,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed * params) { +void GLTrace_glClientActiveTexture(GLenum texture) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightxv); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glClientActiveTexture); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument texture + GLMessage_DataType *arg_texture = glmsg.add_args(); + arg_texture->set_isarray(false); + arg_texture->set_type(GLMessage::DataType::ENUM); + arg_texture->add_intvalue((int)texture); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightxv(light, pname, params); + glContext->hooks->gl.glClientActiveTexture(texture); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25595,26 +12442,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLineWidthx(GLfixed width) { +void GLTrace_glClipPlanex(GLenum plane, const GLfixed *equation) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLineWidthx); + glmsg.set_function(GLMessage::glClipPlanex); - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); + // copy argument plane + GLMessage_DataType *arg_plane = glmsg.add_args(); + arg_plane->set_isarray(false); + arg_plane->set_type(GLMessage::DataType::ENUM); + arg_plane->add_intvalue((int)plane); + + // copy argument equation + GLMessage_DataType *arg_equation = glmsg.add_args(); + arg_equation->set_isarray(false); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLineWidthx(width); + glContext->hooks->gl.glClipPlanex(plane, equation); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) equation, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25623,16 +12477,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLoadIdentity(void) { +void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLoadIdentity); + glmsg.set_function(GLMessage::glColor4ub); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::BYTE); + arg_red->add_intvalue((int)red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::BYTE); + arg_green->add_intvalue((int)green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::BYTE); + arg_blue->add_intvalue((int)blue); + + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::BYTE); + arg_alpha->add_intvalue((int)alpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLoadIdentity(); + glContext->hooks->gl.glColor4ub(red, green, blue, alpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25645,27 +12523,44 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLoadMatrixx(const GLfixed * m) { +void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLoadMatrixx); + glmsg.set_function(GLMessage::glColor4x); + + // copy argument red + GLMessage_DataType *arg_red = glmsg.add_args(); + arg_red->set_isarray(false); + arg_red->set_type(GLMessage::DataType::INT); + arg_red->add_intvalue(red); + + // copy argument green + GLMessage_DataType *arg_green = glmsg.add_args(); + arg_green->set_isarray(false); + arg_green->set_type(GLMessage::DataType::INT); + arg_green->add_intvalue(green); + + // copy argument blue + GLMessage_DataType *arg_blue = glmsg.add_args(); + arg_blue->set_isarray(false); + arg_blue->set_type(GLMessage::DataType::INT); + arg_blue->add_intvalue(blue); - // copy argument m - GLMessage_DataType *arg_m = glmsg.add_args(); - arg_m->set_isarray(false); - arg_m->set_type(GLMessage::DataType::INT64); - arg_m->add_int64value((uintptr_t)m); + // copy argument alpha + GLMessage_DataType *arg_alpha = glmsg.add_args(); + arg_alpha->set_isarray(false); + arg_alpha->set_type(GLMessage::DataType::INT); + arg_alpha->add_intvalue(alpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLoadMatrixx(m); + glContext->hooks->gl.glColor4x(red, green, blue, alpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25674,26 +12569,45 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLogicOp(GLenum opcode) { +void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLogicOp); + glmsg.set_function(GLMessage::glColorPointer); - // copy argument opcode - GLMessage_DataType *arg_opcode = glmsg.add_args(); - arg_opcode->set_isarray(false); - arg_opcode->set_type(GLMessage::DataType::ENUM); - arg_opcode->add_intvalue((int)opcode); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLogicOp(opcode); + glContext->hooks->gl.glColorPointer(size, type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25702,34 +12616,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param) { +void GLTrace_glDepthRangex(GLclampx zNear, GLclampx zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMaterialx); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); + glmsg.set_function(GLMessage::glDepthRangex); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMaterialx(face, pname, param); + glContext->hooks->gl.glDepthRangex(zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25742,39 +12650,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed * param) { +void GLTrace_glDisableClientState(GLenum array) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMaterialxv); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glDisableClientState); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::ENUM); + arg_array->add_intvalue((int)array); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMaterialxv(face, pname, param); + glContext->hooks->gl.glDisableClientState(array); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25783,22 +12678,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMatrixMode(GLenum mode) { +void GLTrace_glEnableClientState(GLenum array) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMatrixMode); + glmsg.set_function(GLMessage::glEnableClientState); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument array + GLMessage_DataType *arg_array = glmsg.add_args(); + arg_array->set_isarray(false); + arg_array->set_type(GLMessage::DataType::ENUM); + arg_array->add_intvalue((int)array); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMatrixMode(mode); + glContext->hooks->gl.glEnableClientState(array); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25811,27 +12706,32 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultMatrixx(const GLfixed * m) { +void GLTrace_glFogx(GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultMatrixx); + glmsg.set_function(GLMessage::glFogx); - // copy argument m - GLMessage_DataType *arg_m = glmsg.add_args(); - arg_m->set_isarray(false); - arg_m->set_type(GLMessage::DataType::INT64); - arg_m->add_int64value((uintptr_t)m); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultMatrixx(m); + glContext->hooks->gl.glFogx(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25840,50 +12740,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { +void GLTrace_glFogxv(GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord4x); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); - - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::INT); - arg_s->add_intvalue(s); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::INT); - arg_t->add_intvalue(t); + glmsg.set_function(GLMessage::glFogxv); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::INT); - arg_r->add_intvalue(r); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument q - GLMessage_DataType *arg_q = glmsg.add_args(); - arg_q->set_isarray(false); - arg_q->set_type(GLMessage::DataType::INT); - arg_q->add_intvalue(q); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord4x(texture, s, t, r, q); + glContext->hooks->gl.glFogxv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25892,34 +12775,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) { +void GLTrace_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glNormal3x); + glmsg.set_function(GLMessage::glFrustumx); - // copy argument nx - GLMessage_DataType *arg_nx = glmsg.add_args(); - arg_nx->set_isarray(false); - arg_nx->set_type(GLMessage::DataType::INT); - arg_nx->add_intvalue(nx); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); - // copy argument ny - GLMessage_DataType *arg_ny = glmsg.add_args(); - arg_ny->set_isarray(false); - arg_ny->set_type(GLMessage::DataType::INT); - arg_ny->add_intvalue(ny); + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); - // copy argument nz - GLMessage_DataType *arg_nz = glmsg.add_args(); - arg_nz->set_isarray(false); - arg_nz->set_type(GLMessage::DataType::INT); - arg_nz->add_intvalue(nz); + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glNormal3x(nx, ny, nz); + glContext->hooks->gl.glFrustumx(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -25932,39 +12833,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const void * pointer) { +void GLTrace_glGetClipPlanex(GLenum pname, GLfixed eqn[4]) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glNormalPointer); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); + glmsg.set_function(GLMessage::glGetClipPlanex); - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glNormalPointer(type, stride, pointer); + glContext->hooks->gl.glGetClipPlanex(pname, eqn); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) pointer, + (void *) eqn, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -25973,56 +12868,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glOrthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { +void GLTrace_glGetFixedv(GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glOrthox); - - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::INT); - arg_l->add_intvalue(l); - - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::INT); - arg_r->add_intvalue(r); - - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::INT); - arg_b->add_intvalue(b); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::INT); - arg_t->add_intvalue(t); + glmsg.set_function(GLMessage::glGetFixedv); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::INT); - arg_f->add_intvalue(f); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glOrthox(l, r, b, t, n, f); + glContext->hooks->gl.glGetFixedv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26031,11 +12903,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointParameterx(GLenum pname, GLfixed param) { +void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointParameterx); + glmsg.set_function(GLMessage::glGetLightxv); + + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -26043,20 +12921,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointParameterx(pname, param); + glContext->hooks->gl.glGetLightxv(light, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26065,11 +12944,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointParameterxv(GLenum pname, const GLfixed * params) { +void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointParameterxv); + glmsg.set_function(GLMessage::glGetMaterialxv); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -26080,13 +12965,13 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointParameterxv(pname, params); + glContext->hooks->gl.glGetMaterialxv(face, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26100,26 +12985,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointSizex(GLfixed size) { +void GLTrace_glGetPointerv(GLenum pname, GLvoid **params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointSizex); + glmsg.set_function(GLMessage::glGetPointerv); - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointSizex(size); + glContext->hooks->gl.glGetPointerv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26128,32 +13020,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units) { +void GLTrace_glGetTexEnviv(GLenum env, GLenum pname, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPolygonOffsetx); + glmsg.set_function(GLMessage::glGetTexEnviv); - // copy argument factor - GLMessage_DataType *arg_factor = glmsg.add_args(); - arg_factor->set_isarray(false); - arg_factor->set_type(GLMessage::DataType::INT); - arg_factor->add_intvalue(factor); + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); - // copy argument units - GLMessage_DataType *arg_units = glmsg.add_args(); - arg_units->set_isarray(false); - arg_units->set_type(GLMessage::DataType::INT); - arg_units->add_intvalue(units); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPolygonOffsetx(factor, units); + glContext->hooks->gl.glGetTexEnviv(env, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26162,20 +13061,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPopMatrix(void) { +void GLTrace_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPopMatrix); + glmsg.set_function(GLMessage::glGetTexEnvxv); + + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPopMatrix(); + glContext->hooks->gl.glGetTexEnvxv(env, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26184,20 +13102,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPushMatrix(void) { +void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPushMatrix); + glmsg.set_function(GLMessage::glGetTexParameterxv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPushMatrix(); + glContext->hooks->gl.glGetTexParameterxv(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26206,40 +13143,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { +void GLTrace_glLightModelx(GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glRotatex); - - // copy argument angle - GLMessage_DataType *arg_angle = glmsg.add_args(); - arg_angle->set_isarray(false); - arg_angle->set_type(GLMessage::DataType::INT); - arg_angle->add_intvalue(angle); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); + glmsg.set_function(GLMessage::glLightModelx); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRotatex(angle, x, y, z); + glContext->hooks->gl.glLightModelx(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26252,32 +13177,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert) { +void GLTrace_glLightModelxv(GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSampleCoveragex); + glmsg.set_function(GLMessage::glLightModelxv); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument invert - GLMessage_DataType *arg_invert = glmsg.add_args(); - arg_invert->set_isarray(false); - arg_invert->set_type(GLMessage::DataType::BOOL); - arg_invert->add_boolvalue(invert); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSampleCoveragex(value, invert); + glContext->hooks->gl.glLightModelxv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26286,34 +13212,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z) { +void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glScalex); + glmsg.set_function(GLMessage::glLightx); - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glScalex(x, y, z); + glContext->hooks->gl.glLightx(light, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26326,26 +13252,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glShadeModel(GLenum mode) { +void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glShadeModel); + glmsg.set_function(GLMessage::glLightxv); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glShadeModel(mode); + glContext->hooks->gl.glLightxv(light, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26354,45 +13293,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void GLTrace_glLineWidthx(GLfixed width) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoordPointer); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); - - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); + glmsg.set_function(GLMessage::glLineWidthx); - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoordPointer(size, type, stride, pointer); + glContext->hooks->gl.glLineWidthx(width); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26401,34 +13321,16 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param) { +void GLTrace_glLoadIdentity(void) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvi); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + glmsg.set_function(GLMessage::glLoadIdentity); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvi(target, pname, param); + glContext->hooks->gl.glLoadIdentity(); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26441,38 +13343,27 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param) { +void GLTrace_glLoadMatrixx(const GLfixed *m) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvx); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glLoadMatrixx); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvx(target, pname, param); + glContext->hooks->gl.glLoadMatrixx(m); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26481,39 +13372,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint * params) { +void GLTrace_glLogicOp(GLenum opcode) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnviv); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glLogicOp); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument opcode + GLMessage_DataType *arg_opcode = glmsg.add_args(); + arg_opcode->set_isarray(false); + arg_opcode->set_type(GLMessage::DataType::ENUM); + arg_opcode->add_intvalue((int)opcode); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnviv(target, pname, params); + glContext->hooks->gl.glLogicOp(opcode); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26522,17 +13400,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed * params) { +void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvxv); + glmsg.set_function(GLMessage::glMaterialx); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -26540,21 +13418,20 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvxv(target, pname, params); + glContext->hooks->gl.glMaterialx(face, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26563,17 +13440,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param) { +void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexParameterx); + glmsg.set_function(GLMessage::glMaterialxv); - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -26581,20 +13458,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexParameterx(target, pname, param); + glContext->hooks->gl.glMaterialxv(face, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26603,39 +13481,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed * params) { +void GLTrace_glMatrixMode(GLenum mode) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexParameterxv); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glMatrixMode); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexParameterxv(target, pname, params); + glContext->hooks->gl.glMatrixMode(mode); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26644,38 +13509,27 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z) { +void GLTrace_glMultMatrixx(const GLfixed *m) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTranslatex); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + glmsg.set_function(GLMessage::glMultMatrixx); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTranslatex(x, y, z); + glContext->hooks->gl.glMultMatrixx(m); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26684,45 +13538,50 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void GLTrace_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertexPointer); + glmsg.set_function(GLMessage::glMultiTexCoord4x); - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::INT); + arg_s->add_intvalue(s); - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); + // copy argument t + GLMessage_DataType *arg_t = glmsg.add_args(); + arg_t->set_isarray(false); + arg_t->set_type(GLMessage::DataType::INT); + arg_t->add_intvalue(t); - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + // copy argument r + GLMessage_DataType *arg_r = glmsg.add_args(); + arg_r->set_isarray(false); + arg_r->set_type(GLMessage::DataType::INT); + arg_r->add_intvalue(r); + + // copy argument q + GLMessage_DataType *arg_q = glmsg.add_args(); + arg_q->set_isarray(false); + arg_q->set_type(GLMessage::DataType::INT); + arg_q->add_intvalue(q); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertexPointer(size, type, stride, pointer); + glContext->hooks->gl.glMultiTexCoord4x(target, s, t, r, q); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26731,31 +13590,34 @@ glContext->traceGLMessage(&glmsg); } - -// Definitions for GL1Ext APIs - -void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha) { +void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBlendEquationSeparateOES); + glmsg.set_function(GLMessage::glNormal3x); - // copy argument modeRGB - GLMessage_DataType *arg_modeRGB = glmsg.add_args(); - arg_modeRGB->set_isarray(false); - arg_modeRGB->set_type(GLMessage::DataType::ENUM); - arg_modeRGB->add_intvalue((int)modeRGB); + // copy argument nx + GLMessage_DataType *arg_nx = glmsg.add_args(); + arg_nx->set_isarray(false); + arg_nx->set_type(GLMessage::DataType::INT); + arg_nx->add_intvalue(nx); - // copy argument modeAlpha - GLMessage_DataType *arg_modeAlpha = glmsg.add_args(); - arg_modeAlpha->set_isarray(false); - arg_modeAlpha->set_type(GLMessage::DataType::ENUM); - arg_modeAlpha->add_intvalue((int)modeAlpha); + // copy argument ny + GLMessage_DataType *arg_ny = glmsg.add_args(); + arg_ny->set_isarray(false); + arg_ny->set_type(GLMessage::DataType::INT); + arg_ny->add_intvalue(ny); + + // copy argument nz + GLMessage_DataType *arg_nz = glmsg.add_args(); + arg_nz->set_isarray(false); + arg_nz->set_type(GLMessage::DataType::INT); + arg_nz->add_intvalue(nz); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendEquationSeparateOES(modeRGB, modeAlpha); + glContext->hooks->gl.glNormal3x(nx, ny, nz); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26768,44 +13630,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { +void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBlendFuncSeparateOES); - - // copy argument srcRGB - GLMessage_DataType *arg_srcRGB = glmsg.add_args(); - arg_srcRGB->set_isarray(false); - arg_srcRGB->set_type(GLMessage::DataType::ENUM); - arg_srcRGB->add_intvalue((int)srcRGB); + glmsg.set_function(GLMessage::glNormalPointer); - // copy argument dstRGB - GLMessage_DataType *arg_dstRGB = glmsg.add_args(); - arg_dstRGB->set_isarray(false); - arg_dstRGB->set_type(GLMessage::DataType::ENUM); - arg_dstRGB->add_intvalue((int)dstRGB); + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument srcAlpha - GLMessage_DataType *arg_srcAlpha = glmsg.add_args(); - arg_srcAlpha->set_isarray(false); - arg_srcAlpha->set_type(GLMessage::DataType::ENUM); - arg_srcAlpha->add_intvalue((int)srcAlpha); + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); - // copy argument dstAlpha - GLMessage_DataType *arg_dstAlpha = glmsg.add_args(); - arg_dstAlpha->set_isarray(false); - arg_dstAlpha->set_type(GLMessage::DataType::ENUM); - arg_dstAlpha->add_intvalue((int)dstAlpha); + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha); + glContext->hooks->gl.glNormalPointer(type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26814,22 +13671,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glBlendEquationOES(GLenum mode) { +void GLTrace_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glBlendEquationOES); + glmsg.set_function(GLMessage::glOrthox); - // copy argument mode - GLMessage_DataType *arg_mode = glmsg.add_args(); - arg_mode->set_isarray(false); - arg_mode->set_type(GLMessage::DataType::ENUM); - arg_mode->add_intvalue((int)mode); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glBlendEquationOES(mode); + glContext->hooks->gl.glOrthox(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26842,28 +13729,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord1bOES(GLenum texture, GLbyte s) { +void GLTrace_glPointParameterx(GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord1bOES); + glmsg.set_function(GLMessage::glPointParameterx); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord1bOES(texture, s); + glContext->hooks->gl.glPointParameterx(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26876,33 +13763,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord1bvOES(GLenum texture, const GLbyte * coords) { +void GLTrace_glPointParameterxv(GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord1bvOES); + glmsg.set_function(GLMessage::glPointParameterxv); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord1bvOES(texture, coords); + glContext->hooks->gl.glPointParameterxv(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26911,34 +13798,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord2bOES(GLenum texture, GLbyte s, GLbyte t) { +void GLTrace_glPointSizex(GLfixed size) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord2bOES); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); - - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + glmsg.set_function(GLMessage::glPointSizex); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::BYTE); - arg_t->add_intvalue((int)t); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord2bOES(texture, s, t); + glContext->hooks->gl.glPointSizex(size); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -26951,33 +13826,32 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord2bvOES(GLenum texture, const GLbyte * coords) { +void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord2bvOES); + glmsg.set_function(GLMessage::glPolygonOffsetx); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // copy argument factor + GLMessage_DataType *arg_factor = glmsg.add_args(); + arg_factor->set_isarray(false); + arg_factor->set_type(GLMessage::DataType::INT); + arg_factor->add_intvalue(factor); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument units + GLMessage_DataType *arg_units = glmsg.add_args(); + arg_units->set_isarray(false); + arg_units->set_type(GLMessage::DataType::INT); + arg_units->add_intvalue(units); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord2bvOES(texture, coords); + glContext->hooks->gl.glPolygonOffsetx(factor, units); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -26986,40 +13860,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord3bOES(GLenum texture, GLbyte s, GLbyte t, GLbyte r) { +void GLTrace_glPopMatrix(void) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord3bOES); + glmsg.set_function(GLMessage::glPopMatrix); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glPopMatrix(); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + void *pointerArgs[] = { + }; - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::BYTE); - arg_t->add_intvalue((int)t); + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::BYTE); - arg_r->add_intvalue((int)r); +void GLTrace_glPushMatrix(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glPushMatrix); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord3bOES(texture, s, t, r); + glContext->hooks->gl.glPushMatrix(); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27032,33 +13904,44 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord3bvOES(GLenum texture, const GLbyte * coords) { +void GLTrace_glRotatex(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord3bvOES); + glmsg.set_function(GLMessage::glRotatex); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // copy argument angle + GLMessage_DataType *arg_angle = glmsg.add_args(); + arg_angle->set_isarray(false); + arg_angle->set_type(GLMessage::DataType::INT); + arg_angle->add_intvalue(angle); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord3bvOES(texture, coords); + glContext->hooks->gl.glRotatex(angle, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27067,46 +13950,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord4bOES(GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q) { +void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord4bOES); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); - - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::BYTE); - arg_t->add_intvalue((int)t); + glmsg.set_function(GLMessage::glSampleCoveragex); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::BYTE); - arg_r->add_intvalue((int)r); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue(value); - // copy argument q - GLMessage_DataType *arg_q = glmsg.add_args(); - arg_q->set_isarray(false); - arg_q->set_type(GLMessage::DataType::BYTE); - arg_q->add_intvalue((int)q); + // copy argument invert + GLMessage_DataType *arg_invert = glmsg.add_args(); + arg_invert->set_isarray(false); + arg_invert->set_type(GLMessage::DataType::BOOL); + arg_invert->add_boolvalue(invert); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord4bOES(texture, s, t, r, q); + glContext->hooks->gl.glSampleCoveragex(value, invert); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27119,33 +13984,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord4bvOES(GLenum texture, const GLbyte * coords) { +void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord4bvOES); + glmsg.set_function(GLMessage::glScalex); - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord4bvOES(texture, coords); + glContext->hooks->gl.glScalex(x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27154,22 +14024,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord1bOES(GLbyte s) { +void GLTrace_glShadeModel(GLenum mode) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord1bOES); + glmsg.set_function(GLMessage::glShadeModel); - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord1bOES(s); + glContext->hooks->gl.glShadeModel(mode); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27182,27 +14052,45 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord1bvOES(const GLbyte * coords) { +void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord1bvOES); + glmsg.set_function(GLMessage::glTexCoordPointer); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord1bvOES(coords); + glContext->hooks->gl.glTexCoordPointer(size, type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, + (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27211,28 +14099,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord2bOES(GLbyte s, GLbyte t) { +void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord2bOES); + glmsg.set_function(GLMessage::glTexEnvi); - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::BYTE); - arg_t->add_intvalue((int)t); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord2bOES(s, t); + glContext->hooks->gl.glTexEnvi(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27245,27 +14139,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord2bvOES(const GLbyte * coords) { +void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord2bvOES); + glmsg.set_function(GLMessage::glTexEnvx); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord2bvOES(coords); + glContext->hooks->gl.glTexEnvx(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27274,38 +14179,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord3bOES(GLbyte s, GLbyte t, GLbyte r) { +void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord3bOES); + glmsg.set_function(GLMessage::glTexEnviv); - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::BYTE); - arg_t->add_intvalue((int)t); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::BYTE); - arg_r->add_intvalue((int)r); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord3bOES(s, t, r); + glContext->hooks->gl.glTexEnviv(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27314,27 +14220,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord3bvOES(const GLbyte * coords) { +void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord3bvOES); + glmsg.set_function(GLMessage::glTexEnvxv); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord3bvOES(coords); + glContext->hooks->gl.glTexEnvxv(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27343,40 +14261,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord4bOES(GLbyte s, GLbyte t, GLbyte r, GLbyte q) { +void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord4bOES); - - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::BYTE); - arg_s->add_intvalue((int)s); + glmsg.set_function(GLMessage::glTexParameterx); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::BYTE); - arg_t->add_intvalue((int)t); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::BYTE); - arg_r->add_intvalue((int)r); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument q - GLMessage_DataType *arg_q = glmsg.add_args(); - arg_q->set_isarray(false); - arg_q->set_type(GLMessage::DataType::BYTE); - arg_q->add_intvalue((int)q); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord4bOES(s, t, r, q); + glContext->hooks->gl.glTexParameterx(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27389,27 +14301,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexCoord4bvOES(const GLbyte * coords) { +void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexCoord4bvOES); + glmsg.set_function(GLMessage::glTexParameterxv); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexCoord4bvOES(coords); + glContext->hooks->gl.glTexParameterxv(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27418,22 +14342,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertex2bOES(GLbyte x) { +void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertex2bOES); + glmsg.set_function(GLMessage::glTranslatex); // copy argument x GLMessage_DataType *arg_x = glmsg.add_args(); arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::BYTE); - arg_x->add_intvalue((int)x); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); + + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); + + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertex2bOES(x); + glContext->hooks->gl.glTranslatex(x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27446,27 +14382,45 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertex2bvOES(const GLbyte * coords) { +void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertex2bvOES); + glmsg.set_function(GLMessage::glVertexPointer); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); + + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); + + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertex2bvOES(coords); + glContext->hooks->gl.glVertexPointer(size, type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, + (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27475,32 +14429,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertex3bOES(GLbyte x, GLbyte y) { +void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertex3bOES); + glmsg.set_function(GLMessage::glPointSizePointerOES); - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::BYTE); - arg_x->add_intvalue((int)x); + // copy argument type + GLMessage_DataType *arg_type = glmsg.add_args(); + arg_type->set_isarray(false); + arg_type->set_type(GLMessage::DataType::ENUM); + arg_type->add_intvalue((int)type); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::BYTE); - arg_y->add_intvalue((int)y); + // copy argument stride + GLMessage_DataType *arg_stride = glmsg.add_args(); + arg_stride->set_isarray(false); + arg_stride->set_type(GLMessage::DataType::INT); + arg_stride->add_intvalue(stride); + + // copy argument pointer + GLMessage_DataType *arg_pointer = glmsg.add_args(); + arg_pointer->set_isarray(false); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertex3bOES(x, y); + glContext->hooks->gl.glPointSizePointerOES(type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27509,27 +14470,35 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertex3bvOES(const GLbyte * coords) { + +// Definitions for GL1Ext APIs + +void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertex3bvOES); + glmsg.set_function(GLMessage::glBlendEquationSeparateOES); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument modeRGB + GLMessage_DataType *arg_modeRGB = glmsg.add_args(); + arg_modeRGB->set_isarray(false); + arg_modeRGB->set_type(GLMessage::DataType::ENUM); + arg_modeRGB->add_intvalue((int)modeRGB); + + // copy argument modeAlpha + GLMessage_DataType *arg_modeAlpha = glmsg.add_args(); + arg_modeAlpha->set_isarray(false); + arg_modeAlpha->set_type(GLMessage::DataType::ENUM); + arg_modeAlpha->add_intvalue((int)modeAlpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertex3bvOES(coords); + glContext->hooks->gl.glBlendEquationSeparateOES(modeRGB, modeAlpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27538,34 +14507,40 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertex4bOES(GLbyte x, GLbyte y, GLbyte z) { +void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertex4bOES); + glmsg.set_function(GLMessage::glBlendFuncSeparateOES); - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::BYTE); - arg_x->add_intvalue((int)x); + // copy argument srcRGB + GLMessage_DataType *arg_srcRGB = glmsg.add_args(); + arg_srcRGB->set_isarray(false); + arg_srcRGB->set_type(GLMessage::DataType::ENUM); + arg_srcRGB->add_intvalue((int)srcRGB); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::BYTE); - arg_y->add_intvalue((int)y); + // copy argument dstRGB + GLMessage_DataType *arg_dstRGB = glmsg.add_args(); + arg_dstRGB->set_isarray(false); + arg_dstRGB->set_type(GLMessage::DataType::ENUM); + arg_dstRGB->add_intvalue((int)dstRGB); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::BYTE); - arg_z->add_intvalue((int)z); + // copy argument srcAlpha + GLMessage_DataType *arg_srcAlpha = glmsg.add_args(); + arg_srcAlpha->set_isarray(false); + arg_srcAlpha->set_type(GLMessage::DataType::ENUM); + arg_srcAlpha->add_intvalue((int)srcAlpha); + + // copy argument dstAlpha + GLMessage_DataType *arg_dstAlpha = glmsg.add_args(); + arg_dstAlpha->set_isarray(false); + arg_dstAlpha->set_type(GLMessage::DataType::ENUM); + arg_dstAlpha->add_intvalue((int)dstAlpha); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertex4bOES(x, y, z); + glContext->hooks->gl.glBlendFuncSeparateOES(srcRGB, dstRGB, srcAlpha, dstAlpha); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27578,27 +14553,26 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glVertex4bvOES(const GLbyte * coords) { +void GLTrace_glBlendEquationOES(GLenum mode) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glVertex4bvOES); + glmsg.set_function(GLMessage::glBlendEquationOES); - // copy argument coords - GLMessage_DataType *arg_coords = glmsg.add_args(); - arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + // copy argument mode + GLMessage_DataType *arg_mode = glmsg.add_args(); + arg_mode->set_isarray(false); + arg_mode->set_type(GLMessage::DataType::ENUM); + arg_mode->add_intvalue((int)mode); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glVertex4bvOES(coords); + glContext->hooks->gl.glBlendEquationOES(mode); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) coords, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -27763,7 +14737,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawTexsvOES(const GLshort * coords) { +void GLTrace_glDrawTexsvOES(const GLshort *coords) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -27772,8 +14746,8 @@ // copy argument coords GLMessage_DataType *arg_coords = glmsg.add_args(); arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27792,7 +14766,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawTexivOES(const GLint * coords) { +void GLTrace_glDrawTexivOES(const GLint *coords) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -27801,8 +14775,8 @@ // copy argument coords GLMessage_DataType *arg_coords = glmsg.add_args(); arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27821,7 +14795,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawTexxvOES(const GLfixed * coords) { +void GLTrace_glDrawTexxvOES(const GLfixed *coords) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -27830,8 +14804,8 @@ // copy argument coords GLMessage_DataType *arg_coords = glmsg.add_args(); arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27902,7 +14876,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDrawTexfvOES(const GLfloat * coords) { +void GLTrace_glDrawTexfvOES(const GLfloat *coords) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -27911,8 +14885,8 @@ // copy argument coords GLMessage_DataType *arg_coords = glmsg.add_args(); arg_coords->set_isarray(false); - arg_coords->set_type(GLMessage::DataType::INT64); - arg_coords->add_int64value((uintptr_t)coords); + arg_coords->set_type(GLMessage::DataType::INT); + arg_coords->add_intvalue((int)coords); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -27931,7 +14905,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glAlphaFuncxOES(GLenum func, GLfixed ref) { +void GLTrace_glAlphaFuncxOES(GLenum func, GLclampx ref) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -27965,7 +14939,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearColorxOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha) { +void GLTrace_glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -28011,7 +14985,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClearDepthxOES(GLfixed depth) { +void GLTrace_glClearDepthxOES(GLclampx depth) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -28039,7 +15013,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed * equation) { +void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed *equation) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -28054,8 +15028,8 @@ // copy argument equation GLMessage_DataType *arg_equation = glmsg.add_args(); arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -28120,28 +15094,28 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDepthRangexOES(GLfixed n, GLfixed f) { +void GLTrace_glDepthRangexOES(GLclampx zNear, GLclampx zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); glmsg.set_function(GLMessage::glDepthRangexOES); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::INT); - arg_f->add_intvalue(f); + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDepthRangexOES(n, f); + glContext->hooks->gl.glDepthRangexOES(zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -28188,221 +15162,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFogxvOES(GLenum pname, const GLfixed * param) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFogxvOES); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFogxvOES(pname, param); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) param, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glFrustumxOES(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glFrustumxOES); - - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::INT); - arg_l->add_intvalue(l); - - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::INT); - arg_r->add_intvalue(r); - - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::INT); - arg_b->add_intvalue(b); - - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::INT); - arg_t->add_intvalue(t); - - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); - - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::INT); - arg_f->add_intvalue(f); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFrustumxOES(l, r, b, t, n, f); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetClipPlanexOES(GLenum plane, GLfixed * equation) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetClipPlanexOES); - - // copy argument plane - GLMessage_DataType *arg_plane = glmsg.add_args(); - arg_plane->set_isarray(false); - arg_plane->set_type(GLMessage::DataType::ENUM); - arg_plane->add_intvalue((int)plane); - - // copy argument equation - GLMessage_DataType *arg_equation = glmsg.add_args(); - arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetClipPlanexOES(plane, equation); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) equation, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetFixedvOES(GLenum pname, GLfixed * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetFixedvOES); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetFixedvOES(pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexEnvxvOES(GLenum target, GLenum pname, GLfixed * params) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glGetTexEnvxvOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); - - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexEnvxvOES(target, pname, params); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - (void *) params, - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed * params) { +void GLTrace_glFogxvOES(GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetTexParameterxvOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + glmsg.set_function(GLMessage::glFogxvOES); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -28413,13 +15177,13 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexParameterxvOES(target, pname, params); + glContext->hooks->gl.glFogxvOES(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -28433,28 +15197,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightModelxOES(GLenum pname, GLfixed param) { +void GLTrace_glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightModelxOES); + glmsg.set_function(GLMessage::glFrustumxOES); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightModelxOES(pname, param); + glContext->hooks->gl.glFrustumxOES(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -28467,11 +15255,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed * param) { +void GLTrace_glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightModelxvOES); + glmsg.set_function(GLMessage::glGetClipPlanexOES); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -28479,21 +15267,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightModelxvOES(pname, param); + glContext->hooks->gl.glGetClipPlanexOES(pname, eqn); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, + (void *) eqn, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28502,17 +15290,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param) { +void GLTrace_glGetFixedvOES(GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightxOES); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); + glmsg.set_function(GLMessage::glGetFixedvOES); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -28520,20 +15302,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightxOES(light, pname, param); + glContext->hooks->gl.glGetFixedvOES(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28542,11 +15325,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed * params) { +void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLightxvOES); + glmsg.set_function(GLMessage::glGetLightxvOES); // copy argument light GLMessage_DataType *arg_light = glmsg.add_args(); @@ -28563,13 +15346,13 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLightxvOES(light, pname, params); + glContext->hooks->gl.glGetLightxvOES(light, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -28583,26 +15366,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLineWidthxOES(GLfixed width) { +void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLineWidthxOES); + glmsg.set_function(GLMessage::glGetMaterialxvOES); - // copy argument width - GLMessage_DataType *arg_width = glmsg.add_args(); - arg_width->set_isarray(false); - arg_width->set_type(GLMessage::DataType::INT); - arg_width->add_intvalue(width); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLineWidthxOES(width); + glContext->hooks->gl.glGetMaterialxvOES(face, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28611,27 +15407,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glLoadMatrixxOES(const GLfixed * m) { +void GLTrace_glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glLoadMatrixxOES); + glmsg.set_function(GLMessage::glGetTexEnvxvOES); - // copy argument m - GLMessage_DataType *arg_m = glmsg.add_args(); - arg_m->set_isarray(false); - arg_m->set_type(GLMessage::DataType::INT64); - arg_m->add_int64value((uintptr_t)m); + // copy argument env + GLMessage_DataType *arg_env = glmsg.add_args(); + arg_env->set_isarray(false); + arg_env->set_type(GLMessage::DataType::ENUM); + arg_env->add_intvalue((int)env); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLoadMatrixxOES(m); + glContext->hooks->gl.glGetTexEnvxvOES(env, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) m, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28640,17 +15448,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param) { +void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMaterialxOES); + glmsg.set_function(GLMessage::glGetTexParameterxvOES); - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -28658,20 +15466,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMaterialxOES(face, pname, param); + glContext->hooks->gl.glGetTexParameterxvOES(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28680,17 +15489,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed * param) { +void GLTrace_glLightModelxOES(GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMaterialxvOES); - - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); + glmsg.set_function(GLMessage::glLightModelxOES); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -28701,18 +15504,17 @@ // copy argument param GLMessage_DataType *arg_param = glmsg.add_args(); arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT64); - arg_param->add_int64value((uintptr_t)param); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMaterialxvOES(face, pname, param); + glContext->hooks->gl.glLightModelxOES(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) param, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28721,27 +15523,33 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultMatrixxOES(const GLfixed * m) { +void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultMatrixxOES); + glmsg.set_function(GLMessage::glLightModelxvOES); - // copy argument m - GLMessage_DataType *arg_m = glmsg.add_args(); - arg_m->set_isarray(false); - arg_m->set_type(GLMessage::DataType::INT64); - arg_m->add_int64value((uintptr_t)m); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultMatrixxOES(m); + glContext->hooks->gl.glLightModelxvOES(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) m, + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28750,46 +15558,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glMultiTexCoord4xOES(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { +void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glMultiTexCoord4xOES); - - // copy argument texture - GLMessage_DataType *arg_texture = glmsg.add_args(); - arg_texture->set_isarray(false); - arg_texture->set_type(GLMessage::DataType::ENUM); - arg_texture->add_intvalue((int)texture); - - // copy argument s - GLMessage_DataType *arg_s = glmsg.add_args(); - arg_s->set_isarray(false); - arg_s->set_type(GLMessage::DataType::INT); - arg_s->add_intvalue(s); + glmsg.set_function(GLMessage::glLightxOES); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::INT); - arg_t->add_intvalue(t); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::INT); - arg_r->add_intvalue(r); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument q - GLMessage_DataType *arg_q = glmsg.add_args(); - arg_q->set_isarray(false); - arg_q->set_type(GLMessage::DataType::INT); - arg_q->add_intvalue(q); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMultiTexCoord4xOES(texture, s, t, r, q); + glContext->hooks->gl.glLightxOES(light, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -28802,38 +15598,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz) { +void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glNormal3xOES); + glmsg.set_function(GLMessage::glLightxvOES); - // copy argument nx - GLMessage_DataType *arg_nx = glmsg.add_args(); - arg_nx->set_isarray(false); - arg_nx->set_type(GLMessage::DataType::INT); - arg_nx->add_intvalue(nx); + // copy argument light + GLMessage_DataType *arg_light = glmsg.add_args(); + arg_light->set_isarray(false); + arg_light->set_type(GLMessage::DataType::ENUM); + arg_light->add_intvalue((int)light); - // copy argument ny - GLMessage_DataType *arg_ny = glmsg.add_args(); - arg_ny->set_isarray(false); - arg_ny->set_type(GLMessage::DataType::INT); - arg_ny->add_intvalue(ny); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument nz - GLMessage_DataType *arg_nz = glmsg.add_args(); - arg_nz->set_isarray(false); - arg_nz->set_type(GLMessage::DataType::INT); - arg_nz->add_intvalue(nz); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glNormal3xOES(nx, ny, nz); + glContext->hooks->gl.glLightxvOES(light, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28842,56 +15639,55 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glOrthoxOES(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f) { +void GLTrace_glLineWidthxOES(GLfixed width) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glOrthoxOES); + glmsg.set_function(GLMessage::glLineWidthxOES); - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::INT); - arg_l->add_intvalue(l); + // copy argument width + GLMessage_DataType *arg_width = glmsg.add_args(); + arg_width->set_isarray(false); + arg_width->set_type(GLMessage::DataType::INT); + arg_width->add_intvalue(width); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::INT); - arg_r->add_intvalue(r); + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glLineWidthxOES(width); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::INT); - arg_b->add_intvalue(b); + void *pointerArgs[] = { + }; - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::INT); - arg_t->add_intvalue(t); + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::INT); - arg_n->add_intvalue(n); +void GLTrace_glLoadMatrixxOES(const GLfixed *m) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glLoadMatrixxOES); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::INT); - arg_f->add_intvalue(f); + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glOrthoxOES(l, r, b, t, n, f); + glContext->hooks->gl.glLoadMatrixxOES(m); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28900,11 +15696,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed * params) { +void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointParameterxvOES); + glmsg.set_function(GLMessage::glMaterialxOES); + + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -28912,21 +15714,20 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointParameterxvOES(pname, params); + glContext->hooks->gl.glMaterialxOES(face, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28935,26 +15736,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointSizexOES(GLfixed size) { +void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointSizexOES); + glmsg.set_function(GLMessage::glMaterialxvOES); - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); + // copy argument face + GLMessage_DataType *arg_face = glmsg.add_args(); + arg_face->set_isarray(false); + arg_face->set_type(GLMessage::DataType::ENUM); + arg_face->add_intvalue((int)face); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointSizexOES(size); + glContext->hooks->gl.glMaterialxvOES(face, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28963,32 +15777,27 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units) { +void GLTrace_glMultMatrixxOES(const GLfixed *m) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPolygonOffsetxOES); - - // copy argument factor - GLMessage_DataType *arg_factor = glmsg.add_args(); - arg_factor->set_isarray(false); - arg_factor->set_type(GLMessage::DataType::INT); - arg_factor->add_intvalue(factor); + glmsg.set_function(GLMessage::glMultMatrixxOES); - // copy argument units - GLMessage_DataType *arg_units = glmsg.add_args(); - arg_units->set_isarray(false); - arg_units->set_type(GLMessage::DataType::INT); - arg_units->add_intvalue(units); + // copy argument m + GLMessage_DataType *arg_m = glmsg.add_args(); + arg_m->set_isarray(false); + arg_m->set_type(GLMessage::DataType::INT); + arg_m->add_intvalue((int)m); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPolygonOffsetxOES(factor, units); + glContext->hooks->gl.glMultMatrixxOES(m); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) m, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -28997,40 +15806,46 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { +void GLTrace_glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glRotatexOES); + glmsg.set_function(GLMessage::glMultiTexCoord4xOES); - // copy argument angle - GLMessage_DataType *arg_angle = glmsg.add_args(); - arg_angle->set_isarray(false); - arg_angle->set_type(GLMessage::DataType::INT); - arg_angle->add_intvalue(angle); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); + // copy argument s + GLMessage_DataType *arg_s = glmsg.add_args(); + arg_s->set_isarray(false); + arg_s->set_type(GLMessage::DataType::INT); + arg_s->add_intvalue(s); - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + // copy argument t + GLMessage_DataType *arg_t = glmsg.add_args(); + arg_t->set_isarray(false); + arg_t->set_type(GLMessage::DataType::INT); + arg_t->add_intvalue(t); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument r + GLMessage_DataType *arg_r = glmsg.add_args(); + arg_r->set_isarray(false); + arg_r->set_type(GLMessage::DataType::INT); + arg_r->add_intvalue(r); + + // copy argument q + GLMessage_DataType *arg_q = glmsg.add_args(); + arg_q->set_isarray(false); + arg_q->set_type(GLMessage::DataType::INT); + arg_q->add_intvalue(q); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glRotatexOES(angle, x, y, z); + glContext->hooks->gl.glMultiTexCoord4xOES(target, s, t, r, q); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29043,28 +15858,34 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSampleCoverageOES(GLfixed value, GLboolean invert) { +void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSampleCoverageOES); + glmsg.set_function(GLMessage::glNormal3xOES); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); + // copy argument nx + GLMessage_DataType *arg_nx = glmsg.add_args(); + arg_nx->set_isarray(false); + arg_nx->set_type(GLMessage::DataType::INT); + arg_nx->add_intvalue(nx); - // copy argument invert - GLMessage_DataType *arg_invert = glmsg.add_args(); - arg_invert->set_isarray(false); - arg_invert->set_type(GLMessage::DataType::BOOL); - arg_invert->add_boolvalue(invert); + // copy argument ny + GLMessage_DataType *arg_ny = glmsg.add_args(); + arg_ny->set_isarray(false); + arg_ny->set_type(GLMessage::DataType::INT); + arg_ny->add_intvalue(ny); + + // copy argument nz + GLMessage_DataType *arg_nz = glmsg.add_args(); + arg_nz->set_isarray(false); + arg_nz->set_type(GLMessage::DataType::INT); + arg_nz->add_intvalue(nz); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSampleCoverageOES(value, invert); + glContext->hooks->gl.glNormal3xOES(nx, ny, nz); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29077,34 +15898,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z) { +void GLTrace_glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glScalexOES); - - // copy argument x - GLMessage_DataType *arg_x = glmsg.add_args(); - arg_x->set_isarray(false); - arg_x->set_type(GLMessage::DataType::INT); - arg_x->add_intvalue(x); - - // copy argument y - GLMessage_DataType *arg_y = glmsg.add_args(); - arg_y->set_isarray(false); - arg_y->set_type(GLMessage::DataType::INT); - arg_y->add_intvalue(y); + glmsg.set_function(GLMessage::glOrthoxOES); - // copy argument z - GLMessage_DataType *arg_z = glmsg.add_args(); - arg_z->set_isarray(false); - arg_z->set_type(GLMessage::DataType::INT); - arg_z->add_intvalue(z); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::INT); + arg_left->add_intvalue(left); + + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::INT); + arg_right->add_intvalue(right); + + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::INT); + arg_bottom->add_intvalue(bottom); + + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::INT); + arg_top->add_intvalue(top); + + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::INT); + arg_zNear->add_intvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::INT); + arg_zFar->add_intvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glScalexOES(x, y, z); + glContext->hooks->gl.glOrthoxOES(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29117,17 +15956,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param) { +void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvxOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + glmsg.set_function(GLMessage::glPointParameterxOES); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -29144,7 +15977,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvxOES(target, pname, param); + glContext->hooks->gl.glPointParameterxOES(pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29157,17 +15990,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed * params) { +void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexEnvxvOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + glmsg.set_function(GLMessage::glPointParameterxvOES); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -29178,13 +16005,13 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexEnvxvOES(target, pname, params); + glContext->hooks->gl.glPointParameterxvOES(pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29198,34 +16025,22 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param) { +void GLTrace_glPointSizexOES(GLfixed size) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexParameterxOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); - - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + glmsg.set_function(GLMessage::glPointSizexOES); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexParameterxOES(target, pname, param); + glContext->hooks->gl.glPointSizexOES(size); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29238,39 +16053,32 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed * params) { +void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexParameterxvOES); - - // copy argument target - GLMessage_DataType *arg_target = glmsg.add_args(); - arg_target->set_isarray(false); - arg_target->set_type(GLMessage::DataType::ENUM); - arg_target->add_intvalue((int)target); + glmsg.set_function(GLMessage::glPolygonOffsetxOES); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument factor + GLMessage_DataType *arg_factor = glmsg.add_args(); + arg_factor->set_isarray(false); + arg_factor->set_type(GLMessage::DataType::INT); + arg_factor->add_intvalue(factor); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument units + GLMessage_DataType *arg_units = glmsg.add_args(); + arg_units->set_isarray(false); + arg_units->set_type(GLMessage::DataType::INT); + arg_units->add_intvalue(units); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexParameterxvOES(target, pname, params); + glContext->hooks->gl.glPolygonOffsetxOES(factor, units); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29279,11 +16087,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z) { +void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTranslatexOES); + glmsg.set_function(GLMessage::glRotatexOES); + + // copy argument angle + GLMessage_DataType *arg_angle = glmsg.add_args(); + arg_angle->set_isarray(false); + arg_angle->set_type(GLMessage::DataType::INT); + arg_angle->add_intvalue(angle); // copy argument x GLMessage_DataType *arg_x = glmsg.add_args(); @@ -29306,7 +16120,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTranslatexOES(x, y, z); + glContext->hooks->gl.glRotatexOES(angle, x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29319,39 +16133,32 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed * params) { +void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetLightxvOES); - - // copy argument light - GLMessage_DataType *arg_light = glmsg.add_args(); - arg_light->set_isarray(false); - arg_light->set_type(GLMessage::DataType::ENUM); - arg_light->add_intvalue((int)light); + glmsg.set_function(GLMessage::glSampleCoveragexOES); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument value + GLMessage_DataType *arg_value = glmsg.add_args(); + arg_value->set_isarray(false); + arg_value->set_type(GLMessage::DataType::INT); + arg_value->add_intvalue(value); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument invert + GLMessage_DataType *arg_invert = glmsg.add_args(); + arg_invert->set_isarray(false); + arg_invert->set_type(GLMessage::DataType::BOOL); + arg_invert->add_boolvalue(invert); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetLightxvOES(light, pname, params); + glContext->hooks->gl.glSampleCoveragexOES(value, invert); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29360,39 +16167,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed * params) { +void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetMaterialxvOES); + glmsg.set_function(GLMessage::glScalexOES); - // copy argument face - GLMessage_DataType *arg_face = glmsg.add_args(); - arg_face->set_isarray(false); - arg_face->set_type(GLMessage::DataType::ENUM); - arg_face->add_intvalue((int)face); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetMaterialxvOES(face, pname, params); + glContext->hooks->gl.glScalexOES(x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29401,11 +16207,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param) { +void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointParameterxOES); + glmsg.set_function(GLMessage::glTexEnvxOES); + + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -29422,7 +16234,7 @@ // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointParameterxOES(pname, param); + glContext->hooks->gl.glTexEnvxOES(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29435,32 +16247,39 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert) { +void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glSampleCoveragexOES); + glmsg.set_function(GLMessage::glTexEnvxvOES); - // copy argument value - GLMessage_DataType *arg_value = glmsg.add_args(); - arg_value->set_isarray(false); - arg_value->set_type(GLMessage::DataType::INT); - arg_value->add_intvalue(value); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); - // copy argument invert - GLMessage_DataType *arg_invert = glmsg.add_args(); - arg_invert->set_isarray(false); - arg_invert->set_type(GLMessage::DataType::BOOL); - arg_invert->add_boolvalue(invert); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glSampleCoveragexOES(value, invert); + glContext->hooks->gl.glTexEnvxvOES(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29469,17 +16288,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed * params) { +void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetTexGenxvOES); + glmsg.set_function(GLMessage::glTexParameterxOES); - // copy argument coord - GLMessage_DataType *arg_coord = glmsg.add_args(); - arg_coord->set_isarray(false); - arg_coord->set_type(GLMessage::DataType::ENUM); - arg_coord->add_intvalue((int)coord); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -29487,21 +16306,20 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetTexGenxvOES(coord, pname, params); + glContext->hooks->gl.glTexParameterxOES(target, pname, param); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29510,17 +16328,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param) { +void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexGenxOES); + glmsg.set_function(GLMessage::glTexParameterxvOES); - // copy argument coord - GLMessage_DataType *arg_coord = glmsg.add_args(); - arg_coord->set_isarray(false); - arg_coord->set_type(GLMessage::DataType::ENUM); - arg_coord->add_intvalue((int)coord); + // copy argument target + GLMessage_DataType *arg_target = glmsg.add_args(); + arg_target->set_isarray(false); + arg_target->set_type(GLMessage::DataType::ENUM); + arg_target->add_intvalue((int)target); // copy argument pname GLMessage_DataType *arg_pname = glmsg.add_args(); @@ -29528,20 +16346,21 @@ arg_pname->set_type(GLMessage::DataType::ENUM); arg_pname->add_intvalue((int)pname); - // copy argument param - GLMessage_DataType *arg_param = glmsg.add_args(); - arg_param->set_isarray(false); - arg_param->set_type(GLMessage::DataType::INT); - arg_param->add_intvalue(param); + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexGenxOES(coord, pname, param); + glContext->hooks->gl.glTexParameterxvOES(target, pname, params); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { + (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29550,39 +16369,38 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed * params) { +void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glTexGenxvOES); + glmsg.set_function(GLMessage::glTranslatexOES); - // copy argument coord - GLMessage_DataType *arg_coord = glmsg.add_args(); - arg_coord->set_isarray(false); - arg_coord->set_type(GLMessage::DataType::ENUM); - arg_coord->add_intvalue((int)coord); + // copy argument x + GLMessage_DataType *arg_x = glmsg.add_args(); + arg_x->set_isarray(false); + arg_x->set_type(GLMessage::DataType::INT); + arg_x->add_intvalue(x); - // copy argument pname - GLMessage_DataType *arg_pname = glmsg.add_args(); - arg_pname->set_isarray(false); - arg_pname->set_type(GLMessage::DataType::ENUM); - arg_pname->add_intvalue((int)pname); + // copy argument y + GLMessage_DataType *arg_y = glmsg.add_args(); + arg_y->set_isarray(false); + arg_y->set_type(GLMessage::DataType::INT); + arg_y->add_intvalue(y); - // copy argument params - GLMessage_DataType *arg_params = glmsg.add_args(); - arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + // copy argument z + GLMessage_DataType *arg_z = glmsg.add_args(); + arg_z->set_isarray(false); + arg_z->set_type(GLMessage::DataType::INT); + arg_z->add_intvalue(z); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glTexGenxvOES(coord, pname, params); + glContext->hooks->gl.glTranslatexOES(x, y, z); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) params, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -29661,7 +16479,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint * renderbuffers) { +void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -29676,8 +16494,8 @@ // copy argument renderbuffers GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); arg_renderbuffers->set_isarray(false); - arg_renderbuffers->set_type(GLMessage::DataType::INT64); - arg_renderbuffers->add_int64value((uintptr_t)renderbuffers); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29696,7 +16514,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint * renderbuffers) { +void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -29711,8 +16529,8 @@ // copy argument renderbuffers GLMessage_DataType *arg_renderbuffers = glmsg.add_args(); arg_renderbuffers->set_isarray(false); - arg_renderbuffers->set_type(GLMessage::DataType::INT64); - arg_renderbuffers->add_int64value((uintptr_t)renderbuffers); + arg_renderbuffers->set_type(GLMessage::DataType::INT); + arg_renderbuffers->add_intvalue((int)renderbuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29777,7 +16595,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint * params) { +void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -29798,8 +16616,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29888,7 +16706,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint * framebuffers) { +void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -29903,8 +16721,8 @@ // copy argument framebuffers GLMessage_DataType *arg_framebuffers = glmsg.add_args(); arg_framebuffers->set_isarray(false); - arg_framebuffers->set_type(GLMessage::DataType::INT64); - arg_framebuffers->add_int64value((uintptr_t)framebuffers); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -29923,7 +16741,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint * framebuffers) { +void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -29938,8 +16756,8 @@ // copy argument framebuffers GLMessage_DataType *arg_framebuffers = glmsg.add_args(); arg_framebuffers->set_isarray(false); - arg_framebuffers->set_type(GLMessage::DataType::INT64); - arg_framebuffers->add_int64value((uintptr_t)framebuffers); + arg_framebuffers->set_type(GLMessage::DataType::INT); + arg_framebuffers->add_intvalue((int)framebuffers); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30092,7 +16910,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint * params) { +void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30119,8 +16937,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30192,70 +17010,23 @@ fixupGLMessage(glContext, wallStartTime, wallEndTime, threadStartTime, threadEndTime, &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glLoadPaletteFromModelViewMatrixOES(void) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glLoadPaletteFromModelViewMatrixOES); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glLoadPaletteFromModelViewMatrixOES(); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - - void *pointerArgs[] = { - }; - - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} - -void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const void * pointer) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); - - glmsg.set_function(GLMessage::glMatrixIndexPointerOES); - - // copy argument size - GLMessage_DataType *arg_size = glmsg.add_args(); - arg_size->set_isarray(false); - arg_size->set_type(GLMessage::DataType::INT); - arg_size->add_intvalue(size); - - // copy argument type - GLMessage_DataType *arg_type = glmsg.add_args(); - arg_type->set_isarray(false); - arg_type->set_type(GLMessage::DataType::ENUM); - arg_type->add_intvalue((int)type); + glContext->traceGLMessage(&glmsg); +} - // copy argument stride - GLMessage_DataType *arg_stride = glmsg.add_args(); - arg_stride->set_isarray(false); - arg_stride->set_type(GLMessage::DataType::INT); - arg_stride->add_intvalue(stride); +void GLTrace_glLoadPaletteFromModelViewMatrixOES(void) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); - // copy argument pointer - GLMessage_DataType *arg_pointer = glmsg.add_args(); - arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + glmsg.set_function(GLMessage::glLoadPaletteFromModelViewMatrixOES); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glMatrixIndexPointerOES(size, type, stride, pointer); + glContext->hooks->gl.glLoadPaletteFromModelViewMatrixOES(); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); void *pointerArgs[] = { - (void *) pointer, }; fixupGLMessage(glContext, wallStartTime, wallEndTime, @@ -30264,11 +17035,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const void * pointer) { +void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glWeightPointerOES); + glmsg.set_function(GLMessage::glMatrixIndexPointerOES); // copy argument size GLMessage_DataType *arg_size = glmsg.add_args(); @@ -30291,13 +17062,13 @@ // copy argument pointer GLMessage_DataType *arg_pointer = glmsg.add_args(); arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glWeightPointerOES(size, type, stride, pointer); + glContext->hooks->gl.glMatrixIndexPointerOES(size, type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30311,11 +17082,17 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const void * pointer) { +void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glPointSizePointerOES); + glmsg.set_function(GLMessage::glWeightPointerOES); + + // copy argument size + GLMessage_DataType *arg_size = glmsg.add_args(); + arg_size->set_isarray(false); + arg_size->set_type(GLMessage::DataType::INT); + arg_size->add_intvalue(size); // copy argument type GLMessage_DataType *arg_type = glmsg.add_args(); @@ -30332,13 +17109,13 @@ // copy argument pointer GLMessage_DataType *arg_pointer = glmsg.add_args(); arg_pointer->set_isarray(false); - arg_pointer->set_type(GLMessage::DataType::INT64); - arg_pointer->add_int64value((uintptr_t)pointer); + arg_pointer->set_type(GLMessage::DataType::INT); + arg_pointer->add_intvalue((int)pointer); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glPointSizePointerOES(type, stride, pointer); + glContext->hooks->gl.glWeightPointerOES(size, type, stride, pointer); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30352,7 +17129,7 @@ glContext->traceGLMessage(&glmsg); } -GLbitfield GLTrace_glQueryMatrixxOES(GLfixed * mantissa, GLint * exponent) { +GLbitfield GLTrace_glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30361,14 +17138,14 @@ // copy argument mantissa GLMessage_DataType *arg_mantissa = glmsg.add_args(); arg_mantissa->set_isarray(false); - arg_mantissa->set_type(GLMessage::DataType::INT64); - arg_mantissa->add_int64value((uintptr_t)mantissa); + arg_mantissa->set_type(GLMessage::DataType::INT); + arg_mantissa->add_intvalue((int)mantissa); // copy argument exponent GLMessage_DataType *arg_exponent = glmsg.add_args(); arg_exponent->set_isarray(false); - arg_exponent->set_type(GLMessage::DataType::INT64); - arg_exponent->add_int64value((uintptr_t)exponent); + arg_exponent->set_type(GLMessage::DataType::INT); + arg_exponent->add_intvalue((int)exponent); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30396,22 +17173,28 @@ return retValue; } -void GLTrace_glClearDepthfOES(GLclampf depth) { +void GLTrace_glDepthRangefOES(GLclampf zNear, GLclampf zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClearDepthfOES); + glmsg.set_function(GLMessage::glDepthRangefOES); - // copy argument depth - GLMessage_DataType *arg_depth = glmsg.add_args(); - arg_depth->set_isarray(false); - arg_depth->set_type(GLMessage::DataType::FLOAT); - arg_depth->add_floatvalue(depth); + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); + + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClearDepthfOES(depth); + glContext->hooks->gl.glDepthRangefOES(zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30424,63 +17207,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat * equation) { +void GLTrace_glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glClipPlanefOES); - - // copy argument plane - GLMessage_DataType *arg_plane = glmsg.add_args(); - arg_plane->set_isarray(false); - arg_plane->set_type(GLMessage::DataType::ENUM); - arg_plane->add_intvalue((int)plane); - - // copy argument equation - GLMessage_DataType *arg_equation = glmsg.add_args(); - arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); - - // call function - nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glClipPlanefOES(plane, equation); - nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); - nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + glmsg.set_function(GLMessage::glFrustumfOES); - void *pointerArgs[] = { - (void *) equation, - }; + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); - fixupGLMessage(glContext, wallStartTime, wallEndTime, - threadStartTime, threadEndTime, - &glmsg, pointerArgs); - glContext->traceGLMessage(&glmsg); -} + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); -void GLTrace_glDepthRangefOES(GLclampf n, GLclampf f) { - GLMessage glmsg; - GLTraceContext *glContext = getGLTraceContext(); + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); - glmsg.set_function(GLMessage::glDepthRangefOES); + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::FLOAT); - arg_n->add_floatvalue(n); + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::FLOAT); - arg_f->add_floatvalue(f); + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glDepthRangefOES(n, f); + glContext->hooks->gl.glFrustumfOES(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30493,52 +17265,52 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glFrustumfOES(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { +void GLTrace_glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glFrustumfOES); + glmsg.set_function(GLMessage::glOrthofOES); - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::FLOAT); - arg_l->add_floatvalue(l); + // copy argument left + GLMessage_DataType *arg_left = glmsg.add_args(); + arg_left->set_isarray(false); + arg_left->set_type(GLMessage::DataType::FLOAT); + arg_left->add_floatvalue(left); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::FLOAT); - arg_r->add_floatvalue(r); + // copy argument right + GLMessage_DataType *arg_right = glmsg.add_args(); + arg_right->set_isarray(false); + arg_right->set_type(GLMessage::DataType::FLOAT); + arg_right->add_floatvalue(right); - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::FLOAT); - arg_b->add_floatvalue(b); + // copy argument bottom + GLMessage_DataType *arg_bottom = glmsg.add_args(); + arg_bottom->set_isarray(false); + arg_bottom->set_type(GLMessage::DataType::FLOAT); + arg_bottom->add_floatvalue(bottom); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::FLOAT); - arg_t->add_floatvalue(t); + // copy argument top + GLMessage_DataType *arg_top = glmsg.add_args(); + arg_top->set_isarray(false); + arg_top->set_type(GLMessage::DataType::FLOAT); + arg_top->add_floatvalue(top); - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::FLOAT); - arg_n->add_floatvalue(n); + // copy argument zNear + GLMessage_DataType *arg_zNear = glmsg.add_args(); + arg_zNear->set_isarray(false); + arg_zNear->set_type(GLMessage::DataType::FLOAT); + arg_zNear->add_floatvalue(zNear); - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::FLOAT); - arg_f->add_floatvalue(f); + // copy argument zFar + GLMessage_DataType *arg_zFar = glmsg.add_args(); + arg_zFar->set_isarray(false); + arg_zFar->set_type(GLMessage::DataType::FLOAT); + arg_zFar->add_floatvalue(zFar); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glFrustumfOES(l, r, b, t, n, f); + glContext->hooks->gl.glOrthofOES(left, right, bottom, top, zNear, zFar); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30551,11 +17323,11 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetClipPlanefOES(GLenum plane, GLfloat * equation) { +void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat *equation) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glGetClipPlanefOES); + glmsg.set_function(GLMessage::glClipPlanefOES); // copy argument plane GLMessage_DataType *arg_plane = glmsg.add_args(); @@ -30566,13 +17338,13 @@ // copy argument equation GLMessage_DataType *arg_equation = glmsg.add_args(); arg_equation->set_isarray(false); - arg_equation->set_type(GLMessage::DataType::INT64); - arg_equation->add_int64value((uintptr_t)equation); + arg_equation->set_type(GLMessage::DataType::INT); + arg_equation->add_intvalue((int)equation); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glGetClipPlanefOES(plane, equation); + glContext->hooks->gl.glClipPlanefOES(plane, equation); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30586,52 +17358,57 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glOrthofOES(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f) { +void GLTrace_glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); - glmsg.set_function(GLMessage::glOrthofOES); + glmsg.set_function(GLMessage::glGetClipPlanefOES); - // copy argument l - GLMessage_DataType *arg_l = glmsg.add_args(); - arg_l->set_isarray(false); - arg_l->set_type(GLMessage::DataType::FLOAT); - arg_l->add_floatvalue(l); + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); - // copy argument r - GLMessage_DataType *arg_r = glmsg.add_args(); - arg_r->set_isarray(false); - arg_r->set_type(GLMessage::DataType::FLOAT); - arg_r->add_floatvalue(r); + // copy argument eqn + GLMessage_DataType *arg_eqn = glmsg.add_args(); + arg_eqn->set_isarray(false); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); - // copy argument b - GLMessage_DataType *arg_b = glmsg.add_args(); - arg_b->set_isarray(false); - arg_b->set_type(GLMessage::DataType::FLOAT); - arg_b->add_floatvalue(b); + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGetClipPlanefOES(pname, eqn); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); - // copy argument t - GLMessage_DataType *arg_t = glmsg.add_args(); - arg_t->set_isarray(false); - arg_t->set_type(GLMessage::DataType::FLOAT); - arg_t->add_floatvalue(t); + void *pointerArgs[] = { + (void *) eqn, + }; - // copy argument n - GLMessage_DataType *arg_n = glmsg.add_args(); - arg_n->set_isarray(false); - arg_n->set_type(GLMessage::DataType::FLOAT); - arg_n->add_floatvalue(n); + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} - // copy argument f - GLMessage_DataType *arg_f = glmsg.add_args(); - arg_f->set_isarray(false); - arg_f->set_type(GLMessage::DataType::FLOAT); - arg_f->add_floatvalue(f); +void GLTrace_glClearDepthfOES(GLclampf depth) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glClearDepthfOES); + + // copy argument depth + GLMessage_DataType *arg_depth = glmsg.add_args(); + arg_depth->set_isarray(false); + arg_depth->set_type(GLMessage::DataType::FLOAT); + arg_depth->add_floatvalue(depth); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); - glContext->hooks->gl.glOrthofOES(l, r, b, t, n, f); + glContext->hooks->gl.glClearDepthfOES(depth); nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30684,7 +17461,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat * params) { +void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30705,8 +17482,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30765,7 +17542,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint * params) { +void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30786,8 +17563,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30806,7 +17583,88 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat * params) { +void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenxOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument param + GLMessage_DataType *arg_param = glmsg.add_args(); + arg_param->set_isarray(false); + arg_param->set_type(GLMessage::DataType::INT); + arg_param->add_intvalue(param); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glTexGenxOES(coord, pname, param); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glTexGenxvOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glTexGenxvOES(coord, pname, params); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + (void *) params, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30827,8 +17685,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30847,7 +17705,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint * params) { +void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30868,8 +17726,8 @@ // copy argument params GLMessage_DataType *arg_params = glmsg.add_args(); arg_params->set_isarray(false); - arg_params->set_type(GLMessage::DataType::INT64); - arg_params->add_int64value((uintptr_t)params); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30888,7 +17746,48 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat * eqn) { +void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params) { + GLMessage glmsg; + GLTraceContext *glContext = getGLTraceContext(); + + glmsg.set_function(GLMessage::glGetTexGenxvOES); + + // copy argument coord + GLMessage_DataType *arg_coord = glmsg.add_args(); + arg_coord->set_isarray(false); + arg_coord->set_type(GLMessage::DataType::ENUM); + arg_coord->add_intvalue((int)coord); + + // copy argument pname + GLMessage_DataType *arg_pname = glmsg.add_args(); + arg_pname->set_isarray(false); + arg_pname->set_type(GLMessage::DataType::ENUM); + arg_pname->add_intvalue((int)pname); + + // copy argument params + GLMessage_DataType *arg_params = glmsg.add_args(); + arg_params->set_isarray(false); + arg_params->set_type(GLMessage::DataType::INT); + arg_params->add_intvalue((int)params); + + // call function + nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); + nsecs_t threadStartTime = systemTime(SYSTEM_TIME_THREAD); + glContext->hooks->gl.glGetTexGenxvOES(coord, pname, params); + nsecs_t threadEndTime = systemTime(SYSTEM_TIME_THREAD); + nsecs_t wallEndTime = systemTime(SYSTEM_TIME_MONOTONIC); + + void *pointerArgs[] = { + (void *) params, + }; + + fixupGLMessage(glContext, wallStartTime, wallEndTime, + threadStartTime, threadEndTime, + &glmsg, pointerArgs); + glContext->traceGLMessage(&glmsg); +} + +void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30903,8 +17802,8 @@ // copy argument eqn GLMessage_DataType *arg_eqn = glmsg.add_args(); arg_eqn->set_isarray(false); - arg_eqn->set_type(GLMessage::DataType::INT64); - arg_eqn->add_int64value((uintptr_t)eqn); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); @@ -30923,7 +17822,7 @@ glContext->traceGLMessage(&glmsg); } -void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed * eqn) { +void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn) { GLMessage glmsg; GLTraceContext *glContext = getGLTraceContext(); @@ -30938,8 +17837,8 @@ // copy argument eqn GLMessage_DataType *arg_eqn = glmsg.add_args(); arg_eqn->set_isarray(false); - arg_eqn->set_type(GLMessage::DataType::INT64); - arg_eqn->add_int64value((uintptr_t)eqn); + arg_eqn->set_type(GLMessage::DataType::INT); + arg_eqn->add_intvalue((int)eqn); // call function nsecs_t wallStartTime = systemTime(SYSTEM_TIME_MONOTONIC); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_api.h android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_api.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_api.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_api.h 2012-10-16 22:57:11.000000000 +0000 @@ -23,46 +23,46 @@ void GLTrace_glActiveTexture(GLenum texture); void GLTrace_glAttachShader(GLuint program, GLuint shader); -void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar * name); +void GLTrace_glBindAttribLocation(GLuint program, GLuint index, const GLchar* name); void GLTrace_glBindBuffer(GLenum target, GLuint buffer); void GLTrace_glBindFramebuffer(GLenum target, GLuint framebuffer); void GLTrace_glBindRenderbuffer(GLenum target, GLuint renderbuffer); void GLTrace_glBindTexture(GLenum target, GLuint texture); -void GLTrace_glBlendColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); +void GLTrace_glBlendColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); void GLTrace_glBlendEquation(GLenum mode); void GLTrace_glBlendEquationSeparate(GLenum modeRGB, GLenum modeAlpha); void GLTrace_glBlendFunc(GLenum sfactor, GLenum dfactor); -void GLTrace_glBlendFuncSeparate(GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha); -void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const void * data, GLenum usage); -void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const void * data); +void GLTrace_glBlendFuncSeparate(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); +void GLTrace_glBufferData(GLenum target, GLsizeiptr size, const GLvoid* data, GLenum usage); +void GLTrace_glBufferSubData(GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid* data); GLenum GLTrace_glCheckFramebufferStatus(GLenum target); void GLTrace_glClear(GLbitfield mask); -void GLTrace_glClearColor(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); -void GLTrace_glClearDepthf(GLfloat d); +void GLTrace_glClearColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); +void GLTrace_glClearDepthf(GLclampf depth); void GLTrace_glClearStencil(GLint s); void GLTrace_glColorMask(GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha); void GLTrace_glCompileShader(GLuint shader); -void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data); -void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data); +void GLTrace_glCompressedTexImage2D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid* data); +void GLTrace_glCompressedTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid* data); void GLTrace_glCopyTexImage2D(GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border); void GLTrace_glCopyTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height); GLuint GLTrace_glCreateProgram(void); GLuint GLTrace_glCreateShader(GLenum type); void GLTrace_glCullFace(GLenum mode); -void GLTrace_glDeleteBuffers(GLsizei n, const GLuint * buffers); -void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint * framebuffers); +void GLTrace_glDeleteBuffers(GLsizei n, const GLuint* buffers); +void GLTrace_glDeleteFramebuffers(GLsizei n, const GLuint* framebuffers); void GLTrace_glDeleteProgram(GLuint program); -void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint * renderbuffers); +void GLTrace_glDeleteRenderbuffers(GLsizei n, const GLuint* renderbuffers); void GLTrace_glDeleteShader(GLuint shader); -void GLTrace_glDeleteTextures(GLsizei n, const GLuint * textures); +void GLTrace_glDeleteTextures(GLsizei n, const GLuint* textures); void GLTrace_glDepthFunc(GLenum func); void GLTrace_glDepthMask(GLboolean flag); -void GLTrace_glDepthRangef(GLfloat n, GLfloat f); +void GLTrace_glDepthRangef(GLclampf zNear, GLclampf zFar); void GLTrace_glDetachShader(GLuint program, GLuint shader); void GLTrace_glDisable(GLenum cap); void GLTrace_glDisableVertexAttribArray(GLuint index); void GLTrace_glDrawArrays(GLenum mode, GLint first, GLsizei count); -void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const void * indices); +void GLTrace_glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices); void GLTrace_glEnable(GLenum cap); void GLTrace_glEnableVertexAttribArray(GLuint index); void GLTrace_glFinish(void); @@ -70,37 +70,37 @@ void GLTrace_glFramebufferRenderbuffer(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); void GLTrace_glFramebufferTexture2D(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); void GLTrace_glFrontFace(GLenum mode); -void GLTrace_glGenBuffers(GLsizei n, GLuint * buffers); +void GLTrace_glGenBuffers(GLsizei n, GLuint* buffers); void GLTrace_glGenerateMipmap(GLenum target); -void GLTrace_glGenFramebuffers(GLsizei n, GLuint * framebuffers); -void GLTrace_glGenRenderbuffers(GLsizei n, GLuint * renderbuffers); -void GLTrace_glGenTextures(GLsizei n, GLuint * textures); -void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); -void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name); -void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders); -GLint GLTrace_glGetAttribLocation(GLuint program, const GLchar * name); -void GLTrace_glGetBooleanv(GLenum pname, GLboolean * data); -void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint * params); +void GLTrace_glGenFramebuffers(GLsizei n, GLuint* framebuffers); +void GLTrace_glGenRenderbuffers(GLsizei n, GLuint* renderbuffers); +void GLTrace_glGenTextures(GLsizei n, GLuint* textures); +void GLTrace_glGetActiveAttrib(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +void GLTrace_glGetActiveUniform(GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name); +void GLTrace_glGetAttachedShaders(GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders); +int GLTrace_glGetAttribLocation(GLuint program, const GLchar* name); +void GLTrace_glGetBooleanv(GLenum pname, GLboolean* params); +void GLTrace_glGetBufferParameteriv(GLenum target, GLenum pname, GLint* params); GLenum GLTrace_glGetError(void); -void GLTrace_glGetFloatv(GLenum pname, GLfloat * data); -void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint * params); -void GLTrace_glGetIntegerv(GLenum pname, GLint * data); -void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint * params); -void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint * params); -void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision); -void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source); -const GLubyte * GLTrace_glGetString(GLenum name); -void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat * params); -void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat * params); -void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint * params); -GLint GLTrace_glGetUniformLocation(GLuint program, const GLchar * name); -void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat * params); -void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint * params); -void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, void ** pointer); +void GLTrace_glGetFloatv(GLenum pname, GLfloat* params); +void GLTrace_glGetFramebufferAttachmentParameteriv(GLenum target, GLenum attachment, GLenum pname, GLint* params); +void GLTrace_glGetIntegerv(GLenum pname, GLint* params); +void GLTrace_glGetProgramiv(GLuint program, GLenum pname, GLint* params); +void GLTrace_glGetProgramInfoLog(GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog); +void GLTrace_glGetRenderbufferParameteriv(GLenum target, GLenum pname, GLint* params); +void GLTrace_glGetShaderiv(GLuint shader, GLenum pname, GLint* params); +void GLTrace_glGetShaderInfoLog(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog); +void GLTrace_glGetShaderPrecisionFormat(GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision); +void GLTrace_glGetShaderSource(GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source); +const GLubyte* GLTrace_glGetString(GLenum name); +void GLTrace_glGetTexParameterfv(GLenum target, GLenum pname, GLfloat* params); +void GLTrace_glGetTexParameteriv(GLenum target, GLenum pname, GLint* params); +void GLTrace_glGetUniformfv(GLuint program, GLint location, GLfloat* params); +void GLTrace_glGetUniformiv(GLuint program, GLint location, GLint* params); +int GLTrace_glGetUniformLocation(GLuint program, const GLchar* name); +void GLTrace_glGetVertexAttribfv(GLuint index, GLenum pname, GLfloat* params); +void GLTrace_glGetVertexAttribiv(GLuint index, GLenum pname, GLint* params); +void GLTrace_glGetVertexAttribPointerv(GLuint index, GLenum pname, GLvoid** pointer); void GLTrace_glHint(GLenum target, GLenum mode); GLboolean GLTrace_glIsBuffer(GLuint buffer); GLboolean GLTrace_glIsEnabled(GLenum cap); @@ -113,524 +113,252 @@ void GLTrace_glLinkProgram(GLuint program); void GLTrace_glPixelStorei(GLenum pname, GLint param); void GLTrace_glPolygonOffset(GLfloat factor, GLfloat units); -void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels); +void GLTrace_glReadPixels(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid* pixels); void GLTrace_glReleaseShaderCompiler(void); void GLTrace_glRenderbufferStorage(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glSampleCoverage(GLfloat value, GLboolean invert); +void GLTrace_glSampleCoverage(GLclampf value, GLboolean invert); void GLTrace_glScissor(GLint x, GLint y, GLsizei width, GLsizei height); -void GLTrace_glShaderBinary(GLsizei count, const GLuint * shaders, GLenum binaryformat, const void * binary, GLsizei length); -void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length); +void GLTrace_glShaderBinary(GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length); +void GLTrace_glShaderSource(GLuint shader, GLsizei count, const GLchar** string, const GLint* length); void GLTrace_glStencilFunc(GLenum func, GLint ref, GLuint mask); void GLTrace_glStencilFuncSeparate(GLenum face, GLenum func, GLint ref, GLuint mask); void GLTrace_glStencilMask(GLuint mask); void GLTrace_glStencilMaskSeparate(GLenum face, GLuint mask); void GLTrace_glStencilOp(GLenum fail, GLenum zfail, GLenum zpass); -void GLTrace_glStencilOpSeparate(GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass); -void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels); +void GLTrace_glStencilOpSeparate(GLenum face, GLenum fail, GLenum zfail, GLenum zpass); +void GLTrace_glTexImage2D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid* pixels); void GLTrace_glTexParameterf(GLenum target, GLenum pname, GLfloat param); -void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat * params); +void GLTrace_glTexParameterfv(GLenum target, GLenum pname, const GLfloat* params); void GLTrace_glTexParameteri(GLenum target, GLenum pname, GLint param); -void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint * params); -void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels); -void GLTrace_glUniform1f(GLint location, GLfloat v0); -void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glUniform1i(GLint location, GLint v0); -void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint * value); -void GLTrace_glUniform2f(GLint location, GLfloat v0, GLfloat v1); -void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glUniform2i(GLint location, GLint v0, GLint v1); -void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint * value); -void GLTrace_glUniform3f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glUniform3i(GLint location, GLint v0, GLint v1, GLint v2); -void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint * value); -void GLTrace_glUniform4f(GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glUniform4i(GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint * value); -void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); +void GLTrace_glTexParameteriv(GLenum target, GLenum pname, const GLint* params); +void GLTrace_glTexSubImage2D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid* pixels); +void GLTrace_glUniform1f(GLint location, GLfloat x); +void GLTrace_glUniform1fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform1i(GLint location, GLint x); +void GLTrace_glUniform1iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniform2f(GLint location, GLfloat x, GLfloat y); +void GLTrace_glUniform2fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform2i(GLint location, GLint x, GLint y); +void GLTrace_glUniform2iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniform3f(GLint location, GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glUniform3fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform3i(GLint location, GLint x, GLint y, GLint z); +void GLTrace_glUniform3iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniform4f(GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void GLTrace_glUniform4fv(GLint location, GLsizei count, const GLfloat* v); +void GLTrace_glUniform4i(GLint location, GLint x, GLint y, GLint z, GLint w); +void GLTrace_glUniform4iv(GLint location, GLsizei count, const GLint* v); +void GLTrace_glUniformMatrix2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +void GLTrace_glUniformMatrix3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); +void GLTrace_glUniformMatrix4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat* value); void GLTrace_glUseProgram(GLuint program); void GLTrace_glValidateProgram(GLuint program); -void GLTrace_glVertexAttrib1f(GLuint index, GLfloat x); -void GLTrace_glVertexAttrib1fv(GLuint index, const GLfloat * v); -void GLTrace_glVertexAttrib2f(GLuint index, GLfloat x, GLfloat y); -void GLTrace_glVertexAttrib2fv(GLuint index, const GLfloat * v); -void GLTrace_glVertexAttrib3f(GLuint index, GLfloat x, GLfloat y, GLfloat z); -void GLTrace_glVertexAttrib3fv(GLuint index, const GLfloat * v); -void GLTrace_glVertexAttrib4f(GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w); -void GLTrace_glVertexAttrib4fv(GLuint index, const GLfloat * v); -void GLTrace_glVertexAttribPointer(GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer); +void GLTrace_glVertexAttrib1f(GLuint indx, GLfloat x); +void GLTrace_glVertexAttrib1fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttrib2f(GLuint indx, GLfloat x, GLfloat y); +void GLTrace_glVertexAttrib2fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttrib3f(GLuint indx, GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glVertexAttrib3fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttrib4f(GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void GLTrace_glVertexAttrib4fv(GLuint indx, const GLfloat* values); +void GLTrace_glVertexAttribPointer(GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr); void GLTrace_glViewport(GLint x, GLint y, GLsizei width, GLsizei height); -void GLTrace_glReadBuffer(GLenum mode); -void GLTrace_glDrawRangeElements(GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices); -void GLTrace_glTexImage3D(GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels); -void GLTrace_glTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels); -void GLTrace_glCopyTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -void GLTrace_glCompressedTexImage3D(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data); -void GLTrace_glCompressedTexSubImage3D(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data); -void GLTrace_glGenQueries(GLsizei n, GLuint * ids); -void GLTrace_glDeleteQueries(GLsizei n, const GLuint * ids); -GLboolean GLTrace_glIsQuery(GLuint id); -void GLTrace_glBeginQuery(GLenum target, GLuint id); -void GLTrace_glEndQuery(GLenum target); -void GLTrace_glGetQueryiv(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetQueryObjectuiv(GLuint id, GLenum pname, GLuint * params); -GLboolean GLTrace_glUnmapBuffer(GLenum target); -void GLTrace_glGetBufferPointerv(GLenum target, GLenum pname, void ** params); -void GLTrace_glDrawBuffers(GLsizei n, const GLenum * bufs); -void GLTrace_glUniformMatrix2x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix3x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix2x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix4x2fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix3x4fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix4x3fv(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glBlitFramebuffer(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -void GLTrace_glRenderbufferStorageMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glFramebufferTextureLayer(GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer); -void * GLTrace_glMapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -void GLTrace_glFlushMappedBufferRange(GLenum target, GLintptr offset, GLsizeiptr length); -void GLTrace_glBindVertexArray(GLuint array); -void GLTrace_glDeleteVertexArrays(GLsizei n, const GLuint * arrays); -void GLTrace_glGenVertexArrays(GLsizei n, GLuint * arrays); -GLboolean GLTrace_glIsVertexArray(GLuint array); -void GLTrace_glGetIntegeri_v(GLenum target, GLuint index, GLint * data); -void GLTrace_glBeginTransformFeedback(GLenum primitiveMode); -void GLTrace_glEndTransformFeedback(void); -void GLTrace_glBindBufferRange(GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size); -void GLTrace_glBindBufferBase(GLenum target, GLuint index, GLuint buffer); -void GLTrace_glTransformFeedbackVaryings(GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode); -void GLTrace_glGetTransformFeedbackVarying(GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name); -void GLTrace_glVertexAttribIPointer(GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer); -void GLTrace_glGetVertexAttribIiv(GLuint index, GLenum pname, GLint * params); -void GLTrace_glGetVertexAttribIuiv(GLuint index, GLenum pname, GLuint * params); -void GLTrace_glVertexAttribI4i(GLuint index, GLint x, GLint y, GLint z, GLint w); -void GLTrace_glVertexAttribI4ui(GLuint index, GLuint x, GLuint y, GLuint z, GLuint w); -void GLTrace_glVertexAttribI4iv(GLuint index, const GLint * v); -void GLTrace_glVertexAttribI4uiv(GLuint index, const GLuint * v); -void GLTrace_glGetUniformuiv(GLuint program, GLint location, GLuint * params); -GLint GLTrace_glGetFragDataLocation(GLuint program, const GLchar * name); -void GLTrace_glUniform1ui(GLint location, GLuint v0); -void GLTrace_glUniform2ui(GLint location, GLuint v0, GLuint v1); -void GLTrace_glUniform3ui(GLint location, GLuint v0, GLuint v1, GLuint v2); -void GLTrace_glUniform4ui(GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void GLTrace_glUniform1uiv(GLint location, GLsizei count, const GLuint * value); -void GLTrace_glUniform2uiv(GLint location, GLsizei count, const GLuint * value); -void GLTrace_glUniform3uiv(GLint location, GLsizei count, const GLuint * value); -void GLTrace_glUniform4uiv(GLint location, GLsizei count, const GLuint * value); -void GLTrace_glClearBufferiv(GLenum buffer, GLint drawbuffer, const GLint * value); -void GLTrace_glClearBufferuiv(GLenum buffer, GLint drawbuffer, const GLuint * value); -void GLTrace_glClearBufferfv(GLenum buffer, GLint drawbuffer, const GLfloat * value); -void GLTrace_glClearBufferfi(GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil); -const GLubyte * GLTrace_glGetStringi(GLenum name, GLuint index); -void GLTrace_glCopyBufferSubData(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); -void GLTrace_glGetUniformIndices(GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices); -void GLTrace_glGetActiveUniformsiv(GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params); -GLuint GLTrace_glGetUniformBlockIndex(GLuint program, const GLchar * uniformBlockName); -void GLTrace_glGetActiveUniformBlockiv(GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params); -void GLTrace_glGetActiveUniformBlockName(GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName); -void GLTrace_glUniformBlockBinding(GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding); -void GLTrace_glDrawArraysInstanced(GLenum mode, GLint first, GLsizei count, GLsizei instancecount); -void GLTrace_glDrawElementsInstanced(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount); -GLsync GLTrace_glFenceSync(GLenum condition, GLbitfield flags); -GLboolean GLTrace_glIsSync(GLsync sync); -void GLTrace_glDeleteSync(GLsync sync); -GLenum GLTrace_glClientWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); -void GLTrace_glWaitSync(GLsync sync, GLbitfield flags, GLuint64 timeout); -void GLTrace_glGetInteger64v(GLenum pname, GLint64 * data); -void GLTrace_glGetSynciv(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); -void GLTrace_glGetInteger64i_v(GLenum target, GLuint index, GLint64 * data); -void GLTrace_glGetBufferParameteri64v(GLenum target, GLenum pname, GLint64 * params); -void GLTrace_glGenSamplers(GLsizei count, GLuint * samplers); -void GLTrace_glDeleteSamplers(GLsizei count, const GLuint * samplers); -GLboolean GLTrace_glIsSampler(GLuint sampler); -void GLTrace_glBindSampler(GLuint unit, GLuint sampler); -void GLTrace_glSamplerParameteri(GLuint sampler, GLenum pname, GLint param); -void GLTrace_glSamplerParameteriv(GLuint sampler, GLenum pname, const GLint * param); -void GLTrace_glSamplerParameterf(GLuint sampler, GLenum pname, GLfloat param); -void GLTrace_glSamplerParameterfv(GLuint sampler, GLenum pname, const GLfloat * param); -void GLTrace_glGetSamplerParameteriv(GLuint sampler, GLenum pname, GLint * params); -void GLTrace_glGetSamplerParameterfv(GLuint sampler, GLenum pname, GLfloat * params); -void GLTrace_glVertexAttribDivisor(GLuint index, GLuint divisor); -void GLTrace_glBindTransformFeedback(GLenum target, GLuint id); -void GLTrace_glDeleteTransformFeedbacks(GLsizei n, const GLuint * ids); -void GLTrace_glGenTransformFeedbacks(GLsizei n, GLuint * ids); -GLboolean GLTrace_glIsTransformFeedback(GLuint id); -void GLTrace_glPauseTransformFeedback(void); -void GLTrace_glResumeTransformFeedback(void); -void GLTrace_glGetProgramBinary(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary); -void GLTrace_glProgramBinary(GLuint program, GLenum binaryFormat, const void * binary, GLsizei length); -void GLTrace_glProgramParameteri(GLuint program, GLenum pname, GLint value); -void GLTrace_glInvalidateFramebuffer(GLenum target, GLsizei numAttachments, const GLenum * attachments); -void GLTrace_glInvalidateSubFramebuffer(GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height); -void GLTrace_glTexStorage2D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glTexStorage3D(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -void GLTrace_glGetInternalformativ(GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint * params); -void GLTrace_glDispatchCompute(GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z); -void GLTrace_glDispatchComputeIndirect(GLintptr indirect); -void GLTrace_glDrawArraysIndirect(GLenum mode, const void * indirect); -void GLTrace_glDrawElementsIndirect(GLenum mode, GLenum type, const void * indirect); -void GLTrace_glFramebufferParameteri(GLenum target, GLenum pname, GLint param); -void GLTrace_glGetFramebufferParameteriv(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetProgramInterfaceiv(GLuint program, GLenum programInterface, GLenum pname, GLint * params); -GLuint GLTrace_glGetProgramResourceIndex(GLuint program, GLenum programInterface, const GLchar * name); -void GLTrace_glGetProgramResourceName(GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name); -void GLTrace_glGetProgramResourceiv(GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params); -GLint GLTrace_glGetProgramResourceLocation(GLuint program, GLenum programInterface, const GLchar * name); -void GLTrace_glUseProgramStages(GLuint pipeline, GLbitfield stages, GLuint program); -void GLTrace_glActiveShaderProgram(GLuint pipeline, GLuint program); -GLuint GLTrace_glCreateShaderProgramv(GLenum type, GLsizei count, const GLchar *const* strings); -void GLTrace_glBindProgramPipeline(GLuint pipeline); -void GLTrace_glDeleteProgramPipelines(GLsizei n, const GLuint * pipelines); -void GLTrace_glGenProgramPipelines(GLsizei n, GLuint * pipelines); -GLboolean GLTrace_glIsProgramPipeline(GLuint pipeline); -void GLTrace_glGetProgramPipelineiv(GLuint pipeline, GLenum pname, GLint * params); -void GLTrace_glProgramUniform1i(GLuint program, GLint location, GLint v0); -void GLTrace_glProgramUniform2i(GLuint program, GLint location, GLint v0, GLint v1); -void GLTrace_glProgramUniform3i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -void GLTrace_glProgramUniform4i(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -void GLTrace_glProgramUniform1ui(GLuint program, GLint location, GLuint v0); -void GLTrace_glProgramUniform2ui(GLuint program, GLint location, GLuint v0, GLuint v1); -void GLTrace_glProgramUniform3ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -void GLTrace_glProgramUniform4ui(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void GLTrace_glProgramUniform1f(GLuint program, GLint location, GLfloat v0); -void GLTrace_glProgramUniform2f(GLuint program, GLint location, GLfloat v0, GLfloat v1); -void GLTrace_glProgramUniform3f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -void GLTrace_glProgramUniform4f(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -void GLTrace_glProgramUniform1iv(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform2iv(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform3iv(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform4iv(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform1uiv(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform2uiv(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform3uiv(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform4uiv(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform1fv(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform2fv(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform3fv(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform4fv(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniformMatrix2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix2x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix3x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix2x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix4x2fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix3x4fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix4x3fv(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glValidateProgramPipeline(GLuint pipeline); -void GLTrace_glGetProgramPipelineInfoLog(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -void GLTrace_glBindImageTexture(GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format); -void GLTrace_glGetBooleani_v(GLenum target, GLuint index, GLboolean * data); -void GLTrace_glMemoryBarrier(GLbitfield barriers); -void GLTrace_glMemoryBarrierByRegion(GLbitfield barriers); -void GLTrace_glTexStorage2DMultisample(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations); -void GLTrace_glGetMultisamplefv(GLenum pname, GLuint index, GLfloat * val); -void GLTrace_glSampleMaski(GLuint maskNumber, GLbitfield mask); -void GLTrace_glGetTexLevelParameteriv(GLenum target, GLint level, GLenum pname, GLint * params); -void GLTrace_glGetTexLevelParameterfv(GLenum target, GLint level, GLenum pname, GLfloat * params); -void GLTrace_glBindVertexBuffer(GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride); -void GLTrace_glVertexAttribFormat(GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset); -void GLTrace_glVertexAttribIFormat(GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset); -void GLTrace_glVertexAttribBinding(GLuint attribindex, GLuint bindingindex); -void GLTrace_glVertexBindingDivisor(GLuint bindingindex, GLuint divisor); // Declarations for GL2Ext APIs -void GLTrace_glBlendBarrierKHR(void); -void GLTrace_glDebugMessageControlKHR(GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled); -void GLTrace_glDebugMessageInsertKHR(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf); -void GLTrace_glDebugMessageCallbackKHR(GLDEBUGPROCKHR callback, const void * userParam); -GLuint GLTrace_glGetDebugMessageLogKHR(GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog); -void GLTrace_glPushDebugGroupKHR(GLenum source, GLuint id, GLsizei length, const GLchar * message); -void GLTrace_glPopDebugGroupKHR(void); -void GLTrace_glObjectLabelKHR(GLenum identifier, GLuint name, GLsizei length, const GLchar * label); -void GLTrace_glGetObjectLabelKHR(GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label); -void GLTrace_glObjectPtrLabelKHR(const void * ptr, GLsizei length, const GLchar * label); -void GLTrace_glGetObjectPtrLabelKHR(const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label); -void GLTrace_glGetPointervKHR(GLenum pname, void ** params); void GLTrace_glEGLImageTargetTexture2DOES(GLenum target, GLeglImageOES image); void GLTrace_glEGLImageTargetRenderbufferStorageOES(GLenum target, GLeglImageOES image); -void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary); -void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const void * binary, GLint length); -void * GLTrace_glMapBufferOES(GLenum target, GLenum access); +void GLTrace_glGetProgramBinaryOES(GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary); +void GLTrace_glProgramBinaryOES(GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length); +void* GLTrace_glMapBufferOES(GLenum target, GLenum access); GLboolean GLTrace_glUnmapBufferOES(GLenum target); -void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, void ** params); -void GLTrace_glMinSampleShadingOES(GLfloat value); -void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels); -void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels); +void GLTrace_glGetBufferPointervOES(GLenum target, GLenum pname, GLvoid** params); +void GLTrace_glTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels); +void GLTrace_glTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels); void GLTrace_glCopyTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height); -void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data); -void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data); +void GLTrace_glCompressedTexImage3DOES(GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data); +void GLTrace_glCompressedTexSubImage3DOES(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data); void GLTrace_glFramebufferTexture3DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset); -void GLTrace_glTexStorage3DMultisampleOES(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations); void GLTrace_glBindVertexArrayOES(GLuint array); -void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint * arrays); -void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint * arrays); +void GLTrace_glDeleteVertexArraysOES(GLsizei n, const GLuint *arrays); +void GLTrace_glGenVertexArraysOES(GLsizei n, GLuint *arrays); GLboolean GLTrace_glIsVertexArrayOES(GLuint array); -void GLTrace_glGetPerfMonitorGroupsAMD(GLint * numGroups, GLsizei groupsSize, GLuint * groups); -void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint * numCounters, GLint * maxActiveCounters, GLsizei counterSize, GLuint * counters); -void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei * length, GLchar * groupString); -void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei * length, GLchar * counterString); -void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, void * data); -void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint * monitors); -void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint * monitors); -void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint * counterList); +void GLTrace_glGetPerfMonitorGroupsAMD(GLint *numGroups, GLsizei groupsSize, GLuint *groups); +void GLTrace_glGetPerfMonitorCountersAMD(GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters); +void GLTrace_glGetPerfMonitorGroupStringAMD(GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString); +void GLTrace_glGetPerfMonitorCounterStringAMD(GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString); +void GLTrace_glGetPerfMonitorCounterInfoAMD(GLuint group, GLuint counter, GLenum pname, GLvoid *data); +void GLTrace_glGenPerfMonitorsAMD(GLsizei n, GLuint *monitors); +void GLTrace_glDeletePerfMonitorsAMD(GLsizei n, GLuint *monitors); +void GLTrace_glSelectPerfMonitorCountersAMD(GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList); void GLTrace_glBeginPerfMonitorAMD(GLuint monitor); void GLTrace_glEndPerfMonitorAMD(GLuint monitor); -void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint * data, GLint * bytesWritten); +void GLTrace_glGetPerfMonitorCounterDataAMD(GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten); void GLTrace_glBlitFramebufferANGLE(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); void GLTrace_glRenderbufferStorageMultisampleANGLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glDrawArraysInstancedANGLE(GLenum mode, GLint first, GLsizei count, GLsizei primcount); -void GLTrace_glDrawElementsInstancedANGLE(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount); -void GLTrace_glVertexAttribDivisorANGLE(GLuint index, GLuint divisor); -void GLTrace_glGetTranslatedShaderSourceANGLE(GLuint shader, GLsizei bufsize, GLsizei * length, GLchar * source); -void GLTrace_glCopyTextureLevelsAPPLE(GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount); void GLTrace_glRenderbufferStorageMultisampleAPPLE(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); void GLTrace_glResolveMultisampleFramebufferAPPLE(void); -GLsync GLTrace_glFenceSyncAPPLE(GLenum condition, GLbitfield flags); -GLboolean GLTrace_glIsSyncAPPLE(GLsync sync); -void GLTrace_glDeleteSyncAPPLE(GLsync sync); -GLenum GLTrace_glClientWaitSyncAPPLE(GLsync sync, GLbitfield flags, GLuint64 timeout); -void GLTrace_glWaitSyncAPPLE(GLsync sync, GLbitfield flags, GLuint64 timeout); -void GLTrace_glGetInteger64vAPPLE(GLenum pname, GLint64 * params); -void GLTrace_glGetSyncivAPPLE(GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values); -void GLTrace_glCopyImageSubDataEXT(GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth); -void GLTrace_glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar * label); -void GLTrace_glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei * length, GLchar * label); -void GLTrace_glInsertEventMarkerEXT(GLsizei length, const GLchar * marker); -void GLTrace_glPushGroupMarkerEXT(GLsizei length, const GLchar * marker); +void GLTrace_glLabelObjectEXT(GLenum type, GLuint object, GLsizei length, const GLchar *label); +void GLTrace_glGetObjectLabelEXT(GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label); +void GLTrace_glInsertEventMarkerEXT(GLsizei length, const GLchar *marker); +void GLTrace_glPushGroupMarkerEXT(GLsizei length, const GLchar *marker); void GLTrace_glPopGroupMarkerEXT(void); -void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum * attachments); -void GLTrace_glGenQueriesEXT(GLsizei n, GLuint * ids); -void GLTrace_glDeleteQueriesEXT(GLsizei n, const GLuint * ids); +void GLTrace_glDiscardFramebufferEXT(GLenum target, GLsizei numAttachments, const GLenum *attachments); +void GLTrace_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); +void GLTrace_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); +void GLTrace_glMultiDrawArraysEXT(GLenum mode, GLint *first, GLsizei *count, GLsizei primcount); +void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount); +void GLTrace_glGenQueriesEXT(GLsizei n, GLuint *ids); +void GLTrace_glDeleteQueriesEXT(GLsizei n, const GLuint *ids); GLboolean GLTrace_glIsQueryEXT(GLuint id); void GLTrace_glBeginQueryEXT(GLenum target, GLuint id); void GLTrace_glEndQueryEXT(GLenum target); -void GLTrace_glQueryCounterEXT(GLuint id, GLenum target); -void GLTrace_glGetQueryivEXT(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetQueryObjectivEXT(GLuint id, GLenum pname, GLint * params); -void GLTrace_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint * params); -void GLTrace_glGetQueryObjecti64vEXT(GLuint id, GLenum pname, GLint64 * params); -void GLTrace_glGetQueryObjectui64vEXT(GLuint id, GLenum pname, GLuint64 * params); -void GLTrace_glDrawBuffersEXT(GLsizei n, const GLenum * bufs); -void GLTrace_glEnableiEXT(GLenum target, GLuint index); -void GLTrace_glDisableiEXT(GLenum target, GLuint index); -void GLTrace_glBlendEquationiEXT(GLuint buf, GLenum mode); -void GLTrace_glBlendEquationSeparateiEXT(GLuint buf, GLenum modeRGB, GLenum modeAlpha); -void GLTrace_glBlendFunciEXT(GLuint buf, GLenum src, GLenum dst); -void GLTrace_glBlendFuncSeparateiEXT(GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); -void GLTrace_glColorMaskiEXT(GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a); -GLboolean GLTrace_glIsEnablediEXT(GLenum target, GLuint index); -void GLTrace_glDrawArraysInstancedEXT(GLenum mode, GLint start, GLsizei count, GLsizei primcount); -void GLTrace_glDrawElementsInstancedEXT(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount); -void GLTrace_glFramebufferTextureEXT(GLenum target, GLenum attachment, GLuint texture, GLint level); -void GLTrace_glVertexAttribDivisorEXT(GLuint index, GLuint divisor); -void * GLTrace_glMapBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access); -void GLTrace_glFlushMappedBufferRangeEXT(GLenum target, GLintptr offset, GLsizeiptr length); -void GLTrace_glMultiDrawArraysEXT(GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount); -void GLTrace_glMultiDrawElementsEXT(GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei primcount); -void GLTrace_glRenderbufferStorageMultisampleEXT(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glFramebufferTexture2DMultisampleEXT(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -void GLTrace_glReadBufferIndexedEXT(GLenum src, GLint index); -void GLTrace_glDrawBuffersIndexedEXT(GLint n, const GLenum * location, const GLint * indices); -void GLTrace_glGetIntegeri_vEXT(GLenum target, GLuint index, GLint * data); -void GLTrace_glPrimitiveBoundingBoxEXT(GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW); +void GLTrace_glGetQueryivEXT(GLenum target, GLenum pname, GLint *params); +void GLTrace_glGetQueryObjectuivEXT(GLuint id, GLenum pname, GLuint *params); GLenum GLTrace_glGetGraphicsResetStatusEXT(void); -void GLTrace_glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data); -void GLTrace_glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, GLfloat * params); -void GLTrace_glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint * params); +void GLTrace_glReadnPixelsEXT(GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data); +void GLTrace_glGetnUniformfvEXT(GLuint program, GLint location, GLsizei bufSize, float *params); +void GLTrace_glGetnUniformivEXT(GLuint program, GLint location, GLsizei bufSize, GLint *params); +void GLTrace_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program); void GLTrace_glActiveShaderProgramEXT(GLuint pipeline, GLuint program); +GLuint GLTrace_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar **strings); void GLTrace_glBindProgramPipelineEXT(GLuint pipeline); -GLuint GLTrace_glCreateShaderProgramvEXT(GLenum type, GLsizei count, const GLchar ** strings); -void GLTrace_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint * pipelines); -void GLTrace_glGenProgramPipelinesEXT(GLsizei n, GLuint * pipelines); -void GLTrace_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog); -void GLTrace_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint * params); +void GLTrace_glDeleteProgramPipelinesEXT(GLsizei n, const GLuint *pipelines); +void GLTrace_glGenProgramPipelinesEXT(GLsizei n, GLuint *pipelines); GLboolean GLTrace_glIsProgramPipelineEXT(GLuint pipeline); void GLTrace_glProgramParameteriEXT(GLuint program, GLenum pname, GLint value); -void GLTrace_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat v0); -void GLTrace_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform1iEXT(GLuint program, GLint location, GLint v0); -void GLTrace_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1); -void GLTrace_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform2iEXT(GLuint program, GLint location, GLint v0, GLint v1); -void GLTrace_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2); -void GLTrace_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform3iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2); -void GLTrace_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3); -void GLTrace_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat * value); -void GLTrace_glProgramUniform4iEXT(GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3); -void GLTrace_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint * value); -void GLTrace_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUseProgramStagesEXT(GLuint pipeline, GLbitfield stages, GLuint program); +void GLTrace_glGetProgramPipelineivEXT(GLuint pipeline, GLenum pname, GLint *params); +void GLTrace_glProgramUniform1iEXT(GLuint program, GLint location, GLint x); +void GLTrace_glProgramUniform2iEXT(GLuint program, GLint location, GLint x, GLint y); +void GLTrace_glProgramUniform3iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z); +void GLTrace_glProgramUniform4iEXT(GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w); +void GLTrace_glProgramUniform1fEXT(GLuint program, GLint location, GLfloat x); +void GLTrace_glProgramUniform2fEXT(GLuint program, GLint location, GLfloat x, GLfloat y); +void GLTrace_glProgramUniform3fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z); +void GLTrace_glProgramUniform4fEXT(GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w); +void GLTrace_glProgramUniform1ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); +void GLTrace_glProgramUniform2ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); +void GLTrace_glProgramUniform3ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); +void GLTrace_glProgramUniform4ivEXT(GLuint program, GLint location, GLsizei count, const GLint *value); +void GLTrace_glProgramUniform1fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); +void GLTrace_glProgramUniform2fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); +void GLTrace_glProgramUniform3fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); +void GLTrace_glProgramUniform4fvEXT(GLuint program, GLint location, GLsizei count, const GLfloat *value); +void GLTrace_glProgramUniformMatrix2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +void GLTrace_glProgramUniformMatrix3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); +void GLTrace_glProgramUniformMatrix4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value); void GLTrace_glValidateProgramPipelineEXT(GLuint pipeline); -void GLTrace_glProgramUniform1uiEXT(GLuint program, GLint location, GLuint v0); -void GLTrace_glProgramUniform2uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1); -void GLTrace_glProgramUniform3uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2); -void GLTrace_glProgramUniform4uiEXT(GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3); -void GLTrace_glProgramUniform1uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform2uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform3uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniform4uivEXT(GLuint program, GLint location, GLsizei count, const GLuint * value); -void GLTrace_glProgramUniformMatrix2x3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix3x2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix2x4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix4x2fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix3x4fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glProgramUniformMatrix4x3fvEXT(GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glPatchParameteriEXT(GLenum pname, GLint value); -void GLTrace_glTexParameterIivEXT(GLenum target, GLenum pname, const GLint * params); -void GLTrace_glTexParameterIuivEXT(GLenum target, GLenum pname, const GLuint * params); -void GLTrace_glGetTexParameterIivEXT(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetTexParameterIuivEXT(GLenum target, GLenum pname, GLuint * params); -void GLTrace_glSamplerParameterIivEXT(GLuint sampler, GLenum pname, const GLint * param); -void GLTrace_glSamplerParameterIuivEXT(GLuint sampler, GLenum pname, const GLuint * param); -void GLTrace_glGetSamplerParameterIivEXT(GLuint sampler, GLenum pname, GLint * params); -void GLTrace_glGetSamplerParameterIuivEXT(GLuint sampler, GLenum pname, GLuint * params); -void GLTrace_glTexBufferEXT(GLenum target, GLenum internalformat, GLuint buffer); -void GLTrace_glTexBufferRangeEXT(GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size); +void GLTrace_glGetProgramPipelineInfoLogEXT(GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog); void GLTrace_glTexStorage1DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); void GLTrace_glTexStorage2DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); void GLTrace_glTexStorage3DEXT(GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); void GLTrace_glTextureStorage1DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width); void GLTrace_glTextureStorage2DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height); void GLTrace_glTextureStorage3DEXT(GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth); -void GLTrace_glTextureViewEXT(GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers); void GLTrace_glRenderbufferStorageMultisampleIMG(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); void GLTrace_glFramebufferTexture2DMultisampleIMG(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples); -void GLTrace_glBeginPerfQueryINTEL(GLuint queryHandle); -void GLTrace_glCreatePerfQueryINTEL(GLuint queryId, GLuint * queryHandle); -void GLTrace_glDeletePerfQueryINTEL(GLuint queryHandle); -void GLTrace_glEndPerfQueryINTEL(GLuint queryHandle); -void GLTrace_glGetFirstPerfQueryIdINTEL(GLuint * queryId); -void GLTrace_glGetNextPerfQueryIdINTEL(GLuint queryId, GLuint * nextQueryId); -void GLTrace_glGetPerfCounterInfoINTEL(GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar * counterName, GLuint counterDescLength, GLchar * counterDesc, GLuint * counterOffset, GLuint * counterDataSize, GLuint * counterTypeEnum, GLuint * counterDataTypeEnum, GLuint64 * rawCounterMaxValue); -void GLTrace_glGetPerfQueryDataINTEL(GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid * data, GLuint * bytesWritten); -void GLTrace_glGetPerfQueryIdByNameINTEL(GLchar * queryName, GLuint * queryId); -void GLTrace_glGetPerfQueryInfoINTEL(GLuint queryId, GLuint queryNameLength, GLchar * queryName, GLuint * dataSize, GLuint * noCounters, GLuint * noInstances, GLuint * capsMask); -void GLTrace_glBlendParameteriNV(GLenum pname, GLint value); -void GLTrace_glBlendBarrierNV(void); -void GLTrace_glCopyBufferSubDataNV(GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size); void GLTrace_glCoverageMaskNV(GLboolean mask); void GLTrace_glCoverageOperationNV(GLenum operation); -void GLTrace_glDrawBuffersNV(GLsizei n, const GLenum * bufs); -void GLTrace_glDrawArraysInstancedNV(GLenum mode, GLint first, GLsizei count, GLsizei primcount); -void GLTrace_glDrawElementsInstancedNV(GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount); -void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint * fences); -void GLTrace_glGenFencesNV(GLsizei n, GLuint * fences); +void GLTrace_glDrawBuffersNV(GLsizei n, const GLenum *bufs); +void GLTrace_glDeleteFencesNV(GLsizei n, const GLuint *fences); +void GLTrace_glGenFencesNV(GLsizei n, GLuint *fences); GLboolean GLTrace_glIsFenceNV(GLuint fence); GLboolean GLTrace_glTestFenceNV(GLuint fence); -void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint * params); +void GLTrace_glGetFenceivNV(GLuint fence, GLenum pname, GLint *params); void GLTrace_glFinishFenceNV(GLuint fence); void GLTrace_glSetFenceNV(GLuint fence, GLenum condition); -void GLTrace_glBlitFramebufferNV(GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter); -void GLTrace_glRenderbufferStorageMultisampleNV(GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glVertexAttribDivisorNV(GLuint index, GLuint divisor); -void GLTrace_glUniformMatrix2x3fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix3x2fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix2x4fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix4x2fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix3x4fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); -void GLTrace_glUniformMatrix4x3fvNV(GLint location, GLsizei count, GLboolean transpose, const GLfloat * value); void GLTrace_glReadBufferNV(GLenum mode); void GLTrace_glAlphaFuncQCOM(GLenum func, GLclampf ref); -void GLTrace_glGetDriverControlsQCOM(GLint * num, GLsizei size, GLuint * driverControls); -void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei * length, GLchar * driverControlString); +void GLTrace_glGetDriverControlsQCOM(GLint *num, GLsizei size, GLuint *driverControls); +void GLTrace_glGetDriverControlStringQCOM(GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString); void GLTrace_glEnableDriverControlQCOM(GLuint driverControl); void GLTrace_glDisableDriverControlQCOM(GLuint driverControl); -void GLTrace_glExtGetTexturesQCOM(GLuint * textures, GLint maxTextures, GLint * numTextures); -void GLTrace_glExtGetBuffersQCOM(GLuint * buffers, GLint maxBuffers, GLint * numBuffers); -void GLTrace_glExtGetRenderbuffersQCOM(GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers); -void GLTrace_glExtGetFramebuffersQCOM(GLuint * framebuffers, GLint maxFramebuffers, GLint * numFramebuffers); -void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint * params); +void GLTrace_glExtGetTexturesQCOM(GLuint *textures, GLint maxTextures, GLint *numTextures); +void GLTrace_glExtGetBuffersQCOM(GLuint *buffers, GLint maxBuffers, GLint *numBuffers); +void GLTrace_glExtGetRenderbuffersQCOM(GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers); +void GLTrace_glExtGetFramebuffersQCOM(GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers); +void GLTrace_glExtGetTexLevelParameterivQCOM(GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params); void GLTrace_glExtTexObjectStateOverrideiQCOM(GLenum target, GLenum pname, GLint param); -void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void * texels); -void GLTrace_glExtGetBufferPointervQCOM(GLenum target, void ** params); -void GLTrace_glExtGetShadersQCOM(GLuint * shaders, GLint maxShaders, GLint * numShaders); -void GLTrace_glExtGetProgramsQCOM(GLuint * programs, GLint maxPrograms, GLint * numPrograms); +void GLTrace_glExtGetTexSubImageQCOM(GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels); +void GLTrace_glExtGetBufferPointervQCOM(GLenum target, GLvoid **params); +void GLTrace_glExtGetShadersQCOM(GLuint *shaders, GLint maxShaders, GLint *numShaders); +void GLTrace_glExtGetProgramsQCOM(GLuint *programs, GLint maxPrograms, GLint *numPrograms); GLboolean GLTrace_glExtIsProgramBinaryQCOM(GLuint program); -void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar * source, GLint * length); +void GLTrace_glExtGetProgramBinarySourceQCOM(GLuint program, GLenum shadertype, GLchar *source, GLint *length); void GLTrace_glStartTilingQCOM(GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask); void GLTrace_glEndTilingQCOM(GLbitfield preserveMask); // Declarations for GL1 APIs -void GLTrace_glAlphaFunc(GLenum func, GLfloat ref); -void GLTrace_glClipPlanef(GLenum p, const GLfloat * eqn); +void GLTrace_glAlphaFunc(GLenum func, GLclampf ref); +void GLTrace_glClipPlanef(GLenum plane, const GLfloat *equation); void GLTrace_glColor4f(GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha); void GLTrace_glFogf(GLenum pname, GLfloat param); -void GLTrace_glFogfv(GLenum pname, const GLfloat * params); -void GLTrace_glFrustumf(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -void GLTrace_glGetClipPlanef(GLenum plane, GLfloat * equation); -void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat * params); -void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat * params); -void GLTrace_glGetTexEnvfv(GLenum target, GLenum pname, GLfloat * params); +void GLTrace_glFogfv(GLenum pname, const GLfloat *params); +void GLTrace_glFrustumf(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glGetClipPlanef(GLenum pname, GLfloat eqn[4]); +void GLTrace_glGetLightfv(GLenum light, GLenum pname, GLfloat *params); +void GLTrace_glGetMaterialfv(GLenum face, GLenum pname, GLfloat *params); +void GLTrace_glGetTexEnvfv(GLenum env, GLenum pname, GLfloat *params); void GLTrace_glLightModelf(GLenum pname, GLfloat param); -void GLTrace_glLightModelfv(GLenum pname, const GLfloat * params); +void GLTrace_glLightModelfv(GLenum pname, const GLfloat *params); void GLTrace_glLightf(GLenum light, GLenum pname, GLfloat param); -void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat * params); -void GLTrace_glLoadMatrixf(const GLfloat * m); +void GLTrace_glLightfv(GLenum light, GLenum pname, const GLfloat *params); +void GLTrace_glLoadMatrixf(const GLfloat *m); void GLTrace_glMaterialf(GLenum face, GLenum pname, GLfloat param); -void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat * params); -void GLTrace_glMultMatrixf(const GLfloat * m); +void GLTrace_glMaterialfv(GLenum face, GLenum pname, const GLfloat *params); +void GLTrace_glMultMatrixf(const GLfloat *m); void GLTrace_glMultiTexCoord4f(GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q); void GLTrace_glNormal3f(GLfloat nx, GLfloat ny, GLfloat nz); -void GLTrace_glOrthof(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); +void GLTrace_glOrthof(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); void GLTrace_glPointParameterf(GLenum pname, GLfloat param); -void GLTrace_glPointParameterfv(GLenum pname, const GLfloat * params); +void GLTrace_glPointParameterfv(GLenum pname, const GLfloat *params); void GLTrace_glPointSize(GLfloat size); void GLTrace_glRotatef(GLfloat angle, GLfloat x, GLfloat y, GLfloat z); void GLTrace_glScalef(GLfloat x, GLfloat y, GLfloat z); void GLTrace_glTexEnvf(GLenum target, GLenum pname, GLfloat param); -void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat * params); +void GLTrace_glTexEnvfv(GLenum target, GLenum pname, const GLfloat *params); void GLTrace_glTranslatef(GLfloat x, GLfloat y, GLfloat z); -void GLTrace_glAlphaFuncx(GLenum func, GLfixed ref); -void GLTrace_glClearColorx(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -void GLTrace_glClearDepthx(GLfixed depth); +void GLTrace_glAlphaFuncx(GLenum func, GLclampx ref); +void GLTrace_glClearColorx(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +void GLTrace_glClearDepthx(GLclampx depth); void GLTrace_glClientActiveTexture(GLenum texture); -void GLTrace_glClipPlanex(GLenum plane, const GLfixed * equation); +void GLTrace_glClipPlanex(GLenum plane, const GLfixed *equation); void GLTrace_glColor4ub(GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha); void GLTrace_glColor4x(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const void * pointer); -void GLTrace_glDepthRangex(GLfixed n, GLfixed f); +void GLTrace_glColorPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glDepthRangex(GLclampx zNear, GLclampx zFar); void GLTrace_glDisableClientState(GLenum array); void GLTrace_glEnableClientState(GLenum array); void GLTrace_glFogx(GLenum pname, GLfixed param); -void GLTrace_glFogxv(GLenum pname, const GLfixed * param); -void GLTrace_glFrustumx(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -void GLTrace_glGetClipPlanex(GLenum plane, GLfixed * equation); -void GLTrace_glGetFixedv(GLenum pname, GLfixed * params); -void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed * params); -void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed * params); -void GLTrace_glGetPointerv(GLenum pname, void ** params); -void GLTrace_glGetTexEnviv(GLenum target, GLenum pname, GLint * params); -void GLTrace_glGetTexEnvxv(GLenum target, GLenum pname, GLfixed * params); -void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed * params); +void GLTrace_glFogxv(GLenum pname, const GLfixed *params); +void GLTrace_glFrustumx(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glGetClipPlanex(GLenum pname, GLfixed eqn[4]); +void GLTrace_glGetFixedv(GLenum pname, GLfixed *params); +void GLTrace_glGetLightxv(GLenum light, GLenum pname, GLfixed *params); +void GLTrace_glGetMaterialxv(GLenum face, GLenum pname, GLfixed *params); +void GLTrace_glGetPointerv(GLenum pname, GLvoid **params); +void GLTrace_glGetTexEnviv(GLenum env, GLenum pname, GLint *params); +void GLTrace_glGetTexEnvxv(GLenum env, GLenum pname, GLfixed *params); +void GLTrace_glGetTexParameterxv(GLenum target, GLenum pname, GLfixed *params); void GLTrace_glLightModelx(GLenum pname, GLfixed param); -void GLTrace_glLightModelxv(GLenum pname, const GLfixed * param); +void GLTrace_glLightModelxv(GLenum pname, const GLfixed *params); void GLTrace_glLightx(GLenum light, GLenum pname, GLfixed param); -void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed * params); +void GLTrace_glLightxv(GLenum light, GLenum pname, const GLfixed *params); void GLTrace_glLineWidthx(GLfixed width); void GLTrace_glLoadIdentity(void); -void GLTrace_glLoadMatrixx(const GLfixed * m); +void GLTrace_glLoadMatrixx(const GLfixed *m); void GLTrace_glLogicOp(GLenum opcode); void GLTrace_glMaterialx(GLenum face, GLenum pname, GLfixed param); -void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed * param); +void GLTrace_glMaterialxv(GLenum face, GLenum pname, const GLfixed *params); void GLTrace_glMatrixMode(GLenum mode); -void GLTrace_glMultMatrixx(const GLfixed * m); -void GLTrace_glMultiTexCoord4x(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +void GLTrace_glMultMatrixx(const GLfixed *m); +void GLTrace_glMultiTexCoord4x(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); void GLTrace_glNormal3x(GLfixed nx, GLfixed ny, GLfixed nz); -void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const void * pointer); -void GLTrace_glOrthox(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); +void GLTrace_glNormalPointer(GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glOrthox(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); void GLTrace_glPointParameterx(GLenum pname, GLfixed param); -void GLTrace_glPointParameterxv(GLenum pname, const GLfixed * params); +void GLTrace_glPointParameterxv(GLenum pname, const GLfixed *params); void GLTrace_glPointSizex(GLfixed size); void GLTrace_glPolygonOffsetx(GLfixed factor, GLfixed units); void GLTrace_glPopMatrix(void); @@ -639,129 +367,106 @@ void GLTrace_glSampleCoveragex(GLclampx value, GLboolean invert); void GLTrace_glScalex(GLfixed x, GLfixed y, GLfixed z); void GLTrace_glShadeModel(GLenum mode); -void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const void * pointer); +void GLTrace_glTexCoordPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); void GLTrace_glTexEnvi(GLenum target, GLenum pname, GLint param); void GLTrace_glTexEnvx(GLenum target, GLenum pname, GLfixed param); -void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint * params); -void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed * params); +void GLTrace_glTexEnviv(GLenum target, GLenum pname, const GLint *params); +void GLTrace_glTexEnvxv(GLenum target, GLenum pname, const GLfixed *params); void GLTrace_glTexParameterx(GLenum target, GLenum pname, GLfixed param); -void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed * params); +void GLTrace_glTexParameterxv(GLenum target, GLenum pname, const GLfixed *params); void GLTrace_glTranslatex(GLfixed x, GLfixed y, GLfixed z); -void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const void * pointer); +void GLTrace_glVertexPointer(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const GLvoid *pointer); // Declarations for GL1Ext APIs void GLTrace_glBlendEquationSeparateOES(GLenum modeRGB, GLenum modeAlpha); void GLTrace_glBlendFuncSeparateOES(GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha); void GLTrace_glBlendEquationOES(GLenum mode); -void GLTrace_glMultiTexCoord1bOES(GLenum texture, GLbyte s); -void GLTrace_glMultiTexCoord1bvOES(GLenum texture, const GLbyte * coords); -void GLTrace_glMultiTexCoord2bOES(GLenum texture, GLbyte s, GLbyte t); -void GLTrace_glMultiTexCoord2bvOES(GLenum texture, const GLbyte * coords); -void GLTrace_glMultiTexCoord3bOES(GLenum texture, GLbyte s, GLbyte t, GLbyte r); -void GLTrace_glMultiTexCoord3bvOES(GLenum texture, const GLbyte * coords); -void GLTrace_glMultiTexCoord4bOES(GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q); -void GLTrace_glMultiTexCoord4bvOES(GLenum texture, const GLbyte * coords); -void GLTrace_glTexCoord1bOES(GLbyte s); -void GLTrace_glTexCoord1bvOES(const GLbyte * coords); -void GLTrace_glTexCoord2bOES(GLbyte s, GLbyte t); -void GLTrace_glTexCoord2bvOES(const GLbyte * coords); -void GLTrace_glTexCoord3bOES(GLbyte s, GLbyte t, GLbyte r); -void GLTrace_glTexCoord3bvOES(const GLbyte * coords); -void GLTrace_glTexCoord4bOES(GLbyte s, GLbyte t, GLbyte r, GLbyte q); -void GLTrace_glTexCoord4bvOES(const GLbyte * coords); -void GLTrace_glVertex2bOES(GLbyte x); -void GLTrace_glVertex2bvOES(const GLbyte * coords); -void GLTrace_glVertex3bOES(GLbyte x, GLbyte y); -void GLTrace_glVertex3bvOES(const GLbyte * coords); -void GLTrace_glVertex4bOES(GLbyte x, GLbyte y, GLbyte z); -void GLTrace_glVertex4bvOES(const GLbyte * coords); void GLTrace_glDrawTexsOES(GLshort x, GLshort y, GLshort z, GLshort width, GLshort height); void GLTrace_glDrawTexiOES(GLint x, GLint y, GLint z, GLint width, GLint height); void GLTrace_glDrawTexxOES(GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height); -void GLTrace_glDrawTexsvOES(const GLshort * coords); -void GLTrace_glDrawTexivOES(const GLint * coords); -void GLTrace_glDrawTexxvOES(const GLfixed * coords); +void GLTrace_glDrawTexsvOES(const GLshort *coords); +void GLTrace_glDrawTexivOES(const GLint *coords); +void GLTrace_glDrawTexxvOES(const GLfixed *coords); void GLTrace_glDrawTexfOES(GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height); -void GLTrace_glDrawTexfvOES(const GLfloat * coords); -void GLTrace_glAlphaFuncxOES(GLenum func, GLfixed ref); -void GLTrace_glClearColorxOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -void GLTrace_glClearDepthxOES(GLfixed depth); -void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed * equation); +void GLTrace_glDrawTexfvOES(const GLfloat *coords); +void GLTrace_glAlphaFuncxOES(GLenum func, GLclampx ref); +void GLTrace_glClearColorxOES(GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha); +void GLTrace_glClearDepthxOES(GLclampx depth); +void GLTrace_glClipPlanexOES(GLenum plane, const GLfixed *equation); void GLTrace_glColor4xOES(GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha); -void GLTrace_glDepthRangexOES(GLfixed n, GLfixed f); +void GLTrace_glDepthRangexOES(GLclampx zNear, GLclampx zFar); void GLTrace_glFogxOES(GLenum pname, GLfixed param); -void GLTrace_glFogxvOES(GLenum pname, const GLfixed * param); -void GLTrace_glFrustumxOES(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -void GLTrace_glGetClipPlanexOES(GLenum plane, GLfixed * equation); -void GLTrace_glGetFixedvOES(GLenum pname, GLfixed * params); -void GLTrace_glGetTexEnvxvOES(GLenum target, GLenum pname, GLfixed * params); -void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed * params); +void GLTrace_glFogxvOES(GLenum pname, const GLfixed *params); +void GLTrace_glFrustumxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glGetClipPlanexOES(GLenum pname, GLfixed eqn[4]); +void GLTrace_glGetFixedvOES(GLenum pname, GLfixed *params); +void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed *params); +void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed *params); +void GLTrace_glGetTexEnvxvOES(GLenum env, GLenum pname, GLfixed *params); +void GLTrace_glGetTexParameterxvOES(GLenum target, GLenum pname, GLfixed *params); void GLTrace_glLightModelxOES(GLenum pname, GLfixed param); -void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed * param); +void GLTrace_glLightModelxvOES(GLenum pname, const GLfixed *params); void GLTrace_glLightxOES(GLenum light, GLenum pname, GLfixed param); -void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed * params); +void GLTrace_glLightxvOES(GLenum light, GLenum pname, const GLfixed *params); void GLTrace_glLineWidthxOES(GLfixed width); -void GLTrace_glLoadMatrixxOES(const GLfixed * m); +void GLTrace_glLoadMatrixxOES(const GLfixed *m); void GLTrace_glMaterialxOES(GLenum face, GLenum pname, GLfixed param); -void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed * param); -void GLTrace_glMultMatrixxOES(const GLfixed * m); -void GLTrace_glMultiTexCoord4xOES(GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q); +void GLTrace_glMaterialxvOES(GLenum face, GLenum pname, const GLfixed *params); +void GLTrace_glMultMatrixxOES(const GLfixed *m); +void GLTrace_glMultiTexCoord4xOES(GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q); void GLTrace_glNormal3xOES(GLfixed nx, GLfixed ny, GLfixed nz); -void GLTrace_glOrthoxOES(GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f); -void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed * params); +void GLTrace_glOrthoxOES(GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar); +void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param); +void GLTrace_glPointParameterxvOES(GLenum pname, const GLfixed *params); void GLTrace_glPointSizexOES(GLfixed size); void GLTrace_glPolygonOffsetxOES(GLfixed factor, GLfixed units); void GLTrace_glRotatexOES(GLfixed angle, GLfixed x, GLfixed y, GLfixed z); -void GLTrace_glSampleCoverageOES(GLfixed value, GLboolean invert); +void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert); void GLTrace_glScalexOES(GLfixed x, GLfixed y, GLfixed z); void GLTrace_glTexEnvxOES(GLenum target, GLenum pname, GLfixed param); -void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed * params); +void GLTrace_glTexEnvxvOES(GLenum target, GLenum pname, const GLfixed *params); void GLTrace_glTexParameterxOES(GLenum target, GLenum pname, GLfixed param); -void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed * params); +void GLTrace_glTexParameterxvOES(GLenum target, GLenum pname, const GLfixed *params); void GLTrace_glTranslatexOES(GLfixed x, GLfixed y, GLfixed z); -void GLTrace_glGetLightxvOES(GLenum light, GLenum pname, GLfixed * params); -void GLTrace_glGetMaterialxvOES(GLenum face, GLenum pname, GLfixed * params); -void GLTrace_glPointParameterxOES(GLenum pname, GLfixed param); -void GLTrace_glSampleCoveragexOES(GLclampx value, GLboolean invert); -void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed * params); -void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param); -void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed * params); GLboolean GLTrace_glIsRenderbufferOES(GLuint renderbuffer); void GLTrace_glBindRenderbufferOES(GLenum target, GLuint renderbuffer); -void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint * renderbuffers); -void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint * renderbuffers); +void GLTrace_glDeleteRenderbuffersOES(GLsizei n, const GLuint* renderbuffers); +void GLTrace_glGenRenderbuffersOES(GLsizei n, GLuint* renderbuffers); void GLTrace_glRenderbufferStorageOES(GLenum target, GLenum internalformat, GLsizei width, GLsizei height); -void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint * params); +void GLTrace_glGetRenderbufferParameterivOES(GLenum target, GLenum pname, GLint* params); GLboolean GLTrace_glIsFramebufferOES(GLuint framebuffer); void GLTrace_glBindFramebufferOES(GLenum target, GLuint framebuffer); -void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint * framebuffers); -void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint * framebuffers); +void GLTrace_glDeleteFramebuffersOES(GLsizei n, const GLuint* framebuffers); +void GLTrace_glGenFramebuffersOES(GLsizei n, GLuint* framebuffers); GLenum GLTrace_glCheckFramebufferStatusOES(GLenum target); void GLTrace_glFramebufferRenderbufferOES(GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer); void GLTrace_glFramebufferTexture2DOES(GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level); -void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint * params); +void GLTrace_glGetFramebufferAttachmentParameterivOES(GLenum target, GLenum attachment, GLenum pname, GLint* params); void GLTrace_glGenerateMipmapOES(GLenum target); void GLTrace_glCurrentPaletteMatrixOES(GLuint matrixpaletteindex); void GLTrace_glLoadPaletteFromModelViewMatrixOES(void); -void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const void * pointer); -void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const void * pointer); -void GLTrace_glPointSizePointerOES(GLenum type, GLsizei stride, const void * pointer); -GLbitfield GLTrace_glQueryMatrixxOES(GLfixed * mantissa, GLint * exponent); +void GLTrace_glMatrixIndexPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +void GLTrace_glWeightPointerOES(GLint size, GLenum type, GLsizei stride, const GLvoid *pointer); +GLbitfield GLTrace_glQueryMatrixxOES(GLfixed mantissa[16], GLint exponent[16]); +void GLTrace_glDepthRangefOES(GLclampf zNear, GLclampf zFar); +void GLTrace_glFrustumfOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glOrthofOES(GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar); +void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat *equation); +void GLTrace_glGetClipPlanefOES(GLenum pname, GLfloat eqn[4]); void GLTrace_glClearDepthfOES(GLclampf depth); -void GLTrace_glClipPlanefOES(GLenum plane, const GLfloat * equation); -void GLTrace_glDepthRangefOES(GLclampf n, GLclampf f); -void GLTrace_glFrustumfOES(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); -void GLTrace_glGetClipPlanefOES(GLenum plane, GLfloat * equation); -void GLTrace_glOrthofOES(GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f); void GLTrace_glTexGenfOES(GLenum coord, GLenum pname, GLfloat param); -void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat * params); +void GLTrace_glTexGenfvOES(GLenum coord, GLenum pname, const GLfloat *params); void GLTrace_glTexGeniOES(GLenum coord, GLenum pname, GLint param); -void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint * params); -void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat * params); -void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint * params); -void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat * eqn); -void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed * eqn); +void GLTrace_glTexGenivOES(GLenum coord, GLenum pname, const GLint *params); +void GLTrace_glTexGenxOES(GLenum coord, GLenum pname, GLfixed param); +void GLTrace_glTexGenxvOES(GLenum coord, GLenum pname, const GLfixed *params); +void GLTrace_glGetTexGenfvOES(GLenum coord, GLenum pname, GLfloat *params); +void GLTrace_glGetTexGenivOES(GLenum coord, GLenum pname, GLint *params); +void GLTrace_glGetTexGenxvOES(GLenum coord, GLenum pname, GLfixed *params); +void GLTrace_glClipPlanefIMG(GLenum p, const GLfloat *eqn); +void GLTrace_glClipPlanexIMG(GLenum p, const GLfixed *eqn); }; // namespace gltrace }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_context.cpp android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_context.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_context.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_context.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -32,7 +32,7 @@ static pthread_once_t sPthreadOnceKey = PTHREAD_ONCE_INIT; void createTLSKey() { - pthread_key_create(&sTLSKey, (void (*)(void*))&releaseContext); + pthread_key_create(&sTLSKey, NULL); } GLTraceContext *getGLTraceContext() { @@ -119,7 +119,7 @@ const size_t DEFAULT_BUFFER_SIZE = 8192; BufferedOutputStream *stream = new BufferedOutputStream(mStream, DEFAULT_BUFFER_SIZE); - GLTraceContext *traceContext = new GLTraceContext(id, version, this, stream); + GLTraceContext *traceContext = new GLTraceContext(id, this, stream); mPerContextState[eglContext] = traceContext; return traceContext; @@ -129,13 +129,8 @@ return mPerContextState[c]; } -GLTraceContext::GLTraceContext(int id, int version, GLTraceState *state, - BufferedOutputStream *stream) : +GLTraceContext::GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream) : mId(id), - mVersion(version), - mVersionMajor(0), - mVersionMinor(0), - mVersionParsed(false), mState(state), mBufferedOutputStream(stream), mElementArrayBuffers(DefaultKeyedVector(NULL)) @@ -148,44 +143,10 @@ return mId; } -int GLTraceContext::getVersion() { - return mVersion; -} - -int GLTraceContext::getVersionMajor() { - if (!mVersionParsed) { - parseGlesVersion(); - mVersionParsed = true; - } - return mVersionMajor; -} - -int GLTraceContext::getVersionMinor() { - if (!mVersionParsed) { - parseGlesVersion(); - mVersionParsed = true; - } - return mVersionMinor; -} - GLTraceState *GLTraceContext::getGlobalTraceState() { return mState; } -void GLTraceContext::parseGlesVersion() { - const char* str = (const char*)hooks->gl.glGetString(GL_VERSION); - int major, minor; - if (sscanf(str, "OpenGL ES-CM %d.%d", &major, &minor) != 2) { - if (sscanf(str, "OpenGL ES %d.%d", &major, &minor) != 2) { - ALOGW("Unable to parse GL_VERSION string: \"%s\"", str); - major = 1; - minor = 0; - } - } - mVersionMajor = major; - mVersionMinor = minor; -} - void GLTraceContext::resizeFBMemory(unsigned minSize) { if (fbcontentsSize >= minSize) { return; @@ -242,8 +203,6 @@ GLMessage_Function func = msg->function(); if (func == GLMessage::eglSwapBuffers - || func == GLMessage::eglCreateContext - || func == GLMessage::eglMakeCurrent || func == GLMessage::glDrawArrays || func == GLMessage::glDrawElements) { mBufferedOutputStream->flush(); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_context.h android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_context.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_context.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_context.h 2012-10-16 22:57:11.000000000 +0000 @@ -50,10 +50,6 @@ /** GL Trace Context info associated with each EGLContext */ class GLTraceContext { int mId; /* unique context id */ - int mVersion; /* GL version, e.g: egl_connection_t::GLESv2_INDEX */ - int mVersionMajor; /* GL major version. Lazily parsed in getVersionX(). */ - int mVersionMinor; /* GL minor version. Lazily parsed in getVersionX(). */ - bool mVersionParsed; /* True if major and minor versions have been parsed. */ GLTraceState *mState; /* parent GL Trace state (for per process GL Trace State Info) */ void *fbcontents; /* memory area to read framebuffer contents */ @@ -65,18 +61,12 @@ /* list of element array buffers in use. */ DefaultKeyedVector mElementArrayBuffers; - /* Parses the GL version string returned from glGetString(GL_VERSION) to get find the major and - minor versions of the GLES API. The context must be current before calling. */ - void parseGlesVersion(); void resizeFBMemory(unsigned minSize); public: gl_hooks_t *hooks; - GLTraceContext(int id, int version, GLTraceState *state, BufferedOutputStream *stream); + GLTraceContext(int id, GLTraceState *state, BufferedOutputStream *stream); int getId(); - int getVersion(); - int getVersionMajor(); - int getVersionMinor(); GLTraceState *getGlobalTraceState(); void getCompressedFB(void **fb, unsigned *fbsize, unsigned *fbwidth, unsigned *fbheight, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_eglapi.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -33,9 +33,6 @@ using gltrace::GLTraceContext; using gltrace::TCPStream; -static pthread_mutex_t sGlTraceStateLock = PTHREAD_MUTEX_INITIALIZER; - -static int sGlTraceInProgress; static GLTraceState *sGLTraceState; static pthread_t sReceiveThreadId; @@ -108,66 +105,33 @@ return NULL; } -/** - * Starts Trace Server and waits for connection from the host. - * Returns -1 in case of connection error, 0 otherwise. - */ -int GLTrace_start() { - int status = 0; - int clientSocket = -1; - TCPStream *stream = NULL; - - pthread_mutex_lock(&sGlTraceStateLock); - - if (sGlTraceInProgress) { - goto done; - } - +void GLTrace_start() { char udsName[PROPERTY_VALUE_MAX]; + property_get("debug.egl.debug_portname", udsName, "gltrace"); - clientSocket = gltrace::acceptClientConnection(udsName); + int clientSocket = gltrace::acceptClientConnection(udsName); if (clientSocket < 0) { - ALOGE("Error creating GLTrace server socket. Tracing disabled."); - status = -1; - goto done; + ALOGE("Error creating GLTrace server socket. Quitting application."); + exit(-1); } - sGlTraceInProgress = 1; - // create communication channel to the host - stream = new TCPStream(clientSocket); + TCPStream *stream = new TCPStream(clientSocket); // initialize tracing state sGLTraceState = new GLTraceState(stream); pthread_create(&sReceiveThreadId, NULL, commandReceiveTask, sGLTraceState); - -done: - pthread_mutex_unlock(&sGlTraceStateLock); - return status; } void GLTrace_stop() { - pthread_mutex_lock(&sGlTraceStateLock); - - if (sGlTraceInProgress) { - sGlTraceInProgress = 0; - delete sGLTraceState; - sGLTraceState = NULL; - } - - pthread_mutex_unlock(&sGlTraceStateLock); + delete sGLTraceState; + sGLTraceState = NULL; } void GLTrace_eglCreateContext(int version, EGLContext c) { - pthread_mutex_lock(&sGlTraceStateLock); - GLTraceState *state = sGLTraceState; - pthread_mutex_unlock(&sGlTraceStateLock); - - if (state == NULL) return; - // update trace state for new EGL context - GLTraceContext *traceContext = state->createTraceContext(version, c); + GLTraceContext *traceContext = sGLTraceState->createTraceContext(version, c); gltrace::setupTraceContextThreadSpecific(traceContext); // trace command through to the host @@ -175,19 +139,8 @@ } void GLTrace_eglMakeCurrent(const unsigned version, gl_hooks_t *hooks, EGLContext c) { - pthread_mutex_lock(&sGlTraceStateLock); - GLTraceState *state = sGLTraceState; - pthread_mutex_unlock(&sGlTraceStateLock); - - if (state == NULL) return; - // setup per context state - GLTraceContext *traceContext = state->getTraceContext(c); - if (traceContext == NULL) { - GLTrace_eglCreateContext(version, c); - traceContext = state->getTraceContext(c); - } - + GLTraceContext *traceContext = sGLTraceState->getTraceContext(c); traceContext->hooks = hooks; gltrace::setupTraceContextThreadSpecific(traceContext); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_egl.cpp android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_egl.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_egl.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_egl.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -17,7 +17,7 @@ #include #include -#include "frameworks/native/opengl/libs/GLES_trace/proto/gltrace.pb.h" +#include "gltrace.pb.h" #include "gltrace_context.h" #include "gltrace_fixup.h" #include "gltrace_transport.h" @@ -71,7 +71,7 @@ glContext->traceGLMessage(&glmessage); } -void GLTrace_eglSwapBuffers(void* /*dpy*/, void* /*draw*/) { +void GLTrace_eglSwapBuffers(void *dpy, void *draw) { GLMessage glmessage; GLTraceContext *glContext = getGLTraceContext(); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_fixup.cpp android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_fixup.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_fixup.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_fixup.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -15,13 +15,12 @@ */ #include -#include #include #include #include #include -#include "frameworks/native/opengl/libs/GLES_trace/proto/gltrace.pb.h" +#include "gltrace.pb.h" #include "gltrace_api.h" #include "gltrace_context.h" #include "gltrace_fixup.h" @@ -29,33 +28,6 @@ namespace android { namespace gltrace { -GLint glGetInteger(GLTraceContext *context, GLenum param) { - GLint x; - context->hooks->gl.glGetIntegerv(param, &x); - return x; -} - -GLint glGetVertexAttrib(GLTraceContext *context, GLuint index, GLenum pname) { - GLint x; - context->hooks->gl.glGetVertexAttribiv(index, pname, &x); - return x; -} - -bool isUsingPixelBuffers(GLTraceContext *context) { - if (context->getVersionMajor() < 3) { - return false; // PBOs not supported prior to GLES 3.0 - } - return glGetInteger(context, GL_PIXEL_UNPACK_BUFFER_BINDING) != 0; -} - -bool isUsingArrayBuffers(GLTraceContext *context) { - return glGetInteger(context, GL_ARRAY_BUFFER_BINDING) != 0; -} - -bool isUsingElementArrayBuffers(GLTraceContext *context) { - return glGetInteger(context, GL_ELEMENT_ARRAY_BUFFER_BINDING) != 0; -} - unsigned getBytesPerTexel(const GLenum format, const GLenum type) { /* Description from glTexImage2D spec: @@ -183,8 +155,7 @@ } /** Common fixup routing for glTexImage2D & glTexSubImage2D. */ -void fixup_glTexImage(GLTraceContext *context, int widthIndex, int heightIndex, GLMessage *glmsg, - void *dataSrc) { +void fixup_glTexImage(int widthIndex, int heightIndex, GLMessage *glmsg, void *dataSrc) { GLMessage_DataType arg_width = glmsg->args(widthIndex); GLMessage_DataType arg_height = glmsg->args(heightIndex); @@ -203,7 +174,7 @@ arg_data->set_type(GLMessage::DataType::BYTE); arg_data->clear_rawbytes(); - if (data != NULL && !isUsingPixelBuffers(context)) { + if (data != NULL) { arg_data->set_isarray(true); arg_data->add_rawbytes(data, bytesPerTexel * width * height); } else { @@ -213,7 +184,7 @@ } -void fixup_glTexImage2D(GLTraceContext *context, GLMessage *glmsg, void *pointersToFixup[]) { +void fixup_glTexImage2D(GLMessage *glmsg, void *pointersToFixup[]) { /* void glTexImage2D(GLenum target, GLint level, GLint internalformat, @@ -226,10 +197,10 @@ */ int widthIndex = 3; int heightIndex = 4; - fixup_glTexImage(context, widthIndex, heightIndex, glmsg, pointersToFixup[0]); + fixup_glTexImage(widthIndex, heightIndex, glmsg, pointersToFixup[0]); } -void fixup_glTexSubImage2D(GLTraceContext *context, GLMessage *glmsg, void *pointersToFixup[]) { +void fixup_glTexSubImage2D(GLMessage *glmsg, void *pointersToFixup[]) { /* void glTexSubImage2D(GLenum target, GLint level, @@ -243,62 +214,7 @@ */ int widthIndex = 4; int heightIndex = 5; - fixup_glTexImage(context, widthIndex, heightIndex, glmsg, pointersToFixup[0]); -} - -void fixup_glCompressedTexImage2D(GLTraceContext *context, GLMessage *glmsg, - void *pointersToFixup[]) { - /* void glCompressedTexImage2D(GLenum target, - GLint level, - GLenum internalformat, - GLsizei width, - GLsizei height, - GLint border, - GLsizei imageSize, - const GLvoid* data); - */ - GLsizei size = glmsg->args(6).intvalue(0); - void *data = pointersToFixup[0]; - - GLMessage_DataType *arg_data = glmsg->mutable_args(7); - arg_data->set_type(GLMessage::DataType::BYTE); - arg_data->clear_rawbytes(); - - if (data != NULL && !isUsingPixelBuffers(context)) { - arg_data->set_isarray(true); - arg_data->add_rawbytes(data, size); - } else { - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::VOID); - } -} - -void fixup_glCompressedTexSubImage2D(GLTraceContext *context, GLMessage *glmsg, - void *pointersToFixup[]) { - /* void glCompressedTexSubImage2D(GLenum target, - GLint level, - GLint xoffset, - GLint yoffset, - GLsizei width, - GLsizei height, - GLenum format, - GLsizei imageSize, - const GLvoid* data); - */ - GLsizei size = glmsg->args(7).intvalue(0); - void *data = pointersToFixup[0]; - - GLMessage_DataType *arg_data = glmsg->mutable_args(8); - arg_data->set_type(GLMessage::DataType::BYTE); - arg_data->clear_rawbytes(); - - if (data != NULL && !isUsingPixelBuffers(context)) { - arg_data->set_isarray(true); - arg_data->add_rawbytes(data, size); - } else { - arg_data->set_isarray(false); - arg_data->set_type(GLMessage::DataType::VOID); - } + fixup_glTexImage(widthIndex, heightIndex, glmsg, pointersToFixup[0]); } void fixup_glShaderSource(GLMessage *glmsg, void *pointersToFixup[]) { @@ -319,26 +235,24 @@ ::std::string src = ""; for (int i = 0; i < count; i++) { if (lengthp != NULL) - src.append(*stringpp++, *lengthp++); + src.append(*stringpp, *lengthp); else - src.append(*stringpp++); // assume null terminated + src.append(*stringpp); // assume null terminated + stringpp++; + lengthp++; } arg_strpp->add_charvalue(src); } -void fixup_glUniformGenericInteger(int argIndex, int nElemsPerVector, GLMessage *glmsg, +void fixup_glUniformGenericInteger(int argIndex, int nIntegers, GLMessage *glmsg, void *pointersToFixup[]) { /* void glUniform?iv(GLint location, GLsizei count, const GLint *value); */ - GLMessage_DataType arg_count = glmsg->args(1); - int n_vectors = arg_count.intvalue(0); - fixup_GenericIntArray(argIndex, nElemsPerVector * n_vectors, glmsg, pointersToFixup[0]); + fixup_GenericIntArray(argIndex, nIntegers, glmsg, pointersToFixup[0]); } -void fixup_glUniformGeneric(int argIndex, int nElemsPerVector, GLMessage *glmsg, void *src) { - GLMessage_DataType arg_count = glmsg->args(1); - int n_vectors = arg_count.intvalue(0); - fixup_GenericFloatArray(argIndex, nElemsPerVector * n_vectors, glmsg, src); +void fixup_glUniformGeneric(int argIndex, int nFloats, GLMessage *glmsg, void *src) { + fixup_GenericFloatArray(argIndex, nFloats, glmsg, src); } void fixup_glUniformMatrixGeneric(int matrixSize, GLMessage *glmsg, void *pointersToFixup[]) { @@ -426,7 +340,7 @@ /** Given a glGetActive[Uniform|Attrib] call, obtain the location * of the variable of given name in the call. */ -GLint getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) { +int getShaderVariableLocation(GLTraceContext *context, GLMessage *glmsg, GLchar *name) { GLMessage_Function func = glmsg->function(); if (func != GLMessage::glGetActiveAttrib && func != GLMessage::glGetActiveUniform) { return -1; @@ -459,13 +373,33 @@ // In order to make things simpler for the debugger, we also pass // a hidden location argument that stores the actual location. // append the location value to the end of the argument list - GLint location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]); + int location = getShaderVariableLocation(context, glmsg, (GLchar*)pointersToFixup[3]); GLMessage_DataType *arg_location = glmsg->add_args(); arg_location->set_isarray(false); arg_location->set_type(GLMessage::DataType::INT); arg_location->add_intvalue(location); } +GLint glGetInteger(GLTraceContext *context, GLenum param) { + GLint x; + context->hooks->gl.glGetIntegerv(param, &x); + return x; +} + +GLint glGetVertexAttrib(GLTraceContext *context, GLuint index, GLenum pname) { + GLint x; + context->hooks->gl.glGetVertexAttribiv(index, pname, &x); + return x; +} + +bool isUsingArrayBuffers(GLTraceContext *context) { + return glGetInteger(context, GL_ARRAY_BUFFER_BINDING) != 0; +} + +bool isUsingElementArrayBuffers(GLTraceContext *context) { + return glGetInteger(context, GL_ELEMENT_ARRAY_BUFFER_BINDING) != 0; +} + /** Copy @len bytes of data from @src into the @dataIndex'th argument of the message. */ void addGlBufferData(GLMessage *glmsg, int dataIndex, GLvoid *src, GLsizeiptr len) { GLMessage_DataType *arg_datap = glmsg->mutable_args(dataIndex); @@ -658,11 +592,6 @@ } void trace_VertexAttribPointerDataForGlDrawArrays(GLTraceContext *context, GLMessage *glmsg) { - if (context->getVersion() == egl_connection_t::GLESv1_INDEX) { - // only supported for GLES2 and above - return; - } - /* void glDrawArrays(GLenum mode, GLint first, GLsizei count) */ GLsizei count = glmsg->args(2).intvalue(0); @@ -675,11 +604,6 @@ void trace_VertexAttribPointerDataForGlDrawElements(GLTraceContext *context, GLMessage *glmsg, GLvoid *indices) { - if (context->getVersion() == egl_connection_t::GLESv1_INDEX) { - // only supported for GLES2 and above - return; - } - /* void glDrawElements(GLenum mode, GLsizei count, GLenum type, const GLvoid* indices) */ GLsizei count = glmsg->args(1).intvalue(0); GLenum type = glmsg->args(2).intvalue(0); @@ -819,22 +743,12 @@ break; case GLMessage::glTexImage2D: if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) { - fixup_glTexImage2D(context, glmsg, pointersToFixup); + fixup_glTexImage2D(glmsg, pointersToFixup); } break; case GLMessage::glTexSubImage2D: if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) { - fixup_glTexSubImage2D(context, glmsg, pointersToFixup); - } - break; - case GLMessage::glCompressedTexImage2D: - if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) { - fixup_glCompressedTexImage2D(context, glmsg, pointersToFixup); - } - break; - case GLMessage::glCompressedTexSubImage2D: - if (context->getGlobalTraceState()->shouldCollectTextureDataOnGlTexImage()) { - fixup_glCompressedTexSubImage2D(context, glmsg, pointersToFixup); + fixup_glTexSubImage2D(glmsg, pointersToFixup); } break; case GLMessage::glShaderSource: diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_fixup.h android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_fixup.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_fixup.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_fixup.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,7 @@ #include -#include "frameworks/native/opengl/libs/GLES_trace/proto/gltrace.pb.h" +#include "gltrace.pb.h" #include "gltrace_context.h" namespace android { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace.pb.cpp android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace.pb.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace.pb.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace.pb.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,2081 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! + +#define INTERNAL_SUPPRESS_PROTOBUF_FIELD_DEPRECATION +#include "gltrace.pb.h" +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace android { +namespace gltrace { + +void protobuf_ShutdownFile_gltrace_2eproto() { + delete GLMessage::default_instance_; + delete GLMessage_DataType::default_instance_; + delete GLMessage_FrameBuffer::default_instance_; +} + +void protobuf_AddDesc_gltrace_2eproto() { + static bool already_here = false; + if (already_here) return; + already_here = true; + GOOGLE_PROTOBUF_VERIFY_VERSION; + + GLMessage::default_instance_ = new GLMessage(); + GLMessage_DataType::default_instance_ = new GLMessage_DataType(); + GLMessage_FrameBuffer::default_instance_ = new GLMessage_FrameBuffer(); + GLMessage::default_instance_->InitAsDefaultInstance(); + GLMessage_DataType::default_instance_->InitAsDefaultInstance(); + GLMessage_FrameBuffer::default_instance_->InitAsDefaultInstance(); + ::google::protobuf::internal::OnShutdown(&protobuf_ShutdownFile_gltrace_2eproto); +} + +// Force AddDescriptors() to be called at static initialization time. +struct StaticDescriptorInitializer_gltrace_2eproto { + StaticDescriptorInitializer_gltrace_2eproto() { + protobuf_AddDesc_gltrace_2eproto(); + } +} static_descriptor_initializer_gltrace_2eproto_; + + +// =================================================================== + +bool GLMessage_Function_IsValid(int value) { + switch(value) { + case 0: + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + case 8: + case 9: + case 10: + case 11: + case 12: + case 13: + case 14: + case 15: + case 16: + case 17: + case 18: + case 19: + case 20: + case 21: + case 22: + case 23: + case 24: + case 25: + case 26: + case 27: + case 28: + case 29: + case 30: + case 31: + case 32: + case 33: + case 34: + case 35: + case 36: + case 37: + case 38: + case 39: + case 40: + case 41: + case 42: + case 43: + case 44: + case 45: + case 46: + case 47: + case 48: + case 49: + case 50: + case 51: + case 52: + case 53: + case 54: + case 55: + case 56: + case 57: + case 58: + case 59: + case 60: + case 61: + case 62: + case 63: + case 64: + case 65: + case 66: + case 67: + case 68: + case 69: + case 70: + case 71: + case 72: + case 73: + case 74: + case 75: + case 76: + case 77: + case 78: + case 79: + case 80: + case 81: + case 82: + case 83: + case 84: + case 85: + case 86: + case 87: + case 88: + case 89: + case 90: + case 91: + case 92: + case 93: + case 94: + case 95: + case 96: + case 97: + case 98: + case 99: + case 100: + case 101: + case 102: + case 103: + case 104: + case 105: + case 106: + case 107: + case 108: + case 109: + case 110: + case 111: + case 112: + case 113: + case 114: + case 115: + case 116: + case 117: + case 118: + case 119: + case 120: + case 121: + case 122: + case 123: + case 124: + case 125: + case 126: + case 127: + case 128: + case 129: + case 130: + case 131: + case 132: + case 133: + case 134: + case 135: + case 136: + case 137: + case 138: + case 139: + case 140: + case 141: + case 142: + case 143: + case 144: + case 145: + case 146: + case 147: + case 148: + case 149: + case 150: + case 151: + case 152: + case 153: + case 154: + case 155: + case 156: + case 157: + case 158: + case 159: + case 160: + case 161: + case 162: + case 163: + case 164: + case 165: + case 166: + case 167: + case 168: + case 169: + case 170: + case 171: + case 172: + case 173: + case 174: + case 175: + case 176: + case 177: + case 178: + case 179: + case 180: + case 181: + case 182: + case 183: + case 184: + case 185: + case 186: + case 187: + case 188: + case 189: + case 190: + case 191: + case 192: + case 193: + case 194: + case 195: + case 196: + case 197: + case 198: + case 199: + case 200: + case 201: + case 202: + case 203: + case 204: + case 205: + case 206: + case 207: + case 208: + case 209: + case 210: + case 211: + case 212: + case 213: + case 214: + case 215: + case 216: + case 217: + case 218: + case 219: + case 220: + case 221: + case 222: + case 223: + case 224: + case 225: + case 226: + case 227: + case 228: + case 229: + case 230: + case 231: + case 232: + case 233: + case 234: + case 235: + case 236: + case 237: + case 238: + case 239: + case 240: + case 241: + case 242: + case 243: + case 244: + case 245: + case 246: + case 247: + case 248: + case 249: + case 250: + case 251: + case 252: + case 253: + case 254: + case 255: + case 256: + case 257: + case 258: + case 259: + case 260: + case 261: + case 262: + case 263: + case 264: + case 265: + case 266: + case 267: + case 268: + case 269: + case 270: + case 271: + case 272: + case 273: + case 274: + case 275: + case 276: + case 277: + case 278: + case 279: + case 280: + case 281: + case 282: + case 283: + case 284: + case 285: + case 286: + case 287: + case 288: + case 289: + case 290: + case 291: + case 292: + case 293: + case 294: + case 295: + case 296: + case 297: + case 298: + case 299: + case 300: + case 301: + case 302: + case 303: + case 304: + case 305: + case 306: + case 307: + case 308: + case 309: + case 310: + case 311: + case 312: + case 313: + case 314: + case 315: + case 316: + case 317: + case 318: + case 319: + case 320: + case 321: + case 322: + case 323: + case 324: + case 325: + case 326: + case 327: + case 328: + case 329: + case 330: + case 331: + case 332: + case 333: + case 334: + case 335: + case 336: + case 337: + case 338: + case 339: + case 340: + case 341: + case 342: + case 343: + case 344: + case 345: + case 346: + case 347: + case 348: + case 349: + case 350: + case 351: + case 352: + case 353: + case 354: + case 355: + case 356: + case 357: + case 358: + case 359: + case 360: + case 361: + case 362: + case 363: + case 364: + case 365: + case 366: + case 367: + case 368: + case 369: + case 370: + case 371: + case 372: + case 373: + case 374: + case 375: + case 502: + case 503: + case 504: + case 505: + case 506: + case 507: + case 508: + case 509: + case 510: + case 511: + case 512: + case 513: + case 514: + case 515: + case 516: + case 517: + case 518: + case 519: + case 520: + case 521: + case 522: + case 523: + case 524: + case 525: + case 526: + case 527: + case 528: + case 529: + case 530: + case 531: + case 532: + case 533: + case 534: + case 535: + case 536: + case 537: + case 538: + case 539: + case 540: + case 541: + case 542: + case 543: + case 544: + case 545: + case 546: + case 547: + case 548: + case 549: + case 550: + case 551: + case 552: + case 553: + case 554: + case 555: + case 556: + case 557: + case 558: + case 559: + case 560: + case 561: + case 2000: + case 2001: + case 2002: + case 2003: + case 2004: + case 2005: + case 2006: + case 2007: + case 2008: + case 2009: + case 2010: + case 2011: + case 2012: + case 2013: + case 2014: + case 2015: + case 2016: + case 2017: + case 2018: + case 2019: + case 2020: + case 2021: + case 2022: + case 2023: + case 2024: + case 2025: + case 2026: + case 2027: + case 2028: + case 2029: + case 2030: + case 2031: + case 2032: + case 2033: + case 2034: + case 2035: + case 2036: + case 2037: + case 2038: + case 2039: + case 2040: + case 2041: + case 2042: + case 2043: + case 2044: + case 2045: + case 3000: + case 3001: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const GLMessage_Function GLMessage::glActiveTexture; +const GLMessage_Function GLMessage::glAlphaFunc; +const GLMessage_Function GLMessage::glAlphaFuncx; +const GLMessage_Function GLMessage::glAlphaFuncxOES; +const GLMessage_Function GLMessage::glAttachShader; +const GLMessage_Function GLMessage::glBeginPerfMonitorAMD; +const GLMessage_Function GLMessage::glBindAttribLocation; +const GLMessage_Function GLMessage::glBindBuffer; +const GLMessage_Function GLMessage::glBindFramebuffer; +const GLMessage_Function GLMessage::glBindFramebufferOES; +const GLMessage_Function GLMessage::glBindRenderbuffer; +const GLMessage_Function GLMessage::glBindRenderbufferOES; +const GLMessage_Function GLMessage::glBindTexture; +const GLMessage_Function GLMessage::glBindVertexArrayOES; +const GLMessage_Function GLMessage::glBlendColor; +const GLMessage_Function GLMessage::glBlendEquation; +const GLMessage_Function GLMessage::glBlendEquationOES; +const GLMessage_Function GLMessage::glBlendEquationSeparate; +const GLMessage_Function GLMessage::glBlendEquationSeparateOES; +const GLMessage_Function GLMessage::glBlendFunc; +const GLMessage_Function GLMessage::glBlendFuncSeparate; +const GLMessage_Function GLMessage::glBlendFuncSeparateOES; +const GLMessage_Function GLMessage::glBufferData; +const GLMessage_Function GLMessage::glBufferSubData; +const GLMessage_Function GLMessage::glCheckFramebufferStatus; +const GLMessage_Function GLMessage::glCheckFramebufferStatusOES; +const GLMessage_Function GLMessage::glClearColor; +const GLMessage_Function GLMessage::glClearColorx; +const GLMessage_Function GLMessage::glClearColorxOES; +const GLMessage_Function GLMessage::glClearDepthf; +const GLMessage_Function GLMessage::glClearDepthfOES; +const GLMessage_Function GLMessage::glClearDepthx; +const GLMessage_Function GLMessage::glClearDepthxOES; +const GLMessage_Function GLMessage::glClear; +const GLMessage_Function GLMessage::glClearStencil; +const GLMessage_Function GLMessage::glClientActiveTexture; +const GLMessage_Function GLMessage::glClipPlanef; +const GLMessage_Function GLMessage::glClipPlanefIMG; +const GLMessage_Function GLMessage::glClipPlanefOES; +const GLMessage_Function GLMessage::glClipPlanex; +const GLMessage_Function GLMessage::glClipPlanexIMG; +const GLMessage_Function GLMessage::glClipPlanexOES; +const GLMessage_Function GLMessage::glColor4f; +const GLMessage_Function GLMessage::glColor4ub; +const GLMessage_Function GLMessage::glColor4x; +const GLMessage_Function GLMessage::glColor4xOES; +const GLMessage_Function GLMessage::glColorMask; +const GLMessage_Function GLMessage::glColorPointer; +const GLMessage_Function GLMessage::glCompileShader; +const GLMessage_Function GLMessage::glCompressedTexImage2D; +const GLMessage_Function GLMessage::glCompressedTexImage3DOES; +const GLMessage_Function GLMessage::glCompressedTexSubImage2D; +const GLMessage_Function GLMessage::glCompressedTexSubImage3DOES; +const GLMessage_Function GLMessage::glCopyTexImage2D; +const GLMessage_Function GLMessage::glCopyTexSubImage2D; +const GLMessage_Function GLMessage::glCopyTexSubImage3DOES; +const GLMessage_Function GLMessage::glCoverageMaskNV; +const GLMessage_Function GLMessage::glCoverageOperationNV; +const GLMessage_Function GLMessage::glCreateProgram; +const GLMessage_Function GLMessage::glCreateShader; +const GLMessage_Function GLMessage::glCullFace; +const GLMessage_Function GLMessage::glCurrentPaletteMatrixOES; +const GLMessage_Function GLMessage::glDeleteBuffers; +const GLMessage_Function GLMessage::glDeleteFencesNV; +const GLMessage_Function GLMessage::glDeleteFramebuffers; +const GLMessage_Function GLMessage::glDeleteFramebuffersOES; +const GLMessage_Function GLMessage::glDeletePerfMonitorsAMD; +const GLMessage_Function GLMessage::glDeleteProgram; +const GLMessage_Function GLMessage::glDeleteRenderbuffers; +const GLMessage_Function GLMessage::glDeleteRenderbuffersOES; +const GLMessage_Function GLMessage::glDeleteShader; +const GLMessage_Function GLMessage::glDeleteTextures; +const GLMessage_Function GLMessage::glDeleteVertexArraysOES; +const GLMessage_Function GLMessage::glDepthFunc; +const GLMessage_Function GLMessage::glDepthMask; +const GLMessage_Function GLMessage::glDepthRangef; +const GLMessage_Function GLMessage::glDepthRangefOES; +const GLMessage_Function GLMessage::glDepthRangex; +const GLMessage_Function GLMessage::glDepthRangexOES; +const GLMessage_Function GLMessage::glDetachShader; +const GLMessage_Function GLMessage::glDisableClientState; +const GLMessage_Function GLMessage::glDisableDriverControlQCOM; +const GLMessage_Function GLMessage::glDisable; +const GLMessage_Function GLMessage::glDisableVertexAttribArray; +const GLMessage_Function GLMessage::glDiscardFramebufferEXT; +const GLMessage_Function GLMessage::glDrawArrays; +const GLMessage_Function GLMessage::glDrawElements; +const GLMessage_Function GLMessage::glDrawTexfOES; +const GLMessage_Function GLMessage::glDrawTexfvOES; +const GLMessage_Function GLMessage::glDrawTexiOES; +const GLMessage_Function GLMessage::glDrawTexivOES; +const GLMessage_Function GLMessage::glDrawTexsOES; +const GLMessage_Function GLMessage::glDrawTexsvOES; +const GLMessage_Function GLMessage::glDrawTexxOES; +const GLMessage_Function GLMessage::glDrawTexxvOES; +const GLMessage_Function GLMessage::glEGLImageTargetRenderbufferStorageOES; +const GLMessage_Function GLMessage::glEGLImageTargetTexture2DOES; +const GLMessage_Function GLMessage::glEnableClientState; +const GLMessage_Function GLMessage::glEnableDriverControlQCOM; +const GLMessage_Function GLMessage::glEnable; +const GLMessage_Function GLMessage::glEnableVertexAttribArray; +const GLMessage_Function GLMessage::glEndPerfMonitorAMD; +const GLMessage_Function GLMessage::glEndTilingQCOM; +const GLMessage_Function GLMessage::glExtGetBufferPointervQCOM; +const GLMessage_Function GLMessage::glExtGetBuffersQCOM; +const GLMessage_Function GLMessage::glExtGetFramebuffersQCOM; +const GLMessage_Function GLMessage::glExtGetProgramBinarySourceQCOM; +const GLMessage_Function GLMessage::glExtGetProgramsQCOM; +const GLMessage_Function GLMessage::glExtGetRenderbuffersQCOM; +const GLMessage_Function GLMessage::glExtGetShadersQCOM; +const GLMessage_Function GLMessage::glExtGetTexLevelParameterivQCOM; +const GLMessage_Function GLMessage::glExtGetTexSubImageQCOM; +const GLMessage_Function GLMessage::glExtGetTexturesQCOM; +const GLMessage_Function GLMessage::glExtIsProgramBinaryQCOM; +const GLMessage_Function GLMessage::glExtTexObjectStateOverrideiQCOM; +const GLMessage_Function GLMessage::glFinishFenceNV; +const GLMessage_Function GLMessage::glFinish; +const GLMessage_Function GLMessage::glFlush; +const GLMessage_Function GLMessage::glFogf; +const GLMessage_Function GLMessage::glFogfv; +const GLMessage_Function GLMessage::glFogx; +const GLMessage_Function GLMessage::glFogxOES; +const GLMessage_Function GLMessage::glFogxv; +const GLMessage_Function GLMessage::glFogxvOES; +const GLMessage_Function GLMessage::glFramebufferRenderbuffer; +const GLMessage_Function GLMessage::glFramebufferRenderbufferOES; +const GLMessage_Function GLMessage::glFramebufferTexture2D; +const GLMessage_Function GLMessage::glFramebufferTexture2DMultisampleIMG; +const GLMessage_Function GLMessage::glFramebufferTexture2DOES; +const GLMessage_Function GLMessage::glFramebufferTexture3DOES; +const GLMessage_Function GLMessage::glFrontFace; +const GLMessage_Function GLMessage::glFrustumf; +const GLMessage_Function GLMessage::glFrustumfOES; +const GLMessage_Function GLMessage::glFrustumx; +const GLMessage_Function GLMessage::glFrustumxOES; +const GLMessage_Function GLMessage::glGenBuffers; +const GLMessage_Function GLMessage::glGenerateMipmap; +const GLMessage_Function GLMessage::glGenerateMipmapOES; +const GLMessage_Function GLMessage::glGenFencesNV; +const GLMessage_Function GLMessage::glGenFramebuffers; +const GLMessage_Function GLMessage::glGenFramebuffersOES; +const GLMessage_Function GLMessage::glGenPerfMonitorsAMD; +const GLMessage_Function GLMessage::glGenRenderbuffers; +const GLMessage_Function GLMessage::glGenRenderbuffersOES; +const GLMessage_Function GLMessage::glGenTextures; +const GLMessage_Function GLMessage::glGenVertexArraysOES; +const GLMessage_Function GLMessage::glGetActiveAttrib; +const GLMessage_Function GLMessage::glGetActiveUniform; +const GLMessage_Function GLMessage::glGetAttachedShaders; +const GLMessage_Function GLMessage::glGetAttribLocation; +const GLMessage_Function GLMessage::glGetBooleanv; +const GLMessage_Function GLMessage::glGetBufferParameteriv; +const GLMessage_Function GLMessage::glGetBufferPointervOES; +const GLMessage_Function GLMessage::glGetClipPlanef; +const GLMessage_Function GLMessage::glGetClipPlanefOES; +const GLMessage_Function GLMessage::glGetClipPlanex; +const GLMessage_Function GLMessage::glGetClipPlanexOES; +const GLMessage_Function GLMessage::glGetDriverControlsQCOM; +const GLMessage_Function GLMessage::glGetDriverControlStringQCOM; +const GLMessage_Function GLMessage::glGetError; +const GLMessage_Function GLMessage::glGetFenceivNV; +const GLMessage_Function GLMessage::glGetFixedv; +const GLMessage_Function GLMessage::glGetFixedvOES; +const GLMessage_Function GLMessage::glGetFloatv; +const GLMessage_Function GLMessage::glGetFramebufferAttachmentParameteriv; +const GLMessage_Function GLMessage::glGetFramebufferAttachmentParameterivOES; +const GLMessage_Function GLMessage::glGetIntegerv; +const GLMessage_Function GLMessage::glGetLightfv; +const GLMessage_Function GLMessage::glGetLightxv; +const GLMessage_Function GLMessage::glGetLightxvOES; +const GLMessage_Function GLMessage::glGetMaterialfv; +const GLMessage_Function GLMessage::glGetMaterialxv; +const GLMessage_Function GLMessage::glGetMaterialxvOES; +const GLMessage_Function GLMessage::glGetPerfMonitorCounterDataAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorCounterInfoAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorCountersAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorCounterStringAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorGroupsAMD; +const GLMessage_Function GLMessage::glGetPerfMonitorGroupStringAMD; +const GLMessage_Function GLMessage::glGetPointerv; +const GLMessage_Function GLMessage::glGetProgramBinaryOES; +const GLMessage_Function GLMessage::glGetProgramInfoLog; +const GLMessage_Function GLMessage::glGetProgramiv; +const GLMessage_Function GLMessage::glGetRenderbufferParameteriv; +const GLMessage_Function GLMessage::glGetRenderbufferParameterivOES; +const GLMessage_Function GLMessage::glGetShaderInfoLog; +const GLMessage_Function GLMessage::glGetShaderiv; +const GLMessage_Function GLMessage::glGetShaderPrecisionFormat; +const GLMessage_Function GLMessage::glGetShaderSource; +const GLMessage_Function GLMessage::glGetString; +const GLMessage_Function GLMessage::glGetTexEnvfv; +const GLMessage_Function GLMessage::glGetTexEnviv; +const GLMessage_Function GLMessage::glGetTexEnvxv; +const GLMessage_Function GLMessage::glGetTexEnvxvOES; +const GLMessage_Function GLMessage::glGetTexGenfvOES; +const GLMessage_Function GLMessage::glGetTexGenivOES; +const GLMessage_Function GLMessage::glGetTexGenxvOES; +const GLMessage_Function GLMessage::glGetTexParameterfv; +const GLMessage_Function GLMessage::glGetTexParameteriv; +const GLMessage_Function GLMessage::glGetTexParameterxv; +const GLMessage_Function GLMessage::glGetTexParameterxvOES; +const GLMessage_Function GLMessage::glGetUniformfv; +const GLMessage_Function GLMessage::glGetUniformiv; +const GLMessage_Function GLMessage::glGetUniformLocation; +const GLMessage_Function GLMessage::glGetVertexAttribfv; +const GLMessage_Function GLMessage::glGetVertexAttribiv; +const GLMessage_Function GLMessage::glGetVertexAttribPointerv; +const GLMessage_Function GLMessage::glHint; +const GLMessage_Function GLMessage::glIsBuffer; +const GLMessage_Function GLMessage::glIsEnabled; +const GLMessage_Function GLMessage::glIsFenceNV; +const GLMessage_Function GLMessage::glIsFramebuffer; +const GLMessage_Function GLMessage::glIsFramebufferOES; +const GLMessage_Function GLMessage::glIsProgram; +const GLMessage_Function GLMessage::glIsRenderbuffer; +const GLMessage_Function GLMessage::glIsRenderbufferOES; +const GLMessage_Function GLMessage::glIsShader; +const GLMessage_Function GLMessage::glIsTexture; +const GLMessage_Function GLMessage::glIsVertexArrayOES; +const GLMessage_Function GLMessage::glLightf; +const GLMessage_Function GLMessage::glLightfv; +const GLMessage_Function GLMessage::glLightModelf; +const GLMessage_Function GLMessage::glLightModelfv; +const GLMessage_Function GLMessage::glLightModelx; +const GLMessage_Function GLMessage::glLightModelxOES; +const GLMessage_Function GLMessage::glLightModelxv; +const GLMessage_Function GLMessage::glLightModelxvOES; +const GLMessage_Function GLMessage::glLightx; +const GLMessage_Function GLMessage::glLightxOES; +const GLMessage_Function GLMessage::glLightxv; +const GLMessage_Function GLMessage::glLightxvOES; +const GLMessage_Function GLMessage::glLineWidth; +const GLMessage_Function GLMessage::glLineWidthx; +const GLMessage_Function GLMessage::glLineWidthxOES; +const GLMessage_Function GLMessage::glLinkProgram; +const GLMessage_Function GLMessage::glLoadIdentity; +const GLMessage_Function GLMessage::glLoadMatrixf; +const GLMessage_Function GLMessage::glLoadMatrixx; +const GLMessage_Function GLMessage::glLoadMatrixxOES; +const GLMessage_Function GLMessage::glLoadPaletteFromModelViewMatrixOES; +const GLMessage_Function GLMessage::glLogicOp; +const GLMessage_Function GLMessage::glMapBufferOES; +const GLMessage_Function GLMessage::glMaterialf; +const GLMessage_Function GLMessage::glMaterialfv; +const GLMessage_Function GLMessage::glMaterialx; +const GLMessage_Function GLMessage::glMaterialxOES; +const GLMessage_Function GLMessage::glMaterialxv; +const GLMessage_Function GLMessage::glMaterialxvOES; +const GLMessage_Function GLMessage::glMatrixIndexPointerOES; +const GLMessage_Function GLMessage::glMatrixMode; +const GLMessage_Function GLMessage::glMultiDrawArraysEXT; +const GLMessage_Function GLMessage::glMultiDrawElementsEXT; +const GLMessage_Function GLMessage::glMultiTexCoord4f; +const GLMessage_Function GLMessage::glMultiTexCoord4x; +const GLMessage_Function GLMessage::glMultiTexCoord4xOES; +const GLMessage_Function GLMessage::glMultMatrixf; +const GLMessage_Function GLMessage::glMultMatrixx; +const GLMessage_Function GLMessage::glMultMatrixxOES; +const GLMessage_Function GLMessage::glNormal3f; +const GLMessage_Function GLMessage::glNormal3x; +const GLMessage_Function GLMessage::glNormal3xOES; +const GLMessage_Function GLMessage::glNormalPointer; +const GLMessage_Function GLMessage::glOrthof; +const GLMessage_Function GLMessage::glOrthofOES; +const GLMessage_Function GLMessage::glOrthox; +const GLMessage_Function GLMessage::glOrthoxOES; +const GLMessage_Function GLMessage::glPixelStorei; +const GLMessage_Function GLMessage::glPointParameterf; +const GLMessage_Function GLMessage::glPointParameterfv; +const GLMessage_Function GLMessage::glPointParameterx; +const GLMessage_Function GLMessage::glPointParameterxOES; +const GLMessage_Function GLMessage::glPointParameterxv; +const GLMessage_Function GLMessage::glPointParameterxvOES; +const GLMessage_Function GLMessage::glPointSize; +const GLMessage_Function GLMessage::glPointSizePointerOES; +const GLMessage_Function GLMessage::glPointSizex; +const GLMessage_Function GLMessage::glPointSizexOES; +const GLMessage_Function GLMessage::glPolygonOffset; +const GLMessage_Function GLMessage::glPolygonOffsetx; +const GLMessage_Function GLMessage::glPolygonOffsetxOES; +const GLMessage_Function GLMessage::glPopMatrix; +const GLMessage_Function GLMessage::glProgramBinaryOES; +const GLMessage_Function GLMessage::glPushMatrix; +const GLMessage_Function GLMessage::glQueryMatrixxOES; +const GLMessage_Function GLMessage::glReadPixels; +const GLMessage_Function GLMessage::glReleaseShaderCompiler; +const GLMessage_Function GLMessage::glRenderbufferStorage; +const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleIMG; +const GLMessage_Function GLMessage::glRenderbufferStorageOES; +const GLMessage_Function GLMessage::glRotatef; +const GLMessage_Function GLMessage::glRotatex; +const GLMessage_Function GLMessage::glRotatexOES; +const GLMessage_Function GLMessage::glSampleCoverage; +const GLMessage_Function GLMessage::glSampleCoveragex; +const GLMessage_Function GLMessage::glSampleCoveragexOES; +const GLMessage_Function GLMessage::glScalef; +const GLMessage_Function GLMessage::glScalex; +const GLMessage_Function GLMessage::glScalexOES; +const GLMessage_Function GLMessage::glScissor; +const GLMessage_Function GLMessage::glSelectPerfMonitorCountersAMD; +const GLMessage_Function GLMessage::glSetFenceNV; +const GLMessage_Function GLMessage::glShadeModel; +const GLMessage_Function GLMessage::glShaderBinary; +const GLMessage_Function GLMessage::glShaderSource; +const GLMessage_Function GLMessage::glStartTilingQCOM; +const GLMessage_Function GLMessage::glStencilFunc; +const GLMessage_Function GLMessage::glStencilFuncSeparate; +const GLMessage_Function GLMessage::glStencilMask; +const GLMessage_Function GLMessage::glStencilMaskSeparate; +const GLMessage_Function GLMessage::glStencilOp; +const GLMessage_Function GLMessage::glStencilOpSeparate; +const GLMessage_Function GLMessage::glTestFenceNV; +const GLMessage_Function GLMessage::glTexCoordPointer; +const GLMessage_Function GLMessage::glTexEnvf; +const GLMessage_Function GLMessage::glTexEnvfv; +const GLMessage_Function GLMessage::glTexEnvi; +const GLMessage_Function GLMessage::glTexEnviv; +const GLMessage_Function GLMessage::glTexEnvx; +const GLMessage_Function GLMessage::glTexEnvxOES; +const GLMessage_Function GLMessage::glTexEnvxv; +const GLMessage_Function GLMessage::glTexEnvxvOES; +const GLMessage_Function GLMessage::glTexGenfOES; +const GLMessage_Function GLMessage::glTexGenfvOES; +const GLMessage_Function GLMessage::glTexGeniOES; +const GLMessage_Function GLMessage::glTexGenivOES; +const GLMessage_Function GLMessage::glTexGenxOES; +const GLMessage_Function GLMessage::glTexGenxvOES; +const GLMessage_Function GLMessage::glTexImage2D; +const GLMessage_Function GLMessage::glTexImage3DOES; +const GLMessage_Function GLMessage::glTexParameterf; +const GLMessage_Function GLMessage::glTexParameterfv; +const GLMessage_Function GLMessage::glTexParameteri; +const GLMessage_Function GLMessage::glTexParameteriv; +const GLMessage_Function GLMessage::glTexParameterx; +const GLMessage_Function GLMessage::glTexParameterxOES; +const GLMessage_Function GLMessage::glTexParameterxv; +const GLMessage_Function GLMessage::glTexParameterxvOES; +const GLMessage_Function GLMessage::glTexSubImage2D; +const GLMessage_Function GLMessage::glTexSubImage3DOES; +const GLMessage_Function GLMessage::glTranslatef; +const GLMessage_Function GLMessage::glTranslatex; +const GLMessage_Function GLMessage::glTranslatexOES; +const GLMessage_Function GLMessage::glUniform1f; +const GLMessage_Function GLMessage::glUniform1fv; +const GLMessage_Function GLMessage::glUniform1i; +const GLMessage_Function GLMessage::glUniform1iv; +const GLMessage_Function GLMessage::glUniform2f; +const GLMessage_Function GLMessage::glUniform2fv; +const GLMessage_Function GLMessage::glUniform2i; +const GLMessage_Function GLMessage::glUniform2iv; +const GLMessage_Function GLMessage::glUniform3f; +const GLMessage_Function GLMessage::glUniform3fv; +const GLMessage_Function GLMessage::glUniform3i; +const GLMessage_Function GLMessage::glUniform3iv; +const GLMessage_Function GLMessage::glUniform4f; +const GLMessage_Function GLMessage::glUniform4fv; +const GLMessage_Function GLMessage::glUniform4i; +const GLMessage_Function GLMessage::glUniform4iv; +const GLMessage_Function GLMessage::glUniformMatrix2fv; +const GLMessage_Function GLMessage::glUniformMatrix3fv; +const GLMessage_Function GLMessage::glUniformMatrix4fv; +const GLMessage_Function GLMessage::glUnmapBufferOES; +const GLMessage_Function GLMessage::glUseProgram; +const GLMessage_Function GLMessage::glValidateProgram; +const GLMessage_Function GLMessage::glVertexAttrib1f; +const GLMessage_Function GLMessage::glVertexAttrib1fv; +const GLMessage_Function GLMessage::glVertexAttrib2f; +const GLMessage_Function GLMessage::glVertexAttrib2fv; +const GLMessage_Function GLMessage::glVertexAttrib3f; +const GLMessage_Function GLMessage::glVertexAttrib3fv; +const GLMessage_Function GLMessage::glVertexAttrib4f; +const GLMessage_Function GLMessage::glVertexAttrib4fv; +const GLMessage_Function GLMessage::glVertexAttribPointer; +const GLMessage_Function GLMessage::glVertexPointer; +const GLMessage_Function GLMessage::glViewport; +const GLMessage_Function GLMessage::glWeightPointerOES; +const GLMessage_Function GLMessage::glActiveShaderProgramEXT; +const GLMessage_Function GLMessage::glAlphaFuncQCOM; +const GLMessage_Function GLMessage::glBeginQueryEXT; +const GLMessage_Function GLMessage::glBindProgramPipelineEXT; +const GLMessage_Function GLMessage::glBlitFramebufferANGLE; +const GLMessage_Function GLMessage::glCreateShaderProgramvEXT; +const GLMessage_Function GLMessage::glDeleteProgramPipelinesEXT; +const GLMessage_Function GLMessage::glDeleteQueriesEXT; +const GLMessage_Function GLMessage::glDrawBuffersNV; +const GLMessage_Function GLMessage::glEndQueryEXT; +const GLMessage_Function GLMessage::glFramebufferTexture2DMultisampleEXT; +const GLMessage_Function GLMessage::glGenProgramPipelinesEXT; +const GLMessage_Function GLMessage::glGenQueriesEXT; +const GLMessage_Function GLMessage::glGetGraphicsResetStatusEXT; +const GLMessage_Function GLMessage::glGetObjectLabelEXT; +const GLMessage_Function GLMessage::glGetProgramPipelineInfoLogEXT; +const GLMessage_Function GLMessage::glGetProgramPipelineivEXT; +const GLMessage_Function GLMessage::glGetQueryObjectuivEXT; +const GLMessage_Function GLMessage::glGetQueryivEXT; +const GLMessage_Function GLMessage::glGetnUniformfvEXT; +const GLMessage_Function GLMessage::glGetnUniformivEXT; +const GLMessage_Function GLMessage::glInsertEventMarkerEXT; +const GLMessage_Function GLMessage::glIsProgramPipelineEXT; +const GLMessage_Function GLMessage::glIsQueryEXT; +const GLMessage_Function GLMessage::glLabelObjectEXT; +const GLMessage_Function GLMessage::glPopGroupMarkerEXT; +const GLMessage_Function GLMessage::glProgramParameteriEXT; +const GLMessage_Function GLMessage::glProgramUniform1fEXT; +const GLMessage_Function GLMessage::glProgramUniform1fvEXT; +const GLMessage_Function GLMessage::glProgramUniform1iEXT; +const GLMessage_Function GLMessage::glProgramUniform1ivEXT; +const GLMessage_Function GLMessage::glProgramUniform2fEXT; +const GLMessage_Function GLMessage::glProgramUniform2fvEXT; +const GLMessage_Function GLMessage::glProgramUniform2iEXT; +const GLMessage_Function GLMessage::glProgramUniform2ivEXT; +const GLMessage_Function GLMessage::glProgramUniform3fEXT; +const GLMessage_Function GLMessage::glProgramUniform3fvEXT; +const GLMessage_Function GLMessage::glProgramUniform3iEXT; +const GLMessage_Function GLMessage::glProgramUniform3ivEXT; +const GLMessage_Function GLMessage::glProgramUniform4fEXT; +const GLMessage_Function GLMessage::glProgramUniform4fvEXT; +const GLMessage_Function GLMessage::glProgramUniform4iEXT; +const GLMessage_Function GLMessage::glProgramUniform4ivEXT; +const GLMessage_Function GLMessage::glProgramUniformMatrix2fvEXT; +const GLMessage_Function GLMessage::glProgramUniformMatrix3fvEXT; +const GLMessage_Function GLMessage::glProgramUniformMatrix4fvEXT; +const GLMessage_Function GLMessage::glPushGroupMarkerEXT; +const GLMessage_Function GLMessage::glReadBufferNV; +const GLMessage_Function GLMessage::glReadnPixelsEXT; +const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleANGLE; +const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleAPPLE; +const GLMessage_Function GLMessage::glRenderbufferStorageMultisampleEXT; +const GLMessage_Function GLMessage::glResolveMultisampleFramebufferAPPLE; +const GLMessage_Function GLMessage::glTexStorage1DEXT; +const GLMessage_Function GLMessage::glTexStorage2DEXT; +const GLMessage_Function GLMessage::glTexStorage3DEXT; +const GLMessage_Function GLMessage::glTextureStorage1DEXT; +const GLMessage_Function GLMessage::glTextureStorage2DEXT; +const GLMessage_Function GLMessage::glTextureStorage3DEXT; +const GLMessage_Function GLMessage::glUseProgramStagesEXT; +const GLMessage_Function GLMessage::glValidateProgramPipelineEXT; +const GLMessage_Function GLMessage::eglGetDisplay; +const GLMessage_Function GLMessage::eglInitialize; +const GLMessage_Function GLMessage::eglTerminate; +const GLMessage_Function GLMessage::eglGetConfigs; +const GLMessage_Function GLMessage::eglChooseConfig; +const GLMessage_Function GLMessage::eglGetConfigAttrib; +const GLMessage_Function GLMessage::eglCreateWindowSurface; +const GLMessage_Function GLMessage::eglCreatePixmapSurface; +const GLMessage_Function GLMessage::eglCreatePbufferSurface; +const GLMessage_Function GLMessage::eglDestroySurface; +const GLMessage_Function GLMessage::eglQuerySurface; +const GLMessage_Function GLMessage::eglCreateContext; +const GLMessage_Function GLMessage::eglDestroyContext; +const GLMessage_Function GLMessage::eglMakeCurrent; +const GLMessage_Function GLMessage::eglGetCurrentContext; +const GLMessage_Function GLMessage::eglGetCurrentSurface; +const GLMessage_Function GLMessage::eglGetCurrentDisplay; +const GLMessage_Function GLMessage::eglQueryContext; +const GLMessage_Function GLMessage::eglWaitGL; +const GLMessage_Function GLMessage::eglWaitNative; +const GLMessage_Function GLMessage::eglSwapBuffers; +const GLMessage_Function GLMessage::eglCopyBuffers; +const GLMessage_Function GLMessage::eglGetError; +const GLMessage_Function GLMessage::eglQueryString; +const GLMessage_Function GLMessage::eglGetProcAddress; +const GLMessage_Function GLMessage::eglSurfaceAttrib; +const GLMessage_Function GLMessage::eglBindTexImage; +const GLMessage_Function GLMessage::eglReleaseTexImage; +const GLMessage_Function GLMessage::eglSwapInterval; +const GLMessage_Function GLMessage::eglBindAPI; +const GLMessage_Function GLMessage::eglQueryAPI; +const GLMessage_Function GLMessage::eglWaitClient; +const GLMessage_Function GLMessage::eglReleaseThread; +const GLMessage_Function GLMessage::eglCreatePbufferFromClientBuffer; +const GLMessage_Function GLMessage::eglLockSurfaceKHR; +const GLMessage_Function GLMessage::eglUnlockSurfaceKHR; +const GLMessage_Function GLMessage::eglCreateImageKHR; +const GLMessage_Function GLMessage::eglDestroyImageKHR; +const GLMessage_Function GLMessage::eglCreateSyncKHR; +const GLMessage_Function GLMessage::eglDestroySyncKHR; +const GLMessage_Function GLMessage::eglClientWaitSyncKHR; +const GLMessage_Function GLMessage::eglGetSyncAttribKHR; +const GLMessage_Function GLMessage::eglSetSwapRectangleANDROID; +const GLMessage_Function GLMessage::eglGetRenderBufferANDROID; +const GLMessage_Function GLMessage::eglGetSystemTimeFrequencyNV; +const GLMessage_Function GLMessage::eglGetSystemTimeNV; +const GLMessage_Function GLMessage::invalid; +const GLMessage_Function GLMessage::glVertexAttribPointerData; +const GLMessage_Function GLMessage::Function_MIN; +const GLMessage_Function GLMessage::Function_MAX; +const int GLMessage::Function_ARRAYSIZE; +#endif // _MSC_VER +bool GLMessage_DataType_Type_IsValid(int value) { + switch(value) { + case 1: + case 2: + case 3: + case 4: + case 5: + case 6: + case 7: + return true; + default: + return false; + } +} + +#ifndef _MSC_VER +const GLMessage_DataType_Type GLMessage_DataType::VOID; +const GLMessage_DataType_Type GLMessage_DataType::CHAR; +const GLMessage_DataType_Type GLMessage_DataType::BYTE; +const GLMessage_DataType_Type GLMessage_DataType::INT; +const GLMessage_DataType_Type GLMessage_DataType::FLOAT; +const GLMessage_DataType_Type GLMessage_DataType::BOOL; +const GLMessage_DataType_Type GLMessage_DataType::ENUM; +const GLMessage_DataType_Type GLMessage_DataType::Type_MIN; +const GLMessage_DataType_Type GLMessage_DataType::Type_MAX; +const int GLMessage_DataType::Type_ARRAYSIZE; +#endif // _MSC_VER +#ifndef _MSC_VER +const int GLMessage_DataType::kTypeFieldNumber; +const int GLMessage_DataType::kIsArrayFieldNumber; +const int GLMessage_DataType::kIntValueFieldNumber; +const int GLMessage_DataType::kFloatValueFieldNumber; +const int GLMessage_DataType::kCharValueFieldNumber; +const int GLMessage_DataType::kRawBytesFieldNumber; +const int GLMessage_DataType::kBoolValueFieldNumber; +#endif // !_MSC_VER + +GLMessage_DataType::GLMessage_DataType() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void GLMessage_DataType::InitAsDefaultInstance() { +} + +GLMessage_DataType::GLMessage_DataType(const GLMessage_DataType& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void GLMessage_DataType::SharedCtor() { + _cached_size_ = 0; + type_ = 1; + isarray_ = false; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GLMessage_DataType::~GLMessage_DataType() { + SharedDtor(); +} + +void GLMessage_DataType::SharedDtor() { + if (this != default_instance_) { + } +} + +void GLMessage_DataType::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const GLMessage_DataType& GLMessage_DataType::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_; +} + +GLMessage_DataType* GLMessage_DataType::default_instance_ = NULL; + +GLMessage_DataType* GLMessage_DataType::New() const { + return new GLMessage_DataType; +} + +void GLMessage_DataType::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + type_ = 1; + isarray_ = false; + } + intvalue_.Clear(); + floatvalue_.Clear(); + charvalue_.Clear(); + rawbytes_.Clear(); + boolvalue_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool GLMessage_DataType::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::android::gltrace::GLMessage_DataType_Type_IsValid(value)) { + set_type(static_cast< ::android::gltrace::GLMessage_DataType_Type >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_isArray; + break; + } + + // required bool isArray = 2 [default = false]; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_isArray: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, &isarray_))); + _set_bit(1); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_intValue; + break; + } + + // repeated int32 intValue = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_intValue: + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + 1, 24, input, this->mutable_intvalue()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, this->mutable_intvalue()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_intValue; + if (input->ExpectTag(37)) goto parse_floatValue; + break; + } + + // repeated float floatValue = 4; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_FIXED32) { + parse_floatValue: + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + 1, 37, input, this->mutable_floatvalue()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< + float, ::google::protobuf::internal::WireFormatLite::TYPE_FLOAT>( + input, this->mutable_floatvalue()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(37)) goto parse_floatValue; + if (input->ExpectTag(42)) goto parse_charValue; + break; + } + + // repeated bytes charValue = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_charValue: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_charvalue())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_charValue; + if (input->ExpectTag(50)) goto parse_rawBytes; + break; + } + + // repeated bytes rawBytes = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_rawBytes: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_rawbytes())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(50)) goto parse_rawBytes; + if (input->ExpectTag(56)) goto parse_boolValue; + break; + } + + // repeated bool boolValue = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_boolValue: + DO_((::google::protobuf::internal::WireFormatLite::ReadRepeatedPrimitive< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + 1, 56, input, this->mutable_boolvalue()))); + } else if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) + == ::google::protobuf::internal::WireFormatLite:: + WIRETYPE_LENGTH_DELIMITED) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPackedPrimitiveNoInline< + bool, ::google::protobuf::internal::WireFormatLite::TYPE_BOOL>( + input, this->mutable_boolvalue()))); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(56)) goto parse_boolValue; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void GLMessage_DataType::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + if (_has_bit(0)) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 1, this->type(), output); + } + + // required bool isArray = 2 [default = false]; + if (_has_bit(1)) { + ::google::protobuf::internal::WireFormatLite::WriteBool(2, this->isarray(), output); + } + + // repeated int32 intValue = 3; + for (int i = 0; i < this->intvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteInt32( + 3, this->intvalue(i), output); + } + + // repeated float floatValue = 4; + for (int i = 0; i < this->floatvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteFloat( + 4, this->floatvalue(i), output); + } + + // repeated bytes charValue = 5; + for (int i = 0; i < this->charvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 5, this->charvalue(i), output); + } + + // repeated bytes rawBytes = 6; + for (int i = 0; i < this->rawbytes_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 6, this->rawbytes(i), output); + } + + // repeated bool boolValue = 7; + for (int i = 0; i < this->boolvalue_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBool( + 7, this->boolvalue(i), output); + } + +} + +int GLMessage_DataType::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + if (has_type()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->type()); + } + + // required bool isArray = 2 [default = false]; + if (has_isarray()) { + total_size += 1 + 1; + } + + } + // repeated int32 intValue = 3; + { + int data_size = 0; + for (int i = 0; i < this->intvalue_size(); i++) { + data_size += ::google::protobuf::internal::WireFormatLite:: + Int32Size(this->intvalue(i)); + } + total_size += 1 * this->intvalue_size() + data_size; + } + + // repeated float floatValue = 4; + { + int data_size = 0; + data_size = 4 * this->floatvalue_size(); + total_size += 1 * this->floatvalue_size() + data_size; + } + + // repeated bytes charValue = 5; + total_size += 1 * this->charvalue_size(); + for (int i = 0; i < this->charvalue_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->charvalue(i)); + } + + // repeated bytes rawBytes = 6; + total_size += 1 * this->rawbytes_size(); + for (int i = 0; i < this->rawbytes_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->rawbytes(i)); + } + + // repeated bool boolValue = 7; + { + int data_size = 0; + data_size = 1 * this->boolvalue_size(); + total_size += 1 * this->boolvalue_size() + data_size; + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GLMessage_DataType::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void GLMessage_DataType::MergeFrom(const GLMessage_DataType& from) { + GOOGLE_CHECK_NE(&from, this); + intvalue_.MergeFrom(from.intvalue_); + floatvalue_.MergeFrom(from.floatvalue_); + charvalue_.MergeFrom(from.charvalue_); + rawbytes_.MergeFrom(from.rawbytes_); + boolvalue_.MergeFrom(from.boolvalue_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bit(0)) { + set_type(from.type()); + } + if (from._has_bit(1)) { + set_isarray(from.isarray()); + } + } +} + +void GLMessage_DataType::CopyFrom(const GLMessage_DataType& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GLMessage_DataType::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void GLMessage_DataType::Swap(GLMessage_DataType* other) { + if (other != this) { + std::swap(type_, other->type_); + std::swap(isarray_, other->isarray_); + intvalue_.Swap(&other->intvalue_); + floatvalue_.Swap(&other->floatvalue_); + charvalue_.Swap(&other->charvalue_); + rawbytes_.Swap(&other->rawbytes_); + boolvalue_.Swap(&other->boolvalue_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string GLMessage_DataType::GetTypeName() const { + return "android.gltrace.GLMessage.DataType"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int GLMessage_FrameBuffer::kWidthFieldNumber; +const int GLMessage_FrameBuffer::kHeightFieldNumber; +const int GLMessage_FrameBuffer::kContentsFieldNumber; +#endif // !_MSC_VER + +GLMessage_FrameBuffer::GLMessage_FrameBuffer() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void GLMessage_FrameBuffer::InitAsDefaultInstance() { +} + +GLMessage_FrameBuffer::GLMessage_FrameBuffer(const GLMessage_FrameBuffer& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void GLMessage_FrameBuffer::SharedCtor() { + _cached_size_ = 0; + width_ = 0; + height_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GLMessage_FrameBuffer::~GLMessage_FrameBuffer() { + SharedDtor(); +} + +void GLMessage_FrameBuffer::SharedDtor() { + if (this != default_instance_) { + } +} + +void GLMessage_FrameBuffer::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const GLMessage_FrameBuffer& GLMessage_FrameBuffer::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_; +} + +GLMessage_FrameBuffer* GLMessage_FrameBuffer::default_instance_ = NULL; + +GLMessage_FrameBuffer* GLMessage_FrameBuffer::New() const { + return new GLMessage_FrameBuffer; +} + +void GLMessage_FrameBuffer::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + width_ = 0; + height_ = 0; + } + contents_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool GLMessage_FrameBuffer::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required int32 width = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &width_))); + _set_bit(0); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_height; + break; + } + + // required int32 height = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_height: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &height_))); + _set_bit(1); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_contents; + break; + } + + // repeated bytes contents = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_contents: + DO_(::google::protobuf::internal::WireFormatLite::ReadBytes( + input, this->add_contents())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(26)) goto parse_contents; + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void GLMessage_FrameBuffer::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required int32 width = 1; + if (_has_bit(0)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->width(), output); + } + + // required int32 height = 2; + if (_has_bit(1)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(2, this->height(), output); + } + + // repeated bytes contents = 3; + for (int i = 0; i < this->contents_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteBytes( + 3, this->contents(i), output); + } + +} + +int GLMessage_FrameBuffer::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required int32 width = 1; + if (has_width()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->width()); + } + + // required int32 height = 2; + if (has_height()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->height()); + } + + } + // repeated bytes contents = 3; + total_size += 1 * this->contents_size(); + for (int i = 0; i < this->contents_size(); i++) { + total_size += ::google::protobuf::internal::WireFormatLite::BytesSize( + this->contents(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GLMessage_FrameBuffer::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void GLMessage_FrameBuffer::MergeFrom(const GLMessage_FrameBuffer& from) { + GOOGLE_CHECK_NE(&from, this); + contents_.MergeFrom(from.contents_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bit(0)) { + set_width(from.width()); + } + if (from._has_bit(1)) { + set_height(from.height()); + } + } +} + +void GLMessage_FrameBuffer::CopyFrom(const GLMessage_FrameBuffer& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GLMessage_FrameBuffer::IsInitialized() const { + if ((_has_bits_[0] & 0x00000003) != 0x00000003) return false; + + return true; +} + +void GLMessage_FrameBuffer::Swap(GLMessage_FrameBuffer* other) { + if (other != this) { + std::swap(width_, other->width_); + std::swap(height_, other->height_); + contents_.Swap(&other->contents_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string GLMessage_FrameBuffer::GetTypeName() const { + return "android.gltrace.GLMessage.FrameBuffer"; +} + + +// ------------------------------------------------------------------- + +#ifndef _MSC_VER +const int GLMessage::kContextIdFieldNumber; +const int GLMessage::kStartTimeFieldNumber; +const int GLMessage::kDurationFieldNumber; +const int GLMessage::kFunctionFieldNumber; +const int GLMessage::kArgsFieldNumber; +const int GLMessage::kReturnValueFieldNumber; +const int GLMessage::kFbFieldNumber; +const int GLMessage::kThreadtimeFieldNumber; +#endif // !_MSC_VER + +GLMessage::GLMessage() + : ::google::protobuf::MessageLite() { + SharedCtor(); +} + +void GLMessage::InitAsDefaultInstance() { + returnvalue_ = const_cast< ::android::gltrace::GLMessage_DataType*>(&::android::gltrace::GLMessage_DataType::default_instance()); + fb_ = const_cast< ::android::gltrace::GLMessage_FrameBuffer*>(&::android::gltrace::GLMessage_FrameBuffer::default_instance()); +} + +GLMessage::GLMessage(const GLMessage& from) + : ::google::protobuf::MessageLite() { + SharedCtor(); + MergeFrom(from); +} + +void GLMessage::SharedCtor() { + _cached_size_ = 0; + context_id_ = 0; + start_time_ = GOOGLE_LONGLONG(0); + duration_ = 0; + function_ = 3000; + returnvalue_ = NULL; + fb_ = NULL; + threadtime_ = 0; + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +GLMessage::~GLMessage() { + SharedDtor(); +} + +void GLMessage::SharedDtor() { + if (this != default_instance_) { + delete returnvalue_; + delete fb_; + } +} + +void GLMessage::SetCachedSize(int size) const { + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); +} +const GLMessage& GLMessage::default_instance() { + if (default_instance_ == NULL) protobuf_AddDesc_gltrace_2eproto(); return *default_instance_; +} + +GLMessage* GLMessage::default_instance_ = NULL; + +GLMessage* GLMessage::New() const { + return new GLMessage; +} + +void GLMessage::Clear() { + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + context_id_ = 0; + start_time_ = GOOGLE_LONGLONG(0); + duration_ = 0; + function_ = 3000; + if (_has_bit(5)) { + if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear(); + } + if (_has_bit(6)) { + if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear(); + } + threadtime_ = 0; + } + args_.Clear(); + ::memset(_has_bits_, 0, sizeof(_has_bits_)); +} + +bool GLMessage::MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input) { +#define DO_(EXPRESSION) if (!(EXPRESSION)) return false + ::google::protobuf::uint32 tag; + while ((tag = input->ReadTag()) != 0) { + switch (::google::protobuf::internal::WireFormatLite::GetTagFieldNumber(tag)) { + // required int32 context_id = 1; + case 1: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &context_id_))); + _set_bit(0); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(16)) goto parse_start_time; + break; + } + + // required int64 start_time = 2; + case 2: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_start_time: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int64, ::google::protobuf::internal::WireFormatLite::TYPE_INT64>( + input, &start_time_))); + _set_bit(1); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(24)) goto parse_duration; + break; + } + + // required int32 duration = 3; + case 3: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_duration: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &duration_))); + _set_bit(2); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(32)) goto parse_function; + break; + } + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + case 4: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_function: + int value; + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + int, ::google::protobuf::internal::WireFormatLite::TYPE_ENUM>( + input, &value))); + if (::android::gltrace::GLMessage_Function_IsValid(value)) { + set_function(static_cast< ::android::gltrace::GLMessage_Function >(value)); + } + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_args; + break; + } + + // repeated .android.gltrace.GLMessage.DataType args = 5; + case 5: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_args: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, add_args())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(42)) goto parse_args; + if (input->ExpectTag(50)) goto parse_returnValue; + break; + } + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + case 6: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_returnValue: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_returnvalue())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(58)) goto parse_fb; + break; + } + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + case 7: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_LENGTH_DELIMITED) { + parse_fb: + DO_(::google::protobuf::internal::WireFormatLite::ReadMessageNoVirtual( + input, mutable_fb())); + } else { + goto handle_uninterpreted; + } + if (input->ExpectTag(64)) goto parse_threadtime; + break; + } + + // optional int32 threadtime = 8; + case 8: { + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_VARINT) { + parse_threadtime: + DO_((::google::protobuf::internal::WireFormatLite::ReadPrimitive< + ::google::protobuf::int32, ::google::protobuf::internal::WireFormatLite::TYPE_INT32>( + input, &threadtime_))); + _set_bit(7); + } else { + goto handle_uninterpreted; + } + if (input->ExpectAtEnd()) return true; + break; + } + + default: { + handle_uninterpreted: + if (::google::protobuf::internal::WireFormatLite::GetTagWireType(tag) == + ::google::protobuf::internal::WireFormatLite::WIRETYPE_END_GROUP) { + return true; + } + DO_(::google::protobuf::internal::WireFormatLite::SkipField(input, tag)); + break; + } + } + } + return true; +#undef DO_ +} + +void GLMessage::SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const { + // required int32 context_id = 1; + if (_has_bit(0)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(1, this->context_id(), output); + } + + // required int64 start_time = 2; + if (_has_bit(1)) { + ::google::protobuf::internal::WireFormatLite::WriteInt64(2, this->start_time(), output); + } + + // required int32 duration = 3; + if (_has_bit(2)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(3, this->duration(), output); + } + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + if (_has_bit(3)) { + ::google::protobuf::internal::WireFormatLite::WriteEnum( + 4, this->function(), output); + } + + // repeated .android.gltrace.GLMessage.DataType args = 5; + for (int i = 0; i < this->args_size(); i++) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 5, this->args(i), output); + } + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + if (_has_bit(5)) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 6, this->returnvalue(), output); + } + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + if (_has_bit(6)) { + ::google::protobuf::internal::WireFormatLite::WriteMessage( + 7, this->fb(), output); + } + + // optional int32 threadtime = 8; + if (_has_bit(7)) { + ::google::protobuf::internal::WireFormatLite::WriteInt32(8, this->threadtime(), output); + } + +} + +int GLMessage::ByteSize() const { + int total_size = 0; + + if (_has_bits_[0 / 32] & (0xffu << (0 % 32))) { + // required int32 context_id = 1; + if (has_context_id()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->context_id()); + } + + // required int64 start_time = 2; + if (has_start_time()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int64Size( + this->start_time()); + } + + // required int32 duration = 3; + if (has_duration()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->duration()); + } + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + if (has_function()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::EnumSize(this->function()); + } + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + if (has_returnvalue()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->returnvalue()); + } + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + if (has_fb()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->fb()); + } + + // optional int32 threadtime = 8; + if (has_threadtime()) { + total_size += 1 + + ::google::protobuf::internal::WireFormatLite::Int32Size( + this->threadtime()); + } + + } + // repeated .android.gltrace.GLMessage.DataType args = 5; + total_size += 1 * this->args_size(); + for (int i = 0; i < this->args_size(); i++) { + total_size += + ::google::protobuf::internal::WireFormatLite::MessageSizeNoVirtual( + this->args(i)); + } + + GOOGLE_SAFE_CONCURRENT_WRITES_BEGIN(); + _cached_size_ = total_size; + GOOGLE_SAFE_CONCURRENT_WRITES_END(); + return total_size; +} + +void GLMessage::CheckTypeAndMergeFrom( + const ::google::protobuf::MessageLite& from) { + MergeFrom(*::google::protobuf::down_cast(&from)); +} + +void GLMessage::MergeFrom(const GLMessage& from) { + GOOGLE_CHECK_NE(&from, this); + args_.MergeFrom(from.args_); + if (from._has_bits_[0 / 32] & (0xffu << (0 % 32))) { + if (from._has_bit(0)) { + set_context_id(from.context_id()); + } + if (from._has_bit(1)) { + set_start_time(from.start_time()); + } + if (from._has_bit(2)) { + set_duration(from.duration()); + } + if (from._has_bit(3)) { + set_function(from.function()); + } + if (from._has_bit(5)) { + mutable_returnvalue()->::android::gltrace::GLMessage_DataType::MergeFrom(from.returnvalue()); + } + if (from._has_bit(6)) { + mutable_fb()->::android::gltrace::GLMessage_FrameBuffer::MergeFrom(from.fb()); + } + if (from._has_bit(7)) { + set_threadtime(from.threadtime()); + } + } +} + +void GLMessage::CopyFrom(const GLMessage& from) { + if (&from == this) return; + Clear(); + MergeFrom(from); +} + +bool GLMessage::IsInitialized() const { + if ((_has_bits_[0] & 0x0000000f) != 0x0000000f) return false; + + for (int i = 0; i < args_size(); i++) { + if (!this->args(i).IsInitialized()) return false; + } + if (has_returnvalue()) { + if (!this->returnvalue().IsInitialized()) return false; + } + if (has_fb()) { + if (!this->fb().IsInitialized()) return false; + } + return true; +} + +void GLMessage::Swap(GLMessage* other) { + if (other != this) { + std::swap(context_id_, other->context_id_); + std::swap(start_time_, other->start_time_); + std::swap(duration_, other->duration_); + std::swap(function_, other->function_); + args_.Swap(&other->args_); + std::swap(returnvalue_, other->returnvalue_); + std::swap(fb_, other->fb_); + std::swap(threadtime_, other->threadtime_); + std::swap(_has_bits_[0], other->_has_bits_[0]); + std::swap(_cached_size_, other->_cached_size_); + } +} + +::std::string GLMessage::GetTypeName() const { + return "android.gltrace.GLMessage"; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace gltrace +} // namespace android + +// @@protoc_insertion_point(global_scope) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace.pb.h android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace.pb.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace.pb.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace.pb.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,1895 @@ +// Generated by the protocol buffer compiler. DO NOT EDIT! +// source: gltrace.proto + +#ifndef PROTOBUF_gltrace_2eproto__INCLUDED +#define PROTOBUF_gltrace_2eproto__INCLUDED + +#include + +#include + +#if GOOGLE_PROTOBUF_VERSION < 2003000 +#error This file was generated by a newer version of protoc which is +#error incompatible with your Protocol Buffer headers. Please update +#error your headers. +#endif +#if 2003000 < GOOGLE_PROTOBUF_MIN_PROTOC_VERSION +#error This file was generated by an older version of protoc which is +#error incompatible with your Protocol Buffer headers. Please +#error regenerate this file with a newer version of protoc. +#endif + +#include +#include +#include +// @@protoc_insertion_point(includes) + +namespace android { +namespace gltrace { + +// Internal implementation detail -- do not call these. +void protobuf_AddDesc_gltrace_2eproto(); +void protobuf_AssignDesc_gltrace_2eproto(); +void protobuf_ShutdownFile_gltrace_2eproto(); + +class GLMessage; +class GLMessage_DataType; +class GLMessage_FrameBuffer; + +enum GLMessage_DataType_Type { + GLMessage_DataType_Type_VOID = 1, + GLMessage_DataType_Type_CHAR = 2, + GLMessage_DataType_Type_BYTE = 3, + GLMessage_DataType_Type_INT = 4, + GLMessage_DataType_Type_FLOAT = 5, + GLMessage_DataType_Type_BOOL = 6, + GLMessage_DataType_Type_ENUM = 7 +}; +bool GLMessage_DataType_Type_IsValid(int value); +const GLMessage_DataType_Type GLMessage_DataType_Type_Type_MIN = GLMessage_DataType_Type_VOID; +const GLMessage_DataType_Type GLMessage_DataType_Type_Type_MAX = GLMessage_DataType_Type_ENUM; +const int GLMessage_DataType_Type_Type_ARRAYSIZE = GLMessage_DataType_Type_Type_MAX + 1; + +enum GLMessage_Function { + GLMessage_Function_glActiveTexture = 0, + GLMessage_Function_glAlphaFunc = 1, + GLMessage_Function_glAlphaFuncx = 2, + GLMessage_Function_glAlphaFuncxOES = 3, + GLMessage_Function_glAttachShader = 4, + GLMessage_Function_glBeginPerfMonitorAMD = 5, + GLMessage_Function_glBindAttribLocation = 6, + GLMessage_Function_glBindBuffer = 7, + GLMessage_Function_glBindFramebuffer = 8, + GLMessage_Function_glBindFramebufferOES = 9, + GLMessage_Function_glBindRenderbuffer = 10, + GLMessage_Function_glBindRenderbufferOES = 11, + GLMessage_Function_glBindTexture = 12, + GLMessage_Function_glBindVertexArrayOES = 13, + GLMessage_Function_glBlendColor = 14, + GLMessage_Function_glBlendEquation = 15, + GLMessage_Function_glBlendEquationOES = 16, + GLMessage_Function_glBlendEquationSeparate = 17, + GLMessage_Function_glBlendEquationSeparateOES = 18, + GLMessage_Function_glBlendFunc = 19, + GLMessage_Function_glBlendFuncSeparate = 20, + GLMessage_Function_glBlendFuncSeparateOES = 21, + GLMessage_Function_glBufferData = 22, + GLMessage_Function_glBufferSubData = 23, + GLMessage_Function_glCheckFramebufferStatus = 24, + GLMessage_Function_glCheckFramebufferStatusOES = 25, + GLMessage_Function_glClearColor = 26, + GLMessage_Function_glClearColorx = 27, + GLMessage_Function_glClearColorxOES = 28, + GLMessage_Function_glClearDepthf = 29, + GLMessage_Function_glClearDepthfOES = 30, + GLMessage_Function_glClearDepthx = 31, + GLMessage_Function_glClearDepthxOES = 32, + GLMessage_Function_glClear = 33, + GLMessage_Function_glClearStencil = 34, + GLMessage_Function_glClientActiveTexture = 35, + GLMessage_Function_glClipPlanef = 36, + GLMessage_Function_glClipPlanefIMG = 37, + GLMessage_Function_glClipPlanefOES = 38, + GLMessage_Function_glClipPlanex = 39, + GLMessage_Function_glClipPlanexIMG = 40, + GLMessage_Function_glClipPlanexOES = 41, + GLMessage_Function_glColor4f = 42, + GLMessage_Function_glColor4ub = 43, + GLMessage_Function_glColor4x = 44, + GLMessage_Function_glColor4xOES = 45, + GLMessage_Function_glColorMask = 46, + GLMessage_Function_glColorPointer = 47, + GLMessage_Function_glCompileShader = 48, + GLMessage_Function_glCompressedTexImage2D = 49, + GLMessage_Function_glCompressedTexImage3DOES = 50, + GLMessage_Function_glCompressedTexSubImage2D = 51, + GLMessage_Function_glCompressedTexSubImage3DOES = 52, + GLMessage_Function_glCopyTexImage2D = 53, + GLMessage_Function_glCopyTexSubImage2D = 54, + GLMessage_Function_glCopyTexSubImage3DOES = 55, + GLMessage_Function_glCoverageMaskNV = 56, + GLMessage_Function_glCoverageOperationNV = 57, + GLMessage_Function_glCreateProgram = 58, + GLMessage_Function_glCreateShader = 59, + GLMessage_Function_glCullFace = 60, + GLMessage_Function_glCurrentPaletteMatrixOES = 61, + GLMessage_Function_glDeleteBuffers = 62, + GLMessage_Function_glDeleteFencesNV = 63, + GLMessage_Function_glDeleteFramebuffers = 64, + GLMessage_Function_glDeleteFramebuffersOES = 65, + GLMessage_Function_glDeletePerfMonitorsAMD = 66, + GLMessage_Function_glDeleteProgram = 67, + GLMessage_Function_glDeleteRenderbuffers = 68, + GLMessage_Function_glDeleteRenderbuffersOES = 69, + GLMessage_Function_glDeleteShader = 70, + GLMessage_Function_glDeleteTextures = 71, + GLMessage_Function_glDeleteVertexArraysOES = 72, + GLMessage_Function_glDepthFunc = 73, + GLMessage_Function_glDepthMask = 74, + GLMessage_Function_glDepthRangef = 75, + GLMessage_Function_glDepthRangefOES = 76, + GLMessage_Function_glDepthRangex = 77, + GLMessage_Function_glDepthRangexOES = 78, + GLMessage_Function_glDetachShader = 79, + GLMessage_Function_glDisableClientState = 80, + GLMessage_Function_glDisableDriverControlQCOM = 81, + GLMessage_Function_glDisable = 82, + GLMessage_Function_glDisableVertexAttribArray = 83, + GLMessage_Function_glDiscardFramebufferEXT = 84, + GLMessage_Function_glDrawArrays = 85, + GLMessage_Function_glDrawElements = 86, + GLMessage_Function_glDrawTexfOES = 87, + GLMessage_Function_glDrawTexfvOES = 88, + GLMessage_Function_glDrawTexiOES = 89, + GLMessage_Function_glDrawTexivOES = 90, + GLMessage_Function_glDrawTexsOES = 91, + GLMessage_Function_glDrawTexsvOES = 92, + GLMessage_Function_glDrawTexxOES = 93, + GLMessage_Function_glDrawTexxvOES = 94, + GLMessage_Function_glEGLImageTargetRenderbufferStorageOES = 95, + GLMessage_Function_glEGLImageTargetTexture2DOES = 96, + GLMessage_Function_glEnableClientState = 97, + GLMessage_Function_glEnableDriverControlQCOM = 98, + GLMessage_Function_glEnable = 99, + GLMessage_Function_glEnableVertexAttribArray = 100, + GLMessage_Function_glEndPerfMonitorAMD = 101, + GLMessage_Function_glEndTilingQCOM = 102, + GLMessage_Function_glExtGetBufferPointervQCOM = 103, + GLMessage_Function_glExtGetBuffersQCOM = 104, + GLMessage_Function_glExtGetFramebuffersQCOM = 105, + GLMessage_Function_glExtGetProgramBinarySourceQCOM = 106, + GLMessage_Function_glExtGetProgramsQCOM = 107, + GLMessage_Function_glExtGetRenderbuffersQCOM = 108, + GLMessage_Function_glExtGetShadersQCOM = 109, + GLMessage_Function_glExtGetTexLevelParameterivQCOM = 110, + GLMessage_Function_glExtGetTexSubImageQCOM = 111, + GLMessage_Function_glExtGetTexturesQCOM = 112, + GLMessage_Function_glExtIsProgramBinaryQCOM = 113, + GLMessage_Function_glExtTexObjectStateOverrideiQCOM = 114, + GLMessage_Function_glFinishFenceNV = 115, + GLMessage_Function_glFinish = 116, + GLMessage_Function_glFlush = 117, + GLMessage_Function_glFogf = 118, + GLMessage_Function_glFogfv = 119, + GLMessage_Function_glFogx = 120, + GLMessage_Function_glFogxOES = 121, + GLMessage_Function_glFogxv = 122, + GLMessage_Function_glFogxvOES = 123, + GLMessage_Function_glFramebufferRenderbuffer = 124, + GLMessage_Function_glFramebufferRenderbufferOES = 125, + GLMessage_Function_glFramebufferTexture2D = 126, + GLMessage_Function_glFramebufferTexture2DMultisampleIMG = 127, + GLMessage_Function_glFramebufferTexture2DOES = 128, + GLMessage_Function_glFramebufferTexture3DOES = 129, + GLMessage_Function_glFrontFace = 130, + GLMessage_Function_glFrustumf = 131, + GLMessage_Function_glFrustumfOES = 132, + GLMessage_Function_glFrustumx = 133, + GLMessage_Function_glFrustumxOES = 134, + GLMessage_Function_glGenBuffers = 135, + GLMessage_Function_glGenerateMipmap = 136, + GLMessage_Function_glGenerateMipmapOES = 137, + GLMessage_Function_glGenFencesNV = 138, + GLMessage_Function_glGenFramebuffers = 139, + GLMessage_Function_glGenFramebuffersOES = 140, + GLMessage_Function_glGenPerfMonitorsAMD = 141, + GLMessage_Function_glGenRenderbuffers = 142, + GLMessage_Function_glGenRenderbuffersOES = 143, + GLMessage_Function_glGenTextures = 144, + GLMessage_Function_glGenVertexArraysOES = 145, + GLMessage_Function_glGetActiveAttrib = 146, + GLMessage_Function_glGetActiveUniform = 147, + GLMessage_Function_glGetAttachedShaders = 148, + GLMessage_Function_glGetAttribLocation = 149, + GLMessage_Function_glGetBooleanv = 150, + GLMessage_Function_glGetBufferParameteriv = 151, + GLMessage_Function_glGetBufferPointervOES = 152, + GLMessage_Function_glGetClipPlanef = 153, + GLMessage_Function_glGetClipPlanefOES = 154, + GLMessage_Function_glGetClipPlanex = 155, + GLMessage_Function_glGetClipPlanexOES = 156, + GLMessage_Function_glGetDriverControlsQCOM = 157, + GLMessage_Function_glGetDriverControlStringQCOM = 158, + GLMessage_Function_glGetError = 159, + GLMessage_Function_glGetFenceivNV = 160, + GLMessage_Function_glGetFixedv = 161, + GLMessage_Function_glGetFixedvOES = 162, + GLMessage_Function_glGetFloatv = 163, + GLMessage_Function_glGetFramebufferAttachmentParameteriv = 164, + GLMessage_Function_glGetFramebufferAttachmentParameterivOES = 165, + GLMessage_Function_glGetIntegerv = 166, + GLMessage_Function_glGetLightfv = 167, + GLMessage_Function_glGetLightxv = 168, + GLMessage_Function_glGetLightxvOES = 169, + GLMessage_Function_glGetMaterialfv = 170, + GLMessage_Function_glGetMaterialxv = 171, + GLMessage_Function_glGetMaterialxvOES = 172, + GLMessage_Function_glGetPerfMonitorCounterDataAMD = 173, + GLMessage_Function_glGetPerfMonitorCounterInfoAMD = 174, + GLMessage_Function_glGetPerfMonitorCountersAMD = 175, + GLMessage_Function_glGetPerfMonitorCounterStringAMD = 176, + GLMessage_Function_glGetPerfMonitorGroupsAMD = 177, + GLMessage_Function_glGetPerfMonitorGroupStringAMD = 178, + GLMessage_Function_glGetPointerv = 179, + GLMessage_Function_glGetProgramBinaryOES = 180, + GLMessage_Function_glGetProgramInfoLog = 181, + GLMessage_Function_glGetProgramiv = 182, + GLMessage_Function_glGetRenderbufferParameteriv = 183, + GLMessage_Function_glGetRenderbufferParameterivOES = 184, + GLMessage_Function_glGetShaderInfoLog = 185, + GLMessage_Function_glGetShaderiv = 186, + GLMessage_Function_glGetShaderPrecisionFormat = 187, + GLMessage_Function_glGetShaderSource = 188, + GLMessage_Function_glGetString = 189, + GLMessage_Function_glGetTexEnvfv = 190, + GLMessage_Function_glGetTexEnviv = 191, + GLMessage_Function_glGetTexEnvxv = 192, + GLMessage_Function_glGetTexEnvxvOES = 193, + GLMessage_Function_glGetTexGenfvOES = 194, + GLMessage_Function_glGetTexGenivOES = 195, + GLMessage_Function_glGetTexGenxvOES = 196, + GLMessage_Function_glGetTexParameterfv = 197, + GLMessage_Function_glGetTexParameteriv = 198, + GLMessage_Function_glGetTexParameterxv = 199, + GLMessage_Function_glGetTexParameterxvOES = 200, + GLMessage_Function_glGetUniformfv = 201, + GLMessage_Function_glGetUniformiv = 202, + GLMessage_Function_glGetUniformLocation = 203, + GLMessage_Function_glGetVertexAttribfv = 204, + GLMessage_Function_glGetVertexAttribiv = 205, + GLMessage_Function_glGetVertexAttribPointerv = 206, + GLMessage_Function_glHint = 207, + GLMessage_Function_glIsBuffer = 208, + GLMessage_Function_glIsEnabled = 209, + GLMessage_Function_glIsFenceNV = 210, + GLMessage_Function_glIsFramebuffer = 211, + GLMessage_Function_glIsFramebufferOES = 212, + GLMessage_Function_glIsProgram = 213, + GLMessage_Function_glIsRenderbuffer = 214, + GLMessage_Function_glIsRenderbufferOES = 215, + GLMessage_Function_glIsShader = 216, + GLMessage_Function_glIsTexture = 217, + GLMessage_Function_glIsVertexArrayOES = 218, + GLMessage_Function_glLightf = 219, + GLMessage_Function_glLightfv = 220, + GLMessage_Function_glLightModelf = 221, + GLMessage_Function_glLightModelfv = 222, + GLMessage_Function_glLightModelx = 223, + GLMessage_Function_glLightModelxOES = 224, + GLMessage_Function_glLightModelxv = 225, + GLMessage_Function_glLightModelxvOES = 226, + GLMessage_Function_glLightx = 227, + GLMessage_Function_glLightxOES = 228, + GLMessage_Function_glLightxv = 229, + GLMessage_Function_glLightxvOES = 230, + GLMessage_Function_glLineWidth = 231, + GLMessage_Function_glLineWidthx = 232, + GLMessage_Function_glLineWidthxOES = 233, + GLMessage_Function_glLinkProgram = 234, + GLMessage_Function_glLoadIdentity = 235, + GLMessage_Function_glLoadMatrixf = 236, + GLMessage_Function_glLoadMatrixx = 237, + GLMessage_Function_glLoadMatrixxOES = 238, + GLMessage_Function_glLoadPaletteFromModelViewMatrixOES = 239, + GLMessage_Function_glLogicOp = 240, + GLMessage_Function_glMapBufferOES = 241, + GLMessage_Function_glMaterialf = 242, + GLMessage_Function_glMaterialfv = 243, + GLMessage_Function_glMaterialx = 244, + GLMessage_Function_glMaterialxOES = 245, + GLMessage_Function_glMaterialxv = 246, + GLMessage_Function_glMaterialxvOES = 247, + GLMessage_Function_glMatrixIndexPointerOES = 248, + GLMessage_Function_glMatrixMode = 249, + GLMessage_Function_glMultiDrawArraysEXT = 250, + GLMessage_Function_glMultiDrawElementsEXT = 251, + GLMessage_Function_glMultiTexCoord4f = 252, + GLMessage_Function_glMultiTexCoord4x = 253, + GLMessage_Function_glMultiTexCoord4xOES = 254, + GLMessage_Function_glMultMatrixf = 255, + GLMessage_Function_glMultMatrixx = 256, + GLMessage_Function_glMultMatrixxOES = 257, + GLMessage_Function_glNormal3f = 258, + GLMessage_Function_glNormal3x = 259, + GLMessage_Function_glNormal3xOES = 260, + GLMessage_Function_glNormalPointer = 261, + GLMessage_Function_glOrthof = 262, + GLMessage_Function_glOrthofOES = 263, + GLMessage_Function_glOrthox = 264, + GLMessage_Function_glOrthoxOES = 265, + GLMessage_Function_glPixelStorei = 266, + GLMessage_Function_glPointParameterf = 267, + GLMessage_Function_glPointParameterfv = 268, + GLMessage_Function_glPointParameterx = 269, + GLMessage_Function_glPointParameterxOES = 270, + GLMessage_Function_glPointParameterxv = 271, + GLMessage_Function_glPointParameterxvOES = 272, + GLMessage_Function_glPointSize = 273, + GLMessage_Function_glPointSizePointerOES = 274, + GLMessage_Function_glPointSizex = 275, + GLMessage_Function_glPointSizexOES = 276, + GLMessage_Function_glPolygonOffset = 277, + GLMessage_Function_glPolygonOffsetx = 278, + GLMessage_Function_glPolygonOffsetxOES = 279, + GLMessage_Function_glPopMatrix = 280, + GLMessage_Function_glProgramBinaryOES = 281, + GLMessage_Function_glPushMatrix = 282, + GLMessage_Function_glQueryMatrixxOES = 283, + GLMessage_Function_glReadPixels = 284, + GLMessage_Function_glReleaseShaderCompiler = 285, + GLMessage_Function_glRenderbufferStorage = 286, + GLMessage_Function_glRenderbufferStorageMultisampleIMG = 287, + GLMessage_Function_glRenderbufferStorageOES = 288, + GLMessage_Function_glRotatef = 289, + GLMessage_Function_glRotatex = 290, + GLMessage_Function_glRotatexOES = 291, + GLMessage_Function_glSampleCoverage = 292, + GLMessage_Function_glSampleCoveragex = 293, + GLMessage_Function_glSampleCoveragexOES = 294, + GLMessage_Function_glScalef = 295, + GLMessage_Function_glScalex = 296, + GLMessage_Function_glScalexOES = 297, + GLMessage_Function_glScissor = 298, + GLMessage_Function_glSelectPerfMonitorCountersAMD = 299, + GLMessage_Function_glSetFenceNV = 300, + GLMessage_Function_glShadeModel = 301, + GLMessage_Function_glShaderBinary = 302, + GLMessage_Function_glShaderSource = 303, + GLMessage_Function_glStartTilingQCOM = 304, + GLMessage_Function_glStencilFunc = 305, + GLMessage_Function_glStencilFuncSeparate = 306, + GLMessage_Function_glStencilMask = 307, + GLMessage_Function_glStencilMaskSeparate = 308, + GLMessage_Function_glStencilOp = 309, + GLMessage_Function_glStencilOpSeparate = 310, + GLMessage_Function_glTestFenceNV = 311, + GLMessage_Function_glTexCoordPointer = 312, + GLMessage_Function_glTexEnvf = 313, + GLMessage_Function_glTexEnvfv = 314, + GLMessage_Function_glTexEnvi = 315, + GLMessage_Function_glTexEnviv = 316, + GLMessage_Function_glTexEnvx = 317, + GLMessage_Function_glTexEnvxOES = 318, + GLMessage_Function_glTexEnvxv = 319, + GLMessage_Function_glTexEnvxvOES = 320, + GLMessage_Function_glTexGenfOES = 321, + GLMessage_Function_glTexGenfvOES = 322, + GLMessage_Function_glTexGeniOES = 323, + GLMessage_Function_glTexGenivOES = 324, + GLMessage_Function_glTexGenxOES = 325, + GLMessage_Function_glTexGenxvOES = 326, + GLMessage_Function_glTexImage2D = 327, + GLMessage_Function_glTexImage3DOES = 328, + GLMessage_Function_glTexParameterf = 329, + GLMessage_Function_glTexParameterfv = 330, + GLMessage_Function_glTexParameteri = 331, + GLMessage_Function_glTexParameteriv = 332, + GLMessage_Function_glTexParameterx = 333, + GLMessage_Function_glTexParameterxOES = 334, + GLMessage_Function_glTexParameterxv = 335, + GLMessage_Function_glTexParameterxvOES = 336, + GLMessage_Function_glTexSubImage2D = 337, + GLMessage_Function_glTexSubImage3DOES = 338, + GLMessage_Function_glTranslatef = 339, + GLMessage_Function_glTranslatex = 340, + GLMessage_Function_glTranslatexOES = 341, + GLMessage_Function_glUniform1f = 342, + GLMessage_Function_glUniform1fv = 343, + GLMessage_Function_glUniform1i = 344, + GLMessage_Function_glUniform1iv = 345, + GLMessage_Function_glUniform2f = 346, + GLMessage_Function_glUniform2fv = 347, + GLMessage_Function_glUniform2i = 348, + GLMessage_Function_glUniform2iv = 349, + GLMessage_Function_glUniform3f = 350, + GLMessage_Function_glUniform3fv = 351, + GLMessage_Function_glUniform3i = 352, + GLMessage_Function_glUniform3iv = 353, + GLMessage_Function_glUniform4f = 354, + GLMessage_Function_glUniform4fv = 355, + GLMessage_Function_glUniform4i = 356, + GLMessage_Function_glUniform4iv = 357, + GLMessage_Function_glUniformMatrix2fv = 358, + GLMessage_Function_glUniformMatrix3fv = 359, + GLMessage_Function_glUniformMatrix4fv = 360, + GLMessage_Function_glUnmapBufferOES = 361, + GLMessage_Function_glUseProgram = 362, + GLMessage_Function_glValidateProgram = 363, + GLMessage_Function_glVertexAttrib1f = 364, + GLMessage_Function_glVertexAttrib1fv = 365, + GLMessage_Function_glVertexAttrib2f = 366, + GLMessage_Function_glVertexAttrib2fv = 367, + GLMessage_Function_glVertexAttrib3f = 368, + GLMessage_Function_glVertexAttrib3fv = 369, + GLMessage_Function_glVertexAttrib4f = 370, + GLMessage_Function_glVertexAttrib4fv = 371, + GLMessage_Function_glVertexAttribPointer = 372, + GLMessage_Function_glVertexPointer = 373, + GLMessage_Function_glViewport = 374, + GLMessage_Function_glWeightPointerOES = 375, + GLMessage_Function_glActiveShaderProgramEXT = 502, + GLMessage_Function_glAlphaFuncQCOM = 503, + GLMessage_Function_glBeginQueryEXT = 504, + GLMessage_Function_glBindProgramPipelineEXT = 505, + GLMessage_Function_glBlitFramebufferANGLE = 506, + GLMessage_Function_glCreateShaderProgramvEXT = 507, + GLMessage_Function_glDeleteProgramPipelinesEXT = 508, + GLMessage_Function_glDeleteQueriesEXT = 509, + GLMessage_Function_glDrawBuffersNV = 510, + GLMessage_Function_glEndQueryEXT = 511, + GLMessage_Function_glFramebufferTexture2DMultisampleEXT = 512, + GLMessage_Function_glGenProgramPipelinesEXT = 513, + GLMessage_Function_glGenQueriesEXT = 514, + GLMessage_Function_glGetGraphicsResetStatusEXT = 515, + GLMessage_Function_glGetObjectLabelEXT = 516, + GLMessage_Function_glGetProgramPipelineInfoLogEXT = 517, + GLMessage_Function_glGetProgramPipelineivEXT = 518, + GLMessage_Function_glGetQueryObjectuivEXT = 519, + GLMessage_Function_glGetQueryivEXT = 520, + GLMessage_Function_glGetnUniformfvEXT = 521, + GLMessage_Function_glGetnUniformivEXT = 521, + GLMessage_Function_glInsertEventMarkerEXT = 522, + GLMessage_Function_glIsProgramPipelineEXT = 523, + GLMessage_Function_glIsQueryEXT = 524, + GLMessage_Function_glLabelObjectEXT = 525, + GLMessage_Function_glPopGroupMarkerEXT = 526, + GLMessage_Function_glProgramParameteriEXT = 527, + GLMessage_Function_glProgramUniform1fEXT = 528, + GLMessage_Function_glProgramUniform1fvEXT = 529, + GLMessage_Function_glProgramUniform1iEXT = 530, + GLMessage_Function_glProgramUniform1ivEXT = 531, + GLMessage_Function_glProgramUniform2fEXT = 532, + GLMessage_Function_glProgramUniform2fvEXT = 533, + GLMessage_Function_glProgramUniform2iEXT = 534, + GLMessage_Function_glProgramUniform2ivEXT = 535, + GLMessage_Function_glProgramUniform3fEXT = 536, + GLMessage_Function_glProgramUniform3fvEXT = 537, + GLMessage_Function_glProgramUniform3iEXT = 538, + GLMessage_Function_glProgramUniform3ivEXT = 539, + GLMessage_Function_glProgramUniform4fEXT = 540, + GLMessage_Function_glProgramUniform4fvEXT = 541, + GLMessage_Function_glProgramUniform4iEXT = 542, + GLMessage_Function_glProgramUniform4ivEXT = 543, + GLMessage_Function_glProgramUniformMatrix2fvEXT = 544, + GLMessage_Function_glProgramUniformMatrix3fvEXT = 545, + GLMessage_Function_glProgramUniformMatrix4fvEXT = 546, + GLMessage_Function_glPushGroupMarkerEXT = 547, + GLMessage_Function_glReadBufferNV = 548, + GLMessage_Function_glReadnPixelsEXT = 549, + GLMessage_Function_glRenderbufferStorageMultisampleANGLE = 550, + GLMessage_Function_glRenderbufferStorageMultisampleAPPLE = 551, + GLMessage_Function_glRenderbufferStorageMultisampleEXT = 552, + GLMessage_Function_glResolveMultisampleFramebufferAPPLE = 553, + GLMessage_Function_glTexStorage1DEXT = 554, + GLMessage_Function_glTexStorage2DEXT = 555, + GLMessage_Function_glTexStorage3DEXT = 556, + GLMessage_Function_glTextureStorage1DEXT = 557, + GLMessage_Function_glTextureStorage2DEXT = 558, + GLMessage_Function_glTextureStorage3DEXT = 559, + GLMessage_Function_glUseProgramStagesEXT = 560, + GLMessage_Function_glValidateProgramPipelineEXT = 561, + GLMessage_Function_eglGetDisplay = 2000, + GLMessage_Function_eglInitialize = 2001, + GLMessage_Function_eglTerminate = 2002, + GLMessage_Function_eglGetConfigs = 2003, + GLMessage_Function_eglChooseConfig = 2004, + GLMessage_Function_eglGetConfigAttrib = 2005, + GLMessage_Function_eglCreateWindowSurface = 2006, + GLMessage_Function_eglCreatePixmapSurface = 2007, + GLMessage_Function_eglCreatePbufferSurface = 2008, + GLMessage_Function_eglDestroySurface = 2009, + GLMessage_Function_eglQuerySurface = 2010, + GLMessage_Function_eglCreateContext = 2011, + GLMessage_Function_eglDestroyContext = 2012, + GLMessage_Function_eglMakeCurrent = 2013, + GLMessage_Function_eglGetCurrentContext = 2014, + GLMessage_Function_eglGetCurrentSurface = 2015, + GLMessage_Function_eglGetCurrentDisplay = 2016, + GLMessage_Function_eglQueryContext = 2017, + GLMessage_Function_eglWaitGL = 2018, + GLMessage_Function_eglWaitNative = 2019, + GLMessage_Function_eglSwapBuffers = 2020, + GLMessage_Function_eglCopyBuffers = 2021, + GLMessage_Function_eglGetError = 2022, + GLMessage_Function_eglQueryString = 2023, + GLMessage_Function_eglGetProcAddress = 2024, + GLMessage_Function_eglSurfaceAttrib = 2025, + GLMessage_Function_eglBindTexImage = 2026, + GLMessage_Function_eglReleaseTexImage = 2027, + GLMessage_Function_eglSwapInterval = 2028, + GLMessage_Function_eglBindAPI = 2029, + GLMessage_Function_eglQueryAPI = 2030, + GLMessage_Function_eglWaitClient = 2031, + GLMessage_Function_eglReleaseThread = 2032, + GLMessage_Function_eglCreatePbufferFromClientBuffer = 2033, + GLMessage_Function_eglLockSurfaceKHR = 2034, + GLMessage_Function_eglUnlockSurfaceKHR = 2035, + GLMessage_Function_eglCreateImageKHR = 2036, + GLMessage_Function_eglDestroyImageKHR = 2037, + GLMessage_Function_eglCreateSyncKHR = 2038, + GLMessage_Function_eglDestroySyncKHR = 2039, + GLMessage_Function_eglClientWaitSyncKHR = 2040, + GLMessage_Function_eglGetSyncAttribKHR = 2041, + GLMessage_Function_eglSetSwapRectangleANDROID = 2042, + GLMessage_Function_eglGetRenderBufferANDROID = 2043, + GLMessage_Function_eglGetSystemTimeFrequencyNV = 2044, + GLMessage_Function_eglGetSystemTimeNV = 2045, + GLMessage_Function_invalid = 3000, + GLMessage_Function_glVertexAttribPointerData = 3001 +}; +bool GLMessage_Function_IsValid(int value); +const GLMessage_Function GLMessage_Function_Function_MIN = GLMessage_Function_glActiveTexture; +const GLMessage_Function GLMessage_Function_Function_MAX = GLMessage_Function_glVertexAttribPointerData; +const int GLMessage_Function_Function_ARRAYSIZE = GLMessage_Function_Function_MAX + 1; + +// =================================================================== + +class GLMessage_DataType : public ::google::protobuf::MessageLite { + public: + GLMessage_DataType(); + virtual ~GLMessage_DataType(); + + GLMessage_DataType(const GLMessage_DataType& from); + + inline GLMessage_DataType& operator=(const GLMessage_DataType& from) { + CopyFrom(from); + return *this; + } + + static const GLMessage_DataType& default_instance(); + + void Swap(GLMessage_DataType* other); + + // implements Message ---------------------------------------------- + + GLMessage_DataType* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const GLMessage_DataType& from); + void MergeFrom(const GLMessage_DataType& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef GLMessage_DataType_Type Type; + static const Type VOID = GLMessage_DataType_Type_VOID; + static const Type CHAR = GLMessage_DataType_Type_CHAR; + static const Type BYTE = GLMessage_DataType_Type_BYTE; + static const Type INT = GLMessage_DataType_Type_INT; + static const Type FLOAT = GLMessage_DataType_Type_FLOAT; + static const Type BOOL = GLMessage_DataType_Type_BOOL; + static const Type ENUM = GLMessage_DataType_Type_ENUM; + static inline bool Type_IsValid(int value) { + return GLMessage_DataType_Type_IsValid(value); + } + static const Type Type_MIN = + GLMessage_DataType_Type_Type_MIN; + static const Type Type_MAX = + GLMessage_DataType_Type_Type_MAX; + static const int Type_ARRAYSIZE = + GLMessage_DataType_Type_Type_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; + inline bool has_type() const; + inline void clear_type(); + static const int kTypeFieldNumber = 1; + inline ::android::gltrace::GLMessage_DataType_Type type() const; + inline void set_type(::android::gltrace::GLMessage_DataType_Type value); + + // required bool isArray = 2 [default = false]; + inline bool has_isarray() const; + inline void clear_isarray(); + static const int kIsArrayFieldNumber = 2; + inline bool isarray() const; + inline void set_isarray(bool value); + + // repeated int32 intValue = 3; + inline int intvalue_size() const; + inline void clear_intvalue(); + static const int kIntValueFieldNumber = 3; + inline ::google::protobuf::int32 intvalue(int index) const; + inline void set_intvalue(int index, ::google::protobuf::int32 value); + inline void add_intvalue(::google::protobuf::int32 value); + inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& + intvalue() const; + inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* + mutable_intvalue(); + + // repeated float floatValue = 4; + inline int floatvalue_size() const; + inline void clear_floatvalue(); + static const int kFloatValueFieldNumber = 4; + inline float floatvalue(int index) const; + inline void set_floatvalue(int index, float value); + inline void add_floatvalue(float value); + inline const ::google::protobuf::RepeatedField< float >& + floatvalue() const; + inline ::google::protobuf::RepeatedField< float >* + mutable_floatvalue(); + + // repeated bytes charValue = 5; + inline int charvalue_size() const; + inline void clear_charvalue(); + static const int kCharValueFieldNumber = 5; + inline const ::std::string& charvalue(int index) const; + inline ::std::string* mutable_charvalue(int index); + inline void set_charvalue(int index, const ::std::string& value); + inline void set_charvalue(int index, const char* value); + inline void set_charvalue(int index, const void* value, size_t size); + inline ::std::string* add_charvalue(); + inline void add_charvalue(const ::std::string& value); + inline void add_charvalue(const char* value); + inline void add_charvalue(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& charvalue() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_charvalue(); + + // repeated bytes rawBytes = 6; + inline int rawbytes_size() const; + inline void clear_rawbytes(); + static const int kRawBytesFieldNumber = 6; + inline const ::std::string& rawbytes(int index) const; + inline ::std::string* mutable_rawbytes(int index); + inline void set_rawbytes(int index, const ::std::string& value); + inline void set_rawbytes(int index, const char* value); + inline void set_rawbytes(int index, const void* value, size_t size); + inline ::std::string* add_rawbytes(); + inline void add_rawbytes(const ::std::string& value); + inline void add_rawbytes(const char* value); + inline void add_rawbytes(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& rawbytes() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_rawbytes(); + + // repeated bool boolValue = 7; + inline int boolvalue_size() const; + inline void clear_boolvalue(); + static const int kBoolValueFieldNumber = 7; + inline bool boolvalue(int index) const; + inline void set_boolvalue(int index, bool value); + inline void add_boolvalue(bool value); + inline const ::google::protobuf::RepeatedField< bool >& + boolvalue() const; + inline ::google::protobuf::RepeatedField< bool >* + mutable_boolvalue(); + + // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.DataType) + private: + mutable int _cached_size_; + + int type_; + bool isarray_; + ::google::protobuf::RepeatedField< ::google::protobuf::int32 > intvalue_; + ::google::protobuf::RepeatedField< float > floatvalue_; + ::google::protobuf::RepeatedPtrField< ::std::string> charvalue_; + ::google::protobuf::RepeatedPtrField< ::std::string> rawbytes_; + ::google::protobuf::RepeatedField< bool > boolvalue_; + friend void protobuf_AddDesc_gltrace_2eproto(); + friend void protobuf_AssignDesc_gltrace_2eproto(); + friend void protobuf_ShutdownFile_gltrace_2eproto(); + + ::google::protobuf::uint32 _has_bits_[(7 + 31) / 32]; + + // WHY DOES & HAVE LOWER PRECEDENCE THAN != !? + inline bool _has_bit(int index) const { + return (_has_bits_[index / 32] & (1u << (index % 32))) != 0; + } + inline void _set_bit(int index) { + _has_bits_[index / 32] |= (1u << (index % 32)); + } + inline void _clear_bit(int index) { + _has_bits_[index / 32] &= ~(1u << (index % 32)); + } + + void InitAsDefaultInstance(); + static GLMessage_DataType* default_instance_; +}; +// ------------------------------------------------------------------- + +class GLMessage_FrameBuffer : public ::google::protobuf::MessageLite { + public: + GLMessage_FrameBuffer(); + virtual ~GLMessage_FrameBuffer(); + + GLMessage_FrameBuffer(const GLMessage_FrameBuffer& from); + + inline GLMessage_FrameBuffer& operator=(const GLMessage_FrameBuffer& from) { + CopyFrom(from); + return *this; + } + + static const GLMessage_FrameBuffer& default_instance(); + + void Swap(GLMessage_FrameBuffer* other); + + // implements Message ---------------------------------------------- + + GLMessage_FrameBuffer* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const GLMessage_FrameBuffer& from); + void MergeFrom(const GLMessage_FrameBuffer& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + // accessors ------------------------------------------------------- + + // required int32 width = 1; + inline bool has_width() const; + inline void clear_width(); + static const int kWidthFieldNumber = 1; + inline ::google::protobuf::int32 width() const; + inline void set_width(::google::protobuf::int32 value); + + // required int32 height = 2; + inline bool has_height() const; + inline void clear_height(); + static const int kHeightFieldNumber = 2; + inline ::google::protobuf::int32 height() const; + inline void set_height(::google::protobuf::int32 value); + + // repeated bytes contents = 3; + inline int contents_size() const; + inline void clear_contents(); + static const int kContentsFieldNumber = 3; + inline const ::std::string& contents(int index) const; + inline ::std::string* mutable_contents(int index); + inline void set_contents(int index, const ::std::string& value); + inline void set_contents(int index, const char* value); + inline void set_contents(int index, const void* value, size_t size); + inline ::std::string* add_contents(); + inline void add_contents(const ::std::string& value); + inline void add_contents(const char* value); + inline void add_contents(const void* value, size_t size); + inline const ::google::protobuf::RepeatedPtrField< ::std::string>& contents() const; + inline ::google::protobuf::RepeatedPtrField< ::std::string>* mutable_contents(); + + // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage.FrameBuffer) + private: + mutable int _cached_size_; + + ::google::protobuf::int32 width_; + ::google::protobuf::int32 height_; + ::google::protobuf::RepeatedPtrField< ::std::string> contents_; + friend void protobuf_AddDesc_gltrace_2eproto(); + friend void protobuf_AssignDesc_gltrace_2eproto(); + friend void protobuf_ShutdownFile_gltrace_2eproto(); + + ::google::protobuf::uint32 _has_bits_[(3 + 31) / 32]; + + // WHY DOES & HAVE LOWER PRECEDENCE THAN != !? + inline bool _has_bit(int index) const { + return (_has_bits_[index / 32] & (1u << (index % 32))) != 0; + } + inline void _set_bit(int index) { + _has_bits_[index / 32] |= (1u << (index % 32)); + } + inline void _clear_bit(int index) { + _has_bits_[index / 32] &= ~(1u << (index % 32)); + } + + void InitAsDefaultInstance(); + static GLMessage_FrameBuffer* default_instance_; +}; +// ------------------------------------------------------------------- + +class GLMessage : public ::google::protobuf::MessageLite { + public: + GLMessage(); + virtual ~GLMessage(); + + GLMessage(const GLMessage& from); + + inline GLMessage& operator=(const GLMessage& from) { + CopyFrom(from); + return *this; + } + + static const GLMessage& default_instance(); + + void Swap(GLMessage* other); + + // implements Message ---------------------------------------------- + + GLMessage* New() const; + void CheckTypeAndMergeFrom(const ::google::protobuf::MessageLite& from); + void CopyFrom(const GLMessage& from); + void MergeFrom(const GLMessage& from); + void Clear(); + bool IsInitialized() const; + + int ByteSize() const; + bool MergePartialFromCodedStream( + ::google::protobuf::io::CodedInputStream* input); + void SerializeWithCachedSizes( + ::google::protobuf::io::CodedOutputStream* output) const; + int GetCachedSize() const { return _cached_size_; } + private: + void SharedCtor(); + void SharedDtor(); + void SetCachedSize(int size) const; + public: + + ::std::string GetTypeName() const; + + // nested types ---------------------------------------------------- + + typedef GLMessage_DataType DataType; + typedef GLMessage_FrameBuffer FrameBuffer; + + typedef GLMessage_Function Function; + static const Function glActiveTexture = GLMessage_Function_glActiveTexture; + static const Function glAlphaFunc = GLMessage_Function_glAlphaFunc; + static const Function glAlphaFuncx = GLMessage_Function_glAlphaFuncx; + static const Function glAlphaFuncxOES = GLMessage_Function_glAlphaFuncxOES; + static const Function glAttachShader = GLMessage_Function_glAttachShader; + static const Function glBeginPerfMonitorAMD = GLMessage_Function_glBeginPerfMonitorAMD; + static const Function glBindAttribLocation = GLMessage_Function_glBindAttribLocation; + static const Function glBindBuffer = GLMessage_Function_glBindBuffer; + static const Function glBindFramebuffer = GLMessage_Function_glBindFramebuffer; + static const Function glBindFramebufferOES = GLMessage_Function_glBindFramebufferOES; + static const Function glBindRenderbuffer = GLMessage_Function_glBindRenderbuffer; + static const Function glBindRenderbufferOES = GLMessage_Function_glBindRenderbufferOES; + static const Function glBindTexture = GLMessage_Function_glBindTexture; + static const Function glBindVertexArrayOES = GLMessage_Function_glBindVertexArrayOES; + static const Function glBlendColor = GLMessage_Function_glBlendColor; + static const Function glBlendEquation = GLMessage_Function_glBlendEquation; + static const Function glBlendEquationOES = GLMessage_Function_glBlendEquationOES; + static const Function glBlendEquationSeparate = GLMessage_Function_glBlendEquationSeparate; + static const Function glBlendEquationSeparateOES = GLMessage_Function_glBlendEquationSeparateOES; + static const Function glBlendFunc = GLMessage_Function_glBlendFunc; + static const Function glBlendFuncSeparate = GLMessage_Function_glBlendFuncSeparate; + static const Function glBlendFuncSeparateOES = GLMessage_Function_glBlendFuncSeparateOES; + static const Function glBufferData = GLMessage_Function_glBufferData; + static const Function glBufferSubData = GLMessage_Function_glBufferSubData; + static const Function glCheckFramebufferStatus = GLMessage_Function_glCheckFramebufferStatus; + static const Function glCheckFramebufferStatusOES = GLMessage_Function_glCheckFramebufferStatusOES; + static const Function glClearColor = GLMessage_Function_glClearColor; + static const Function glClearColorx = GLMessage_Function_glClearColorx; + static const Function glClearColorxOES = GLMessage_Function_glClearColorxOES; + static const Function glClearDepthf = GLMessage_Function_glClearDepthf; + static const Function glClearDepthfOES = GLMessage_Function_glClearDepthfOES; + static const Function glClearDepthx = GLMessage_Function_glClearDepthx; + static const Function glClearDepthxOES = GLMessage_Function_glClearDepthxOES; + static const Function glClear = GLMessage_Function_glClear; + static const Function glClearStencil = GLMessage_Function_glClearStencil; + static const Function glClientActiveTexture = GLMessage_Function_glClientActiveTexture; + static const Function glClipPlanef = GLMessage_Function_glClipPlanef; + static const Function glClipPlanefIMG = GLMessage_Function_glClipPlanefIMG; + static const Function glClipPlanefOES = GLMessage_Function_glClipPlanefOES; + static const Function glClipPlanex = GLMessage_Function_glClipPlanex; + static const Function glClipPlanexIMG = GLMessage_Function_glClipPlanexIMG; + static const Function glClipPlanexOES = GLMessage_Function_glClipPlanexOES; + static const Function glColor4f = GLMessage_Function_glColor4f; + static const Function glColor4ub = GLMessage_Function_glColor4ub; + static const Function glColor4x = GLMessage_Function_glColor4x; + static const Function glColor4xOES = GLMessage_Function_glColor4xOES; + static const Function glColorMask = GLMessage_Function_glColorMask; + static const Function glColorPointer = GLMessage_Function_glColorPointer; + static const Function glCompileShader = GLMessage_Function_glCompileShader; + static const Function glCompressedTexImage2D = GLMessage_Function_glCompressedTexImage2D; + static const Function glCompressedTexImage3DOES = GLMessage_Function_glCompressedTexImage3DOES; + static const Function glCompressedTexSubImage2D = GLMessage_Function_glCompressedTexSubImage2D; + static const Function glCompressedTexSubImage3DOES = GLMessage_Function_glCompressedTexSubImage3DOES; + static const Function glCopyTexImage2D = GLMessage_Function_glCopyTexImage2D; + static const Function glCopyTexSubImage2D = GLMessage_Function_glCopyTexSubImage2D; + static const Function glCopyTexSubImage3DOES = GLMessage_Function_glCopyTexSubImage3DOES; + static const Function glCoverageMaskNV = GLMessage_Function_glCoverageMaskNV; + static const Function glCoverageOperationNV = GLMessage_Function_glCoverageOperationNV; + static const Function glCreateProgram = GLMessage_Function_glCreateProgram; + static const Function glCreateShader = GLMessage_Function_glCreateShader; + static const Function glCullFace = GLMessage_Function_glCullFace; + static const Function glCurrentPaletteMatrixOES = GLMessage_Function_glCurrentPaletteMatrixOES; + static const Function glDeleteBuffers = GLMessage_Function_glDeleteBuffers; + static const Function glDeleteFencesNV = GLMessage_Function_glDeleteFencesNV; + static const Function glDeleteFramebuffers = GLMessage_Function_glDeleteFramebuffers; + static const Function glDeleteFramebuffersOES = GLMessage_Function_glDeleteFramebuffersOES; + static const Function glDeletePerfMonitorsAMD = GLMessage_Function_glDeletePerfMonitorsAMD; + static const Function glDeleteProgram = GLMessage_Function_glDeleteProgram; + static const Function glDeleteRenderbuffers = GLMessage_Function_glDeleteRenderbuffers; + static const Function glDeleteRenderbuffersOES = GLMessage_Function_glDeleteRenderbuffersOES; + static const Function glDeleteShader = GLMessage_Function_glDeleteShader; + static const Function glDeleteTextures = GLMessage_Function_glDeleteTextures; + static const Function glDeleteVertexArraysOES = GLMessage_Function_glDeleteVertexArraysOES; + static const Function glDepthFunc = GLMessage_Function_glDepthFunc; + static const Function glDepthMask = GLMessage_Function_glDepthMask; + static const Function glDepthRangef = GLMessage_Function_glDepthRangef; + static const Function glDepthRangefOES = GLMessage_Function_glDepthRangefOES; + static const Function glDepthRangex = GLMessage_Function_glDepthRangex; + static const Function glDepthRangexOES = GLMessage_Function_glDepthRangexOES; + static const Function glDetachShader = GLMessage_Function_glDetachShader; + static const Function glDisableClientState = GLMessage_Function_glDisableClientState; + static const Function glDisableDriverControlQCOM = GLMessage_Function_glDisableDriverControlQCOM; + static const Function glDisable = GLMessage_Function_glDisable; + static const Function glDisableVertexAttribArray = GLMessage_Function_glDisableVertexAttribArray; + static const Function glDiscardFramebufferEXT = GLMessage_Function_glDiscardFramebufferEXT; + static const Function glDrawArrays = GLMessage_Function_glDrawArrays; + static const Function glDrawElements = GLMessage_Function_glDrawElements; + static const Function glDrawTexfOES = GLMessage_Function_glDrawTexfOES; + static const Function glDrawTexfvOES = GLMessage_Function_glDrawTexfvOES; + static const Function glDrawTexiOES = GLMessage_Function_glDrawTexiOES; + static const Function glDrawTexivOES = GLMessage_Function_glDrawTexivOES; + static const Function glDrawTexsOES = GLMessage_Function_glDrawTexsOES; + static const Function glDrawTexsvOES = GLMessage_Function_glDrawTexsvOES; + static const Function glDrawTexxOES = GLMessage_Function_glDrawTexxOES; + static const Function glDrawTexxvOES = GLMessage_Function_glDrawTexxvOES; + static const Function glEGLImageTargetRenderbufferStorageOES = GLMessage_Function_glEGLImageTargetRenderbufferStorageOES; + static const Function glEGLImageTargetTexture2DOES = GLMessage_Function_glEGLImageTargetTexture2DOES; + static const Function glEnableClientState = GLMessage_Function_glEnableClientState; + static const Function glEnableDriverControlQCOM = GLMessage_Function_glEnableDriverControlQCOM; + static const Function glEnable = GLMessage_Function_glEnable; + static const Function glEnableVertexAttribArray = GLMessage_Function_glEnableVertexAttribArray; + static const Function glEndPerfMonitorAMD = GLMessage_Function_glEndPerfMonitorAMD; + static const Function glEndTilingQCOM = GLMessage_Function_glEndTilingQCOM; + static const Function glExtGetBufferPointervQCOM = GLMessage_Function_glExtGetBufferPointervQCOM; + static const Function glExtGetBuffersQCOM = GLMessage_Function_glExtGetBuffersQCOM; + static const Function glExtGetFramebuffersQCOM = GLMessage_Function_glExtGetFramebuffersQCOM; + static const Function glExtGetProgramBinarySourceQCOM = GLMessage_Function_glExtGetProgramBinarySourceQCOM; + static const Function glExtGetProgramsQCOM = GLMessage_Function_glExtGetProgramsQCOM; + static const Function glExtGetRenderbuffersQCOM = GLMessage_Function_glExtGetRenderbuffersQCOM; + static const Function glExtGetShadersQCOM = GLMessage_Function_glExtGetShadersQCOM; + static const Function glExtGetTexLevelParameterivQCOM = GLMessage_Function_glExtGetTexLevelParameterivQCOM; + static const Function glExtGetTexSubImageQCOM = GLMessage_Function_glExtGetTexSubImageQCOM; + static const Function glExtGetTexturesQCOM = GLMessage_Function_glExtGetTexturesQCOM; + static const Function glExtIsProgramBinaryQCOM = GLMessage_Function_glExtIsProgramBinaryQCOM; + static const Function glExtTexObjectStateOverrideiQCOM = GLMessage_Function_glExtTexObjectStateOverrideiQCOM; + static const Function glFinishFenceNV = GLMessage_Function_glFinishFenceNV; + static const Function glFinish = GLMessage_Function_glFinish; + static const Function glFlush = GLMessage_Function_glFlush; + static const Function glFogf = GLMessage_Function_glFogf; + static const Function glFogfv = GLMessage_Function_glFogfv; + static const Function glFogx = GLMessage_Function_glFogx; + static const Function glFogxOES = GLMessage_Function_glFogxOES; + static const Function glFogxv = GLMessage_Function_glFogxv; + static const Function glFogxvOES = GLMessage_Function_glFogxvOES; + static const Function glFramebufferRenderbuffer = GLMessage_Function_glFramebufferRenderbuffer; + static const Function glFramebufferRenderbufferOES = GLMessage_Function_glFramebufferRenderbufferOES; + static const Function glFramebufferTexture2D = GLMessage_Function_glFramebufferTexture2D; + static const Function glFramebufferTexture2DMultisampleIMG = GLMessage_Function_glFramebufferTexture2DMultisampleIMG; + static const Function glFramebufferTexture2DOES = GLMessage_Function_glFramebufferTexture2DOES; + static const Function glFramebufferTexture3DOES = GLMessage_Function_glFramebufferTexture3DOES; + static const Function glFrontFace = GLMessage_Function_glFrontFace; + static const Function glFrustumf = GLMessage_Function_glFrustumf; + static const Function glFrustumfOES = GLMessage_Function_glFrustumfOES; + static const Function glFrustumx = GLMessage_Function_glFrustumx; + static const Function glFrustumxOES = GLMessage_Function_glFrustumxOES; + static const Function glGenBuffers = GLMessage_Function_glGenBuffers; + static const Function glGenerateMipmap = GLMessage_Function_glGenerateMipmap; + static const Function glGenerateMipmapOES = GLMessage_Function_glGenerateMipmapOES; + static const Function glGenFencesNV = GLMessage_Function_glGenFencesNV; + static const Function glGenFramebuffers = GLMessage_Function_glGenFramebuffers; + static const Function glGenFramebuffersOES = GLMessage_Function_glGenFramebuffersOES; + static const Function glGenPerfMonitorsAMD = GLMessage_Function_glGenPerfMonitorsAMD; + static const Function glGenRenderbuffers = GLMessage_Function_glGenRenderbuffers; + static const Function glGenRenderbuffersOES = GLMessage_Function_glGenRenderbuffersOES; + static const Function glGenTextures = GLMessage_Function_glGenTextures; + static const Function glGenVertexArraysOES = GLMessage_Function_glGenVertexArraysOES; + static const Function glGetActiveAttrib = GLMessage_Function_glGetActiveAttrib; + static const Function glGetActiveUniform = GLMessage_Function_glGetActiveUniform; + static const Function glGetAttachedShaders = GLMessage_Function_glGetAttachedShaders; + static const Function glGetAttribLocation = GLMessage_Function_glGetAttribLocation; + static const Function glGetBooleanv = GLMessage_Function_glGetBooleanv; + static const Function glGetBufferParameteriv = GLMessage_Function_glGetBufferParameteriv; + static const Function glGetBufferPointervOES = GLMessage_Function_glGetBufferPointervOES; + static const Function glGetClipPlanef = GLMessage_Function_glGetClipPlanef; + static const Function glGetClipPlanefOES = GLMessage_Function_glGetClipPlanefOES; + static const Function glGetClipPlanex = GLMessage_Function_glGetClipPlanex; + static const Function glGetClipPlanexOES = GLMessage_Function_glGetClipPlanexOES; + static const Function glGetDriverControlsQCOM = GLMessage_Function_glGetDriverControlsQCOM; + static const Function glGetDriverControlStringQCOM = GLMessage_Function_glGetDriverControlStringQCOM; + static const Function glGetError = GLMessage_Function_glGetError; + static const Function glGetFenceivNV = GLMessage_Function_glGetFenceivNV; + static const Function glGetFixedv = GLMessage_Function_glGetFixedv; + static const Function glGetFixedvOES = GLMessage_Function_glGetFixedvOES; + static const Function glGetFloatv = GLMessage_Function_glGetFloatv; + static const Function glGetFramebufferAttachmentParameteriv = GLMessage_Function_glGetFramebufferAttachmentParameteriv; + static const Function glGetFramebufferAttachmentParameterivOES = GLMessage_Function_glGetFramebufferAttachmentParameterivOES; + static const Function glGetIntegerv = GLMessage_Function_glGetIntegerv; + static const Function glGetLightfv = GLMessage_Function_glGetLightfv; + static const Function glGetLightxv = GLMessage_Function_glGetLightxv; + static const Function glGetLightxvOES = GLMessage_Function_glGetLightxvOES; + static const Function glGetMaterialfv = GLMessage_Function_glGetMaterialfv; + static const Function glGetMaterialxv = GLMessage_Function_glGetMaterialxv; + static const Function glGetMaterialxvOES = GLMessage_Function_glGetMaterialxvOES; + static const Function glGetPerfMonitorCounterDataAMD = GLMessage_Function_glGetPerfMonitorCounterDataAMD; + static const Function glGetPerfMonitorCounterInfoAMD = GLMessage_Function_glGetPerfMonitorCounterInfoAMD; + static const Function glGetPerfMonitorCountersAMD = GLMessage_Function_glGetPerfMonitorCountersAMD; + static const Function glGetPerfMonitorCounterStringAMD = GLMessage_Function_glGetPerfMonitorCounterStringAMD; + static const Function glGetPerfMonitorGroupsAMD = GLMessage_Function_glGetPerfMonitorGroupsAMD; + static const Function glGetPerfMonitorGroupStringAMD = GLMessage_Function_glGetPerfMonitorGroupStringAMD; + static const Function glGetPointerv = GLMessage_Function_glGetPointerv; + static const Function glGetProgramBinaryOES = GLMessage_Function_glGetProgramBinaryOES; + static const Function glGetProgramInfoLog = GLMessage_Function_glGetProgramInfoLog; + static const Function glGetProgramiv = GLMessage_Function_glGetProgramiv; + static const Function glGetRenderbufferParameteriv = GLMessage_Function_glGetRenderbufferParameteriv; + static const Function glGetRenderbufferParameterivOES = GLMessage_Function_glGetRenderbufferParameterivOES; + static const Function glGetShaderInfoLog = GLMessage_Function_glGetShaderInfoLog; + static const Function glGetShaderiv = GLMessage_Function_glGetShaderiv; + static const Function glGetShaderPrecisionFormat = GLMessage_Function_glGetShaderPrecisionFormat; + static const Function glGetShaderSource = GLMessage_Function_glGetShaderSource; + static const Function glGetString = GLMessage_Function_glGetString; + static const Function glGetTexEnvfv = GLMessage_Function_glGetTexEnvfv; + static const Function glGetTexEnviv = GLMessage_Function_glGetTexEnviv; + static const Function glGetTexEnvxv = GLMessage_Function_glGetTexEnvxv; + static const Function glGetTexEnvxvOES = GLMessage_Function_glGetTexEnvxvOES; + static const Function glGetTexGenfvOES = GLMessage_Function_glGetTexGenfvOES; + static const Function glGetTexGenivOES = GLMessage_Function_glGetTexGenivOES; + static const Function glGetTexGenxvOES = GLMessage_Function_glGetTexGenxvOES; + static const Function glGetTexParameterfv = GLMessage_Function_glGetTexParameterfv; + static const Function glGetTexParameteriv = GLMessage_Function_glGetTexParameteriv; + static const Function glGetTexParameterxv = GLMessage_Function_glGetTexParameterxv; + static const Function glGetTexParameterxvOES = GLMessage_Function_glGetTexParameterxvOES; + static const Function glGetUniformfv = GLMessage_Function_glGetUniformfv; + static const Function glGetUniformiv = GLMessage_Function_glGetUniformiv; + static const Function glGetUniformLocation = GLMessage_Function_glGetUniformLocation; + static const Function glGetVertexAttribfv = GLMessage_Function_glGetVertexAttribfv; + static const Function glGetVertexAttribiv = GLMessage_Function_glGetVertexAttribiv; + static const Function glGetVertexAttribPointerv = GLMessage_Function_glGetVertexAttribPointerv; + static const Function glHint = GLMessage_Function_glHint; + static const Function glIsBuffer = GLMessage_Function_glIsBuffer; + static const Function glIsEnabled = GLMessage_Function_glIsEnabled; + static const Function glIsFenceNV = GLMessage_Function_glIsFenceNV; + static const Function glIsFramebuffer = GLMessage_Function_glIsFramebuffer; + static const Function glIsFramebufferOES = GLMessage_Function_glIsFramebufferOES; + static const Function glIsProgram = GLMessage_Function_glIsProgram; + static const Function glIsRenderbuffer = GLMessage_Function_glIsRenderbuffer; + static const Function glIsRenderbufferOES = GLMessage_Function_glIsRenderbufferOES; + static const Function glIsShader = GLMessage_Function_glIsShader; + static const Function glIsTexture = GLMessage_Function_glIsTexture; + static const Function glIsVertexArrayOES = GLMessage_Function_glIsVertexArrayOES; + static const Function glLightf = GLMessage_Function_glLightf; + static const Function glLightfv = GLMessage_Function_glLightfv; + static const Function glLightModelf = GLMessage_Function_glLightModelf; + static const Function glLightModelfv = GLMessage_Function_glLightModelfv; + static const Function glLightModelx = GLMessage_Function_glLightModelx; + static const Function glLightModelxOES = GLMessage_Function_glLightModelxOES; + static const Function glLightModelxv = GLMessage_Function_glLightModelxv; + static const Function glLightModelxvOES = GLMessage_Function_glLightModelxvOES; + static const Function glLightx = GLMessage_Function_glLightx; + static const Function glLightxOES = GLMessage_Function_glLightxOES; + static const Function glLightxv = GLMessage_Function_glLightxv; + static const Function glLightxvOES = GLMessage_Function_glLightxvOES; + static const Function glLineWidth = GLMessage_Function_glLineWidth; + static const Function glLineWidthx = GLMessage_Function_glLineWidthx; + static const Function glLineWidthxOES = GLMessage_Function_glLineWidthxOES; + static const Function glLinkProgram = GLMessage_Function_glLinkProgram; + static const Function glLoadIdentity = GLMessage_Function_glLoadIdentity; + static const Function glLoadMatrixf = GLMessage_Function_glLoadMatrixf; + static const Function glLoadMatrixx = GLMessage_Function_glLoadMatrixx; + static const Function glLoadMatrixxOES = GLMessage_Function_glLoadMatrixxOES; + static const Function glLoadPaletteFromModelViewMatrixOES = GLMessage_Function_glLoadPaletteFromModelViewMatrixOES; + static const Function glLogicOp = GLMessage_Function_glLogicOp; + static const Function glMapBufferOES = GLMessage_Function_glMapBufferOES; + static const Function glMaterialf = GLMessage_Function_glMaterialf; + static const Function glMaterialfv = GLMessage_Function_glMaterialfv; + static const Function glMaterialx = GLMessage_Function_glMaterialx; + static const Function glMaterialxOES = GLMessage_Function_glMaterialxOES; + static const Function glMaterialxv = GLMessage_Function_glMaterialxv; + static const Function glMaterialxvOES = GLMessage_Function_glMaterialxvOES; + static const Function glMatrixIndexPointerOES = GLMessage_Function_glMatrixIndexPointerOES; + static const Function glMatrixMode = GLMessage_Function_glMatrixMode; + static const Function glMultiDrawArraysEXT = GLMessage_Function_glMultiDrawArraysEXT; + static const Function glMultiDrawElementsEXT = GLMessage_Function_glMultiDrawElementsEXT; + static const Function glMultiTexCoord4f = GLMessage_Function_glMultiTexCoord4f; + static const Function glMultiTexCoord4x = GLMessage_Function_glMultiTexCoord4x; + static const Function glMultiTexCoord4xOES = GLMessage_Function_glMultiTexCoord4xOES; + static const Function glMultMatrixf = GLMessage_Function_glMultMatrixf; + static const Function glMultMatrixx = GLMessage_Function_glMultMatrixx; + static const Function glMultMatrixxOES = GLMessage_Function_glMultMatrixxOES; + static const Function glNormal3f = GLMessage_Function_glNormal3f; + static const Function glNormal3x = GLMessage_Function_glNormal3x; + static const Function glNormal3xOES = GLMessage_Function_glNormal3xOES; + static const Function glNormalPointer = GLMessage_Function_glNormalPointer; + static const Function glOrthof = GLMessage_Function_glOrthof; + static const Function glOrthofOES = GLMessage_Function_glOrthofOES; + static const Function glOrthox = GLMessage_Function_glOrthox; + static const Function glOrthoxOES = GLMessage_Function_glOrthoxOES; + static const Function glPixelStorei = GLMessage_Function_glPixelStorei; + static const Function glPointParameterf = GLMessage_Function_glPointParameterf; + static const Function glPointParameterfv = GLMessage_Function_glPointParameterfv; + static const Function glPointParameterx = GLMessage_Function_glPointParameterx; + static const Function glPointParameterxOES = GLMessage_Function_glPointParameterxOES; + static const Function glPointParameterxv = GLMessage_Function_glPointParameterxv; + static const Function glPointParameterxvOES = GLMessage_Function_glPointParameterxvOES; + static const Function glPointSize = GLMessage_Function_glPointSize; + static const Function glPointSizePointerOES = GLMessage_Function_glPointSizePointerOES; + static const Function glPointSizex = GLMessage_Function_glPointSizex; + static const Function glPointSizexOES = GLMessage_Function_glPointSizexOES; + static const Function glPolygonOffset = GLMessage_Function_glPolygonOffset; + static const Function glPolygonOffsetx = GLMessage_Function_glPolygonOffsetx; + static const Function glPolygonOffsetxOES = GLMessage_Function_glPolygonOffsetxOES; + static const Function glPopMatrix = GLMessage_Function_glPopMatrix; + static const Function glProgramBinaryOES = GLMessage_Function_glProgramBinaryOES; + static const Function glPushMatrix = GLMessage_Function_glPushMatrix; + static const Function glQueryMatrixxOES = GLMessage_Function_glQueryMatrixxOES; + static const Function glReadPixels = GLMessage_Function_glReadPixels; + static const Function glReleaseShaderCompiler = GLMessage_Function_glReleaseShaderCompiler; + static const Function glRenderbufferStorage = GLMessage_Function_glRenderbufferStorage; + static const Function glRenderbufferStorageMultisampleIMG = GLMessage_Function_glRenderbufferStorageMultisampleIMG; + static const Function glRenderbufferStorageOES = GLMessage_Function_glRenderbufferStorageOES; + static const Function glRotatef = GLMessage_Function_glRotatef; + static const Function glRotatex = GLMessage_Function_glRotatex; + static const Function glRotatexOES = GLMessage_Function_glRotatexOES; + static const Function glSampleCoverage = GLMessage_Function_glSampleCoverage; + static const Function glSampleCoveragex = GLMessage_Function_glSampleCoveragex; + static const Function glSampleCoveragexOES = GLMessage_Function_glSampleCoveragexOES; + static const Function glScalef = GLMessage_Function_glScalef; + static const Function glScalex = GLMessage_Function_glScalex; + static const Function glScalexOES = GLMessage_Function_glScalexOES; + static const Function glScissor = GLMessage_Function_glScissor; + static const Function glSelectPerfMonitorCountersAMD = GLMessage_Function_glSelectPerfMonitorCountersAMD; + static const Function glSetFenceNV = GLMessage_Function_glSetFenceNV; + static const Function glShadeModel = GLMessage_Function_glShadeModel; + static const Function glShaderBinary = GLMessage_Function_glShaderBinary; + static const Function glShaderSource = GLMessage_Function_glShaderSource; + static const Function glStartTilingQCOM = GLMessage_Function_glStartTilingQCOM; + static const Function glStencilFunc = GLMessage_Function_glStencilFunc; + static const Function glStencilFuncSeparate = GLMessage_Function_glStencilFuncSeparate; + static const Function glStencilMask = GLMessage_Function_glStencilMask; + static const Function glStencilMaskSeparate = GLMessage_Function_glStencilMaskSeparate; + static const Function glStencilOp = GLMessage_Function_glStencilOp; + static const Function glStencilOpSeparate = GLMessage_Function_glStencilOpSeparate; + static const Function glTestFenceNV = GLMessage_Function_glTestFenceNV; + static const Function glTexCoordPointer = GLMessage_Function_glTexCoordPointer; + static const Function glTexEnvf = GLMessage_Function_glTexEnvf; + static const Function glTexEnvfv = GLMessage_Function_glTexEnvfv; + static const Function glTexEnvi = GLMessage_Function_glTexEnvi; + static const Function glTexEnviv = GLMessage_Function_glTexEnviv; + static const Function glTexEnvx = GLMessage_Function_glTexEnvx; + static const Function glTexEnvxOES = GLMessage_Function_glTexEnvxOES; + static const Function glTexEnvxv = GLMessage_Function_glTexEnvxv; + static const Function glTexEnvxvOES = GLMessage_Function_glTexEnvxvOES; + static const Function glTexGenfOES = GLMessage_Function_glTexGenfOES; + static const Function glTexGenfvOES = GLMessage_Function_glTexGenfvOES; + static const Function glTexGeniOES = GLMessage_Function_glTexGeniOES; + static const Function glTexGenivOES = GLMessage_Function_glTexGenivOES; + static const Function glTexGenxOES = GLMessage_Function_glTexGenxOES; + static const Function glTexGenxvOES = GLMessage_Function_glTexGenxvOES; + static const Function glTexImage2D = GLMessage_Function_glTexImage2D; + static const Function glTexImage3DOES = GLMessage_Function_glTexImage3DOES; + static const Function glTexParameterf = GLMessage_Function_glTexParameterf; + static const Function glTexParameterfv = GLMessage_Function_glTexParameterfv; + static const Function glTexParameteri = GLMessage_Function_glTexParameteri; + static const Function glTexParameteriv = GLMessage_Function_glTexParameteriv; + static const Function glTexParameterx = GLMessage_Function_glTexParameterx; + static const Function glTexParameterxOES = GLMessage_Function_glTexParameterxOES; + static const Function glTexParameterxv = GLMessage_Function_glTexParameterxv; + static const Function glTexParameterxvOES = GLMessage_Function_glTexParameterxvOES; + static const Function glTexSubImage2D = GLMessage_Function_glTexSubImage2D; + static const Function glTexSubImage3DOES = GLMessage_Function_glTexSubImage3DOES; + static const Function glTranslatef = GLMessage_Function_glTranslatef; + static const Function glTranslatex = GLMessage_Function_glTranslatex; + static const Function glTranslatexOES = GLMessage_Function_glTranslatexOES; + static const Function glUniform1f = GLMessage_Function_glUniform1f; + static const Function glUniform1fv = GLMessage_Function_glUniform1fv; + static const Function glUniform1i = GLMessage_Function_glUniform1i; + static const Function glUniform1iv = GLMessage_Function_glUniform1iv; + static const Function glUniform2f = GLMessage_Function_glUniform2f; + static const Function glUniform2fv = GLMessage_Function_glUniform2fv; + static const Function glUniform2i = GLMessage_Function_glUniform2i; + static const Function glUniform2iv = GLMessage_Function_glUniform2iv; + static const Function glUniform3f = GLMessage_Function_glUniform3f; + static const Function glUniform3fv = GLMessage_Function_glUniform3fv; + static const Function glUniform3i = GLMessage_Function_glUniform3i; + static const Function glUniform3iv = GLMessage_Function_glUniform3iv; + static const Function glUniform4f = GLMessage_Function_glUniform4f; + static const Function glUniform4fv = GLMessage_Function_glUniform4fv; + static const Function glUniform4i = GLMessage_Function_glUniform4i; + static const Function glUniform4iv = GLMessage_Function_glUniform4iv; + static const Function glUniformMatrix2fv = GLMessage_Function_glUniformMatrix2fv; + static const Function glUniformMatrix3fv = GLMessage_Function_glUniformMatrix3fv; + static const Function glUniformMatrix4fv = GLMessage_Function_glUniformMatrix4fv; + static const Function glUnmapBufferOES = GLMessage_Function_glUnmapBufferOES; + static const Function glUseProgram = GLMessage_Function_glUseProgram; + static const Function glValidateProgram = GLMessage_Function_glValidateProgram; + static const Function glVertexAttrib1f = GLMessage_Function_glVertexAttrib1f; + static const Function glVertexAttrib1fv = GLMessage_Function_glVertexAttrib1fv; + static const Function glVertexAttrib2f = GLMessage_Function_glVertexAttrib2f; + static const Function glVertexAttrib2fv = GLMessage_Function_glVertexAttrib2fv; + static const Function glVertexAttrib3f = GLMessage_Function_glVertexAttrib3f; + static const Function glVertexAttrib3fv = GLMessage_Function_glVertexAttrib3fv; + static const Function glVertexAttrib4f = GLMessage_Function_glVertexAttrib4f; + static const Function glVertexAttrib4fv = GLMessage_Function_glVertexAttrib4fv; + static const Function glVertexAttribPointer = GLMessage_Function_glVertexAttribPointer; + static const Function glVertexPointer = GLMessage_Function_glVertexPointer; + static const Function glViewport = GLMessage_Function_glViewport; + static const Function glWeightPointerOES = GLMessage_Function_glWeightPointerOES; + static const Function glActiveShaderProgramEXT = GLMessage_Function_glActiveShaderProgramEXT; + static const Function glAlphaFuncQCOM = GLMessage_Function_glAlphaFuncQCOM; + static const Function glBeginQueryEXT = GLMessage_Function_glBeginQueryEXT; + static const Function glBindProgramPipelineEXT = GLMessage_Function_glBindProgramPipelineEXT; + static const Function glBlitFramebufferANGLE = GLMessage_Function_glBlitFramebufferANGLE; + static const Function glCreateShaderProgramvEXT = GLMessage_Function_glCreateShaderProgramvEXT; + static const Function glDeleteProgramPipelinesEXT = GLMessage_Function_glDeleteProgramPipelinesEXT; + static const Function glDeleteQueriesEXT = GLMessage_Function_glDeleteQueriesEXT; + static const Function glDrawBuffersNV = GLMessage_Function_glDrawBuffersNV; + static const Function glEndQueryEXT = GLMessage_Function_glEndQueryEXT; + static const Function glFramebufferTexture2DMultisampleEXT = GLMessage_Function_glFramebufferTexture2DMultisampleEXT; + static const Function glGenProgramPipelinesEXT = GLMessage_Function_glGenProgramPipelinesEXT; + static const Function glGenQueriesEXT = GLMessage_Function_glGenQueriesEXT; + static const Function glGetGraphicsResetStatusEXT = GLMessage_Function_glGetGraphicsResetStatusEXT; + static const Function glGetObjectLabelEXT = GLMessage_Function_glGetObjectLabelEXT; + static const Function glGetProgramPipelineInfoLogEXT = GLMessage_Function_glGetProgramPipelineInfoLogEXT; + static const Function glGetProgramPipelineivEXT = GLMessage_Function_glGetProgramPipelineivEXT; + static const Function glGetQueryObjectuivEXT = GLMessage_Function_glGetQueryObjectuivEXT; + static const Function glGetQueryivEXT = GLMessage_Function_glGetQueryivEXT; + static const Function glGetnUniformfvEXT = GLMessage_Function_glGetnUniformfvEXT; + static const Function glGetnUniformivEXT = GLMessage_Function_glGetnUniformivEXT; + static const Function glInsertEventMarkerEXT = GLMessage_Function_glInsertEventMarkerEXT; + static const Function glIsProgramPipelineEXT = GLMessage_Function_glIsProgramPipelineEXT; + static const Function glIsQueryEXT = GLMessage_Function_glIsQueryEXT; + static const Function glLabelObjectEXT = GLMessage_Function_glLabelObjectEXT; + static const Function glPopGroupMarkerEXT = GLMessage_Function_glPopGroupMarkerEXT; + static const Function glProgramParameteriEXT = GLMessage_Function_glProgramParameteriEXT; + static const Function glProgramUniform1fEXT = GLMessage_Function_glProgramUniform1fEXT; + static const Function glProgramUniform1fvEXT = GLMessage_Function_glProgramUniform1fvEXT; + static const Function glProgramUniform1iEXT = GLMessage_Function_glProgramUniform1iEXT; + static const Function glProgramUniform1ivEXT = GLMessage_Function_glProgramUniform1ivEXT; + static const Function glProgramUniform2fEXT = GLMessage_Function_glProgramUniform2fEXT; + static const Function glProgramUniform2fvEXT = GLMessage_Function_glProgramUniform2fvEXT; + static const Function glProgramUniform2iEXT = GLMessage_Function_glProgramUniform2iEXT; + static const Function glProgramUniform2ivEXT = GLMessage_Function_glProgramUniform2ivEXT; + static const Function glProgramUniform3fEXT = GLMessage_Function_glProgramUniform3fEXT; + static const Function glProgramUniform3fvEXT = GLMessage_Function_glProgramUniform3fvEXT; + static const Function glProgramUniform3iEXT = GLMessage_Function_glProgramUniform3iEXT; + static const Function glProgramUniform3ivEXT = GLMessage_Function_glProgramUniform3ivEXT; + static const Function glProgramUniform4fEXT = GLMessage_Function_glProgramUniform4fEXT; + static const Function glProgramUniform4fvEXT = GLMessage_Function_glProgramUniform4fvEXT; + static const Function glProgramUniform4iEXT = GLMessage_Function_glProgramUniform4iEXT; + static const Function glProgramUniform4ivEXT = GLMessage_Function_glProgramUniform4ivEXT; + static const Function glProgramUniformMatrix2fvEXT = GLMessage_Function_glProgramUniformMatrix2fvEXT; + static const Function glProgramUniformMatrix3fvEXT = GLMessage_Function_glProgramUniformMatrix3fvEXT; + static const Function glProgramUniformMatrix4fvEXT = GLMessage_Function_glProgramUniformMatrix4fvEXT; + static const Function glPushGroupMarkerEXT = GLMessage_Function_glPushGroupMarkerEXT; + static const Function glReadBufferNV = GLMessage_Function_glReadBufferNV; + static const Function glReadnPixelsEXT = GLMessage_Function_glReadnPixelsEXT; + static const Function glRenderbufferStorageMultisampleANGLE = GLMessage_Function_glRenderbufferStorageMultisampleANGLE; + static const Function glRenderbufferStorageMultisampleAPPLE = GLMessage_Function_glRenderbufferStorageMultisampleAPPLE; + static const Function glRenderbufferStorageMultisampleEXT = GLMessage_Function_glRenderbufferStorageMultisampleEXT; + static const Function glResolveMultisampleFramebufferAPPLE = GLMessage_Function_glResolveMultisampleFramebufferAPPLE; + static const Function glTexStorage1DEXT = GLMessage_Function_glTexStorage1DEXT; + static const Function glTexStorage2DEXT = GLMessage_Function_glTexStorage2DEXT; + static const Function glTexStorage3DEXT = GLMessage_Function_glTexStorage3DEXT; + static const Function glTextureStorage1DEXT = GLMessage_Function_glTextureStorage1DEXT; + static const Function glTextureStorage2DEXT = GLMessage_Function_glTextureStorage2DEXT; + static const Function glTextureStorage3DEXT = GLMessage_Function_glTextureStorage3DEXT; + static const Function glUseProgramStagesEXT = GLMessage_Function_glUseProgramStagesEXT; + static const Function glValidateProgramPipelineEXT = GLMessage_Function_glValidateProgramPipelineEXT; + static const Function eglGetDisplay = GLMessage_Function_eglGetDisplay; + static const Function eglInitialize = GLMessage_Function_eglInitialize; + static const Function eglTerminate = GLMessage_Function_eglTerminate; + static const Function eglGetConfigs = GLMessage_Function_eglGetConfigs; + static const Function eglChooseConfig = GLMessage_Function_eglChooseConfig; + static const Function eglGetConfigAttrib = GLMessage_Function_eglGetConfigAttrib; + static const Function eglCreateWindowSurface = GLMessage_Function_eglCreateWindowSurface; + static const Function eglCreatePixmapSurface = GLMessage_Function_eglCreatePixmapSurface; + static const Function eglCreatePbufferSurface = GLMessage_Function_eglCreatePbufferSurface; + static const Function eglDestroySurface = GLMessage_Function_eglDestroySurface; + static const Function eglQuerySurface = GLMessage_Function_eglQuerySurface; + static const Function eglCreateContext = GLMessage_Function_eglCreateContext; + static const Function eglDestroyContext = GLMessage_Function_eglDestroyContext; + static const Function eglMakeCurrent = GLMessage_Function_eglMakeCurrent; + static const Function eglGetCurrentContext = GLMessage_Function_eglGetCurrentContext; + static const Function eglGetCurrentSurface = GLMessage_Function_eglGetCurrentSurface; + static const Function eglGetCurrentDisplay = GLMessage_Function_eglGetCurrentDisplay; + static const Function eglQueryContext = GLMessage_Function_eglQueryContext; + static const Function eglWaitGL = GLMessage_Function_eglWaitGL; + static const Function eglWaitNative = GLMessage_Function_eglWaitNative; + static const Function eglSwapBuffers = GLMessage_Function_eglSwapBuffers; + static const Function eglCopyBuffers = GLMessage_Function_eglCopyBuffers; + static const Function eglGetError = GLMessage_Function_eglGetError; + static const Function eglQueryString = GLMessage_Function_eglQueryString; + static const Function eglGetProcAddress = GLMessage_Function_eglGetProcAddress; + static const Function eglSurfaceAttrib = GLMessage_Function_eglSurfaceAttrib; + static const Function eglBindTexImage = GLMessage_Function_eglBindTexImage; + static const Function eglReleaseTexImage = GLMessage_Function_eglReleaseTexImage; + static const Function eglSwapInterval = GLMessage_Function_eglSwapInterval; + static const Function eglBindAPI = GLMessage_Function_eglBindAPI; + static const Function eglQueryAPI = GLMessage_Function_eglQueryAPI; + static const Function eglWaitClient = GLMessage_Function_eglWaitClient; + static const Function eglReleaseThread = GLMessage_Function_eglReleaseThread; + static const Function eglCreatePbufferFromClientBuffer = GLMessage_Function_eglCreatePbufferFromClientBuffer; + static const Function eglLockSurfaceKHR = GLMessage_Function_eglLockSurfaceKHR; + static const Function eglUnlockSurfaceKHR = GLMessage_Function_eglUnlockSurfaceKHR; + static const Function eglCreateImageKHR = GLMessage_Function_eglCreateImageKHR; + static const Function eglDestroyImageKHR = GLMessage_Function_eglDestroyImageKHR; + static const Function eglCreateSyncKHR = GLMessage_Function_eglCreateSyncKHR; + static const Function eglDestroySyncKHR = GLMessage_Function_eglDestroySyncKHR; + static const Function eglClientWaitSyncKHR = GLMessage_Function_eglClientWaitSyncKHR; + static const Function eglGetSyncAttribKHR = GLMessage_Function_eglGetSyncAttribKHR; + static const Function eglSetSwapRectangleANDROID = GLMessage_Function_eglSetSwapRectangleANDROID; + static const Function eglGetRenderBufferANDROID = GLMessage_Function_eglGetRenderBufferANDROID; + static const Function eglGetSystemTimeFrequencyNV = GLMessage_Function_eglGetSystemTimeFrequencyNV; + static const Function eglGetSystemTimeNV = GLMessage_Function_eglGetSystemTimeNV; + static const Function invalid = GLMessage_Function_invalid; + static const Function glVertexAttribPointerData = GLMessage_Function_glVertexAttribPointerData; + static inline bool Function_IsValid(int value) { + return GLMessage_Function_IsValid(value); + } + static const Function Function_MIN = + GLMessage_Function_Function_MIN; + static const Function Function_MAX = + GLMessage_Function_Function_MAX; + static const int Function_ARRAYSIZE = + GLMessage_Function_Function_ARRAYSIZE; + + // accessors ------------------------------------------------------- + + // required int32 context_id = 1; + inline bool has_context_id() const; + inline void clear_context_id(); + static const int kContextIdFieldNumber = 1; + inline ::google::protobuf::int32 context_id() const; + inline void set_context_id(::google::protobuf::int32 value); + + // required int64 start_time = 2; + inline bool has_start_time() const; + inline void clear_start_time(); + static const int kStartTimeFieldNumber = 2; + inline ::google::protobuf::int64 start_time() const; + inline void set_start_time(::google::protobuf::int64 value); + + // required int32 duration = 3; + inline bool has_duration() const; + inline void clear_duration(); + static const int kDurationFieldNumber = 3; + inline ::google::protobuf::int32 duration() const; + inline void set_duration(::google::protobuf::int32 value); + + // required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; + inline bool has_function() const; + inline void clear_function(); + static const int kFunctionFieldNumber = 4; + inline ::android::gltrace::GLMessage_Function function() const; + inline void set_function(::android::gltrace::GLMessage_Function value); + + // repeated .android.gltrace.GLMessage.DataType args = 5; + inline int args_size() const; + inline void clear_args(); + static const int kArgsFieldNumber = 5; + inline const ::android::gltrace::GLMessage_DataType& args(int index) const; + inline ::android::gltrace::GLMessage_DataType* mutable_args(int index); + inline ::android::gltrace::GLMessage_DataType* add_args(); + inline const ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >& + args() const; + inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >* + mutable_args(); + + // optional .android.gltrace.GLMessage.DataType returnValue = 6; + inline bool has_returnvalue() const; + inline void clear_returnvalue(); + static const int kReturnValueFieldNumber = 6; + inline const ::android::gltrace::GLMessage_DataType& returnvalue() const; + inline ::android::gltrace::GLMessage_DataType* mutable_returnvalue(); + + // optional .android.gltrace.GLMessage.FrameBuffer fb = 7; + inline bool has_fb() const; + inline void clear_fb(); + static const int kFbFieldNumber = 7; + inline const ::android::gltrace::GLMessage_FrameBuffer& fb() const; + inline ::android::gltrace::GLMessage_FrameBuffer* mutable_fb(); + + // optional int32 threadtime = 8; + inline bool has_threadtime() const; + inline void clear_threadtime(); + static const int kThreadtimeFieldNumber = 8; + inline ::google::protobuf::int32 threadtime() const; + inline void set_threadtime(::google::protobuf::int32 value); + + // @@protoc_insertion_point(class_scope:android.gltrace.GLMessage) + private: + mutable int _cached_size_; + + ::google::protobuf::int32 context_id_; + ::google::protobuf::int64 start_time_; + ::google::protobuf::int32 duration_; + int function_; + ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType > args_; + ::android::gltrace::GLMessage_DataType* returnvalue_; + ::android::gltrace::GLMessage_FrameBuffer* fb_; + ::google::protobuf::int32 threadtime_; + friend void protobuf_AddDesc_gltrace_2eproto(); + friend void protobuf_AssignDesc_gltrace_2eproto(); + friend void protobuf_ShutdownFile_gltrace_2eproto(); + + ::google::protobuf::uint32 _has_bits_[(8 + 31) / 32]; + + // WHY DOES & HAVE LOWER PRECEDENCE THAN != !? + inline bool _has_bit(int index) const { + return (_has_bits_[index / 32] & (1u << (index % 32))) != 0; + } + inline void _set_bit(int index) { + _has_bits_[index / 32] |= (1u << (index % 32)); + } + inline void _clear_bit(int index) { + _has_bits_[index / 32] &= ~(1u << (index % 32)); + } + + void InitAsDefaultInstance(); + static GLMessage* default_instance_; +}; +// =================================================================== + + +// =================================================================== + +// GLMessage_DataType + +// required .android.gltrace.GLMessage.DataType.Type type = 1 [default = VOID]; +inline bool GLMessage_DataType::has_type() const { + return _has_bit(0); +} +inline void GLMessage_DataType::clear_type() { + type_ = 1; + _clear_bit(0); +} +inline ::android::gltrace::GLMessage_DataType_Type GLMessage_DataType::type() const { + return static_cast< ::android::gltrace::GLMessage_DataType_Type >(type_); +} +inline void GLMessage_DataType::set_type(::android::gltrace::GLMessage_DataType_Type value) { + GOOGLE_DCHECK(::android::gltrace::GLMessage_DataType_Type_IsValid(value)); + _set_bit(0); + type_ = value; +} + +// required bool isArray = 2 [default = false]; +inline bool GLMessage_DataType::has_isarray() const { + return _has_bit(1); +} +inline void GLMessage_DataType::clear_isarray() { + isarray_ = false; + _clear_bit(1); +} +inline bool GLMessage_DataType::isarray() const { + return isarray_; +} +inline void GLMessage_DataType::set_isarray(bool value) { + _set_bit(1); + isarray_ = value; +} + +// repeated int32 intValue = 3; +inline int GLMessage_DataType::intvalue_size() const { + return intvalue_.size(); +} +inline void GLMessage_DataType::clear_intvalue() { + intvalue_.Clear(); +} +inline ::google::protobuf::int32 GLMessage_DataType::intvalue(int index) const { + return intvalue_.Get(index); +} +inline void GLMessage_DataType::set_intvalue(int index, ::google::protobuf::int32 value) { + intvalue_.Set(index, value); +} +inline void GLMessage_DataType::add_intvalue(::google::protobuf::int32 value) { + intvalue_.Add(value); +} +inline const ::google::protobuf::RepeatedField< ::google::protobuf::int32 >& +GLMessage_DataType::intvalue() const { + return intvalue_; +} +inline ::google::protobuf::RepeatedField< ::google::protobuf::int32 >* +GLMessage_DataType::mutable_intvalue() { + return &intvalue_; +} + +// repeated float floatValue = 4; +inline int GLMessage_DataType::floatvalue_size() const { + return floatvalue_.size(); +} +inline void GLMessage_DataType::clear_floatvalue() { + floatvalue_.Clear(); +} +inline float GLMessage_DataType::floatvalue(int index) const { + return floatvalue_.Get(index); +} +inline void GLMessage_DataType::set_floatvalue(int index, float value) { + floatvalue_.Set(index, value); +} +inline void GLMessage_DataType::add_floatvalue(float value) { + floatvalue_.Add(value); +} +inline const ::google::protobuf::RepeatedField< float >& +GLMessage_DataType::floatvalue() const { + return floatvalue_; +} +inline ::google::protobuf::RepeatedField< float >* +GLMessage_DataType::mutable_floatvalue() { + return &floatvalue_; +} + +// repeated bytes charValue = 5; +inline int GLMessage_DataType::charvalue_size() const { + return charvalue_.size(); +} +inline void GLMessage_DataType::clear_charvalue() { + charvalue_.Clear(); +} +inline const ::std::string& GLMessage_DataType::charvalue(int index) const { + return charvalue_.Get(index); +} +inline ::std::string* GLMessage_DataType::mutable_charvalue(int index) { + return charvalue_.Mutable(index); +} +inline void GLMessage_DataType::set_charvalue(int index, const ::std::string& value) { + charvalue_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_charvalue(int index, const char* value) { + charvalue_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_charvalue(int index, const void* value, size_t size) { + charvalue_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* GLMessage_DataType::add_charvalue() { + return charvalue_.Add(); +} +inline void GLMessage_DataType::add_charvalue(const ::std::string& value) { + charvalue_.Add()->assign(value); +} +inline void GLMessage_DataType::add_charvalue(const char* value) { + charvalue_.Add()->assign(value); +} +inline void GLMessage_DataType::add_charvalue(const void* value, size_t size) { + charvalue_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +GLMessage_DataType::charvalue() const { + return charvalue_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +GLMessage_DataType::mutable_charvalue() { + return &charvalue_; +} + +// repeated bytes rawBytes = 6; +inline int GLMessage_DataType::rawbytes_size() const { + return rawbytes_.size(); +} +inline void GLMessage_DataType::clear_rawbytes() { + rawbytes_.Clear(); +} +inline const ::std::string& GLMessage_DataType::rawbytes(int index) const { + return rawbytes_.Get(index); +} +inline ::std::string* GLMessage_DataType::mutable_rawbytes(int index) { + return rawbytes_.Mutable(index); +} +inline void GLMessage_DataType::set_rawbytes(int index, const ::std::string& value) { + rawbytes_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_rawbytes(int index, const char* value) { + rawbytes_.Mutable(index)->assign(value); +} +inline void GLMessage_DataType::set_rawbytes(int index, const void* value, size_t size) { + rawbytes_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* GLMessage_DataType::add_rawbytes() { + return rawbytes_.Add(); +} +inline void GLMessage_DataType::add_rawbytes(const ::std::string& value) { + rawbytes_.Add()->assign(value); +} +inline void GLMessage_DataType::add_rawbytes(const char* value) { + rawbytes_.Add()->assign(value); +} +inline void GLMessage_DataType::add_rawbytes(const void* value, size_t size) { + rawbytes_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +GLMessage_DataType::rawbytes() const { + return rawbytes_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +GLMessage_DataType::mutable_rawbytes() { + return &rawbytes_; +} + +// repeated bool boolValue = 7; +inline int GLMessage_DataType::boolvalue_size() const { + return boolvalue_.size(); +} +inline void GLMessage_DataType::clear_boolvalue() { + boolvalue_.Clear(); +} +inline bool GLMessage_DataType::boolvalue(int index) const { + return boolvalue_.Get(index); +} +inline void GLMessage_DataType::set_boolvalue(int index, bool value) { + boolvalue_.Set(index, value); +} +inline void GLMessage_DataType::add_boolvalue(bool value) { + boolvalue_.Add(value); +} +inline const ::google::protobuf::RepeatedField< bool >& +GLMessage_DataType::boolvalue() const { + return boolvalue_; +} +inline ::google::protobuf::RepeatedField< bool >* +GLMessage_DataType::mutable_boolvalue() { + return &boolvalue_; +} + +// ------------------------------------------------------------------- + +// GLMessage_FrameBuffer + +// required int32 width = 1; +inline bool GLMessage_FrameBuffer::has_width() const { + return _has_bit(0); +} +inline void GLMessage_FrameBuffer::clear_width() { + width_ = 0; + _clear_bit(0); +} +inline ::google::protobuf::int32 GLMessage_FrameBuffer::width() const { + return width_; +} +inline void GLMessage_FrameBuffer::set_width(::google::protobuf::int32 value) { + _set_bit(0); + width_ = value; +} + +// required int32 height = 2; +inline bool GLMessage_FrameBuffer::has_height() const { + return _has_bit(1); +} +inline void GLMessage_FrameBuffer::clear_height() { + height_ = 0; + _clear_bit(1); +} +inline ::google::protobuf::int32 GLMessage_FrameBuffer::height() const { + return height_; +} +inline void GLMessage_FrameBuffer::set_height(::google::protobuf::int32 value) { + _set_bit(1); + height_ = value; +} + +// repeated bytes contents = 3; +inline int GLMessage_FrameBuffer::contents_size() const { + return contents_.size(); +} +inline void GLMessage_FrameBuffer::clear_contents() { + contents_.Clear(); +} +inline const ::std::string& GLMessage_FrameBuffer::contents(int index) const { + return contents_.Get(index); +} +inline ::std::string* GLMessage_FrameBuffer::mutable_contents(int index) { + return contents_.Mutable(index); +} +inline void GLMessage_FrameBuffer::set_contents(int index, const ::std::string& value) { + contents_.Mutable(index)->assign(value); +} +inline void GLMessage_FrameBuffer::set_contents(int index, const char* value) { + contents_.Mutable(index)->assign(value); +} +inline void GLMessage_FrameBuffer::set_contents(int index, const void* value, size_t size) { + contents_.Mutable(index)->assign( + reinterpret_cast(value), size); +} +inline ::std::string* GLMessage_FrameBuffer::add_contents() { + return contents_.Add(); +} +inline void GLMessage_FrameBuffer::add_contents(const ::std::string& value) { + contents_.Add()->assign(value); +} +inline void GLMessage_FrameBuffer::add_contents(const char* value) { + contents_.Add()->assign(value); +} +inline void GLMessage_FrameBuffer::add_contents(const void* value, size_t size) { + contents_.Add()->assign(reinterpret_cast(value), size); +} +inline const ::google::protobuf::RepeatedPtrField< ::std::string>& +GLMessage_FrameBuffer::contents() const { + return contents_; +} +inline ::google::protobuf::RepeatedPtrField< ::std::string>* +GLMessage_FrameBuffer::mutable_contents() { + return &contents_; +} + +// ------------------------------------------------------------------- + +// GLMessage + +// required int32 context_id = 1; +inline bool GLMessage::has_context_id() const { + return _has_bit(0); +} +inline void GLMessage::clear_context_id() { + context_id_ = 0; + _clear_bit(0); +} +inline ::google::protobuf::int32 GLMessage::context_id() const { + return context_id_; +} +inline void GLMessage::set_context_id(::google::protobuf::int32 value) { + _set_bit(0); + context_id_ = value; +} + +// required int64 start_time = 2; +inline bool GLMessage::has_start_time() const { + return _has_bit(1); +} +inline void GLMessage::clear_start_time() { + start_time_ = GOOGLE_LONGLONG(0); + _clear_bit(1); +} +inline ::google::protobuf::int64 GLMessage::start_time() const { + return start_time_; +} +inline void GLMessage::set_start_time(::google::protobuf::int64 value) { + _set_bit(1); + start_time_ = value; +} + +// required int32 duration = 3; +inline bool GLMessage::has_duration() const { + return _has_bit(2); +} +inline void GLMessage::clear_duration() { + duration_ = 0; + _clear_bit(2); +} +inline ::google::protobuf::int32 GLMessage::duration() const { + return duration_; +} +inline void GLMessage::set_duration(::google::protobuf::int32 value) { + _set_bit(2); + duration_ = value; +} + +// required .android.gltrace.GLMessage.Function function = 4 [default = invalid]; +inline bool GLMessage::has_function() const { + return _has_bit(3); +} +inline void GLMessage::clear_function() { + function_ = 3000; + _clear_bit(3); +} +inline ::android::gltrace::GLMessage_Function GLMessage::function() const { + return static_cast< ::android::gltrace::GLMessage_Function >(function_); +} +inline void GLMessage::set_function(::android::gltrace::GLMessage_Function value) { + GOOGLE_DCHECK(::android::gltrace::GLMessage_Function_IsValid(value)); + _set_bit(3); + function_ = value; +} + +// repeated .android.gltrace.GLMessage.DataType args = 5; +inline int GLMessage::args_size() const { + return args_.size(); +} +inline void GLMessage::clear_args() { + args_.Clear(); +} +inline const ::android::gltrace::GLMessage_DataType& GLMessage::args(int index) const { + return args_.Get(index); +} +inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_args(int index) { + return args_.Mutable(index); +} +inline ::android::gltrace::GLMessage_DataType* GLMessage::add_args() { + return args_.Add(); +} +inline const ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >& +GLMessage::args() const { + return args_; +} +inline ::google::protobuf::RepeatedPtrField< ::android::gltrace::GLMessage_DataType >* +GLMessage::mutable_args() { + return &args_; +} + +// optional .android.gltrace.GLMessage.DataType returnValue = 6; +inline bool GLMessage::has_returnvalue() const { + return _has_bit(5); +} +inline void GLMessage::clear_returnvalue() { + if (returnvalue_ != NULL) returnvalue_->::android::gltrace::GLMessage_DataType::Clear(); + _clear_bit(5); +} +inline const ::android::gltrace::GLMessage_DataType& GLMessage::returnvalue() const { + return returnvalue_ != NULL ? *returnvalue_ : *default_instance_->returnvalue_; +} +inline ::android::gltrace::GLMessage_DataType* GLMessage::mutable_returnvalue() { + _set_bit(5); + if (returnvalue_ == NULL) returnvalue_ = new ::android::gltrace::GLMessage_DataType; + return returnvalue_; +} + +// optional .android.gltrace.GLMessage.FrameBuffer fb = 7; +inline bool GLMessage::has_fb() const { + return _has_bit(6); +} +inline void GLMessage::clear_fb() { + if (fb_ != NULL) fb_->::android::gltrace::GLMessage_FrameBuffer::Clear(); + _clear_bit(6); +} +inline const ::android::gltrace::GLMessage_FrameBuffer& GLMessage::fb() const { + return fb_ != NULL ? *fb_ : *default_instance_->fb_; +} +inline ::android::gltrace::GLMessage_FrameBuffer* GLMessage::mutable_fb() { + _set_bit(6); + if (fb_ == NULL) fb_ = new ::android::gltrace::GLMessage_FrameBuffer; + return fb_; +} + +// optional int32 threadtime = 8; +inline bool GLMessage::has_threadtime() const { + return _has_bit(7); +} +inline void GLMessage::clear_threadtime() { + threadtime_ = 0; + _clear_bit(7); +} +inline ::google::protobuf::int32 GLMessage::threadtime() const { + return threadtime_; +} +inline void GLMessage::set_threadtime(::google::protobuf::int32 value) { + _set_bit(7); + threadtime_ = value; +} + + +// @@protoc_insertion_point(namespace_scope) + +} // namespace gltrace +} // namespace android + +// @@protoc_insertion_point(global_scope) + +#endif // PROTOBUF_gltrace_2eproto__INCLUDED diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_transport.h android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_transport.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/src/gltrace_transport.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/src/gltrace_transport.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,7 @@ #include -#include "frameworks/native/opengl/libs/GLES_trace/proto/gltrace.pb.h" +#include "gltrace.pb.h" namespace android { namespace gltrace { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/tools/genapi.py android-platform-frameworks-native-21/opengl/libs/GLES_trace/tools/genapi.py --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/GLES_trace/tools/genapi.py 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/GLES_trace/tools/genapi.py 2012-10-16 22:57:11.000000000 +0000 @@ -18,16 +18,16 @@ # This script is used to generate the trace implementations of all # OpenGL calls. When executed, it reads the specs for the OpenGL calls # from the files GLES2/gl2_api.in, GLES2/gl2ext_api.in, GLES_CM/gl_api.in, -# and GLES_CM/glext_api.in, and generates trace versions for all the +# and GLES_CM/glext_api.in, and generates trace versions for all the # defined functions. # # PREREQUISITES # To generate C++ files, this script uses the 'pyratemp' template # module. The only reason to use pyratemp is that it is extremly # simple to install: -# $ wget http://www.simple-is-better.org/template/pyratemp-0.3.2.tgz -# Extract and put the pyratemp.py file in the GLES_trace/tools folder, -# or update PYTHONPATH to point to wherever it was downloaded. +# $ wget http://www.simple-is-better.org/template/pyratemp-current/pyratemp.py +# Put the file in the GLES_trace/tools folder, or update PYTHONPATH +# to point to wherever it was downloaded. # # USAGE # $ cd GLES_trace - run the program from GLES2_trace folder @@ -44,26 +44,22 @@ self.name = name def __str__(self): - if self.name == "pointer": # pointers map to the INT64 DataType - return "INT64" + if self.name == "pointer": # pointers map to the INT DataType + return "INT" return self.name.upper() def getProtobufCall(self): if self.name == "void": raise ValueError("Attempt to set void value") elif self.name == "char" or self.name == "byte" \ - or self.name == "enum": + or self.name == "pointer" or self.name == "enum": return "add_intvalue((int)" - elif self.name == "pointer": - return "add_int64value((uintptr_t)" elif self.name == "int": return "add_intvalue(" elif self.name == "float": return "add_floatvalue(" elif self.name == "bool": return "add_boolvalue(" - elif self.name == "int64": - return "add_int64value(" else: raise ValueError("Unknown value type %s" % self.name) @@ -75,10 +71,9 @@ DataType.INT = DataType("int") DataType.FLOAT = DataType("float") DataType.POINTER = DataType("pointer") -DataType.INT64 = DataType("int64") # mapping of GL types to protobuf DataType -GLPROTOBUF_TYPE_MAP = { +GL2PROTOBUF_TYPE_MAP = { "GLvoid":DataType.VOID, "void":DataType.VOID, "GLchar":DataType.CHAR, @@ -100,10 +95,6 @@ "GLsizeiptr":DataType.INT, "GLintptr":DataType.INT, "GLeglImageOES":DataType.POINTER, - "GLint64":DataType.INT64, - "GLuint64":DataType.INT64, - "GLsync":DataType.POINTER, - "GLDEBUGPROCKHR":DataType.POINTER, } API_SPECS = [ @@ -135,6 +126,7 @@ HEADER_INCLUDES = """ #include #include +#include #include "gltrace.pb.h" #include "gltrace_context.h" @@ -218,7 +210,7 @@ if kw.count('*') > 0: return DataType.POINTER - return GLPROTOBUF_TYPE_MAP.get(kw) + return GL2PROTOBUF_TYPE_MAP.get(kw) def getNameTypePair(decl): """ Split declaration of a variable to a tuple of (variable name, DataType). @@ -231,7 +223,7 @@ # if name is a pointer (e.g. "*ptr"), then remove the "*" from the name # and add it to the data type - pointersInName = name.count("*") + pointersInName = name.count("*") if pointersInName > 0: name = name.replace("*", "") dataType += "*" * pointersInName @@ -267,7 +259,7 @@ API_ENTRY_REGEX = "(.*)API_ENTRY\(.*?\)\((.*?)\)" # Regex to match CALL_GL_API specification: - # e.g. CALL_GL_API(glCullFace, mode); + # e.g. CALL_GL_API(glCullFace, mode); # CALL_GL_API_RETURN(glCreateProgram); CALL_GL_API_REGEX = "CALL_GL_API(_RETURN)?\((.*)\);" @@ -279,7 +271,7 @@ defn: specification line containing API_ENTRY macro e.g: void API_ENTRY(glActiveTexture)(GLenum texture) { callsite: specification line containing CALL_GL_API macro - e.g: CALL_GL_API(glActiveTexture, texture); + e.g: CALL_GL_API(glActiveTexture, texture); """ self.prefix = prefix self.ret = self.getReturnType(apientry) @@ -295,7 +287,7 @@ '''Extract the return type from the API_ENTRY specification''' m = re.search(self.API_ENTRY_REGEX, apientry) if not m: - raise ValueError("%s does not match API_ENTRY specification %s" + raise ValueError("%s does not match API_ENTRY specification %s" % (apientry, self.API_ENTRY_REGEX)) return m.group(1).strip() @@ -304,7 +296,7 @@ '''Extract the argument list from the API_ENTRY specification''' m = re.search(self.API_ENTRY_REGEX, apientry) if not m: - raise ValueError("%s does not match API_ENTRY specification %s" + raise ValueError("%s does not match API_ENTRY specification %s" % (apientry, self.API_ENTRY_REGEX)) return m.group(2).strip() @@ -335,7 +327,7 @@ return "%s GLTrace_%s(%s);" % (self.ret, self.func, self.arglist) def genCode(self): - return TRACE_CALL_TEMPLATE(func = self.func, + return TRACE_CALL_TEMPLATE(func = self.func, retType = self.ret, retDataType = getDataTypeFromKw(self.ret), inputArgList = self.arglist, @@ -364,7 +356,7 @@ def removeDuplicates(apis): '''Remove all duplicate function entries. - The input list contains functions declared in GL1, GL2, and GL3 APIs. + The input list contains functions declared in GL1 and GL2 APIs. This will return a list that contains only the first function if there are multiple functions with the same name.''' uniqs = [] @@ -410,7 +402,7 @@ f.writelines(lines) if __name__ == '__main__': - apis = parseAllSpecs(API_SPECS) # read in all the specfiles - apis = removeDuplicates(apis) # remove duplication of functions common to multiple versions + apis = parseAllSpecs(API_SPECS) # read in all the specfiles + apis = removeDuplicates(apis) # remove duplication of functions common to GL1 and GL2 genHeaders(apis, 'gltrace_api.h') # generate header file genSrcs(apis, 'gltrace_api.cpp') # generate source file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/glestrace.h android-platform-frameworks-native-21/opengl/libs/glestrace.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/glestrace.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/glestrace.h 2012-10-16 22:57:11.000000000 +0000 @@ -30,7 +30,7 @@ void GLTrace_eglSwapBuffers(void*, void*); /* Start and stop GL Tracing. */ -int GLTrace_start(); +void GLTrace_start(); void GLTrace_stop(); /* Obtain the gl_hooks structure filled with the trace implementation for all GL functions. */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/hooks.h android-platform-frameworks-native-21/opengl/libs/hooks.h --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/hooks.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/hooks.h 2012-10-16 22:57:11.000000000 +0000 @@ -1,16 +1,16 @@ -/* +/* ** Copyright 2007, 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 + ** 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 + ** 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 + ** 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. */ @@ -29,14 +29,14 @@ #include #include #include -#include -#include - -// set to 1 for debugging -#define USE_SLOW_BINDING 0 +#if !defined(__arm__) +#define USE_SLOW_BINDING 1 +#else +#define USE_SLOW_BINDING 0 +#endif #undef NELEM -#define NELEM(x) (sizeof(x)/sizeof(*(x))) +#define NELEM(x) (sizeof(x)/sizeof(*(x))) // maximum number of GL extensions that can be used simultaneously in // a given process. this limitation exists because we need to have @@ -45,7 +45,15 @@ #define MAX_NUMBER_OF_GL_EXTENSIONS 256 -#include /* special private C library header */ +#if defined(HAVE_ANDROID_OS) && !USE_SLOW_BINDING && __OPTIMIZE__ +#define USE_FAST_TLS_KEY 1 +#else +#define USE_FAST_TLS_KEY 0 +#endif + +#if USE_FAST_TLS_KEY +# include /* special private C library header */ +#endif // ---------------------------------------------------------------------------- namespace android { @@ -74,20 +82,7 @@ #undef EGL_ENTRY EGLAPI void setGlThreadSpecific(gl_hooks_t const *value); - -// We have a dedicated TLS slot in bionic -inline gl_hooks_t const * volatile * get_tls_hooks() { - volatile void *tls_base = __get_tls(); - gl_hooks_t const * volatile * tls_hooks = - reinterpret_cast(tls_base); - return tls_hooks; -} - -inline EGLAPI gl_hooks_t const* getGlThreadSpecific() { - gl_hooks_t const * volatile * tls_hooks = get_tls_hooks(); - gl_hooks_t const* hooks = tls_hooks[TLS_SLOT_OPENGL_API]; - return hooks; -} +EGLAPI gl_hooks_t const* getGlThreadSpecific(); // ---------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/tools/genfiles android-platform-frameworks-native-21/opengl/libs/tools/genfiles --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/tools/genfiles 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/tools/genfiles 2012-10-16 22:57:11.000000000 +0000 @@ -14,24 +14,16 @@ # See the License for the specific language governing permissions and # limitations under the License. -# Force a specific locale for sorting to avoid irrelevant differences -# in the generated files that could hide real differences. -export LC_ALL=POSIX - ./glapigen ../../include/GLES/gl.h > ../GLES_CM/gl_api.in ./glapigen ../../include/GLES/glext.h > ../GLES_CM/glext_api.in -./glapigen ../../include/GLES3/gl3.h > ../GLES2/gl2_api.in +./glapigen ../../include/GLES2/gl2.h > ../GLES2/gl2_api.in ./glapigen ../../include/GLES2/gl2ext.h > ../GLES2/gl2ext_api.in ./glentrygen ../../include/GLES/gl.h > /tmp/gl_entries.in ./glentrygen ../../include/GLES/glext.h > /tmp/glext_entries.in -./glentrygen ../../include/GLES3/gl3.h > /tmp/gl2_entries.in +./glentrygen ../../include/GLES2/gl2.h > /tmp/gl2_entries.in ./glentrygen ../../include/GLES2/gl2ext.h > /tmp/gl2ext_entries.in -# The awk command removes lines with the same function name as an earlier -# line, even if the rest of the line differs. Although signatures of -# functions with the same name should be the same, the different versions -# have some irrelevant whitespace and parameter name differences. cat /tmp/gl_entries.in \ /tmp/glext_entries.in \ /tmp/gl2_entries.in \ @@ -44,8 +36,8 @@ cat ../../include/GLES/gl.h \ ../../include/GLES/glext.h \ + ../../include/GLES2/gl2.h \ ../../include/GLES2/gl2ext.h \ - ../../include/GLES3/gl3.h \ | ./glenumsgen \ | sort \ > ../enums.in diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/libs/trace.in android-platform-frameworks-native-21/opengl/libs/trace.in --- android-platform-frameworks-native-6.0.1+r16/opengl/libs/trace.in 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/libs/trace.in 2012-10-16 22:57:11.000000000 +0000 @@ -1,211 +1,137 @@ -TRACE_GL_VOID(glActiveShaderProgram, (GLuint pipeline, GLuint program), (pipeline, program), 2, "GLuint", pipeline, "GLuint", program) TRACE_GL_VOID(glActiveShaderProgramEXT, (GLuint pipeline, GLuint program), (pipeline, program), 2, "GLuint", pipeline, "GLuint", program) TRACE_GL_VOID(glActiveTexture, (GLenum texture), (texture), 1, "GLenum", texture) -TRACE_GL_VOID(glAlphaFunc, (GLenum func, GLfloat ref), (func, ref), 2, "GLenum", func, "GLfloat", ref) +TRACE_GL_VOID(glAlphaFunc, (GLenum func, GLclampf ref), (func, ref), 2, "GLenum", func, "GLclampf", ref) TRACE_GL_VOID(glAlphaFuncQCOM, (GLenum func, GLclampf ref), (func, ref), 2, "GLenum", func, "GLclampf", ref) -TRACE_GL_VOID(glAlphaFuncx, (GLenum func, GLfixed ref), (func, ref), 2, "GLenum", func, "GLfixed", ref) -TRACE_GL_VOID(glAlphaFuncxOES, (GLenum func, GLfixed ref), (func, ref), 2, "GLenum", func, "GLfixed", ref) +TRACE_GL_VOID(glAlphaFuncx, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref) +TRACE_GL_VOID(glAlphaFuncxOES, (GLenum func, GLclampx ref), (func, ref), 2, "GLenum", func, "GLclampx", ref) TRACE_GL_VOID(glAttachShader, (GLuint program, GLuint shader), (program, shader), 2, "GLuint", program, "GLuint", shader) TRACE_GL_VOID(glBeginPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor) -TRACE_GL_VOID(glBeginPerfQueryINTEL, (GLuint queryHandle), (queryHandle), 1, "GLuint", queryHandle) -TRACE_GL_VOID(glBeginQuery, (GLenum target, GLuint id), (target, id), 2, "GLenum", target, "GLuint", id) TRACE_GL_VOID(glBeginQueryEXT, (GLenum target, GLuint id), (target, id), 2, "GLenum", target, "GLuint", id) -TRACE_GL_VOID(glBeginTransformFeedback, (GLenum primitiveMode), (primitiveMode), 1, "GLenum", primitiveMode) -TRACE_GL_VOID(glBindAttribLocation, (GLuint program, GLuint index, const GLchar * name), (program, index, name), 3, "GLuint", program, "GLuint", index, "const GLchar *", name) +TRACE_GL_VOID(glBindAttribLocation, (GLuint program, GLuint index, const GLchar* name), (program, index, name), 3, "GLuint", program, "GLuint", index, "const GLchar*", name) TRACE_GL_VOID(glBindBuffer, (GLenum target, GLuint buffer), (target, buffer), 2, "GLenum", target, "GLuint", buffer) -TRACE_GL_VOID(glBindBufferBase, (GLenum target, GLuint index, GLuint buffer), (target, index, buffer), 3, "GLenum", target, "GLuint", index, "GLuint", buffer) -TRACE_GL_VOID(glBindBufferRange, (GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size), (target, index, buffer, offset, size), 5, "GLenum", target, "GLuint", index, "GLuint", buffer, "GLintptr", offset, "GLsizeiptr", size) TRACE_GL_VOID(glBindFramebuffer, (GLenum target, GLuint framebuffer), (target, framebuffer), 2, "GLenum", target, "GLuint", framebuffer) TRACE_GL_VOID(glBindFramebufferOES, (GLenum target, GLuint framebuffer), (target, framebuffer), 2, "GLenum", target, "GLuint", framebuffer) -TRACE_GL_VOID(glBindImageTexture, (GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format), (unit, texture, level, layered, layer, access, format), 7, "GLuint", unit, "GLuint", texture, "GLint", level, "GLboolean", layered, "GLint", layer, "GLenum", access, "GLenum", format) -TRACE_GL_VOID(glBindProgramPipeline, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline) TRACE_GL_VOID(glBindProgramPipelineEXT, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline) TRACE_GL_VOID(glBindRenderbuffer, (GLenum target, GLuint renderbuffer), (target, renderbuffer), 2, "GLenum", target, "GLuint", renderbuffer) TRACE_GL_VOID(glBindRenderbufferOES, (GLenum target, GLuint renderbuffer), (target, renderbuffer), 2, "GLenum", target, "GLuint", renderbuffer) -TRACE_GL_VOID(glBindSampler, (GLuint unit, GLuint sampler), (unit, sampler), 2, "GLuint", unit, "GLuint", sampler) TRACE_GL_VOID(glBindTexture, (GLenum target, GLuint texture), (target, texture), 2, "GLenum", target, "GLuint", texture) -TRACE_GL_VOID(glBindTransformFeedback, (GLenum target, GLuint id), (target, id), 2, "GLenum", target, "GLuint", id) -TRACE_GL_VOID(glBindVertexArray, (GLuint array), (array), 1, "GLuint", array) TRACE_GL_VOID(glBindVertexArrayOES, (GLuint array), (array), 1, "GLuint", array) -TRACE_GL_VOID(glBindVertexBuffer, (GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride), (bindingindex, buffer, offset, stride), 4, "GLuint", bindingindex, "GLuint", buffer, "GLintptr", offset, "GLsizei", stride) -TRACE_GL_VOID(glBlendBarrierKHR, (void), (), 0) -TRACE_GL_VOID(glBlendBarrierNV, (void), (), 0) -TRACE_GL_VOID(glBlendColor, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha), 4, "GLfloat", red, "GLfloat", green, "GLfloat", blue, "GLfloat", alpha) -TRACE_GL_VOID(glBlendEquation, (GLenum mode), (mode), 1, "GLenum", mode) +TRACE_GL_VOID(glBlendColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha), 4, "GLclampf", red, "GLclampf", green, "GLclampf", blue, "GLclampf", alpha) +TRACE_GL_VOID(glBlendEquation, ( GLenum mode ), (mode), 1, "GLenum", mode) TRACE_GL_VOID(glBlendEquationOES, (GLenum mode), (mode), 1, "GLenum", mode) TRACE_GL_VOID(glBlendEquationSeparate, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha), 2, "GLenum", modeRGB, "GLenum", modeAlpha) TRACE_GL_VOID(glBlendEquationSeparateOES, (GLenum modeRGB, GLenum modeAlpha), (modeRGB, modeAlpha), 2, "GLenum", modeRGB, "GLenum", modeAlpha) -TRACE_GL_VOID(glBlendEquationSeparateiEXT, (GLuint buf, GLenum modeRGB, GLenum modeAlpha), (buf, modeRGB, modeAlpha), 3, "GLuint", buf, "GLenum", modeRGB, "GLenum", modeAlpha) -TRACE_GL_VOID(glBlendEquationiEXT, (GLuint buf, GLenum mode), (buf, mode), 2, "GLuint", buf, "GLenum", mode) TRACE_GL_VOID(glBlendFunc, (GLenum sfactor, GLenum dfactor), (sfactor, dfactor), 2, "GLenum", sfactor, "GLenum", dfactor) -TRACE_GL_VOID(glBlendFuncSeparate, (GLenum sfactorRGB, GLenum dfactorRGB, GLenum sfactorAlpha, GLenum dfactorAlpha), (sfactorRGB, dfactorRGB, sfactorAlpha, dfactorAlpha), 4, "GLenum", sfactorRGB, "GLenum", dfactorRGB, "GLenum", sfactorAlpha, "GLenum", dfactorAlpha) +TRACE_GL_VOID(glBlendFuncSeparate, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha), 4, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha) TRACE_GL_VOID(glBlendFuncSeparateOES, (GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (srcRGB, dstRGB, srcAlpha, dstAlpha), 4, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha) -TRACE_GL_VOID(glBlendFuncSeparateiEXT, (GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha), (buf, srcRGB, dstRGB, srcAlpha, dstAlpha), 5, "GLuint", buf, "GLenum", srcRGB, "GLenum", dstRGB, "GLenum", srcAlpha, "GLenum", dstAlpha) -TRACE_GL_VOID(glBlendFunciEXT, (GLuint buf, GLenum src, GLenum dst), (buf, src, dst), 3, "GLuint", buf, "GLenum", src, "GLenum", dst) -TRACE_GL_VOID(glBlendParameteriNV, (GLenum pname, GLint value), (pname, value), 2, "GLenum", pname, "GLint", value) -TRACE_GL_VOID(glBlitFramebuffer, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter), (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), 10, "GLint", srcX0, "GLint", srcY0, "GLint", srcX1, "GLint", srcY1, "GLint", dstX0, "GLint", dstY0, "GLint", dstX1, "GLint", dstY1, "GLbitfield", mask, "GLenum", filter) TRACE_GL_VOID(glBlitFramebufferANGLE, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter), (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), 10, "GLint", srcX0, "GLint", srcY0, "GLint", srcX1, "GLint", srcY1, "GLint", dstX0, "GLint", dstY0, "GLint", dstX1, "GLint", dstY1, "GLbitfield", mask, "GLenum", filter) -TRACE_GL_VOID(glBlitFramebufferNV, (GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter), (srcX0, srcY0, srcX1, srcY1, dstX0, dstY0, dstX1, dstY1, mask, filter), 10, "GLint", srcX0, "GLint", srcY0, "GLint", srcX1, "GLint", srcY1, "GLint", dstX0, "GLint", dstY0, "GLint", dstX1, "GLint", dstY1, "GLbitfield", mask, "GLenum", filter) -TRACE_GL_VOID(glBufferData, (GLenum target, GLsizeiptr size, const void * data, GLenum usage), (target, size, data, usage), 4, "GLenum", target, "GLsizeiptr", size, "const void *", data, "GLenum", usage) -TRACE_GL_VOID(glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const void * data), (target, offset, size, data), 4, "GLenum", target, "GLintptr", offset, "GLsizeiptr", size, "const void *", data) +TRACE_GL_VOID(glBufferData, (GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage), (target, size, data, usage), 4, "GLenum", target, "GLsizeiptr", size, "const GLvoid *", data, "GLenum", usage) +TRACE_GL_VOID(glBufferSubData, (GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data), (target, offset, size, data), 4, "GLenum", target, "GLintptr", offset, "GLsizeiptr", size, "const GLvoid *", data) TRACE_GL(GLenum, glCheckFramebufferStatus, (GLenum target), (target), 1, "GLenum", target) TRACE_GL(GLenum, glCheckFramebufferStatusOES, (GLenum target), (target), 1, "GLenum", target) TRACE_GL_VOID(glClear, (GLbitfield mask), (mask), 1, "GLbitfield", mask) -TRACE_GL_VOID(glClearBufferfi, (GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil), (buffer, drawbuffer, depth, stencil), 4, "GLenum", buffer, "GLint", drawbuffer, "GLfloat", depth, "GLint", stencil) -TRACE_GL_VOID(glClearBufferfv, (GLenum buffer, GLint drawbuffer, const GLfloat * value), (buffer, drawbuffer, value), 3, "GLenum", buffer, "GLint", drawbuffer, "const GLfloat *", value) -TRACE_GL_VOID(glClearBufferiv, (GLenum buffer, GLint drawbuffer, const GLint * value), (buffer, drawbuffer, value), 3, "GLenum", buffer, "GLint", drawbuffer, "const GLint *", value) -TRACE_GL_VOID(glClearBufferuiv, (GLenum buffer, GLint drawbuffer, const GLuint * value), (buffer, drawbuffer, value), 3, "GLenum", buffer, "GLint", drawbuffer, "const GLuint *", value) -TRACE_GL_VOID(glClearColor, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha), 4, "GLfloat", red, "GLfloat", green, "GLfloat", blue, "GLfloat", alpha) -TRACE_GL_VOID(glClearColorx, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha) -TRACE_GL_VOID(glClearColorxOES, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha) -TRACE_GL_VOID(glClearDepthf, (GLfloat d), (d), 1, "GLfloat", d) +TRACE_GL_VOID(glClearColor, (GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha), (red, green, blue, alpha), 4, "GLclampf", red, "GLclampf", green, "GLclampf", blue, "GLclampf", alpha) +TRACE_GL_VOID(glClearColorx, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha) +TRACE_GL_VOID(glClearColorxOES, (GLclampx red, GLclampx green, GLclampx blue, GLclampx alpha), (red, green, blue, alpha), 4, "GLclampx", red, "GLclampx", green, "GLclampx", blue, "GLclampx", alpha) +TRACE_GL_VOID(glClearDepthf, (GLclampf depth), (depth), 1, "GLclampf", depth) TRACE_GL_VOID(glClearDepthfOES, (GLclampf depth), (depth), 1, "GLclampf", depth) -TRACE_GL_VOID(glClearDepthx, (GLfixed depth), (depth), 1, "GLfixed", depth) -TRACE_GL_VOID(glClearDepthxOES, (GLfixed depth), (depth), 1, "GLfixed", depth) +TRACE_GL_VOID(glClearDepthx, (GLclampx depth), (depth), 1, "GLclampx", depth) +TRACE_GL_VOID(glClearDepthxOES, (GLclampx depth), (depth), 1, "GLclampx", depth) TRACE_GL_VOID(glClearStencil, (GLint s), (s), 1, "GLint", s) TRACE_GL_VOID(glClientActiveTexture, (GLenum texture), (texture), 1, "GLenum", texture) -TRACE_GL(GLenum, glClientWaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout), (sync, flags, timeout), 3, "GLsync", sync, "GLbitfield", flags, "GLuint64", timeout) -TRACE_GL(GLenum, glClientWaitSyncAPPLE, (GLsync sync, GLbitfield flags, GLuint64 timeout), (sync, flags, timeout), 3, "GLsync", sync, "GLbitfield", flags, "GLuint64", timeout) -TRACE_GL_VOID(glClipPlanef, (GLenum p, const GLfloat * eqn), (p, eqn), 2, "GLenum", p, "const GLfloat *", eqn) -TRACE_GL_VOID(glClipPlanefIMG, (GLenum p, const GLfloat * eqn), (p, eqn), 2, "GLenum", p, "const GLfloat *", eqn) -TRACE_GL_VOID(glClipPlanefOES, (GLenum plane, const GLfloat * equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation) -TRACE_GL_VOID(glClipPlanex, (GLenum plane, const GLfixed * equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation) -TRACE_GL_VOID(glClipPlanexIMG, (GLenum p, const GLfixed * eqn), (p, eqn), 2, "GLenum", p, "const GLfixed *", eqn) -TRACE_GL_VOID(glClipPlanexOES, (GLenum plane, const GLfixed * equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation) +TRACE_GL_VOID(glClipPlanef, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation) +TRACE_GL_VOID(glClipPlanefIMG, (GLenum p, const GLfloat *eqn), (p, eqn), 2, "GLenum", p, "const GLfloat *", eqn) +TRACE_GL_VOID(glClipPlanefOES, (GLenum plane, const GLfloat *equation), (plane, equation), 2, "GLenum", plane, "const GLfloat *", equation) +TRACE_GL_VOID(glClipPlanex, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation) +TRACE_GL_VOID(glClipPlanexIMG, (GLenum p, const GLfixed *eqn), (p, eqn), 2, "GLenum", p, "const GLfixed *", eqn) +TRACE_GL_VOID(glClipPlanexOES, (GLenum plane, const GLfixed *equation), (plane, equation), 2, "GLenum", plane, "const GLfixed *", equation) TRACE_GL_VOID(glColor4f, (GLfloat red, GLfloat green, GLfloat blue, GLfloat alpha), (red, green, blue, alpha), 4, "GLfloat", red, "GLfloat", green, "GLfloat", blue, "GLfloat", alpha) TRACE_GL_VOID(glColor4ub, (GLubyte red, GLubyte green, GLubyte blue, GLubyte alpha), (red, green, blue, alpha), 4, "GLubyte", red, "GLubyte", green, "GLubyte", blue, "GLubyte", alpha) TRACE_GL_VOID(glColor4x, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha) TRACE_GL_VOID(glColor4xOES, (GLfixed red, GLfixed green, GLfixed blue, GLfixed alpha), (red, green, blue, alpha), 4, "GLfixed", red, "GLfixed", green, "GLfixed", blue, "GLfixed", alpha) TRACE_GL_VOID(glColorMask, (GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha), (red, green, blue, alpha), 4, "GLboolean", red, "GLboolean", green, "GLboolean", blue, "GLboolean", alpha) -TRACE_GL_VOID(glColorMaskiEXT, (GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a), (index, r, g, b, a), 5, "GLuint", index, "GLboolean", r, "GLboolean", g, "GLboolean", b, "GLboolean", a) -TRACE_GL_VOID(glColorPointer, (GLint size, GLenum type, GLsizei stride, const void * pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const void *", pointer) +TRACE_GL_VOID(glColorPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) TRACE_GL_VOID(glCompileShader, (GLuint shader), (shader), 1, "GLuint", shader) -TRACE_GL_VOID(glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const void * data), (target, level, internalformat, width, height, border, imageSize, data), 8, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLint", border, "GLsizei", imageSize, "const void *", data) -TRACE_GL_VOID(glCompressedTexImage3D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data), (target, level, internalformat, width, height, depth, border, imageSize, data), 9, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLsizei", imageSize, "const void *", data) -TRACE_GL_VOID(glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const void * data), (target, level, internalformat, width, height, depth, border, imageSize, data), 9, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLsizei", imageSize, "const void *", data) -TRACE_GL_VOID(glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const void * data), (target, level, xoffset, yoffset, width, height, format, imageSize, data), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLsizei", imageSize, "const void *", data) -TRACE_GL_VOID(glCompressedTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLsizei", imageSize, "const void *", data) -TRACE_GL_VOID(glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const void * data), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLsizei", imageSize, "const void *", data) -TRACE_GL_VOID(glCopyBufferSubData, (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size), (readTarget, writeTarget, readOffset, writeOffset, size), 5, "GLenum", readTarget, "GLenum", writeTarget, "GLintptr", readOffset, "GLintptr", writeOffset, "GLsizeiptr", size) -TRACE_GL_VOID(glCopyBufferSubDataNV, (GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size), (readTarget, writeTarget, readOffset, writeOffset, size), 5, "GLenum", readTarget, "GLenum", writeTarget, "GLintptr", readOffset, "GLintptr", writeOffset, "GLsizeiptr", size) -TRACE_GL_VOID(glCopyImageSubDataEXT, (GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth), (srcName, srcTarget, srcLevel, srcX, srcY, srcZ, dstName, dstTarget, dstLevel, dstX, dstY, dstZ, srcWidth, srcHeight, srcDepth), 15, "GLuint", srcName, "GLenum", srcTarget, "GLint", srcLevel, "GLint", srcX, "GLint", srcY, "GLint", srcZ, "GLuint", dstName, "GLenum", dstTarget, "GLint", dstLevel, "GLint", dstX, "GLint", dstY, "GLint", dstZ, "GLsizei", srcWidth, "GLsizei", srcHeight, "GLsizei", srcDepth) +TRACE_GL_VOID(glCompressedTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data), (target, level, internalformat, width, height, border, imageSize, data), 8, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLint", border, "GLsizei", imageSize, "const GLvoid *", data) +TRACE_GL_VOID(glCompressedTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid* data), (target, level, internalformat, width, height, depth, border, imageSize, data), 9, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLsizei", imageSize, "const GLvoid*", data) +TRACE_GL_VOID(glCompressedTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data), (target, level, xoffset, yoffset, width, height, format, imageSize, data), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLsizei", imageSize, "const GLvoid *", data) +TRACE_GL_VOID(glCompressedTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid* data), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, imageSize, data), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLsizei", imageSize, "const GLvoid*", data) TRACE_GL_VOID(glCopyTexImage2D, (GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border), (target, level, internalformat, x, y, width, height, border), 8, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLint", border) TRACE_GL_VOID(glCopyTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, x, y, width, height), 8, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glCopyTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, zoffset, x, y, width, height), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glCopyTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height), (target, level, xoffset, yoffset, zoffset, x, y, width, height), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glCopyTextureLevelsAPPLE, (GLuint destinationTexture, GLuint sourceTexture, GLint sourceBaseLevel, GLsizei sourceLevelCount), (destinationTexture, sourceTexture, sourceBaseLevel, sourceLevelCount), 4, "GLuint", destinationTexture, "GLuint", sourceTexture, "GLint", sourceBaseLevel, "GLsizei", sourceLevelCount) TRACE_GL_VOID(glCoverageMaskNV, (GLboolean mask), (mask), 1, "GLboolean", mask) TRACE_GL_VOID(glCoverageOperationNV, (GLenum operation), (operation), 1, "GLenum", operation) -TRACE_GL_VOID(glCreatePerfQueryINTEL, (GLuint queryId, GLuint * queryHandle), (queryId, queryHandle), 2, "GLuint", queryId, "GLuint *", queryHandle) TRACE_GL(GLuint, glCreateProgram, (void), (), 0) TRACE_GL(GLuint, glCreateShader, (GLenum type), (type), 1, "GLenum", type) -TRACE_GL(GLuint, glCreateShaderProgramv, (GLenum type, GLsizei count, const GLchar *const* strings), (type, count, strings), 3, "GLenum", type, "GLsizei", count, "const GLchar *const*", strings) -TRACE_GL(GLuint, glCreateShaderProgramvEXT, (GLenum type, GLsizei count, const GLchar ** strings), (type, count, strings), 3, "GLenum", type, "GLsizei", count, "const GLchar **", strings) +TRACE_GL(GLuint, glCreateShaderProgramvEXT, (GLenum type, GLsizei count, const GLchar **strings), (type, count, strings), 3, "GLenum", type, "GLsizei", count, "const GLchar **", strings) TRACE_GL_VOID(glCullFace, (GLenum mode), (mode), 1, "GLenum", mode) TRACE_GL_VOID(glCurrentPaletteMatrixOES, (GLuint matrixpaletteindex), (matrixpaletteindex), 1, "GLuint", matrixpaletteindex) -TRACE_GL_VOID(glDebugMessageCallbackKHR, (GLDEBUGPROCKHR callback, const void * userParam), (callback, userParam), 2, "GLDEBUGPROCKHR", callback, "const void *", userParam) -TRACE_GL_VOID(glDebugMessageControlKHR, (GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint * ids, GLboolean enabled), (source, type, severity, count, ids, enabled), 6, "GLenum", source, "GLenum", type, "GLenum", severity, "GLsizei", count, "const GLuint *", ids, "GLboolean", enabled) -TRACE_GL_VOID(glDebugMessageInsertKHR, (GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar * buf), (source, type, id, severity, length, buf), 6, "GLenum", source, "GLenum", type, "GLuint", id, "GLenum", severity, "GLsizei", length, "const GLchar *", buf) -TRACE_GL_VOID(glDeleteBuffers, (GLsizei n, const GLuint * buffers), (n, buffers), 2, "GLsizei", n, "const GLuint *", buffers) -TRACE_GL_VOID(glDeleteFencesNV, (GLsizei n, const GLuint * fences), (n, fences), 2, "GLsizei", n, "const GLuint *", fences) -TRACE_GL_VOID(glDeleteFramebuffers, (GLsizei n, const GLuint * framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint *", framebuffers) -TRACE_GL_VOID(glDeleteFramebuffersOES, (GLsizei n, const GLuint * framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint *", framebuffers) -TRACE_GL_VOID(glDeletePerfMonitorsAMD, (GLsizei n, GLuint * monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors) -TRACE_GL_VOID(glDeletePerfQueryINTEL, (GLuint queryHandle), (queryHandle), 1, "GLuint", queryHandle) +TRACE_GL_VOID(glDeleteBuffers, (GLsizei n, const GLuint *buffers), (n, buffers), 2, "GLsizei", n, "const GLuint *", buffers) +TRACE_GL_VOID(glDeleteFencesNV, (GLsizei n, const GLuint *fences), (n, fences), 2, "GLsizei", n, "const GLuint *", fences) +TRACE_GL_VOID(glDeleteFramebuffers, (GLsizei n, const GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint*", framebuffers) +TRACE_GL_VOID(glDeleteFramebuffersOES, (GLsizei n, const GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "const GLuint*", framebuffers) +TRACE_GL_VOID(glDeletePerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors) TRACE_GL_VOID(glDeleteProgram, (GLuint program), (program), 1, "GLuint", program) -TRACE_GL_VOID(glDeleteProgramPipelines, (GLsizei n, const GLuint * pipelines), (n, pipelines), 2, "GLsizei", n, "const GLuint *", pipelines) -TRACE_GL_VOID(glDeleteProgramPipelinesEXT, (GLsizei n, const GLuint * pipelines), (n, pipelines), 2, "GLsizei", n, "const GLuint *", pipelines) -TRACE_GL_VOID(glDeleteQueries, (GLsizei n, const GLuint * ids), (n, ids), 2, "GLsizei", n, "const GLuint *", ids) -TRACE_GL_VOID(glDeleteQueriesEXT, (GLsizei n, const GLuint * ids), (n, ids), 2, "GLsizei", n, "const GLuint *", ids) -TRACE_GL_VOID(glDeleteRenderbuffers, (GLsizei n, const GLuint * renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint *", renderbuffers) -TRACE_GL_VOID(glDeleteRenderbuffersOES, (GLsizei n, const GLuint * renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint *", renderbuffers) -TRACE_GL_VOID(glDeleteSamplers, (GLsizei count, const GLuint * samplers), (count, samplers), 2, "GLsizei", count, "const GLuint *", samplers) +TRACE_GL_VOID(glDeleteProgramPipelinesEXT, (GLsizei n, const GLuint *pipelines), (n, pipelines), 2, "GLsizei", n, "const GLuint *", pipelines) +TRACE_GL_VOID(glDeleteQueriesEXT, (GLsizei n, const GLuint *ids), (n, ids), 2, "GLsizei", n, "const GLuint *", ids) +TRACE_GL_VOID(glDeleteRenderbuffers, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint*", renderbuffers) +TRACE_GL_VOID(glDeleteRenderbuffersOES, (GLsizei n, const GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "const GLuint*", renderbuffers) TRACE_GL_VOID(glDeleteShader, (GLuint shader), (shader), 1, "GLuint", shader) -TRACE_GL_VOID(glDeleteSync, (GLsync sync), (sync), 1, "GLsync", sync) -TRACE_GL_VOID(glDeleteSyncAPPLE, (GLsync sync), (sync), 1, "GLsync", sync) -TRACE_GL_VOID(glDeleteTextures, (GLsizei n, const GLuint * textures), (n, textures), 2, "GLsizei", n, "const GLuint *", textures) -TRACE_GL_VOID(glDeleteTransformFeedbacks, (GLsizei n, const GLuint * ids), (n, ids), 2, "GLsizei", n, "const GLuint *", ids) -TRACE_GL_VOID(glDeleteVertexArrays, (GLsizei n, const GLuint * arrays), (n, arrays), 2, "GLsizei", n, "const GLuint *", arrays) -TRACE_GL_VOID(glDeleteVertexArraysOES, (GLsizei n, const GLuint * arrays), (n, arrays), 2, "GLsizei", n, "const GLuint *", arrays) +TRACE_GL_VOID(glDeleteTextures, (GLsizei n, const GLuint *textures), (n, textures), 2, "GLsizei", n, "const GLuint *", textures) +TRACE_GL_VOID(glDeleteVertexArraysOES, (GLsizei n, const GLuint *arrays), (n, arrays), 2, "GLsizei", n, "const GLuint *", arrays) TRACE_GL_VOID(glDepthFunc, (GLenum func), (func), 1, "GLenum", func) TRACE_GL_VOID(glDepthMask, (GLboolean flag), (flag), 1, "GLboolean", flag) -TRACE_GL_VOID(glDepthRangef, (GLfloat n, GLfloat f), (n, f), 2, "GLfloat", n, "GLfloat", f) -TRACE_GL_VOID(glDepthRangefOES, (GLclampf n, GLclampf f), (n, f), 2, "GLclampf", n, "GLclampf", f) -TRACE_GL_VOID(glDepthRangex, (GLfixed n, GLfixed f), (n, f), 2, "GLfixed", n, "GLfixed", f) -TRACE_GL_VOID(glDepthRangexOES, (GLfixed n, GLfixed f), (n, f), 2, "GLfixed", n, "GLfixed", f) +TRACE_GL_VOID(glDepthRangef, (GLclampf zNear, GLclampf zFar), (zNear, zFar), 2, "GLclampf", zNear, "GLclampf", zFar) +TRACE_GL_VOID(glDepthRangefOES, (GLclampf zNear, GLclampf zFar), (zNear, zFar), 2, "GLclampf", zNear, "GLclampf", zFar) +TRACE_GL_VOID(glDepthRangex, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar) +TRACE_GL_VOID(glDepthRangexOES, (GLclampx zNear, GLclampx zFar), (zNear, zFar), 2, "GLclampx", zNear, "GLclampx", zFar) TRACE_GL_VOID(glDetachShader, (GLuint program, GLuint shader), (program, shader), 2, "GLuint", program, "GLuint", shader) TRACE_GL_VOID(glDisable, (GLenum cap), (cap), 1, "GLenum", cap) TRACE_GL_VOID(glDisableClientState, (GLenum array), (array), 1, "GLenum", array) TRACE_GL_VOID(glDisableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl) TRACE_GL_VOID(glDisableVertexAttribArray, (GLuint index), (index), 1, "GLuint", index) -TRACE_GL_VOID(glDisableiEXT, (GLenum target, GLuint index), (target, index), 2, "GLenum", target, "GLuint", index) -TRACE_GL_VOID(glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum * attachments), (target, numAttachments, attachments), 3, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments) -TRACE_GL_VOID(glDispatchCompute, (GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z), (num_groups_x, num_groups_y, num_groups_z), 3, "GLuint", num_groups_x, "GLuint", num_groups_y, "GLuint", num_groups_z) -TRACE_GL_VOID(glDispatchComputeIndirect, (GLintptr indirect), (indirect), 1, "GLintptr", indirect) +TRACE_GL_VOID(glDiscardFramebufferEXT, (GLenum target, GLsizei numAttachments, const GLenum *attachments), (target, numAttachments, attachments), 3, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments) TRACE_GL_VOID(glDrawArrays, (GLenum mode, GLint first, GLsizei count), (mode, first, count), 3, "GLenum", mode, "GLint", first, "GLsizei", count) -TRACE_GL_VOID(glDrawArraysIndirect, (GLenum mode, const void * indirect), (mode, indirect), 2, "GLenum", mode, "const void *", indirect) -TRACE_GL_VOID(glDrawArraysInstanced, (GLenum mode, GLint first, GLsizei count, GLsizei instancecount), (mode, first, count, instancecount), 4, "GLenum", mode, "GLint", first, "GLsizei", count, "GLsizei", instancecount) -TRACE_GL_VOID(glDrawArraysInstancedANGLE, (GLenum mode, GLint first, GLsizei count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "GLint", first, "GLsizei", count, "GLsizei", primcount) -TRACE_GL_VOID(glDrawArraysInstancedEXT, (GLenum mode, GLint start, GLsizei count, GLsizei primcount), (mode, start, count, primcount), 4, "GLenum", mode, "GLint", start, "GLsizei", count, "GLsizei", primcount) -TRACE_GL_VOID(glDrawArraysInstancedNV, (GLenum mode, GLint first, GLsizei count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "GLint", first, "GLsizei", count, "GLsizei", primcount) -TRACE_GL_VOID(glDrawBuffers, (GLsizei n, const GLenum * bufs), (n, bufs), 2, "GLsizei", n, "const GLenum *", bufs) -TRACE_GL_VOID(glDrawBuffersEXT, (GLsizei n, const GLenum * bufs), (n, bufs), 2, "GLsizei", n, "const GLenum *", bufs) -TRACE_GL_VOID(glDrawBuffersIndexedEXT, (GLint n, const GLenum * location, const GLint * indices), (n, location, indices), 3, "GLint", n, "const GLenum *", location, "const GLint *", indices) -TRACE_GL_VOID(glDrawBuffersNV, (GLsizei n, const GLenum * bufs), (n, bufs), 2, "GLsizei", n, "const GLenum *", bufs) -TRACE_GL_VOID(glDrawElements, (GLenum mode, GLsizei count, GLenum type, const void * indices), (mode, count, type, indices), 4, "GLenum", mode, "GLsizei", count, "GLenum", type, "const void *", indices) -TRACE_GL_VOID(glDrawElementsIndirect, (GLenum mode, GLenum type, const void * indirect), (mode, type, indirect), 3, "GLenum", mode, "GLenum", type, "const void *", indirect) -TRACE_GL_VOID(glDrawElementsInstanced, (GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei instancecount), (mode, count, type, indices, instancecount), 5, "GLenum", mode, "GLsizei", count, "GLenum", type, "const void *", indices, "GLsizei", instancecount) -TRACE_GL_VOID(glDrawElementsInstancedANGLE, (GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "GLsizei", count, "GLenum", type, "const void *", indices, "GLsizei", primcount) -TRACE_GL_VOID(glDrawElementsInstancedEXT, (GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "GLsizei", count, "GLenum", type, "const void *", indices, "GLsizei", primcount) -TRACE_GL_VOID(glDrawElementsInstancedNV, (GLenum mode, GLsizei count, GLenum type, const void * indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "GLsizei", count, "GLenum", type, "const void *", indices, "GLsizei", primcount) -TRACE_GL_VOID(glDrawRangeElements, (GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const void * indices), (mode, start, end, count, type, indices), 6, "GLenum", mode, "GLuint", start, "GLuint", end, "GLsizei", count, "GLenum", type, "const void *", indices) +TRACE_GL_VOID(glDrawBuffersNV, (GLsizei n, const GLenum *bufs), (n, bufs), 2, "GLsizei", n, "const GLenum *", bufs) +TRACE_GL_VOID(glDrawElements, (GLenum mode, GLsizei count, GLenum type, const GLvoid *indices), (mode, count, type, indices), 4, "GLenum", mode, "GLsizei", count, "GLenum", type, "const GLvoid *", indices) TRACE_GL_VOID(glDrawTexfOES, (GLfloat x, GLfloat y, GLfloat z, GLfloat width, GLfloat height), (x, y, z, width, height), 5, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", width, "GLfloat", height) -TRACE_GL_VOID(glDrawTexfvOES, (const GLfloat * coords), (coords), 1, "const GLfloat *", coords) +TRACE_GL_VOID(glDrawTexfvOES, (const GLfloat *coords), (coords), 1, "const GLfloat *", coords) TRACE_GL_VOID(glDrawTexiOES, (GLint x, GLint y, GLint z, GLint width, GLint height), (x, y, z, width, height), 5, "GLint", x, "GLint", y, "GLint", z, "GLint", width, "GLint", height) -TRACE_GL_VOID(glDrawTexivOES, (const GLint * coords), (coords), 1, "const GLint *", coords) +TRACE_GL_VOID(glDrawTexivOES, (const GLint *coords), (coords), 1, "const GLint *", coords) TRACE_GL_VOID(glDrawTexsOES, (GLshort x, GLshort y, GLshort z, GLshort width, GLshort height), (x, y, z, width, height), 5, "GLshort", x, "GLshort", y, "GLshort", z, "GLshort", width, "GLshort", height) -TRACE_GL_VOID(glDrawTexsvOES, (const GLshort * coords), (coords), 1, "const GLshort *", coords) +TRACE_GL_VOID(glDrawTexsvOES, (const GLshort *coords), (coords), 1, "const GLshort *", coords) TRACE_GL_VOID(glDrawTexxOES, (GLfixed x, GLfixed y, GLfixed z, GLfixed width, GLfixed height), (x, y, z, width, height), 5, "GLfixed", x, "GLfixed", y, "GLfixed", z, "GLfixed", width, "GLfixed", height) -TRACE_GL_VOID(glDrawTexxvOES, (const GLfixed * coords), (coords), 1, "const GLfixed *", coords) +TRACE_GL_VOID(glDrawTexxvOES, (const GLfixed *coords), (coords), 1, "const GLfixed *", coords) TRACE_GL_VOID(glEGLImageTargetRenderbufferStorageOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image) TRACE_GL_VOID(glEGLImageTargetTexture2DOES, (GLenum target, GLeglImageOES image), (target, image), 2, "GLenum", target, "GLeglImageOES", image) TRACE_GL_VOID(glEnable, (GLenum cap), (cap), 1, "GLenum", cap) TRACE_GL_VOID(glEnableClientState, (GLenum array), (array), 1, "GLenum", array) TRACE_GL_VOID(glEnableDriverControlQCOM, (GLuint driverControl), (driverControl), 1, "GLuint", driverControl) TRACE_GL_VOID(glEnableVertexAttribArray, (GLuint index), (index), 1, "GLuint", index) -TRACE_GL_VOID(glEnableiEXT, (GLenum target, GLuint index), (target, index), 2, "GLenum", target, "GLuint", index) TRACE_GL_VOID(glEndPerfMonitorAMD, (GLuint monitor), (monitor), 1, "GLuint", monitor) -TRACE_GL_VOID(glEndPerfQueryINTEL, (GLuint queryHandle), (queryHandle), 1, "GLuint", queryHandle) -TRACE_GL_VOID(glEndQuery, (GLenum target), (target), 1, "GLenum", target) TRACE_GL_VOID(glEndQueryEXT, (GLenum target), (target), 1, "GLenum", target) TRACE_GL_VOID(glEndTilingQCOM, (GLbitfield preserveMask), (preserveMask), 1, "GLbitfield", preserveMask) -TRACE_GL_VOID(glEndTransformFeedback, (void), (), 0) -TRACE_GL_VOID(glExtGetBufferPointervQCOM, (GLenum target, void ** params), (target, params), 2, "GLenum", target, "void **", params) -TRACE_GL_VOID(glExtGetBuffersQCOM, (GLuint * buffers, GLint maxBuffers, GLint * numBuffers), (buffers, maxBuffers, numBuffers), 3, "GLuint *", buffers, "GLint", maxBuffers, "GLint *", numBuffers) -TRACE_GL_VOID(glExtGetFramebuffersQCOM, (GLuint * framebuffers, GLint maxFramebuffers, GLint * numFramebuffers), (framebuffers, maxFramebuffers, numFramebuffers), 3, "GLuint *", framebuffers, "GLint", maxFramebuffers, "GLint *", numFramebuffers) -TRACE_GL_VOID(glExtGetProgramBinarySourceQCOM, (GLuint program, GLenum shadertype, GLchar * source, GLint * length), (program, shadertype, source, length), 4, "GLuint", program, "GLenum", shadertype, "GLchar *", source, "GLint *", length) -TRACE_GL_VOID(glExtGetProgramsQCOM, (GLuint * programs, GLint maxPrograms, GLint * numPrograms), (programs, maxPrograms, numPrograms), 3, "GLuint *", programs, "GLint", maxPrograms, "GLint *", numPrograms) -TRACE_GL_VOID(glExtGetRenderbuffersQCOM, (GLuint * renderbuffers, GLint maxRenderbuffers, GLint * numRenderbuffers), (renderbuffers, maxRenderbuffers, numRenderbuffers), 3, "GLuint *", renderbuffers, "GLint", maxRenderbuffers, "GLint *", numRenderbuffers) -TRACE_GL_VOID(glExtGetShadersQCOM, (GLuint * shaders, GLint maxShaders, GLint * numShaders), (shaders, maxShaders, numShaders), 3, "GLuint *", shaders, "GLint", maxShaders, "GLint *", numShaders) -TRACE_GL_VOID(glExtGetTexLevelParameterivQCOM, (GLuint texture, GLenum face, GLint level, GLenum pname, GLint * params), (texture, face, level, pname, params), 5, "GLuint", texture, "GLenum", face, "GLint", level, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glExtGetTexSubImageQCOM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, void * texels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "void *", texels) -TRACE_GL_VOID(glExtGetTexturesQCOM, (GLuint * textures, GLint maxTextures, GLint * numTextures), (textures, maxTextures, numTextures), 3, "GLuint *", textures, "GLint", maxTextures, "GLint *", numTextures) +TRACE_GL_VOID(glExtGetBufferPointervQCOM, (GLenum target, GLvoid **params), (target, params), 2, "GLenum", target, "GLvoid **", params) +TRACE_GL_VOID(glExtGetBuffersQCOM, (GLuint *buffers, GLint maxBuffers, GLint *numBuffers), (buffers, maxBuffers, numBuffers), 3, "GLuint *", buffers, "GLint", maxBuffers, "GLint *", numBuffers) +TRACE_GL_VOID(glExtGetFramebuffersQCOM, (GLuint *framebuffers, GLint maxFramebuffers, GLint *numFramebuffers), (framebuffers, maxFramebuffers, numFramebuffers), 3, "GLuint *", framebuffers, "GLint", maxFramebuffers, "GLint *", numFramebuffers) +TRACE_GL_VOID(glExtGetProgramBinarySourceQCOM, (GLuint program, GLenum shadertype, GLchar *source, GLint *length), (program, shadertype, source, length), 4, "GLuint", program, "GLenum", shadertype, "GLchar *", source, "GLint *", length) +TRACE_GL_VOID(glExtGetProgramsQCOM, (GLuint *programs, GLint maxPrograms, GLint *numPrograms), (programs, maxPrograms, numPrograms), 3, "GLuint *", programs, "GLint", maxPrograms, "GLint *", numPrograms) +TRACE_GL_VOID(glExtGetRenderbuffersQCOM, (GLuint *renderbuffers, GLint maxRenderbuffers, GLint *numRenderbuffers), (renderbuffers, maxRenderbuffers, numRenderbuffers), 3, "GLuint *", renderbuffers, "GLint", maxRenderbuffers, "GLint *", numRenderbuffers) +TRACE_GL_VOID(glExtGetShadersQCOM, (GLuint *shaders, GLint maxShaders, GLint *numShaders), (shaders, maxShaders, numShaders), 3, "GLuint *", shaders, "GLint", maxShaders, "GLint *", numShaders) +TRACE_GL_VOID(glExtGetTexLevelParameterivQCOM, (GLuint texture, GLenum face, GLint level, GLenum pname, GLint *params), (texture, face, level, pname, params), 5, "GLuint", texture, "GLenum", face, "GLint", level, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glExtGetTexSubImageQCOM, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLvoid *texels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, texels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "GLvoid *", texels) +TRACE_GL_VOID(glExtGetTexturesQCOM, (GLuint *textures, GLint maxTextures, GLint *numTextures), (textures, maxTextures, numTextures), 3, "GLuint *", textures, "GLint", maxTextures, "GLint *", numTextures) TRACE_GL(GLboolean, glExtIsProgramBinaryQCOM, (GLuint program), (program), 1, "GLuint", program) TRACE_GL_VOID(glExtTexObjectStateOverrideiQCOM, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param) -TRACE_GL(GLsync, glFenceSync, (GLenum condition, GLbitfield flags), (condition, flags), 2, "GLenum", condition, "GLbitfield", flags) -TRACE_GL(GLsync, glFenceSyncAPPLE, (GLenum condition, GLbitfield flags), (condition, flags), 2, "GLenum", condition, "GLbitfield", flags) TRACE_GL_VOID(glFinish, (void), (), 0) TRACE_GL_VOID(glFinishFenceNV, (GLuint fence), (fence), 1, "GLuint", fence) TRACE_GL_VOID(glFlush, (void), (), 0) -TRACE_GL_VOID(glFlushMappedBufferRange, (GLenum target, GLintptr offset, GLsizeiptr length), (target, offset, length), 3, "GLenum", target, "GLintptr", offset, "GLsizeiptr", length) -TRACE_GL_VOID(glFlushMappedBufferRangeEXT, (GLenum target, GLintptr offset, GLsizeiptr length), (target, offset, length), 3, "GLenum", target, "GLintptr", offset, "GLsizeiptr", length) TRACE_GL_VOID(glFogf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glFogfv, (GLenum pname, const GLfloat * params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glFogfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glFogx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glFogxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glFogxv, (GLenum pname, const GLfixed * param), (pname, param), 2, "GLenum", pname, "const GLfixed *", param) -TRACE_GL_VOID(glFogxvOES, (GLenum pname, const GLfixed * param), (pname, param), 2, "GLenum", pname, "const GLfixed *", param) -TRACE_GL_VOID(glFramebufferParameteri, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param) +TRACE_GL_VOID(glFogxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glFogxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) TRACE_GL_VOID(glFramebufferRenderbuffer, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer), 4, "GLenum", target, "GLenum", attachment, "GLenum", renderbuffertarget, "GLuint", renderbuffer) TRACE_GL_VOID(glFramebufferRenderbufferOES, (GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer), (target, attachment, renderbuffertarget, renderbuffer), 4, "GLenum", target, "GLenum", attachment, "GLenum", renderbuffertarget, "GLuint", renderbuffer) TRACE_GL_VOID(glFramebufferTexture2D, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level), 5, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level) @@ -213,520 +139,299 @@ TRACE_GL_VOID(glFramebufferTexture2DMultisampleIMG, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLsizei samples), (target, attachment, textarget, texture, level, samples), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLsizei", samples) TRACE_GL_VOID(glFramebufferTexture2DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level), (target, attachment, textarget, texture, level), 5, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level) TRACE_GL_VOID(glFramebufferTexture3DOES, (GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level, GLint zoffset), (target, attachment, textarget, texture, level, zoffset), 6, "GLenum", target, "GLenum", attachment, "GLenum", textarget, "GLuint", texture, "GLint", level, "GLint", zoffset) -TRACE_GL_VOID(glFramebufferTextureEXT, (GLenum target, GLenum attachment, GLuint texture, GLint level), (target, attachment, texture, level), 4, "GLenum", target, "GLenum", attachment, "GLuint", texture, "GLint", level) -TRACE_GL_VOID(glFramebufferTextureLayer, (GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer), (target, attachment, texture, level, layer), 5, "GLenum", target, "GLenum", attachment, "GLuint", texture, "GLint", level, "GLint", layer) TRACE_GL_VOID(glFrontFace, (GLenum mode), (mode), 1, "GLenum", mode) -TRACE_GL_VOID(glFrustumf, (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f), (l, r, b, t, n, f), 6, "GLfloat", l, "GLfloat", r, "GLfloat", b, "GLfloat", t, "GLfloat", n, "GLfloat", f) -TRACE_GL_VOID(glFrustumfOES, (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f), (l, r, b, t, n, f), 6, "GLfloat", l, "GLfloat", r, "GLfloat", b, "GLfloat", t, "GLfloat", n, "GLfloat", f) -TRACE_GL_VOID(glFrustumx, (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f), (l, r, b, t, n, f), 6, "GLfixed", l, "GLfixed", r, "GLfixed", b, "GLfixed", t, "GLfixed", n, "GLfixed", f) -TRACE_GL_VOID(glFrustumxOES, (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f), (l, r, b, t, n, f), 6, "GLfixed", l, "GLfixed", r, "GLfixed", b, "GLfixed", t, "GLfixed", n, "GLfixed", f) -TRACE_GL_VOID(glGenBuffers, (GLsizei n, GLuint * buffers), (n, buffers), 2, "GLsizei", n, "GLuint *", buffers) -TRACE_GL_VOID(glGenFencesNV, (GLsizei n, GLuint * fences), (n, fences), 2, "GLsizei", n, "GLuint *", fences) -TRACE_GL_VOID(glGenFramebuffers, (GLsizei n, GLuint * framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint *", framebuffers) -TRACE_GL_VOID(glGenFramebuffersOES, (GLsizei n, GLuint * framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint *", framebuffers) -TRACE_GL_VOID(glGenPerfMonitorsAMD, (GLsizei n, GLuint * monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors) -TRACE_GL_VOID(glGenProgramPipelines, (GLsizei n, GLuint * pipelines), (n, pipelines), 2, "GLsizei", n, "GLuint *", pipelines) -TRACE_GL_VOID(glGenProgramPipelinesEXT, (GLsizei n, GLuint * pipelines), (n, pipelines), 2, "GLsizei", n, "GLuint *", pipelines) -TRACE_GL_VOID(glGenQueries, (GLsizei n, GLuint * ids), (n, ids), 2, "GLsizei", n, "GLuint *", ids) -TRACE_GL_VOID(glGenQueriesEXT, (GLsizei n, GLuint * ids), (n, ids), 2, "GLsizei", n, "GLuint *", ids) -TRACE_GL_VOID(glGenRenderbuffers, (GLsizei n, GLuint * renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint *", renderbuffers) -TRACE_GL_VOID(glGenRenderbuffersOES, (GLsizei n, GLuint * renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint *", renderbuffers) -TRACE_GL_VOID(glGenSamplers, (GLsizei count, GLuint * samplers), (count, samplers), 2, "GLsizei", count, "GLuint *", samplers) -TRACE_GL_VOID(glGenTextures, (GLsizei n, GLuint * textures), (n, textures), 2, "GLsizei", n, "GLuint *", textures) -TRACE_GL_VOID(glGenTransformFeedbacks, (GLsizei n, GLuint * ids), (n, ids), 2, "GLsizei", n, "GLuint *", ids) -TRACE_GL_VOID(glGenVertexArrays, (GLsizei n, GLuint * arrays), (n, arrays), 2, "GLsizei", n, "GLuint *", arrays) -TRACE_GL_VOID(glGenVertexArraysOES, (GLsizei n, GLuint * arrays), (n, arrays), 2, "GLsizei", n, "GLuint *", arrays) +TRACE_GL_VOID(glFrustumf, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glFrustumfOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glFrustumx, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glFrustumxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glGenBuffers, (GLsizei n, GLuint *buffers), (n, buffers), 2, "GLsizei", n, "GLuint *", buffers) +TRACE_GL_VOID(glGenFencesNV, (GLsizei n, GLuint *fences), (n, fences), 2, "GLsizei", n, "GLuint *", fences) +TRACE_GL_VOID(glGenFramebuffers, (GLsizei n, GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint*", framebuffers) +TRACE_GL_VOID(glGenFramebuffersOES, (GLsizei n, GLuint* framebuffers), (n, framebuffers), 2, "GLsizei", n, "GLuint*", framebuffers) +TRACE_GL_VOID(glGenPerfMonitorsAMD, (GLsizei n, GLuint *monitors), (n, monitors), 2, "GLsizei", n, "GLuint *", monitors) +TRACE_GL_VOID(glGenProgramPipelinesEXT, (GLsizei n, GLuint *pipelines), (n, pipelines), 2, "GLsizei", n, "GLuint *", pipelines) +TRACE_GL_VOID(glGenQueriesEXT, (GLsizei n, GLuint *ids), (n, ids), 2, "GLsizei", n, "GLuint *", ids) +TRACE_GL_VOID(glGenRenderbuffers, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint*", renderbuffers) +TRACE_GL_VOID(glGenRenderbuffersOES, (GLsizei n, GLuint* renderbuffers), (n, renderbuffers), 2, "GLsizei", n, "GLuint*", renderbuffers) +TRACE_GL_VOID(glGenTextures, (GLsizei n, GLuint *textures), (n, textures), 2, "GLsizei", n, "GLuint *", textures) +TRACE_GL_VOID(glGenVertexArraysOES, (GLsizei n, GLuint *arrays), (n, arrays), 2, "GLsizei", n, "GLuint *", arrays) TRACE_GL_VOID(glGenerateMipmap, (GLenum target), (target), 1, "GLenum", target) TRACE_GL_VOID(glGenerateMipmapOES, (GLenum target), (target), 1, "GLenum", target) -TRACE_GL_VOID(glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name), (program, index, bufSize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufSize, "GLsizei *", length, "GLint *", size, "GLenum *", type, "GLchar *", name) -TRACE_GL_VOID(glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLint * size, GLenum * type, GLchar * name), (program, index, bufSize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufSize, "GLsizei *", length, "GLint *", size, "GLenum *", type, "GLchar *", name) -TRACE_GL_VOID(glGetActiveUniformBlockName, (GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei * length, GLchar * uniformBlockName), (program, uniformBlockIndex, bufSize, length, uniformBlockName), 5, "GLuint", program, "GLuint", uniformBlockIndex, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", uniformBlockName) -TRACE_GL_VOID(glGetActiveUniformBlockiv, (GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint * params), (program, uniformBlockIndex, pname, params), 4, "GLuint", program, "GLuint", uniformBlockIndex, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetActiveUniformsiv, (GLuint program, GLsizei uniformCount, const GLuint * uniformIndices, GLenum pname, GLint * params), (program, uniformCount, uniformIndices, pname, params), 5, "GLuint", program, "GLsizei", uniformCount, "const GLuint *", uniformIndices, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetAttachedShaders, (GLuint program, GLsizei maxCount, GLsizei * count, GLuint * shaders), (program, maxCount, count, shaders), 4, "GLuint", program, "GLsizei", maxCount, "GLsizei *", count, "GLuint *", shaders) -TRACE_GL(GLint, glGetAttribLocation, (GLuint program, const GLchar * name), (program, name), 2, "GLuint", program, "const GLchar *", name) -TRACE_GL_VOID(glGetBooleani_v, (GLenum target, GLuint index, GLboolean * data), (target, index, data), 3, "GLenum", target, "GLuint", index, "GLboolean *", data) -TRACE_GL_VOID(glGetBooleanv, (GLenum pname, GLboolean * data), (pname, data), 2, "GLenum", pname, "GLboolean *", data) -TRACE_GL_VOID(glGetBufferParameteri64v, (GLenum target, GLenum pname, GLint64 * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint64 *", params) -TRACE_GL_VOID(glGetBufferParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetBufferPointerv, (GLenum target, GLenum pname, void ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "void **", params) -TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, void ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "void **", params) -TRACE_GL_VOID(glGetClipPlanef, (GLenum plane, GLfloat * equation), (plane, equation), 2, "GLenum", plane, "GLfloat *", equation) -TRACE_GL_VOID(glGetClipPlanefOES, (GLenum plane, GLfloat * equation), (plane, equation), 2, "GLenum", plane, "GLfloat *", equation) -TRACE_GL_VOID(glGetClipPlanex, (GLenum plane, GLfixed * equation), (plane, equation), 2, "GLenum", plane, "GLfixed *", equation) -TRACE_GL_VOID(glGetClipPlanexOES, (GLenum plane, GLfixed * equation), (plane, equation), 2, "GLenum", plane, "GLfixed *", equation) -TRACE_GL(GLuint, glGetDebugMessageLogKHR, (GLuint count, GLsizei bufSize, GLenum * sources, GLenum * types, GLuint * ids, GLenum * severities, GLsizei * lengths, GLchar * messageLog), (count, bufSize, sources, types, ids, severities, lengths, messageLog), 8, "GLuint", count, "GLsizei", bufSize, "GLenum *", sources, "GLenum *", types, "GLuint *", ids, "GLenum *", severities, "GLsizei *", lengths, "GLchar *", messageLog) -TRACE_GL_VOID(glGetDriverControlStringQCOM, (GLuint driverControl, GLsizei bufSize, GLsizei * length, GLchar * driverControlString), (driverControl, bufSize, length, driverControlString), 4, "GLuint", driverControl, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", driverControlString) -TRACE_GL_VOID(glGetDriverControlsQCOM, (GLint * num, GLsizei size, GLuint * driverControls), (num, size, driverControls), 3, "GLint *", num, "GLsizei", size, "GLuint *", driverControls) +TRACE_GL_VOID(glGetActiveAttrib, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name) +TRACE_GL_VOID(glGetActiveUniform, (GLuint program, GLuint index, GLsizei bufsize, GLsizei* length, GLint* size, GLenum* type, GLchar* name), (program, index, bufsize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufsize, "GLsizei*", length, "GLint*", size, "GLenum*", type, "GLchar*", name) +TRACE_GL_VOID(glGetAttachedShaders, (GLuint program, GLsizei maxcount, GLsizei* count, GLuint* shaders), (program, maxcount, count, shaders), 4, "GLuint", program, "GLsizei", maxcount, "GLsizei*", count, "GLuint*", shaders) +TRACE_GL(int, glGetAttribLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name) +TRACE_GL_VOID(glGetBooleanv, (GLenum pname, GLboolean *params), (pname, params), 2, "GLenum", pname, "GLboolean *", params) +TRACE_GL_VOID(glGetBufferParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetBufferPointervOES, (GLenum target, GLenum pname, GLvoid ** params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLvoid **", params) +TRACE_GL_VOID(glGetClipPlanef, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn) +TRACE_GL_VOID(glGetClipPlanefOES, (GLenum pname, GLfloat eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfloat", eqn) +TRACE_GL_VOID(glGetClipPlanex, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn) +TRACE_GL_VOID(glGetClipPlanexOES, (GLenum pname, GLfixed eqn[4]), (pname, eqn), 2, "GLenum", pname, "GLfixed", eqn) +TRACE_GL_VOID(glGetDriverControlStringQCOM, (GLuint driverControl, GLsizei bufSize, GLsizei *length, GLchar *driverControlString), (driverControl, bufSize, length, driverControlString), 4, "GLuint", driverControl, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", driverControlString) +TRACE_GL_VOID(glGetDriverControlsQCOM, (GLint *num, GLsizei size, GLuint *driverControls), (num, size, driverControls), 3, "GLint *", num, "GLsizei", size, "GLuint *", driverControls) TRACE_GL(GLenum, glGetError, (void), (), 0) -TRACE_GL_VOID(glGetFenceivNV, (GLuint fence, GLenum pname, GLint * params), (fence, pname, params), 3, "GLuint", fence, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetFirstPerfQueryIdINTEL, (GLuint * queryId), (queryId), 1, "GLuint *", queryId) -TRACE_GL_VOID(glGetFixedv, (GLenum pname, GLfixed * params), (pname, params), 2, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetFixedvOES, (GLenum pname, GLfixed * params), (pname, params), 2, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetFloatv, (GLenum pname, GLfloat * data), (pname, data), 2, "GLenum", pname, "GLfloat *", data) -TRACE_GL(GLint, glGetFragDataLocation, (GLuint program, const GLchar * name), (program, name), 2, "GLuint", program, "const GLchar *", name) -TRACE_GL_VOID(glGetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint * params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetFramebufferAttachmentParameterivOES, (GLenum target, GLenum attachment, GLenum pname, GLint * params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetFramebufferParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetFenceivNV, (GLuint fence, GLenum pname, GLint *params), (fence, pname, params), 3, "GLuint", fence, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetFixedv, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetFixedvOES, (GLenum pname, GLfixed *params), (pname, params), 2, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetFloatv, (GLenum pname, GLfloat *params), (pname, params), 2, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetFramebufferAttachmentParameteriv, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetFramebufferAttachmentParameterivOES, (GLenum target, GLenum attachment, GLenum pname, GLint* params), (target, attachment, pname, params), 4, "GLenum", target, "GLenum", attachment, "GLenum", pname, "GLint*", params) TRACE_GL(GLenum, glGetGraphicsResetStatusEXT, (void), (), 0) -TRACE_GL_VOID(glGetInteger64i_v, (GLenum target, GLuint index, GLint64 * data), (target, index, data), 3, "GLenum", target, "GLuint", index, "GLint64 *", data) -TRACE_GL_VOID(glGetInteger64v, (GLenum pname, GLint64 * data), (pname, data), 2, "GLenum", pname, "GLint64 *", data) -TRACE_GL_VOID(glGetInteger64vAPPLE, (GLenum pname, GLint64 * params), (pname, params), 2, "GLenum", pname, "GLint64 *", params) -TRACE_GL_VOID(glGetIntegeri_v, (GLenum target, GLuint index, GLint * data), (target, index, data), 3, "GLenum", target, "GLuint", index, "GLint *", data) -TRACE_GL_VOID(glGetIntegeri_vEXT, (GLenum target, GLuint index, GLint * data), (target, index, data), 3, "GLenum", target, "GLuint", index, "GLint *", data) -TRACE_GL_VOID(glGetIntegerv, (GLenum pname, GLint * data), (pname, data), 2, "GLenum", pname, "GLint *", data) -TRACE_GL_VOID(glGetInternalformativ, (GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint * params), (target, internalformat, pname, bufSize, params), 5, "GLenum", target, "GLenum", internalformat, "GLenum", pname, "GLsizei", bufSize, "GLint *", params) -TRACE_GL_VOID(glGetLightfv, (GLenum light, GLenum pname, GLfloat * params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetLightxv, (GLenum light, GLenum pname, GLfixed * params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetLightxvOES, (GLenum light, GLenum pname, GLfixed * params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetMaterialfv, (GLenum face, GLenum pname, GLfloat * params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetMaterialxv, (GLenum face, GLenum pname, GLfixed * params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetMaterialxvOES, (GLenum face, GLenum pname, GLfixed * params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetMultisamplefv, (GLenum pname, GLuint index, GLfloat * val), (pname, index, val), 3, "GLenum", pname, "GLuint", index, "GLfloat *", val) -TRACE_GL_VOID(glGetNextPerfQueryIdINTEL, (GLuint queryId, GLuint * nextQueryId), (queryId, nextQueryId), 2, "GLuint", queryId, "GLuint *", nextQueryId) -TRACE_GL_VOID(glGetObjectLabelEXT, (GLenum type, GLuint object, GLsizei bufSize, GLsizei * length, GLchar * label), (type, object, bufSize, length, label), 5, "GLenum", type, "GLuint", object, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", label) -TRACE_GL_VOID(glGetObjectLabelKHR, (GLenum identifier, GLuint name, GLsizei bufSize, GLsizei * length, GLchar * label), (identifier, name, bufSize, length, label), 5, "GLenum", identifier, "GLuint", name, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", label) -TRACE_GL_VOID(glGetObjectPtrLabelKHR, (const void * ptr, GLsizei bufSize, GLsizei * length, GLchar * label), (ptr, bufSize, length, label), 4, "const void *", ptr, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", label) -TRACE_GL_VOID(glGetPerfCounterInfoINTEL, (GLuint queryId, GLuint counterId, GLuint counterNameLength, GLchar * counterName, GLuint counterDescLength, GLchar * counterDesc, GLuint * counterOffset, GLuint * counterDataSize, GLuint * counterTypeEnum, GLuint * counterDataTypeEnum, GLuint64 * rawCounterMaxValue), (queryId, counterId, counterNameLength, counterName, counterDescLength, counterDesc, counterOffset, counterDataSize, counterTypeEnum, counterDataTypeEnum, rawCounterMaxValue), 11, "GLuint", queryId, "GLuint", counterId, "GLuint", counterNameLength, "GLchar *", counterName, "GLuint", counterDescLength, "GLchar *", counterDesc, "GLuint *", counterOffset, "GLuint *", counterDataSize, "GLuint *", counterTypeEnum, "GLuint *", counterDataTypeEnum, "GLuint64 *", rawCounterMaxValue) -TRACE_GL_VOID(glGetPerfMonitorCounterDataAMD, (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint * data, GLint * bytesWritten), (monitor, pname, dataSize, data, bytesWritten), 5, "GLuint", monitor, "GLenum", pname, "GLsizei", dataSize, "GLuint *", data, "GLint *", bytesWritten) -TRACE_GL_VOID(glGetPerfMonitorCounterInfoAMD, (GLuint group, GLuint counter, GLenum pname, void * data), (group, counter, pname, data), 4, "GLuint", group, "GLuint", counter, "GLenum", pname, "void *", data) -TRACE_GL_VOID(glGetPerfMonitorCounterStringAMD, (GLuint group, GLuint counter, GLsizei bufSize, GLsizei * length, GLchar * counterString), (group, counter, bufSize, length, counterString), 5, "GLuint", group, "GLuint", counter, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", counterString) -TRACE_GL_VOID(glGetPerfMonitorCountersAMD, (GLuint group, GLint * numCounters, GLint * maxActiveCounters, GLsizei counterSize, GLuint * counters), (group, numCounters, maxActiveCounters, counterSize, counters), 5, "GLuint", group, "GLint *", numCounters, "GLint *", maxActiveCounters, "GLsizei", counterSize, "GLuint *", counters) -TRACE_GL_VOID(glGetPerfMonitorGroupStringAMD, (GLuint group, GLsizei bufSize, GLsizei * length, GLchar * groupString), (group, bufSize, length, groupString), 4, "GLuint", group, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", groupString) -TRACE_GL_VOID(glGetPerfMonitorGroupsAMD, (GLint * numGroups, GLsizei groupsSize, GLuint * groups), (numGroups, groupsSize, groups), 3, "GLint *", numGroups, "GLsizei", groupsSize, "GLuint *", groups) -TRACE_GL_VOID(glGetPerfQueryDataINTEL, (GLuint queryHandle, GLuint flags, GLsizei dataSize, GLvoid * data, GLuint * bytesWritten), (queryHandle, flags, dataSize, data, bytesWritten), 5, "GLuint", queryHandle, "GLuint", flags, "GLsizei", dataSize, "GLvoid *", data, "GLuint *", bytesWritten) -TRACE_GL_VOID(glGetPerfQueryIdByNameINTEL, (GLchar * queryName, GLuint * queryId), (queryName, queryId), 2, "GLchar *", queryName, "GLuint *", queryId) -TRACE_GL_VOID(glGetPerfQueryInfoINTEL, (GLuint queryId, GLuint queryNameLength, GLchar * queryName, GLuint * dataSize, GLuint * noCounters, GLuint * noInstances, GLuint * capsMask), (queryId, queryNameLength, queryName, dataSize, noCounters, noInstances, capsMask), 7, "GLuint", queryId, "GLuint", queryNameLength, "GLchar *", queryName, "GLuint *", dataSize, "GLuint *", noCounters, "GLuint *", noInstances, "GLuint *", capsMask) -TRACE_GL_VOID(glGetPointerv, (GLenum pname, void ** params), (pname, params), 2, "GLenum", pname, "void **", params) -TRACE_GL_VOID(glGetPointervKHR, (GLenum pname, void ** params), (pname, params), 2, "GLenum", pname, "void **", params) -TRACE_GL_VOID(glGetProgramBinary, (GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary), (program, bufSize, length, binaryFormat, binary), 5, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLenum *", binaryFormat, "void *", binary) -TRACE_GL_VOID(glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei * length, GLenum * binaryFormat, void * binary), (program, bufSize, length, binaryFormat, binary), 5, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLenum *", binaryFormat, "void *", binary) -TRACE_GL_VOID(glGetProgramInfoLog, (GLuint program, GLsizei bufSize, GLsizei * length, GLchar * infoLog), (program, bufSize, length, infoLog), 4, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", infoLog) -TRACE_GL_VOID(glGetProgramInterfaceiv, (GLuint program, GLenum programInterface, GLenum pname, GLint * params), (program, programInterface, pname, params), 4, "GLuint", program, "GLenum", programInterface, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetProgramPipelineInfoLog, (GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog), (pipeline, bufSize, length, infoLog), 4, "GLuint", pipeline, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", infoLog) -TRACE_GL_VOID(glGetProgramPipelineInfoLogEXT, (GLuint pipeline, GLsizei bufSize, GLsizei * length, GLchar * infoLog), (pipeline, bufSize, length, infoLog), 4, "GLuint", pipeline, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", infoLog) -TRACE_GL_VOID(glGetProgramPipelineiv, (GLuint pipeline, GLenum pname, GLint * params), (pipeline, pname, params), 3, "GLuint", pipeline, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetProgramPipelineivEXT, (GLuint pipeline, GLenum pname, GLint * params), (pipeline, pname, params), 3, "GLuint", pipeline, "GLenum", pname, "GLint *", params) -TRACE_GL(GLuint, glGetProgramResourceIndex, (GLuint program, GLenum programInterface, const GLchar * name), (program, programInterface, name), 3, "GLuint", program, "GLenum", programInterface, "const GLchar *", name) -TRACE_GL(GLint, glGetProgramResourceLocation, (GLuint program, GLenum programInterface, const GLchar * name), (program, programInterface, name), 3, "GLuint", program, "GLenum", programInterface, "const GLchar *", name) -TRACE_GL_VOID(glGetProgramResourceName, (GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei * length, GLchar * name), (program, programInterface, index, bufSize, length, name), 6, "GLuint", program, "GLenum", programInterface, "GLuint", index, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", name) -TRACE_GL_VOID(glGetProgramResourceiv, (GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum * props, GLsizei bufSize, GLsizei * length, GLint * params), (program, programInterface, index, propCount, props, bufSize, length, params), 8, "GLuint", program, "GLenum", programInterface, "GLuint", index, "GLsizei", propCount, "const GLenum *", props, "GLsizei", bufSize, "GLsizei *", length, "GLint *", params) -TRACE_GL_VOID(glGetProgramiv, (GLuint program, GLenum pname, GLint * params), (program, pname, params), 3, "GLuint", program, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetQueryObjecti64vEXT, (GLuint id, GLenum pname, GLint64 * params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLint64 *", params) -TRACE_GL_VOID(glGetQueryObjectivEXT, (GLuint id, GLenum pname, GLint * params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetQueryObjectui64vEXT, (GLuint id, GLenum pname, GLuint64 * params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLuint64 *", params) -TRACE_GL_VOID(glGetQueryObjectuiv, (GLuint id, GLenum pname, GLuint * params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLuint *", params) -TRACE_GL_VOID(glGetQueryObjectuivEXT, (GLuint id, GLenum pname, GLuint * params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLuint *", params) -TRACE_GL_VOID(glGetQueryiv, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetQueryivEXT, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetRenderbufferParameterivOES, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetSamplerParameterIivEXT, (GLuint sampler, GLenum pname, GLint * params), (sampler, pname, params), 3, "GLuint", sampler, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetSamplerParameterIuivEXT, (GLuint sampler, GLenum pname, GLuint * params), (sampler, pname, params), 3, "GLuint", sampler, "GLenum", pname, "GLuint *", params) -TRACE_GL_VOID(glGetSamplerParameterfv, (GLuint sampler, GLenum pname, GLfloat * params), (sampler, pname, params), 3, "GLuint", sampler, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetSamplerParameteriv, (GLuint sampler, GLenum pname, GLint * params), (sampler, pname, params), 3, "GLuint", sampler, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetShaderInfoLog, (GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * infoLog), (shader, bufSize, length, infoLog), 4, "GLuint", shader, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", infoLog) -TRACE_GL_VOID(glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint * range, GLint * precision), (shadertype, precisiontype, range, precision), 4, "GLenum", shadertype, "GLenum", precisiontype, "GLint *", range, "GLint *", precision) -TRACE_GL_VOID(glGetShaderSource, (GLuint shader, GLsizei bufSize, GLsizei * length, GLchar * source), (shader, bufSize, length, source), 4, "GLuint", shader, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", source) -TRACE_GL_VOID(glGetShaderiv, (GLuint shader, GLenum pname, GLint * params), (shader, pname, params), 3, "GLuint", shader, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetIntegerv, (GLenum pname, GLint *params), (pname, params), 2, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetLightfv, (GLenum light, GLenum pname, GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetLightxv, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetLightxvOES, (GLenum light, GLenum pname, GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetMaterialfv, (GLenum face, GLenum pname, GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetMaterialxv, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetMaterialxvOES, (GLenum face, GLenum pname, GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetObjectLabelEXT, (GLenum type, GLuint object, GLsizei bufSize, GLsizei *length, GLchar *label), (type, object, bufSize, length, label), 5, "GLenum", type, "GLuint", object, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", label) +TRACE_GL_VOID(glGetPerfMonitorCounterDataAMD, (GLuint monitor, GLenum pname, GLsizei dataSize, GLuint *data, GLint *bytesWritten), (monitor, pname, dataSize, data, bytesWritten), 5, "GLuint", monitor, "GLenum", pname, "GLsizei", dataSize, "GLuint *", data, "GLint *", bytesWritten) +TRACE_GL_VOID(glGetPerfMonitorCounterInfoAMD, (GLuint group, GLuint counter, GLenum pname, GLvoid *data), (group, counter, pname, data), 4, "GLuint", group, "GLuint", counter, "GLenum", pname, "GLvoid *", data) +TRACE_GL_VOID(glGetPerfMonitorCounterStringAMD, (GLuint group, GLuint counter, GLsizei bufSize, GLsizei *length, GLchar *counterString), (group, counter, bufSize, length, counterString), 5, "GLuint", group, "GLuint", counter, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", counterString) +TRACE_GL_VOID(glGetPerfMonitorCountersAMD, (GLuint group, GLint *numCounters, GLint *maxActiveCounters, GLsizei counterSize, GLuint *counters), (group, numCounters, maxActiveCounters, counterSize, counters), 5, "GLuint", group, "GLint *", numCounters, "GLint *", maxActiveCounters, "GLsizei", counterSize, "GLuint *", counters) +TRACE_GL_VOID(glGetPerfMonitorGroupStringAMD, (GLuint group, GLsizei bufSize, GLsizei *length, GLchar *groupString), (group, bufSize, length, groupString), 4, "GLuint", group, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", groupString) +TRACE_GL_VOID(glGetPerfMonitorGroupsAMD, (GLint *numGroups, GLsizei groupsSize, GLuint *groups), (numGroups, groupsSize, groups), 3, "GLint *", numGroups, "GLsizei", groupsSize, "GLuint *", groups) +TRACE_GL_VOID(glGetPointerv, (GLenum pname, GLvoid **params), (pname, params), 2, "GLenum", pname, "GLvoid **", params) +TRACE_GL_VOID(glGetProgramBinaryOES, (GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary), (program, bufSize, length, binaryFormat, binary), 5, "GLuint", program, "GLsizei", bufSize, "GLsizei *", length, "GLenum *", binaryFormat, "GLvoid *", binary) +TRACE_GL_VOID(glGetProgramInfoLog, (GLuint program, GLsizei bufsize, GLsizei* length, GLchar* infolog), (program, bufsize, length, infolog), 4, "GLuint", program, "GLsizei", bufsize, "GLsizei*", length, "GLchar*", infolog) +TRACE_GL_VOID(glGetProgramPipelineInfoLogEXT, (GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog), (pipeline, bufSize, length, infoLog), 4, "GLuint", pipeline, "GLsizei", bufSize, "GLsizei *", length, "GLchar *", infoLog) +TRACE_GL_VOID(glGetProgramPipelineivEXT, (GLuint pipeline, GLenum pname, GLint *params), (pipeline, pname, params), 3, "GLuint", pipeline, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetProgramiv, (GLuint program, GLenum pname, GLint* params), (program, pname, params), 3, "GLuint", program, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetQueryObjectuivEXT, (GLuint id, GLenum pname, GLuint *params), (id, pname, params), 3, "GLuint", id, "GLenum", pname, "GLuint *", params) +TRACE_GL_VOID(glGetQueryivEXT, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetRenderbufferParameteriv, (GLenum target, GLenum pname, GLint* params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetRenderbufferParameterivOES, (GLenum target, GLenum pname, GLint* params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetShaderInfoLog, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* infolog), (shader, bufsize, length, infolog), 4, "GLuint", shader, "GLsizei", bufsize, "GLsizei*", length, "GLchar*", infolog) +TRACE_GL_VOID(glGetShaderPrecisionFormat, (GLenum shadertype, GLenum precisiontype, GLint* range, GLint* precision), (shadertype, precisiontype, range, precision), 4, "GLenum", shadertype, "GLenum", precisiontype, "GLint*", range, "GLint*", precision) +TRACE_GL_VOID(glGetShaderSource, (GLuint shader, GLsizei bufsize, GLsizei* length, GLchar* source), (shader, bufsize, length, source), 4, "GLuint", shader, "GLsizei", bufsize, "GLsizei*", length, "GLchar*", source) +TRACE_GL_VOID(glGetShaderiv, (GLuint shader, GLenum pname, GLint* params), (shader, pname, params), 3, "GLuint", shader, "GLenum", pname, "GLint*", params) TRACE_GL(const GLubyte *, glGetString, (GLenum name), (name), 1, "GLenum", name) -TRACE_GL(const GLubyte *, glGetStringi, (GLenum name, GLuint index), (name, index), 2, "GLenum", name, "GLuint", index) -TRACE_GL_VOID(glGetSynciv, (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values), (sync, pname, bufSize, length, values), 5, "GLsync", sync, "GLenum", pname, "GLsizei", bufSize, "GLsizei *", length, "GLint *", values) -TRACE_GL_VOID(glGetSyncivAPPLE, (GLsync sync, GLenum pname, GLsizei bufSize, GLsizei * length, GLint * values), (sync, pname, bufSize, length, values), 5, "GLsync", sync, "GLenum", pname, "GLsizei", bufSize, "GLsizei *", length, "GLint *", values) -TRACE_GL_VOID(glGetTexEnvfv, (GLenum target, GLenum pname, GLfloat * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetTexEnviv, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetTexEnvxv, (GLenum target, GLenum pname, GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetTexEnvxvOES, (GLenum target, GLenum pname, GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetTexGenfvOES, (GLenum coord, GLenum pname, GLfloat * params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetTexGenivOES, (GLenum coord, GLenum pname, GLint * params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetTexGenxvOES, (GLenum coord, GLenum pname, GLfixed * params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetTexLevelParameterfv, (GLenum target, GLint level, GLenum pname, GLfloat * params), (target, level, pname, params), 4, "GLenum", target, "GLint", level, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetTexLevelParameteriv, (GLenum target, GLint level, GLenum pname, GLint * params), (target, level, pname, params), 4, "GLenum", target, "GLint", level, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetTexParameterIivEXT, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetTexParameterIuivEXT, (GLenum target, GLenum pname, GLuint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLuint *", params) -TRACE_GL_VOID(glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetTexParameteriv, (GLenum target, GLenum pname, GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) -TRACE_GL_VOID(glGetTransformFeedbackVarying, (GLuint program, GLuint index, GLsizei bufSize, GLsizei * length, GLsizei * size, GLenum * type, GLchar * name), (program, index, bufSize, length, size, type, name), 7, "GLuint", program, "GLuint", index, "GLsizei", bufSize, "GLsizei *", length, "GLsizei *", size, "GLenum *", type, "GLchar *", name) -TRACE_GL_VOID(glGetTranslatedShaderSourceANGLE, (GLuint shader, GLsizei bufsize, GLsizei * length, GLchar * source), (shader, bufsize, length, source), 4, "GLuint", shader, "GLsizei", bufsize, "GLsizei *", length, "GLchar *", source) -TRACE_GL(GLuint, glGetUniformBlockIndex, (GLuint program, const GLchar * uniformBlockName), (program, uniformBlockName), 2, "GLuint", program, "const GLchar *", uniformBlockName) -TRACE_GL_VOID(glGetUniformIndices, (GLuint program, GLsizei uniformCount, const GLchar *const* uniformNames, GLuint * uniformIndices), (program, uniformCount, uniformNames, uniformIndices), 4, "GLuint", program, "GLsizei", uniformCount, "const GLchar *const*", uniformNames, "GLuint *", uniformIndices) -TRACE_GL(GLint, glGetUniformLocation, (GLuint program, const GLchar * name), (program, name), 2, "GLuint", program, "const GLchar *", name) -TRACE_GL_VOID(glGetUniformfv, (GLuint program, GLint location, GLfloat * params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLfloat *", params) -TRACE_GL_VOID(glGetUniformiv, (GLuint program, GLint location, GLint * params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLint *", params) -TRACE_GL_VOID(glGetUniformuiv, (GLuint program, GLint location, GLuint * params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLuint *", params) -TRACE_GL_VOID(glGetVertexAttribIiv, (GLuint index, GLenum pname, GLint * params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetVertexAttribIuiv, (GLuint index, GLenum pname, GLuint * params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLuint *", params) -TRACE_GL_VOID(glGetVertexAttribPointerv, (GLuint index, GLenum pname, void ** pointer), (index, pname, pointer), 3, "GLuint", index, "GLenum", pname, "void **", pointer) -TRACE_GL_VOID(glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat * params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLfloat *", params) -TRACE_GL_VOID(glGetVertexAttribiv, (GLuint index, GLenum pname, GLint * params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLint *", params) -TRACE_GL_VOID(glGetnUniformfvEXT, (GLuint program, GLint location, GLsizei bufSize, GLfloat * params), (program, location, bufSize, params), 4, "GLuint", program, "GLint", location, "GLsizei", bufSize, "GLfloat *", params) -TRACE_GL_VOID(glGetnUniformivEXT, (GLuint program, GLint location, GLsizei bufSize, GLint * params), (program, location, bufSize, params), 4, "GLuint", program, "GLint", location, "GLsizei", bufSize, "GLint *", params) +TRACE_GL_VOID(glGetTexEnvfv, (GLenum env, GLenum pname, GLfloat *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetTexEnviv, (GLenum env, GLenum pname, GLint *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetTexEnvxv, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexEnvxvOES, (GLenum env, GLenum pname, GLfixed *params), (env, pname, params), 3, "GLenum", env, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexGenfvOES, (GLenum coord, GLenum pname, GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetTexGenivOES, (GLenum coord, GLenum pname, GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetTexGenxvOES, (GLenum coord, GLenum pname, GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexParameterfv, (GLenum target, GLenum pname, GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfloat *", params) +TRACE_GL_VOID(glGetTexParameteriv, (GLenum target, GLenum pname, GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLint *", params) +TRACE_GL_VOID(glGetTexParameterxv, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) +TRACE_GL_VOID(glGetTexParameterxvOES, (GLenum target, GLenum pname, GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "GLfixed *", params) +TRACE_GL(int, glGetUniformLocation, (GLuint program, const GLchar* name), (program, name), 2, "GLuint", program, "const GLchar*", name) +TRACE_GL_VOID(glGetUniformfv, (GLuint program, GLint location, GLfloat* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLfloat*", params) +TRACE_GL_VOID(glGetUniformiv, (GLuint program, GLint location, GLint* params), (program, location, params), 3, "GLuint", program, "GLint", location, "GLint*", params) +TRACE_GL_VOID(glGetVertexAttribPointerv, (GLuint index, GLenum pname, GLvoid** pointer), (index, pname, pointer), 3, "GLuint", index, "GLenum", pname, "GLvoid**", pointer) +TRACE_GL_VOID(glGetVertexAttribfv, (GLuint index, GLenum pname, GLfloat* params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLfloat*", params) +TRACE_GL_VOID(glGetVertexAttribiv, (GLuint index, GLenum pname, GLint* params), (index, pname, params), 3, "GLuint", index, "GLenum", pname, "GLint*", params) +TRACE_GL_VOID(glGetnUniformfvEXT, (GLuint program, GLint location, GLsizei bufSize, float *params), (program, location, bufSize, params), 4, "GLuint", program, "GLint", location, "GLsizei", bufSize, "float *", params) +TRACE_GL_VOID(glGetnUniformivEXT, (GLuint program, GLint location, GLsizei bufSize, GLint *params), (program, location, bufSize, params), 4, "GLuint", program, "GLint", location, "GLsizei", bufSize, "GLint *", params) TRACE_GL_VOID(glHint, (GLenum target, GLenum mode), (target, mode), 2, "GLenum", target, "GLenum", mode) -TRACE_GL_VOID(glInsertEventMarkerEXT, (GLsizei length, const GLchar * marker), (length, marker), 2, "GLsizei", length, "const GLchar *", marker) -TRACE_GL_VOID(glInvalidateFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum * attachments), (target, numAttachments, attachments), 3, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments) -TRACE_GL_VOID(glInvalidateSubFramebuffer, (GLenum target, GLsizei numAttachments, const GLenum * attachments, GLint x, GLint y, GLsizei width, GLsizei height), (target, numAttachments, attachments, x, y, width, height), 7, "GLenum", target, "GLsizei", numAttachments, "const GLenum *", attachments, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) +TRACE_GL_VOID(glInsertEventMarkerEXT, (GLsizei length, const GLchar *marker), (length, marker), 2, "GLsizei", length, "const GLchar *", marker) TRACE_GL(GLboolean, glIsBuffer, (GLuint buffer), (buffer), 1, "GLuint", buffer) TRACE_GL(GLboolean, glIsEnabled, (GLenum cap), (cap), 1, "GLenum", cap) -TRACE_GL(GLboolean, glIsEnablediEXT, (GLenum target, GLuint index), (target, index), 2, "GLenum", target, "GLuint", index) TRACE_GL(GLboolean, glIsFenceNV, (GLuint fence), (fence), 1, "GLuint", fence) TRACE_GL(GLboolean, glIsFramebuffer, (GLuint framebuffer), (framebuffer), 1, "GLuint", framebuffer) TRACE_GL(GLboolean, glIsFramebufferOES, (GLuint framebuffer), (framebuffer), 1, "GLuint", framebuffer) TRACE_GL(GLboolean, glIsProgram, (GLuint program), (program), 1, "GLuint", program) -TRACE_GL(GLboolean, glIsProgramPipeline, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline) TRACE_GL(GLboolean, glIsProgramPipelineEXT, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline) -TRACE_GL(GLboolean, glIsQuery, (GLuint id), (id), 1, "GLuint", id) TRACE_GL(GLboolean, glIsQueryEXT, (GLuint id), (id), 1, "GLuint", id) TRACE_GL(GLboolean, glIsRenderbuffer, (GLuint renderbuffer), (renderbuffer), 1, "GLuint", renderbuffer) TRACE_GL(GLboolean, glIsRenderbufferOES, (GLuint renderbuffer), (renderbuffer), 1, "GLuint", renderbuffer) -TRACE_GL(GLboolean, glIsSampler, (GLuint sampler), (sampler), 1, "GLuint", sampler) TRACE_GL(GLboolean, glIsShader, (GLuint shader), (shader), 1, "GLuint", shader) -TRACE_GL(GLboolean, glIsSync, (GLsync sync), (sync), 1, "GLsync", sync) -TRACE_GL(GLboolean, glIsSyncAPPLE, (GLsync sync), (sync), 1, "GLsync", sync) TRACE_GL(GLboolean, glIsTexture, (GLuint texture), (texture), 1, "GLuint", texture) -TRACE_GL(GLboolean, glIsTransformFeedback, (GLuint id), (id), 1, "GLuint", id) -TRACE_GL(GLboolean, glIsVertexArray, (GLuint array), (array), 1, "GLuint", array) TRACE_GL(GLboolean, glIsVertexArrayOES, (GLuint array), (array), 1, "GLuint", array) -TRACE_GL_VOID(glLabelObjectEXT, (GLenum type, GLuint object, GLsizei length, const GLchar * label), (type, object, length, label), 4, "GLenum", type, "GLuint", object, "GLsizei", length, "const GLchar *", label) +TRACE_GL_VOID(glLabelObjectEXT, (GLenum type, GLuint object, GLsizei length, const GLchar *label), (type, object, length, label), 4, "GLenum", type, "GLuint", object, "GLsizei", length, "const GLchar *", label) TRACE_GL_VOID(glLightModelf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glLightModelfv, (GLenum pname, const GLfloat * params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glLightModelfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glLightModelx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glLightModelxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glLightModelxv, (GLenum pname, const GLfixed * param), (pname, param), 2, "GLenum", pname, "const GLfixed *", param) -TRACE_GL_VOID(glLightModelxvOES, (GLenum pname, const GLfixed * param), (pname, param), 2, "GLenum", pname, "const GLfixed *", param) +TRACE_GL_VOID(glLightModelxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLightModelxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) TRACE_GL_VOID(glLightf, (GLenum light, GLenum pname, GLfloat param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glLightfv, (GLenum light, GLenum pname, const GLfloat * params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glLightfv, (GLenum light, GLenum pname, const GLfloat *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glLightx, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glLightxOES, (GLenum light, GLenum pname, GLfixed param), (light, pname, param), 3, "GLenum", light, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glLightxv, (GLenum light, GLenum pname, const GLfixed * params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params) -TRACE_GL_VOID(glLightxvOES, (GLenum light, GLenum pname, const GLfixed * params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLightxv, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glLightxvOES, (GLenum light, GLenum pname, const GLfixed *params), (light, pname, params), 3, "GLenum", light, "GLenum", pname, "const GLfixed *", params) TRACE_GL_VOID(glLineWidth, (GLfloat width), (width), 1, "GLfloat", width) TRACE_GL_VOID(glLineWidthx, (GLfixed width), (width), 1, "GLfixed", width) TRACE_GL_VOID(glLineWidthxOES, (GLfixed width), (width), 1, "GLfixed", width) TRACE_GL_VOID(glLinkProgram, (GLuint program), (program), 1, "GLuint", program) TRACE_GL_VOID(glLoadIdentity, (void), (), 0) -TRACE_GL_VOID(glLoadMatrixf, (const GLfloat * m), (m), 1, "const GLfloat *", m) -TRACE_GL_VOID(glLoadMatrixx, (const GLfixed * m), (m), 1, "const GLfixed *", m) -TRACE_GL_VOID(glLoadMatrixxOES, (const GLfixed * m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glLoadMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m) +TRACE_GL_VOID(glLoadMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glLoadMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m) TRACE_GL_VOID(glLoadPaletteFromModelViewMatrixOES, (void), (), 0) TRACE_GL_VOID(glLogicOp, (GLenum opcode), (opcode), 1, "GLenum", opcode) -TRACE_GL(void *, glMapBufferOES, (GLenum target, GLenum access), (target, access), 2, "GLenum", target, "GLenum", access) -TRACE_GL(void *, glMapBufferRange, (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access), (target, offset, length, access), 4, "GLenum", target, "GLintptr", offset, "GLsizeiptr", length, "GLbitfield", access) -TRACE_GL(void *, glMapBufferRangeEXT, (GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access), (target, offset, length, access), 4, "GLenum", target, "GLintptr", offset, "GLsizeiptr", length, "GLbitfield", access) +TRACE_GL(void*, glMapBufferOES, (GLenum target, GLenum access), (target, access), 2, "GLenum", target, "GLenum", access) TRACE_GL_VOID(glMaterialf, (GLenum face, GLenum pname, GLfloat param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glMaterialfv, (GLenum face, GLenum pname, const GLfloat * params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glMaterialfv, (GLenum face, GLenum pname, const GLfloat *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glMaterialx, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glMaterialxOES, (GLenum face, GLenum pname, GLfixed param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glMaterialxv, (GLenum face, GLenum pname, const GLfixed * param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", param) -TRACE_GL_VOID(glMaterialxvOES, (GLenum face, GLenum pname, const GLfixed * param), (face, pname, param), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", param) -TRACE_GL_VOID(glMatrixIndexPointerOES, (GLint size, GLenum type, GLsizei stride, const void * pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const void *", pointer) +TRACE_GL_VOID(glMaterialxv, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glMaterialxvOES, (GLenum face, GLenum pname, const GLfixed *params), (face, pname, params), 3, "GLenum", face, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glMatrixIndexPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) TRACE_GL_VOID(glMatrixMode, (GLenum mode), (mode), 1, "GLenum", mode) -TRACE_GL_VOID(glMemoryBarrier, (GLbitfield barriers), (barriers), 1, "GLbitfield", barriers) -TRACE_GL_VOID(glMemoryBarrierByRegion, (GLbitfield barriers), (barriers), 1, "GLbitfield", barriers) -TRACE_GL_VOID(glMinSampleShadingOES, (GLfloat value), (value), 1, "GLfloat", value) -TRACE_GL_VOID(glMultMatrixf, (const GLfloat * m), (m), 1, "const GLfloat *", m) -TRACE_GL_VOID(glMultMatrixx, (const GLfixed * m), (m), 1, "const GLfixed *", m) -TRACE_GL_VOID(glMultMatrixxOES, (const GLfixed * m), (m), 1, "const GLfixed *", m) -TRACE_GL_VOID(glMultiDrawArraysEXT, (GLenum mode, const GLint * first, const GLsizei * count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "const GLint *", first, "const GLsizei *", count, "GLsizei", primcount) -TRACE_GL_VOID(glMultiDrawElementsEXT, (GLenum mode, const GLsizei * count, GLenum type, const void *const* indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "const GLsizei *", count, "GLenum", type, "const void *const*", indices, "GLsizei", primcount) -TRACE_GL_VOID(glMultiTexCoord1bOES, (GLenum texture, GLbyte s), (texture, s), 2, "GLenum", texture, "GLbyte", s) -TRACE_GL_VOID(glMultiTexCoord1bvOES, (GLenum texture, const GLbyte * coords), (texture, coords), 2, "GLenum", texture, "const GLbyte *", coords) -TRACE_GL_VOID(glMultiTexCoord2bOES, (GLenum texture, GLbyte s, GLbyte t), (texture, s, t), 3, "GLenum", texture, "GLbyte", s, "GLbyte", t) -TRACE_GL_VOID(glMultiTexCoord2bvOES, (GLenum texture, const GLbyte * coords), (texture, coords), 2, "GLenum", texture, "const GLbyte *", coords) -TRACE_GL_VOID(glMultiTexCoord3bOES, (GLenum texture, GLbyte s, GLbyte t, GLbyte r), (texture, s, t, r), 4, "GLenum", texture, "GLbyte", s, "GLbyte", t, "GLbyte", r) -TRACE_GL_VOID(glMultiTexCoord3bvOES, (GLenum texture, const GLbyte * coords), (texture, coords), 2, "GLenum", texture, "const GLbyte *", coords) -TRACE_GL_VOID(glMultiTexCoord4bOES, (GLenum texture, GLbyte s, GLbyte t, GLbyte r, GLbyte q), (texture, s, t, r, q), 5, "GLenum", texture, "GLbyte", s, "GLbyte", t, "GLbyte", r, "GLbyte", q) -TRACE_GL_VOID(glMultiTexCoord4bvOES, (GLenum texture, const GLbyte * coords), (texture, coords), 2, "GLenum", texture, "const GLbyte *", coords) +TRACE_GL_VOID(glMultMatrixf, (const GLfloat *m), (m), 1, "const GLfloat *", m) +TRACE_GL_VOID(glMultMatrixx, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glMultMatrixxOES, (const GLfixed *m), (m), 1, "const GLfixed *", m) +TRACE_GL_VOID(glMultiDrawArraysEXT, (GLenum mode, GLint *first, GLsizei *count, GLsizei primcount), (mode, first, count, primcount), 4, "GLenum", mode, "GLint *", first, "GLsizei *", count, "GLsizei", primcount) +TRACE_GL_VOID(glMultiDrawElementsEXT, (GLenum mode, const GLsizei *count, GLenum type, const GLvoid* *indices, GLsizei primcount), (mode, count, type, indices, primcount), 5, "GLenum", mode, "const GLsizei *", count, "GLenum", type, "const GLvoid* *", indices, "GLsizei", primcount) TRACE_GL_VOID(glMultiTexCoord4f, (GLenum target, GLfloat s, GLfloat t, GLfloat r, GLfloat q), (target, s, t, r, q), 5, "GLenum", target, "GLfloat", s, "GLfloat", t, "GLfloat", r, "GLfloat", q) -TRACE_GL_VOID(glMultiTexCoord4x, (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (texture, s, t, r, q), 5, "GLenum", texture, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q) -TRACE_GL_VOID(glMultiTexCoord4xOES, (GLenum texture, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (texture, s, t, r, q), 5, "GLenum", texture, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q) +TRACE_GL_VOID(glMultiTexCoord4x, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q) +TRACE_GL_VOID(glMultiTexCoord4xOES, (GLenum target, GLfixed s, GLfixed t, GLfixed r, GLfixed q), (target, s, t, r, q), 5, "GLenum", target, "GLfixed", s, "GLfixed", t, "GLfixed", r, "GLfixed", q) TRACE_GL_VOID(glNormal3f, (GLfloat nx, GLfloat ny, GLfloat nz), (nx, ny, nz), 3, "GLfloat", nx, "GLfloat", ny, "GLfloat", nz) TRACE_GL_VOID(glNormal3x, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz) TRACE_GL_VOID(glNormal3xOES, (GLfixed nx, GLfixed ny, GLfixed nz), (nx, ny, nz), 3, "GLfixed", nx, "GLfixed", ny, "GLfixed", nz) -TRACE_GL_VOID(glNormalPointer, (GLenum type, GLsizei stride, const void * pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const void *", pointer) -TRACE_GL_VOID(glObjectLabelKHR, (GLenum identifier, GLuint name, GLsizei length, const GLchar * label), (identifier, name, length, label), 4, "GLenum", identifier, "GLuint", name, "GLsizei", length, "const GLchar *", label) -TRACE_GL_VOID(glObjectPtrLabelKHR, (const void * ptr, GLsizei length, const GLchar * label), (ptr, length, label), 3, "const void *", ptr, "GLsizei", length, "const GLchar *", label) -TRACE_GL_VOID(glOrthof, (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f), (l, r, b, t, n, f), 6, "GLfloat", l, "GLfloat", r, "GLfloat", b, "GLfloat", t, "GLfloat", n, "GLfloat", f) -TRACE_GL_VOID(glOrthofOES, (GLfloat l, GLfloat r, GLfloat b, GLfloat t, GLfloat n, GLfloat f), (l, r, b, t, n, f), 6, "GLfloat", l, "GLfloat", r, "GLfloat", b, "GLfloat", t, "GLfloat", n, "GLfloat", f) -TRACE_GL_VOID(glOrthox, (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f), (l, r, b, t, n, f), 6, "GLfixed", l, "GLfixed", r, "GLfixed", b, "GLfixed", t, "GLfixed", n, "GLfixed", f) -TRACE_GL_VOID(glOrthoxOES, (GLfixed l, GLfixed r, GLfixed b, GLfixed t, GLfixed n, GLfixed f), (l, r, b, t, n, f), 6, "GLfixed", l, "GLfixed", r, "GLfixed", b, "GLfixed", t, "GLfixed", n, "GLfixed", f) -TRACE_GL_VOID(glPatchParameteriEXT, (GLenum pname, GLint value), (pname, value), 2, "GLenum", pname, "GLint", value) -TRACE_GL_VOID(glPauseTransformFeedback, (void), (), 0) +TRACE_GL_VOID(glNormalPointer, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) +TRACE_GL_VOID(glOrthof, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glOrthofOES, (GLfloat left, GLfloat right, GLfloat bottom, GLfloat top, GLfloat zNear, GLfloat zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfloat", left, "GLfloat", right, "GLfloat", bottom, "GLfloat", top, "GLfloat", zNear, "GLfloat", zFar) +TRACE_GL_VOID(glOrthox, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) +TRACE_GL_VOID(glOrthoxOES, (GLfixed left, GLfixed right, GLfixed bottom, GLfixed top, GLfixed zNear, GLfixed zFar), (left, right, bottom, top, zNear, zFar), 6, "GLfixed", left, "GLfixed", right, "GLfixed", bottom, "GLfixed", top, "GLfixed", zNear, "GLfixed", zFar) TRACE_GL_VOID(glPixelStorei, (GLenum pname, GLint param), (pname, param), 2, "GLenum", pname, "GLint", param) TRACE_GL_VOID(glPointParameterf, (GLenum pname, GLfloat param), (pname, param), 2, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glPointParameterfv, (GLenum pname, const GLfloat * params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glPointParameterfv, (GLenum pname, const GLfloat *params), (pname, params), 2, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glPointParameterx, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glPointParameterxOES, (GLenum pname, GLfixed param), (pname, param), 2, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glPointParameterxv, (GLenum pname, const GLfixed * params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) -TRACE_GL_VOID(glPointParameterxvOES, (GLenum pname, const GLfixed * params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glPointParameterxv, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glPointParameterxvOES, (GLenum pname, const GLfixed *params), (pname, params), 2, "GLenum", pname, "const GLfixed *", params) TRACE_GL_VOID(glPointSize, (GLfloat size), (size), 1, "GLfloat", size) -TRACE_GL_VOID(glPointSizePointerOES, (GLenum type, GLsizei stride, const void * pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const void *", pointer) +TRACE_GL_VOID(glPointSizePointerOES, (GLenum type, GLsizei stride, const GLvoid *pointer), (type, stride, pointer), 3, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) TRACE_GL_VOID(glPointSizex, (GLfixed size), (size), 1, "GLfixed", size) TRACE_GL_VOID(glPointSizexOES, (GLfixed size), (size), 1, "GLfixed", size) TRACE_GL_VOID(glPolygonOffset, (GLfloat factor, GLfloat units), (factor, units), 2, "GLfloat", factor, "GLfloat", units) TRACE_GL_VOID(glPolygonOffsetx, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units) TRACE_GL_VOID(glPolygonOffsetxOES, (GLfixed factor, GLfixed units), (factor, units), 2, "GLfixed", factor, "GLfixed", units) -TRACE_GL_VOID(glPopDebugGroupKHR, (void), (), 0) TRACE_GL_VOID(glPopGroupMarkerEXT, (void), (), 0) TRACE_GL_VOID(glPopMatrix, (void), (), 0) -TRACE_GL_VOID(glPrimitiveBoundingBoxEXT, (GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW), (minX, minY, minZ, minW, maxX, maxY, maxZ, maxW), 8, "GLfloat", minX, "GLfloat", minY, "GLfloat", minZ, "GLfloat", minW, "GLfloat", maxX, "GLfloat", maxY, "GLfloat", maxZ, "GLfloat", maxW) -TRACE_GL_VOID(glProgramBinary, (GLuint program, GLenum binaryFormat, const void * binary, GLsizei length), (program, binaryFormat, binary, length), 4, "GLuint", program, "GLenum", binaryFormat, "const void *", binary, "GLsizei", length) -TRACE_GL_VOID(glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const void * binary, GLint length), (program, binaryFormat, binary, length), 4, "GLuint", program, "GLenum", binaryFormat, "const void *", binary, "GLint", length) -TRACE_GL_VOID(glProgramParameteri, (GLuint program, GLenum pname, GLint value), (program, pname, value), 3, "GLuint", program, "GLenum", pname, "GLint", value) +TRACE_GL_VOID(glProgramBinaryOES, (GLuint program, GLenum binaryFormat, const GLvoid *binary, GLint length), (program, binaryFormat, binary, length), 4, "GLuint", program, "GLenum", binaryFormat, "const GLvoid *", binary, "GLint", length) TRACE_GL_VOID(glProgramParameteriEXT, (GLuint program, GLenum pname, GLint value), (program, pname, value), 3, "GLuint", program, "GLenum", pname, "GLint", value) -TRACE_GL_VOID(glProgramUniform1f, (GLuint program, GLint location, GLfloat v0), (program, location, v0), 3, "GLuint", program, "GLint", location, "GLfloat", v0) -TRACE_GL_VOID(glProgramUniform1fEXT, (GLuint program, GLint location, GLfloat v0), (program, location, v0), 3, "GLuint", program, "GLint", location, "GLfloat", v0) -TRACE_GL_VOID(glProgramUniform1fv, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform1fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform1i, (GLuint program, GLint location, GLint v0), (program, location, v0), 3, "GLuint", program, "GLint", location, "GLint", v0) -TRACE_GL_VOID(glProgramUniform1iEXT, (GLuint program, GLint location, GLint v0), (program, location, v0), 3, "GLuint", program, "GLint", location, "GLint", v0) -TRACE_GL_VOID(glProgramUniform1iv, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform1ivEXT, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform1ui, (GLuint program, GLint location, GLuint v0), (program, location, v0), 3, "GLuint", program, "GLint", location, "GLuint", v0) -TRACE_GL_VOID(glProgramUniform1uiEXT, (GLuint program, GLint location, GLuint v0), (program, location, v0), 3, "GLuint", program, "GLint", location, "GLuint", v0) -TRACE_GL_VOID(glProgramUniform1uiv, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform1uivEXT, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform2f, (GLuint program, GLint location, GLfloat v0, GLfloat v1), (program, location, v0, v1), 4, "GLuint", program, "GLint", location, "GLfloat", v0, "GLfloat", v1) -TRACE_GL_VOID(glProgramUniform2fEXT, (GLuint program, GLint location, GLfloat v0, GLfloat v1), (program, location, v0, v1), 4, "GLuint", program, "GLint", location, "GLfloat", v0, "GLfloat", v1) -TRACE_GL_VOID(glProgramUniform2fv, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform2fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform2i, (GLuint program, GLint location, GLint v0, GLint v1), (program, location, v0, v1), 4, "GLuint", program, "GLint", location, "GLint", v0, "GLint", v1) -TRACE_GL_VOID(glProgramUniform2iEXT, (GLuint program, GLint location, GLint v0, GLint v1), (program, location, v0, v1), 4, "GLuint", program, "GLint", location, "GLint", v0, "GLint", v1) -TRACE_GL_VOID(glProgramUniform2iv, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform2ivEXT, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform2ui, (GLuint program, GLint location, GLuint v0, GLuint v1), (program, location, v0, v1), 4, "GLuint", program, "GLint", location, "GLuint", v0, "GLuint", v1) -TRACE_GL_VOID(glProgramUniform2uiEXT, (GLuint program, GLint location, GLuint v0, GLuint v1), (program, location, v0, v1), 4, "GLuint", program, "GLint", location, "GLuint", v0, "GLuint", v1) -TRACE_GL_VOID(glProgramUniform2uiv, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform2uivEXT, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform3f, (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2), (program, location, v0, v1, v2), 5, "GLuint", program, "GLint", location, "GLfloat", v0, "GLfloat", v1, "GLfloat", v2) -TRACE_GL_VOID(glProgramUniform3fEXT, (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2), (program, location, v0, v1, v2), 5, "GLuint", program, "GLint", location, "GLfloat", v0, "GLfloat", v1, "GLfloat", v2) -TRACE_GL_VOID(glProgramUniform3fv, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform3fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform3i, (GLuint program, GLint location, GLint v0, GLint v1, GLint v2), (program, location, v0, v1, v2), 5, "GLuint", program, "GLint", location, "GLint", v0, "GLint", v1, "GLint", v2) -TRACE_GL_VOID(glProgramUniform3iEXT, (GLuint program, GLint location, GLint v0, GLint v1, GLint v2), (program, location, v0, v1, v2), 5, "GLuint", program, "GLint", location, "GLint", v0, "GLint", v1, "GLint", v2) -TRACE_GL_VOID(glProgramUniform3iv, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform3ivEXT, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform3ui, (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2), (program, location, v0, v1, v2), 5, "GLuint", program, "GLint", location, "GLuint", v0, "GLuint", v1, "GLuint", v2) -TRACE_GL_VOID(glProgramUniform3uiEXT, (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2), (program, location, v0, v1, v2), 5, "GLuint", program, "GLint", location, "GLuint", v0, "GLuint", v1, "GLuint", v2) -TRACE_GL_VOID(glProgramUniform3uiv, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform3uivEXT, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform4f, (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3), (program, location, v0, v1, v2, v3), 6, "GLuint", program, "GLint", location, "GLfloat", v0, "GLfloat", v1, "GLfloat", v2, "GLfloat", v3) -TRACE_GL_VOID(glProgramUniform4fEXT, (GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3), (program, location, v0, v1, v2, v3), 6, "GLuint", program, "GLint", location, "GLfloat", v0, "GLfloat", v1, "GLfloat", v2, "GLfloat", v3) -TRACE_GL_VOID(glProgramUniform4fv, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform4fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniform4i, (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3), (program, location, v0, v1, v2, v3), 6, "GLuint", program, "GLint", location, "GLint", v0, "GLint", v1, "GLint", v2, "GLint", v3) -TRACE_GL_VOID(glProgramUniform4iEXT, (GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3), (program, location, v0, v1, v2, v3), 6, "GLuint", program, "GLint", location, "GLint", v0, "GLint", v1, "GLint", v2, "GLint", v3) -TRACE_GL_VOID(glProgramUniform4iv, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform4ivEXT, (GLuint program, GLint location, GLsizei count, const GLint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glProgramUniform4ui, (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3), (program, location, v0, v1, v2, v3), 6, "GLuint", program, "GLint", location, "GLuint", v0, "GLuint", v1, "GLuint", v2, "GLuint", v3) -TRACE_GL_VOID(glProgramUniform4uiEXT, (GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3), (program, location, v0, v1, v2, v3), 6, "GLuint", program, "GLint", location, "GLuint", v0, "GLuint", v1, "GLuint", v2, "GLuint", v3) -TRACE_GL_VOID(glProgramUniform4uiv, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniform4uivEXT, (GLuint program, GLint location, GLsizei count, const GLuint * value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glProgramUniformMatrix2fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix2fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix2x3fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix2x3fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix2x4fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix2x4fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix3fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix3fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix3x2fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix3x2fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix3x4fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix3x4fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix4fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix4fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix4x2fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix4x2fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix4x3fv, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glProgramUniformMatrix4x3fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glPushDebugGroupKHR, (GLenum source, GLuint id, GLsizei length, const GLchar * message), (source, id, length, message), 4, "GLenum", source, "GLuint", id, "GLsizei", length, "const GLchar *", message) -TRACE_GL_VOID(glPushGroupMarkerEXT, (GLsizei length, const GLchar * marker), (length, marker), 2, "GLsizei", length, "const GLchar *", marker) +TRACE_GL_VOID(glProgramUniform1fEXT, (GLuint program, GLint location, GLfloat x), (program, location, x), 3, "GLuint", program, "GLint", location, "GLfloat", x) +TRACE_GL_VOID(glProgramUniform1fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) +TRACE_GL_VOID(glProgramUniform1iEXT, (GLuint program, GLint location, GLint x), (program, location, x), 3, "GLuint", program, "GLint", location, "GLint", x) +TRACE_GL_VOID(glProgramUniform1ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) +TRACE_GL_VOID(glProgramUniform2fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y), (program, location, x, y), 4, "GLuint", program, "GLint", location, "GLfloat", x, "GLfloat", y) +TRACE_GL_VOID(glProgramUniform2fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) +TRACE_GL_VOID(glProgramUniform2iEXT, (GLuint program, GLint location, GLint x, GLint y), (program, location, x, y), 4, "GLuint", program, "GLint", location, "GLint", x, "GLint", y) +TRACE_GL_VOID(glProgramUniform2ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) +TRACE_GL_VOID(glProgramUniform3fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z), (program, location, x, y, z), 5, "GLuint", program, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z) +TRACE_GL_VOID(glProgramUniform3fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) +TRACE_GL_VOID(glProgramUniform3iEXT, (GLuint program, GLint location, GLint x, GLint y, GLint z), (program, location, x, y, z), 5, "GLuint", program, "GLint", location, "GLint", x, "GLint", y, "GLint", z) +TRACE_GL_VOID(glProgramUniform3ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) +TRACE_GL_VOID(glProgramUniform4fEXT, (GLuint program, GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (program, location, x, y, z, w), 6, "GLuint", program, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w) +TRACE_GL_VOID(glProgramUniform4fvEXT, (GLuint program, GLint location, GLsizei count, const GLfloat *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLfloat *", value) +TRACE_GL_VOID(glProgramUniform4iEXT, (GLuint program, GLint location, GLint x, GLint y, GLint z, GLint w), (program, location, x, y, z, w), 6, "GLuint", program, "GLint", location, "GLint", x, "GLint", y, "GLint", z, "GLint", w) +TRACE_GL_VOID(glProgramUniform4ivEXT, (GLuint program, GLint location, GLsizei count, const GLint *value), (program, location, count, value), 4, "GLuint", program, "GLint", location, "GLsizei", count, "const GLint *", value) +TRACE_GL_VOID(glProgramUniformMatrix2fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) +TRACE_GL_VOID(glProgramUniformMatrix3fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) +TRACE_GL_VOID(glProgramUniformMatrix4fvEXT, (GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value), (program, location, count, transpose, value), 5, "GLuint", program, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) +TRACE_GL_VOID(glPushGroupMarkerEXT, (GLsizei length, const GLchar *marker), (length, marker), 2, "GLsizei", length, "const GLchar *", marker) TRACE_GL_VOID(glPushMatrix, (void), (), 0) -TRACE_GL_VOID(glQueryCounterEXT, (GLuint id, GLenum target), (id, target), 2, "GLuint", id, "GLenum", target) -TRACE_GL(GLbitfield, glQueryMatrixxOES, (GLfixed * mantissa, GLint * exponent), (mantissa, exponent), 2, "GLfixed *", mantissa, "GLint *", exponent) -TRACE_GL_VOID(glReadBuffer, (GLenum mode), (mode), 1, "GLenum", mode) -TRACE_GL_VOID(glReadBufferIndexedEXT, (GLenum src, GLint index), (src, index), 2, "GLenum", src, "GLint", index) +TRACE_GL(GLbitfield, glQueryMatrixxOES, (GLfixed mantissa[16], GLint exponent[16]), (mantissa, exponent), 2, "GLfixed", mantissa, "GLint", exponent) TRACE_GL_VOID(glReadBufferNV, (GLenum mode), (mode), 1, "GLenum", mode) -TRACE_GL_VOID(glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, void * pixels), (x, y, width, height, format, type, pixels), 7, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "void *", pixels) -TRACE_GL_VOID(glReadnPixelsEXT, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void * data), (x, y, width, height, format, type, bufSize, data), 8, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "GLsizei", bufSize, "void *", data) +TRACE_GL_VOID(glReadPixels, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels), (x, y, width, height, format, type, pixels), 7, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "GLvoid *", pixels) +TRACE_GL_VOID(glReadnPixelsEXT, (GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLsizei bufSize, void *data), (x, y, width, height, format, type, bufSize, data), 8, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "GLsizei", bufSize, "void *", data) TRACE_GL_VOID(glReleaseShaderCompiler, (void), (), 0) TRACE_GL_VOID(glRenderbufferStorage, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height), 4, "GLenum", target, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glRenderbufferStorageMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glRenderbufferStorageMultisampleANGLE, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glRenderbufferStorageMultisampleAPPLE, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glRenderbufferStorageMultisampleEXT, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glRenderbufferStorageMultisampleIMG, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glRenderbufferStorageMultisampleNV, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height), (target, samples, internalformat, width, height), 5, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glRenderbufferStorageOES, (GLenum target, GLenum internalformat, GLsizei width, GLsizei height), (target, internalformat, width, height), 4, "GLenum", target, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glResolveMultisampleFramebufferAPPLE, (void), (), 0) -TRACE_GL_VOID(glResumeTransformFeedback, (void), (), 0) TRACE_GL_VOID(glRotatef, (GLfloat angle, GLfloat x, GLfloat y, GLfloat z), (angle, x, y, z), 4, "GLfloat", angle, "GLfloat", x, "GLfloat", y, "GLfloat", z) TRACE_GL_VOID(glRotatex, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z) TRACE_GL_VOID(glRotatexOES, (GLfixed angle, GLfixed x, GLfixed y, GLfixed z), (angle, x, y, z), 4, "GLfixed", angle, "GLfixed", x, "GLfixed", y, "GLfixed", z) -TRACE_GL_VOID(glSampleCoverage, (GLfloat value, GLboolean invert), (value, invert), 2, "GLfloat", value, "GLboolean", invert) -TRACE_GL_VOID(glSampleCoverageOES, (GLfixed value, GLboolean invert), (value, invert), 2, "GLfixed", value, "GLboolean", invert) +TRACE_GL_VOID(glSampleCoverage, (GLclampf value, GLboolean invert), (value, invert), 2, "GLclampf", value, "GLboolean", invert) TRACE_GL_VOID(glSampleCoveragex, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert) TRACE_GL_VOID(glSampleCoveragexOES, (GLclampx value, GLboolean invert), (value, invert), 2, "GLclampx", value, "GLboolean", invert) -TRACE_GL_VOID(glSampleMaski, (GLuint maskNumber, GLbitfield mask), (maskNumber, mask), 2, "GLuint", maskNumber, "GLbitfield", mask) -TRACE_GL_VOID(glSamplerParameterIivEXT, (GLuint sampler, GLenum pname, const GLint * param), (sampler, pname, param), 3, "GLuint", sampler, "GLenum", pname, "const GLint *", param) -TRACE_GL_VOID(glSamplerParameterIuivEXT, (GLuint sampler, GLenum pname, const GLuint * param), (sampler, pname, param), 3, "GLuint", sampler, "GLenum", pname, "const GLuint *", param) -TRACE_GL_VOID(glSamplerParameterf, (GLuint sampler, GLenum pname, GLfloat param), (sampler, pname, param), 3, "GLuint", sampler, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glSamplerParameterfv, (GLuint sampler, GLenum pname, const GLfloat * param), (sampler, pname, param), 3, "GLuint", sampler, "GLenum", pname, "const GLfloat *", param) -TRACE_GL_VOID(glSamplerParameteri, (GLuint sampler, GLenum pname, GLint param), (sampler, pname, param), 3, "GLuint", sampler, "GLenum", pname, "GLint", param) -TRACE_GL_VOID(glSamplerParameteriv, (GLuint sampler, GLenum pname, const GLint * param), (sampler, pname, param), 3, "GLuint", sampler, "GLenum", pname, "const GLint *", param) TRACE_GL_VOID(glScalef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z) TRACE_GL_VOID(glScalex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) TRACE_GL_VOID(glScalexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) TRACE_GL_VOID(glScissor, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height), 4, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glSelectPerfMonitorCountersAMD, (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint * counterList), (monitor, enable, group, numCounters, counterList), 5, "GLuint", monitor, "GLboolean", enable, "GLuint", group, "GLint", numCounters, "GLuint *", counterList) +TRACE_GL_VOID(glSelectPerfMonitorCountersAMD, (GLuint monitor, GLboolean enable, GLuint group, GLint numCounters, GLuint *countersList), (monitor, enable, group, numCounters, countersList), 5, "GLuint", monitor, "GLboolean", enable, "GLuint", group, "GLint", numCounters, "GLuint *", countersList) TRACE_GL_VOID(glSetFenceNV, (GLuint fence, GLenum condition), (fence, condition), 2, "GLuint", fence, "GLenum", condition) TRACE_GL_VOID(glShadeModel, (GLenum mode), (mode), 1, "GLenum", mode) -TRACE_GL_VOID(glShaderBinary, (GLsizei count, const GLuint * shaders, GLenum binaryformat, const void * binary, GLsizei length), (count, shaders, binaryformat, binary, length), 5, "GLsizei", count, "const GLuint *", shaders, "GLenum", binaryformat, "const void *", binary, "GLsizei", length) -TRACE_GL_VOID(glShaderSource, (GLuint shader, GLsizei count, const GLchar *const* string, const GLint * length), (shader, count, string, length), 4, "GLuint", shader, "GLsizei", count, "const GLchar *const*", string, "const GLint *", length) +TRACE_GL_VOID(glShaderBinary, (GLsizei n, const GLuint* shaders, GLenum binaryformat, const GLvoid* binary, GLsizei length), (n, shaders, binaryformat, binary, length), 5, "GLsizei", n, "const GLuint*", shaders, "GLenum", binaryformat, "const GLvoid*", binary, "GLsizei", length) +TRACE_GL_VOID(glShaderSource, (GLuint shader, GLsizei count, const GLchar** string, const GLint* length), (shader, count, string, length), 4, "GLuint", shader, "GLsizei", count, "const GLchar**", string, "const GLint*", length) TRACE_GL_VOID(glStartTilingQCOM, (GLuint x, GLuint y, GLuint width, GLuint height, GLbitfield preserveMask), (x, y, width, height, preserveMask), 5, "GLuint", x, "GLuint", y, "GLuint", width, "GLuint", height, "GLbitfield", preserveMask) TRACE_GL_VOID(glStencilFunc, (GLenum func, GLint ref, GLuint mask), (func, ref, mask), 3, "GLenum", func, "GLint", ref, "GLuint", mask) TRACE_GL_VOID(glStencilFuncSeparate, (GLenum face, GLenum func, GLint ref, GLuint mask), (face, func, ref, mask), 4, "GLenum", face, "GLenum", func, "GLint", ref, "GLuint", mask) TRACE_GL_VOID(glStencilMask, (GLuint mask), (mask), 1, "GLuint", mask) TRACE_GL_VOID(glStencilMaskSeparate, (GLenum face, GLuint mask), (face, mask), 2, "GLenum", face, "GLuint", mask) TRACE_GL_VOID(glStencilOp, (GLenum fail, GLenum zfail, GLenum zpass), (fail, zfail, zpass), 3, "GLenum", fail, "GLenum", zfail, "GLenum", zpass) -TRACE_GL_VOID(glStencilOpSeparate, (GLenum face, GLenum sfail, GLenum dpfail, GLenum dppass), (face, sfail, dpfail, dppass), 4, "GLenum", face, "GLenum", sfail, "GLenum", dpfail, "GLenum", dppass) +TRACE_GL_VOID(glStencilOpSeparate, (GLenum face, GLenum fail, GLenum zfail, GLenum zpass), (face, fail, zfail, zpass), 4, "GLenum", face, "GLenum", fail, "GLenum", zfail, "GLenum", zpass) TRACE_GL(GLboolean, glTestFenceNV, (GLuint fence), (fence), 1, "GLuint", fence) -TRACE_GL_VOID(glTexBufferEXT, (GLenum target, GLenum internalformat, GLuint buffer), (target, internalformat, buffer), 3, "GLenum", target, "GLenum", internalformat, "GLuint", buffer) -TRACE_GL_VOID(glTexBufferRangeEXT, (GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size), (target, internalformat, buffer, offset, size), 5, "GLenum", target, "GLenum", internalformat, "GLuint", buffer, "GLintptr", offset, "GLsizeiptr", size) -TRACE_GL_VOID(glTexCoord1bOES, (GLbyte s), (s), 1, "GLbyte", s) -TRACE_GL_VOID(glTexCoord1bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glTexCoord2bOES, (GLbyte s, GLbyte t), (s, t), 2, "GLbyte", s, "GLbyte", t) -TRACE_GL_VOID(glTexCoord2bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glTexCoord3bOES, (GLbyte s, GLbyte t, GLbyte r), (s, t, r), 3, "GLbyte", s, "GLbyte", t, "GLbyte", r) -TRACE_GL_VOID(glTexCoord3bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glTexCoord4bOES, (GLbyte s, GLbyte t, GLbyte r, GLbyte q), (s, t, r, q), 4, "GLbyte", s, "GLbyte", t, "GLbyte", r, "GLbyte", q) -TRACE_GL_VOID(glTexCoord4bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const void * pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const void *", pointer) +TRACE_GL_VOID(glTexCoordPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) TRACE_GL_VOID(glTexEnvf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glTexEnvfv, (GLenum target, GLenum pname, const GLfloat * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glTexEnvfv, (GLenum target, GLenum pname, const GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glTexEnvi, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param) -TRACE_GL_VOID(glTexEnviv, (GLenum target, GLenum pname, const GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params) +TRACE_GL_VOID(glTexEnviv, (GLenum target, GLenum pname, const GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params) TRACE_GL_VOID(glTexEnvx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glTexEnvxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glTexEnvxv, (GLenum target, GLenum pname, const GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) -TRACE_GL_VOID(glTexEnvxvOES, (GLenum target, GLenum pname, const GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexEnvxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexEnvxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) TRACE_GL_VOID(glTexGenfOES, (GLenum coord, GLenum pname, GLfloat param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glTexGenfvOES, (GLenum coord, GLenum pname, const GLfloat * params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glTexGenfvOES, (GLenum coord, GLenum pname, const GLfloat *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glTexGeniOES, (GLenum coord, GLenum pname, GLint param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLint", param) -TRACE_GL_VOID(glTexGenivOES, (GLenum coord, GLenum pname, const GLint * params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLint *", params) +TRACE_GL_VOID(glTexGenivOES, (GLenum coord, GLenum pname, const GLint *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLint *", params) TRACE_GL_VOID(glTexGenxOES, (GLenum coord, GLenum pname, GLfixed param), (coord, pname, param), 3, "GLenum", coord, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glTexGenxvOES, (GLenum coord, GLenum pname, const GLfixed * params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfixed *", params) -TRACE_GL_VOID(glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const void * pixels), (target, level, internalformat, width, height, border, format, type, pixels), 9, "GLenum", target, "GLint", level, "GLint", internalformat, "GLsizei", width, "GLsizei", height, "GLint", border, "GLenum", format, "GLenum", type, "const void *", pixels) -TRACE_GL_VOID(glTexImage3D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels), (target, level, internalformat, width, height, depth, border, format, type, pixels), 10, "GLenum", target, "GLint", level, "GLint", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLenum", format, "GLenum", type, "const void *", pixels) -TRACE_GL_VOID(glTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const void * pixels), (target, level, internalformat, width, height, depth, border, format, type, pixels), 10, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLenum", format, "GLenum", type, "const void *", pixels) -TRACE_GL_VOID(glTexParameterIivEXT, (GLenum target, GLenum pname, const GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params) -TRACE_GL_VOID(glTexParameterIuivEXT, (GLenum target, GLenum pname, const GLuint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLuint *", params) +TRACE_GL_VOID(glTexGenxvOES, (GLenum coord, GLenum pname, const GLfixed *params), (coord, pname, params), 3, "GLenum", coord, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexImage2D, (GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels), (target, level, internalformat, width, height, border, format, type, pixels), 9, "GLenum", target, "GLint", level, "GLint", internalformat, "GLsizei", width, "GLsizei", height, "GLint", border, "GLenum", format, "GLenum", type, "const GLvoid *", pixels) +TRACE_GL_VOID(glTexImage3DOES, (GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid* pixels), (target, level, internalformat, width, height, depth, border, format, type, pixels), 10, "GLenum", target, "GLint", level, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLint", border, "GLenum", format, "GLenum", type, "const GLvoid*", pixels) TRACE_GL_VOID(glTexParameterf, (GLenum target, GLenum pname, GLfloat param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfloat", param) -TRACE_GL_VOID(glTexParameterfv, (GLenum target, GLenum pname, const GLfloat * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params) +TRACE_GL_VOID(glTexParameterfv, (GLenum target, GLenum pname, const GLfloat *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfloat *", params) TRACE_GL_VOID(glTexParameteri, (GLenum target, GLenum pname, GLint param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLint", param) -TRACE_GL_VOID(glTexParameteriv, (GLenum target, GLenum pname, const GLint * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params) +TRACE_GL_VOID(glTexParameteriv, (GLenum target, GLenum pname, const GLint *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLint *", params) TRACE_GL_VOID(glTexParameterx, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) TRACE_GL_VOID(glTexParameterxOES, (GLenum target, GLenum pname, GLfixed param), (target, pname, param), 3, "GLenum", target, "GLenum", pname, "GLfixed", param) -TRACE_GL_VOID(glTexParameterxv, (GLenum target, GLenum pname, const GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) -TRACE_GL_VOID(glTexParameterxvOES, (GLenum target, GLenum pname, const GLfixed * params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexParameterxv, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) +TRACE_GL_VOID(glTexParameterxvOES, (GLenum target, GLenum pname, const GLfixed *params), (target, pname, params), 3, "GLenum", target, "GLenum", pname, "const GLfixed *", params) TRACE_GL_VOID(glTexStorage1DEXT, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width), (target, levels, internalformat, width), 4, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width) -TRACE_GL_VOID(glTexStorage2D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height), (target, levels, internalformat, width, height), 5, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glTexStorage2DEXT, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height), (target, levels, internalformat, width, height), 5, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glTexStorage2DMultisample, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations), (target, samples, internalformat, width, height, fixedsamplelocations), 6, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLboolean", fixedsamplelocations) -TRACE_GL_VOID(glTexStorage3D, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth), (target, levels, internalformat, width, height, depth), 6, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth) TRACE_GL_VOID(glTexStorage3DEXT, (GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth), (target, levels, internalformat, width, height, depth), 6, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth) -TRACE_GL_VOID(glTexStorage3DMultisampleOES, (GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations), (target, samples, internalformat, width, height, depth, fixedsamplelocations), 7, "GLenum", target, "GLsizei", samples, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLboolean", fixedsamplelocations) -TRACE_GL_VOID(glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const void * pixels), (target, level, xoffset, yoffset, width, height, format, type, pixels), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "const void *", pixels) -TRACE_GL_VOID(glTexSubImage3D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "const void *", pixels) -TRACE_GL_VOID(glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const void * pixels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "const void *", pixels) +TRACE_GL_VOID(glTexSubImage2D, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels), (target, level, xoffset, yoffset, width, height, format, type, pixels), 9, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLsizei", width, "GLsizei", height, "GLenum", format, "GLenum", type, "const GLvoid *", pixels) +TRACE_GL_VOID(glTexSubImage3DOES, (GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid* pixels), (target, level, xoffset, yoffset, zoffset, width, height, depth, format, type, pixels), 11, "GLenum", target, "GLint", level, "GLint", xoffset, "GLint", yoffset, "GLint", zoffset, "GLsizei", width, "GLsizei", height, "GLsizei", depth, "GLenum", format, "GLenum", type, "const GLvoid*", pixels) TRACE_GL_VOID(glTextureStorage1DEXT, (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width), (texture, target, levels, internalformat, width), 5, "GLuint", texture, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width) TRACE_GL_VOID(glTextureStorage2DEXT, (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height), (texture, target, levels, internalformat, width, height), 6, "GLuint", texture, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height) TRACE_GL_VOID(glTextureStorage3DEXT, (GLuint texture, GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth), (texture, target, levels, internalformat, width, height, depth), 7, "GLuint", texture, "GLenum", target, "GLsizei", levels, "GLenum", internalformat, "GLsizei", width, "GLsizei", height, "GLsizei", depth) -TRACE_GL_VOID(glTextureViewEXT, (GLuint texture, GLenum target, GLuint origtexture, GLenum internalformat, GLuint minlevel, GLuint numlevels, GLuint minlayer, GLuint numlayers), (texture, target, origtexture, internalformat, minlevel, numlevels, minlayer, numlayers), 8, "GLuint", texture, "GLenum", target, "GLuint", origtexture, "GLenum", internalformat, "GLuint", minlevel, "GLuint", numlevels, "GLuint", minlayer, "GLuint", numlayers) -TRACE_GL_VOID(glTransformFeedbackVaryings, (GLuint program, GLsizei count, const GLchar *const* varyings, GLenum bufferMode), (program, count, varyings, bufferMode), 4, "GLuint", program, "GLsizei", count, "const GLchar *const*", varyings, "GLenum", bufferMode) TRACE_GL_VOID(glTranslatef, (GLfloat x, GLfloat y, GLfloat z), (x, y, z), 3, "GLfloat", x, "GLfloat", y, "GLfloat", z) TRACE_GL_VOID(glTranslatex, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) TRACE_GL_VOID(glTranslatexOES, (GLfixed x, GLfixed y, GLfixed z), (x, y, z), 3, "GLfixed", x, "GLfixed", y, "GLfixed", z) -TRACE_GL_VOID(glUniform1f, (GLint location, GLfloat v0), (location, v0), 2, "GLint", location, "GLfloat", v0) -TRACE_GL_VOID(glUniform1fv, (GLint location, GLsizei count, const GLfloat * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glUniform1i, (GLint location, GLint v0), (location, v0), 2, "GLint", location, "GLint", v0) -TRACE_GL_VOID(glUniform1iv, (GLint location, GLsizei count, const GLint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glUniform1ui, (GLint location, GLuint v0), (location, v0), 2, "GLint", location, "GLuint", v0) -TRACE_GL_VOID(glUniform1uiv, (GLint location, GLsizei count, const GLuint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glUniform2f, (GLint location, GLfloat v0, GLfloat v1), (location, v0, v1), 3, "GLint", location, "GLfloat", v0, "GLfloat", v1) -TRACE_GL_VOID(glUniform2fv, (GLint location, GLsizei count, const GLfloat * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glUniform2i, (GLint location, GLint v0, GLint v1), (location, v0, v1), 3, "GLint", location, "GLint", v0, "GLint", v1) -TRACE_GL_VOID(glUniform2iv, (GLint location, GLsizei count, const GLint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glUniform2ui, (GLint location, GLuint v0, GLuint v1), (location, v0, v1), 3, "GLint", location, "GLuint", v0, "GLuint", v1) -TRACE_GL_VOID(glUniform2uiv, (GLint location, GLsizei count, const GLuint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glUniform3f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2), (location, v0, v1, v2), 4, "GLint", location, "GLfloat", v0, "GLfloat", v1, "GLfloat", v2) -TRACE_GL_VOID(glUniform3fv, (GLint location, GLsizei count, const GLfloat * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glUniform3i, (GLint location, GLint v0, GLint v1, GLint v2), (location, v0, v1, v2), 4, "GLint", location, "GLint", v0, "GLint", v1, "GLint", v2) -TRACE_GL_VOID(glUniform3iv, (GLint location, GLsizei count, const GLint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glUniform3ui, (GLint location, GLuint v0, GLuint v1, GLuint v2), (location, v0, v1, v2), 4, "GLint", location, "GLuint", v0, "GLuint", v1, "GLuint", v2) -TRACE_GL_VOID(glUniform3uiv, (GLint location, GLsizei count, const GLuint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glUniform4f, (GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3), (location, v0, v1, v2, v3), 5, "GLint", location, "GLfloat", v0, "GLfloat", v1, "GLfloat", v2, "GLfloat", v3) -TRACE_GL_VOID(glUniform4fv, (GLint location, GLsizei count, const GLfloat * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLfloat *", value) -TRACE_GL_VOID(glUniform4i, (GLint location, GLint v0, GLint v1, GLint v2, GLint v3), (location, v0, v1, v2, v3), 5, "GLint", location, "GLint", v0, "GLint", v1, "GLint", v2, "GLint", v3) -TRACE_GL_VOID(glUniform4iv, (GLint location, GLsizei count, const GLint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLint *", value) -TRACE_GL_VOID(glUniform4ui, (GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3), (location, v0, v1, v2, v3), 5, "GLint", location, "GLuint", v0, "GLuint", v1, "GLuint", v2, "GLuint", v3) -TRACE_GL_VOID(glUniform4uiv, (GLint location, GLsizei count, const GLuint * value), (location, count, value), 3, "GLint", location, "GLsizei", count, "const GLuint *", value) -TRACE_GL_VOID(glUniformBlockBinding, (GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding), (program, uniformBlockIndex, uniformBlockBinding), 3, "GLuint", program, "GLuint", uniformBlockIndex, "GLuint", uniformBlockBinding) -TRACE_GL_VOID(glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix2x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix2x3fvNV, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix2x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix2x4fvNV, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix3x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix3x2fvNV, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix3x4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix3x4fvNV, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix4x2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix4x2fvNV, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix4x3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL_VOID(glUniformMatrix4x3fvNV, (GLint location, GLsizei count, GLboolean transpose, const GLfloat * value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat *", value) -TRACE_GL(GLboolean, glUnmapBuffer, (GLenum target), (target), 1, "GLenum", target) +TRACE_GL_VOID(glUniform1f, (GLint location, GLfloat x), (location, x), 2, "GLint", location, "GLfloat", x) +TRACE_GL_VOID(glUniform1fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v) +TRACE_GL_VOID(glUniform1i, (GLint location, GLint x), (location, x), 2, "GLint", location, "GLint", x) +TRACE_GL_VOID(glUniform1iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v) +TRACE_GL_VOID(glUniform2f, (GLint location, GLfloat x, GLfloat y), (location, x, y), 3, "GLint", location, "GLfloat", x, "GLfloat", y) +TRACE_GL_VOID(glUniform2fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v) +TRACE_GL_VOID(glUniform2i, (GLint location, GLint x, GLint y), (location, x, y), 3, "GLint", location, "GLint", x, "GLint", y) +TRACE_GL_VOID(glUniform2iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v) +TRACE_GL_VOID(glUniform3f, (GLint location, GLfloat x, GLfloat y, GLfloat z), (location, x, y, z), 4, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z) +TRACE_GL_VOID(glUniform3fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v) +TRACE_GL_VOID(glUniform3i, (GLint location, GLint x, GLint y, GLint z), (location, x, y, z), 4, "GLint", location, "GLint", x, "GLint", y, "GLint", z) +TRACE_GL_VOID(glUniform3iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v) +TRACE_GL_VOID(glUniform4f, (GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (location, x, y, z, w), 5, "GLint", location, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w) +TRACE_GL_VOID(glUniform4fv, (GLint location, GLsizei count, const GLfloat* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLfloat*", v) +TRACE_GL_VOID(glUniform4i, (GLint location, GLint x, GLint y, GLint z, GLint w), (location, x, y, z, w), 5, "GLint", location, "GLint", x, "GLint", y, "GLint", z, "GLint", w) +TRACE_GL_VOID(glUniform4iv, (GLint location, GLsizei count, const GLint* v), (location, count, v), 3, "GLint", location, "GLsizei", count, "const GLint*", v) +TRACE_GL_VOID(glUniformMatrix2fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat*", value) +TRACE_GL_VOID(glUniformMatrix3fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat*", value) +TRACE_GL_VOID(glUniformMatrix4fv, (GLint location, GLsizei count, GLboolean transpose, const GLfloat* value), (location, count, transpose, value), 4, "GLint", location, "GLsizei", count, "GLboolean", transpose, "const GLfloat*", value) TRACE_GL(GLboolean, glUnmapBufferOES, (GLenum target), (target), 1, "GLenum", target) TRACE_GL_VOID(glUseProgram, (GLuint program), (program), 1, "GLuint", program) -TRACE_GL_VOID(glUseProgramStages, (GLuint pipeline, GLbitfield stages, GLuint program), (pipeline, stages, program), 3, "GLuint", pipeline, "GLbitfield", stages, "GLuint", program) TRACE_GL_VOID(glUseProgramStagesEXT, (GLuint pipeline, GLbitfield stages, GLuint program), (pipeline, stages, program), 3, "GLuint", pipeline, "GLbitfield", stages, "GLuint", program) TRACE_GL_VOID(glValidateProgram, (GLuint program), (program), 1, "GLuint", program) -TRACE_GL_VOID(glValidateProgramPipeline, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline) TRACE_GL_VOID(glValidateProgramPipelineEXT, (GLuint pipeline), (pipeline), 1, "GLuint", pipeline) -TRACE_GL_VOID(glVertex2bOES, (GLbyte x), (x), 1, "GLbyte", x) -TRACE_GL_VOID(glVertex2bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glVertex3bOES, (GLbyte x, GLbyte y), (x, y), 2, "GLbyte", x, "GLbyte", y) -TRACE_GL_VOID(glVertex3bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glVertex4bOES, (GLbyte x, GLbyte y, GLbyte z), (x, y, z), 3, "GLbyte", x, "GLbyte", y, "GLbyte", z) -TRACE_GL_VOID(glVertex4bvOES, (const GLbyte * coords), (coords), 1, "const GLbyte *", coords) -TRACE_GL_VOID(glVertexAttrib1f, (GLuint index, GLfloat x), (index, x), 2, "GLuint", index, "GLfloat", x) -TRACE_GL_VOID(glVertexAttrib1fv, (GLuint index, const GLfloat * v), (index, v), 2, "GLuint", index, "const GLfloat *", v) -TRACE_GL_VOID(glVertexAttrib2f, (GLuint index, GLfloat x, GLfloat y), (index, x, y), 3, "GLuint", index, "GLfloat", x, "GLfloat", y) -TRACE_GL_VOID(glVertexAttrib2fv, (GLuint index, const GLfloat * v), (index, v), 2, "GLuint", index, "const GLfloat *", v) -TRACE_GL_VOID(glVertexAttrib3f, (GLuint index, GLfloat x, GLfloat y, GLfloat z), (index, x, y, z), 4, "GLuint", index, "GLfloat", x, "GLfloat", y, "GLfloat", z) -TRACE_GL_VOID(glVertexAttrib3fv, (GLuint index, const GLfloat * v), (index, v), 2, "GLuint", index, "const GLfloat *", v) -TRACE_GL_VOID(glVertexAttrib4f, (GLuint index, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (index, x, y, z, w), 5, "GLuint", index, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w) -TRACE_GL_VOID(glVertexAttrib4fv, (GLuint index, const GLfloat * v), (index, v), 2, "GLuint", index, "const GLfloat *", v) -TRACE_GL_VOID(glVertexAttribBinding, (GLuint attribindex, GLuint bindingindex), (attribindex, bindingindex), 2, "GLuint", attribindex, "GLuint", bindingindex) -TRACE_GL_VOID(glVertexAttribDivisor, (GLuint index, GLuint divisor), (index, divisor), 2, "GLuint", index, "GLuint", divisor) -TRACE_GL_VOID(glVertexAttribDivisorANGLE, (GLuint index, GLuint divisor), (index, divisor), 2, "GLuint", index, "GLuint", divisor) -TRACE_GL_VOID(glVertexAttribDivisorEXT, (GLuint index, GLuint divisor), (index, divisor), 2, "GLuint", index, "GLuint", divisor) -TRACE_GL_VOID(glVertexAttribDivisorNV, (GLuint index, GLuint divisor), (index, divisor), 2, "GLuint", index, "GLuint", divisor) -TRACE_GL_VOID(glVertexAttribFormat, (GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset), (attribindex, size, type, normalized, relativeoffset), 5, "GLuint", attribindex, "GLint", size, "GLenum", type, "GLboolean", normalized, "GLuint", relativeoffset) -TRACE_GL_VOID(glVertexAttribI4i, (GLuint index, GLint x, GLint y, GLint z, GLint w), (index, x, y, z, w), 5, "GLuint", index, "GLint", x, "GLint", y, "GLint", z, "GLint", w) -TRACE_GL_VOID(glVertexAttribI4iv, (GLuint index, const GLint * v), (index, v), 2, "GLuint", index, "const GLint *", v) -TRACE_GL_VOID(glVertexAttribI4ui, (GLuint index, GLuint x, GLuint y, GLuint z, GLuint w), (index, x, y, z, w), 5, "GLuint", index, "GLuint", x, "GLuint", y, "GLuint", z, "GLuint", w) -TRACE_GL_VOID(glVertexAttribI4uiv, (GLuint index, const GLuint * v), (index, v), 2, "GLuint", index, "const GLuint *", v) -TRACE_GL_VOID(glVertexAttribIFormat, (GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset), (attribindex, size, type, relativeoffset), 4, "GLuint", attribindex, "GLint", size, "GLenum", type, "GLuint", relativeoffset) -TRACE_GL_VOID(glVertexAttribIPointer, (GLuint index, GLint size, GLenum type, GLsizei stride, const void * pointer), (index, size, type, stride, pointer), 5, "GLuint", index, "GLint", size, "GLenum", type, "GLsizei", stride, "const void *", pointer) -TRACE_GL_VOID(glVertexAttribPointer, (GLuint index, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const void * pointer), (index, size, type, normalized, stride, pointer), 6, "GLuint", index, "GLint", size, "GLenum", type, "GLboolean", normalized, "GLsizei", stride, "const void *", pointer) -TRACE_GL_VOID(glVertexBindingDivisor, (GLuint bindingindex, GLuint divisor), (bindingindex, divisor), 2, "GLuint", bindingindex, "GLuint", divisor) -TRACE_GL_VOID(glVertexPointer, (GLint size, GLenum type, GLsizei stride, const void * pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const void *", pointer) +TRACE_GL_VOID(glVertexAttrib1f, (GLuint indx, GLfloat x), (indx, x), 2, "GLuint", indx, "GLfloat", x) +TRACE_GL_VOID(glVertexAttrib1fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values) +TRACE_GL_VOID(glVertexAttrib2f, (GLuint indx, GLfloat x, GLfloat y), (indx, x, y), 3, "GLuint", indx, "GLfloat", x, "GLfloat", y) +TRACE_GL_VOID(glVertexAttrib2fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values) +TRACE_GL_VOID(glVertexAttrib3f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z), (indx, x, y, z), 4, "GLuint", indx, "GLfloat", x, "GLfloat", y, "GLfloat", z) +TRACE_GL_VOID(glVertexAttrib3fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values) +TRACE_GL_VOID(glVertexAttrib4f, (GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w), (indx, x, y, z, w), 5, "GLuint", indx, "GLfloat", x, "GLfloat", y, "GLfloat", z, "GLfloat", w) +TRACE_GL_VOID(glVertexAttrib4fv, (GLuint indx, const GLfloat* values), (indx, values), 2, "GLuint", indx, "const GLfloat*", values) +TRACE_GL_VOID(glVertexAttribPointer, (GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid* ptr), (indx, size, type, normalized, stride, ptr), 6, "GLuint", indx, "GLint", size, "GLenum", type, "GLboolean", normalized, "GLsizei", stride, "const GLvoid*", ptr) +TRACE_GL_VOID(glVertexPointer, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) TRACE_GL_VOID(glViewport, (GLint x, GLint y, GLsizei width, GLsizei height), (x, y, width, height), 4, "GLint", x, "GLint", y, "GLsizei", width, "GLsizei", height) -TRACE_GL_VOID(glWaitSync, (GLsync sync, GLbitfield flags, GLuint64 timeout), (sync, flags, timeout), 3, "GLsync", sync, "GLbitfield", flags, "GLuint64", timeout) -TRACE_GL_VOID(glWaitSyncAPPLE, (GLsync sync, GLbitfield flags, GLuint64 timeout), (sync, flags, timeout), 3, "GLsync", sync, "GLbitfield", flags, "GLuint64", timeout) -TRACE_GL_VOID(glWeightPointerOES, (GLint size, GLenum type, GLsizei stride, const void * pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const void *", pointer) +TRACE_GL_VOID(glWeightPointerOES, (GLint size, GLenum type, GLsizei stride, const GLvoid *pointer), (size, type, stride, pointer), 4, "GLint", size, "GLenum", type, "GLsizei", stride, "const GLvoid *", pointer) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_blob_cache.txt android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_blob_cache.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_blob_cache.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_blob_cache.txt 2012-10-16 22:57:11.000000000 +0000 @@ -16,15 +16,15 @@ Status - Complete + Draft. Version - Version 3, December 13, 2012 + Version 1, April 22, 2011 Number - EGL Extension #48 + EGL Extension #XXX Dependencies @@ -88,8 +88,8 @@ New Procedures and Functions void eglSetBlobCacheFuncsANDROID(EGLDisplay dpy, - EGLSetBlobFuncANDROID set, - EGLGetBlobFuncANDROID get); + EGLSetBlobFunc set, + EGLGetBlobFunc get); New Tokens @@ -200,9 +200,6 @@ Revision History -#3 (Jon Leech, December 13, 2012) - - Fix typo in New Functions section & assign extension #. - #2 (Jamie Gennis, April 25, 2011) - Swapped the order of the size and pointer arguments to the get and set functions. diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_framebuffer_target.txt android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_framebuffer_target.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_framebuffer_target.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_framebuffer_target.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -Name - - ANDROID_framebuffer_target - -Name Strings - - EGL_ANDROID_framebuffer_target - -Contributors - - Jamie Gennis - -Contact - - Jamie Gennis, Google Inc. (jgennis 'at' google.com) - -Status - - Complete - -Version - - Version 1, September 20, 2012 - -Number - - EGL Extension #47 - -Dependencies - - Requires EGL 1.0 - - This extension is written against the wording of the EGL 1.4 Specification - -Overview - - Android supports a number of different ANativeWindow implementations that - can be used to create an EGLSurface. One implementation, which is used to - send the result of performing window composition to a display, may have - some device-specific restrictions. Because of this, some EGLConfigs may - be incompatible with these ANativeWindows. This extension introduces a - new boolean EGLConfig attribute that indicates whether the EGLConfig - supports rendering to an ANativeWindow for which the buffers are passed to - the HWComposer HAL as a framebuffer target layer. - -New Types - - None. - -New Procedures and Functions - - None. - -New Tokens - - Accepted by the parameter of eglGetConfigAttrib and - the parameter of eglChooseConfig: - - EGL_FRAMEBUFFER_TARGET_ANDROID 0x3147 - -Changes to Chapter 3 of the EGL 1.4 Specification (EGL Functions and Errors) - - Section 3.4, Configuration Management, add a row to Table 3.1. - - Attribute Type Notes - ------------------------------ ------- --------------------------- - EGL_FRAMEBUFFER_TARGET_ANDROID boolean whether use as a HWComposer - framebuffer target layer is - supported - - Section 3.4, Configuration Management, add a row to Table 3.4. - - Attribute Default Selection Sort Sort - Criteria Order Priority - ------------------------------ ------------- --------- ----- -------- - EGL_FRAMEBUFFER_TARGET_ANDROID EGL_DONT_CARE Exact None - - Section 3.4, Configuration Management, add a paragraph at the end of the - subsection titled Other EGLConfig Attribute Descriptions. - - EGL_FRAMEBUFFER_TARGET_ANDROID is a boolean indicating whether the - config may be used to create an EGLSurface from an ANativeWindow for - which the buffers are to be passed to HWComposer as a framebuffer - target layer. - - Section 3.4.1, Querying Configurations, change the last paragraph as follow - - EGLConfigs are not sorted with respect to the parameters - EGL_BIND_TO_TEXTURE_RGB, EGL_BIND_TO_TEXTURE_RGBA, EGL_CONFORMANT, - EGL_LEVEL, EGL_NATIVE_RENDERABLE, EGL_MAX_SWAP_INTERVAL, - EGL_MIN_SWAP_INTERVAL, EGL_RENDERABLE_TYPE, EGL_SURFACE_TYPE, - EGL_TRANSPARENT_TYPE, EGL_TRANSPARENT_RED_VALUE, - EGL_TRANSPARENT_GREEN_VALUE, EGL_TRANSPARENT_BLUE_VALUE, and - EGL_RECORDABLE_ANDROID. - -Issues - - -Revision History - -#1 (Jamie Gennis, September 20, 2012) - - Initial draft. diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_image_native_buffer.txt android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_image_native_buffer.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_image_native_buffer.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_image_native_buffer.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,108 +0,0 @@ -Name - - ANDROID_image_native_buffer - -Name Strings - - EGL_ANDROID_image_native_buffer - -Contributors - - Mathias Agopian - Jamie Gennis - Jesse Hall - -Contact - - Jesse Hall, Google Inc. (jessehall 'at' google.com) - -Status - - Complete - -Version - - Version 1, November 28, 2012 - -Number - - EGL Extension #49 - -Dependencies - - EGL 1.2 is required. - - EGL_KHR_image_base is required. - - This extension is written against the wording of the EGL 1.2 - Specification. - -Overview - - This extension enables using an Android window buffer (struct - ANativeWindowBuffer) as an EGLImage source. - -New Types - - None. - -New Procedures and Functions - - None. - -New Tokens - - Accepted by the parameter of eglCreateImageKHR: - - EGL_NATIVE_BUFFER_ANDROID 0x3140 - -Changes to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors) - - Add to section 2.5.1 "EGLImage Specification" (as defined by the - EGL_KHR_image_base specification), in the description of - eglCreateImageKHR: - - "Values accepted for are listed in Table aaa, below. - - +----------------------------+-----------------------------------------+ - | | Notes | - +----------------------------+-----------------------------------------+ - | EGL_NATIVE_BUFFER_ANDROID | Used for ANativeWindowBuffer objects | - +----------------------------+-----------------------------------------+ - Table aaa. Legal values for eglCreateImageKHR parameter - - ... - - If is EGL_NATIVE_BUFFER_ANDROID, must be a valid display, - must be EGL_NO_CONTEXT, must be a pointer to a valid - ANativeWindowBuffer object (cast into the type EGLClientBuffer), and - attributes other than EGL_IMAGE_PRESERVED_KHR are ignored." - - Add to the list of error conditions for eglCreateImageKHR: - - "* If is EGL_NATIVE_BUFFER_ANDROID and is not a - pointer to a valid ANativeWindowBuffer, the error EGL_BAD_PARAMETER - is generated. - - * If is EGL_NATIVE_BUFFER_ANDROID and is not - EGL_NO_CONTEXT, the error EGL_BAD_CONTEXT is generated. - - * If is EGL_NATIVE_BUFFER_ANDROID and was created - with properties (format, usage, dimensions, etc.) not supported by - the EGL implementation, the error EGL_BAD_PARAMETER is generated." - -Issues - - 1. Should this extension define what combinations of ANativeWindowBuffer - properties implementations are required to support? - - RESOLVED: No. - - The requirements have evolved over time and will continue to change with - future Android releases. The minimum requirements for a given Android - version should be documented by that version. - -Revision History - -#1 (Jesse Hall, November 28, 2012) - - Initial draft. diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_native_fence_sync.txt android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_native_fence_sync.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_native_fence_sync.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_native_fence_sync.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,281 +0,0 @@ -Name - - ANDROID_native_fence_sync - -Name Strings - - EGL_ANDROID_native_fence_sync - -Contributors - - Jamie Gennis - -Contact - - Jamie Gennis, Google Inc. (jgennis 'at' google.com) - -Status - - Complete - -Version - - Version 3, September 4, 2012 - -Number - - EGL Extension #50 - -Dependencies - - Requires EGL 1.1 - - This extension is written against the wording of the EGL 1.2 Specification - - EGL_KHR_fence_sync is required. - -Overview - - This extension enables the creation of EGL fence sync objects that are - associated with a native synchronization fence object that is referenced - using a file descriptor. These EGL fence sync objects have nearly - identical semantics to those defined by the KHR_fence_sync extension, - except that they have an additional attribute storing the file descriptor - referring to the native fence object. - - This extension assumes the existence of a native fence synchronization - object that behaves similarly to an EGL fence sync object. These native - objects must have a signal status like that of an EGLSyncKHR object that - indicates whether the fence has ever been signaled. Once signaled the - native object's signal status may not change again. - -New Types - - None. - -New Procedures and Functions - - EGLint eglDupNativeFenceFDANDROID( - EGLDisplay dpy, - EGLSyncKHR); - -New Tokens - - Accepted by the parameter of eglCreateSyncKHR, and returned - in when eglGetSyncAttribKHR is called with - EGL_SYNC_TYPE_KHR: - - EGL_SYNC_NATIVE_FENCE_ANDROID 0x3144 - - Accepted by the parameter of eglCreateSyncKHR: - - EGL_SYNC_NATIVE_FENCE_FD_ANDROID 0x3145 - - Accepted by the parameter of eglCreateSyncKHR, and returned - by eglDupNativeFenceFDANDROID in the event of an error: - - EGL_NO_NATIVE_FENCE_FD_ANDROID -1 - - Returned in when eglGetSyncAttribKHR is called with - EGL_SYNC_CONDITION_KHR: - - EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID 0x3146 - -Changes to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors) - - Add the following after the sixth paragraph of Section 3.8.1 (Sync - Objects), added by KHR_fence_sync - - "If is EGL_SYNC_NATIVE_FENCE_ANDROID, an EGL native fence sync - object is created. In this case the EGL_SYNC_NATIVE_FENCE_FD_ANDROID - attribute may optionally be specified. If this attribute is specified, it - must be set to either a file descriptor that refers to a native fence - object or to the value EGL_NO_NATIVE_FENCE_FD_ANDROID. - - The default values for the EGL native fence sync object attributes are as - follows: - - Attribute Name Initial Attribute Value(s) - --------------- -------------------------- - EGL_SYNC_TYPE_KHR EGL_SYNC_NATIVE_FENCE_ANDROID - EGL_SYNC_STATUS_KHR EGL_UNSIGNALED_KHR - EGL_SYNC_CONDITION_KHR EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR - EGL_SYNC_NATIVE_FENCE_FD_ANDROID EGL_NO_NATIVE_FENCE_FD_ANDROID - - If the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute is not - EGL_NO_NATIVE_FENCE_FD_ANDROID then the EGL_SYNC_CONDITION_KHR attribute is - set to EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID and the EGL_SYNC_STATUS_KHR - attribute is set to reflect the signal status of the native fence object. - Additionally, the EGL implementation assumes ownership of the file - descriptor, so the caller must not use it after calling eglCreateSyncKHR." - - Modify Section 3.8.1 (Sync Objects), added by KHR_fence_sync, starting at - the seventh paragraph - - "When a fence sync object is created or when an EGL native fence sync - object is created with the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute set - to EGL_NO_NATIVE_FENCE_FD_ANDROID, eglCreateSyncKHR also inserts a fence - command into the command stream of the bound client API's current context - (i.e., the context returned by eglGetCurrentContext), and associates it - with the newly created sync object. - - After associating the fence command with an EGL native fence sync object, - the next Flush() operation performed by the current client API causes a - new native fence object to be created, and the - EGL_SYNC_NATIVE_FENCE_ANDROID attribute of the EGL native fence object is - set to a file descriptor that refers to the new native fence object. This - new native fence object is signaled when the EGL native fence sync object - is signaled. - - When the condition of the sync object is satisfied by the fence command, - the sync is signaled by the associated client API context, causing any - eglClientWaitSyncKHR commands (see below) blocking on to unblock. - If the sync object is an EGL native fence sync object then the native - fence object is also signaled when the condition is satisfied. The - EGL_SYNC_PRIOR_COMMANDS_COMPLETE_KHR condition is satisfied by completion - of the fence command corresponding to the sync object and all preceding - commands in the associated client API context's command stream. The sync - object will not be signaled until all effects from these commands on the - client API's internal and framebuffer state are fully realized. No other - state is affected by execution of the fence command. - - The EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID condition is satisfied by the - signaling of the native fence object referred to by the - EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute. When this happens any - eglClientWaitSyncKHR commands blocking on unblock." - - Modify the list of eglCreateSyncKHR errors in Section 3.8.1 (Sync Objects), - added by KHR_fence_sync - - "Errors - ------ - - * If is not the name of a valid, initialized EGLDisplay, - EGL_NO_SYNC_KHR is returned and an EGL_BAD_DISPLAY error is - generated. - * If is EGL_SYNC_FENCE_KHR and is neither NULL nor - empty (containing only EGL_NONE), EGL_NO_SYNC_KHR is returned and an - EGL_BAD_ATTRIBUTE error is generated. - * If is EGL_SYNC_NATIVE_FENCE_ANDROID and contains - an attribute other than EGL_SYNC_NATIVE_FENCE_FD_ANDROID, - EGL_NO_SYNC_KHR is returned and an EGL_BAD_ATTRIBUTE error is - generated. - * If is not a supported type of sync object, - EGL_NO_SYNC_KHR is returned and an EGL_BAD_ATTRIBUTE error is - generated. - * If is EGL_SYNC_FENCE_KHR or EGL_SYNC_NATIVE_FENCE_ANDROID and - no context is current for the bound API (i.e., eglGetCurrentContext - returns EGL_NO_CONTEXT), EGL_NO_SYNC_KHR is returned and an - EGL_BAD_MATCH error is generated. - * If is EGL_SYNC_FENCE_KHR or EGL_SYNC_NATIVE_FENCE_ANDROID and - does not match the EGLDisplay of the currently bound context for - the currently bound client API (the EGLDisplay returned by - eglGetCurrentDisplay()) then EGL_NO_SYNC_KHR is returned and an - EGL_BAD_MATCH error is generated. - * If is EGL_SYNC_FENCE_KHR or EGL_SYNC_NATIVE_FENCE_ANDROID and - the currently bound client API does not support the client API - extension indicating it can place fence commands, then EGL_NO_SYNC_KHR - is returned and an EGL_BAD_MATCH error is generated." - - Modify table 3.cc in Section 3.8.1 (Sync Objects), added by KHR_fence_sync - - " - Attribute Description Supported Sync Objects - ----------------- ----------------------- ---------------------- - EGL_SYNC_TYPE_KHR Type of the sync object All - EGL_SYNC_STATUS_KHR Status of the sync object All - EGL_SYNC_CONDITION_KHR Signaling condition EGL_SYNC_FENCE_KHR and - EGL_SYNC_NATIVE_FENCE_ANDROID only - " - - Modify the second paragraph description of eglDestroySyncKHR in Section - 3.8.1 (Sync Objects), added by KHR_fence_sync - - "If no errors are generated, EGL_TRUE is returned, and will no - longer be the handle of a valid sync object. Additionally, if is an - EGL native fence sync object and the EGL_SYNC_NATIVE_FENCE_FD_ANDROID - attribute is not EGL_NO_NATIVE_FENCE_FD_ANDROID then that file descriptor - is closed." - - Add the following after the last paragraph of Section 3.8.1 (Sync - Objects), added by KHR_fence_sync - - The command - - EGLint eglDupNativeFenceFDANDROID( - EGLDisplay dpy, - EGLSyncKHR sync); - - duplicates the file descriptor stored in the - EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute of an EGL native fence sync - object and returns the new file descriptor. - - Errors - ------ - - * If is not a valid sync object for , - EGL_NO_NATIVE_FENCE_FD_ANDROID is returned and an EGL_BAD_PARAMETER - error is generated. - * If the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute of is - EGL_NO_NATIVE_FENCE_FD_ANDROID, EGL_NO_NATIVE_FENCE_FD_ANDROID is - returned and an EGL_BAD_PARAMETER error is generated. - * If does not match the display passed to eglCreateSyncKHR - when was created, the behaviour is undefined." - -Issues - - 1. Should EGLSyncKHR objects that wrap native fence objects use the - EGL_SYNC_FENCE_KHR type? - - RESOLVED: A new sync object type will be added. - - We don't want to require all EGL fence sync objects to wrap native fence - objects, so we need some way to tell the EGL implementation at sync object - creation whether the sync object should support querying the native fence - FD attribute. We could do this with either a new sync object type or with a - boolean attribute. It might be nice to pick up future signaling conditions - that might be added for fence sync objects, but there may be things that - get added that don't make sense in the context of native fence objects. - - 2. Who is responsible for dup'ing the native fence file descriptors? - - RESOLVED: Whenever a file descriptor is passed into or returned from an - EGL call in this extension, ownership of that file descriptor is - transfered. The recipient of the file descriptor must close it when it is - no longer needed, and the provider of the file descriptor must dup it - before providing it if they require continued use of the native fence. - - 3. Can the EGL_SYNC_NATIVE_FENCE_FD_ANDROID attribute be queried? - - RESOLVED: No. - - Returning the file descriptor owned by the EGL implementation would - violate the file descriptor ownership rule described in issue #2. Having - eglGetSyncAttribKHR return a different (dup'd) file descriptor each time - it's called seems wrong, so a new function was added to explicitly dup the - file descriptor. - - That said, the attribute is useful both as a way to pass an existing file - descriptor to eglCreateSyncKHR and as a way to describe the subsequent - behavior of EGL native fence sync objects, so it is left as an attribute - for which the value cannot be queried. - -Revision History - -#3 (Jamie Gennis, September 4, 2012) - - Reworded the extension to refer to "native fence" objects rather than - "Android fence" objects. - - Added a paragraph to the overview that describes assumptions about the - native fence sync objects. - -#2 (Jamie Gennis, July 23, 2012) - - Changed the file descriptor ownership transferring behavior. - - Added the eglDupAndroidFenceFDANDROID function. - - Removed EGL_SYNC_NATIVE_FENCE_FD_ANDROID from the table of gettable - attributes. - - Added language specifying that a native Android fence is created at the - flush following the creation of an EGL Android fence sync object that is - not passed an existing native fence. - -#1 (Jamie Gennis, May 29, 2012) - - Initial draft. diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_presentation_time.txt android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_presentation_time.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_presentation_time.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_presentation_time.txt 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -Name - - ANDROID_presentation_time - -Name Strings - - EGL_ANDROID_presentation_time - -Contributors - - Jamie Gennis - Andy McFadden - Jesse Hall - -Contact - - Jamie Gennis, Google Inc. (jgennis 'at' google.com) - -Status - - Draft - -Version - - Version 3, June 26, 2013 - -Number - - EGL Extension #XXX - -Dependencies - - Requires EGL 1.1 - - This extension is written against the wording of the EGL 1.4 Specification - -Overview - - Often when rendering a sequence of images, there is some time at which each - image is intended to be presented to the viewer. This extension allows - this desired presentation time to be specified for each frame rendered to - an EGLSurface, allowing the native window system to use it. - -New Types - - /* - * EGLnsecsANDROID is a signed integer type for representing a time in - * nanoseconds. - */ - #include - typedef khronos_stime_nanoseconds_t EGLnsecsANDROID; - - -New Procedures and Functions - - EGLboolean eglPresentationTimeANDROID( - EGLDisplay dpy, - EGLSurface sur, - EGLnsecsANDROID time); - -New Tokens - - None. - -Changes to Chapter 3 of the EGL 1.2 Specification (EGL Functions and Errors) - - Add a new subsection before Section 3.9.4, page 53 (Posting Errors) - - "3.9.4 Presentation Time - - The function - - EGLboolean eglPresentationTimeANDROID(EGLDisplay dpy, EGLSurface - surface, EGLnsecsANDROID time); - - specifies the time at which the current color buffer of surface should be - presented to the viewer. The time parameter should be a time in - nanoseconds, but the exact meaning of the time depends on the native - window system's use of the presentation time. In situations where - an absolute time is needed such as displaying the color buffer on a - display device, the time should correspond to the system monotonic up-time - clock. For situations in which an absolute time is not needed such as - using the color buffer for video encoding, the presentation time of the - first frame may be arbitrarily chosen and those of subsequent frames - chosen relative to that of the first frame. - - The presentation time may be set multiple times, with each call to - eglPresentationTimeANDROID overriding prior calls. Setting the - presentation time alone does not cause the color buffer to be made - visible, but if the color buffer is subsequently posted to a native window - or copied to a native pixmap then the presentation time of the surface at - that time may be passed along for the native window system to use. - - If the surface presentation time is successfully set, EGL_TRUE is - returned. Otherwise EGL_FALSE is returned and an appropriate error is - set. If is not the name of a valid, initialized EGLDisplay, an - EGL_BAD_DISPLAY error is generated. If is not a valid EGLSurface - then an EGL_BAD_SURFACE error is generated. - -Issues - - 1. How is the presentation time used? - - RESOLVED: The uses of the presentation time are intentionally not specified - in this extension. Some possible uses include Audio/Video synchronization, - video frame timestamps for video encoding, display latency metrics, and - display latency control. - - 2. How can the current value of the clock that should be used for the - presentation time when an absolute time is needed be queried on Android? - - RESOLVED: The current clock value can be queried from the Java - System.nanoTime() method, or from the native clock_gettime function by - passing CLOCK_MONOTONIC as the clock identifier. - - 3. Should the presentation time be state which is used by eglSwapBuffers, - or should it be a new parameter to an extended variant of eglSwapBuffers? - - RESOLVED: The presentation time should be new state which is used by - the existing eglSwapBuffers call. Adding new state composes better with - other (hypothetical) extensions that also modify the behavior of - eglSwapBuffers. - -Revision History - -#3 (Jesse Hall, June 26, 2013) - - Enumerated errors generated by eglPresentationTimeANDROID. - - Added Issue #3 with resolution. - -#2 (Jamie Gennis, April 1, 2013) - - Clarified how uses that either do or do not need an absolute time should - be handled. - - Specified the eglPresentationTimeANDROID return value. - -#1 (Jamie Gennis, January 8, 2013) - - Initial draft. diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_recordable.txt android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_recordable.txt --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/EGL_ANDROID_recordable.txt 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/EGL_ANDROID_recordable.txt 2012-10-16 22:57:11.000000000 +0000 @@ -16,15 +16,15 @@ Status - Complete + Draft. Version - Version 2, July 15, 2011 + Version 1, July 8, 2011 Number - EGL Extension #51 + EGL Extension #XXX Dependencies diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/specs/README android-platform-frameworks-native-21/opengl/specs/README --- android-platform-frameworks-native-6.0.1+r16/opengl/specs/README 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/specs/README 2012-10-16 22:57:11.000000000 +0000 @@ -8,14 +8,6 @@ ---------------- ---------------------------------- 0x3140 EGL_ANDROID_image_native_buffer 0x3141 (unused) -0x3142 EGL_RECORDABLE_ANDROID (EGL_ANDROID_recordable) +0x3142 EGL_ANDROID_recordable 0x3143 EGL_VERSION_HW_ANDROID (internal use) -0x3144 EGL_SYNC_NATIVE_FENCE_ANDROID (EGL_ANDROID_native_fence_sync) -0x3145 EGL_SYNC_NATIVE_FENCE_FD_ANDROID (EGL_ANDROID_native_fence_sync) -0x3146 EGL_SYNC_NATIVE_FENCE_SIGNALED_ANDROID (EGL_ANDROID_native_fence_sync) -0x3147 EGL_FRAMEBUFFER_TARGET_ANDROID (EGL_ANDROID_framebuffer_target) -0x3148 EGL_IMAGE_CROP_LEFT_ANDROID (EGL_ANDROID_image_crop) -0x3149 EGL_IMAGE_CROP_TOP_ANDROID (EGL_ANDROID_image_crop) -0x314A EGL_IMAGE_CROP_RIGHT_ANDROID (EGL_ANDROID_image_crop) -0x314B EGL_IMAGE_CROP_BOTTOM_ANDROID (EGL_ANDROID_image_crop) -0x314C - 0x314F (unused) +0x3144 - 0x314F (unused) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/Android.mk android-platform-frameworks-native-21/opengl/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -20,7 +20,7 @@ textures \ tritex \ -ifneq (,$(TARGET_BUILD_JAVA_SUPPORT_LEVEL)) +ifneq ($(TARGET_BUILD_PDK), true) dirs += \ gl2_cameraeye \ gl2_java \ @@ -29,16 +29,11 @@ gl_jni \ gl_perfapp \ lighting1709 \ + testFramerate \ testLatency \ testPauseResume \ testViewport \ -endif # JAVA_SUPPORT - -ifeq (platform,$(TARGET_BUILD_JAVA_SUPPORT_LEVEL)) -dirs += \ - testFramerate - -endif # JAVA_SUPPORT platform +endif include $(call all-named-subdir-makefiles, $(dirs)) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/angeles/Android.mk android-platform-frameworks-native-21/opengl/tests/angeles/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/angeles/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/angeles/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -3,8 +3,7 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) LOCAL_SRC_FILES:= app-linux.cpp demo.c.arm -LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui libgui libutils -LOCAL_STATIC_LIBRARIES += libglTest +LOCAL_SHARED_LIBRARIES := libEGL libGLESv1_CM libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) LOCAL_MODULE:= angeles LOCAL_MODULE_TAGS := optional diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/angeles/app-linux.cpp android-platform-frameworks-native-21/opengl/tests/angeles/app-linux.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/angeles/app-linux.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/angeles/app-linux.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -52,8 +52,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -118,7 +118,7 @@ fprintf(stderr, "EGL Error: 0x%04x\n", (int)error); } -static int initGraphics(EGLint samples, const WindowSurface& windowSurface) +static int initGraphics(unsigned samples) { EGLint configAttribs[] = { EGL_DEPTH_SIZE, 16, @@ -135,7 +135,7 @@ EGLint w, h; EGLDisplay dpy; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); @@ -193,8 +193,7 @@ printf("Multisample enabled: GL_SAMPLES = %u\n", samples); } - WindowSurface windowSurface; - if (!initGraphics(samples, windowSurface)) + if (!initGraphics(samples)) { fprintf(stderr, "Graphics initialization failed.\n"); return EXIT_FAILURE; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/EGLTest/Android.mk android-platform-frameworks-native-21/opengl/tests/EGLTest/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/EGLTest/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/EGLTest/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,7 +1,6 @@ # Build the unit tests. LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_MODULE := EGL_test @@ -14,19 +13,24 @@ LOCAL_SHARED_LIBRARIES := \ libEGL \ libcutils \ - libbinder \ + libstlport \ libutils \ libgui \ +LOCAL_STATIC_LIBRARIES := \ + libgtest \ + libgtest_main \ + LOCAL_C_INCLUDES := \ + bionic \ bionic/libc/private \ + bionic/libstdc++/include \ + external/gtest/include \ + external/stlport/stlport \ frameworks/native/opengl/libs \ frameworks/native/opengl/libs/EGL \ -# gold in binutils 2.22 will warn about the usage of mktemp -LOCAL_LDFLAGS += -Wl,--no-fatal-warnings - -include $(BUILD_NATIVE_TEST) +include $(BUILD_EXECUTABLE) # Include subdirectory makefiles # ============================================================ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/EGLTest/egl_cache_test.cpp android-platform-frameworks-native-21/opengl/tests/EGLTest/egl_cache_test.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/EGLTest/egl_cache_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/EGLTest/egl_cache_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -41,7 +41,7 @@ }; TEST_F(EGLCacheTest, UninitializedCacheAlwaysMisses) { - uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee }; + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mCache->setBlob("abcd", 4, "efgh", 4); ASSERT_EQ(0, mCache->getBlob("abcd", 4, buf, 4)); ASSERT_EQ(0xee, buf[0]); @@ -51,7 +51,7 @@ } TEST_F(EGLCacheTest, InitializedCacheAlwaysHits) { - uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee }; + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY)); mCache->setBlob("abcd", 4, "efgh", 4); ASSERT_EQ(4, mCache->getBlob("abcd", 4, buf, 4)); @@ -62,7 +62,7 @@ } TEST_F(EGLCacheTest, TerminatedCacheAlwaysMisses) { - uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee }; + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY)); mCache->setBlob("abcd", 4, "efgh", 4); mCache->terminate(); @@ -94,7 +94,7 @@ }; TEST_F(EGLCacheSerializationTest, ReinitializedCacheContainsValues) { - uint8_t buf[4] = { 0xee, 0xee, 0xee, 0xee }; + char buf[4] = { 0xee, 0xee, 0xee, 0xee }; mCache->setCacheFilename(mFilename); mCache->initialize(egl_display_t::get(EGL_DEFAULT_DISPLAY)); mCache->setBlob("abcd", 4, "efgh", 4); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/EGLTest/EGL_test.cpp android-platform-frameworks-native-21/opengl/tests/EGLTest/EGL_test.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/EGLTest/EGL_test.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/EGLTest/EGL_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -19,7 +19,8 @@ #include #include -#include +#include +#include namespace android { @@ -100,18 +101,10 @@ }; EXPECT_TRUE(eglChooseConfig(mEglDisplay, attrs, &config, 1, &numConfigs)); - struct DummyConsumer : public BnConsumerListener { - virtual void onFrameAvailable(const BufferItem& /* item */) {} - virtual void onBuffersReleased() {} - virtual void onSidebandStreamChanged() {} - }; - // Create a EGLSurface - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - consumer->consumerConnect(new DummyConsumer, false); - sp mSTC = new Surface(producer); + sp bq = new BufferQueue(); + bq->consumerConnect(new DummyConsumer()); + sp mSTC = new SurfaceTextureClient(static_cast >( bq)); sp mANW = mSTC; EGLSurface eglSurface = eglCreateWindowSurface(mEglDisplay, config, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/fillrate/Android.mk android-platform-frameworks-native-21/opengl/tests/fillrate/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/fillrate/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/fillrate/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -9,10 +9,7 @@ libutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/fillrate/fillrate.cpp android-platform-frameworks-native-21/opengl/tests/fillrate/fillrate.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/fillrate/fillrate.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/fillrate/fillrate.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -25,8 +25,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -45,8 +45,7 @@ EGLint w, h; EGLDisplay dpy; - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); @@ -91,13 +90,11 @@ } } - const GLfloat fh = h; - const GLfloat fw = w; const GLfloat vertices[4][2] = { - { 0, 0 }, - { 0, fh }, - { fw, fh }, - { fw, 0 } + { 0, 0 }, + { 0, h }, + { w, h }, + { w, 0 } }; const GLfloat texCoords[4][2] = { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/filter/Android.mk android-platform-frameworks-native-21/opengl/tests/filter/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/filter/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/filter/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/filter/filter.cpp android-platform-frameworks-native-21/opengl/tests/filter/filter.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/filter/filter.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/filter/filter.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -5,8 +5,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -40,10 +40,8 @@ EGLDisplay dpy; EGLNativeWindowType window = 0; - WindowSurface* windowSurface = NULL; if (!usePbuffer) { - windowSurface = new WindowSurface(); - window = windowSurface->getSurface(); + window = android_createDisplaySurface(); } dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); @@ -140,12 +138,11 @@ //glDrawTexiOES(0, 0, 0, dim, dim); - const GLfloat fdim = dim; const GLfloat vertices[4][2] = { - { 0, 0 }, - { 0, fdim }, - { fdim, fdim }, - { fdim, 0 } + { 0, 0 }, + { 0, dim }, + { dim, dim }, + { dim, 0 } }; const GLfloat texCoords[4][2] = { @@ -189,6 +186,5 @@ } eglTerminate(dpy); - delete windowSurface; return 0; } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/finish/Android.mk android-platform-frameworks-native-21/opengl/tests/finish/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/finish/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/finish/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -9,10 +9,7 @@ libutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/finish/finish.cpp android-platform-frameworks-native-21/opengl/tests/finish/finish.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/finish/finish.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/finish/finish.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -26,8 +26,8 @@ #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -46,8 +46,7 @@ EGLint w, h; EGLDisplay dpy; - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_basic/Android.mk android-platform-frameworks-native-21/opengl/tests/gl2_basic/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_basic/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_basic/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv2 \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_basic/gl2_basic.cpp android-platform-frameworks-native-21/opengl/tests/gl2_basic/gl2_basic.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_basic/gl2_basic.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_basic/gl2_basic.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -26,8 +26,8 @@ #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -298,8 +298,7 @@ checkEglError("printEGLConfigurations"); - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig); if (returnValue) { printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_copyTexImage/Android.mk android-platform-frameworks-native-21/opengl/tests/gl2_copyTexImage/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_copyTexImage/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_copyTexImage/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv2 \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp android-platform-frameworks-native-21/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_copyTexImage/gl2_copyTexImage.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -26,8 +26,8 @@ #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -406,8 +406,7 @@ checkEglError("printEGLConfigurations"); - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); EGLint numConfigs = -1, n = 0; eglChooseConfig(dpy, s_configAttribs, 0, 0, &numConfigs); if (numConfigs) { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_jni/Android.mk android-platform-frameworks-native-21/opengl/tests/gl2_jni/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_jni/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_jni/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -30,14 +30,13 @@ # Optional tag would mean it doesn't get installed by default LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter +LOCAL_CFLAGS := -Werror LOCAL_SRC_FILES:= \ gl_code.cpp LOCAL_SHARED_LIBRARIES := \ libutils \ - liblog \ libEGL \ libGLESv2 diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_jni/jni/gl_code.cpp android-platform-frameworks-native-21/opengl/tests/gl2_jni/jni/gl_code.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_jni/jni/gl_code.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_jni/jni/gl_code.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -153,7 +153,7 @@ JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_step(JNIEnv * env, jobject obj); }; -JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height) +JNIEXPORT void JNICALL Java_com_android_gl2jni_GL2JNILib_init(JNIEnv * env, jobject obj, jint width, jint height) { setupGraphics(width, height); } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_yuvtex/Android.mk android-platform-frameworks-native-21/opengl/tests/gl2_yuvtex/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_yuvtex/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_yuvtex/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -5,15 +5,10 @@ gl2_yuvtex.cpp LOCAL_SHARED_LIBRARIES := \ - libcutils \ + libcutils \ libEGL \ libGLESv2 \ - libutils \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp android-platform-frameworks-native-21/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl2_yuvtex/gl2_yuvtex.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -27,9 +27,9 @@ #include -#include +#include #include -#include +#include "EGLUtils.h" using namespace android; @@ -364,8 +364,7 @@ return 0; } - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig); if (returnValue) { printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_basic/Android.mk android-platform-frameworks-native-21/opengl/tests/gl_basic/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_basic/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_basic/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_basic/gl_basic.cpp android-platform-frameworks-native-21/opengl/tests/gl_basic/gl_basic.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_basic/gl_basic.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_basic/gl_basic.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -5,8 +5,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" #include @@ -23,7 +23,7 @@ #define FIXED_ONE 0x10000 #define ITERATIONS 50 -int init_gl_surface(const WindowSurface& windowSurface); +int init_gl_surface(void); void free_gl_surface(void); void init_scene(void); void render(); @@ -194,8 +194,7 @@ int q; int start, end; printf("Initializing EGL...\n"); - WindowSurface windowSurface; - if(!init_gl_surface(windowSurface)) + if(!init_gl_surface()) { printf("GL initialisation failed - exiting\n"); return 0; @@ -210,7 +209,7 @@ return 0; } -int init_gl_surface(const WindowSurface& windowSurface) +int init_gl_surface(void) { EGLint numConfigs = 1; EGLConfig myConfig = {0}; @@ -237,7 +236,7 @@ return 0; } - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig); if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gldual/Android.mk android-platform-frameworks-native-21/opengl/tests/gldual/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gldual/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gldual/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -30,14 +30,13 @@ # Optional tag would mean it doesn't get installed by default LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter +LOCAL_CFLAGS := -Werror LOCAL_SRC_FILES:= \ gl_code.cpp LOCAL_SHARED_LIBRARIES := \ libutils \ - liblog \ libEGL \ libGLESv2 diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_jni/Android.mk android-platform-frameworks-native-21/opengl/tests/gl_jni/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_jni/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_jni/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -30,14 +30,13 @@ # Optional tag would mean it doesn't get installed by default LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter +LOCAL_CFLAGS := -Werror LOCAL_SRC_FILES:= \ gl_code.cpp LOCAL_SHARED_LIBRARIES := \ libutils \ - liblog \ libEGL \ libGLESv1_CM diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perf/Android.mk android-platform-frameworks-native-21/opengl/tests/gl_perf/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perf/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_perf/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -6,15 +6,10 @@ filltest.cpp LOCAL_SHARED_LIBRARIES := \ - libcutils \ - liblog \ + libcutils \ libEGL \ libGLESv2 \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perf/fill_common.cpp android-platform-frameworks-native-21/opengl/tests/gl_perf/fill_common.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perf/fill_common.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_perf/fill_common.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -189,7 +189,7 @@ } static void randUniform(int pgm, const char *var) { - GLint loc = glGetUniformLocation(pgm, var); + int loc = glGetUniformLocation(pgm, var); if (loc >= 0) { float x = ((float)rand()) / RAND_MAX; float y = ((float)rand()) / RAND_MAX; @@ -211,7 +211,7 @@ startTimer(); glClear(GL_DEPTH_BUFFER_BIT | GL_COLOR_BUFFER_BIT); for (uint32_t ct=0; ct < passCount; ct++) { - GLint loc = glGetUniformLocation(pgm, "u_texOff"); + int loc = glGetUniformLocation(pgm, "u_texOff"); glUniform2f(loc, ((float)ct) / passCount, ((float)ct) / 2.f / passCount); randUniform(pgm, "u_color"); @@ -271,7 +271,7 @@ printf("error running test\n"); return; } - GLint loc = glGetUniformLocation(pgm, "u_tex0"); + int loc = glGetUniformLocation(pgm, "u_tex0"); if (loc >= 0) glUniform1i(loc, 0); loc = glGetUniformLocation(pgm, "u_tex1"); if (loc >= 0) glUniform1i(loc, 1); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perf/gl2_perf.cpp android-platform-frameworks-native-21/opengl/tests/gl_perf/gl2_perf.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perf/gl2_perf.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_perf/gl2_perf.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -26,8 +26,8 @@ #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -86,8 +86,7 @@ return 0; } - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig); if (returnValue) { printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perfapp/Android.mk android-platform-frameworks-native-21/opengl/tests/gl_perfapp/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_perfapp/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_perfapp/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -33,14 +33,13 @@ # Optional tag would mean it doesn't get installed by default LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS := -Werror -Wno-error=unused-parameter +LOCAL_CFLAGS := -Werror LOCAL_SRC_FILES:= \ gl_code.cpp LOCAL_SHARED_LIBRARIES := \ libutils \ - liblog \ libEGL \ libGLESv2 diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_yuvtex/Android.mk android-platform-frameworks-native-21/opengl/tests/gl_yuvtex/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_yuvtex/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_yuvtex/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -5,14 +5,10 @@ gl_yuvtex.cpp LOCAL_SHARED_LIBRARIES := \ - libcutils \ + libcutils \ libEGL \ libGLESv1_CM \ - libutils \ - libui \ - libgui - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_yuvtex/gl_yuvtex.cpp android-platform-frameworks-native-21/opengl/tests/gl_yuvtex/gl_yuvtex.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/gl_yuvtex/gl_yuvtex.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/gl_yuvtex/gl_yuvtex.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -27,9 +27,9 @@ #include -#include +#include #include -#include +#include "EGLUtils.h" using namespace android; @@ -254,8 +254,7 @@ return 0; } - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); returnValue = EGLUtils::selectConfigForNativeWindow(dpy, s_configAttribs, window, &myConfig); if (returnValue) { printf("EGLUtils::selectConfigForNativeWindow() returned %d", returnValue); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/Android.mk android-platform-frameworks-native-21/opengl/tests/hwc/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -15,33 +15,30 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - LOCAL_MODULE_TAGS := tests LOCAL_MODULE:= libhwcTest -LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -LOCAL_CXX_STL := libc++ LOCAL_SRC_FILES:= hwcTestLib.cpp LOCAL_C_INCLUDES += system/extras/tests/include \ - $(call include-path-for, opengl-tests-includes) \ + bionic \ + bionic/libstdc++/include \ + external/stlport/stlport \ + $(call include-path-for, opengl-tests-includes) + +LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES + +LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport +LOCAL_STATIC_LIBRARIES += libglTest + include $(BUILD_STATIC_LIBRARY) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk - -LOCAL_MODULE:= hwcStress -LOCAL_MODULE_TAGS := tests -LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -LOCAL_CXX_STL := libc++ LOCAL_SRC_FILES:= hwcStress.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ libEGL \ libGLESv2 \ - libutils \ - liblog \ libui \ libhardware \ @@ -53,25 +50,26 @@ LOCAL_C_INCLUDES += \ system/extras/tests/include \ hardware/libhardware/include \ - $(call include-path-for, opengl-tests-includes) \ + $(call include-path-for, opengl-tests-includes) -include $(BUILD_NATIVE_TEST) +LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk +LOCAL_MODULE:= hwcStress +LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativestresstest -LOCAL_MODULE:= hwcRects LOCAL_MODULE_TAGS := tests + LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -LOCAL_CXX_STL := libc++ + +include $(BUILD_NATIVE_TEST) + +include $(CLEAR_VARS) LOCAL_SRC_FILES:= hwcRects.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ libEGL \ libGLESv2 \ - libutils \ - liblog \ libui \ libhardware \ @@ -83,25 +81,24 @@ LOCAL_C_INCLUDES += \ system/extras/tests/include \ hardware/libhardware/include \ - $(call include-path-for, opengl-tests-includes) \ + $(call include-path-for, opengl-tests-includes) -include $(BUILD_NATIVE_TEST) - -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk +LOCAL_MODULE:= hwcRects +LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativeutil -LOCAL_MODULE:= hwcColorEquiv LOCAL_MODULE_TAGS := tests + LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -LOCAL_CXX_STL := libc++ + +include $(BUILD_NATIVE_TEST) + +include $(CLEAR_VARS) LOCAL_SRC_FILES:= hwcColorEquiv.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ libEGL \ libGLESv2 \ - libutils \ - liblog \ libui \ libhardware \ @@ -113,25 +110,24 @@ LOCAL_C_INCLUDES += \ system/extras/tests/include \ hardware/libhardware/include \ - $(call include-path-for, opengl-tests-includes) \ - -include $(BUILD_NATIVE_TEST) + $(call include-path-for, opengl-tests-includes) -include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk +LOCAL_MODULE:= hwcColorEquiv +LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativeutil -LOCAL_MODULE:= hwcCommit LOCAL_MODULE_TAGS := tests + LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -LOCAL_CXX_STL := libc++ + +include $(BUILD_NATIVE_TEST) + +include $(CLEAR_VARS) LOCAL_SRC_FILES:= hwcCommit.cpp LOCAL_SHARED_LIBRARIES := \ libcutils \ libEGL \ libGLESv2 \ - libutils \ - liblog \ libui \ libhardware \ @@ -143,6 +139,13 @@ LOCAL_C_INCLUDES += \ system/extras/tests/include \ hardware/libhardware/include \ - $(call include-path-for, opengl-tests-includes) \ + $(call include-path-for, opengl-tests-includes) + +LOCAL_MODULE:= hwcCommit +LOCAL_MODULE_PATH := $(TARGET_OUT_DATA)/nativebenchmark + +LOCAL_MODULE_TAGS := tests + +LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES include $(BUILD_NATIVE_TEST) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcColorEquiv.cpp android-platform-frameworks-native-21/opengl/tests/hwc/hwcColorEquiv.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcColorEquiv.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/hwcColorEquiv.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -85,6 +85,7 @@ #include #include +#include #include #define LOG_TAG "hwcColorEquivTest" @@ -123,7 +124,7 @@ // Globals static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_SW_WRITE_RARELY; -static hwc_composer_device_1_t *hwcDevice; +static hwc_composer_device_t *hwcDevice; static EGLDisplay dpy; static EGLSurface surface; static EGLint width, height; @@ -166,6 +167,7 @@ int rv, opt; bool error; char *chptr; + unsigned int pass; char cmd[MAXCMD]; string str; @@ -292,12 +294,14 @@ // Use the upper third of the display for the reference frame and // the middle third for the equivalence frame. unsigned int refHeight = height / 3; + unsigned int refPosY = 0; // Reference frame Y position unsigned int refPosX = 0; // Reference frame X position unsigned int refWidth = width - refPosX; if ((refWidth & refFormat->wMod) != 0) { refWidth += refFormat->wMod - (refWidth % refFormat->wMod); } unsigned int equivHeight = height / 3; + unsigned int equivPosY = refHeight; // Equivalence frame Y position unsigned int equivPosX = 0; // Equivalence frame X position unsigned int equivWidth = width - equivPosX; if ((equivWidth & equivFormat->wMod) != 0) { @@ -340,16 +344,16 @@ hwcTestFillColorHBlend(equivFrame.get(), refFormat->format, startRefColor, endRefColor); - hwc_display_contents_1_t *list; - size_t size = sizeof(hwc_display_contents_1_t) + numFrames * sizeof(hwc_layer_1_t); - if ((list = (hwc_display_contents_1_t *) calloc(1, size)) == NULL) { + hwc_layer_list_t *list; + size_t size = sizeof(hwc_layer_list) + numFrames * sizeof(hwc_layer_t); + if ((list = (hwc_layer_list_t *) calloc(1, size)) == NULL) { testPrintE("Allocate list failed"); exit(11); } list->flags = HWC_GEOMETRY_CHANGED; list->numHwLayers = numFrames; - hwc_layer_1_t *layer = &list->hwLayers[0]; + hwc_layer_t *layer = &list->hwLayers[0]; layer->handle = refFrame->handle; layer->blending = HWC_BLENDING_NONE; layer->sourceCrop.left = 0; @@ -379,7 +383,7 @@ // Perform prepare operation if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); } - hwcDevice->prepare(hwcDevice, 1, &list); + hwcDevice->prepare(hwcDevice, list); if (verbose) { testPrintI("Post Prepare:"); hwcTestDisplayListPrepareModifiable(list); @@ -389,9 +393,7 @@ list->flags &= ~HWC_GEOMETRY_CHANGED; if (verbose) {hwcTestDisplayListHandles(list); } - list->dpy = dpy; - list->sur = surface; - hwcDevice->set(hwcDevice, 1, &list); + hwcDevice->set(hwcDevice, dpy, surface, list); testDelay(endDelay); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcCommit.cpp android-platform-frameworks-native-21/opengl/tests/hwc/hwcCommit.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcCommit.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/hwcCommit.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -96,6 +96,7 @@ #include #include +#include #include #define LOG_TAG "hwcCommitTest" @@ -229,7 +230,7 @@ // Globals static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_SW_WRITE_RARELY; -static hwc_composer_device_1_t *hwcDevice; +static hwc_composer_device_t *hwcDevice; static EGLDisplay dpy; static EGLSurface surface; static EGLint width, height; @@ -338,6 +339,7 @@ main(int argc, char *argv[]) { int rv, opt; + char *chptr; bool error; string str; char cmd[MAXCMD]; @@ -1395,7 +1397,7 @@ // Given a list of rectangles, determine how many HWC will commit to render uint32_t numOverlays(list& rectList) { - hwc_display_contents_1_t *hwcList; + hwc_layer_list_t *hwcList; list > buffers; hwcList = hwcTestCreateLayerList(rectList.size()); @@ -1404,7 +1406,7 @@ exit(30); } - hwc_layer_1_t *layer = &hwcList->hwLayers[0]; + hwc_layer_t *layer = &hwcList->hwLayers[0]; for (std::list::iterator it = rectList.begin(); it != rectList.end(); ++it, ++layer) { // Allocate the texture for the source frame @@ -1428,7 +1430,7 @@ // Perform prepare operation if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(hwcList); } - hwcDevice->prepare(hwcDevice, 1, &hwcList); + hwcDevice->prepare(hwcDevice, hwcList); if (verbose) { testPrintI("Post Prepare:"); hwcTestDisplayListPrepareModifiable(hwcList); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcRects.cpp android-platform-frameworks-native-21/opengl/tests/hwc/hwcRects.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcRects.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/hwcRects.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -104,6 +104,7 @@ #include #include +#include #include #define LOG_TAG "hwcRectsTest" @@ -164,7 +165,7 @@ list rectangle; static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_SW_WRITE_RARELY; -static hwc_composer_device_1_t *hwcDevice; +static hwc_composer_device_t *hwcDevice; static EGLDisplay dpy; static EGLSurface surface; static EGLint width, height; @@ -204,6 +205,7 @@ { int rv, opt; char *chptr; + bool error; string str; char cmd[MAXCMD]; @@ -305,14 +307,14 @@ } // Create list of frames - hwc_display_contents_1_t *list; + hwc_layer_list_t *list; list = hwcTestCreateLayerList(rectangle.size()); if (list == NULL) { testPrintE("hwcTestCreateLayerList failed"); exit(5); } - hwc_layer_1_t *layer = &list->hwLayers[0]; + hwc_layer_t *layer = &list->hwLayers[0]; for (std::list::iterator it = rectangle.begin(); it != rectangle.end(); ++it, ++layer) { layer->handle = it->texture->handle; @@ -327,7 +329,7 @@ // Perform prepare operation if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); } - hwcDevice->prepare(hwcDevice, 1, &list); + hwcDevice->prepare(hwcDevice, list); if (verbose) { testPrintI("Post Prepare:"); hwcTestDisplayListPrepareModifiable(list); @@ -339,9 +341,7 @@ // Perform the set operation(s) if (verbose) {testPrintI("Set:"); } if (verbose) { hwcTestDisplayListHandles(list); } - list->dpy = dpy; - list->sur = surface; - hwcDevice->set(hwcDevice, 1, &list); + hwcDevice->set(hwcDevice, dpy, surface, list); testDelay(endDelay); @@ -366,6 +366,7 @@ istringstream in(rectStr); const struct hwcTestGraphicFormat *format; Rectangle rect; + struct hwc_rect hwcRect; // Graphic Format in >> str; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcStress.cpp android-platform-frameworks-native-21/opengl/tests/hwc/hwcStress.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcStress.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/hwcStress.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -101,6 +101,7 @@ #include #include +#include #include #define LOG_TAG "hwcStressTest" @@ -191,7 +192,7 @@ // File scope globals static const int texUsage = GraphicBuffer::USAGE_HW_TEXTURE | GraphicBuffer::USAGE_SW_WRITE_RARELY; -static hwc_composer_device_1_t *hwcDevice; +static hwc_composer_device_t *hwcDevice; static EGLDisplay dpy; static EGLSurface surface; static EGLint width, height; @@ -408,7 +409,7 @@ // generated for this pass. srand48(pass); - hwc_display_contents_1_t *list; + hwc_layer_list_t *list; list = hwcTestCreateLayerList(testRandMod(frames.size()) + 1); if (list == NULL) { testPrintE("hwcTestCreateLayerList failed"); @@ -427,7 +428,7 @@ for (unsigned int n1 = 0; n1 < list->numHwLayers; n1++) { unsigned int idx = testRandMod(selectedFrames[n1].size()); sp gBuf = selectedFrames[n1][idx]; - hwc_layer_1_t *layer = &list->hwLayers[n1]; + hwc_layer_t *layer = &list->hwLayers[n1]; layer->handle = gBuf->handle; layer->blending = blendingOps[testRandMod(NUMA(blendingOps))]; @@ -477,7 +478,7 @@ // Perform prepare operation if (verbose) { testPrintI("Prepare:"); hwcTestDisplayList(list); } - hwcDevice->prepare(hwcDevice, 1, &list); + hwcDevice->prepare(hwcDevice, list); if (verbose) { testPrintI("Post Prepare:"); hwcTestDisplayListPrepareModifiable(list); @@ -490,15 +491,13 @@ if (verbose) {testPrintI("Set:"); } for (unsigned int n1 = 0; n1 < numSet; n1++) { if (verbose) { hwcTestDisplayListHandles(list); } - list->dpy = dpy; - list->sur = surface; - hwcDevice->set(hwcDevice, 1, &list); + hwcDevice->set(hwcDevice, dpy, surface, list); // Prandomly select a new set of handles for (unsigned int n1 = 0; n1 < list->numHwLayers; n1++) { unsigned int idx = testRandMod(selectedFrames[n1].size()); sp gBuf = selectedFrames[n1][idx]; - hwc_layer_1_t *layer = &list->hwLayers[n1]; + hwc_layer_t *layer = &list->hwLayers[n1]; layer->handle = (native_handle_t *) gBuf->handle; } @@ -573,8 +572,8 @@ // mod the wMod/hMod value must be equal to 0. size_t w = (width * maxSizeRatio) * testRandFract(); size_t h = (height * maxSizeRatio) * testRandFract(); - w = max(size_t(1u), w); - h = max(size_t(1u), h); + w = max(1u, w); + h = max(1u, h); if ((w % formatPtr->wMod) != 0) { w += formatPtr->wMod - (w % formatPtr->wMod); } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcTestLib.cpp android-platform-frameworks-native-21/opengl/tests/hwc/hwcTestLib.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcTestLib.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/hwcTestLib.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -20,22 +20,22 @@ * Utility library functions for use by the Hardware Composer test cases */ -#include // For ntohl() and htonl() - -#include #include #include +#include // For ntohl() and htonl() + #include "hwcTestLib.h" #include "EGLUtils.h" // Defines -#define NUMA(a) (sizeof(a) / sizeof((a)[0])) +#define NUMA(a) (sizeof(a) / sizeof(a [0])) // Function Prototypes static void printGLString(const char *name, GLenum s); static void checkEglError(const char* op, EGLBoolean returnVal = EGL_TRUE); +static void checkGlError(const char* op); static void printEGLConfiguration(EGLDisplay dpy, EGLConfig config); using namespace std; @@ -51,6 +51,8 @@ { static EGLContext context; + int rv; + EGLBoolean returnValue; EGLConfig myConfig = {0}; EGLint contextAttribs[] = { EGL_CONTEXT_CLIENT_VERSION, 2, EGL_NONE }; @@ -78,11 +80,7 @@ exit(71); } - // The tests want to stop the framework and play with the hardware - // composer, which means it doesn't make sense to use WindowSurface - // here. android_createDisplaySurface() is going away, so just - // politely fail here. - EGLNativeWindowType window = NULL; //android_createDisplaySurface(); + EGLNativeWindowType window = android_createDisplaySurface(); if (window == NULL) { testPrintE("android_createDisplaySurface failed"); exit(72); @@ -136,7 +134,7 @@ } // Open Hardware Composer Device -void hwcTestOpenHwc(hwc_composer_device_1_t **hwcDevicePtr) +void hwcTestOpenHwc(hwc_composer_device_t **hwcDevicePtr) { int rv; hw_module_t const *hwcModule; @@ -147,7 +145,7 @@ perror(NULL); exit(77); } - if ((rv = hwc_open_1(hwcModule, hwcDevicePtr)) != 0) { + if ((rv = hwc_open(hwcModule, hwcDevicePtr)) != 0) { testPrintE("hwc_open failed, rv: %i", rv); errno = -rv; perror(NULL); @@ -401,12 +399,12 @@ * Dynamically creates layer list with numLayers worth * of hwLayers entries. */ -hwc_display_contents_1_t *hwcTestCreateLayerList(size_t numLayers) +hwc_layer_list_t *hwcTestCreateLayerList(size_t numLayers) { - hwc_display_contents_1_t *list; + hwc_layer_list_t *list; - size_t size = sizeof(hwc_display_contents_1_t) + numLayers * sizeof(hwc_layer_1_t); - if ((list = (hwc_display_contents_1_t *) calloc(1, size)) == NULL) { + size_t size = sizeof(hwc_layer_list) + numLayers * sizeof(hwc_layer_t); + if ((list = (hwc_layer_list_t *) calloc(1, size)) == NULL) { return NULL; } list->flags = HWC_GEOMETRY_CHANGED; @@ -419,13 +417,13 @@ * hwcTestFreeLayerList * Frees memory previous allocated via hwcTestCreateLayerList(). */ -void hwcTestFreeLayerList(hwc_display_contents_1_t *list) +void hwcTestFreeLayerList(hwc_layer_list_t *list) { free(list); } // Display the settings of the layer list pointed to by list -void hwcTestDisplayList(hwc_display_contents_1_t *list) +void hwcTestDisplayList(hwc_layer_list_t *list) { testPrintI(" flags: %#x%s", list->flags, (list->flags & HWC_GEOMETRY_CHANGED) ? " GEOMETRY_CHANGED" : ""); @@ -496,7 +494,7 @@ * Displays the portions of a list that are meant to be modified by * a prepare call. */ -void hwcTestDisplayListPrepareModifiable(hwc_display_contents_1_t *list) +void hwcTestDisplayListPrepareModifiable(hwc_layer_list_t *list) { uint32_t numOverlays = 0; for (unsigned int layer = 0; layer < list->numHwLayers; layer++) { @@ -524,7 +522,7 @@ * * Displays the handles of all the graphic buffers in the list. */ -void hwcTestDisplayListHandles(hwc_display_contents_1_t *list) +void hwcTestDisplayListHandles(hwc_layer_list_t *list) { const unsigned int maxLayersPerLine = 6; @@ -562,6 +560,8 @@ {HAL_PIXEL_FORMAT_RGB_888, false, 3, 0, 8, 8, 8, 16, 8, 0, 0}, {HAL_PIXEL_FORMAT_RGB_565, true, 2, 0, 5, 5, 6, 11, 5, 0, 0}, {HAL_PIXEL_FORMAT_BGRA_8888, false, 4, 16, 8, 8, 8, 0, 8, 24, 8}, + {HAL_PIXEL_FORMAT_RGBA_5551, true , 2, 0, 5, 5, 5, 10, 5, 15, 1}, + {HAL_PIXEL_FORMAT_RGBA_4444, false, 2, 12, 4, 0, 4, 4, 4, 8, 4}, {HAL_PIXEL_FORMAT_YV12, true, 3, 16, 8, 8, 8, 0, 8, 0, 0}, }; @@ -614,6 +614,8 @@ {HAL_PIXEL_FORMAT_RGB_888, 3}, {HAL_PIXEL_FORMAT_RGB_565, 2}, {HAL_PIXEL_FORMAT_BGRA_8888, 4}, + {HAL_PIXEL_FORMAT_RGBA_5551, 2}, + {HAL_PIXEL_FORMAT_RGBA_4444, 2}, }; if (gBuf->getPixelFormat() == HAL_PIXEL_FORMAT_YV12) { @@ -666,6 +668,7 @@ for (unsigned int x = 0; x < gBuf->getStride(); x++) { for (unsigned int y = 0; y < gBuf->getHeight(); y++) { + uint32_t val = pixel; hwcTestSetPixel(gBuf, buf, x, y, (x < gBuf->getWidth()) ? pixel : testRand()); } @@ -810,6 +813,10 @@ 0, 0, 31, 31, 0, 0, 63, 63, 0, 0, 31, 31}, {HAL_PIXEL_FORMAT_BGRA_8888, true, false, 0, 0, 255, 255, 0, 0, 255, 255, 0, 0, 255, 255}, + {HAL_PIXEL_FORMAT_RGBA_5551, true, false, + 0, 0, 31, 31, 0, 0, 31, 31, 0, 0, 31, 31}, + {HAL_PIXEL_FORMAT_RGBA_4444, true, false, + 0, 0, 15, 15, 0, 0, 15, 15, 0, 0, 15, 15}, {HAL_PIXEL_FORMAT_YV12, false, true, 0, 16, 235, 255, 0, 16, 240, 255, 0, 16, 240, 255}, }; @@ -962,6 +969,14 @@ } } +static void checkGlError(const char* op) +{ + for (GLint error = glGetError(); error; error + = glGetError()) { + testPrintE("after %s() glError (0x%x)", op, error); + } +} + static void printEGLConfiguration(EGLDisplay dpy, EGLConfig config) { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcTestLib.h android-platform-frameworks-native-21/opengl/tests/hwc/hwcTestLib.h --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/hwc/hwcTestLib.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/hwc/hwcTestLib.h 2012-10-16 22:57:11.000000000 +0000 @@ -27,6 +27,7 @@ #include #include +#include #include #include @@ -45,6 +46,8 @@ {HAL_PIXEL_FORMAT_RGB_888, "RGB888", 1, 1}, {HAL_PIXEL_FORMAT_RGB_565, "RGB565", 1, 1}, {HAL_PIXEL_FORMAT_BGRA_8888, "BGRA8888", 1, 1}, + {HAL_PIXEL_FORMAT_RGBA_5551, "RGBA5551", 1, 1}, + {HAL_PIXEL_FORMAT_RGBA_4444, "RGBA4444", 1, 1}, {HAL_PIXEL_FORMAT_YV12, "YV12", 2, 2}, }; @@ -104,17 +107,17 @@ // Function Prototypes void hwcTestInitDisplay(bool verbose, EGLDisplay *dpy, EGLSurface *surface, EGLint *width, EGLint *height); -void hwcTestOpenHwc(hwc_composer_device_1_t **hwcDevicePtr); +void hwcTestOpenHwc(hwc_composer_device_t **hwcDevicePtr); const struct hwcTestGraphicFormat *hwcTestGraphicFormatLookup(const char *desc); const struct hwcTestGraphicFormat *hwcTestGraphicFormatLookup(uint32_t id); const char *hwcTestGraphicFormat2str(uint32_t format); std::string hwcTestRect2str(const struct hwc_rect& rect); -hwc_display_contents_1_t *hwcTestCreateLayerList(size_t numLayers); -void hwcTestFreeLayerList(hwc_display_contents_1_t *list); -void hwcTestDisplayList(hwc_display_contents_1_t *list); -void hwcTestDisplayListPrepareModifiable(hwc_display_contents_1_t *list); -void hwcTestDisplayListHandles(hwc_display_contents_1_t *list); +hwc_layer_list_t *hwcTestCreateLayerList(size_t numLayers); +void hwcTestFreeLayerList(hwc_layer_list_t *list); +void hwcTestDisplayList(hwc_layer_list_t *list); +void hwcTestDisplayListPrepareModifiable(hwc_layer_list_t *list); +void hwcTestDisplayListHandles(hwc_layer_list_t *list); uint32_t hwcTestColor2Pixel(uint32_t format, ColorFract color, float alpha); void hwcTestColorConvert(uint32_t fromFormat, uint32_t toFormat, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/include/WindowSurface.h android-platform-frameworks-native-21/opengl/tests/include/WindowSurface.h --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/include/WindowSurface.h 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/include/WindowSurface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef OPENGL_TESTS_WINDOWSURFACE_H -#define OPENGL_TESTS_WINDOWSURFACE_H - -#include - -#include - -namespace android { - -/* - * A window that covers the entire display surface. - * - * The window is destroyed when this object is destroyed, so don't try - * to use the surface after that point. - */ -class WindowSurface { -public: - // Creates the window. - WindowSurface(); - - // Retrieves a handle to the window. - EGLNativeWindowType getSurface() const; - -private: - WindowSurface(const WindowSurface&); - WindowSurface& operator=(const WindowSurface&); - - sp mSurfaceControl; -}; - -} // namespace android - -#endif /* OPENGL_TESTS_WINDOWSURFACE_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/lib/Android.mk android-platform-frameworks-native-21/opengl/tests/lib/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/lib/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/lib/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -15,13 +15,18 @@ LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_MODULE_TAGS := tests LOCAL_MODULE:= libglTest -LOCAL_SRC_FILES:= glTestLib.cpp WindowSurface.cpp +LOCAL_SRC_FILES:= glTestLib.cpp LOCAL_C_INCLUDES += system/extras/tests/include \ + bionic \ + bionic/libstdc++/include \ + external/stlport/stlport \ $(call include-path-for, opengl-tests-includes) LOCAL_CFLAGS := -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES +LOCAL_SHARED_LIBRARIES += libcutils libutils libstlport + + include $(BUILD_STATIC_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/lib/WindowSurface.cpp android-platform-frameworks-native-21/opengl/tests/lib/WindowSurface.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/lib/WindowSurface.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/lib/WindowSurface.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/* - * Copyright 2014 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 - -#include -#include -#include -#include - -using namespace android; - -WindowSurface::WindowSurface() { - status_t err; - - sp surfaceComposerClient = new SurfaceComposerClient; - err = surfaceComposerClient->initCheck(); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposerClient::initCheck error: %#x\n", err); - return; - } - - // Get main display parameters. - sp mainDpy = SurfaceComposerClient::getBuiltInDisplay( - ISurfaceComposer::eDisplayIdMain); - DisplayInfo mainDpyInfo; - err = SurfaceComposerClient::getDisplayInfo(mainDpy, &mainDpyInfo); - if (err != NO_ERROR) { - fprintf(stderr, "ERROR: unable to get display characteristics\n"); - return; - } - - uint32_t width, height; - if (mainDpyInfo.orientation != DISPLAY_ORIENTATION_0 && - mainDpyInfo.orientation != DISPLAY_ORIENTATION_180) { - // rotated - width = mainDpyInfo.h; - height = mainDpyInfo.w; - } else { - width = mainDpyInfo.w; - height = mainDpyInfo.h; - } - - sp sc = surfaceComposerClient->createSurface( - String8("Benchmark"), width, height, - PIXEL_FORMAT_RGBX_8888, ISurfaceComposerClient::eOpaque); - if (sc == NULL || !sc->isValid()) { - fprintf(stderr, "Failed to create SurfaceControl\n"); - return; - } - - SurfaceComposerClient::openGlobalTransaction(); - err = sc->setLayer(0x7FFFFFFF); // always on top - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::setLayer error: %#x\n", err); - return; - } - - err = sc->show(); - if (err != NO_ERROR) { - fprintf(stderr, "SurfaceComposer::show error: %#x\n", err); - return; - } - SurfaceComposerClient::closeGlobalTransaction(); - - mSurfaceControl = sc; -} - -EGLNativeWindowType WindowSurface::getSurface() const { - sp anw = mSurfaceControl->getSurface(); - return (EGLNativeWindowType) anw.get(); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/linetex/Android.mk android-platform-frameworks-native-21/opengl/tests/linetex/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/linetex/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/linetex/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/linetex/linetex.cpp android-platform-frameworks-native-21/opengl/tests/linetex/linetex.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/linetex/linetex.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/linetex/linetex.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -15,6 +15,8 @@ ** limitations under the License. */ +#define LOG_TAG "fillrate" + #include #include #include @@ -24,8 +26,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -44,8 +46,7 @@ EGLint w, h; EGLDisplay dpy; - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); @@ -80,11 +81,9 @@ // default pack-alignment is 4 const uint16_t t16[64] = { 0xFFFF, 0, 0xF800, 0, 0x07E0, 0, 0x001F, 0 }; - const GLfloat fh = h; - const GLfloat fw2 = w/2; const GLfloat vertices[4][2] = { - { fw2, 0 }, - { fw2, fh } + { w/2, 0 }, + { w/2, h } }; const GLfloat texCoords[4][2] = { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/swapinterval/Android.mk android-platform-frameworks-native-21/opengl/tests/swapinterval/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/swapinterval/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/swapinterval/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -9,10 +9,7 @@ libutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/swapinterval/swapinterval.cpp android-platform-frameworks-native-21/opengl/tests/swapinterval/swapinterval.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/swapinterval/swapinterval.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/swapinterval/swapinterval.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -23,8 +23,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -45,8 +45,7 @@ EGLDisplay dpy; - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/textures/Android.mk android-platform-frameworks-native-21/opengl/tests/textures/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/textures/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/textures/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/textures/textures.cpp android-platform-frameworks-native-21/opengl/tests/textures/textures.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/textures/textures.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/textures/textures.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -22,8 +22,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" using namespace android; @@ -42,8 +42,7 @@ EGLint w, h; EGLDisplay dpy; - WindowSurface windowSurface; - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); dpy = eglGetDisplay(EGL_DEFAULT_DISPLAY); eglInitialize(dpy, &majorVersion, &minorVersion); @@ -115,7 +114,5 @@ glDrawTexiOES(dim/2, dim/2, 0, dim/2, dim/2); eglSwapBuffers(dpy, surface); - - sleep(2); // so you have a chance to admire it return 0; } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/tritex/Android.mk android-platform-frameworks-native-21/opengl/tests/tritex/Android.mk --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/tritex/Android.mk 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/tritex/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -8,11 +8,7 @@ libcutils \ libEGL \ libGLESv1_CM \ - libui \ - libgui \ - libutils - -LOCAL_STATIC_LIBRARIES += libglTest + libui LOCAL_C_INCLUDES += $(call include-path-for, opengl-tests-includes) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tests/tritex/tritex.cpp android-platform-frameworks-native-21/opengl/tests/tritex/tritex.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tests/tritex/tritex.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tests/tritex/tritex.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -8,8 +8,8 @@ #include #include -#include -#include +#include +#include "EGLUtils.h" #include #include @@ -25,7 +25,7 @@ #define FIXED_ONE 0x10000 #define ITERATIONS 50 -int init_gl_surface(const WindowSurface&); +int init_gl_surface(void); void free_gl_surface(void); void init_scene(void); void render(int quads); @@ -98,8 +98,7 @@ printf("Initializing EGL...\n"); - WindowSurface windowSurface; - if(!init_gl_surface(windowSurface)) + if(!init_gl_surface()) { printf("GL initialisation failed - exiting\n"); return 0; @@ -118,7 +117,7 @@ return 0; } -int init_gl_surface(const WindowSurface& windowSurface) +int init_gl_surface(void) { EGLint numConfigs = 1; EGLConfig myConfig = {0}; @@ -141,7 +140,7 @@ return 0; } - EGLNativeWindowType window = windowSurface.getSurface(); + EGLNativeWindowType window = android_createDisplaySurface(); EGLUtils::selectConfigForNativeWindow(eglDisplay, attrib, window, &myConfig); if ( (eglSurface = eglCreateWindowSurface(eglDisplay, myConfig, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/gen android-platform-frameworks-native-21/opengl/tools/glgen/gen --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/gen 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/gen 2012-10-16 22:57:11.000000000 +0000 @@ -12,7 +12,6 @@ mkdir -p out/com/google/android/gles_jni mkdir -p out/android/app mkdir -p out/android/graphics -mkdir -p out/android/view mkdir -p out/android/opengl mkdir -p out/android/content mkdir -p out/android/content/pm @@ -25,30 +24,15 @@ echo "package android.app; import android.content.pm.IPackageManager; public class AppGlobals { public static IPackageManager getPackageManager() { return null;} }" > out/android/app/AppGlobals.java # echo "package android.content; import android.content.pm.PackageManager; public interface Context { public PackageManager getPackageManager(); }" > out/android/content/Context.java echo "package android.content.pm; public class ApplicationInfo {public int targetSdkVersion;}" > out/android/content/pm/ApplicationInfo.java -echo "package android.content.pm; public interface IPackageManager {ApplicationInfo getApplicationInfo(java.lang.String packageName, int flags, java.lang.String userId) throws android.os.RemoteException;}" > out/android/content/pm/IPackageManager.java +echo "package android.content.pm; public interface IPackageManager {ApplicationInfo getApplicationInfo(java.lang.String packageName, int flags) throws android.os.RemoteException;}" > out/android/content/pm/IPackageManager.java echo "package android.os; public class Build {public static class VERSION_CODES { public static final int CUPCAKE = 3;}; }" > out/android/os/Build.java -echo "package android.os; public class UserHandle {public static String myUserId() { return \"\"; } }" > out/android/os/UserHandle.java echo "package android.os; public class RemoteException extends Exception {}" > out/android/os/RemoteException.java echo "package android.util; public class Log {public static void w(String a, String b) {} public static void e(String a, String b) {}}" > out/android/util/Log.java -echo "package android.opengl; public abstract class EGLObjectHandle { public int getHandle() { return 0; } }" > out/android/opengl/EGLObjectHandle.java - - -echo "package android.graphics;" > out/android/graphics/SurfaceTexture.java -echo "public interface SurfaceTexture {}" >> out/android/graphics/SurfaceTexture.java -echo "package android.view;" > out/android/view/SurfaceView.java -echo "public interface SurfaceView { SurfaceHolder getHolder(); }" >> out/android/view/SurfaceView.java -echo "package android.view;" > out/android/view/Surface.java -echo "public interface Surface {}" >> out/android/view/Surface.java -echo "package android.view;" > out/android/view/SurfaceHolder.java -echo "public interface SurfaceHolder { Surface getSurface(); }" >> out/android/view/SurfaceHolder.java - -cp static/egl/*.java out/android/opengl/ - GLFILE=out/javax/microedition/khronos/opengles/GL.java cp stubs/jsr239/GLHeader.java-if $GLFILE -GLGEN_FILES="CFunc.java CType.java CodeEmitter.java EGLCodeEmitter.java GenerateEGL.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java" +GLGEN_FILES="CFunc.java CType.java CodeEmitter.java GenerateGL.java GenerateGLES.java GLESCodeEmitter.java JFunc.java JniCodeEmitter.java JType.java Jsr239CodeEmitter.java ParameterChecker.java" pushd src > /dev/null javac ${GLGEN_FILES} @@ -60,19 +44,14 @@ popd > /dev/null echo "Generating JSR239-like APIs" -java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 \ - specs/jsr239/glspec-1.0ext \ - specs/jsr239/glspec-1.1 \ - specs/jsr239/glspec-1.1ext \ - specs/jsr239/glspec-1.1extpack \ - specs/jsr239/glspec-checks +java -classpath src GenerateGL -c specs/jsr239/glspec-1.0 specs/jsr239/glspec-1.0ext specs/jsr239/glspec-1.1 specs/jsr239/glspec-1.1ext specs/jsr239/glspec-1.1extpack specs/jsr239/glspec-checks JAVA_RESULT=$? if [ $JAVA_RESULT -ne 0 ]; then echo "Could not run GenerateGL." exit $JAVA_RESULT fi -echo "Generating static OpenGLES bindings" +echo "Generating static OpenGLES 1.1 bindings" java -classpath src GenerateGLES JAVA_RESULT=$? if [ $JAVA_RESULT -ne 0 ]; then @@ -80,34 +59,11 @@ exit $JAVA_RESULT fi -echo "Generating static EGL bindings" -java -classpath src GenerateEGL -JAVA_RESULT=$? -if [ $JAVA_RESULT -ne 0 ]; then - echo "Could not run GenerateEGL." - exit $JAVA_RESULT -fi - rm src/*.class pushd out > /dev/null mkdir classes -javac -d classes android/opengl/EGL14.java \ - android/opengl/EGLExt.java \ - com/google/android/gles_jni/GLImpl.java \ - javax/microedition/khronos/opengles/GL10.java \ - javax/microedition/khronos/opengles/GL10Ext.java \ - javax/microedition/khronos/opengles/GL11.java \ - javax/microedition/khronos/opengles/GL11Ext.java \ - javax/microedition/khronos/opengles/GL11ExtensionPack.java \ - android/opengl/GLES10.java \ - android/opengl/GLES10Ext.java \ - android/opengl/GLES11.java \ - android/opengl/GLES11Ext.java \ - android/opengl/GLES20.java \ - android/opengl/GLES30.java \ - android/opengl/GLES31.java \ - android/opengl/GLES31Ext.java +javac -d classes com/google/android/gles_jni/GLImpl.java javax/microedition/khronos/opengles/GL10.java javax/microedition/khronos/opengles/GL10Ext.java javax/microedition/khronos/opengles/GL11.java javax/microedition/khronos/opengles/GL11Ext.java javax/microedition/khronos/opengles/GL11ExtensionPack.java android/opengl/GLES10.java android/opengl/GLES10Ext.java android/opengl/GLES11.java android/opengl/GLES11Ext.java android/opengl/GLES20.java popd > /dev/null JAVA_RESULT=$? if [ $JAVA_RESULT -ne 0 ]; then @@ -134,35 +90,29 @@ if cmp -s $1/$3 $2/$3 ; then echo "# " $3 unchanged else - echo "# " $3 changed if [ $SAID_PLEASE == "0" ] ; then echo Please evaluate the following commands: echo SAID_PLEASE=1 fi - echo " cp $2/$3 $1" - echo " (cd $1; git add $3)" + echo " " cp $2/$3 $1 + echo " " git add $1/$3 KEEP_GENERATED=1 fi } -compareGenerated ../../../../base/core/jni generated/C com_google_android_gles_jni_GLImpl.cpp -compareGenerated ../../../../base/opengl/java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java +compareGenerated ../../../core/jni generated/C com_google_android_gles_jni_GLImpl.cpp +compareGenerated ../../java/com/google/android/gles_jni generated/com/google/android/gles_jni GLImpl.java for x in GL.java GL10.java GL10Ext.java GL11.java GL11Ext.java GL11ExtensionPack.java do - compareGenerated ../../../../base/opengl/java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x -done - -for x in EGL14 EGLExt GLES10 GLES10Ext GLES11 GLES11Ext GLES20 GLES30 GLES31 GLES31Ext -do - compareGenerated ../../../../base/opengl/java/android/opengl generated/android/opengl ${x}.java - compareGenerated ../../../../base/core/jni generated/C android_opengl_${x}.cpp + compareGenerated ../../java/javax/microedition/khronos/opengles generated/javax/microedition/khronos/opengles $x done -for x in EGLConfig EGLContext EGLDisplay EGLObjectHandle EGLSurface +for x in GLES10 GLES10Ext GLES11 GLES11Ext GLES20 do - compareGenerated ../../../../base/opengl/java/android/opengl generated/android/opengl ${x}.java + compareGenerated ../../java/android/opengl generated/android/opengl ${x}.java + compareGenerated ../../../core/jni generated/C android_opengl_${x}.cpp done if [ $KEEP_GENERATED == "0" ] ; then diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/egl/checks.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/egl/checks.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/egl/checks.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/egl/checks.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -eglInitialize check major 1 check minor 1 -eglGetConfigs check configs config_size -eglChooseConfig check configs config_size check num_config 1 sentinel attrib_list EGL_NONE -eglGetConfigAttrib check value 1 -//STUB function: //eglCreateWindowSurface sentinel attrib_list EGL_NONE -eglCreatePbufferSurface sentinel attrib_list EGL_NONE -//unsupported: eglCreatePixmapSurface sentinel attrib_list EGL_NONE -eglCreatePixmapSurface unsupported -eglCopyBuffers unsupported -eglQuerySurface check value 1 -eglCreatePbufferFromClientBuffer sentinel attrib_list EGL_NONE -eglCreateContext sentinel attrib_list EGL_NONE -eglQueryContext check value 1 diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/egl/EGL14.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/egl/EGL14.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/egl/EGL14.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/egl/EGL14.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,33 +0,0 @@ -EGLint eglGetError ( void ) -EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) -EGLBoolean eglInitialize ( EGLDisplay dpy, EGLint *major, EGLint *minor ) -EGLBoolean eglTerminate ( EGLDisplay dpy ) -const char * eglQueryString ( EGLDisplay dpy, EGLint name ) -EGLBoolean eglGetConfigs ( EGLDisplay dpy, EGLConfig *configs, EGLint config_size, EGLint *num_config ) -EGLBoolean eglChooseConfig ( EGLDisplay dpy, const EGLint *attrib_list, EGLConfig *configs, EGLint config_size, EGLint *num_config ) -EGLBoolean eglGetConfigAttrib ( EGLDisplay dpy, EGLConfig config, EGLint attribute, EGLint *value ) -EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) -EGLSurface eglCreatePbufferSurface ( EGLDisplay dpy, EGLConfig config, const EGLint *attrib_list ) -EGLSurface eglCreatePixmapSurface ( EGLDisplay dpy, EGLConfig config, EGLNativePixmapType pixmap, const EGLint *attrib_list ) -EGLBoolean eglDestroySurface ( EGLDisplay dpy, EGLSurface surface ) -EGLBoolean eglQuerySurface ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint *value ) -EGLBoolean eglBindAPI ( EGLenum api ) -EGLenum eglQueryAPI ( void ) -EGLBoolean eglWaitClient ( void ) -EGLBoolean eglReleaseThread ( void ) -EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) -EGLBoolean eglSurfaceAttrib ( EGLDisplay dpy, EGLSurface surface, EGLint attribute, EGLint value ) -EGLBoolean eglBindTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) -EGLBoolean eglReleaseTexImage ( EGLDisplay dpy, EGLSurface surface, EGLint buffer ) -EGLBoolean eglSwapInterval ( EGLDisplay dpy, EGLint interval ) -EGLContext eglCreateContext ( EGLDisplay dpy, EGLConfig config, EGLContext share_context, const EGLint *attrib_list ) -EGLBoolean eglDestroyContext ( EGLDisplay dpy, EGLContext ctx ) -EGLBoolean eglMakeCurrent ( EGLDisplay dpy, EGLSurface draw, EGLSurface read, EGLContext ctx ) -EGLContext eglGetCurrentContext ( void ) -EGLSurface eglGetCurrentSurface ( EGLint readdraw ) -EGLDisplay eglGetCurrentDisplay ( void ) -EGLBoolean eglQueryContext ( EGLDisplay dpy, EGLContext ctx, EGLint attribute, EGLint *value ) -EGLBoolean eglWaitGL ( void ) -EGLBoolean eglWaitNative ( EGLint engine ) -EGLBoolean eglSwapBuffers ( EGLDisplay dpy, EGLSurface surface ) -EGLBoolean eglCopyBuffers ( EGLDisplay dpy, EGLSurface surface, EGLNativePixmapType target ) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/egl/EGLExt.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/egl/EGLExt.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/egl/EGLExt.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/egl/EGLExt.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -EGLBoolean eglPresentationTimeANDROID ( EGLDisplay dpy, EGLSurface sur, EGLnsecsANDROID time ) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/checks.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/checks.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/checks.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/checks.spec 2012-10-16 22:57:11.000000000 +0000 @@ -1,99 +1,42 @@ -# Copyright (C) 2013 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. -# - -# -# ifcheck defaults to 1 so we don't explicitly list pnames requiring -# a single value. unknown pnames will be validated against one value, which -# is not perfect but better than nothing. -# - -glBufferData nullAllowed check data size -glBufferSubData check data size -# glCompressedTexImage2D -# glCompressedTexSubImage2D glClipPlanef check eqn 4 glClipPlanex check eqn 4 +glGetClipPlanefOES check eqn 4 +glGetClipPlanexOES check eqn 4 glDeleteBuffers check buffers n -glDeleteFramebuffers check framebuffers n -glDeleteFramebuffersOES check framebuffers n -glDeleteRenderbuffers check renderbuffers n -glDeleteRenderbuffersOES check renderbuffers n glDeleteTextures check textures n glDrawElements check_AIOOBE indices count +glFog ifcheck params 1 pname GL_FOG_MODE,GL_FOG_DENSITY,GL_FOG_START,GL_FOG_END ifcheck params 4 pname GL_FOG_COLOR +glGenBuffers check buffers n +glGenTextures check textures n +glGetClipPlane check eqn 4 +glGetIntegerv ifcheck params 1 pname GL_ALPHA_BITS,GL_ALPHA_TEST_FUNC,GL_ALPHA_TEST_REF,GL_BLEND_DST,GL_BLUE_BITS,GL_COLOR_ARRAY_BUFFER_BINDING,GL_COLOR_ARRAY_SIZE,GL_COLOR_ARRAY_STRIDE,GL_COLOR_ARRAY_TYPE,GL_CULL_FACE,GL_DEPTH_BITS,GL_DEPTH_CLEAR_VALUE,GL_DEPTH_FUNC,GL_DEPTH_WRITEMASK,GL_FOG_DENSITY,GL_FOG_END,GL_FOG_MODE,GL_FOG_START,GL_FRONT_FACE,GL_GREEN_BITS,GL_IMPLEMENTATION_COLOR_READ_FORMAT_OES,GL_IMPLEMENTATION_COLOR_READ_TYPE_OES,GL_LIGHT_MODEL_COLOR_CONTROL,GL_LIGHT_MODEL_LOCAL_VIEWER,GL_LIGHT_MODEL_TWO_SIDE,GL_LINE_SMOOTH_HINT,GL_LINE_WIDTH,GL_LOGIC_OP_MODE,GL_MATRIX_INDEX_ARRAY_BUFFER_BINDING_OES,GL_MATRIX_INDEX_ARRAY_SIZE_OES,GL_MATRIX_INDEX_ARRAY_STRIDE_OES,GL_MATRIX_INDEX_ARRAY_TYPE_OES,GL_MATRIX_MODE,GL_MAX_CLIP_PLANES,GL_MAX_ELEMENTS_INDICES,GL_MAX_ELEMENTS_VERTICES,GL_MAX_LIGHTS,GL_MAX_MODELVIEW_STACK_DEPTH,GL_MAX_PALETTE_MATRICES_OES,GL_MAX_PROJECTION_STACK_DEPTH,GL_MAX_TEXTURE_SIZE,GL_MAX_TEXTURE_STACK_DEPTH,GL_MAX_TEXTURE_UNITS,GL_MAX_VERTEX_UNITS_OES,GL_MODELVIEW_STACK_DEPTH,GL_NORMAL_ARRAY_BUFFER_BINDING,GL_NORMAL_ARRAY_STRIDE,GL_NORMAL_ARRAY_TYPE,GL_NUM_COMPRESSED_TEXTURE_FORMATS,GL_PACK_ALIGNMENT,GL_PERSPECTIVE_CORRECTION_HINT,GL_POINT_SIZE,GL_POINT_SIZE_ARRAY_BUFFER_BINDING_OES,GL_POINT_SIZE_ARRAY_STRIDE_OES,GL_POINT_SIZE_ARRAY_TYPE_OES,GL_POINT_SMOOTH_HINT,GL_POLYGON_OFFSET_FACTOR,GL_POLYGON_OFFSET_UNITS,GL_PROJECTION_STACK_DEPTH,GL_RED_BITS,GL_SHADE_MODEL,GL_STENCIL_BITS,GL_STENCIL_CLEAR_VALUE,GL_STENCIL_FAIL,GL_STENCIL_FUNC,GL_STENCIL_PASS_DEPTH_FAIL,GL_STENCIL_PASS_DEPTH_PASS,GL_STENCIL_REF,GL_STENCIL_VALUE_MASK,GL_STENCIL_WRITEMASK,GL_SUBPIXEL_BITS,GL_TEXTURE_BINDING_2D,GL_TEXTURE_COORD_ARRAY_BUFFER_BINDING,GL_TEXTURE_COORD_ARRAY_SIZE,GL_TEXTURE_COORD_ARRAY_STRIDE,GL_TEXTURE_COORD_ARRAY_TYPE,GL_TEXTURE_STACK_DEPTH,GL_UNPACK_ALIGNMENT,GL_VERTEX_ARRAY_BUFFER_BINDING,GL_VERTEX_ARRAY_SIZE,GL_VERTEX_ARRAY_STRIDE,GL_VERTEX_ARRAY_TYPE,GL_WEIGHT_ARRAY_BUFFER_BINDING_OES,GL_WEIGHT_ARRAY_SIZE_OES,GL_WEIGHT_ARRAY_STRIDE_OES,GL_WEIGHT_ARRAY_TYPE_OES ifcheck params 2 pname GL_ALIASED_POINT_SIZE_RANGE,GL_ALIASED_LINE_WIDTH_RANGE,GL_DEPTH_RANGE,GL_MAX_VIEWPORT_DIMS,GL_SMOOTH_LINE_WIDTH_RANGE,GL_SMOOTH_POINT_SIZE_RANGE ifcheck params 4 pname GL_COLOR_CLEAR_VALUE,GL_COLOR_WRITEMASK,GL_FOG_COLOR,GL_LIGHT_MODEL_AMBIENT,GL_SCISSOR_BOX,GL_VIEWPORT ifcheck params 16 pname GL_MODELVIEW_MATRIX,GL_MODELVIEW_MATRIX_FLOAT_AS_INT_BITS_OES,GL_PROJECTION_MATRIX,GL_PROJECTION_MATRIX_FLOAT_AS_INT_BITS_OES,GL_TEXTURE_MATRIX,GL_TEXTURE_MATRIX_FLOAT_AS_INT_BITS_OES ifcheck params getNumCompressedTextureFormats() pname GL_COMPRESSED_TEXTURE_FORMATS +glGetLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION +glGetMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE +glGetTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR +glGetTexParameter check params 1 +glLightModel ifcheck params 1 pname GL_LIGHT_MODEL_TWO_SIDE ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT +glLight ifcheck params 1 pname GL_SPOT_EXPONENT,GL_SPOT_CUTOFF,GL_CONSTANT_ATTENUATION,GL_LINEAR_ATTENUATION,GL_QUADRATIC_ATTENUATION ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION +glLoadMatrix check m 16 +glMaterial ifcheck params 1 pname GL_SHININESS ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE +glMultMatrix check m 16 +glPointParameter check params 1 +glTexEnv ifcheck params 1 pname GL_TEXTURE_ENV_MODE,GL_COMBINE_RGB,GL_COMBINE_ALPHA ifcheck params 4 pname GL_TEXTURE_ENV_COLOR +glTexImage2D nullAllowed +glTexSubImage2D nullAllowed +glBufferData nullAllowed check data size +glBufferSubData check data size +glTexParameter check params 1 +glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 glDrawTexfvOES check coords 5 glDrawTexivOES check coords 5 glDrawTexsvOES check coords 5 glDrawTexxvOES check coords 5 -glFog ifcheck params 4 pname GL_FOG_COLOR -glGenBuffers check buffers n +glDeleteFramebuffersOES check framebuffers n +glDeleteRenderbuffersOES check renderbuffers n glGenFramebuffersOES check framebuffers n -glGenFramebuffers check framebuffers n glGenRenderbuffersOES check renderbuffers n -glGenRenderbuffers check renderbuffers n -glGenTextures check textures n -// glGetActiveAttrib -// glGetActiveUniform -glGetAttachedShaders nullAllowed check count 1 check shaders maxcount -// glGetBooleanv glGetBufferParameter check params 1 -glGetClipPlanef check eqn 4 -glGetClipPlanex check eqn 4 -glGetClipPlanefOES check eqn 4 -glGetClipPlanexOES check eqn 4 -// glGetFloatv glGetFramebufferAttachmentParameterivOES check params 1 -// glGetIntegerv -glGetLight ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION -glGetMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE -// glGetProgramInfoLog -glGetProgramiv check params 1 -glGetRenderbufferParameteriv check params 1 glGetRenderbufferParameterivOES check params 1 -// glGetShaderInfoLog -glGetShaderiv check params 1 -glGetShaderPrecisionFormat check range 1 check precision 1 -// glGetShaderSource -// glGetString -glGetTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR -glGetTexGen ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE -glGetTexParameter check params 1 -glGetUniform check params 1 -glGetVertexAttrib ifcheck params 4 pname GL_CURRENT_VERTEX_ATTRIB -glLight ifcheck params 3 pname GL_SPOT_DIRECTION ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION -glLightModel ifcheck params 4 pname GL_LIGHT_MODEL_AMBIENT -glLoadMatrix check m 16 -glMaterial ifcheck params 4 pname GL_AMBIENT,GL_DIFFUSE,GL_SPECULAR,GL_EMISSION,GL_AMBIENT_AND_DIFFUSE -glMultMatrix check m 16 -glPointParameter check params 1 -glQueryMatrixxOES check mantissa 16 check exponent 16 return -1 -# glReadPixels -glShaderBinary check binary length -// glShaderSource -glTexEnv ifcheck params 4 pname GL_TEXTURE_ENV_COLOR -glTexImage2D nullAllowed -glTexParameter check params 1 -glTexSubImage2D nullAllowed -glUniform1 check v count -glUniform2 check v count*2 -glUniform3 check v count*3 -glUniform4 check v count*4 -glUniformMatrix2 check value count*4 -glUniformMatrix3 check value count*9 -glUniformMatrix4 check value count*16 -glVertexAttrib1 check values 1 -glVertexAttrib2 check values 2 -glVertexAttrib3 check values 3 -glVertexAttrib4 check values 4 -# glVertexAttribPointer +glGetTexGen ifcheck params 1 pname GL_TEXTURE_GEN_MODE ifcheck params 4 pname GL_OBJECT_PLANE,GL_EYE_PLANE + diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES20.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES20.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES20.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES20.spec 2012-10-16 22:57:11.000000000 +0000 @@ -1,144 +1,144 @@ -void glActiveTexture ( GLenum texture ) -void glAttachShader ( GLuint program, GLuint shader ) -void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) -void glBindBuffer ( GLenum target, GLuint buffer ) -void glBindFramebuffer ( GLenum target, GLuint framebuffer ) -void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) -void glBindTexture ( GLenum target, GLuint texture ) -void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) -void glBlendEquation ( GLenum mode ) -void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) -void glBlendFunc ( GLenum sfactor, GLenum dfactor ) -void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) -void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) -void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) -GLenum glCheckFramebufferStatus ( GLenum target ) -void glClear ( GLbitfield mask ) -void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) -void glClearDepthf ( GLclampf depth ) -void glClearStencil ( GLint s ) -void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) -void glCompileShader ( GLuint shader ) -void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) -void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) -void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) -void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) -GLuint glCreateProgram ( void ) -GLuint glCreateShader ( GLenum type ) -void glCullFace ( GLenum mode ) -void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) -void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) -void glDeleteProgram ( GLuint program ) -void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) -void glDeleteShader ( GLuint shader ) -void glDeleteTextures ( GLsizei n, const GLuint *textures ) -void glDepthFunc ( GLenum func ) -void glDepthMask ( GLboolean flag ) -void glDepthRangef ( GLclampf zNear, GLclampf zFar ) -void glDetachShader ( GLuint program, GLuint shader ) -void glDisable ( GLenum cap ) -void glDisableVertexAttribArray ( GLuint index ) -void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) -void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) -void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) -void glEnable ( GLenum cap ) -void glEnableVertexAttribArray ( GLuint index ) -void glFinish ( void ) -void glFlush ( void ) -void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) -void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) -void glFrontFace ( GLenum mode ) -void glGenBuffers ( GLsizei n, GLuint *buffers ) -void glGenerateMipmap ( GLenum target ) -void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) -void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) -void glGenTextures ( GLsizei n, GLuint *textures ) -void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) -void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) -void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) -GLint glGetAttribLocation ( GLuint program, const char *name ) -void glGetBooleanv ( GLenum pname, GLboolean *params ) -void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) -GLenum glGetError ( void ) -void glGetFloatv ( GLenum pname, GLfloat *params ) -void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) -void glGetIntegerv ( GLenum pname, GLint *params ) -void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) -void glGetProgramInfoLog ( GLuint program, GLsizei bufsize, GLsizei *length, char *infolog ) -void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) -void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) -void glGetShaderInfoLog ( GLuint shader, GLsizei bufsize, GLsizei *length, char *infolog ) -void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) -void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) -const GLubyte * glGetString ( GLenum name ) -void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) -void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) -void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) -void glGetUniformiv ( GLuint program, GLint location, GLint *params ) -GLint glGetUniformLocation ( GLuint program, const char *name ) -void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) -void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) -// void glGetVertexAttribPointerv ( GLuint index, GLenum pname, void **pointer ) -void glHint ( GLenum target, GLenum mode ) -GLboolean glIsBuffer ( GLuint buffer ) -GLboolean glIsEnabled ( GLenum cap ) -GLboolean glIsFramebuffer ( GLuint framebuffer ) -GLboolean glIsProgram ( GLuint program ) -GLboolean glIsRenderbuffer ( GLuint renderbuffer ) -GLboolean glIsShader ( GLuint shader ) -GLboolean glIsTexture ( GLuint texture ) -void glLineWidth ( GLfloat width ) -void glLinkProgram ( GLuint program ) -void glPixelStorei ( GLenum pname, GLint param ) -void glPolygonOffset ( GLfloat factor, GLfloat units ) -void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) -void glReleaseShaderCompiler ( void ) -void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) -void glSampleCoverage ( GLclampf value, GLboolean invert ) -void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) -void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) -void glShaderSource ( GLuint shader ) -void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) -void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) -void glStencilMask ( GLuint mask ) -void glStencilMaskSeparate ( GLenum face, GLuint mask ) -void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) -void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) -void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) -void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) -void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) -void glTexParameteri ( GLenum target, GLenum pname, GLint param ) -void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) -void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) -void glUniform1f ( GLint location, GLfloat x ) -void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) -void glUniform1i ( GLint location, GLint x ) -void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) -void glUniform2f ( GLint location, GLfloat x, GLfloat y ) -void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) -void glUniform2i ( GLint location, GLint x, GLint y ) -void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) -void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) -void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) -void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) -void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) -void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) -void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) -void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) -void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUseProgram ( GLuint program ) -void glValidateProgram ( GLuint program ) -void glVertexAttrib1f ( GLuint indx, GLfloat x ) -void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) -void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) -void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) -void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) -void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) -void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) -void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) -void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) -void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) -void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) +void glActiveTexture ( GLenum texture ) +void glAttachShader ( GLuint program, GLuint shader ) +void glBindAttribLocation ( GLuint program, GLuint index, const char *name ) +void glBindBuffer ( GLenum target, GLuint buffer ) +void glBindFramebuffer ( GLenum target, GLuint framebuffer ) +void glBindRenderbuffer ( GLenum target, GLuint renderbuffer ) +void glBindTexture ( GLenum target, GLuint texture ) +void glBlendColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +void glBlendEquation ( GLenum mode ) +void glBlendEquationSeparate ( GLenum modeRGB, GLenum modeAlpha ) +void glBlendFunc ( GLenum sfactor, GLenum dfactor ) +void glBlendFuncSeparate ( GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) +void glBufferData ( GLenum target, GLsizeiptr size, const GLvoid *data, GLenum usage ) +void glBufferSubData ( GLenum target, GLintptr offset, GLsizeiptr size, const GLvoid *data ) +GLenum glCheckFramebufferStatus ( GLenum target ) +void glClear ( GLbitfield mask ) +void glClearColor ( GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha ) +void glClearDepthf ( GLclampf depth ) +void glClearStencil ( GLint s ) +void glColorMask ( GLboolean red, GLboolean green, GLboolean blue, GLboolean alpha ) +void glCompileShader ( GLuint shader ) +void glCompressedTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLint border, GLsizei imageSize, const GLvoid *data ) +void glCompressedTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLsizei imageSize, const GLvoid *data ) +void glCopyTexImage2D ( GLenum target, GLint level, GLenum internalformat, GLint x, GLint y, GLsizei width, GLsizei height, GLint border ) +void glCopyTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint x, GLint y, GLsizei width, GLsizei height ) +GLuint glCreateProgram ( void ) +GLuint glCreateShader ( GLenum type ) +void glCullFace ( GLenum mode ) +void glDeleteBuffers ( GLsizei n, const GLuint *buffers ) +void glDeleteFramebuffers ( GLsizei n, const GLuint *framebuffers ) +void glDeleteProgram ( GLuint program ) +void glDeleteRenderbuffers ( GLsizei n, const GLuint *renderbuffers ) +void glDeleteShader ( GLuint shader ) +void glDeleteTextures ( GLsizei n, const GLuint *textures ) +void glDepthFunc ( GLenum func ) +void glDepthMask ( GLboolean flag ) +void glDepthRangef ( GLclampf zNear, GLclampf zFar ) +void glDetachShader ( GLuint program, GLuint shader ) +void glDisable ( GLenum cap ) +void glDisableVertexAttribArray ( GLuint index ) +void glDrawArrays ( GLenum mode, GLint first, GLsizei count ) +void glDrawElements ( GLenum mode, GLsizei count, GLenum type, GLint offset ) +void glDrawElements ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices ) +void glEnable ( GLenum cap ) +void glEnableVertexAttribArray ( GLuint index ) +void glFinish ( void ) +void glFlush ( void ) +void glFramebufferRenderbuffer ( GLenum target, GLenum attachment, GLenum renderbuffertarget, GLuint renderbuffer ) +void glFramebufferTexture2D ( GLenum target, GLenum attachment, GLenum textarget, GLuint texture, GLint level ) +void glFrontFace ( GLenum mode ) +void glGenBuffers ( GLsizei n, GLuint *buffers ) +void glGenerateMipmap ( GLenum target ) +void glGenFramebuffers ( GLsizei n, GLuint *framebuffers ) +void glGenRenderbuffers ( GLsizei n, GLuint *renderbuffers ) +void glGenTextures ( GLsizei n, GLuint *textures ) +void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) +void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) +void glGetAttachedShaders ( GLuint program, GLsizei maxcount, GLsizei *count, GLuint *shaders ) +int glGetAttribLocation ( GLuint program, const char *name ) +void glGetBooleanv ( GLenum pname, GLboolean *params ) +void glGetBufferParameteriv ( GLenum target, GLenum pname, GLint *params ) +GLenum glGetError ( void ) +void glGetFloatv ( GLenum pname, GLfloat *params ) +void glGetFramebufferAttachmentParameteriv ( GLenum target, GLenum attachment, GLenum pname, GLint *params ) +void glGetIntegerv ( GLenum pname, GLint *params ) +void glGetProgramiv ( GLuint program, GLenum pname, GLint *params ) +void glGetProgramInfoLog ( GLuint program, GLsizei bufsize, GLsizei *length, char *infolog ) +void glGetRenderbufferParameteriv ( GLenum target, GLenum pname, GLint *params ) +void glGetShaderiv ( GLuint shader, GLenum pname, GLint *params ) +void glGetShaderInfoLog ( GLuint shader, GLsizei bufsize, GLsizei *length, char *infolog ) +void glGetShaderPrecisionFormat ( GLenum shadertype, GLenum precisiontype, GLint *range, GLint *precision ) +void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) +const GLubyte * glGetString ( GLenum name ) +void glGetTexParameterfv ( GLenum target, GLenum pname, GLfloat *params ) +void glGetTexParameteriv ( GLenum target, GLenum pname, GLint *params ) +void glGetUniformfv ( GLuint program, GLint location, GLfloat *params ) +void glGetUniformiv ( GLuint program, GLint location, GLint *params ) +int glGetUniformLocation ( GLuint program, const char *name ) +void glGetVertexAttribfv ( GLuint index, GLenum pname, GLfloat *params ) +void glGetVertexAttribiv ( GLuint index, GLenum pname, GLint *params ) +// void glGetVertexAttribPointerv ( GLuint index, GLenum pname, void **pointer ) +void glHint ( GLenum target, GLenum mode ) +GLboolean glIsBuffer ( GLuint buffer ) +GLboolean glIsEnabled ( GLenum cap ) +GLboolean glIsFramebuffer ( GLuint framebuffer ) +GLboolean glIsProgram ( GLuint program ) +GLboolean glIsRenderbuffer ( GLuint renderbuffer ) +GLboolean glIsShader ( GLuint shader ) +GLboolean glIsTexture ( GLuint texture ) +void glLineWidth ( GLfloat width ) +void glLinkProgram ( GLuint program ) +void glPixelStorei ( GLenum pname, GLint param ) +void glPolygonOffset ( GLfloat factor, GLfloat units ) +void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLvoid *pixels ) +void glReleaseShaderCompiler ( void ) +void glRenderbufferStorage ( GLenum target, GLenum internalformat, GLsizei width, GLsizei height ) +void glSampleCoverage ( GLclampf value, GLboolean invert ) +void glScissor ( GLint x, GLint y, GLsizei width, GLsizei height ) +void glShaderBinary ( GLsizei n, const GLuint *shaders, GLenum binaryformat, const GLvoid *binary, GLsizei length ) +void glShaderSource ( GLuint shader ) +void glStencilFunc ( GLenum func, GLint ref, GLuint mask ) +void glStencilFuncSeparate ( GLenum face, GLenum func, GLint ref, GLuint mask ) +void glStencilMask ( GLuint mask ) +void glStencilMaskSeparate ( GLenum face, GLuint mask ) +void glStencilOp ( GLenum fail, GLenum zfail, GLenum zpass ) +void glStencilOpSeparate ( GLenum face, GLenum fail, GLenum zfail, GLenum zpass ) +void glTexImage2D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) +void glTexParameterf ( GLenum target, GLenum pname, GLfloat param ) +void glTexParameterfv ( GLenum target, GLenum pname, const GLfloat *params ) +void glTexParameteri ( GLenum target, GLenum pname, GLint param ) +void glTexParameteriv ( GLenum target, GLenum pname, const GLint *params ) +void glTexSubImage2D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLsizei width, GLsizei height, GLenum format, GLenum type, const GLvoid *pixels ) +void glUniform1f ( GLint location, GLfloat x ) +void glUniform1fv ( GLint location, GLsizei count, const GLfloat *v ) +void glUniform1i ( GLint location, GLint x ) +void glUniform1iv ( GLint location, GLsizei count, const GLint *v ) +void glUniform2f ( GLint location, GLfloat x, GLfloat y ) +void glUniform2fv ( GLint location, GLsizei count, const GLfloat *v ) +void glUniform2i ( GLint location, GLint x, GLint y ) +void glUniform2iv ( GLint location, GLsizei count, const GLint *v ) +void glUniform3f ( GLint location, GLfloat x, GLfloat y, GLfloat z ) +void glUniform3fv ( GLint location, GLsizei count, const GLfloat *v ) +void glUniform3i ( GLint location, GLint x, GLint y, GLint z ) +void glUniform3iv ( GLint location, GLsizei count, const GLint *v ) +void glUniform4f ( GLint location, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +void glUniform4fv ( GLint location, GLsizei count, const GLfloat *v ) +void glUniform4i ( GLint location, GLint x, GLint y, GLint z, GLint w ) +void glUniform4iv ( GLint location, GLsizei count, const GLint *v ) +void glUniformMatrix2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) +void glUniformMatrix3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) +void glUniformMatrix4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) +void glUseProgram ( GLuint program ) +void glValidateProgram ( GLuint program ) +void glVertexAttrib1f ( GLuint indx, GLfloat x ) +void glVertexAttrib1fv ( GLuint indx, const GLfloat *values ) +void glVertexAttrib2f ( GLuint indx, GLfloat x, GLfloat y ) +void glVertexAttrib2fv ( GLuint indx, const GLfloat *values ) +void glVertexAttrib3f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z ) +void glVertexAttrib3fv ( GLuint indx, const GLfloat *values ) +void glVertexAttrib4f ( GLuint indx, GLfloat x, GLfloat y, GLfloat z, GLfloat w ) +void glVertexAttrib4fv ( GLuint indx, const GLfloat *values ) +void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, GLint offset ) +void glVertexAttribPointer ( GLuint indx, GLint size, GLenum type, GLboolean normalized, GLsizei stride, const GLvoid *ptr ) +void glViewport ( GLint x, GLint y, GLsizei width, GLsizei height ) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES30.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES30.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES30.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES30.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,110 +0,0 @@ -void glReadBuffer ( GLenum mode ) -void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, const GLvoid *indices ) -void glDrawRangeElements ( GLenum mode, GLuint start, GLuint end, GLsizei count, GLenum type, GLsizei offset ) -void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, const GLvoid *pixels ) -void glTexImage3D ( GLenum target, GLint level, GLint internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLenum format, GLenum type, GLsizei offset ) -void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, const GLvoid *pixels ) -void glTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLenum type, GLsizei offset ) -void glCopyTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLint x, GLint y, GLsizei width, GLsizei height ) -void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, const GLvoid *data ) -void glCompressedTexImage3D ( GLenum target, GLint level, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLint border, GLsizei imageSize, GLsizei offset ) -void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, const GLvoid *data ) -void glCompressedTexSubImage3D ( GLenum target, GLint level, GLint xoffset, GLint yoffset, GLint zoffset, GLsizei width, GLsizei height, GLsizei depth, GLenum format, GLsizei imageSize, GLsizei offset ) -void glGenQueries ( GLsizei n, GLuint *ids ) -void glDeleteQueries ( GLsizei n, const GLuint *ids ) -GLboolean glIsQuery ( GLuint id ) -void glBeginQuery ( GLenum target, GLuint id ) -void glEndQuery ( GLenum target ) -void glGetQueryiv ( GLenum target, GLenum pname, GLint *params ) -void glGetQueryObjectuiv ( GLuint id, GLenum pname, GLuint *params ) -GLboolean glUnmapBuffer ( GLenum target ) -void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid **params ) -void glDrawBuffers ( GLsizei n, const GLenum *bufs ) -void glUniformMatrix2x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix3x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix2x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix4x2fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix3x4fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glUniformMatrix4x3fv ( GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glBlitFramebuffer ( GLint srcX0, GLint srcY0, GLint srcX1, GLint srcY1, GLint dstX0, GLint dstY0, GLint dstX1, GLint dstY1, GLbitfield mask, GLenum filter ) -void glRenderbufferStorageMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height ) -void glFramebufferTextureLayer ( GLenum target, GLenum attachment, GLuint texture, GLint level, GLint layer ) -GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) -void glFlushMappedBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length ) -void glBindVertexArray ( GLuint array ) -void glDeleteVertexArrays ( GLsizei n, const GLuint *arrays ) -void glGenVertexArrays ( GLsizei n, GLuint *arrays ) -GLboolean glIsVertexArray ( GLuint array ) -void glGetIntegeri_v ( GLenum target, GLuint index, GLint *data ) -void glBeginTransformFeedback ( GLenum primitiveMode ) -void glEndTransformFeedback ( void ) -void glBindBufferRange ( GLenum target, GLuint index, GLuint buffer, GLintptr offset, GLsizeiptr size ) -void glBindBufferBase ( GLenum target, GLuint index, GLuint buffer ) -void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) -void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLsizei *size, GLenum *type, GLchar *name ) -void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, const GLvoid *pointer ) -void glVertexAttribIPointer ( GLuint index, GLint size, GLenum type, GLsizei stride, GLsizei offset ) -void glGetVertexAttribIiv ( GLuint index, GLenum pname, GLint *params ) -void glGetVertexAttribIuiv ( GLuint index, GLenum pname, GLuint *params ) -void glVertexAttribI4i ( GLuint index, GLint x, GLint y, GLint z, GLint w ) -void glVertexAttribI4ui ( GLuint index, GLuint x, GLuint y, GLuint z, GLuint w ) -void glVertexAttribI4iv ( GLuint index, const GLint *v ) -void glVertexAttribI4uiv ( GLuint index, const GLuint *v ) -void glGetUniformuiv ( GLuint program, GLint location, GLuint *params ) -GLint glGetFragDataLocation ( GLuint program, const GLchar *name ) -void glUniform1ui ( GLint location, GLuint v0 ) -void glUniform2ui ( GLint location, GLuint v0, GLuint v1 ) -void glUniform3ui ( GLint location, GLuint v0, GLuint v1, GLuint v2 ) -void glUniform4ui ( GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) -void glUniform1uiv ( GLint location, GLsizei count, const GLuint *value ) -void glUniform2uiv ( GLint location, GLsizei count, const GLuint *value ) -void glUniform3uiv ( GLint location, GLsizei count, const GLuint *value ) -void glUniform4uiv ( GLint location, GLsizei count, const GLuint *value ) -void glClearBufferiv ( GLenum buffer, GLint drawbuffer, const GLint *value ) -void glClearBufferuiv ( GLenum buffer, GLint drawbuffer, const GLuint *value ) -void glClearBufferfv ( GLenum buffer, GLint drawbuffer, const GLfloat *value ) -void glClearBufferfi ( GLenum buffer, GLint drawbuffer, GLfloat depth, GLint stencil ) -const GLubyte * glGetStringi ( GLenum name, GLuint index ) -void glCopyBufferSubData ( GLenum readTarget, GLenum writeTarget, GLintptr readOffset, GLintptr writeOffset, GLsizeiptr size ) -void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) -void glGetActiveUniformsiv ( GLuint program, GLsizei uniformCount, const GLuint *uniformIndices, GLenum pname, GLint *params ) -GLuint glGetUniformBlockIndex ( GLuint program, const GLchar *uniformBlockName ) -void glGetActiveUniformBlockiv ( GLuint program, GLuint uniformBlockIndex, GLenum pname, GLint *params ) -void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) -void glUniformBlockBinding ( GLuint program, GLuint uniformBlockIndex, GLuint uniformBlockBinding ) -void glDrawArraysInstanced ( GLenum mode, GLint first, GLsizei count, GLsizei instanceCount ) -void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) -GLsync glFenceSync ( GLenum condition, GLbitfield flags ) -GLboolean glIsSync ( GLsync sync ) -void glDeleteSync ( GLsync sync ) -GLenum glClientWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout ) -void glWaitSync ( GLsync sync, GLbitfield flags, GLuint64 timeout ) -void glGetInteger64v ( GLenum pname, GLint64 *params ) -void glGetSynciv ( GLsync sync, GLenum pname, GLsizei bufSize, GLsizei *length, GLint *values ) -void glGetInteger64i_v ( GLenum target, GLuint index, GLint64 *data ) -void glGetBufferParameteri64v ( GLenum target, GLenum pname, GLint64 *params ) -void glGenSamplers ( GLsizei count, GLuint *samplers ) -void glDeleteSamplers ( GLsizei count, const GLuint *samplers ) -GLboolean glIsSampler ( GLuint sampler ) -void glBindSampler ( GLuint unit, GLuint sampler ) -void glSamplerParameteri ( GLuint sampler, GLenum pname, GLint param ) -void glSamplerParameteriv ( GLuint sampler, GLenum pname, const GLint *param ) -void glSamplerParameterf ( GLuint sampler, GLenum pname, GLfloat param ) -void glSamplerParameterfv ( GLuint sampler, GLenum pname, const GLfloat *param ) -void glGetSamplerParameteriv ( GLuint sampler, GLenum pname, GLint *params ) -void glGetSamplerParameterfv ( GLuint sampler, GLenum pname, GLfloat *params ) -void glVertexAttribDivisor ( GLuint index, GLuint divisor ) -void glBindTransformFeedback ( GLenum target, GLuint id ) -void glDeleteTransformFeedbacks ( GLsizei n, const GLuint *ids ) -void glGenTransformFeedbacks ( GLsizei n, GLuint *ids ) -GLboolean glIsTransformFeedback ( GLuint id ) -void glPauseTransformFeedback ( void ) -void glResumeTransformFeedback ( void ) -void glGetProgramBinary ( GLuint program, GLsizei bufSize, GLsizei *length, GLenum *binaryFormat, GLvoid *binary ) -void glProgramBinary ( GLuint program, GLenum binaryFormat, const GLvoid *binary, GLsizei length ) -void glProgramParameteri ( GLuint program, GLenum pname, GLint value ) -void glInvalidateFramebuffer ( GLenum target, GLsizei numAttachments, const GLenum *attachments ) -void glInvalidateSubFramebuffer ( GLenum target, GLsizei numAttachments, const GLenum *attachments, GLint x, GLint y, GLsizei width, GLsizei height ) -void glTexStorage2D ( GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height ) -void glTexStorage3D ( GLenum target, GLsizei levels, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth ) -void glGetInternalformativ ( GLenum target, GLenum internalformat, GLenum pname, GLsizei bufSize, GLint *params ) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES31Ext.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES31Ext.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES31Ext.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES31Ext.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -void glBlendBarrierKHR ( void ) -void glDebugMessageControlKHR ( GLenum source, GLenum type, GLenum severity, GLsizei count, const GLuint *ids, GLboolean enabled ) -void glDebugMessageInsertKHR ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf ) -void glDebugMessageCallbackKHR ( GLDEBUGPROCKHR callback, const void *userParam ) -GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) -void glPushDebugGroupKHR ( GLenum source, GLuint id, GLsizei length, const GLchar *message ) -void glPopDebugGroupKHR ( void ) -void glObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei length, const GLchar *label ) -void glGetObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label ) -void glObjectPtrLabelKHR ( const void *ptr, GLsizei length, const GLchar *label ) -void glGetObjectPtrLabelKHR ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label ) -void glGetPointervKHR ( GLenum pname, void **params ) -void glMinSampleShadingOES ( GLfloat value ) -void glTexStorage3DMultisampleOES ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLsizei depth, GLboolean fixedsamplelocations ) -void glCopyImageSubDataEXT ( GLuint srcName, GLenum srcTarget, GLint srcLevel, GLint srcX, GLint srcY, GLint srcZ, GLuint dstName, GLenum dstTarget, GLint dstLevel, GLint dstX, GLint dstY, GLint dstZ, GLsizei srcWidth, GLsizei srcHeight, GLsizei srcDepth ) -void glEnableiEXT ( GLenum target, GLuint index ) -void glDisableiEXT ( GLenum target, GLuint index ) -void glBlendEquationiEXT ( GLuint buf, GLenum mode ) -void glBlendEquationSeparateiEXT ( GLuint buf, GLenum modeRGB, GLenum modeAlpha ) -void glBlendFunciEXT ( GLuint buf, GLenum src, GLenum dst ) -void glBlendFuncSeparateiEXT ( GLuint buf, GLenum srcRGB, GLenum dstRGB, GLenum srcAlpha, GLenum dstAlpha ) -void glColorMaskiEXT ( GLuint index, GLboolean r, GLboolean g, GLboolean b, GLboolean a ) -GLboolean glIsEnablediEXT ( GLenum target, GLuint index ) -void glFramebufferTextureEXT ( GLenum target, GLenum attachment, GLuint texture, GLint level ) -void glPrimitiveBoundingBoxEXT ( GLfloat minX, GLfloat minY, GLfloat minZ, GLfloat minW, GLfloat maxX, GLfloat maxY, GLfloat maxZ, GLfloat maxW ) -void glPatchParameteriEXT ( GLenum pname, GLint value ) -void glTexParameterIivEXT ( GLenum target, GLenum pname, const GLint *params ) -void glTexParameterIuivEXT ( GLenum target, GLenum pname, const GLuint *params ) -void glGetTexParameterIivEXT ( GLenum target, GLenum pname, GLint *params ) -void glGetTexParameterIuivEXT ( GLenum target, GLenum pname, GLuint *params ) -void glSamplerParameterIivEXT ( GLuint sampler, GLenum pname, const GLint *param ) -void glSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, const GLuint *param ) -void glGetSamplerParameterIivEXT ( GLuint sampler, GLenum pname, GLint *params ) -void glGetSamplerParameterIuivEXT ( GLuint sampler, GLenum pname, GLuint *params ) -void glTexBufferEXT ( GLenum target, GLenum internalformat, GLuint buffer ) -void glTexBufferRangeEXT ( GLenum target, GLenum internalformat, GLuint buffer, GLintptr offset, GLsizeiptr size ) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES31.spec android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES31.spec --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/specs/gles11/GLES31.spec 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/specs/gles11/GLES31.spec 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -void glDispatchCompute ( GLuint num_groups_x, GLuint num_groups_y, GLuint num_groups_z ) -void glDispatchComputeIndirect ( GLintptr indirect ) -void glDrawArraysIndirect ( GLenum mode, const void *indirect ) -void glDrawElementsIndirect ( GLenum mode, GLenum type, const void *indirect ) -void glFramebufferParameteri ( GLenum target, GLenum pname, GLint param ) -void glGetFramebufferParameteriv ( GLenum target, GLenum pname, GLint *params ) -void glGetProgramInterfaceiv ( GLuint program, GLenum programInterface, GLenum pname, GLint *params ) -GLuint glGetProgramResourceIndex ( GLuint program, GLenum programInterface, const GLchar *name ) -void glGetProgramResourceName ( GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name ) -void glGetProgramResourceiv ( GLuint program, GLenum programInterface, GLuint index, GLsizei propCount, const GLenum *props, GLsizei bufSize, GLsizei *length, GLint *params ) -GLint glGetProgramResourceLocation ( GLuint program, GLenum programInterface, const GLchar *name ) -void glUseProgramStages ( GLuint pipeline, GLbitfield stages, GLuint program ) -void glActiveShaderProgram ( GLuint pipeline, GLuint program ) -GLuint glCreateShaderProgramv ( GLenum type, GLsizei count, const GLchar *const *strings ) -void glBindProgramPipeline ( GLuint pipeline ) -void glDeleteProgramPipelines ( GLsizei n, const GLuint *pipelines ) -void glGenProgramPipelines ( GLsizei n, GLuint *pipelines ) -GLboolean glIsProgramPipeline ( GLuint pipeline ) -void glGetProgramPipelineiv ( GLuint pipeline, GLenum pname, GLint *params ) -void glProgramUniform1i ( GLuint program, GLint location, GLint v0 ) -void glProgramUniform2i ( GLuint program, GLint location, GLint v0, GLint v1 ) -void glProgramUniform3i ( GLuint program, GLint location, GLint v0, GLint v1, GLint v2 ) -void glProgramUniform4i ( GLuint program, GLint location, GLint v0, GLint v1, GLint v2, GLint v3 ) -void glProgramUniform1ui ( GLuint program, GLint location, GLuint v0 ) -void glProgramUniform2ui ( GLuint program, GLint location, GLuint v0, GLuint v1 ) -void glProgramUniform3ui ( GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2 ) -void glProgramUniform4ui ( GLuint program, GLint location, GLuint v0, GLuint v1, GLuint v2, GLuint v3 ) -void glProgramUniform1f ( GLuint program, GLint location, GLfloat v0 ) -void glProgramUniform2f ( GLuint program, GLint location, GLfloat v0, GLfloat v1 ) -void glProgramUniform3f ( GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2 ) -void glProgramUniform4f ( GLuint program, GLint location, GLfloat v0, GLfloat v1, GLfloat v2, GLfloat v3 ) -void glProgramUniform1iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) -void glProgramUniform2iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) -void glProgramUniform3iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) -void glProgramUniform4iv ( GLuint program, GLint location, GLsizei count, const GLint *value ) -void glProgramUniform1uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) -void glProgramUniform2uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) -void glProgramUniform3uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) -void glProgramUniform4uiv ( GLuint program, GLint location, GLsizei count, const GLuint *value ) -void glProgramUniform1fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) -void glProgramUniform2fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) -void glProgramUniform3fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) -void glProgramUniform4fv ( GLuint program, GLint location, GLsizei count, const GLfloat *value ) -void glProgramUniformMatrix2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix2x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix3x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix2x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix4x2fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix3x4fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glProgramUniformMatrix4x3fv ( GLuint program, GLint location, GLsizei count, GLboolean transpose, const GLfloat *value ) -void glValidateProgramPipeline ( GLuint pipeline ) -void glGetProgramPipelineInfoLog ( GLuint pipeline, GLsizei bufSize, GLsizei *length, GLchar *infoLog ) -void glBindImageTexture ( GLuint unit, GLuint texture, GLint level, GLboolean layered, GLint layer, GLenum access, GLenum format ) -void glGetBooleani_v ( GLenum target, GLuint index, GLboolean *data ) -void glMemoryBarrier ( GLbitfield barriers ) -void glMemoryBarrierByRegion ( GLbitfield barriers ) -void glTexStorage2DMultisample ( GLenum target, GLsizei samples, GLenum internalformat, GLsizei width, GLsizei height, GLboolean fixedsamplelocations ) -void glGetMultisamplefv ( GLenum pname, GLuint index, GLfloat *val ) -void glSampleMaski ( GLuint maskNumber, GLbitfield mask ) -void glGetTexLevelParameteriv ( GLenum target, GLint level, GLenum pname, GLint *params ) -void glGetTexLevelParameterfv ( GLenum target, GLint level, GLenum pname, GLfloat *params ) -void glBindVertexBuffer ( GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) -void glVertexAttribFormat ( GLuint attribindex, GLint size, GLenum type, GLboolean normalized, GLuint relativeoffset ) -void glVertexAttribIFormat ( GLuint attribindex, GLint size, GLenum type, GLuint relativeoffset ) -void glVertexAttribBinding ( GLuint attribindex, GLuint bindingindex ) -void glVertexBindingDivisor ( GLuint bindingindex, GLuint divisor ) diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/CFunc.java android-platform-frameworks-native-21/opengl/tools/glgen/src/CFunc.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/CFunc.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/CFunc.java 2012-10-16 22:57:11.000000000 +0000 @@ -28,7 +28,6 @@ boolean hasPointerArg = false; boolean hasTypedPointerArg = false; - boolean hasEGLHandleArg = false; public CFunc(String original) { this.original = original; @@ -64,9 +63,6 @@ if (argType.isTypedPointer()) { hasTypedPointerArg = true; } - if (argType.isEGLHandle()) { - hasEGLHandleArg = true; - } } public int getNumArgs() { @@ -99,10 +95,6 @@ return hasTypedPointerArg; } - public boolean hasEGLHandleArg() { - return hasEGLHandleArg; - } - @Override public String toString() { String s = "Function " + fname + " returns " + ftype + ": "; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/CType.java android-platform-frameworks-native-21/opengl/tools/glgen/src/CType.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/CType.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/CType.java 2012-10-16 22:57:11.000000000 +0000 @@ -53,16 +53,6 @@ return isPointer; } - public boolean isEGLHandle() { - if(baseType.equals("EGLContext") - || baseType.equals("EGLConfig") - || baseType.equals("EGLSurface") - || baseType.equals("EGLDisplay")) { - return true; - } - return false; - } - boolean isVoid() { String baseType = getBaseType(); return baseType.equals("GLvoid") || @@ -70,8 +60,7 @@ } public boolean isConstCharPointer() { - return isConst && isPointer && - (baseType.equals("char") || baseType.equals("GLchar")); + return isConst && isPointer && baseType.equals("char"); } public boolean isTypedPointer() { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/EGLCodeEmitter.java android-platform-frameworks-native-21/opengl/tools/glgen/src/EGLCodeEmitter.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/EGLCodeEmitter.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/EGLCodeEmitter.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,58 +0,0 @@ -/* - * Copyright 2012 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. - */ - -import java.io.PrintStream; - -/** - * Emits a Java interface and Java & C implementation for a C function. - * - *

The Java interface will have Buffer and array variants for functions that - * have a typed pointer argument. The array variant will convert a single " *data" - * argument to a pair of arguments "[] data, int offset". - */ -public class EGLCodeEmitter extends JniCodeEmitter { - - PrintStream mJavaImplStream; - PrintStream mCStream; - - PrintStream mJavaInterfaceStream; - - /** - */ - public EGLCodeEmitter(String classPathName, - ParameterChecker checker, - PrintStream javaImplStream, - PrintStream cStream) { - mClassPathName = classPathName; - mChecker = checker; - - mJavaImplStream = javaImplStream; - mCStream = cStream; - mUseContextPointer = false; - mUseStaticMethods = true; - mUseSimpleMethodNames = true; - mUseHideCommentForAPI = false; - } - - public void emitCode(CFunc cfunc, String original) { - emitCode(cfunc, original, null, mJavaImplStream, - mCStream); - } - - public void emitNativeRegistration(String nativeRegistrationName) { - emitNativeRegistration(nativeRegistrationName, mCStream); - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/GenerateEGL.java android-platform-frameworks-native-21/opengl/tools/glgen/src/GenerateEGL.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/GenerateEGL.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/GenerateEGL.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/* - * Copyright 2012 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. - */ - -import java.io.BufferedReader; -import java.io.File; -import java.io.FileOutputStream; -import java.io.FileReader; -import java.io.IOException; -import java.io.PrintStream; - -public class GenerateEGL { - - private static void copy(String filename, PrintStream out) throws IOException { - BufferedReader br = new BufferedReader(new FileReader(filename)); - String s; - while ((s = br.readLine()) != null) { - out.println(s); - } - } - - private static void emit(EGLCodeEmitter emitter, - BufferedReader specReader, - PrintStream glStream, - PrintStream cStream) throws Exception { - String s = null; - while ((s = specReader.readLine()) != null) { - if (s.trim().startsWith("//")) { - continue; - } - - CFunc cfunc = CFunc.parseCFunc(s); - - String fname = cfunc.getName(); - String stubRoot = "stubs/egl/" + fname; - String javaPath = stubRoot + ".java"; - File f = new File(javaPath); - if (f.exists()) { - System.out.println("Special-casing function " + fname); - copy(javaPath, glStream); - copy(stubRoot + ".cpp", cStream); - - // Register native function names - // This should be improved to require fewer discrete files - String filename = stubRoot + ".nativeReg"; - BufferedReader br = - new BufferedReader(new FileReader(filename)); - String nfunc; - while ((nfunc = br.readLine()) != null) { - emitter.addNativeRegistration(nfunc); - } - } else { - emitter.emitCode(cfunc, s); - } - } - } - - public static void main(String[] args) throws Exception { - int aidx = 0; - while ((aidx < args.length) && (args[aidx].charAt(0) == '-')) { - switch (args[aidx].charAt(1)) { - default: - System.err.println("Unknown flag: " + args[aidx]); - System.exit(1); - } - - aidx++; - } - - BufferedReader checksReader = - new BufferedReader(new FileReader("specs/egl/checks.spec")); - ParameterChecker checker = new ParameterChecker(checksReader); - - - for(String suffix: new String[] {"EGL14", "EGLExt"}) { - BufferedReader specReader = new BufferedReader(new FileReader( - "specs/egl/" + suffix + ".spec")); - String egljFilename = "android/opengl/" + suffix + ".java"; - String eglcFilename = "android_opengl_" + suffix + ".cpp"; - PrintStream egljStream = - new PrintStream(new FileOutputStream("out/" + egljFilename)); - PrintStream eglcStream = - new PrintStream(new FileOutputStream("out/" + eglcFilename)); - copy("stubs/egl/" + suffix + "Header.java-if", egljStream); - copy("stubs/egl/" + suffix + "cHeader.cpp", eglcStream); - EGLCodeEmitter emitter = new EGLCodeEmitter( - "android/opengl/" + suffix, - checker, egljStream, eglcStream); - emit(emitter, specReader, egljStream, eglcStream); - emitter.emitNativeRegistration( - "register_android_opengl_jni_" + suffix); - egljStream.println("}"); - egljStream.close(); - eglcStream.close(); - } - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/GenerateGLES.java android-platform-frameworks-native-21/opengl/tools/glgen/src/GenerateGLES.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/GenerateGLES.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/GenerateGLES.java 2012-10-16 22:57:11.000000000 +0000 @@ -42,6 +42,7 @@ } CFunc cfunc = CFunc.parseCFunc(s); + String fname = cfunc.getName(); String stubRoot = "stubs/gles11/" + fname; String javaPath = stubRoot + ".java"; @@ -84,8 +85,7 @@ // Generate files for(String suffix: new String[] {"GLES10", "GLES10Ext", - "GLES11", "GLES11Ext", "GLES20", - "GLES30", "GLES31", "GLES31Ext"}) + "GLES11", "GLES11Ext", "GLES20"}) { BufferedReader spec11Reader = new BufferedReader(new FileReader("specs/gles11/" @@ -96,9 +96,10 @@ new PrintStream(new FileOutputStream("out/" + gl11Filename)); PrintStream gl11cStream = new PrintStream(new FileOutputStream("out/" + gl11cFilename)); + gl11Stream.println("/*"); + gl11cStream.println("/*"); copy("stubs/gles11/" + suffix + "Header.java-if", gl11Stream); copy("stubs/gles11/" + suffix + "cHeader.cpp", gl11cStream); - copy("stubs/gles11/common.cpp", gl11cStream); GLESCodeEmitter emitter = new GLESCodeEmitter( "android/opengl/" + suffix, checker, gl11Stream, gl11cStream); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/JniCodeEmitter.java android-platform-frameworks-native-21/opengl/tools/glgen/src/JniCodeEmitter.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/JniCodeEmitter.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/JniCodeEmitter.java 2012-10-16 22:57:11.000000000 +0000 @@ -25,8 +25,6 @@ static final boolean mUseCPlusPlus = true; protected boolean mUseContextPointer = true; protected boolean mUseStaticMethods = false; - protected boolean mUseSimpleMethodNames = false; - protected boolean mUseHideCommentForAPI = false; protected String mClassPathName; protected ParameterChecker mChecker; protected List nativeRegistrations = new ArrayList(); @@ -36,9 +34,7 @@ public static String getJniName(JType jType) { String jniName = ""; - if (jType.isEGLHandle()) { - return (jType.isArray() ? "[" : "" ) + "Landroid/opengl/" + jType.getBaseType() + ";"; - } else if (jType.isClass()) { + if (jType.isClass()) { return "L" + jType.getBaseType() + ";"; } else if (jType.isArray()) { jniName = "["; @@ -54,7 +50,7 @@ } else if (baseType.equals("short")) { jniName += "S"; } else if (baseType.equals("long")) { - jniName += "J"; + jniName += "L"; } else if (baseType.equals("byte")) { jniName += "B"; } else if (baseType.equals("String")) { @@ -67,6 +63,7 @@ return jniName; } + public void emitCode(CFunc cfunc, String original, PrintStream javaInterfaceStream, PrintStream javaImplStream, @@ -99,10 +96,6 @@ if (!duplicate) { emitJniCode(jfunc, cStream); } - // Don't create IOBuffer versions of the EGL functions - if (cfunc.hasEGLHandleArg()) { - return; - } } jfunc = JFunc.convert(cfunc, false); @@ -128,13 +121,8 @@ } public void emitNativeDeclaration(JFunc jfunc, PrintStream out) { - if (mUseHideCommentForAPI) { - out.println(" /* @hide C function " + jfunc.getCFunc().getOriginal() + " */"); - out.println(); - } else { - out.println(" // C function " + jfunc.getCFunc().getOriginal()); - out.println(); - } + out.println(" // C function " + jfunc.getCFunc().getOriginal()); + out.println(); emitFunction(jfunc, out, true, false); } @@ -197,100 +185,56 @@ void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck, String iii) { - printIfcheckPostamble(out, isBuffer, emitExceptionCheck, - "offset", "_remaining", iii); - } + printIfcheckPostamble(out, isBuffer, emitExceptionCheck, + "offset", "_remaining", iii); + } void printIfcheckPostamble(PrintStream out, boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) { - out.println(iii + " default:"); - out.println(iii + " _needed = 1;"); - out.println(iii + " break;"); - out.println(iii + "}"); - - out.println(iii + "if (" + remaining + " < _needed) {"); - out.println(iii + indent + "_exception = 1;"); - out.println(iii + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(iii + indent + - "_exceptionMessage = \"" + - (isBuffer ? "remaining()" : "length - " + offset) + - " < needed\";"); - out.println(iii + indent + "goto exit;"); - out.println(iii + "}"); - - needsExit = true; - } - - boolean isNullAllowed(CFunc cfunc) { - String[] checks = mChecker.getChecks(cfunc.getName()); - int index = 1; - if (checks != null) { - while (index < checks.length) { - if (checks[index].equals("nullAllowed")) { - return true; - } else { - index = skipOneCheck(checks, index); - } - } - } - return false; - } + out.println(iii + " default:"); + out.println(iii + " _needed = 0;"); + out.println(iii + " break;"); + out.println(iii + "}"); - boolean hasCheckTest(CFunc cfunc) { - String[] checks = mChecker.getChecks(cfunc.getName()); - int index = 1; - if (checks != null) { - while (index < checks.length) { - if (checks[index].startsWith("check")) { - return true; - } else { - index = skipOneCheck(checks, index); + out.println(iii + "if (" + remaining + " < _needed) {"); + if (emitExceptionCheck) { + out.println(iii + indent + "_exception = 1;"); } + out.println(iii + indent + "jniThrowException(_env, " + + "\"java/lang/IllegalArgumentException\", " + + "\"" + (isBuffer ? "remaining()" : "length - " + offset) + " < needed\");"); + out.println(iii + indent + "goto exit;"); + needsExit = true; + out.println(iii + "}"); } - } - return false; - } - boolean hasIfTest(CFunc cfunc) { + boolean isNullAllowed(CFunc cfunc) { String[] checks = mChecker.getChecks(cfunc.getName()); int index = 1; if (checks != null) { while (index < checks.length) { - if (checks[index].startsWith("ifcheck")) { + if (checks[index].equals("return")) { + index += 2; + } else if (checks[index].startsWith("check")) { + index += 3; + } else if (checks[index].equals("ifcheck")) { + index += 5; + } else if (checks[index].equals("unsupported")) { + index += 1; + } else if (checks[index].equals("requires")) { + index += 2; + } else if (checks[index].equals("nullAllowed")) { return true; } else { - index = skipOneCheck(checks, index); + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); } } } return false; } - int skipOneCheck(String[] checks, int index) { - if (checks[index].equals("return")) { - index += 2; - } else if (checks[index].startsWith("check")) { - index += 3; - } else if (checks[index].startsWith("sentinel")) { - index += 3; - } else if (checks[index].equals("ifcheck")) { - index += 5; - } else if (checks[index].equals("unsupported")) { - index += 1; - } else if (checks[index].equals("requires")) { - index += 2; - } else if (checks[index].equals("nullAllowed")) { - index += 1; - } else { - System.out.println("Error: unknown keyword \"" + - checks[index] + "\""); - System.exit(0); - } - - return index; - } - String getErrorReturnValue(CFunc cfunc) { CType returnType = cfunc.getType(); boolean isVoid = returnType.isVoid(); @@ -298,10 +242,6 @@ return null; } - if (returnType.getBaseType().startsWith("EGL")) { - return "(" + returnType.getDeclaration() + ") 0"; - } - String[] checks = mChecker.getChecks(cfunc.getName()); int index = 1; @@ -309,8 +249,20 @@ while (index < checks.length) { if (checks[index].equals("return")) { return checks[index + 1]; + } else if (checks[index].startsWith("check")) { + index += 3; + } else if (checks[index].equals("ifcheck")) { + index += 5; + } else if (checks[index].equals("unsupported")) { + index += 1; + } else if (checks[index].equals("requires")) { + index += 2; + } else if (checks[index].equals("nullAllowed")) { + index += 1; } else { - index = skipOneCheck(checks, index); + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); } } } @@ -325,8 +277,20 @@ while (index < checks.length) { if (checks[index].equals("unsupported")) { return true; + } else if (checks[index].equals("requires")) { + index += 2; + } else if (checks[index].equals("return")) { + index += 2; + } else if (checks[index].startsWith("check")) { + index += 3; + } else if (checks[index].equals("ifcheck")) { + index += 5; + } else if (checks[index].equals("nullAllowed")) { + index += 1; } else { - index = skipOneCheck(checks, index); + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); } } } @@ -338,10 +302,22 @@ int index = 1; if (checks != null) { while (index < checks.length) { - if (checks[index].equals("requires")) { + if (checks[index].equals("unsupported")) { + index += 1; + } else if (checks[index].equals("requires")) { return checks[index+1]; + } else if (checks[index].equals("return")) { + index += 2; + } else if (checks[index].startsWith("check")) { + index += 3; + } else if (checks[index].equals("ifcheck")) { + index += 5; + } else if (checks[index].equals("nullAllowed")) { + index += 1; } else { - index = skipOneCheck(checks, index); + System.out.println("Error: unknown keyword \"" + + checks[index] + "\""); + System.exit(0); } } } @@ -369,7 +345,9 @@ continue; } out.println(iii + "if (" + remaining + " < " + checks[index + 2] + ") {"); - out.println(iii + indent + "_exception = 1;"); + if (emitExceptionCheck) { + out.println(iii + indent + "_exception = 1;"); + } String exceptionClassName = "java/lang/IllegalArgumentException"; // If the "check" keyword was of the form // "check_", use the class name in the @@ -383,18 +361,13 @@ throw new RuntimeException("unknown exception abbreviation: " + abbr); } } - out.println(iii + indent + - "_exceptionType = \""+exceptionClassName+"\";"); - out.println(iii + indent + - "_exceptionMessage = \"" + - (isBuffer ? "remaining()" : "length - " + - offset) + " < " + checks[index + 2] + - " < needed\";"); + out.println(iii + indent + "jniThrowException(_env, " + + "\"" + exceptionClassName + "\", " + + "\"" + (isBuffer ? "remaining()" : "length - " + offset) + " < " + checks[index + 2] + "\");"); out.println(iii + indent + "goto exit;"); - out.println(iii + "}"); - needsExit = true; + out.println(iii + "}"); index += 3; } else if (checks[index].equals("ifcheck")) { @@ -415,8 +388,21 @@ lastWasIfcheck = true; index += 5; + } else if (checks[index].equals("return")) { + // ignore + index += 2; + } else if (checks[index].equals("unsupported")) { + // ignore + index += 1; + } else if (checks[index].equals("requires")) { + // ignore + index += 2; + } else if (checks[index].equals("nullAllowed")) { + // ignore + index += 1; } else { - index = skipOneCheck(checks, index); + System.out.println("Error: unknown keyword \"" + checks[index] + "\""); + System.exit(0); } } } @@ -426,69 +412,6 @@ } } - void emitSentinelCheck(CFunc cfunc, String cname, PrintStream out, - boolean isBuffer, boolean emitExceptionCheck, String offset, String remaining, String iii) { - - String[] checks = mChecker.getChecks(cfunc.getName()); - - int index = 1; - if (checks != null) { - while (index < checks.length) { - if (checks[index].startsWith("sentinel")) { - if (cname != null && !cname.equals(checks[index + 1])) { - index += 3; - continue; - } - - out.println(iii + cname + "_sentinel = false;"); - out.println(iii + "for (int i = " + remaining + - " - 1; i >= 0; i--) {"); - out.println(iii + indent + "if (" + cname + - "[i] == " + checks[index + 2] + "){"); - out.println(iii + indent + indent + - cname + "_sentinel = true;"); - out.println(iii + indent + indent + "break;"); - out.println(iii + indent + "}"); - out.println(iii + "}"); - out.println(iii + - "if (" + cname + "_sentinel == false) {"); - out.println(iii + indent + "_exception = 1;"); - out.println(iii + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(iii + indent + "_exceptionMessage = \"" + cname + - " must contain " + checks[index + 2] + "!\";"); - out.println(iii + indent + "goto exit;"); - out.println(iii + "}"); - - needsExit = true; - index += 3; - } else { - index = skipOneCheck(checks, index); - } - } - } - } - - void emitLocalVariablesForSentinel(CFunc cfunc, PrintStream out) { - - String[] checks = mChecker.getChecks(cfunc.getName()); - - int index = 1; - if (checks != null) { - while (index < checks.length) { - if (checks[index].startsWith("sentinel")) { - String cname = checks[index + 1]; - out.println(indent + "bool " + cname + "_sentinel = false;"); - - index += 3; - - } else { - index = skipOneCheck(checks, index); - } - } - } - } - boolean hasNonConstArg(JFunc jfunc, CFunc cfunc, List nonPrimitiveArgs) { if (nonPrimitiveArgs.size() > 0) { for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) { @@ -715,7 +638,7 @@ return "j" + baseType; } } else if (jType.isArray()) { - return jType.isClass() ? "jobjectArray" : "j" + baseType + "Array"; + return "j" + baseType + "Array"; } else { return "jobject"; } @@ -749,20 +672,10 @@ String outName = "android_" + jfunc.getName(); boolean isPointerFunc = isPointerFunc(jfunc); - boolean isPointerOffsetFunc = - (outName.endsWith("Pointer") || outName.endsWith("PointerOES") || - outName.endsWith("glDrawElements") || - outName.endsWith("glDrawRangeElements") || - outName.endsWith("glTexImage2D") || - outName.endsWith("glTexSubImage2D") || - outName.endsWith("glCompressedTexImage2D") || - outName.endsWith("glCompressedTexSubImage2D") || - outName.endsWith("glTexImage3D") || - outName.endsWith("glTexSubImage3D") || - outName.endsWith("glCompressedTexImage3D") || - outName.endsWith("glCompressedTexSubImage3D") || - outName.endsWith("glReadPixels")) - && !jfunc.getCFunc().hasPointerArg(); + boolean isVBOPointerFunc = (outName.endsWith("Pointer") || + outName.endsWith("PointerOES") || + outName.endsWith("DrawElements") || outName.endsWith("VertexAttribPointer")) && + !jfunc.getCFunc().hasPointerArg(); if (isPointerFunc) { outName += "Bounds"; } @@ -785,10 +698,8 @@ // Append signature to function name String sig = getJniMangledName(signature).replace('.', '_').replace('/', '_'); - if (!mUseSimpleMethodNames) { - out.print("__" + sig); - outName += "__" + sig; - } + out.print("__" + sig); + outName += "__" + sig; signature = signature.replace('.', '/'); rsignature = rsignature.replace('.', '/'); @@ -812,7 +723,6 @@ List stringArgs = new ArrayList(); int numBufferArgs = 0; List bufferArgNames = new ArrayList(); - List bufferArgTypes = new ArrayList(); // Emit JNI signature (arguments) // @@ -824,11 +734,11 @@ for (int i = 0; i < numArgs; i++) { out.print(", "); JType argType = jfunc.getArgType(i); - String suffix = ""; + String suffix; if (!argType.isPrimitive()) { if (argType.isArray()) { suffix = "_ref"; - } else if (argType.isBuffer()) { + } else { suffix = "_buf"; } nonPrimitiveArgs.add(new Integer(i)); @@ -836,11 +746,11 @@ int cIndex = jfunc.getArgCIndex(i); String cname = cfunc.getArgName(cIndex); bufferArgNames.add(cname); - bufferArgTypes.add(jfunc.getArgType(i)); numBufferArgs++; } + } else { + suffix = ""; } - if (argType.isString()) { stringArgs.add(new Integer(i)); } @@ -891,14 +801,7 @@ " \"" + cfunc.getName() + "\");"); if (!isVoid) { String retval = getErrorReturnValue(cfunc); - if (cfunc.getType().isEGLHandle()) { - String baseType = cfunc.getType().getBaseType().toLowerCase(); - out.println(indent + - "return toEGLHandle(_env, " + baseType + "Class, " + - baseType + "Constructor, " + retval + ");"); - } else { - out.println(indent + "return " + retval + ";"); - } + out.println(indent + "return " + retval + ";"); } out.println("}"); out.println(); @@ -917,14 +820,7 @@ out.println(indent + indent + " return;"); } else { String retval = getErrorReturnValue(cfunc); - if (cfunc.getType().isEGLHandle()) { - String baseType = cfunc.getType().getBaseType().toLowerCase(); - out.println(indent + - "return toEGLHandle(_env, " + baseType + "Class, " + - baseType + "Constructor, " + retval + ");"); - } else { - out.println(indent + "return " + retval + ";"); - } + out.println(indent + indent + " return " + retval + ";"); } out.println(indent + "}"); } @@ -934,43 +830,23 @@ } boolean initializeReturnValue = stringArgs.size() > 0; - boolean emitExceptionCheck = ((numArrays > 0 || numStrings > 0) - && (hasNonConstArg(jfunc, cfunc, nonPrimitiveArgs) - || (cfunc.hasPointerArg() && numArrays > 0)) - || hasCheckTest(cfunc) - || hasIfTest(cfunc)) - || (stringArgs.size() > 0); + + boolean emitExceptionCheck = (numArrays > 0 || numBuffers > 0 || numStrings > 0) && + hasNonConstArg(jfunc, cfunc, nonPrimitiveArgs); // mChecker.getChecks(cfunc.getName()) != null + // Emit an _exeption variable if there will be error checks if (emitExceptionCheck) { out.println(indent + "jint _exception = 0;"); - out.println(indent + "const char * _exceptionType = NULL;"); - out.println(indent + "const char * _exceptionMessage = NULL;"); } // Emit a single _array or multiple _XXXArray variables if (numBufferArgs == 1) { - JType bufferType = bufferArgTypes.get(0); - if (bufferType.isTypedBuffer()) { - String typedArrayType = getJniType(bufferType.getArrayTypeForTypedBuffer()); - out.println(indent + typedArrayType + " _array = (" + typedArrayType + ") 0;"); - } else { out.println(indent + "jarray _array = (jarray) 0;"); - } - out.println(indent + "jint _bufferOffset = (jint) 0;"); } else { for (int i = 0; i < numBufferArgs; i++) { - JType bufferType = bufferArgTypes.get(0); - if (bufferType.isTypedBuffer()) { - String typedArrayType = getJniType(bufferType.getArrayTypeForTypedBuffer()); - out.println(indent + typedArrayType + " _" + bufferArgNames.get(i) + - "Array = (" + typedArrayType + ") 0;"); - } else { - out.println(indent + "jarray _" + bufferArgNames.get(i) + - "Array = (jarray) 0;"); - } - out.println(indent + "jint _" + bufferArgNames.get(i) + - "BufferOffset = (jint) 0;"); + out.println(indent + "jarray _" + bufferArgNames.get(i) + + "Array = (jarray) 0;"); } } if (!isVoid) { @@ -980,49 +856,13 @@ " _returnValue = " + retval + ";"); } else if (initializeReturnValue) { out.println(indent + returnType.getDeclaration() + - " _returnValue = 0;"); + " _returnValue = 0;"); } else { out.println(indent + returnType.getDeclaration() + " _returnValue;"); } } - // Emit local variable declarations for EGL Handles - // - // Example: - // - // EGLSurface surface_native = (EGLHandle)fromEGLHandle(_env, surfaceClass, surfaceConstructor, surface); - // - if (nonPrimitiveArgs.size() > 0) { - for (int i = 0; i < nonPrimitiveArgs.size(); i++) { - int idx = nonPrimitiveArgs.get(i).intValue(); - int cIndex = jfunc.getArgCIndex(idx); - String cname = cfunc.getArgName(cIndex); - - if (jfunc.getArgType(idx).isBuffer() - || jfunc.getArgType(idx).isArray() - || !jfunc.getArgType(idx).isEGLHandle()) - continue; - - CType type = cfunc.getArgType(jfunc.getArgCIndex(idx)); - String decl = type.getDeclaration(); - out.println(indent + - decl + " " + cname + "_native = (" + - decl + ") fromEGLHandle(_env, " + - type.getBaseType().toLowerCase() + - "GetHandleID, " + jfunc.getArgName(idx) + - ");"); - } - } - - // Emit local variable declarations for element/sentinel checks - // - // Example: - // - // bool attrib_list_sentinel_found = false; - // - emitLocalVariablesForSentinel(cfunc, out); - // Emit local variable declarations for pointer arguments // // Example: @@ -1038,12 +878,9 @@ int cIndex = jfunc.getArgCIndex(idx); String cname = cfunc.getArgName(cIndex); - if (!jfunc.getArgType(idx).isBuffer() && !jfunc.getArgType(idx).isArray()) - continue; - CType type = cfunc.getArgType(jfunc.getArgCIndex(idx)); String decl = type.getDeclaration(); - if (jfunc.getArgType(idx).isArray() && !jfunc.getArgType(idx).isClass()) { + if (jfunc.getArgType(idx).isArray()) { out.println(indent + decl + (decl.endsWith("*") ? "" : " ") + @@ -1055,10 +892,10 @@ out.println(indent + "jint " + remaining + ";"); out.println(indent + - decl + - (decl.endsWith("*") ? "" : " ") + - jfunc.getArgName(idx) + - " = (" + decl + ") 0;"); + decl + + (decl.endsWith("*") ? "" : " ") + + jfunc.getArgName(idx) + + " = (" + decl + ") 0;"); } out.println(); @@ -1086,14 +923,11 @@ CType type = cfunc.getArgType(jfunc.getArgCIndex(idx)); String decl = type.getDeclaration(); - needsExit = true; out.println(indent + "if (!" + cname + ") {"); - out.println(indent + indent + "_exception = 1;"); - out.println(indent + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(indent + indent + - "_exceptionMessage = \"" + cname + " == null\";"); - out.println(indent + indent + "goto exit;"); + out.println(indent + " jniThrowException(_env, " + + "\"java/lang/IllegalArgumentException\", \"" + cname + " == null\");"); + out.println(indent + " goto exit;"); + needsExit = true; out.println(indent + "}"); out.println(indent + "_native" + cname + " = _env->GetStringUTFChars(" + cname + ", 0);"); @@ -1102,8 +936,9 @@ out.println(); } - // Emit 'GetPrimitiveArrayCritical' for non-object arrays + // Emit 'GetPrimitiveArrayCritical' for arrays // Emit 'GetPointer' calls for Buffer pointers + int bufArgIdx = 0; if (nonPrimitiveArgs.size() > 0) { for (int i = 0; i < nonPrimitiveArgs.size(); i++) { int idx = nonPrimitiveArgs.get(i).intValue(); @@ -1115,24 +950,29 @@ remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" : "_" + cname + "Remaining"; - if (jfunc.getArgType(idx).isArray() - && !jfunc.getArgType(idx).isEGLHandle()) { + if (jfunc.getArgType(idx).isArray()) { + out.println(indent + + "if (!" + + cname + + "_ref) {"); + if (emitExceptionCheck) { + out.println(indent + indent + "_exception = 1;"); + } + out.println(indent + " jniThrowException(_env, " + + "\"java/lang/IllegalArgumentException\", " + + "\"" + cname + " == null\");"); + out.println(indent + " goto exit;"); needsExit = true; - out.println(indent + "if (!" + cname + "_ref) {"); - out.println(indent + indent + "_exception = 1;"); - out.println(indent + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(indent + indent + - "_exceptionMessage = \"" + cname +" == null\";"); - out.println(indent + indent + "goto exit;"); out.println(indent + "}"); + out.println(indent + "if (" + offset + " < 0) {"); - out.println(indent + indent + "_exception = 1;"); - out.println(indent + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(indent + indent + - "_exceptionMessage = \"" + offset +" < 0\";"); - out.println(indent + indent + "goto exit;"); + if (emitExceptionCheck) { + out.println(indent + indent + "_exception = 1;"); + } + out.println(indent + " jniThrowException(_env, " + + "\"java/lang/IllegalArgumentException\", \"" + offset + " < 0\");"); + out.println(indent + " goto exit;"); + needsExit = true; out.println(indent + "}"); out.println(indent + remaining + " = " + @@ -1150,56 +990,19 @@ "_base = (" + cfunc.getArgType(cIndex).getDeclaration() + ")"); - String arrayGetter = jfunc.getArgType(idx).getArrayGetterForPrimitiveArray(); out.println(indent + " " + (mUseCPlusPlus ? "_env" : "(*_env)") + - "->" + arrayGetter + "(" + + "->GetPrimitiveArrayCritical(" + (mUseCPlusPlus ? "" : "_env, ") + jfunc.getArgName(idx) + "_ref, (jboolean *)0);"); out.println(indent + - cname + " = " + cname + "_base + " + offset + ";"); - - emitSentinelCheck(cfunc, cname, out, false, - emitExceptionCheck, offset, - remaining, indent); + cname + " = " + cname + "_base + " + offset + + ";"); out.println(); - } else if (jfunc.getArgType(idx).isArray() - && jfunc.getArgType(idx).isEGLHandle()) { - needsExit = true; - out.println(indent + "if (!" + cname + "_ref) {"); - out.println(indent + indent + "_exception = 1;"); - out.println(indent + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(indent + indent + "_exceptionMessage = \"" + cname +" == null\";"); - out.println(indent + indent + "goto exit;"); - out.println(indent + "}"); - out.println(indent + "if (" + offset + " < 0) {"); - out.println(indent + indent + "_exception = 1;"); - out.println(indent + indent + - "_exceptionType = \"java/lang/IllegalArgumentException\";"); - out.println(indent + indent + "_exceptionMessage = \"" + offset +" < 0\";"); - out.println(indent + indent + "goto exit;"); - out.println(indent + "}"); - - out.println(indent + remaining + " = " + - (mUseCPlusPlus ? "_env" : "(*_env)") + - "->GetArrayLength(" + - (mUseCPlusPlus ? "" : "_env, ") + - cname + "_ref) - " + offset + ";"); - emitNativeBoundsChecks(cfunc, cname, out, false, - emitExceptionCheck, - offset, remaining, " "); - out.println(indent + - jfunc.getArgName(idx) + " = new " + - cfunc.getArgType(cIndex).getBaseType() + - "["+ remaining + "];"); - out.println(); - } else if (jfunc.getArgType(idx).isBuffer()) { + } else { String array = numBufferArgs <= 1 ? "_array" : - "_" + cfunc.getArgName(cIndex) + "Array"; - String bufferOffset = numBufferArgs <= 1 ? "_bufferOffset" : - "_" + cfunc.getArgName(cIndex) + "BufferOffset"; + "_" + bufferArgNames.get(bufArgIdx++) + "Array"; boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc; if (nullAllowed) { @@ -1216,7 +1019,7 @@ cname + "_buf);"); String iii = " "; out.println(iii + indent + "if ( ! " + cname + " ) {"); - out.println(iii + indent + indent + "return;"); + out.println(iii + iii + indent + "return;"); out.println(iii + indent + "}"); } else { out.println(indent + @@ -1225,7 +1028,7 @@ cfunc.getArgType(cIndex).getDeclaration() + ")getPointer(_env, " + cname + - "_buf, (jarray*)&" + array + ", &" + remaining + ", &" + bufferOffset + + "_buf, &" + array + ", &" + remaining + ");"); } @@ -1240,41 +1043,6 @@ } } - // Emit 'GetPrimitiveArrayCritical' for pointers if needed - if (nonPrimitiveArgs.size() > 0) { - for (int i = 0; i < nonPrimitiveArgs.size(); i++) { - int idx = nonPrimitiveArgs.get(i).intValue(); - int cIndex = jfunc.getArgCIndex(idx); - - if(!jfunc.getArgType(idx).isBuffer() || isPointerFunc) continue; - - String cname = cfunc.getArgName(cIndex); - String bufferOffset = numBufferArgs <= 1 ? "_bufferOffset" : - "_" + cname + "BufferOffset"; - String array = numBufferArgs <= 1 ? "_array" : - "_" + cfunc.getArgName(cIndex) + "Array"; - - boolean nullAllowed = isNullAllowed(cfunc) || isPointerFunc; - if (nullAllowed) { - out.println(indent + "if (" + cname + "_buf && " + cname +" == NULL) {"); - } else { - out.println(indent + "if (" + cname +" == NULL) {"); - } - JType argType = jfunc.getArgType(idx); - if (argType.isTypedBuffer()) { - String arrayGetter = argType.getArrayTypeForTypedBuffer().getArrayGetterForPrimitiveArray(); - out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->" + arrayGetter + "(" + array + ", (jboolean *) 0);"); - out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");"); - out.println(indent + "}"); - } else { - out.println(indent + indent + "char * _" + cname + "Base = (char *)_env->GetPrimitiveArrayCritical(" + array + ", (jboolean *) 0);"); - out.println(indent + indent + cname + " = (" +cfunc.getArgType(cIndex).getDeclaration() +") (_" + cname + "Base + " + bufferOffset + ");"); - out.println(indent + "}"); - } - } - } - - if (!isVoid) { out.print(indent + "_returnValue = "); } else { @@ -1306,26 +1074,19 @@ } for (int i = 0; i < numArgs; i++) { String typecast; - if (i == numArgs - 1 && isPointerOffsetFunc) { - typecast = "reinterpret_cast"; + if (i == numArgs - 1 && isVBOPointerFunc) { + typecast = "const GLvoid *"; } else { - typecast = "(" + cfunc.getArgType(i).getDeclaration() + ")"; + typecast = cfunc.getArgType(i).getDeclaration(); } out.print(indent + indent + - typecast); - + "(" + + typecast + + ")"); if (cfunc.getArgType(i).isConstCharPointer()) { out.print("_native"); } - - if (cfunc.getArgType(i).isEGLHandle() && - !cfunc.getArgType(i).isPointer()){ - out.print(cfunc.getArgName(i)+"_native"); - } else if (i == numArgs - 1 && isPointerOffsetFunc){ - out.print("("+cfunc.getArgName(i)+")"); - } else { - out.print(cfunc.getArgName(i)); - } + out.print(cfunc.getArgName(i)); if (i == numArgs - 1) { if (isPointerFunc) { @@ -1347,60 +1108,45 @@ needsExit = false; } - + bufArgIdx = 0; if (nonPrimitiveArgs.size() > 0) { for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) { int idx = nonPrimitiveArgs.get(i).intValue(); int cIndex = jfunc.getArgCIndex(idx); - if (jfunc.getArgType(idx).isArray() && !jfunc.getArgType(idx).isClass()) { + if (jfunc.getArgType(idx).isArray()) { // If the argument is 'const', GL will not write to it. // In this case, we can use the 'JNI_ABORT' flag to avoid // the need to write back to the Java array out.println(indent + "if (" + jfunc.getArgName(idx) + "_base) {"); - String arrayReleaser = jfunc.getArgType(idx).getArrayReleaserForPrimitiveArray(); out.println(indent + indent + (mUseCPlusPlus ? "_env" : "(*_env)") + - "->" + arrayReleaser + "(" + + "->ReleasePrimitiveArrayCritical(" + (mUseCPlusPlus ? "" : "_env, ") + jfunc.getArgName(idx) + "_ref, " + - "(j" + jfunc.getArgType(idx).getBaseType() + "*)" + cfunc.getArgName(cIndex) + + cfunc.getArgName(cIndex) + "_base,"); out.println(indent + indent + indent + (cfunc.getArgType(cIndex).isConst() ? - "JNI_ABORT" : "_exception ? JNI_ABORT: 0" ) + + "JNI_ABORT" : + "_exception ? JNI_ABORT: 0") + ");"); out.println(indent + "}"); } else if (jfunc.getArgType(idx).isBuffer()) { if (! isPointerFunc) { - JType argType = jfunc.getArgType(idx); String array = numBufferArgs <= 1 ? "_array" : - "_" + cfunc.getArgName(cIndex) + "Array"; + "_" + bufferArgNames.get(bufArgIdx++) + "Array"; out.println(indent + "if (" + array + ") {"); - if (argType.isTypedBuffer()) { - String arrayReleaser = - argType.getArrayTypeForTypedBuffer().getArrayReleaserForPrimitiveArray(); - out.println(indent + indent + - "_env->" + arrayReleaser + "(" + array + ", " + - "(j" + argType.getArrayTypeForTypedBuffer().getBaseType() + "*)" + - cfunc.getArgName(cIndex) + - ", " + - (cfunc.getArgType(cIndex).isConst() ? - "JNI_ABORT" : (emitExceptionCheck ? - "_exception ? JNI_ABORT : 0" : "0")) + - ");"); - } else { - out.println(indent + indent + - "releasePointer(_env, " + array + ", " + - cfunc.getArgName(cIndex) + - ", " + - (cfunc.getArgType(cIndex).isConst() ? - "JNI_FALSE" : (emitExceptionCheck ? - "_exception ? JNI_FALSE : JNI_TRUE" : "JNI_TRUE")) + - ");"); - } + out.println(indent + indent + + "releasePointer(_env, " + array + ", " + + cfunc.getArgName(cIndex) + + ", " + + (cfunc.getArgType(cIndex).isConst() ? + "JNI_FALSE" : "_exception ? JNI_FALSE :" + + " JNI_TRUE") + + ");"); out.println(indent + "}"); } } @@ -1422,61 +1168,9 @@ out.println(); } - // Copy results back to java arrays - if (nonPrimitiveArgs.size() > 0) { - for (int i = nonPrimitiveArgs.size() - 1; i >= 0; i--) { - int idx = nonPrimitiveArgs.get(i).intValue(); - int cIndex = jfunc.getArgCIndex(idx); - String baseType = cfunc.getArgType(cIndex).getBaseType().toLowerCase(); - if (jfunc.getArgType(idx).isArray() && jfunc.getArgType(idx).isClass()) { - remaining = ((numArrays + numBuffers) <= 1) ? "_remaining" : - "_" + cfunc.getArgName(cIndex) + "Remaining"; - offset = numArrays <= 1 ? "offset" : cfunc.getArgName(cIndex) + "Offset"; - out.println(indent + - "if (" + jfunc.getArgName(idx) + ") {"); - out.println(indent + indent + - "for (int i = 0; i < " + remaining + "; i++) {"); - out.println(indent + indent + indent + - "jobject " + cfunc.getArgName(cIndex) + - "_new = toEGLHandle(_env, " + baseType + - "Class, " + baseType + "Constructor, " + - cfunc.getArgName(cIndex) + "[i]);"); - out.println(indent + indent + indent + - (mUseCPlusPlus ? "_env" : "(*_env)") + - "->SetObjectArrayElement(" + - (mUseCPlusPlus ? "" : "_env, ") + - cfunc.getArgName(cIndex) + - "_ref, i + " + offset + ", " + - cfunc.getArgName(cIndex) + "_new);"); - out.println(indent + indent + "}"); - out.println(indent + indent + - "delete[] " + jfunc.getArgName(idx) + ";"); - out.println(indent + "}"); - } - } - } - - - // Throw exception if there is one - if (emitExceptionCheck) { - out.println(indent + "if (_exception) {"); - out.println(indent + indent + - "jniThrowException(_env, _exceptionType, _exceptionMessage);"); - out.println(indent + "}"); - - } - if (!isVoid) { - if (cfunc.getType().isEGLHandle()) { - String baseType = cfunc.getType().getBaseType().toLowerCase(); - out.println(indent + - "return toEGLHandle(_env, " + baseType + "Class, " + - baseType + "Constructor, _returnValue);"); - } else { - out.println(indent + "return (" + - getJniType(jfunc.getType()) + ")_returnValue;"); - } + out.println(indent + "return _returnValue;"); } out.println("}"); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/JType.java android-platform-frameworks-native-21/opengl/tools/glgen/src/JType.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/JType.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/JType.java 2012-10-16 22:57:11.000000000 +0000 @@ -46,27 +46,7 @@ typeMapping.put(new CType("GLubyte", true, true), new JType("String", false, false)); typeMapping.put(new CType("char", false, true), new JType("byte")); typeMapping.put(new CType("char", true, true), new JType("String", false, false)); - typeMapping.put(new CType("GLchar", true, true), new JType("String", false, false)); typeMapping.put(new CType("int"), new JType("int")); - typeMapping.put(new CType("GLuint64"), new JType("long")); - typeMapping.put(new CType("GLsync"), new JType("long")); - - // EGL primitive types - typeMapping.put(new CType("EGLint"), new JType("int")); - typeMapping.put(new CType("EGLBoolean"), new JType("boolean")); - typeMapping.put(new CType("EGLenum"), new JType("int")); - typeMapping.put(new CType("EGLNativePixmapType"), new JType("int")); - typeMapping.put(new CType("EGLNativeWindowType"), new JType("int")); - typeMapping.put(new CType("EGLNativeDisplayType"), new JType("long")); - typeMapping.put(new CType("EGLClientBuffer"), new JType("long")); - typeMapping.put(new CType("EGLnsecsANDROID"), new JType("long")); - - // EGL nonprimitive types - typeMapping.put(new CType("EGLConfig"), new JType("EGLConfig", true, false)); - typeMapping.put(new CType("EGLContext"), new JType("EGLContext", true, false)); - typeMapping.put(new CType("EGLDisplay"), new JType("EGLDisplay", true, false)); - typeMapping.put(new CType("EGLSurface"), new JType("EGLSurface", true, false)); - // Untyped pointers map to untyped Buffers typeMapping.put(new CType("GLvoid", true, true), @@ -83,8 +63,6 @@ new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLenum", false, true), new JType("java.nio.IntBuffer", true, false)); - typeMapping.put(new CType("GLenum", true, true), - new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLfixed", false, true), new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLfixed", true, true), @@ -105,16 +83,13 @@ new JType("java.nio.IntBuffer", true, false)); typeMapping.put(new CType("GLshort", true, true), new JType("java.nio.ShortBuffer", true, false)); - typeMapping.put(new CType("GLint64", false, true), - new JType("java.nio.LongBuffer", true, false)); // Typed pointers map to arrays + offsets arrayTypeMapping.put(new CType("char", false, true), new JType("byte", false, true)); arrayTypeMapping.put(new CType("GLboolean", false, true), - new JType("boolean", false, true)); + new JType("boolean", false, true)); arrayTypeMapping.put(new CType("GLenum", false, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLenum", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLfixed", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLfixed", false, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLfloat", false, true), new JType("float", false, true)); @@ -128,14 +103,6 @@ arrayTypeMapping.put(new CType("GLuint", true, true), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLintptr"), new JType("int", false, true)); arrayTypeMapping.put(new CType("GLsizeiptr"), new JType("int", false, true)); - arrayTypeMapping.put(new CType("GLint64", false, true), new JType("long", false, true)); - - //EGL typed pointers map to arrays + offsets - arrayTypeMapping.put(new CType("EGLint", false, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("EGLint", true, true), new JType("int", false, true)); - arrayTypeMapping.put(new CType("EGLConfig", false, true), new JType("EGLConfig", true, true)); - arrayTypeMapping.put(new CType("EGLConfig", true, true), new JType("EGLConfig", true, true)); - } public JType() { @@ -191,89 +158,6 @@ (baseType.indexOf("Buffer") != -1); } - public JType getArrayTypeForTypedBuffer() { - if (!isTypedBuffer()) { - throw new RuntimeException("Not typed buffer type " + this); - } - switch (baseType) { - case "java.nio.ByteBuffer": - return new JType("byte", false, true); - case "java.nio.BooleanBuffer": - return new JType("boolean", false, true); - case "java.nio.ShortBuffer": - return new JType("short", false, true); - case "java.nio.CharBuffer": - return new JType("char", false, true); - case "java.nio.IntBuffer": - return new JType("int", false, true); - case "java.nio.LongBuffer": - return new JType("long", false, true); - case "java.nio.FloatBuffer": - return new JType("float", false, true); - case "java.nio.DoubleBuffer": - return new JType("double", false, true); - default: - throw new RuntimeException("Unknown typed buffer type " + this); - } - } - - public String getArrayGetterForPrimitiveArray() { - if (!isArray() || isClass()) { - throw new RuntimeException("Not array type " + this); - } - switch (baseType) { - case "byte": - return "GetByteArrayElements"; - case "boolean": - return "GetBooleanArrayElements"; - case "short": - return "GetShortArrayElements"; - case "char": - return "GetCharArrayElements"; - case "int": - return "GetIntArrayElements"; - case "long": - return "GetLongArrayElements"; - case "float": - return "GetFloatArrayElements"; - case "double": - return "GetDoubleArrayElements"; - default: - throw new RuntimeException("Unknown array type " + this); - } - } - - public String getArrayReleaserForPrimitiveArray() { - if (!isArray() || isClass()) { - throw new RuntimeException("Not array type " + this); - } - switch (baseType) { - case "byte": - return "ReleaseByteArrayElements"; - case "boolean": - return "ReleaseBooleanArrayElements"; - case "short": - return "ReleaseShortArrayElements"; - case "char": - return "ReleaseCharArrayElements"; - case "int": - return "ReleaseIntArrayElements"; - case "long": - return "ReleaseLongArrayElements"; - case "float": - return "ReleaseFloatArrayElements"; - case "double": - return "ReleaseDoubleArrayElements"; - default: - throw new RuntimeException("Unknown array type " + this); - } - } - - public boolean isEGLHandle() { - return !isPrimitive() && - (baseType.startsWith("EGL")); - } - public static JType convert(CType ctype, boolean useArray) { JType javaType = null; if (useArray) { diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/ParameterChecker.java android-platform-frameworks-native-21/opengl/tools/glgen/src/ParameterChecker.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/src/ParameterChecker.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/src/ParameterChecker.java 2012-10-16 22:57:11.000000000 +0000 @@ -22,21 +22,8 @@ HashMap map = new HashMap(); public ParameterChecker(BufferedReader reader) throws Exception { - String line; - while ((line = reader.readLine()) != null) { - String s = line.trim(); - - // skip empty lines - if (s.isEmpty()) { - continue; - } - - // skip single-line comments - if (s.startsWith("//") || - s.startsWith("#")) { - continue; - } - + String s; + while ((s = reader.readLine()) != null) { String[] tokens = s.split("\\s"); map.put(tokens[0], tokens); } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLConfig.java android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLConfig.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLConfig.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLConfig.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* -** -** Copyright 2012, 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. -*/ - -package android.opengl; - -/** - * Wrapper class for native EGLConfig objects. - * - */ -public class EGLConfig extends EGLObjectHandle { - private EGLConfig(long handle) { - super(handle); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof EGLConfig)) return false; - - EGLConfig that = (EGLConfig) o; - return getNativeHandle() == that.getNativeHandle(); - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLContext.java android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLContext.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLContext.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLContext.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* -** -** Copyright 2012, 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. -*/ - -package android.opengl; - -/** - * Wrapper class for native EGLContext objects. - * - */ -public class EGLContext extends EGLObjectHandle { - private EGLContext(long handle) { - super(handle); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof EGLContext)) return false; - - EGLContext that = (EGLContext) o; - return getNativeHandle() == that.getNativeHandle(); - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLDisplay.java android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLDisplay.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLDisplay.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLDisplay.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* -** -** Copyright 2012, 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. -*/ - -package android.opengl; - -/** - * Wrapper class for native EGLDisplay objects. - * - */ -public class EGLDisplay extends EGLObjectHandle { - private EGLDisplay(long handle) { - super(handle); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof EGLDisplay)) return false; - - EGLDisplay that = (EGLDisplay) o; - return getNativeHandle() == that.getNativeHandle(); - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLObjectHandle.java android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLObjectHandle.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLObjectHandle.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLObjectHandle.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,70 +0,0 @@ -/* -** -** Copyright 2012, 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. -*/ - -package android.opengl; - -/** - * Base class for wrapped EGL objects. - * - */ -public abstract class EGLObjectHandle { - private final long mHandle; - - /** - * @deprecated Use {@link #EGLObjectHandle(long)} instead. Handles - * on 64 bit platforms will be wider than java ints. - */ - @Deprecated - protected EGLObjectHandle(int handle) { - mHandle = handle; - } - protected EGLObjectHandle(long handle) { - mHandle = handle; - } - /** - * @deprecated Use {@link #getNativeHandle()} instead. Handles on - * 64 bit platforms will be wider than java ints. - */ - @Deprecated - public int getHandle() { - if ((mHandle & 0xffffffffL) != mHandle) { - throw new UnsupportedOperationException(); - } - return (int)mHandle; - } - /** - * Returns the native handle of the wrapped EGL object. This handle can be - * cast to the corresponding native type on the native side. - * - * For example, EGLDisplay dpy = (EGLDisplay)handle; - * - * @return the native handle of the wrapped EGL object. - */ - public long getNativeHandle() { - return mHandle; - } - @Override - public int hashCode() { - /* - * Based on the algorithm suggested in - * http://developer.android.com/reference/java/lang/Object.html - */ - int result = 17; - result = 31 * result + (int) (mHandle ^ (mHandle >>> 32)); - return result; - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLSurface.java android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLSurface.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/static/egl/EGLSurface.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/static/egl/EGLSurface.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,37 +0,0 @@ -/* -** -** Copyright 2012, 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. -*/ - -package android.opengl; - -/** - * Wrapper class for native EGLSurface objects. - * - */ -public class EGLSurface extends EGLObjectHandle { - private EGLSurface(long handle) { - super(handle); - } - - @Override - public boolean equals(Object o) { - if (this == o) return true; - if (!(o instanceof EGLSurface)) return false; - - EGLSurface that = (EGLSurface) o; - return getNativeHandle() == that.getNativeHandle(); - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGL14cHeader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,137 +0,0 @@ -/* -** Copyright 2012, 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. -*/ - -// This source file is automatically generated - -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" - -#include "jni.h" -#include "JNIHelp.h" -#include -#include -#include -#include - -#include -#include - -#include -#include -#include - -#include - -static int initialized = 0; - -static jclass egldisplayClass; -static jclass eglcontextClass; -static jclass eglsurfaceClass; -static jclass eglconfigClass; - -static jmethodID egldisplayGetHandleID; -static jmethodID eglcontextGetHandleID; -static jmethodID eglsurfaceGetHandleID; -static jmethodID eglconfigGetHandleID; - -static jmethodID egldisplayConstructor; -static jmethodID eglcontextConstructor; -static jmethodID eglsurfaceConstructor; -static jmethodID eglconfigConstructor; - -static jobject eglNoContextObject; -static jobject eglNoDisplayObject; -static jobject eglNoSurfaceObject; - - - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay"); - egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal); - jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext"); - eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal); - jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface"); - eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal); - jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig"); - eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal); - - egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J"); - eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J"); - eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J"); - eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J"); - - - egldisplayConstructor = _env->GetMethodID(egldisplayClass, "", "(J)V"); - eglcontextConstructor = _env->GetMethodID(eglcontextClass, "", "(J)V"); - eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "", "(J)V"); - eglconfigConstructor = _env->GetMethodID(eglconfigClass, "", "(J)V"); - - jobject localeglNoContextObject = _env->NewObject(eglcontextClass, eglcontextConstructor, reinterpret_cast(EGL_NO_CONTEXT)); - eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject); - jobject localeglNoDisplayObject = _env->NewObject(egldisplayClass, egldisplayConstructor, reinterpret_cast(EGL_NO_DISPLAY)); - eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject); - jobject localeglNoSurfaceObject = _env->NewObject(eglsurfaceClass, eglsurfaceConstructor, reinterpret_cast(EGL_NO_SURFACE)); - eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject); - - - jclass eglClass = _env->FindClass("android/opengl/EGL14"); - jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;"); - _env->SetStaticObjectField(eglClass, noContextFieldID, eglNoContextObject); - - jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;"); - _env->SetStaticObjectField(eglClass, noDisplayFieldID, eglNoDisplayObject); - - jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;"); - _env->SetStaticObjectField(eglClass, noSurfaceFieldID, eglNoSurfaceObject); -} - -static void * -fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) { - if (obj == NULL){ - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Object is set to null."); - } - - jlong handle = _env->CallLongMethod(obj, mid); - return reinterpret_cast(handle); -} - -static jobject -toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) { - if (cls == eglcontextClass && - (EGLContext)handle == EGL_NO_CONTEXT) { - return eglNoContextObject; - } - - if (cls == egldisplayClass && - (EGLDisplay)handle == EGL_NO_DISPLAY) { - return eglNoDisplayObject; - } - - if (cls == eglsurfaceClass && - (EGLSurface)handle == EGL_NO_SURFACE) { - return eglNoSurfaceObject; - } - - return _env->NewObject(cls, con, reinterpret_cast(handle)); -} - -// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGL14Header.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGL14Header.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGL14Header.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGL14Header.java-if 1970-01-01 00:00:00.000000000 +0000 @@ -1,151 +0,0 @@ -/* -** Copyright 2012, 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. -*/ - -// This source file is automatically generated - -package android.opengl; - -import android.graphics.SurfaceTexture; -import android.view.Surface; -import android.view.SurfaceView; -import android.view.SurfaceHolder; - -/** - * EGL 1.4 - * - */ -public class EGL14 { - -public static final int EGL_DEFAULT_DISPLAY = 0; -public static EGLContext EGL_NO_CONTEXT = null; -public static EGLDisplay EGL_NO_DISPLAY = null; -public static EGLSurface EGL_NO_SURFACE = null; - -public static final int EGL_FALSE = 0; -public static final int EGL_TRUE = 1; -public static final int EGL_SUCCESS = 0x3000; -public static final int EGL_NOT_INITIALIZED = 0x3001; -public static final int EGL_BAD_ACCESS = 0x3002; -public static final int EGL_BAD_ALLOC = 0x3003; -public static final int EGL_BAD_ATTRIBUTE = 0x3004; -public static final int EGL_BAD_CONFIG = 0x3005; -public static final int EGL_BAD_CONTEXT = 0x3006; -public static final int EGL_BAD_CURRENT_SURFACE = 0x3007; -public static final int EGL_BAD_DISPLAY = 0x3008; -public static final int EGL_BAD_MATCH = 0x3009; -public static final int EGL_BAD_NATIVE_PIXMAP = 0x300A; -public static final int EGL_BAD_NATIVE_WINDOW = 0x300B; -public static final int EGL_BAD_PARAMETER = 0x300C; -public static final int EGL_BAD_SURFACE = 0x300D; -public static final int EGL_CONTEXT_LOST = 0x300E; -public static final int EGL_BUFFER_SIZE = 0x3020; -public static final int EGL_ALPHA_SIZE = 0x3021; -public static final int EGL_BLUE_SIZE = 0x3022; -public static final int EGL_GREEN_SIZE = 0x3023; -public static final int EGL_RED_SIZE = 0x3024; -public static final int EGL_DEPTH_SIZE = 0x3025; -public static final int EGL_STENCIL_SIZE = 0x3026; -public static final int EGL_CONFIG_CAVEAT = 0x3027; -public static final int EGL_CONFIG_ID = 0x3028; -public static final int EGL_LEVEL = 0x3029; -public static final int EGL_MAX_PBUFFER_HEIGHT = 0x302A; -public static final int EGL_MAX_PBUFFER_PIXELS = 0x302B; -public static final int EGL_MAX_PBUFFER_WIDTH = 0x302C; -public static final int EGL_NATIVE_RENDERABLE = 0x302D; -public static final int EGL_NATIVE_VISUAL_ID = 0x302E; -public static final int EGL_NATIVE_VISUAL_TYPE = 0x302F; -public static final int EGL_SAMPLES = 0x3031; -public static final int EGL_SAMPLE_BUFFERS = 0x3032; -public static final int EGL_SURFACE_TYPE = 0x3033; -public static final int EGL_TRANSPARENT_TYPE = 0x3034; -public static final int EGL_TRANSPARENT_BLUE_VALUE = 0x3035; -public static final int EGL_TRANSPARENT_GREEN_VALUE = 0x3036; -public static final int EGL_TRANSPARENT_RED_VALUE = 0x3037; -public static final int EGL_NONE = 0x3038; -public static final int EGL_BIND_TO_TEXTURE_RGB = 0x3039; -public static final int EGL_BIND_TO_TEXTURE_RGBA = 0x303A; -public static final int EGL_MIN_SWAP_INTERVAL = 0x303B; -public static final int EGL_MAX_SWAP_INTERVAL = 0x303C; -public static final int EGL_LUMINANCE_SIZE = 0x303D; -public static final int EGL_ALPHA_MASK_SIZE = 0x303E; -public static final int EGL_COLOR_BUFFER_TYPE = 0x303F; -public static final int EGL_RENDERABLE_TYPE = 0x3040; -public static final int EGL_MATCH_NATIVE_PIXMAP = 0x3041; -public static final int EGL_CONFORMANT = 0x3042; -public static final int EGL_SLOW_CONFIG = 0x3050; -public static final int EGL_NON_CONFORMANT_CONFIG = 0x3051; -public static final int EGL_TRANSPARENT_RGB = 0x3052; -public static final int EGL_RGB_BUFFER = 0x308E; -public static final int EGL_LUMINANCE_BUFFER = 0x308F; -public static final int EGL_NO_TEXTURE = 0x305C; -public static final int EGL_TEXTURE_RGB = 0x305D; -public static final int EGL_TEXTURE_RGBA = 0x305E; -public static final int EGL_TEXTURE_2D = 0x305F; -public static final int EGL_PBUFFER_BIT = 0x0001; -public static final int EGL_PIXMAP_BIT = 0x0002; -public static final int EGL_WINDOW_BIT = 0x0004; -public static final int EGL_VG_COLORSPACE_LINEAR_BIT = 0x0020; -public static final int EGL_VG_ALPHA_FORMAT_PRE_BIT = 0x0040; -public static final int EGL_MULTISAMPLE_RESOLVE_BOX_BIT = 0x0200; -public static final int EGL_SWAP_BEHAVIOR_PRESERVED_BIT = 0x0400; -public static final int EGL_OPENGL_ES_BIT = 0x0001; -public static final int EGL_OPENVG_BIT = 0x0002; -public static final int EGL_OPENGL_ES2_BIT = 0x0004; -public static final int EGL_OPENGL_BIT = 0x0008; -public static final int EGL_VENDOR = 0x3053; -public static final int EGL_VERSION = 0x3054; -public static final int EGL_EXTENSIONS = 0x3055; -public static final int EGL_CLIENT_APIS = 0x308D; -public static final int EGL_HEIGHT = 0x3056; -public static final int EGL_WIDTH = 0x3057; -public static final int EGL_LARGEST_PBUFFER = 0x3058; -public static final int EGL_TEXTURE_FORMAT = 0x3080; -public static final int EGL_TEXTURE_TARGET = 0x3081; -public static final int EGL_MIPMAP_TEXTURE = 0x3082; -public static final int EGL_MIPMAP_LEVEL = 0x3083; -public static final int EGL_RENDER_BUFFER = 0x3086; -public static final int EGL_VG_COLORSPACE = 0x3087; -public static final int EGL_VG_ALPHA_FORMAT = 0x3088; -public static final int EGL_HORIZONTAL_RESOLUTION = 0x3090; -public static final int EGL_VERTICAL_RESOLUTION = 0x3091; -public static final int EGL_PIXEL_ASPECT_RATIO = 0x3092; -public static final int EGL_SWAP_BEHAVIOR = 0x3093; -public static final int EGL_MULTISAMPLE_RESOLVE = 0x3099; -public static final int EGL_BACK_BUFFER = 0x3084; -public static final int EGL_SINGLE_BUFFER = 0x3085; -public static final int EGL_VG_COLORSPACE_sRGB = 0x3089; -public static final int EGL_VG_COLORSPACE_LINEAR = 0x308A; -public static final int EGL_VG_ALPHA_FORMAT_NONPRE = 0x308B; -public static final int EGL_VG_ALPHA_FORMAT_PRE = 0x308C; -public static final int EGL_DISPLAY_SCALING = 10000; -public static final int EGL_BUFFER_PRESERVED = 0x3094; -public static final int EGL_BUFFER_DESTROYED = 0x3095; -public static final int EGL_OPENVG_IMAGE = 0x3096; -public static final int EGL_CONTEXT_CLIENT_TYPE = 0x3097; -public static final int EGL_CONTEXT_CLIENT_VERSION = 0x3098; -public static final int EGL_MULTISAMPLE_RESOLVE_DEFAULT = 0x309A; -public static final int EGL_MULTISAMPLE_RESOLVE_BOX = 0x309B; -public static final int EGL_OPENGL_ES_API = 0x30A0; -public static final int EGL_OPENVG_API = 0x30A1; -public static final int EGL_OPENGL_API = 0x30A2; -public static final int EGL_DRAW = 0x3059; -public static final int EGL_READ = 0x305A; -public static final int EGL_CORE_NATIVE_ENGINE = 0x305B; - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/* EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) */ -static jobject -android_eglCreatePbufferFromClientBuffer - (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jlong buffer, jobject config, jintArray attrib_list_ref, jint offset) { - jint _exception = 0; - const char * _exceptionType = NULL; - const char * _exceptionMessage = NULL; - EGLSurface _returnValue = (EGLSurface) 0; - EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); - EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); - bool attrib_list_sentinel = false; - EGLint *attrib_list_base = (EGLint *) 0; - jint _remaining; - EGLint *attrib_list = (EGLint *) 0; - - if (!attrib_list_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "attrib_list == null"; - goto exit; - } - if (offset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "offset < 0"; - goto exit; - } - _remaining = _env->GetArrayLength(attrib_list_ref) - offset; - attrib_list_base = (EGLint *) - _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0); - attrib_list = attrib_list_base + offset; - attrib_list_sentinel = false; - for (int i = _remaining - 1; i >= 0; i--) { - if (attrib_list[i] == EGL_NONE){ - attrib_list_sentinel = true; - break; - } - } - if (attrib_list_sentinel == false) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "attrib_list must contain EGL_NONE!"; - goto exit; - } - - _returnValue = eglCreatePbufferFromClientBuffer( - (EGLDisplay)dpy_native, - (EGLenum)buftype, - reinterpret_cast(buffer), - (EGLConfig)config_native, - (EGLint *)attrib_list - ); - -exit: - if (attrib_list_base) { - _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base, - JNI_ABORT); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } - return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); -} - -static jobject -android_eglCreatePbufferFromClientBufferInt - (JNIEnv *_env, jobject _this, jobject dpy, jint buftype, jint buffer, jobject config, jintArray attrib_list_ref, jint offset) { - if(sizeof(void*) != sizeof(uint32_t)) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglCreatePbufferFromClientBuffer"); - return 0; - } - return android_eglCreatePbufferFromClientBuffer(_env, _this, dpy, buftype, buffer, config, attrib_list_ref, offset); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,23 +0,0 @@ - // C function EGLSurface eglCreatePbufferFromClientBuffer ( EGLDisplay dpy, EGLenum buftype, EGLClientBuffer buffer, EGLConfig config, const EGLint *attrib_list ) - // TODO Deprecate the below method - public static native EGLSurface eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, - int buftype, - int buffer, - EGLConfig config, - int[] attrib_list, - int offset - ); - // TODO Unhide the below method - /** - * {@hide} - */ - public static native EGLSurface eglCreatePbufferFromClientBuffer( - EGLDisplay dpy, - int buftype, - long buffer, - EGLConfig config, - int[] attrib_list, - int offset - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreatePbufferFromClientBuffer.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IILandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBufferInt }, -{"eglCreatePbufferFromClientBuffer", "(Landroid/opengl/EGLDisplay;IJLandroid/opengl/EGLConfig;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreatePbufferFromClientBuffer }, \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,158 +0,0 @@ -/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ -static jobject -android_eglCreateWindowSurface - (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { - jint _exception = 0; - const char * _exceptionType = ""; - const char * _exceptionMessage = ""; - EGLSurface _returnValue = (EGLSurface) 0; - EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); - EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); - int attrib_list_sentinel = 0; - EGLint *attrib_list_base = (EGLint *) 0; - jint _remaining; - EGLint *attrib_list = (EGLint *) 0; - android::sp window; - - if (!attrib_list_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "attrib_list == null"; - goto exit; - } - if (offset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "offset < 0"; - goto exit; - } - if (win == NULL) { -not_valid_surface: - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; - goto exit; - } - - window = android::android_view_Surface_getNativeWindow(_env, win); - - if (window == NULL) - goto not_valid_surface; - - _remaining = _env->GetArrayLength(attrib_list_ref) - offset; - attrib_list_base = (EGLint *) - _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0); - attrib_list = attrib_list_base + offset; - attrib_list_sentinel = 0; - for (int i = _remaining - 1; i >= 0; i--) { - if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ - attrib_list_sentinel = 1; - break; - } - } - if (attrib_list_sentinel == 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "attrib_list must contain EGL_NONE!"; - goto exit; - } - - _returnValue = eglCreateWindowSurface( - (EGLDisplay)dpy_native, - (EGLConfig)config_native, - (EGLNativeWindowType)window.get(), - (EGLint *)attrib_list - ); - -exit: - if (attrib_list_base) { - _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base, - JNI_ABORT); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } - return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); -} - -/* EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) */ -static jobject -android_eglCreateWindowSurfaceTexture - (JNIEnv *_env, jobject _this, jobject dpy, jobject config, jobject win, jintArray attrib_list_ref, jint offset) { - jint _exception = 0; - const char * _exceptionType = ""; - const char * _exceptionMessage = ""; - EGLSurface _returnValue = (EGLSurface) 0; - EGLDisplay dpy_native = (EGLDisplay) fromEGLHandle(_env, egldisplayGetHandleID, dpy); - EGLConfig config_native = (EGLConfig) fromEGLHandle(_env, eglconfigGetHandleID, config); - int attrib_list_sentinel = 0; - EGLint *attrib_list_base = (EGLint *) 0; - jint _remaining; - EGLint *attrib_list = (EGLint *) 0; - android::sp window; - android::sp producer; - - if (!attrib_list_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "attrib_list == null"; - goto exit; - } - if (offset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "offset < 0"; - goto exit; - } - if (win == NULL) { -not_valid_surface: - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "Make sure the SurfaceView or associated SurfaceHolder has a valid Surface"; - goto exit; - } - producer = android::SurfaceTexture_getProducer(_env, win); - - if (producer == NULL) - goto not_valid_surface; - - window = new android::Surface(producer, true); - - if (window == NULL) - goto not_valid_surface; - - _remaining = _env->GetArrayLength(attrib_list_ref) - offset; - attrib_list_base = (EGLint *) - _env->GetIntArrayElements(attrib_list_ref, (jboolean *)0); - attrib_list = attrib_list_base + offset; - attrib_list_sentinel = 0; - for (int i = _remaining - 1; i >= 0; i--) { - if (*((EGLint*)(attrib_list + i)) == EGL_NONE){ - attrib_list_sentinel = 1; - break; - } - } - if (attrib_list_sentinel == 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "attrib_list must contain EGL_NONE!"; - goto exit; - } - - _returnValue = eglCreateWindowSurface( - (EGLDisplay)dpy_native, - (EGLConfig)config_native, - (EGLNativeWindowType)window.get(), - (EGLint *)attrib_list - ); - -exit: - if (attrib_list_base) { - _env->ReleaseIntArrayElements(attrib_list_ref, attrib_list_base, - JNI_ABORT); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } - return toEGLHandle(_env, eglsurfaceClass, eglsurfaceConstructor, _returnValue); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,50 +0,0 @@ - // C function EGLSurface eglCreateWindowSurface ( EGLDisplay dpy, EGLConfig config, EGLNativeWindowType win, const EGLint *attrib_list ) - - private static native EGLSurface _eglCreateWindowSurface( - EGLDisplay dpy, - EGLConfig config, - Object win, - int[] attrib_list, - int offset - ); - - private static native EGLSurface _eglCreateWindowSurfaceTexture( - EGLDisplay dpy, - EGLConfig config, - Object win, - int[] attrib_list, - int offset - ); - - public static EGLSurface eglCreateWindowSurface(EGLDisplay dpy, - EGLConfig config, - Object win, - int[] attrib_list, - int offset - ){ - Surface sur = null; - if (win instanceof SurfaceView) { - SurfaceView surfaceView = (SurfaceView)win; - sur = surfaceView.getHolder().getSurface(); - } else if (win instanceof SurfaceHolder) { - SurfaceHolder holder = (SurfaceHolder)win; - sur = holder.getSurface(); - } else if (win instanceof Surface) { - sur = (Surface) win; - } - - EGLSurface surface; - if (sur != null) { - surface = _eglCreateWindowSurface(dpy, config, sur, attrib_list, offset); - } else if (win instanceof SurfaceTexture) { - surface = _eglCreateWindowSurfaceTexture(dpy, config, - win, attrib_list, offset); - } else { - throw new java.lang.UnsupportedOperationException( - "eglCreateWindowSurface() can only be called with an instance of " + - "Surface, SurfaceView, SurfaceTexture or SurfaceHolder at the moment, " + - "this will be fixed later."); - } - - return surface; - } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglCreateWindowSurface.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"_eglCreateWindowSurface", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurface }, -{"_eglCreateWindowSurfaceTexture", "(Landroid/opengl/EGLDisplay;Landroid/opengl/EGLConfig;Ljava/lang/Object;[II)Landroid/opengl/EGLSurface;", (void *) android_eglCreateWindowSurfaceTexture }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGLExtcHeader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -/* -** Copyright 2013, 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. -*/ - -// This source file is automatically generated - -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" - -#include "jni.h" -#include "JNIHelp.h" -#include -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -static int initialized = 0; - -static jclass egldisplayClass; -static jclass eglcontextClass; -static jclass eglsurfaceClass; -static jclass eglconfigClass; - -static jmethodID egldisplayGetHandleID; -static jmethodID eglcontextGetHandleID; -static jmethodID eglsurfaceGetHandleID; -static jmethodID eglconfigGetHandleID; - -static jmethodID egldisplayConstructor; -static jmethodID eglcontextConstructor; -static jmethodID eglsurfaceConstructor; -static jmethodID eglconfigConstructor; - -static jobject eglNoContextObject; -static jobject eglNoDisplayObject; -static jobject eglNoSurfaceObject; - - - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass egldisplayClassLocal = _env->FindClass("android/opengl/EGLDisplay"); - egldisplayClass = (jclass) _env->NewGlobalRef(egldisplayClassLocal); - jclass eglcontextClassLocal = _env->FindClass("android/opengl/EGLContext"); - eglcontextClass = (jclass) _env->NewGlobalRef(eglcontextClassLocal); - jclass eglsurfaceClassLocal = _env->FindClass("android/opengl/EGLSurface"); - eglsurfaceClass = (jclass) _env->NewGlobalRef(eglsurfaceClassLocal); - jclass eglconfigClassLocal = _env->FindClass("android/opengl/EGLConfig"); - eglconfigClass = (jclass) _env->NewGlobalRef(eglconfigClassLocal); - - egldisplayGetHandleID = _env->GetMethodID(egldisplayClass, "getNativeHandle", "()J"); - eglcontextGetHandleID = _env->GetMethodID(eglcontextClass, "getNativeHandle", "()J"); - eglsurfaceGetHandleID = _env->GetMethodID(eglsurfaceClass, "getNativeHandle", "()J"); - eglconfigGetHandleID = _env->GetMethodID(eglconfigClass, "getNativeHandle", "()J"); - - - egldisplayConstructor = _env->GetMethodID(egldisplayClass, "", "(J)V"); - eglcontextConstructor = _env->GetMethodID(eglcontextClass, "", "(J)V"); - eglsurfaceConstructor = _env->GetMethodID(eglsurfaceClass, "", "(J)V"); - eglconfigConstructor = _env->GetMethodID(eglconfigClass, "", "(J)V"); - - - jclass eglClass = _env->FindClass("android/opengl/EGL14"); - jfieldID noContextFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_CONTEXT", "Landroid/opengl/EGLContext;"); - jobject localeglNoContextObject = _env->GetStaticObjectField(eglClass, noContextFieldID); - eglNoContextObject = _env->NewGlobalRef(localeglNoContextObject); - - jfieldID noDisplayFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_DISPLAY", "Landroid/opengl/EGLDisplay;"); - jobject localeglNoDisplayObject = _env->GetStaticObjectField(eglClass, noDisplayFieldID); - eglNoDisplayObject = _env->NewGlobalRef(localeglNoDisplayObject); - - jfieldID noSurfaceFieldID = _env->GetStaticFieldID(eglClass, "EGL_NO_SURFACE", "Landroid/opengl/EGLSurface;"); - jobject localeglNoSurfaceObject = _env->GetStaticObjectField(eglClass, noSurfaceFieldID); - eglNoSurfaceObject = _env->NewGlobalRef(localeglNoSurfaceObject); -} - -static void * -fromEGLHandle(JNIEnv *_env, jmethodID mid, jobject obj) { - if (obj == NULL){ - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Object is set to null."); - } - - return reinterpret_cast(_env->CallLongMethod(obj, mid)); -} - -static jobject -toEGLHandle(JNIEnv *_env, jclass cls, jmethodID con, void * handle) { - if (cls == eglcontextClass && - (EGLContext)handle == EGL_NO_CONTEXT) { - return eglNoContextObject; - } - - if (cls == egldisplayClass && - (EGLDisplay)handle == EGL_NO_DISPLAY) { - return eglNoDisplayObject; - } - - if (cls == eglsurfaceClass && - (EGLSurface)handle == EGL_NO_SURFACE) { - return eglNoSurfaceObject; - } - - return _env->NewObject(cls, con, reinterpret_cast(handle)); -} - -// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/EGLExtHeader.java-if 1970-01-01 00:00:00.000000000 +0000 @@ -1,36 +0,0 @@ -/* -** Copyright 2013, 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. -*/ - -// This source file is automatically generated - -package android.opengl; - -/** - * EGL Extensions - */ -public class EGLExt { - - // EGL_KHR_create_context - public static final int EGL_CONTEXT_MAJOR_VERSION_KHR = 0x3098; - public static final int EGL_CONTEXT_MINOR_VERSION_KHR = 0x30FB; - public static final int EGL_CONTEXT_FLAGS_KHR = 0x30FC; - public static final int EGL_OPENGL_ES3_BIT_KHR = 0x0040; - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglGetDisplay.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */ -static jobject -android_eglGetDisplay - (JNIEnv *_env, jobject _this, jlong display_id) { - EGLDisplay _returnValue = (EGLDisplay) 0; - _returnValue = eglGetDisplay( - reinterpret_cast(display_id) - ); - return toEGLHandle(_env, egldisplayClass, egldisplayConstructor, _returnValue); -} - -/* EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) */ -static jobject -android_eglGetDisplayInt - (JNIEnv *_env, jobject _this, jint display_id) { - - if (static_cast(display_id) != - reinterpret_cast(EGL_DEFAULT_DISPLAY)) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "eglGetDisplay"); - return 0; - } - return android_eglGetDisplay(_env, _this, display_id); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglGetDisplay.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglGetDisplay.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglGetDisplay.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglGetDisplay.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ - // C function EGLDisplay eglGetDisplay ( EGLNativeDisplayType display_id ) - - public static native EGLDisplay eglGetDisplay( - int display_id - ); - - /** - * {@hide} - */ - public static native EGLDisplay eglGetDisplay( - long display_id - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglGetDisplay.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"eglGetDisplay", "(I)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplayInt }, -{"eglGetDisplay", "(J)Landroid/opengl/EGLDisplay;", (void *) android_eglGetDisplay }, \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglQueryString.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglQueryString.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglQueryString.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglQueryString.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ -/* const char * eglQueryString ( EGLDisplay dpy, EGLint name ) */ -static jstring -android_eglQueryString__Landroind_opengl_EGLDisplay_2I - (JNIEnv *_env, jobject _this, jobject dpy, jint name) { - const char* chars = (const char*) eglQueryString( - (EGLDisplay)fromEGLHandle(_env, egldisplayGetHandleID, dpy), - (EGLint)name - ); - return _env->NewStringUTF(chars); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglQueryString.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglQueryString.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglQueryString.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglQueryString.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - // C function const char * eglQueryString ( EGLDisplay dpy, EGLint name ) - - public static native String eglQueryString( - EGLDisplay dpy, - int name - ); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/egl/eglQueryString.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"eglQueryString", "(Landroid/opengl/EGLDisplay;I)Ljava/lang/String;", (void *) android_eglQueryString__Landroind_opengl_EGLDisplay_2I }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/common.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/common.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/common.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/common.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,418 +0,0 @@ -#include -#include -#include -#include -#include - -static int initialized = 0; - -static jclass nioAccessClass; -static jclass bufferClass; -static jmethodID getBasePointerID; -static jmethodID getBaseArrayID; -static jmethodID getBaseArrayOffsetID; -static jfieldID positionID; -static jfieldID limitID; -static jfieldID elementSizeShiftID; - - -/* special calls implemented in Android's GLES wrapper used to more - * efficiently bound-check passed arrays */ -extern "C" { -#ifdef GL_VERSION_ES_CM_1_1 -GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, - const GLvoid *ptr, GLsizei count); -GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, - const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count); -#endif -#ifdef GL_ES_VERSION_2_0 -static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, - GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { - glVertexAttribPointer(indx, size, type, normalized, stride, pointer); -} -#endif -#ifdef GL_ES_VERSION_3_0 -static void glVertexAttribIPointerBounds(GLuint indx, GLint size, GLenum type, - GLsizei stride, const GLvoid *pointer, GLsizei count) { - glVertexAttribIPointer(indx, size, type, stride, pointer); -} -#endif -} - -/* Cache method IDs each time the class is loaded. */ - -static void -nativeClassInit(JNIEnv *_env, jclass glImplClass) -{ - jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); - nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); - - jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); - bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); - - getBasePointerID = _env->GetStaticMethodID(nioAccessClass, - "getBasePointer", "(Ljava/nio/Buffer;)J"); - getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); - getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, - "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); - - positionID = _env->GetFieldID(bufferClass, "position", "I"); - limitID = _env->GetFieldID(bufferClass, "limit", "I"); - elementSizeShiftID = - _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); -} - -static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) -{ - jint position; - jint limit; - jint elementSizeShift; - jlong pointer; - - position = _env->GetIntField(buffer, positionID); - limit = _env->GetIntField(buffer, limitID); - elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - *remaining = (limit - position) << elementSizeShift; - pointer = _env->CallStaticLongMethod(nioAccessClass, - getBasePointerID, buffer); - if (pointer != 0L) { - *array = NULL; - return reinterpret_cast(pointer); - } - - *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, - getBaseArrayID, buffer); - *offset = _env->CallStaticIntMethod(nioAccessClass, - getBaseArrayOffsetID, buffer); - - return NULL; -} - -class ByteArrayGetter { -public: - static void* Get(JNIEnv* _env, jbyteArray array, jboolean* is_copy) { - return _env->GetByteArrayElements(array, is_copy); - } -}; -class BooleanArrayGetter { -public: - static void* Get(JNIEnv* _env, jbooleanArray array, jboolean* is_copy) { - return _env->GetBooleanArrayElements(array, is_copy); - } -}; -class CharArrayGetter { -public: - static void* Get(JNIEnv* _env, jcharArray array, jboolean* is_copy) { - return _env->GetCharArrayElements(array, is_copy); - } -}; -class ShortArrayGetter { -public: - static void* Get(JNIEnv* _env, jshortArray array, jboolean* is_copy) { - return _env->GetShortArrayElements(array, is_copy); - } -}; -class IntArrayGetter { -public: - static void* Get(JNIEnv* _env, jintArray array, jboolean* is_copy) { - return _env->GetIntArrayElements(array, is_copy); - } -}; -class LongArrayGetter { -public: - static void* Get(JNIEnv* _env, jlongArray array, jboolean* is_copy) { - return _env->GetLongArrayElements(array, is_copy); - } -}; -class FloatArrayGetter { -public: - static void* Get(JNIEnv* _env, jfloatArray array, jboolean* is_copy) { - return _env->GetFloatArrayElements(array, is_copy); - } -}; -class DoubleArrayGetter { -public: - static void* Get(JNIEnv* _env, jdoubleArray array, jboolean* is_copy) { - return _env->GetDoubleArrayElements(array, is_copy); - } -}; - -template -static void* -getArrayPointer(JNIEnv *_env, JTYPEARRAY array, jboolean* is_copy) { - return ARRAYGETTER::Get(_env, array, is_copy); -} - -class ByteArrayReleaser { -public: - static void Release(JNIEnv* _env, jbyteArray array, jbyte* data, jboolean commit) { - _env->ReleaseByteArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class BooleanArrayReleaser { -public: - static void Release(JNIEnv* _env, jbooleanArray array, jboolean* data, jboolean commit) { - _env->ReleaseBooleanArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class CharArrayReleaser { -public: - static void Release(JNIEnv* _env, jcharArray array, jchar* data, jboolean commit) { - _env->ReleaseCharArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class ShortArrayReleaser { -public: - static void Release(JNIEnv* _env, jshortArray array, jshort* data, jboolean commit) { - _env->ReleaseShortArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class IntArrayReleaser { -public: - static void Release(JNIEnv* _env, jintArray array, jint* data, jboolean commit) { - _env->ReleaseIntArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class LongArrayReleaser { -public: - static void Release(JNIEnv* _env, jlongArray array, jlong* data, jboolean commit) { - _env->ReleaseLongArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class FloatArrayReleaser { -public: - static void Release(JNIEnv* _env, jfloatArray array, jfloat* data, jboolean commit) { - _env->ReleaseFloatArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; -class DoubleArrayReleaser { -public: - static void Release(JNIEnv* _env, jdoubleArray array, jdouble* data, jboolean commit) { - _env->ReleaseDoubleArrayElements(array, data, commit ? 0 : JNI_ABORT); - } -}; - -template -static void -releaseArrayPointer(JNIEnv *_env, JTYPEARRAY array, NTYPEARRAY data, jboolean commit) { - ARRAYRELEASER::Release(_env, array, data, commit); -} - -static void -releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) -{ - _env->ReleasePrimitiveArrayCritical(array, data, - commit ? 0 : JNI_ABORT); -} - -static void * -getDirectBufferPointer(JNIEnv *_env, jobject buffer) { - char* buf = (char*) _env->GetDirectBufferAddress(buffer); - if (buf) { - jint position = _env->GetIntField(buffer, positionID); - jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); - buf += position << elementSizeShift; - } else { - jniThrowException(_env, "java/lang/IllegalArgumentException", - "Must use a native order direct Buffer"); - } - return (void*) buf; -} - -// -------------------------------------------------------------------------- - -/* - * returns the number of values glGet returns for a given pname. - * - * The code below is written such that pnames requiring only one values - * are the default (and are not explicitely tested for). This makes the - * checking code much shorter/readable/efficient. - * - * This means that unknown pnames (e.g.: extensions) will default to 1. If - * that unknown pname needs more than 1 value, then the validation check - * is incomplete and the app may crash if it passed the wrong number params. - */ -static int getNeededCount(GLint pname) { - int needed = 1; -#ifdef GL_ES_VERSION_2_0 - // GLES 2.x pnames - switch (pname) { - case GL_ALIASED_LINE_WIDTH_RANGE: - case GL_ALIASED_POINT_SIZE_RANGE: - needed = 2; - break; - - case GL_BLEND_COLOR: - case GL_COLOR_CLEAR_VALUE: - case GL_COLOR_WRITEMASK: - case GL_SCISSOR_BOX: - case GL_VIEWPORT: - needed = 4; - break; - - case GL_COMPRESSED_TEXTURE_FORMATS: - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); - break; - - case GL_SHADER_BINARY_FORMATS: - glGetIntegerv(GL_NUM_SHADER_BINARY_FORMATS, &needed); - break; - } -#endif - -#ifdef GL_VERSION_ES_CM_1_1 - // GLES 1.x pnames - switch (pname) { - case GL_ALIASED_LINE_WIDTH_RANGE: - case GL_ALIASED_POINT_SIZE_RANGE: - case GL_DEPTH_RANGE: - case GL_SMOOTH_LINE_WIDTH_RANGE: - case GL_SMOOTH_POINT_SIZE_RANGE: - needed = 2; - break; - - case GL_CURRENT_NORMAL: - case GL_POINT_DISTANCE_ATTENUATION: - needed = 3; - break; - - case GL_COLOR_CLEAR_VALUE: - case GL_COLOR_WRITEMASK: - case GL_CURRENT_COLOR: - case GL_CURRENT_TEXTURE_COORDS: - case GL_FOG_COLOR: - case GL_LIGHT_MODEL_AMBIENT: - case GL_SCISSOR_BOX: - case GL_VIEWPORT: - needed = 4; - break; - - case GL_MODELVIEW_MATRIX: - case GL_PROJECTION_MATRIX: - case GL_TEXTURE_MATRIX: - needed = 16; - break; - - case GL_COMPRESSED_TEXTURE_FORMATS: - glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &needed); - break; - } -#endif - return needed; -} - -template -static void -get - (JNIEnv *_env, jobject _this, jint pname, JTYPEARRAY params_ref, jint offset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - CTYPE *params_base = (CTYPE *) 0; - jint _remaining; - CTYPE *params = (CTYPE *) 0; - int _needed = 0; - - if (!params_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "params == null"; - goto exit; - } - if (offset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "offset < 0"; - goto exit; - } - _remaining = _env->GetArrayLength(params_ref) - offset; - _needed = getNeededCount(pname); - // if we didn't find this pname, we just assume the user passed - // an array of the right size -- this might happen with extensions - // or if we forget an enum here. - if (_remaining < _needed) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length - offset < needed"; - goto exit; - } - params_base = (CTYPE *) getArrayPointer( - _env, params_ref, (jboolean *)0); - params = params_base + offset; - - GET( - (GLenum)pname, - (CTYPE *)params - ); - -exit: - if (params_base) { - releaseArrayPointer( - _env, params_ref, params_base, !_exception); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - - -template -static void -getarray - (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - JTYPEARRAY _array = (JTYPEARRAY) 0; - jint _bufferOffset = (jint) 0; - jint _remaining; - CTYPE *params = (CTYPE *) 0; - int _needed = 0; - - params = (CTYPE *)getPointer(_env, params_buf, (jarray*)&_array, &_remaining, &_bufferOffset); - _remaining /= sizeof(CTYPE); // convert from bytes to item count - _needed = getNeededCount(pname); - // if we didn't find this pname, we just assume the user passed - // an array of the right size -- this might happen with extensions - // or if we forget an enum here. - if (_needed>0 && _remaining < _needed) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "remaining() < needed"; - goto exit; - } - if (params == NULL) { - char * _paramsBase = (char *) getArrayPointer( - _env, _array, (jboolean *) 0); - params = (CTYPE *) (_paramsBase + _bufferOffset); - } - GET( - (GLenum)pname, - (CTYPE *)params - ); - -exit: - if (_array) { - releaseArrayPointer( - _env, _array, (NTYPEARRAY)params, _exception ? JNI_FALSE : JNI_TRUE); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -/* void glBindVertexBuffer ( GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) */ -static void -android_glBindVertexBuffer__IIJI - (JNIEnv *_env, jobject _this, jint bindingindex, jint buffer, jlong offset, jint stride) { - if (sizeof(GLintptr) != sizeof(jlong) && (offset < LONG_MIN || offset > LONG_MAX)) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "offset too large"); - return; - } - glBindVertexBuffer( - (GLuint)bindingindex, - (GLuint)buffer, - (GLintptr)offset, - (GLsizei)stride - ); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ - // C function void glBindVertexBuffer ( GLuint bindingindex, GLuint buffer, GLintptr offset, GLsizei stride ) - - public static native void glBindVertexBuffer( - int bindingindex, - int buffer, - long offset, - int stride - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glBindVertexBuffer.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glBindVertexBuffer", "(IIJI)V", (void *) android_glBindVertexBuffer__IIJI }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -/* GLuint glCreateShaderProgramv ( GLenum type, GLsizei count, const GLchar *const *strings ) */ -static jint -android_glCreateShaderProgramv - (JNIEnv *_env, jobject _this, jint type, jobjectArray strings) { - - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ - // C function GLuint glCreateShaderProgramv ( GLenum type, GLsizei count, const GLchar *const *strings ) - - public static native int glCreateShaderProgramv( - int type, - String[] strings - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glCreateShaderProgramv.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glCreateShaderProgramv", "(I[Ljava/lang/String;)I", (void *) android_glCreateShaderProgramv }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,5 +0,0 @@ -/* void glDebugMessageCallbackKHR ( GLDEBUGPROCKHR callback, const void *userParam ) */ -static void -android_glDebugMessageCallbackKHR(JNIEnv *_env, jobject _this, jobject callback) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - // C function void glDebugMessageCallbackKHR ( GLDEBUGPROCKHR callback, const void *userParam ) - - public interface DebugProcKHR { - void onMessage(int source, int type, int id, int severity, String message); - } - - public static native void glDebugMessageCallbackKHR(DebugProcKHR callback); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageCallbackKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glDebugMessageCallbackKHR", "(Landroid/opengl/GLES31Ext$DebugProcKHR;)V", (void *) android_glDebugMessageCallbackKHR }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* void glDebugMessageInsertKHR ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf ) */ -static void -android_glDebugMessageInsertKHR__IIIILjava_lang_String_2 - (JNIEnv *_env, jobject _this, jint source, jint type, jint id, jint severity, jstring buf) { - jint _exception = 0; - const char * _exceptionType = NULL; - const char * _exceptionMessage = NULL; - const char* _nativebuf = 0; - jint _length = 0; - - if (!buf) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "buf == null"; - goto exit; - } - _nativebuf = _env->GetStringUTFChars(buf, 0); - _length = _env->GetStringUTFLength(buf); - - glDebugMessageInsertKHR( - (GLenum)source, - (GLenum)type, - (GLuint)id, - (GLenum)severity, - (GLsizei)_length, - (GLchar *)_nativebuf - ); - -exit: - if (_nativebuf) { - _env->ReleaseStringUTFChars(buf, _nativebuf); - } - - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,10 +0,0 @@ - // C function void glDebugMessageInsertKHR ( GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, const GLchar *buf ) - - public static native void glDebugMessageInsertKHR( - int source, - int type, - int id, - int severity, - String buf - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDebugMessageInsertKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glDebugMessageInsertKHR", "(IIIILjava/lang/String;)V", (void *) android_glDebugMessageInsertKHR__IIIILjava_lang_String_2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -/* void glDispatchComputeIndirect ( GLintptr indirect ) */ -static void android_glDispatchComputeIndirect(JNIEnv *_env, jobject, jlong indirect) { - // 'indirect' is a byte offset, not a pointer. GL checks for negative and too-large values. - // Here we only need to check for successful 64-bit to 32-bit conversion. - // - jlong is a int64_t (jni.h) - // - GLintptr is a long (khrplatform.h) - if (sizeof(GLintptr) != sizeof(jlong) && (indirect < LONG_MIN || indirect > LONG_MAX)) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "indirect offset too large"); - return; - } - glDispatchComputeIndirect((GLintptr)indirect); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function void glDispatchComputeIndirect ( GLintptr indirect ); - - public static native void glDispatchComputeIndirect(long indirect); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDispatchComputeIndirect.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glDispatchComputeIndirect", "(J)V", (void *) android_glDispatchComputeIndirect }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -/* void glDrawArraysIndirect ( GLenum mode, const void *indirect ) */ -static void android_glDrawArraysIndirect(JNIEnv *_env, jobject, int mode, jlong indirect) { - // In OpenGL ES, 'indirect' is a byte offset into a buffer, not a raw pointer. - // GL checks for too-large values. Here we only need to check for successful signed 64-bit - // to unsigned 32-bit conversion. - if (sizeof(void*) != sizeof(jlong) && indirect > static_cast(UINT32_MAX)) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "indirect offset too large"); - return; - } - glDrawArraysIndirect(mode, (const void*)indirect); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function void glDrawArraysIndirect ( GLenum mode, const void *indirect ); - - public static native void glDrawArraysIndirect(int mode, long indirect); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawArraysIndirect.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glDrawArraysIndirect", "(IJ)V", (void *) android_glDrawArraysIndirect }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,12 +0,0 @@ -/* void glDrawElementsIndirect ( GLenum mode, GLenum type, const void *indirect ) */ -static void android_glDrawElementsIndirect(JNIEnv *_env, jobject, jint mode, jint type, jlong indirect) { - // In OpenGL ES, 'indirect' is a byte offset into a buffer, not a raw pointer. - // GL checks for too-large values. Here we only need to check for successful signed 64-bit - // to unsigned 32-bit conversion. - if (sizeof(void*) != sizeof(jlong) && indirect > static_cast(UINT32_MAX)) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "indirect offset too large"); - return; - } - glDrawElementsIndirect(mode, type, (const void*)indirect); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function glDrawElementsIndirect ( GLenum mode, GLenum type, const void *indirect ); - - public static native void glDrawElementsIndirect(int mode, int type, long indirect); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsIndirect.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glDrawElementsIndirect", "(IIJ)V", (void *) android_glDrawElementsIndirect }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,38 +0,0 @@ -/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */ -static void -android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I - (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jobject indices_buf, jint instanceCount) { - jarray _array = (jarray) 0; - jint _bufferOffset = (jint) 0; - jint _remaining; - GLvoid *indices = (GLvoid *) 0; - - indices = (GLvoid *)getPointer(_env, indices_buf, &_array, &_remaining, &_bufferOffset); - if (indices == NULL) { - char * _indicesBase = (char *)_env->GetPrimitiveArrayCritical(_array, (jboolean *) 0); - indices = (GLvoid *) (_indicesBase + _bufferOffset); - } - glDrawElementsInstanced( - (GLenum)mode, - (GLsizei)count, - (GLenum)type, - (GLvoid *)indices, - (GLsizei)instanceCount - ); - if (_array) { - releasePointer(_env, _array, indices, JNI_FALSE); - } -} - -/* void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) */ -static void -android_glDrawElementsInstanced__IIIII - (JNIEnv *_env, jobject _this, jint mode, jint count, jint type, jint indicesOffset, jint instanceCount) { - glDrawElementsInstanced( - (GLenum)mode, - (GLsizei)count, - (GLenum)type, - (GLvoid *)static_cast(indicesOffset), - (GLsizei)instanceCount - ); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ - // C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) - - public static native void glDrawElementsInstanced( - int mode, - int count, - int type, - java.nio.Buffer indices, - int instanceCount - ); - - // C function void glDrawElementsInstanced ( GLenum mode, GLsizei count, GLenum type, const GLvoid *indices, GLsizei instanceCount ) - - public static native void glDrawElementsInstanced( - int mode, - int count, - int type, - int indicesOffset, - int instanceCount - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glDrawElementsInstanced.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"glDrawElementsInstanced", "(IIILjava/nio/Buffer;I)V", (void *) android_glDrawElementsInstanced__IIILjava_nio_Buffer_2I }, -{"glDrawElementsInstanced", "(IIIII)V", (void *) android_glDrawElementsInstanced__IIIII }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10cHeader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -17,10 +16,119 @@ // This source file is automatically generated -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" +#include "jni.h" +#include "JNIHelp.h" +#include +#include +#include #include #include +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glColorPointerBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glNormalPointerBounds(GLenum type, GLsizei stride, + const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glTexCoordPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +GL_API void GL_APIENTRY glVertexPointerBounds(GLint size, GLenum type, + GLsizei stride, const GLvoid *pointer, GLsizei count); +} + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); + } + return (void*) buf; +} + +static int +getNumCompressedTextureFormats() { + int numCompressedTextureFormats = 0; + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); + return numCompressedTextureFormats; +} + +// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10ExtcHeader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -17,10 +16,87 @@ // This source file is automatically generated -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" +#include "jni.h" +#include "JNIHelp.h" +#include +#include +#include #include #include +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10ExtHeader.java-if 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -22,6 +21,6 @@ public class GLES10Ext { native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES10Header.java-if 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -262,7 +261,7 @@ native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } private static Buffer _colorPointer; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11cHeader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -17,10 +16,108 @@ // This source file is automatically generated -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" +#include "jni.h" +#include "JNIHelp.h" +#include +#include +#include #include #include +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glPointSizePointerOESBounds(GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +} + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); + } + return (void*) buf; +} + +// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11ExtcHeader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -17,10 +16,109 @@ // This source file is automatically generated -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" +#include "jni.h" +#include "JNIHelp.h" +#include +#include +#include #include #include +/* special calls implemented in Android's GLES wrapper used to more + * efficiently bound-check passed arrays */ +extern "C" { +GL_API void GL_APIENTRY glMatrixIndexPointerOESBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +GL_API void GL_APIENTRY glWeightPointerOESBounds(GLint size, GLenum type, GLsizei stride, + const GLvoid *ptr, GLsizei count); +} + +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); + } + return (void*) buf; +} +// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11ExtHeader.java-if 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -132,7 +131,7 @@ native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } private static final int GL_BYTE = GLES10.GL_BYTE; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES11Header.java-if 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -147,7 +146,7 @@ native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } private static Buffer _pointSizePointerOES; diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES20cHeader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -17,10 +16,113 @@ // This source file is automatically generated -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" +#include "jni.h" +#include "JNIHelp.h" +#include +#include +#include #include #include +static int initialized = 0; + +static jclass nioAccessClass; +static jclass bufferClass; +static jmethodID getBasePointerID; +static jmethodID getBaseArrayID; +static jmethodID getBaseArrayOffsetID; +static jfieldID positionID; +static jfieldID limitID; +static jfieldID elementSizeShiftID; + +/* Cache method IDs each time the class is loaded. */ + +static void +nativeClassInit(JNIEnv *_env, jclass glImplClass) +{ + jclass nioAccessClassLocal = _env->FindClass("java/nio/NIOAccess"); + nioAccessClass = (jclass) _env->NewGlobalRef(nioAccessClassLocal); + + jclass bufferClassLocal = _env->FindClass("java/nio/Buffer"); + bufferClass = (jclass) _env->NewGlobalRef(bufferClassLocal); + + getBasePointerID = _env->GetStaticMethodID(nioAccessClass, + "getBasePointer", "(Ljava/nio/Buffer;)J"); + getBaseArrayID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArray", "(Ljava/nio/Buffer;)Ljava/lang/Object;"); + getBaseArrayOffsetID = _env->GetStaticMethodID(nioAccessClass, + "getBaseArrayOffset", "(Ljava/nio/Buffer;)I"); + + positionID = _env->GetFieldID(bufferClass, "position", "I"); + limitID = _env->GetFieldID(bufferClass, "limit", "I"); + elementSizeShiftID = + _env->GetFieldID(bufferClass, "_elementSizeShift", "I"); +} + + +static void * +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) +{ + jint position; + jint limit; + jint elementSizeShift; + jlong pointer; + jint offset; + void *data; + + position = _env->GetIntField(buffer, positionID); + limit = _env->GetIntField(buffer, limitID); + elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + *remaining = (limit - position) << elementSizeShift; + pointer = _env->CallStaticLongMethod(nioAccessClass, + getBasePointerID, buffer); + if (pointer != 0L) { + *array = NULL; + return (void *) (jint) pointer; + } + + *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, + getBaseArrayID, buffer); + offset = _env->CallStaticIntMethod(nioAccessClass, + getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); + + return (void *) ((char *) data + offset); +} + + +static void +releasePointer(JNIEnv *_env, jarray array, void *data, jboolean commit) +{ + _env->ReleasePrimitiveArrayCritical(array, data, + commit ? 0 : JNI_ABORT); +} + +static void * +getDirectBufferPointer(JNIEnv *_env, jobject buffer) { + char* buf = (char*) _env->GetDirectBufferAddress(buffer); + if (buf) { + jint position = _env->GetIntField(buffer, positionID); + jint elementSizeShift = _env->GetIntField(buffer, elementSizeShiftID); + buf += position << elementSizeShift; + } else { + jniThrowException(_env, "java/lang/IllegalArgumentException", + "Must use a native order direct Buffer"); + } + return (void*) buf; +} + +static int +getNumCompressedTextureFormats() { + int numCompressedTextureFormats = 0; + glGetIntegerv(GL_NUM_COMPRESSED_TEXTURE_FORMATS, &numCompressedTextureFormats); + return numCompressedTextureFormats; +} + +static void glVertexAttribPointerBounds(GLuint indx, GLint size, GLenum type, + GLboolean normalized, GLsizei stride, const GLvoid *pointer, GLsizei count) { + glVertexAttribPointer(indx, size, type, normalized, stride, pointer); +} + +// -------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES20Header.java-if 2012-10-16 22:57:11.000000000 +0000 @@ -1,4 +1,3 @@ -/* ** ** Copyright 2009, The Android Open Source Project ** @@ -296,10 +295,6 @@ public static final int GL_RGB5_A1 = 0x8057; public static final int GL_RGB565 = 0x8D62; public static final int GL_DEPTH_COMPONENT16 = 0x81A5; - // GL_STENCIL_INDEX does not appear in gl2.h or gl2ext.h, and there is no - // token with value 0x1901. - // - @Deprecated public static final int GL_STENCIL_INDEX = 0x1901; public static final int GL_STENCIL_INDEX8 = 0x8D48; public static final int GL_RENDERBUFFER_WIDTH = 0x8D42; @@ -331,5 +326,5 @@ native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES30cHeader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -/* -** -** Copyright 2013, 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. -*/ - -// This source file is automatically generated - -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" - -#include -#include - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES30Header.java-if 1970-01-01 00:00:00.000000000 +0000 @@ -1,337 +0,0 @@ -/* -** -** Copyright 2013, 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. -*/ - -// This source file is automatically generated - -package android.opengl; - -/** OpenGL ES 3.0 - */ -public class GLES30 extends GLES20 { - public static final int GL_READ_BUFFER = 0x0C02; - public static final int GL_UNPACK_ROW_LENGTH = 0x0CF2; - public static final int GL_UNPACK_SKIP_ROWS = 0x0CF3; - public static final int GL_UNPACK_SKIP_PIXELS = 0x0CF4; - public static final int GL_PACK_ROW_LENGTH = 0x0D02; - public static final int GL_PACK_SKIP_ROWS = 0x0D03; - public static final int GL_PACK_SKIP_PIXELS = 0x0D04; - public static final int GL_COLOR = 0x1800; - public static final int GL_DEPTH = 0x1801; - public static final int GL_STENCIL = 0x1802; - public static final int GL_RED = 0x1903; - public static final int GL_RGB8 = 0x8051; - public static final int GL_RGBA8 = 0x8058; - public static final int GL_RGB10_A2 = 0x8059; - public static final int GL_TEXTURE_BINDING_3D = 0x806A; - public static final int GL_UNPACK_SKIP_IMAGES = 0x806D; - public static final int GL_UNPACK_IMAGE_HEIGHT = 0x806E; - public static final int GL_TEXTURE_3D = 0x806F; - public static final int GL_TEXTURE_WRAP_R = 0x8072; - public static final int GL_MAX_3D_TEXTURE_SIZE = 0x8073; - public static final int GL_UNSIGNED_INT_2_10_10_10_REV = 0x8368; - public static final int GL_MAX_ELEMENTS_VERTICES = 0x80E8; - public static final int GL_MAX_ELEMENTS_INDICES = 0x80E9; - public static final int GL_TEXTURE_MIN_LOD = 0x813A; - public static final int GL_TEXTURE_MAX_LOD = 0x813B; - public static final int GL_TEXTURE_BASE_LEVEL = 0x813C; - public static final int GL_TEXTURE_MAX_LEVEL = 0x813D; - public static final int GL_MIN = 0x8007; - public static final int GL_MAX = 0x8008; - public static final int GL_DEPTH_COMPONENT24 = 0x81A6; - public static final int GL_MAX_TEXTURE_LOD_BIAS = 0x84FD; - public static final int GL_TEXTURE_COMPARE_MODE = 0x884C; - public static final int GL_TEXTURE_COMPARE_FUNC = 0x884D; - public static final int GL_CURRENT_QUERY = 0x8865; - public static final int GL_QUERY_RESULT = 0x8866; - public static final int GL_QUERY_RESULT_AVAILABLE = 0x8867; - public static final int GL_BUFFER_MAPPED = 0x88BC; - public static final int GL_BUFFER_MAP_POINTER = 0x88BD; - public static final int GL_STREAM_READ = 0x88E1; - public static final int GL_STREAM_COPY = 0x88E2; - public static final int GL_STATIC_READ = 0x88E5; - public static final int GL_STATIC_COPY = 0x88E6; - public static final int GL_DYNAMIC_READ = 0x88E9; - public static final int GL_DYNAMIC_COPY = 0x88EA; - public static final int GL_MAX_DRAW_BUFFERS = 0x8824; - public static final int GL_DRAW_BUFFER0 = 0x8825; - public static final int GL_DRAW_BUFFER1 = 0x8826; - public static final int GL_DRAW_BUFFER2 = 0x8827; - public static final int GL_DRAW_BUFFER3 = 0x8828; - public static final int GL_DRAW_BUFFER4 = 0x8829; - public static final int GL_DRAW_BUFFER5 = 0x882A; - public static final int GL_DRAW_BUFFER6 = 0x882B; - public static final int GL_DRAW_BUFFER7 = 0x882C; - public static final int GL_DRAW_BUFFER8 = 0x882D; - public static final int GL_DRAW_BUFFER9 = 0x882E; - public static final int GL_DRAW_BUFFER10 = 0x882F; - public static final int GL_DRAW_BUFFER11 = 0x8830; - public static final int GL_DRAW_BUFFER12 = 0x8831; - public static final int GL_DRAW_BUFFER13 = 0x8832; - public static final int GL_DRAW_BUFFER14 = 0x8833; - public static final int GL_DRAW_BUFFER15 = 0x8834; - public static final int GL_MAX_FRAGMENT_UNIFORM_COMPONENTS = 0x8B49; - public static final int GL_MAX_VERTEX_UNIFORM_COMPONENTS = 0x8B4A; - public static final int GL_SAMPLER_3D = 0x8B5F; - public static final int GL_SAMPLER_2D_SHADOW = 0x8B62; - public static final int GL_FRAGMENT_SHADER_DERIVATIVE_HINT = 0x8B8B; - public static final int GL_PIXEL_PACK_BUFFER = 0x88EB; - public static final int GL_PIXEL_UNPACK_BUFFER = 0x88EC; - public static final int GL_PIXEL_PACK_BUFFER_BINDING = 0x88ED; - public static final int GL_PIXEL_UNPACK_BUFFER_BINDING = 0x88EF; - public static final int GL_FLOAT_MAT2x3 = 0x8B65; - public static final int GL_FLOAT_MAT2x4 = 0x8B66; - public static final int GL_FLOAT_MAT3x2 = 0x8B67; - public static final int GL_FLOAT_MAT3x4 = 0x8B68; - public static final int GL_FLOAT_MAT4x2 = 0x8B69; - public static final int GL_FLOAT_MAT4x3 = 0x8B6A; - public static final int GL_SRGB = 0x8C40; - public static final int GL_SRGB8 = 0x8C41; - public static final int GL_SRGB8_ALPHA8 = 0x8C43; - public static final int GL_COMPARE_REF_TO_TEXTURE = 0x884E; - public static final int GL_MAJOR_VERSION = 0x821B; - public static final int GL_MINOR_VERSION = 0x821C; - public static final int GL_NUM_EXTENSIONS = 0x821D; - public static final int GL_RGBA32F = 0x8814; - public static final int GL_RGB32F = 0x8815; - public static final int GL_RGBA16F = 0x881A; - public static final int GL_RGB16F = 0x881B; - public static final int GL_VERTEX_ATTRIB_ARRAY_INTEGER = 0x88FD; - public static final int GL_MAX_ARRAY_TEXTURE_LAYERS = 0x88FF; - public static final int GL_MIN_PROGRAM_TEXEL_OFFSET = 0x8904; - public static final int GL_MAX_PROGRAM_TEXEL_OFFSET = 0x8905; - public static final int GL_MAX_VARYING_COMPONENTS = 0x8B4B; - public static final int GL_TEXTURE_2D_ARRAY = 0x8C1A; - public static final int GL_TEXTURE_BINDING_2D_ARRAY = 0x8C1D; - public static final int GL_R11F_G11F_B10F = 0x8C3A; - public static final int GL_UNSIGNED_INT_10F_11F_11F_REV = 0x8C3B; - public static final int GL_RGB9_E5 = 0x8C3D; - public static final int GL_UNSIGNED_INT_5_9_9_9_REV = 0x8C3E; - public static final int GL_TRANSFORM_FEEDBACK_VARYING_MAX_LENGTH = 0x8C76; - public static final int GL_TRANSFORM_FEEDBACK_BUFFER_MODE = 0x8C7F; - public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_COMPONENTS = 0x8C80; - public static final int GL_TRANSFORM_FEEDBACK_VARYINGS = 0x8C83; - public static final int GL_TRANSFORM_FEEDBACK_BUFFER_START = 0x8C84; - public static final int GL_TRANSFORM_FEEDBACK_BUFFER_SIZE = 0x8C85; - public static final int GL_TRANSFORM_FEEDBACK_PRIMITIVES_WRITTEN = 0x8C88; - public static final int GL_RASTERIZER_DISCARD = 0x8C89; - public static final int GL_MAX_TRANSFORM_FEEDBACK_INTERLEAVED_COMPONENTS = 0x8C8A; - public static final int GL_MAX_TRANSFORM_FEEDBACK_SEPARATE_ATTRIBS = 0x8C8B; - public static final int GL_INTERLEAVED_ATTRIBS = 0x8C8C; - public static final int GL_SEPARATE_ATTRIBS = 0x8C8D; - public static final int GL_TRANSFORM_FEEDBACK_BUFFER = 0x8C8E; - public static final int GL_TRANSFORM_FEEDBACK_BUFFER_BINDING = 0x8C8F; - public static final int GL_RGBA32UI = 0x8D70; - public static final int GL_RGB32UI = 0x8D71; - public static final int GL_RGBA16UI = 0x8D76; - public static final int GL_RGB16UI = 0x8D77; - public static final int GL_RGBA8UI = 0x8D7C; - public static final int GL_RGB8UI = 0x8D7D; - public static final int GL_RGBA32I = 0x8D82; - public static final int GL_RGB32I = 0x8D83; - public static final int GL_RGBA16I = 0x8D88; - public static final int GL_RGB16I = 0x8D89; - public static final int GL_RGBA8I = 0x8D8E; - public static final int GL_RGB8I = 0x8D8F; - public static final int GL_RED_INTEGER = 0x8D94; - public static final int GL_RGB_INTEGER = 0x8D98; - public static final int GL_RGBA_INTEGER = 0x8D99; - public static final int GL_SAMPLER_2D_ARRAY = 0x8DC1; - public static final int GL_SAMPLER_2D_ARRAY_SHADOW = 0x8DC4; - public static final int GL_SAMPLER_CUBE_SHADOW = 0x8DC5; - public static final int GL_UNSIGNED_INT_VEC2 = 0x8DC6; - public static final int GL_UNSIGNED_INT_VEC3 = 0x8DC7; - public static final int GL_UNSIGNED_INT_VEC4 = 0x8DC8; - public static final int GL_INT_SAMPLER_2D = 0x8DCA; - public static final int GL_INT_SAMPLER_3D = 0x8DCB; - public static final int GL_INT_SAMPLER_CUBE = 0x8DCC; - public static final int GL_INT_SAMPLER_2D_ARRAY = 0x8DCF; - public static final int GL_UNSIGNED_INT_SAMPLER_2D = 0x8DD2; - public static final int GL_UNSIGNED_INT_SAMPLER_3D = 0x8DD3; - public static final int GL_UNSIGNED_INT_SAMPLER_CUBE = 0x8DD4; - public static final int GL_UNSIGNED_INT_SAMPLER_2D_ARRAY = 0x8DD7; - public static final int GL_BUFFER_ACCESS_FLAGS = 0x911F; - public static final int GL_BUFFER_MAP_LENGTH = 0x9120; - public static final int GL_BUFFER_MAP_OFFSET = 0x9121; - public static final int GL_DEPTH_COMPONENT32F = 0x8CAC; - public static final int GL_DEPTH32F_STENCIL8 = 0x8CAD; - public static final int GL_FLOAT_32_UNSIGNED_INT_24_8_REV = 0x8DAD; - public static final int GL_FRAMEBUFFER_ATTACHMENT_COLOR_ENCODING = 0x8210; - public static final int GL_FRAMEBUFFER_ATTACHMENT_COMPONENT_TYPE = 0x8211; - public static final int GL_FRAMEBUFFER_ATTACHMENT_RED_SIZE = 0x8212; - public static final int GL_FRAMEBUFFER_ATTACHMENT_GREEN_SIZE = 0x8213; - public static final int GL_FRAMEBUFFER_ATTACHMENT_BLUE_SIZE = 0x8214; - public static final int GL_FRAMEBUFFER_ATTACHMENT_ALPHA_SIZE = 0x8215; - public static final int GL_FRAMEBUFFER_ATTACHMENT_DEPTH_SIZE = 0x8216; - public static final int GL_FRAMEBUFFER_ATTACHMENT_STENCIL_SIZE = 0x8217; - public static final int GL_FRAMEBUFFER_DEFAULT = 0x8218; - public static final int GL_FRAMEBUFFER_UNDEFINED = 0x8219; - public static final int GL_DEPTH_STENCIL_ATTACHMENT = 0x821A; - public static final int GL_DEPTH_STENCIL = 0x84F9; - public static final int GL_UNSIGNED_INT_24_8 = 0x84FA; - public static final int GL_DEPTH24_STENCIL8 = 0x88F0; - public static final int GL_UNSIGNED_NORMALIZED = 0x8C17; - public static final int GL_DRAW_FRAMEBUFFER_BINDING = GL_FRAMEBUFFER_BINDING; - public static final int GL_READ_FRAMEBUFFER = 0x8CA8; - public static final int GL_DRAW_FRAMEBUFFER = 0x8CA9; - public static final int GL_READ_FRAMEBUFFER_BINDING = 0x8CAA; - public static final int GL_RENDERBUFFER_SAMPLES = 0x8CAB; - public static final int GL_FRAMEBUFFER_ATTACHMENT_TEXTURE_LAYER = 0x8CD4; - public static final int GL_MAX_COLOR_ATTACHMENTS = 0x8CDF; - public static final int GL_COLOR_ATTACHMENT1 = 0x8CE1; - public static final int GL_COLOR_ATTACHMENT2 = 0x8CE2; - public static final int GL_COLOR_ATTACHMENT3 = 0x8CE3; - public static final int GL_COLOR_ATTACHMENT4 = 0x8CE4; - public static final int GL_COLOR_ATTACHMENT5 = 0x8CE5; - public static final int GL_COLOR_ATTACHMENT6 = 0x8CE6; - public static final int GL_COLOR_ATTACHMENT7 = 0x8CE7; - public static final int GL_COLOR_ATTACHMENT8 = 0x8CE8; - public static final int GL_COLOR_ATTACHMENT9 = 0x8CE9; - public static final int GL_COLOR_ATTACHMENT10 = 0x8CEA; - public static final int GL_COLOR_ATTACHMENT11 = 0x8CEB; - public static final int GL_COLOR_ATTACHMENT12 = 0x8CEC; - public static final int GL_COLOR_ATTACHMENT13 = 0x8CED; - public static final int GL_COLOR_ATTACHMENT14 = 0x8CEE; - public static final int GL_COLOR_ATTACHMENT15 = 0x8CEF; - public static final int GL_FRAMEBUFFER_INCOMPLETE_MULTISAMPLE = 0x8D56; - public static final int GL_MAX_SAMPLES = 0x8D57; - public static final int GL_HALF_FLOAT = 0x140B; - public static final int GL_MAP_READ_BIT = 0x0001; - public static final int GL_MAP_WRITE_BIT = 0x0002; - public static final int GL_MAP_INVALIDATE_RANGE_BIT = 0x0004; - public static final int GL_MAP_INVALIDATE_BUFFER_BIT = 0x0008; - public static final int GL_MAP_FLUSH_EXPLICIT_BIT = 0x0010; - public static final int GL_MAP_UNSYNCHRONIZED_BIT = 0x0020; - public static final int GL_RG = 0x8227; - public static final int GL_RG_INTEGER = 0x8228; - public static final int GL_R8 = 0x8229; - public static final int GL_RG8 = 0x822B; - public static final int GL_R16F = 0x822D; - public static final int GL_R32F = 0x822E; - public static final int GL_RG16F = 0x822F; - public static final int GL_RG32F = 0x8230; - public static final int GL_R8I = 0x8231; - public static final int GL_R8UI = 0x8232; - public static final int GL_R16I = 0x8233; - public static final int GL_R16UI = 0x8234; - public static final int GL_R32I = 0x8235; - public static final int GL_R32UI = 0x8236; - public static final int GL_RG8I = 0x8237; - public static final int GL_RG8UI = 0x8238; - public static final int GL_RG16I = 0x8239; - public static final int GL_RG16UI = 0x823A; - public static final int GL_RG32I = 0x823B; - public static final int GL_RG32UI = 0x823C; - public static final int GL_VERTEX_ARRAY_BINDING = 0x85B5; - public static final int GL_R8_SNORM = 0x8F94; - public static final int GL_RG8_SNORM = 0x8F95; - public static final int GL_RGB8_SNORM = 0x8F96; - public static final int GL_RGBA8_SNORM = 0x8F97; - public static final int GL_SIGNED_NORMALIZED = 0x8F9C; - public static final int GL_PRIMITIVE_RESTART_FIXED_INDEX = 0x8D69; - public static final int GL_COPY_READ_BUFFER = 0x8F36; - public static final int GL_COPY_WRITE_BUFFER = 0x8F37; - public static final int GL_COPY_READ_BUFFER_BINDING = GL_COPY_READ_BUFFER; - public static final int GL_COPY_WRITE_BUFFER_BINDING = GL_COPY_WRITE_BUFFER; - public static final int GL_UNIFORM_BUFFER = 0x8A11; - public static final int GL_UNIFORM_BUFFER_BINDING = 0x8A28; - public static final int GL_UNIFORM_BUFFER_START = 0x8A29; - public static final int GL_UNIFORM_BUFFER_SIZE = 0x8A2A; - public static final int GL_MAX_VERTEX_UNIFORM_BLOCKS = 0x8A2B; - public static final int GL_MAX_FRAGMENT_UNIFORM_BLOCKS = 0x8A2D; - public static final int GL_MAX_COMBINED_UNIFORM_BLOCKS = 0x8A2E; - public static final int GL_MAX_UNIFORM_BUFFER_BINDINGS = 0x8A2F; - public static final int GL_MAX_UNIFORM_BLOCK_SIZE = 0x8A30; - public static final int GL_MAX_COMBINED_VERTEX_UNIFORM_COMPONENTS = 0x8A31; - public static final int GL_MAX_COMBINED_FRAGMENT_UNIFORM_COMPONENTS = 0x8A33; - public static final int GL_UNIFORM_BUFFER_OFFSET_ALIGNMENT = 0x8A34; - public static final int GL_ACTIVE_UNIFORM_BLOCK_MAX_NAME_LENGTH = 0x8A35; - public static final int GL_ACTIVE_UNIFORM_BLOCKS = 0x8A36; - public static final int GL_UNIFORM_TYPE = 0x8A37; - public static final int GL_UNIFORM_SIZE = 0x8A38; - public static final int GL_UNIFORM_NAME_LENGTH = 0x8A39; - public static final int GL_UNIFORM_BLOCK_INDEX = 0x8A3A; - public static final int GL_UNIFORM_OFFSET = 0x8A3B; - public static final int GL_UNIFORM_ARRAY_STRIDE = 0x8A3C; - public static final int GL_UNIFORM_MATRIX_STRIDE = 0x8A3D; - public static final int GL_UNIFORM_IS_ROW_MAJOR = 0x8A3E; - public static final int GL_UNIFORM_BLOCK_BINDING = 0x8A3F; - public static final int GL_UNIFORM_BLOCK_DATA_SIZE = 0x8A40; - public static final int GL_UNIFORM_BLOCK_NAME_LENGTH = 0x8A41; - public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORMS = 0x8A42; - public static final int GL_UNIFORM_BLOCK_ACTIVE_UNIFORM_INDICES = 0x8A43; - public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_VERTEX_SHADER = 0x8A44; - public static final int GL_UNIFORM_BLOCK_REFERENCED_BY_FRAGMENT_SHADER = 0x8A46; - // GL_INVALID_INDEX is defined as 0xFFFFFFFFu in C. - public static final int GL_INVALID_INDEX = -1; - public static final int GL_MAX_VERTEX_OUTPUT_COMPONENTS = 0x9122; - public static final int GL_MAX_FRAGMENT_INPUT_COMPONENTS = 0x9125; - public static final int GL_MAX_SERVER_WAIT_TIMEOUT = 0x9111; - public static final int GL_OBJECT_TYPE = 0x9112; - public static final int GL_SYNC_CONDITION = 0x9113; - public static final int GL_SYNC_STATUS = 0x9114; - public static final int GL_SYNC_FLAGS = 0x9115; - public static final int GL_SYNC_FENCE = 0x9116; - public static final int GL_SYNC_GPU_COMMANDS_COMPLETE = 0x9117; - public static final int GL_UNSIGNALED = 0x9118; - public static final int GL_SIGNALED = 0x9119; - public static final int GL_ALREADY_SIGNALED = 0x911A; - public static final int GL_TIMEOUT_EXPIRED = 0x911B; - public static final int GL_CONDITION_SATISFIED = 0x911C; - public static final int GL_WAIT_FAILED = 0x911D; - public static final int GL_SYNC_FLUSH_COMMANDS_BIT = 0x00000001; - // GL_TIMEOUT_IGNORED is defined as 0xFFFFFFFFFFFFFFFFull in C. - public static final long GL_TIMEOUT_IGNORED = -1; - public static final int GL_VERTEX_ATTRIB_ARRAY_DIVISOR = 0x88FE; - public static final int GL_ANY_SAMPLES_PASSED = 0x8C2F; - public static final int GL_ANY_SAMPLES_PASSED_CONSERVATIVE = 0x8D6A; - public static final int GL_SAMPLER_BINDING = 0x8919; - public static final int GL_RGB10_A2UI = 0x906F; - public static final int GL_TEXTURE_SWIZZLE_R = 0x8E42; - public static final int GL_TEXTURE_SWIZZLE_G = 0x8E43; - public static final int GL_TEXTURE_SWIZZLE_B = 0x8E44; - public static final int GL_TEXTURE_SWIZZLE_A = 0x8E45; - public static final int GL_GREEN = 0x1904; - public static final int GL_BLUE = 0x1905; - public static final int GL_INT_2_10_10_10_REV = 0x8D9F; - public static final int GL_TRANSFORM_FEEDBACK = 0x8E22; - public static final int GL_TRANSFORM_FEEDBACK_PAUSED = 0x8E23; - public static final int GL_TRANSFORM_FEEDBACK_ACTIVE = 0x8E24; - public static final int GL_TRANSFORM_FEEDBACK_BINDING = 0x8E25; - public static final int GL_PROGRAM_BINARY_RETRIEVABLE_HINT = 0x8257; - public static final int GL_PROGRAM_BINARY_LENGTH = 0x8741; - public static final int GL_NUM_PROGRAM_BINARY_FORMATS = 0x87FE; - public static final int GL_PROGRAM_BINARY_FORMATS = 0x87FF; - public static final int GL_COMPRESSED_R11_EAC = 0x9270; - public static final int GL_COMPRESSED_SIGNED_R11_EAC = 0x9271; - public static final int GL_COMPRESSED_RG11_EAC = 0x9272; - public static final int GL_COMPRESSED_SIGNED_RG11_EAC = 0x9273; - public static final int GL_COMPRESSED_RGB8_ETC2 = 0x9274; - public static final int GL_COMPRESSED_SRGB8_ETC2 = 0x9275; - public static final int GL_COMPRESSED_RGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9276; - public static final int GL_COMPRESSED_SRGB8_PUNCHTHROUGH_ALPHA1_ETC2 = 0x9277; - public static final int GL_COMPRESSED_RGBA8_ETC2_EAC = 0x9278; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ETC2_EAC = 0x9279; - public static final int GL_TEXTURE_IMMUTABLE_FORMAT = 0x912F; - public static final int GL_MAX_ELEMENT_INDEX = 0x8D6B; - public static final int GL_NUM_SAMPLE_COUNTS = 0x9380; - public static final int GL_TEXTURE_IMMUTABLE_LEVELS = 0x82DF; - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31cHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31cHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31cHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31cHeader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,24 +0,0 @@ -/* - * Copyright 2014 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. - */ - -// This source file is automatically generated - -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" - -#include -#include diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31ExtcHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31ExtcHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31ExtcHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31ExtcHeader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* - * Copyright 2014 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. - */ - -// This source file is automatically generated - -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" - -#include -#include - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31ExtHeader.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31ExtHeader.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31ExtHeader.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31ExtHeader.java-if 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -/* - * Copyright 2014 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. - */ - -// This source file is automatically generated - -package android.opengl; - -public class GLES31Ext { - - // GL_KHR_blend_equation_advanced - public static final int GL_BLEND_ADVANCED_COHERENT_KHR = 0x9285; - public static final int GL_MULTIPLY_KHR = 0x9294; - public static final int GL_SCREEN_KHR = 0x9295; - public static final int GL_OVERLAY_KHR = 0x9296; - public static final int GL_DARKEN_KHR = 0x9297; - public static final int GL_LIGHTEN_KHR = 0x9298; - public static final int GL_COLORDODGE_KHR = 0x9299; - public static final int GL_COLORBURN_KHR = 0x929A; - public static final int GL_HARDLIGHT_KHR = 0x929B; - public static final int GL_SOFTLIGHT_KHR = 0x929C; - public static final int GL_DIFFERENCE_KHR = 0x929E; - public static final int GL_EXCLUSION_KHR = 0x92A0; - public static final int GL_HSL_HUE_KHR = 0x92AD; - public static final int GL_HSL_SATURATION_KHR = 0x92AE; - public static final int GL_HSL_COLOR_KHR = 0x92AF; - public static final int GL_HSL_LUMINOSITY_KHR = 0x92B0; - - // GL_KHR_debug - public static final int GL_DEBUG_OUTPUT_SYNCHRONOUS_KHR = 0x8242; - public static final int GL_DEBUG_NEXT_LOGGED_MESSAGE_LENGTH_KHR = 0x8243; - public static final int GL_DEBUG_CALLBACK_FUNCTION_KHR = 0x8244; - public static final int GL_DEBUG_CALLBACK_USER_PARAM_KHR = 0x8245; - public static final int GL_DEBUG_SOURCE_API_KHR = 0x8246; - public static final int GL_DEBUG_SOURCE_WINDOW_SYSTEM_KHR = 0x8247; - public static final int GL_DEBUG_SOURCE_SHADER_COMPILER_KHR = 0x8248; - public static final int GL_DEBUG_SOURCE_THIRD_PARTY_KHR = 0x8249; - public static final int GL_DEBUG_SOURCE_APPLICATION_KHR = 0x824A; - public static final int GL_DEBUG_SOURCE_OTHER_KHR = 0x824B; - public static final int GL_DEBUG_TYPE_ERROR_KHR = 0x824C; - public static final int GL_DEBUG_TYPE_DEPRECATED_BEHAVIOR_KHR = 0x824D; - public static final int GL_DEBUG_TYPE_UNDEFINED_BEHAVIOR_KHR = 0x824E; - public static final int GL_DEBUG_TYPE_PORTABILITY_KHR = 0x824F; - public static final int GL_DEBUG_TYPE_PERFORMANCE_KHR = 0x8250; - public static final int GL_DEBUG_TYPE_OTHER_KHR = 0x8251; - public static final int GL_DEBUG_TYPE_MARKER_KHR = 0x8268; - public static final int GL_DEBUG_TYPE_PUSH_GROUP_KHR = 0x8269; - public static final int GL_DEBUG_TYPE_POP_GROUP_KHR = 0x826A; - public static final int GL_DEBUG_SEVERITY_NOTIFICATION_KHR = 0x826B; - public static final int GL_MAX_DEBUG_GROUP_STACK_DEPTH_KHR = 0x826C; - public static final int GL_DEBUG_GROUP_STACK_DEPTH_KHR = 0x826D; - public static final int GL_BUFFER_KHR = 0x82E0; - public static final int GL_SHADER_KHR = 0x82E1; - public static final int GL_PROGRAM_KHR = 0x82E2; - public static final int GL_VERTEX_ARRAY_KHR = 0x8074; - public static final int GL_QUERY_KHR = 0x82E3; - public static final int GL_SAMPLER_KHR = 0x82E6; - public static final int GL_MAX_LABEL_LENGTH_KHR = 0x82E8; - public static final int GL_MAX_DEBUG_MESSAGE_LENGTH_KHR = 0x9143; - public static final int GL_MAX_DEBUG_LOGGED_MESSAGES_KHR = 0x9144; - public static final int GL_DEBUG_LOGGED_MESSAGES_KHR = 0x9145; - public static final int GL_DEBUG_SEVERITY_HIGH_KHR = 0x9146; - public static final int GL_DEBUG_SEVERITY_MEDIUM_KHR = 0x9147; - public static final int GL_DEBUG_SEVERITY_LOW_KHR = 0x9148; - public static final int GL_DEBUG_OUTPUT_KHR = 0x92E0; - public static final int GL_CONTEXT_FLAG_DEBUG_BIT_KHR = 0x00000002; - public static final int GL_STACK_OVERFLOW_KHR = 0x0503; - public static final int GL_STACK_UNDERFLOW_KHR = 0x0504; - - // GL_KHR_texture_compression_astc_ldr - public static final int GL_COMPRESSED_RGBA_ASTC_4x4_KHR = 0x93B0; - public static final int GL_COMPRESSED_RGBA_ASTC_5x4_KHR = 0x93B1; - public static final int GL_COMPRESSED_RGBA_ASTC_5x5_KHR = 0x93B2; - public static final int GL_COMPRESSED_RGBA_ASTC_6x5_KHR = 0x93B3; - public static final int GL_COMPRESSED_RGBA_ASTC_6x6_KHR = 0x93B4; - public static final int GL_COMPRESSED_RGBA_ASTC_8x5_KHR = 0x93B5; - public static final int GL_COMPRESSED_RGBA_ASTC_8x6_KHR = 0x93B6; - public static final int GL_COMPRESSED_RGBA_ASTC_8x8_KHR = 0x93B7; - public static final int GL_COMPRESSED_RGBA_ASTC_10x5_KHR = 0x93B8; - public static final int GL_COMPRESSED_RGBA_ASTC_10x6_KHR = 0x93B9; - public static final int GL_COMPRESSED_RGBA_ASTC_10x8_KHR = 0x93BA; - public static final int GL_COMPRESSED_RGBA_ASTC_10x10_KHR = 0x93BB; - public static final int GL_COMPRESSED_RGBA_ASTC_12x10_KHR = 0x93BC; - public static final int GL_COMPRESSED_RGBA_ASTC_12x12_KHR = 0x93BD; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_4x4_KHR = 0x93D0; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x4_KHR = 0x93D1; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_5x5_KHR = 0x93D2; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x5_KHR = 0x93D3; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_6x6_KHR = 0x93D4; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x5_KHR = 0x93D5; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x6_KHR = 0x93D6; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_8x8_KHR = 0x93D7; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x5_KHR = 0x93D8; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x6_KHR = 0x93D9; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x8_KHR = 0x93DA; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_10x10_KHR = 0x93DB; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x10_KHR = 0x93DC; - public static final int GL_COMPRESSED_SRGB8_ALPHA8_ASTC_12x12_KHR = 0x93DD; - - // GL_OES_sample_shading - public static final int GL_SAMPLE_SHADING_OES = 0x8C36; - public static final int GL_MIN_SAMPLE_SHADING_VALUE_OES = 0x8C37; - - // GL_OES_shader_multisample_interpolation - public static final int GL_MIN_FRAGMENT_INTERPOLATION_OFFSET_OES = 0x8E5B; - public static final int GL_MAX_FRAGMENT_INTERPOLATION_OFFSET_OES = 0x8E5C; - public static final int GL_FRAGMENT_INTERPOLATION_OFFSET_BITS_OES = 0x8E5D; - - // GL_OES_texture_stencil8 - public static final int GL_STENCIL_INDEX_OES = 0x1901; - public static final int GL_STENCIL_INDEX8_OES = 0x8D48; - - // GL_OES_texture_storage_multisample_2d_array - public static final int GL_TEXTURE_2D_MULTISAMPLE_ARRAY_OES = 0x9102; - public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE_ARRAY_OES = 0x9105; - public static final int GL_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 0x910B; - public static final int GL_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 0x910C; - public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE_ARRAY_OES = 0x910D; - - // GL_EXT_geometry_shader - public static final int GL_GEOMETRY_SHADER_EXT = 0x8DD9; - public static final int GL_GEOMETRY_SHADER_BIT_EXT = 0x00000004; - public static final int GL_GEOMETRY_LINKED_VERTICES_OUT_EXT = 0x8916; - public static final int GL_GEOMETRY_LINKED_INPUT_TYPE_EXT = 0x8917; - public static final int GL_GEOMETRY_LINKED_OUTPUT_TYPE_EXT = 0x8918; - public static final int GL_GEOMETRY_SHADER_INVOCATIONS_EXT = 0x887F; - public static final int GL_LAYER_PROVOKING_VERTEX_EXT = 0x825E; - public static final int GL_LINES_ADJACENCY_EXT = 0x000A; - public static final int GL_LINE_STRIP_ADJACENCY_EXT = 0x000B; - public static final int GL_TRIANGLES_ADJACENCY_EXT = 0x000C; - public static final int GL_TRIANGLE_STRIP_ADJACENCY_EXT = 0x000D; - public static final int GL_MAX_GEOMETRY_UNIFORM_COMPONENTS_EXT = 0x8DDF; - public static final int GL_MAX_GEOMETRY_UNIFORM_BLOCKS_EXT = 0x8A2C; - public static final int GL_MAX_COMBINED_GEOMETRY_UNIFORM_COMPONENTS_EXT = 0x8A32; - public static final int GL_MAX_GEOMETRY_INPUT_COMPONENTS_EXT = 0x9123; - public static final int GL_MAX_GEOMETRY_OUTPUT_COMPONENTS_EXT = 0x9124; - public static final int GL_MAX_GEOMETRY_OUTPUT_VERTICES_EXT = 0x8DE0; - public static final int GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS_EXT = 0x8DE1; - public static final int GL_MAX_GEOMETRY_SHADER_INVOCATIONS_EXT = 0x8E5A; - public static final int GL_MAX_GEOMETRY_TEXTURE_IMAGE_UNITS_EXT = 0x8C29; - public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTER_BUFFERS_EXT = 0x92CF; - public static final int GL_MAX_GEOMETRY_ATOMIC_COUNTERS_EXT = 0x92D5; - public static final int GL_MAX_GEOMETRY_IMAGE_UNIFORMS_EXT = 0x90CD; - public static final int GL_MAX_GEOMETRY_SHADER_STORAGE_BLOCKS_EXT = 0x90D7; - public static final int GL_FIRST_VERTEX_CONVENTION_EXT = 0x8E4D; - public static final int GL_LAST_VERTEX_CONVENTION_EXT = 0x8E4E; - public static final int GL_UNDEFINED_VERTEX_EXT = 0x8260; - public static final int GL_PRIMITIVES_GENERATED_EXT = 0x8C87; - public static final int GL_FRAMEBUFFER_DEFAULT_LAYERS_EXT = 0x9312; - public static final int GL_MAX_FRAMEBUFFER_LAYERS_EXT = 0x9317; - public static final int GL_FRAMEBUFFER_INCOMPLETE_LAYER_TARGETS_EXT = 0x8DA8; - public static final int GL_FRAMEBUFFER_ATTACHMENT_LAYERED_EXT = 0x8DA7; - public static final int GL_REFERENCED_BY_GEOMETRY_SHADER_EXT = 0x9309; - - // GL_EXT_primitive_bounding_box - public static final int GL_PRIMITIVE_BOUNDING_BOX_EXT = 0x92BE; - - // GL_EXT_tessellation_shader - public static final int GL_PATCHES_EXT = 0x000E; - public static final int GL_PATCH_VERTICES_EXT = 0x8E72; - public static final int GL_TESS_CONTROL_OUTPUT_VERTICES_EXT = 0x8E75; - public static final int GL_TESS_GEN_MODE_EXT = 0x8E76; - public static final int GL_TESS_GEN_SPACING_EXT = 0x8E77; - public static final int GL_TESS_GEN_VERTEX_ORDER_EXT = 0x8E78; - public static final int GL_TESS_GEN_POINT_MODE_EXT = 0x8E79; - public static final int GL_ISOLINES_EXT = 0x8E7A; - public static final int GL_QUADS_EXT = 0x0007; - public static final int GL_FRACTIONAL_ODD_EXT = 0x8E7B; - public static final int GL_FRACTIONAL_EVEN_EXT = 0x8E7C; - public static final int GL_MAX_PATCH_VERTICES_EXT = 0x8E7D; - public static final int GL_MAX_TESS_GEN_LEVEL_EXT = 0x8E7E; - public static final int GL_MAX_TESS_CONTROL_UNIFORM_COMPONENTS_EXT = 0x8E7F; - public static final int GL_MAX_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT = 0x8E80; - public static final int GL_MAX_TESS_CONTROL_TEXTURE_IMAGE_UNITS_EXT = 0x8E81; - public static final int GL_MAX_TESS_EVALUATION_TEXTURE_IMAGE_UNITS_EXT = 0x8E82; - public static final int GL_MAX_TESS_CONTROL_OUTPUT_COMPONENTS_EXT = 0x8E83; - public static final int GL_MAX_TESS_PATCH_COMPONENTS_EXT = 0x8E84; - public static final int GL_MAX_TESS_CONTROL_TOTAL_OUTPUT_COMPONENTS_EXT = 0x8E85; - public static final int GL_MAX_TESS_EVALUATION_OUTPUT_COMPONENTS_EXT = 0x8E86; - public static final int GL_MAX_TESS_CONTROL_UNIFORM_BLOCKS_EXT = 0x8E89; - public static final int GL_MAX_TESS_EVALUATION_UNIFORM_BLOCKS_EXT = 0x8E8A; - public static final int GL_MAX_TESS_CONTROL_INPUT_COMPONENTS_EXT = 0x886C; - public static final int GL_MAX_TESS_EVALUATION_INPUT_COMPONENTS_EXT = 0x886D; - public static final int GL_MAX_COMBINED_TESS_CONTROL_UNIFORM_COMPONENTS_EXT = 0x8E1E; - public static final int GL_MAX_COMBINED_TESS_EVALUATION_UNIFORM_COMPONENTS_EXT = 0x8E1F; - public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTER_BUFFERS_EXT = 0x92CD; - public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTER_BUFFERS_EXT = 0x92CE; - public static final int GL_MAX_TESS_CONTROL_ATOMIC_COUNTERS_EXT = 0x92D3; - public static final int GL_MAX_TESS_EVALUATION_ATOMIC_COUNTERS_EXT = 0x92D4; - public static final int GL_MAX_TESS_CONTROL_IMAGE_UNIFORMS_EXT = 0x90CB; - public static final int GL_MAX_TESS_EVALUATION_IMAGE_UNIFORMS_EXT = 0x90CC; - public static final int GL_MAX_TESS_CONTROL_SHADER_STORAGE_BLOCKS_EXT = 0x90D8; - public static final int GL_MAX_TESS_EVALUATION_SHADER_STORAGE_BLOCKS_EXT = 0x90D9; - public static final int GL_PRIMITIVE_RESTART_FOR_PATCHES_SUPPORTED = 0x8221; - public static final int GL_IS_PER_PATCH_EXT = 0x92E7; - public static final int GL_REFERENCED_BY_TESS_CONTROL_SHADER_EXT = 0x9307; - public static final int GL_REFERENCED_BY_TESS_EVALUATION_SHADER_EXT = 0x9308; - public static final int GL_TESS_CONTROL_SHADER_EXT = 0x8E88; - public static final int GL_TESS_EVALUATION_SHADER_EXT = 0x8E87; - public static final int GL_TESS_CONTROL_SHADER_BIT_EXT = 0x00000008; - public static final int GL_TESS_EVALUATION_SHADER_BIT_EXT = 0x00000010; - - // GL_EXT_texture_border_clamp - public static final int GL_TEXTURE_BORDER_COLOR_EXT = 0x1004; - public static final int GL_CLAMP_TO_BORDER_EXT = 0x812D; - - // GL_EXT_texture_buffer - public static final int GL_TEXTURE_BUFFER_EXT = 0x8C2A; - public static final int GL_TEXTURE_BUFFER_BINDING_EXT = 0x8C2A; - public static final int GL_MAX_TEXTURE_BUFFER_SIZE_EXT = 0x8C2B; - public static final int GL_TEXTURE_BINDING_BUFFER_EXT = 0x8C2C; - public static final int GL_TEXTURE_BUFFER_DATA_STORE_BINDING_EXT = 0x8C2D; - public static final int GL_TEXTURE_BUFFER_OFFSET_ALIGNMENT_EXT = 0x919F; - public static final int GL_SAMPLER_BUFFER_EXT = 0x8DC2; - public static final int GL_INT_SAMPLER_BUFFER_EXT = 0x8DD0; - public static final int GL_UNSIGNED_INT_SAMPLER_BUFFER_EXT = 0x8DD8; - public static final int GL_IMAGE_BUFFER_EXT = 0x9051; - public static final int GL_INT_IMAGE_BUFFER_EXT = 0x905C; - public static final int GL_UNSIGNED_INT_IMAGE_BUFFER_EXT = 0x9067; - public static final int GL_TEXTURE_BUFFER_OFFSET_EXT = 0x919D; - public static final int GL_TEXTURE_BUFFER_SIZE_EXT = 0x919E; - - // GL_EXT_texture_cube_map_array - public static final int GL_TEXTURE_CUBE_MAP_ARRAY_EXT = 0x9009; - public static final int GL_TEXTURE_BINDING_CUBE_MAP_ARRAY_EXT = 0x900A; - public static final int GL_SAMPLER_CUBE_MAP_ARRAY_EXT = 0x900C; - public static final int GL_SAMPLER_CUBE_MAP_ARRAY_SHADOW_EXT = 0x900D; - public static final int GL_INT_SAMPLER_CUBE_MAP_ARRAY_EXT = 0x900E; - public static final int GL_UNSIGNED_INT_SAMPLER_CUBE_MAP_ARRAY_EXT = 0x900F; - public static final int GL_IMAGE_CUBE_MAP_ARRAY_EXT = 0x9054; - public static final int GL_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 0x905F; - public static final int GL_UNSIGNED_INT_IMAGE_CUBE_MAP_ARRAY_EXT = 0x906A; - - // GL_EXT_texture_sRGB_decode - public static final int GL_TEXTURE_SRGB_DECODE_EXT = 0x8A48; - public static final int GL_DECODE_EXT = 0x8A49; - public static final int GL_SKIP_DECODE_EXT = 0x8A4A; - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } - - private GLES31Ext() {} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31Header.java-if android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31Header.java-if --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/GLES31Header.java-if 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/GLES31Header.java-if 1970-01-01 00:00:00.000000000 +0000 @@ -1,201 +0,0 @@ -/* - * Copyright 2014 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. - */ - -// This source file is automatically generated - -package android.opengl; - -/** OpenGL ES 3.1 - */ -public class GLES31 extends GLES30 { - - public static final int GL_VERTEX_SHADER_BIT = 0x00000001; - public static final int GL_FRAGMENT_SHADER_BIT = 0x00000002; - public static final int GL_UNIFORM_BARRIER_BIT = 0x00000004; - public static final int GL_TEXTURE_FETCH_BARRIER_BIT = 0x00000008; - public static final int GL_COMPUTE_SHADER_BIT = 0x00000020; - public static final int GL_COMMAND_BARRIER_BIT = 0x00000040; - public static final int GL_PIXEL_BUFFER_BARRIER_BIT = 0x00000080; - public static final int GL_TEXTURE_UPDATE_BARRIER_BIT = 0x00000100; - public static final int GL_BUFFER_UPDATE_BARRIER_BIT = 0x00000200; - public static final int GL_FRAMEBUFFER_BARRIER_BIT = 0x00000400; - public static final int GL_TRANSFORM_FEEDBACK_BARRIER_BIT = 0x00000800; - public static final int GL_ATOMIC_COUNTER_BARRIER_BIT = 0x00001000; - public static final int GL_SHADER_STORAGE_BARRIER_BIT = 0x00002000; - public static final int GL_ALL_SHADER_BITS = -1; // 0xFFFFFFFF - - public static final int GL_TEXTURE_WIDTH = 0x1000; - public static final int GL_TEXTURE_HEIGHT = 0x1001; - public static final int GL_TEXTURE_INTERNAL_FORMAT = 0x1003; - public static final int GL_STENCIL_INDEX = 0x1901; - public static final int GL_TEXTURE_RED_SIZE = 0x805C; - public static final int GL_TEXTURE_GREEN_SIZE = 0x805D; - public static final int GL_TEXTURE_BLUE_SIZE = 0x805E; - public static final int GL_TEXTURE_ALPHA_SIZE = 0x805F; - public static final int GL_TEXTURE_DEPTH = 0x8071; - public static final int GL_PROGRAM_SEPARABLE = 0x8258; - public static final int GL_ACTIVE_PROGRAM = 0x8259; - public static final int GL_PROGRAM_PIPELINE_BINDING = 0x825A; - public static final int GL_MAX_COMPUTE_SHARED_MEMORY_SIZE = 0x8262; - public static final int GL_MAX_COMPUTE_UNIFORM_COMPONENTS = 0x8263; - public static final int GL_MAX_COMPUTE_ATOMIC_COUNTER_BUFFERS = 0x8264; - public static final int GL_MAX_COMPUTE_ATOMIC_COUNTERS = 0x8265; - public static final int GL_MAX_COMBINED_COMPUTE_UNIFORM_COMPONENTS = 0x8266; - public static final int GL_COMPUTE_WORK_GROUP_SIZE = 0x8267; - public static final int GL_MAX_UNIFORM_LOCATIONS = 0x826E; - public static final int GL_VERTEX_ATTRIB_BINDING = 0x82D4; - public static final int GL_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D5; - public static final int GL_VERTEX_BINDING_DIVISOR = 0x82D6; - public static final int GL_VERTEX_BINDING_OFFSET = 0x82D7; - public static final int GL_VERTEX_BINDING_STRIDE = 0x82D8; - public static final int GL_MAX_VERTEX_ATTRIB_RELATIVE_OFFSET = 0x82D9; - public static final int GL_MAX_VERTEX_ATTRIB_BINDINGS = 0x82DA; - public static final int GL_MAX_VERTEX_ATTRIB_STRIDE = 0x82E5; - public static final int GL_TEXTURE_COMPRESSED = 0x86A1; - public static final int GL_TEXTURE_DEPTH_SIZE = 0x884A; - public static final int GL_READ_ONLY = 0x88B8; - public static final int GL_WRITE_ONLY = 0x88B9; - public static final int GL_READ_WRITE = 0x88BA; - public static final int GL_TEXTURE_STENCIL_SIZE = 0x88F1; - public static final int GL_TEXTURE_RED_TYPE = 0x8C10; - public static final int GL_TEXTURE_GREEN_TYPE = 0x8C11; - public static final int GL_TEXTURE_BLUE_TYPE = 0x8C12; - public static final int GL_TEXTURE_ALPHA_TYPE = 0x8C13; - public static final int GL_TEXTURE_DEPTH_TYPE = 0x8C16; - public static final int GL_TEXTURE_SHARED_SIZE = 0x8C3F; - public static final int GL_SAMPLE_POSITION = 0x8E50; - public static final int GL_SAMPLE_MASK = 0x8E51; - public static final int GL_SAMPLE_MASK_VALUE = 0x8E52; - public static final int GL_MAX_SAMPLE_MASK_WORDS = 0x8E59; - public static final int GL_MIN_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5E; - public static final int GL_MAX_PROGRAM_TEXTURE_GATHER_OFFSET = 0x8E5F; - public static final int GL_MAX_IMAGE_UNITS = 0x8F38; - public static final int GL_MAX_COMBINED_SHADER_OUTPUT_RESOURCES = 0x8F39; - public static final int GL_IMAGE_BINDING_NAME = 0x8F3A; - public static final int GL_IMAGE_BINDING_LEVEL = 0x8F3B; - public static final int GL_IMAGE_BINDING_LAYERED = 0x8F3C; - public static final int GL_IMAGE_BINDING_LAYER = 0x8F3D; - public static final int GL_IMAGE_BINDING_ACCESS = 0x8F3E; - public static final int GL_DRAW_INDIRECT_BUFFER = 0x8F3F; - public static final int GL_DRAW_INDIRECT_BUFFER_BINDING = 0x8F43; - public static final int GL_VERTEX_BINDING_BUFFER = 0x8F4F; - public static final int GL_IMAGE_2D = 0x904D; - public static final int GL_IMAGE_3D = 0x904E; - public static final int GL_IMAGE_CUBE = 0x9050; - public static final int GL_IMAGE_2D_ARRAY = 0x9053; - public static final int GL_INT_IMAGE_2D = 0x9058; - public static final int GL_INT_IMAGE_3D = 0x9059; - public static final int GL_INT_IMAGE_CUBE = 0x905B; - public static final int GL_INT_IMAGE_2D_ARRAY = 0x905E; - public static final int GL_UNSIGNED_INT_IMAGE_2D = 0x9063; - public static final int GL_UNSIGNED_INT_IMAGE_3D = 0x9064; - public static final int GL_UNSIGNED_INT_IMAGE_CUBE = 0x9066; - public static final int GL_UNSIGNED_INT_IMAGE_2D_ARRAY = 0x9069; - public static final int GL_IMAGE_BINDING_FORMAT = 0x906E; - public static final int GL_IMAGE_FORMAT_COMPATIBILITY_TYPE = 0x90C7; - public static final int GL_IMAGE_FORMAT_COMPATIBILITY_BY_SIZE = 0x90C8; - public static final int GL_IMAGE_FORMAT_COMPATIBILITY_BY_CLASS = 0x90C9; - public static final int GL_MAX_VERTEX_IMAGE_UNIFORMS = 0x90CA; - public static final int GL_MAX_FRAGMENT_IMAGE_UNIFORMS = 0x90CE; - public static final int GL_MAX_COMBINED_IMAGE_UNIFORMS = 0x90CF; - public static final int GL_SHADER_STORAGE_BUFFER = 0x90D2; - public static final int GL_SHADER_STORAGE_BUFFER_BINDING = 0x90D3; - public static final int GL_SHADER_STORAGE_BUFFER_START = 0x90D4; - public static final int GL_SHADER_STORAGE_BUFFER_SIZE = 0x90D5; - public static final int GL_MAX_VERTEX_SHADER_STORAGE_BLOCKS = 0x90D6; - public static final int GL_MAX_FRAGMENT_SHADER_STORAGE_BLOCKS = 0x90DA; - public static final int GL_MAX_COMPUTE_SHADER_STORAGE_BLOCKS = 0x90DB; - public static final int GL_MAX_COMBINED_SHADER_STORAGE_BLOCKS = 0x90DC; - public static final int GL_MAX_SHADER_STORAGE_BUFFER_BINDINGS = 0x90DD; - public static final int GL_MAX_SHADER_STORAGE_BLOCK_SIZE = 0x90DE; - public static final int GL_SHADER_STORAGE_BUFFER_OFFSET_ALIGNMENT = 0x90DF; - public static final int GL_DEPTH_STENCIL_TEXTURE_MODE = 0x90EA; - public static final int GL_MAX_COMPUTE_WORK_GROUP_INVOCATIONS = 0x90EB; - public static final int GL_DISPATCH_INDIRECT_BUFFER = 0x90EE; - public static final int GL_DISPATCH_INDIRECT_BUFFER_BINDING = 0x90EF; - public static final int GL_TEXTURE_2D_MULTISAMPLE = 0x9100; - public static final int GL_TEXTURE_BINDING_2D_MULTISAMPLE = 0x9104; - public static final int GL_TEXTURE_SAMPLES = 0x9106; - public static final int GL_TEXTURE_FIXED_SAMPLE_LOCATIONS = 0x9107; - public static final int GL_SAMPLER_2D_MULTISAMPLE = 0x9108; - public static final int GL_INT_SAMPLER_2D_MULTISAMPLE = 0x9109; - public static final int GL_UNSIGNED_INT_SAMPLER_2D_MULTISAMPLE = 0x910A; - public static final int GL_MAX_COLOR_TEXTURE_SAMPLES = 0x910E; - public static final int GL_MAX_DEPTH_TEXTURE_SAMPLES = 0x910F; - public static final int GL_MAX_INTEGER_SAMPLES = 0x9110; - public static final int GL_COMPUTE_SHADER = 0x91B9; - public static final int GL_MAX_COMPUTE_UNIFORM_BLOCKS = 0x91BB; - public static final int GL_MAX_COMPUTE_TEXTURE_IMAGE_UNITS = 0x91BC; - public static final int GL_MAX_COMPUTE_IMAGE_UNIFORMS = 0x91BD; - public static final int GL_MAX_COMPUTE_WORK_GROUP_COUNT = 0x91BE; - public static final int GL_MAX_COMPUTE_WORK_GROUP_SIZE = 0x91BF; - public static final int GL_ATOMIC_COUNTER_BUFFER = 0x92C0; - public static final int GL_ATOMIC_COUNTER_BUFFER_BINDING = 0x92C1; - public static final int GL_ATOMIC_COUNTER_BUFFER_START = 0x92C2; - public static final int GL_ATOMIC_COUNTER_BUFFER_SIZE = 0x92C3; - public static final int GL_MAX_VERTEX_ATOMIC_COUNTER_BUFFERS = 0x92CC; - public static final int GL_MAX_FRAGMENT_ATOMIC_COUNTER_BUFFERS = 0x92D0; - public static final int GL_MAX_COMBINED_ATOMIC_COUNTER_BUFFERS = 0x92D1; - public static final int GL_MAX_VERTEX_ATOMIC_COUNTERS = 0x92D2; - public static final int GL_MAX_FRAGMENT_ATOMIC_COUNTERS = 0x92D6; - public static final int GL_MAX_COMBINED_ATOMIC_COUNTERS = 0x92D7; - public static final int GL_MAX_ATOMIC_COUNTER_BUFFER_SIZE = 0x92D8; - public static final int GL_ACTIVE_ATOMIC_COUNTER_BUFFERS = 0x92D9; - public static final int GL_UNSIGNED_INT_ATOMIC_COUNTER = 0x92DB; - public static final int GL_MAX_ATOMIC_COUNTER_BUFFER_BINDINGS = 0x92DC; - public static final int GL_UNIFORM = 0x92E1; - public static final int GL_UNIFORM_BLOCK = 0x92E2; - public static final int GL_PROGRAM_INPUT = 0x92E3; - public static final int GL_PROGRAM_OUTPUT = 0x92E4; - public static final int GL_BUFFER_VARIABLE = 0x92E5; - public static final int GL_SHADER_STORAGE_BLOCK = 0x92E6; - public static final int GL_TRANSFORM_FEEDBACK_VARYING = 0x92F4; - public static final int GL_ACTIVE_RESOURCES = 0x92F5; - public static final int GL_MAX_NAME_LENGTH = 0x92F6; - public static final int GL_MAX_NUM_ACTIVE_VARIABLES = 0x92F7; - public static final int GL_NAME_LENGTH = 0x92F9; - public static final int GL_TYPE = 0x92FA; - public static final int GL_ARRAY_SIZE = 0x92FB; - public static final int GL_OFFSET = 0x92FC; - public static final int GL_BLOCK_INDEX = 0x92FD; - public static final int GL_ARRAY_STRIDE = 0x92FE; - public static final int GL_MATRIX_STRIDE = 0x92FF; - public static final int GL_IS_ROW_MAJOR = 0x9300; - public static final int GL_ATOMIC_COUNTER_BUFFER_INDEX = 0x9301; - public static final int GL_BUFFER_BINDING = 0x9302; - public static final int GL_BUFFER_DATA_SIZE = 0x9303; - public static final int GL_NUM_ACTIVE_VARIABLES = 0x9304; - public static final int GL_ACTIVE_VARIABLES = 0x9305; - public static final int GL_REFERENCED_BY_VERTEX_SHADER = 0x9306; - public static final int GL_REFERENCED_BY_FRAGMENT_SHADER = 0x930A; - public static final int GL_REFERENCED_BY_COMPUTE_SHADER = 0x930B; - public static final int GL_TOP_LEVEL_ARRAY_SIZE = 0x930C; - public static final int GL_TOP_LEVEL_ARRAY_STRIDE = 0x930D; - public static final int GL_LOCATION = 0x930E; - public static final int GL_FRAMEBUFFER_DEFAULT_WIDTH = 0x9310; - public static final int GL_FRAMEBUFFER_DEFAULT_HEIGHT = 0x9311; - public static final int GL_FRAMEBUFFER_DEFAULT_SAMPLES = 0x9313; - public static final int GL_FRAMEBUFFER_DEFAULT_FIXED_SAMPLE_LOCATIONS = 0x9314; - public static final int GL_MAX_FRAMEBUFFER_WIDTH = 0x9315; - public static final int GL_MAX_FRAMEBUFFER_HEIGHT = 0x9316; - public static final int GL_MAX_FRAMEBUFFER_SAMPLES = 0x9318; - - native private static void _nativeClassInit(); - static { - _nativeClassInit(); - } - - private GLES31() {} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,328 +0,0 @@ -/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static void -android_glGetActiveAttrib__III_3II_3II_3II_3BI - (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - GLsizei *length_base = (GLsizei *) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - GLint *size_base = (GLint *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - GLenum *type_base = (GLenum *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - char *name_base = (char *) 0; - jint _nameRemaining; - char *name = (char *) 0; - - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; - } - _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; - length_base = (GLsizei *) - _env->GetIntArrayElements(length_ref, (jboolean *)0); - length = length_base + lengthOffset; - - if (!size_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "size == null"; - goto exit; - } - if (sizeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sizeOffset < 0"; - goto exit; - } - _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; - size_base = (GLint *) - _env->GetIntArrayElements(size_ref, (jboolean *)0); - size = size_base + sizeOffset; - - if (!type_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "type == null"; - goto exit; - } - if (typeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "typeOffset < 0"; - goto exit; - } - _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; - type_base = (GLenum *) - _env->GetIntArrayElements(type_ref, (jboolean *)0); - type = type_base + typeOffset; - - if (!name_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "name == null"; - goto exit; - } - if (nameOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "nameOffset < 0"; - goto exit; - } - _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; - name_base = (char *) - _env->GetByteArrayElements(name_ref, (jboolean *)0); - name = name_base + nameOffset; - - glGetActiveAttrib( - (GLuint)program, - (GLuint)index, - (GLsizei)bufsize, - (GLsizei *)length, - (GLint *)size, - (GLenum *)type, - (char *)name - ); - -exit: - if (name_base) { - _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, - _exception ? JNI_ABORT: 0); - } - if (type_base) { - _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, - _exception ? JNI_ABORT: 0); - } - if (size_base) { - _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, - _exception ? JNI_ABORT: 0); - } - if (length_base) { - _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, - _exception ? JNI_ABORT: 0); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static void -android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B - (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { - jintArray _lengthArray = (jintArray) 0; - jint _lengthBufferOffset = (jint) 0; - jintArray _sizeArray = (jintArray) 0; - jint _sizeBufferOffset = (jint) 0; - jintArray _typeArray = (jintArray) 0; - jint _typeBufferOffset = (jint) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); - size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); - type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); - if (length == NULL) { - char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); - length = (GLsizei *) (_lengthBase + _lengthBufferOffset); - } - if (size == NULL) { - char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); - size = (GLint *) (_sizeBase + _sizeBufferOffset); - } - if (type == NULL) { - char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); - type = (GLenum *) (_typeBase + _typeBufferOffset); - } - glGetActiveAttrib( - (GLuint)program, - (GLuint)index, - (GLsizei)bufsize, - (GLsizei *)length, - (GLint *)size, - (GLenum *)type, - reinterpret_cast(name) - ); - if (_typeArray) { - releaseArrayPointer(_env, _typeArray, (jint*)type, JNI_TRUE); - } - if (_sizeArray) { - releaseArrayPointer(_env, _sizeArray, (jint*)size, JNI_TRUE); - } - if (_lengthArray) { - releaseArrayPointer(_env, _lengthArray, (jint*)length, JNI_TRUE); - } -} - -/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static jstring -android_glGetActiveAttrib1 - (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - GLint *size_base = (GLint *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - GLenum *type_base = (GLenum *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - jstring result = 0; - - GLint len = 0; - glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); - if (!len) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(len); - - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - if (!size_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "size == null"; - goto exit; - } - if (sizeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sizeOffset < 0"; - goto exit; - } - _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; - size_base = (GLint *) - _env->GetIntArrayElements(size_ref, (jboolean *)0); - size = size_base + sizeOffset; - - if (!type_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "type == null"; - goto exit; - } - if (typeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "typeOffset < 0"; - goto exit; - } - _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; - type_base = (GLenum *) - _env->GetIntArrayElements(type_ref, (jboolean *)0); - type = type_base + typeOffset; - - glGetActiveAttrib( - (GLuint)program, - (GLuint)index, - (GLsizei)len, - NULL, - (GLint *)size, - (GLenum *)type, - (char *)buf - ); -exit: - if (type_base) { - _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, - _exception ? JNI_ABORT: 0); - } - if (size_base) { - _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, - _exception ? JNI_ABORT: 0); - } - if (_exception != 1) { - result = _env->NewStringUTF(buf); - } - if (buf) { - free(buf); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } - if (result == 0) { - result = _env->NewStringUTF(""); - } - - return result; -} - -/* void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static jstring -android_glGetActiveAttrib2 - (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { - jintArray _sizeArray = (jintArray) 0; - jint _sizeBufferOffset = (jint) 0; - jintArray _typeArray = (jintArray) 0; - jint _typeBufferOffset = (jint) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - jstring result = 0; - - GLint len = 0; - glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); - if (!len) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(len); - - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - - size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); - type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); - if (size == NULL) { - char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); - size = (GLint *) (_sizeBase + _sizeBufferOffset); - } - if (type == NULL) { - char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); - type = (GLenum *) (_typeBase + _typeBufferOffset); - } - glGetActiveAttrib( - (GLuint)program, - (GLuint)index, - (GLsizei)len, - NULL, - (GLint *)size, - (GLenum *)type, - (char *)buf - ); - - if (_typeArray) { - releaseArrayPointer(_env, _typeArray, (jint*)type, JNI_TRUE); - } - if (_sizeArray) { - releaseArrayPointer(_env, _sizeArray, (jint*)size, JNI_TRUE); - } - result = _env->NewStringUTF(buf); - if (buf) { - free(buf); - } - return result; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ - // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - public static native void glGetActiveAttrib( - int program, - int index, - int bufsize, - int[] length, - int lengthOffset, - int[] size, - int sizeOffset, - int[] type, - int typeOffset, - byte[] name, - int nameOffset - ); - - // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - /** @hide Method is broken, but used to be public (b/6006380) */ - public static native void glGetActiveAttrib( - int program, - int index, - int bufsize, - java.nio.IntBuffer length, - java.nio.IntBuffer size, - java.nio.IntBuffer type, - byte name - ); - - // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - public static native String glGetActiveAttrib( - int program, - int index, - int[] size, - int sizeOffset, - int[] type, - int typeOffset - ); - - // C function void glGetActiveAttrib ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - public static native String glGetActiveAttrib( - int program, - int index, - java.nio.IntBuffer size, - java.nio.IntBuffer type - ); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveAttrib.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -{"glGetActiveAttrib", "(III[II[II[II[BI)V", (void *) android_glGetActiveAttrib__III_3II_3II_3II_3BI }, -{"glGetActiveAttrib", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveAttrib__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, -{"glGetActiveAttrib", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveAttrib1 }, -{"glGetActiveAttrib", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveAttrib2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,126 +0,0 @@ -/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ -static void -android_glGetActiveUniformBlockName_III_3II_3BI - (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, int bufSize, jintArray length_ref, jint lengthOffset, jbyteArray name_ref, jint nameOffset) { - jint _exception = 0; - const char* _exceptionType; - const char* _exceptionMessage; - GLsizei* _length_base = (GLsizei*)0; - jint _lengthRemaining; - GLsizei* _length = (GLsizei*)0; - GLchar* _name_base = (GLchar*)0; - jint _nameRemaining; - GLchar* _name = (GLchar*)0; - - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; - } - _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; - _length_base = (GLsizei*)_env->GetIntArrayElements( - length_ref, (jboolean*)0); - _length = _length_base + lengthOffset; - - if (!name_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformBlockName == null"; - goto exit; - } - if (nameOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformBlockNameOffset < 0"; - goto exit; - } - _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; - _name_base = (GLchar*)_env->GetByteArrayElements( - name_ref, (jboolean*)0); - _name = _name_base + nameOffset; - - glGetActiveUniformBlockName( - (GLuint)program, - (GLuint)uniformBlockIndex, - (GLsizei)bufSize, - (GLsizei*)_length, - (GLchar*)_name - ); - -exit: - if (_name_base) { - _env->ReleaseByteArrayElements(name_ref, (jbyte*)_name_base, - _exception ? JNI_ABORT: 0); - } - if (_length_base) { - _env->ReleaseIntArrayElements(length_ref, (jint*)_length_base, - _exception ? JNI_ABORT: 0); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ -static void -android_glGetActiveUniformBlockName_IILjava_nio_Buffer_2Ljava_nio_Buffer_2 - (JNIEnv* _env, jobject _this, jint program, jint uniformBlockIndex, jobject length_buf, jobject uniformBlockName_buf) { - jint _exception = 0; - const char* _exceptionType; - const char* _exceptionMessage; - jarray _lengthArray = (jarray)0; - jint _lengthBufferOffset = (jint)0; - GLsizei* _length = (GLsizei*)0; - jint _lengthRemaining; - jarray _nameArray = (jarray)0; - jint _nameBufferOffset = (jint)0; - GLchar* _name = (GLchar*)0; - jint _nameRemaining; - - _length = (GLsizei*)getPointer(_env, length_buf, &_lengthArray, &_lengthRemaining, &_lengthBufferOffset); - if (_length == NULL) { - GLsizei* _lengthBase = (GLsizei*)_env->GetPrimitiveArrayCritical(_lengthArray, (jboolean*)0); - _length = (GLsizei*)(_lengthBase + _lengthBufferOffset); - } - - _name = (GLchar*)getPointer(_env, uniformBlockName_buf, &_nameArray, &_nameRemaining, &_nameBufferOffset); - if (_name == NULL) { - GLchar* _nameBase = (GLchar*)_env->GetPrimitiveArrayCritical(_nameArray, (jboolean*)0); - _name = (GLchar*)(_nameBase + _nameBufferOffset); - } - - glGetActiveUniformBlockName( - (GLuint)program, - (GLuint)uniformBlockIndex, - (GLsizei)_nameRemaining, - _length, _name - ); - if (_nameArray) { - releasePointer(_env, _nameArray, _name, JNI_TRUE); - } - if (_lengthArray) { - releasePointer(_env, _lengthArray, _length, JNI_TRUE); - } -} - -/* void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) */ -static jstring -android_glGetActiveUniformBlockName_II - (JNIEnv *_env, jobject _this, jint program, jint uniformBlockIndex) { - GLint len = 0; - glGetActiveUniformBlockiv((GLuint)program, (GLuint)uniformBlockIndex, - GL_UNIFORM_BLOCK_NAME_LENGTH, &len); - GLchar* name = (GLchar*)malloc(len); - glGetActiveUniformBlockName((GLuint)program, (GLuint)uniformBlockIndex, - len, NULL, name); - jstring result = _env->NewStringUTF(name); - free(name); - return result; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,28 +0,0 @@ - // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) - - public static native void glGetActiveUniformBlockName( - int program, - int uniformBlockIndex, - int bufSize, - int[] length, - int lengthOffset, - byte[] uniformBlockName, - int uniformBlockNameOffset - ); - - // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) - - public static native void glGetActiveUniformBlockName( - int program, - int uniformBlockIndex, - java.nio.Buffer length, - java.nio.Buffer uniformBlockName - ); - - // C function void glGetActiveUniformBlockName ( GLuint program, GLuint uniformBlockIndex, GLsizei bufSize, GLsizei *length, GLchar *uniformBlockName ) - - public static native String glGetActiveUniformBlockName( - int program, - int uniformBlockIndex - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniformBlockName.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -{"glGetActiveUniformBlockName", "(III[II[BI)V", (void *) android_glGetActiveUniformBlockName_III_3II_3BI }, -{"glGetActiveUniformBlockName", "(IILjava/nio/Buffer;Ljava/nio/Buffer;)V", (void *) android_glGetActiveUniformBlockName_IILjava_nio_Buffer_2Ljava_nio_Buffer_2 }, -{"glGetActiveUniformBlockName", "(II)Ljava/lang/String;", (void *) android_glGetActiveUniformBlockName_II }, \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,329 +0,0 @@ -/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static void -android_glGetActiveUniform__III_3II_3II_3II_3BI - (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - GLsizei *length_base = (GLsizei *) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - GLint *size_base = (GLint *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - GLenum *type_base = (GLenum *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - char *name_base = (char *) 0; - jint _nameRemaining; - char *name = (char *) 0; - - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; - } - _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; - length_base = (GLsizei *) - _env->GetIntArrayElements(length_ref, (jboolean *)0); - length = length_base + lengthOffset; - - if (!size_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "size == null"; - goto exit; - } - if (sizeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sizeOffset < 0"; - goto exit; - } - _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; - size_base = (GLint *) - _env->GetIntArrayElements(size_ref, (jboolean *)0); - size = size_base + sizeOffset; - - if (!type_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "type == null"; - goto exit; - } - if (typeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "typeOffset < 0"; - goto exit; - } - _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; - type_base = (GLenum *) - _env->GetIntArrayElements(type_ref, (jboolean *)0); - type = type_base + typeOffset; - - if (!name_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "name == null"; - goto exit; - } - if (nameOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "nameOffset < 0"; - goto exit; - } - _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; - name_base = (char *) - _env->GetByteArrayElements(name_ref, (jboolean *)0); - name = name_base + nameOffset; - - glGetActiveUniform( - (GLuint)program, - (GLuint)index, - (GLsizei)bufsize, - (GLsizei *)length, - (GLint *)size, - (GLenum *)type, - (char *)name - ); - -exit: - if (name_base) { - _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, - _exception ? JNI_ABORT: 0); - } - if (type_base) { - _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, - _exception ? JNI_ABORT: 0); - } - if (size_base) { - _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, - _exception ? JNI_ABORT: 0); - } - if (length_base) { - _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, - _exception ? JNI_ABORT: 0); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static void -android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B - (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { - jintArray _lengthArray = (jintArray) 0; - jint _lengthBufferOffset = (jint) 0; - jintArray _sizeArray = (jintArray) 0; - jint _sizeBufferOffset = (jint) 0; - jintArray _typeArray = (jintArray) 0; - jint _typeBufferOffset = (jint) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); - size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); - type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); - if (length == NULL) { - char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); - length = (GLsizei *) (_lengthBase + _lengthBufferOffset); - } - if (size == NULL) { - char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); - size = (GLint *) (_sizeBase + _sizeBufferOffset); - } - if (type == NULL) { - char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); - type = (GLenum *) (_typeBase + _typeBufferOffset); - } - glGetActiveUniform( - (GLuint)program, - (GLuint)index, - (GLsizei)bufsize, - (GLsizei *)length, - (GLint *)size, - (GLenum *)type, - reinterpret_cast(name) - ); - if (_typeArray) { - releaseArrayPointer(_env, _typeArray, (jint*)type, JNI_TRUE); - } - if (_sizeArray) { - releaseArrayPointer(_env, _sizeArray, (jint*)size, JNI_TRUE); - } - if (_lengthArray) { - releaseArrayPointer(_env, _lengthArray, (jint*)length, JNI_TRUE); - } -} - -/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static jstring -android_glGetActiveUniform1 - (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - - GLint *size_base = (GLint *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - - GLenum *type_base = (GLenum *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - jstring result = 0; - - GLint len = 0; - glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); - if (!len) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(len); - - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - - if (!size_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "size == null"; - goto exit; - } - if (sizeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sizeOffset < 0"; - goto exit; - } - _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; - size_base = (GLint *) - _env->GetIntArrayElements(size_ref, (jboolean *)0); - size = size_base + sizeOffset; - - if (!type_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "type == null"; - goto exit; - } - if (typeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "typeOffset < 0"; - goto exit; - } - _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; - type_base = (GLenum *) - _env->GetIntArrayElements(type_ref, (jboolean *)0); - type = type_base + typeOffset; - - glGetActiveUniform( - (GLuint)program, - (GLuint)index, - (GLsizei)len, - NULL, - (GLint *)size, - (GLenum *)type, - (char *)buf - ); - -exit: - if (type_base) { - _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, - _exception ? JNI_ABORT: 0); - } - if (size_base) { - _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, - _exception ? JNI_ABORT: 0); - } - if (_exception != 1) { - result = _env->NewStringUTF(buf); - } - if (buf) { - free(buf); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } - if (result == 0) { - result = _env->NewStringUTF(""); - } - return result; -} - -/* void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) */ -static jstring -android_glGetActiveUniform2 - (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { - jintArray _sizeArray = (jintArray) 0; - jint _sizeBufferOffset = (jint) 0; - jintArray _typeArray = (jintArray) 0; - jint _typeBufferOffset = (jint) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - jstring result = 0; - GLint len = 0; - glGetProgramiv((GLuint)program, GL_ACTIVE_UNIFORM_MAX_LENGTH, &len); - if (!len) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(len); - - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - - size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); - type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); - - if (size == NULL) { - char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); - size = (GLint *) (_sizeBase + _sizeBufferOffset); - } - if (type == NULL) { - char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); - type = (GLenum *) (_typeBase + _typeBufferOffset); - } - glGetActiveUniform( - (GLuint)program, - (GLuint)index, - len, - NULL, - (GLint *)size, - (GLenum *)type, - (char *)buf - ); - - if (_typeArray) { - releaseArrayPointer(_env, _typeArray, (jint*)type, JNI_TRUE); - } - if (_sizeArray) { - releaseArrayPointer(_env, _sizeArray, (jint*)size, JNI_TRUE); - } - result = _env->NewStringUTF(buf); - if (buf) { - free(buf); - } - return result; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,47 +0,0 @@ - // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - public static native void glGetActiveUniform( - int program, - int index, - int bufsize, - int[] length, - int lengthOffset, - int[] size, - int sizeOffset, - int[] type, - int typeOffset, - byte[] name, - int nameOffset - ); - - // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - /** @hide Method is broken, but used to be public (b/6006380) */ - public static native void glGetActiveUniform( - int program, - int index, - int bufsize, - java.nio.IntBuffer length, - java.nio.IntBuffer size, - java.nio.IntBuffer type, - byte name - ); - // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - public static native String glGetActiveUniform( - int program, - int index, - int[] size, - int sizeOffset, - int[] type, - int typeOffset - ); - - // C function void glGetActiveUniform ( GLuint program, GLuint index, GLsizei bufsize, GLsizei *length, GLint *size, GLenum *type, char *name ) - - public static native String glGetActiveUniform( - int program, - int index, - java.nio.IntBuffer size, - java.nio.IntBuffer type - ); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetActiveUniform.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -{"glGetActiveUniform", "(III[II[II[II[BI)V", (void *) android_glGetActiveUniform__III_3II_3II_3II_3BI }, -{"glGetActiveUniform", "(II[II[II)Ljava/lang/String;", (void *) android_glGetActiveUniform1 }, -{"glGetActiveUniform", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetActiveUniform__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, -{"glGetActiveUniform", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetActiveUniform2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBooleanv.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ -static void -android_glGetBooleanv__I_3ZI - (JNIEnv *_env, jobject _this, jint pname, jbooleanArray params_ref, jint offset) { - get( - _env, _this, pname, params_ref, offset); -} - -/* void glGetBooleanv ( GLenum pname, GLboolean *params ) */ -static void -android_glGetBooleanv__ILjava_nio_IntBuffer_2 - (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - getarray( - _env, _this, pname, params_buf); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBooleanv.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ - // C function void glGetBooleanv ( GLenum pname, GLboolean *params ) - - public static native void glGetBooleanv( - int pname, - boolean[] params, - int offset - ); - - // C function void glGetBooleanv ( GLenum pname, GLboolean *params ) - - public static native void glGetBooleanv( - int pname, - java.nio.IntBuffer params - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBooleanv.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"glGetBooleanv", "(I[ZI)V", (void *) android_glGetBooleanv__I_3ZI }, -{"glGetBooleanv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetBooleanv__ILjava_nio_IntBuffer_2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,11 +0,0 @@ -/* void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) */ -static jobject -android_glGetBufferPointerv__II - (JNIEnv *_env, jobject _this, jint target, jint pname) { - GLint64 _mapLength; - GLvoid* _p; - glGetBufferParameteri64v((GLenum)target, GL_BUFFER_MAP_LENGTH, &_mapLength); - glGetBufferPointerv((GLenum)target, (GLenum)pname, &_p); - return _env->NewDirectByteBuffer(_p, _mapLength); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ - // C function void glGetBufferPointerv ( GLenum target, GLenum pname, GLvoid** params ) - - public static native java.nio.Buffer glGetBufferPointerv( - int target, - int pname - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetBufferPointerv.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetBufferPointerv", "(II)Ljava/nio/Buffer;", (void *) android_glGetBufferPointerv__II }, \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,31 +0,0 @@ -/* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */ -static jint -android_glGetDebugMessageLogKHR__II_3II_3II_3II_3II_3II_3BI - (JNIEnv *_env, jobject _this, jint count, jint bufSize, jintArray sources_ref, jint sourcesOffset, jintArray types_ref, jint typesOffset, jintArray ids_ref, jint idsOffset, jintArray severities_ref, jint severitiesOffset, jintArray lengths_ref, jint lengthsOffset, jbyteArray messageLog_ref, jint messageLogOffset) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return 0; -} - -/* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */ -static uint -android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2 - (JNIEnv *_env, jobject _this, jint count, jobject sources_ref, jobject types_ref, jobject ids_ref, jobject severities_ref, jobject lengths_ref, jobject messageLog_ref) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return 0; -} - -/* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */ -static jobjectArray -android_glGetDebugMessageLogKHR__I_3II_3II_3II_3II - (JNIEnv *_env, jobject _this, jint count, jintArray sources_ref, jint sourcesOffset, jintArray types_ref, jint typesOffset, jintArray ids_ref, jint idsOffset, jintArray severities_ref, jint severitiesOffset) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return 0; -} - -/* GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) */ -static jobjectArray -android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 - (JNIEnv *_env, jobject _this, jint count, jobject sources_ref, jobject types_ref, jobject ids_ref, jobject severities_ref) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ - // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) - - public static native int glGetDebugMessageLogKHR( - int count, - int bufSize, - int[] sources, - int sourcesOffset, - int[] types, - int typesOffset, - int[] ids, - int idsOffset, - int[] severities, - int severitiesOffset, - int[] lengths, - int lengthsOffset, - byte[] messageLog, - int messageLogOffset); - - // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) - - public static native int glGetDebugMessageLogKHR( - int count, - java.nio.IntBuffer sources, - java.nio.IntBuffer types, - java.nio.IntBuffer ids, - java.nio.IntBuffer severities, - java.nio.IntBuffer lengths, - java.nio.ByteBuffer messageLog); - - // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) - - public static native String[] glGetDebugMessageLogKHR( - int count, - int[] sources, - int sourcesOffset, - int[] types, - int typesOffset, - int[] ids, - int idsOffset, - int[] severities, - int severitiesOffset); - - // C function GLuint glGetDebugMessageLogKHR ( GLuint count, GLsizei bufSize, GLenum *sources, GLenum *types, GLuint *ids, GLenum *severities, GLsizei *lengths, GLchar *messageLog ) - - public static native String[] glGetDebugMessageLogKHR( - int count, - java.nio.IntBuffer sources, - java.nio.IntBuffer types, - java.nio.IntBuffer ids, - java.nio.IntBuffer severities); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetDebugMessageLogKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -{"glGetDebugMessageLogKHR", "(II[II[II[II[II[II[BI)I", (void *) android_glGetDebugMessageLogKHR__II_3II_3II_3II_3II_3II_3BI }, -{"glGetDebugMessageLogKHR", "(ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/ByteBuffer;)I", (void *) android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_ByteBuffer_2 }, -{"glGetDebugMessageLogKHR", "(I[II[II[II[II)[Ljava/lang/String;", (void *) android_glGetDebugMessageLogKHR__I_3II_3II_3II_3II }, -{"glGetDebugMessageLogKHR", "(ILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;)[Ljava/lang/String;", (void *) android_glGetDebugMessageLogKHR__ILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetFloatv.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ -static void -android_glGetFloatv__I_3FI - (JNIEnv *_env, jobject _this, jint pname, jfloatArray params_ref, jint offset) { - get( - _env, _this, pname, params_ref, offset); -} - -/* void glGetFloatv ( GLenum pname, GLfloat *params ) */ -static void -android_glGetFloatv__ILjava_nio_FloatBuffer_2 - (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - getarray( - _env, _this, pname, params_buf); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetFloatv.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetFloatv.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetFloatv.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetFloatv.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ - // C function void glGetFloatv ( GLenum pname, GLfloat *params ) - - public static native void glGetFloatv( - int pname, - float[] params, - int offset - ); - - // C function void glGetFloatv ( GLenum pname, GLfloat *params ) - - public static native void glGetFloatv( - int pname, - java.nio.FloatBuffer params - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetFloatv.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"glGetFloatv", "(I[FI)V", (void *) android_glGetFloatv__I_3FI }, -{"glGetFloatv", "(ILjava/nio/FloatBuffer;)V", (void *) android_glGetFloatv__ILjava_nio_FloatBuffer_2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetIntegerv.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ -/* void glGetIntegerv ( GLenum pname, GLint *params ) */ -static void -android_glGetIntegerv__I_3II - (JNIEnv *_env, jobject _this, jint pname, jintArray params_ref, jint offset) { - get( - _env, _this, pname, params_ref, offset); -} - -/* void glGetIntegerv ( GLenum pname, GLint *params ) */ -static void -android_glGetIntegerv__ILjava_nio_IntBuffer_2 - (JNIEnv *_env, jobject _this, jint pname, jobject params_buf) { - getarray( - _env, _this, pname, params_buf); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetIntegerv.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,15 +0,0 @@ - // C function void glGetIntegerv ( GLenum pname, GLint *params ) - - public static native void glGetIntegerv( - int pname, - int[] params, - int offset - ); - - // C function void glGetIntegerv ( GLenum pname, GLint *params ) - - public static native void glGetIntegerv( - int pname, - java.nio.IntBuffer params - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetIntegerv.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"glGetIntegerv", "(I[II)V", (void *) android_glGetIntegerv__I_3II }, -{"glGetIntegerv", "(ILjava/nio/IntBuffer;)V", (void *) android_glGetIntegerv__ILjava_nio_IntBuffer_2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -/* void glGetObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label ) */ -static jstring -android_glGetObjectLabelKHR(JNIEnv *_env, jobject _this, jint identifier, jint name) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return NULL; -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function void glGetObjectLabelKHR ( GLenum identifier, GLuint name, GLsizei bufSize, GLsizei *length, GLchar *label ) - - public static native String glGetObjectLabelKHR(int identifier, int name); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectLabelKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetObjectLabelKHR", "(II)Ljava/lang/String;", (void *) android_glGetObjectLabelKHR }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -/* void glGetObjectPtrLabelKHR ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label ) */ -static jstring -android_glGetObjectPtrLabelKHR(JNIEnv *_env, jobject _this, jlong ptr) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return NULL; -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function void glGetObjectPtrLabelKHR ( const void *ptr, GLsizei bufSize, GLsizei *length, GLchar *label ) - - public static native String glGetObjectPtrLabelKHR(long ptr); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetObjectPtrLabelKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetObjectPtrLabelKHR", "(J)Ljava/lang/String;", (void *) android_glGetObjectPtrLabelKHR }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ -/* void glGetPointervKHR ( GLenum pname, void **params ) */ -static jobject -android_glGetDebugMessageCallbackKHR(JNIEnv *_env, jobject _this) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return NULL; -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function void glGetPointervKHR ( GLenum pname, void **params ) - - public static native DebugProcKHR glGetDebugMessageCallbackKHR(); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetPointervKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetDebugMessageCallbackKHR", "()Landroid/opengl/GLES31Ext$DebugProcKHR;", (void *) android_glGetDebugMessageCallbackKHR }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramInfoLog.java 2012-10-16 22:57:11.000000000 +0000 @@ -1,5 +1,21 @@ +/* + * Copyright (C) 2009 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. + */ + // C function void glGetProgramInfoLog( GLuint program, GLsizei maxLength, GLsizei * length, - // GLchar * infoLog); + // GLchar * infoLog); public static native String glGetProgramInfoLog( int program diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,19 +0,0 @@ -#include - -/* void glGetProgramPipelineInfoLog ( GLuint shader, GLsizei maxLength, GLsizei* length, GLchar* infoLog ) */ -static jstring android_glGetProgramPipelineInfoLog(JNIEnv *_env, jobject, jint shader) { - GLint infoLen = 0; - glGetProgramPipelineiv(shader, GL_INFO_LOG_LENGTH, &infoLen); - if (!infoLen) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(infoLen); - if (buf == NULL) { - jniThrowException(_env, "java/lang/OutOfMemoryError", "out of memory"); - return NULL; - } - glGetProgramPipelineInfoLog(shader, infoLen, NULL, buf); - jstring result = _env->NewStringUTF(buf); - free(buf); - return result; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ - // C function void glGetProgramPipelineInfoLog( GLuint program, GLsizei maxLength, GLsizei * length, GLchar * infoLog); - - public static native String glGetProgramPipelineInfoLog( - int program - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramPipelineInfoLog.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetProgramPipelineInfoLog", "(I)Ljava/lang/String;", (void *) android_glGetProgramPipelineInfoLog }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -/* void glGetProgramResourceName ( GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name ) */ -static jstring -android_glGetProgramResourceName - (JNIEnv *_env, jobject _this, jint program, jint programInterface, jint index) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); - return NULL; -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - // C function void glGetProgramResourceName ( GLuint program, GLenum programInterface, GLuint index, GLsizei bufSize, GLsizei *length, GLchar *name ) - - public static native String glGetProgramResourceName( - int program, - int programInterface, - int index - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetProgramResourceName.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetProgramResourceName", "(III)Ljava/lang/String;", (void *) android_glGetProgramResourceName }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderInfoLog.java 2012-10-16 22:57:11.000000000 +0000 @@ -1,5 +1,21 @@ +/* + * Copyright (C) 2009 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. + */ + // C function void glGetShaderInfoLog( GLuint shader, GLsizei maxLength, GLsizei * length, - // GLchar * infoLog); + // GLchar * infoLog); public static native String glGetShaderInfoLog( int shader diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderSource.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ -static void -android_glGetShaderSource__II_3II_3BI - (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jintArray length_ref, jint lengthOffset, jbyteArray source_ref, jint sourceOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - GLsizei *length_base = (GLsizei *) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - char *source_base = (char *) 0; - jint _sourceRemaining; - char *source = (char *) 0; - - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; - } - _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; - length_base = (GLsizei *) - _env->GetIntArrayElements(length_ref, (jboolean *)0); - length = length_base + lengthOffset; - - if (!source_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "source == null"; - goto exit; - } - if (sourceOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sourceOffset < 0"; - goto exit; - } - _sourceRemaining = _env->GetArrayLength(source_ref) - sourceOffset; - source_base = (char *) - _env->GetByteArrayElements(source_ref, (jboolean *)0); - source = source_base + sourceOffset; - - glGetShaderSource( - (GLuint)shader, - (GLsizei)bufsize, - (GLsizei *)length, - (char *)source - ); - -exit: - if (source_base) { - _env->ReleaseByteArrayElements(source_ref, (jbyte*)source_base, - _exception ? JNI_ABORT: 0); - } - if (length_base) { - _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, - _exception ? JNI_ABORT: 0); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ -static void -android_glGetShaderSource__IILjava_nio_IntBuffer_2B - (JNIEnv *_env, jobject _this, jint shader, jint bufsize, jobject length_buf, jbyte source) { - jintArray _array = (jintArray) 0; - jint _bufferOffset = (jint) 0; - jint _remaining; - GLsizei *length = (GLsizei *) 0; - - length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_array, &_remaining, &_bufferOffset); - if (length == NULL) { - char * _lengthBase = (char *)_env->GetIntArrayElements(_array, (jboolean *) 0); - length = (GLsizei *) (_lengthBase + _bufferOffset); - } - glGetShaderSource( - (GLuint)shader, - (GLsizei)bufsize, - (GLsizei *)length, - reinterpret_cast(source) - ); - if (_array) { - releaseArrayPointer(_env, _array, (jint*)length, JNI_TRUE); - } -} - -/* void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) */ -static jstring android_glGetShaderSource(JNIEnv *_env, jobject, jint shader) { - GLint shaderLen = 0; - glGetShaderiv((GLuint)shader, GL_SHADER_SOURCE_LENGTH, &shaderLen); - if (!shaderLen) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(shaderLen); - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - glGetShaderSource(shader, shaderLen, NULL, buf); - jstring result = _env->NewStringUTF(buf); - free(buf); - return result; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderSource.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ - // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) - - public static native void glGetShaderSource( - int shader, - int bufsize, - int[] length, - int lengthOffset, - byte[] source, - int sourceOffset - ); - - // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) - - /** @hide Method is broken, but used to be public (b/6006380) */ - public static native void glGetShaderSource( - int shader, - int bufsize, - java.nio.IntBuffer length, - byte source - ); - - // C function void glGetShaderSource ( GLuint shader, GLsizei bufsize, GLsizei *length, char *source ) - - public static native String glGetShaderSource( - int shader - ); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetShaderSource.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,3 +0,0 @@ -{"glGetShaderSource", "(II[II[BI)V", (void *) android_glGetShaderSource__II_3II_3BI }, -{"glGetShaderSource", "(IILjava/nio/IntBuffer;B)V", (void *) android_glGetShaderSource__IILjava_nio_IntBuffer_2B }, -{"glGetShaderSource", "(I)Ljava/lang/String;", (void *) android_glGetShaderSource }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetStringi.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ -/* const GLubyte * glGetStringi ( GLenum name, GLuint index ) */ -static jstring -android_glGetStringi__II - (JNIEnv *_env, jobject _this, jint name, jint index) { - const GLubyte* _chars = glGetStringi((GLenum)name, (GLuint)index); - return _env->NewStringUTF((const char*)_chars); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetStringi.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetStringi.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetStringi.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetStringi.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,7 +0,0 @@ - // C function const GLubyte * glGetStringi ( GLenum name, GLuint index ) - - public static native String glGetStringi( - int name, - int index - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetStringi.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glGetStringi", "(II)Ljava/lang/String;", (void *) android_glGetStringi__II }, \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetString.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetString.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetString.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetString.java 2012-10-16 22:57:11.000000000 +0000 @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2009 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. + */ + // C function const GLubyte * glGetString ( GLenum name ) public static native String glGetString( diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,332 +0,0 @@ -/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ -static void -android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI - (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jintArray length_ref, jint lengthOffset, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset, jbyteArray name_ref, jint nameOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - GLsizei *length_base = (GLsizei *) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - GLint *size_base = (GLint *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - GLenum *type_base = (GLenum *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - char *name_base = (char *) 0; - jint _nameRemaining; - char *name = (char *) 0; - - if (!length_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "length == null"; - goto exit; - } - if (lengthOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "lengthOffset < 0"; - goto exit; - } - _lengthRemaining = _env->GetArrayLength(length_ref) - lengthOffset; - length_base = (GLsizei *) - _env->GetIntArrayElements(length_ref, (jboolean *)0); - length = length_base + lengthOffset; - - if (!size_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "size == null"; - goto exit; - } - if (sizeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sizeOffset < 0"; - goto exit; - } - _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; - size_base = (GLint *) - _env->GetIntArrayElements(size_ref, (jboolean *)0); - size = size_base + sizeOffset; - - if (!type_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "type == null"; - goto exit; - } - if (typeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "typeOffset < 0"; - goto exit; - } - _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; - type_base = (GLenum *) - _env->GetIntArrayElements(type_ref, (jboolean *)0); - type = type_base + typeOffset; - - if (!name_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "name == null"; - goto exit; - } - if (nameOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "nameOffset < 0"; - goto exit; - } - _nameRemaining = _env->GetArrayLength(name_ref) - nameOffset; - name_base = (char *) - _env->GetByteArrayElements(name_ref, (jboolean *)0); - name = name_base + nameOffset; - - glGetTransformFeedbackVarying( - (GLuint)program, - (GLuint)index, - (GLsizei)bufsize, - (GLsizei *)length, - (GLint *)size, - (GLenum *)type, - (char *)name - ); - -exit: - if (name_base) { - _env->ReleaseByteArrayElements(name_ref, (jbyte*)name_base, - _exception ? JNI_ABORT: 0); - } - if (type_base) { - _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, - _exception ? JNI_ABORT: 0); - } - if (size_base) { - _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, - _exception ? JNI_ABORT: 0); - } - if (length_base) { - _env->ReleaseIntArrayElements(length_ref, (jint*)length_base, - _exception ? JNI_ABORT: 0); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ -static void -android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B - (JNIEnv *_env, jobject _this, jint program, jint index, jint bufsize, jobject length_buf, jobject size_buf, jobject type_buf, jbyte name) { - jintArray _lengthArray = (jintArray) 0; - jint _lengthBufferOffset = (jint) 0; - jintArray _sizeArray = (jintArray) 0; - jint _sizeBufferOffset = (jint) 0; - jintArray _typeArray = (jintArray) 0; - jint _typeBufferOffset = (jint) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - length = (GLsizei *)getPointer(_env, length_buf, (jarray*)&_lengthArray, &_lengthRemaining, &_lengthBufferOffset); - size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); - type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); - if (length == NULL) { - char * _lengthBase = (char *)_env->GetIntArrayElements(_lengthArray, (jboolean *) 0); - length = (GLsizei *) (_lengthBase + _lengthBufferOffset); - } - if (size == NULL) { - char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); - size = (GLint *) (_sizeBase + _sizeBufferOffset); - } - if (type == NULL) { - char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); - type = (GLenum *) (_typeBase + _typeBufferOffset); - } - glGetTransformFeedbackVarying( - (GLuint)program, - (GLuint)index, - (GLsizei)bufsize, - (GLsizei *)length, - (GLint *)size, - (GLenum *)type, - // The cast below is incorrect. The driver will end up writing to the - // address specified by name, which will always crash the process since - // it is guaranteed to be in low memory. The additional static_cast - // suppresses the warning for now. http://b/19478262 - (char *)static_cast(name) - ); - if (_typeArray) { - releaseArrayPointer(_env, _typeArray, (jint*)type, JNI_TRUE); - } - if (_sizeArray) { - releaseArrayPointer(_env, _sizeArray, (jint*)size, JNI_TRUE); - } - if (_lengthArray) { - releaseArrayPointer(_env, _lengthArray, (jint*)length, JNI_TRUE); - } -} - -/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ -static jstring -android_glGetTransformFeedbackVarying1 - (JNIEnv *_env, jobject _this, jint program, jint index, jintArray size_ref, jint sizeOffset, jintArray type_ref, jint typeOffset) { - jint _exception = 0; - const char * _exceptionType; - const char * _exceptionMessage; - GLint *size_base = (GLint *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - GLenum *type_base = (GLenum *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - jstring result = 0; - - GLint len = 0; - glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); - if (!len) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(len); - - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - if (!size_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "size == null"; - goto exit; - } - if (sizeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "sizeOffset < 0"; - goto exit; - } - _sizeRemaining = _env->GetArrayLength(size_ref) - sizeOffset; - size_base = (GLint *) - _env->GetIntArrayElements(size_ref, (jboolean *)0); - size = size_base + sizeOffset; - - if (!type_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "type == null"; - goto exit; - } - if (typeOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "typeOffset < 0"; - goto exit; - } - _typeRemaining = _env->GetArrayLength(type_ref) - typeOffset; - type_base = (GLenum *) - _env->GetIntArrayElements(type_ref, (jboolean *)0); - type = type_base + typeOffset; - - glGetTransformFeedbackVarying( - (GLuint)program, - (GLuint)index, - (GLsizei)len, - NULL, - (GLint *)size, - (GLenum *)type, - (char *)buf - ); -exit: - if (type_base) { - _env->ReleaseIntArrayElements(type_ref, (jint*)type_base, - _exception ? JNI_ABORT: 0); - } - if (size_base) { - _env->ReleaseIntArrayElements(size_ref, (jint*)size_base, - _exception ? JNI_ABORT: 0); - } - if (_exception != 1) { - result = _env->NewStringUTF(buf); - } - if (buf) { - free(buf); - } - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } - if (result == 0) { - result = _env->NewStringUTF(""); - } - - return result; -} - -/* void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) */ -static jstring -android_glGetTransformFeedbackVarying2 - (JNIEnv *_env, jobject _this, jint program, jint index, jobject size_buf, jobject type_buf) { - jintArray _sizeArray = (jintArray) 0; - jint _sizeBufferOffset = (jint) 0; - jintArray _typeArray = (jintArray) 0; - jint _typeBufferOffset = (jint) 0; - jint _lengthRemaining; - GLsizei *length = (GLsizei *) 0; - jint _sizeRemaining; - GLint *size = (GLint *) 0; - jint _typeRemaining; - GLenum *type = (GLenum *) 0; - - jstring result = 0; - - GLint len = 0; - glGetProgramiv((GLuint)program, GL_ACTIVE_ATTRIBUTE_MAX_LENGTH, &len); - if (!len) { - return _env->NewStringUTF(""); - } - char* buf = (char*) malloc(len); - - if (buf == NULL) { - jniThrowException(_env, "java/lang/IllegalArgumentException", "out of memory"); - return NULL; - } - - size = (GLint *)getPointer(_env, size_buf, (jarray*)&_sizeArray, &_sizeRemaining, &_sizeBufferOffset); - type = (GLenum *)getPointer(_env, type_buf, (jarray*)&_typeArray, &_typeRemaining, &_typeBufferOffset); - if (size == NULL) { - char * _sizeBase = (char *)_env->GetIntArrayElements(_sizeArray, (jboolean *) 0); - size = (GLint *) (_sizeBase + _sizeBufferOffset); - } - if (type == NULL) { - char * _typeBase = (char *)_env->GetIntArrayElements(_typeArray, (jboolean *) 0); - type = (GLenum *) (_typeBase + _typeBufferOffset); - } - glGetTransformFeedbackVarying( - (GLuint)program, - (GLuint)index, - (GLsizei)len, - NULL, - (GLint *)size, - (GLenum *)type, - (char *)buf - ); - - if (_typeArray) { - releaseArrayPointer(_env, _typeArray, (jint*)type, JNI_TRUE); - } - if (_sizeArray) { - releaseArrayPointer(_env, _sizeArray, (jint*)size, JNI_TRUE); - } - result = _env->NewStringUTF(buf); - if (buf) { - free(buf); - } - return result; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ - // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) - - public static native void glGetTransformFeedbackVarying( - int program, - int index, - int bufsize, - int[] length, - int lengthOffset, - int[] size, - int sizeOffset, - int[] type, - int typeOffset, - byte[] name, - int nameOffset - ); - - // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) - - public static native void glGetTransformFeedbackVarying( - int program, - int index, - int bufsize, - java.nio.IntBuffer length, - java.nio.IntBuffer size, - java.nio.IntBuffer type, - byte name - ); - - // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) - - public static native String glGetTransformFeedbackVarying( - int program, - int index, - int[] size, - int sizeOffset, - int[] type, - int typeOffset - ); - - // C function void glGetTransformFeedbackVarying ( GLuint program, GLuint index, GLsizei bufSize, GLsizei *length, GLint *size, GLenum *type, GLchar *name ) - - public static native String glGetTransformFeedbackVarying( - int program, - int index, - java.nio.IntBuffer size, - java.nio.IntBuffer type - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetTransformFeedbackVarying.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ -{"glGetTransformFeedbackVarying", "(III[II[II[II[BI)V", (void *) android_glGetTransformFeedbackVarying__III_3II_3II_3II_3BI }, -{"glGetTransformFeedbackVarying", "(IIILjava/nio/IntBuffer;Ljava/nio/IntBuffer;Ljava/nio/IntBuffer;B)V", (void *) android_glGetTransformFeedbackVarying__IIILjava_nio_IntBuffer_2Ljava_nio_IntBuffer_2Ljava_nio_IntBuffer_2B }, -{"glGetTransformFeedbackVarying", "(II[II[II)Ljava/lang/String;", (void *) android_glGetTransformFeedbackVarying1 }, -{"glGetTransformFeedbackVarying", "(IILjava/nio/IntBuffer;Ljava/nio/IntBuffer;)Ljava/lang/String;", (void *) android_glGetTransformFeedbackVarying2 }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,154 +0,0 @@ -/* void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) */ -static -void -android_glGetUniformIndices_array - (JNIEnv *_env, jobject _this, jint program, jobjectArray uniformNames_ref, jintArray uniformIndices_ref, jint uniformIndicesOffset) { - jint _exception = 0; - const char* _exceptionType = NULL; - const char* _exceptionMessage = NULL; - jint _count = 0; - jint _i; - const char** _names = NULL; - GLuint* _indices_base = NULL; - GLuint* _indices = NULL; - - if (!uniformNames_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformNames == null"; - goto exit; - } - _count = _env->GetArrayLength(uniformNames_ref); - _names = (const char**)calloc(_count, sizeof(const char*)); - for (_i = 0; _i < _count; _i++) { - jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); - if (!_name) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "null uniformNames element"; - goto exit; - } - _names[_i] = _env->GetStringUTFChars(_name, 0); - } - - if (!uniformIndices_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformIndices == null"; - goto exit; - } - if (uniformIndicesOffset < 0) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformIndicesOffset < 0"; - goto exit; - } - if (_env->GetArrayLength(uniformIndices_ref) - uniformIndicesOffset < _count) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "not enough space in uniformIndices"; - goto exit; - } - _indices_base = (GLuint*)_env->GetIntArrayElements( - uniformIndices_ref, 0); - _indices = _indices_base + uniformIndicesOffset; - - glGetUniformIndices(program, _count, _names, _indices); - -exit: - if (_indices_base) { - _env->ReleaseIntArrayElements(uniformIndices_ref, (jint*)_indices_base, - _exception ? JNI_ABORT : 0); - } - for (_i = _count - 1; _i >= 0; _i--) { - if (_names[_i]) { - jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); - if (_name) { - _env->ReleaseStringUTFChars(_name, _names[_i]); - } - } - } - free(_names); - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - -/* void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) */ -static -void -android_glGetUniformIndices_buffer - (JNIEnv *_env, jobject _this, jint program, jobjectArray uniformNames_ref, jobject uniformIndices_buf) { - jint _exception = 0; - const char* _exceptionType = NULL; - const char* _exceptionMessage = NULL; - jint _count = 0; - jint _i; - const char** _names = NULL; - jintArray _uniformIndicesArray = (jintArray)0; - jint _uniformIndicesRemaining; - jint _uniformIndicesOffset = 0; - GLuint* _indices = NULL; - char* _indicesBase = NULL; - - if (!uniformNames_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformNames == null"; - goto exit; - } - if (!uniformIndices_buf) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "uniformIndices == null"; - goto exit; - } - - _count = _env->GetArrayLength(uniformNames_ref); - _names = (const char**)calloc(_count, sizeof(const char*)); - for (_i = 0; _i < _count; _i++) { - jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); - if (!_name) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "null uniformNames element"; - goto exit; - } - _names[_i] = _env->GetStringUTFChars(_name, 0); - } - - _indices = (GLuint*)getPointer(_env, uniformIndices_buf, - (jarray*)&_uniformIndicesArray, &_uniformIndicesRemaining, - &_uniformIndicesOffset); - if (!_indices) { - _indicesBase = (char*)_env->GetIntArrayElements( - _uniformIndicesArray, 0); - _indices = (GLuint*)(_indicesBase + _uniformIndicesOffset); - } - if (_uniformIndicesRemaining < _count) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "not enough space in uniformIndices"; - goto exit; - } - - glGetUniformIndices(program, _count, _names, _indices); - -exit: - if (_uniformIndicesArray) { - releaseArrayPointer( - _env, _uniformIndicesArray, (jint*)_indicesBase, JNI_TRUE); - } - for (_i = _count - 1; _i >= 0; _i--) { - if (_names[_i]) { - jstring _name = (jstring)_env->GetObjectArrayElement(uniformNames_ref, _i); - if (_name) { - _env->ReleaseStringUTFChars(_name, _names[_i]); - } - } - } - free(_names); - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,17 +0,0 @@ - // C function void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) - - public static native void glGetUniformIndices( - int program, - String[] uniformNames, - int[] uniformIndices, - int uniformIndicesOffset - ); - - // C function void glGetUniformIndices ( GLuint program, GLsizei uniformCount, const GLchar *const *uniformNames, GLuint *uniformIndices ) - - public static native void glGetUniformIndices( - int program, - String[] uniformNames, - java.nio.IntBuffer uniformIndices - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glGetUniformIndices.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1,2 +0,0 @@ -{"glGetUniformIndices", "(I[Ljava/lang/String;[II)V", (void *) android_glGetUniformIndices_array }, -{"glGetUniformIndices", "(I[Ljava/lang/String;Ljava/nio/IntBuffer;)V", (void *) android_glGetUniformIndices_buffer }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glMapBufferRange.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,13 +0,0 @@ -/* GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) */ -static jobject -android_glMapBufferRange__IIII - (JNIEnv *_env, jobject _this, jint target, jint offset, jint length, jint access) { - GLvoid* _p = glMapBufferRange((GLenum)target, - (GLintptr)offset, (GLsizeiptr)length, (GLbitfield)access); - jobject _buf = (jobject)0; - if (_p) { - _buf = _env->NewDirectByteBuffer(_p, length); - } - return _buf; -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glMapBufferRange.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,9 +0,0 @@ - // C function GLvoid * glMapBufferRange ( GLenum target, GLintptr offset, GLsizeiptr length, GLbitfield access ) - - public static native java.nio.Buffer glMapBufferRange( - int target, - int offset, - int length, - int access - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glMapBufferRange.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glMapBufferRange", "(IIII)Ljava/nio/Buffer;", (void *) android_glMapBufferRange__IIII }, \ No newline at end of file diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,6 +0,0 @@ -/* void glObjectPtrLabelKHR ( const void *ptr, GLsizei length, const GLchar *label ) */ -static void -android_glObjectPtrLabelKHR(JNIEnv *_env, jobject _this, jlong ptr, jstring label) { - jniThrowException(_env, "java/lang/UnsupportedOperationException", "not yet implemented"); -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,4 +0,0 @@ - // C function void glObjectPtrLabelKHR ( const void *ptr, GLsizei length, const GLchar *label ) - - public static native void glObjectPtrLabelKHR(long ptr, String label); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glObjectPtrLabelKHR.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glObjectPtrLabelKHR", "(JLjava/lang/String;)V", (void *) android_glObjectPtrLabelKHR }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glShaderSource.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glShaderSource.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glShaderSource.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glShaderSource.java 2012-10-16 22:57:11.000000000 +0000 @@ -1,3 +1,19 @@ +/* + * Copyright (C) 2009 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. + */ + // C function void glShaderSource ( GLuint shader, GLsizei count, const GLchar ** string, const GLint* length ) public static native void glShaderSource( diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -/* void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) */ -static -void -android_glTransformFeedbackVaryings - (JNIEnv *_env, jobject _this, jint program, jobjectArray varyings_ref, jint bufferMode) { - jint _exception = 0; - const char* _exceptionType = NULL; - const char* _exceptionMessage = NULL; - jint _count = 0, _i; - const char** _varyings = NULL; - const char* _varying = NULL; - - if (!varyings_ref) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "varyings == null"; - goto exit; - } - - _count = _env->GetArrayLength(varyings_ref); - _varyings = (const char**)calloc(_count, sizeof(const char*)); - for (_i = 0; _i < _count; _i++) { - jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i); - if (!_varying) { - _exception = 1; - _exceptionType = "java/lang/IllegalArgumentException"; - _exceptionMessage = "null varyings element"; - goto exit; - } - _varyings[_i] = _env->GetStringUTFChars(_varying, 0); - } - - glTransformFeedbackVaryings(program, _count, _varyings, bufferMode); - -exit: - for (_i = _count - 1; _i >= 0; _i--) { - if (_varyings[_i]) { - jstring _varying = (jstring)_env->GetObjectArrayElement(varyings_ref, _i); - if (_varying) { - _env->ReleaseStringUTFChars(_varying, _varyings[_i]); - } - } - } - free(_varyings); - if (_exception) { - jniThrowException(_env, _exceptionType, _exceptionMessage); - } -} - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.java 1970-01-01 00:00:00.000000000 +0000 @@ -1,8 +0,0 @@ - // C function void glTransformFeedbackVaryings ( GLuint program, GLsizei count, const GLchar *varyings, GLenum bufferMode ) - - public static native void glTransformFeedbackVaryings( - int program, - String[] varyings, - int bufferMode - ); - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/gles11/glTransformFeedbackVaryings.nativeReg 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -{"glTransformFeedbackVaryings", "(I[Ljava/lang/String;I)V", (void *) android_glTransformFeedbackVaryings }, diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp android-platform-frameworks-native-21/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/jsr239/GLCHeader.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,10 +16,6 @@ // This source file is automatically generated -#pragma GCC diagnostic ignored "-Wunused-variable" -#pragma GCC diagnostic ignored "-Wunused-but-set-variable" -#pragma GCC diagnostic ignored "-Wunused-function" - #include "jni.h" #include "JNIHelp.h" #include @@ -117,12 +113,14 @@ } static void * -getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining, jint *offset) +getPointer(JNIEnv *_env, jobject buffer, jarray *array, jint *remaining) { jint position; jint limit; jint elementSizeShift; jlong pointer; + jint offset; + void *data; position = _env->GetIntField(buffer, positionID); limit = _env->GetIntField(buffer, limitID); @@ -132,7 +130,7 @@ getBasePointerID, buffer); if (pointer != 0L) { *array = NULL; - return reinterpret_cast(pointer); + return (void *) (jint) pointer; } *array = (jarray) _env->CallStaticObjectMethod(nioAccessClass, @@ -140,10 +138,11 @@ if (*array == NULL) { return (void*) NULL; } - *offset = _env->CallStaticIntMethod(nioAccessClass, + offset = _env->CallStaticIntMethod(nioAccessClass, getBaseArrayOffsetID, buffer); + data = _env->GetPrimitiveArrayCritical(*array, (jboolean *) 0); - return NULL; + return (void *) ((char *) data + offset); } static void @@ -181,12 +180,10 @@ if (allowIndirectBuffers(_env)) { jarray array = 0; jint remaining; - jint offset; - buf = getPointer(_env, buffer, &array, &remaining, &offset); + buf = getPointer(_env, buffer, &array, &remaining); if (array) { releasePointer(_env, array, buf, 0); } - buf = (char*)buf + offset; } else { jniThrowException(_env, "java/lang/IllegalArgumentException", "Must use a native order direct Buffer"); diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl android-platform-frameworks-native-21/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen/stubs/jsr239/GLImplHeader.java-impl 2012-10-16 22:57:11.000000000 +0000 @@ -22,7 +22,6 @@ import android.content.pm.ApplicationInfo; import android.content.pm.IPackageManager; import android.os.Build; -import android.os.UserHandle; import android.util.Log; import java.nio.Buffer; @@ -38,7 +37,7 @@ native private static void _nativeClassInit(); static { - _nativeClassInit(); + _nativeClassInit(); } Buffer _colorPointer = null; @@ -67,7 +66,7 @@ int version = 0; IPackageManager pm = AppGlobals.getPackageManager(); try { - ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0, UserHandle.myUserId()); + ApplicationInfo applicationInfo = pm.getApplicationInfo(appName, 0); if (applicationInfo != null) { version = applicationInfo.targetSdkVersion; } diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/.gitignore android-platform-frameworks-native-21/opengl/tools/glgen2/.gitignore --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/.gitignore 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen2/.gitignore 1970-01-01 00:00:00.000000000 +0000 @@ -1 +0,0 @@ -registry/reg.pyc diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/glgen.py android-platform-frameworks-native-21/opengl/tools/glgen2/glgen.py --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/glgen.py 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen2/glgen.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,328 +0,0 @@ -#!/usr/bin/env python -# -# Copyright 2014 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. - -from __future__ import print_function -from operator import itemgetter -import collections -import os.path -import re -import sys - - -# Avoid endlessly adding to the path if this module is imported multiple -# times, e.g. in an interactive session -regpath = os.path.join(sys.path[0], "registry") -if sys.path[1] != regpath: - sys.path.insert(1, regpath) -import reg - - -AEP_EXTENSIONS = [ - 'GL_KHR_blend_equation_advanced', - 'GL_KHR_debug', - 'GL_KHR_texture_compression_astc_ldr', - 'GL_OES_sample_shading', - 'GL_OES_sample_variables', - 'GL_OES_shader_image_atomic', - 'GL_OES_shader_multisample_interpolation', - 'GL_OES_texture_stencil8', - 'GL_OES_texture_storage_multisample_2d_array', - 'GL_EXT_copy_image', - 'GL_EXT_draw_buffers_indexed', - 'GL_EXT_geometry_shader', - 'GL_EXT_gpu_shader5', - 'GL_EXT_primitive_bounding_box', - 'GL_EXT_shader_io_blocks', - 'GL_EXT_tessellation_shader', - 'GL_EXT_texture_border_clamp', - 'GL_EXT_texture_buffer', - 'GL_EXT_texture_cube_map_array', - 'GL_EXT_texture_sRGB_decode'] - - -def nonestr(s): - return s if s else "" - - -def parseTypedName(elem): - type = [nonestr(elem.text)] - name = None - for subelem in elem: - text = nonestr(subelem.text) - tail = nonestr(subelem.tail) - if subelem.tag == 'name': - name = text - break - else: - type.extend([text, tail]) - return (''.join(type).strip(), name) - - -# Format a list of (type, name) tuples as a C-style parameter list -def fmtParams(params): - if not params: - return 'void' - return ', '.join(['%s %s' % (p[0], p[1]) for p in params]) - -# Format a list of (type, name) tuples as a C-style argument list -def fmtArgs(params): - return ', '.join(p[1] for p in params) - -# Format a list of (type, name) tuples as comma-separated '"type", name' -def fmtTypeNameList(params): - return ', '.join(['"%s", %s' % (p[0], p[1]) for p in params]) - - -def overrideSymbolName(sym, apiname): - # The wrapper intercepts various glGet and glGetString functions and - # (sometimes) calls the generated thunk which dispatches to the - # driver's implementation - wrapped_get_syms = { - 'gles1' : [ - 'glGetString' - ], - 'gles2' : [ - 'glGetString', - 'glGetStringi', - 'glGetBooleanv', - 'glGetFloatv', - 'glGetIntegerv', - 'glGetInteger64v', - ], - } - if sym in wrapped_get_syms.get(apiname): - return '__' + sym - else: - return sym - - -# Generate API trampoline templates: -# API_ENTRY()() { -# CALL_GL_API(, ); -# // or -# CALL_GL_API_RETURN(, ); -# } -class TrampolineGen(reg.OutputGenerator): - def __init__(self): - reg.OutputGenerator.__init__(self, sys.stderr, sys.stderr, None) - - def genCmd(self, cmd, name): - reg.OutputGenerator.genCmd(self, cmd, name) - - rtype, fname = parseTypedName(cmd.elem.find('proto')) - params = [parseTypedName(p) for p in cmd.elem.findall('param')] - - call = 'CALL_GL_API' if rtype == 'void' else 'CALL_GL_API_RETURN' - print('%s API_ENTRY(%s)(%s) {\n' - ' %s(%s%s%s);\n' - '}' - % (rtype, overrideSymbolName(fname, self.genOpts.apiname), - fmtParams(params), call, fname, - ', ' if len(params) > 0 else '', - fmtArgs(params)), - file=self.outFile) - - - -# Collect all API prototypes across all families, remove duplicates, -# emit to entries.in and trace.in files. -class ApiGenerator(reg.OutputGenerator): - def __init__(self): - reg.OutputGenerator.__init__(self, sys.stderr, sys.stderr, None) - self.cmds = [] - self.enums = collections.OrderedDict() - - def genCmd(self, cmd, name): - reg.OutputGenerator.genCmd(self, cmd, name) - rtype, fname = parseTypedName(cmd.elem.find('proto')) - params = [parseTypedName(p) for p in cmd.elem.findall('param')] - self.cmds.append({'rtype': rtype, 'name': fname, 'params': params}) - - def genEnum(self, enuminfo, name): - reg.OutputGenerator.genEnum(self, enuminfo, name) - value = enuminfo.elem.get('value') - - # Skip bitmask enums. Pattern matches: - # - GL_DEPTH_BUFFER_BIT - # - GL_MAP_INVALIDATE_BUFFER_BIT_EXT - # - GL_COLOR_BUFFER_BIT1_QCOM - # but not - # - GL_DEPTH_BITS - # - GL_QUERY_COUNTER_BITS_EXT - # - # TODO: Assuming a naming pattern and using a regex is what the - # old glenumsgen script did. But the registry XML knows which enums are - # parts of bitmask groups, so we should just use that. I'm not sure how - # to get the information out though, and it's not critical right now, - # so leaving for later. - if re.search('_BIT($|\d*_)', name): - return - - # Skip non-hex values (GL_TRUE, GL_FALSE, header guard junk) - if not re.search('0x[0-9A-Fa-f]+', value): - return - - # Append 'u' or 'ull' type suffix if present - type = enuminfo.elem.get('type') - if type and type != 'i': - value += type - - if value not in self.enums: - self.enums[value] = name - - def finish(self): - # sort by function name, remove duplicates - self.cmds.sort(key=itemgetter('name')) - cmds = [] - for cmd in self.cmds: - if len(cmds) == 0 or cmd != cmds[-1]: - cmds.append(cmd) - self.cmds = cmds - - # Write entries.in - def writeEntries(self, outfile): - for cmd in self.cmds: - print('GL_ENTRY(%s, %s, %s)' - % (cmd['rtype'], cmd['name'], fmtParams(cmd['params'])), - file=outfile) - - # Write traces.in - def writeTrace(self, outfile): - for cmd in self.cmds: - if cmd['rtype'] == 'void': - ret = '_VOID(' - else: - ret = '(%s, ' % cmd['rtype'] - - params = cmd['params'] - if len(params) > 0: - typeNameList = ', ' + fmtTypeNameList(params) - else: - typeNameList = '' - - print('TRACE_GL%s%s, (%s), (%s), %d%s)' - % (ret, cmd['name'], - fmtParams(params), fmtArgs(params), - len(params), typeNameList), - file=outfile) - - # Write enums.in - def writeEnums(self, outfile): - for enum in self.enums.iteritems(): - print('GL_ENUM(%s,%s)' % (enum[0], enum[1]), file=outfile) - - -# Generate .spec entries for use by legacy 'gen' script -class SpecGenerator(reg.OutputGenerator): - def __init__(self): - reg.OutputGenerator.__init__(self, sys.stderr, sys.stderr, None) - - def genCmd(self, cmd, name): - reg.OutputGenerator.genCmd(self, cmd, name) - rtype, fname = parseTypedName(cmd.elem.find('proto')) - params = [parseTypedName(p) for p in cmd.elem.findall('param')] - - print('%s %s ( %s )' % (rtype, fname, fmtParams(params)), - file=self.outFile) - - -if __name__ == '__main__': - registry = reg.Registry() - registry.loadFile('registry/gl.xml') - - registry.setGenerator(TrampolineGen()) - TRAMPOLINE_OPTIONS = [ - reg.GeneratorOptions( - apiname = 'gles1', - profile = 'common', - filename = '../../libs/GLES_CM/gl_api.in'), - reg.GeneratorOptions( - apiname = 'gles1', - profile = 'common', - emitversions = None, - defaultExtensions = 'gles1', - filename = '../../libs/GLES_CM/glext_api.in'), - reg.GeneratorOptions( - apiname = 'gles2', - profile = 'common', - filename = '../../libs/GLES2/gl2_api.in'), - reg.GeneratorOptions( - apiname = 'gles2', - profile = 'common', - emitversions = None, - defaultExtensions = 'gles2', - filename = '../../libs/GLES2/gl2ext_api.in')] - for opts in TRAMPOLINE_OPTIONS: - registry.apiGen(opts) - - apigen = ApiGenerator() - registry.setGenerator(apigen) - API_OPTIONS = [ - # Generate non-extension versions of each API first, then extensions, - # so that if an extension enum was later standardized, we see the non- - # suffixed version first. - reg.GeneratorOptions( - apiname = 'gles1', - profile = 'common'), - reg.GeneratorOptions( - apiname = 'gles2', - profile = 'common'), - reg.GeneratorOptions( - apiname = 'gles1', - profile = 'common', - emitversions = None, - defaultExtensions = 'gles1'), - reg.GeneratorOptions( - apiname = 'gles2', - profile = 'common', - emitversions = None, - defaultExtensions = 'gles2')] - for opts in API_OPTIONS: - registry.apiGen(opts) - apigen.finish() - with open('../../libs/entries.in', 'w') as f: - apigen.writeEntries(f) - with open('../../libs/trace.in', 'w') as f: - apigen.writeTrace(f) - with open('../../libs/enums.in', 'w') as f: - apigen.writeEnums(f) - - registry.setGenerator(SpecGenerator()) - SPEC_OPTIONS = [ - reg.GeneratorOptions( - apiname = 'gles2', - profile = 'common', - versions = '3\.1', - filename = '../glgen/specs/gles11/GLES31.spec'), - reg.GeneratorOptions( - apiname = 'gles2', - profile = 'common', - emitversions = None, - defaultExtensions = None, - addExtensions = '^({})$'.format('|'.join(AEP_EXTENSIONS)), - filename = '../glgen/specs/gles11/GLES31Ext.spec')] - # SpecGenerator creates a good starting point, but the CFunc.java parser is - # so terrible that the .spec file needs a lot of manual massaging before - # it works. Commenting this out to avoid accidentally overwriting all the - # manual modifications. - # - # Eventually this script should generate the Java and JNI code directly, - # skipping the intermediate .spec step, and obsoleting the existing - # ../glgen system. - # - # for opts in SPEC_OPTIONS: - # registry.apiGen(opts) - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/egl.xml android-platform-frameworks-native-21/opengl/tools/glgen2/registry/egl.xml --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/egl.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen2/registry/egl.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,1966 +0,0 @@ - - - - - - - - - #include <KHR/khrplatform.h> - #include <EGL/eglplatform.h> - - - - - - - - - - - - - - typedef unsigned int EGLBoolean; - typedef unsigned int EGLenum; - typedef intptr_t EGLAttribKHR; - typedef intptr_t EGLAttrib; - typedef void *EGLConfig; - typedef void *EGLContext; - typedef void *EGLDisplay; - typedef void *EGLSurface; - typedef void *EGLClientBuffer; - typedef void (*__eglMustCastToProperFunctionPointerType)(void); - typedef void *EGLImageKHR; - typedef void *EGLImage; - typedef void *EGLSyncKHR; - typedef void *EGLSync; - typedef khronos_utime_nanoseconds_t EGLTimeKHR; - typedef khronos_utime_nanoseconds_t EGLTime; - typedef void *EGLSyncNV; - typedef khronos_utime_nanoseconds_t EGLTimeNV; - typedef khronos_utime_nanoseconds_t EGLuint64NV; - typedef void *EGLStreamKHR; - typedef khronos_uint64_t EGLuint64KHR; - typedef int EGLNativeFileDescriptorKHR; - typedef khronos_ssize_t EGLsizeiANDROID; - typedef void (*EGLSetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, const void *value, EGLsizeiANDROID valueSize); - typedef EGLsizeiANDROID (*EGLGetBlobFuncANDROID) (const void *key, EGLsizeiANDROID keySize, void *value, EGLsizeiANDROID valueSize); - struct EGLClientPixmapHI { - void *pData; - EGLint iWidth; - EGLint iHeight; - EGLint iStride; -}; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - EGLBoolean eglBindAPI - EGLenum api - - - EGLBoolean eglBindTexImage - EGLDisplay dpy - EGLSurface surface - EGLint buffer - - - EGLBoolean eglChooseConfig - EGLDisplay dpy - const EGLint *attrib_list - EGLConfig *configs - EGLint config_size - EGLint *num_config - - - EGLint eglClientWaitSync - EGLDisplay dpy - EGLSync sync - EGLint flags - EGLTime timeout - - - EGLint eglClientWaitSyncKHR - EGLDisplay dpy - EGLSyncKHR sync - EGLint flags - EGLTimeKHR timeout - - - - EGLint eglClientWaitSyncNV - EGLSyncNV sync - EGLint flags - EGLTimeNV timeout - - - EGLBoolean eglCopyBuffers - EGLDisplay dpy - EGLSurface surface - EGLNativePixmapType target - - - EGLContext eglCreateContext - EGLDisplay dpy - EGLConfig config - EGLContext share_context - const EGLint *attrib_list - - - EGLImageKHR eglCreateDRMImageMESA - EGLDisplay dpy - const EGLint *attrib_list - - - EGLSyncNV eglCreateFenceSyncNV - EGLDisplay dpy - EGLenum condition - const EGLint *attrib_list - - - EGLImageKHR eglCreateImageKHR - EGLDisplay dpy - EGLContext ctx - EGLenum target - EGLClientBuffer buffer - const EGLint *attrib_list - - - EGLSurface eglCreatePbufferFromClientBuffer - EGLDisplay dpy - EGLenum buftype - EGLClientBuffer buffer - EGLConfig config - const EGLint *attrib_list - - - EGLSurface eglCreatePbufferSurface - EGLDisplay dpy - EGLConfig config - const EGLint *attrib_list - - - EGLSurface eglCreatePixmapSurface - EGLDisplay dpy - EGLConfig config - EGLNativePixmapType pixmap - const EGLint *attrib_list - - - EGLSurface eglCreatePixmapSurfaceHI - EGLDisplay dpy - EGLConfig config - struct EGLClientPixmapHI *pixmap - - - EGLSurface eglCreatePlatformPixmapSurface - EGLDisplay dpy - EGLConfig config - void *native_pixmap - const EGLAttrib *attrib_list - - - EGLSurface eglCreatePlatformPixmapSurfaceEXT - EGLDisplay dpy - EGLConfig config - void *native_pixmap - const EGLint *attrib_list - - - EGLSurface eglCreatePlatformWindowSurface - EGLDisplay dpy - EGLConfig config - void *native_window - const EGLAttrib *attrib_list - - - EGLSurface eglCreatePlatformWindowSurfaceEXT - EGLDisplay dpy - EGLConfig config - void *native_window - const EGLint *attrib_list - - - EGLStreamKHR eglCreateStreamFromFileDescriptorKHR - EGLDisplay dpy - EGLNativeFileDescriptorKHR file_descriptor - - - EGLStreamKHR eglCreateStreamKHR - EGLDisplay dpy - const EGLint *attrib_list - - - EGLSurface eglCreateStreamProducerSurfaceKHR - EGLDisplay dpy - EGLConfig config - EGLStreamKHR stream - const EGLint *attrib_list - - - EGLSyncKHR eglCreateStreamSyncNV - EGLDisplay dpy - EGLStreamKHR stream - EGLenum type - const EGLint *attrib_list - - - EGLSync eglCreateSync - EGLDisplay dpy - EGLenum type - const EGLAttrib *attrib_list - - - EGLSyncKHR eglCreateSyncKHR - EGLDisplay dpy - EGLenum type - const EGLint *attrib_list - - - EGLSyncKHR eglCreateSync64KHR - EGLDisplay dpy - EGLenum type - const EGLAttribKHR *attrib_list - - - - EGLSurface eglCreateWindowSurface - EGLDisplay dpy - EGLConfig config - EGLNativeWindowType win - const EGLint *attrib_list - - - EGLBoolean eglDestroyContext - EGLDisplay dpy - EGLContext ctx - - - EGLBoolean eglDestroyImageKHR - EGLDisplay dpy - EGLImageKHR image - - - EGLBoolean eglDestroyStreamKHR - EGLDisplay dpy - EGLStreamKHR stream - - - EGLBoolean eglDestroySurface - EGLDisplay dpy - EGLSurface surface - - - EGLBoolean eglDestroySync - EGLDisplay dpy - EGLSync sync - - - EGLBoolean eglDestroySyncKHR - EGLDisplay dpy - EGLSyncKHR sync - - - - EGLBoolean eglDestroySyncNV - EGLSyncNV sync - - - EGLint eglDupNativeFenceFDANDROID - EGLDisplay dpy - EGLSyncKHR sync - - - EGLBoolean eglExportDRMImageMESA - EGLDisplay dpy - EGLImageKHR image - EGLint *name - EGLint *handle - EGLint *stride - - - EGLBoolean eglFenceNV - EGLSyncNV sync - - - EGLBoolean eglGetConfigAttrib - EGLDisplay dpy - EGLConfig config - EGLint attribute - EGLint *value - - - EGLBoolean eglGetConfigs - EGLDisplay dpy - EGLConfig *configs - EGLint config_size - EGLint *num_config - - - EGLContext eglGetCurrentContext - - - EGLDisplay eglGetCurrentDisplay - - - EGLSurface eglGetCurrentSurface - EGLint readdraw - - - EGLDisplay eglGetDisplay - EGLNativeDisplayType display_id - - - EGLint eglGetError - - - EGLDisplay eglGetPlatformDisplay - EGLenum platform - void *native_display - const EGLAttrib *attrib_list - - - EGLDisplay eglGetPlatformDisplayEXT - EGLenum platform - void *native_display - const EGLint *attrib_list - - - __eglMustCastToProperFunctionPointerType eglGetProcAddress - const char *procname - - - EGLNativeFileDescriptorKHR eglGetStreamFileDescriptorKHR - EGLDisplay dpy - EGLStreamKHR stream - - - EGLBoolean eglGetSyncAttrib - EGLDisplay dpy - EGLSync sync - EGLint attribute - EGLAttrib *value - - - EGLBoolean eglGetSyncAttribKHR - EGLDisplay dpy - EGLSyncKHR sync - EGLint attribute - EGLint *value - - - EGLBoolean eglGetSyncAttribNV - EGLSyncNV sync - EGLint attribute - EGLint *value - - - EGLuint64NV eglGetSystemTimeFrequencyNV - - - EGLuint64NV eglGetSystemTimeNV - - - EGLBoolean eglInitialize - EGLDisplay dpy - EGLint *major - EGLint *minor - - - EGLBoolean eglLockSurfaceKHR - EGLDisplay dpy - EGLSurface surface - const EGLint *attrib_list - - - EGLBoolean eglMakeCurrent - EGLDisplay dpy - EGLSurface draw - EGLSurface read - EGLContext ctx - - - EGLBoolean eglPostSubBufferNV - EGLDisplay dpy - EGLSurface surface - EGLint x - EGLint y - EGLint width - EGLint height - - - EGLenum eglQueryAPI - - - EGLBoolean eglQueryContext - EGLDisplay dpy - EGLContext ctx - EGLint attribute - EGLint *value - - - EGLBoolean eglQueryNativeDisplayNV - EGLDisplay dpy - EGLNativeDisplayType *display_id - - - EGLBoolean eglQueryNativePixmapNV - EGLDisplay dpy - EGLSurface surf - EGLNativePixmapType *pixmap - - - EGLBoolean eglQueryNativeWindowNV - EGLDisplay dpy - EGLSurface surf - EGLNativeWindowType *window - - - EGLBoolean eglQueryStreamKHR - EGLDisplay dpy - EGLStreamKHR stream - EGLenum attribute - EGLint *value - - - EGLBoolean eglQueryStreamTimeKHR - EGLDisplay dpy - EGLStreamKHR stream - EGLenum attribute - EGLTimeKHR *value - - - EGLBoolean eglQueryStreamu64KHR - EGLDisplay dpy - EGLStreamKHR stream - EGLenum attribute - EGLuint64KHR *value - - - const char *eglQueryString - EGLDisplay dpy - EGLint name - - - EGLBoolean eglQuerySurface - EGLDisplay dpy - EGLSurface surface - EGLint attribute - EGLint *value - - - EGLBoolean eglQuerySurface64KHR - EGLDisplay dpy - EGLSurface surface - EGLint attribute - EGLAttribKHR *value - - - EGLBoolean eglQuerySurfacePointerANGLE - EGLDisplay dpy - EGLSurface surface - EGLint attribute - void **value - - - EGLBoolean eglReleaseTexImage - EGLDisplay dpy - EGLSurface surface - EGLint buffer - - - EGLBoolean eglReleaseThread - - - void eglSetBlobCacheFuncsANDROID - EGLDisplay dpy - EGLSetBlobFuncANDROID set - EGLGetBlobFuncANDROID get - - - EGLBoolean eglSignalSyncKHR - EGLDisplay dpy - EGLSyncKHR sync - EGLenum mode - - - EGLBoolean eglSignalSyncNV - EGLSyncNV sync - EGLenum mode - - - EGLBoolean eglStreamAttribKHR - EGLDisplay dpy - EGLStreamKHR stream - EGLenum attribute - EGLint value - - - EGLBoolean eglStreamConsumerAcquireKHR - EGLDisplay dpy - EGLStreamKHR stream - - - EGLBoolean eglStreamConsumerGLTextureExternalKHR - EGLDisplay dpy - EGLStreamKHR stream - - - EGLBoolean eglStreamConsumerReleaseKHR - EGLDisplay dpy - EGLStreamKHR stream - - - EGLBoolean eglSurfaceAttrib - EGLDisplay dpy - EGLSurface surface - EGLint attribute - EGLint value - - - EGLBoolean eglSwapBuffers - EGLDisplay dpy - EGLSurface surface - - - EGLBoolean eglSwapBuffersWithDamageEXT - EGLDisplay dpy - EGLSurface surface - EGLint *rects - EGLint n_rects - - - EGLBoolean eglSwapBuffersRegionNOK - EGLDisplay dpy - EGLSurface surface - EGLint numRects - const EGLint *rects - - - EGLBoolean eglSwapBuffersRegion2NOK - EGLDisplay dpy - EGLSurface surface - EGLint numRects - const EGLint *rects - - - EGLBoolean eglSwapInterval - EGLDisplay dpy - EGLint interval - - - EGLBoolean eglTerminate - EGLDisplay dpy - - - EGLBoolean eglUnlockSurfaceKHR - EGLDisplay dpy - EGLSurface surface - - - EGLBoolean eglWaitClient - - - EGLBoolean eglWaitGL - - - EGLBoolean eglWaitNative - EGLint engine - - - EGLBoolean eglWaitSync - EGLDisplay dpy - EGLSync sync - EGLint flags - - - EGLint eglWaitSyncKHR - EGLDisplay dpy - EGLSyncKHR sync - EGLint flags - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/genheaders.py android-platform-frameworks-native-21/opengl/tools/glgen2/registry/genheaders.py --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/genheaders.py 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen2/registry/genheaders.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,578 +0,0 @@ -#!/usr/bin/env python -# -# Copyright (c) 2013-2014 The Khronos Group Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and/or associated documentation files (the -# "Materials"), to deal in the Materials without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Materials, and to -# permit persons to whom the Materials are furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Materials. -# -# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - -import sys, time, pdb, string, cProfile -from reg import * - -# debug - start header generation in debugger -# dump - dump registry after loading -# profile - enable Python profiling -# protect - whether to use #ifndef protections -# registry - use specified XML registry instead of gl.xml -# target - string name of target header, or all targets if None -# timeit - time length of registry loading & header generation -# validate - validate return & parameter group tags against -debug = False -dump = False -profile = False -protect = True -target = None -timeit = False -validate= False -# Default input / log files -errFilename = None -diagFilename = 'diag.txt' -regFilename = 'gl.xml' - -if __name__ == '__main__': - i = 1 - while (i < len(sys.argv)): - arg = sys.argv[i] - i = i + 1 - if (arg == '-debug'): - write('Enabling debug (-debug)', file=sys.stderr) - debug = True - elif (arg == '-dump'): - write('Enabling dump (-dump)', file=sys.stderr) - dump = True - elif (arg == '-noprotect'): - write('Disabling inclusion protection in output headers', file=sys.stderr) - protect = False - elif (arg == '-profile'): - write('Enabling profiling (-profile)', file=sys.stderr) - profile = True - elif (arg == '-registry'): - regFilename = sys.argv[i] - i = i+1 - write('Using registry ', regFilename, file=sys.stderr) - elif (arg == '-time'): - write('Enabling timing (-time)', file=sys.stderr) - timeit = True - elif (arg == '-validate'): - write('Enabling group validation (-validate)', file=sys.stderr) - validate = True - elif (arg[0:1] == '-'): - write('Unrecognized argument:', arg, file=sys.stderr) - exit(1) - else: - target = arg - write('Using target', target, file=sys.stderr) - -# Simple timer functions -startTime = None -def startTimer(): - global startTime - startTime = time.clock() -def endTimer(msg): - global startTime - endTime = time.clock() - if (timeit): - write(msg, endTime - startTime) - startTime = None - -# Load & parse registry -reg = Registry() - -startTimer() -tree = etree.parse(regFilename) -endTimer('Time to make ElementTree =') - -startTimer() -reg.loadElementTree(tree) -endTimer('Time to parse ElementTree =') - -if (validate): - reg.validateGroups() - -if (dump): - write('***************************************') - write('Performing Registry dump to regdump.txt') - write('***************************************') - reg.dumpReg(filehandle = open('regdump.txt','w')) - -# Turn a list of strings into a regexp string matching exactly those strings -def makeREstring(list): - return '^(' + '|'.join(list) + ')$' - -# These are "mandatory" OpenGL ES 1 extensions, to -# be included in the core GLES/gl.h header. -es1CoreList = [ - 'GL_OES_read_format', - 'GL_OES_compressed_paletted_texture', - 'GL_OES_point_size_array', - 'GL_OES_point_sprite' -] - -# Descriptive names for various regexp patterns used to select -# versions and extensions - -allVersions = allExtensions = '.*' -noVersions = noExtensions = None -gl12andLaterPat = '1\.[2-9]|[234]\.[0-9]' -gles2onlyPat = '2\.[0-9]' -gles2and30Pat = '2\.[0-9]|3.0' -gles2and30and31Pat = '2.[0-9]|3.[01]' -es1CorePat = makeREstring(es1CoreList) -# Extensions in old glcorearb.h but not yet tagged accordingly in gl.xml -glCoreARBPat = None -glx13andLaterPat = '1\.[3-9]' - -# Copyright text prefixing all headers (list of strings). -prefixStrings = [ - '/*', - '** Copyright (c) 2013-2014 The Khronos Group Inc.', - '**', - '** Permission is hereby granted, free of charge, to any person obtaining a', - '** copy of this software and/or associated documentation files (the', - '** "Materials"), to deal in the Materials without restriction, including', - '** without limitation the rights to use, copy, modify, merge, publish,', - '** distribute, sublicense, and/or sell copies of the Materials, and to', - '** permit persons to whom the Materials are furnished to do so, subject to', - '** the following conditions:', - '**', - '** The above copyright notice and this permission notice shall be included', - '** in all copies or substantial portions of the Materials.', - '**', - '** THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,', - '** EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF', - '** MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.', - '** IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY', - '** CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,', - '** TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE', - '** MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS.', - '*/', - '/*', - '** This header is generated from the Khronos OpenGL / OpenGL ES XML', - '** API Registry. The current version of the Registry, generator scripts', - '** used to make the header, and the header can be found at', - '** http://www.opengl.org/registry/', - '**', - '** Khronos $' + 'Revision$ on $' + 'Date$', - '*/', - '' -] - -# glext.h / glcorearb.h define calling conventions inline (no GL *platform.h) -glExtPlatformStrings = [ - '#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)', - '#ifndef WIN32_LEAN_AND_MEAN', - '#define WIN32_LEAN_AND_MEAN 1', - '#endif', - '#include ', - '#endif', - '', - '#ifndef APIENTRY', - '#define APIENTRY', - '#endif', - '#ifndef APIENTRYP', - '#define APIENTRYP APIENTRY *', - '#endif', - '#ifndef GLAPI', - '#define GLAPI extern', - '#endif', - '' -] - -glCorearbPlatformStrings = glExtPlatformStrings + [ - '/* glcorearb.h is for use with OpenGL core profile implementations.', - '** It should should be placed in the same directory as gl.h and', - '** included as .', - '**', - '** glcorearb.h includes only APIs in the latest OpenGL core profile', - '** implementation together with APIs in newer ARB extensions which ', - '** can be supported by the core profile. It does not, and never will', - '** include functionality removed from the core profile, such as', - '** fixed-function vertex and fragment processing.', - '**', - '** Do not #include both and either of or', - '** in the same source file.', - '*/', - '' -] - -# wglext.h needs Windows include -wglPlatformStrings = [ - '#if defined(_WIN32) && !defined(APIENTRY) && !defined(__CYGWIN__) && !defined(__SCITECH_SNAP__)', - '#define WIN32_LEAN_AND_MEAN 1', - '#include ', - '#endif', - '', -] - -# GLES 1/2/3 core .h have separate *platform.h files to define calling conventions -gles1PlatformStrings = [ '#include ', '' ] -gles2PlatformStrings = [ '#include ', '' ] -gles3PlatformStrings = [ '#include ', '' ] -eglPlatformStrings = [ '#include ', '' ] - -# GLES 1/2 extension .h have small addition to calling convention headers -gles1ExtPlatformStrings = gles2ExtPlatformStrings = [ - '#ifndef GL_APIENTRYP', - '#define GL_APIENTRYP GL_APIENTRY*', - '#endif', - '' -] - -# Insert generation date in a comment for headers not having *GLEXT_VERSION macros -genDateCommentString = [ - format("/* Generated on date %s */" % time.strftime("%Y%m%d")), - '' -] - -# GL_GLEXT_VERSION is defined only in glext.h -glextVersionStrings = [ - format("#define GL_GLEXT_VERSION %s" % time.strftime("%Y%m%d")), - '' -] -# WGL_WGLEXT_VERSION is defined only in wglext.h -wglextVersionStrings = [ - format("#define WGL_WGLEXT_VERSION %s" % time.strftime("%Y%m%d")), - '' -] -# GLX_GLXEXT_VERSION is defined only in glxext.h -glxextVersionStrings = [ - format("#define GLX_GLXEXT_VERSION %s" % time.strftime("%Y%m%d")), - '' -] -# EGL_EGLEXT_VERSION is defined only in eglext.h -eglextVersionStrings = [ - format("#define EGL_EGLEXT_VERSION %s" % time.strftime("%Y%m%d")), - '' -] - -# Defaults for generating re-inclusion protection wrappers (or not) -protectFile = protect -protectFeature = protect -protectProto = protect - -buildList = [ - # GL API 1.2+ + extensions - GL/glext.h - CGeneratorOptions( - filename = 'GL/glext.h', - apiname = 'gl', - profile = 'compatibility', - versions = allVersions, - emitversions = gl12andLaterPat, - defaultExtensions = 'gl', # Default extensions for GL - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + glExtPlatformStrings + glextVersionStrings, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GLAPI ', - apientry = 'APIENTRY ', - apientryp = 'APIENTRYP '), - # GL core profile + extensions - GL/glcorearb.h - CGeneratorOptions( - filename = 'GL/glcorearb.h', - apiname = 'gl', - profile = 'core', - versions = allVersions, - emitversions = allVersions, - defaultExtensions = 'glcore', # Default extensions for GL core profile (only) - addExtensions = glCoreARBPat, - removeExtensions = None, - prefixText = prefixStrings + glCorearbPlatformStrings, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GLAPI ', - apientry = 'APIENTRY ', - apientryp = 'APIENTRYP '), - # GLES 1.x API + mandatory extensions - GLES/gl.h (no function pointers) - CGeneratorOptions( - filename = 'GLES/gl.h', - apiname = 'gles1', - profile = 'common', - versions = allVersions, - emitversions = allVersions, - defaultExtensions = None, # No default extensions - addExtensions = es1CorePat, # Add mandatory ES1 extensions in GLES1/gl.h - removeExtensions = None, - prefixText = prefixStrings + gles1PlatformStrings + genDateCommentString, - genFuncPointers = False, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = False, # Core ES API functions are in the static link libraries - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GL_API ', - apientry = 'GL_APIENTRY ', - apientryp = 'GL_APIENTRYP '), - # GLES 1.x extensions - GLES/glext.h - CGeneratorOptions( - filename = 'GLES/glext.h', - apiname = 'gles1', - profile = 'common', - versions = allVersions, - emitversions = noVersions, - defaultExtensions = 'gles1', # Default extensions for GLES 1 - addExtensions = None, - removeExtensions = es1CorePat, # Remove mandatory ES1 extensions in GLES1/glext.h - prefixText = prefixStrings + gles1ExtPlatformStrings + genDateCommentString, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GL_API ', - apientry = 'GL_APIENTRY ', - apientryp = 'GL_APIENTRYP '), - # GLES 2.0 API - GLES2/gl2.h (no function pointers) - CGeneratorOptions( - filename = 'GLES2/gl2.h', - apiname = 'gles2', - profile = 'common', - versions = gles2onlyPat, - emitversions = allVersions, - defaultExtensions = None, # No default extensions - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + gles2PlatformStrings + genDateCommentString, - genFuncPointers = False, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = False, # Core ES API functions are in the static link libraries - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GL_APICALL ', - apientry = 'GL_APIENTRY ', - apientryp = 'GL_APIENTRYP '), - # GLES 3.1 / 3.0 / 2.0 extensions - GLES2/gl2ext.h - CGeneratorOptions( - filename = 'GLES2/gl2ext.h', - apiname = 'gles2', - profile = 'common', - versions = gles2onlyPat, - emitversions = None, - defaultExtensions = 'gles2', # Default extensions for GLES 2 - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + gles2ExtPlatformStrings + genDateCommentString, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GL_APICALL ', - apientry = 'GL_APIENTRY ', - apientryp = 'GL_APIENTRYP '), - # GLES 3.1 API - GLES3/gl31.h (no function pointers) - CGeneratorOptions( - filename = 'GLES3/gl31.h', - apiname = 'gles2', - profile = 'common', - versions = gles2and30and31Pat, - emitversions = allVersions, - defaultExtensions = None, # No default extensions - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + gles3PlatformStrings + genDateCommentString, - genFuncPointers = False, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = False, # Core ES API functions are in the static link libraries - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GL_APICALL ', - apientry = 'GL_APIENTRY ', - apientryp = 'GL_APIENTRYP '), - # GLES 3.0 API - GLES3/gl3.h (no function pointers) - CGeneratorOptions( - filename = 'GLES3/gl3.h', - apiname = 'gles2', - profile = 'common', - versions = gles2and30Pat, - emitversions = allVersions, - defaultExtensions = None, # No default extensions - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + gles3PlatformStrings + genDateCommentString, - genFuncPointers = False, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = False, # Core ES API functions are in the static link libraries - protectProtoStr = 'GL_GLEXT_PROTOTYPES', - apicall = 'GL_APICALL ', - apientry = 'GL_APIENTRY ', - apientryp = 'GL_APIENTRYP '), - # EGL API - EGL/egl.h (no function pointers, yet @@@) - CGeneratorOptions( - filename = 'EGL/egl.h', - apiname = 'egl', - profile = None, - versions = allVersions, - emitversions = allVersions, - defaultExtensions = None, # No default extensions - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + eglPlatformStrings + genDateCommentString, - genFuncPointers = False, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = False, - protectProtoStr = 'EGL_EGLEXT_PROTOTYPES', - apicall = 'EGLAPI ', - apientry = 'EGLAPIENTRY ', - apientryp = 'EGLAPIENTRYP '), - # EGL extensions - EGL/eglext.h (no function pointers, yet @@@) - CGeneratorOptions( - filename = 'EGL/eglext.h', - apiname = 'egl', - profile = None, - versions = allVersions, - emitversions = None, - defaultExtensions = 'egl', # Default extensions for EGL - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + eglPlatformStrings + eglextVersionStrings, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'EGL_EGLEXT_PROTOTYPES', - apicall = 'EGLAPI ', - apientry = 'EGLAPIENTRY ', - apientryp = 'EGLAPIENTRYP '), - # GLX 1.* API - GL/glx.h - CGeneratorOptions( - filename = 'GL/glx.h', - apiname = 'glx', - profile = None, - versions = allVersions, - emitversions = allVersions, - defaultExtensions = None, # No default extensions - addExtensions = None, - removeExtensions = None, - # add glXPlatformStrings? - prefixText = prefixStrings + genDateCommentString, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'GLX_GLXEXT_PROTOTYPES', - apicall = '', - apientry = '', - apientryp = ' *'), - # GLX 1.3+ API + extensions - GL/glxext.h (no function pointers, yet @@@) - CGeneratorOptions( - filename = 'GL/glxext.h', - apiname = 'glx', - profile = None, - versions = allVersions, - emitversions = glx13andLaterPat, - defaultExtensions = 'glx', # Default extensions for GLX - addExtensions = None, - removeExtensions = None, - # add glXPlatformStrings? - prefixText = prefixStrings + glxextVersionStrings, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'GLX_GLXEXT_PROTOTYPES', - apicall = '', - apientry = '', - apientryp = ' *'), - # WGL API + extensions - GL/wgl.h (no function pointers, yet @@@) - CGeneratorOptions( - filename = 'GL/wgl.h', - apiname = 'wgl', - profile = None, - versions = allVersions, - emitversions = allVersions, - defaultExtensions = 'wgl', # Default extensions for WGL - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + wglPlatformStrings + genDateCommentString, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'WGL_WGLEXT_PROTOTYPES', - apicall = '', - apientry = 'WINAPI ', - apientryp = 'WINAPI * '), - # WGL extensions - GL/wglext.h (no function pointers, yet @@@) - CGeneratorOptions( - filename = 'GL/wglext.h', - apiname = 'wgl', - profile = None, - versions = allVersions, - emitversions = None, - defaultExtensions = 'wgl', # Default extensions for WGL - addExtensions = None, - removeExtensions = None, - prefixText = prefixStrings + wglPlatformStrings + wglextVersionStrings, - genFuncPointers = True, - protectFile = protectFile, - protectFeature = protectFeature, - protectProto = protectProto, - protectProtoStr = 'WGL_WGLEXT_PROTOTYPES', - apicall = '', - apientry = 'WINAPI ', - apientryp = 'WINAPI * '), - # End of list - None -] - -# create error/warning & diagnostic files -if (errFilename): - errWarn = open(errFilename,'w') -else: - errWarn = sys.stderr -diag = open(diagFilename, 'w') - -def genHeaders(): - # Loop over targets, building each - generated = 0 - for genOpts in buildList: - if (genOpts == None): - break - if (target and target != genOpts.filename): - # write('*** Skipping', genOpts.filename) - continue - write('*** Building', genOpts.filename) - generated = generated + 1 - startTimer() - gen = COutputGenerator(errFile=errWarn, - warnFile=errWarn, - diagFile=diag) - reg.setGenerator(gen) - reg.apiGen(genOpts) - write('** Generated', genOpts.filename) - endTimer('Time to generate ' + genOpts.filename + ' =') - if (target and generated == 0): - write('Failed to generate target:', target) - -if (debug): - pdb.run('genHeaders()') -elif (profile): - import cProfile, pstats - cProfile.run('genHeaders()', 'profile.txt') - p = pstats.Stats('profile.txt') - p.strip_dirs().sort_stats('time').print_stats(50) -else: - genHeaders() diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/gl.xml android-platform-frameworks-native-21/opengl/tools/glgen2/registry/gl.xml --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/gl.xml 2016-02-15 21:17:11.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen2/registry/gl.xml 1970-01-01 00:00:00.000000000 +0000 @@ -1,42184 +0,0 @@ - - - -Copyright (c) 2013-2014 The Khronos Group Inc. - -Permission is hereby granted, free of charge, to any person obtaining a -copy of this software and/or associated documentation files (the -"Materials"), to deal in the Materials without restriction, including -without limitation the rights to use, copy, modify, merge, publish, -distribute, sublicense, and/or sell copies of the Materials, and to -permit persons to whom the Materials are furnished to do so, subject to -the following conditions: - -The above copyright notice and this permission notice shall be included -in all copies or substantial portions of the Materials. - -THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - ------------------------------------------------------------------------- - -This file, gl.xml, is the OpenGL and OpenGL API Registry. The older -".spec" file format has been retired and will no longer be updated with -new extensions and API versions. The canonical version of the registry, -together with documentation, schema, and Python generator scripts used -to generate C header files for OpenGL and OpenGL ES, can always be found -in the Khronos Registry at - http://www.opengl.org/registry/ - - - - - - #include <stddef.h> - #include <KHR/khrplatform.h> - #ifndef GLEXT_64_TYPES_DEFINED -/* This code block is duplicated in glxext.h, so must be protected */ -#define GLEXT_64_TYPES_DEFINED -/* Define int32_t, int64_t, and uint64_t types for UST/MSC */ -/* (as used in the GL_EXT_timer_query extension). */ -#if defined(__STDC_VERSION__) && __STDC_VERSION__ >= 199901L -#include <inttypes.h> -#elif defined(__sun__) || defined(__digital__) -#include <inttypes.h> -#if defined(__STDC__) -#if defined(__arch64__) || defined(_LP64) -typedef long int int64_t; -typedef unsigned long int uint64_t; -#else -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#endif /* __arch64__ */ -#endif /* __STDC__ */ -#elif defined( __VMS ) || defined(__sgi) -#include <inttypes.h> -#elif defined(__SCO__) || defined(__USLC__) -#include <stdint.h> -#elif defined(__UNIXOS2__) || defined(__SOL64__) -typedef long int int32_t; -typedef long long int int64_t; -typedef unsigned long long int uint64_t; -#elif defined(_WIN32) && defined(__GNUC__) -#include <stdint.h> -#elif defined(_WIN32) -typedef __int32 int32_t; -typedef __int64 int64_t; -typedef unsigned __int64 uint64_t; -#else -/* Fallback if nothing above works */ -#include <inttypes.h> -#endif -#endif - - typedef unsigned int GLenum; - typedef unsigned char GLboolean; - typedef unsigned int GLbitfield; - typedef void GLvoid; - typedef signed char GLbyte; - typedef short GLshort; - typedef int GLint; - typedef int GLclampx; - typedef unsigned char GLubyte; - typedef unsigned short GLushort; - typedef unsigned int GLuint; - typedef int GLsizei; - typedef float GLfloat; - typedef float GLclampf; - typedef double GLdouble; - typedef double GLclampd; - typedef void *GLeglImageOES; - typedef char GLchar; - typedef char GLcharARB; - #ifdef __APPLE__ -typedef void *GLhandleARB; -#else -typedef unsigned int GLhandleARB; -#endif - typedef unsigned short GLhalfARB; - typedef unsigned short GLhalf; - typedef GLint GLfixed; - typedef ptrdiff_t GLintptr; - typedef ptrdiff_t GLsizeiptr; - typedef int64_t GLint64; - typedef uint64_t GLuint64; - typedef ptrdiff_t GLintptrARB; - typedef ptrdiff_t GLsizeiptrARB; - typedef int64_t GLint64EXT; - typedef uint64_t GLuint64EXT; - typedef struct __GLsync *GLsync; - struct _cl_context; - struct _cl_event; - typedef void ( *GLDEBUGPROC)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); - typedef void ( *GLDEBUGPROCARB)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); - typedef void ( *GLDEBUGPROCKHR)(GLenum source,GLenum type,GLuint id,GLenum severity,GLsizei length,const GLchar *message,const void *userParam); - - typedef khronos_int32_t GLclampx; - - typedef khronos_int8_t GLbyte; - typedef khronos_uint8_t GLubyte; - typedef khronos_float_t GLfloat; - typedef khronos_float_t GLclampf; - typedef khronos_int32_t GLfixed; - typedef khronos_int64_t GLint64; - typedef khronos_uint64_t GLuint64; - typedef khronos_intptr_t GLintptr; - typedef khronos_ssize_t GLsizeiptr; - - typedef khronos_int8_t GLbyte; - typedef khronos_uint8_t GLubyte; - typedef khronos_float_t GLfloat; - typedef khronos_float_t GLclampf; - typedef khronos_int32_t GLfixed; - typedef khronos_int64_t GLint64; - typedef khronos_uint64_t GLuint64; - typedef khronos_int64_t GLint64EXT; - typedef khronos_uint64_t GLuint64EXT; - typedef khronos_intptr_t GLintptr; - typedef khronos_ssize_t GLsizeiptr; - - - typedef void ( *GLDEBUGPROCAMD)(GLuint id,GLenum category,GLenum severity,GLsizei length,const GLchar *message,void *userParam); - typedef unsigned short GLhalfNV; - typedef GLintptr GLvdpauSurfaceNV; - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - void glAccum - GLenum op - GLfloat value - - - - void glAccumxOES - GLenum op - GLfixed value - - - void glActiveProgramEXT - GLuint program - - - void glActiveShaderProgram - GLuint pipeline - GLuint program - - - void glActiveShaderProgramEXT - GLuint pipeline - GLuint program - - - void glActiveStencilFaceEXT - GLenum face - - - - void glActiveTexture - GLenum texture - - - - void glActiveTextureARB - GLenum texture - - - - - void glActiveVaryingNV - GLuint program - const GLchar *name - - - void glAlphaFragmentOp1ATI - GLenum op - GLuint dst - GLuint dstMod - GLuint arg1 - GLuint arg1Rep - GLuint arg1Mod - - - void glAlphaFragmentOp2ATI - GLenum op - GLuint dst - GLuint dstMod - GLuint arg1 - GLuint arg1Rep - GLuint arg1Mod - GLuint arg2 - GLuint arg2Rep - GLuint arg2Mod - - - void glAlphaFragmentOp3ATI - GLenum op - GLuint dst - GLuint dstMod - GLuint arg1 - GLuint arg1Rep - GLuint arg1Mod - GLuint arg2 - GLuint arg2Rep - GLuint arg2Mod - GLuint arg3 - GLuint arg3Rep - GLuint arg3Mod - - - void glAlphaFunc - GLenum func - GLfloat ref - - - - void glAlphaFuncQCOM - GLenum func - GLclampf ref - - - void glAlphaFuncx - GLenum func - GLfixed ref - - - void glAlphaFuncxOES - GLenum func - GLfixed ref - - - void glApplyTextureEXT - GLenum mode - - - GLboolean glAreProgramsResidentNV - GLsizei n - const GLuint *programs - GLboolean *residences - - - - GLboolean glAreTexturesResident - GLsizei n - const GLuint *textures - GLboolean *residences - - - - GLboolean glAreTexturesResidentEXT - GLsizei n - const GLuint *textures - GLboolean *residences - - - - void glArrayElement - GLint i - - - void glArrayElementEXT - GLint i - - - - void glArrayObjectATI - GLenum array - GLint size - GLenum type - GLsizei stride - GLuint buffer - GLuint offset - - - void glAsyncMarkerSGIX - GLuint marker - - - void glAttachObjectARB - GLhandleARB containerObj - GLhandleARB obj - - - - void glAttachShader - GLuint program - GLuint shader - - - void glBegin - GLenum mode - - - - void glBeginConditionalRender - GLuint id - GLenum mode - - - void glBeginConditionalRenderNV - GLuint id - GLenum mode - - - - - void glBeginConditionalRenderNVX - GLuint id - - - void glBeginFragmentShaderATI - - - void glBeginOcclusionQueryNV - GLuint id - - - void glBeginPerfMonitorAMD - GLuint monitor - - - void glBeginPerfQueryINTEL - GLuint queryHandle - - - void glBeginQuery - GLenum target - GLuint id - - - - void glBeginQueryARB - GLenum target - GLuint id - - - - void glBeginQueryEXT - GLenum target - GLuint id - - - void glBeginQueryIndexed - GLenum target - GLuint index - GLuint id - - - void glBeginTransformFeedback - GLenum primitiveMode - - - void glBeginTransformFeedbackEXT - GLenum primitiveMode - - - - void glBeginTransformFeedbackNV - GLenum primitiveMode - - - - void glBeginVertexShaderEXT - - - void glBeginVideoCaptureNV - GLuint video_capture_slot - - - void glBindAttribLocation - GLuint program - GLuint index - const GLchar *name - - - void glBindAttribLocationARB - GLhandleARB programObj - GLuint index - const GLcharARB *name - - - - void glBindBuffer - GLenum target - GLuint buffer - - - void glBindBufferARB - GLenum target - GLuint buffer - - - - void glBindBufferBase - GLenum target - GLuint index - GLuint buffer - - - void glBindBufferBaseEXT - GLenum target - GLuint index - GLuint buffer - - - - void glBindBufferBaseNV - GLenum target - GLuint index - GLuint buffer - - - - void glBindBufferOffsetEXT - GLenum target - GLuint index - GLuint buffer - GLintptr offset - - - void glBindBufferOffsetNV - GLenum target - GLuint index - GLuint buffer - GLintptr offset - - - - void glBindBufferRange - GLenum target - GLuint index - GLuint buffer - GLintptr offset - GLsizeiptr size - - - void glBindBufferRangeEXT - GLenum target - GLuint index - GLuint buffer - GLintptr offset - GLsizeiptr size - - - - void glBindBufferRangeNV - GLenum target - GLuint index - GLuint buffer - GLintptr offset - GLsizeiptr size - - - - void glBindBuffersBase - GLenum target - GLuint first - GLsizei count - const GLuint *buffers - - - void glBindBuffersRange - GLenum target - GLuint first - GLsizei count - const GLuint *buffers - const GLintptr *offsets - const GLsizeiptr *sizes - - - void glBindFragDataLocation - GLuint program - GLuint color - const GLchar *name - - - void glBindFragDataLocationEXT - GLuint program - GLuint color - const GLchar *name - - - - void glBindFragDataLocationIndexed - GLuint program - GLuint colorNumber - GLuint index - const GLchar *name - - - void glBindFragmentShaderATI - GLuint id - - - void glBindFramebuffer - GLenum target - GLuint framebuffer - - - - void glBindFramebufferEXT - GLenum target - GLuint framebuffer - - - - void glBindFramebufferOES - GLenum target - GLuint framebuffer - - - void glBindImageTexture - GLuint unit - GLuint texture - GLint level - GLboolean layered - GLint layer - GLenum access - GLenum format - - - void glBindImageTextureEXT - GLuint index - GLuint texture - GLint level - GLboolean layered - GLint layer - GLenum access - GLint format - - - void glBindImageTextures - GLuint first - GLsizei count - const GLuint *textures - - - GLuint glBindLightParameterEXT - GLenum light - GLenum value - - - GLuint glBindMaterialParameterEXT - GLenum face - GLenum value - - - void glBindMultiTextureEXT - GLenum texunit - GLenum target - GLuint texture - - - GLuint glBindParameterEXT - GLenum value - - - void glBindProgramARB - GLenum target - GLuint program - - - - void glBindProgramNV - GLenum target - GLuint id - - - - - void glBindProgramPipeline - GLuint pipeline - - - void glBindProgramPipelineEXT - GLuint pipeline - - - void glBindRenderbuffer - GLenum target - GLuint renderbuffer - - - - void glBindRenderbufferEXT - GLenum target - GLuint renderbuffer - - - - void glBindRenderbufferOES - GLenum target - GLuint renderbuffer - - - void glBindSampler - GLuint unit - GLuint sampler - - - void glBindSamplers - GLuint first - GLsizei count - const GLuint *samplers - - - GLuint glBindTexGenParameterEXT - GLenum unit - GLenum coord - GLenum value - - - void glBindTexture - GLenum target - GLuint texture - - - - void glBindTextureEXT - GLenum target - GLuint texture - - - - - GLuint glBindTextureUnitParameterEXT - GLenum unit - GLenum value - - - void glBindTextures - GLuint first - GLsizei count - const GLuint *textures - - - void glBindTransformFeedback - GLenum target - GLuint id - - - void glBindTransformFeedbackNV - GLenum target - GLuint id - - - void glBindVertexArray - GLuint array - - - - void glBindVertexArrayAPPLE - GLuint array - - - void glBindVertexArrayOES - GLuint array - - - - void glBindVertexBuffer - GLuint bindingindex - GLuint buffer - GLintptr offset - GLsizei stride - - - void glBindVertexBuffers - GLuint first - GLsizei count - const GLuint *buffers - const GLintptr *offsets - const GLsizei *strides - - - void glBindVertexShaderEXT - GLuint id - - - void glBindVideoCaptureStreamBufferNV - GLuint video_capture_slot - GLuint stream - GLenum frame_region - GLintptrARB offset - - - void glBindVideoCaptureStreamTextureNV - GLuint video_capture_slot - GLuint stream - GLenum frame_region - GLenum target - GLuint texture - - - void glBinormal3bEXT - GLbyte bx - GLbyte by - GLbyte bz - - - - void glBinormal3bvEXT - const GLbyte *v - - - void glBinormal3dEXT - GLdouble bx - GLdouble by - GLdouble bz - - - - void glBinormal3dvEXT - const GLdouble *v - - - void glBinormal3fEXT - GLfloat bx - GLfloat by - GLfloat bz - - - - void glBinormal3fvEXT - const GLfloat *v - - - void glBinormal3iEXT - GLint bx - GLint by - GLint bz - - - - void glBinormal3ivEXT - const GLint *v - - - void glBinormal3sEXT - GLshort bx - GLshort by - GLshort bz - - - - void glBinormal3svEXT - const GLshort *v - - - void glBinormalPointerEXT - GLenum type - GLsizei stride - const void *pointer - - - void glBitmap - GLsizei width - GLsizei height - GLfloat xorig - GLfloat yorig - GLfloat xmove - GLfloat ymove - const GLubyte *bitmap - - - - - void glBitmapxOES - GLsizei width - GLsizei height - GLfixed xorig - GLfixed yorig - GLfixed xmove - GLfixed ymove - const GLubyte *bitmap - - - void glBlendBarrierNV - - - void glBlendBarrierKHR - - - void glBlendColor - GLfloat red - GLfloat green - GLfloat blue - GLfloat alpha - - - - void glBlendColorEXT - GLfloat red - GLfloat green - GLfloat blue - GLfloat alpha - - - - - void glBlendColorxOES - GLfixed red - GLfixed green - GLfixed blue - GLfixed alpha - - - void glBlendEquation - GLenum mode - - - - void glBlendEquationEXT - GLenum mode - - - - - void glBlendEquationIndexedAMD - GLuint buf - GLenum mode - - - - void glBlendEquationOES - GLenum mode - - - void glBlendEquationSeparate - GLenum modeRGB - GLenum modeAlpha - - - - void glBlendEquationSeparateEXT - GLenum modeRGB - GLenum modeAlpha - - - - - void glBlendEquationSeparateIndexedAMD - GLuint buf - GLenum modeRGB - GLenum modeAlpha - - - - void glBlendEquationSeparateOES - GLenum modeRGB - GLenum modeAlpha - - - void glBlendEquationSeparatei - GLuint buf - GLenum modeRGB - GLenum modeAlpha - - - void glBlendEquationSeparateiARB - GLuint buf - GLenum modeRGB - GLenum modeAlpha - - - - void glBlendEquationSeparateiEXT - GLuint buf - GLenum modeRGB - GLenum modeAlpha - - - - void glBlendEquationi - GLuint buf - GLenum mode - - - void glBlendEquationiEXT - GLuint buf - GLenum mode - - - - void glBlendEquationiARB - GLuint buf - GLenum mode - - - - void glBlendFunc - GLenum sfactor - GLenum dfactor - - - - void glBlendFuncIndexedAMD - GLuint buf - GLenum src - GLenum dst - - - - void glBlendFuncSeparate - GLenum sfactorRGB - GLenum dfactorRGB - GLenum sfactorAlpha - GLenum dfactorAlpha - - - - void glBlendFuncSeparateEXT - GLenum sfactorRGB - GLenum dfactorRGB - GLenum sfactorAlpha - GLenum dfactorAlpha - - - - - void glBlendFuncSeparateINGR - GLenum sfactorRGB - GLenum dfactorRGB - GLenum sfactorAlpha - GLenum dfactorAlpha - - - - - void glBlendFuncSeparateIndexedAMD - GLuint buf - GLenum srcRGB - GLenum dstRGB - GLenum srcAlpha - GLenum dstAlpha - - - - void glBlendFuncSeparateOES - GLenum srcRGB - GLenum dstRGB - GLenum srcAlpha - GLenum dstAlpha - - - void glBlendFuncSeparatei - GLuint buf - GLenum srcRGB - GLenum dstRGB - GLenum srcAlpha - GLenum dstAlpha - - - void glBlendFuncSeparateiARB - GLuint buf - GLenum srcRGB - GLenum dstRGB - GLenum srcAlpha - GLenum dstAlpha - - - - void glBlendFuncSeparateiEXT - GLuint buf - GLenum srcRGB - GLenum dstRGB - GLenum srcAlpha - GLenum dstAlpha - - - - void glBlendFunci - GLuint buf - GLenum src - GLenum dst - - - void glBlendFunciARB - GLuint buf - GLenum src - GLenum dst - - - - void glBlendFunciEXT - GLuint buf - GLenum src - GLenum dst - - - - void glBlendParameteriNV - GLenum pname - GLint value - - - void glBlitFramebuffer - GLint srcX0 - GLint srcY0 - GLint srcX1 - GLint srcY1 - GLint dstX0 - GLint dstY0 - GLint dstX1 - GLint dstY1 - GLbitfield mask - GLenum filter - - - - void glBlitFramebufferANGLE - GLint srcX0 - GLint srcY0 - GLint srcX1 - GLint srcY1 - GLint dstX0 - GLint dstY0 - GLint dstX1 - GLint dstY1 - GLbitfield mask - GLenum filter - - - void glBlitFramebufferEXT - GLint srcX0 - GLint srcY0 - GLint srcX1 - GLint srcY1 - GLint dstX0 - GLint dstY0 - GLint dstX1 - GLint dstY1 - GLbitfield mask - GLenum filter - - - - - void glBlitFramebufferNV - GLint srcX0 - GLint srcY0 - GLint srcX1 - GLint srcY1 - GLint dstX0 - GLint dstY0 - GLint dstX1 - GLint dstY1 - GLbitfield mask - GLenum filter - - - - void glBufferAddressRangeNV - GLenum pname - GLuint index - GLuint64EXT address - GLsizeiptr length - - - void glBufferData - GLenum target - GLsizeiptr size - const void *data - GLenum usage - - - void glBufferDataARB - GLenum target - GLsizeiptrARB size - const void *data - GLenum usage - - - - void glBufferParameteriAPPLE - GLenum target - GLenum pname - GLint param - - - void glBufferStorage - GLenum target - GLsizeiptr size - const void *data - GLbitfield flags - - - void glBufferSubData - GLenum target - GLintptr offset - GLsizeiptr size - const void *data - - - void glBufferSubDataARB - GLenum target - GLintptrARB offset - GLsizeiptrARB size - const void *data - - - - void glCallList - GLuint list - - - - void glCallLists - GLsizei n - GLenum type - const void *lists - - - - GLenum glCheckFramebufferStatus - GLenum target - - - - GLenum glCheckFramebufferStatusEXT - GLenum target - - - - - GLenum glCheckFramebufferStatusOES - GLenum target - - - GLenum glCheckNamedFramebufferStatusEXT - GLuint framebuffer - GLenum target - - - void glClampColor - GLenum target - GLenum clamp - - - - void glClampColorARB - GLenum target - GLenum clamp - - - - - void glClear - GLbitfield mask - - - - void glClearAccum - GLfloat red - GLfloat green - GLfloat blue - GLfloat alpha - - - - void glClearAccumxOES - GLfixed red - GLfixed green - GLfixed blue - GLfixed alpha - - - void glClearBufferData - GLenum target - GLenum internalformat - GLenum format - GLenum type - const void *data - - - void glClearBufferSubData - GLenum target - GLenum internalformat - GLintptr offset - GLsizeiptr size - GLenum format - GLenum type - const void *data - - - void glClearBufferfi - GLenum buffer - GLint drawbuffer - GLfloat depth - GLint stencil - - - void glClearBufferfv - GLenum buffer - GLint drawbuffer - const GLfloat *value - - - void glClearBufferiv - GLenum buffer - GLint drawbuffer - const GLint *value - - - void glClearBufferuiv - GLenum buffer - GLint drawbuffer - const GLuint *value - - - void glClearColor - GLfloat red - GLfloat green - GLfloat blue - GLfloat alpha - - - - void glClearColorIiEXT - GLint red - GLint green - GLint blue - GLint alpha - - - - void glClearColorIuiEXT - GLuint red - GLuint green - GLuint blue - GLuint alpha - - - - void glClearColorx - GLfixed red - GLfixed green - GLfixed blue - GLfixed alpha - - - void glClearColorxOES - GLfixed red - GLfixed green - GLfixed blue - GLfixed alpha - - - void glClearDepth - GLdouble depth - - - - void glClearDepthdNV - GLdouble depth - - - - void glClearDepthf - GLfloat d - - - void glClearDepthfOES - GLclampf depth - - - - - void glClearDepthx - GLfixed depth - - - void glClearDepthxOES - GLfixed depth - - - void glClearIndex - GLfloat c - - - - void glClearNamedBufferDataEXT - GLuint buffer - GLenum internalformat - GLenum format - GLenum type - const void *data - - - void glClearNamedBufferSubDataEXT - GLuint buffer - GLenum internalformat - GLsizeiptr offset - GLsizeiptr size - GLenum format - GLenum type - const void *data - - - void glClearStencil - GLint s - - - - void glClearTexImage - GLuint texture - GLint level - GLenum format - GLenum type - const void *data - - - void glClearTexSubImage - GLuint texture - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - const void *data - - - void glClientActiveTexture - GLenum texture - - - void glClientActiveTextureARB - GLenum texture - - - - void glClientActiveVertexStreamATI - GLenum stream - - - void glClientAttribDefaultEXT - GLbitfield mask - - - GLenum glClientWaitSync - GLsync sync - GLbitfield flags - GLuint64 timeout - - - GLenum glClientWaitSyncAPPLE - GLsync sync - GLbitfield flags - GLuint64 timeout - - - - void glClipPlane - GLenum plane - const GLdouble *equation - - - - void glClipPlanef - GLenum p - const GLfloat *eqn - - - void glClipPlanefIMG - GLenum p - const GLfloat *eqn - - - void glClipPlanefOES - GLenum plane - const GLfloat *equation - - - - void glClipPlanex - GLenum plane - const GLfixed *equation - - - void glClipPlanexIMG - GLenum p - const GLfixed *eqn - - - void glClipPlanexOES - GLenum plane - const GLfixed *equation - - - void glColor3b - GLbyte red - GLbyte green - GLbyte blue - - - - void glColor3bv - const GLbyte *v - - - - void glColor3d - GLdouble red - GLdouble green - GLdouble blue - - - - void glColor3dv - const GLdouble *v - - - - void glColor3f - GLfloat red - GLfloat green - GLfloat blue - - - - void glColor3fVertex3fSUN - GLfloat r - GLfloat g - GLfloat b - GLfloat x - GLfloat y - GLfloat z - - - void glColor3fVertex3fvSUN - const GLfloat *c - const GLfloat *v - - - void glColor3fv - const GLfloat *v - - - - void glColor3hNV - GLhalfNV red - GLhalfNV green - GLhalfNV blue - - - - void glColor3hvNV - const GLhalfNV *v - - - - void glColor3i - GLint red - GLint green - GLint blue - - - - void glColor3iv - const GLint *v - - - - void glColor3s - GLshort red - GLshort green - GLshort blue - - - - void glColor3sv - const GLshort *v - - - - void glColor3ub - GLubyte red - GLubyte green - GLubyte blue - - - - void glColor3ubv - const GLubyte *v - - - - void glColor3ui - GLuint red - GLuint green - GLuint blue - - - - void glColor3uiv - const GLuint *v - - - - void glColor3us - GLushort red - GLushort green - GLushort blue - - - - void glColor3usv - const GLushort *v - - - - void glColor3xOES - GLfixed red - GLfixed green - GLfixed blue - - - void glColor3xvOES - const GLfixed *components - - - void glColor4b - GLbyte red - GLbyte green - GLbyte blue - GLbyte alpha - - - - void glColor4bv - const GLbyte *v - - - - void glColor4d - GLdouble red - GLdouble green - GLdouble blue - GLdouble alpha - - - - void glColor4dv - const GLdouble *v - - - - void glColor4f - GLfloat red - GLfloat green - GLfloat blue - GLfloat alpha - - - - void glColor4fNormal3fVertex3fSUN - GLfloat r - GLfloat g - GLfloat b - GLfloat a - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glColor4fNormal3fVertex3fvSUN - const GLfloat *c - const GLfloat *n - const GLfloat *v - - - void glColor4fv - const GLfloat *v - - - - void glColor4hNV - GLhalfNV red - GLhalfNV green - GLhalfNV blue - GLhalfNV alpha - - - - void glColor4hvNV - const GLhalfNV *v - - - - void glColor4i - GLint red - GLint green - GLint blue - GLint alpha - - - - void glColor4iv - const GLint *v - - - - void glColor4s - GLshort red - GLshort green - GLshort blue - GLshort alpha - - - - void glColor4sv - const GLshort *v - - - - void glColor4ub - GLubyte red - GLubyte green - GLubyte blue - GLubyte alpha - - - - void glColor4ubVertex2fSUN - GLubyte r - GLubyte g - GLubyte b - GLubyte a - GLfloat x - GLfloat y - - - void glColor4ubVertex2fvSUN - const GLubyte *c - const GLfloat *v - - - void glColor4ubVertex3fSUN - GLubyte r - GLubyte g - GLubyte b - GLubyte a - GLfloat x - GLfloat y - GLfloat z - - - void glColor4ubVertex3fvSUN - const GLubyte *c - const GLfloat *v - - - void glColor4ubv - const GLubyte *v - - - - void glColor4ui - GLuint red - GLuint green - GLuint blue - GLuint alpha - - - - void glColor4uiv - const GLuint *v - - - - void glColor4us - GLushort red - GLushort green - GLushort blue - GLushort alpha - - - - void glColor4usv - const GLushort *v - - - - void glColor4x - GLfixed red - GLfixed green - GLfixed blue - GLfixed alpha - - - void glColor4xOES - GLfixed red - GLfixed green - GLfixed blue - GLfixed alpha - - - void glColor4xvOES - const GLfixed *components - - - void glColorFormatNV - GLint size - GLenum type - GLsizei stride - - - void glColorFragmentOp1ATI - GLenum op - GLuint dst - GLuint dstMask - GLuint dstMod - GLuint arg1 - GLuint arg1Rep - GLuint arg1Mod - - - void glColorFragmentOp2ATI - GLenum op - GLuint dst - GLuint dstMask - GLuint dstMod - GLuint arg1 - GLuint arg1Rep - GLuint arg1Mod - GLuint arg2 - GLuint arg2Rep - GLuint arg2Mod - - - void glColorFragmentOp3ATI - GLenum op - GLuint dst - GLuint dstMask - GLuint dstMod - GLuint arg1 - GLuint arg1Rep - GLuint arg1Mod - GLuint arg2 - GLuint arg2Rep - GLuint arg2Mod - GLuint arg3 - GLuint arg3Rep - GLuint arg3Mod - - - void glColorMask - GLboolean red - GLboolean green - GLboolean blue - GLboolean alpha - - - - void glColorMaskIndexedEXT - GLuint index - GLboolean r - GLboolean g - GLboolean b - GLboolean a - - - - void glColorMaski - GLuint index - GLboolean r - GLboolean g - GLboolean b - GLboolean a - - - void glColorMaskiEXT - GLuint index - GLboolean r - GLboolean g - GLboolean b - GLboolean a - - - - void glColorMaterial - GLenum face - GLenum mode - - - - void glColorP3ui - GLenum type - GLuint color - - - void glColorP3uiv - GLenum type - const GLuint *color - - - void glColorP4ui - GLenum type - GLuint color - - - void glColorP4uiv - GLenum type - const GLuint *color - - - void glColorPointer - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glColorPointerEXT - GLint size - GLenum type - GLsizei stride - GLsizei count - const void *pointer - - - void glColorPointerListIBM - GLint size - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glColorPointervINTEL - GLint size - GLenum type - const void **pointer - - - void glColorSubTable - GLenum target - GLsizei start - GLsizei count - GLenum format - GLenum type - const void *data - - - - - void glColorSubTableEXT - GLenum target - GLsizei start - GLsizei count - GLenum format - GLenum type - const void *data - - - - void glColorTable - GLenum target - GLenum internalformat - GLsizei width - GLenum format - GLenum type - const void *table - - - - - void glColorTableEXT - GLenum target - GLenum internalFormat - GLsizei width - GLenum format - GLenum type - const void *table - - - - void glColorTableParameterfv - GLenum target - GLenum pname - const GLfloat *params - - - - void glColorTableParameterfvSGI - GLenum target - GLenum pname - const GLfloat *params - - - - - void glColorTableParameteriv - GLenum target - GLenum pname - const GLint *params - - - - void glColorTableParameterivSGI - GLenum target - GLenum pname - const GLint *params - - - - - void glColorTableSGI - GLenum target - GLenum internalformat - GLsizei width - GLenum format - GLenum type - const void *table - - - - - void glCombinerInputNV - GLenum stage - GLenum portion - GLenum variable - GLenum input - GLenum mapping - GLenum componentUsage - - - - void glCombinerOutputNV - GLenum stage - GLenum portion - GLenum abOutput - GLenum cdOutput - GLenum sumOutput - GLenum scale - GLenum bias - GLboolean abDotProduct - GLboolean cdDotProduct - GLboolean muxSum - - - - void glCombinerParameterfNV - GLenum pname - GLfloat param - - - - void glCombinerParameterfvNV - GLenum pname - const GLfloat *params - - - - void glCombinerParameteriNV - GLenum pname - GLint param - - - - void glCombinerParameterivNV - GLenum pname - const GLint *params - - - - void glCombinerStageParameterfvNV - GLenum stage - GLenum pname - const GLfloat *params - - - void glCompileShader - GLuint shader - - - void glCompileShaderARB - GLhandleARB shaderObj - - - - void glCompileShaderIncludeARB - GLuint shader - GLsizei count - const GLchar *const*path - const GLint *length - - - void glCompressedMultiTexImage1DEXT - GLenum texunit - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLint border - GLsizei imageSize - const void *bits - - - void glCompressedMultiTexImage2DEXT - GLenum texunit - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLint border - GLsizei imageSize - const void *bits - - - void glCompressedMultiTexImage3DEXT - GLenum texunit - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLsizei imageSize - const void *bits - - - void glCompressedMultiTexSubImage1DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLsizei imageSize - const void *bits - - - void glCompressedMultiTexSubImage2DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLsizei imageSize - const void *bits - - - void glCompressedMultiTexSubImage3DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLsizei imageSize - const void *bits - - - void glCompressedTexImage1D - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLint border - GLsizei imageSize - const void *data - - - - - void glCompressedTexImage1DARB - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLint border - GLsizei imageSize - const void *data - - - - - void glCompressedTexImage2D - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLint border - GLsizei imageSize - const void *data - - - - - void glCompressedTexImage2DARB - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLint border - GLsizei imageSize - const void *data - - - - - void glCompressedTexImage3D - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLsizei imageSize - const void *data - - - - - void glCompressedTexImage3DARB - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLsizei imageSize - const void *data - - - - - void glCompressedTexImage3DOES - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLsizei imageSize - const void *data - - - - void glCompressedTexSubImage1D - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLsizei imageSize - const void *data - - - - - void glCompressedTexSubImage1DARB - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLsizei imageSize - const void *data - - - - - void glCompressedTexSubImage2D - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLsizei imageSize - const void *data - - - - - void glCompressedTexSubImage2DARB - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLsizei imageSize - const void *data - - - - - void glCompressedTexSubImage3D - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLsizei imageSize - const void *data - - - - - void glCompressedTexSubImage3DARB - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLsizei imageSize - const void *data - - - - - void glCompressedTexSubImage3DOES - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLsizei imageSize - const void *data - - - - void glCompressedTextureImage1DEXT - GLuint texture - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLint border - GLsizei imageSize - const void *bits - - - void glCompressedTextureImage2DEXT - GLuint texture - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLint border - GLsizei imageSize - const void *bits - - - void glCompressedTextureImage3DEXT - GLuint texture - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLsizei imageSize - const void *bits - - - void glCompressedTextureSubImage1DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLsizei imageSize - const void *bits - - - void glCompressedTextureSubImage2DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLsizei imageSize - const void *bits - - - void glCompressedTextureSubImage3DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLsizei imageSize - const void *bits - - - void glConvolutionFilter1D - GLenum target - GLenum internalformat - GLsizei width - GLenum format - GLenum type - const void *image - - - - - void glConvolutionFilter1DEXT - GLenum target - GLenum internalformat - GLsizei width - GLenum format - GLenum type - const void *image - - - - - void glConvolutionFilter2D - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *image - - - - - void glConvolutionFilter2DEXT - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *image - - - - - void glConvolutionParameterf - GLenum target - GLenum pname - GLfloat params - - - - void glConvolutionParameterfEXT - GLenum target - GLenum pname - GLfloat params - - - - - void glConvolutionParameterfv - GLenum target - GLenum pname - const GLfloat *params - - - - void glConvolutionParameterfvEXT - GLenum target - GLenum pname - const GLfloat *params - - - - - void glConvolutionParameteri - GLenum target - GLenum pname - GLint params - - - - void glConvolutionParameteriEXT - GLenum target - GLenum pname - GLint params - - - - - void glConvolutionParameteriv - GLenum target - GLenum pname - const GLint *params - - - - void glConvolutionParameterivEXT - GLenum target - GLenum pname - const GLint *params - - - - - void glConvolutionParameterxOES - GLenum target - GLenum pname - GLfixed param - - - void glConvolutionParameterxvOES - GLenum target - GLenum pname - const GLfixed *params - - - void glCopyBufferSubData - GLenum readTarget - GLenum writeTarget - GLintptr readOffset - GLintptr writeOffset - GLsizeiptr size - - - void glCopyBufferSubDataNV - GLenum readTarget - GLenum writeTarget - GLintptr readOffset - GLintptr writeOffset - GLsizeiptr size - - - - void glCopyColorSubTable - GLenum target - GLsizei start - GLint x - GLint y - GLsizei width - - - - void glCopyColorSubTableEXT - GLenum target - GLsizei start - GLint x - GLint y - GLsizei width - - - - void glCopyColorTable - GLenum target - GLenum internalformat - GLint x - GLint y - GLsizei width - - - - void glCopyColorTableSGI - GLenum target - GLenum internalformat - GLint x - GLint y - GLsizei width - - - - - void glCopyConvolutionFilter1D - GLenum target - GLenum internalformat - GLint x - GLint y - GLsizei width - - - - void glCopyConvolutionFilter1DEXT - GLenum target - GLenum internalformat - GLint x - GLint y - GLsizei width - - - - - void glCopyConvolutionFilter2D - GLenum target - GLenum internalformat - GLint x - GLint y - GLsizei width - GLsizei height - - - - void glCopyConvolutionFilter2DEXT - GLenum target - GLenum internalformat - GLint x - GLint y - GLsizei width - GLsizei height - - - - - void glCopyImageSubData - GLuint srcName - GLenum srcTarget - GLint srcLevel - GLint srcX - GLint srcY - GLint srcZ - GLuint dstName - GLenum dstTarget - GLint dstLevel - GLint dstX - GLint dstY - GLint dstZ - GLsizei srcWidth - GLsizei srcHeight - GLsizei srcDepth - - - void glCopyImageSubDataEXT - GLuint srcName - GLenum srcTarget - GLint srcLevel - GLint srcX - GLint srcY - GLint srcZ - GLuint dstName - GLenum dstTarget - GLint dstLevel - GLint dstX - GLint dstY - GLint dstZ - GLsizei srcWidth - GLsizei srcHeight - GLsizei srcDepth - - - - void glCopyImageSubDataNV - GLuint srcName - GLenum srcTarget - GLint srcLevel - GLint srcX - GLint srcY - GLint srcZ - GLuint dstName - GLenum dstTarget - GLint dstLevel - GLint dstX - GLint dstY - GLint dstZ - GLsizei width - GLsizei height - GLsizei depth - - - - void glCopyMultiTexImage1DEXT - GLenum texunit - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLint border - - - void glCopyMultiTexImage2DEXT - GLenum texunit - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLsizei height - GLint border - - - void glCopyMultiTexSubImage1DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint x - GLint y - GLsizei width - - - void glCopyMultiTexSubImage2DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - void glCopyMultiTexSubImage3DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - void glCopyPathNV - GLuint resultPath - GLuint srcPath - - - void glCopyPixels - GLint x - GLint y - GLsizei width - GLsizei height - GLenum type - - - - void glCopyTexImage1D - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLint border - - - - void glCopyTexImage1DEXT - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLint border - - - - - void glCopyTexImage2D - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLsizei height - GLint border - - - - void glCopyTexImage2DEXT - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLsizei height - GLint border - - - - - void glCopyTexSubImage1D - GLenum target - GLint level - GLint xoffset - GLint x - GLint y - GLsizei width - - - - void glCopyTexSubImage1DEXT - GLenum target - GLint level - GLint xoffset - GLint x - GLint y - GLsizei width - - - - - void glCopyTexSubImage2D - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - - void glCopyTexSubImage2DEXT - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - - - void glCopyTexSubImage3D - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - - void glCopyTexSubImage3DEXT - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - - - void glCopyTexSubImage3DOES - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - - void glCopyTextureImage1DEXT - GLuint texture - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLint border - - - void glCopyTextureImage2DEXT - GLuint texture - GLenum target - GLint level - GLenum internalformat - GLint x - GLint y - GLsizei width - GLsizei height - GLint border - - - void glCopyTextureLevelsAPPLE - GLuint destinationTexture - GLuint sourceTexture - GLint sourceBaseLevel - GLsizei sourceLevelCount - - - void glCopyTextureSubImage1DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint x - GLint y - GLsizei width - - - void glCopyTextureSubImage2DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - void glCopyTextureSubImage3DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLint x - GLint y - GLsizei width - GLsizei height - - - void glCoverFillPathInstancedNV - GLsizei numPaths - GLenum pathNameType - const void *paths - GLuint pathBase - GLenum coverMode - GLenum transformType - const GLfloat *transformValues - - - void glCoverFillPathNV - GLuint path - GLenum coverMode - - - void glCoverStrokePathInstancedNV - GLsizei numPaths - GLenum pathNameType - const void *paths - GLuint pathBase - GLenum coverMode - GLenum transformType - const GLfloat *transformValues - - - void glCoverStrokePathNV - GLuint path - GLenum coverMode - - - void glCoverageMaskNV - GLboolean mask - - - void glCoverageOperationNV - GLenum operation - - - void glCreatePerfQueryINTEL - GLuint queryId - GLuint *queryHandle - - - GLuint glCreateProgram - - - GLhandleARB glCreateProgramObjectARB - - - - GLuint glCreateShader - GLenum type - - - GLhandleARB glCreateShaderObjectARB - GLenum shaderType - - - - GLuint glCreateShaderProgramEXT - GLenum type - const GLchar *string - - - GLuint glCreateShaderProgramv - GLenum type - GLsizei count - const GLchar *const*strings - - - GLuint glCreateShaderProgramvEXT - GLenum type - GLsizei count - const GLchar **strings - - - GLsync glCreateSyncFromCLeventARB - struct _cl_context *context - struct _cl_event *event - GLbitfield flags - - - void glCullFace - GLenum mode - - - - void glCullParameterdvEXT - GLenum pname - GLdouble *params - - - void glCullParameterfvEXT - GLenum pname - GLfloat *params - - - void glCurrentPaletteMatrixARB - GLint index - - - - void glCurrentPaletteMatrixOES - GLuint matrixpaletteindex - - - void glDebugMessageCallback - GLDEBUGPROC callback - const void *userParam - - - void glDebugMessageCallbackAMD - GLDEBUGPROCAMD callback - void *userParam - - - void glDebugMessageCallbackARB - GLDEBUGPROCARB callback - const void *userParam - - - - void glDebugMessageCallbackKHR - GLDEBUGPROCKHR callback - const void *userParam - - - - void glDebugMessageControl - GLenum source - GLenum type - GLenum severity - GLsizei count - const GLuint *ids - GLboolean enabled - - - void glDebugMessageControlARB - GLenum source - GLenum type - GLenum severity - GLsizei count - const GLuint *ids - GLboolean enabled - - - - void glDebugMessageControlKHR - GLenum source - GLenum type - GLenum severity - GLsizei count - const GLuint *ids - GLboolean enabled - - - - void glDebugMessageEnableAMD - GLenum category - GLenum severity - GLsizei count - const GLuint *ids - GLboolean enabled - - - void glDebugMessageInsert - GLenum source - GLenum type - GLuint id - GLenum severity - GLsizei length - const GLchar *buf - - - void glDebugMessageInsertAMD - GLenum category - GLenum severity - GLuint id - GLsizei length - const GLchar *buf - - - void glDebugMessageInsertARB - GLenum source - GLenum type - GLuint id - GLenum severity - GLsizei length - const GLchar *buf - - - - void glDebugMessageInsertKHR - GLenum source - GLenum type - GLuint id - GLenum severity - GLsizei length - const GLchar *buf - - - - void glDeformSGIX - GLbitfield mask - - - - void glDeformationMap3dSGIX - GLenum target - GLdouble u1 - GLdouble u2 - GLint ustride - GLint uorder - GLdouble v1 - GLdouble v2 - GLint vstride - GLint vorder - GLdouble w1 - GLdouble w2 - GLint wstride - GLint worder - const GLdouble *points - - - - void glDeformationMap3fSGIX - GLenum target - GLfloat u1 - GLfloat u2 - GLint ustride - GLint uorder - GLfloat v1 - GLfloat v2 - GLint vstride - GLint vorder - GLfloat w1 - GLfloat w2 - GLint wstride - GLint worder - const GLfloat *points - - - - void glDeleteAsyncMarkersSGIX - GLuint marker - GLsizei range - - - void glDeleteBuffers - GLsizei n - const GLuint *buffers - - - void glDeleteBuffersARB - GLsizei n - const GLuint *buffers - - - - void glDeleteFencesAPPLE - GLsizei n - const GLuint *fences - - - void glDeleteFencesNV - GLsizei n - const GLuint *fences - - - - void glDeleteFragmentShaderATI - GLuint id - - - void glDeleteFramebuffers - GLsizei n - const GLuint *framebuffers - - - - void glDeleteFramebuffersEXT - GLsizei n - const GLuint *framebuffers - - - - - void glDeleteFramebuffersOES - GLsizei n - const GLuint *framebuffers - - - void glDeleteLists - GLuint list - GLsizei range - - - - void glDeleteNamedStringARB - GLint namelen - const GLchar *name - - - void glDeleteNamesAMD - GLenum identifier - GLuint num - const GLuint *names - - - void glDeleteObjectARB - GLhandleARB obj - - - void glDeleteOcclusionQueriesNV - GLsizei n - const GLuint *ids - - - void glDeletePathsNV - GLuint path - GLsizei range - - - void glDeletePerfMonitorsAMD - GLsizei n - GLuint *monitors - - - void glDeletePerfQueryINTEL - GLuint queryHandle - - - void glDeleteProgram - GLuint program - - - - void glDeleteProgramPipelines - GLsizei n - const GLuint *pipelines - - - void glDeleteProgramPipelinesEXT - GLsizei n - const GLuint *pipelines - - - void glDeleteProgramsARB - GLsizei n - const GLuint *programs - - - - void glDeleteProgramsNV - GLsizei n - const GLuint *programs - - - - - void glDeleteQueries - GLsizei n - const GLuint *ids - - - - void glDeleteQueriesARB - GLsizei n - const GLuint *ids - - - - void glDeleteQueriesEXT - GLsizei n - const GLuint *ids - - - void glDeleteRenderbuffers - GLsizei n - const GLuint *renderbuffers - - - - void glDeleteRenderbuffersEXT - GLsizei n - const GLuint *renderbuffers - - - - - void glDeleteRenderbuffersOES - GLsizei n - const GLuint *renderbuffers - - - void glDeleteSamplers - GLsizei count - const GLuint *samplers - - - void glDeleteShader - GLuint shader - - - - void glDeleteSync - GLsync sync - - - void glDeleteSyncAPPLE - GLsync sync - - - - void glDeleteTextures - GLsizei n - const GLuint *textures - - - - void glDeleteTexturesEXT - GLsizei n - const GLuint *textures - - - - void glDeleteTransformFeedbacks - GLsizei n - const GLuint *ids - - - void glDeleteTransformFeedbacksNV - GLsizei n - const GLuint *ids - - - - void glDeleteVertexArrays - GLsizei n - const GLuint *arrays - - - - void glDeleteVertexArraysAPPLE - GLsizei n - const GLuint *arrays - - - - void glDeleteVertexArraysOES - GLsizei n - const GLuint *arrays - - - - void glDeleteVertexShaderEXT - GLuint id - - - void glDepthBoundsEXT - GLclampd zmin - GLclampd zmax - - - - void glDepthBoundsdNV - GLdouble zmin - GLdouble zmax - - - - void glDepthFunc - GLenum func - - - - void glDepthMask - GLboolean flag - - - - void glDepthRange - GLdouble near - GLdouble far - - - - void glDepthRangeArrayv - GLuint first - GLsizei count - const GLdouble *v - - - void glDepthRangeIndexed - GLuint index - GLdouble n - GLdouble f - - - void glDepthRangedNV - GLdouble zNear - GLdouble zFar - - - - void glDepthRangef - GLfloat n - GLfloat f - - - void glDepthRangefOES - GLclampf n - GLclampf f - - - - - void glDepthRangex - GLfixed n - GLfixed f - - - void glDepthRangexOES - GLfixed n - GLfixed f - - - void glDetachObjectARB - GLhandleARB containerObj - GLhandleARB attachedObj - - - - void glDetachShader - GLuint program - GLuint shader - - - void glDetailTexFuncSGIS - GLenum target - GLsizei n - const GLfloat *points - - - - void glDisable - GLenum cap - - - - void glDisableClientState - GLenum array - - - void glDisableClientStateIndexedEXT - GLenum array - GLuint index - - - void glDisableClientStateiEXT - GLenum array - GLuint index - - - void glDisableDriverControlQCOM - GLuint driverControl - - - void glDisableIndexedEXT - GLenum target - GLuint index - - - - void glDisableVariantClientStateEXT - GLuint id - - - void glDisableVertexArrayAttribEXT - GLuint vaobj - GLuint index - - - void glDisableVertexArrayEXT - GLuint vaobj - GLenum array - - - void glDisableVertexAttribAPPLE - GLuint index - GLenum pname - - - void glDisableVertexAttribArray - GLuint index - - - void glDisableVertexAttribArrayARB - GLuint index - - - - void glDisablei - GLenum target - GLuint index - - - void glDisableiEXT - GLenum target - GLuint index - - - - void glDiscardFramebufferEXT - GLenum target - GLsizei numAttachments - const GLenum *attachments - - - void glDispatchCompute - GLuint num_groups_x - GLuint num_groups_y - GLuint num_groups_z - - - void glDispatchComputeGroupSizeARB - GLuint num_groups_x - GLuint num_groups_y - GLuint num_groups_z - GLuint group_size_x - GLuint group_size_y - GLuint group_size_z - - - void glDispatchComputeIndirect - GLintptr indirect - - - void glDrawArrays - GLenum mode - GLint first - GLsizei count - - - - void glDrawArraysEXT - GLenum mode - GLint first - GLsizei count - - - - - void glDrawArraysIndirect - GLenum mode - const void *indirect - - - void glDrawArraysInstanced - GLenum mode - GLint first - GLsizei count - GLsizei instancecount - - - void glDrawArraysInstancedANGLE - GLenum mode - GLint first - GLsizei count - GLsizei primcount - - - - void glDrawArraysInstancedARB - GLenum mode - GLint first - GLsizei count - GLsizei primcount - - - - void glDrawArraysInstancedBaseInstance - GLenum mode - GLint first - GLsizei count - GLsizei instancecount - GLuint baseinstance - - - void glDrawArraysInstancedEXT - GLenum mode - GLint start - GLsizei count - GLsizei primcount - - - - void glDrawArraysInstancedNV - GLenum mode - GLint first - GLsizei count - GLsizei primcount - - - - void glDrawBuffer - GLenum mode - - - - void glDrawBuffers - GLsizei n - const GLenum *bufs - - - - void glDrawBuffersARB - GLsizei n - const GLenum *bufs - - - - void glDrawBuffersATI - GLsizei n - const GLenum *bufs - - - - - void glDrawBuffersEXT - GLsizei n - const GLenum *bufs - - - - void glDrawBuffersIndexedEXT - GLint n - const GLenum *location - const GLint *indices - - - void glDrawBuffersNV - GLsizei n - const GLenum *bufs - - - void glDrawElementArrayAPPLE - GLenum mode - GLint first - GLsizei count - - - void glDrawElementArrayATI - GLenum mode - GLsizei count - - - void glDrawElements - GLenum mode - GLsizei count - GLenum type - const void *indices - - - void glDrawElementsBaseVertex - GLenum mode - GLsizei count - GLenum type - const void *indices - GLint basevertex - - - void glDrawElementsIndirect - GLenum mode - GLenum type - const void *indirect - - - void glDrawElementsInstanced - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei instancecount - - - void glDrawElementsInstancedANGLE - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei primcount - - - - void glDrawElementsInstancedARB - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei primcount - - - - void glDrawElementsInstancedBaseInstance - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei instancecount - GLuint baseinstance - - - void glDrawElementsInstancedBaseVertex - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei instancecount - GLint basevertex - - - void glDrawElementsInstancedBaseVertexBaseInstance - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei instancecount - GLint basevertex - GLuint baseinstance - - - void glDrawElementsInstancedEXT - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei primcount - - - - void glDrawElementsInstancedNV - GLenum mode - GLsizei count - GLenum type - const void *indices - GLsizei primcount - - - - void glDrawMeshArraysSUN - GLenum mode - GLint first - GLsizei count - GLsizei width - - - void glDrawPixels - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *pixels - - - - - void glDrawRangeElementArrayAPPLE - GLenum mode - GLuint start - GLuint end - GLint first - GLsizei count - - - void glDrawRangeElementArrayATI - GLenum mode - GLuint start - GLuint end - GLsizei count - - - void glDrawRangeElements - GLenum mode - GLuint start - GLuint end - GLsizei count - GLenum type - const void *indices - - - void glDrawRangeElementsBaseVertex - GLenum mode - GLuint start - GLuint end - GLsizei count - GLenum type - const void *indices - GLint basevertex - - - void glDrawRangeElementsEXT - GLenum mode - GLuint start - GLuint end - GLsizei count - GLenum type - const void *indices - - - - void glDrawTexfOES - GLfloat x - GLfloat y - GLfloat z - GLfloat width - GLfloat height - - - void glDrawTexfvOES - const GLfloat *coords - - - void glDrawTexiOES - GLint x - GLint y - GLint z - GLint width - GLint height - - - void glDrawTexivOES - const GLint *coords - - - void glDrawTexsOES - GLshort x - GLshort y - GLshort z - GLshort width - GLshort height - - - void glDrawTexsvOES - const GLshort *coords - - - void glDrawTextureNV - GLuint texture - GLuint sampler - GLfloat x0 - GLfloat y0 - GLfloat x1 - GLfloat y1 - GLfloat z - GLfloat s0 - GLfloat t0 - GLfloat s1 - GLfloat t1 - - - void glDrawTexxOES - GLfixed x - GLfixed y - GLfixed z - GLfixed width - GLfixed height - - - void glDrawTexxvOES - const GLfixed *coords - - - void glDrawTransformFeedback - GLenum mode - GLuint id - - - void glDrawTransformFeedbackInstanced - GLenum mode - GLuint id - GLsizei instancecount - - - void glDrawTransformFeedbackNV - GLenum mode - GLuint id - - - - void glDrawTransformFeedbackStream - GLenum mode - GLuint id - GLuint stream - - - void glDrawTransformFeedbackStreamInstanced - GLenum mode - GLuint id - GLuint stream - GLsizei instancecount - - - void glEGLImageTargetRenderbufferStorageOES - GLenum target - GLeglImageOES image - - - void glEGLImageTargetTexture2DOES - GLenum target - GLeglImageOES image - - - void glEdgeFlag - GLboolean flag - - - - void glEdgeFlagFormatNV - GLsizei stride - - - void glEdgeFlagPointer - GLsizei stride - const void *pointer - - - void glEdgeFlagPointerEXT - GLsizei stride - GLsizei count - const GLboolean *pointer - - - void glEdgeFlagPointerListIBM - GLint stride - const GLboolean **pointer - GLint ptrstride - - - void glEdgeFlagv - const GLboolean *flag - - - - void glElementPointerAPPLE - GLenum type - const void *pointer - - - void glElementPointerATI - GLenum type - const void *pointer - - - void glEnable - GLenum cap - - - - void glEnableClientState - GLenum array - - - void glEnableClientStateIndexedEXT - GLenum array - GLuint index - - - void glEnableClientStateiEXT - GLenum array - GLuint index - - - void glEnableDriverControlQCOM - GLuint driverControl - - - void glEnableIndexedEXT - GLenum target - GLuint index - - - - void glEnableVariantClientStateEXT - GLuint id - - - void glEnableVertexArrayAttribEXT - GLuint vaobj - GLuint index - - - void glEnableVertexArrayEXT - GLuint vaobj - GLenum array - - - void glEnableVertexAttribAPPLE - GLuint index - GLenum pname - - - void glEnableVertexAttribArray - GLuint index - - - void glEnableVertexAttribArrayARB - GLuint index - - - - void glEnablei - GLenum target - GLuint index - - - void glEnableiEXT - GLenum target - GLuint index - - - - void glEnd - - - - void glEndConditionalRender - - - - void glEndConditionalRenderNV - - - - void glEndConditionalRenderNVX - - - - void glEndFragmentShaderATI - - - void glEndList - - - - void glEndOcclusionQueryNV - - - void glEndPerfMonitorAMD - GLuint monitor - - - void glEndPerfQueryINTEL - GLuint queryHandle - - - void glEndQuery - GLenum target - - - - void glEndQueryARB - GLenum target - - - - void glEndQueryEXT - GLenum target - - - void glEndQueryIndexed - GLenum target - GLuint index - - - void glEndTilingQCOM - GLbitfield preserveMask - - - void glEndTransformFeedback - - - void glEndTransformFeedbackEXT - - - - void glEndTransformFeedbackNV - - - - void glEndVertexShaderEXT - - - void glEndVideoCaptureNV - GLuint video_capture_slot - - - void glEvalCoord1d - GLdouble u - - - - void glEvalCoord1dv - const GLdouble *u - - - - void glEvalCoord1f - GLfloat u - - - - void glEvalCoord1fv - const GLfloat *u - - - - void glEvalCoord1xOES - GLfixed u - - - void glEvalCoord1xvOES - const GLfixed *coords - - - void glEvalCoord2d - GLdouble u - GLdouble v - - - - void glEvalCoord2dv - const GLdouble *u - - - - void glEvalCoord2f - GLfloat u - GLfloat v - - - - void glEvalCoord2fv - const GLfloat *u - - - - void glEvalCoord2xOES - GLfixed u - GLfixed v - - - void glEvalCoord2xvOES - const GLfixed *coords - - - void glEvalMapsNV - GLenum target - GLenum mode - - - void glEvalMesh1 - GLenum mode - GLint i1 - GLint i2 - - - - void glEvalMesh2 - GLenum mode - GLint i1 - GLint i2 - GLint j1 - GLint j2 - - - - void glEvalPoint1 - GLint i - - - - void glEvalPoint2 - GLint i - GLint j - - - - void glExecuteProgramNV - GLenum target - GLuint id - const GLfloat *params - - - - void glExtGetBufferPointervQCOM - GLenum target - void **params - - - void glExtGetBuffersQCOM - GLuint *buffers - GLint maxBuffers - GLint *numBuffers - - - void glExtGetFramebuffersQCOM - GLuint *framebuffers - GLint maxFramebuffers - GLint *numFramebuffers - - - void glExtGetProgramBinarySourceQCOM - GLuint program - GLenum shadertype - GLchar *source - GLint *length - - - void glExtGetProgramsQCOM - GLuint *programs - GLint maxPrograms - GLint *numPrograms - - - void glExtGetRenderbuffersQCOM - GLuint *renderbuffers - GLint maxRenderbuffers - GLint *numRenderbuffers - - - void glExtGetShadersQCOM - GLuint *shaders - GLint maxShaders - GLint *numShaders - - - void glExtGetTexLevelParameterivQCOM - GLuint texture - GLenum face - GLint level - GLenum pname - GLint *params - - - void glExtGetTexSubImageQCOM - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - void *texels - - - void glExtGetTexturesQCOM - GLuint *textures - GLint maxTextures - GLint *numTextures - - - GLboolean glExtIsProgramBinaryQCOM - GLuint program - - - void glExtTexObjectStateOverrideiQCOM - GLenum target - GLenum pname - GLint param - - - void glExtractComponentEXT - GLuint res - GLuint src - GLuint num - - - void glFeedbackBuffer - GLsizei size - GLenum type - GLfloat *buffer - - - - void glFeedbackBufferxOES - GLsizei n - GLenum type - const GLfixed *buffer - - - GLsync glFenceSync - GLenum condition - GLbitfield flags - - - GLsync glFenceSyncAPPLE - GLenum condition - GLbitfield flags - - - - void glFinalCombinerInputNV - GLenum variable - GLenum input - GLenum mapping - GLenum componentUsage - - - - void glFinish - - - - GLint glFinishAsyncSGIX - GLuint *markerp - - - void glFinishFenceAPPLE - GLuint fence - - - void glFinishFenceNV - GLuint fence - - - - void glFinishObjectAPPLE - GLenum object - GLint name - - - void glFinishTextureSUNX - - - void glFlush - - - - void glFlushMappedBufferRange - GLenum target - GLintptr offset - GLsizeiptr length - - - void glFlushMappedBufferRangeAPPLE - GLenum target - GLintptr offset - GLsizeiptr size - - - - void glFlushMappedBufferRangeEXT - GLenum target - GLintptr offset - GLsizeiptr length - - - - void glFlushMappedNamedBufferRangeEXT - GLuint buffer - GLintptr offset - GLsizeiptr length - - - void glFlushPixelDataRangeNV - GLenum target - - - void glFlushRasterSGIX - - - - void glFlushStaticDataIBM - GLenum target - - - void glFlushVertexArrayRangeAPPLE - GLsizei length - void *pointer - - - void glFlushVertexArrayRangeNV - - - void glFogCoordFormatNV - GLenum type - GLsizei stride - - - void glFogCoordPointer - GLenum type - GLsizei stride - const void *pointer - - - void glFogCoordPointerEXT - GLenum type - GLsizei stride - const void *pointer - - - - void glFogCoordPointerListIBM - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glFogCoordd - GLdouble coord - - - - void glFogCoorddEXT - GLdouble coord - - - - - void glFogCoorddv - const GLdouble *coord - - - - void glFogCoorddvEXT - const GLdouble *coord - - - - - void glFogCoordf - GLfloat coord - - - - void glFogCoordfEXT - GLfloat coord - - - - - void glFogCoordfv - const GLfloat *coord - - - - void glFogCoordfvEXT - const GLfloat *coord - - - - - void glFogCoordhNV - GLhalfNV fog - - - - void glFogCoordhvNV - const GLhalfNV *fog - - - - void glFogFuncSGIS - GLsizei n - const GLfloat *points - - - - void glFogf - GLenum pname - GLfloat param - - - - void glFogfv - GLenum pname - const GLfloat *params - - - - void glFogi - GLenum pname - GLint param - - - - void glFogiv - GLenum pname - const GLint *params - - - - void glFogx - GLenum pname - GLfixed param - - - void glFogxOES - GLenum pname - GLfixed param - - - void glFogxv - GLenum pname - const GLfixed *param - - - void glFogxvOES - GLenum pname - const GLfixed *param - - - void glFragmentColorMaterialSGIX - GLenum face - GLenum mode - - - void glFragmentLightModelfSGIX - GLenum pname - GLfloat param - - - void glFragmentLightModelfvSGIX - GLenum pname - const GLfloat *params - - - void glFragmentLightModeliSGIX - GLenum pname - GLint param - - - void glFragmentLightModelivSGIX - GLenum pname - const GLint *params - - - void glFragmentLightfSGIX - GLenum light - GLenum pname - GLfloat param - - - void glFragmentLightfvSGIX - GLenum light - GLenum pname - const GLfloat *params - - - void glFragmentLightiSGIX - GLenum light - GLenum pname - GLint param - - - void glFragmentLightivSGIX - GLenum light - GLenum pname - const GLint *params - - - void glFragmentMaterialfSGIX - GLenum face - GLenum pname - GLfloat param - - - void glFragmentMaterialfvSGIX - GLenum face - GLenum pname - const GLfloat *params - - - void glFragmentMaterialiSGIX - GLenum face - GLenum pname - GLint param - - - void glFragmentMaterialivSGIX - GLenum face - GLenum pname - const GLint *params - - - void glFrameTerminatorGREMEDY - - - void glFrameZoomSGIX - GLint factor - - - - void glFramebufferDrawBufferEXT - GLuint framebuffer - GLenum mode - - - void glFramebufferDrawBuffersEXT - GLuint framebuffer - GLsizei n - const GLenum *bufs - - - void glFramebufferParameteri - GLenum target - GLenum pname - GLint param - - - void glFramebufferReadBufferEXT - GLuint framebuffer - GLenum mode - - - void glFramebufferRenderbuffer - GLenum target - GLenum attachment - GLenum renderbuffertarget - GLuint renderbuffer - - - - void glFramebufferRenderbufferEXT - GLenum target - GLenum attachment - GLenum renderbuffertarget - GLuint renderbuffer - - - - - void glFramebufferRenderbufferOES - GLenum target - GLenum attachment - GLenum renderbuffertarget - GLuint renderbuffer - - - void glFramebufferTexture - GLenum target - GLenum attachment - GLuint texture - GLint level - - - void glFramebufferTexture1D - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - - void glFramebufferTexture1DEXT - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - - - void glFramebufferTexture2D - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - - void glFramebufferTexture2DEXT - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - - - void glFramebufferTexture2DMultisampleEXT - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - GLsizei samples - - - void glFramebufferTexture2DMultisampleIMG - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - GLsizei samples - - - void glFramebufferTexture2DOES - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - void glFramebufferTexture3D - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - GLint zoffset - - - - void glFramebufferTexture3DEXT - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - GLint zoffset - - - - - void glFramebufferTexture3DOES - GLenum target - GLenum attachment - GLenum textarget - GLuint texture - GLint level - GLint zoffset - - - - void glFramebufferTextureARB - GLenum target - GLenum attachment - GLuint texture - GLint level - - - - void glFramebufferTextureEXT - GLenum target - GLenum attachment - GLuint texture - GLint level - - - - void glFramebufferTextureFaceARB - GLenum target - GLenum attachment - GLuint texture - GLint level - GLenum face - - - void glFramebufferTextureFaceEXT - GLenum target - GLenum attachment - GLuint texture - GLint level - GLenum face - - - - void glFramebufferTextureLayer - GLenum target - GLenum attachment - GLuint texture - GLint level - GLint layer - - - - void glFramebufferTextureLayerARB - GLenum target - GLenum attachment - GLuint texture - GLint level - GLint layer - - - - void glFramebufferTextureLayerEXT - GLenum target - GLenum attachment - GLuint texture - GLint level - GLint layer - - - - void glFreeObjectBufferATI - GLuint buffer - - - void glFrontFace - GLenum mode - - - - void glFrustum - GLdouble left - GLdouble right - GLdouble bottom - GLdouble top - GLdouble zNear - GLdouble zFar - - - - void glFrustumf - GLfloat l - GLfloat r - GLfloat b - GLfloat t - GLfloat n - GLfloat f - - - void glFrustumfOES - GLfloat l - GLfloat r - GLfloat b - GLfloat t - GLfloat n - GLfloat f - - - - void glFrustumx - GLfixed l - GLfixed r - GLfixed b - GLfixed t - GLfixed n - GLfixed f - - - void glFrustumxOES - GLfixed l - GLfixed r - GLfixed b - GLfixed t - GLfixed n - GLfixed f - - - GLuint glGenAsyncMarkersSGIX - GLsizei range - - - void glGenBuffers - GLsizei n - GLuint *buffers - - - void glGenBuffersARB - GLsizei n - GLuint *buffers - - - - void glGenFencesAPPLE - GLsizei n - GLuint *fences - - - void glGenFencesNV - GLsizei n - GLuint *fences - - - - GLuint glGenFragmentShadersATI - GLuint range - - - void glGenFramebuffers - GLsizei n - GLuint *framebuffers - - - - void glGenFramebuffersEXT - GLsizei n - GLuint *framebuffers - - - - - void glGenFramebuffersOES - GLsizei n - GLuint *framebuffers - - - GLuint glGenLists - GLsizei range - - - - void glGenNamesAMD - GLenum identifier - GLuint num - GLuint *names - - - void glGenOcclusionQueriesNV - GLsizei n - GLuint *ids - - - GLuint glGenPathsNV - GLsizei range - - - void glGenPerfMonitorsAMD - GLsizei n - GLuint *monitors - - - void glGenProgramPipelines - GLsizei n - GLuint *pipelines - - - void glGenProgramPipelinesEXT - GLsizei n - GLuint *pipelines - - - void glGenProgramsARB - GLsizei n - GLuint *programs - - - - void glGenProgramsNV - GLsizei n - GLuint *programs - - - - - void glGenQueries - GLsizei n - GLuint *ids - - - - void glGenQueriesARB - GLsizei n - GLuint *ids - - - - void glGenQueriesEXT - GLsizei n - GLuint *ids - - - void glGenRenderbuffers - GLsizei n - GLuint *renderbuffers - - - - void glGenRenderbuffersEXT - GLsizei n - GLuint *renderbuffers - - - - - void glGenRenderbuffersOES - GLsizei n - GLuint *renderbuffers - - - void glGenSamplers - GLsizei count - GLuint *samplers - - - GLuint glGenSymbolsEXT - GLenum datatype - GLenum storagetype - GLenum range - GLuint components - - - void glGenTextures - GLsizei n - GLuint *textures - - - - void glGenTexturesEXT - GLsizei n - GLuint *textures - - - - void glGenTransformFeedbacks - GLsizei n - GLuint *ids - - - void glGenTransformFeedbacksNV - GLsizei n - GLuint *ids - - - - void glGenVertexArrays - GLsizei n - GLuint *arrays - - - - void glGenVertexArraysAPPLE - GLsizei n - GLuint *arrays - - - - void glGenVertexArraysOES - GLsizei n - GLuint *arrays - - - - GLuint glGenVertexShadersEXT - GLuint range - - - void glGenerateMipmap - GLenum target - - - - void glGenerateMipmapEXT - GLenum target - - - - - void glGenerateMipmapOES - GLenum target - - - void glGenerateMultiTexMipmapEXT - GLenum texunit - GLenum target - - - void glGenerateTextureMipmapEXT - GLuint texture - GLenum target - - - void glGetActiveAtomicCounterBufferiv - GLuint program - GLuint bufferIndex - GLenum pname - GLint *params - - - void glGetActiveAttrib - GLuint program - GLuint index - GLsizei bufSize - GLsizei *length - GLint *size - GLenum *type - GLchar *name - - - void glGetActiveAttribARB - GLhandleARB programObj - GLuint index - GLsizei maxLength - GLsizei *length - GLint *size - GLenum *type - GLcharARB *name - - - - void glGetActiveSubroutineName - GLuint program - GLenum shadertype - GLuint index - GLsizei bufsize - GLsizei *length - GLchar *name - - - void glGetActiveSubroutineUniformName - GLuint program - GLenum shadertype - GLuint index - GLsizei bufsize - GLsizei *length - GLchar *name - - - void glGetActiveSubroutineUniformiv - GLuint program - GLenum shadertype - GLuint index - GLenum pname - GLint *values - - - void glGetActiveUniform - GLuint program - GLuint index - GLsizei bufSize - GLsizei *length - GLint *size - GLenum *type - GLchar *name - - - void glGetActiveUniformARB - GLhandleARB programObj - GLuint index - GLsizei maxLength - GLsizei *length - GLint *size - GLenum *type - GLcharARB *name - - - - void glGetActiveUniformBlockName - GLuint program - GLuint uniformBlockIndex - GLsizei bufSize - GLsizei *length - GLchar *uniformBlockName - - - void glGetActiveUniformBlockiv - GLuint program - GLuint uniformBlockIndex - GLenum pname - GLint *params - - - void glGetActiveUniformName - GLuint program - GLuint uniformIndex - GLsizei bufSize - GLsizei *length - GLchar *uniformName - - - void glGetActiveUniformsiv - GLuint program - GLsizei uniformCount - const GLuint *uniformIndices - GLenum pname - GLint *params - - - void glGetActiveVaryingNV - GLuint program - GLuint index - GLsizei bufSize - GLsizei *length - GLsizei *size - GLenum *type - GLchar *name - - - void glGetArrayObjectfvATI - GLenum array - GLenum pname - GLfloat *params - - - void glGetArrayObjectivATI - GLenum array - GLenum pname - GLint *params - - - void glGetAttachedObjectsARB - GLhandleARB containerObj - GLsizei maxCount - GLsizei *count - GLhandleARB *obj - - - void glGetAttachedShaders - GLuint program - GLsizei maxCount - GLsizei *count - GLuint *shaders - - - GLint glGetAttribLocation - GLuint program - const GLchar *name - - - GLint glGetAttribLocationARB - GLhandleARB programObj - const GLcharARB *name - - - - void glGetBooleanIndexedvEXT - GLenum target - GLuint index - GLboolean *data - - - - void glGetBooleani_v - GLenum target - GLuint index - GLboolean *data - - - void glGetBooleanv - GLenum pname - GLboolean *data - - - - void glGetBufferParameteri64v - GLenum target - GLenum pname - GLint64 *params - - - void glGetBufferParameteriv - GLenum target - GLenum pname - GLint *params - - - void glGetBufferParameterivARB - GLenum target - GLenum pname - GLint *params - - - - void glGetBufferParameterui64vNV - GLenum target - GLenum pname - GLuint64EXT *params - - - void glGetBufferPointerv - GLenum target - GLenum pname - void **params - - - void glGetBufferPointervARB - GLenum target - GLenum pname - void **params - - - - void glGetBufferPointervOES - GLenum target - GLenum pname - void **params - - - - void glGetBufferSubData - GLenum target - GLintptr offset - GLsizeiptr size - void *data - - - void glGetBufferSubDataARB - GLenum target - GLintptrARB offset - GLsizeiptrARB size - void *data - - - - void glGetClipPlane - GLenum plane - GLdouble *equation - - - - void glGetClipPlanef - GLenum plane - GLfloat *equation - - - void glGetClipPlanefOES - GLenum plane - GLfloat *equation - - - - void glGetClipPlanex - GLenum plane - GLfixed *equation - - - void glGetClipPlanexOES - GLenum plane - GLfixed *equation - - - void glGetColorTable - GLenum target - GLenum format - GLenum type - void *table - - - - - void glGetColorTableEXT - GLenum target - GLenum format - GLenum type - void *data - - - - void glGetColorTableParameterfv - GLenum target - GLenum pname - GLfloat *params - - - - void glGetColorTableParameterfvEXT - GLenum target - GLenum pname - GLfloat *params - - - - void glGetColorTableParameterfvSGI - GLenum target - GLenum pname - GLfloat *params - - - - void glGetColorTableParameteriv - GLenum target - GLenum pname - GLint *params - - - - void glGetColorTableParameterivEXT - GLenum target - GLenum pname - GLint *params - - - - void glGetColorTableParameterivSGI - GLenum target - GLenum pname - GLint *params - - - - void glGetColorTableSGI - GLenum target - GLenum format - GLenum type - void *table - - - - void glGetCombinerInputParameterfvNV - GLenum stage - GLenum portion - GLenum variable - GLenum pname - GLfloat *params - - - - void glGetCombinerInputParameterivNV - GLenum stage - GLenum portion - GLenum variable - GLenum pname - GLint *params - - - - void glGetCombinerOutputParameterfvNV - GLenum stage - GLenum portion - GLenum pname - GLfloat *params - - - - void glGetCombinerOutputParameterivNV - GLenum stage - GLenum portion - GLenum pname - GLint *params - - - - void glGetCombinerStageParameterfvNV - GLenum stage - GLenum pname - GLfloat *params - - - void glGetCompressedMultiTexImageEXT - GLenum texunit - GLenum target - GLint lod - void *img - - - void glGetCompressedTexImage - GLenum target - GLint level - void *img - - - - - void glGetCompressedTexImageARB - GLenum target - GLint level - void *img - - - - - void glGetCompressedTextureImageEXT - GLuint texture - GLenum target - GLint lod - void *img - - - void glGetConvolutionFilter - GLenum target - GLenum format - GLenum type - void *image - - - - - void glGetConvolutionFilterEXT - GLenum target - GLenum format - GLenum type - void *image - - - - void glGetConvolutionParameterfv - GLenum target - GLenum pname - GLfloat *params - - - - void glGetConvolutionParameterfvEXT - GLenum target - GLenum pname - GLfloat *params - - - - void glGetConvolutionParameteriv - GLenum target - GLenum pname - GLint *params - - - - void glGetConvolutionParameterivEXT - GLenum target - GLenum pname - GLint *params - - - - void glGetConvolutionParameterxvOES - GLenum target - GLenum pname - GLfixed *params - - - GLuint glGetDebugMessageLog - GLuint count - GLsizei bufSize - GLenum *sources - GLenum *types - GLuint *ids - GLenum *severities - GLsizei *lengths - GLchar *messageLog - - - GLuint glGetDebugMessageLogAMD - GLuint count - GLsizei bufsize - GLenum *categories - GLuint *severities - GLuint *ids - GLsizei *lengths - GLchar *message - - - GLuint glGetDebugMessageLogARB - GLuint count - GLsizei bufSize - GLenum *sources - GLenum *types - GLuint *ids - GLenum *severities - GLsizei *lengths - GLchar *messageLog - - - - GLuint glGetDebugMessageLogKHR - GLuint count - GLsizei bufSize - GLenum *sources - GLenum *types - GLuint *ids - GLenum *severities - GLsizei *lengths - GLchar *messageLog - - - - void glGetDetailTexFuncSGIS - GLenum target - GLfloat *points - - - - void glGetDoubleIndexedvEXT - GLenum target - GLuint index - GLdouble *data - - - - void glGetDoublei_v - GLenum target - GLuint index - GLdouble *data - - - void glGetDoublei_vEXT - GLenum pname - GLuint index - GLdouble *params - - - - void glGetDoublev - GLenum pname - GLdouble *data - - - - void glGetDriverControlStringQCOM - GLuint driverControl - GLsizei bufSize - GLsizei *length - GLchar *driverControlString - - - void glGetDriverControlsQCOM - GLint *num - GLsizei size - GLuint *driverControls - - - GLenum glGetError - - - - void glGetFenceivNV - GLuint fence - GLenum pname - GLint *params - - - - void glGetFinalCombinerInputParameterfvNV - GLenum variable - GLenum pname - GLfloat *params - - - - void glGetFinalCombinerInputParameterivNV - GLenum variable - GLenum pname - GLint *params - - - - void glGetFirstPerfQueryIdINTEL - GLuint *queryId - - - void glGetFixedv - GLenum pname - GLfixed *params - - - void glGetFixedvOES - GLenum pname - GLfixed *params - - - void glGetFloatIndexedvEXT - GLenum target - GLuint index - GLfloat *data - - - - void glGetFloati_v - GLenum target - GLuint index - GLfloat *data - - - void glGetFloati_vEXT - GLenum pname - GLuint index - GLfloat *params - - - - void glGetFloatv - GLenum pname - GLfloat *data - - - - void glGetFogFuncSGIS - GLfloat *points - - - GLint glGetFragDataIndex - GLuint program - const GLchar *name - - - GLint glGetFragDataLocation - GLuint program - const GLchar *name - - - GLint glGetFragDataLocationEXT - GLuint program - const GLchar *name - - - - void glGetFragmentLightfvSGIX - GLenum light - GLenum pname - GLfloat *params - - - void glGetFragmentLightivSGIX - GLenum light - GLenum pname - GLint *params - - - void glGetFragmentMaterialfvSGIX - GLenum face - GLenum pname - GLfloat *params - - - void glGetFragmentMaterialivSGIX - GLenum face - GLenum pname - GLint *params - - - void glGetFramebufferAttachmentParameteriv - GLenum target - GLenum attachment - GLenum pname - GLint *params - - - - void glGetFramebufferAttachmentParameterivEXT - GLenum target - GLenum attachment - GLenum pname - GLint *params - - - - - void glGetFramebufferAttachmentParameterivOES - GLenum target - GLenum attachment - GLenum pname - GLint *params - - - void glGetFramebufferParameteriv - GLenum target - GLenum pname - GLint *params - - - void glGetFramebufferParameterivEXT - GLuint framebuffer - GLenum pname - GLint *params - - - GLenum glGetGraphicsResetStatusARB - - - GLenum glGetGraphicsResetStatusEXT - - - GLhandleARB glGetHandleARB - GLenum pname - - - void glGetHistogram - GLenum target - GLboolean reset - GLenum format - GLenum type - void *values - - - - - void glGetHistogramEXT - GLenum target - GLboolean reset - GLenum format - GLenum type - void *values - - - - void glGetHistogramParameterfv - GLenum target - GLenum pname - GLfloat *params - - - - void glGetHistogramParameterfvEXT - GLenum target - GLenum pname - GLfloat *params - - - - void glGetHistogramParameteriv - GLenum target - GLenum pname - GLint *params - - - - void glGetHistogramParameterivEXT - GLenum target - GLenum pname - GLint *params - - - - void glGetHistogramParameterxvOES - GLenum target - GLenum pname - GLfixed *params - - - GLuint64 glGetImageHandleARB - GLuint texture - GLint level - GLboolean layered - GLint layer - GLenum format - - - GLuint64 glGetImageHandleNV - GLuint texture - GLint level - GLboolean layered - GLint layer - GLenum format - - - void glGetImageTransformParameterfvHP - GLenum target - GLenum pname - GLfloat *params - - - void glGetImageTransformParameterivHP - GLenum target - GLenum pname - GLint *params - - - void glGetInfoLogARB - GLhandleARB obj - GLsizei maxLength - GLsizei *length - GLcharARB *infoLog - - - GLint glGetInstrumentsSGIX - - - - void glGetInteger64i_v - GLenum target - GLuint index - GLint64 *data - - - void glGetInteger64v - GLenum pname - GLint64 *data - - - void glGetInteger64vAPPLE - GLenum pname - GLint64 *params - - - - void glGetIntegerIndexedvEXT - GLenum target - GLuint index - GLint *data - - - - void glGetIntegeri_v - GLenum target - GLuint index - GLint *data - - - void glGetIntegeri_vEXT - GLenum target - GLuint index - GLint *data - - - void glGetIntegerui64i_vNV - GLenum value - GLuint index - GLuint64EXT *result - - - void glGetIntegerui64vNV - GLenum value - GLuint64EXT *result - - - void glGetIntegerv - GLenum pname - GLint *data - - - - void glGetInternalformati64v - GLenum target - GLenum internalformat - GLenum pname - GLsizei bufSize - GLint64 *params - - - void glGetInternalformativ - GLenum target - GLenum internalformat - GLenum pname - GLsizei bufSize - GLint *params - - - void glGetInvariantBooleanvEXT - GLuint id - GLenum value - GLboolean *data - - - void glGetInvariantFloatvEXT - GLuint id - GLenum value - GLfloat *data - - - void glGetInvariantIntegervEXT - GLuint id - GLenum value - GLint *data - - - void glGetLightfv - GLenum light - GLenum pname - GLfloat *params - - - - void glGetLightiv - GLenum light - GLenum pname - GLint *params - - - - void glGetLightxOES - GLenum light - GLenum pname - GLfixed *params - - - void glGetLightxv - GLenum light - GLenum pname - GLfixed *params - - - void glGetLightxvOES - GLenum light - GLenum pname - GLfixed *params - - - void glGetListParameterfvSGIX - GLuint list - GLenum pname - GLfloat *params - - - void glGetListParameterivSGIX - GLuint list - GLenum pname - GLint *params - - - void glGetLocalConstantBooleanvEXT - GLuint id - GLenum value - GLboolean *data - - - void glGetLocalConstantFloatvEXT - GLuint id - GLenum value - GLfloat *data - - - void glGetLocalConstantIntegervEXT - GLuint id - GLenum value - GLint *data - - - void glGetMapAttribParameterfvNV - GLenum target - GLuint index - GLenum pname - GLfloat *params - - - void glGetMapAttribParameterivNV - GLenum target - GLuint index - GLenum pname - GLint *params - - - void glGetMapControlPointsNV - GLenum target - GLuint index - GLenum type - GLsizei ustride - GLsizei vstride - GLboolean packed - void *points - - - void glGetMapParameterfvNV - GLenum target - GLenum pname - GLfloat *params - - - void glGetMapParameterivNV - GLenum target - GLenum pname - GLint *params - - - void glGetMapdv - GLenum target - GLenum query - GLdouble *v - - - - void glGetMapfv - GLenum target - GLenum query - GLfloat *v - - - - void glGetMapiv - GLenum target - GLenum query - GLint *v - - - - void glGetMapxvOES - GLenum target - GLenum query - GLfixed *v - - - void glGetMaterialfv - GLenum face - GLenum pname - GLfloat *params - - - - void glGetMaterialiv - GLenum face - GLenum pname - GLint *params - - - - void glGetMaterialxOES - GLenum face - GLenum pname - GLfixed param - - - void glGetMaterialxv - GLenum face - GLenum pname - GLfixed *params - - - void glGetMaterialxvOES - GLenum face - GLenum pname - GLfixed *params - - - void glGetMinmax - GLenum target - GLboolean reset - GLenum format - GLenum type - void *values - - - - - void glGetMinmaxEXT - GLenum target - GLboolean reset - GLenum format - GLenum type - void *values - - - - void glGetMinmaxParameterfv - GLenum target - GLenum pname - GLfloat *params - - - - void glGetMinmaxParameterfvEXT - GLenum target - GLenum pname - GLfloat *params - - - - void glGetMinmaxParameteriv - GLenum target - GLenum pname - GLint *params - - - - void glGetMinmaxParameterivEXT - GLenum target - GLenum pname - GLint *params - - - - void glGetMultiTexEnvfvEXT - GLenum texunit - GLenum target - GLenum pname - GLfloat *params - - - void glGetMultiTexEnvivEXT - GLenum texunit - GLenum target - GLenum pname - GLint *params - - - void glGetMultiTexGendvEXT - GLenum texunit - GLenum coord - GLenum pname - GLdouble *params - - - void glGetMultiTexGenfvEXT - GLenum texunit - GLenum coord - GLenum pname - GLfloat *params - - - void glGetMultiTexGenivEXT - GLenum texunit - GLenum coord - GLenum pname - GLint *params - - - void glGetMultiTexImageEXT - GLenum texunit - GLenum target - GLint level - GLenum format - GLenum type - void *pixels - - - void glGetMultiTexLevelParameterfvEXT - GLenum texunit - GLenum target - GLint level - GLenum pname - GLfloat *params - - - void glGetMultiTexLevelParameterivEXT - GLenum texunit - GLenum target - GLint level - GLenum pname - GLint *params - - - void glGetMultiTexParameterIivEXT - GLenum texunit - GLenum target - GLenum pname - GLint *params - - - void glGetMultiTexParameterIuivEXT - GLenum texunit - GLenum target - GLenum pname - GLuint *params - - - void glGetMultiTexParameterfvEXT - GLenum texunit - GLenum target - GLenum pname - GLfloat *params - - - void glGetMultiTexParameterivEXT - GLenum texunit - GLenum target - GLenum pname - GLint *params - - - void glGetMultisamplefv - GLenum pname - GLuint index - GLfloat *val - - - void glGetMultisamplefvNV - GLenum pname - GLuint index - GLfloat *val - - - - void glGetNamedBufferParameterivEXT - GLuint buffer - GLenum pname - GLint *params - - - void glGetNamedBufferParameterui64vNV - GLuint buffer - GLenum pname - GLuint64EXT *params - - - void glGetNamedBufferPointervEXT - GLuint buffer - GLenum pname - void **params - - - void glGetNamedBufferSubDataEXT - GLuint buffer - GLintptr offset - GLsizeiptr size - void *data - - - void glGetNamedFramebufferAttachmentParameterivEXT - GLuint framebuffer - GLenum attachment - GLenum pname - GLint *params - - - void glGetNamedFramebufferParameterivEXT - GLuint framebuffer - GLenum pname - GLint *params - - - void glGetNamedProgramLocalParameterIivEXT - GLuint program - GLenum target - GLuint index - GLint *params - - - void glGetNamedProgramLocalParameterIuivEXT - GLuint program - GLenum target - GLuint index - GLuint *params - - - void glGetNamedProgramLocalParameterdvEXT - GLuint program - GLenum target - GLuint index - GLdouble *params - - - void glGetNamedProgramLocalParameterfvEXT - GLuint program - GLenum target - GLuint index - GLfloat *params - - - void glGetNamedProgramStringEXT - GLuint program - GLenum target - GLenum pname - void *string - - - void glGetNamedProgramivEXT - GLuint program - GLenum target - GLenum pname - GLint *params - - - void glGetNamedRenderbufferParameterivEXT - GLuint renderbuffer - GLenum pname - GLint *params - - - void glGetNamedStringARB - GLint namelen - const GLchar *name - GLsizei bufSize - GLint *stringlen - GLchar *string - - - void glGetNamedStringivARB - GLint namelen - const GLchar *name - GLenum pname - GLint *params - - - void glGetNextPerfQueryIdINTEL - GLuint queryId - GLuint *nextQueryId - - - void glGetObjectBufferfvATI - GLuint buffer - GLenum pname - GLfloat *params - - - void glGetObjectBufferivATI - GLuint buffer - GLenum pname - GLint *params - - - void glGetObjectLabel - GLenum identifier - GLuint name - GLsizei bufSize - GLsizei *length - GLchar *label - - - void glGetObjectLabelEXT - GLenum type - GLuint object - GLsizei bufSize - GLsizei *length - GLchar *label - - - void glGetObjectLabelKHR - GLenum identifier - GLuint name - GLsizei bufSize - GLsizei *length - GLchar *label - - - - void glGetObjectParameterfvARB - GLhandleARB obj - GLenum pname - GLfloat *params - - - void glGetObjectParameterivAPPLE - GLenum objectType - GLuint name - GLenum pname - GLint *params - - - void glGetObjectParameterivARB - GLhandleARB obj - GLenum pname - GLint *params - - - void glGetObjectPtrLabel - const void *ptr - GLsizei bufSize - GLsizei *length - GLchar *label - - - void glGetObjectPtrLabelKHR - const void *ptr - GLsizei bufSize - GLsizei *length - GLchar *label - - - - void glGetOcclusionQueryivNV - GLuint id - GLenum pname - GLint *params - - - void glGetOcclusionQueryuivNV - GLuint id - GLenum pname - GLuint *params - - - void glGetPathColorGenfvNV - GLenum color - GLenum pname - GLfloat *value - - - void glGetPathColorGenivNV - GLenum color - GLenum pname - GLint *value - - - void glGetPathCommandsNV - GLuint path - GLubyte *commands - - - void glGetPathCoordsNV - GLuint path - GLfloat *coords - - - void glGetPathDashArrayNV - GLuint path - GLfloat *dashArray - - - GLfloat glGetPathLengthNV - GLuint path - GLsizei startSegment - GLsizei numSegments - - - void glGetPathMetricRangeNV - GLbitfield metricQueryMask - GLuint firstPathName - GLsizei numPaths - GLsizei stride - GLfloat *metrics - - - void glGetPathMetricsNV - GLbitfield metricQueryMask - GLsizei numPaths - GLenum pathNameType - const void *paths - GLuint pathBase - GLsizei stride - GLfloat *metrics - - - void glGetPathParameterfvNV - GLuint path - GLenum pname - GLfloat *value - - - void glGetPathParameterivNV - GLuint path - GLenum pname - GLint *value - - - void glGetPathSpacingNV - GLenum pathListMode - GLsizei numPaths - GLenum pathNameType - const void *paths - GLuint pathBase - GLfloat advanceScale - GLfloat kerningScale - GLenum transformType - GLfloat *returnedSpacing - - - void glGetPathTexGenfvNV - GLenum texCoordSet - GLenum pname - GLfloat *value - - - void glGetPathTexGenivNV - GLenum texCoordSet - GLenum pname - GLint *value - - - void glGetPerfCounterInfoINTEL - GLuint queryId - GLuint counterId - GLuint counterNameLength - GLchar *counterName - GLuint counterDescLength - GLchar *counterDesc - GLuint *counterOffset - GLuint *counterDataSize - GLuint *counterTypeEnum - GLuint *counterDataTypeEnum - GLuint64 *rawCounterMaxValue - - - void glGetPerfMonitorCounterDataAMD - GLuint monitor - GLenum pname - GLsizei dataSize - GLuint *data - GLint *bytesWritten - - - void glGetPerfMonitorCounterInfoAMD - GLuint group - GLuint counter - GLenum pname - void *data - - - void glGetPerfMonitorCounterStringAMD - GLuint group - GLuint counter - GLsizei bufSize - GLsizei *length - GLchar *counterString - - - void glGetPerfMonitorCountersAMD - GLuint group - GLint *numCounters - GLint *maxActiveCounters - GLsizei counterSize - GLuint *counters - - - void glGetPerfMonitorGroupStringAMD - GLuint group - GLsizei bufSize - GLsizei *length - GLchar *groupString - - - void glGetPerfMonitorGroupsAMD - GLint *numGroups - GLsizei groupsSize - GLuint *groups - - - void glGetPerfQueryDataINTEL - GLuint queryHandle - GLuint flags - GLsizei dataSize - GLvoid *data - GLuint *bytesWritten - - - void glGetPerfQueryIdByNameINTEL - GLchar *queryName - GLuint *queryId - - - void glGetPerfQueryInfoINTEL - GLuint queryId - GLuint queryNameLength - GLchar *queryName - GLuint *dataSize - GLuint *noCounters - GLuint *noInstances - GLuint *capsMask - - - void glGetPixelMapfv - GLenum map - GLfloat *values - - - - - void glGetPixelMapuiv - GLenum map - GLuint *values - - - - - void glGetPixelMapusv - GLenum map - GLushort *values - - - - - void glGetPixelMapxv - GLenum map - GLint size - GLfixed *values - - - void glGetPixelTexGenParameterfvSGIS - GLenum pname - GLfloat *params - - - void glGetPixelTexGenParameterivSGIS - GLenum pname - GLint *params - - - void glGetPixelTransformParameterfvEXT - GLenum target - GLenum pname - GLfloat *params - - - - void glGetPixelTransformParameterivEXT - GLenum target - GLenum pname - GLint *params - - - - void glGetPointerIndexedvEXT - GLenum target - GLuint index - void **data - - - void glGetPointeri_vEXT - GLenum pname - GLuint index - void **params - - - void glGetPointerv - GLenum pname - void **params - - - - void glGetPointervEXT - GLenum pname - void **params - - - - void glGetPointervKHR - GLenum pname - void **params - - - - void glGetPolygonStipple - GLubyte *mask - - - - - void glGetProgramBinary - GLuint program - GLsizei bufSize - GLsizei *length - GLenum *binaryFormat - void *binary - - - void glGetProgramBinaryOES - GLuint program - GLsizei bufSize - GLsizei *length - GLenum *binaryFormat - void *binary - - - - void glGetProgramEnvParameterIivNV - GLenum target - GLuint index - GLint *params - - - void glGetProgramEnvParameterIuivNV - GLenum target - GLuint index - GLuint *params - - - void glGetProgramEnvParameterdvARB - GLenum target - GLuint index - GLdouble *params - - - void glGetProgramEnvParameterfvARB - GLenum target - GLuint index - GLfloat *params - - - void glGetProgramInfoLog - GLuint program - GLsizei bufSize - GLsizei *length - GLchar *infoLog - - - - void glGetProgramInterfaceiv - GLuint program - GLenum programInterface - GLenum pname - GLint *params - - - void glGetProgramLocalParameterIivNV - GLenum target - GLuint index - GLint *params - - - void glGetProgramLocalParameterIuivNV - GLenum target - GLuint index - GLuint *params - - - void glGetProgramLocalParameterdvARB - GLenum target - GLuint index - GLdouble *params - - - void glGetProgramLocalParameterfvARB - GLenum target - GLuint index - GLfloat *params - - - void glGetProgramNamedParameterdvNV - GLuint id - GLsizei len - const GLubyte *name - GLdouble *params - - - - void glGetProgramNamedParameterfvNV - GLuint id - GLsizei len - const GLubyte *name - GLfloat *params - - - - void glGetProgramParameterdvNV - GLenum target - GLuint index - GLenum pname - GLdouble *params - - - - void glGetProgramParameterfvNV - GLenum target - GLuint index - GLenum pname - GLfloat *params - - - - void glGetProgramPipelineInfoLog - GLuint pipeline - GLsizei bufSize - GLsizei *length - GLchar *infoLog - - - void glGetProgramPipelineInfoLogEXT - GLuint pipeline - GLsizei bufSize - GLsizei *length - GLchar *infoLog - - - void glGetProgramPipelineiv - GLuint pipeline - GLenum pname - GLint *params - - - void glGetProgramPipelineivEXT - GLuint pipeline - GLenum pname - GLint *params - - - GLuint glGetProgramResourceIndex - GLuint program - GLenum programInterface - const GLchar *name - - - GLint glGetProgramResourceLocation - GLuint program - GLenum programInterface - const GLchar *name - - - GLint glGetProgramResourceLocationIndex - GLuint program - GLenum programInterface - const GLchar *name - - - void glGetProgramResourceName - GLuint program - GLenum programInterface - GLuint index - GLsizei bufSize - GLsizei *length - GLchar *name - - - void glGetProgramResourceiv - GLuint program - GLenum programInterface - GLuint index - GLsizei propCount - const GLenum *props - GLsizei bufSize - GLsizei *length - GLint *params - - - void glGetProgramStageiv - GLuint program - GLenum shadertype - GLenum pname - GLint *values - - - void glGetProgramStringARB - GLenum target - GLenum pname - void *string - - - void glGetProgramStringNV - GLuint id - GLenum pname - GLubyte *program - - - - void glGetProgramSubroutineParameteruivNV - GLenum target - GLuint index - GLuint *param - - - void glGetProgramiv - GLuint program - GLenum pname - GLint *params - - - - void glGetProgramivARB - GLenum target - GLenum pname - GLint *params - - - void glGetProgramivNV - GLuint id - GLenum pname - GLint *params - - - - void glGetQueryIndexediv - GLenum target - GLuint index - GLenum pname - GLint *params - - - void glGetQueryObjecti64v - GLuint id - GLenum pname - GLint64 *params - - - void glGetQueryObjecti64vEXT - GLuint id - GLenum pname - GLint64 *params - - - - - void glGetQueryObjectiv - GLuint id - GLenum pname - GLint *params - - - - void glGetQueryObjectivARB - GLuint id - GLenum pname - GLint *params - - - - void glGetQueryObjectivEXT - GLuint id - GLenum pname - GLint *params - - - - void glGetQueryObjectui64v - GLuint id - GLenum pname - GLuint64 *params - - - void glGetQueryObjectui64vEXT - GLuint id - GLenum pname - GLuint64 *params - - - - - void glGetQueryObjectuiv - GLuint id - GLenum pname - GLuint *params - - - - void glGetQueryObjectuivARB - GLuint id - GLenum pname - GLuint *params - - - - void glGetQueryObjectuivEXT - GLuint id - GLenum pname - GLuint *params - - - void glGetQueryiv - GLenum target - GLenum pname - GLint *params - - - - void glGetQueryivARB - GLenum target - GLenum pname - GLint *params - - - - void glGetQueryivEXT - GLenum target - GLenum pname - GLint *params - - - void glGetRenderbufferParameteriv - GLenum target - GLenum pname - GLint *params - - - - void glGetRenderbufferParameterivEXT - GLenum target - GLenum pname - GLint *params - - - - - void glGetRenderbufferParameterivOES - GLenum target - GLenum pname - GLint *params - - - void glGetSamplerParameterIiv - GLuint sampler - GLenum pname - GLint *params - - - void glGetSamplerParameterIivEXT - GLuint sampler - GLenum pname - GLint *params - - - - void glGetSamplerParameterIuiv - GLuint sampler - GLenum pname - GLuint *params - - - void glGetSamplerParameterIuivEXT - GLuint sampler - GLenum pname - GLuint *params - - - - void glGetSamplerParameterfv - GLuint sampler - GLenum pname - GLfloat *params - - - void glGetSamplerParameteriv - GLuint sampler - GLenum pname - GLint *params - - - void glGetSeparableFilter - GLenum target - GLenum format - GLenum type - void *row - void *column - void *span - - - - - void glGetSeparableFilterEXT - GLenum target - GLenum format - GLenum type - void *row - void *column - void *span - - - - void glGetShaderInfoLog - GLuint shader - GLsizei bufSize - GLsizei *length - GLchar *infoLog - - - - void glGetShaderPrecisionFormat - GLenum shadertype - GLenum precisiontype - GLint *range - GLint *precision - - - void glGetShaderSource - GLuint shader - GLsizei bufSize - GLsizei *length - GLchar *source - - - void glGetShaderSourceARB - GLhandleARB obj - GLsizei maxLength - GLsizei *length - GLcharARB *source - - - - void glGetShaderiv - GLuint shader - GLenum pname - GLint *params - - - - void glGetSharpenTexFuncSGIS - GLenum target - GLfloat *points - - - - const GLubyte *glGetString - GLenum name - - - - const GLubyte *glGetStringi - GLenum name - GLuint index - - - GLuint glGetSubroutineIndex - GLuint program - GLenum shadertype - const GLchar *name - - - GLint glGetSubroutineUniformLocation - GLuint program - GLenum shadertype - const GLchar *name - - - void glGetSynciv - GLsync sync - GLenum pname - GLsizei bufSize - GLsizei *length - GLint *values - - - void glGetSyncivAPPLE - GLsync sync - GLenum pname - GLsizei bufSize - GLsizei *length - GLint *values - - - - void glGetTexBumpParameterfvATI - GLenum pname - GLfloat *param - - - void glGetTexBumpParameterivATI - GLenum pname - GLint *param - - - void glGetTexEnvfv - GLenum target - GLenum pname - GLfloat *params - - - - void glGetTexEnviv - GLenum target - GLenum pname - GLint *params - - - - void glGetTexEnvxv - GLenum target - GLenum pname - GLfixed *params - - - void glGetTexEnvxvOES - GLenum target - GLenum pname - GLfixed *params - - - void glGetTexFilterFuncSGIS - GLenum target - GLenum filter - GLfloat *weights - - - - void glGetTexGendv - GLenum coord - GLenum pname - GLdouble *params - - - - void glGetTexGenfv - GLenum coord - GLenum pname - GLfloat *params - - - - void glGetTexGenfvOES - GLenum coord - GLenum pname - GLfloat *params - - - void glGetTexGeniv - GLenum coord - GLenum pname - GLint *params - - - - void glGetTexGenivOES - GLenum coord - GLenum pname - GLint *params - - - void glGetTexGenxvOES - GLenum coord - GLenum pname - GLfixed *params - - - void glGetTexImage - GLenum target - GLint level - GLenum format - GLenum type - void *pixels - - - - - void glGetTexLevelParameterfv - GLenum target - GLint level - GLenum pname - GLfloat *params - - - - void glGetTexLevelParameteriv - GLenum target - GLint level - GLenum pname - GLint *params - - - - void glGetTexLevelParameterxvOES - GLenum target - GLint level - GLenum pname - GLfixed *params - - - void glGetTexParameterIiv - GLenum target - GLenum pname - GLint *params - - - - void glGetTexParameterIivEXT - GLenum target - GLenum pname - GLint *params - - - - void glGetTexParameterIuiv - GLenum target - GLenum pname - GLuint *params - - - - void glGetTexParameterIuivEXT - GLenum target - GLenum pname - GLuint *params - - - - void glGetTexParameterPointervAPPLE - GLenum target - GLenum pname - void **params - - - void glGetTexParameterfv - GLenum target - GLenum pname - GLfloat *params - - - - void glGetTexParameteriv - GLenum target - GLenum pname - GLint *params - - - - void glGetTexParameterxv - GLenum target - GLenum pname - GLfixed *params - - - void glGetTexParameterxvOES - GLenum target - GLenum pname - GLfixed *params - - - GLuint64 glGetTextureHandleARB - GLuint texture - - - GLuint64 glGetTextureHandleNV - GLuint texture - - - void glGetTextureImageEXT - GLuint texture - GLenum target - GLint level - GLenum format - GLenum type - void *pixels - - - void glGetTextureLevelParameterfvEXT - GLuint texture - GLenum target - GLint level - GLenum pname - GLfloat *params - - - void glGetTextureLevelParameterivEXT - GLuint texture - GLenum target - GLint level - GLenum pname - GLint *params - - - void glGetTextureParameterIivEXT - GLuint texture - GLenum target - GLenum pname - GLint *params - - - void glGetTextureParameterIuivEXT - GLuint texture - GLenum target - GLenum pname - GLuint *params - - - void glGetTextureParameterfvEXT - GLuint texture - GLenum target - GLenum pname - GLfloat *params - - - void glGetTextureParameterivEXT - GLuint texture - GLenum target - GLenum pname - GLint *params - - - GLuint64 glGetTextureSamplerHandleARB - GLuint texture - GLuint sampler - - - GLuint64 glGetTextureSamplerHandleNV - GLuint texture - GLuint sampler - - - void glGetTrackMatrixivNV - GLenum target - GLuint address - GLenum pname - GLint *params - - - - void glGetTransformFeedbackVarying - GLuint program - GLuint index - GLsizei bufSize - GLsizei *length - GLsizei *size - GLenum *type - GLchar *name - - - void glGetTransformFeedbackVaryingEXT - GLuint program - GLuint index - GLsizei bufSize - GLsizei *length - GLsizei *size - GLenum *type - GLchar *name - - - - void glGetTransformFeedbackVaryingNV - GLuint program - GLuint index - GLint *location - - - void glGetTranslatedShaderSourceANGLE - GLuint shader - GLsizei bufsize - GLsizei *length - GLchar *source - - - GLuint glGetUniformBlockIndex - GLuint program - const GLchar *uniformBlockName - - - GLint glGetUniformBufferSizeEXT - GLuint program - GLint location - - - void glGetUniformIndices - GLuint program - GLsizei uniformCount - const GLchar *const*uniformNames - GLuint *uniformIndices - - - GLint glGetUniformLocation - GLuint program - const GLchar *name - - - GLint glGetUniformLocationARB - GLhandleARB programObj - const GLcharARB *name - - - - GLintptr glGetUniformOffsetEXT - GLuint program - GLint location - - - void glGetUniformSubroutineuiv - GLenum shadertype - GLint location - GLuint *params - - - void glGetUniformdv - GLuint program - GLint location - GLdouble *params - - - void glGetUniformfv - GLuint program - GLint location - GLfloat *params - - - void glGetUniformfvARB - GLhandleARB programObj - GLint location - GLfloat *params - - - - void glGetUniformi64vNV - GLuint program - GLint location - GLint64EXT *params - - - void glGetUniformiv - GLuint program - GLint location - GLint *params - - - void glGetUniformivARB - GLhandleARB programObj - GLint location - GLint *params - - - - void glGetUniformui64vNV - GLuint program - GLint location - GLuint64EXT *params - - - void glGetUniformuiv - GLuint program - GLint location - GLuint *params - - - void glGetUniformuivEXT - GLuint program - GLint location - GLuint *params - - - - void glGetVariantArrayObjectfvATI - GLuint id - GLenum pname - GLfloat *params - - - void glGetVariantArrayObjectivATI - GLuint id - GLenum pname - GLint *params - - - void glGetVariantBooleanvEXT - GLuint id - GLenum value - GLboolean *data - - - void glGetVariantFloatvEXT - GLuint id - GLenum value - GLfloat *data - - - void glGetVariantIntegervEXT - GLuint id - GLenum value - GLint *data - - - void glGetVariantPointervEXT - GLuint id - GLenum value - void **data - - - GLint glGetVaryingLocationNV - GLuint program - const GLchar *name - - - void glGetVertexArrayIntegeri_vEXT - GLuint vaobj - GLuint index - GLenum pname - GLint *param - - - void glGetVertexArrayIntegervEXT - GLuint vaobj - GLenum pname - GLint *param - - - void glGetVertexArrayPointeri_vEXT - GLuint vaobj - GLuint index - GLenum pname - void **param - - - void glGetVertexArrayPointervEXT - GLuint vaobj - GLenum pname - void **param - - - void glGetVertexAttribArrayObjectfvATI - GLuint index - GLenum pname - GLfloat *params - - - void glGetVertexAttribArrayObjectivATI - GLuint index - GLenum pname - GLint *params - - - void glGetVertexAttribIiv - GLuint index - GLenum pname - GLint *params - - - void glGetVertexAttribIivEXT - GLuint index - GLenum pname - GLint *params - - - - void glGetVertexAttribIuiv - GLuint index - GLenum pname - GLuint *params - - - void glGetVertexAttribIuivEXT - GLuint index - GLenum pname - GLuint *params - - - - void glGetVertexAttribLdv - GLuint index - GLenum pname - GLdouble *params - - - void glGetVertexAttribLdvEXT - GLuint index - GLenum pname - GLdouble *params - - - - void glGetVertexAttribLi64vNV - GLuint index - GLenum pname - GLint64EXT *params - - - void glGetVertexAttribLui64vARB - GLuint index - GLenum pname - GLuint64EXT *params - - - void glGetVertexAttribLui64vNV - GLuint index - GLenum pname - GLuint64EXT *params - - - void glGetVertexAttribPointerv - GLuint index - GLenum pname - void **pointer - - - - void glGetVertexAttribPointervARB - GLuint index - GLenum pname - void **pointer - - - - void glGetVertexAttribPointervNV - GLuint index - GLenum pname - void **pointer - - - - void glGetVertexAttribdv - GLuint index - GLenum pname - GLdouble *params - - - - void glGetVertexAttribdvARB - GLuint index - GLenum pname - GLdouble *params - - - - - void glGetVertexAttribdvNV - GLuint index - GLenum pname - GLdouble *params - - - - - void glGetVertexAttribfv - GLuint index - GLenum pname - GLfloat *params - - - - void glGetVertexAttribfvARB - GLuint index - GLenum pname - GLfloat *params - - - - - void glGetVertexAttribfvNV - GLuint index - GLenum pname - GLfloat *params - - - - - void glGetVertexAttribiv - GLuint index - GLenum pname - GLint *params - - - - void glGetVertexAttribivARB - GLuint index - GLenum pname - GLint *params - - - - - void glGetVertexAttribivNV - GLuint index - GLenum pname - GLint *params - - - - - void glGetVideoCaptureStreamdvNV - GLuint video_capture_slot - GLuint stream - GLenum pname - GLdouble *params - - - void glGetVideoCaptureStreamfvNV - GLuint video_capture_slot - GLuint stream - GLenum pname - GLfloat *params - - - void glGetVideoCaptureStreamivNV - GLuint video_capture_slot - GLuint stream - GLenum pname - GLint *params - - - void glGetVideoCaptureivNV - GLuint video_capture_slot - GLenum pname - GLint *params - - - void glGetVideoi64vNV - GLuint video_slot - GLenum pname - GLint64EXT *params - - - void glGetVideoivNV - GLuint video_slot - GLenum pname - GLint *params - - - void glGetVideoui64vNV - GLuint video_slot - GLenum pname - GLuint64EXT *params - - - void glGetVideouivNV - GLuint video_slot - GLenum pname - GLuint *params - - - void glGetnColorTableARB - GLenum target - GLenum format - GLenum type - GLsizei bufSize - void *table - - - void glGetnCompressedTexImageARB - GLenum target - GLint lod - GLsizei bufSize - void *img - - - void glGetnConvolutionFilterARB - GLenum target - GLenum format - GLenum type - GLsizei bufSize - void *image - - - void glGetnHistogramARB - GLenum target - GLboolean reset - GLenum format - GLenum type - GLsizei bufSize - void *values - - - void glGetnMapdvARB - GLenum target - GLenum query - GLsizei bufSize - GLdouble *v - - - void glGetnMapfvARB - GLenum target - GLenum query - GLsizei bufSize - GLfloat *v - - - void glGetnMapivARB - GLenum target - GLenum query - GLsizei bufSize - GLint *v - - - void glGetnMinmaxARB - GLenum target - GLboolean reset - GLenum format - GLenum type - GLsizei bufSize - void *values - - - void glGetnPixelMapfvARB - GLenum map - GLsizei bufSize - GLfloat *values - - - void glGetnPixelMapuivARB - GLenum map - GLsizei bufSize - GLuint *values - - - void glGetnPixelMapusvARB - GLenum map - GLsizei bufSize - GLushort *values - - - void glGetnPolygonStippleARB - GLsizei bufSize - GLubyte *pattern - - - void glGetnSeparableFilterARB - GLenum target - GLenum format - GLenum type - GLsizei rowBufSize - void *row - GLsizei columnBufSize - void *column - void *span - - - void glGetnTexImageARB - GLenum target - GLint level - GLenum format - GLenum type - GLsizei bufSize - void *img - - - void glGetnUniformdvARB - GLuint program - GLint location - GLsizei bufSize - GLdouble *params - - - void glGetnUniformfvARB - GLuint program - GLint location - GLsizei bufSize - GLfloat *params - - - void glGetnUniformfvEXT - GLuint program - GLint location - GLsizei bufSize - GLfloat *params - - - void glGetnUniformivARB - GLuint program - GLint location - GLsizei bufSize - GLint *params - - - void glGetnUniformivEXT - GLuint program - GLint location - GLsizei bufSize - GLint *params - - - void glGetnUniformuivARB - GLuint program - GLint location - GLsizei bufSize - GLuint *params - - - void glGlobalAlphaFactorbSUN - GLbyte factor - - - void glGlobalAlphaFactordSUN - GLdouble factor - - - void glGlobalAlphaFactorfSUN - GLfloat factor - - - void glGlobalAlphaFactoriSUN - GLint factor - - - void glGlobalAlphaFactorsSUN - GLshort factor - - - void glGlobalAlphaFactorubSUN - GLubyte factor - - - void glGlobalAlphaFactoruiSUN - GLuint factor - - - void glGlobalAlphaFactorusSUN - GLushort factor - - - void glHint - GLenum target - GLenum mode - - - - void glHintPGI - GLenum target - GLint mode - - - void glHistogram - GLenum target - GLsizei width - GLenum internalformat - GLboolean sink - - - - void glHistogramEXT - GLenum target - GLsizei width - GLenum internalformat - GLboolean sink - - - - - void glIglooInterfaceSGIX - GLenum pname - const void *params - - - - void glImageTransformParameterfHP - GLenum target - GLenum pname - GLfloat param - - - void glImageTransformParameterfvHP - GLenum target - GLenum pname - const GLfloat *params - - - void glImageTransformParameteriHP - GLenum target - GLenum pname - GLint param - - - void glImageTransformParameterivHP - GLenum target - GLenum pname - const GLint *params - - - GLsync glImportSyncEXT - GLenum external_sync_type - GLintptr external_sync - GLbitfield flags - - - void glIndexFormatNV - GLenum type - GLsizei stride - - - void glIndexFuncEXT - GLenum func - GLclampf ref - - - void glIndexMask - GLuint mask - - - - void glIndexMaterialEXT - GLenum face - GLenum mode - - - void glIndexPointer - GLenum type - GLsizei stride - const void *pointer - - - void glIndexPointerEXT - GLenum type - GLsizei stride - GLsizei count - const void *pointer - - - void glIndexPointerListIBM - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glIndexd - GLdouble c - - - - void glIndexdv - const GLdouble *c - - - - void glIndexf - GLfloat c - - - - void glIndexfv - const GLfloat *c - - - - void glIndexi - GLint c - - - - void glIndexiv - const GLint *c - - - - void glIndexs - GLshort c - - - - void glIndexsv - const GLshort *c - - - - void glIndexub - GLubyte c - - - - void glIndexubv - const GLubyte *c - - - - void glIndexxOES - GLfixed component - - - void glIndexxvOES - const GLfixed *component - - - void glInitNames - - - - void glInsertComponentEXT - GLuint res - GLuint src - GLuint num - - - void glInsertEventMarkerEXT - GLsizei length - const GLchar *marker - - - void glInstrumentsBufferSGIX - GLsizei size - GLint *buffer - - - - void glInterleavedArrays - GLenum format - GLsizei stride - const void *pointer - - - void glInterpolatePathsNV - GLuint resultPath - GLuint pathA - GLuint pathB - GLfloat weight - - - void glInvalidateBufferData - GLuint buffer - - - void glInvalidateBufferSubData - GLuint buffer - GLintptr offset - GLsizeiptr length - - - void glInvalidateFramebuffer - GLenum target - GLsizei numAttachments - const GLenum *attachments - - - void glInvalidateSubFramebuffer - GLenum target - GLsizei numAttachments - const GLenum *attachments - GLint x - GLint y - GLsizei width - GLsizei height - - - void glInvalidateTexImage - GLuint texture - GLint level - - - void glInvalidateTexSubImage - GLuint texture - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - - - GLboolean glIsAsyncMarkerSGIX - GLuint marker - - - GLboolean glIsBuffer - GLuint buffer - - - GLboolean glIsBufferARB - GLuint buffer - - - - GLboolean glIsBufferResidentNV - GLenum target - - - GLboolean glIsEnabled - GLenum cap - - - - GLboolean glIsEnabledIndexedEXT - GLenum target - GLuint index - - - - GLboolean glIsEnabledi - GLenum target - GLuint index - - - GLboolean glIsEnablediEXT - GLenum target - GLuint index - - - - GLboolean glIsFenceAPPLE - GLuint fence - - - GLboolean glIsFenceNV - GLuint fence - - - - GLboolean glIsFramebuffer - GLuint framebuffer - - - - GLboolean glIsFramebufferEXT - GLuint framebuffer - - - - - GLboolean glIsFramebufferOES - GLuint framebuffer - - - GLboolean glIsImageHandleResidentARB - GLuint64 handle - - - GLboolean glIsImageHandleResidentNV - GLuint64 handle - - - GLboolean glIsList - GLuint list - - - - GLboolean glIsNameAMD - GLenum identifier - GLuint name - - - GLboolean glIsNamedBufferResidentNV - GLuint buffer - - - GLboolean glIsNamedStringARB - GLint namelen - const GLchar *name - - - GLboolean glIsObjectBufferATI - GLuint buffer - - - GLboolean glIsOcclusionQueryNV - GLuint id - - - GLboolean glIsPathNV - GLuint path - - - GLboolean glIsPointInFillPathNV - GLuint path - GLuint mask - GLfloat x - GLfloat y - - - GLboolean glIsPointInStrokePathNV - GLuint path - GLfloat x - GLfloat y - - - GLboolean glIsProgram - GLuint program - - - - GLboolean glIsProgramARB - GLuint program - - - - GLboolean glIsProgramNV - GLuint id - - - - - GLboolean glIsProgramPipeline - GLuint pipeline - - - GLboolean glIsProgramPipelineEXT - GLuint pipeline - - - GLboolean glIsQuery - GLuint id - - - - GLboolean glIsQueryARB - GLuint id - - - - GLboolean glIsQueryEXT - GLuint id - - - GLboolean glIsRenderbuffer - GLuint renderbuffer - - - - GLboolean glIsRenderbufferEXT - GLuint renderbuffer - - - - - GLboolean glIsRenderbufferOES - GLuint renderbuffer - - - GLboolean glIsSampler - GLuint sampler - - - GLboolean glIsShader - GLuint shader - - - - GLboolean glIsSync - GLsync sync - - - GLboolean glIsSyncAPPLE - GLsync sync - - - - GLboolean glIsTexture - GLuint texture - - - - GLboolean glIsTextureEXT - GLuint texture - - - - GLboolean glIsTextureHandleResidentARB - GLuint64 handle - - - GLboolean glIsTextureHandleResidentNV - GLuint64 handle - - - GLboolean glIsTransformFeedback - GLuint id - - - GLboolean glIsTransformFeedbackNV - GLuint id - - - - GLboolean glIsVariantEnabledEXT - GLuint id - GLenum cap - - - GLboolean glIsVertexArray - GLuint array - - - - GLboolean glIsVertexArrayAPPLE - GLuint array - - - - GLboolean glIsVertexArrayOES - GLuint array - - - - GLboolean glIsVertexAttribEnabledAPPLE - GLuint index - GLenum pname - - - void glLabelObjectEXT - GLenum type - GLuint object - GLsizei length - const GLchar *label - - - void glLightEnviSGIX - GLenum pname - GLint param - - - void glLightModelf - GLenum pname - GLfloat param - - - - void glLightModelfv - GLenum pname - const GLfloat *params - - - - void glLightModeli - GLenum pname - GLint param - - - - void glLightModeliv - GLenum pname - const GLint *params - - - - void glLightModelx - GLenum pname - GLfixed param - - - void glLightModelxOES - GLenum pname - GLfixed param - - - void glLightModelxv - GLenum pname - const GLfixed *param - - - void glLightModelxvOES - GLenum pname - const GLfixed *param - - - void glLightf - GLenum light - GLenum pname - GLfloat param - - - - void glLightfv - GLenum light - GLenum pname - const GLfloat *params - - - - void glLighti - GLenum light - GLenum pname - GLint param - - - - void glLightiv - GLenum light - GLenum pname - const GLint *params - - - - void glLightx - GLenum light - GLenum pname - GLfixed param - - - void glLightxOES - GLenum light - GLenum pname - GLfixed param - - - void glLightxv - GLenum light - GLenum pname - const GLfixed *params - - - void glLightxvOES - GLenum light - GLenum pname - const GLfixed *params - - - void glLineStipple - GLint factor - GLushort pattern - - - - void glLineWidth - GLfloat width - - - - void glLineWidthx - GLfixed width - - - void glLineWidthxOES - GLfixed width - - - void glLinkProgram - GLuint program - - - void glLinkProgramARB - GLhandleARB programObj - - - - void glListBase - GLuint base - - - - void glListParameterfSGIX - GLuint list - GLenum pname - GLfloat param - - - - void glListParameterfvSGIX - GLuint list - GLenum pname - const GLfloat *params - - - - void glListParameteriSGIX - GLuint list - GLenum pname - GLint param - - - - void glListParameterivSGIX - GLuint list - GLenum pname - const GLint *params - - - - void glLoadIdentity - - - - void glLoadIdentityDeformationMapSGIX - GLbitfield mask - - - - void glLoadMatrixd - const GLdouble *m - - - - void glLoadMatrixf - const GLfloat *m - - - - void glLoadMatrixx - const GLfixed *m - - - void glLoadMatrixxOES - const GLfixed *m - - - void glLoadName - GLuint name - - - - void glLoadPaletteFromModelViewMatrixOES - - - void glLoadProgramNV - GLenum target - GLuint id - GLsizei len - const GLubyte *program - - - - void glLoadTransposeMatrixd - const GLdouble *m - - - void glLoadTransposeMatrixdARB - const GLdouble *m - - - - void glLoadTransposeMatrixf - const GLfloat *m - - - void glLoadTransposeMatrixfARB - const GLfloat *m - - - - void glLoadTransposeMatrixxOES - const GLfixed *m - - - void glLockArraysEXT - GLint first - GLsizei count - - - void glLogicOp - GLenum opcode - - - - void glMakeBufferNonResidentNV - GLenum target - - - void glMakeBufferResidentNV - GLenum target - GLenum access - - - void glMakeImageHandleNonResidentARB - GLuint64 handle - - - void glMakeImageHandleNonResidentNV - GLuint64 handle - - - void glMakeImageHandleResidentARB - GLuint64 handle - GLenum access - - - void glMakeImageHandleResidentNV - GLuint64 handle - GLenum access - - - void glMakeNamedBufferNonResidentNV - GLuint buffer - - - void glMakeNamedBufferResidentNV - GLuint buffer - GLenum access - - - void glMakeTextureHandleNonResidentARB - GLuint64 handle - - - void glMakeTextureHandleNonResidentNV - GLuint64 handle - - - void glMakeTextureHandleResidentARB - GLuint64 handle - - - void glMakeTextureHandleResidentNV - GLuint64 handle - - - void glMap1d - GLenum target - GLdouble u1 - GLdouble u2 - GLint stride - GLint order - const GLdouble *points - - - - void glMap1f - GLenum target - GLfloat u1 - GLfloat u2 - GLint stride - GLint order - const GLfloat *points - - - - void glMap1xOES - GLenum target - GLfixed u1 - GLfixed u2 - GLint stride - GLint order - GLfixed points - - - void glMap2d - GLenum target - GLdouble u1 - GLdouble u2 - GLint ustride - GLint uorder - GLdouble v1 - GLdouble v2 - GLint vstride - GLint vorder - const GLdouble *points - - - - void glMap2f - GLenum target - GLfloat u1 - GLfloat u2 - GLint ustride - GLint uorder - GLfloat v1 - GLfloat v2 - GLint vstride - GLint vorder - const GLfloat *points - - - - void glMap2xOES - GLenum target - GLfixed u1 - GLfixed u2 - GLint ustride - GLint uorder - GLfixed v1 - GLfixed v2 - GLint vstride - GLint vorder - GLfixed points - - - void *glMapBuffer - GLenum target - GLenum access - - - void *glMapBufferARB - GLenum target - GLenum access - - - - void *glMapBufferOES - GLenum target - GLenum access - - - - void *glMapBufferRange - GLenum target - GLintptr offset - GLsizeiptr length - GLbitfield access - - - - void *glMapBufferRangeEXT - GLenum target - GLintptr offset - GLsizeiptr length - GLbitfield access - - - - void glMapControlPointsNV - GLenum target - GLuint index - GLenum type - GLsizei ustride - GLsizei vstride - GLint uorder - GLint vorder - GLboolean packed - const void *points - - - void glMapGrid1d - GLint un - GLdouble u1 - GLdouble u2 - - - - void glMapGrid1f - GLint un - GLfloat u1 - GLfloat u2 - - - - void glMapGrid1xOES - GLint n - GLfixed u1 - GLfixed u2 - - - void glMapGrid2d - GLint un - GLdouble u1 - GLdouble u2 - GLint vn - GLdouble v1 - GLdouble v2 - - - - void glMapGrid2f - GLint un - GLfloat u1 - GLfloat u2 - GLint vn - GLfloat v1 - GLfloat v2 - - - - void glMapGrid2xOES - GLint n - GLfixed u1 - GLfixed u2 - GLfixed v1 - GLfixed v2 - - - void *glMapNamedBufferEXT - GLuint buffer - GLenum access - - - void *glMapNamedBufferRangeEXT - GLuint buffer - GLintptr offset - GLsizeiptr length - GLbitfield access - - - void *glMapObjectBufferATI - GLuint buffer - - - void glMapParameterfvNV - GLenum target - GLenum pname - const GLfloat *params - - - void glMapParameterivNV - GLenum target - GLenum pname - const GLint *params - - - void *glMapTexture2DINTEL - GLuint texture - GLint level - GLbitfield access - GLint *stride - GLenum *layout - - - void glMapVertexAttrib1dAPPLE - GLuint index - GLuint size - GLdouble u1 - GLdouble u2 - GLint stride - GLint order - const GLdouble *points - - - void glMapVertexAttrib1fAPPLE - GLuint index - GLuint size - GLfloat u1 - GLfloat u2 - GLint stride - GLint order - const GLfloat *points - - - void glMapVertexAttrib2dAPPLE - GLuint index - GLuint size - GLdouble u1 - GLdouble u2 - GLint ustride - GLint uorder - GLdouble v1 - GLdouble v2 - GLint vstride - GLint vorder - const GLdouble *points - - - void glMapVertexAttrib2fAPPLE - GLuint index - GLuint size - GLfloat u1 - GLfloat u2 - GLint ustride - GLint uorder - GLfloat v1 - GLfloat v2 - GLint vstride - GLint vorder - const GLfloat *points - - - void glMaterialf - GLenum face - GLenum pname - GLfloat param - - - - void glMaterialfv - GLenum face - GLenum pname - const GLfloat *params - - - - void glMateriali - GLenum face - GLenum pname - GLint param - - - - void glMaterialiv - GLenum face - GLenum pname - const GLint *params - - - - void glMaterialx - GLenum face - GLenum pname - GLfixed param - - - void glMaterialxOES - GLenum face - GLenum pname - GLfixed param - - - void glMaterialxv - GLenum face - GLenum pname - const GLfixed *param - - - void glMaterialxvOES - GLenum face - GLenum pname - const GLfixed *param - - - void glMatrixFrustumEXT - GLenum mode - GLdouble left - GLdouble right - GLdouble bottom - GLdouble top - GLdouble zNear - GLdouble zFar - - - void glMatrixIndexPointerARB - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glMatrixIndexPointerOES - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glMatrixIndexubvARB - GLint size - const GLubyte *indices - - - - void glMatrixIndexuivARB - GLint size - const GLuint *indices - - - - void glMatrixIndexusvARB - GLint size - const GLushort *indices - - - - void glMatrixLoadIdentityEXT - GLenum mode - - - void glMatrixLoadTransposedEXT - GLenum mode - const GLdouble *m - - - void glMatrixLoadTransposefEXT - GLenum mode - const GLfloat *m - - - void glMatrixLoaddEXT - GLenum mode - const GLdouble *m - - - void glMatrixLoadfEXT - GLenum mode - const GLfloat *m - - - void glMatrixMode - GLenum mode - - - - void glMatrixMultTransposedEXT - GLenum mode - const GLdouble *m - - - void glMatrixMultTransposefEXT - GLenum mode - const GLfloat *m - - - void glMatrixMultdEXT - GLenum mode - const GLdouble *m - - - void glMatrixMultfEXT - GLenum mode - const GLfloat *m - - - void glMatrixOrthoEXT - GLenum mode - GLdouble left - GLdouble right - GLdouble bottom - GLdouble top - GLdouble zNear - GLdouble zFar - - - void glMatrixPopEXT - GLenum mode - - - void glMatrixPushEXT - GLenum mode - - - void glMatrixRotatedEXT - GLenum mode - GLdouble angle - GLdouble x - GLdouble y - GLdouble z - - - void glMatrixRotatefEXT - GLenum mode - GLfloat angle - GLfloat x - GLfloat y - GLfloat z - - - void glMatrixScaledEXT - GLenum mode - GLdouble x - GLdouble y - GLdouble z - - - void glMatrixScalefEXT - GLenum mode - GLfloat x - GLfloat y - GLfloat z - - - void glMatrixTranslatedEXT - GLenum mode - GLdouble x - GLdouble y - GLdouble z - - - void glMatrixTranslatefEXT - GLenum mode - GLfloat x - GLfloat y - GLfloat z - - - void glMemoryBarrier - GLbitfield barriers - - - void glMemoryBarrierByRegion - GLbitfield barriers - - - void glMemoryBarrierEXT - GLbitfield barriers - - - - void glMinSampleShading - GLfloat value - - - void glMinSampleShadingARB - GLfloat value - - - - void glMinSampleShadingOES - GLfloat value - - - - void glMinmax - GLenum target - GLenum internalformat - GLboolean sink - - - - void glMinmaxEXT - GLenum target - GLenum internalformat - GLboolean sink - - - - - void glMultMatrixd - const GLdouble *m - - - - void glMultMatrixf - const GLfloat *m - - - - void glMultMatrixx - const GLfixed *m - - - void glMultMatrixxOES - const GLfixed *m - - - void glMultTransposeMatrixd - const GLdouble *m - - - void glMultTransposeMatrixdARB - const GLdouble *m - - - - void glMultTransposeMatrixf - const GLfloat *m - - - void glMultTransposeMatrixfARB - const GLfloat *m - - - - void glMultTransposeMatrixxOES - const GLfixed *m - - - void glMultiDrawArrays - GLenum mode - const GLint *first - const GLsizei *count - GLsizei drawcount - - - void glMultiDrawArraysEXT - GLenum mode - const GLint *first - const GLsizei *count - GLsizei primcount - - - - void glMultiDrawArraysIndirect - GLenum mode - const void *indirect - GLsizei drawcount - GLsizei stride - - - void glMultiDrawArraysIndirectAMD - GLenum mode - const void *indirect - GLsizei primcount - GLsizei stride - - - - void glMultiDrawArraysIndirectBindlessNV - GLenum mode - const void *indirect - GLsizei drawCount - GLsizei stride - GLint vertexBufferCount - - - void glMultiDrawArraysIndirectCountARB - GLenum mode - GLintptr indirect - GLintptr drawcount - GLsizei maxdrawcount - GLsizei stride - - - void glMultiDrawElementArrayAPPLE - GLenum mode - const GLint *first - const GLsizei *count - GLsizei primcount - - - void glMultiDrawElements - GLenum mode - const GLsizei *count - GLenum type - const void *const*indices - GLsizei drawcount - - - void glMultiDrawElementsBaseVertex - GLenum mode - const GLsizei *count - GLenum type - const void *const*indices - GLsizei drawcount - const GLint *basevertex - - - void glMultiDrawElementsEXT - GLenum mode - const GLsizei *count - GLenum type - const void *const*indices - GLsizei primcount - - - - void glMultiDrawElementsIndirect - GLenum mode - GLenum type - const void *indirect - GLsizei drawcount - GLsizei stride - - - void glMultiDrawElementsIndirectAMD - GLenum mode - GLenum type - const void *indirect - GLsizei primcount - GLsizei stride - - - - void glMultiDrawElementsIndirectBindlessNV - GLenum mode - GLenum type - const void *indirect - GLsizei drawCount - GLsizei stride - GLint vertexBufferCount - - - void glMultiDrawElementsIndirectCountARB - GLenum mode - GLenum type - GLintptr indirect - GLintptr drawcount - GLsizei maxdrawcount - GLsizei stride - - - void glMultiDrawRangeElementArrayAPPLE - GLenum mode - GLuint start - GLuint end - const GLint *first - const GLsizei *count - GLsizei primcount - - - void glMultiModeDrawArraysIBM - const GLenum *mode - const GLint *first - const GLsizei *count - GLsizei primcount - GLint modestride - - - void glMultiModeDrawElementsIBM - const GLenum *mode - const GLsizei *count - GLenum type - const void *const*indices - GLsizei primcount - GLint modestride - - - void glMultiTexBufferEXT - GLenum texunit - GLenum target - GLenum internalformat - GLuint buffer - - - void glMultiTexCoord1bOES - GLenum texture - GLbyte s - - - void glMultiTexCoord1bvOES - GLenum texture - const GLbyte *coords - - - void glMultiTexCoord1d - GLenum target - GLdouble s - - - - void glMultiTexCoord1dARB - GLenum target - GLdouble s - - - - - void glMultiTexCoord1dv - GLenum target - const GLdouble *v - - - - void glMultiTexCoord1dvARB - GLenum target - const GLdouble *v - - - - - void glMultiTexCoord1f - GLenum target - GLfloat s - - - - void glMultiTexCoord1fARB - GLenum target - GLfloat s - - - - - void glMultiTexCoord1fv - GLenum target - const GLfloat *v - - - - void glMultiTexCoord1fvARB - GLenum target - const GLfloat *v - - - - - void glMultiTexCoord1hNV - GLenum target - GLhalfNV s - - - - void glMultiTexCoord1hvNV - GLenum target - const GLhalfNV *v - - - - void glMultiTexCoord1i - GLenum target - GLint s - - - - void glMultiTexCoord1iARB - GLenum target - GLint s - - - - - void glMultiTexCoord1iv - GLenum target - const GLint *v - - - - void glMultiTexCoord1ivARB - GLenum target - const GLint *v - - - - - void glMultiTexCoord1s - GLenum target - GLshort s - - - - void glMultiTexCoord1sARB - GLenum target - GLshort s - - - - - void glMultiTexCoord1sv - GLenum target - const GLshort *v - - - - void glMultiTexCoord1svARB - GLenum target - const GLshort *v - - - - - void glMultiTexCoord1xOES - GLenum texture - GLfixed s - - - void glMultiTexCoord1xvOES - GLenum texture - const GLfixed *coords - - - void glMultiTexCoord2bOES - GLenum texture - GLbyte s - GLbyte t - - - void glMultiTexCoord2bvOES - GLenum texture - const GLbyte *coords - - - void glMultiTexCoord2d - GLenum target - GLdouble s - GLdouble t - - - - void glMultiTexCoord2dARB - GLenum target - GLdouble s - GLdouble t - - - - - void glMultiTexCoord2dv - GLenum target - const GLdouble *v - - - - void glMultiTexCoord2dvARB - GLenum target - const GLdouble *v - - - - - void glMultiTexCoord2f - GLenum target - GLfloat s - GLfloat t - - - - void glMultiTexCoord2fARB - GLenum target - GLfloat s - GLfloat t - - - - - void glMultiTexCoord2fv - GLenum target - const GLfloat *v - - - - void glMultiTexCoord2fvARB - GLenum target - const GLfloat *v - - - - - void glMultiTexCoord2hNV - GLenum target - GLhalfNV s - GLhalfNV t - - - - void glMultiTexCoord2hvNV - GLenum target - const GLhalfNV *v - - - - void glMultiTexCoord2i - GLenum target - GLint s - GLint t - - - - void glMultiTexCoord2iARB - GLenum target - GLint s - GLint t - - - - - void glMultiTexCoord2iv - GLenum target - const GLint *v - - - - void glMultiTexCoord2ivARB - GLenum target - const GLint *v - - - - - void glMultiTexCoord2s - GLenum target - GLshort s - GLshort t - - - - void glMultiTexCoord2sARB - GLenum target - GLshort s - GLshort t - - - - - void glMultiTexCoord2sv - GLenum target - const GLshort *v - - - - void glMultiTexCoord2svARB - GLenum target - const GLshort *v - - - - - void glMultiTexCoord2xOES - GLenum texture - GLfixed s - GLfixed t - - - void glMultiTexCoord2xvOES - GLenum texture - const GLfixed *coords - - - void glMultiTexCoord3bOES - GLenum texture - GLbyte s - GLbyte t - GLbyte r - - - void glMultiTexCoord3bvOES - GLenum texture - const GLbyte *coords - - - void glMultiTexCoord3d - GLenum target - GLdouble s - GLdouble t - GLdouble r - - - - void glMultiTexCoord3dARB - GLenum target - GLdouble s - GLdouble t - GLdouble r - - - - - void glMultiTexCoord3dv - GLenum target - const GLdouble *v - - - - void glMultiTexCoord3dvARB - GLenum target - const GLdouble *v - - - - - void glMultiTexCoord3f - GLenum target - GLfloat s - GLfloat t - GLfloat r - - - - void glMultiTexCoord3fARB - GLenum target - GLfloat s - GLfloat t - GLfloat r - - - - - void glMultiTexCoord3fv - GLenum target - const GLfloat *v - - - - void glMultiTexCoord3fvARB - GLenum target - const GLfloat *v - - - - - void glMultiTexCoord3hNV - GLenum target - GLhalfNV s - GLhalfNV t - GLhalfNV r - - - - void glMultiTexCoord3hvNV - GLenum target - const GLhalfNV *v - - - - void glMultiTexCoord3i - GLenum target - GLint s - GLint t - GLint r - - - - void glMultiTexCoord3iARB - GLenum target - GLint s - GLint t - GLint r - - - - - void glMultiTexCoord3iv - GLenum target - const GLint *v - - - - void glMultiTexCoord3ivARB - GLenum target - const GLint *v - - - - - void glMultiTexCoord3s - GLenum target - GLshort s - GLshort t - GLshort r - - - - void glMultiTexCoord3sARB - GLenum target - GLshort s - GLshort t - GLshort r - - - - - void glMultiTexCoord3sv - GLenum target - const GLshort *v - - - - void glMultiTexCoord3svARB - GLenum target - const GLshort *v - - - - - void glMultiTexCoord3xOES - GLenum texture - GLfixed s - GLfixed t - GLfixed r - - - void glMultiTexCoord3xvOES - GLenum texture - const GLfixed *coords - - - void glMultiTexCoord4bOES - GLenum texture - GLbyte s - GLbyte t - GLbyte r - GLbyte q - - - void glMultiTexCoord4bvOES - GLenum texture - const GLbyte *coords - - - void glMultiTexCoord4d - GLenum target - GLdouble s - GLdouble t - GLdouble r - GLdouble q - - - - void glMultiTexCoord4dARB - GLenum target - GLdouble s - GLdouble t - GLdouble r - GLdouble q - - - - - void glMultiTexCoord4dv - GLenum target - const GLdouble *v - - - - void glMultiTexCoord4dvARB - GLenum target - const GLdouble *v - - - - - void glMultiTexCoord4f - GLenum target - GLfloat s - GLfloat t - GLfloat r - GLfloat q - - - - void glMultiTexCoord4fARB - GLenum target - GLfloat s - GLfloat t - GLfloat r - GLfloat q - - - - - void glMultiTexCoord4fv - GLenum target - const GLfloat *v - - - - void glMultiTexCoord4fvARB - GLenum target - const GLfloat *v - - - - - void glMultiTexCoord4hNV - GLenum target - GLhalfNV s - GLhalfNV t - GLhalfNV r - GLhalfNV q - - - - void glMultiTexCoord4hvNV - GLenum target - const GLhalfNV *v - - - - void glMultiTexCoord4i - GLenum target - GLint s - GLint t - GLint r - GLint q - - - - void glMultiTexCoord4iARB - GLenum target - GLint s - GLint t - GLint r - GLint q - - - - - void glMultiTexCoord4iv - GLenum target - const GLint *v - - - - void glMultiTexCoord4ivARB - GLenum target - const GLint *v - - - - - void glMultiTexCoord4s - GLenum target - GLshort s - GLshort t - GLshort r - GLshort q - - - - void glMultiTexCoord4sARB - GLenum target - GLshort s - GLshort t - GLshort r - GLshort q - - - - - void glMultiTexCoord4sv - GLenum target - const GLshort *v - - - - void glMultiTexCoord4svARB - GLenum target - const GLshort *v - - - - - void glMultiTexCoord4x - GLenum texture - GLfixed s - GLfixed t - GLfixed r - GLfixed q - - - void glMultiTexCoord4xOES - GLenum texture - GLfixed s - GLfixed t - GLfixed r - GLfixed q - - - void glMultiTexCoord4xvOES - GLenum texture - const GLfixed *coords - - - void glMultiTexCoordP1ui - GLenum texture - GLenum type - GLuint coords - - - void glMultiTexCoordP1uiv - GLenum texture - GLenum type - const GLuint *coords - - - void glMultiTexCoordP2ui - GLenum texture - GLenum type - GLuint coords - - - void glMultiTexCoordP2uiv - GLenum texture - GLenum type - const GLuint *coords - - - void glMultiTexCoordP3ui - GLenum texture - GLenum type - GLuint coords - - - void glMultiTexCoordP3uiv - GLenum texture - GLenum type - const GLuint *coords - - - void glMultiTexCoordP4ui - GLenum texture - GLenum type - GLuint coords - - - void glMultiTexCoordP4uiv - GLenum texture - GLenum type - const GLuint *coords - - - void glMultiTexCoordPointerEXT - GLenum texunit - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glMultiTexEnvfEXT - GLenum texunit - GLenum target - GLenum pname - GLfloat param - - - - void glMultiTexEnvfvEXT - GLenum texunit - GLenum target - GLenum pname - const GLfloat *params - - - void glMultiTexEnviEXT - GLenum texunit - GLenum target - GLenum pname - GLint param - - - - void glMultiTexEnvivEXT - GLenum texunit - GLenum target - GLenum pname - const GLint *params - - - void glMultiTexGendEXT - GLenum texunit - GLenum coord - GLenum pname - GLdouble param - - - - void glMultiTexGendvEXT - GLenum texunit - GLenum coord - GLenum pname - const GLdouble *params - - - void glMultiTexGenfEXT - GLenum texunit - GLenum coord - GLenum pname - GLfloat param - - - - void glMultiTexGenfvEXT - GLenum texunit - GLenum coord - GLenum pname - const GLfloat *params - - - void glMultiTexGeniEXT - GLenum texunit - GLenum coord - GLenum pname - GLint param - - - - void glMultiTexGenivEXT - GLenum texunit - GLenum coord - GLenum pname - const GLint *params - - - void glMultiTexImage1DEXT - GLenum texunit - GLenum target - GLint level - GLint internalformat - GLsizei width - GLint border - GLenum format - GLenum type - const void *pixels - - - void glMultiTexImage2DEXT - GLenum texunit - GLenum target - GLint level - GLint internalformat - GLsizei width - GLsizei height - GLint border - GLenum format - GLenum type - const void *pixels - - - void glMultiTexImage3DEXT - GLenum texunit - GLenum target - GLint level - GLint internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLenum format - GLenum type - const void *pixels - - - void glMultiTexParameterIivEXT - GLenum texunit - GLenum target - GLenum pname - const GLint *params - - - void glMultiTexParameterIuivEXT - GLenum texunit - GLenum target - GLenum pname - const GLuint *params - - - void glMultiTexParameterfEXT - GLenum texunit - GLenum target - GLenum pname - GLfloat param - - - - void glMultiTexParameterfvEXT - GLenum texunit - GLenum target - GLenum pname - const GLfloat *params - - - void glMultiTexParameteriEXT - GLenum texunit - GLenum target - GLenum pname - GLint param - - - - void glMultiTexParameterivEXT - GLenum texunit - GLenum target - GLenum pname - const GLint *params - - - void glMultiTexRenderbufferEXT - GLenum texunit - GLenum target - GLuint renderbuffer - - - void glMultiTexSubImage1DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLenum type - const void *pixels - - - void glMultiTexSubImage2DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *pixels - - - void glMultiTexSubImage3DEXT - GLenum texunit - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - const void *pixels - - - void glNamedBufferDataEXT - GLuint buffer - GLsizeiptr size - const void *data - GLenum usage - - - void glNamedBufferStorageEXT - GLuint buffer - GLsizeiptr size - const void *data - GLbitfield flags - - - void glNamedBufferSubDataEXT - GLuint buffer - GLintptr offset - GLsizeiptr size - const void *data - - - void glNamedCopyBufferSubDataEXT - GLuint readBuffer - GLuint writeBuffer - GLintptr readOffset - GLintptr writeOffset - GLsizeiptr size - - - void glNamedFramebufferParameteriEXT - GLuint framebuffer - GLenum pname - GLint param - - - void glNamedFramebufferRenderbufferEXT - GLuint framebuffer - GLenum attachment - GLenum renderbuffertarget - GLuint renderbuffer - - - void glNamedFramebufferTexture1DEXT - GLuint framebuffer - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - void glNamedFramebufferTexture2DEXT - GLuint framebuffer - GLenum attachment - GLenum textarget - GLuint texture - GLint level - - - void glNamedFramebufferTexture3DEXT - GLuint framebuffer - GLenum attachment - GLenum textarget - GLuint texture - GLint level - GLint zoffset - - - void glNamedFramebufferTextureEXT - GLuint framebuffer - GLenum attachment - GLuint texture - GLint level - - - void glNamedFramebufferTextureFaceEXT - GLuint framebuffer - GLenum attachment - GLuint texture - GLint level - GLenum face - - - void glNamedFramebufferTextureLayerEXT - GLuint framebuffer - GLenum attachment - GLuint texture - GLint level - GLint layer - - - void glNamedProgramLocalParameter4dEXT - GLuint program - GLenum target - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glNamedProgramLocalParameter4dvEXT - GLuint program - GLenum target - GLuint index - const GLdouble *params - - - void glNamedProgramLocalParameter4fEXT - GLuint program - GLenum target - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glNamedProgramLocalParameter4fvEXT - GLuint program - GLenum target - GLuint index - const GLfloat *params - - - void glNamedProgramLocalParameterI4iEXT - GLuint program - GLenum target - GLuint index - GLint x - GLint y - GLint z - GLint w - - - - void glNamedProgramLocalParameterI4ivEXT - GLuint program - GLenum target - GLuint index - const GLint *params - - - void glNamedProgramLocalParameterI4uiEXT - GLuint program - GLenum target - GLuint index - GLuint x - GLuint y - GLuint z - GLuint w - - - - void glNamedProgramLocalParameterI4uivEXT - GLuint program - GLenum target - GLuint index - const GLuint *params - - - void glNamedProgramLocalParameters4fvEXT - GLuint program - GLenum target - GLuint index - GLsizei count - const GLfloat *params - - - void glNamedProgramLocalParametersI4ivEXT - GLuint program - GLenum target - GLuint index - GLsizei count - const GLint *params - - - void glNamedProgramLocalParametersI4uivEXT - GLuint program - GLenum target - GLuint index - GLsizei count - const GLuint *params - - - void glNamedProgramStringEXT - GLuint program - GLenum target - GLenum format - GLsizei len - const void *string - - - void glNamedRenderbufferStorageEXT - GLuint renderbuffer - GLenum internalformat - GLsizei width - GLsizei height - - - void glNamedRenderbufferStorageMultisampleCoverageEXT - GLuint renderbuffer - GLsizei coverageSamples - GLsizei colorSamples - GLenum internalformat - GLsizei width - GLsizei height - - - void glNamedRenderbufferStorageMultisampleEXT - GLuint renderbuffer - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - void glNamedStringARB - GLenum type - GLint namelen - const GLchar *name - GLint stringlen - const GLchar *string - - - void glNewList - GLuint list - GLenum mode - - - - GLuint glNewObjectBufferATI - GLsizei size - const void *pointer - GLenum usage - - - void glNormal3b - GLbyte nx - GLbyte ny - GLbyte nz - - - - void glNormal3bv - const GLbyte *v - - - - void glNormal3d - GLdouble nx - GLdouble ny - GLdouble nz - - - - void glNormal3dv - const GLdouble *v - - - - void glNormal3f - GLfloat nx - GLfloat ny - GLfloat nz - - - - void glNormal3fVertex3fSUN - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glNormal3fVertex3fvSUN - const GLfloat *n - const GLfloat *v - - - void glNormal3fv - const GLfloat *v - - - - void glNormal3hNV - GLhalfNV nx - GLhalfNV ny - GLhalfNV nz - - - - void glNormal3hvNV - const GLhalfNV *v - - - - void glNormal3i - GLint nx - GLint ny - GLint nz - - - - void glNormal3iv - const GLint *v - - - - void glNormal3s - GLshort nx - GLshort ny - GLshort nz - - - - void glNormal3sv - const GLshort *v - - - - void glNormal3x - GLfixed nx - GLfixed ny - GLfixed nz - - - void glNormal3xOES - GLfixed nx - GLfixed ny - GLfixed nz - - - void glNormal3xvOES - const GLfixed *coords - - - void glNormalFormatNV - GLenum type - GLsizei stride - - - void glNormalP3ui - GLenum type - GLuint coords - - - void glNormalP3uiv - GLenum type - const GLuint *coords - - - void glNormalPointer - GLenum type - GLsizei stride - const void *pointer - - - void glNormalPointerEXT - GLenum type - GLsizei stride - GLsizei count - const void *pointer - - - void glNormalPointerListIBM - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glNormalPointervINTEL - GLenum type - const void **pointer - - - void glNormalStream3bATI - GLenum stream - GLbyte nx - GLbyte ny - GLbyte nz - - - void glNormalStream3bvATI - GLenum stream - const GLbyte *coords - - - void glNormalStream3dATI - GLenum stream - GLdouble nx - GLdouble ny - GLdouble nz - - - void glNormalStream3dvATI - GLenum stream - const GLdouble *coords - - - void glNormalStream3fATI - GLenum stream - GLfloat nx - GLfloat ny - GLfloat nz - - - void glNormalStream3fvATI - GLenum stream - const GLfloat *coords - - - void glNormalStream3iATI - GLenum stream - GLint nx - GLint ny - GLint nz - - - void glNormalStream3ivATI - GLenum stream - const GLint *coords - - - void glNormalStream3sATI - GLenum stream - GLshort nx - GLshort ny - GLshort nz - - - void glNormalStream3svATI - GLenum stream - const GLshort *coords - - - void glObjectLabel - GLenum identifier - GLuint name - GLsizei length - const GLchar *label - - - void glObjectLabelKHR - GLenum identifier - GLuint name - GLsizei length - const GLchar *label - - - - void glObjectPtrLabel - const void *ptr - GLsizei length - const GLchar *label - - - void glObjectPtrLabelKHR - const void *ptr - GLsizei length - const GLchar *label - - - - GLenum glObjectPurgeableAPPLE - GLenum objectType - GLuint name - GLenum option - - - GLenum glObjectUnpurgeableAPPLE - GLenum objectType - GLuint name - GLenum option - - - void glOrtho - GLdouble left - GLdouble right - GLdouble bottom - GLdouble top - GLdouble zNear - GLdouble zFar - - - - void glOrthof - GLfloat l - GLfloat r - GLfloat b - GLfloat t - GLfloat n - GLfloat f - - - void glOrthofOES - GLfloat l - GLfloat r - GLfloat b - GLfloat t - GLfloat n - GLfloat f - - - - void glOrthox - GLfixed l - GLfixed r - GLfixed b - GLfixed t - GLfixed n - GLfixed f - - - void glOrthoxOES - GLfixed l - GLfixed r - GLfixed b - GLfixed t - GLfixed n - GLfixed f - - - void glPNTrianglesfATI - GLenum pname - GLfloat param - - - void glPNTrianglesiATI - GLenum pname - GLint param - - - void glPassTexCoordATI - GLuint dst - GLuint coord - GLenum swizzle - - - void glPassThrough - GLfloat token - - - - void glPassThroughxOES - GLfixed token - - - void glPatchParameterfv - GLenum pname - const GLfloat *values - - - void glPatchParameteri - GLenum pname - GLint value - - - void glPatchParameteriEXT - GLenum pname - GLint value - - - - void glPathColorGenNV - GLenum color - GLenum genMode - GLenum colorFormat - const GLfloat *coeffs - - - void glPathCommandsNV - GLuint path - GLsizei numCommands - const GLubyte *commands - GLsizei numCoords - GLenum coordType - const void *coords - - - void glPathCoordsNV - GLuint path - GLsizei numCoords - GLenum coordType - const void *coords - - - void glPathCoverDepthFuncNV - GLenum func - - - void glPathDashArrayNV - GLuint path - GLsizei dashCount - const GLfloat *dashArray - - - void glPathFogGenNV - GLenum genMode - - - void glPathGlyphRangeNV - GLuint firstPathName - GLenum fontTarget - const void *fontName - GLbitfield fontStyle - GLuint firstGlyph - GLsizei numGlyphs - GLenum handleMissingGlyphs - GLuint pathParameterTemplate - GLfloat emScale - - - void glPathGlyphsNV - GLuint firstPathName - GLenum fontTarget - const void *fontName - GLbitfield fontStyle - GLsizei numGlyphs - GLenum type - const void *charcodes - GLenum handleMissingGlyphs - GLuint pathParameterTemplate - GLfloat emScale - - - void glPathParameterfNV - GLuint path - GLenum pname - GLfloat value - - - void glPathParameterfvNV - GLuint path - GLenum pname - const GLfloat *value - - - void glPathParameteriNV - GLuint path - GLenum pname - GLint value - - - void glPathParameterivNV - GLuint path - GLenum pname - const GLint *value - - - void glPathStencilDepthOffsetNV - GLfloat factor - GLfloat units - - - void glPathStencilFuncNV - GLenum func - GLint ref - GLuint mask - - - void glPathStringNV - GLuint path - GLenum format - GLsizei length - const void *pathString - - - void glPathSubCommandsNV - GLuint path - GLsizei commandStart - GLsizei commandsToDelete - GLsizei numCommands - const GLubyte *commands - GLsizei numCoords - GLenum coordType - const void *coords - - - void glPathSubCoordsNV - GLuint path - GLsizei coordStart - GLsizei numCoords - GLenum coordType - const void *coords - - - void glPathTexGenNV - GLenum texCoordSet - GLenum genMode - GLint components - const GLfloat *coeffs - - - void glPauseTransformFeedback - - - void glPauseTransformFeedbackNV - - - - void glPixelDataRangeNV - GLenum target - GLsizei length - const void *pointer - - - void glPixelMapfv - GLenum map - GLsizei mapsize - const GLfloat *values - - - - - void glPixelMapuiv - GLenum map - GLsizei mapsize - const GLuint *values - - - - - void glPixelMapusv - GLenum map - GLsizei mapsize - const GLushort *values - - - - - void glPixelMapx - GLenum map - GLint size - const GLfixed *values - - - void glPixelStoref - GLenum pname - GLfloat param - - - - void glPixelStorei - GLenum pname - GLint param - - - - void glPixelStorex - GLenum pname - GLfixed param - - - void glPixelTexGenParameterfSGIS - GLenum pname - GLfloat param - - - void glPixelTexGenParameterfvSGIS - GLenum pname - const GLfloat *params - - - void glPixelTexGenParameteriSGIS - GLenum pname - GLint param - - - void glPixelTexGenParameterivSGIS - GLenum pname - const GLint *params - - - void glPixelTexGenSGIX - GLenum mode - - - - void glPixelTransferf - GLenum pname - GLfloat param - - - - void glPixelTransferi - GLenum pname - GLint param - - - - void glPixelTransferxOES - GLenum pname - GLfixed param - - - void glPixelTransformParameterfEXT - GLenum target - GLenum pname - GLfloat param - - - - void glPixelTransformParameterfvEXT - GLenum target - GLenum pname - const GLfloat *params - - - void glPixelTransformParameteriEXT - GLenum target - GLenum pname - GLint param - - - - void glPixelTransformParameterivEXT - GLenum target - GLenum pname - const GLint *params - - - void glPixelZoom - GLfloat xfactor - GLfloat yfactor - - - - void glPixelZoomxOES - GLfixed xfactor - GLfixed yfactor - - - GLboolean glPointAlongPathNV - GLuint path - GLsizei startSegment - GLsizei numSegments - GLfloat distance - GLfloat *x - GLfloat *y - GLfloat *tangentX - GLfloat *tangentY - - - void glPointParameterf - GLenum pname - GLfloat param - - - - void glPointParameterfARB - GLenum pname - GLfloat param - - - - - void glPointParameterfEXT - GLenum pname - GLfloat param - - - - void glPointParameterfSGIS - GLenum pname - GLfloat param - - - - void glPointParameterfv - GLenum pname - const GLfloat *params - - - - void glPointParameterfvARB - GLenum pname - const GLfloat *params - - - - - void glPointParameterfvEXT - GLenum pname - const GLfloat *params - - - - void glPointParameterfvSGIS - GLenum pname - const GLfloat *params - - - - void glPointParameteri - GLenum pname - GLint param - - - - void glPointParameteriNV - GLenum pname - GLint param - - - - - void glPointParameteriv - GLenum pname - const GLint *params - - - - void glPointParameterivNV - GLenum pname - const GLint *params - - - - - void glPointParameterx - GLenum pname - GLfixed param - - - void glPointParameterxOES - GLenum pname - GLfixed param - - - void glPointParameterxv - GLenum pname - const GLfixed *params - - - void glPointParameterxvOES - GLenum pname - const GLfixed *params - - - void glPointSize - GLfloat size - - - - void glPointSizePointerOES - GLenum type - GLsizei stride - const void *pointer - - - void glPointSizex - GLfixed size - - - void glPointSizexOES - GLfixed size - - - GLint glPollAsyncSGIX - GLuint *markerp - - - GLint glPollInstrumentsSGIX - GLint *marker_p - - - - void glPolygonMode - GLenum face - GLenum mode - - - - void glPolygonOffset - GLfloat factor - GLfloat units - - - - void glPolygonOffsetEXT - GLfloat factor - GLfloat bias - - - - void glPolygonOffsetx - GLfixed factor - GLfixed units - - - void glPolygonOffsetxOES - GLfixed factor - GLfixed units - - - void glPolygonStipple - const GLubyte *mask - - - - - void glPopAttrib - - - - void glPopClientAttrib - - - void glPopDebugGroup - - - void glPopDebugGroupKHR - - - - void glPopGroupMarkerEXT - - - void glPopMatrix - - - - void glPopName - - - - void glPresentFrameDualFillNV - GLuint video_slot - GLuint64EXT minPresentTime - GLuint beginPresentTimeId - GLuint presentDurationId - GLenum type - GLenum target0 - GLuint fill0 - GLenum target1 - GLuint fill1 - GLenum target2 - GLuint fill2 - GLenum target3 - GLuint fill3 - - - void glPresentFrameKeyedNV - GLuint video_slot - GLuint64EXT minPresentTime - GLuint beginPresentTimeId - GLuint presentDurationId - GLenum type - GLenum target0 - GLuint fill0 - GLuint key0 - GLenum target1 - GLuint fill1 - GLuint key1 - - - void glPrimitiveBoundingBoxEXT - GLfloat minX - GLfloat minY - GLfloat minZ - GLfloat minW - GLfloat maxX - GLfloat maxY - GLfloat maxZ - GLfloat maxW - - - void glPrimitiveRestartIndex - GLuint index - - - void glPrimitiveRestartIndexNV - GLuint index - - - void glPrimitiveRestartNV - - - void glPrioritizeTextures - GLsizei n - const GLuint *textures - const GLfloat *priorities - - - - void glPrioritizeTexturesEXT - GLsizei n - const GLuint *textures - const GLclampf *priorities - - - - - void glPrioritizeTexturesxOES - GLsizei n - const GLuint *textures - const GLfixed *priorities - - - void glProgramBinary - GLuint program - GLenum binaryFormat - const void *binary - GLsizei length - - - void glProgramBinaryOES - GLuint program - GLenum binaryFormat - const void *binary - GLint length - - - - void glProgramBufferParametersIivNV - GLenum target - GLuint bindingIndex - GLuint wordIndex - GLsizei count - const GLint *params - - - void glProgramBufferParametersIuivNV - GLenum target - GLuint bindingIndex - GLuint wordIndex - GLsizei count - const GLuint *params - - - void glProgramBufferParametersfvNV - GLenum target - GLuint bindingIndex - GLuint wordIndex - GLsizei count - const GLfloat *params - - - void glProgramEnvParameter4dARB - GLenum target - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glProgramEnvParameter4dvARB - GLenum target - GLuint index - const GLdouble *params - - - void glProgramEnvParameter4fARB - GLenum target - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glProgramEnvParameter4fvARB - GLenum target - GLuint index - const GLfloat *params - - - void glProgramEnvParameterI4iNV - GLenum target - GLuint index - GLint x - GLint y - GLint z - GLint w - - - - void glProgramEnvParameterI4ivNV - GLenum target - GLuint index - const GLint *params - - - void glProgramEnvParameterI4uiNV - GLenum target - GLuint index - GLuint x - GLuint y - GLuint z - GLuint w - - - - void glProgramEnvParameterI4uivNV - GLenum target - GLuint index - const GLuint *params - - - void glProgramEnvParameters4fvEXT - GLenum target - GLuint index - GLsizei count - const GLfloat *params - - - - void glProgramEnvParametersI4ivNV - GLenum target - GLuint index - GLsizei count - const GLint *params - - - void glProgramEnvParametersI4uivNV - GLenum target - GLuint index - GLsizei count - const GLuint *params - - - void glProgramLocalParameter4dARB - GLenum target - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glProgramLocalParameter4dvARB - GLenum target - GLuint index - const GLdouble *params - - - void glProgramLocalParameter4fARB - GLenum target - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glProgramLocalParameter4fvARB - GLenum target - GLuint index - const GLfloat *params - - - void glProgramLocalParameterI4iNV - GLenum target - GLuint index - GLint x - GLint y - GLint z - GLint w - - - - void glProgramLocalParameterI4ivNV - GLenum target - GLuint index - const GLint *params - - - void glProgramLocalParameterI4uiNV - GLenum target - GLuint index - GLuint x - GLuint y - GLuint z - GLuint w - - - - void glProgramLocalParameterI4uivNV - GLenum target - GLuint index - const GLuint *params - - - void glProgramLocalParameters4fvEXT - GLenum target - GLuint index - GLsizei count - const GLfloat *params - - - - void glProgramLocalParametersI4ivNV - GLenum target - GLuint index - GLsizei count - const GLint *params - - - void glProgramLocalParametersI4uivNV - GLenum target - GLuint index - GLsizei count - const GLuint *params - - - void glProgramNamedParameter4dNV - GLuint id - GLsizei len - const GLubyte *name - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glProgramNamedParameter4dvNV - GLuint id - GLsizei len - const GLubyte *name - const GLdouble *v - - - - void glProgramNamedParameter4fNV - GLuint id - GLsizei len - const GLubyte *name - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glProgramNamedParameter4fvNV - GLuint id - GLsizei len - const GLubyte *name - const GLfloat *v - - - - void glProgramParameter4dNV - GLenum target - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glProgramParameter4dvNV - GLenum target - GLuint index - const GLdouble *v - - - - void glProgramParameter4fNV - GLenum target - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glProgramParameter4fvNV - GLenum target - GLuint index - const GLfloat *v - - - - void glProgramParameteri - GLuint program - GLenum pname - GLint value - - - void glProgramParameteriARB - GLuint program - GLenum pname - GLint value - - - - void glProgramParameteriEXT - GLuint program - GLenum pname - GLint value - - - - void glProgramParameters4dvNV - GLenum target - GLuint index - GLsizei count - const GLdouble *v - - - - void glProgramParameters4fvNV - GLenum target - GLuint index - GLsizei count - const GLfloat *v - - - - void glProgramStringARB - GLenum target - GLenum format - GLsizei len - const void *string - - - void glProgramSubroutineParametersuivNV - GLenum target - GLsizei count - const GLuint *params - - - void glProgramUniform1d - GLuint program - GLint location - GLdouble v0 - - - void glProgramUniform1dEXT - GLuint program - GLint location - GLdouble x - - - void glProgramUniform1dv - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform1dvEXT - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform1f - GLuint program - GLint location - GLfloat v0 - - - void glProgramUniform1fEXT - GLuint program - GLint location - GLfloat v0 - - - - void glProgramUniform1fv - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - void glProgramUniform1fvEXT - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - - void glProgramUniform1i - GLuint program - GLint location - GLint v0 - - - void glProgramUniform1i64NV - GLuint program - GLint location - GLint64EXT x - - - void glProgramUniform1i64vNV - GLuint program - GLint location - GLsizei count - const GLint64EXT *value - - - void glProgramUniform1iEXT - GLuint program - GLint location - GLint v0 - - - - void glProgramUniform1iv - GLuint program - GLint location - GLsizei count - const GLint *value - - - void glProgramUniform1ivEXT - GLuint program - GLint location - GLsizei count - const GLint *value - - - - void glProgramUniform1ui - GLuint program - GLint location - GLuint v0 - - - void glProgramUniform1ui64NV - GLuint program - GLint location - GLuint64EXT x - - - void glProgramUniform1ui64vNV - GLuint program - GLint location - GLsizei count - const GLuint64EXT *value - - - void glProgramUniform1uiEXT - GLuint program - GLint location - GLuint v0 - - - - void glProgramUniform1uiv - GLuint program - GLint location - GLsizei count - const GLuint *value - - - void glProgramUniform1uivEXT - GLuint program - GLint location - GLsizei count - const GLuint *value - - - - void glProgramUniform2d - GLuint program - GLint location - GLdouble v0 - GLdouble v1 - - - void glProgramUniform2dEXT - GLuint program - GLint location - GLdouble x - GLdouble y - - - void glProgramUniform2dv - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform2dvEXT - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform2f - GLuint program - GLint location - GLfloat v0 - GLfloat v1 - - - void glProgramUniform2fEXT - GLuint program - GLint location - GLfloat v0 - GLfloat v1 - - - - void glProgramUniform2fv - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - void glProgramUniform2fvEXT - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - - void glProgramUniform2i - GLuint program - GLint location - GLint v0 - GLint v1 - - - void glProgramUniform2i64NV - GLuint program - GLint location - GLint64EXT x - GLint64EXT y - - - void glProgramUniform2i64vNV - GLuint program - GLint location - GLsizei count - const GLint64EXT *value - - - void glProgramUniform2iEXT - GLuint program - GLint location - GLint v0 - GLint v1 - - - - void glProgramUniform2iv - GLuint program - GLint location - GLsizei count - const GLint *value - - - void glProgramUniform2ivEXT - GLuint program - GLint location - GLsizei count - const GLint *value - - - - void glProgramUniform2ui - GLuint program - GLint location - GLuint v0 - GLuint v1 - - - void glProgramUniform2ui64NV - GLuint program - GLint location - GLuint64EXT x - GLuint64EXT y - - - void glProgramUniform2ui64vNV - GLuint program - GLint location - GLsizei count - const GLuint64EXT *value - - - void glProgramUniform2uiEXT - GLuint program - GLint location - GLuint v0 - GLuint v1 - - - - void glProgramUniform2uiv - GLuint program - GLint location - GLsizei count - const GLuint *value - - - void glProgramUniform2uivEXT - GLuint program - GLint location - GLsizei count - const GLuint *value - - - - void glProgramUniform3d - GLuint program - GLint location - GLdouble v0 - GLdouble v1 - GLdouble v2 - - - void glProgramUniform3dEXT - GLuint program - GLint location - GLdouble x - GLdouble y - GLdouble z - - - void glProgramUniform3dv - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform3dvEXT - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform3f - GLuint program - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - - - void glProgramUniform3fEXT - GLuint program - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - - - - void glProgramUniform3fv - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - void glProgramUniform3fvEXT - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - - void glProgramUniform3i - GLuint program - GLint location - GLint v0 - GLint v1 - GLint v2 - - - void glProgramUniform3i64NV - GLuint program - GLint location - GLint64EXT x - GLint64EXT y - GLint64EXT z - - - void glProgramUniform3i64vNV - GLuint program - GLint location - GLsizei count - const GLint64EXT *value - - - void glProgramUniform3iEXT - GLuint program - GLint location - GLint v0 - GLint v1 - GLint v2 - - - - void glProgramUniform3iv - GLuint program - GLint location - GLsizei count - const GLint *value - - - void glProgramUniform3ivEXT - GLuint program - GLint location - GLsizei count - const GLint *value - - - - void glProgramUniform3ui - GLuint program - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - - - void glProgramUniform3ui64NV - GLuint program - GLint location - GLuint64EXT x - GLuint64EXT y - GLuint64EXT z - - - void glProgramUniform3ui64vNV - GLuint program - GLint location - GLsizei count - const GLuint64EXT *value - - - void glProgramUniform3uiEXT - GLuint program - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - - - - void glProgramUniform3uiv - GLuint program - GLint location - GLsizei count - const GLuint *value - - - void glProgramUniform3uivEXT - GLuint program - GLint location - GLsizei count - const GLuint *value - - - - void glProgramUniform4d - GLuint program - GLint location - GLdouble v0 - GLdouble v1 - GLdouble v2 - GLdouble v3 - - - void glProgramUniform4dEXT - GLuint program - GLint location - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - void glProgramUniform4dv - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform4dvEXT - GLuint program - GLint location - GLsizei count - const GLdouble *value - - - void glProgramUniform4f - GLuint program - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - GLfloat v3 - - - void glProgramUniform4fEXT - GLuint program - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - GLfloat v3 - - - - void glProgramUniform4fv - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - void glProgramUniform4fvEXT - GLuint program - GLint location - GLsizei count - const GLfloat *value - - - - void glProgramUniform4i - GLuint program - GLint location - GLint v0 - GLint v1 - GLint v2 - GLint v3 - - - void glProgramUniform4i64NV - GLuint program - GLint location - GLint64EXT x - GLint64EXT y - GLint64EXT z - GLint64EXT w - - - void glProgramUniform4i64vNV - GLuint program - GLint location - GLsizei count - const GLint64EXT *value - - - void glProgramUniform4iEXT - GLuint program - GLint location - GLint v0 - GLint v1 - GLint v2 - GLint v3 - - - - void glProgramUniform4iv - GLuint program - GLint location - GLsizei count - const GLint *value - - - void glProgramUniform4ivEXT - GLuint program - GLint location - GLsizei count - const GLint *value - - - - void glProgramUniform4ui - GLuint program - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - GLuint v3 - - - void glProgramUniform4ui64NV - GLuint program - GLint location - GLuint64EXT x - GLuint64EXT y - GLuint64EXT z - GLuint64EXT w - - - void glProgramUniform4ui64vNV - GLuint program - GLint location - GLsizei count - const GLuint64EXT *value - - - void glProgramUniform4uiEXT - GLuint program - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - GLuint v3 - - - - void glProgramUniform4uiv - GLuint program - GLint location - GLsizei count - const GLuint *value - - - void glProgramUniform4uivEXT - GLuint program - GLint location - GLsizei count - const GLuint *value - - - - void glProgramUniformHandleui64ARB - GLuint program - GLint location - GLuint64 value - - - void glProgramUniformHandleui64NV - GLuint program - GLint location - GLuint64 value - - - void glProgramUniformHandleui64vARB - GLuint program - GLint location - GLsizei count - const GLuint64 *values - - - void glProgramUniformHandleui64vNV - GLuint program - GLint location - GLsizei count - const GLuint64 *values - - - void glProgramUniformMatrix2dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix2dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix2fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix2fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix2x3dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix2x3dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix2x3fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix2x3fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix2x4dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix2x4dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix2x4fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix2x4fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix3dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix3dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix3fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix3fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix3x2dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix3x2dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix3x2fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix3x2fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix3x4dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix3x4dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix3x4fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix3x4fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix4dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix4dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix4fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix4fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix4x2dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix4x2dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix4x2fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix4x2fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformMatrix4x3dv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix4x3dvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glProgramUniformMatrix4x3fv - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glProgramUniformMatrix4x3fvEXT - GLuint program - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glProgramUniformui64NV - GLuint program - GLint location - GLuint64EXT value - - - void glProgramUniformui64vNV - GLuint program - GLint location - GLsizei count - const GLuint64EXT *value - - - void glProgramVertexLimitNV - GLenum target - GLint limit - - - void glProvokingVertex - GLenum mode - - - void glProvokingVertexEXT - GLenum mode - - - - void glPushAttrib - GLbitfield mask - - - - void glPushClientAttrib - GLbitfield mask - - - void glPushClientAttribDefaultEXT - GLbitfield mask - - - void glPushDebugGroup - GLenum source - GLuint id - GLsizei length - const GLchar *message - - - void glPushDebugGroupKHR - GLenum source - GLuint id - GLsizei length - const GLchar *message - - - - void glPushGroupMarkerEXT - GLsizei length - const GLchar *marker - - - void glPushMatrix - - - - void glPushName - GLuint name - - - - void glQueryCounter - GLuint id - GLenum target - - - void glQueryCounterEXT - GLuint id - GLenum target - - - - GLbitfield glQueryMatrixxOES - GLfixed *mantissa - GLint *exponent - - - void glQueryObjectParameteruiAMD - GLenum target - GLuint id - GLenum pname - GLuint param - - - void glRasterPos2d - GLdouble x - GLdouble y - - - - void glRasterPos2dv - const GLdouble *v - - - - void glRasterPos2f - GLfloat x - GLfloat y - - - - void glRasterPos2fv - const GLfloat *v - - - - void glRasterPos2i - GLint x - GLint y - - - - void glRasterPos2iv - const GLint *v - - - - void glRasterPos2s - GLshort x - GLshort y - - - - void glRasterPos2sv - const GLshort *v - - - - void glRasterPos2xOES - GLfixed x - GLfixed y - - - void glRasterPos2xvOES - const GLfixed *coords - - - void glRasterPos3d - GLdouble x - GLdouble y - GLdouble z - - - - void glRasterPos3dv - const GLdouble *v - - - - void glRasterPos3f - GLfloat x - GLfloat y - GLfloat z - - - - void glRasterPos3fv - const GLfloat *v - - - - void glRasterPos3i - GLint x - GLint y - GLint z - - - - void glRasterPos3iv - const GLint *v - - - - void glRasterPos3s - GLshort x - GLshort y - GLshort z - - - - void glRasterPos3sv - const GLshort *v - - - - void glRasterPos3xOES - GLfixed x - GLfixed y - GLfixed z - - - void glRasterPos3xvOES - const GLfixed *coords - - - void glRasterPos4d - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glRasterPos4dv - const GLdouble *v - - - - void glRasterPos4f - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glRasterPos4fv - const GLfloat *v - - - - void glRasterPos4i - GLint x - GLint y - GLint z - GLint w - - - - void glRasterPos4iv - const GLint *v - - - - void glRasterPos4s - GLshort x - GLshort y - GLshort z - GLshort w - - - - void glRasterPos4sv - const GLshort *v - - - - void glRasterPos4xOES - GLfixed x - GLfixed y - GLfixed z - GLfixed w - - - void glRasterPos4xvOES - const GLfixed *coords - - - void glReadBuffer - GLenum mode - - - - void glReadBufferIndexedEXT - GLenum src - GLint index - - - void glReadBufferNV - GLenum mode - - - void glReadInstrumentsSGIX - GLint marker - - - - void glReadPixels - GLint x - GLint y - GLsizei width - GLsizei height - GLenum format - GLenum type - void *pixels - - - - - void glReadnPixelsARB - GLint x - GLint y - GLsizei width - GLsizei height - GLenum format - GLenum type - GLsizei bufSize - void *data - - - void glReadnPixelsEXT - GLint x - GLint y - GLsizei width - GLsizei height - GLenum format - GLenum type - GLsizei bufSize - void *data - - - void glRectd - GLdouble x1 - GLdouble y1 - GLdouble x2 - GLdouble y2 - - - - void glRectdv - const GLdouble *v1 - const GLdouble *v2 - - - - void glRectf - GLfloat x1 - GLfloat y1 - GLfloat x2 - GLfloat y2 - - - - void glRectfv - const GLfloat *v1 - const GLfloat *v2 - - - - void glRecti - GLint x1 - GLint y1 - GLint x2 - GLint y2 - - - - void glRectiv - const GLint *v1 - const GLint *v2 - - - - void glRects - GLshort x1 - GLshort y1 - GLshort x2 - GLshort y2 - - - - void glRectsv - const GLshort *v1 - const GLshort *v2 - - - - void glRectxOES - GLfixed x1 - GLfixed y1 - GLfixed x2 - GLfixed y2 - - - void glRectxvOES - const GLfixed *v1 - const GLfixed *v2 - - - void glReferencePlaneSGIX - const GLdouble *equation - - - - void glReleaseShaderCompiler - - - GLint glRenderMode - GLenum mode - - - - void glRenderbufferStorage - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - - - - void glRenderbufferStorageEXT - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - - - - - void glRenderbufferStorageMultisample - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - - void glRenderbufferStorageMultisampleANGLE - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - void glRenderbufferStorageMultisampleAPPLE - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - void glRenderbufferStorageMultisampleCoverageNV - GLenum target - GLsizei coverageSamples - GLsizei colorSamples - GLenum internalformat - GLsizei width - GLsizei height - - - void glRenderbufferStorageMultisampleEXT - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - - - void glRenderbufferStorageMultisampleIMG - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - void glRenderbufferStorageMultisampleNV - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - - - - void glRenderbufferStorageOES - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - - - void glReplacementCodePointerSUN - GLenum type - GLsizei stride - const void **pointer - - - void glReplacementCodeubSUN - GLubyte code - - - void glReplacementCodeubvSUN - const GLubyte *code - - - void glReplacementCodeuiColor3fVertex3fSUN - GLuint rc - GLfloat r - GLfloat g - GLfloat b - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiColor3fVertex3fvSUN - const GLuint *rc - const GLfloat *c - const GLfloat *v - - - void glReplacementCodeuiColor4fNormal3fVertex3fSUN - GLuint rc - GLfloat r - GLfloat g - GLfloat b - GLfloat a - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiColor4fNormal3fVertex3fvSUN - const GLuint *rc - const GLfloat *c - const GLfloat *n - const GLfloat *v - - - void glReplacementCodeuiColor4ubVertex3fSUN - GLuint rc - GLubyte r - GLubyte g - GLubyte b - GLubyte a - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiColor4ubVertex3fvSUN - const GLuint *rc - const GLubyte *c - const GLfloat *v - - - void glReplacementCodeuiNormal3fVertex3fSUN - GLuint rc - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiNormal3fVertex3fvSUN - const GLuint *rc - const GLfloat *n - const GLfloat *v - - - void glReplacementCodeuiSUN - GLuint code - - - void glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fSUN - GLuint rc - GLfloat s - GLfloat t - GLfloat r - GLfloat g - GLfloat b - GLfloat a - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiTexCoord2fColor4fNormal3fVertex3fvSUN - const GLuint *rc - const GLfloat *tc - const GLfloat *c - const GLfloat *n - const GLfloat *v - - - void glReplacementCodeuiTexCoord2fNormal3fVertex3fSUN - GLuint rc - GLfloat s - GLfloat t - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiTexCoord2fNormal3fVertex3fvSUN - const GLuint *rc - const GLfloat *tc - const GLfloat *n - const GLfloat *v - - - void glReplacementCodeuiTexCoord2fVertex3fSUN - GLuint rc - GLfloat s - GLfloat t - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiTexCoord2fVertex3fvSUN - const GLuint *rc - const GLfloat *tc - const GLfloat *v - - - void glReplacementCodeuiVertex3fSUN - GLuint rc - GLfloat x - GLfloat y - GLfloat z - - - void glReplacementCodeuiVertex3fvSUN - const GLuint *rc - const GLfloat *v - - - void glReplacementCodeuivSUN - const GLuint *code - - - void glReplacementCodeusSUN - GLushort code - - - void glReplacementCodeusvSUN - const GLushort *code - - - void glRequestResidentProgramsNV - GLsizei n - const GLuint *programs - - - - void glResetHistogram - GLenum target - - - - void glResetHistogramEXT - GLenum target - - - - - void glResetMinmax - GLenum target - - - - void glResetMinmaxEXT - GLenum target - - - - - void glResizeBuffersMESA - - - void glResolveMultisampleFramebufferAPPLE - - - void glResumeTransformFeedback - - - void glResumeTransformFeedbackNV - - - - void glRotated - GLdouble angle - GLdouble x - GLdouble y - GLdouble z - - - - void glRotatef - GLfloat angle - GLfloat x - GLfloat y - GLfloat z - - - - void glRotatex - GLfixed angle - GLfixed x - GLfixed y - GLfixed z - - - void glRotatexOES - GLfixed angle - GLfixed x - GLfixed y - GLfixed z - - - void glSampleCoverage - GLfloat value - GLboolean invert - - - - void glSampleCoverageARB - GLfloat value - GLboolean invert - - - - void glSampleCoverageOES - GLfixed value - GLboolean invert - - - void glSampleCoveragex - GLclampx value - GLboolean invert - - - void glSampleCoveragexOES - GLclampx value - GLboolean invert - - - void glSampleMapATI - GLuint dst - GLuint interp - GLenum swizzle - - - void glSampleMaskEXT - GLclampf value - GLboolean invert - - - void glSampleMaskIndexedNV - GLuint index - GLbitfield mask - - - void glSampleMaskSGIS - GLclampf value - GLboolean invert - - - - - void glSampleMaski - GLuint maskNumber - GLbitfield mask - - - void glSamplePatternEXT - GLenum pattern - - - void glSamplePatternSGIS - GLenum pattern - - - - - void glSamplerParameterIiv - GLuint sampler - GLenum pname - const GLint *param - - - void glSamplerParameterIivEXT - GLuint sampler - GLenum pname - const GLint *param - - - - void glSamplerParameterIuiv - GLuint sampler - GLenum pname - const GLuint *param - - - void glSamplerParameterIuivEXT - GLuint sampler - GLenum pname - const GLuint *param - - - - void glSamplerParameterf - GLuint sampler - GLenum pname - GLfloat param - - - void glSamplerParameterfv - GLuint sampler - GLenum pname - const GLfloat *param - - - void glSamplerParameteri - GLuint sampler - GLenum pname - GLint param - - - void glSamplerParameteriv - GLuint sampler - GLenum pname - const GLint *param - - - void glScaled - GLdouble x - GLdouble y - GLdouble z - - - - void glScalef - GLfloat x - GLfloat y - GLfloat z - - - - void glScalex - GLfixed x - GLfixed y - GLfixed z - - - void glScalexOES - GLfixed x - GLfixed y - GLfixed z - - - void glScissor - GLint x - GLint y - GLsizei width - GLsizei height - - - - void glScissorArrayv - GLuint first - GLsizei count - const GLint *v - - - void glScissorIndexed - GLuint index - GLint left - GLint bottom - GLsizei width - GLsizei height - - - void glScissorIndexedv - GLuint index - const GLint *v - - - void glSecondaryColor3b - GLbyte red - GLbyte green - GLbyte blue - - - - void glSecondaryColor3bEXT - GLbyte red - GLbyte green - GLbyte blue - - - - - void glSecondaryColor3bv - const GLbyte *v - - - - void glSecondaryColor3bvEXT - const GLbyte *v - - - - - void glSecondaryColor3d - GLdouble red - GLdouble green - GLdouble blue - - - - void glSecondaryColor3dEXT - GLdouble red - GLdouble green - GLdouble blue - - - - - void glSecondaryColor3dv - const GLdouble *v - - - - void glSecondaryColor3dvEXT - const GLdouble *v - - - - - void glSecondaryColor3f - GLfloat red - GLfloat green - GLfloat blue - - - - void glSecondaryColor3fEXT - GLfloat red - GLfloat green - GLfloat blue - - - - - void glSecondaryColor3fv - const GLfloat *v - - - - void glSecondaryColor3fvEXT - const GLfloat *v - - - - - void glSecondaryColor3hNV - GLhalfNV red - GLhalfNV green - GLhalfNV blue - - - - void glSecondaryColor3hvNV - const GLhalfNV *v - - - - void glSecondaryColor3i - GLint red - GLint green - GLint blue - - - - void glSecondaryColor3iEXT - GLint red - GLint green - GLint blue - - - - - void glSecondaryColor3iv - const GLint *v - - - - void glSecondaryColor3ivEXT - const GLint *v - - - - - void glSecondaryColor3s - GLshort red - GLshort green - GLshort blue - - - - void glSecondaryColor3sEXT - GLshort red - GLshort green - GLshort blue - - - - - void glSecondaryColor3sv - const GLshort *v - - - - void glSecondaryColor3svEXT - const GLshort *v - - - - - void glSecondaryColor3ub - GLubyte red - GLubyte green - GLubyte blue - - - - void glSecondaryColor3ubEXT - GLubyte red - GLubyte green - GLubyte blue - - - - - void glSecondaryColor3ubv - const GLubyte *v - - - - void glSecondaryColor3ubvEXT - const GLubyte *v - - - - - void glSecondaryColor3ui - GLuint red - GLuint green - GLuint blue - - - - void glSecondaryColor3uiEXT - GLuint red - GLuint green - GLuint blue - - - - - void glSecondaryColor3uiv - const GLuint *v - - - - void glSecondaryColor3uivEXT - const GLuint *v - - - - - void glSecondaryColor3us - GLushort red - GLushort green - GLushort blue - - - - void glSecondaryColor3usEXT - GLushort red - GLushort green - GLushort blue - - - - - void glSecondaryColor3usv - const GLushort *v - - - - void glSecondaryColor3usvEXT - const GLushort *v - - - - - void glSecondaryColorFormatNV - GLint size - GLenum type - GLsizei stride - - - void glSecondaryColorP3ui - GLenum type - GLuint color - - - void glSecondaryColorP3uiv - GLenum type - const GLuint *color - - - void glSecondaryColorPointer - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glSecondaryColorPointerEXT - GLint size - GLenum type - GLsizei stride - const void *pointer - - - - void glSecondaryColorPointerListIBM - GLint size - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glSelectBuffer - GLsizei size - GLuint *buffer - - - - void glSelectPerfMonitorCountersAMD - GLuint monitor - GLboolean enable - GLuint group - GLint numCounters - GLuint *counterList - - - void glSeparableFilter2D - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *row - const void *column - - - - - void glSeparableFilter2DEXT - GLenum target - GLenum internalformat - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *row - const void *column - - - - - void glSetFenceAPPLE - GLuint fence - - - void glSetFenceNV - GLuint fence - GLenum condition - - - void glSetFragmentShaderConstantATI - GLuint dst - const GLfloat *value - - - void glSetInvariantEXT - GLuint id - GLenum type - const void *addr - - - void glSetLocalConstantEXT - GLuint id - GLenum type - const void *addr - - - void glSetMultisamplefvAMD - GLenum pname - GLuint index - const GLfloat *val - - - void glShadeModel - GLenum mode - - - - void glShaderBinary - GLsizei count - const GLuint *shaders - GLenum binaryformat - const void *binary - GLsizei length - - - void glShaderOp1EXT - GLenum op - GLuint res - GLuint arg1 - - - void glShaderOp2EXT - GLenum op - GLuint res - GLuint arg1 - GLuint arg2 - - - void glShaderOp3EXT - GLenum op - GLuint res - GLuint arg1 - GLuint arg2 - GLuint arg3 - - - void glShaderSource - GLuint shader - GLsizei count - const GLchar *const*string - const GLint *length - - - void glShaderSourceARB - GLhandleARB shaderObj - GLsizei count - const GLcharARB **string - const GLint *length - - - - void glShaderStorageBlockBinding - GLuint program - GLuint storageBlockIndex - GLuint storageBlockBinding - - - void glSharpenTexFuncSGIS - GLenum target - GLsizei n - const GLfloat *points - - - - void glSpriteParameterfSGIX - GLenum pname - GLfloat param - - - - void glSpriteParameterfvSGIX - GLenum pname - const GLfloat *params - - - - void glSpriteParameteriSGIX - GLenum pname - GLint param - - - - void glSpriteParameterivSGIX - GLenum pname - const GLint *params - - - - void glStartInstrumentsSGIX - - - - void glStartTilingQCOM - GLuint x - GLuint y - GLuint width - GLuint height - GLbitfield preserveMask - - - void glStencilClearTagEXT - GLsizei stencilTagBits - GLuint stencilClearTag - - - - void glStencilFillPathInstancedNV - GLsizei numPaths - GLenum pathNameType - const void *paths - GLuint pathBase - GLenum fillMode - GLuint mask - GLenum transformType - const GLfloat *transformValues - - - void glStencilFillPathNV - GLuint path - GLenum fillMode - GLuint mask - - - void glStencilFunc - GLenum func - GLint ref - GLuint mask - - - - void glStencilFuncSeparate - GLenum face - GLenum func - GLint ref - GLuint mask - - - void glStencilFuncSeparateATI - GLenum frontfunc - GLenum backfunc - GLint ref - GLuint mask - - - void glStencilMask - GLuint mask - - - - void glStencilMaskSeparate - GLenum face - GLuint mask - - - void glStencilOp - GLenum fail - GLenum zfail - GLenum zpass - - - - void glStencilOpSeparate - GLenum face - GLenum sfail - GLenum dpfail - GLenum dppass - - - void glStencilOpSeparateATI - GLenum face - GLenum sfail - GLenum dpfail - GLenum dppass - - - - void glStencilOpValueAMD - GLenum face - GLuint value - - - void glStencilStrokePathInstancedNV - GLsizei numPaths - GLenum pathNameType - const void *paths - GLuint pathBase - GLint reference - GLuint mask - GLenum transformType - const GLfloat *transformValues - - - void glStencilStrokePathNV - GLuint path - GLint reference - GLuint mask - - - void glStopInstrumentsSGIX - GLint marker - - - - void glStringMarkerGREMEDY - GLsizei len - const void *string - - - void glSwizzleEXT - GLuint res - GLuint in - GLenum outX - GLenum outY - GLenum outZ - GLenum outW - - - void glSyncTextureINTEL - GLuint texture - - - void glTagSampleBufferSGIX - - - - void glTangent3bEXT - GLbyte tx - GLbyte ty - GLbyte tz - - - - void glTangent3bvEXT - const GLbyte *v - - - void glTangent3dEXT - GLdouble tx - GLdouble ty - GLdouble tz - - - - void glTangent3dvEXT - const GLdouble *v - - - void glTangent3fEXT - GLfloat tx - GLfloat ty - GLfloat tz - - - - void glTangent3fvEXT - const GLfloat *v - - - void glTangent3iEXT - GLint tx - GLint ty - GLint tz - - - - void glTangent3ivEXT - const GLint *v - - - void glTangent3sEXT - GLshort tx - GLshort ty - GLshort tz - - - - void glTangent3svEXT - const GLshort *v - - - void glTangentPointerEXT - GLenum type - GLsizei stride - const void *pointer - - - void glTbufferMask3DFX - GLuint mask - - - void glTessellationFactorAMD - GLfloat factor - - - void glTessellationModeAMD - GLenum mode - - - GLboolean glTestFenceAPPLE - GLuint fence - - - GLboolean glTestFenceNV - GLuint fence - - - - GLboolean glTestObjectAPPLE - GLenum object - GLuint name - - - void glTexBuffer - GLenum target - GLenum internalformat - GLuint buffer - - - void glTexBufferARB - GLenum target - GLenum internalformat - GLuint buffer - - - - void glTexBufferEXT - GLenum target - GLenum internalformat - GLuint buffer - - - - void glTexBufferRange - GLenum target - GLenum internalformat - GLuint buffer - GLintptr offset - GLsizeiptr size - - - void glTexBufferRangeEXT - GLenum target - GLenum internalformat - GLuint buffer - GLintptr offset - GLsizeiptr size - - - - void glTexBumpParameterfvATI - GLenum pname - const GLfloat *param - - - void glTexBumpParameterivATI - GLenum pname - const GLint *param - - - void glTexCoord1bOES - GLbyte s - - - void glTexCoord1bvOES - const GLbyte *coords - - - void glTexCoord1d - GLdouble s - - - - void glTexCoord1dv - const GLdouble *v - - - - void glTexCoord1f - GLfloat s - - - - void glTexCoord1fv - const GLfloat *v - - - - void glTexCoord1hNV - GLhalfNV s - - - - void glTexCoord1hvNV - const GLhalfNV *v - - - - void glTexCoord1i - GLint s - - - - void glTexCoord1iv - const GLint *v - - - - void glTexCoord1s - GLshort s - - - - void glTexCoord1sv - const GLshort *v - - - - void glTexCoord1xOES - GLfixed s - - - void glTexCoord1xvOES - const GLfixed *coords - - - void glTexCoord2bOES - GLbyte s - GLbyte t - - - void glTexCoord2bvOES - const GLbyte *coords - - - void glTexCoord2d - GLdouble s - GLdouble t - - - - void glTexCoord2dv - const GLdouble *v - - - - void glTexCoord2f - GLfloat s - GLfloat t - - - - void glTexCoord2fColor3fVertex3fSUN - GLfloat s - GLfloat t - GLfloat r - GLfloat g - GLfloat b - GLfloat x - GLfloat y - GLfloat z - - - void glTexCoord2fColor3fVertex3fvSUN - const GLfloat *tc - const GLfloat *c - const GLfloat *v - - - void glTexCoord2fColor4fNormal3fVertex3fSUN - GLfloat s - GLfloat t - GLfloat r - GLfloat g - GLfloat b - GLfloat a - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glTexCoord2fColor4fNormal3fVertex3fvSUN - const GLfloat *tc - const GLfloat *c - const GLfloat *n - const GLfloat *v - - - void glTexCoord2fColor4ubVertex3fSUN - GLfloat s - GLfloat t - GLubyte r - GLubyte g - GLubyte b - GLubyte a - GLfloat x - GLfloat y - GLfloat z - - - void glTexCoord2fColor4ubVertex3fvSUN - const GLfloat *tc - const GLubyte *c - const GLfloat *v - - - void glTexCoord2fNormal3fVertex3fSUN - GLfloat s - GLfloat t - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - - - void glTexCoord2fNormal3fVertex3fvSUN - const GLfloat *tc - const GLfloat *n - const GLfloat *v - - - void glTexCoord2fVertex3fSUN - GLfloat s - GLfloat t - GLfloat x - GLfloat y - GLfloat z - - - void glTexCoord2fVertex3fvSUN - const GLfloat *tc - const GLfloat *v - - - void glTexCoord2fv - const GLfloat *v - - - - void glTexCoord2hNV - GLhalfNV s - GLhalfNV t - - - - void glTexCoord2hvNV - const GLhalfNV *v - - - - void glTexCoord2i - GLint s - GLint t - - - - void glTexCoord2iv - const GLint *v - - - - void glTexCoord2s - GLshort s - GLshort t - - - - void glTexCoord2sv - const GLshort *v - - - - void glTexCoord2xOES - GLfixed s - GLfixed t - - - void glTexCoord2xvOES - const GLfixed *coords - - - void glTexCoord3bOES - GLbyte s - GLbyte t - GLbyte r - - - void glTexCoord3bvOES - const GLbyte *coords - - - void glTexCoord3d - GLdouble s - GLdouble t - GLdouble r - - - - void glTexCoord3dv - const GLdouble *v - - - - void glTexCoord3f - GLfloat s - GLfloat t - GLfloat r - - - - void glTexCoord3fv - const GLfloat *v - - - - void glTexCoord3hNV - GLhalfNV s - GLhalfNV t - GLhalfNV r - - - - void glTexCoord3hvNV - const GLhalfNV *v - - - - void glTexCoord3i - GLint s - GLint t - GLint r - - - - void glTexCoord3iv - const GLint *v - - - - void glTexCoord3s - GLshort s - GLshort t - GLshort r - - - - void glTexCoord3sv - const GLshort *v - - - - void glTexCoord3xOES - GLfixed s - GLfixed t - GLfixed r - - - void glTexCoord3xvOES - const GLfixed *coords - - - void glTexCoord4bOES - GLbyte s - GLbyte t - GLbyte r - GLbyte q - - - void glTexCoord4bvOES - const GLbyte *coords - - - void glTexCoord4d - GLdouble s - GLdouble t - GLdouble r - GLdouble q - - - - void glTexCoord4dv - const GLdouble *v - - - - void glTexCoord4f - GLfloat s - GLfloat t - GLfloat r - GLfloat q - - - - void glTexCoord4fColor4fNormal3fVertex4fSUN - GLfloat s - GLfloat t - GLfloat p - GLfloat q - GLfloat r - GLfloat g - GLfloat b - GLfloat a - GLfloat nx - GLfloat ny - GLfloat nz - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - void glTexCoord4fColor4fNormal3fVertex4fvSUN - const GLfloat *tc - const GLfloat *c - const GLfloat *n - const GLfloat *v - - - void glTexCoord4fVertex4fSUN - GLfloat s - GLfloat t - GLfloat p - GLfloat q - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - void glTexCoord4fVertex4fvSUN - const GLfloat *tc - const GLfloat *v - - - void glTexCoord4fv - const GLfloat *v - - - - void glTexCoord4hNV - GLhalfNV s - GLhalfNV t - GLhalfNV r - GLhalfNV q - - - - void glTexCoord4hvNV - const GLhalfNV *v - - - - void glTexCoord4i - GLint s - GLint t - GLint r - GLint q - - - - void glTexCoord4iv - const GLint *v - - - - void glTexCoord4s - GLshort s - GLshort t - GLshort r - GLshort q - - - - void glTexCoord4sv - const GLshort *v - - - - void glTexCoord4xOES - GLfixed s - GLfixed t - GLfixed r - GLfixed q - - - void glTexCoord4xvOES - const GLfixed *coords - - - void glTexCoordFormatNV - GLint size - GLenum type - GLsizei stride - - - void glTexCoordP1ui - GLenum type - GLuint coords - - - void glTexCoordP1uiv - GLenum type - const GLuint *coords - - - void glTexCoordP2ui - GLenum type - GLuint coords - - - void glTexCoordP2uiv - GLenum type - const GLuint *coords - - - void glTexCoordP3ui - GLenum type - GLuint coords - - - void glTexCoordP3uiv - GLenum type - const GLuint *coords - - - void glTexCoordP4ui - GLenum type - GLuint coords - - - void glTexCoordP4uiv - GLenum type - const GLuint *coords - - - void glTexCoordPointer - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glTexCoordPointerEXT - GLint size - GLenum type - GLsizei stride - GLsizei count - const void *pointer - - - void glTexCoordPointerListIBM - GLint size - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glTexCoordPointervINTEL - GLint size - GLenum type - const void **pointer - - - void glTexEnvf - GLenum target - GLenum pname - GLfloat param - - - - void glTexEnvfv - GLenum target - GLenum pname - const GLfloat *params - - - - void glTexEnvi - GLenum target - GLenum pname - GLint param - - - - void glTexEnviv - GLenum target - GLenum pname - const GLint *params - - - - void glTexEnvx - GLenum target - GLenum pname - GLfixed param - - - void glTexEnvxOES - GLenum target - GLenum pname - GLfixed param - - - void glTexEnvxv - GLenum target - GLenum pname - const GLfixed *params - - - void glTexEnvxvOES - GLenum target - GLenum pname - const GLfixed *params - - - void glTexFilterFuncSGIS - GLenum target - GLenum filter - GLsizei n - const GLfloat *weights - - - - void glTexGend - GLenum coord - GLenum pname - GLdouble param - - - - void glTexGendv - GLenum coord - GLenum pname - const GLdouble *params - - - - void glTexGenf - GLenum coord - GLenum pname - GLfloat param - - - - void glTexGenfOES - GLenum coord - GLenum pname - GLfloat param - - - void glTexGenfv - GLenum coord - GLenum pname - const GLfloat *params - - - - void glTexGenfvOES - GLenum coord - GLenum pname - const GLfloat *params - - - void glTexGeni - GLenum coord - GLenum pname - GLint param - - - - void glTexGeniOES - GLenum coord - GLenum pname - GLint param - - - void glTexGeniv - GLenum coord - GLenum pname - const GLint *params - - - - void glTexGenivOES - GLenum coord - GLenum pname - const GLint *params - - - void glTexGenxOES - GLenum coord - GLenum pname - GLfixed param - - - void glTexGenxvOES - GLenum coord - GLenum pname - const GLfixed *params - - - void glTexImage1D - GLenum target - GLint level - GLint internalformat - GLsizei width - GLint border - GLenum format - GLenum type - const void *pixels - - - - - void glTexImage2D - GLenum target - GLint level - GLint internalformat - GLsizei width - GLsizei height - GLint border - GLenum format - GLenum type - const void *pixels - - - - - void glTexImage2DMultisample - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLboolean fixedsamplelocations - - - void glTexImage2DMultisampleCoverageNV - GLenum target - GLsizei coverageSamples - GLsizei colorSamples - GLint internalFormat - GLsizei width - GLsizei height - GLboolean fixedSampleLocations - - - void glTexImage3D - GLenum target - GLint level - GLint internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLenum format - GLenum type - const void *pixels - - - - - void glTexImage3DEXT - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLenum format - GLenum type - const void *pixels - - - - - void glTexImage3DMultisample - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedsamplelocations - - - void glTexImage3DMultisampleCoverageNV - GLenum target - GLsizei coverageSamples - GLsizei colorSamples - GLint internalFormat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedSampleLocations - - - void glTexImage3DOES - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLenum format - GLenum type - const void *pixels - - - - void glTexImage4DSGIS - GLenum target - GLint level - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLsizei size4d - GLint border - GLenum format - GLenum type - const void *pixels - - - - void glTexPageCommitmentARB - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLboolean resident - - - void glTexParameterIiv - GLenum target - GLenum pname - const GLint *params - - - - void glTexParameterIivEXT - GLenum target - GLenum pname - const GLint *params - - - - void glTexParameterIuiv - GLenum target - GLenum pname - const GLuint *params - - - - void glTexParameterIuivEXT - GLenum target - GLenum pname - const GLuint *params - - - - void glTexParameterf - GLenum target - GLenum pname - GLfloat param - - - - void glTexParameterfv - GLenum target - GLenum pname - const GLfloat *params - - - - void glTexParameteri - GLenum target - GLenum pname - GLint param - - - - void glTexParameteriv - GLenum target - GLenum pname - const GLint *params - - - - void glTexParameterx - GLenum target - GLenum pname - GLfixed param - - - void glTexParameterxOES - GLenum target - GLenum pname - GLfixed param - - - void glTexParameterxv - GLenum target - GLenum pname - const GLfixed *params - - - void glTexParameterxvOES - GLenum target - GLenum pname - const GLfixed *params - - - void glTexRenderbufferNV - GLenum target - GLuint renderbuffer - - - void glTexStorage1D - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - - - void glTexStorage1DEXT - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - - - - void glTexStorage2D - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - GLsizei height - - - void glTexStorage2DEXT - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - GLsizei height - - - - void glTexStorage2DMultisample - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLboolean fixedsamplelocations - - - void glTexStorage3D - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - - - void glTexStorage3DEXT - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - - - - void glTexStorage3DMultisample - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedsamplelocations - - - void glTexStorage3DMultisampleOES - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedsamplelocations - - - - void glTexStorageSparseAMD - GLenum target - GLenum internalFormat - GLsizei width - GLsizei height - GLsizei depth - GLsizei layers - GLbitfield flags - - - void glTexSubImage1D - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLenum type - const void *pixels - - - - - void glTexSubImage1DEXT - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLenum type - const void *pixels - - - - - void glTexSubImage2D - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *pixels - - - - - void glTexSubImage2DEXT - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *pixels - - - - - void glTexSubImage3D - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - const void *pixels - - - - - void glTexSubImage3DEXT - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - const void *pixels - - - - - void glTexSubImage3DOES - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - const void *pixels - - - - void glTexSubImage4DSGIS - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLint woffset - GLsizei width - GLsizei height - GLsizei depth - GLsizei size4d - GLenum format - GLenum type - const void *pixels - - - - void glTextureBarrierNV - - - - void glTextureBufferEXT - GLuint texture - GLenum target - GLenum internalformat - GLuint buffer - - - void glTextureBufferRangeEXT - GLuint texture - GLenum target - GLenum internalformat - GLuint buffer - GLintptr offset - GLsizeiptr size - - - void glTextureColorMaskSGIS - GLboolean red - GLboolean green - GLboolean blue - GLboolean alpha - - - - void glTextureImage1DEXT - GLuint texture - GLenum target - GLint level - GLint internalformat - GLsizei width - GLint border - GLenum format - GLenum type - const void *pixels - - - void glTextureImage2DEXT - GLuint texture - GLenum target - GLint level - GLint internalformat - GLsizei width - GLsizei height - GLint border - GLenum format - GLenum type - const void *pixels - - - void glTextureImage2DMultisampleCoverageNV - GLuint texture - GLenum target - GLsizei coverageSamples - GLsizei colorSamples - GLint internalFormat - GLsizei width - GLsizei height - GLboolean fixedSampleLocations - - - void glTextureImage2DMultisampleNV - GLuint texture - GLenum target - GLsizei samples - GLint internalFormat - GLsizei width - GLsizei height - GLboolean fixedSampleLocations - - - void glTextureImage3DEXT - GLuint texture - GLenum target - GLint level - GLint internalformat - GLsizei width - GLsizei height - GLsizei depth - GLint border - GLenum format - GLenum type - const void *pixels - - - void glTextureImage3DMultisampleCoverageNV - GLuint texture - GLenum target - GLsizei coverageSamples - GLsizei colorSamples - GLint internalFormat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedSampleLocations - - - void glTextureImage3DMultisampleNV - GLuint texture - GLenum target - GLsizei samples - GLint internalFormat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedSampleLocations - - - void glTextureLightEXT - GLenum pname - - - void glTextureMaterialEXT - GLenum face - GLenum mode - - - void glTextureNormalEXT - GLenum mode - - - void glTexturePageCommitmentEXT - GLuint texture - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLboolean resident - - - void glTextureParameterIivEXT - GLuint texture - GLenum target - GLenum pname - const GLint *params - - - void glTextureParameterIuivEXT - GLuint texture - GLenum target - GLenum pname - const GLuint *params - - - void glTextureParameterfEXT - GLuint texture - GLenum target - GLenum pname - GLfloat param - - - - void glTextureParameterfvEXT - GLuint texture - GLenum target - GLenum pname - const GLfloat *params - - - void glTextureParameteriEXT - GLuint texture - GLenum target - GLenum pname - GLint param - - - - void glTextureParameterivEXT - GLuint texture - GLenum target - GLenum pname - const GLint *params - - - void glTextureRangeAPPLE - GLenum target - GLsizei length - const void *pointer - - - void glTextureRenderbufferEXT - GLuint texture - GLenum target - GLuint renderbuffer - - - void glTextureStorage1DEXT - GLuint texture - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - - - void glTextureStorage2DEXT - GLuint texture - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - GLsizei height - - - void glTextureStorage2DMultisampleEXT - GLuint texture - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLboolean fixedsamplelocations - - - void glTextureStorage3DEXT - GLuint texture - GLenum target - GLsizei levels - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - - - void glTextureStorage3DMultisampleEXT - GLuint texture - GLenum target - GLsizei samples - GLenum internalformat - GLsizei width - GLsizei height - GLsizei depth - GLboolean fixedsamplelocations - - - void glTextureStorageSparseAMD - GLuint texture - GLenum target - GLenum internalFormat - GLsizei width - GLsizei height - GLsizei depth - GLsizei layers - GLbitfield flags - - - void glTextureSubImage1DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLsizei width - GLenum format - GLenum type - const void *pixels - - - void glTextureSubImage2DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLsizei width - GLsizei height - GLenum format - GLenum type - const void *pixels - - - void glTextureSubImage3DEXT - GLuint texture - GLenum target - GLint level - GLint xoffset - GLint yoffset - GLint zoffset - GLsizei width - GLsizei height - GLsizei depth - GLenum format - GLenum type - const void *pixels - - - void glTextureView - GLuint texture - GLenum target - GLuint origtexture - GLenum internalformat - GLuint minlevel - GLuint numlevels - GLuint minlayer - GLuint numlayers - - - void glTextureViewEXT - GLuint texture - GLenum target - GLuint origtexture - GLenum internalformat - GLuint minlevel - GLuint numlevels - GLuint minlayer - GLuint numlayers - - - - void glTrackMatrixNV - GLenum target - GLuint address - GLenum matrix - GLenum transform - - - - void glTransformFeedbackAttribsNV - GLuint count - const GLint *attribs - GLenum bufferMode - - - void glTransformFeedbackStreamAttribsNV - GLsizei count - const GLint *attribs - GLsizei nbuffers - const GLint *bufstreams - GLenum bufferMode - - - void glTransformFeedbackVaryings - GLuint program - GLsizei count - const GLchar *const*varyings - GLenum bufferMode - - - void glTransformFeedbackVaryingsEXT - GLuint program - GLsizei count - const GLchar *const*varyings - GLenum bufferMode - - - - void glTransformFeedbackVaryingsNV - GLuint program - GLsizei count - const GLint *locations - GLenum bufferMode - - - void glTransformPathNV - GLuint resultPath - GLuint srcPath - GLenum transformType - const GLfloat *transformValues - - - void glTranslated - GLdouble x - GLdouble y - GLdouble z - - - - void glTranslatef - GLfloat x - GLfloat y - GLfloat z - - - - void glTranslatex - GLfixed x - GLfixed y - GLfixed z - - - void glTranslatexOES - GLfixed x - GLfixed y - GLfixed z - - - void glUniform1d - GLint location - GLdouble x - - - void glUniform1dv - GLint location - GLsizei count - const GLdouble *value - - - void glUniform1f - GLint location - GLfloat v0 - - - void glUniform1fARB - GLint location - GLfloat v0 - - - - void glUniform1fv - GLint location - GLsizei count - const GLfloat *value - - - void glUniform1fvARB - GLint location - GLsizei count - const GLfloat *value - - - - void glUniform1i - GLint location - GLint v0 - - - void glUniform1i64NV - GLint location - GLint64EXT x - - - void glUniform1i64vNV - GLint location - GLsizei count - const GLint64EXT *value - - - void glUniform1iARB - GLint location - GLint v0 - - - - void glUniform1iv - GLint location - GLsizei count - const GLint *value - - - void glUniform1ivARB - GLint location - GLsizei count - const GLint *value - - - - void glUniform1ui - GLint location - GLuint v0 - - - void glUniform1ui64NV - GLint location - GLuint64EXT x - - - void glUniform1ui64vNV - GLint location - GLsizei count - const GLuint64EXT *value - - - void glUniform1uiEXT - GLint location - GLuint v0 - - - - void glUniform1uiv - GLint location - GLsizei count - const GLuint *value - - - void glUniform1uivEXT - GLint location - GLsizei count - const GLuint *value - - - - void glUniform2d - GLint location - GLdouble x - GLdouble y - - - void glUniform2dv - GLint location - GLsizei count - const GLdouble *value - - - void glUniform2f - GLint location - GLfloat v0 - GLfloat v1 - - - void glUniform2fARB - GLint location - GLfloat v0 - GLfloat v1 - - - - void glUniform2fv - GLint location - GLsizei count - const GLfloat *value - - - void glUniform2fvARB - GLint location - GLsizei count - const GLfloat *value - - - - void glUniform2i - GLint location - GLint v0 - GLint v1 - - - void glUniform2i64NV - GLint location - GLint64EXT x - GLint64EXT y - - - void glUniform2i64vNV - GLint location - GLsizei count - const GLint64EXT *value - - - void glUniform2iARB - GLint location - GLint v0 - GLint v1 - - - - void glUniform2iv - GLint location - GLsizei count - const GLint *value - - - void glUniform2ivARB - GLint location - GLsizei count - const GLint *value - - - - void glUniform2ui - GLint location - GLuint v0 - GLuint v1 - - - void glUniform2ui64NV - GLint location - GLuint64EXT x - GLuint64EXT y - - - void glUniform2ui64vNV - GLint location - GLsizei count - const GLuint64EXT *value - - - void glUniform2uiEXT - GLint location - GLuint v0 - GLuint v1 - - - - void glUniform2uiv - GLint location - GLsizei count - const GLuint *value - - - void glUniform2uivEXT - GLint location - GLsizei count - const GLuint *value - - - - void glUniform3d - GLint location - GLdouble x - GLdouble y - GLdouble z - - - void glUniform3dv - GLint location - GLsizei count - const GLdouble *value - - - void glUniform3f - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - - - void glUniform3fARB - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - - - - void glUniform3fv - GLint location - GLsizei count - const GLfloat *value - - - void glUniform3fvARB - GLint location - GLsizei count - const GLfloat *value - - - - void glUniform3i - GLint location - GLint v0 - GLint v1 - GLint v2 - - - void glUniform3i64NV - GLint location - GLint64EXT x - GLint64EXT y - GLint64EXT z - - - void glUniform3i64vNV - GLint location - GLsizei count - const GLint64EXT *value - - - void glUniform3iARB - GLint location - GLint v0 - GLint v1 - GLint v2 - - - - void glUniform3iv - GLint location - GLsizei count - const GLint *value - - - void glUniform3ivARB - GLint location - GLsizei count - const GLint *value - - - - void glUniform3ui - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - - - void glUniform3ui64NV - GLint location - GLuint64EXT x - GLuint64EXT y - GLuint64EXT z - - - void glUniform3ui64vNV - GLint location - GLsizei count - const GLuint64EXT *value - - - void glUniform3uiEXT - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - - - - void glUniform3uiv - GLint location - GLsizei count - const GLuint *value - - - void glUniform3uivEXT - GLint location - GLsizei count - const GLuint *value - - - - void glUniform4d - GLint location - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - void glUniform4dv - GLint location - GLsizei count - const GLdouble *value - - - void glUniform4f - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - GLfloat v3 - - - void glUniform4fARB - GLint location - GLfloat v0 - GLfloat v1 - GLfloat v2 - GLfloat v3 - - - - void glUniform4fv - GLint location - GLsizei count - const GLfloat *value - - - void glUniform4fvARB - GLint location - GLsizei count - const GLfloat *value - - - - void glUniform4i - GLint location - GLint v0 - GLint v1 - GLint v2 - GLint v3 - - - void glUniform4i64NV - GLint location - GLint64EXT x - GLint64EXT y - GLint64EXT z - GLint64EXT w - - - void glUniform4i64vNV - GLint location - GLsizei count - const GLint64EXT *value - - - void glUniform4iARB - GLint location - GLint v0 - GLint v1 - GLint v2 - GLint v3 - - - - void glUniform4iv - GLint location - GLsizei count - const GLint *value - - - void glUniform4ivARB - GLint location - GLsizei count - const GLint *value - - - - void glUniform4ui - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - GLuint v3 - - - void glUniform4ui64NV - GLint location - GLuint64EXT x - GLuint64EXT y - GLuint64EXT z - GLuint64EXT w - - - void glUniform4ui64vNV - GLint location - GLsizei count - const GLuint64EXT *value - - - void glUniform4uiEXT - GLint location - GLuint v0 - GLuint v1 - GLuint v2 - GLuint v3 - - - - void glUniform4uiv - GLint location - GLsizei count - const GLuint *value - - - void glUniform4uivEXT - GLint location - GLsizei count - const GLuint *value - - - - void glUniformBlockBinding - GLuint program - GLuint uniformBlockIndex - GLuint uniformBlockBinding - - - void glUniformBufferEXT - GLuint program - GLint location - GLuint buffer - - - void glUniformHandleui64ARB - GLint location - GLuint64 value - - - void glUniformHandleui64NV - GLint location - GLuint64 value - - - void glUniformHandleui64vARB - GLint location - GLsizei count - const GLuint64 *value - - - void glUniformHandleui64vNV - GLint location - GLsizei count - const GLuint64 *value - - - void glUniformMatrix2dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix2fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glUniformMatrix2fvARB - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix2x3dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix2x3fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix2x3fvNV - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix2x4dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix2x4fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix2x4fvNV - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix3dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix3fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glUniformMatrix3fvARB - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix3x2dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix3x2fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix3x2fvNV - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix3x4dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix3x4fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix3x4fvNV - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix4dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix4fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - void glUniformMatrix4fvARB - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix4x2dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix4x2fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix4x2fvNV - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix4x3dv - GLint location - GLsizei count - GLboolean transpose - const GLdouble *value - - - void glUniformMatrix4x3fv - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformMatrix4x3fvNV - GLint location - GLsizei count - GLboolean transpose - const GLfloat *value - - - - void glUniformSubroutinesuiv - GLenum shadertype - GLsizei count - const GLuint *indices - - - void glUniformui64NV - GLint location - GLuint64EXT value - - - void glUniformui64vNV - GLint location - GLsizei count - const GLuint64EXT *value - - - void glUnlockArraysEXT - - - GLboolean glUnmapBuffer - GLenum target - - - GLboolean glUnmapBufferARB - GLenum target - - - - GLboolean glUnmapBufferOES - GLenum target - - - - GLboolean glUnmapNamedBufferEXT - GLuint buffer - - - void glUnmapObjectBufferATI - GLuint buffer - - - void glUnmapTexture2DINTEL - GLuint texture - GLint level - - - void glUpdateObjectBufferATI - GLuint buffer - GLuint offset - GLsizei size - const void *pointer - GLenum preserve - - - void glUseProgram - GLuint program - - - void glUseProgramObjectARB - GLhandleARB programObj - - - - void glUseProgramStages - GLuint pipeline - GLbitfield stages - GLuint program - - - void glUseProgramStagesEXT - GLuint pipeline - GLbitfield stages - GLuint program - - - void glUseShaderProgramEXT - GLenum type - GLuint program - - - void glVDPAUFiniNV - - - void glVDPAUGetSurfaceivNV - GLvdpauSurfaceNV surface - GLenum pname - GLsizei bufSize - GLsizei *length - GLint *values - - - void glVDPAUInitNV - const void *vdpDevice - const void *getProcAddress - - - GLboolean glVDPAUIsSurfaceNV - GLvdpauSurfaceNV surface - - - void glVDPAUMapSurfacesNV - GLsizei numSurfaces - const GLvdpauSurfaceNV *surfaces - - - GLvdpauSurfaceNV glVDPAURegisterOutputSurfaceNV - const void *vdpSurface - GLenum target - GLsizei numTextureNames - const GLuint *textureNames - - - GLvdpauSurfaceNV glVDPAURegisterVideoSurfaceNV - const void *vdpSurface - GLenum target - GLsizei numTextureNames - const GLuint *textureNames - - - void glVDPAUSurfaceAccessNV - GLvdpauSurfaceNV surface - GLenum access - - - void glVDPAUUnmapSurfacesNV - GLsizei numSurface - const GLvdpauSurfaceNV *surfaces - - - void glVDPAUUnregisterSurfaceNV - GLvdpauSurfaceNV surface - - - void glValidateProgram - GLuint program - - - void glValidateProgramARB - GLhandleARB programObj - - - - void glValidateProgramPipeline - GLuint pipeline - - - void glValidateProgramPipelineEXT - GLuint pipeline - - - void glVariantArrayObjectATI - GLuint id - GLenum type - GLsizei stride - GLuint buffer - GLuint offset - - - void glVariantPointerEXT - GLuint id - GLenum type - GLuint stride - const void *addr - - - void glVariantbvEXT - GLuint id - const GLbyte *addr - - - void glVariantdvEXT - GLuint id - const GLdouble *addr - - - void glVariantfvEXT - GLuint id - const GLfloat *addr - - - void glVariantivEXT - GLuint id - const GLint *addr - - - void glVariantsvEXT - GLuint id - const GLshort *addr - - - void glVariantubvEXT - GLuint id - const GLubyte *addr - - - void glVariantuivEXT - GLuint id - const GLuint *addr - - - void glVariantusvEXT - GLuint id - const GLushort *addr - - - void glVertex2bOES - GLbyte x - - - void glVertex2bvOES - const GLbyte *coords - - - void glVertex2d - GLdouble x - GLdouble y - - - - void glVertex2dv - const GLdouble *v - - - - void glVertex2f - GLfloat x - GLfloat y - - - - void glVertex2fv - const GLfloat *v - - - - void glVertex2hNV - GLhalfNV x - GLhalfNV y - - - - void glVertex2hvNV - const GLhalfNV *v - - - - void glVertex2i - GLint x - GLint y - - - - void glVertex2iv - const GLint *v - - - - void glVertex2s - GLshort x - GLshort y - - - - void glVertex2sv - const GLshort *v - - - - void glVertex2xOES - GLfixed x - - - void glVertex2xvOES - const GLfixed *coords - - - void glVertex3bOES - GLbyte x - GLbyte y - - - void glVertex3bvOES - const GLbyte *coords - - - void glVertex3d - GLdouble x - GLdouble y - GLdouble z - - - - void glVertex3dv - const GLdouble *v - - - - void glVertex3f - GLfloat x - GLfloat y - GLfloat z - - - - void glVertex3fv - const GLfloat *v - - - - void glVertex3hNV - GLhalfNV x - GLhalfNV y - GLhalfNV z - - - - void glVertex3hvNV - const GLhalfNV *v - - - - void glVertex3i - GLint x - GLint y - GLint z - - - - void glVertex3iv - const GLint *v - - - - void glVertex3s - GLshort x - GLshort y - GLshort z - - - - void glVertex3sv - const GLshort *v - - - - void glVertex3xOES - GLfixed x - GLfixed y - - - void glVertex3xvOES - const GLfixed *coords - - - void glVertex4bOES - GLbyte x - GLbyte y - GLbyte z - - - void glVertex4bvOES - const GLbyte *coords - - - void glVertex4d - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glVertex4dv - const GLdouble *v - - - - void glVertex4f - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glVertex4fv - const GLfloat *v - - - - void glVertex4hNV - GLhalfNV x - GLhalfNV y - GLhalfNV z - GLhalfNV w - - - - void glVertex4hvNV - const GLhalfNV *v - - - - void glVertex4i - GLint x - GLint y - GLint z - GLint w - - - - void glVertex4iv - const GLint *v - - - - void glVertex4s - GLshort x - GLshort y - GLshort z - GLshort w - - - - void glVertex4sv - const GLshort *v - - - - void glVertex4xOES - GLfixed x - GLfixed y - GLfixed z - - - void glVertex4xvOES - const GLfixed *coords - - - void glVertexArrayBindVertexBufferEXT - GLuint vaobj - GLuint bindingindex - GLuint buffer - GLintptr offset - GLsizei stride - - - void glVertexArrayColorOffsetEXT - GLuint vaobj - GLuint buffer - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayEdgeFlagOffsetEXT - GLuint vaobj - GLuint buffer - GLsizei stride - GLintptr offset - - - void glVertexArrayFogCoordOffsetEXT - GLuint vaobj - GLuint buffer - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayIndexOffsetEXT - GLuint vaobj - GLuint buffer - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayMultiTexCoordOffsetEXT - GLuint vaobj - GLuint buffer - GLenum texunit - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayNormalOffsetEXT - GLuint vaobj - GLuint buffer - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayParameteriAPPLE - GLenum pname - GLint param - - - void glVertexArrayRangeAPPLE - GLsizei length - void *pointer - - - void glVertexArrayRangeNV - GLsizei length - const void *pointer - - - void glVertexArraySecondaryColorOffsetEXT - GLuint vaobj - GLuint buffer - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayTexCoordOffsetEXT - GLuint vaobj - GLuint buffer - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayVertexAttribBindingEXT - GLuint vaobj - GLuint attribindex - GLuint bindingindex - - - void glVertexArrayVertexAttribDivisorEXT - GLuint vaobj - GLuint index - GLuint divisor - - - void glVertexArrayVertexAttribFormatEXT - GLuint vaobj - GLuint attribindex - GLint size - GLenum type - GLboolean normalized - GLuint relativeoffset - - - void glVertexArrayVertexAttribIFormatEXT - GLuint vaobj - GLuint attribindex - GLint size - GLenum type - GLuint relativeoffset - - - void glVertexArrayVertexAttribIOffsetEXT - GLuint vaobj - GLuint buffer - GLuint index - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayVertexAttribLFormatEXT - GLuint vaobj - GLuint attribindex - GLint size - GLenum type - GLuint relativeoffset - - - void glVertexArrayVertexAttribLOffsetEXT - GLuint vaobj - GLuint buffer - GLuint index - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexArrayVertexAttribOffsetEXT - GLuint vaobj - GLuint buffer - GLuint index - GLint size - GLenum type - GLboolean normalized - GLsizei stride - GLintptr offset - - - void glVertexArrayVertexBindingDivisorEXT - GLuint vaobj - GLuint bindingindex - GLuint divisor - - - void glVertexArrayVertexOffsetEXT - GLuint vaobj - GLuint buffer - GLint size - GLenum type - GLsizei stride - GLintptr offset - - - void glVertexAttrib1d - GLuint index - GLdouble x - - - - void glVertexAttrib1dARB - GLuint index - GLdouble x - - - - - void glVertexAttrib1dNV - GLuint index - GLdouble x - - - - - void glVertexAttrib1dv - GLuint index - const GLdouble *v - - - - void glVertexAttrib1dvARB - GLuint index - const GLdouble *v - - - - - void glVertexAttrib1dvNV - GLuint index - const GLdouble *v - - - - - void glVertexAttrib1f - GLuint index - GLfloat x - - - - void glVertexAttrib1fARB - GLuint index - GLfloat x - - - - - void glVertexAttrib1fNV - GLuint index - GLfloat x - - - - - void glVertexAttrib1fv - GLuint index - const GLfloat *v - - - - void glVertexAttrib1fvARB - GLuint index - const GLfloat *v - - - - - void glVertexAttrib1fvNV - GLuint index - const GLfloat *v - - - - - void glVertexAttrib1hNV - GLuint index - GLhalfNV x - - - - void glVertexAttrib1hvNV - GLuint index - const GLhalfNV *v - - - - void glVertexAttrib1s - GLuint index - GLshort x - - - - void glVertexAttrib1sARB - GLuint index - GLshort x - - - - - void glVertexAttrib1sNV - GLuint index - GLshort x - - - - - void glVertexAttrib1sv - GLuint index - const GLshort *v - - - - void glVertexAttrib1svARB - GLuint index - const GLshort *v - - - - - void glVertexAttrib1svNV - GLuint index - const GLshort *v - - - - - void glVertexAttrib2d - GLuint index - GLdouble x - GLdouble y - - - - void glVertexAttrib2dARB - GLuint index - GLdouble x - GLdouble y - - - - - void glVertexAttrib2dNV - GLuint index - GLdouble x - GLdouble y - - - - - void glVertexAttrib2dv - GLuint index - const GLdouble *v - - - - void glVertexAttrib2dvARB - GLuint index - const GLdouble *v - - - - - void glVertexAttrib2dvNV - GLuint index - const GLdouble *v - - - - - void glVertexAttrib2f - GLuint index - GLfloat x - GLfloat y - - - - void glVertexAttrib2fARB - GLuint index - GLfloat x - GLfloat y - - - - - void glVertexAttrib2fNV - GLuint index - GLfloat x - GLfloat y - - - - - void glVertexAttrib2fv - GLuint index - const GLfloat *v - - - - void glVertexAttrib2fvARB - GLuint index - const GLfloat *v - - - - - void glVertexAttrib2fvNV - GLuint index - const GLfloat *v - - - - - void glVertexAttrib2hNV - GLuint index - GLhalfNV x - GLhalfNV y - - - - void glVertexAttrib2hvNV - GLuint index - const GLhalfNV *v - - - - void glVertexAttrib2s - GLuint index - GLshort x - GLshort y - - - - void glVertexAttrib2sARB - GLuint index - GLshort x - GLshort y - - - - - void glVertexAttrib2sNV - GLuint index - GLshort x - GLshort y - - - - - void glVertexAttrib2sv - GLuint index - const GLshort *v - - - - void glVertexAttrib2svARB - GLuint index - const GLshort *v - - - - - void glVertexAttrib2svNV - GLuint index - const GLshort *v - - - - - void glVertexAttrib3d - GLuint index - GLdouble x - GLdouble y - GLdouble z - - - - void glVertexAttrib3dARB - GLuint index - GLdouble x - GLdouble y - GLdouble z - - - - - void glVertexAttrib3dNV - GLuint index - GLdouble x - GLdouble y - GLdouble z - - - - - void glVertexAttrib3dv - GLuint index - const GLdouble *v - - - - void glVertexAttrib3dvARB - GLuint index - const GLdouble *v - - - - - void glVertexAttrib3dvNV - GLuint index - const GLdouble *v - - - - - void glVertexAttrib3f - GLuint index - GLfloat x - GLfloat y - GLfloat z - - - - void glVertexAttrib3fARB - GLuint index - GLfloat x - GLfloat y - GLfloat z - - - - - void glVertexAttrib3fNV - GLuint index - GLfloat x - GLfloat y - GLfloat z - - - - - void glVertexAttrib3fv - GLuint index - const GLfloat *v - - - - void glVertexAttrib3fvARB - GLuint index - const GLfloat *v - - - - - void glVertexAttrib3fvNV - GLuint index - const GLfloat *v - - - - - void glVertexAttrib3hNV - GLuint index - GLhalfNV x - GLhalfNV y - GLhalfNV z - - - - void glVertexAttrib3hvNV - GLuint index - const GLhalfNV *v - - - - void glVertexAttrib3s - GLuint index - GLshort x - GLshort y - GLshort z - - - - void glVertexAttrib3sARB - GLuint index - GLshort x - GLshort y - GLshort z - - - - - void glVertexAttrib3sNV - GLuint index - GLshort x - GLshort y - GLshort z - - - - - void glVertexAttrib3sv - GLuint index - const GLshort *v - - - - void glVertexAttrib3svARB - GLuint index - const GLshort *v - - - - - void glVertexAttrib3svNV - GLuint index - const GLshort *v - - - - - void glVertexAttrib4Nbv - GLuint index - const GLbyte *v - - - void glVertexAttrib4NbvARB - GLuint index - const GLbyte *v - - - - void glVertexAttrib4Niv - GLuint index - const GLint *v - - - void glVertexAttrib4NivARB - GLuint index - const GLint *v - - - - void glVertexAttrib4Nsv - GLuint index - const GLshort *v - - - void glVertexAttrib4NsvARB - GLuint index - const GLshort *v - - - - void glVertexAttrib4Nub - GLuint index - GLubyte x - GLubyte y - GLubyte z - GLubyte w - - - void glVertexAttrib4NubARB - GLuint index - GLubyte x - GLubyte y - GLubyte z - GLubyte w - - - - void glVertexAttrib4Nubv - GLuint index - const GLubyte *v - - - - void glVertexAttrib4NubvARB - GLuint index - const GLubyte *v - - - - - void glVertexAttrib4Nuiv - GLuint index - const GLuint *v - - - void glVertexAttrib4NuivARB - GLuint index - const GLuint *v - - - - void glVertexAttrib4Nusv - GLuint index - const GLushort *v - - - void glVertexAttrib4NusvARB - GLuint index - const GLushort *v - - - - void glVertexAttrib4bv - GLuint index - const GLbyte *v - - - void glVertexAttrib4bvARB - GLuint index - const GLbyte *v - - - - void glVertexAttrib4d - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glVertexAttrib4dARB - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - - void glVertexAttrib4dNV - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - - void glVertexAttrib4dv - GLuint index - const GLdouble *v - - - - void glVertexAttrib4dvARB - GLuint index - const GLdouble *v - - - - - void glVertexAttrib4dvNV - GLuint index - const GLdouble *v - - - - - void glVertexAttrib4f - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glVertexAttrib4fARB - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - - void glVertexAttrib4fNV - GLuint index - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - - void glVertexAttrib4fv - GLuint index - const GLfloat *v - - - - void glVertexAttrib4fvARB - GLuint index - const GLfloat *v - - - - - void glVertexAttrib4fvNV - GLuint index - const GLfloat *v - - - - - void glVertexAttrib4hNV - GLuint index - GLhalfNV x - GLhalfNV y - GLhalfNV z - GLhalfNV w - - - - void glVertexAttrib4hvNV - GLuint index - const GLhalfNV *v - - - - void glVertexAttrib4iv - GLuint index - const GLint *v - - - void glVertexAttrib4ivARB - GLuint index - const GLint *v - - - - void glVertexAttrib4s - GLuint index - GLshort x - GLshort y - GLshort z - GLshort w - - - - void glVertexAttrib4sARB - GLuint index - GLshort x - GLshort y - GLshort z - GLshort w - - - - - void glVertexAttrib4sNV - GLuint index - GLshort x - GLshort y - GLshort z - GLshort w - - - - - void glVertexAttrib4sv - GLuint index - const GLshort *v - - - - void glVertexAttrib4svARB - GLuint index - const GLshort *v - - - - - void glVertexAttrib4svNV - GLuint index - const GLshort *v - - - - - void glVertexAttrib4ubNV - GLuint index - GLubyte x - GLubyte y - GLubyte z - GLubyte w - - - - - void glVertexAttrib4ubv - GLuint index - const GLubyte *v - - - void glVertexAttrib4ubvARB - GLuint index - const GLubyte *v - - - - void glVertexAttrib4ubvNV - GLuint index - const GLubyte *v - - - - - void glVertexAttrib4uiv - GLuint index - const GLuint *v - - - void glVertexAttrib4uivARB - GLuint index - const GLuint *v - - - - void glVertexAttrib4usv - GLuint index - const GLushort *v - - - void glVertexAttrib4usvARB - GLuint index - const GLushort *v - - - - void glVertexAttribArrayObjectATI - GLuint index - GLint size - GLenum type - GLboolean normalized - GLsizei stride - GLuint buffer - GLuint offset - - - void glVertexAttribBinding - GLuint attribindex - GLuint bindingindex - - - void glVertexAttribDivisor - GLuint index - GLuint divisor - - - void glVertexAttribDivisorANGLE - GLuint index - GLuint divisor - - - - void glVertexAttribDivisorARB - GLuint index - GLuint divisor - - - - void glVertexAttribDivisorEXT - GLuint index - GLuint divisor - - - - void glVertexAttribDivisorNV - GLuint index - GLuint divisor - - - - void glVertexAttribFormat - GLuint attribindex - GLint size - GLenum type - GLboolean normalized - GLuint relativeoffset - - - void glVertexAttribFormatNV - GLuint index - GLint size - GLenum type - GLboolean normalized - GLsizei stride - - - void glVertexAttribI1i - GLuint index - GLint x - - - - void glVertexAttribI1iEXT - GLuint index - GLint x - - - - - void glVertexAttribI1iv - GLuint index - const GLint *v - - - void glVertexAttribI1ivEXT - GLuint index - const GLint *v - - - - void glVertexAttribI1ui - GLuint index - GLuint x - - - - void glVertexAttribI1uiEXT - GLuint index - GLuint x - - - - - void glVertexAttribI1uiv - GLuint index - const GLuint *v - - - void glVertexAttribI1uivEXT - GLuint index - const GLuint *v - - - - void glVertexAttribI2i - GLuint index - GLint x - GLint y - - - - void glVertexAttribI2iEXT - GLuint index - GLint x - GLint y - - - - - void glVertexAttribI2iv - GLuint index - const GLint *v - - - void glVertexAttribI2ivEXT - GLuint index - const GLint *v - - - - void glVertexAttribI2ui - GLuint index - GLuint x - GLuint y - - - - void glVertexAttribI2uiEXT - GLuint index - GLuint x - GLuint y - - - - - void glVertexAttribI2uiv - GLuint index - const GLuint *v - - - void glVertexAttribI2uivEXT - GLuint index - const GLuint *v - - - - void glVertexAttribI3i - GLuint index - GLint x - GLint y - GLint z - - - - void glVertexAttribI3iEXT - GLuint index - GLint x - GLint y - GLint z - - - - - void glVertexAttribI3iv - GLuint index - const GLint *v - - - void glVertexAttribI3ivEXT - GLuint index - const GLint *v - - - - void glVertexAttribI3ui - GLuint index - GLuint x - GLuint y - GLuint z - - - - void glVertexAttribI3uiEXT - GLuint index - GLuint x - GLuint y - GLuint z - - - - - void glVertexAttribI3uiv - GLuint index - const GLuint *v - - - void glVertexAttribI3uivEXT - GLuint index - const GLuint *v - - - - void glVertexAttribI4bv - GLuint index - const GLbyte *v - - - void glVertexAttribI4bvEXT - GLuint index - const GLbyte *v - - - - void glVertexAttribI4i - GLuint index - GLint x - GLint y - GLint z - GLint w - - - - void glVertexAttribI4iEXT - GLuint index - GLint x - GLint y - GLint z - GLint w - - - - - void glVertexAttribI4iv - GLuint index - const GLint *v - - - void glVertexAttribI4ivEXT - GLuint index - const GLint *v - - - - void glVertexAttribI4sv - GLuint index - const GLshort *v - - - void glVertexAttribI4svEXT - GLuint index - const GLshort *v - - - - void glVertexAttribI4ubv - GLuint index - const GLubyte *v - - - void glVertexAttribI4ubvEXT - GLuint index - const GLubyte *v - - - - void glVertexAttribI4ui - GLuint index - GLuint x - GLuint y - GLuint z - GLuint w - - - - void glVertexAttribI4uiEXT - GLuint index - GLuint x - GLuint y - GLuint z - GLuint w - - - - - void glVertexAttribI4uiv - GLuint index - const GLuint *v - - - void glVertexAttribI4uivEXT - GLuint index - const GLuint *v - - - - void glVertexAttribI4usv - GLuint index - const GLushort *v - - - void glVertexAttribI4usvEXT - GLuint index - const GLushort *v - - - - void glVertexAttribIFormat - GLuint attribindex - GLint size - GLenum type - GLuint relativeoffset - - - void glVertexAttribIFormatNV - GLuint index - GLint size - GLenum type - GLsizei stride - - - void glVertexAttribIPointer - GLuint index - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glVertexAttribIPointerEXT - GLuint index - GLint size - GLenum type - GLsizei stride - const void *pointer - - - - void glVertexAttribL1d - GLuint index - GLdouble x - - - void glVertexAttribL1dEXT - GLuint index - GLdouble x - - - - void glVertexAttribL1dv - GLuint index - const GLdouble *v - - - void glVertexAttribL1dvEXT - GLuint index - const GLdouble *v - - - - void glVertexAttribL1i64NV - GLuint index - GLint64EXT x - - - void glVertexAttribL1i64vNV - GLuint index - const GLint64EXT *v - - - void glVertexAttribL1ui64ARB - GLuint index - GLuint64EXT x - - - void glVertexAttribL1ui64NV - GLuint index - GLuint64EXT x - - - void glVertexAttribL1ui64vARB - GLuint index - const GLuint64EXT *v - - - void glVertexAttribL1ui64vNV - GLuint index - const GLuint64EXT *v - - - void glVertexAttribL2d - GLuint index - GLdouble x - GLdouble y - - - void glVertexAttribL2dEXT - GLuint index - GLdouble x - GLdouble y - - - - void glVertexAttribL2dv - GLuint index - const GLdouble *v - - - void glVertexAttribL2dvEXT - GLuint index - const GLdouble *v - - - - void glVertexAttribL2i64NV - GLuint index - GLint64EXT x - GLint64EXT y - - - void glVertexAttribL2i64vNV - GLuint index - const GLint64EXT *v - - - void glVertexAttribL2ui64NV - GLuint index - GLuint64EXT x - GLuint64EXT y - - - void glVertexAttribL2ui64vNV - GLuint index - const GLuint64EXT *v - - - void glVertexAttribL3d - GLuint index - GLdouble x - GLdouble y - GLdouble z - - - void glVertexAttribL3dEXT - GLuint index - GLdouble x - GLdouble y - GLdouble z - - - - void glVertexAttribL3dv - GLuint index - const GLdouble *v - - - void glVertexAttribL3dvEXT - GLuint index - const GLdouble *v - - - - void glVertexAttribL3i64NV - GLuint index - GLint64EXT x - GLint64EXT y - GLint64EXT z - - - void glVertexAttribL3i64vNV - GLuint index - const GLint64EXT *v - - - void glVertexAttribL3ui64NV - GLuint index - GLuint64EXT x - GLuint64EXT y - GLuint64EXT z - - - void glVertexAttribL3ui64vNV - GLuint index - const GLuint64EXT *v - - - void glVertexAttribL4d - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - void glVertexAttribL4dEXT - GLuint index - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glVertexAttribL4dv - GLuint index - const GLdouble *v - - - void glVertexAttribL4dvEXT - GLuint index - const GLdouble *v - - - - void glVertexAttribL4i64NV - GLuint index - GLint64EXT x - GLint64EXT y - GLint64EXT z - GLint64EXT w - - - void glVertexAttribL4i64vNV - GLuint index - const GLint64EXT *v - - - void glVertexAttribL4ui64NV - GLuint index - GLuint64EXT x - GLuint64EXT y - GLuint64EXT z - GLuint64EXT w - - - void glVertexAttribL4ui64vNV - GLuint index - const GLuint64EXT *v - - - void glVertexAttribLFormat - GLuint attribindex - GLint size - GLenum type - GLuint relativeoffset - - - void glVertexAttribLFormatNV - GLuint index - GLint size - GLenum type - GLsizei stride - - - void glVertexAttribLPointer - GLuint index - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glVertexAttribLPointerEXT - GLuint index - GLint size - GLenum type - GLsizei stride - const void *pointer - - - - void glVertexAttribP1ui - GLuint index - GLenum type - GLboolean normalized - GLuint value - - - void glVertexAttribP1uiv - GLuint index - GLenum type - GLboolean normalized - const GLuint *value - - - void glVertexAttribP2ui - GLuint index - GLenum type - GLboolean normalized - GLuint value - - - void glVertexAttribP2uiv - GLuint index - GLenum type - GLboolean normalized - const GLuint *value - - - void glVertexAttribP3ui - GLuint index - GLenum type - GLboolean normalized - GLuint value - - - void glVertexAttribP3uiv - GLuint index - GLenum type - GLboolean normalized - const GLuint *value - - - void glVertexAttribP4ui - GLuint index - GLenum type - GLboolean normalized - GLuint value - - - void glVertexAttribP4uiv - GLuint index - GLenum type - GLboolean normalized - const GLuint *value - - - void glVertexAttribParameteriAMD - GLuint index - GLenum pname - GLint param - - - void glVertexAttribPointer - GLuint index - GLint size - GLenum type - GLboolean normalized - GLsizei stride - const void *pointer - - - void glVertexAttribPointerARB - GLuint index - GLint size - GLenum type - GLboolean normalized - GLsizei stride - const void *pointer - - - - void glVertexAttribPointerNV - GLuint index - GLint fsize - GLenum type - GLsizei stride - const void *pointer - - - void glVertexAttribs1dvNV - GLuint index - GLsizei count - const GLdouble *v - - - - void glVertexAttribs1fvNV - GLuint index - GLsizei count - const GLfloat *v - - - - void glVertexAttribs1hvNV - GLuint index - GLsizei n - const GLhalfNV *v - - - - void glVertexAttribs1svNV - GLuint index - GLsizei count - const GLshort *v - - - - void glVertexAttribs2dvNV - GLuint index - GLsizei count - const GLdouble *v - - - - void glVertexAttribs2fvNV - GLuint index - GLsizei count - const GLfloat *v - - - - void glVertexAttribs2hvNV - GLuint index - GLsizei n - const GLhalfNV *v - - - - void glVertexAttribs2svNV - GLuint index - GLsizei count - const GLshort *v - - - - void glVertexAttribs3dvNV - GLuint index - GLsizei count - const GLdouble *v - - - - void glVertexAttribs3fvNV - GLuint index - GLsizei count - const GLfloat *v - - - - void glVertexAttribs3hvNV - GLuint index - GLsizei n - const GLhalfNV *v - - - - void glVertexAttribs3svNV - GLuint index - GLsizei count - const GLshort *v - - - - void glVertexAttribs4dvNV - GLuint index - GLsizei count - const GLdouble *v - - - - void glVertexAttribs4fvNV - GLuint index - GLsizei count - const GLfloat *v - - - - void glVertexAttribs4hvNV - GLuint index - GLsizei n - const GLhalfNV *v - - - - void glVertexAttribs4svNV - GLuint index - GLsizei count - const GLshort *v - - - - void glVertexAttribs4ubvNV - GLuint index - GLsizei count - const GLubyte *v - - - - void glVertexBindingDivisor - GLuint bindingindex - GLuint divisor - - - void glVertexBlendARB - GLint count - - - - void glVertexBlendEnvfATI - GLenum pname - GLfloat param - - - void glVertexBlendEnviATI - GLenum pname - GLint param - - - void glVertexFormatNV - GLint size - GLenum type - GLsizei stride - - - void glVertexP2ui - GLenum type - GLuint value - - - void glVertexP2uiv - GLenum type - const GLuint *value - - - void glVertexP3ui - GLenum type - GLuint value - - - void glVertexP3uiv - GLenum type - const GLuint *value - - - void glVertexP4ui - GLenum type - GLuint value - - - void glVertexP4uiv - GLenum type - const GLuint *value - - - void glVertexPointer - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glVertexPointerEXT - GLint size - GLenum type - GLsizei stride - GLsizei count - const void *pointer - - - void glVertexPointerListIBM - GLint size - GLenum type - GLint stride - const void **pointer - GLint ptrstride - - - void glVertexPointervINTEL - GLint size - GLenum type - const void **pointer - - - void glVertexStream1dATI - GLenum stream - GLdouble x - - - void glVertexStream1dvATI - GLenum stream - const GLdouble *coords - - - void glVertexStream1fATI - GLenum stream - GLfloat x - - - void glVertexStream1fvATI - GLenum stream - const GLfloat *coords - - - void glVertexStream1iATI - GLenum stream - GLint x - - - void glVertexStream1ivATI - GLenum stream - const GLint *coords - - - void glVertexStream1sATI - GLenum stream - GLshort x - - - void glVertexStream1svATI - GLenum stream - const GLshort *coords - - - void glVertexStream2dATI - GLenum stream - GLdouble x - GLdouble y - - - void glVertexStream2dvATI - GLenum stream - const GLdouble *coords - - - void glVertexStream2fATI - GLenum stream - GLfloat x - GLfloat y - - - void glVertexStream2fvATI - GLenum stream - const GLfloat *coords - - - void glVertexStream2iATI - GLenum stream - GLint x - GLint y - - - void glVertexStream2ivATI - GLenum stream - const GLint *coords - - - void glVertexStream2sATI - GLenum stream - GLshort x - GLshort y - - - void glVertexStream2svATI - GLenum stream - const GLshort *coords - - - void glVertexStream3dATI - GLenum stream - GLdouble x - GLdouble y - GLdouble z - - - void glVertexStream3dvATI - GLenum stream - const GLdouble *coords - - - void glVertexStream3fATI - GLenum stream - GLfloat x - GLfloat y - GLfloat z - - - void glVertexStream3fvATI - GLenum stream - const GLfloat *coords - - - void glVertexStream3iATI - GLenum stream - GLint x - GLint y - GLint z - - - void glVertexStream3ivATI - GLenum stream - const GLint *coords - - - void glVertexStream3sATI - GLenum stream - GLshort x - GLshort y - GLshort z - - - void glVertexStream3svATI - GLenum stream - const GLshort *coords - - - void glVertexStream4dATI - GLenum stream - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - void glVertexStream4dvATI - GLenum stream - const GLdouble *coords - - - void glVertexStream4fATI - GLenum stream - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - void glVertexStream4fvATI - GLenum stream - const GLfloat *coords - - - void glVertexStream4iATI - GLenum stream - GLint x - GLint y - GLint z - GLint w - - - void glVertexStream4ivATI - GLenum stream - const GLint *coords - - - void glVertexStream4sATI - GLenum stream - GLshort x - GLshort y - GLshort z - GLshort w - - - void glVertexStream4svATI - GLenum stream - const GLshort *coords - - - void glVertexWeightPointerEXT - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glVertexWeightfEXT - GLfloat weight - - - - void glVertexWeightfvEXT - const GLfloat *weight - - - - void glVertexWeighthNV - GLhalfNV weight - - - - void glVertexWeighthvNV - const GLhalfNV *weight - - - - GLenum glVideoCaptureNV - GLuint video_capture_slot - GLuint *sequence_num - GLuint64EXT *capture_time - - - void glVideoCaptureStreamParameterdvNV - GLuint video_capture_slot - GLuint stream - GLenum pname - const GLdouble *params - - - void glVideoCaptureStreamParameterfvNV - GLuint video_capture_slot - GLuint stream - GLenum pname - const GLfloat *params - - - void glVideoCaptureStreamParameterivNV - GLuint video_capture_slot - GLuint stream - GLenum pname - const GLint *params - - - void glViewport - GLint x - GLint y - GLsizei width - GLsizei height - - - - void glViewportArrayv - GLuint first - GLsizei count - const GLfloat *v - - - void glViewportIndexedf - GLuint index - GLfloat x - GLfloat y - GLfloat w - GLfloat h - - - void glViewportIndexedfv - GLuint index - const GLfloat *v - - - void glWaitSync - GLsync sync - GLbitfield flags - GLuint64 timeout - - - void glWaitSyncAPPLE - GLsync sync - GLbitfield flags - GLuint64 timeout - - - - void glWeightPathsNV - GLuint resultPath - GLsizei numPaths - const GLuint *paths - const GLfloat *weights - - - void glWeightPointerARB - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glWeightPointerOES - GLint size - GLenum type - GLsizei stride - const void *pointer - - - void glWeightbvARB - GLint size - const GLbyte *weights - - - - void glWeightdvARB - GLint size - const GLdouble *weights - - - - void glWeightfvARB - GLint size - const GLfloat *weights - - - - void glWeightivARB - GLint size - const GLint *weights - - - - void glWeightsvARB - GLint size - const GLshort *weights - - - - void glWeightubvARB - GLint size - const GLubyte *weights - - - - void glWeightuivARB - GLint size - const GLuint *weights - - - - void glWeightusvARB - GLint size - const GLushort *weights - - - - void glWindowPos2d - GLdouble x - GLdouble y - - - - void glWindowPos2dARB - GLdouble x - GLdouble y - - - - - void glWindowPos2dMESA - GLdouble x - GLdouble y - - - - - void glWindowPos2dv - const GLdouble *v - - - - void glWindowPos2dvARB - const GLdouble *v - - - - - void glWindowPos2dvMESA - const GLdouble *v - - - - void glWindowPos2f - GLfloat x - GLfloat y - - - - void glWindowPos2fARB - GLfloat x - GLfloat y - - - - - void glWindowPos2fMESA - GLfloat x - GLfloat y - - - - - void glWindowPos2fv - const GLfloat *v - - - - void glWindowPos2fvARB - const GLfloat *v - - - - - void glWindowPos2fvMESA - const GLfloat *v - - - - void glWindowPos2i - GLint x - GLint y - - - - void glWindowPos2iARB - GLint x - GLint y - - - - - void glWindowPos2iMESA - GLint x - GLint y - - - - - void glWindowPos2iv - const GLint *v - - - - void glWindowPos2ivARB - const GLint *v - - - - - void glWindowPos2ivMESA - const GLint *v - - - - void glWindowPos2s - GLshort x - GLshort y - - - - void glWindowPos2sARB - GLshort x - GLshort y - - - - - void glWindowPos2sMESA - GLshort x - GLshort y - - - - - void glWindowPos2sv - const GLshort *v - - - - void glWindowPos2svARB - const GLshort *v - - - - - void glWindowPos2svMESA - const GLshort *v - - - - void glWindowPos3d - GLdouble x - GLdouble y - GLdouble z - - - - void glWindowPos3dARB - GLdouble x - GLdouble y - GLdouble z - - - - - void glWindowPos3dMESA - GLdouble x - GLdouble y - GLdouble z - - - - - void glWindowPos3dv - const GLdouble *v - - - - void glWindowPos3dvARB - const GLdouble *v - - - - - void glWindowPos3dvMESA - const GLdouble *v - - - - void glWindowPos3f - GLfloat x - GLfloat y - GLfloat z - - - - void glWindowPos3fARB - GLfloat x - GLfloat y - GLfloat z - - - - - void glWindowPos3fMESA - GLfloat x - GLfloat y - GLfloat z - - - - - void glWindowPos3fv - const GLfloat *v - - - - void glWindowPos3fvARB - const GLfloat *v - - - - - void glWindowPos3fvMESA - const GLfloat *v - - - - void glWindowPos3i - GLint x - GLint y - GLint z - - - - void glWindowPos3iARB - GLint x - GLint y - GLint z - - - - - void glWindowPos3iMESA - GLint x - GLint y - GLint z - - - - - void glWindowPos3iv - const GLint *v - - - - void glWindowPos3ivARB - const GLint *v - - - - - void glWindowPos3ivMESA - const GLint *v - - - - void glWindowPos3s - GLshort x - GLshort y - GLshort z - - - - void glWindowPos3sARB - GLshort x - GLshort y - GLshort z - - - - - void glWindowPos3sMESA - GLshort x - GLshort y - GLshort z - - - - - void glWindowPos3sv - const GLshort *v - - - - void glWindowPos3svARB - const GLshort *v - - - - - void glWindowPos3svMESA - const GLshort *v - - - - void glWindowPos4dMESA - GLdouble x - GLdouble y - GLdouble z - GLdouble w - - - - void glWindowPos4dvMESA - const GLdouble *v - - - void glWindowPos4fMESA - GLfloat x - GLfloat y - GLfloat z - GLfloat w - - - - void glWindowPos4fvMESA - const GLfloat *v - - - void glWindowPos4iMESA - GLint x - GLint y - GLint z - GLint w - - - - void glWindowPos4ivMESA - const GLint *v - - - void glWindowPos4sMESA - GLshort x - GLshort y - GLshort z - GLshort w - - - - void glWindowPos4svMESA - const GLshort *v - - - void glWriteMaskEXT - GLuint res - GLuint in - GLenum outX - GLenum outY - GLenum outZ - GLenum outW - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff -Nru android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/reg.py android-platform-frameworks-native-21/opengl/tools/glgen2/registry/reg.py --- android-platform-frameworks-native-6.0.1+r16/opengl/tools/glgen2/registry/reg.py 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/opengl/tools/glgen2/registry/reg.py 1970-01-01 00:00:00.000000000 +0000 @@ -1,1162 +0,0 @@ -#!/usr/bin/python3 -i -# -# Copyright (c) 2013-2014 The Khronos Group Inc. -# -# Permission is hereby granted, free of charge, to any person obtaining a -# copy of this software and/or associated documentation files (the -# "Materials"), to deal in the Materials without restriction, including -# without limitation the rights to use, copy, modify, merge, publish, -# distribute, sublicense, and/or sell copies of the Materials, and to -# permit persons to whom the Materials are furnished to do so, subject to -# the following conditions: -# -# The above copyright notice and this permission notice shall be included -# in all copies or substantial portions of the Materials. -# -# THE MATERIALS ARE PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, -# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF -# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. -# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY -# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, -# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE -# MATERIALS OR THE USE OR OTHER DEALINGS IN THE MATERIALS. - -import io,os,re,string,sys -from lxml import etree - -def write( *args, **kwargs ): - file = kwargs.pop('file',sys.stdout) - end = kwargs.pop( 'end','\n') - file.write( ' '.join([str(arg) for arg in args]) ) - file.write( end ) - -# noneStr - returns string argument, or "" if argument is None. -# Used in converting lxml Elements into text. -# str - string to convert -def noneStr(str): - if (str): - return str - else: - return "" - -# matchAPIProfile - returns whether an API and profile -# being generated matches an element's profile -# api - string naming the API to match -# profile - string naming the profile to match -# elem - Element which (may) have 'api' and 'profile' -# attributes to match to. -# If a tag is not present in the Element, the corresponding API -# or profile always matches. -# Otherwise, the tag must exactly match the API or profile. -# Thus, if 'profile' = core: -# with no attribute will match -# will match -# will not match -# Possible match conditions: -# Requested Element -# Profile Profile -# --------- -------- -# None None Always matches -# 'string' None Always matches -# None 'string' Does not match. Can't generate multiple APIs -# or profiles, so if an API/profile constraint -# is present, it must be asked for explicitly. -# 'string' 'string' Strings must match -# -# ** In the future, we will allow regexes for the attributes, -# not just strings, so that api="^(gl|gles2)" will match. Even -# this isn't really quite enough, we might prefer something -# like "gl(core)|gles1(common-lite)". -def matchAPIProfile(api, profile, elem): - """Match a requested API & profile name to a api & profile attributes of an Element""" - match = True - # Match 'api', if present - if ('api' in elem.attrib): - if (api == None): - raise UserWarning("No API requested, but 'api' attribute is present with value '" + - elem.get('api') + "'") - elif (api != elem.get('api')): - # Requested API doesn't match attribute - return False - if ('profile' in elem.attrib): - if (profile == None): - raise UserWarning("No profile requested, but 'profile' attribute is present with value '" + - elem.get('profile') + "'") - elif (profile != elem.get('profile')): - # Requested profile doesn't match attribute - return False - return True - -# BaseInfo - base class for information about a registry feature -# (type/group/enum/command/API/extension). -# required - should this feature be defined during header generation -# (has it been removed by a profile or version)? -# declared - has this feature been defined already? -# elem - lxml.etree Element for this feature -# resetState() - reset required/declared to initial values. Used -# prior to generating a new API interface. -class BaseInfo: - """Represents the state of a registry feature, used during API generation""" - def __init__(self, elem): - self.required = False - self.declared = False - self.elem = elem - def resetState(self): - self.required = False - self.declared = False - -# TypeInfo - registry information about a type. No additional state -# beyond BaseInfo is required. -class TypeInfo(BaseInfo): - """Represents the state of a registry type""" - def __init__(self, elem): - BaseInfo.__init__(self, elem) - -# GroupInfo - registry information about a group of related enums. -# enums - dictionary of enum names which are in the group -class GroupInfo(BaseInfo): - """Represents the state of a registry enumerant group""" - def __init__(self, elem): - BaseInfo.__init__(self, elem) - self.enums = {} - -# EnumInfo - registry information about an enum -# type - numeric type of the value of the tag -# ( '' for GLint, 'u' for GLuint, 'ull' for GLuint64 ) -class EnumInfo(BaseInfo): - """Represents the state of a registry enum""" - def __init__(self, elem): - BaseInfo.__init__(self, elem) - self.type = elem.get('type') - if (self.type == None): - self.type = '' - -# CmdInfo - registry information about a command -# glxtype - type of GLX protocol { None, 'render', 'single', 'vendor' } -# glxopcode - GLX protocol opcode { None, number } -# glxequiv - equivalent command at GLX dispatch level { None, string } -# vecequiv - equivalent vector form of a command taking multiple scalar args -# { None, string } -class CmdInfo(BaseInfo): - """Represents the state of a registry command""" - def __init__(self, elem): - BaseInfo.__init__(self, elem) - self.glxtype = None - self.glxopcode = None - self.glxequiv = None - self.vecequiv = None - -# FeatureInfo - registry information about an API -# or -# name - feature name string (e.g. 'GL_ARB_multitexture') -# number - feature version number (e.g. 1.2). -# features are unversioned and assigned version number 0. -# category - category, e.g. VERSION or ARB/KHR/OES/ETC/vendor -# emit - has this feature been defined already? -class FeatureInfo(BaseInfo): - """Represents the state of an API feature (version/extension)""" - def __init__(self, elem): - BaseInfo.__init__(self, elem) - self.name = elem.get('name') - # Determine element category (vendor). Only works - # for elements. - if (elem.tag == 'feature'): - self.category = 'VERSION' - self.number = elem.get('number') - else: - self.category = self.name.split('_', 2)[1] - self.number = "0" - self.emit = False - -# Primary sort key for regSortFeatures. -# Sorts by category of the feature name string: -# Core API features (those defined with a tag) -# ARB/KHR/OES (Khronos extensions) -# other (EXT/vendor extensions) -def regSortCategoryKey(feature): - if (feature.elem.tag == 'feature'): - return 0 - elif (feature.category == 'ARB' or - feature.category == 'KHR' or - feature.category == 'OES'): - return 1 - else: - return 2 - -# Secondary sort key for regSortFeatures. -# Sorts by extension name. -def regSortNameKey(feature): - return feature.name - -# Tertiary sort key for regSortFeatures. -# Sorts by feature version number. -# elements all have version number "0" -def regSortNumberKey(feature): - return feature.number - -# regSortFeatures - default sort procedure for features. -# Sorts by primary key of feature category, -# then by feature name within the category, -# then by version number -def regSortFeatures(featureList): - featureList.sort(key = regSortNumberKey) - featureList.sort(key = regSortNameKey) - featureList.sort(key = regSortCategoryKey) - -# GeneratorOptions - base class for options used during header production -# These options are target language independent, and used by -# Registry.apiGen() and by base OutputGenerator objects. -# -# Members -# filename - name of file to generate, or None to write to stdout. -# apiname - string matching 'apiname' attribute, e.g. 'gl'. -# profile - string specifying API profile , e.g. 'core', or None. -# versions - regex matching API versions to process interfaces for. -# Normally '.*' or '[0-9]\.[0-9]' to match all defined versions. -# emitversions - regex matching API versions to actually emit -# interfaces for (though all requested versions are considered -# when deciding which interfaces to generate). For GL 4.3 glext.h, -# this might be '1\.[2-5]|[2-4]\.[0-9]'. -# defaultExtensions - If not None, a string which must in its -# entirety match the pattern in the "supported" attribute of -# the . Defaults to None. Usually the same as apiname. -# addExtensions - regex matching names of additional extensions -# to include. Defaults to None. -# removeExtenions - regex matching names of extensions to -# remove (after defaultExtensions and addExtensions). Defaults -# to None. -# sortProcedure - takes a list of FeatureInfo objects and sorts -# them in place to a preferred order in the generated output. -# Default is core API versions, ARB/KHR/OES extensions, all -# other extensions, alphabetically within each group. -# The regex patterns can be None or empty, in which case they match -# nothing. -class GeneratorOptions: - """Represents options during header production from an API registry""" - def __init__(self, - filename = None, - apiname = None, - profile = None, - versions = '.*', - emitversions = '.*', - defaultExtensions = None, - addExtensions = None, - removeExtensions = None, - sortProcedure = regSortFeatures): - self.filename = filename - self.apiname = apiname - self.profile = profile - self.versions = self.emptyRegex(versions) - self.emitversions = self.emptyRegex(emitversions) - self.defaultExtensions = defaultExtensions - self.addExtensions = self.emptyRegex(addExtensions) - self.removeExtensions = self.emptyRegex(removeExtensions) - self.sortProcedure = sortProcedure - # - # Substitute a regular expression which matches no version - # or extension names for None or the empty string. - def emptyRegex(self,pat): - if (pat == None or pat == ''): - return '_nomatch_^' - else: - return pat - -# CGeneratorOptions - subclass of GeneratorOptions. -# -# Adds options used by COutputGenerator objects during C language header -# generation. -# -# Additional members -# prefixText - list of strings to prefix generated header with -# (usually a copyright statement + calling convention macros). -# protectFile - True if multiple inclusion protection should be -# generated (based on the filename) around the entire header. -# protectFeature - True if #ifndef..#endif protection should be -# generated around a feature interface in the header file. -# genFuncPointers - True if function pointer typedefs should be -# generated -# protectProto - True if #ifdef..#endif protection should be -# generated around prototype declarations -# protectProtoStr - #ifdef symbol to use around prototype -# declarations, if protected -# apicall - string to use for the function declaration prefix, -# such as APICALL on Windows. -# apientry - string to use for the calling convention macro, -# in typedefs, such as APIENTRY. -# apientryp - string to use for the calling convention macro -# in function pointer typedefs, such as APIENTRYP. -class CGeneratorOptions(GeneratorOptions): - """Represents options during C header production from an API registry""" - def __init__(self, - filename = None, - apiname = None, - profile = None, - versions = '.*', - emitversions = '.*', - defaultExtensions = None, - addExtensions = None, - removeExtensions = None, - sortProcedure = regSortFeatures, - prefixText = "", - genFuncPointers = True, - protectFile = True, - protectFeature = True, - protectProto = True, - protectProtoStr = True, - apicall = '', - apientry = '', - apientryp = ''): - GeneratorOptions.__init__(self, filename, apiname, profile, - versions, emitversions, defaultExtensions, - addExtensions, removeExtensions, sortProcedure) - self.prefixText = prefixText - self.genFuncPointers = genFuncPointers - self.protectFile = protectFile - self.protectFeature = protectFeature - self.protectProto = protectProto - self.protectProtoStr = protectProtoStr - self.apicall = apicall - self.apientry = apientry - self.apientryp = apientryp - -# OutputGenerator - base class for generating API interfaces. -# Manages basic logic, logging, and output file control -# Derived classes actually generate formatted output. -# -# ---- methods ---- -# OutputGenerator(errFile, warnFile, diagFile) -# errFile, warnFile, diagFile - file handles to write errors, -# warnings, diagnostics to. May be None to not write. -# logMsg(level, *args) - log messages of different categories -# level - 'error', 'warn', or 'diag'. 'error' will also -# raise a UserWarning exception -# *args - print()-style arguments -# beginFile(genOpts) - start a new interface file -# genOpts - GeneratorOptions controlling what's generated and how -# endFile() - finish an interface file, closing it when done -# beginFeature(interface, emit) - write interface for a feature -# and tag generated features as having been done. -# interface - element for the / to generate -# emit - actually write to the header only when True -# endFeature() - finish an interface. -# genType(typeinfo,name) - generate interface for a type -# typeinfo - TypeInfo for a type -# genEnum(enuminfo, name) - generate interface for an enum -# enuminfo - EnumInfo for an enum -# name - enum name -# genCmd(cmdinfo) - generate interface for a command -# cmdinfo - CmdInfo for a command -class OutputGenerator: - """Generate specified API interfaces in a specific style, such as a C header""" - def __init__(self, - errFile = sys.stderr, - warnFile = sys.stderr, - diagFile = sys.stdout): - self.outFile = None - self.errFile = errFile - self.warnFile = warnFile - self.diagFile = diagFile - # Internal state - self.featureName = None - self.genOpts = None - # - # logMsg - write a message of different categories to different - # destinations. - # level - - # 'diag' (diagnostic, voluminous) - # 'warn' (warning) - # 'error' (fatal error - raises exception after logging) - # *args - print()-style arguments to direct to corresponding log - def logMsg(self, level, *args): - """Log a message at the given level. Can be ignored or log to a file""" - if (level == 'error'): - strfile = io.StringIO() - write('ERROR:', *args, file=strfile) - if (self.errFile != None): - write(strfile.getvalue(), file=self.errFile) - raise UserWarning(strfile.getvalue()) - elif (level == 'warn'): - if (self.warnFile != None): - write('WARNING:', *args, file=self.warnFile) - elif (level == 'diag'): - if (self.diagFile != None): - write('DIAG:', *args, file=self.diagFile) - else: - raise UserWarning( - '*** FATAL ERROR in Generator.logMsg: unknown level:' + level) - # - def beginFile(self, genOpts): - self.genOpts = genOpts - # - # Open specified output file. Not done in constructor since a - # Generator can be used without writing to a file. - if (self.genOpts.filename != None): - self.outFile = open(self.genOpts.filename, 'w') - else: - self.outFile = sys.stdout - def endFile(self): - self.errFile and self.errFile.flush() - self.warnFile and self.warnFile.flush() - self.diagFile and self.diagFile.flush() - self.outFile.flush() - if (self.outFile != sys.stdout and self.outFile != sys.stderr): - self.outFile.close() - self.genOpts = None - # - def beginFeature(self, interface, emit): - self.emit = emit - self.featureName = interface.get('name') - # If there's an additional 'protect' attribute in the feature, save it - self.featureExtraProtect = interface.get('protect') - def endFeature(self): - # Derived classes responsible for emitting feature - self.featureName = None - self.featureExtraProtect = None - # - # Type generation - def genType(self, typeinfo, name): - if (self.featureName == None): - raise UserWarning('Attempt to generate type', name, - 'when not in feature') - # - # Enumerant generation - def genEnum(self, enuminfo, name): - if (self.featureName == None): - raise UserWarning('Attempt to generate enum', name, - 'when not in feature') - # - # Command generation - def genCmd(self, cmd, name): - if (self.featureName == None): - raise UserWarning('Attempt to generate command', name, - 'when not in feature') - -# COutputGenerator - subclass of OutputGenerator. -# Generates C-language API interfaces. -# -# ---- methods ---- -# COutputGenerator(errFile, warnFile, diagFile) - args as for -# OutputGenerator. Defines additional internal state. -# makeCDecls(cmd) - return C prototype and function pointer typedef for a -# Element, as a list of two strings -# cmd - Element for the -# newline() - print a newline to the output file (utility function) -# ---- methods overriding base class ---- -# beginFile(genOpts) -# endFile() -# beginFeature(interface, emit) -# endFeature() -# genType(typeinfo,name) - generate interface for a type -# genEnum(enuminfo, name) -# genCmd(cmdinfo) -class COutputGenerator(OutputGenerator): - """Generate specified API interfaces in a specific style, such as a C header""" - def __init__(self, - errFile = sys.stderr, - warnFile = sys.stderr, - diagFile = sys.stdout): - OutputGenerator.__init__(self, errFile, warnFile, diagFile) - # Internal state - accumulators for different inner block text - self.typeBody = '' - self.enumBody = '' - self.cmdBody = '' - # - # makeCDecls - return C prototype and function pointer typedef for a - # command, as a two-element list of strings. - # cmd - Element containing a tag - def makeCDecls(self, cmd): - """Generate C function pointer typedef for Element""" - proto = cmd.find('proto') - params = cmd.findall('param') - # Begin accumulating prototype and typedef strings - pdecl = self.genOpts.apicall - tdecl = 'typedef ' - # - # Insert the function return type/name. - # For prototypes, add APIENTRY macro before the name - # For typedefs, add (APIENTRYP ) around the name and - # use the PFNGLCMDNAMEPROC nameng convention. - # Done by walking the tree for element by element. - # lxml.etree has elem.text followed by (elem[i], elem[i].tail) - # for each child element and any following text - # Leading text - pdecl += noneStr(proto.text) - tdecl += noneStr(proto.text) - # For each child element, if it's a wrap in appropriate - # declaration. Otherwise append its contents and tail contents. - for elem in proto: - text = noneStr(elem.text) - tail = noneStr(elem.tail) - if (elem.tag == 'name'): - pdecl += self.genOpts.apientry + text + tail - tdecl += '(' + self.genOpts.apientryp + 'PFN' + text.upper() + 'PROC' + tail + ')' - else: - pdecl += text + tail - tdecl += text + tail - # Now add the parameter declaration list, which is identical - # for prototypes and typedefs. Concatenate all the text from - # a node without the tags. No tree walking required - # since all tags are ignored. - n = len(params) - paramdecl = ' (' - if n > 0: - for i in range(0,n): - paramdecl += ''.join([t for t in params[i].itertext()]) - if (i < n - 1): - paramdecl += ', ' - else: - paramdecl += 'void' - paramdecl += ");\n"; - return [ pdecl + paramdecl, tdecl + paramdecl ] - # - def newline(self): - write('', file=self.outFile) - # - def beginFile(self, genOpts): - OutputGenerator.beginFile(self, genOpts) - # C-specific - # - # Multiple inclusion protection & C++ wrappers. - if (genOpts.protectFile and self.genOpts.filename): - headerSym = '__' + re.sub('\.h', '_h_', os.path.basename(self.genOpts.filename)) - write('#ifndef', headerSym, file=self.outFile) - write('#define', headerSym, '1', file=self.outFile) - self.newline() - write('#ifdef __cplusplus', file=self.outFile) - write('extern "C" {', file=self.outFile) - write('#endif', file=self.outFile) - self.newline() - # - # User-supplied prefix text, if any (list of strings) - if (genOpts.prefixText): - for s in genOpts.prefixText: - write(s, file=self.outFile) - # - # Some boilerplate describing what was generated - this - # will probably be removed later since the extensions - # pattern may be very long. - write('/* Generated C header for:', file=self.outFile) - write(' * API:', genOpts.apiname, file=self.outFile) - if (genOpts.profile): - write(' * Profile:', genOpts.profile, file=self.outFile) - write(' * Versions considered:', genOpts.versions, file=self.outFile) - write(' * Versions emitted:', genOpts.emitversions, file=self.outFile) - write(' * Default extensions included:', genOpts.defaultExtensions, file=self.outFile) - write(' * Additional extensions included:', genOpts.addExtensions, file=self.outFile) - write(' * Extensions removed:', genOpts.removeExtensions, file=self.outFile) - write(' */', file=self.outFile) - def endFile(self): - # C-specific - # Finish C++ wrapper and multiple inclusion protection - self.newline() - write('#ifdef __cplusplus', file=self.outFile) - write('}', file=self.outFile) - write('#endif', file=self.outFile) - if (self.genOpts.protectFile and self.genOpts.filename): - self.newline() - write('#endif', file=self.outFile) - # Finish processing in superclass - OutputGenerator.endFile(self) - def beginFeature(self, interface, emit): - # Start processing in superclass - OutputGenerator.beginFeature(self, interface, emit) - # C-specific - # Accumulate types, enums, function pointer typedefs, end function - # prototypes separately for this feature. They're only printed in - # endFeature(). - self.typeBody = '' - self.enumBody = '' - self.cmdPointerBody = '' - self.cmdBody = '' - def endFeature(self): - # C-specific - # Actually write the interface to the output file. - if (self.emit): - self.newline() - if (self.genOpts.protectFeature): - write('#ifndef', self.featureName, file=self.outFile) - write('#define', self.featureName, '1', file=self.outFile) - if (self.typeBody != ''): - write(self.typeBody, end='', file=self.outFile) - # - # Don't add additional protection for derived type declarations, - # which may be needed by other features later on. - if (self.featureExtraProtect != None): - write('#ifdef', self.featureExtraProtect, file=self.outFile) - if (self.enumBody != ''): - write(self.enumBody, end='', file=self.outFile) - if (self.genOpts.genFuncPointers and self.cmdPointerBody != ''): - write(self.cmdPointerBody, end='', file=self.outFile) - if (self.cmdBody != ''): - if (self.genOpts.protectProto): - write('#ifdef', self.genOpts.protectProtoStr, file=self.outFile) - write(self.cmdBody, end='', file=self.outFile) - if (self.genOpts.protectProto): - write('#endif', file=self.outFile) - if (self.featureExtraProtect != None): - write('#endif /*', self.featureExtraProtect, '*/', file=self.outFile) - if (self.genOpts.protectFeature): - write('#endif /*', self.featureName, '*/', file=self.outFile) - # Finish processing in superclass - OutputGenerator.endFeature(self) - # - # Type generation - def genType(self, typeinfo, name): - OutputGenerator.genType(self, typeinfo, name) - # - # Replace tags with an APIENTRY-style string - # (from self.genOpts). Copy other text through unchanged. - # If the resulting text is an empty string, don't emit it. - typeElem = typeinfo.elem - s = noneStr(typeElem.text) - for elem in typeElem: - if (elem.tag == 'apientry'): - s += self.genOpts.apientry + noneStr(elem.tail) - else: - s += noneStr(elem.text) + noneStr(elem.tail) - if (len(s) > 0): - self.typeBody += s + "\n" - # - # Enumerant generation - def genEnum(self, enuminfo, name): - OutputGenerator.genEnum(self, enuminfo, name) - # - # EnumInfo.type is a C value suffix (e.g. u, ull) - self.enumBody += '#define ' + name.ljust(33) + ' ' + enuminfo.elem.get('value') - # - # Handle non-integer 'type' fields by using it as the C value suffix - t = enuminfo.elem.get('type') - if (t != '' and t != 'i'): - self.enumBody += enuminfo.type - self.enumBody += "\n" - # - # Command generation - def genCmd(self, cmdinfo, name): - OutputGenerator.genCmd(self, cmdinfo, name) - # - decls = self.makeCDecls(cmdinfo.elem) - self.cmdBody += decls[0] - if (self.genOpts.genFuncPointers): - self.cmdPointerBody += decls[1] - -# Registry - object representing an API registry, loaded from an XML file -# Members -# tree - ElementTree containing the root -# typedict - dictionary of TypeInfo objects keyed by type name -# groupdict - dictionary of GroupInfo objects keyed by group name -# enumdict - dictionary of EnumInfo objects keyed by enum name -# cmddict - dictionary of CmdInfo objects keyed by command name -# apidict - dictionary of Elements keyed by API name -# extensions - list of Elements -# extdict - dictionary of Elements keyed by extension name -# gen - OutputGenerator object used to write headers / messages -# genOpts - GeneratorOptions object used to control which -# fetures to write and how to format them -# emitFeatures - True to actually emit features for a version / extension, -# or False to just treat them as emitted -# Public methods -# loadElementTree(etree) - load registry from specified ElementTree -# loadFile(filename) - load registry from XML file -# setGenerator(gen) - OutputGenerator to use -# parseTree() - parse the registry once loaded & create dictionaries -# dumpReg(maxlen, filehandle) - diagnostic to dump the dictionaries -# to specified file handle (default stdout). Truncates type / -# enum / command elements to maxlen characters (default 80) -# generator(g) - specify the output generator object -# apiGen(apiname, genOpts) - generate API headers for the API type -# and profile specified in genOpts, but only for the versions and -# extensions specified there. -# apiReset() - call between calls to apiGen() to reset internal state -# validateGroups() - call to verify that each or -# with a 'group' attribute matches an actual existing group. -# Private methods -# addElementInfo(elem,info,infoName,dictionary) - add feature info to dict -# lookupElementInfo(fname,dictionary) - lookup feature info in dict -class Registry: - """Represents an API registry loaded from XML""" - def __init__(self): - self.tree = None - self.typedict = {} - self.groupdict = {} - self.enumdict = {} - self.cmddict = {} - self.apidict = {} - self.extensions = [] - self.extdict = {} - # A default output generator, so commands prior to apiGen can report - # errors via the generator object. - self.gen = OutputGenerator() - self.genOpts = None - self.emitFeatures = False - def loadElementTree(self, tree): - """Load ElementTree into a Registry object and parse it""" - self.tree = tree - self.parseTree() - def loadFile(self, file): - """Load an API registry XML file into a Registry object and parse it""" - self.tree = etree.parse(file) - self.parseTree() - def setGenerator(self, gen): - """Specify output generator object. None restores the default generator""" - self.gen = gen - # addElementInfo - add information about an element to the - # corresponding dictionary - # elem - ///// Element - # info - corresponding {Type|Group|Enum|Cmd|Feature}Info object - # infoName - 'type' / 'group' / 'enum' / 'command' / 'feature' / 'extension' - # dictionary - self.{type|group|enum|cmd|api|ext}dict - # If the Element has an 'api' attribute, the dictionary key is the - # tuple (name,api). If not, the key is the name. 'name' is an - # attribute of the Element - def addElementInfo(self, elem, info, infoName, dictionary): - if ('api' in elem.attrib): - key = (elem.get('name'),elem.get('api')) - else: - key = elem.get('name') - if key in dictionary: - self.gen.logMsg('warn', '*** Attempt to redefine', - infoName, 'with key:', key) - else: - dictionary[key] = info - # - # lookupElementInfo - find a {Type|Enum|Cmd}Info object by name. - # If an object qualified by API name exists, use that. - # fname - name of type / enum / command - # dictionary - self.{type|enum|cmd}dict - def lookupElementInfo(self, fname, dictionary): - key = (fname, self.genOpts.apiname) - if (key in dictionary): - # self.gen.logMsg('diag', 'Found API-specific element for feature', fname) - return dictionary[key] - elif (fname in dictionary): - # self.gen.logMsg('diag', 'Found generic element for feature', fname) - return dictionary[fname] - else: - return None - def parseTree(self): - """Parse the registry Element, once created""" - # This must be the Element for the root - self.reg = self.tree.getroot() - # - # Create dictionary of registry types from toplevel tags - # and add 'name' attribute to each tag (where missing) - # based on its element. - # - # There's usually one block; more are OK - # Required attributes: 'name' or nested tag contents - self.typedict = {} - for type in self.reg.findall('types/type'): - # If the doesn't already have a 'name' attribute, set - # it from contents of its tag. - if (type.get('name') == None): - type.attrib['name'] = type.find('name').text - self.addElementInfo(type, TypeInfo(type), 'type', self.typedict) - # - # Create dictionary of registry groups from toplevel tags. - # - # There's usually one block; more are OK. - # Required attributes: 'name' - self.groupdict = {} - for group in self.reg.findall('groups/group'): - self.addElementInfo(group, GroupInfo(group), 'group', self.groupdict) - # - # Create dictionary of registry enums from toplevel tags - # - # There are usually many tags in different namespaces, but - # these are functional namespaces of the values, while the actual - # enum names all share the dictionary. - # Required attributes: 'name', 'value' - self.enumdict = {} - for enum in self.reg.findall('enums/enum'): - self.addElementInfo(enum, EnumInfo(enum), 'enum', self.enumdict) - # - # Create dictionary of registry commands from tags - # and add 'name' attribute to each tag (where missing) - # based on its element. - # - # There's usually only one block; more are OK. - # Required attributes: 'name' or tag contents - self.cmddict = {} - for cmd in self.reg.findall('commands/command'): - # If the doesn't already have a 'name' attribute, set - # it from contents of its tag. - if (cmd.get('name') == None): - cmd.attrib['name'] = cmd.find('proto/name').text - ci = CmdInfo(cmd) - self.addElementInfo(cmd, ci, 'command', self.cmddict) - # - # Create dictionaries of API and extension interfaces - # from toplevel and tags. - # - self.apidict = {} - for feature in self.reg.findall('feature'): - ai = FeatureInfo(feature) - self.addElementInfo(feature, ai, 'feature', self.apidict) - self.extensions = self.reg.findall('extensions/extension') - self.extdict = {} - for feature in self.extensions: - ei = FeatureInfo(feature) - self.addElementInfo(feature, ei, 'extension', self.extdict) - def dumpReg(self, maxlen = 40, filehandle = sys.stdout): - """Dump all the dictionaries constructed from the Registry object""" - write('***************************************', file=filehandle) - write(' ** Dumping Registry contents **', file=filehandle) - write('***************************************', file=filehandle) - write('// Types', file=filehandle) - for name in self.typedict: - tobj = self.typedict[name] - write(' Type', name, '->', etree.tostring(tobj.elem)[0:maxlen], file=filehandle) - write('// Groups', file=filehandle) - for name in self.groupdict: - gobj = self.groupdict[name] - write(' Group', name, '->', etree.tostring(gobj.elem)[0:maxlen], file=filehandle) - write('// Enums', file=filehandle) - for name in self.enumdict: - eobj = self.enumdict[name] - write(' Enum', name, '->', etree.tostring(eobj.elem)[0:maxlen], file=filehandle) - write('// Commands', file=filehandle) - for name in self.cmddict: - cobj = self.cmddict[name] - write(' Command', name, '->', etree.tostring(cobj.elem)[0:maxlen], file=filehandle) - write('// APIs', file=filehandle) - for key in self.apidict: - write(' API Version ', key, '->', - etree.tostring(self.apidict[key].elem)[0:maxlen], file=filehandle) - write('// Extensions', file=filehandle) - for key in self.extdict: - write(' Extension', key, '->', - etree.tostring(self.extdict[key].elem)[0:maxlen], file=filehandle) - # write('***************************************', file=filehandle) - # write(' ** Dumping XML ElementTree **', file=filehandle) - # write('***************************************', file=filehandle) - # write(etree.tostring(self.tree.getroot(),pretty_print=True), file=filehandle) - # - # typename - name of type - # required - boolean (to tag features as required or not) - def markTypeRequired(self, typename, required): - """Require (along with its dependencies) or remove (but not its dependencies) a type""" - self.gen.logMsg('diag', '*** tagging type:', typename, '-> required =', required) - # Get TypeInfo object for tag corresponding to typename - type = self.lookupElementInfo(typename, self.typedict) - if (type != None): - # Tag required type dependencies as required. - # This DOES NOT un-tag dependencies in a tag. - # See comments in markRequired() below for the reason. - if (required and ('requires' in type.elem.attrib)): - depType = type.elem.get('requires') - self.gen.logMsg('diag', '*** Generating dependent type', - depType, 'for type', typename) - self.markTypeRequired(depType, required) - type.required = required - else: - self.gen.logMsg('warn', '*** type:', typename , 'IS NOT DEFINED') - # - # features - Element for or tag - # required - boolean (to tag features as required or not) - def markRequired(self, features, required): - """Require or remove features specified in the Element""" - self.gen.logMsg('diag', '*** markRequired (features = , required =', required, ')') - # Loop over types, enums, and commands in the tag - # @@ It would be possible to respect 'api' and 'profile' attributes - # in individual features, but that's not done yet. - for typeElem in features.findall('type'): - self.markTypeRequired(typeElem.get('name'), required) - for enumElem in features.findall('enum'): - name = enumElem.get('name') - self.gen.logMsg('diag', '*** tagging enum:', name, '-> required =', required) - enum = self.lookupElementInfo(name, self.enumdict) - if (enum != None): - enum.required = required - else: - self.gen.logMsg('warn', '*** enum:', name , 'IS NOT DEFINED') - for cmdElem in features.findall('command'): - name = cmdElem.get('name') - self.gen.logMsg('diag', '*** tagging command:', name, '-> required =', required) - cmd = self.lookupElementInfo(name, self.cmddict) - if (cmd != None): - cmd.required = required - # Tag all parameter types of this command as required. - # This DOES NOT remove types of commands in a - # tag, because many other commands may use the same type. - # We could be more clever and reference count types, - # instead of using a boolean. - if (required): - # Look for in entire tree, - # not just immediate children - for ptype in cmd.elem.findall('.//ptype'): - self.gen.logMsg('diag', '*** markRequired: command implicitly requires dependent type', ptype.text) - self.markTypeRequired(ptype.text, required) - else: - self.gen.logMsg('warn', '*** command:', name, 'IS NOT DEFINED') - # - # interface - Element for or , containing - # and tags - # api - string specifying API name being generated - # profile - string specifying API profile being generated - def requireAndRemoveFeatures(self, interface, api, profile): - """Process and tags for a or """ - # marks things that are required by this version/profile - for feature in interface.findall('require'): - if (matchAPIProfile(api, profile, feature)): - self.markRequired(feature,True) - # marks things that are removed by this version/profile - for feature in interface.findall('remove'): - if (matchAPIProfile(api, profile, feature)): - self.markRequired(feature,False) - # - # generateFeature - generate a single type / enum / command, - # and all its dependencies as needed. - # fname - name of feature (// - # ftype - type of feature, 'type' | 'enum' | 'command' - # dictionary - of *Info objects - self.{type|enum|cmd}dict - # genProc - bound function pointer for self.gen.gen{Type|Enum|Cmd} - def generateFeature(self, fname, ftype, dictionary, genProc): - f = self.lookupElementInfo(fname, dictionary) - if (f == None): - # No such feature. This is an error, but reported earlier - self.gen.logMsg('diag', '*** No entry found for feature', fname, - 'returning!') - return - # - # If feature isn't required, or has already been declared, return - if (not f.required): - self.gen.logMsg('diag', '*** Skipping', ftype, fname, '(not required)') - return - if (f.declared): - self.gen.logMsg('diag', '*** Skipping', ftype, fname, '(already declared)') - return - # - # Pull in dependent type declaration(s) of the feature. - # For types, there may be one in the 'required' attribute of the element - # For commands, there may be many in tags within the element - # For enums, no dependencies are allowed (though perhasps if you - # have a uint64 enum, it should require GLuint64) - if (ftype == 'type'): - if ('requires' in f.elem.attrib): - depname = f.elem.get('requires') - self.gen.logMsg('diag', '*** Generating required dependent type', - depname) - self.generateFeature(depname, 'type', self.typedict, - self.gen.genType) - elif (ftype == 'command'): - for ptype in f.elem.findall('.//ptype'): - depname = ptype.text - self.gen.logMsg('diag', '*** Generating required parameter type', - depname) - self.generateFeature(depname, 'type', self.typedict, - self.gen.genType) - # - # Actually generate the type only if emitting declarations - if self.emitFeatures: - self.gen.logMsg('diag', '*** Emitting', ftype, 'decl for', fname) - genProc(f, fname) - else: - self.gen.logMsg('diag', '*** Skipping', ftype, fname, - '(not emitting this feature)') - # Always mark feature declared, as though actually emitted - f.declared = True - # - # generateRequiredInterface - generate all interfaces required - # by an API version or extension - # interface - Element for or - def generateRequiredInterface(self, interface): - """Generate required C interface for specified API version/extension""" - # - # Loop over all features inside all tags. - # tags are ignored (handled in pass 1). - for features in interface.findall('require'): - for t in features.findall('type'): - self.generateFeature(t.get('name'), 'type', self.typedict, - self.gen.genType) - for e in features.findall('enum'): - self.generateFeature(e.get('name'), 'enum', self.enumdict, - self.gen.genEnum) - for c in features.findall('command'): - self.generateFeature(c.get('name'), 'command', self.cmddict, - self.gen.genCmd) - # - # apiGen(genOpts) - generate interface for specified versions - # genOpts - GeneratorOptions object with parameters used - # by the Generator object. - def apiGen(self, genOpts): - """Generate interfaces for the specified API type and range of versions""" - # - self.gen.logMsg('diag', '*******************************************') - self.gen.logMsg('diag', ' Registry.apiGen file:', genOpts.filename, - 'api:', genOpts.apiname, - 'profile:', genOpts.profile) - self.gen.logMsg('diag', '*******************************************') - # - self.genOpts = genOpts - # Reset required/declared flags for all features - self.apiReset() - # - # Compile regexps used to select versions & extensions - regVersions = re.compile(self.genOpts.versions) - regEmitVersions = re.compile(self.genOpts.emitversions) - regAddExtensions = re.compile(self.genOpts.addExtensions) - regRemoveExtensions = re.compile(self.genOpts.removeExtensions) - # - # Get all matching API versions & add to list of FeatureInfo - features = [] - apiMatch = False - for key in self.apidict: - fi = self.apidict[key] - api = fi.elem.get('api') - if (api == self.genOpts.apiname): - apiMatch = True - if (regVersions.match(fi.number)): - # Matches API & version #s being generated. Mark for - # emission and add to the features[] list . - # @@ Could use 'declared' instead of 'emit'? - fi.emit = (regEmitVersions.match(fi.number) != None) - features.append(fi) - if (not fi.emit): - self.gen.logMsg('diag', '*** NOT tagging feature api =', api, - 'name =', fi.name, 'number =', fi.number, - 'for emission (does not match emitversions pattern)') - else: - self.gen.logMsg('diag', '*** NOT including feature api =', api, - 'name =', fi.name, 'number =', fi.number, - '(does not match requested versions)') - else: - self.gen.logMsg('diag', '*** NOT including feature api =', api, - 'name =', fi.name, - '(does not match requested API)') - if (not apiMatch): - self.gen.logMsg('warn', '*** No matching API versions found!') - # - # Get all matching extensions & add to the list. - # Start with extensions tagged with 'api' pattern matching the API - # being generated. Add extensions matching the pattern specified in - # regExtensions, then remove extensions matching the pattern - # specified in regRemoveExtensions - for key in self.extdict: - ei = self.extdict[key] - extName = ei.name - include = False - # - # Include extension if defaultExtensions is not None and if the - # 'supported' attribute matches defaultExtensions. The regexp in - # 'supported' must exactly match defaultExtensions, so bracket - # it with ^(pat)$. - pat = '^(' + ei.elem.get('supported') + ')$' - if (self.genOpts.defaultExtensions and - re.match(pat, self.genOpts.defaultExtensions)): - self.gen.logMsg('diag', '*** Including extension', - extName, "(defaultExtensions matches the 'supported' attribute)") - include = True - # - # Include additional extensions if the extension name matches - # the regexp specified in the generator options. This allows - # forcing extensions into an interface even if they're not - # tagged appropriately in the registry. - if (regAddExtensions.match(extName) != None): - self.gen.logMsg('diag', '*** Including extension', - extName, '(matches explicitly requested extensions to add)') - include = True - # Remove extensions if the name matches the regexp specified - # in generator options. This allows forcing removal of - # extensions from an interface even if they're tagged that - # way in the registry. - if (regRemoveExtensions.match(extName) != None): - self.gen.logMsg('diag', '*** Removing extension', - extName, '(matches explicitly requested extensions to remove)') - include = False - # - # If the extension is to be included, add it to the - # extension features list. - if (include): - ei.emit = True - features.append(ei) - else: - self.gen.logMsg('diag', '*** NOT including extension', - extName, '(does not match api attribute or explicitly requested extensions)') - # - # Sort the extension features list, if a sort procedure is defined - if (self.genOpts.sortProcedure): - self.genOpts.sortProcedure(features) - # - # Pass 1: loop over requested API versions and extensions tagging - # types/commands/features as required (in an block) or no - # longer required (in an block). It is possible to remove - # a feature in one version and restore it later by requiring it in - # a later version. - # If a profile other than 'None' is being generated, it must - # match the profile attribute (if any) of the and - # tags. - self.gen.logMsg('diag', '*** PASS 1: TAG FEATURES ********************************************') - for f in features: - self.gen.logMsg('diag', '*** PASS 1: Tagging required and removed features for', - f.name) - self.requireAndRemoveFeatures(f.elem, self.genOpts.apiname, self.genOpts.profile) - # - # Pass 2: loop over specified API versions and extensions printing - # declarations for required things which haven't already been - # generated. - self.gen.logMsg('diag', '*** PASS 2: GENERATE INTERFACES FOR FEATURES ************************') - self.gen.beginFile(self.genOpts) - for f in features: - self.gen.logMsg('diag', '*** PASS 2: Generating interface for', - f.name) - emit = self.emitFeatures = f.emit - if (not emit): - self.gen.logMsg('diag', '*** PASS 2: NOT declaring feature', - f.elem.get('name'), 'because it is not tagged for emission') - # Generate the interface (or just tag its elements as having been - # emitted, if they haven't been). - self.gen.beginFeature(f.elem, emit) - self.generateRequiredInterface(f.elem) - self.gen.endFeature() - self.gen.endFile() - # - # apiReset - use between apiGen() calls to reset internal state - # - def apiReset(self): - """Reset type/enum/command dictionaries before generating another API""" - for type in self.typedict: - self.typedict[type].resetState() - for enum in self.enumdict: - self.enumdict[enum].resetState() - for cmd in self.cmddict: - self.cmddict[cmd].resetState() - for cmd in self.apidict: - self.apidict[cmd].resetState() - # - # validateGroups - check that group= attributes match actual groups - # - def validateGroups(self): - """Validate group= attributes on and tags""" - # Keep track of group names not in tags - badGroup = {} - self.gen.logMsg('diag', '*** VALIDATING GROUP ATTRIBUTES ***') - for cmd in self.reg.findall('commands/command'): - proto = cmd.find('proto') - funcname = cmd.find('proto/name').text - if ('group' in proto.attrib.keys()): - group = proto.get('group') - # self.gen.logMsg('diag', '*** Command ', funcname, ' has return group ', group) - if (group not in self.groupdict.keys()): - # self.gen.logMsg('diag', '*** Command ', funcname, ' has UNKNOWN return group ', group) - if (group not in badGroup.keys()): - badGroup[group] = 1 - else: - badGroup[group] = badGroup[group] + 1 - for param in cmd.findall('param'): - pname = param.find('name') - if (pname != None): - pname = pname.text - else: - pname = type.get('name') - if ('group' in param.attrib.keys()): - group = param.get('group') - if (group not in self.groupdict.keys()): - # self.gen.logMsg('diag', '*** Command ', funcname, ' param ', pname, ' has UNKNOWN group ', group) - if (group not in badGroup.keys()): - badGroup[group] = 1 - else: - badGroup[group] = badGroup[group] + 1 - if (len(badGroup.keys()) > 0): - self.gen.logMsg('diag', '*** SUMMARY OF UNRECOGNIZED GROUPS ***') - for key in sorted(badGroup.keys()): - self.gen.logMsg('diag', ' ', key, ' occurred ', badGroup[key], ' times') diff -Nru android-platform-frameworks-native-6.0.1+r16/services/batteryservice/Android.mk android-platform-frameworks-native-21/services/batteryservice/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/batteryservice/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/batteryservice/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,20 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - BatteryProperties.cpp \ - BatteryProperty.cpp \ - IBatteryPropertiesListener.cpp \ - IBatteryPropertiesRegistrar.cpp - -LOCAL_STATIC_LIBRARIES := \ - libutils \ - libbinder - -LOCAL_MODULE:= libbatteryservice - -LOCAL_MODULE_TAGS := optional - -LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code - -include $(BUILD_STATIC_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/batteryservice/BatteryProperties.cpp android-platform-frameworks-native-21/services/batteryservice/BatteryProperties.cpp --- android-platform-frameworks-native-6.0.1+r16/services/batteryservice/BatteryProperties.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/batteryservice/BatteryProperties.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include -#include -#include -#include -#include -#include - -namespace android { - -/* - * Parcel read/write code must be kept in sync with - * frameworks/base/core/java/android/os/BatteryProperties.java - */ - -status_t BatteryProperties::readFromParcel(Parcel* p) { - chargerAcOnline = p->readInt32() == 1 ? true : false; - chargerUsbOnline = p->readInt32() == 1 ? true : false; - chargerWirelessOnline = p->readInt32() == 1 ? true : false; - maxChargingCurrent = p->readInt32(); - batteryStatus = p->readInt32(); - batteryHealth = p->readInt32(); - batteryPresent = p->readInt32() == 1 ? true : false; - batteryLevel = p->readInt32(); - batteryVoltage = p->readInt32(); - batteryTemperature = p->readInt32(); - batteryTechnology = String8((p->readString16()).string()); - return OK; -} - -status_t BatteryProperties::writeToParcel(Parcel* p) const { - p->writeInt32(chargerAcOnline ? 1 : 0); - p->writeInt32(chargerUsbOnline ? 1 : 0); - p->writeInt32(chargerWirelessOnline ? 1 : 0); - p->writeInt32(maxChargingCurrent); - p->writeInt32(batteryStatus); - p->writeInt32(batteryHealth); - p->writeInt32(batteryPresent ? 1 : 0); - p->writeInt32(batteryLevel); - p->writeInt32(batteryVoltage); - p->writeInt32(batteryTemperature); - p->writeString16(String16(batteryTechnology)); - return OK; -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/batteryservice/BatteryProperty.cpp android-platform-frameworks-native-21/services/batteryservice/BatteryProperty.cpp --- android-platform-frameworks-native-6.0.1+r16/services/batteryservice/BatteryProperty.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/batteryservice/BatteryProperty.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include -#include -#include -#include - -namespace android { - -/* - * Parcel read/write code must be kept in sync with - * frameworks/base/core/java/android/os/BatteryProperty.java - */ - -status_t BatteryProperty::readFromParcel(Parcel* p) { - valueInt64 = p->readInt64(); - return OK; -} - -status_t BatteryProperty::writeToParcel(Parcel* p) const { - p->writeInt64(valueInt64); - return OK; -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/batteryservice/IBatteryPropertiesListener.cpp android-platform-frameworks-native-21/services/batteryservice/IBatteryPropertiesListener.cpp --- android-platform-frameworks-native-6.0.1+r16/services/batteryservice/IBatteryPropertiesListener.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/batteryservice/IBatteryPropertiesListener.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,46 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include -#include -#include - -namespace android { - -class BpBatteryPropertiesListener : public BpInterface -{ -public: - BpBatteryPropertiesListener(const sp& impl) - : BpInterface(impl) - { - } - - void batteryPropertiesChanged(struct BatteryProperties props) - { - Parcel data, reply; - data.writeInterfaceToken(IBatteryPropertiesListener::getInterfaceDescriptor()); - data.writeInt32(1); - props.writeToParcel(&data); - remote()->transact(TRANSACT_BATTERYPROPERTIESCHANGED, data, &reply, IBinder::FLAG_ONEWAY); - } -}; - -IMPLEMENT_META_INTERFACE(BatteryPropertiesListener, "android.os.IBatteryPropertiesListener"); - -// ---------------------------------------------------------------------------- - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/batteryservice/IBatteryPropertiesRegistrar.cpp android-platform-frameworks-native-21/services/batteryservice/IBatteryPropertiesRegistrar.cpp --- android-platform-frameworks-native-6.0.1+r16/services/batteryservice/IBatteryPropertiesRegistrar.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/batteryservice/IBatteryPropertiesRegistrar.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,106 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define LOG_TAG "IBatteryPropertiesRegistrar" -//#define LOG_NDEBUG 0 -#include - -#include -#include -#include -#include -#include - -namespace android { - -class BpBatteryPropertiesRegistrar : public BpInterface { -public: - BpBatteryPropertiesRegistrar(const sp& impl) - : BpInterface(impl) {} - - void registerListener(const sp& listener) { - Parcel data; - data.writeInterfaceToken(IBatteryPropertiesRegistrar::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(listener)); - remote()->transact(REGISTER_LISTENER, data, NULL); - } - - void unregisterListener(const sp& listener) { - Parcel data; - data.writeInterfaceToken(IBatteryPropertiesRegistrar::getInterfaceDescriptor()); - data.writeStrongBinder(IInterface::asBinder(listener)); - remote()->transact(UNREGISTER_LISTENER, data, NULL); - } - - status_t getProperty(int id, struct BatteryProperty *val) { - Parcel data, reply; - data.writeInterfaceToken(IBatteryPropertiesRegistrar::getInterfaceDescriptor()); - data.writeInt32(id); - remote()->transact(GET_PROPERTY, data, &reply); - int32_t ret = reply.readExceptionCode(); - if (ret != 0) { - return ret; - } - ret = reply.readInt32(); - int parcelpresent = reply.readInt32(); - if (parcelpresent) - val->readFromParcel(&reply); - return ret; - } -}; - -IMPLEMENT_META_INTERFACE(BatteryPropertiesRegistrar, "android.os.IBatteryPropertiesRegistrar"); - -status_t BnBatteryPropertiesRegistrar::onTransact(uint32_t code, - const Parcel& data, - Parcel* reply, - uint32_t flags) -{ - switch(code) { - case REGISTER_LISTENER: { - CHECK_INTERFACE(IBatteryPropertiesRegistrar, data, reply); - sp listener = - interface_cast(data.readStrongBinder()); - registerListener(listener); - return OK; - } - - case UNREGISTER_LISTENER: { - CHECK_INTERFACE(IBatteryPropertiesRegistrar, data, reply); - sp listener = - interface_cast(data.readStrongBinder()); - unregisterListener(listener); - return OK; - } - - case GET_PROPERTY: { - CHECK_INTERFACE(IBatteryPropertiesRegistrar, data, reply); - int id = data.readInt32(); - struct BatteryProperty val; - status_t result = getProperty(id, &val); - reply->writeNoException(); - reply->writeInt32(result); - reply->writeInt32(1); - val.writeToParcel(reply); - return OK; - } - } - return BBinder::onTransact(code, data, reply, flags); -}; - -// ---------------------------------------------------------------------------- - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/Android.mk android-platform-frameworks-native-21/services/inputflinger/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,49 +0,0 @@ -# Copyright (C) 2013 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - EventHub.cpp \ - InputApplication.cpp \ - InputDispatcher.cpp \ - InputListener.cpp \ - InputManager.cpp \ - InputReader.cpp \ - InputWindow.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libcrypto \ - libcutils \ - libinput \ - liblog \ - libutils \ - libui \ - libhardware_legacy - - -# TODO: Move inputflinger to its own process and mark it hidden -#LOCAL_CFLAGS += -fvisibility=hidden - -LOCAL_CFLAGS += -Wno-unused-parameter - -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_MODULE := libinputflinger - -include $(BUILD_SHARED_LIBRARY) - -include $(call all-makefiles-under,$(LOCAL_PATH)) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/EventHub.cpp android-platform-frameworks-native-21/services/inputflinger/EventHub.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/EventHub.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/EventHub.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1712 +0,0 @@ -/* - * Copyright (C) 2005 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 -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#define LOG_TAG "EventHub" - -// #define LOG_NDEBUG 0 - -#include "EventHub.h" - -#include - -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -/* this macro is used to tell if "bit" is set in "array" - * it selects a byte from the array, and does a boolean AND - * operation with a byte that only has the relevant bit set. - * eg. to check for the 12th bit, we do (array[1] & 1<<4) - */ -#define test_bit(bit, array) (array[bit/8] & (1<<(bit%8))) - -/* this macro computes the number of bytes needed to represent a bit array of the specified size */ -#define sizeof_bit_array(bits) ((bits + 7) / 8) - -#define INDENT " " -#define INDENT2 " " -#define INDENT3 " " - -namespace android { - -static const char *WAKE_LOCK_ID = "KeyEvents"; -static const char *DEVICE_PATH = "/dev/input"; - -/* return the larger integer */ -static inline int max(int v1, int v2) -{ - return (v1 > v2) ? v1 : v2; -} - -static inline const char* toString(bool value) { - return value ? "true" : "false"; -} - -static String8 sha1(const String8& in) { - SHA_CTX ctx; - SHA1_Init(&ctx); - SHA1_Update(&ctx, reinterpret_cast(in.string()), in.size()); - u_char digest[SHA_DIGEST_LENGTH]; - SHA1_Final(digest, &ctx); - - String8 out; - for (size_t i = 0; i < SHA_DIGEST_LENGTH; i++) { - out.appendFormat("%02x", digest[i]); - } - return out; -} - -static void getLinuxRelease(int* major, int* minor) { - struct utsname info; - if (uname(&info) || sscanf(info.release, "%d.%d", major, minor) <= 0) { - *major = 0, *minor = 0; - ALOGE("Could not get linux version: %s", strerror(errno)); - } -} - -// --- Global Functions --- - -uint32_t getAbsAxisUsage(int32_t axis, uint32_t deviceClasses) { - // Touch devices get dibs on touch-related axes. - if (deviceClasses & INPUT_DEVICE_CLASS_TOUCH) { - switch (axis) { - case ABS_X: - case ABS_Y: - case ABS_PRESSURE: - case ABS_TOOL_WIDTH: - case ABS_DISTANCE: - case ABS_TILT_X: - case ABS_TILT_Y: - case ABS_MT_SLOT: - case ABS_MT_TOUCH_MAJOR: - case ABS_MT_TOUCH_MINOR: - case ABS_MT_WIDTH_MAJOR: - case ABS_MT_WIDTH_MINOR: - case ABS_MT_ORIENTATION: - case ABS_MT_POSITION_X: - case ABS_MT_POSITION_Y: - case ABS_MT_TOOL_TYPE: - case ABS_MT_BLOB_ID: - case ABS_MT_TRACKING_ID: - case ABS_MT_PRESSURE: - case ABS_MT_DISTANCE: - return INPUT_DEVICE_CLASS_TOUCH; - } - } - - // External stylus gets the pressure axis - if (deviceClasses & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) { - if (axis == ABS_PRESSURE) { - return INPUT_DEVICE_CLASS_EXTERNAL_STYLUS; - } - } - - // Joystick devices get the rest. - return deviceClasses & INPUT_DEVICE_CLASS_JOYSTICK; -} - -// --- EventHub::Device --- - -EventHub::Device::Device(int fd, int32_t id, const String8& path, - const InputDeviceIdentifier& identifier) : - next(NULL), - fd(fd), id(id), path(path), identifier(identifier), - classes(0), configuration(NULL), virtualKeyMap(NULL), - ffEffectPlaying(false), ffEffectId(-1), controllerNumber(0), - timestampOverrideSec(0), timestampOverrideUsec(0) { - memset(keyBitmask, 0, sizeof(keyBitmask)); - memset(absBitmask, 0, sizeof(absBitmask)); - memset(relBitmask, 0, sizeof(relBitmask)); - memset(swBitmask, 0, sizeof(swBitmask)); - memset(ledBitmask, 0, sizeof(ledBitmask)); - memset(ffBitmask, 0, sizeof(ffBitmask)); - memset(propBitmask, 0, sizeof(propBitmask)); -} - -EventHub::Device::~Device() { - close(); - delete configuration; - delete virtualKeyMap; -} - -void EventHub::Device::close() { - if (fd >= 0) { - ::close(fd); - fd = -1; - } -} - - -// --- EventHub --- - -const uint32_t EventHub::EPOLL_ID_INOTIFY; -const uint32_t EventHub::EPOLL_ID_WAKE; -const int EventHub::EPOLL_SIZE_HINT; -const int EventHub::EPOLL_MAX_EVENTS; - -EventHub::EventHub(void) : - mBuiltInKeyboardId(NO_BUILT_IN_KEYBOARD), mNextDeviceId(1), mControllerNumbers(), - mOpeningDevices(0), mClosingDevices(0), - mNeedToSendFinishedDeviceScan(false), - mNeedToReopenDevices(false), mNeedToScanDevices(true), - mPendingEventCount(0), mPendingEventIndex(0), mPendingINotify(false) { - acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID); - - mEpollFd = epoll_create(EPOLL_SIZE_HINT); - LOG_ALWAYS_FATAL_IF(mEpollFd < 0, "Could not create epoll instance. errno=%d", errno); - - mINotifyFd = inotify_init(); - int result = inotify_add_watch(mINotifyFd, DEVICE_PATH, IN_DELETE | IN_CREATE); - LOG_ALWAYS_FATAL_IF(result < 0, "Could not register INotify for %s. errno=%d", - DEVICE_PATH, errno); - - struct epoll_event eventItem; - memset(&eventItem, 0, sizeof(eventItem)); - eventItem.events = EPOLLIN; - eventItem.data.u32 = EPOLL_ID_INOTIFY; - result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mINotifyFd, &eventItem); - LOG_ALWAYS_FATAL_IF(result != 0, "Could not add INotify to epoll instance. errno=%d", errno); - - int wakeFds[2]; - result = pipe(wakeFds); - LOG_ALWAYS_FATAL_IF(result != 0, "Could not create wake pipe. errno=%d", errno); - - mWakeReadPipeFd = wakeFds[0]; - mWakeWritePipeFd = wakeFds[1]; - - result = fcntl(mWakeReadPipeFd, F_SETFL, O_NONBLOCK); - LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake read pipe non-blocking. errno=%d", - errno); - - result = fcntl(mWakeWritePipeFd, F_SETFL, O_NONBLOCK); - LOG_ALWAYS_FATAL_IF(result != 0, "Could not make wake write pipe non-blocking. errno=%d", - errno); - - eventItem.data.u32 = EPOLL_ID_WAKE; - result = epoll_ctl(mEpollFd, EPOLL_CTL_ADD, mWakeReadPipeFd, &eventItem); - LOG_ALWAYS_FATAL_IF(result != 0, "Could not add wake read pipe to epoll instance. errno=%d", - errno); - - int major, minor; - getLinuxRelease(&major, &minor); - // EPOLLWAKEUP was introduced in kernel 3.5 - mUsingEpollWakeup = major > 3 || (major == 3 && minor >= 5); -} - -EventHub::~EventHub(void) { - closeAllDevicesLocked(); - - while (mClosingDevices) { - Device* device = mClosingDevices; - mClosingDevices = device->next; - delete device; - } - - ::close(mEpollFd); - ::close(mINotifyFd); - ::close(mWakeReadPipeFd); - ::close(mWakeWritePipeFd); - - release_wake_lock(WAKE_LOCK_ID); -} - -InputDeviceIdentifier EventHub::getDeviceIdentifier(int32_t deviceId) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device == NULL) return InputDeviceIdentifier(); - return device->identifier; -} - -uint32_t EventHub::getDeviceClasses(int32_t deviceId) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device == NULL) return 0; - return device->classes; -} - -int32_t EventHub::getDeviceControllerNumber(int32_t deviceId) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device == NULL) return 0; - return device->controllerNumber; -} - -void EventHub::getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device && device->configuration) { - *outConfiguration = *device->configuration; - } else { - outConfiguration->clear(); - } -} - -status_t EventHub::getAbsoluteAxisInfo(int32_t deviceId, int axis, - RawAbsoluteAxisInfo* outAxisInfo) const { - outAxisInfo->clear(); - - if (axis >= 0 && axis <= ABS_MAX) { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual() && test_bit(axis, device->absBitmask)) { - struct input_absinfo info; - if(ioctl(device->fd, EVIOCGABS(axis), &info)) { - ALOGW("Error reading absolute controller %d for device %s fd %d, errno=%d", - axis, device->identifier.name.string(), device->fd, errno); - return -errno; - } - - if (info.minimum != info.maximum) { - outAxisInfo->valid = true; - outAxisInfo->minValue = info.minimum; - outAxisInfo->maxValue = info.maximum; - outAxisInfo->flat = info.flat; - outAxisInfo->fuzz = info.fuzz; - outAxisInfo->resolution = info.resolution; - } - return OK; - } - } - return -1; -} - -bool EventHub::hasRelativeAxis(int32_t deviceId, int axis) const { - if (axis >= 0 && axis <= REL_MAX) { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device) { - return test_bit(axis, device->relBitmask); - } - } - return false; -} - -bool EventHub::hasInputProperty(int32_t deviceId, int property) const { - if (property >= 0 && property <= INPUT_PROP_MAX) { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device) { - return test_bit(property, device->propBitmask); - } - } - return false; -} - -int32_t EventHub::getScanCodeState(int32_t deviceId, int32_t scanCode) const { - if (scanCode >= 0 && scanCode <= KEY_MAX) { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual() && test_bit(scanCode, device->keyBitmask)) { - uint8_t keyState[sizeof_bit_array(KEY_MAX + 1)]; - memset(keyState, 0, sizeof(keyState)); - if (ioctl(device->fd, EVIOCGKEY(sizeof(keyState)), keyState) >= 0) { - return test_bit(scanCode, keyState) ? AKEY_STATE_DOWN : AKEY_STATE_UP; - } - } - } - return AKEY_STATE_UNKNOWN; -} - -int32_t EventHub::getKeyCodeState(int32_t deviceId, int32_t keyCode) const { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual() && device->keyMap.haveKeyLayout()) { - Vector scanCodes; - device->keyMap.keyLayoutMap->findScanCodesForKey(keyCode, &scanCodes); - if (scanCodes.size() != 0) { - uint8_t keyState[sizeof_bit_array(KEY_MAX + 1)]; - memset(keyState, 0, sizeof(keyState)); - if (ioctl(device->fd, EVIOCGKEY(sizeof(keyState)), keyState) >= 0) { - for (size_t i = 0; i < scanCodes.size(); i++) { - int32_t sc = scanCodes.itemAt(i); - if (sc >= 0 && sc <= KEY_MAX && test_bit(sc, keyState)) { - return AKEY_STATE_DOWN; - } - } - return AKEY_STATE_UP; - } - } - } - return AKEY_STATE_UNKNOWN; -} - -int32_t EventHub::getSwitchState(int32_t deviceId, int32_t sw) const { - if (sw >= 0 && sw <= SW_MAX) { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual() && test_bit(sw, device->swBitmask)) { - uint8_t swState[sizeof_bit_array(SW_MAX + 1)]; - memset(swState, 0, sizeof(swState)); - if (ioctl(device->fd, EVIOCGSW(sizeof(swState)), swState) >= 0) { - return test_bit(sw, swState) ? AKEY_STATE_DOWN : AKEY_STATE_UP; - } - } - } - return AKEY_STATE_UNKNOWN; -} - -status_t EventHub::getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const { - *outValue = 0; - - if (axis >= 0 && axis <= ABS_MAX) { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual() && test_bit(axis, device->absBitmask)) { - struct input_absinfo info; - if(ioctl(device->fd, EVIOCGABS(axis), &info)) { - ALOGW("Error reading absolute controller %d for device %s fd %d, errno=%d", - axis, device->identifier.name.string(), device->fd, errno); - return -errno; - } - - *outValue = info.value; - return OK; - } - } - return -1; -} - -bool EventHub::markSupportedKeyCodes(int32_t deviceId, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) const { - AutoMutex _l(mLock); - - Device* device = getDeviceLocked(deviceId); - if (device && device->keyMap.haveKeyLayout()) { - Vector scanCodes; - for (size_t codeIndex = 0; codeIndex < numCodes; codeIndex++) { - scanCodes.clear(); - - status_t err = device->keyMap.keyLayoutMap->findScanCodesForKey( - keyCodes[codeIndex], &scanCodes); - if (! err) { - // check the possible scan codes identified by the layout map against the - // map of codes actually emitted by the driver - for (size_t sc = 0; sc < scanCodes.size(); sc++) { - if (test_bit(scanCodes[sc], device->keyBitmask)) { - outFlags[codeIndex] = 1; - break; - } - } - } - } - return true; - } - return false; -} - -status_t EventHub::mapKey(int32_t deviceId, - int32_t scanCode, int32_t usageCode, int32_t metaState, - int32_t* outKeycode, int32_t* outMetaState, uint32_t* outFlags) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - status_t status = NAME_NOT_FOUND; - - if (device) { - // Check the key character map first. - sp kcm = device->getKeyCharacterMap(); - if (kcm != NULL) { - if (!kcm->mapKey(scanCode, usageCode, outKeycode)) { - *outFlags = 0; - status = NO_ERROR; - } - } - - // Check the key layout next. - if (status != NO_ERROR && device->keyMap.haveKeyLayout()) { - if (!device->keyMap.keyLayoutMap->mapKey( - scanCode, usageCode, outKeycode, outFlags)) { - status = NO_ERROR; - } - } - - if (status == NO_ERROR) { - if (kcm != NULL) { - kcm->tryRemapKey(*outKeycode, metaState, outKeycode, outMetaState); - } else { - *outMetaState = metaState; - } - } - } - - if (status != NO_ERROR) { - *outKeycode = 0; - *outFlags = 0; - *outMetaState = metaState; - } - - return status; -} - -status_t EventHub::mapAxis(int32_t deviceId, int32_t scanCode, AxisInfo* outAxisInfo) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - - if (device && device->keyMap.haveKeyLayout()) { - status_t err = device->keyMap.keyLayoutMap->mapAxis(scanCode, outAxisInfo); - if (err == NO_ERROR) { - return NO_ERROR; - } - } - - return NAME_NOT_FOUND; -} - -void EventHub::setExcludedDevices(const Vector& devices) { - AutoMutex _l(mLock); - - mExcludedDevices = devices; -} - -bool EventHub::hasScanCode(int32_t deviceId, int32_t scanCode) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device && scanCode >= 0 && scanCode <= KEY_MAX) { - if (test_bit(scanCode, device->keyBitmask)) { - return true; - } - } - return false; -} - -bool EventHub::hasLed(int32_t deviceId, int32_t led) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - int32_t sc; - if (device && mapLed(device, led, &sc) == NO_ERROR) { - if (test_bit(sc, device->ledBitmask)) { - return true; - } - } - return false; -} - -void EventHub::setLedState(int32_t deviceId, int32_t led, bool on) { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - setLedStateLocked(device, led, on); -} - -void EventHub::setLedStateLocked(Device* device, int32_t led, bool on) { - int32_t sc; - if (device && !device->isVirtual() && mapLed(device, led, &sc) != NAME_NOT_FOUND) { - struct input_event ev; - ev.time.tv_sec = 0; - ev.time.tv_usec = 0; - ev.type = EV_LED; - ev.code = sc; - ev.value = on ? 1 : 0; - - ssize_t nWrite; - do { - nWrite = write(device->fd, &ev, sizeof(struct input_event)); - } while (nWrite == -1 && errno == EINTR); - } -} - -void EventHub::getVirtualKeyDefinitions(int32_t deviceId, - Vector& outVirtualKeys) const { - outVirtualKeys.clear(); - - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device && device->virtualKeyMap) { - outVirtualKeys.appendVector(device->virtualKeyMap->getVirtualKeys()); - } -} - -sp EventHub::getKeyCharacterMap(int32_t deviceId) const { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device) { - return device->getKeyCharacterMap(); - } - return NULL; -} - -bool EventHub::setKeyboardLayoutOverlay(int32_t deviceId, - const sp& map) { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device) { - if (map != device->overlayKeyMap) { - device->overlayKeyMap = map; - device->combinedKeyMap = KeyCharacterMap::combine( - device->keyMap.keyCharacterMap, map); - return true; - } - } - return false; -} - -static String8 generateDescriptor(InputDeviceIdentifier& identifier) { - String8 rawDescriptor; - rawDescriptor.appendFormat(":%04x:%04x:", identifier.vendor, - identifier.product); - // TODO add handling for USB devices to not uniqueify kbs that show up twice - if (!identifier.uniqueId.isEmpty()) { - rawDescriptor.append("uniqueId:"); - rawDescriptor.append(identifier.uniqueId); - } else if (identifier.nonce != 0) { - rawDescriptor.appendFormat("nonce:%04x", identifier.nonce); - } - - if (identifier.vendor == 0 && identifier.product == 0) { - // If we don't know the vendor and product id, then the device is probably - // built-in so we need to rely on other information to uniquely identify - // the input device. Usually we try to avoid relying on the device name or - // location but for built-in input device, they are unlikely to ever change. - if (!identifier.name.isEmpty()) { - rawDescriptor.append("name:"); - rawDescriptor.append(identifier.name); - } else if (!identifier.location.isEmpty()) { - rawDescriptor.append("location:"); - rawDescriptor.append(identifier.location); - } - } - identifier.descriptor = sha1(rawDescriptor); - return rawDescriptor; -} - -void EventHub::assignDescriptorLocked(InputDeviceIdentifier& identifier) { - // Compute a device descriptor that uniquely identifies the device. - // The descriptor is assumed to be a stable identifier. Its value should not - // change between reboots, reconnections, firmware updates or new releases - // of Android. In practice we sometimes get devices that cannot be uniquely - // identified. In this case we enforce uniqueness between connected devices. - // Ideally, we also want the descriptor to be short and relatively opaque. - - identifier.nonce = 0; - String8 rawDescriptor = generateDescriptor(identifier); - if (identifier.uniqueId.isEmpty()) { - // If it didn't have a unique id check for conflicts and enforce - // uniqueness if necessary. - while(getDeviceByDescriptorLocked(identifier.descriptor) != NULL) { - identifier.nonce++; - rawDescriptor = generateDescriptor(identifier); - } - } - ALOGV("Created descriptor: raw=%s, cooked=%s", rawDescriptor.string(), - identifier.descriptor.string()); -} - -void EventHub::vibrate(int32_t deviceId, nsecs_t duration) { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual()) { - ff_effect effect; - memset(&effect, 0, sizeof(effect)); - effect.type = FF_RUMBLE; - effect.id = device->ffEffectId; - effect.u.rumble.strong_magnitude = 0xc000; - effect.u.rumble.weak_magnitude = 0xc000; - effect.replay.length = (duration + 999999LL) / 1000000LL; - effect.replay.delay = 0; - if (ioctl(device->fd, EVIOCSFF, &effect)) { - ALOGW("Could not upload force feedback effect to device %s due to error %d.", - device->identifier.name.string(), errno); - return; - } - device->ffEffectId = effect.id; - - struct input_event ev; - ev.time.tv_sec = 0; - ev.time.tv_usec = 0; - ev.type = EV_FF; - ev.code = device->ffEffectId; - ev.value = 1; - if (write(device->fd, &ev, sizeof(ev)) != sizeof(ev)) { - ALOGW("Could not start force feedback effect on device %s due to error %d.", - device->identifier.name.string(), errno); - return; - } - device->ffEffectPlaying = true; - } -} - -void EventHub::cancelVibrate(int32_t deviceId) { - AutoMutex _l(mLock); - Device* device = getDeviceLocked(deviceId); - if (device && !device->isVirtual()) { - if (device->ffEffectPlaying) { - device->ffEffectPlaying = false; - - struct input_event ev; - ev.time.tv_sec = 0; - ev.time.tv_usec = 0; - ev.type = EV_FF; - ev.code = device->ffEffectId; - ev.value = 0; - if (write(device->fd, &ev, sizeof(ev)) != sizeof(ev)) { - ALOGW("Could not stop force feedback effect on device %s due to error %d.", - device->identifier.name.string(), errno); - return; - } - } - } -} - -EventHub::Device* EventHub::getDeviceByDescriptorLocked(String8& descriptor) const { - size_t size = mDevices.size(); - for (size_t i = 0; i < size; i++) { - Device* device = mDevices.valueAt(i); - if (descriptor.compare(device->identifier.descriptor) == 0) { - return device; - } - } - return NULL; -} - -EventHub::Device* EventHub::getDeviceLocked(int32_t deviceId) const { - if (deviceId == BUILT_IN_KEYBOARD_ID) { - deviceId = mBuiltInKeyboardId; - } - ssize_t index = mDevices.indexOfKey(deviceId); - return index >= 0 ? mDevices.valueAt(index) : NULL; -} - -EventHub::Device* EventHub::getDeviceByPathLocked(const char* devicePath) const { - for (size_t i = 0; i < mDevices.size(); i++) { - Device* device = mDevices.valueAt(i); - if (device->path == devicePath) { - return device; - } - } - return NULL; -} - -size_t EventHub::getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize) { - ALOG_ASSERT(bufferSize >= 1); - - AutoMutex _l(mLock); - - struct input_event readBuffer[bufferSize]; - - RawEvent* event = buffer; - size_t capacity = bufferSize; - bool awoken = false; - for (;;) { - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - - // Reopen input devices if needed. - if (mNeedToReopenDevices) { - mNeedToReopenDevices = false; - - ALOGI("Reopening all input devices due to a configuration change."); - - closeAllDevicesLocked(); - mNeedToScanDevices = true; - break; // return to the caller before we actually rescan - } - - // Report any devices that had last been added/removed. - while (mClosingDevices) { - Device* device = mClosingDevices; - ALOGV("Reporting device closed: id=%d, name=%s\n", - device->id, device->path.string()); - mClosingDevices = device->next; - event->when = now; - event->deviceId = device->id == mBuiltInKeyboardId ? BUILT_IN_KEYBOARD_ID : device->id; - event->type = DEVICE_REMOVED; - event += 1; - delete device; - mNeedToSendFinishedDeviceScan = true; - if (--capacity == 0) { - break; - } - } - - if (mNeedToScanDevices) { - mNeedToScanDevices = false; - scanDevicesLocked(); - mNeedToSendFinishedDeviceScan = true; - } - - while (mOpeningDevices != NULL) { - Device* device = mOpeningDevices; - ALOGV("Reporting device opened: id=%d, name=%s\n", - device->id, device->path.string()); - mOpeningDevices = device->next; - event->when = now; - event->deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id; - event->type = DEVICE_ADDED; - event += 1; - mNeedToSendFinishedDeviceScan = true; - if (--capacity == 0) { - break; - } - } - - if (mNeedToSendFinishedDeviceScan) { - mNeedToSendFinishedDeviceScan = false; - event->when = now; - event->type = FINISHED_DEVICE_SCAN; - event += 1; - if (--capacity == 0) { - break; - } - } - - // Grab the next input event. - bool deviceChanged = false; - while (mPendingEventIndex < mPendingEventCount) { - const struct epoll_event& eventItem = mPendingEventItems[mPendingEventIndex++]; - if (eventItem.data.u32 == EPOLL_ID_INOTIFY) { - if (eventItem.events & EPOLLIN) { - mPendingINotify = true; - } else { - ALOGW("Received unexpected epoll event 0x%08x for INotify.", eventItem.events); - } - continue; - } - - if (eventItem.data.u32 == EPOLL_ID_WAKE) { - if (eventItem.events & EPOLLIN) { - ALOGV("awoken after wake()"); - awoken = true; - char buffer[16]; - ssize_t nRead; - do { - nRead = read(mWakeReadPipeFd, buffer, sizeof(buffer)); - } while ((nRead == -1 && errno == EINTR) || nRead == sizeof(buffer)); - } else { - ALOGW("Received unexpected epoll event 0x%08x for wake read pipe.", - eventItem.events); - } - continue; - } - - ssize_t deviceIndex = mDevices.indexOfKey(eventItem.data.u32); - if (deviceIndex < 0) { - ALOGW("Received unexpected epoll event 0x%08x for unknown device id %d.", - eventItem.events, eventItem.data.u32); - continue; - } - - Device* device = mDevices.valueAt(deviceIndex); - if (eventItem.events & EPOLLIN) { - int32_t readSize = read(device->fd, readBuffer, - sizeof(struct input_event) * capacity); - if (readSize == 0 || (readSize < 0 && errno == ENODEV)) { - // Device was removed before INotify noticed. - ALOGW("could not get event, removed? (fd: %d size: %" PRId32 - " bufferSize: %zu capacity: %zu errno: %d)\n", - device->fd, readSize, bufferSize, capacity, errno); - deviceChanged = true; - closeDeviceLocked(device); - } else if (readSize < 0) { - if (errno != EAGAIN && errno != EINTR) { - ALOGW("could not get event (errno=%d)", errno); - } - } else if ((readSize % sizeof(struct input_event)) != 0) { - ALOGE("could not get event (wrong size: %d)", readSize); - } else { - int32_t deviceId = device->id == mBuiltInKeyboardId ? 0 : device->id; - - size_t count = size_t(readSize) / sizeof(struct input_event); - for (size_t i = 0; i < count; i++) { - struct input_event& iev = readBuffer[i]; - ALOGV("%s got: time=%d.%06d, type=%d, code=%d, value=%d", - device->path.string(), - (int) iev.time.tv_sec, (int) iev.time.tv_usec, - iev.type, iev.code, iev.value); - - // Some input devices may have a better concept of the time - // when an input event was actually generated than the kernel - // which simply timestamps all events on entry to evdev. - // This is a custom Android extension of the input protocol - // mainly intended for use with uinput based device drivers. - if (iev.type == EV_MSC) { - if (iev.code == MSC_ANDROID_TIME_SEC) { - device->timestampOverrideSec = iev.value; - continue; - } else if (iev.code == MSC_ANDROID_TIME_USEC) { - device->timestampOverrideUsec = iev.value; - continue; - } - } - if (device->timestampOverrideSec || device->timestampOverrideUsec) { - iev.time.tv_sec = device->timestampOverrideSec; - iev.time.tv_usec = device->timestampOverrideUsec; - if (iev.type == EV_SYN && iev.code == SYN_REPORT) { - device->timestampOverrideSec = 0; - device->timestampOverrideUsec = 0; - } - ALOGV("applied override time %d.%06d", - int(iev.time.tv_sec), int(iev.time.tv_usec)); - } - - // Use the time specified in the event instead of the current time - // so that downstream code can get more accurate estimates of - // event dispatch latency from the time the event is enqueued onto - // the evdev client buffer. - // - // The event's timestamp fortuitously uses the same monotonic clock - // time base as the rest of Android. The kernel event device driver - // (drivers/input/evdev.c) obtains timestamps using ktime_get_ts(). - // The systemTime(SYSTEM_TIME_MONOTONIC) function we use everywhere - // calls clock_gettime(CLOCK_MONOTONIC) which is implemented as a - // system call that also queries ktime_get_ts(). - event->when = nsecs_t(iev.time.tv_sec) * 1000000000LL - + nsecs_t(iev.time.tv_usec) * 1000LL; - ALOGV("event time %" PRId64 ", now %" PRId64, event->when, now); - - // Bug 7291243: Add a guard in case the kernel generates timestamps - // that appear to be far into the future because they were generated - // using the wrong clock source. - // - // This can happen because when the input device is initially opened - // it has a default clock source of CLOCK_REALTIME. Any input events - // enqueued right after the device is opened will have timestamps - // generated using CLOCK_REALTIME. We later set the clock source - // to CLOCK_MONOTONIC but it is already too late. - // - // Invalid input event timestamps can result in ANRs, crashes and - // and other issues that are hard to track down. We must not let them - // propagate through the system. - // - // Log a warning so that we notice the problem and recover gracefully. - if (event->when >= now + 10 * 1000000000LL) { - // Double-check. Time may have moved on. - nsecs_t time = systemTime(SYSTEM_TIME_MONOTONIC); - if (event->when > time) { - ALOGW("An input event from %s has a timestamp that appears to " - "have been generated using the wrong clock source " - "(expected CLOCK_MONOTONIC): " - "event time %" PRId64 ", current time %" PRId64 - ", call time %" PRId64 ". " - "Using current time instead.", - device->path.string(), event->when, time, now); - event->when = time; - } else { - ALOGV("Event time is ok but failed the fast path and required " - "an extra call to systemTime: " - "event time %" PRId64 ", current time %" PRId64 - ", call time %" PRId64 ".", - event->when, time, now); - } - } - event->deviceId = deviceId; - event->type = iev.type; - event->code = iev.code; - event->value = iev.value; - event += 1; - capacity -= 1; - } - if (capacity == 0) { - // The result buffer is full. Reset the pending event index - // so we will try to read the device again on the next iteration. - mPendingEventIndex -= 1; - break; - } - } - } else if (eventItem.events & EPOLLHUP) { - ALOGI("Removing device %s due to epoll hang-up event.", - device->identifier.name.string()); - deviceChanged = true; - closeDeviceLocked(device); - } else { - ALOGW("Received unexpected epoll event 0x%08x for device %s.", - eventItem.events, device->identifier.name.string()); - } - } - - // readNotify() will modify the list of devices so this must be done after - // processing all other events to ensure that we read all remaining events - // before closing the devices. - if (mPendingINotify && mPendingEventIndex >= mPendingEventCount) { - mPendingINotify = false; - readNotifyLocked(); - deviceChanged = true; - } - - // Report added or removed devices immediately. - if (deviceChanged) { - continue; - } - - // Return now if we have collected any events or if we were explicitly awoken. - if (event != buffer || awoken) { - break; - } - - // Poll for events. Mind the wake lock dance! - // We hold a wake lock at all times except during epoll_wait(). This works due to some - // subtle choreography. When a device driver has pending (unread) events, it acquires - // a kernel wake lock. However, once the last pending event has been read, the device - // driver will release the kernel wake lock. To prevent the system from going to sleep - // when this happens, the EventHub holds onto its own user wake lock while the client - // is processing events. Thus the system can only sleep if there are no events - // pending or currently being processed. - // - // The timeout is advisory only. If the device is asleep, it will not wake just to - // service the timeout. - mPendingEventIndex = 0; - - mLock.unlock(); // release lock before poll, must be before release_wake_lock - release_wake_lock(WAKE_LOCK_ID); - - int pollResult = epoll_wait(mEpollFd, mPendingEventItems, EPOLL_MAX_EVENTS, timeoutMillis); - - acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_ID); - mLock.lock(); // reacquire lock after poll, must be after acquire_wake_lock - - if (pollResult == 0) { - // Timed out. - mPendingEventCount = 0; - break; - } - - if (pollResult < 0) { - // An error occurred. - mPendingEventCount = 0; - - // Sleep after errors to avoid locking up the system. - // Hopefully the error is transient. - if (errno != EINTR) { - ALOGW("poll failed (errno=%d)\n", errno); - usleep(100000); - } - } else { - // Some events occurred. - mPendingEventCount = size_t(pollResult); - } - } - - // All done, return the number of events we read. - return event - buffer; -} - -void EventHub::wake() { - ALOGV("wake() called"); - - ssize_t nWrite; - do { - nWrite = write(mWakeWritePipeFd, "W", 1); - } while (nWrite == -1 && errno == EINTR); - - if (nWrite != 1 && errno != EAGAIN) { - ALOGW("Could not write wake signal, errno=%d", errno); - } -} - -void EventHub::scanDevicesLocked() { - status_t res = scanDirLocked(DEVICE_PATH); - if(res < 0) { - ALOGE("scan dir failed for %s\n", DEVICE_PATH); - } - if (mDevices.indexOfKey(VIRTUAL_KEYBOARD_ID) < 0) { - createVirtualKeyboardLocked(); - } -} - -// ---------------------------------------------------------------------------- - -static bool containsNonZeroByte(const uint8_t* array, uint32_t startIndex, uint32_t endIndex) { - const uint8_t* end = array + endIndex; - array += startIndex; - while (array != end) { - if (*(array++) != 0) { - return true; - } - } - return false; -} - -static const int32_t GAMEPAD_KEYCODES[] = { - AKEYCODE_BUTTON_A, AKEYCODE_BUTTON_B, AKEYCODE_BUTTON_C, - AKEYCODE_BUTTON_X, AKEYCODE_BUTTON_Y, AKEYCODE_BUTTON_Z, - AKEYCODE_BUTTON_L1, AKEYCODE_BUTTON_R1, - AKEYCODE_BUTTON_L2, AKEYCODE_BUTTON_R2, - AKEYCODE_BUTTON_THUMBL, AKEYCODE_BUTTON_THUMBR, - AKEYCODE_BUTTON_START, AKEYCODE_BUTTON_SELECT, AKEYCODE_BUTTON_MODE, -}; - -status_t EventHub::openDeviceLocked(const char *devicePath) { - char buffer[80]; - - ALOGV("Opening device: %s", devicePath); - - int fd = open(devicePath, O_RDWR | O_CLOEXEC); - if(fd < 0) { - ALOGE("could not open %s, %s\n", devicePath, strerror(errno)); - return -1; - } - - InputDeviceIdentifier identifier; - - // Get device name. - if(ioctl(fd, EVIOCGNAME(sizeof(buffer) - 1), &buffer) < 1) { - //fprintf(stderr, "could not get device name for %s, %s\n", devicePath, strerror(errno)); - } else { - buffer[sizeof(buffer) - 1] = '\0'; - identifier.name.setTo(buffer); - } - - // Check to see if the device is on our excluded list - for (size_t i = 0; i < mExcludedDevices.size(); i++) { - const String8& item = mExcludedDevices.itemAt(i); - if (identifier.name == item) { - ALOGI("ignoring event id %s driver %s\n", devicePath, item.string()); - close(fd); - return -1; - } - } - - // Get device driver version. - int driverVersion; - if(ioctl(fd, EVIOCGVERSION, &driverVersion)) { - ALOGE("could not get driver version for %s, %s\n", devicePath, strerror(errno)); - close(fd); - return -1; - } - - // Get device identifier. - struct input_id inputId; - if(ioctl(fd, EVIOCGID, &inputId)) { - ALOGE("could not get device input id for %s, %s\n", devicePath, strerror(errno)); - close(fd); - return -1; - } - identifier.bus = inputId.bustype; - identifier.product = inputId.product; - identifier.vendor = inputId.vendor; - identifier.version = inputId.version; - - // Get device physical location. - if(ioctl(fd, EVIOCGPHYS(sizeof(buffer) - 1), &buffer) < 1) { - //fprintf(stderr, "could not get location for %s, %s\n", devicePath, strerror(errno)); - } else { - buffer[sizeof(buffer) - 1] = '\0'; - identifier.location.setTo(buffer); - } - - // Get device unique id. - if(ioctl(fd, EVIOCGUNIQ(sizeof(buffer) - 1), &buffer) < 1) { - //fprintf(stderr, "could not get idstring for %s, %s\n", devicePath, strerror(errno)); - } else { - buffer[sizeof(buffer) - 1] = '\0'; - identifier.uniqueId.setTo(buffer); - } - - // Fill in the descriptor. - assignDescriptorLocked(identifier); - - // Make file descriptor non-blocking for use with poll(). - if (fcntl(fd, F_SETFL, O_NONBLOCK)) { - ALOGE("Error %d making device file descriptor non-blocking.", errno); - close(fd); - return -1; - } - - // Allocate device. (The device object takes ownership of the fd at this point.) - int32_t deviceId = mNextDeviceId++; - Device* device = new Device(fd, deviceId, String8(devicePath), identifier); - - ALOGV("add device %d: %s\n", deviceId, devicePath); - ALOGV(" bus: %04x\n" - " vendor %04x\n" - " product %04x\n" - " version %04x\n", - identifier.bus, identifier.vendor, identifier.product, identifier.version); - ALOGV(" name: \"%s\"\n", identifier.name.string()); - ALOGV(" location: \"%s\"\n", identifier.location.string()); - ALOGV(" unique id: \"%s\"\n", identifier.uniqueId.string()); - ALOGV(" descriptor: \"%s\"\n", identifier.descriptor.string()); - ALOGV(" driver: v%d.%d.%d\n", - driverVersion >> 16, (driverVersion >> 8) & 0xff, driverVersion & 0xff); - - // Load the configuration file for the device. - loadConfigurationLocked(device); - - // Figure out the kinds of events the device reports. - ioctl(fd, EVIOCGBIT(EV_KEY, sizeof(device->keyBitmask)), device->keyBitmask); - ioctl(fd, EVIOCGBIT(EV_ABS, sizeof(device->absBitmask)), device->absBitmask); - ioctl(fd, EVIOCGBIT(EV_REL, sizeof(device->relBitmask)), device->relBitmask); - ioctl(fd, EVIOCGBIT(EV_SW, sizeof(device->swBitmask)), device->swBitmask); - ioctl(fd, EVIOCGBIT(EV_LED, sizeof(device->ledBitmask)), device->ledBitmask); - ioctl(fd, EVIOCGBIT(EV_FF, sizeof(device->ffBitmask)), device->ffBitmask); - ioctl(fd, EVIOCGPROP(sizeof(device->propBitmask)), device->propBitmask); - - // See if this is a keyboard. Ignore everything in the button range except for - // joystick and gamepad buttons which are handled like keyboards for the most part. - bool haveKeyboardKeys = containsNonZeroByte(device->keyBitmask, 0, sizeof_bit_array(BTN_MISC)) - || containsNonZeroByte(device->keyBitmask, sizeof_bit_array(KEY_OK), - sizeof_bit_array(KEY_MAX + 1)); - bool haveGamepadButtons = containsNonZeroByte(device->keyBitmask, sizeof_bit_array(BTN_MISC), - sizeof_bit_array(BTN_MOUSE)) - || containsNonZeroByte(device->keyBitmask, sizeof_bit_array(BTN_JOYSTICK), - sizeof_bit_array(BTN_DIGI)); - if (haveKeyboardKeys || haveGamepadButtons) { - device->classes |= INPUT_DEVICE_CLASS_KEYBOARD; - } - - // See if this is a cursor device such as a trackball or mouse. - if (test_bit(BTN_MOUSE, device->keyBitmask) - && test_bit(REL_X, device->relBitmask) - && test_bit(REL_Y, device->relBitmask)) { - device->classes |= INPUT_DEVICE_CLASS_CURSOR; - } - - // See if this is a touch pad. - // Is this a new modern multi-touch driver? - if (test_bit(ABS_MT_POSITION_X, device->absBitmask) - && test_bit(ABS_MT_POSITION_Y, device->absBitmask)) { - // Some joysticks such as the PS3 controller report axes that conflict - // with the ABS_MT range. Try to confirm that the device really is - // a touch screen. - if (test_bit(BTN_TOUCH, device->keyBitmask) || !haveGamepadButtons) { - device->classes |= INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_TOUCH_MT; - } - // Is this an old style single-touch driver? - } else if (test_bit(BTN_TOUCH, device->keyBitmask) - && test_bit(ABS_X, device->absBitmask) - && test_bit(ABS_Y, device->absBitmask)) { - device->classes |= INPUT_DEVICE_CLASS_TOUCH; - // Is this a BT stylus? - } else if ((test_bit(ABS_PRESSURE, device->absBitmask) || - test_bit(BTN_TOUCH, device->keyBitmask)) - && !test_bit(ABS_X, device->absBitmask) - && !test_bit(ABS_Y, device->absBitmask)) { - device->classes |= INPUT_DEVICE_CLASS_EXTERNAL_STYLUS; - // Keyboard will try to claim some of the buttons but we really want to reserve those so we - // can fuse it with the touch screen data, so just take them back. Note this means an - // external stylus cannot also be a keyboard device. - device->classes &= ~INPUT_DEVICE_CLASS_KEYBOARD; - } - - // See if this device is a joystick. - // Assumes that joysticks always have gamepad buttons in order to distinguish them - // from other devices such as accelerometers that also have absolute axes. - if (haveGamepadButtons) { - uint32_t assumedClasses = device->classes | INPUT_DEVICE_CLASS_JOYSTICK; - for (int i = 0; i <= ABS_MAX; i++) { - if (test_bit(i, device->absBitmask) - && (getAbsAxisUsage(i, assumedClasses) & INPUT_DEVICE_CLASS_JOYSTICK)) { - device->classes = assumedClasses; - break; - } - } - } - - // Check whether this device has switches. - for (int i = 0; i <= SW_MAX; i++) { - if (test_bit(i, device->swBitmask)) { - device->classes |= INPUT_DEVICE_CLASS_SWITCH; - break; - } - } - - // Check whether this device supports the vibrator. - if (test_bit(FF_RUMBLE, device->ffBitmask)) { - device->classes |= INPUT_DEVICE_CLASS_VIBRATOR; - } - - // Configure virtual keys. - if ((device->classes & INPUT_DEVICE_CLASS_TOUCH)) { - // Load the virtual keys for the touch screen, if any. - // We do this now so that we can make sure to load the keymap if necessary. - status_t status = loadVirtualKeyMapLocked(device); - if (!status) { - device->classes |= INPUT_DEVICE_CLASS_KEYBOARD; - } - } - - // Load the key map. - // We need to do this for joysticks too because the key layout may specify axes. - status_t keyMapStatus = NAME_NOT_FOUND; - if (device->classes & (INPUT_DEVICE_CLASS_KEYBOARD | INPUT_DEVICE_CLASS_JOYSTICK)) { - // Load the keymap for the device. - keyMapStatus = loadKeyMapLocked(device); - } - - // Configure the keyboard, gamepad or virtual keyboard. - if (device->classes & INPUT_DEVICE_CLASS_KEYBOARD) { - // Register the keyboard as a built-in keyboard if it is eligible. - if (!keyMapStatus - && mBuiltInKeyboardId == NO_BUILT_IN_KEYBOARD - && isEligibleBuiltInKeyboard(device->identifier, - device->configuration, &device->keyMap)) { - mBuiltInKeyboardId = device->id; - } - - // 'Q' key support = cheap test of whether this is an alpha-capable kbd - if (hasKeycodeLocked(device, AKEYCODE_Q)) { - device->classes |= INPUT_DEVICE_CLASS_ALPHAKEY; - } - - // See if this device has a DPAD. - if (hasKeycodeLocked(device, AKEYCODE_DPAD_UP) && - hasKeycodeLocked(device, AKEYCODE_DPAD_DOWN) && - hasKeycodeLocked(device, AKEYCODE_DPAD_LEFT) && - hasKeycodeLocked(device, AKEYCODE_DPAD_RIGHT) && - hasKeycodeLocked(device, AKEYCODE_DPAD_CENTER)) { - device->classes |= INPUT_DEVICE_CLASS_DPAD; - } - - // See if this device has a gamepad. - for (size_t i = 0; i < sizeof(GAMEPAD_KEYCODES)/sizeof(GAMEPAD_KEYCODES[0]); i++) { - if (hasKeycodeLocked(device, GAMEPAD_KEYCODES[i])) { - device->classes |= INPUT_DEVICE_CLASS_GAMEPAD; - break; - } - } - - // Disable kernel key repeat since we handle it ourselves - unsigned int repeatRate[] = {0,0}; - if (ioctl(fd, EVIOCSREP, repeatRate)) { - ALOGW("Unable to disable kernel key repeat for %s: %s", devicePath, strerror(errno)); - } - } - - // If the device isn't recognized as something we handle, don't monitor it. - if (device->classes == 0) { - ALOGV("Dropping device: id=%d, path='%s', name='%s'", - deviceId, devicePath, device->identifier.name.string()); - delete device; - return -1; - } - - // Determine whether the device has a mic. - if (deviceHasMicLocked(device)) { - device->classes |= INPUT_DEVICE_CLASS_MIC; - } - - // Determine whether the device is external or internal. - if (isExternalDeviceLocked(device)) { - device->classes |= INPUT_DEVICE_CLASS_EXTERNAL; - } - - if (device->classes & (INPUT_DEVICE_CLASS_JOYSTICK | INPUT_DEVICE_CLASS_DPAD) - && device->classes & INPUT_DEVICE_CLASS_GAMEPAD) { - device->controllerNumber = getNextControllerNumberLocked(device); - setLedForController(device); - } - - // Register with epoll. - struct epoll_event eventItem; - memset(&eventItem, 0, sizeof(eventItem)); - eventItem.events = EPOLLIN; - if (mUsingEpollWakeup) { - eventItem.events |= EPOLLWAKEUP; - } - eventItem.data.u32 = deviceId; - if (epoll_ctl(mEpollFd, EPOLL_CTL_ADD, fd, &eventItem)) { - ALOGE("Could not add device fd to epoll instance. errno=%d", errno); - delete device; - return -1; - } - - String8 wakeMechanism("EPOLLWAKEUP"); - if (!mUsingEpollWakeup) { -#ifndef EVIOCSSUSPENDBLOCK - // uapi headers don't include EVIOCSSUSPENDBLOCK, and future kernels - // will use an epoll flag instead, so as long as we want to support - // this feature, we need to be prepared to define the ioctl ourselves. -#define EVIOCSSUSPENDBLOCK _IOW('E', 0x91, int) -#endif - if (ioctl(fd, EVIOCSSUSPENDBLOCK, 1)) { - wakeMechanism = ""; - } else { - wakeMechanism = "EVIOCSSUSPENDBLOCK"; - } - } - - // Tell the kernel that we want to use the monotonic clock for reporting timestamps - // associated with input events. This is important because the input system - // uses the timestamps extensively and assumes they were recorded using the monotonic - // clock. - // - // In older kernel, before Linux 3.4, there was no way to tell the kernel which - // clock to use to input event timestamps. The standard kernel behavior was to - // record a real time timestamp, which isn't what we want. Android kernels therefore - // contained a patch to the evdev_event() function in drivers/input/evdev.c to - // replace the call to do_gettimeofday() with ktime_get_ts() to cause the monotonic - // clock to be used instead of the real time clock. - // - // As of Linux 3.4, there is a new EVIOCSCLOCKID ioctl to set the desired clock. - // Therefore, we no longer require the Android-specific kernel patch described above - // as long as we make sure to set select the monotonic clock. We do that here. - int clockId = CLOCK_MONOTONIC; - bool usingClockIoctl = !ioctl(fd, EVIOCSCLOCKID, &clockId); - - ALOGI("New device: id=%d, fd=%d, path='%s', name='%s', classes=0x%x, " - "configuration='%s', keyLayout='%s', keyCharacterMap='%s', builtinKeyboard=%s, " - "wakeMechanism=%s, usingClockIoctl=%s", - deviceId, fd, devicePath, device->identifier.name.string(), - device->classes, - device->configurationFile.string(), - device->keyMap.keyLayoutFile.string(), - device->keyMap.keyCharacterMapFile.string(), - toString(mBuiltInKeyboardId == deviceId), - wakeMechanism.string(), toString(usingClockIoctl)); - - addDeviceLocked(device); - return 0; -} - -void EventHub::createVirtualKeyboardLocked() { - InputDeviceIdentifier identifier; - identifier.name = "Virtual"; - identifier.uniqueId = ""; - assignDescriptorLocked(identifier); - - Device* device = new Device(-1, VIRTUAL_KEYBOARD_ID, String8(""), identifier); - device->classes = INPUT_DEVICE_CLASS_KEYBOARD - | INPUT_DEVICE_CLASS_ALPHAKEY - | INPUT_DEVICE_CLASS_DPAD - | INPUT_DEVICE_CLASS_VIRTUAL; - loadKeyMapLocked(device); - addDeviceLocked(device); -} - -void EventHub::addDeviceLocked(Device* device) { - mDevices.add(device->id, device); - device->next = mOpeningDevices; - mOpeningDevices = device; -} - -void EventHub::loadConfigurationLocked(Device* device) { - device->configurationFile = getInputDeviceConfigurationFilePathByDeviceIdentifier( - device->identifier, INPUT_DEVICE_CONFIGURATION_FILE_TYPE_CONFIGURATION); - if (device->configurationFile.isEmpty()) { - ALOGD("No input device configuration file found for device '%s'.", - device->identifier.name.string()); - } else { - status_t status = PropertyMap::load(device->configurationFile, - &device->configuration); - if (status) { - ALOGE("Error loading input device configuration file for device '%s'. " - "Using default configuration.", - device->identifier.name.string()); - } - } -} - -status_t EventHub::loadVirtualKeyMapLocked(Device* device) { - // The virtual key map is supplied by the kernel as a system board property file. - String8 path; - path.append("/sys/board_properties/virtualkeys."); - path.append(device->identifier.name); - if (access(path.string(), R_OK)) { - return NAME_NOT_FOUND; - } - return VirtualKeyMap::load(path, &device->virtualKeyMap); -} - -status_t EventHub::loadKeyMapLocked(Device* device) { - return device->keyMap.load(device->identifier, device->configuration); -} - -bool EventHub::isExternalDeviceLocked(Device* device) { - if (device->configuration) { - bool value; - if (device->configuration->tryGetProperty(String8("device.internal"), value)) { - return !value; - } - } - return device->identifier.bus == BUS_USB || device->identifier.bus == BUS_BLUETOOTH; -} - -bool EventHub::deviceHasMicLocked(Device* device) { - if (device->configuration) { - bool value; - if (device->configuration->tryGetProperty(String8("audio.mic"), value)) { - return value; - } - } - return false; -} - -int32_t EventHub::getNextControllerNumberLocked(Device* device) { - if (mControllerNumbers.isFull()) { - ALOGI("Maximum number of controllers reached, assigning controller number 0 to device %s", - device->identifier.name.string()); - return 0; - } - // Since the controller number 0 is reserved for non-controllers, translate all numbers up by - // one - return static_cast(mControllerNumbers.markFirstUnmarkedBit() + 1); -} - -void EventHub::releaseControllerNumberLocked(Device* device) { - int32_t num = device->controllerNumber; - device->controllerNumber= 0; - if (num == 0) { - return; - } - mControllerNumbers.clearBit(static_cast(num - 1)); -} - -void EventHub::setLedForController(Device* device) { - for (int i = 0; i < MAX_CONTROLLER_LEDS; i++) { - setLedStateLocked(device, ALED_CONTROLLER_1 + i, device->controllerNumber == i + 1); - } -} - -bool EventHub::hasKeycodeLocked(Device* device, int keycode) const { - if (!device->keyMap.haveKeyLayout()) { - return false; - } - - Vector scanCodes; - device->keyMap.keyLayoutMap->findScanCodesForKey(keycode, &scanCodes); - const size_t N = scanCodes.size(); - for (size_t i=0; i= 0 && sc <= KEY_MAX && test_bit(sc, device->keyBitmask)) { - return true; - } - } - - return false; -} - -status_t EventHub::mapLed(Device* device, int32_t led, int32_t* outScanCode) const { - if (!device->keyMap.haveKeyLayout()) { - return NAME_NOT_FOUND; - } - - int32_t scanCode; - if(device->keyMap.keyLayoutMap->findScanCodeForLed(led, &scanCode) != NAME_NOT_FOUND) { - if(scanCode >= 0 && scanCode <= LED_MAX && test_bit(scanCode, device->ledBitmask)) { - *outScanCode = scanCode; - return NO_ERROR; - } - } - return NAME_NOT_FOUND; -} - -status_t EventHub::closeDeviceByPathLocked(const char *devicePath) { - Device* device = getDeviceByPathLocked(devicePath); - if (device) { - closeDeviceLocked(device); - return 0; - } - ALOGV("Remove device: %s not found, device may already have been removed.", devicePath); - return -1; -} - -void EventHub::closeAllDevicesLocked() { - while (mDevices.size() > 0) { - closeDeviceLocked(mDevices.valueAt(mDevices.size() - 1)); - } -} - -void EventHub::closeDeviceLocked(Device* device) { - ALOGI("Removed device: path=%s name=%s id=%d fd=%d classes=0x%x\n", - device->path.string(), device->identifier.name.string(), device->id, - device->fd, device->classes); - - if (device->id == mBuiltInKeyboardId) { - ALOGW("built-in keyboard device %s (id=%d) is closing! the apps will not like this", - device->path.string(), mBuiltInKeyboardId); - mBuiltInKeyboardId = NO_BUILT_IN_KEYBOARD; - } - - if (!device->isVirtual()) { - if (epoll_ctl(mEpollFd, EPOLL_CTL_DEL, device->fd, NULL)) { - ALOGW("Could not remove device fd from epoll instance. errno=%d", errno); - } - } - - releaseControllerNumberLocked(device); - - mDevices.removeItem(device->id); - device->close(); - - // Unlink for opening devices list if it is present. - Device* pred = NULL; - bool found = false; - for (Device* entry = mOpeningDevices; entry != NULL; ) { - if (entry == device) { - found = true; - break; - } - pred = entry; - entry = entry->next; - } - if (found) { - // Unlink the device from the opening devices list then delete it. - // We don't need to tell the client that the device was closed because - // it does not even know it was opened in the first place. - ALOGI("Device %s was immediately closed after opening.", device->path.string()); - if (pred) { - pred->next = device->next; - } else { - mOpeningDevices = device->next; - } - delete device; - } else { - // Link into closing devices list. - // The device will be deleted later after we have informed the client. - device->next = mClosingDevices; - mClosingDevices = device; - } -} - -status_t EventHub::readNotifyLocked() { - int res; - char devname[PATH_MAX]; - char *filename; - char event_buf[512]; - int event_size; - int event_pos = 0; - struct inotify_event *event; - - ALOGV("EventHub::readNotify nfd: %d\n", mINotifyFd); - res = read(mINotifyFd, event_buf, sizeof(event_buf)); - if(res < (int)sizeof(*event)) { - if(errno == EINTR) - return 0; - ALOGW("could not get event, %s\n", strerror(errno)); - return -1; - } - //printf("got %d bytes of event information\n", res); - - strcpy(devname, DEVICE_PATH); - filename = devname + strlen(devname); - *filename++ = '/'; - - while(res >= (int)sizeof(*event)) { - event = (struct inotify_event *)(event_buf + event_pos); - //printf("%d: %08x \"%s\"\n", event->wd, event->mask, event->len ? event->name : ""); - if(event->len) { - strcpy(filename, event->name); - if(event->mask & IN_CREATE) { - openDeviceLocked(devname); - } else { - ALOGI("Removing device '%s' due to inotify event\n", devname); - closeDeviceByPathLocked(devname); - } - } - event_size = sizeof(*event) + event->len; - res -= event_size; - event_pos += event_size; - } - return 0; -} - -status_t EventHub::scanDirLocked(const char *dirname) -{ - char devname[PATH_MAX]; - char *filename; - DIR *dir; - struct dirent *de; - dir = opendir(dirname); - if(dir == NULL) - return -1; - strcpy(devname, dirname); - filename = devname + strlen(devname); - *filename++ = '/'; - while((de = readdir(dir))) { - if(de->d_name[0] == '.' && - (de->d_name[1] == '\0' || - (de->d_name[1] == '.' && de->d_name[2] == '\0'))) - continue; - strcpy(filename, de->d_name); - openDeviceLocked(devname); - } - closedir(dir); - return 0; -} - -void EventHub::requestReopenDevices() { - ALOGV("requestReopenDevices() called"); - - AutoMutex _l(mLock); - mNeedToReopenDevices = true; -} - -void EventHub::dump(String8& dump) { - dump.append("Event Hub State:\n"); - - { // acquire lock - AutoMutex _l(mLock); - - dump.appendFormat(INDENT "BuiltInKeyboardId: %d\n", mBuiltInKeyboardId); - - dump.append(INDENT "Devices:\n"); - - for (size_t i = 0; i < mDevices.size(); i++) { - const Device* device = mDevices.valueAt(i); - if (mBuiltInKeyboardId == device->id) { - dump.appendFormat(INDENT2 "%d: %s (aka device 0 - built-in keyboard)\n", - device->id, device->identifier.name.string()); - } else { - dump.appendFormat(INDENT2 "%d: %s\n", device->id, - device->identifier.name.string()); - } - dump.appendFormat(INDENT3 "Classes: 0x%08x\n", device->classes); - dump.appendFormat(INDENT3 "Path: %s\n", device->path.string()); - dump.appendFormat(INDENT3 "Descriptor: %s\n", device->identifier.descriptor.string()); - dump.appendFormat(INDENT3 "Location: %s\n", device->identifier.location.string()); - dump.appendFormat(INDENT3 "ControllerNumber: %d\n", device->controllerNumber); - dump.appendFormat(INDENT3 "UniqueId: %s\n", device->identifier.uniqueId.string()); - dump.appendFormat(INDENT3 "Identifier: bus=0x%04x, vendor=0x%04x, " - "product=0x%04x, version=0x%04x\n", - device->identifier.bus, device->identifier.vendor, - device->identifier.product, device->identifier.version); - dump.appendFormat(INDENT3 "KeyLayoutFile: %s\n", - device->keyMap.keyLayoutFile.string()); - dump.appendFormat(INDENT3 "KeyCharacterMapFile: %s\n", - device->keyMap.keyCharacterMapFile.string()); - dump.appendFormat(INDENT3 "ConfigurationFile: %s\n", - device->configurationFile.string()); - dump.appendFormat(INDENT3 "HaveKeyboardLayoutOverlay: %s\n", - toString(device->overlayKeyMap != NULL)); - } - } // release lock -} - -void EventHub::monitor() { - // Acquire and release the lock to ensure that the event hub has not deadlocked. - mLock.lock(); - mLock.unlock(); -} - - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/EventHub.h android-platform-frameworks-native-21/services/inputflinger/EventHub.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/EventHub.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/EventHub.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,466 +0,0 @@ -/* - * Copyright (C) 2005 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. - */ - -// -#ifndef _RUNTIME_EVENT_HUB_H -#define _RUNTIME_EVENT_HUB_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -/* Convenience constants. */ - -#define BTN_FIRST 0x100 // first button code -#define BTN_LAST 0x15f // last button code - -/* - * These constants are used privately in Android to pass raw timestamps - * through evdev from uinput device drivers because there is currently no - * other way to transfer this information. The evdev driver automatically - * timestamps all input events with the time they were posted and clobbers - * whatever information was passed in. - * - * For the purposes of this hack, the timestamp is specified in the - * CLOCK_MONOTONIC timebase and is split into two EV_MSC events specifying - * seconds and microseconds. - */ -#define MSC_ANDROID_TIME_SEC 0x6 -#define MSC_ANDROID_TIME_USEC 0x7 - -namespace android { - -enum { - // Device id of a special "virtual" keyboard that is always present. - VIRTUAL_KEYBOARD_ID = -1, - // Device id of the "built-in" keyboard if there is one. - BUILT_IN_KEYBOARD_ID = 0, -}; - -/* - * A raw event as retrieved from the EventHub. - */ -struct RawEvent { - nsecs_t when; - int32_t deviceId; - int32_t type; - int32_t code; - int32_t value; -}; - -/* Describes an absolute axis. */ -struct RawAbsoluteAxisInfo { - bool valid; // true if the information is valid, false otherwise - - int32_t minValue; // minimum value - int32_t maxValue; // maximum value - int32_t flat; // center flat position, eg. flat == 8 means center is between -8 and 8 - int32_t fuzz; // error tolerance, eg. fuzz == 4 means value is +/- 4 due to noise - int32_t resolution; // resolution in units per mm or radians per mm - - inline void clear() { - valid = false; - minValue = 0; - maxValue = 0; - flat = 0; - fuzz = 0; - resolution = 0; - } -}; - -/* - * Input device classes. - */ -enum { - /* The input device is a keyboard or has buttons. */ - INPUT_DEVICE_CLASS_KEYBOARD = 0x00000001, - - /* The input device is an alpha-numeric keyboard (not just a dial pad). */ - INPUT_DEVICE_CLASS_ALPHAKEY = 0x00000002, - - /* The input device is a touchscreen or a touchpad (either single-touch or multi-touch). */ - INPUT_DEVICE_CLASS_TOUCH = 0x00000004, - - /* The input device is a cursor device such as a trackball or mouse. */ - INPUT_DEVICE_CLASS_CURSOR = 0x00000008, - - /* The input device is a multi-touch touchscreen. */ - INPUT_DEVICE_CLASS_TOUCH_MT = 0x00000010, - - /* The input device is a directional pad (implies keyboard, has DPAD keys). */ - INPUT_DEVICE_CLASS_DPAD = 0x00000020, - - /* The input device is a gamepad (implies keyboard, has BUTTON keys). */ - INPUT_DEVICE_CLASS_GAMEPAD = 0x00000040, - - /* The input device has switches. */ - INPUT_DEVICE_CLASS_SWITCH = 0x00000080, - - /* The input device is a joystick (implies gamepad, has joystick absolute axes). */ - INPUT_DEVICE_CLASS_JOYSTICK = 0x00000100, - - /* The input device has a vibrator (supports FF_RUMBLE). */ - INPUT_DEVICE_CLASS_VIBRATOR = 0x00000200, - - /* The input device has a microphone. */ - INPUT_DEVICE_CLASS_MIC = 0x00000400, - - /* The input device is an external stylus (has data we want to fuse with touch data). */ - INPUT_DEVICE_CLASS_EXTERNAL_STYLUS = 0x00000800, - - /* The input device is virtual (not a real device, not part of UI configuration). */ - INPUT_DEVICE_CLASS_VIRTUAL = 0x40000000, - - /* The input device is external (not built-in). */ - INPUT_DEVICE_CLASS_EXTERNAL = 0x80000000, -}; - -/* - * Gets the class that owns an axis, in cases where multiple classes might claim - * the same axis for different purposes. - */ -extern uint32_t getAbsAxisUsage(int32_t axis, uint32_t deviceClasses); - -/* - * Grand Central Station for events. - * - * The event hub aggregates input events received across all known input - * devices on the system, including devices that may be emulated by the simulator - * environment. In addition, the event hub generates fake input events to indicate - * when devices are added or removed. - * - * The event hub provides a stream of input events (via the getEvent function). - * It also supports querying the current actual state of input devices such as identifying - * which keys are currently down. Finally, the event hub keeps track of the capabilities of - * individual input devices, such as their class and the set of key codes that they support. - */ -class EventHubInterface : public virtual RefBase { -protected: - EventHubInterface() { } - virtual ~EventHubInterface() { } - -public: - // Synthetic raw event type codes produced when devices are added or removed. - enum { - // Sent when a device is added. - DEVICE_ADDED = 0x10000000, - // Sent when a device is removed. - DEVICE_REMOVED = 0x20000000, - // Sent when all added/removed devices from the most recent scan have been reported. - // This event is always sent at least once. - FINISHED_DEVICE_SCAN = 0x30000000, - - FIRST_SYNTHETIC_EVENT = DEVICE_ADDED, - }; - - virtual uint32_t getDeviceClasses(int32_t deviceId) const = 0; - - virtual InputDeviceIdentifier getDeviceIdentifier(int32_t deviceId) const = 0; - - virtual int32_t getDeviceControllerNumber(int32_t deviceId) const = 0; - - virtual void getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const = 0; - - virtual status_t getAbsoluteAxisInfo(int32_t deviceId, int axis, - RawAbsoluteAxisInfo* outAxisInfo) const = 0; - - virtual bool hasRelativeAxis(int32_t deviceId, int axis) const = 0; - - virtual bool hasInputProperty(int32_t deviceId, int property) const = 0; - - virtual status_t mapKey(int32_t deviceId, - int32_t scanCode, int32_t usageCode, int32_t metaState, - int32_t* outKeycode, int32_t *outMetaState, uint32_t* outFlags) const = 0; - - virtual status_t mapAxis(int32_t deviceId, int32_t scanCode, - AxisInfo* outAxisInfo) const = 0; - - // Sets devices that are excluded from opening. - // This can be used to ignore input devices for sensors. - virtual void setExcludedDevices(const Vector& devices) = 0; - - /* - * Wait for events to become available and returns them. - * After returning, the EventHub holds onto a wake lock until the next call to getEvent. - * This ensures that the device will not go to sleep while the event is being processed. - * If the device needs to remain awake longer than that, then the caller is responsible - * for taking care of it (say, by poking the power manager user activity timer). - * - * The timeout is advisory only. If the device is asleep, it will not wake just to - * service the timeout. - * - * Returns the number of events obtained, or 0 if the timeout expired. - */ - virtual size_t getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize) = 0; - - /* - * Query current input state. - */ - virtual int32_t getScanCodeState(int32_t deviceId, int32_t scanCode) const = 0; - virtual int32_t getKeyCodeState(int32_t deviceId, int32_t keyCode) const = 0; - virtual int32_t getSwitchState(int32_t deviceId, int32_t sw) const = 0; - virtual status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, - int32_t* outValue) const = 0; - - /* - * Examine key input devices for specific framework keycode support - */ - virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes, const int32_t* keyCodes, - uint8_t* outFlags) const = 0; - - virtual bool hasScanCode(int32_t deviceId, int32_t scanCode) const = 0; - - /* LED related functions expect Android LED constants, not scan codes or HID usages */ - virtual bool hasLed(int32_t deviceId, int32_t led) const = 0; - virtual void setLedState(int32_t deviceId, int32_t led, bool on) = 0; - - virtual void getVirtualKeyDefinitions(int32_t deviceId, - Vector& outVirtualKeys) const = 0; - - virtual sp getKeyCharacterMap(int32_t deviceId) const = 0; - virtual bool setKeyboardLayoutOverlay(int32_t deviceId, const sp& map) = 0; - - /* Control the vibrator. */ - virtual void vibrate(int32_t deviceId, nsecs_t duration) = 0; - virtual void cancelVibrate(int32_t deviceId) = 0; - - /* Requests the EventHub to reopen all input devices on the next call to getEvents(). */ - virtual void requestReopenDevices() = 0; - - /* Wakes up getEvents() if it is blocked on a read. */ - virtual void wake() = 0; - - /* Dump EventHub state to a string. */ - virtual void dump(String8& dump) = 0; - - /* Called by the heatbeat to ensures that the reader has not deadlocked. */ - virtual void monitor() = 0; -}; - -class EventHub : public EventHubInterface -{ -public: - EventHub(); - - virtual uint32_t getDeviceClasses(int32_t deviceId) const; - - virtual InputDeviceIdentifier getDeviceIdentifier(int32_t deviceId) const; - - virtual int32_t getDeviceControllerNumber(int32_t deviceId) const; - - virtual void getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const; - - virtual status_t getAbsoluteAxisInfo(int32_t deviceId, int axis, - RawAbsoluteAxisInfo* outAxisInfo) const; - - virtual bool hasRelativeAxis(int32_t deviceId, int axis) const; - - virtual bool hasInputProperty(int32_t deviceId, int property) const; - - virtual status_t mapKey(int32_t deviceId, - int32_t scanCode, int32_t usageCode, int32_t metaState, - int32_t* outKeycode, int32_t *outMetaState, uint32_t* outFlags) const; - - virtual status_t mapAxis(int32_t deviceId, int32_t scanCode, - AxisInfo* outAxisInfo) const; - - virtual void setExcludedDevices(const Vector& devices); - - virtual int32_t getScanCodeState(int32_t deviceId, int32_t scanCode) const; - virtual int32_t getKeyCodeState(int32_t deviceId, int32_t keyCode) const; - virtual int32_t getSwitchState(int32_t deviceId, int32_t sw) const; - virtual status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t* outValue) const; - - virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) const; - - virtual size_t getEvents(int timeoutMillis, RawEvent* buffer, size_t bufferSize); - - virtual bool hasScanCode(int32_t deviceId, int32_t scanCode) const; - virtual bool hasLed(int32_t deviceId, int32_t led) const; - virtual void setLedState(int32_t deviceId, int32_t led, bool on); - - virtual void getVirtualKeyDefinitions(int32_t deviceId, - Vector& outVirtualKeys) const; - - virtual sp getKeyCharacterMap(int32_t deviceId) const; - virtual bool setKeyboardLayoutOverlay(int32_t deviceId, const sp& map); - - virtual void vibrate(int32_t deviceId, nsecs_t duration); - virtual void cancelVibrate(int32_t deviceId); - - virtual void requestReopenDevices(); - - virtual void wake(); - - virtual void dump(String8& dump); - virtual void monitor(); - -protected: - virtual ~EventHub(); - -private: - struct Device { - Device* next; - - int fd; // may be -1 if device is virtual - const int32_t id; - const String8 path; - const InputDeviceIdentifier identifier; - - uint32_t classes; - - uint8_t keyBitmask[(KEY_MAX + 1) / 8]; - uint8_t absBitmask[(ABS_MAX + 1) / 8]; - uint8_t relBitmask[(REL_MAX + 1) / 8]; - uint8_t swBitmask[(SW_MAX + 1) / 8]; - uint8_t ledBitmask[(LED_MAX + 1) / 8]; - uint8_t ffBitmask[(FF_MAX + 1) / 8]; - uint8_t propBitmask[(INPUT_PROP_MAX + 1) / 8]; - - String8 configurationFile; - PropertyMap* configuration; - VirtualKeyMap* virtualKeyMap; - KeyMap keyMap; - - sp overlayKeyMap; - sp combinedKeyMap; - - bool ffEffectPlaying; - int16_t ffEffectId; // initially -1 - - int32_t controllerNumber; - - int32_t timestampOverrideSec; - int32_t timestampOverrideUsec; - - Device(int fd, int32_t id, const String8& path, const InputDeviceIdentifier& identifier); - ~Device(); - - void close(); - - inline bool isVirtual() const { return fd < 0; } - - const sp& getKeyCharacterMap() const { - if (combinedKeyMap != NULL) { - return combinedKeyMap; - } - return keyMap.keyCharacterMap; - } - }; - - status_t openDeviceLocked(const char *devicePath); - void createVirtualKeyboardLocked(); - void addDeviceLocked(Device* device); - void assignDescriptorLocked(InputDeviceIdentifier& identifier); - - status_t closeDeviceByPathLocked(const char *devicePath); - void closeDeviceLocked(Device* device); - void closeAllDevicesLocked(); - - status_t scanDirLocked(const char *dirname); - void scanDevicesLocked(); - status_t readNotifyLocked(); - - Device* getDeviceByDescriptorLocked(String8& descriptor) const; - Device* getDeviceLocked(int32_t deviceId) const; - Device* getDeviceByPathLocked(const char* devicePath) const; - - bool hasKeycodeLocked(Device* device, int keycode) const; - - void loadConfigurationLocked(Device* device); - status_t loadVirtualKeyMapLocked(Device* device); - status_t loadKeyMapLocked(Device* device); - - bool isExternalDeviceLocked(Device* device); - bool deviceHasMicLocked(Device* device); - - int32_t getNextControllerNumberLocked(Device* device); - void releaseControllerNumberLocked(Device* device); - void setLedForController(Device* device); - - status_t mapLed(Device* device, int32_t led, int32_t* outScanCode) const; - void setLedStateLocked(Device* device, int32_t led, bool on); - - // Protect all internal state. - mutable Mutex mLock; - - // The actual id of the built-in keyboard, or NO_BUILT_IN_KEYBOARD if none. - // EventHub remaps the built-in keyboard to id 0 externally as required by the API. - enum { - // Must not conflict with any other assigned device ids, including - // the virtual keyboard id (-1). - NO_BUILT_IN_KEYBOARD = -2, - }; - int32_t mBuiltInKeyboardId; - - int32_t mNextDeviceId; - - BitSet32 mControllerNumbers; - - KeyedVector mDevices; - - Device *mOpeningDevices; - Device *mClosingDevices; - - bool mNeedToSendFinishedDeviceScan; - bool mNeedToReopenDevices; - bool mNeedToScanDevices; - Vector mExcludedDevices; - - int mEpollFd; - int mINotifyFd; - int mWakeReadPipeFd; - int mWakeWritePipeFd; - - // Ids used for epoll notifications not associated with devices. - static const uint32_t EPOLL_ID_INOTIFY = 0x80000001; - static const uint32_t EPOLL_ID_WAKE = 0x80000002; - - // Epoll FD list size hint. - static const int EPOLL_SIZE_HINT = 8; - - // Maximum number of signalled FDs to handle at a time. - static const int EPOLL_MAX_EVENTS = 16; - - // The array of pending epoll events and the index of the next event to be handled. - struct epoll_event mPendingEventItems[EPOLL_MAX_EVENTS]; - size_t mPendingEventCount; - size_t mPendingEventIndex; - bool mPendingINotify; - - bool mUsingEpollWakeup; -}; - -}; // namespace android - -#endif // _RUNTIME_EVENT_HUB_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/Android.mk android-platform-frameworks-native-21/services/inputflinger/host/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -# Copyright (C) 2015 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. - -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_CLANG := true - -LOCAL_SRC_FILES:= \ - InputFlinger.cpp \ - InputDriver.cpp \ - InputHost.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libcrypto \ - libcutils \ - libinput \ - liblog \ - libutils \ - libhardware - - -# TODO: Move inputflinger to its own process and mark it hidden -#LOCAL_CFLAGS += -fvisibility=hidden - -LOCAL_CFLAGS += -Wno-unused-parameter - -LOCAL_EXPORT_C_INCLUDE_DIRS := $(LOCAL_PATH) - -LOCAL_MODULE := libinputflingerhost - -include $(BUILD_SHARED_LIBRARY) - -######################################################################## -# build input flinger executable -include $(CLEAR_VARS) - -LOCAL_CLANG := true - -LOCAL_SRC_FILES:= \ - main.cpp - -LOCAL_SHARED_LIBRARIES := \ - libbinder \ - libinputflingerhost \ - libutils - -LOCAL_MODULE := inputflinger - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputDriver.cpp android-platform-frameworks-native-21/services/inputflinger/host/InputDriver.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputDriver.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/InputDriver.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,146 +0,0 @@ -/* - * Copyright (C) 2015 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 -#include - -#define LOG_TAG "InputDriver" - -#define LOG_NDEBUG 0 - -#include "InputDriver.h" -#include "InputHost.h" - -#include -#include -#include - -#define INDENT2 " " - -namespace android { - -static input_host_callbacks_t kCallbacks = { - .create_device_identifier = create_device_identifier, - .create_device_definition = create_device_definition, - .create_input_report_definition = create_input_report_definition, - .create_output_report_definition = create_output_report_definition, - .input_device_definition_add_report = input_device_definition_add_report, - .input_report_definition_add_collection = input_report_definition_add_collection, - .input_report_definition_declare_usage_int = input_report_definition_declare_usage_int, - .input_report_definition_declare_usages_bool = input_report_definition_declare_usages_bool, - .register_device = register_device, - .input_allocate_report = input_allocate_report, - .input_report_set_usage_int = input_report_set_usage_int, - .input_report_set_usage_bool = input_report_set_usage_bool, - .report_event = report_event, - .input_get_device_property_map = input_get_device_property_map, - .input_get_device_property = input_get_device_property, - .input_get_property_key = input_get_property_key, - .input_get_property_value = input_get_property_value, - .input_free_device_property = input_free_device_property, - .input_free_device_property_map = input_free_device_property_map, -}; - -InputDriver::InputDriver(const char* name) : mName(String8(name)) { - const hw_module_t* module; - int err = input_open(&module, name); - LOG_ALWAYS_FATAL_IF(err != 0, "Input module %s not found", name); - mHal = reinterpret_cast(module); -} - -void InputDriver::init(InputHostInterface* host) { - mHal->init(mHal, static_cast(host), kCallbacks); -} - -void InputDriver::dump(String8& result) { - result.appendFormat(INDENT2 "HAL Input Driver (%s)\n", mName.string()); -} - - -// HAL wrapper functions - -input_device_identifier_t* create_device_identifier(input_host_t* host, - const char* name, int32_t product_id, int32_t vendor_id, - input_bus_t bus, const char* unique_id) { - return nullptr; -} - -input_device_definition_t* create_device_definition(input_host_t* host) { - return nullptr; -} - -input_report_definition_t* create_input_report_definition(input_host_t* host) { - return nullptr; -} - -input_report_definition_t* create_output_report_definition(input_host_t* host) { - return nullptr; -} - -void input_device_definition_add_report(input_host_t* host, - input_device_definition_t* d, input_report_definition_t* r) { } - -void input_report_definition_add_collection(input_host_t* host, - input_report_definition_t* report, input_collection_id_t id, int32_t arity) { } - -void input_report_definition_declare_usage_int(input_host_t* host, - input_report_definition_t* report, input_collection_id_t id, - input_usage_t usage, int32_t min, int32_t max, float resolution) { } - -void input_report_definition_declare_usages_bool(input_host_t* host, - input_report_definition_t* report, input_collection_id_t id, - input_usage_t* usage, size_t usage_count) { } - - -input_device_handle_t* register_device(input_host_t* host, - input_device_identifier_t* id, input_device_definition_t* d) { - return nullptr; -} - -input_report_t* input_allocate_report(input_host_t* host, input_report_definition_t* r) { - return nullptr; -} -void input_report_set_usage_int(input_host_t* host, input_report_t* r, - input_collection_id_t id, input_usage_t usage, int32_t value, int32_t arity_index) { } - -void input_report_set_usage_bool(input_host_t* host, input_report_t* r, - input_collection_id_t id, input_usage_t usage, bool value, int32_t arity_index) { } - -void report_event(input_host_t* host, input_device_handle_t* d, input_report_t* report) { } - -input_property_map_t* input_get_device_property_map(input_host_t* host, - input_device_identifier_t* id) { - return nullptr; -} - -input_property_t* input_get_device_property(input_host_t* host, input_property_map_t* map, - const char* key) { - return nullptr; -} - -const char* input_get_property_key(input_host_t* host, input_property_t* property) { - return nullptr; -} - -const char* input_get_property_value(input_host_t* host, input_property_t* property) { - return nullptr; -} - -void input_free_device_property(input_host_t* host, input_property_t* property) { } - -void input_free_device_property_map(input_host_t* host, input_property_map_t* map) { } - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputDriver.h android-platform-frameworks-native-21/services/inputflinger/host/InputDriver.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputDriver.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/InputDriver.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,117 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -#ifndef ANDROID_INPUT_DRIVER_H -#define ANDROID_INPUT_DRIVER_H - -#include -#include - -#include "InputHost.h" - -#include -#include -#include - -namespace android { - -class InputHostInterface; - -class InputDriverInterface : public virtual RefBase { -protected: - InputDriverInterface() = default; - virtual ~InputDriverInterface() = default; - -public: - virtual void init(InputHostInterface* host) = 0; - - virtual void dump(String8& result) = 0; -}; - -class InputDriver : public InputDriverInterface { -public: - InputDriver(const char* name); - virtual ~InputDriver() = default; - - virtual void init(InputHostInterface* host) override; - - virtual void dump(String8& result) override; - -private: - String8 mName; - const input_module_t* mHal; -}; - - -extern "C" { - -input_device_identifier_t* create_device_identifier(input_host_t* host, - const char* name, int32_t product_id, int32_t vendor_id, - input_bus_t bus, const char* unique_id); - -input_device_definition_t* create_device_definition(input_host_t* host); - -input_report_definition_t* create_input_report_definition(input_host_t* host); - -input_report_definition_t* create_output_report_definition(input_host_t* host); - -void input_device_definition_add_report(input_host_t* host, - input_device_definition_t* d, input_report_definition_t* r); - -void input_report_definition_add_collection(input_host_t* host, - input_report_definition_t* report, input_collection_id_t id, int32_t arity); - -void input_report_definition_declare_usage_int(input_host_t* host, - input_report_definition_t* report, input_collection_id_t id, - input_usage_t usage, int32_t min, int32_t max, float resolution); - -void input_report_definition_declare_usages_bool(input_host_t* host, - input_report_definition_t* report, input_collection_id_t id, - input_usage_t* usage, size_t usage_count); - - -input_device_handle_t* register_device(input_host_t* host, - input_device_identifier_t* id, input_device_definition_t* d); - -void unregister_device(input_host_t* host, input_device_handle_t* handle); - -input_report_t* input_allocate_report(input_host_t* host, input_report_definition_t* r); - -void input_report_set_usage_int(input_host_t* host, input_report_t* r, - input_collection_id_t id, input_usage_t usage, int32_t value, int32_t arity_index); - -void input_report_set_usage_bool(input_host_t* host, input_report_t* r, - input_collection_id_t id, input_usage_t usage, bool value, int32_t arity_index); - -void report_event(input_host_t* host, input_device_handle_t* d, input_report_t* report); - -input_property_map_t* input_get_device_property_map(input_host_t* host, - input_device_identifier_t* id); - -input_property_t* input_get_device_property(input_host_t* host, input_property_map_t* map, - const char* key); - -const char* input_get_property_key(input_host_t* host, input_property_t* property); - -const char* input_get_property_value(input_host_t* host, input_property_t* property); - -void input_free_device_property(input_host_t* host, input_property_t* property); - -void input_free_device_property_map(input_host_t* host, input_property_map_t* map); -} - -} // namespace android -#endif // ANDROID_INPUT_DRIVER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputFlinger.cpp android-platform-frameworks-native-21/services/inputflinger/host/InputFlinger.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputFlinger.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/InputFlinger.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define LOG_TAG "InputFlinger" - - -#include -#include - -#include - -#include "InputFlinger.h" -#include "InputDriver.h" - -#include -#include -#include -#include -#include - -namespace android { - -const String16 sAccessInputFlingerPermission("android.permission.ACCESS_INPUT_FLINGER"); -const String16 sDumpPermission("android.permission.DUMP"); - - -InputFlinger::InputFlinger() : - BnInputFlinger() { - ALOGI("InputFlinger is starting"); - mHost = new InputHost(); - mHost->registerInputDriver(new InputDriver(INPUT_INSTANCE_EVDEV)); -} - -InputFlinger::~InputFlinger() { -} - -status_t InputFlinger::dump(int fd, const Vector& args) { - String8 result; - const IPCThreadState* ipc = IPCThreadState::self(); - const int pid = ipc->getCallingPid(); - const int uid = ipc->getCallingUid(); - if ((uid != AID_SHELL) - && !PermissionCache::checkPermission(sDumpPermission, pid, uid)) { - result.appendFormat("Permission Denial: " - "can't dump SurfaceFlinger from pid=%d, uid=%d\n", pid, uid); - } else { - dumpInternal(result); - } - write(fd, result.string(), result.size()); - return OK; -} - -void InputFlinger::dumpInternal(String8& result) { - result.append("INPUT FLINGER (dumpsys inputflinger)\n"); - mHost->dump(result); -} - -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputFlinger.h android-platform-frameworks-native-21/services/inputflinger/host/InputFlinger.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputFlinger.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/InputFlinger.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,53 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_INPUT_FLINGER_H -#define ANDROID_INPUT_FLINGER_H - -#include -#include - -#include "InputHost.h" - -#include -#include -#include -#include -#include - -namespace android { - -class InputFlinger : public BnInputFlinger { -public: - static char const* getServiceName() ANDROID_API { - return "inputflinger"; - } - - InputFlinger() ANDROID_API; - - virtual status_t dump(int fd, const Vector& args); - -private: - virtual ~InputFlinger(); - - void dumpInternal(String8& result); - - sp mHost; -}; - -} // namespace android - -#endif // ANDROID_INPUT_FLINGER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputHost.cpp android-platform-frameworks-native-21/services/inputflinger/host/InputHost.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputHost.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/InputHost.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright (C) 2015 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 - -#include "InputDriver.h" -#include "InputHost.h" - -#include -#include - -#define INDENT " " - -namespace android { - -void InputHost::registerInputDriver(InputDriverInterface* driver) { - LOG_ALWAYS_FATAL_IF(driver == nullptr, "Cannot register a nullptr as an InputDriver!"); - driver->init(this); - mDrivers.push_back(driver); -} - -void InputHost::dump(String8& result) { - result.append(INDENT "Input Drivers:\n"); - for (size_t i = 0; i < mDrivers.size(); i++) { - mDrivers[i]->dump(result); - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputHost.h android-platform-frameworks-native-21/services/inputflinger/host/InputHost.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/InputHost.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/InputHost.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,62 +0,0 @@ -/* - * Copyright (C) 2015 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. - */ - -#ifndef ANDROID_INPUT_HOST_H -#define ANDROID_INPUT_HOST_H - -#include - -#include -#include -#include -#include - -#include "InputDriver.h" - -// Declare a concrete type for the HAL -struct input_host { -}; - -namespace android { - -class InputDriverInterface; - -class InputHostInterface : public input_host_t, public virtual RefBase { -protected: - InputHostInterface() = default; - virtual ~InputHostInterface() = default; - -public: - - virtual void registerInputDriver(InputDriverInterface* driver) = 0; - - virtual void dump(String8& result) = 0; -}; - -class InputHost : public InputHostInterface { -public: - InputHost() = default; - - virtual void registerInputDriver(InputDriverInterface* driver) override; - - virtual void dump(String8& result) override; - -private: - std::vector> mDrivers; -}; - -} // namespace android -#endif // ANDRIOD_INPUT_HOST_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/main.cpp android-platform-frameworks-native-21/services/inputflinger/host/main.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/host/main.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/host/main.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,26 +0,0 @@ -/* - * Copyright (C) 2013 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 -#include "InputFlinger.h" - -using namespace android; - -int main(int, char**) { - ProcessState::self()->setThreadPoolMaxThreadCount(4); - BinderService::publishAndJoinThreadPool(true); - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputApplication.cpp android-platform-frameworks-native-21/services/inputflinger/InputApplication.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputApplication.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputApplication.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "InputApplication" - -#include "InputApplication.h" - -#include - -namespace android { - -// --- InputApplicationHandle --- - -InputApplicationHandle::InputApplicationHandle() : - mInfo(NULL) { -} - -InputApplicationHandle::~InputApplicationHandle() { - delete mInfo; -} - -void InputApplicationHandle::releaseInfo() { - if (mInfo) { - delete mInfo; - mInfo = NULL; - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputApplication.h android-platform-frameworks-native-21/services/inputflinger/InputApplication.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputApplication.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputApplication.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - * 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. - */ - -#ifndef _UI_INPUT_APPLICATION_H -#define _UI_INPUT_APPLICATION_H - -#include - -#include -#include -#include - -namespace android { - -/* - * Describes the properties of an application that can receive input. - */ -struct InputApplicationInfo { - String8 name; - nsecs_t dispatchingTimeout; -}; - - -/* - * Handle for an application that can receive input. - * - * Used by the native input dispatcher as a handle for the window manager objects - * that describe an application. - */ -class InputApplicationHandle : public RefBase { -public: - inline const InputApplicationInfo* getInfo() const { - return mInfo; - } - - inline String8 getName() const { - return mInfo ? mInfo->name : String8(""); - } - - inline nsecs_t getDispatchingTimeout(nsecs_t defaultValue) const { - return mInfo ? mInfo->dispatchingTimeout : defaultValue; - } - - /** - * Requests that the state of this object be updated to reflect - * the most current available information about the application. - * - * This method should only be called from within the input dispatcher's - * critical section. - * - * Returns true on success, or false if the handle is no longer valid. - */ - virtual bool updateInfo() = 0; - - /** - * Releases the storage used by the associated information when it is - * no longer needed. - */ - void releaseInfo(); - -protected: - InputApplicationHandle(); - virtual ~InputApplicationHandle(); - - InputApplicationInfo* mInfo; -}; - -} // namespace android - -#endif // _UI_INPUT_APPLICATION_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputDispatcher.cpp android-platform-frameworks-native-21/services/inputflinger/InputDispatcher.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputDispatcher.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputDispatcher.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,4535 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "InputDispatcher" -#define ATRACE_TAG ATRACE_TAG_INPUT - -//#define LOG_NDEBUG 0 - -// Log detailed debug messages about each inbound event notification to the dispatcher. -#define DEBUG_INBOUND_EVENT_DETAILS 0 - -// Log detailed debug messages about each outbound event processed by the dispatcher. -#define DEBUG_OUTBOUND_EVENT_DETAILS 0 - -// Log debug messages about the dispatch cycle. -#define DEBUG_DISPATCH_CYCLE 0 - -// Log debug messages about registrations. -#define DEBUG_REGISTRATION 0 - -// Log debug messages about input event injection. -#define DEBUG_INJECTION 0 - -// Log debug messages about input focus tracking. -#define DEBUG_FOCUS 0 - -// Log debug messages about the app switch latency optimization. -#define DEBUG_APP_SWITCH 0 - -// Log debug messages about hover events. -#define DEBUG_HOVER 0 - -#include "InputDispatcher.h" - -#include -#include -#include -#include - -#include -#include -#include -#include -#include - -#define INDENT " " -#define INDENT2 " " -#define INDENT3 " " -#define INDENT4 " " - -namespace android { - -// Default input dispatching timeout if there is no focused application or paused window -// from which to determine an appropriate dispatching timeout. -const nsecs_t DEFAULT_INPUT_DISPATCHING_TIMEOUT = 5000 * 1000000LL; // 5 sec - -// Amount of time to allow for all pending events to be processed when an app switch -// key is on the way. This is used to preempt input dispatch and drop input events -// when an application takes too long to respond and the user has pressed an app switch key. -const nsecs_t APP_SWITCH_TIMEOUT = 500 * 1000000LL; // 0.5sec - -// Amount of time to allow for an event to be dispatched (measured since its eventTime) -// before considering it stale and dropping it. -const nsecs_t STALE_EVENT_TIMEOUT = 10000 * 1000000LL; // 10sec - -// Amount of time to allow touch events to be streamed out to a connection before requiring -// that the first event be finished. This value extends the ANR timeout by the specified -// amount. For example, if streaming is allowed to get ahead by one second relative to the -// queue of waiting unfinished events, then ANRs will similarly be delayed by one second. -const nsecs_t STREAM_AHEAD_EVENT_TIMEOUT = 500 * 1000000LL; // 0.5sec - -// Log a warning when an event takes longer than this to process, even if an ANR does not occur. -const nsecs_t SLOW_EVENT_PROCESSING_WARNING_TIMEOUT = 2000 * 1000000LL; // 2sec - -// Number of recent events to keep for debugging purposes. -const size_t RECENT_QUEUE_MAX_SIZE = 10; - -static inline nsecs_t now() { - return systemTime(SYSTEM_TIME_MONOTONIC); -} - -static inline const char* toString(bool value) { - return value ? "true" : "false"; -} - -static inline int32_t getMotionEventActionPointerIndex(int32_t action) { - return (action & AMOTION_EVENT_ACTION_POINTER_INDEX_MASK) - >> AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; -} - -static bool isValidKeyAction(int32_t action) { - switch (action) { - case AKEY_EVENT_ACTION_DOWN: - case AKEY_EVENT_ACTION_UP: - return true; - default: - return false; - } -} - -static bool validateKeyEvent(int32_t action) { - if (! isValidKeyAction(action)) { - ALOGE("Key event has invalid action code 0x%x", action); - return false; - } - return true; -} - -static bool isValidMotionAction(int32_t action, int32_t actionButton, int32_t pointerCount) { - switch (action & AMOTION_EVENT_ACTION_MASK) { - case AMOTION_EVENT_ACTION_DOWN: - case AMOTION_EVENT_ACTION_UP: - case AMOTION_EVENT_ACTION_CANCEL: - case AMOTION_EVENT_ACTION_MOVE: - case AMOTION_EVENT_ACTION_OUTSIDE: - case AMOTION_EVENT_ACTION_HOVER_ENTER: - case AMOTION_EVENT_ACTION_HOVER_MOVE: - case AMOTION_EVENT_ACTION_HOVER_EXIT: - case AMOTION_EVENT_ACTION_SCROLL: - return true; - case AMOTION_EVENT_ACTION_POINTER_DOWN: - case AMOTION_EVENT_ACTION_POINTER_UP: { - int32_t index = getMotionEventActionPointerIndex(action); - return index >= 0 && size_t(index) < pointerCount; - } - case AMOTION_EVENT_ACTION_BUTTON_PRESS: - case AMOTION_EVENT_ACTION_BUTTON_RELEASE: - return actionButton != 0; - default: - return false; - } -} - -static bool validateMotionEvent(int32_t action, int32_t actionButton, size_t pointerCount, - const PointerProperties* pointerProperties) { - if (! isValidMotionAction(action, actionButton, pointerCount)) { - ALOGE("Motion event has invalid action code 0x%x", action); - return false; - } - if (pointerCount < 1 || pointerCount > MAX_POINTERS) { - ALOGE("Motion event has invalid pointer count %zu; value must be between 1 and %d.", - pointerCount, MAX_POINTERS); - return false; - } - BitSet32 pointerIdBits; - for (size_t i = 0; i < pointerCount; i++) { - int32_t id = pointerProperties[i].id; - if (id < 0 || id > MAX_POINTER_ID) { - ALOGE("Motion event has invalid pointer id %d; value must be between 0 and %d", - id, MAX_POINTER_ID); - return false; - } - if (pointerIdBits.hasBit(id)) { - ALOGE("Motion event has duplicate pointer id %d", id); - return false; - } - pointerIdBits.markBit(id); - } - return true; -} - -static bool isMainDisplay(int32_t displayId) { - return displayId == ADISPLAY_ID_DEFAULT || displayId == ADISPLAY_ID_NONE; -} - -static void dumpRegion(String8& dump, const Region& region) { - if (region.isEmpty()) { - dump.append(""); - return; - } - - bool first = true; - Region::const_iterator cur = region.begin(); - Region::const_iterator const tail = region.end(); - while (cur != tail) { - if (first) { - first = false; - } else { - dump.append("|"); - } - dump.appendFormat("[%d,%d][%d,%d]", cur->left, cur->top, cur->right, cur->bottom); - cur++; - } -} - - -// --- InputDispatcher --- - -InputDispatcher::InputDispatcher(const sp& policy) : - mPolicy(policy), - mPendingEvent(NULL), mLastDropReason(DROP_REASON_NOT_DROPPED), - mAppSwitchSawKeyDown(false), mAppSwitchDueTime(LONG_LONG_MAX), - mNextUnblockedEvent(NULL), - mDispatchEnabled(false), mDispatchFrozen(false), mInputFilterEnabled(false), - mInputTargetWaitCause(INPUT_TARGET_WAIT_CAUSE_NONE) { - mLooper = new Looper(false); - - mKeyRepeatState.lastKeyEntry = NULL; - - policy->getDispatcherConfiguration(&mConfig); -} - -InputDispatcher::~InputDispatcher() { - { // acquire lock - AutoMutex _l(mLock); - - resetKeyRepeatLocked(); - releasePendingEventLocked(); - drainInboundQueueLocked(); - } - - while (mConnectionsByFd.size() != 0) { - unregisterInputChannel(mConnectionsByFd.valueAt(0)->inputChannel); - } -} - -void InputDispatcher::dispatchOnce() { - nsecs_t nextWakeupTime = LONG_LONG_MAX; - { // acquire lock - AutoMutex _l(mLock); - mDispatcherIsAliveCondition.broadcast(); - - // Run a dispatch loop if there are no pending commands. - // The dispatch loop might enqueue commands to run afterwards. - if (!haveCommandsLocked()) { - dispatchOnceInnerLocked(&nextWakeupTime); - } - - // Run all pending commands if there are any. - // If any commands were run then force the next poll to wake up immediately. - if (runCommandsLockedInterruptible()) { - nextWakeupTime = LONG_LONG_MIN; - } - } // release lock - - // Wait for callback or timeout or wake. (make sure we round up, not down) - nsecs_t currentTime = now(); - int timeoutMillis = toMillisecondTimeoutDelay(currentTime, nextWakeupTime); - mLooper->pollOnce(timeoutMillis); -} - -void InputDispatcher::dispatchOnceInnerLocked(nsecs_t* nextWakeupTime) { - nsecs_t currentTime = now(); - - // Reset the key repeat timer whenever normal dispatch is suspended while the - // device is in a non-interactive state. This is to ensure that we abort a key - // repeat if the device is just coming out of sleep. - if (!mDispatchEnabled) { - resetKeyRepeatLocked(); - } - - // If dispatching is frozen, do not process timeouts or try to deliver any new events. - if (mDispatchFrozen) { -#if DEBUG_FOCUS - ALOGD("Dispatch frozen. Waiting some more."); -#endif - return; - } - - // Optimize latency of app switches. - // Essentially we start a short timeout when an app switch key (HOME / ENDCALL) has - // been pressed. When it expires, we preempt dispatch and drop all other pending events. - bool isAppSwitchDue = mAppSwitchDueTime <= currentTime; - if (mAppSwitchDueTime < *nextWakeupTime) { - *nextWakeupTime = mAppSwitchDueTime; - } - - // Ready to start a new event. - // If we don't already have a pending event, go grab one. - if (! mPendingEvent) { - if (mInboundQueue.isEmpty()) { - if (isAppSwitchDue) { - // The inbound queue is empty so the app switch key we were waiting - // for will never arrive. Stop waiting for it. - resetPendingAppSwitchLocked(false); - isAppSwitchDue = false; - } - - // Synthesize a key repeat if appropriate. - if (mKeyRepeatState.lastKeyEntry) { - if (currentTime >= mKeyRepeatState.nextRepeatTime) { - mPendingEvent = synthesizeKeyRepeatLocked(currentTime); - } else { - if (mKeyRepeatState.nextRepeatTime < *nextWakeupTime) { - *nextWakeupTime = mKeyRepeatState.nextRepeatTime; - } - } - } - - // Nothing to do if there is no pending event. - if (!mPendingEvent) { - return; - } - } else { - // Inbound queue has at least one entry. - mPendingEvent = mInboundQueue.dequeueAtHead(); - traceInboundQueueLengthLocked(); - } - - // Poke user activity for this event. - if (mPendingEvent->policyFlags & POLICY_FLAG_PASS_TO_USER) { - pokeUserActivityLocked(mPendingEvent); - } - - // Get ready to dispatch the event. - resetANRTimeoutsLocked(); - } - - // Now we have an event to dispatch. - // All events are eventually dequeued and processed this way, even if we intend to drop them. - ALOG_ASSERT(mPendingEvent != NULL); - bool done = false; - DropReason dropReason = DROP_REASON_NOT_DROPPED; - if (!(mPendingEvent->policyFlags & POLICY_FLAG_PASS_TO_USER)) { - dropReason = DROP_REASON_POLICY; - } else if (!mDispatchEnabled) { - dropReason = DROP_REASON_DISABLED; - } - - if (mNextUnblockedEvent == mPendingEvent) { - mNextUnblockedEvent = NULL; - } - - switch (mPendingEvent->type) { - case EventEntry::TYPE_CONFIGURATION_CHANGED: { - ConfigurationChangedEntry* typedEntry = - static_cast(mPendingEvent); - done = dispatchConfigurationChangedLocked(currentTime, typedEntry); - dropReason = DROP_REASON_NOT_DROPPED; // configuration changes are never dropped - break; - } - - case EventEntry::TYPE_DEVICE_RESET: { - DeviceResetEntry* typedEntry = - static_cast(mPendingEvent); - done = dispatchDeviceResetLocked(currentTime, typedEntry); - dropReason = DROP_REASON_NOT_DROPPED; // device resets are never dropped - break; - } - - case EventEntry::TYPE_KEY: { - KeyEntry* typedEntry = static_cast(mPendingEvent); - if (isAppSwitchDue) { - if (isAppSwitchKeyEventLocked(typedEntry)) { - resetPendingAppSwitchLocked(true); - isAppSwitchDue = false; - } else if (dropReason == DROP_REASON_NOT_DROPPED) { - dropReason = DROP_REASON_APP_SWITCH; - } - } - if (dropReason == DROP_REASON_NOT_DROPPED - && isStaleEventLocked(currentTime, typedEntry)) { - dropReason = DROP_REASON_STALE; - } - if (dropReason == DROP_REASON_NOT_DROPPED && mNextUnblockedEvent) { - dropReason = DROP_REASON_BLOCKED; - } - done = dispatchKeyLocked(currentTime, typedEntry, &dropReason, nextWakeupTime); - break; - } - - case EventEntry::TYPE_MOTION: { - MotionEntry* typedEntry = static_cast(mPendingEvent); - if (dropReason == DROP_REASON_NOT_DROPPED && isAppSwitchDue) { - dropReason = DROP_REASON_APP_SWITCH; - } - if (dropReason == DROP_REASON_NOT_DROPPED - && isStaleEventLocked(currentTime, typedEntry)) { - dropReason = DROP_REASON_STALE; - } - if (dropReason == DROP_REASON_NOT_DROPPED && mNextUnblockedEvent) { - dropReason = DROP_REASON_BLOCKED; - } - done = dispatchMotionLocked(currentTime, typedEntry, - &dropReason, nextWakeupTime); - break; - } - - default: - ALOG_ASSERT(false); - break; - } - - if (done) { - if (dropReason != DROP_REASON_NOT_DROPPED) { - dropInboundEventLocked(mPendingEvent, dropReason); - } - mLastDropReason = dropReason; - - releasePendingEventLocked(); - *nextWakeupTime = LONG_LONG_MIN; // force next poll to wake up immediately - } -} - -bool InputDispatcher::enqueueInboundEventLocked(EventEntry* entry) { - bool needWake = mInboundQueue.isEmpty(); - mInboundQueue.enqueueAtTail(entry); - traceInboundQueueLengthLocked(); - - switch (entry->type) { - case EventEntry::TYPE_KEY: { - // Optimize app switch latency. - // If the application takes too long to catch up then we drop all events preceding - // the app switch key. - KeyEntry* keyEntry = static_cast(entry); - if (isAppSwitchKeyEventLocked(keyEntry)) { - if (keyEntry->action == AKEY_EVENT_ACTION_DOWN) { - mAppSwitchSawKeyDown = true; - } else if (keyEntry->action == AKEY_EVENT_ACTION_UP) { - if (mAppSwitchSawKeyDown) { -#if DEBUG_APP_SWITCH - ALOGD("App switch is pending!"); -#endif - mAppSwitchDueTime = keyEntry->eventTime + APP_SWITCH_TIMEOUT; - mAppSwitchSawKeyDown = false; - needWake = true; - } - } - } - break; - } - - case EventEntry::TYPE_MOTION: { - // Optimize case where the current application is unresponsive and the user - // decides to touch a window in a different application. - // If the application takes too long to catch up then we drop all events preceding - // the touch into the other window. - MotionEntry* motionEntry = static_cast(entry); - if (motionEntry->action == AMOTION_EVENT_ACTION_DOWN - && (motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) - && mInputTargetWaitCause == INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY - && mInputTargetWaitApplicationHandle != NULL) { - int32_t displayId = motionEntry->displayId; - int32_t x = int32_t(motionEntry->pointerCoords[0]. - getAxisValue(AMOTION_EVENT_AXIS_X)); - int32_t y = int32_t(motionEntry->pointerCoords[0]. - getAxisValue(AMOTION_EVENT_AXIS_Y)); - sp touchedWindowHandle = findTouchedWindowAtLocked(displayId, x, y); - if (touchedWindowHandle != NULL - && touchedWindowHandle->inputApplicationHandle - != mInputTargetWaitApplicationHandle) { - // User touched a different application than the one we are waiting on. - // Flag the event, and start pruning the input queue. - mNextUnblockedEvent = motionEntry; - needWake = true; - } - } - break; - } - } - - return needWake; -} - -void InputDispatcher::addRecentEventLocked(EventEntry* entry) { - entry->refCount += 1; - mRecentQueue.enqueueAtTail(entry); - if (mRecentQueue.count() > RECENT_QUEUE_MAX_SIZE) { - mRecentQueue.dequeueAtHead()->release(); - } -} - -sp InputDispatcher::findTouchedWindowAtLocked(int32_t displayId, - int32_t x, int32_t y) { - // Traverse windows from front to back to find touched window. - size_t numWindows = mWindowHandles.size(); - for (size_t i = 0; i < numWindows; i++) { - sp windowHandle = mWindowHandles.itemAt(i); - const InputWindowInfo* windowInfo = windowHandle->getInfo(); - if (windowInfo->displayId == displayId) { - int32_t flags = windowInfo->layoutParamsFlags; - - if (windowInfo->visible) { - if (!(flags & InputWindowInfo::FLAG_NOT_TOUCHABLE)) { - bool isTouchModal = (flags & (InputWindowInfo::FLAG_NOT_FOCUSABLE - | InputWindowInfo::FLAG_NOT_TOUCH_MODAL)) == 0; - if (isTouchModal || windowInfo->touchableRegionContainsPoint(x, y)) { - // Found window. - return windowHandle; - } - } - } - } - } - return NULL; -} - -void InputDispatcher::dropInboundEventLocked(EventEntry* entry, DropReason dropReason) { - const char* reason; - switch (dropReason) { - case DROP_REASON_POLICY: -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("Dropped event because policy consumed it."); -#endif - reason = "inbound event was dropped because the policy consumed it"; - break; - case DROP_REASON_DISABLED: - if (mLastDropReason != DROP_REASON_DISABLED) { - ALOGI("Dropped event because input dispatch is disabled."); - } - reason = "inbound event was dropped because input dispatch is disabled"; - break; - case DROP_REASON_APP_SWITCH: - ALOGI("Dropped event because of pending overdue app switch."); - reason = "inbound event was dropped because of pending overdue app switch"; - break; - case DROP_REASON_BLOCKED: - ALOGI("Dropped event because the current application is not responding and the user " - "has started interacting with a different application."); - reason = "inbound event was dropped because the current application is not responding " - "and the user has started interacting with a different application"; - break; - case DROP_REASON_STALE: - ALOGI("Dropped event because it is stale."); - reason = "inbound event was dropped because it is stale"; - break; - default: - ALOG_ASSERT(false); - return; - } - - switch (entry->type) { - case EventEntry::TYPE_KEY: { - CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, reason); - synthesizeCancelationEventsForAllConnectionsLocked(options); - break; - } - case EventEntry::TYPE_MOTION: { - MotionEntry* motionEntry = static_cast(entry); - if (motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) { - CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, reason); - synthesizeCancelationEventsForAllConnectionsLocked(options); - } else { - CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, reason); - synthesizeCancelationEventsForAllConnectionsLocked(options); - } - break; - } - } -} - -bool InputDispatcher::isAppSwitchKeyCode(int32_t keyCode) { - return keyCode == AKEYCODE_HOME - || keyCode == AKEYCODE_ENDCALL - || keyCode == AKEYCODE_APP_SWITCH; -} - -bool InputDispatcher::isAppSwitchKeyEventLocked(KeyEntry* keyEntry) { - return ! (keyEntry->flags & AKEY_EVENT_FLAG_CANCELED) - && isAppSwitchKeyCode(keyEntry->keyCode) - && (keyEntry->policyFlags & POLICY_FLAG_TRUSTED) - && (keyEntry->policyFlags & POLICY_FLAG_PASS_TO_USER); -} - -bool InputDispatcher::isAppSwitchPendingLocked() { - return mAppSwitchDueTime != LONG_LONG_MAX; -} - -void InputDispatcher::resetPendingAppSwitchLocked(bool handled) { - mAppSwitchDueTime = LONG_LONG_MAX; - -#if DEBUG_APP_SWITCH - if (handled) { - ALOGD("App switch has arrived."); - } else { - ALOGD("App switch was abandoned."); - } -#endif -} - -bool InputDispatcher::isStaleEventLocked(nsecs_t currentTime, EventEntry* entry) { - return currentTime - entry->eventTime >= STALE_EVENT_TIMEOUT; -} - -bool InputDispatcher::haveCommandsLocked() const { - return !mCommandQueue.isEmpty(); -} - -bool InputDispatcher::runCommandsLockedInterruptible() { - if (mCommandQueue.isEmpty()) { - return false; - } - - do { - CommandEntry* commandEntry = mCommandQueue.dequeueAtHead(); - - Command command = commandEntry->command; - (this->*command)(commandEntry); // commands are implicitly 'LockedInterruptible' - - commandEntry->connection.clear(); - delete commandEntry; - } while (! mCommandQueue.isEmpty()); - return true; -} - -InputDispatcher::CommandEntry* InputDispatcher::postCommandLocked(Command command) { - CommandEntry* commandEntry = new CommandEntry(command); - mCommandQueue.enqueueAtTail(commandEntry); - return commandEntry; -} - -void InputDispatcher::drainInboundQueueLocked() { - while (! mInboundQueue.isEmpty()) { - EventEntry* entry = mInboundQueue.dequeueAtHead(); - releaseInboundEventLocked(entry); - } - traceInboundQueueLengthLocked(); -} - -void InputDispatcher::releasePendingEventLocked() { - if (mPendingEvent) { - resetANRTimeoutsLocked(); - releaseInboundEventLocked(mPendingEvent); - mPendingEvent = NULL; - } -} - -void InputDispatcher::releaseInboundEventLocked(EventEntry* entry) { - InjectionState* injectionState = entry->injectionState; - if (injectionState && injectionState->injectionResult == INPUT_EVENT_INJECTION_PENDING) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("Injected inbound event was dropped."); -#endif - setInjectionResultLocked(entry, INPUT_EVENT_INJECTION_FAILED); - } - if (entry == mNextUnblockedEvent) { - mNextUnblockedEvent = NULL; - } - addRecentEventLocked(entry); - entry->release(); -} - -void InputDispatcher::resetKeyRepeatLocked() { - if (mKeyRepeatState.lastKeyEntry) { - mKeyRepeatState.lastKeyEntry->release(); - mKeyRepeatState.lastKeyEntry = NULL; - } -} - -InputDispatcher::KeyEntry* InputDispatcher::synthesizeKeyRepeatLocked(nsecs_t currentTime) { - KeyEntry* entry = mKeyRepeatState.lastKeyEntry; - - // Reuse the repeated key entry if it is otherwise unreferenced. - uint32_t policyFlags = entry->policyFlags & - (POLICY_FLAG_RAW_MASK | POLICY_FLAG_PASS_TO_USER | POLICY_FLAG_TRUSTED); - if (entry->refCount == 1) { - entry->recycle(); - entry->eventTime = currentTime; - entry->policyFlags = policyFlags; - entry->repeatCount += 1; - } else { - KeyEntry* newEntry = new KeyEntry(currentTime, - entry->deviceId, entry->source, policyFlags, - entry->action, entry->flags, entry->keyCode, entry->scanCode, - entry->metaState, entry->repeatCount + 1, entry->downTime); - - mKeyRepeatState.lastKeyEntry = newEntry; - entry->release(); - - entry = newEntry; - } - entry->syntheticRepeat = true; - - // Increment reference count since we keep a reference to the event in - // mKeyRepeatState.lastKeyEntry in addition to the one we return. - entry->refCount += 1; - - mKeyRepeatState.nextRepeatTime = currentTime + mConfig.keyRepeatDelay; - return entry; -} - -bool InputDispatcher::dispatchConfigurationChangedLocked( - nsecs_t currentTime, ConfigurationChangedEntry* entry) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("dispatchConfigurationChanged - eventTime=%lld", entry->eventTime); -#endif - - // Reset key repeating in case a keyboard device was added or removed or something. - resetKeyRepeatLocked(); - - // Enqueue a command to run outside the lock to tell the policy that the configuration changed. - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doNotifyConfigurationChangedInterruptible); - commandEntry->eventTime = entry->eventTime; - return true; -} - -bool InputDispatcher::dispatchDeviceResetLocked( - nsecs_t currentTime, DeviceResetEntry* entry) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("dispatchDeviceReset - eventTime=%lld, deviceId=%d", entry->eventTime, entry->deviceId); -#endif - - CancelationOptions options(CancelationOptions::CANCEL_ALL_EVENTS, - "device was reset"); - options.deviceId = entry->deviceId; - synthesizeCancelationEventsForAllConnectionsLocked(options); - return true; -} - -bool InputDispatcher::dispatchKeyLocked(nsecs_t currentTime, KeyEntry* entry, - DropReason* dropReason, nsecs_t* nextWakeupTime) { - // Preprocessing. - if (! entry->dispatchInProgress) { - if (entry->repeatCount == 0 - && entry->action == AKEY_EVENT_ACTION_DOWN - && (entry->policyFlags & POLICY_FLAG_TRUSTED) - && (!(entry->policyFlags & POLICY_FLAG_DISABLE_KEY_REPEAT))) { - if (mKeyRepeatState.lastKeyEntry - && mKeyRepeatState.lastKeyEntry->keyCode == entry->keyCode) { - // We have seen two identical key downs in a row which indicates that the device - // driver is automatically generating key repeats itself. We take note of the - // repeat here, but we disable our own next key repeat timer since it is clear that - // we will not need to synthesize key repeats ourselves. - entry->repeatCount = mKeyRepeatState.lastKeyEntry->repeatCount + 1; - resetKeyRepeatLocked(); - mKeyRepeatState.nextRepeatTime = LONG_LONG_MAX; // don't generate repeats ourselves - } else { - // Not a repeat. Save key down state in case we do see a repeat later. - resetKeyRepeatLocked(); - mKeyRepeatState.nextRepeatTime = entry->eventTime + mConfig.keyRepeatTimeout; - } - mKeyRepeatState.lastKeyEntry = entry; - entry->refCount += 1; - } else if (! entry->syntheticRepeat) { - resetKeyRepeatLocked(); - } - - if (entry->repeatCount == 1) { - entry->flags |= AKEY_EVENT_FLAG_LONG_PRESS; - } else { - entry->flags &= ~AKEY_EVENT_FLAG_LONG_PRESS; - } - - entry->dispatchInProgress = true; - - logOutboundKeyDetailsLocked("dispatchKey - ", entry); - } - - // Handle case where the policy asked us to try again later last time. - if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER) { - if (currentTime < entry->interceptKeyWakeupTime) { - if (entry->interceptKeyWakeupTime < *nextWakeupTime) { - *nextWakeupTime = entry->interceptKeyWakeupTime; - } - return false; // wait until next wakeup - } - entry->interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_UNKNOWN; - entry->interceptKeyWakeupTime = 0; - } - - // Give the policy a chance to intercept the key. - if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_UNKNOWN) { - if (entry->policyFlags & POLICY_FLAG_PASS_TO_USER) { - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doInterceptKeyBeforeDispatchingLockedInterruptible); - if (mFocusedWindowHandle != NULL) { - commandEntry->inputWindowHandle = mFocusedWindowHandle; - } - commandEntry->keyEntry = entry; - entry->refCount += 1; - return false; // wait for the command to run - } else { - entry->interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_CONTINUE; - } - } else if (entry->interceptKeyResult == KeyEntry::INTERCEPT_KEY_RESULT_SKIP) { - if (*dropReason == DROP_REASON_NOT_DROPPED) { - *dropReason = DROP_REASON_POLICY; - } - } - - // Clean up if dropping the event. - if (*dropReason != DROP_REASON_NOT_DROPPED) { - setInjectionResultLocked(entry, *dropReason == DROP_REASON_POLICY - ? INPUT_EVENT_INJECTION_SUCCEEDED : INPUT_EVENT_INJECTION_FAILED); - return true; - } - - // Identify targets. - Vector inputTargets; - int32_t injectionResult = findFocusedWindowTargetsLocked(currentTime, - entry, inputTargets, nextWakeupTime); - if (injectionResult == INPUT_EVENT_INJECTION_PENDING) { - return false; - } - - setInjectionResultLocked(entry, injectionResult); - if (injectionResult != INPUT_EVENT_INJECTION_SUCCEEDED) { - return true; - } - - addMonitoringTargetsLocked(inputTargets); - - // Dispatch the key. - dispatchEventLocked(currentTime, entry, inputTargets); - return true; -} - -void InputDispatcher::logOutboundKeyDetailsLocked(const char* prefix, const KeyEntry* entry) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, " - "action=0x%x, flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, " - "repeatCount=%d, downTime=%lld", - prefix, - entry->eventTime, entry->deviceId, entry->source, entry->policyFlags, - entry->action, entry->flags, entry->keyCode, entry->scanCode, entry->metaState, - entry->repeatCount, entry->downTime); -#endif -} - -bool InputDispatcher::dispatchMotionLocked( - nsecs_t currentTime, MotionEntry* entry, DropReason* dropReason, nsecs_t* nextWakeupTime) { - // Preprocessing. - if (! entry->dispatchInProgress) { - entry->dispatchInProgress = true; - - logOutboundMotionDetailsLocked("dispatchMotion - ", entry); - } - - // Clean up if dropping the event. - if (*dropReason != DROP_REASON_NOT_DROPPED) { - setInjectionResultLocked(entry, *dropReason == DROP_REASON_POLICY - ? INPUT_EVENT_INJECTION_SUCCEEDED : INPUT_EVENT_INJECTION_FAILED); - return true; - } - - bool isPointerEvent = entry->source & AINPUT_SOURCE_CLASS_POINTER; - - // Identify targets. - Vector inputTargets; - - bool conflictingPointerActions = false; - int32_t injectionResult; - if (isPointerEvent) { - // Pointer event. (eg. touchscreen) - injectionResult = findTouchedWindowTargetsLocked(currentTime, - entry, inputTargets, nextWakeupTime, &conflictingPointerActions); - } else { - // Non touch event. (eg. trackball) - injectionResult = findFocusedWindowTargetsLocked(currentTime, - entry, inputTargets, nextWakeupTime); - } - if (injectionResult == INPUT_EVENT_INJECTION_PENDING) { - return false; - } - - setInjectionResultLocked(entry, injectionResult); - if (injectionResult != INPUT_EVENT_INJECTION_SUCCEEDED) { - if (injectionResult != INPUT_EVENT_INJECTION_PERMISSION_DENIED) { - CancelationOptions::Mode mode(isPointerEvent ? - CancelationOptions::CANCEL_POINTER_EVENTS : - CancelationOptions::CANCEL_NON_POINTER_EVENTS); - CancelationOptions options(mode, "input event injection failed"); - synthesizeCancelationEventsForMonitorsLocked(options); - } - return true; - } - - // TODO: support sending secondary display events to input monitors - if (isMainDisplay(entry->displayId)) { - addMonitoringTargetsLocked(inputTargets); - } - - // Dispatch the motion. - if (conflictingPointerActions) { - CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, - "conflicting pointer actions"); - synthesizeCancelationEventsForAllConnectionsLocked(options); - } - dispatchEventLocked(currentTime, entry, inputTargets); - return true; -} - - -void InputDispatcher::logOutboundMotionDetailsLocked(const char* prefix, const MotionEntry* entry) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("%seventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, " - "action=0x%x, actionButton=0x%x, flags=0x%x, " - "metaState=0x%x, buttonState=0x%x," - "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld", - prefix, - entry->eventTime, entry->deviceId, entry->source, entry->policyFlags, - entry->action, entry->actionButton, entry->flags, - entry->metaState, entry->buttonState, - entry->edgeFlags, entry->xPrecision, entry->yPrecision, - entry->downTime); - - for (uint32_t i = 0; i < entry->pointerCount; i++) { - ALOGD(" Pointer %d: id=%d, toolType=%d, " - "x=%f, y=%f, pressure=%f, size=%f, " - "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, " - "orientation=%f", - i, entry->pointerProperties[i].id, - entry->pointerProperties[i].toolType, - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_SIZE), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), - entry->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION)); - } -#endif -} - -void InputDispatcher::dispatchEventLocked(nsecs_t currentTime, - EventEntry* eventEntry, const Vector& inputTargets) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("dispatchEventToCurrentInputTargets"); -#endif - - ALOG_ASSERT(eventEntry->dispatchInProgress); // should already have been set to true - - pokeUserActivityLocked(eventEntry); - - for (size_t i = 0; i < inputTargets.size(); i++) { - const InputTarget& inputTarget = inputTargets.itemAt(i); - - ssize_t connectionIndex = getConnectionIndexLocked(inputTarget.inputChannel); - if (connectionIndex >= 0) { - sp connection = mConnectionsByFd.valueAt(connectionIndex); - prepareDispatchCycleLocked(currentTime, connection, eventEntry, &inputTarget); - } else { -#if DEBUG_FOCUS - ALOGD("Dropping event delivery to target with channel '%s' because it " - "is no longer registered with the input dispatcher.", - inputTarget.inputChannel->getName().string()); -#endif - } - } -} - -int32_t InputDispatcher::handleTargetsNotReadyLocked(nsecs_t currentTime, - const EventEntry* entry, - const sp& applicationHandle, - const sp& windowHandle, - nsecs_t* nextWakeupTime, const char* reason) { - if (applicationHandle == NULL && windowHandle == NULL) { - if (mInputTargetWaitCause != INPUT_TARGET_WAIT_CAUSE_SYSTEM_NOT_READY) { -#if DEBUG_FOCUS - ALOGD("Waiting for system to become ready for input. Reason: %s", reason); -#endif - mInputTargetWaitCause = INPUT_TARGET_WAIT_CAUSE_SYSTEM_NOT_READY; - mInputTargetWaitStartTime = currentTime; - mInputTargetWaitTimeoutTime = LONG_LONG_MAX; - mInputTargetWaitTimeoutExpired = false; - mInputTargetWaitApplicationHandle.clear(); - } - } else { - if (mInputTargetWaitCause != INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY) { -#if DEBUG_FOCUS - ALOGD("Waiting for application to become ready for input: %s. Reason: %s", - getApplicationWindowLabelLocked(applicationHandle, windowHandle).string(), - reason); -#endif - nsecs_t timeout; - if (windowHandle != NULL) { - timeout = windowHandle->getDispatchingTimeout(DEFAULT_INPUT_DISPATCHING_TIMEOUT); - } else if (applicationHandle != NULL) { - timeout = applicationHandle->getDispatchingTimeout( - DEFAULT_INPUT_DISPATCHING_TIMEOUT); - } else { - timeout = DEFAULT_INPUT_DISPATCHING_TIMEOUT; - } - - mInputTargetWaitCause = INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY; - mInputTargetWaitStartTime = currentTime; - mInputTargetWaitTimeoutTime = currentTime + timeout; - mInputTargetWaitTimeoutExpired = false; - mInputTargetWaitApplicationHandle.clear(); - - if (windowHandle != NULL) { - mInputTargetWaitApplicationHandle = windowHandle->inputApplicationHandle; - } - if (mInputTargetWaitApplicationHandle == NULL && applicationHandle != NULL) { - mInputTargetWaitApplicationHandle = applicationHandle; - } - } - } - - if (mInputTargetWaitTimeoutExpired) { - return INPUT_EVENT_INJECTION_TIMED_OUT; - } - - if (currentTime >= mInputTargetWaitTimeoutTime) { - onANRLocked(currentTime, applicationHandle, windowHandle, - entry->eventTime, mInputTargetWaitStartTime, reason); - - // Force poll loop to wake up immediately on next iteration once we get the - // ANR response back from the policy. - *nextWakeupTime = LONG_LONG_MIN; - return INPUT_EVENT_INJECTION_PENDING; - } else { - // Force poll loop to wake up when timeout is due. - if (mInputTargetWaitTimeoutTime < *nextWakeupTime) { - *nextWakeupTime = mInputTargetWaitTimeoutTime; - } - return INPUT_EVENT_INJECTION_PENDING; - } -} - -void InputDispatcher::resumeAfterTargetsNotReadyTimeoutLocked(nsecs_t newTimeout, - const sp& inputChannel) { - if (newTimeout > 0) { - // Extend the timeout. - mInputTargetWaitTimeoutTime = now() + newTimeout; - } else { - // Give up. - mInputTargetWaitTimeoutExpired = true; - - // Input state will not be realistic. Mark it out of sync. - if (inputChannel.get()) { - ssize_t connectionIndex = getConnectionIndexLocked(inputChannel); - if (connectionIndex >= 0) { - sp connection = mConnectionsByFd.valueAt(connectionIndex); - sp windowHandle = connection->inputWindowHandle; - - if (windowHandle != NULL) { - const InputWindowInfo* info = windowHandle->getInfo(); - if (info) { - ssize_t stateIndex = mTouchStatesByDisplay.indexOfKey(info->displayId); - if (stateIndex >= 0) { - mTouchStatesByDisplay.editValueAt(stateIndex).removeWindow( - windowHandle); - } - } - } - - if (connection->status == Connection::STATUS_NORMAL) { - CancelationOptions options(CancelationOptions::CANCEL_ALL_EVENTS, - "application not responding"); - synthesizeCancelationEventsForConnectionLocked(connection, options); - } - } - } - } -} - -nsecs_t InputDispatcher::getTimeSpentWaitingForApplicationLocked( - nsecs_t currentTime) { - if (mInputTargetWaitCause == INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY) { - return currentTime - mInputTargetWaitStartTime; - } - return 0; -} - -void InputDispatcher::resetANRTimeoutsLocked() { -#if DEBUG_FOCUS - ALOGD("Resetting ANR timeouts."); -#endif - - // Reset input target wait timeout. - mInputTargetWaitCause = INPUT_TARGET_WAIT_CAUSE_NONE; - mInputTargetWaitApplicationHandle.clear(); -} - -int32_t InputDispatcher::findFocusedWindowTargetsLocked(nsecs_t currentTime, - const EventEntry* entry, Vector& inputTargets, nsecs_t* nextWakeupTime) { - int32_t injectionResult; - String8 reason; - - // If there is no currently focused window and no focused application - // then drop the event. - if (mFocusedWindowHandle == NULL) { - if (mFocusedApplicationHandle != NULL) { - injectionResult = handleTargetsNotReadyLocked(currentTime, entry, - mFocusedApplicationHandle, NULL, nextWakeupTime, - "Waiting because no window has focus but there is a " - "focused application that may eventually add a window " - "when it finishes starting up."); - goto Unresponsive; - } - - ALOGI("Dropping event because there is no focused window or focused application."); - injectionResult = INPUT_EVENT_INJECTION_FAILED; - goto Failed; - } - - // Check permissions. - if (! checkInjectionPermission(mFocusedWindowHandle, entry->injectionState)) { - injectionResult = INPUT_EVENT_INJECTION_PERMISSION_DENIED; - goto Failed; - } - - // Check whether the window is ready for more input. - reason = checkWindowReadyForMoreInputLocked(currentTime, - mFocusedWindowHandle, entry, "focused"); - if (!reason.isEmpty()) { - injectionResult = handleTargetsNotReadyLocked(currentTime, entry, - mFocusedApplicationHandle, mFocusedWindowHandle, nextWakeupTime, reason.string()); - goto Unresponsive; - } - - // Success! Output targets. - injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED; - addWindowTargetLocked(mFocusedWindowHandle, - InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS, BitSet32(0), - inputTargets); - - // Done. -Failed: -Unresponsive: - nsecs_t timeSpentWaitingForApplication = getTimeSpentWaitingForApplicationLocked(currentTime); - updateDispatchStatisticsLocked(currentTime, entry, - injectionResult, timeSpentWaitingForApplication); -#if DEBUG_FOCUS - ALOGD("findFocusedWindow finished: injectionResult=%d, " - "timeSpentWaitingForApplication=%0.1fms", - injectionResult, timeSpentWaitingForApplication / 1000000.0); -#endif - return injectionResult; -} - -int32_t InputDispatcher::findTouchedWindowTargetsLocked(nsecs_t currentTime, - const MotionEntry* entry, Vector& inputTargets, nsecs_t* nextWakeupTime, - bool* outConflictingPointerActions) { - enum InjectionPermission { - INJECTION_PERMISSION_UNKNOWN, - INJECTION_PERMISSION_GRANTED, - INJECTION_PERMISSION_DENIED - }; - - nsecs_t startTime = now(); - - // For security reasons, we defer updating the touch state until we are sure that - // event injection will be allowed. - int32_t displayId = entry->displayId; - int32_t action = entry->action; - int32_t maskedAction = action & AMOTION_EVENT_ACTION_MASK; - - // Update the touch state as needed based on the properties of the touch event. - int32_t injectionResult = INPUT_EVENT_INJECTION_PENDING; - InjectionPermission injectionPermission = INJECTION_PERMISSION_UNKNOWN; - sp newHoverWindowHandle; - - // Copy current touch state into mTempTouchState. - // This state is always reset at the end of this function, so if we don't find state - // for the specified display then our initial state will be empty. - const TouchState* oldState = NULL; - ssize_t oldStateIndex = mTouchStatesByDisplay.indexOfKey(displayId); - if (oldStateIndex >= 0) { - oldState = &mTouchStatesByDisplay.valueAt(oldStateIndex); - mTempTouchState.copyFrom(*oldState); - } - - bool isSplit = mTempTouchState.split; - bool switchedDevice = mTempTouchState.deviceId >= 0 && mTempTouchState.displayId >= 0 - && (mTempTouchState.deviceId != entry->deviceId - || mTempTouchState.source != entry->source - || mTempTouchState.displayId != displayId); - bool isHoverAction = (maskedAction == AMOTION_EVENT_ACTION_HOVER_MOVE - || maskedAction == AMOTION_EVENT_ACTION_HOVER_ENTER - || maskedAction == AMOTION_EVENT_ACTION_HOVER_EXIT); - bool newGesture = (maskedAction == AMOTION_EVENT_ACTION_DOWN - || maskedAction == AMOTION_EVENT_ACTION_SCROLL - || isHoverAction); - bool wrongDevice = false; - if (newGesture) { - bool down = maskedAction == AMOTION_EVENT_ACTION_DOWN; - if (switchedDevice && mTempTouchState.down && !down) { -#if DEBUG_FOCUS - ALOGD("Dropping event because a pointer for a different device is already down."); -#endif - injectionResult = INPUT_EVENT_INJECTION_FAILED; - switchedDevice = false; - wrongDevice = true; - goto Failed; - } - mTempTouchState.reset(); - mTempTouchState.down = down; - mTempTouchState.deviceId = entry->deviceId; - mTempTouchState.source = entry->source; - mTempTouchState.displayId = displayId; - isSplit = false; - } - - if (newGesture || (isSplit && maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN)) { - /* Case 1: New splittable pointer going down, or need target for hover or scroll. */ - - int32_t pointerIndex = getMotionEventActionPointerIndex(action); - int32_t x = int32_t(entry->pointerCoords[pointerIndex]. - getAxisValue(AMOTION_EVENT_AXIS_X)); - int32_t y = int32_t(entry->pointerCoords[pointerIndex]. - getAxisValue(AMOTION_EVENT_AXIS_Y)); - sp newTouchedWindowHandle; - bool isTouchModal = false; - - // Traverse windows from front to back to find touched window and outside targets. - size_t numWindows = mWindowHandles.size(); - for (size_t i = 0; i < numWindows; i++) { - sp windowHandle = mWindowHandles.itemAt(i); - const InputWindowInfo* windowInfo = windowHandle->getInfo(); - if (windowInfo->displayId != displayId) { - continue; // wrong display - } - - int32_t flags = windowInfo->layoutParamsFlags; - if (windowInfo->visible) { - if (! (flags & InputWindowInfo::FLAG_NOT_TOUCHABLE)) { - isTouchModal = (flags & (InputWindowInfo::FLAG_NOT_FOCUSABLE - | InputWindowInfo::FLAG_NOT_TOUCH_MODAL)) == 0; - if (isTouchModal || windowInfo->touchableRegionContainsPoint(x, y)) { - newTouchedWindowHandle = windowHandle; - break; // found touched window, exit window loop - } - } - - if (maskedAction == AMOTION_EVENT_ACTION_DOWN - && (flags & InputWindowInfo::FLAG_WATCH_OUTSIDE_TOUCH)) { - int32_t outsideTargetFlags = InputTarget::FLAG_DISPATCH_AS_OUTSIDE; - if (isWindowObscuredAtPointLocked(windowHandle, x, y)) { - outsideTargetFlags |= InputTarget::FLAG_WINDOW_IS_OBSCURED; - } - - mTempTouchState.addOrUpdateWindow( - windowHandle, outsideTargetFlags, BitSet32(0)); - } - } - } - - // Figure out whether splitting will be allowed for this window. - if (newTouchedWindowHandle != NULL - && newTouchedWindowHandle->getInfo()->supportsSplitTouch()) { - // New window supports splitting. - isSplit = true; - } else if (isSplit) { - // New window does not support splitting but we have already split events. - // Ignore the new window. - newTouchedWindowHandle = NULL; - } - - // Handle the case where we did not find a window. - if (newTouchedWindowHandle == NULL) { - // Try to assign the pointer to the first foreground window we find, if there is one. - newTouchedWindowHandle = mTempTouchState.getFirstForegroundWindowHandle(); - if (newTouchedWindowHandle == NULL) { - ALOGI("Dropping event because there is no touchable window at (%d, %d).", x, y); - injectionResult = INPUT_EVENT_INJECTION_FAILED; - goto Failed; - } - } - - // Set target flags. - int32_t targetFlags = InputTarget::FLAG_FOREGROUND | InputTarget::FLAG_DISPATCH_AS_IS; - if (isSplit) { - targetFlags |= InputTarget::FLAG_SPLIT; - } - if (isWindowObscuredAtPointLocked(newTouchedWindowHandle, x, y)) { - targetFlags |= InputTarget::FLAG_WINDOW_IS_OBSCURED; - } - - // Update hover state. - if (isHoverAction) { - newHoverWindowHandle = newTouchedWindowHandle; - } else if (maskedAction == AMOTION_EVENT_ACTION_SCROLL) { - newHoverWindowHandle = mLastHoverWindowHandle; - } - - // Update the temporary touch state. - BitSet32 pointerIds; - if (isSplit) { - uint32_t pointerId = entry->pointerProperties[pointerIndex].id; - pointerIds.markBit(pointerId); - } - mTempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds); - } else { - /* Case 2: Pointer move, up, cancel or non-splittable pointer down. */ - - // If the pointer is not currently down, then ignore the event. - if (! mTempTouchState.down) { -#if DEBUG_FOCUS - ALOGD("Dropping event because the pointer is not down or we previously " - "dropped the pointer down event."); -#endif - injectionResult = INPUT_EVENT_INJECTION_FAILED; - goto Failed; - } - - // Check whether touches should slip outside of the current foreground window. - if (maskedAction == AMOTION_EVENT_ACTION_MOVE - && entry->pointerCount == 1 - && mTempTouchState.isSlippery()) { - int32_t x = int32_t(entry->pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X)); - int32_t y = int32_t(entry->pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y)); - - sp oldTouchedWindowHandle = - mTempTouchState.getFirstForegroundWindowHandle(); - sp newTouchedWindowHandle = - findTouchedWindowAtLocked(displayId, x, y); - if (oldTouchedWindowHandle != newTouchedWindowHandle - && newTouchedWindowHandle != NULL) { -#if DEBUG_FOCUS - ALOGD("Touch is slipping out of window %s into window %s.", - oldTouchedWindowHandle->getName().string(), - newTouchedWindowHandle->getName().string()); -#endif - // Make a slippery exit from the old window. - mTempTouchState.addOrUpdateWindow(oldTouchedWindowHandle, - InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT, BitSet32(0)); - - // Make a slippery entrance into the new window. - if (newTouchedWindowHandle->getInfo()->supportsSplitTouch()) { - isSplit = true; - } - - int32_t targetFlags = InputTarget::FLAG_FOREGROUND - | InputTarget::FLAG_DISPATCH_AS_SLIPPERY_ENTER; - if (isSplit) { - targetFlags |= InputTarget::FLAG_SPLIT; - } - if (isWindowObscuredAtPointLocked(newTouchedWindowHandle, x, y)) { - targetFlags |= InputTarget::FLAG_WINDOW_IS_OBSCURED; - } - - BitSet32 pointerIds; - if (isSplit) { - pointerIds.markBit(entry->pointerProperties[0].id); - } - mTempTouchState.addOrUpdateWindow(newTouchedWindowHandle, targetFlags, pointerIds); - } - } - } - - if (newHoverWindowHandle != mLastHoverWindowHandle) { - // Let the previous window know that the hover sequence is over. - if (mLastHoverWindowHandle != NULL) { -#if DEBUG_HOVER - ALOGD("Sending hover exit event to window %s.", - mLastHoverWindowHandle->getName().string()); -#endif - mTempTouchState.addOrUpdateWindow(mLastHoverWindowHandle, - InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT, BitSet32(0)); - } - - // Let the new window know that the hover sequence is starting. - if (newHoverWindowHandle != NULL) { -#if DEBUG_HOVER - ALOGD("Sending hover enter event to window %s.", - newHoverWindowHandle->getName().string()); -#endif - mTempTouchState.addOrUpdateWindow(newHoverWindowHandle, - InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER, BitSet32(0)); - } - } - - // Check permission to inject into all touched foreground windows and ensure there - // is at least one touched foreground window. - { - bool haveForegroundWindow = false; - for (size_t i = 0; i < mTempTouchState.windows.size(); i++) { - const TouchedWindow& touchedWindow = mTempTouchState.windows[i]; - if (touchedWindow.targetFlags & InputTarget::FLAG_FOREGROUND) { - haveForegroundWindow = true; - if (! checkInjectionPermission(touchedWindow.windowHandle, - entry->injectionState)) { - injectionResult = INPUT_EVENT_INJECTION_PERMISSION_DENIED; - injectionPermission = INJECTION_PERMISSION_DENIED; - goto Failed; - } - } - } - if (! haveForegroundWindow) { -#if DEBUG_FOCUS - ALOGD("Dropping event because there is no touched foreground window to receive it."); -#endif - injectionResult = INPUT_EVENT_INJECTION_FAILED; - goto Failed; - } - - // Permission granted to injection into all touched foreground windows. - injectionPermission = INJECTION_PERMISSION_GRANTED; - } - - // Check whether windows listening for outside touches are owned by the same UID. If it is - // set the policy flag that we will not reveal coordinate information to this window. - if (maskedAction == AMOTION_EVENT_ACTION_DOWN) { - sp foregroundWindowHandle = - mTempTouchState.getFirstForegroundWindowHandle(); - const int32_t foregroundWindowUid = foregroundWindowHandle->getInfo()->ownerUid; - for (size_t i = 0; i < mTempTouchState.windows.size(); i++) { - const TouchedWindow& touchedWindow = mTempTouchState.windows[i]; - if (touchedWindow.targetFlags & InputTarget::FLAG_DISPATCH_AS_OUTSIDE) { - sp inputWindowHandle = touchedWindow.windowHandle; - if (inputWindowHandle->getInfo()->ownerUid != foregroundWindowUid) { - mTempTouchState.addOrUpdateWindow(inputWindowHandle, - InputTarget::FLAG_ZERO_COORDS, BitSet32(0)); - } - } - } - } - - // Ensure all touched foreground windows are ready for new input. - for (size_t i = 0; i < mTempTouchState.windows.size(); i++) { - const TouchedWindow& touchedWindow = mTempTouchState.windows[i]; - if (touchedWindow.targetFlags & InputTarget::FLAG_FOREGROUND) { - // Check whether the window is ready for more input. - String8 reason = checkWindowReadyForMoreInputLocked(currentTime, - touchedWindow.windowHandle, entry, "touched"); - if (!reason.isEmpty()) { - injectionResult = handleTargetsNotReadyLocked(currentTime, entry, - NULL, touchedWindow.windowHandle, nextWakeupTime, reason.string()); - goto Unresponsive; - } - } - } - - // If this is the first pointer going down and the touched window has a wallpaper - // then also add the touched wallpaper windows so they are locked in for the duration - // of the touch gesture. - // We do not collect wallpapers during HOVER_MOVE or SCROLL because the wallpaper - // engine only supports touch events. We would need to add a mechanism similar - // to View.onGenericMotionEvent to enable wallpapers to handle these events. - if (maskedAction == AMOTION_EVENT_ACTION_DOWN) { - sp foregroundWindowHandle = - mTempTouchState.getFirstForegroundWindowHandle(); - if (foregroundWindowHandle->getInfo()->hasWallpaper) { - for (size_t i = 0; i < mWindowHandles.size(); i++) { - sp windowHandle = mWindowHandles.itemAt(i); - const InputWindowInfo* info = windowHandle->getInfo(); - if (info->displayId == displayId - && windowHandle->getInfo()->layoutParamsType - == InputWindowInfo::TYPE_WALLPAPER) { - mTempTouchState.addOrUpdateWindow(windowHandle, - InputTarget::FLAG_WINDOW_IS_OBSCURED - | InputTarget::FLAG_DISPATCH_AS_IS, - BitSet32(0)); - } - } - } - } - - // Success! Output targets. - injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED; - - for (size_t i = 0; i < mTempTouchState.windows.size(); i++) { - const TouchedWindow& touchedWindow = mTempTouchState.windows.itemAt(i); - addWindowTargetLocked(touchedWindow.windowHandle, touchedWindow.targetFlags, - touchedWindow.pointerIds, inputTargets); - } - - // Drop the outside or hover touch windows since we will not care about them - // in the next iteration. - mTempTouchState.filterNonAsIsTouchWindows(); - -Failed: - // Check injection permission once and for all. - if (injectionPermission == INJECTION_PERMISSION_UNKNOWN) { - if (checkInjectionPermission(NULL, entry->injectionState)) { - injectionPermission = INJECTION_PERMISSION_GRANTED; - } else { - injectionPermission = INJECTION_PERMISSION_DENIED; - } - } - - // Update final pieces of touch state if the injector had permission. - if (injectionPermission == INJECTION_PERMISSION_GRANTED) { - if (!wrongDevice) { - if (switchedDevice) { -#if DEBUG_FOCUS - ALOGD("Conflicting pointer actions: Switched to a different device."); -#endif - *outConflictingPointerActions = true; - } - - if (isHoverAction) { - // Started hovering, therefore no longer down. - if (oldState && oldState->down) { -#if DEBUG_FOCUS - ALOGD("Conflicting pointer actions: Hover received while pointer was down."); -#endif - *outConflictingPointerActions = true; - } - mTempTouchState.reset(); - if (maskedAction == AMOTION_EVENT_ACTION_HOVER_ENTER - || maskedAction == AMOTION_EVENT_ACTION_HOVER_MOVE) { - mTempTouchState.deviceId = entry->deviceId; - mTempTouchState.source = entry->source; - mTempTouchState.displayId = displayId; - } - } else if (maskedAction == AMOTION_EVENT_ACTION_UP - || maskedAction == AMOTION_EVENT_ACTION_CANCEL) { - // All pointers up or canceled. - mTempTouchState.reset(); - } else if (maskedAction == AMOTION_EVENT_ACTION_DOWN) { - // First pointer went down. - if (oldState && oldState->down) { -#if DEBUG_FOCUS - ALOGD("Conflicting pointer actions: Down received while already down."); -#endif - *outConflictingPointerActions = true; - } - } else if (maskedAction == AMOTION_EVENT_ACTION_POINTER_UP) { - // One pointer went up. - if (isSplit) { - int32_t pointerIndex = getMotionEventActionPointerIndex(action); - uint32_t pointerId = entry->pointerProperties[pointerIndex].id; - - for (size_t i = 0; i < mTempTouchState.windows.size(); ) { - TouchedWindow& touchedWindow = mTempTouchState.windows.editItemAt(i); - if (touchedWindow.targetFlags & InputTarget::FLAG_SPLIT) { - touchedWindow.pointerIds.clearBit(pointerId); - if (touchedWindow.pointerIds.isEmpty()) { - mTempTouchState.windows.removeAt(i); - continue; - } - } - i += 1; - } - } - } - - // Save changes unless the action was scroll in which case the temporary touch - // state was only valid for this one action. - if (maskedAction != AMOTION_EVENT_ACTION_SCROLL) { - if (mTempTouchState.displayId >= 0) { - if (oldStateIndex >= 0) { - mTouchStatesByDisplay.editValueAt(oldStateIndex).copyFrom(mTempTouchState); - } else { - mTouchStatesByDisplay.add(displayId, mTempTouchState); - } - } else if (oldStateIndex >= 0) { - mTouchStatesByDisplay.removeItemsAt(oldStateIndex); - } - } - - // Update hover state. - mLastHoverWindowHandle = newHoverWindowHandle; - } - } else { -#if DEBUG_FOCUS - ALOGD("Not updating touch focus because injection was denied."); -#endif - } - -Unresponsive: - // Reset temporary touch state to ensure we release unnecessary references to input channels. - mTempTouchState.reset(); - - nsecs_t timeSpentWaitingForApplication = getTimeSpentWaitingForApplicationLocked(currentTime); - updateDispatchStatisticsLocked(currentTime, entry, - injectionResult, timeSpentWaitingForApplication); -#if DEBUG_FOCUS - ALOGD("findTouchedWindow finished: injectionResult=%d, injectionPermission=%d, " - "timeSpentWaitingForApplication=%0.1fms", - injectionResult, injectionPermission, timeSpentWaitingForApplication / 1000000.0); -#endif - return injectionResult; -} - -void InputDispatcher::addWindowTargetLocked(const sp& windowHandle, - int32_t targetFlags, BitSet32 pointerIds, Vector& inputTargets) { - inputTargets.push(); - - const InputWindowInfo* windowInfo = windowHandle->getInfo(); - InputTarget& target = inputTargets.editTop(); - target.inputChannel = windowInfo->inputChannel; - target.flags = targetFlags; - target.xOffset = - windowInfo->frameLeft; - target.yOffset = - windowInfo->frameTop; - target.scaleFactor = windowInfo->scaleFactor; - target.pointerIds = pointerIds; -} - -void InputDispatcher::addMonitoringTargetsLocked(Vector& inputTargets) { - for (size_t i = 0; i < mMonitoringChannels.size(); i++) { - inputTargets.push(); - - InputTarget& target = inputTargets.editTop(); - target.inputChannel = mMonitoringChannels[i]; - target.flags = InputTarget::FLAG_DISPATCH_AS_IS; - target.xOffset = 0; - target.yOffset = 0; - target.pointerIds.clear(); - target.scaleFactor = 1.0f; - } -} - -bool InputDispatcher::checkInjectionPermission(const sp& windowHandle, - const InjectionState* injectionState) { - if (injectionState - && (windowHandle == NULL - || windowHandle->getInfo()->ownerUid != injectionState->injectorUid) - && !hasInjectionPermission(injectionState->injectorPid, injectionState->injectorUid)) { - if (windowHandle != NULL) { - ALOGW("Permission denied: injecting event from pid %d uid %d to window %s " - "owned by uid %d", - injectionState->injectorPid, injectionState->injectorUid, - windowHandle->getName().string(), - windowHandle->getInfo()->ownerUid); - } else { - ALOGW("Permission denied: injecting event from pid %d uid %d", - injectionState->injectorPid, injectionState->injectorUid); - } - return false; - } - return true; -} - -bool InputDispatcher::isWindowObscuredAtPointLocked( - const sp& windowHandle, int32_t x, int32_t y) const { - int32_t displayId = windowHandle->getInfo()->displayId; - size_t numWindows = mWindowHandles.size(); - for (size_t i = 0; i < numWindows; i++) { - sp otherHandle = mWindowHandles.itemAt(i); - if (otherHandle == windowHandle) { - break; - } - - const InputWindowInfo* otherInfo = otherHandle->getInfo(); - if (otherInfo->displayId == displayId - && otherInfo->visible && !otherInfo->isTrustedOverlay() - && otherInfo->frameContainsPoint(x, y)) { - return true; - } - } - return false; -} - -String8 InputDispatcher::checkWindowReadyForMoreInputLocked(nsecs_t currentTime, - const sp& windowHandle, const EventEntry* eventEntry, - const char* targetType) { - // If the window is paused then keep waiting. - if (windowHandle->getInfo()->paused) { - return String8::format("Waiting because the %s window is paused.", targetType); - } - - // If the window's connection is not registered then keep waiting. - ssize_t connectionIndex = getConnectionIndexLocked(windowHandle->getInputChannel()); - if (connectionIndex < 0) { - return String8::format("Waiting because the %s window's input channel is not " - "registered with the input dispatcher. The window may be in the process " - "of being removed.", targetType); - } - - // If the connection is dead then keep waiting. - sp connection = mConnectionsByFd.valueAt(connectionIndex); - if (connection->status != Connection::STATUS_NORMAL) { - return String8::format("Waiting because the %s window's input connection is %s." - "The window may be in the process of being removed.", targetType, - connection->getStatusLabel()); - } - - // If the connection is backed up then keep waiting. - if (connection->inputPublisherBlocked) { - return String8::format("Waiting because the %s window's input channel is full. " - "Outbound queue length: %d. Wait queue length: %d.", - targetType, connection->outboundQueue.count(), connection->waitQueue.count()); - } - - // Ensure that the dispatch queues aren't too far backed up for this event. - if (eventEntry->type == EventEntry::TYPE_KEY) { - // If the event is a key event, then we must wait for all previous events to - // complete before delivering it because previous events may have the - // side-effect of transferring focus to a different window and we want to - // ensure that the following keys are sent to the new window. - // - // Suppose the user touches a button in a window then immediately presses "A". - // If the button causes a pop-up window to appear then we want to ensure that - // the "A" key is delivered to the new pop-up window. This is because users - // often anticipate pending UI changes when typing on a keyboard. - // To obtain this behavior, we must serialize key events with respect to all - // prior input events. - if (!connection->outboundQueue.isEmpty() || !connection->waitQueue.isEmpty()) { - return String8::format("Waiting to send key event because the %s window has not " - "finished processing all of the input events that were previously " - "delivered to it. Outbound queue length: %d. Wait queue length: %d.", - targetType, connection->outboundQueue.count(), connection->waitQueue.count()); - } - } else { - // Touch events can always be sent to a window immediately because the user intended - // to touch whatever was visible at the time. Even if focus changes or a new - // window appears moments later, the touch event was meant to be delivered to - // whatever window happened to be on screen at the time. - // - // Generic motion events, such as trackball or joystick events are a little trickier. - // Like key events, generic motion events are delivered to the focused window. - // Unlike key events, generic motion events don't tend to transfer focus to other - // windows and it is not important for them to be serialized. So we prefer to deliver - // generic motion events as soon as possible to improve efficiency and reduce lag - // through batching. - // - // The one case where we pause input event delivery is when the wait queue is piling - // up with lots of events because the application is not responding. - // This condition ensures that ANRs are detected reliably. - if (!connection->waitQueue.isEmpty() - && currentTime >= connection->waitQueue.head->deliveryTime - + STREAM_AHEAD_EVENT_TIMEOUT) { - return String8::format("Waiting to send non-key event because the %s window has not " - "finished processing certain input events that were delivered to it over " - "%0.1fms ago. Wait queue length: %d. Wait queue head age: %0.1fms.", - targetType, STREAM_AHEAD_EVENT_TIMEOUT * 0.000001f, - connection->waitQueue.count(), - (currentTime - connection->waitQueue.head->deliveryTime) * 0.000001f); - } - } - return String8::empty(); -} - -String8 InputDispatcher::getApplicationWindowLabelLocked( - const sp& applicationHandle, - const sp& windowHandle) { - if (applicationHandle != NULL) { - if (windowHandle != NULL) { - String8 label(applicationHandle->getName()); - label.append(" - "); - label.append(windowHandle->getName()); - return label; - } else { - return applicationHandle->getName(); - } - } else if (windowHandle != NULL) { - return windowHandle->getName(); - } else { - return String8(""); - } -} - -void InputDispatcher::pokeUserActivityLocked(const EventEntry* eventEntry) { - if (mFocusedWindowHandle != NULL) { - const InputWindowInfo* info = mFocusedWindowHandle->getInfo(); - if (info->inputFeatures & InputWindowInfo::INPUT_FEATURE_DISABLE_USER_ACTIVITY) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("Not poking user activity: disabled by window '%s'.", info->name.string()); -#endif - return; - } - } - - int32_t eventType = USER_ACTIVITY_EVENT_OTHER; - switch (eventEntry->type) { - case EventEntry::TYPE_MOTION: { - const MotionEntry* motionEntry = static_cast(eventEntry); - if (motionEntry->action == AMOTION_EVENT_ACTION_CANCEL) { - return; - } - - if (MotionEvent::isTouchEvent(motionEntry->source, motionEntry->action)) { - eventType = USER_ACTIVITY_EVENT_TOUCH; - } - break; - } - case EventEntry::TYPE_KEY: { - const KeyEntry* keyEntry = static_cast(eventEntry); - if (keyEntry->flags & AKEY_EVENT_FLAG_CANCELED) { - return; - } - eventType = USER_ACTIVITY_EVENT_BUTTON; - break; - } - } - - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doPokeUserActivityLockedInterruptible); - commandEntry->eventTime = eventEntry->eventTime; - commandEntry->userActivityEventType = eventType; -} - -void InputDispatcher::prepareDispatchCycleLocked(nsecs_t currentTime, - const sp& connection, EventEntry* eventEntry, const InputTarget* inputTarget) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ prepareDispatchCycle - flags=0x%08x, " - "xOffset=%f, yOffset=%f, scaleFactor=%f, " - "pointerIds=0x%x", - connection->getInputChannelName(), inputTarget->flags, - inputTarget->xOffset, inputTarget->yOffset, - inputTarget->scaleFactor, inputTarget->pointerIds.value); -#endif - - // Skip this event if the connection status is not normal. - // We don't want to enqueue additional outbound events if the connection is broken. - if (connection->status != Connection::STATUS_NORMAL) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ Dropping event because the channel status is %s", - connection->getInputChannelName(), connection->getStatusLabel()); -#endif - return; - } - - // Split a motion event if needed. - if (inputTarget->flags & InputTarget::FLAG_SPLIT) { - ALOG_ASSERT(eventEntry->type == EventEntry::TYPE_MOTION); - - MotionEntry* originalMotionEntry = static_cast(eventEntry); - if (inputTarget->pointerIds.count() != originalMotionEntry->pointerCount) { - MotionEntry* splitMotionEntry = splitMotionEvent( - originalMotionEntry, inputTarget->pointerIds); - if (!splitMotionEntry) { - return; // split event was dropped - } -#if DEBUG_FOCUS - ALOGD("channel '%s' ~ Split motion event.", - connection->getInputChannelName()); - logOutboundMotionDetailsLocked(" ", splitMotionEntry); -#endif - enqueueDispatchEntriesLocked(currentTime, connection, - splitMotionEntry, inputTarget); - splitMotionEntry->release(); - return; - } - } - - // Not splitting. Enqueue dispatch entries for the event as is. - enqueueDispatchEntriesLocked(currentTime, connection, eventEntry, inputTarget); -} - -void InputDispatcher::enqueueDispatchEntriesLocked(nsecs_t currentTime, - const sp& connection, EventEntry* eventEntry, const InputTarget* inputTarget) { - bool wasEmpty = connection->outboundQueue.isEmpty(); - - // Enqueue dispatch entries for the requested modes. - enqueueDispatchEntryLocked(connection, eventEntry, inputTarget, - InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT); - enqueueDispatchEntryLocked(connection, eventEntry, inputTarget, - InputTarget::FLAG_DISPATCH_AS_OUTSIDE); - enqueueDispatchEntryLocked(connection, eventEntry, inputTarget, - InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER); - enqueueDispatchEntryLocked(connection, eventEntry, inputTarget, - InputTarget::FLAG_DISPATCH_AS_IS); - enqueueDispatchEntryLocked(connection, eventEntry, inputTarget, - InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT); - enqueueDispatchEntryLocked(connection, eventEntry, inputTarget, - InputTarget::FLAG_DISPATCH_AS_SLIPPERY_ENTER); - - // If the outbound queue was previously empty, start the dispatch cycle going. - if (wasEmpty && !connection->outboundQueue.isEmpty()) { - startDispatchCycleLocked(currentTime, connection); - } -} - -void InputDispatcher::enqueueDispatchEntryLocked( - const sp& connection, EventEntry* eventEntry, const InputTarget* inputTarget, - int32_t dispatchMode) { - int32_t inputTargetFlags = inputTarget->flags; - if (!(inputTargetFlags & dispatchMode)) { - return; - } - inputTargetFlags = (inputTargetFlags & ~InputTarget::FLAG_DISPATCH_MASK) | dispatchMode; - - // This is a new event. - // Enqueue a new dispatch entry onto the outbound queue for this connection. - DispatchEntry* dispatchEntry = new DispatchEntry(eventEntry, // increments ref - inputTargetFlags, inputTarget->xOffset, inputTarget->yOffset, - inputTarget->scaleFactor); - - // Apply target flags and update the connection's input state. - switch (eventEntry->type) { - case EventEntry::TYPE_KEY: { - KeyEntry* keyEntry = static_cast(eventEntry); - dispatchEntry->resolvedAction = keyEntry->action; - dispatchEntry->resolvedFlags = keyEntry->flags; - - if (!connection->inputState.trackKey(keyEntry, - dispatchEntry->resolvedAction, dispatchEntry->resolvedFlags)) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent key event", - connection->getInputChannelName()); -#endif - delete dispatchEntry; - return; // skip the inconsistent event - } - break; - } - - case EventEntry::TYPE_MOTION: { - MotionEntry* motionEntry = static_cast(eventEntry); - if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_OUTSIDE) { - dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_OUTSIDE; - } else if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_HOVER_EXIT) { - dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_HOVER_EXIT; - } else if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_HOVER_ENTER) { - dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_HOVER_ENTER; - } else if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT) { - dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_CANCEL; - } else if (dispatchMode & InputTarget::FLAG_DISPATCH_AS_SLIPPERY_ENTER) { - dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_DOWN; - } else { - dispatchEntry->resolvedAction = motionEntry->action; - } - if (dispatchEntry->resolvedAction == AMOTION_EVENT_ACTION_HOVER_MOVE - && !connection->inputState.isHovering( - motionEntry->deviceId, motionEntry->source, motionEntry->displayId)) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ enqueueDispatchEntryLocked: filling in missing hover enter event", - connection->getInputChannelName()); -#endif - dispatchEntry->resolvedAction = AMOTION_EVENT_ACTION_HOVER_ENTER; - } - - dispatchEntry->resolvedFlags = motionEntry->flags; - if (dispatchEntry->targetFlags & InputTarget::FLAG_WINDOW_IS_OBSCURED) { - dispatchEntry->resolvedFlags |= AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED; - } - - if (!connection->inputState.trackMotion(motionEntry, - dispatchEntry->resolvedAction, dispatchEntry->resolvedFlags)) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ enqueueDispatchEntryLocked: skipping inconsistent motion event", - connection->getInputChannelName()); -#endif - delete dispatchEntry; - return; // skip the inconsistent event - } - break; - } - } - - // Remember that we are waiting for this dispatch to complete. - if (dispatchEntry->hasForegroundTarget()) { - incrementPendingForegroundDispatchesLocked(eventEntry); - } - - // Enqueue the dispatch entry. - connection->outboundQueue.enqueueAtTail(dispatchEntry); - traceOutboundQueueLengthLocked(connection); -} - -void InputDispatcher::startDispatchCycleLocked(nsecs_t currentTime, - const sp& connection) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ startDispatchCycle", - connection->getInputChannelName()); -#endif - - while (connection->status == Connection::STATUS_NORMAL - && !connection->outboundQueue.isEmpty()) { - DispatchEntry* dispatchEntry = connection->outboundQueue.head; - dispatchEntry->deliveryTime = currentTime; - - // Publish the event. - status_t status; - EventEntry* eventEntry = dispatchEntry->eventEntry; - switch (eventEntry->type) { - case EventEntry::TYPE_KEY: { - KeyEntry* keyEntry = static_cast(eventEntry); - - // Publish the key event. - status = connection->inputPublisher.publishKeyEvent(dispatchEntry->seq, - keyEntry->deviceId, keyEntry->source, - dispatchEntry->resolvedAction, dispatchEntry->resolvedFlags, - keyEntry->keyCode, keyEntry->scanCode, - keyEntry->metaState, keyEntry->repeatCount, keyEntry->downTime, - keyEntry->eventTime); - break; - } - - case EventEntry::TYPE_MOTION: { - MotionEntry* motionEntry = static_cast(eventEntry); - - PointerCoords scaledCoords[MAX_POINTERS]; - const PointerCoords* usingCoords = motionEntry->pointerCoords; - - // Set the X and Y offset depending on the input source. - float xOffset, yOffset, scaleFactor; - if ((motionEntry->source & AINPUT_SOURCE_CLASS_POINTER) - && !(dispatchEntry->targetFlags & InputTarget::FLAG_ZERO_COORDS)) { - scaleFactor = dispatchEntry->scaleFactor; - xOffset = dispatchEntry->xOffset * scaleFactor; - yOffset = dispatchEntry->yOffset * scaleFactor; - if (scaleFactor != 1.0f) { - for (uint32_t i = 0; i < motionEntry->pointerCount; i++) { - scaledCoords[i] = motionEntry->pointerCoords[i]; - scaledCoords[i].scale(scaleFactor); - } - usingCoords = scaledCoords; - } - } else { - xOffset = 0.0f; - yOffset = 0.0f; - scaleFactor = 1.0f; - - // We don't want the dispatch target to know. - if (dispatchEntry->targetFlags & InputTarget::FLAG_ZERO_COORDS) { - for (uint32_t i = 0; i < motionEntry->pointerCount; i++) { - scaledCoords[i].clear(); - } - usingCoords = scaledCoords; - } - } - - // Publish the motion event. - status = connection->inputPublisher.publishMotionEvent(dispatchEntry->seq, - motionEntry->deviceId, motionEntry->source, - dispatchEntry->resolvedAction, motionEntry->actionButton, - dispatchEntry->resolvedFlags, motionEntry->edgeFlags, - motionEntry->metaState, motionEntry->buttonState, - xOffset, yOffset, motionEntry->xPrecision, motionEntry->yPrecision, - motionEntry->downTime, motionEntry->eventTime, - motionEntry->pointerCount, motionEntry->pointerProperties, - usingCoords); - break; - } - - default: - ALOG_ASSERT(false); - return; - } - - // Check the result. - if (status) { - if (status == WOULD_BLOCK) { - if (connection->waitQueue.isEmpty()) { - ALOGE("channel '%s' ~ Could not publish event because the pipe is full. " - "This is unexpected because the wait queue is empty, so the pipe " - "should be empty and we shouldn't have any problems writing an " - "event to it, status=%d", connection->getInputChannelName(), status); - abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/); - } else { - // Pipe is full and we are waiting for the app to finish process some events - // before sending more events to it. -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ Could not publish event because the pipe is full, " - "waiting for the application to catch up", - connection->getInputChannelName()); -#endif - connection->inputPublisherBlocked = true; - } - } else { - ALOGE("channel '%s' ~ Could not publish event due to an unexpected error, " - "status=%d", connection->getInputChannelName(), status); - abortBrokenDispatchCycleLocked(currentTime, connection, true /*notify*/); - } - return; - } - - // Re-enqueue the event on the wait queue. - connection->outboundQueue.dequeue(dispatchEntry); - traceOutboundQueueLengthLocked(connection); - connection->waitQueue.enqueueAtTail(dispatchEntry); - traceWaitQueueLengthLocked(connection); - } -} - -void InputDispatcher::finishDispatchCycleLocked(nsecs_t currentTime, - const sp& connection, uint32_t seq, bool handled) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ finishDispatchCycle - seq=%u, handled=%s", - connection->getInputChannelName(), seq, toString(handled)); -#endif - - connection->inputPublisherBlocked = false; - - if (connection->status == Connection::STATUS_BROKEN - || connection->status == Connection::STATUS_ZOMBIE) { - return; - } - - // Notify other system components and prepare to start the next dispatch cycle. - onDispatchCycleFinishedLocked(currentTime, connection, seq, handled); -} - -void InputDispatcher::abortBrokenDispatchCycleLocked(nsecs_t currentTime, - const sp& connection, bool notify) { -#if DEBUG_DISPATCH_CYCLE - ALOGD("channel '%s' ~ abortBrokenDispatchCycle - notify=%s", - connection->getInputChannelName(), toString(notify)); -#endif - - // Clear the dispatch queues. - drainDispatchQueueLocked(&connection->outboundQueue); - traceOutboundQueueLengthLocked(connection); - drainDispatchQueueLocked(&connection->waitQueue); - traceWaitQueueLengthLocked(connection); - - // The connection appears to be unrecoverably broken. - // Ignore already broken or zombie connections. - if (connection->status == Connection::STATUS_NORMAL) { - connection->status = Connection::STATUS_BROKEN; - - if (notify) { - // Notify other system components. - onDispatchCycleBrokenLocked(currentTime, connection); - } - } -} - -void InputDispatcher::drainDispatchQueueLocked(Queue* queue) { - while (!queue->isEmpty()) { - DispatchEntry* dispatchEntry = queue->dequeueAtHead(); - releaseDispatchEntryLocked(dispatchEntry); - } -} - -void InputDispatcher::releaseDispatchEntryLocked(DispatchEntry* dispatchEntry) { - if (dispatchEntry->hasForegroundTarget()) { - decrementPendingForegroundDispatchesLocked(dispatchEntry->eventEntry); - } - delete dispatchEntry; -} - -int InputDispatcher::handleReceiveCallback(int fd, int events, void* data) { - InputDispatcher* d = static_cast(data); - - { // acquire lock - AutoMutex _l(d->mLock); - - ssize_t connectionIndex = d->mConnectionsByFd.indexOfKey(fd); - if (connectionIndex < 0) { - ALOGE("Received spurious receive callback for unknown input channel. " - "fd=%d, events=0x%x", fd, events); - return 0; // remove the callback - } - - bool notify; - sp connection = d->mConnectionsByFd.valueAt(connectionIndex); - if (!(events & (ALOOPER_EVENT_ERROR | ALOOPER_EVENT_HANGUP))) { - if (!(events & ALOOPER_EVENT_INPUT)) { - ALOGW("channel '%s' ~ Received spurious callback for unhandled poll event. " - "events=0x%x", connection->getInputChannelName(), events); - return 1; - } - - nsecs_t currentTime = now(); - bool gotOne = false; - status_t status; - for (;;) { - uint32_t seq; - bool handled; - status = connection->inputPublisher.receiveFinishedSignal(&seq, &handled); - if (status) { - break; - } - d->finishDispatchCycleLocked(currentTime, connection, seq, handled); - gotOne = true; - } - if (gotOne) { - d->runCommandsLockedInterruptible(); - if (status == WOULD_BLOCK) { - return 1; - } - } - - notify = status != DEAD_OBJECT || !connection->monitor; - if (notify) { - ALOGE("channel '%s' ~ Failed to receive finished signal. status=%d", - connection->getInputChannelName(), status); - } - } else { - // Monitor channels are never explicitly unregistered. - // We do it automatically when the remote endpoint is closed so don't warn - // about them. - notify = !connection->monitor; - if (notify) { - ALOGW("channel '%s' ~ Consumer closed input channel or an error occurred. " - "events=0x%x", connection->getInputChannelName(), events); - } - } - - // Unregister the channel. - d->unregisterInputChannelLocked(connection->inputChannel, notify); - return 0; // remove the callback - } // release lock -} - -void InputDispatcher::synthesizeCancelationEventsForAllConnectionsLocked( - const CancelationOptions& options) { - for (size_t i = 0; i < mConnectionsByFd.size(); i++) { - synthesizeCancelationEventsForConnectionLocked( - mConnectionsByFd.valueAt(i), options); - } -} - -void InputDispatcher::synthesizeCancelationEventsForMonitorsLocked( - const CancelationOptions& options) { - for (size_t i = 0; i < mMonitoringChannels.size(); i++) { - synthesizeCancelationEventsForInputChannelLocked(mMonitoringChannels[i], options); - } -} - -void InputDispatcher::synthesizeCancelationEventsForInputChannelLocked( - const sp& channel, const CancelationOptions& options) { - ssize_t index = getConnectionIndexLocked(channel); - if (index >= 0) { - synthesizeCancelationEventsForConnectionLocked( - mConnectionsByFd.valueAt(index), options); - } -} - -void InputDispatcher::synthesizeCancelationEventsForConnectionLocked( - const sp& connection, const CancelationOptions& options) { - if (connection->status == Connection::STATUS_BROKEN) { - return; - } - - nsecs_t currentTime = now(); - - Vector cancelationEvents; - connection->inputState.synthesizeCancelationEvents(currentTime, - cancelationEvents, options); - - if (!cancelationEvents.isEmpty()) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("channel '%s' ~ Synthesized %d cancelation events to bring channel back in sync " - "with reality: %s, mode=%d.", - connection->getInputChannelName(), cancelationEvents.size(), - options.reason, options.mode); -#endif - for (size_t i = 0; i < cancelationEvents.size(); i++) { - EventEntry* cancelationEventEntry = cancelationEvents.itemAt(i); - switch (cancelationEventEntry->type) { - case EventEntry::TYPE_KEY: - logOutboundKeyDetailsLocked("cancel - ", - static_cast(cancelationEventEntry)); - break; - case EventEntry::TYPE_MOTION: - logOutboundMotionDetailsLocked("cancel - ", - static_cast(cancelationEventEntry)); - break; - } - - InputTarget target; - sp windowHandle = getWindowHandleLocked(connection->inputChannel); - if (windowHandle != NULL) { - const InputWindowInfo* windowInfo = windowHandle->getInfo(); - target.xOffset = -windowInfo->frameLeft; - target.yOffset = -windowInfo->frameTop; - target.scaleFactor = windowInfo->scaleFactor; - } else { - target.xOffset = 0; - target.yOffset = 0; - target.scaleFactor = 1.0f; - } - target.inputChannel = connection->inputChannel; - target.flags = InputTarget::FLAG_DISPATCH_AS_IS; - - enqueueDispatchEntryLocked(connection, cancelationEventEntry, // increments ref - &target, InputTarget::FLAG_DISPATCH_AS_IS); - - cancelationEventEntry->release(); - } - - startDispatchCycleLocked(currentTime, connection); - } -} - -InputDispatcher::MotionEntry* -InputDispatcher::splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds) { - ALOG_ASSERT(pointerIds.value != 0); - - uint32_t splitPointerIndexMap[MAX_POINTERS]; - PointerProperties splitPointerProperties[MAX_POINTERS]; - PointerCoords splitPointerCoords[MAX_POINTERS]; - - uint32_t originalPointerCount = originalMotionEntry->pointerCount; - uint32_t splitPointerCount = 0; - - for (uint32_t originalPointerIndex = 0; originalPointerIndex < originalPointerCount; - originalPointerIndex++) { - const PointerProperties& pointerProperties = - originalMotionEntry->pointerProperties[originalPointerIndex]; - uint32_t pointerId = uint32_t(pointerProperties.id); - if (pointerIds.hasBit(pointerId)) { - splitPointerIndexMap[splitPointerCount] = originalPointerIndex; - splitPointerProperties[splitPointerCount].copyFrom(pointerProperties); - splitPointerCoords[splitPointerCount].copyFrom( - originalMotionEntry->pointerCoords[originalPointerIndex]); - splitPointerCount += 1; - } - } - - if (splitPointerCount != pointerIds.count()) { - // This is bad. We are missing some of the pointers that we expected to deliver. - // Most likely this indicates that we received an ACTION_MOVE events that has - // different pointer ids than we expected based on the previous ACTION_DOWN - // or ACTION_POINTER_DOWN events that caused us to decide to split the pointers - // in this way. - ALOGW("Dropping split motion event because the pointer count is %d but " - "we expected there to be %d pointers. This probably means we received " - "a broken sequence of pointer ids from the input device.", - splitPointerCount, pointerIds.count()); - return NULL; - } - - int32_t action = originalMotionEntry->action; - int32_t maskedAction = action & AMOTION_EVENT_ACTION_MASK; - if (maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN - || maskedAction == AMOTION_EVENT_ACTION_POINTER_UP) { - int32_t originalPointerIndex = getMotionEventActionPointerIndex(action); - const PointerProperties& pointerProperties = - originalMotionEntry->pointerProperties[originalPointerIndex]; - uint32_t pointerId = uint32_t(pointerProperties.id); - if (pointerIds.hasBit(pointerId)) { - if (pointerIds.count() == 1) { - // The first/last pointer went down/up. - action = maskedAction == AMOTION_EVENT_ACTION_POINTER_DOWN - ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP; - } else { - // A secondary pointer went down/up. - uint32_t splitPointerIndex = 0; - while (pointerId != uint32_t(splitPointerProperties[splitPointerIndex].id)) { - splitPointerIndex += 1; - } - action = maskedAction | (splitPointerIndex - << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT); - } - } else { - // An unrelated pointer changed. - action = AMOTION_EVENT_ACTION_MOVE; - } - } - - MotionEntry* splitMotionEntry = new MotionEntry( - originalMotionEntry->eventTime, - originalMotionEntry->deviceId, - originalMotionEntry->source, - originalMotionEntry->policyFlags, - action, - originalMotionEntry->actionButton, - originalMotionEntry->flags, - originalMotionEntry->metaState, - originalMotionEntry->buttonState, - originalMotionEntry->edgeFlags, - originalMotionEntry->xPrecision, - originalMotionEntry->yPrecision, - originalMotionEntry->downTime, - originalMotionEntry->displayId, - splitPointerCount, splitPointerProperties, splitPointerCoords, 0, 0); - - if (originalMotionEntry->injectionState) { - splitMotionEntry->injectionState = originalMotionEntry->injectionState; - splitMotionEntry->injectionState->refCount += 1; - } - - return splitMotionEntry; -} - -void InputDispatcher::notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) { -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("notifyConfigurationChanged - eventTime=%lld", args->eventTime); -#endif - - bool needWake; - { // acquire lock - AutoMutex _l(mLock); - - ConfigurationChangedEntry* newEntry = new ConfigurationChangedEntry(args->eventTime); - needWake = enqueueInboundEventLocked(newEntry); - } // release lock - - if (needWake) { - mLooper->wake(); - } -} - -void InputDispatcher::notifyKey(const NotifyKeyArgs* args) { -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("notifyKey - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, action=0x%x, " - "flags=0x%x, keyCode=0x%x, scanCode=0x%x, metaState=0x%x, downTime=%lld", - args->eventTime, args->deviceId, args->source, args->policyFlags, - args->action, args->flags, args->keyCode, args->scanCode, - args->metaState, args->downTime); -#endif - if (!validateKeyEvent(args->action)) { - return; - } - - uint32_t policyFlags = args->policyFlags; - int32_t flags = args->flags; - int32_t metaState = args->metaState; - if ((policyFlags & POLICY_FLAG_VIRTUAL) || (flags & AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY)) { - policyFlags |= POLICY_FLAG_VIRTUAL; - flags |= AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY; - } - if (policyFlags & POLICY_FLAG_FUNCTION) { - metaState |= AMETA_FUNCTION_ON; - } - - policyFlags |= POLICY_FLAG_TRUSTED; - - int32_t keyCode = args->keyCode; - if (metaState & AMETA_META_ON && args->action == AKEY_EVENT_ACTION_DOWN) { - int32_t newKeyCode = AKEYCODE_UNKNOWN; - if (keyCode == AKEYCODE_DEL) { - newKeyCode = AKEYCODE_BACK; - } else if (keyCode == AKEYCODE_ENTER) { - newKeyCode = AKEYCODE_HOME; - } - if (newKeyCode != AKEYCODE_UNKNOWN) { - AutoMutex _l(mLock); - struct KeyReplacement replacement = {keyCode, args->deviceId}; - mReplacedKeys.add(replacement, newKeyCode); - keyCode = newKeyCode; - metaState &= ~AMETA_META_ON; - } - } else if (args->action == AKEY_EVENT_ACTION_UP) { - // In order to maintain a consistent stream of up and down events, check to see if the key - // going up is one we've replaced in a down event and haven't yet replaced in an up event, - // even if the modifier was released between the down and the up events. - AutoMutex _l(mLock); - struct KeyReplacement replacement = {keyCode, args->deviceId}; - ssize_t index = mReplacedKeys.indexOfKey(replacement); - if (index >= 0) { - keyCode = mReplacedKeys.valueAt(index); - mReplacedKeys.removeItemsAt(index); - metaState &= ~AMETA_META_ON; - } - } - - KeyEvent event; - event.initialize(args->deviceId, args->source, args->action, - flags, keyCode, args->scanCode, metaState, 0, - args->downTime, args->eventTime); - - mPolicy->interceptKeyBeforeQueueing(&event, /*byref*/ policyFlags); - - bool needWake; - { // acquire lock - mLock.lock(); - - if (shouldSendKeyToInputFilterLocked(args)) { - mLock.unlock(); - - policyFlags |= POLICY_FLAG_FILTERED; - if (!mPolicy->filterInputEvent(&event, policyFlags)) { - return; // event was consumed by the filter - } - - mLock.lock(); - } - - int32_t repeatCount = 0; - KeyEntry* newEntry = new KeyEntry(args->eventTime, - args->deviceId, args->source, policyFlags, - args->action, flags, keyCode, args->scanCode, - metaState, repeatCount, args->downTime); - - needWake = enqueueInboundEventLocked(newEntry); - mLock.unlock(); - } // release lock - - if (needWake) { - mLooper->wake(); - } -} - -bool InputDispatcher::shouldSendKeyToInputFilterLocked(const NotifyKeyArgs* args) { - return mInputFilterEnabled; -} - -void InputDispatcher::notifyMotion(const NotifyMotionArgs* args) { -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("notifyMotion - eventTime=%lld, deviceId=%d, source=0x%x, policyFlags=0x%x, " - "action=0x%x, actionButton=0x%x, flags=0x%x, metaState=0x%x, buttonState=0x%x," - "edgeFlags=0x%x, xPrecision=%f, yPrecision=%f, downTime=%lld", - args->eventTime, args->deviceId, args->source, args->policyFlags, - args->action, args->actionButton, args->flags, args->metaState, args->buttonState, - args->edgeFlags, args->xPrecision, args->yPrecision, args->downTime); - for (uint32_t i = 0; i < args->pointerCount; i++) { - ALOGD(" Pointer %d: id=%d, toolType=%d, " - "x=%f, y=%f, pressure=%f, size=%f, " - "touchMajor=%f, touchMinor=%f, toolMajor=%f, toolMinor=%f, " - "orientation=%f", - i, args->pointerProperties[i].id, - args->pointerProperties[i].toolType, - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_X), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_Y), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_PRESSURE), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_SIZE), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), - args->pointerCoords[i].getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION)); - } -#endif - if (!validateMotionEvent(args->action, args->actionButton, - args->pointerCount, args->pointerProperties)) { - return; - } - - uint32_t policyFlags = args->policyFlags; - policyFlags |= POLICY_FLAG_TRUSTED; - mPolicy->interceptMotionBeforeQueueing(args->eventTime, /*byref*/ policyFlags); - - bool needWake; - { // acquire lock - mLock.lock(); - - if (shouldSendMotionToInputFilterLocked(args)) { - mLock.unlock(); - - MotionEvent event; - event.initialize(args->deviceId, args->source, args->action, args->actionButton, - args->flags, args->edgeFlags, args->metaState, args->buttonState, - 0, 0, args->xPrecision, args->yPrecision, - args->downTime, args->eventTime, - args->pointerCount, args->pointerProperties, args->pointerCoords); - - policyFlags |= POLICY_FLAG_FILTERED; - if (!mPolicy->filterInputEvent(&event, policyFlags)) { - return; // event was consumed by the filter - } - - mLock.lock(); - } - - // Just enqueue a new motion event. - MotionEntry* newEntry = new MotionEntry(args->eventTime, - args->deviceId, args->source, policyFlags, - args->action, args->actionButton, args->flags, - args->metaState, args->buttonState, - args->edgeFlags, args->xPrecision, args->yPrecision, args->downTime, - args->displayId, - args->pointerCount, args->pointerProperties, args->pointerCoords, 0, 0); - - needWake = enqueueInboundEventLocked(newEntry); - mLock.unlock(); - } // release lock - - if (needWake) { - mLooper->wake(); - } -} - -bool InputDispatcher::shouldSendMotionToInputFilterLocked(const NotifyMotionArgs* args) { - // TODO: support sending secondary display events to input filter - return mInputFilterEnabled && isMainDisplay(args->displayId); -} - -void InputDispatcher::notifySwitch(const NotifySwitchArgs* args) { -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("notifySwitch - eventTime=%lld, policyFlags=0x%x, switchValues=0x%08x, switchMask=0x%08x", - args->eventTime, args->policyFlags, - args->switchValues, args->switchMask); -#endif - - uint32_t policyFlags = args->policyFlags; - policyFlags |= POLICY_FLAG_TRUSTED; - mPolicy->notifySwitch(args->eventTime, - args->switchValues, args->switchMask, policyFlags); -} - -void InputDispatcher::notifyDeviceReset(const NotifyDeviceResetArgs* args) { -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("notifyDeviceReset - eventTime=%lld, deviceId=%d", - args->eventTime, args->deviceId); -#endif - - bool needWake; - { // acquire lock - AutoMutex _l(mLock); - - DeviceResetEntry* newEntry = new DeviceResetEntry(args->eventTime, args->deviceId); - needWake = enqueueInboundEventLocked(newEntry); - } // release lock - - if (needWake) { - mLooper->wake(); - } -} - -int32_t InputDispatcher::injectInputEvent(const InputEvent* event, int32_t displayId, - int32_t injectorPid, int32_t injectorUid, int32_t syncMode, int32_t timeoutMillis, - uint32_t policyFlags) { -#if DEBUG_INBOUND_EVENT_DETAILS - ALOGD("injectInputEvent - eventType=%d, injectorPid=%d, injectorUid=%d, " - "syncMode=%d, timeoutMillis=%d, policyFlags=0x%08x", - event->getType(), injectorPid, injectorUid, syncMode, timeoutMillis, policyFlags); -#endif - - nsecs_t endTime = now() + milliseconds_to_nanoseconds(timeoutMillis); - - policyFlags |= POLICY_FLAG_INJECTED; - if (hasInjectionPermission(injectorPid, injectorUid)) { - policyFlags |= POLICY_FLAG_TRUSTED; - } - - EventEntry* firstInjectedEntry; - EventEntry* lastInjectedEntry; - switch (event->getType()) { - case AINPUT_EVENT_TYPE_KEY: { - const KeyEvent* keyEvent = static_cast(event); - int32_t action = keyEvent->getAction(); - if (! validateKeyEvent(action)) { - return INPUT_EVENT_INJECTION_FAILED; - } - - int32_t flags = keyEvent->getFlags(); - if (flags & AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY) { - policyFlags |= POLICY_FLAG_VIRTUAL; - } - - if (!(policyFlags & POLICY_FLAG_FILTERED)) { - mPolicy->interceptKeyBeforeQueueing(keyEvent, /*byref*/ policyFlags); - } - - mLock.lock(); - firstInjectedEntry = new KeyEntry(keyEvent->getEventTime(), - keyEvent->getDeviceId(), keyEvent->getSource(), - policyFlags, action, flags, - keyEvent->getKeyCode(), keyEvent->getScanCode(), keyEvent->getMetaState(), - keyEvent->getRepeatCount(), keyEvent->getDownTime()); - lastInjectedEntry = firstInjectedEntry; - break; - } - - case AINPUT_EVENT_TYPE_MOTION: { - const MotionEvent* motionEvent = static_cast(event); - int32_t action = motionEvent->getAction(); - size_t pointerCount = motionEvent->getPointerCount(); - const PointerProperties* pointerProperties = motionEvent->getPointerProperties(); - int32_t actionButton = motionEvent->getActionButton(); - if (! validateMotionEvent(action, actionButton, pointerCount, pointerProperties)) { - return INPUT_EVENT_INJECTION_FAILED; - } - - if (!(policyFlags & POLICY_FLAG_FILTERED)) { - nsecs_t eventTime = motionEvent->getEventTime(); - mPolicy->interceptMotionBeforeQueueing(eventTime, /*byref*/ policyFlags); - } - - mLock.lock(); - const nsecs_t* sampleEventTimes = motionEvent->getSampleEventTimes(); - const PointerCoords* samplePointerCoords = motionEvent->getSamplePointerCoords(); - firstInjectedEntry = new MotionEntry(*sampleEventTimes, - motionEvent->getDeviceId(), motionEvent->getSource(), policyFlags, - action, actionButton, motionEvent->getFlags(), - motionEvent->getMetaState(), motionEvent->getButtonState(), - motionEvent->getEdgeFlags(), - motionEvent->getXPrecision(), motionEvent->getYPrecision(), - motionEvent->getDownTime(), displayId, - uint32_t(pointerCount), pointerProperties, samplePointerCoords, - motionEvent->getXOffset(), motionEvent->getYOffset()); - lastInjectedEntry = firstInjectedEntry; - for (size_t i = motionEvent->getHistorySize(); i > 0; i--) { - sampleEventTimes += 1; - samplePointerCoords += pointerCount; - MotionEntry* nextInjectedEntry = new MotionEntry(*sampleEventTimes, - motionEvent->getDeviceId(), motionEvent->getSource(), policyFlags, - action, actionButton, motionEvent->getFlags(), - motionEvent->getMetaState(), motionEvent->getButtonState(), - motionEvent->getEdgeFlags(), - motionEvent->getXPrecision(), motionEvent->getYPrecision(), - motionEvent->getDownTime(), displayId, - uint32_t(pointerCount), pointerProperties, samplePointerCoords, - motionEvent->getXOffset(), motionEvent->getYOffset()); - lastInjectedEntry->next = nextInjectedEntry; - lastInjectedEntry = nextInjectedEntry; - } - break; - } - - default: - ALOGW("Cannot inject event of type %d", event->getType()); - return INPUT_EVENT_INJECTION_FAILED; - } - - InjectionState* injectionState = new InjectionState(injectorPid, injectorUid); - if (syncMode == INPUT_EVENT_INJECTION_SYNC_NONE) { - injectionState->injectionIsAsync = true; - } - - injectionState->refCount += 1; - lastInjectedEntry->injectionState = injectionState; - - bool needWake = false; - for (EventEntry* entry = firstInjectedEntry; entry != NULL; ) { - EventEntry* nextEntry = entry->next; - needWake |= enqueueInboundEventLocked(entry); - entry = nextEntry; - } - - mLock.unlock(); - - if (needWake) { - mLooper->wake(); - } - - int32_t injectionResult; - { // acquire lock - AutoMutex _l(mLock); - - if (syncMode == INPUT_EVENT_INJECTION_SYNC_NONE) { - injectionResult = INPUT_EVENT_INJECTION_SUCCEEDED; - } else { - for (;;) { - injectionResult = injectionState->injectionResult; - if (injectionResult != INPUT_EVENT_INJECTION_PENDING) { - break; - } - - nsecs_t remainingTimeout = endTime - now(); - if (remainingTimeout <= 0) { -#if DEBUG_INJECTION - ALOGD("injectInputEvent - Timed out waiting for injection result " - "to become available."); -#endif - injectionResult = INPUT_EVENT_INJECTION_TIMED_OUT; - break; - } - - mInjectionResultAvailableCondition.waitRelative(mLock, remainingTimeout); - } - - if (injectionResult == INPUT_EVENT_INJECTION_SUCCEEDED - && syncMode == INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISHED) { - while (injectionState->pendingForegroundDispatches != 0) { -#if DEBUG_INJECTION - ALOGD("injectInputEvent - Waiting for %d pending foreground dispatches.", - injectionState->pendingForegroundDispatches); -#endif - nsecs_t remainingTimeout = endTime - now(); - if (remainingTimeout <= 0) { -#if DEBUG_INJECTION - ALOGD("injectInputEvent - Timed out waiting for pending foreground " - "dispatches to finish."); -#endif - injectionResult = INPUT_EVENT_INJECTION_TIMED_OUT; - break; - } - - mInjectionSyncFinishedCondition.waitRelative(mLock, remainingTimeout); - } - } - } - - injectionState->release(); - } // release lock - -#if DEBUG_INJECTION - ALOGD("injectInputEvent - Finished with result %d. " - "injectorPid=%d, injectorUid=%d", - injectionResult, injectorPid, injectorUid); -#endif - - return injectionResult; -} - -bool InputDispatcher::hasInjectionPermission(int32_t injectorPid, int32_t injectorUid) { - return injectorUid == 0 - || mPolicy->checkInjectEventsPermissionNonReentrant(injectorPid, injectorUid); -} - -void InputDispatcher::setInjectionResultLocked(EventEntry* entry, int32_t injectionResult) { - InjectionState* injectionState = entry->injectionState; - if (injectionState) { -#if DEBUG_INJECTION - ALOGD("Setting input event injection result to %d. " - "injectorPid=%d, injectorUid=%d", - injectionResult, injectionState->injectorPid, injectionState->injectorUid); -#endif - - if (injectionState->injectionIsAsync - && !(entry->policyFlags & POLICY_FLAG_FILTERED)) { - // Log the outcome since the injector did not wait for the injection result. - switch (injectionResult) { - case INPUT_EVENT_INJECTION_SUCCEEDED: - ALOGV("Asynchronous input event injection succeeded."); - break; - case INPUT_EVENT_INJECTION_FAILED: - ALOGW("Asynchronous input event injection failed."); - break; - case INPUT_EVENT_INJECTION_PERMISSION_DENIED: - ALOGW("Asynchronous input event injection permission denied."); - break; - case INPUT_EVENT_INJECTION_TIMED_OUT: - ALOGW("Asynchronous input event injection timed out."); - break; - } - } - - injectionState->injectionResult = injectionResult; - mInjectionResultAvailableCondition.broadcast(); - } -} - -void InputDispatcher::incrementPendingForegroundDispatchesLocked(EventEntry* entry) { - InjectionState* injectionState = entry->injectionState; - if (injectionState) { - injectionState->pendingForegroundDispatches += 1; - } -} - -void InputDispatcher::decrementPendingForegroundDispatchesLocked(EventEntry* entry) { - InjectionState* injectionState = entry->injectionState; - if (injectionState) { - injectionState->pendingForegroundDispatches -= 1; - - if (injectionState->pendingForegroundDispatches == 0) { - mInjectionSyncFinishedCondition.broadcast(); - } - } -} - -sp InputDispatcher::getWindowHandleLocked( - const sp& inputChannel) const { - size_t numWindows = mWindowHandles.size(); - for (size_t i = 0; i < numWindows; i++) { - const sp& windowHandle = mWindowHandles.itemAt(i); - if (windowHandle->getInputChannel() == inputChannel) { - return windowHandle; - } - } - return NULL; -} - -bool InputDispatcher::hasWindowHandleLocked( - const sp& windowHandle) const { - size_t numWindows = mWindowHandles.size(); - for (size_t i = 0; i < numWindows; i++) { - if (mWindowHandles.itemAt(i) == windowHandle) { - return true; - } - } - return false; -} - -void InputDispatcher::setInputWindows(const Vector >& inputWindowHandles) { -#if DEBUG_FOCUS - ALOGD("setInputWindows"); -#endif - { // acquire lock - AutoMutex _l(mLock); - - Vector > oldWindowHandles = mWindowHandles; - mWindowHandles = inputWindowHandles; - - sp newFocusedWindowHandle; - bool foundHoveredWindow = false; - for (size_t i = 0; i < mWindowHandles.size(); i++) { - const sp& windowHandle = mWindowHandles.itemAt(i); - if (!windowHandle->updateInfo() || windowHandle->getInputChannel() == NULL) { - mWindowHandles.removeAt(i--); - continue; - } - if (windowHandle->getInfo()->hasFocus) { - newFocusedWindowHandle = windowHandle; - } - if (windowHandle == mLastHoverWindowHandle) { - foundHoveredWindow = true; - } - } - - if (!foundHoveredWindow) { - mLastHoverWindowHandle = NULL; - } - - if (mFocusedWindowHandle != newFocusedWindowHandle) { - if (mFocusedWindowHandle != NULL) { -#if DEBUG_FOCUS - ALOGD("Focus left window: %s", - mFocusedWindowHandle->getName().string()); -#endif - sp focusedInputChannel = mFocusedWindowHandle->getInputChannel(); - if (focusedInputChannel != NULL) { - CancelationOptions options(CancelationOptions::CANCEL_NON_POINTER_EVENTS, - "focus left window"); - synthesizeCancelationEventsForInputChannelLocked( - focusedInputChannel, options); - } - } - if (newFocusedWindowHandle != NULL) { -#if DEBUG_FOCUS - ALOGD("Focus entered window: %s", - newFocusedWindowHandle->getName().string()); -#endif - } - mFocusedWindowHandle = newFocusedWindowHandle; - } - - for (size_t d = 0; d < mTouchStatesByDisplay.size(); d++) { - TouchState& state = mTouchStatesByDisplay.editValueAt(d); - for (size_t i = 0; i < state.windows.size(); i++) { - TouchedWindow& touchedWindow = state.windows.editItemAt(i); - if (!hasWindowHandleLocked(touchedWindow.windowHandle)) { -#if DEBUG_FOCUS - ALOGD("Touched window was removed: %s", - touchedWindow.windowHandle->getName().string()); -#endif - sp touchedInputChannel = - touchedWindow.windowHandle->getInputChannel(); - if (touchedInputChannel != NULL) { - CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, - "touched window was removed"); - synthesizeCancelationEventsForInputChannelLocked( - touchedInputChannel, options); - } - state.windows.removeAt(i--); - } - } - } - - // Release information for windows that are no longer present. - // This ensures that unused input channels are released promptly. - // Otherwise, they might stick around until the window handle is destroyed - // which might not happen until the next GC. - for (size_t i = 0; i < oldWindowHandles.size(); i++) { - const sp& oldWindowHandle = oldWindowHandles.itemAt(i); - if (!hasWindowHandleLocked(oldWindowHandle)) { -#if DEBUG_FOCUS - ALOGD("Window went away: %s", oldWindowHandle->getName().string()); -#endif - oldWindowHandle->releaseInfo(); - } - } - } // release lock - - // Wake up poll loop since it may need to make new input dispatching choices. - mLooper->wake(); -} - -void InputDispatcher::setFocusedApplication( - const sp& inputApplicationHandle) { -#if DEBUG_FOCUS - ALOGD("setFocusedApplication"); -#endif - { // acquire lock - AutoMutex _l(mLock); - - if (inputApplicationHandle != NULL && inputApplicationHandle->updateInfo()) { - if (mFocusedApplicationHandle != inputApplicationHandle) { - if (mFocusedApplicationHandle != NULL) { - resetANRTimeoutsLocked(); - mFocusedApplicationHandle->releaseInfo(); - } - mFocusedApplicationHandle = inputApplicationHandle; - } - } else if (mFocusedApplicationHandle != NULL) { - resetANRTimeoutsLocked(); - mFocusedApplicationHandle->releaseInfo(); - mFocusedApplicationHandle.clear(); - } - -#if DEBUG_FOCUS - //logDispatchStateLocked(); -#endif - } // release lock - - // Wake up poll loop since it may need to make new input dispatching choices. - mLooper->wake(); -} - -void InputDispatcher::setInputDispatchMode(bool enabled, bool frozen) { -#if DEBUG_FOCUS - ALOGD("setInputDispatchMode: enabled=%d, frozen=%d", enabled, frozen); -#endif - - bool changed; - { // acquire lock - AutoMutex _l(mLock); - - if (mDispatchEnabled != enabled || mDispatchFrozen != frozen) { - if (mDispatchFrozen && !frozen) { - resetANRTimeoutsLocked(); - } - - if (mDispatchEnabled && !enabled) { - resetAndDropEverythingLocked("dispatcher is being disabled"); - } - - mDispatchEnabled = enabled; - mDispatchFrozen = frozen; - changed = true; - } else { - changed = false; - } - -#if DEBUG_FOCUS - //logDispatchStateLocked(); -#endif - } // release lock - - if (changed) { - // Wake up poll loop since it may need to make new input dispatching choices. - mLooper->wake(); - } -} - -void InputDispatcher::setInputFilterEnabled(bool enabled) { -#if DEBUG_FOCUS - ALOGD("setInputFilterEnabled: enabled=%d", enabled); -#endif - - { // acquire lock - AutoMutex _l(mLock); - - if (mInputFilterEnabled == enabled) { - return; - } - - mInputFilterEnabled = enabled; - resetAndDropEverythingLocked("input filter is being enabled or disabled"); - } // release lock - - // Wake up poll loop since there might be work to do to drop everything. - mLooper->wake(); -} - -bool InputDispatcher::transferTouchFocus(const sp& fromChannel, - const sp& toChannel) { -#if DEBUG_FOCUS - ALOGD("transferTouchFocus: fromChannel=%s, toChannel=%s", - fromChannel->getName().string(), toChannel->getName().string()); -#endif - { // acquire lock - AutoMutex _l(mLock); - - sp fromWindowHandle = getWindowHandleLocked(fromChannel); - sp toWindowHandle = getWindowHandleLocked(toChannel); - if (fromWindowHandle == NULL || toWindowHandle == NULL) { -#if DEBUG_FOCUS - ALOGD("Cannot transfer focus because from or to window not found."); -#endif - return false; - } - if (fromWindowHandle == toWindowHandle) { -#if DEBUG_FOCUS - ALOGD("Trivial transfer to same window."); -#endif - return true; - } - if (fromWindowHandle->getInfo()->displayId != toWindowHandle->getInfo()->displayId) { -#if DEBUG_FOCUS - ALOGD("Cannot transfer focus because windows are on different displays."); -#endif - return false; - } - - bool found = false; - for (size_t d = 0; d < mTouchStatesByDisplay.size(); d++) { - TouchState& state = mTouchStatesByDisplay.editValueAt(d); - for (size_t i = 0; i < state.windows.size(); i++) { - const TouchedWindow& touchedWindow = state.windows[i]; - if (touchedWindow.windowHandle == fromWindowHandle) { - int32_t oldTargetFlags = touchedWindow.targetFlags; - BitSet32 pointerIds = touchedWindow.pointerIds; - - state.windows.removeAt(i); - - int32_t newTargetFlags = oldTargetFlags - & (InputTarget::FLAG_FOREGROUND - | InputTarget::FLAG_SPLIT | InputTarget::FLAG_DISPATCH_AS_IS); - state.addOrUpdateWindow(toWindowHandle, newTargetFlags, pointerIds); - - found = true; - goto Found; - } - } - } -Found: - - if (! found) { -#if DEBUG_FOCUS - ALOGD("Focus transfer failed because from window did not have focus."); -#endif - return false; - } - - ssize_t fromConnectionIndex = getConnectionIndexLocked(fromChannel); - ssize_t toConnectionIndex = getConnectionIndexLocked(toChannel); - if (fromConnectionIndex >= 0 && toConnectionIndex >= 0) { - sp fromConnection = mConnectionsByFd.valueAt(fromConnectionIndex); - sp toConnection = mConnectionsByFd.valueAt(toConnectionIndex); - - fromConnection->inputState.copyPointerStateTo(toConnection->inputState); - CancelationOptions options(CancelationOptions::CANCEL_POINTER_EVENTS, - "transferring touch focus from this window to another window"); - synthesizeCancelationEventsForConnectionLocked(fromConnection, options); - } - -#if DEBUG_FOCUS - logDispatchStateLocked(); -#endif - } // release lock - - // Wake up poll loop since it may need to make new input dispatching choices. - mLooper->wake(); - return true; -} - -void InputDispatcher::resetAndDropEverythingLocked(const char* reason) { -#if DEBUG_FOCUS - ALOGD("Resetting and dropping all events (%s).", reason); -#endif - - CancelationOptions options(CancelationOptions::CANCEL_ALL_EVENTS, reason); - synthesizeCancelationEventsForAllConnectionsLocked(options); - - resetKeyRepeatLocked(); - releasePendingEventLocked(); - drainInboundQueueLocked(); - resetANRTimeoutsLocked(); - - mTouchStatesByDisplay.clear(); - mLastHoverWindowHandle.clear(); - mReplacedKeys.clear(); -} - -void InputDispatcher::logDispatchStateLocked() { - String8 dump; - dumpDispatchStateLocked(dump); - - char* text = dump.lockBuffer(dump.size()); - char* start = text; - while (*start != '\0') { - char* end = strchr(start, '\n'); - if (*end == '\n') { - *(end++) = '\0'; - } - ALOGD("%s", start); - start = end; - } -} - -void InputDispatcher::dumpDispatchStateLocked(String8& dump) { - dump.appendFormat(INDENT "DispatchEnabled: %d\n", mDispatchEnabled); - dump.appendFormat(INDENT "DispatchFrozen: %d\n", mDispatchFrozen); - - if (mFocusedApplicationHandle != NULL) { - dump.appendFormat(INDENT "FocusedApplication: name='%s', dispatchingTimeout=%0.3fms\n", - mFocusedApplicationHandle->getName().string(), - mFocusedApplicationHandle->getDispatchingTimeout( - DEFAULT_INPUT_DISPATCHING_TIMEOUT) / 1000000.0); - } else { - dump.append(INDENT "FocusedApplication: \n"); - } - dump.appendFormat(INDENT "FocusedWindow: name='%s'\n", - mFocusedWindowHandle != NULL ? mFocusedWindowHandle->getName().string() : ""); - - if (!mTouchStatesByDisplay.isEmpty()) { - dump.appendFormat(INDENT "TouchStatesByDisplay:\n"); - for (size_t i = 0; i < mTouchStatesByDisplay.size(); i++) { - const TouchState& state = mTouchStatesByDisplay.valueAt(i); - dump.appendFormat(INDENT2 "%d: down=%s, split=%s, deviceId=%d, source=0x%08x\n", - state.displayId, toString(state.down), toString(state.split), - state.deviceId, state.source); - if (!state.windows.isEmpty()) { - dump.append(INDENT3 "Windows:\n"); - for (size_t i = 0; i < state.windows.size(); i++) { - const TouchedWindow& touchedWindow = state.windows[i]; - dump.appendFormat(INDENT4 "%zu: name='%s', pointerIds=0x%0x, targetFlags=0x%x\n", - i, touchedWindow.windowHandle->getName().string(), - touchedWindow.pointerIds.value, - touchedWindow.targetFlags); - } - } else { - dump.append(INDENT3 "Windows: \n"); - } - } - } else { - dump.append(INDENT "TouchStates: \n"); - } - - if (!mWindowHandles.isEmpty()) { - dump.append(INDENT "Windows:\n"); - for (size_t i = 0; i < mWindowHandles.size(); i++) { - const sp& windowHandle = mWindowHandles.itemAt(i); - const InputWindowInfo* windowInfo = windowHandle->getInfo(); - - dump.appendFormat(INDENT2 "%zu: name='%s', displayId=%d, " - "paused=%s, hasFocus=%s, hasWallpaper=%s, " - "visible=%s, canReceiveKeys=%s, flags=0x%08x, type=0x%08x, layer=%d, " - "frame=[%d,%d][%d,%d], scale=%f, " - "touchableRegion=", - i, windowInfo->name.string(), windowInfo->displayId, - toString(windowInfo->paused), - toString(windowInfo->hasFocus), - toString(windowInfo->hasWallpaper), - toString(windowInfo->visible), - toString(windowInfo->canReceiveKeys), - windowInfo->layoutParamsFlags, windowInfo->layoutParamsType, - windowInfo->layer, - windowInfo->frameLeft, windowInfo->frameTop, - windowInfo->frameRight, windowInfo->frameBottom, - windowInfo->scaleFactor); - dumpRegion(dump, windowInfo->touchableRegion); - dump.appendFormat(", inputFeatures=0x%08x", windowInfo->inputFeatures); - dump.appendFormat(", ownerPid=%d, ownerUid=%d, dispatchingTimeout=%0.3fms\n", - windowInfo->ownerPid, windowInfo->ownerUid, - windowInfo->dispatchingTimeout / 1000000.0); - } - } else { - dump.append(INDENT "Windows: \n"); - } - - if (!mMonitoringChannels.isEmpty()) { - dump.append(INDENT "MonitoringChannels:\n"); - for (size_t i = 0; i < mMonitoringChannels.size(); i++) { - const sp& channel = mMonitoringChannels[i]; - dump.appendFormat(INDENT2 "%zu: '%s'\n", i, channel->getName().string()); - } - } else { - dump.append(INDENT "MonitoringChannels: \n"); - } - - nsecs_t currentTime = now(); - - // Dump recently dispatched or dropped events from oldest to newest. - if (!mRecentQueue.isEmpty()) { - dump.appendFormat(INDENT "RecentQueue: length=%u\n", mRecentQueue.count()); - for (EventEntry* entry = mRecentQueue.head; entry; entry = entry->next) { - dump.append(INDENT2); - entry->appendDescription(dump); - dump.appendFormat(", age=%0.1fms\n", - (currentTime - entry->eventTime) * 0.000001f); - } - } else { - dump.append(INDENT "RecentQueue: \n"); - } - - // Dump event currently being dispatched. - if (mPendingEvent) { - dump.append(INDENT "PendingEvent:\n"); - dump.append(INDENT2); - mPendingEvent->appendDescription(dump); - dump.appendFormat(", age=%0.1fms\n", - (currentTime - mPendingEvent->eventTime) * 0.000001f); - } else { - dump.append(INDENT "PendingEvent: \n"); - } - - // Dump inbound events from oldest to newest. - if (!mInboundQueue.isEmpty()) { - dump.appendFormat(INDENT "InboundQueue: length=%u\n", mInboundQueue.count()); - for (EventEntry* entry = mInboundQueue.head; entry; entry = entry->next) { - dump.append(INDENT2); - entry->appendDescription(dump); - dump.appendFormat(", age=%0.1fms\n", - (currentTime - entry->eventTime) * 0.000001f); - } - } else { - dump.append(INDENT "InboundQueue: \n"); - } - - if (!mReplacedKeys.isEmpty()) { - dump.append(INDENT "ReplacedKeys:\n"); - for (size_t i = 0; i < mReplacedKeys.size(); i++) { - const KeyReplacement& replacement = mReplacedKeys.keyAt(i); - int32_t newKeyCode = mReplacedKeys.valueAt(i); - dump.appendFormat(INDENT2 "%zu: originalKeyCode=%d, deviceId=%d, newKeyCode=%d\n", - i, replacement.keyCode, replacement.deviceId, newKeyCode); - } - } else { - dump.append(INDENT "ReplacedKeys: \n"); - } - - if (!mConnectionsByFd.isEmpty()) { - dump.append(INDENT "Connections:\n"); - for (size_t i = 0; i < mConnectionsByFd.size(); i++) { - const sp& connection = mConnectionsByFd.valueAt(i); - dump.appendFormat(INDENT2 "%zu: channelName='%s', windowName='%s', " - "status=%s, monitor=%s, inputPublisherBlocked=%s\n", - i, connection->getInputChannelName(), connection->getWindowName(), - connection->getStatusLabel(), toString(connection->monitor), - toString(connection->inputPublisherBlocked)); - - if (!connection->outboundQueue.isEmpty()) { - dump.appendFormat(INDENT3 "OutboundQueue: length=%u\n", - connection->outboundQueue.count()); - for (DispatchEntry* entry = connection->outboundQueue.head; entry; - entry = entry->next) { - dump.append(INDENT4); - entry->eventEntry->appendDescription(dump); - dump.appendFormat(", targetFlags=0x%08x, resolvedAction=%d, age=%0.1fms\n", - entry->targetFlags, entry->resolvedAction, - (currentTime - entry->eventEntry->eventTime) * 0.000001f); - } - } else { - dump.append(INDENT3 "OutboundQueue: \n"); - } - - if (!connection->waitQueue.isEmpty()) { - dump.appendFormat(INDENT3 "WaitQueue: length=%u\n", - connection->waitQueue.count()); - for (DispatchEntry* entry = connection->waitQueue.head; entry; - entry = entry->next) { - dump.append(INDENT4); - entry->eventEntry->appendDescription(dump); - dump.appendFormat(", targetFlags=0x%08x, resolvedAction=%d, " - "age=%0.1fms, wait=%0.1fms\n", - entry->targetFlags, entry->resolvedAction, - (currentTime - entry->eventEntry->eventTime) * 0.000001f, - (currentTime - entry->deliveryTime) * 0.000001f); - } - } else { - dump.append(INDENT3 "WaitQueue: \n"); - } - } - } else { - dump.append(INDENT "Connections: \n"); - } - - if (isAppSwitchPendingLocked()) { - dump.appendFormat(INDENT "AppSwitch: pending, due in %0.1fms\n", - (mAppSwitchDueTime - now()) / 1000000.0); - } else { - dump.append(INDENT "AppSwitch: not pending\n"); - } - - dump.append(INDENT "Configuration:\n"); - dump.appendFormat(INDENT2 "KeyRepeatDelay: %0.1fms\n", - mConfig.keyRepeatDelay * 0.000001f); - dump.appendFormat(INDENT2 "KeyRepeatTimeout: %0.1fms\n", - mConfig.keyRepeatTimeout * 0.000001f); -} - -status_t InputDispatcher::registerInputChannel(const sp& inputChannel, - const sp& inputWindowHandle, bool monitor) { -#if DEBUG_REGISTRATION - ALOGD("channel '%s' ~ registerInputChannel - monitor=%s", inputChannel->getName().string(), - toString(monitor)); -#endif - - { // acquire lock - AutoMutex _l(mLock); - - if (getConnectionIndexLocked(inputChannel) >= 0) { - ALOGW("Attempted to register already registered input channel '%s'", - inputChannel->getName().string()); - return BAD_VALUE; - } - - sp connection = new Connection(inputChannel, inputWindowHandle, monitor); - - int fd = inputChannel->getFd(); - mConnectionsByFd.add(fd, connection); - - if (monitor) { - mMonitoringChannels.push(inputChannel); - } - - mLooper->addFd(fd, 0, ALOOPER_EVENT_INPUT, handleReceiveCallback, this); - } // release lock - - // Wake the looper because some connections have changed. - mLooper->wake(); - return OK; -} - -status_t InputDispatcher::unregisterInputChannel(const sp& inputChannel) { -#if DEBUG_REGISTRATION - ALOGD("channel '%s' ~ unregisterInputChannel", inputChannel->getName().string()); -#endif - - { // acquire lock - AutoMutex _l(mLock); - - status_t status = unregisterInputChannelLocked(inputChannel, false /*notify*/); - if (status) { - return status; - } - } // release lock - - // Wake the poll loop because removing the connection may have changed the current - // synchronization state. - mLooper->wake(); - return OK; -} - -status_t InputDispatcher::unregisterInputChannelLocked(const sp& inputChannel, - bool notify) { - ssize_t connectionIndex = getConnectionIndexLocked(inputChannel); - if (connectionIndex < 0) { - ALOGW("Attempted to unregister already unregistered input channel '%s'", - inputChannel->getName().string()); - return BAD_VALUE; - } - - sp connection = mConnectionsByFd.valueAt(connectionIndex); - mConnectionsByFd.removeItemsAt(connectionIndex); - - if (connection->monitor) { - removeMonitorChannelLocked(inputChannel); - } - - mLooper->removeFd(inputChannel->getFd()); - - nsecs_t currentTime = now(); - abortBrokenDispatchCycleLocked(currentTime, connection, notify); - - connection->status = Connection::STATUS_ZOMBIE; - return OK; -} - -void InputDispatcher::removeMonitorChannelLocked(const sp& inputChannel) { - for (size_t i = 0; i < mMonitoringChannels.size(); i++) { - if (mMonitoringChannels[i] == inputChannel) { - mMonitoringChannels.removeAt(i); - break; - } - } -} - -ssize_t InputDispatcher::getConnectionIndexLocked(const sp& inputChannel) { - ssize_t connectionIndex = mConnectionsByFd.indexOfKey(inputChannel->getFd()); - if (connectionIndex >= 0) { - sp connection = mConnectionsByFd.valueAt(connectionIndex); - if (connection->inputChannel.get() == inputChannel.get()) { - return connectionIndex; - } - } - - return -1; -} - -void InputDispatcher::onDispatchCycleFinishedLocked( - nsecs_t currentTime, const sp& connection, uint32_t seq, bool handled) { - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doDispatchCycleFinishedLockedInterruptible); - commandEntry->connection = connection; - commandEntry->eventTime = currentTime; - commandEntry->seq = seq; - commandEntry->handled = handled; -} - -void InputDispatcher::onDispatchCycleBrokenLocked( - nsecs_t currentTime, const sp& connection) { - ALOGE("channel '%s' ~ Channel is unrecoverably broken and will be disposed!", - connection->getInputChannelName()); - - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doNotifyInputChannelBrokenLockedInterruptible); - commandEntry->connection = connection; -} - -void InputDispatcher::onANRLocked( - nsecs_t currentTime, const sp& applicationHandle, - const sp& windowHandle, - nsecs_t eventTime, nsecs_t waitStartTime, const char* reason) { - float dispatchLatency = (currentTime - eventTime) * 0.000001f; - float waitDuration = (currentTime - waitStartTime) * 0.000001f; - ALOGI("Application is not responding: %s. " - "It has been %0.1fms since event, %0.1fms since wait started. Reason: %s", - getApplicationWindowLabelLocked(applicationHandle, windowHandle).string(), - dispatchLatency, waitDuration, reason); - - // Capture a record of the InputDispatcher state at the time of the ANR. - time_t t = time(NULL); - struct tm tm; - localtime_r(&t, &tm); - char timestr[64]; - strftime(timestr, sizeof(timestr), "%F %T", &tm); - mLastANRState.clear(); - mLastANRState.append(INDENT "ANR:\n"); - mLastANRState.appendFormat(INDENT2 "Time: %s\n", timestr); - mLastANRState.appendFormat(INDENT2 "Window: %s\n", - getApplicationWindowLabelLocked(applicationHandle, windowHandle).string()); - mLastANRState.appendFormat(INDENT2 "DispatchLatency: %0.1fms\n", dispatchLatency); - mLastANRState.appendFormat(INDENT2 "WaitDuration: %0.1fms\n", waitDuration); - mLastANRState.appendFormat(INDENT2 "Reason: %s\n", reason); - dumpDispatchStateLocked(mLastANRState); - - CommandEntry* commandEntry = postCommandLocked( - & InputDispatcher::doNotifyANRLockedInterruptible); - commandEntry->inputApplicationHandle = applicationHandle; - commandEntry->inputWindowHandle = windowHandle; - commandEntry->reason = reason; -} - -void InputDispatcher::doNotifyConfigurationChangedInterruptible( - CommandEntry* commandEntry) { - mLock.unlock(); - - mPolicy->notifyConfigurationChanged(commandEntry->eventTime); - - mLock.lock(); -} - -void InputDispatcher::doNotifyInputChannelBrokenLockedInterruptible( - CommandEntry* commandEntry) { - sp connection = commandEntry->connection; - - if (connection->status != Connection::STATUS_ZOMBIE) { - mLock.unlock(); - - mPolicy->notifyInputChannelBroken(connection->inputWindowHandle); - - mLock.lock(); - } -} - -void InputDispatcher::doNotifyANRLockedInterruptible( - CommandEntry* commandEntry) { - mLock.unlock(); - - nsecs_t newTimeout = mPolicy->notifyANR( - commandEntry->inputApplicationHandle, commandEntry->inputWindowHandle, - commandEntry->reason); - - mLock.lock(); - - resumeAfterTargetsNotReadyTimeoutLocked(newTimeout, - commandEntry->inputWindowHandle != NULL - ? commandEntry->inputWindowHandle->getInputChannel() : NULL); -} - -void InputDispatcher::doInterceptKeyBeforeDispatchingLockedInterruptible( - CommandEntry* commandEntry) { - KeyEntry* entry = commandEntry->keyEntry; - - KeyEvent event; - initializeKeyEvent(&event, entry); - - mLock.unlock(); - - nsecs_t delay = mPolicy->interceptKeyBeforeDispatching(commandEntry->inputWindowHandle, - &event, entry->policyFlags); - - mLock.lock(); - - if (delay < 0) { - entry->interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_SKIP; - } else if (!delay) { - entry->interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_CONTINUE; - } else { - entry->interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER; - entry->interceptKeyWakeupTime = now() + delay; - } - entry->release(); -} - -void InputDispatcher::doDispatchCycleFinishedLockedInterruptible( - CommandEntry* commandEntry) { - sp connection = commandEntry->connection; - nsecs_t finishTime = commandEntry->eventTime; - uint32_t seq = commandEntry->seq; - bool handled = commandEntry->handled; - - // Handle post-event policy actions. - DispatchEntry* dispatchEntry = connection->findWaitQueueEntry(seq); - if (dispatchEntry) { - nsecs_t eventDuration = finishTime - dispatchEntry->deliveryTime; - if (eventDuration > SLOW_EVENT_PROCESSING_WARNING_TIMEOUT) { - String8 msg; - msg.appendFormat("Window '%s' spent %0.1fms processing the last input event: ", - connection->getWindowName(), eventDuration * 0.000001f); - dispatchEntry->eventEntry->appendDescription(msg); - ALOGI("%s", msg.string()); - } - - bool restartEvent; - if (dispatchEntry->eventEntry->type == EventEntry::TYPE_KEY) { - KeyEntry* keyEntry = static_cast(dispatchEntry->eventEntry); - restartEvent = afterKeyEventLockedInterruptible(connection, - dispatchEntry, keyEntry, handled); - } else if (dispatchEntry->eventEntry->type == EventEntry::TYPE_MOTION) { - MotionEntry* motionEntry = static_cast(dispatchEntry->eventEntry); - restartEvent = afterMotionEventLockedInterruptible(connection, - dispatchEntry, motionEntry, handled); - } else { - restartEvent = false; - } - - // Dequeue the event and start the next cycle. - // Note that because the lock might have been released, it is possible that the - // contents of the wait queue to have been drained, so we need to double-check - // a few things. - if (dispatchEntry == connection->findWaitQueueEntry(seq)) { - connection->waitQueue.dequeue(dispatchEntry); - traceWaitQueueLengthLocked(connection); - if (restartEvent && connection->status == Connection::STATUS_NORMAL) { - connection->outboundQueue.enqueueAtHead(dispatchEntry); - traceOutboundQueueLengthLocked(connection); - } else { - releaseDispatchEntryLocked(dispatchEntry); - } - } - - // Start the next dispatch cycle for this connection. - startDispatchCycleLocked(now(), connection); - } -} - -bool InputDispatcher::afterKeyEventLockedInterruptible(const sp& connection, - DispatchEntry* dispatchEntry, KeyEntry* keyEntry, bool handled) { - if (!(keyEntry->flags & AKEY_EVENT_FLAG_FALLBACK)) { - // Get the fallback key state. - // Clear it out after dispatching the UP. - int32_t originalKeyCode = keyEntry->keyCode; - int32_t fallbackKeyCode = connection->inputState.getFallbackKey(originalKeyCode); - if (keyEntry->action == AKEY_EVENT_ACTION_UP) { - connection->inputState.removeFallbackKey(originalKeyCode); - } - - if (handled || !dispatchEntry->hasForegroundTarget()) { - // If the application handles the original key for which we previously - // generated a fallback or if the window is not a foreground window, - // then cancel the associated fallback key, if any. - if (fallbackKeyCode != -1) { - // Dispatch the unhandled key to the policy with the cancel flag. -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Unhandled key event: Asking policy to cancel fallback action. " - "keyCode=%d, action=%d, repeatCount=%d, policyFlags=0x%08x", - keyEntry->keyCode, keyEntry->action, keyEntry->repeatCount, - keyEntry->policyFlags); -#endif - KeyEvent event; - initializeKeyEvent(&event, keyEntry); - event.setFlags(event.getFlags() | AKEY_EVENT_FLAG_CANCELED); - - mLock.unlock(); - - mPolicy->dispatchUnhandledKey(connection->inputWindowHandle, - &event, keyEntry->policyFlags, &event); - - mLock.lock(); - - // Cancel the fallback key. - if (fallbackKeyCode != AKEYCODE_UNKNOWN) { - CancelationOptions options(CancelationOptions::CANCEL_FALLBACK_EVENTS, - "application handled the original non-fallback key " - "or is no longer a foreground target, " - "canceling previously dispatched fallback key"); - options.keyCode = fallbackKeyCode; - synthesizeCancelationEventsForConnectionLocked(connection, options); - } - connection->inputState.removeFallbackKey(originalKeyCode); - } - } else { - // If the application did not handle a non-fallback key, first check - // that we are in a good state to perform unhandled key event processing - // Then ask the policy what to do with it. - bool initialDown = keyEntry->action == AKEY_EVENT_ACTION_DOWN - && keyEntry->repeatCount == 0; - if (fallbackKeyCode == -1 && !initialDown) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Unhandled key event: Skipping unhandled key event processing " - "since this is not an initial down. " - "keyCode=%d, action=%d, repeatCount=%d, policyFlags=0x%08x", - originalKeyCode, keyEntry->action, keyEntry->repeatCount, - keyEntry->policyFlags); -#endif - return false; - } - - // Dispatch the unhandled key to the policy. -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Unhandled key event: Asking policy to perform fallback action. " - "keyCode=%d, action=%d, repeatCount=%d, policyFlags=0x%08x", - keyEntry->keyCode, keyEntry->action, keyEntry->repeatCount, - keyEntry->policyFlags); -#endif - KeyEvent event; - initializeKeyEvent(&event, keyEntry); - - mLock.unlock(); - - bool fallback = mPolicy->dispatchUnhandledKey(connection->inputWindowHandle, - &event, keyEntry->policyFlags, &event); - - mLock.lock(); - - if (connection->status != Connection::STATUS_NORMAL) { - connection->inputState.removeFallbackKey(originalKeyCode); - return false; - } - - // Latch the fallback keycode for this key on an initial down. - // The fallback keycode cannot change at any other point in the lifecycle. - if (initialDown) { - if (fallback) { - fallbackKeyCode = event.getKeyCode(); - } else { - fallbackKeyCode = AKEYCODE_UNKNOWN; - } - connection->inputState.setFallbackKey(originalKeyCode, fallbackKeyCode); - } - - ALOG_ASSERT(fallbackKeyCode != -1); - - // Cancel the fallback key if the policy decides not to send it anymore. - // We will continue to dispatch the key to the policy but we will no - // longer dispatch a fallback key to the application. - if (fallbackKeyCode != AKEYCODE_UNKNOWN - && (!fallback || fallbackKeyCode != event.getKeyCode())) { -#if DEBUG_OUTBOUND_EVENT_DETAILS - if (fallback) { - ALOGD("Unhandled key event: Policy requested to send key %d" - "as a fallback for %d, but on the DOWN it had requested " - "to send %d instead. Fallback canceled.", - event.getKeyCode(), originalKeyCode, fallbackKeyCode); - } else { - ALOGD("Unhandled key event: Policy did not request fallback for %d, " - "but on the DOWN it had requested to send %d. " - "Fallback canceled.", - originalKeyCode, fallbackKeyCode); - } -#endif - - CancelationOptions options(CancelationOptions::CANCEL_FALLBACK_EVENTS, - "canceling fallback, policy no longer desires it"); - options.keyCode = fallbackKeyCode; - synthesizeCancelationEventsForConnectionLocked(connection, options); - - fallback = false; - fallbackKeyCode = AKEYCODE_UNKNOWN; - if (keyEntry->action != AKEY_EVENT_ACTION_UP) { - connection->inputState.setFallbackKey(originalKeyCode, - fallbackKeyCode); - } - } - -#if DEBUG_OUTBOUND_EVENT_DETAILS - { - String8 msg; - const KeyedVector& fallbackKeys = - connection->inputState.getFallbackKeys(); - for (size_t i = 0; i < fallbackKeys.size(); i++) { - msg.appendFormat(", %d->%d", fallbackKeys.keyAt(i), - fallbackKeys.valueAt(i)); - } - ALOGD("Unhandled key event: %d currently tracked fallback keys%s.", - fallbackKeys.size(), msg.string()); - } -#endif - - if (fallback) { - // Restart the dispatch cycle using the fallback key. - keyEntry->eventTime = event.getEventTime(); - keyEntry->deviceId = event.getDeviceId(); - keyEntry->source = event.getSource(); - keyEntry->flags = event.getFlags() | AKEY_EVENT_FLAG_FALLBACK; - keyEntry->keyCode = fallbackKeyCode; - keyEntry->scanCode = event.getScanCode(); - keyEntry->metaState = event.getMetaState(); - keyEntry->repeatCount = event.getRepeatCount(); - keyEntry->downTime = event.getDownTime(); - keyEntry->syntheticRepeat = false; - -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Unhandled key event: Dispatching fallback key. " - "originalKeyCode=%d, fallbackKeyCode=%d, fallbackMetaState=%08x", - originalKeyCode, fallbackKeyCode, keyEntry->metaState); -#endif - return true; // restart the event - } else { -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Unhandled key event: No fallback key."); -#endif - } - } - } - return false; -} - -bool InputDispatcher::afterMotionEventLockedInterruptible(const sp& connection, - DispatchEntry* dispatchEntry, MotionEntry* motionEntry, bool handled) { - return false; -} - -void InputDispatcher::doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry) { - mLock.unlock(); - - mPolicy->pokeUserActivity(commandEntry->eventTime, commandEntry->userActivityEventType); - - mLock.lock(); -} - -void InputDispatcher::initializeKeyEvent(KeyEvent* event, const KeyEntry* entry) { - event->initialize(entry->deviceId, entry->source, entry->action, entry->flags, - entry->keyCode, entry->scanCode, entry->metaState, entry->repeatCount, - entry->downTime, entry->eventTime); -} - -void InputDispatcher::updateDispatchStatisticsLocked(nsecs_t currentTime, const EventEntry* entry, - int32_t injectionResult, nsecs_t timeSpentWaitingForApplication) { - // TODO Write some statistics about how long we spend waiting. -} - -void InputDispatcher::traceInboundQueueLengthLocked() { - if (ATRACE_ENABLED()) { - ATRACE_INT("iq", mInboundQueue.count()); - } -} - -void InputDispatcher::traceOutboundQueueLengthLocked(const sp& connection) { - if (ATRACE_ENABLED()) { - char counterName[40]; - snprintf(counterName, sizeof(counterName), "oq:%s", connection->getWindowName()); - ATRACE_INT(counterName, connection->outboundQueue.count()); - } -} - -void InputDispatcher::traceWaitQueueLengthLocked(const sp& connection) { - if (ATRACE_ENABLED()) { - char counterName[40]; - snprintf(counterName, sizeof(counterName), "wq:%s", connection->getWindowName()); - ATRACE_INT(counterName, connection->waitQueue.count()); - } -} - -void InputDispatcher::dump(String8& dump) { - AutoMutex _l(mLock); - - dump.append("Input Dispatcher State:\n"); - dumpDispatchStateLocked(dump); - - if (!mLastANRState.isEmpty()) { - dump.append("\nInput Dispatcher State at time of last ANR:\n"); - dump.append(mLastANRState); - } -} - -void InputDispatcher::monitor() { - // Acquire and release the lock to ensure that the dispatcher has not deadlocked. - mLock.lock(); - mLooper->wake(); - mDispatcherIsAliveCondition.wait(mLock); - mLock.unlock(); -} - - -// --- InputDispatcher::InjectionState --- - -InputDispatcher::InjectionState::InjectionState(int32_t injectorPid, int32_t injectorUid) : - refCount(1), - injectorPid(injectorPid), injectorUid(injectorUid), - injectionResult(INPUT_EVENT_INJECTION_PENDING), injectionIsAsync(false), - pendingForegroundDispatches(0) { -} - -InputDispatcher::InjectionState::~InjectionState() { -} - -void InputDispatcher::InjectionState::release() { - refCount -= 1; - if (refCount == 0) { - delete this; - } else { - ALOG_ASSERT(refCount > 0); - } -} - - -// --- InputDispatcher::EventEntry --- - -InputDispatcher::EventEntry::EventEntry(int32_t type, nsecs_t eventTime, uint32_t policyFlags) : - refCount(1), type(type), eventTime(eventTime), policyFlags(policyFlags), - injectionState(NULL), dispatchInProgress(false) { -} - -InputDispatcher::EventEntry::~EventEntry() { - releaseInjectionState(); -} - -void InputDispatcher::EventEntry::release() { - refCount -= 1; - if (refCount == 0) { - delete this; - } else { - ALOG_ASSERT(refCount > 0); - } -} - -void InputDispatcher::EventEntry::releaseInjectionState() { - if (injectionState) { - injectionState->release(); - injectionState = NULL; - } -} - - -// --- InputDispatcher::ConfigurationChangedEntry --- - -InputDispatcher::ConfigurationChangedEntry::ConfigurationChangedEntry(nsecs_t eventTime) : - EventEntry(TYPE_CONFIGURATION_CHANGED, eventTime, 0) { -} - -InputDispatcher::ConfigurationChangedEntry::~ConfigurationChangedEntry() { -} - -void InputDispatcher::ConfigurationChangedEntry::appendDescription(String8& msg) const { - msg.append("ConfigurationChangedEvent(), policyFlags=0x%08x", - policyFlags); -} - - -// --- InputDispatcher::DeviceResetEntry --- - -InputDispatcher::DeviceResetEntry::DeviceResetEntry(nsecs_t eventTime, int32_t deviceId) : - EventEntry(TYPE_DEVICE_RESET, eventTime, 0), - deviceId(deviceId) { -} - -InputDispatcher::DeviceResetEntry::~DeviceResetEntry() { -} - -void InputDispatcher::DeviceResetEntry::appendDescription(String8& msg) const { - msg.appendFormat("DeviceResetEvent(deviceId=%d), policyFlags=0x%08x", - deviceId, policyFlags); -} - - -// --- InputDispatcher::KeyEntry --- - -InputDispatcher::KeyEntry::KeyEntry(nsecs_t eventTime, - int32_t deviceId, uint32_t source, uint32_t policyFlags, int32_t action, - int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, - int32_t repeatCount, nsecs_t downTime) : - EventEntry(TYPE_KEY, eventTime, policyFlags), - deviceId(deviceId), source(source), action(action), flags(flags), - keyCode(keyCode), scanCode(scanCode), metaState(metaState), - repeatCount(repeatCount), downTime(downTime), - syntheticRepeat(false), interceptKeyResult(KeyEntry::INTERCEPT_KEY_RESULT_UNKNOWN), - interceptKeyWakeupTime(0) { -} - -InputDispatcher::KeyEntry::~KeyEntry() { -} - -void InputDispatcher::KeyEntry::appendDescription(String8& msg) const { - msg.appendFormat("KeyEvent(deviceId=%d, source=0x%08x, action=%d, " - "flags=0x%08x, keyCode=%d, scanCode=%d, metaState=0x%08x, " - "repeatCount=%d), policyFlags=0x%08x", - deviceId, source, action, flags, keyCode, scanCode, metaState, - repeatCount, policyFlags); -} - -void InputDispatcher::KeyEntry::recycle() { - releaseInjectionState(); - - dispatchInProgress = false; - syntheticRepeat = false; - interceptKeyResult = KeyEntry::INTERCEPT_KEY_RESULT_UNKNOWN; - interceptKeyWakeupTime = 0; -} - - -// --- InputDispatcher::MotionEntry --- - -InputDispatcher::MotionEntry::MotionEntry(nsecs_t eventTime, int32_t deviceId, - uint32_t source, uint32_t policyFlags, int32_t action, int32_t actionButton, - int32_t flags, int32_t metaState, int32_t buttonState, int32_t edgeFlags, - float xPrecision, float yPrecision, nsecs_t downTime, - int32_t displayId, uint32_t pointerCount, - const PointerProperties* pointerProperties, const PointerCoords* pointerCoords, - float xOffset, float yOffset) : - EventEntry(TYPE_MOTION, eventTime, policyFlags), - eventTime(eventTime), - deviceId(deviceId), source(source), action(action), actionButton(actionButton), - flags(flags), metaState(metaState), buttonState(buttonState), - edgeFlags(edgeFlags), xPrecision(xPrecision), yPrecision(yPrecision), - downTime(downTime), displayId(displayId), pointerCount(pointerCount) { - for (uint32_t i = 0; i < pointerCount; i++) { - this->pointerProperties[i].copyFrom(pointerProperties[i]); - this->pointerCoords[i].copyFrom(pointerCoords[i]); - if (xOffset || yOffset) { - this->pointerCoords[i].applyOffset(xOffset, yOffset); - } - } -} - -InputDispatcher::MotionEntry::~MotionEntry() { -} - -void InputDispatcher::MotionEntry::appendDescription(String8& msg) const { - msg.appendFormat("MotionEvent(deviceId=%d, source=0x%08x, action=%d, actionButton=0x%08x, " - "flags=0x%08x, metaState=0x%08x, buttonState=0x%08x, " - "edgeFlags=0x%08x, xPrecision=%.1f, yPrecision=%.1f, displayId=%d, pointers=[", - deviceId, source, action, actionButton, flags, metaState, buttonState, edgeFlags, - xPrecision, yPrecision, displayId); - for (uint32_t i = 0; i < pointerCount; i++) { - if (i) { - msg.append(", "); - } - msg.appendFormat("%d: (%.1f, %.1f)", pointerProperties[i].id, - pointerCoords[i].getX(), pointerCoords[i].getY()); - } - msg.appendFormat("]), policyFlags=0x%08x", policyFlags); -} - - -// --- InputDispatcher::DispatchEntry --- - -volatile int32_t InputDispatcher::DispatchEntry::sNextSeqAtomic; - -InputDispatcher::DispatchEntry::DispatchEntry(EventEntry* eventEntry, - int32_t targetFlags, float xOffset, float yOffset, float scaleFactor) : - seq(nextSeq()), - eventEntry(eventEntry), targetFlags(targetFlags), - xOffset(xOffset), yOffset(yOffset), scaleFactor(scaleFactor), - deliveryTime(0), resolvedAction(0), resolvedFlags(0) { - eventEntry->refCount += 1; -} - -InputDispatcher::DispatchEntry::~DispatchEntry() { - eventEntry->release(); -} - -uint32_t InputDispatcher::DispatchEntry::nextSeq() { - // Sequence number 0 is reserved and will never be returned. - uint32_t seq; - do { - seq = android_atomic_inc(&sNextSeqAtomic); - } while (!seq); - return seq; -} - - -// --- InputDispatcher::InputState --- - -InputDispatcher::InputState::InputState() { -} - -InputDispatcher::InputState::~InputState() { -} - -bool InputDispatcher::InputState::isNeutral() const { - return mKeyMementos.isEmpty() && mMotionMementos.isEmpty(); -} - -bool InputDispatcher::InputState::isHovering(int32_t deviceId, uint32_t source, - int32_t displayId) const { - for (size_t i = 0; i < mMotionMementos.size(); i++) { - const MotionMemento& memento = mMotionMementos.itemAt(i); - if (memento.deviceId == deviceId - && memento.source == source - && memento.displayId == displayId - && memento.hovering) { - return true; - } - } - return false; -} - -bool InputDispatcher::InputState::trackKey(const KeyEntry* entry, - int32_t action, int32_t flags) { - switch (action) { - case AKEY_EVENT_ACTION_UP: { - if (entry->flags & AKEY_EVENT_FLAG_FALLBACK) { - for (size_t i = 0; i < mFallbackKeys.size(); ) { - if (mFallbackKeys.valueAt(i) == entry->keyCode) { - mFallbackKeys.removeItemsAt(i); - } else { - i += 1; - } - } - } - ssize_t index = findKeyMemento(entry); - if (index >= 0) { - mKeyMementos.removeAt(index); - return true; - } - /* FIXME: We can't just drop the key up event because that prevents creating - * popup windows that are automatically shown when a key is held and then - * dismissed when the key is released. The problem is that the popup will - * not have received the original key down, so the key up will be considered - * to be inconsistent with its observed state. We could perhaps handle this - * by synthesizing a key down but that will cause other problems. - * - * So for now, allow inconsistent key up events to be dispatched. - * -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Dropping inconsistent key up event: deviceId=%d, source=%08x, " - "keyCode=%d, scanCode=%d", - entry->deviceId, entry->source, entry->keyCode, entry->scanCode); -#endif - return false; - */ - return true; - } - - case AKEY_EVENT_ACTION_DOWN: { - ssize_t index = findKeyMemento(entry); - if (index >= 0) { - mKeyMementos.removeAt(index); - } - addKeyMemento(entry, flags); - return true; - } - - default: - return true; - } -} - -bool InputDispatcher::InputState::trackMotion(const MotionEntry* entry, - int32_t action, int32_t flags) { - int32_t actionMasked = action & AMOTION_EVENT_ACTION_MASK; - switch (actionMasked) { - case AMOTION_EVENT_ACTION_UP: - case AMOTION_EVENT_ACTION_CANCEL: { - ssize_t index = findMotionMemento(entry, false /*hovering*/); - if (index >= 0) { - mMotionMementos.removeAt(index); - return true; - } -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Dropping inconsistent motion up or cancel event: deviceId=%d, source=%08x, " - "actionMasked=%d", - entry->deviceId, entry->source, actionMasked); -#endif - return false; - } - - case AMOTION_EVENT_ACTION_DOWN: { - ssize_t index = findMotionMemento(entry, false /*hovering*/); - if (index >= 0) { - mMotionMementos.removeAt(index); - } - addMotionMemento(entry, flags, false /*hovering*/); - return true; - } - - case AMOTION_EVENT_ACTION_POINTER_UP: - case AMOTION_EVENT_ACTION_POINTER_DOWN: - case AMOTION_EVENT_ACTION_MOVE: { - if (entry->source & AINPUT_SOURCE_CLASS_NAVIGATION) { - // Trackballs can send MOVE events with a corresponding DOWN or UP. There's no need to - // generate cancellation events for these since they're based in relative rather than - // absolute units. - return true; - } - - ssize_t index = findMotionMemento(entry, false /*hovering*/); - - if (entry->source & AINPUT_SOURCE_CLASS_JOYSTICK) { - // Joysticks can send MOVE events without a corresponding DOWN or UP. Since all - // joystick axes are normalized to [-1, 1] we can trust that 0 means it's neutral. Any - // other value and we need to track the motion so we can send cancellation events for - // anything generating fallback events (e.g. DPad keys for joystick movements). - if (index >= 0) { - if (entry->pointerCoords[0].isEmpty()) { - mMotionMementos.removeAt(index); - } else { - MotionMemento& memento = mMotionMementos.editItemAt(index); - memento.setPointers(entry); - } - } else if (!entry->pointerCoords[0].isEmpty()) { - addMotionMemento(entry, flags, false /*hovering*/); - } - - // Joysticks and trackballs can send MOVE events without corresponding DOWN or UP. - return true; - } - if (index >= 0) { - MotionMemento& memento = mMotionMementos.editItemAt(index); - memento.setPointers(entry); - return true; - } -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Dropping inconsistent motion pointer up/down or move event: " - "deviceId=%d, source=%08x, actionMasked=%d", - entry->deviceId, entry->source, actionMasked); -#endif - return false; - } - - case AMOTION_EVENT_ACTION_HOVER_EXIT: { - ssize_t index = findMotionMemento(entry, true /*hovering*/); - if (index >= 0) { - mMotionMementos.removeAt(index); - return true; - } -#if DEBUG_OUTBOUND_EVENT_DETAILS - ALOGD("Dropping inconsistent motion hover exit event: deviceId=%d, source=%08x", - entry->deviceId, entry->source); -#endif - return false; - } - - case AMOTION_EVENT_ACTION_HOVER_ENTER: - case AMOTION_EVENT_ACTION_HOVER_MOVE: { - ssize_t index = findMotionMemento(entry, true /*hovering*/); - if (index >= 0) { - mMotionMementos.removeAt(index); - } - addMotionMemento(entry, flags, true /*hovering*/); - return true; - } - - default: - return true; - } -} - -ssize_t InputDispatcher::InputState::findKeyMemento(const KeyEntry* entry) const { - for (size_t i = 0; i < mKeyMementos.size(); i++) { - const KeyMemento& memento = mKeyMementos.itemAt(i); - if (memento.deviceId == entry->deviceId - && memento.source == entry->source - && memento.keyCode == entry->keyCode - && memento.scanCode == entry->scanCode) { - return i; - } - } - return -1; -} - -ssize_t InputDispatcher::InputState::findMotionMemento(const MotionEntry* entry, - bool hovering) const { - for (size_t i = 0; i < mMotionMementos.size(); i++) { - const MotionMemento& memento = mMotionMementos.itemAt(i); - if (memento.deviceId == entry->deviceId - && memento.source == entry->source - && memento.displayId == entry->displayId - && memento.hovering == hovering) { - return i; - } - } - return -1; -} - -void InputDispatcher::InputState::addKeyMemento(const KeyEntry* entry, int32_t flags) { - mKeyMementos.push(); - KeyMemento& memento = mKeyMementos.editTop(); - memento.deviceId = entry->deviceId; - memento.source = entry->source; - memento.keyCode = entry->keyCode; - memento.scanCode = entry->scanCode; - memento.metaState = entry->metaState; - memento.flags = flags; - memento.downTime = entry->downTime; - memento.policyFlags = entry->policyFlags; -} - -void InputDispatcher::InputState::addMotionMemento(const MotionEntry* entry, - int32_t flags, bool hovering) { - mMotionMementos.push(); - MotionMemento& memento = mMotionMementos.editTop(); - memento.deviceId = entry->deviceId; - memento.source = entry->source; - memento.flags = flags; - memento.xPrecision = entry->xPrecision; - memento.yPrecision = entry->yPrecision; - memento.downTime = entry->downTime; - memento.displayId = entry->displayId; - memento.setPointers(entry); - memento.hovering = hovering; - memento.policyFlags = entry->policyFlags; -} - -void InputDispatcher::InputState::MotionMemento::setPointers(const MotionEntry* entry) { - pointerCount = entry->pointerCount; - for (uint32_t i = 0; i < entry->pointerCount; i++) { - pointerProperties[i].copyFrom(entry->pointerProperties[i]); - pointerCoords[i].copyFrom(entry->pointerCoords[i]); - } -} - -void InputDispatcher::InputState::synthesizeCancelationEvents(nsecs_t currentTime, - Vector& outEvents, const CancelationOptions& options) { - for (size_t i = 0; i < mKeyMementos.size(); i++) { - const KeyMemento& memento = mKeyMementos.itemAt(i); - if (shouldCancelKey(memento, options)) { - outEvents.push(new KeyEntry(currentTime, - memento.deviceId, memento.source, memento.policyFlags, - AKEY_EVENT_ACTION_UP, memento.flags | AKEY_EVENT_FLAG_CANCELED, - memento.keyCode, memento.scanCode, memento.metaState, 0, memento.downTime)); - } - } - - for (size_t i = 0; i < mMotionMementos.size(); i++) { - const MotionMemento& memento = mMotionMementos.itemAt(i); - if (shouldCancelMotion(memento, options)) { - outEvents.push(new MotionEntry(currentTime, - memento.deviceId, memento.source, memento.policyFlags, - memento.hovering - ? AMOTION_EVENT_ACTION_HOVER_EXIT - : AMOTION_EVENT_ACTION_CANCEL, - memento.flags, 0, 0, 0, 0, - memento.xPrecision, memento.yPrecision, memento.downTime, - memento.displayId, - memento.pointerCount, memento.pointerProperties, memento.pointerCoords, - 0, 0)); - } - } -} - -void InputDispatcher::InputState::clear() { - mKeyMementos.clear(); - mMotionMementos.clear(); - mFallbackKeys.clear(); -} - -void InputDispatcher::InputState::copyPointerStateTo(InputState& other) const { - for (size_t i = 0; i < mMotionMementos.size(); i++) { - const MotionMemento& memento = mMotionMementos.itemAt(i); - if (memento.source & AINPUT_SOURCE_CLASS_POINTER) { - for (size_t j = 0; j < other.mMotionMementos.size(); ) { - const MotionMemento& otherMemento = other.mMotionMementos.itemAt(j); - if (memento.deviceId == otherMemento.deviceId - && memento.source == otherMemento.source - && memento.displayId == otherMemento.displayId) { - other.mMotionMementos.removeAt(j); - } else { - j += 1; - } - } - other.mMotionMementos.push(memento); - } - } -} - -int32_t InputDispatcher::InputState::getFallbackKey(int32_t originalKeyCode) { - ssize_t index = mFallbackKeys.indexOfKey(originalKeyCode); - return index >= 0 ? mFallbackKeys.valueAt(index) : -1; -} - -void InputDispatcher::InputState::setFallbackKey(int32_t originalKeyCode, - int32_t fallbackKeyCode) { - ssize_t index = mFallbackKeys.indexOfKey(originalKeyCode); - if (index >= 0) { - mFallbackKeys.replaceValueAt(index, fallbackKeyCode); - } else { - mFallbackKeys.add(originalKeyCode, fallbackKeyCode); - } -} - -void InputDispatcher::InputState::removeFallbackKey(int32_t originalKeyCode) { - mFallbackKeys.removeItem(originalKeyCode); -} - -bool InputDispatcher::InputState::shouldCancelKey(const KeyMemento& memento, - const CancelationOptions& options) { - if (options.keyCode != -1 && memento.keyCode != options.keyCode) { - return false; - } - - if (options.deviceId != -1 && memento.deviceId != options.deviceId) { - return false; - } - - switch (options.mode) { - case CancelationOptions::CANCEL_ALL_EVENTS: - case CancelationOptions::CANCEL_NON_POINTER_EVENTS: - return true; - case CancelationOptions::CANCEL_FALLBACK_EVENTS: - return memento.flags & AKEY_EVENT_FLAG_FALLBACK; - default: - return false; - } -} - -bool InputDispatcher::InputState::shouldCancelMotion(const MotionMemento& memento, - const CancelationOptions& options) { - if (options.deviceId != -1 && memento.deviceId != options.deviceId) { - return false; - } - - switch (options.mode) { - case CancelationOptions::CANCEL_ALL_EVENTS: - return true; - case CancelationOptions::CANCEL_POINTER_EVENTS: - return memento.source & AINPUT_SOURCE_CLASS_POINTER; - case CancelationOptions::CANCEL_NON_POINTER_EVENTS: - return !(memento.source & AINPUT_SOURCE_CLASS_POINTER); - default: - return false; - } -} - - -// --- InputDispatcher::Connection --- - -InputDispatcher::Connection::Connection(const sp& inputChannel, - const sp& inputWindowHandle, bool monitor) : - status(STATUS_NORMAL), inputChannel(inputChannel), inputWindowHandle(inputWindowHandle), - monitor(monitor), - inputPublisher(inputChannel), inputPublisherBlocked(false) { -} - -InputDispatcher::Connection::~Connection() { -} - -const char* InputDispatcher::Connection::getWindowName() const { - if (inputWindowHandle != NULL) { - return inputWindowHandle->getName().string(); - } - if (monitor) { - return "monitor"; - } - return "?"; -} - -const char* InputDispatcher::Connection::getStatusLabel() const { - switch (status) { - case STATUS_NORMAL: - return "NORMAL"; - - case STATUS_BROKEN: - return "BROKEN"; - - case STATUS_ZOMBIE: - return "ZOMBIE"; - - default: - return "UNKNOWN"; - } -} - -InputDispatcher::DispatchEntry* InputDispatcher::Connection::findWaitQueueEntry(uint32_t seq) { - for (DispatchEntry* entry = waitQueue.head; entry != NULL; entry = entry->next) { - if (entry->seq == seq) { - return entry; - } - } - return NULL; -} - - -// --- InputDispatcher::CommandEntry --- - -InputDispatcher::CommandEntry::CommandEntry(Command command) : - command(command), eventTime(0), keyEntry(NULL), userActivityEventType(0), - seq(0), handled(false) { -} - -InputDispatcher::CommandEntry::~CommandEntry() { -} - - -// --- InputDispatcher::TouchState --- - -InputDispatcher::TouchState::TouchState() : - down(false), split(false), deviceId(-1), source(0), displayId(-1) { -} - -InputDispatcher::TouchState::~TouchState() { -} - -void InputDispatcher::TouchState::reset() { - down = false; - split = false; - deviceId = -1; - source = 0; - displayId = -1; - windows.clear(); -} - -void InputDispatcher::TouchState::copyFrom(const TouchState& other) { - down = other.down; - split = other.split; - deviceId = other.deviceId; - source = other.source; - displayId = other.displayId; - windows = other.windows; -} - -void InputDispatcher::TouchState::addOrUpdateWindow(const sp& windowHandle, - int32_t targetFlags, BitSet32 pointerIds) { - if (targetFlags & InputTarget::FLAG_SPLIT) { - split = true; - } - - for (size_t i = 0; i < windows.size(); i++) { - TouchedWindow& touchedWindow = windows.editItemAt(i); - if (touchedWindow.windowHandle == windowHandle) { - touchedWindow.targetFlags |= targetFlags; - if (targetFlags & InputTarget::FLAG_DISPATCH_AS_SLIPPERY_EXIT) { - touchedWindow.targetFlags &= ~InputTarget::FLAG_DISPATCH_AS_IS; - } - touchedWindow.pointerIds.value |= pointerIds.value; - return; - } - } - - windows.push(); - - TouchedWindow& touchedWindow = windows.editTop(); - touchedWindow.windowHandle = windowHandle; - touchedWindow.targetFlags = targetFlags; - touchedWindow.pointerIds = pointerIds; -} - -void InputDispatcher::TouchState::removeWindow(const sp& windowHandle) { - for (size_t i = 0; i < windows.size(); i++) { - if (windows.itemAt(i).windowHandle == windowHandle) { - windows.removeAt(i); - return; - } - } -} - -void InputDispatcher::TouchState::filterNonAsIsTouchWindows() { - for (size_t i = 0 ; i < windows.size(); ) { - TouchedWindow& window = windows.editItemAt(i); - if (window.targetFlags & (InputTarget::FLAG_DISPATCH_AS_IS - | InputTarget::FLAG_DISPATCH_AS_SLIPPERY_ENTER)) { - window.targetFlags &= ~InputTarget::FLAG_DISPATCH_MASK; - window.targetFlags |= InputTarget::FLAG_DISPATCH_AS_IS; - i += 1; - } else { - windows.removeAt(i); - } - } -} - -sp InputDispatcher::TouchState::getFirstForegroundWindowHandle() const { - for (size_t i = 0; i < windows.size(); i++) { - const TouchedWindow& window = windows.itemAt(i); - if (window.targetFlags & InputTarget::FLAG_FOREGROUND) { - return window.windowHandle; - } - } - return NULL; -} - -bool InputDispatcher::TouchState::isSlippery() const { - // Must have exactly one foreground window. - bool haveSlipperyForegroundWindow = false; - for (size_t i = 0; i < windows.size(); i++) { - const TouchedWindow& window = windows.itemAt(i); - if (window.targetFlags & InputTarget::FLAG_FOREGROUND) { - if (haveSlipperyForegroundWindow - || !(window.windowHandle->getInfo()->layoutParamsFlags - & InputWindowInfo::FLAG_SLIPPERY)) { - return false; - } - haveSlipperyForegroundWindow = true; - } - } - return haveSlipperyForegroundWindow; -} - - -// --- InputDispatcherThread --- - -InputDispatcherThread::InputDispatcherThread(const sp& dispatcher) : - Thread(/*canCallJava*/ true), mDispatcher(dispatcher) { -} - -InputDispatcherThread::~InputDispatcherThread() { -} - -bool InputDispatcherThread::threadLoop() { - mDispatcher->dispatchOnce(); - return true; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputDispatcher.h android-platform-frameworks-native-21/services/inputflinger/InputDispatcher.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputDispatcher.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputDispatcher.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,1148 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _UI_INPUT_DISPATCHER_H -#define _UI_INPUT_DISPATCHER_H - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include - -#include "InputWindow.h" -#include "InputApplication.h" -#include "InputListener.h" - - -namespace android { - -/* - * Constants used to report the outcome of input event injection. - */ -enum { - /* (INTERNAL USE ONLY) Specifies that injection is pending and its outcome is unknown. */ - INPUT_EVENT_INJECTION_PENDING = -1, - - /* Injection succeeded. */ - INPUT_EVENT_INJECTION_SUCCEEDED = 0, - - /* Injection failed because the injector did not have permission to inject - * into the application with input focus. */ - INPUT_EVENT_INJECTION_PERMISSION_DENIED = 1, - - /* Injection failed because there were no available input targets. */ - INPUT_EVENT_INJECTION_FAILED = 2, - - /* Injection failed due to a timeout. */ - INPUT_EVENT_INJECTION_TIMED_OUT = 3 -}; - -/* - * Constants used to determine the input event injection synchronization mode. - */ -enum { - /* Injection is asynchronous and is assumed always to be successful. */ - INPUT_EVENT_INJECTION_SYNC_NONE = 0, - - /* Waits for previous events to be dispatched so that the input dispatcher can determine - * whether input event injection willbe permitted based on the current input focus. - * Does not wait for the input event to finish processing. */ - INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_RESULT = 1, - - /* Waits for the input event to be completely processed. */ - INPUT_EVENT_INJECTION_SYNC_WAIT_FOR_FINISHED = 2, -}; - - -/* - * An input target specifies how an input event is to be dispatched to a particular window - * including the window's input channel, control flags, a timeout, and an X / Y offset to - * be added to input event coordinates to compensate for the absolute position of the - * window area. - */ -struct InputTarget { - enum { - /* This flag indicates that the event is being delivered to a foreground application. */ - FLAG_FOREGROUND = 1 << 0, - - /* This flag indicates that the target of a MotionEvent is partly or wholly - * obscured by another visible window above it. The motion event should be - * delivered with flag AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED. */ - FLAG_WINDOW_IS_OBSCURED = 1 << 1, - - /* This flag indicates that a motion event is being split across multiple windows. */ - FLAG_SPLIT = 1 << 2, - - /* This flag indicates that the pointer coordinates dispatched to the application - * will be zeroed out to avoid revealing information to an application. This is - * used in conjunction with FLAG_DISPATCH_AS_OUTSIDE to prevent apps not sharing - * the same UID from watching all touches. */ - FLAG_ZERO_COORDS = 1 << 3, - - /* This flag indicates that the event should be sent as is. - * Should always be set unless the event is to be transmuted. */ - FLAG_DISPATCH_AS_IS = 1 << 8, - - /* This flag indicates that a MotionEvent with AMOTION_EVENT_ACTION_DOWN falls outside - * of the area of this target and so should instead be delivered as an - * AMOTION_EVENT_ACTION_OUTSIDE to this target. */ - FLAG_DISPATCH_AS_OUTSIDE = 1 << 9, - - /* This flag indicates that a hover sequence is starting in the given window. - * The event is transmuted into ACTION_HOVER_ENTER. */ - FLAG_DISPATCH_AS_HOVER_ENTER = 1 << 10, - - /* This flag indicates that a hover event happened outside of a window which handled - * previous hover events, signifying the end of the current hover sequence for that - * window. - * The event is transmuted into ACTION_HOVER_ENTER. */ - FLAG_DISPATCH_AS_HOVER_EXIT = 1 << 11, - - /* This flag indicates that the event should be canceled. - * It is used to transmute ACTION_MOVE into ACTION_CANCEL when a touch slips - * outside of a window. */ - FLAG_DISPATCH_AS_SLIPPERY_EXIT = 1 << 12, - - /* This flag indicates that the event should be dispatched as an initial down. - * It is used to transmute ACTION_MOVE into ACTION_DOWN when a touch slips - * into a new window. */ - FLAG_DISPATCH_AS_SLIPPERY_ENTER = 1 << 13, - - /* Mask for all dispatch modes. */ - FLAG_DISPATCH_MASK = FLAG_DISPATCH_AS_IS - | FLAG_DISPATCH_AS_OUTSIDE - | FLAG_DISPATCH_AS_HOVER_ENTER - | FLAG_DISPATCH_AS_HOVER_EXIT - | FLAG_DISPATCH_AS_SLIPPERY_EXIT - | FLAG_DISPATCH_AS_SLIPPERY_ENTER, - }; - - // The input channel to be targeted. - sp inputChannel; - - // Flags for the input target. - int32_t flags; - - // The x and y offset to add to a MotionEvent as it is delivered. - // (ignored for KeyEvents) - float xOffset, yOffset; - - // Scaling factor to apply to MotionEvent as it is delivered. - // (ignored for KeyEvents) - float scaleFactor; - - // The subset of pointer ids to include in motion events dispatched to this input target - // if FLAG_SPLIT is set. - BitSet32 pointerIds; -}; - - -/* - * Input dispatcher configuration. - * - * Specifies various options that modify the behavior of the input dispatcher. - * The values provided here are merely defaults. The actual values will come from ViewConfiguration - * and are passed into the dispatcher during initialization. - */ -struct InputDispatcherConfiguration { - // The key repeat initial timeout. - nsecs_t keyRepeatTimeout; - - // The key repeat inter-key delay. - nsecs_t keyRepeatDelay; - - InputDispatcherConfiguration() : - keyRepeatTimeout(500 * 1000000LL), - keyRepeatDelay(50 * 1000000LL) { } -}; - - -/* - * Input dispatcher policy interface. - * - * The input reader policy is used by the input reader to interact with the Window Manager - * and other system components. - * - * The actual implementation is partially supported by callbacks into the DVM - * via JNI. This interface is also mocked in the unit tests. - */ -class InputDispatcherPolicyInterface : public virtual RefBase { -protected: - InputDispatcherPolicyInterface() { } - virtual ~InputDispatcherPolicyInterface() { } - -public: - /* Notifies the system that a configuration change has occurred. */ - virtual void notifyConfigurationChanged(nsecs_t when) = 0; - - /* Notifies the system that an application is not responding. - * Returns a new timeout to continue waiting, or 0 to abort dispatch. */ - virtual nsecs_t notifyANR(const sp& inputApplicationHandle, - const sp& inputWindowHandle, - const String8& reason) = 0; - - /* Notifies the system that an input channel is unrecoverably broken. */ - virtual void notifyInputChannelBroken(const sp& inputWindowHandle) = 0; - - /* Gets the input dispatcher configuration. */ - virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) = 0; - - /* Filters an input event. - * Return true to dispatch the event unmodified, false to consume the event. - * A filter can also transform and inject events later by passing POLICY_FLAG_FILTERED - * to injectInputEvent. - */ - virtual bool filterInputEvent(const InputEvent* inputEvent, uint32_t policyFlags) = 0; - - /* Intercepts a key event immediately before queueing it. - * The policy can use this method as an opportunity to perform power management functions - * and early event preprocessing such as updating policy flags. - * - * This method is expected to set the POLICY_FLAG_PASS_TO_USER policy flag if the event - * should be dispatched to applications. - */ - virtual void interceptKeyBeforeQueueing(const KeyEvent* keyEvent, uint32_t& policyFlags) = 0; - - /* Intercepts a touch, trackball or other motion event before queueing it. - * The policy can use this method as an opportunity to perform power management functions - * and early event preprocessing such as updating policy flags. - * - * This method is expected to set the POLICY_FLAG_PASS_TO_USER policy flag if the event - * should be dispatched to applications. - */ - virtual void interceptMotionBeforeQueueing(nsecs_t when, uint32_t& policyFlags) = 0; - - /* Allows the policy a chance to intercept a key before dispatching. */ - virtual nsecs_t interceptKeyBeforeDispatching(const sp& inputWindowHandle, - const KeyEvent* keyEvent, uint32_t policyFlags) = 0; - - /* Allows the policy a chance to perform default processing for an unhandled key. - * Returns an alternate keycode to redispatch as a fallback, or 0 to give up. */ - virtual bool dispatchUnhandledKey(const sp& inputWindowHandle, - const KeyEvent* keyEvent, uint32_t policyFlags, KeyEvent* outFallbackKeyEvent) = 0; - - /* Notifies the policy about switch events. - */ - virtual void notifySwitch(nsecs_t when, - uint32_t switchValues, uint32_t switchMask, uint32_t policyFlags) = 0; - - /* Poke user activity for an event dispatched to a window. */ - virtual void pokeUserActivity(nsecs_t eventTime, int32_t eventType) = 0; - - /* Checks whether a given application pid/uid has permission to inject input events - * into other applications. - * - * This method is special in that its implementation promises to be non-reentrant and - * is safe to call while holding other locks. (Most other methods make no such guarantees!) - */ - virtual bool checkInjectEventsPermissionNonReentrant( - int32_t injectorPid, int32_t injectorUid) = 0; -}; - - -/* Notifies the system about input events generated by the input reader. - * The dispatcher is expected to be mostly asynchronous. */ -class InputDispatcherInterface : public virtual RefBase, public InputListenerInterface { -protected: - InputDispatcherInterface() { } - virtual ~InputDispatcherInterface() { } - -public: - /* Dumps the state of the input dispatcher. - * - * This method may be called on any thread (usually by the input manager). */ - virtual void dump(String8& dump) = 0; - - /* Called by the heatbeat to ensures that the dispatcher has not deadlocked. */ - virtual void monitor() = 0; - - /* Runs a single iteration of the dispatch loop. - * Nominally processes one queued event, a timeout, or a response from an input consumer. - * - * This method should only be called on the input dispatcher thread. - */ - virtual void dispatchOnce() = 0; - - /* Injects an input event and optionally waits for sync. - * The synchronization mode determines whether the method blocks while waiting for - * input injection to proceed. - * Returns one of the INPUT_EVENT_INJECTION_XXX constants. - * - * This method may be called on any thread (usually by the input manager). - */ - virtual int32_t injectInputEvent(const InputEvent* event, int32_t displayId, - int32_t injectorPid, int32_t injectorUid, int32_t syncMode, int32_t timeoutMillis, - uint32_t policyFlags) = 0; - - /* Sets the list of input windows. - * - * This method may be called on any thread (usually by the input manager). - */ - virtual void setInputWindows(const Vector >& inputWindowHandles) = 0; - - /* Sets the focused application. - * - * This method may be called on any thread (usually by the input manager). - */ - virtual void setFocusedApplication( - const sp& inputApplicationHandle) = 0; - - /* Sets the input dispatching mode. - * - * This method may be called on any thread (usually by the input manager). - */ - virtual void setInputDispatchMode(bool enabled, bool frozen) = 0; - - /* Sets whether input event filtering is enabled. - * When enabled, incoming input events are sent to the policy's filterInputEvent - * method instead of being dispatched. The filter is expected to use - * injectInputEvent to inject the events it would like to have dispatched. - * It should include POLICY_FLAG_FILTERED in the policy flags during injection. - */ - virtual void setInputFilterEnabled(bool enabled) = 0; - - /* Transfers touch focus from the window associated with one channel to the - * window associated with the other channel. - * - * Returns true on success. False if the window did not actually have touch focus. - */ - virtual bool transferTouchFocus(const sp& fromChannel, - const sp& toChannel) = 0; - - /* Registers or unregister input channels that may be used as targets for input events. - * If monitor is true, the channel will receive a copy of all input events. - * - * These methods may be called on any thread (usually by the input manager). - */ - virtual status_t registerInputChannel(const sp& inputChannel, - const sp& inputWindowHandle, bool monitor) = 0; - virtual status_t unregisterInputChannel(const sp& inputChannel) = 0; -}; - -/* Dispatches events to input targets. Some functions of the input dispatcher, such as - * identifying input targets, are controlled by a separate policy object. - * - * IMPORTANT INVARIANT: - * Because the policy can potentially block or cause re-entrance into the input dispatcher, - * the input dispatcher never calls into the policy while holding its internal locks. - * The implementation is also carefully designed to recover from scenarios such as an - * input channel becoming unregistered while identifying input targets or processing timeouts. - * - * Methods marked 'Locked' must be called with the lock acquired. - * - * Methods marked 'LockedInterruptible' must be called with the lock acquired but - * may during the course of their execution release the lock, call into the policy, and - * then reacquire the lock. The caller is responsible for recovering gracefully. - * - * A 'LockedInterruptible' method may called a 'Locked' method, but NOT vice-versa. - */ -class InputDispatcher : public InputDispatcherInterface { -protected: - virtual ~InputDispatcher(); - -public: - explicit InputDispatcher(const sp& policy); - - virtual void dump(String8& dump); - virtual void monitor(); - - virtual void dispatchOnce(); - - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args); - virtual void notifyKey(const NotifyKeyArgs* args); - virtual void notifyMotion(const NotifyMotionArgs* args); - virtual void notifySwitch(const NotifySwitchArgs* args); - virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args); - - virtual int32_t injectInputEvent(const InputEvent* event, int32_t displayId, - int32_t injectorPid, int32_t injectorUid, int32_t syncMode, int32_t timeoutMillis, - uint32_t policyFlags); - - virtual void setInputWindows(const Vector >& inputWindowHandles); - virtual void setFocusedApplication(const sp& inputApplicationHandle); - virtual void setInputDispatchMode(bool enabled, bool frozen); - virtual void setInputFilterEnabled(bool enabled); - - virtual bool transferTouchFocus(const sp& fromChannel, - const sp& toChannel); - - virtual status_t registerInputChannel(const sp& inputChannel, - const sp& inputWindowHandle, bool monitor); - virtual status_t unregisterInputChannel(const sp& inputChannel); - -private: - template - struct Link { - T* next; - T* prev; - - protected: - inline Link() : next(NULL), prev(NULL) { } - }; - - struct InjectionState { - mutable int32_t refCount; - - int32_t injectorPid; - int32_t injectorUid; - int32_t injectionResult; // initially INPUT_EVENT_INJECTION_PENDING - bool injectionIsAsync; // set to true if injection is not waiting for the result - int32_t pendingForegroundDispatches; // the number of foreground dispatches in progress - - InjectionState(int32_t injectorPid, int32_t injectorUid); - void release(); - - private: - ~InjectionState(); - }; - - struct EventEntry : Link { - enum { - TYPE_CONFIGURATION_CHANGED, - TYPE_DEVICE_RESET, - TYPE_KEY, - TYPE_MOTION - }; - - mutable int32_t refCount; - int32_t type; - nsecs_t eventTime; - uint32_t policyFlags; - InjectionState* injectionState; - - bool dispatchInProgress; // initially false, set to true while dispatching - - inline bool isInjected() const { return injectionState != NULL; } - - void release(); - - virtual void appendDescription(String8& msg) const = 0; - - protected: - EventEntry(int32_t type, nsecs_t eventTime, uint32_t policyFlags); - virtual ~EventEntry(); - void releaseInjectionState(); - }; - - struct ConfigurationChangedEntry : EventEntry { - ConfigurationChangedEntry(nsecs_t eventTime); - virtual void appendDescription(String8& msg) const; - - protected: - virtual ~ConfigurationChangedEntry(); - }; - - struct DeviceResetEntry : EventEntry { - int32_t deviceId; - - DeviceResetEntry(nsecs_t eventTime, int32_t deviceId); - virtual void appendDescription(String8& msg) const; - - protected: - virtual ~DeviceResetEntry(); - }; - - struct KeyEntry : EventEntry { - int32_t deviceId; - uint32_t source; - int32_t action; - int32_t flags; - int32_t keyCode; - int32_t scanCode; - int32_t metaState; - int32_t repeatCount; - nsecs_t downTime; - - bool syntheticRepeat; // set to true for synthetic key repeats - - enum InterceptKeyResult { - INTERCEPT_KEY_RESULT_UNKNOWN, - INTERCEPT_KEY_RESULT_SKIP, - INTERCEPT_KEY_RESULT_CONTINUE, - INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER, - }; - InterceptKeyResult interceptKeyResult; // set based on the interception result - nsecs_t interceptKeyWakeupTime; // used with INTERCEPT_KEY_RESULT_TRY_AGAIN_LATER - - KeyEntry(nsecs_t eventTime, - int32_t deviceId, uint32_t source, uint32_t policyFlags, int32_t action, - int32_t flags, int32_t keyCode, int32_t scanCode, int32_t metaState, - int32_t repeatCount, nsecs_t downTime); - virtual void appendDescription(String8& msg) const; - void recycle(); - - protected: - virtual ~KeyEntry(); - }; - - struct MotionEntry : EventEntry { - nsecs_t eventTime; - int32_t deviceId; - uint32_t source; - int32_t action; - int32_t actionButton; - int32_t flags; - int32_t metaState; - int32_t buttonState; - int32_t edgeFlags; - float xPrecision; - float yPrecision; - nsecs_t downTime; - int32_t displayId; - uint32_t pointerCount; - PointerProperties pointerProperties[MAX_POINTERS]; - PointerCoords pointerCoords[MAX_POINTERS]; - - MotionEntry(nsecs_t eventTime, - int32_t deviceId, uint32_t source, uint32_t policyFlags, - int32_t action, int32_t actionButton, int32_t flags, - int32_t metaState, int32_t buttonState, int32_t edgeFlags, - float xPrecision, float yPrecision, nsecs_t downTime, - int32_t displayId, uint32_t pointerCount, - const PointerProperties* pointerProperties, const PointerCoords* pointerCoords, - float xOffset, float yOffset); - virtual void appendDescription(String8& msg) const; - - protected: - virtual ~MotionEntry(); - }; - - // Tracks the progress of dispatching a particular event to a particular connection. - struct DispatchEntry : Link { - const uint32_t seq; // unique sequence number, never 0 - - EventEntry* eventEntry; // the event to dispatch - int32_t targetFlags; - float xOffset; - float yOffset; - float scaleFactor; - nsecs_t deliveryTime; // time when the event was actually delivered - - // Set to the resolved action and flags when the event is enqueued. - int32_t resolvedAction; - int32_t resolvedFlags; - - DispatchEntry(EventEntry* eventEntry, - int32_t targetFlags, float xOffset, float yOffset, float scaleFactor); - ~DispatchEntry(); - - inline bool hasForegroundTarget() const { - return targetFlags & InputTarget::FLAG_FOREGROUND; - } - - inline bool isSplit() const { - return targetFlags & InputTarget::FLAG_SPLIT; - } - - private: - static volatile int32_t sNextSeqAtomic; - - static uint32_t nextSeq(); - }; - - // A command entry captures state and behavior for an action to be performed in the - // dispatch loop after the initial processing has taken place. It is essentially - // a kind of continuation used to postpone sensitive policy interactions to a point - // in the dispatch loop where it is safe to release the lock (generally after finishing - // the critical parts of the dispatch cycle). - // - // The special thing about commands is that they can voluntarily release and reacquire - // the dispatcher lock at will. Initially when the command starts running, the - // dispatcher lock is held. However, if the command needs to call into the policy to - // do some work, it can release the lock, do the work, then reacquire the lock again - // before returning. - // - // This mechanism is a bit clunky but it helps to preserve the invariant that the dispatch - // never calls into the policy while holding its lock. - // - // Commands are implicitly 'LockedInterruptible'. - struct CommandEntry; - typedef void (InputDispatcher::*Command)(CommandEntry* commandEntry); - - class Connection; - struct CommandEntry : Link { - CommandEntry(Command command); - ~CommandEntry(); - - Command command; - - // parameters for the command (usage varies by command) - sp connection; - nsecs_t eventTime; - KeyEntry* keyEntry; - sp inputApplicationHandle; - sp inputWindowHandle; - String8 reason; - int32_t userActivityEventType; - uint32_t seq; - bool handled; - }; - - // Generic queue implementation. - template - struct Queue { - T* head; - T* tail; - uint32_t entryCount; - - inline Queue() : head(NULL), tail(NULL), entryCount(0) { - } - - inline bool isEmpty() const { - return !head; - } - - inline void enqueueAtTail(T* entry) { - entryCount++; - entry->prev = tail; - if (tail) { - tail->next = entry; - } else { - head = entry; - } - entry->next = NULL; - tail = entry; - } - - inline void enqueueAtHead(T* entry) { - entryCount++; - entry->next = head; - if (head) { - head->prev = entry; - } else { - tail = entry; - } - entry->prev = NULL; - head = entry; - } - - inline void dequeue(T* entry) { - entryCount--; - if (entry->prev) { - entry->prev->next = entry->next; - } else { - head = entry->next; - } - if (entry->next) { - entry->next->prev = entry->prev; - } else { - tail = entry->prev; - } - } - - inline T* dequeueAtHead() { - entryCount--; - T* entry = head; - head = entry->next; - if (head) { - head->prev = NULL; - } else { - tail = NULL; - } - return entry; - } - - uint32_t count() const { - return entryCount; - } - }; - - /* Specifies which events are to be canceled and why. */ - struct CancelationOptions { - enum Mode { - CANCEL_ALL_EVENTS = 0, - CANCEL_POINTER_EVENTS = 1, - CANCEL_NON_POINTER_EVENTS = 2, - CANCEL_FALLBACK_EVENTS = 3, - }; - - // The criterion to use to determine which events should be canceled. - Mode mode; - - // Descriptive reason for the cancelation. - const char* reason; - - // The specific keycode of the key event to cancel, or -1 to cancel any key event. - int32_t keyCode; - - // The specific device id of events to cancel, or -1 to cancel events from any device. - int32_t deviceId; - - CancelationOptions(Mode mode, const char* reason) : - mode(mode), reason(reason), keyCode(-1), deviceId(-1) { } - }; - - /* Tracks dispatched key and motion event state so that cancelation events can be - * synthesized when events are dropped. */ - class InputState { - public: - InputState(); - ~InputState(); - - // Returns true if there is no state to be canceled. - bool isNeutral() const; - - // Returns true if the specified source is known to have received a hover enter - // motion event. - bool isHovering(int32_t deviceId, uint32_t source, int32_t displayId) const; - - // Records tracking information for a key event that has just been published. - // Returns true if the event should be delivered, false if it is inconsistent - // and should be skipped. - bool trackKey(const KeyEntry* entry, int32_t action, int32_t flags); - - // Records tracking information for a motion event that has just been published. - // Returns true if the event should be delivered, false if it is inconsistent - // and should be skipped. - bool trackMotion(const MotionEntry* entry, int32_t action, int32_t flags); - - // Synthesizes cancelation events for the current state and resets the tracked state. - void synthesizeCancelationEvents(nsecs_t currentTime, - Vector& outEvents, const CancelationOptions& options); - - // Clears the current state. - void clear(); - - // Copies pointer-related parts of the input state to another instance. - void copyPointerStateTo(InputState& other) const; - - // Gets the fallback key associated with a keycode. - // Returns -1 if none. - // Returns AKEYCODE_UNKNOWN if we are only dispatching the unhandled key to the policy. - int32_t getFallbackKey(int32_t originalKeyCode); - - // Sets the fallback key for a particular keycode. - void setFallbackKey(int32_t originalKeyCode, int32_t fallbackKeyCode); - - // Removes the fallback key for a particular keycode. - void removeFallbackKey(int32_t originalKeyCode); - - inline const KeyedVector& getFallbackKeys() const { - return mFallbackKeys; - } - - private: - struct KeyMemento { - int32_t deviceId; - uint32_t source; - int32_t keyCode; - int32_t scanCode; - int32_t metaState; - int32_t flags; - nsecs_t downTime; - uint32_t policyFlags; - }; - - struct MotionMemento { - int32_t deviceId; - uint32_t source; - int32_t flags; - float xPrecision; - float yPrecision; - nsecs_t downTime; - int32_t displayId; - uint32_t pointerCount; - PointerProperties pointerProperties[MAX_POINTERS]; - PointerCoords pointerCoords[MAX_POINTERS]; - bool hovering; - uint32_t policyFlags; - - void setPointers(const MotionEntry* entry); - }; - - Vector mKeyMementos; - Vector mMotionMementos; - KeyedVector mFallbackKeys; - - ssize_t findKeyMemento(const KeyEntry* entry) const; - ssize_t findMotionMemento(const MotionEntry* entry, bool hovering) const; - - void addKeyMemento(const KeyEntry* entry, int32_t flags); - void addMotionMemento(const MotionEntry* entry, int32_t flags, bool hovering); - - static bool shouldCancelKey(const KeyMemento& memento, - const CancelationOptions& options); - static bool shouldCancelMotion(const MotionMemento& memento, - const CancelationOptions& options); - }; - - /* Manages the dispatch state associated with a single input channel. */ - class Connection : public RefBase { - protected: - virtual ~Connection(); - - public: - enum Status { - // Everything is peachy. - STATUS_NORMAL, - // An unrecoverable communication error has occurred. - STATUS_BROKEN, - // The input channel has been unregistered. - STATUS_ZOMBIE - }; - - Status status; - sp inputChannel; // never null - sp inputWindowHandle; // may be null - bool monitor; - InputPublisher inputPublisher; - InputState inputState; - - // True if the socket is full and no further events can be published until - // the application consumes some of the input. - bool inputPublisherBlocked; - - // Queue of events that need to be published to the connection. - Queue outboundQueue; - - // Queue of events that have been published to the connection but that have not - // yet received a "finished" response from the application. - Queue waitQueue; - - explicit Connection(const sp& inputChannel, - const sp& inputWindowHandle, bool monitor); - - inline const char* getInputChannelName() const { return inputChannel->getName().string(); } - - const char* getWindowName() const; - const char* getStatusLabel() const; - - DispatchEntry* findWaitQueueEntry(uint32_t seq); - }; - - enum DropReason { - DROP_REASON_NOT_DROPPED = 0, - DROP_REASON_POLICY = 1, - DROP_REASON_APP_SWITCH = 2, - DROP_REASON_DISABLED = 3, - DROP_REASON_BLOCKED = 4, - DROP_REASON_STALE = 5, - }; - - sp mPolicy; - InputDispatcherConfiguration mConfig; - - Mutex mLock; - - Condition mDispatcherIsAliveCondition; - - sp mLooper; - - EventEntry* mPendingEvent; - Queue mInboundQueue; - Queue mRecentQueue; - Queue mCommandQueue; - - DropReason mLastDropReason; - - void dispatchOnceInnerLocked(nsecs_t* nextWakeupTime); - - // Enqueues an inbound event. Returns true if mLooper->wake() should be called. - bool enqueueInboundEventLocked(EventEntry* entry); - - // Cleans up input state when dropping an inbound event. - void dropInboundEventLocked(EventEntry* entry, DropReason dropReason); - - // Adds an event to a queue of recent events for debugging purposes. - void addRecentEventLocked(EventEntry* entry); - - // App switch latency optimization. - bool mAppSwitchSawKeyDown; - nsecs_t mAppSwitchDueTime; - - static bool isAppSwitchKeyCode(int32_t keyCode); - bool isAppSwitchKeyEventLocked(KeyEntry* keyEntry); - bool isAppSwitchPendingLocked(); - void resetPendingAppSwitchLocked(bool handled); - - // Stale event latency optimization. - static bool isStaleEventLocked(nsecs_t currentTime, EventEntry* entry); - - // Blocked event latency optimization. Drops old events when the user intends - // to transfer focus to a new application. - EventEntry* mNextUnblockedEvent; - - sp findTouchedWindowAtLocked(int32_t displayId, int32_t x, int32_t y); - - // All registered connections mapped by channel file descriptor. - KeyedVector > mConnectionsByFd; - - ssize_t getConnectionIndexLocked(const sp& inputChannel); - - // Input channels that will receive a copy of all input events. - Vector > mMonitoringChannels; - - // Event injection and synchronization. - Condition mInjectionResultAvailableCondition; - bool hasInjectionPermission(int32_t injectorPid, int32_t injectorUid); - void setInjectionResultLocked(EventEntry* entry, int32_t injectionResult); - - Condition mInjectionSyncFinishedCondition; - void incrementPendingForegroundDispatchesLocked(EventEntry* entry); - void decrementPendingForegroundDispatchesLocked(EventEntry* entry); - - // Key repeat tracking. - struct KeyRepeatState { - KeyEntry* lastKeyEntry; // or null if no repeat - nsecs_t nextRepeatTime; - } mKeyRepeatState; - - void resetKeyRepeatLocked(); - KeyEntry* synthesizeKeyRepeatLocked(nsecs_t currentTime); - - // Key replacement tracking - struct KeyReplacement { - int32_t keyCode; - int32_t deviceId; - bool operator==(const KeyReplacement& rhs) const { - return keyCode == rhs.keyCode && deviceId == rhs.deviceId; - } - bool operator<(const KeyReplacement& rhs) const { - return keyCode != rhs.keyCode ? keyCode < rhs.keyCode : deviceId < rhs.deviceId; - } - }; - // Maps the key code replaced, device id tuple to the key code it was replaced with - KeyedVector mReplacedKeys; - - // Deferred command processing. - bool haveCommandsLocked() const; - bool runCommandsLockedInterruptible(); - CommandEntry* postCommandLocked(Command command); - - // Input filter processing. - bool shouldSendKeyToInputFilterLocked(const NotifyKeyArgs* args); - bool shouldSendMotionToInputFilterLocked(const NotifyMotionArgs* args); - - // Inbound event processing. - void drainInboundQueueLocked(); - void releasePendingEventLocked(); - void releaseInboundEventLocked(EventEntry* entry); - - // Dispatch state. - bool mDispatchEnabled; - bool mDispatchFrozen; - bool mInputFilterEnabled; - - Vector > mWindowHandles; - - sp getWindowHandleLocked(const sp& inputChannel) const; - bool hasWindowHandleLocked(const sp& windowHandle) const; - - // Focus tracking for keys, trackball, etc. - sp mFocusedWindowHandle; - - // Focus tracking for touch. - struct TouchedWindow { - sp windowHandle; - int32_t targetFlags; - BitSet32 pointerIds; // zero unless target flag FLAG_SPLIT is set - }; - struct TouchState { - bool down; - bool split; - int32_t deviceId; // id of the device that is currently down, others are rejected - uint32_t source; // source of the device that is current down, others are rejected - int32_t displayId; // id to the display that currently has a touch, others are rejected - Vector windows; - - TouchState(); - ~TouchState(); - void reset(); - void copyFrom(const TouchState& other); - void addOrUpdateWindow(const sp& windowHandle, - int32_t targetFlags, BitSet32 pointerIds); - void removeWindow(const sp& windowHandle); - void filterNonAsIsTouchWindows(); - sp getFirstForegroundWindowHandle() const; - bool isSlippery() const; - }; - - KeyedVector mTouchStatesByDisplay; - TouchState mTempTouchState; - - // Focused application. - sp mFocusedApplicationHandle; - - // Dispatcher state at time of last ANR. - String8 mLastANRState; - - // Dispatch inbound events. - bool dispatchConfigurationChangedLocked( - nsecs_t currentTime, ConfigurationChangedEntry* entry); - bool dispatchDeviceResetLocked( - nsecs_t currentTime, DeviceResetEntry* entry); - bool dispatchKeyLocked( - nsecs_t currentTime, KeyEntry* entry, - DropReason* dropReason, nsecs_t* nextWakeupTime); - bool dispatchMotionLocked( - nsecs_t currentTime, MotionEntry* entry, - DropReason* dropReason, nsecs_t* nextWakeupTime); - void dispatchEventLocked(nsecs_t currentTime, EventEntry* entry, - const Vector& inputTargets); - - void logOutboundKeyDetailsLocked(const char* prefix, const KeyEntry* entry); - void logOutboundMotionDetailsLocked(const char* prefix, const MotionEntry* entry); - - // Keeping track of ANR timeouts. - enum InputTargetWaitCause { - INPUT_TARGET_WAIT_CAUSE_NONE, - INPUT_TARGET_WAIT_CAUSE_SYSTEM_NOT_READY, - INPUT_TARGET_WAIT_CAUSE_APPLICATION_NOT_READY, - }; - - InputTargetWaitCause mInputTargetWaitCause; - nsecs_t mInputTargetWaitStartTime; - nsecs_t mInputTargetWaitTimeoutTime; - bool mInputTargetWaitTimeoutExpired; - sp mInputTargetWaitApplicationHandle; - - // Contains the last window which received a hover event. - sp mLastHoverWindowHandle; - - // Finding targets for input events. - int32_t handleTargetsNotReadyLocked(nsecs_t currentTime, const EventEntry* entry, - const sp& applicationHandle, - const sp& windowHandle, - nsecs_t* nextWakeupTime, const char* reason); - void resumeAfterTargetsNotReadyTimeoutLocked(nsecs_t newTimeout, - const sp& inputChannel); - nsecs_t getTimeSpentWaitingForApplicationLocked(nsecs_t currentTime); - void resetANRTimeoutsLocked(); - - int32_t findFocusedWindowTargetsLocked(nsecs_t currentTime, const EventEntry* entry, - Vector& inputTargets, nsecs_t* nextWakeupTime); - int32_t findTouchedWindowTargetsLocked(nsecs_t currentTime, const MotionEntry* entry, - Vector& inputTargets, nsecs_t* nextWakeupTime, - bool* outConflictingPointerActions); - - void addWindowTargetLocked(const sp& windowHandle, - int32_t targetFlags, BitSet32 pointerIds, Vector& inputTargets); - void addMonitoringTargetsLocked(Vector& inputTargets); - - void pokeUserActivityLocked(const EventEntry* eventEntry); - bool checkInjectionPermission(const sp& windowHandle, - const InjectionState* injectionState); - bool isWindowObscuredAtPointLocked(const sp& windowHandle, - int32_t x, int32_t y) const; - String8 getApplicationWindowLabelLocked(const sp& applicationHandle, - const sp& windowHandle); - - String8 checkWindowReadyForMoreInputLocked(nsecs_t currentTime, - const sp& windowHandle, const EventEntry* eventEntry, - const char* targetType); - - // Manage the dispatch cycle for a single connection. - // These methods are deliberately not Interruptible because doing all of the work - // with the mutex held makes it easier to ensure that connection invariants are maintained. - // If needed, the methods post commands to run later once the critical bits are done. - void prepareDispatchCycleLocked(nsecs_t currentTime, const sp& connection, - EventEntry* eventEntry, const InputTarget* inputTarget); - void enqueueDispatchEntriesLocked(nsecs_t currentTime, const sp& connection, - EventEntry* eventEntry, const InputTarget* inputTarget); - void enqueueDispatchEntryLocked(const sp& connection, - EventEntry* eventEntry, const InputTarget* inputTarget, int32_t dispatchMode); - void startDispatchCycleLocked(nsecs_t currentTime, const sp& connection); - void finishDispatchCycleLocked(nsecs_t currentTime, const sp& connection, - uint32_t seq, bool handled); - void abortBrokenDispatchCycleLocked(nsecs_t currentTime, const sp& connection, - bool notify); - void drainDispatchQueueLocked(Queue* queue); - void releaseDispatchEntryLocked(DispatchEntry* dispatchEntry); - static int handleReceiveCallback(int fd, int events, void* data); - - void synthesizeCancelationEventsForAllConnectionsLocked( - const CancelationOptions& options); - void synthesizeCancelationEventsForMonitorsLocked(const CancelationOptions& options); - void synthesizeCancelationEventsForInputChannelLocked(const sp& channel, - const CancelationOptions& options); - void synthesizeCancelationEventsForConnectionLocked(const sp& connection, - const CancelationOptions& options); - - // Splitting motion events across windows. - MotionEntry* splitMotionEvent(const MotionEntry* originalMotionEntry, BitSet32 pointerIds); - - // Reset and drop everything the dispatcher is doing. - void resetAndDropEverythingLocked(const char* reason); - - // Dump state. - void dumpDispatchStateLocked(String8& dump); - void logDispatchStateLocked(); - - // Registration. - void removeMonitorChannelLocked(const sp& inputChannel); - status_t unregisterInputChannelLocked(const sp& inputChannel, bool notify); - - // Add or remove a connection to the mActiveConnections vector. - void activateConnectionLocked(Connection* connection); - void deactivateConnectionLocked(Connection* connection); - - // Interesting events that we might like to log or tell the framework about. - void onDispatchCycleFinishedLocked( - nsecs_t currentTime, const sp& connection, uint32_t seq, bool handled); - void onDispatchCycleBrokenLocked( - nsecs_t currentTime, const sp& connection); - void onANRLocked( - nsecs_t currentTime, const sp& applicationHandle, - const sp& windowHandle, - nsecs_t eventTime, nsecs_t waitStartTime, const char* reason); - - // Outbound policy interactions. - void doNotifyConfigurationChangedInterruptible(CommandEntry* commandEntry); - void doNotifyInputChannelBrokenLockedInterruptible(CommandEntry* commandEntry); - void doNotifyANRLockedInterruptible(CommandEntry* commandEntry); - void doInterceptKeyBeforeDispatchingLockedInterruptible(CommandEntry* commandEntry); - void doDispatchCycleFinishedLockedInterruptible(CommandEntry* commandEntry); - bool afterKeyEventLockedInterruptible(const sp& connection, - DispatchEntry* dispatchEntry, KeyEntry* keyEntry, bool handled); - bool afterMotionEventLockedInterruptible(const sp& connection, - DispatchEntry* dispatchEntry, MotionEntry* motionEntry, bool handled); - void doPokeUserActivityLockedInterruptible(CommandEntry* commandEntry); - void initializeKeyEvent(KeyEvent* event, const KeyEntry* entry); - - // Statistics gathering. - void updateDispatchStatisticsLocked(nsecs_t currentTime, const EventEntry* entry, - int32_t injectionResult, nsecs_t timeSpentWaitingForApplication); - void traceInboundQueueLengthLocked(); - void traceOutboundQueueLengthLocked(const sp& connection); - void traceWaitQueueLengthLocked(const sp& connection); -}; - -/* Enqueues and dispatches input events, endlessly. */ -class InputDispatcherThread : public Thread { -public: - explicit InputDispatcherThread(const sp& dispatcher); - ~InputDispatcherThread(); - -private: - virtual bool threadLoop(); - - sp mDispatcher; -}; - -} // namespace android - -#endif // _UI_INPUT_DISPATCHER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputListener.cpp android-platform-frameworks-native-21/services/inputflinger/InputListener.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputListener.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputListener.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,182 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "InputListener" - -//#define LOG_NDEBUG 0 - -#include "InputListener.h" - -#include - -namespace android { - -// --- NotifyConfigurationChangedArgs --- - -NotifyConfigurationChangedArgs::NotifyConfigurationChangedArgs(nsecs_t eventTime) : - eventTime(eventTime) { -} - -NotifyConfigurationChangedArgs::NotifyConfigurationChangedArgs( - const NotifyConfigurationChangedArgs& other) : - eventTime(other.eventTime) { -} - -void NotifyConfigurationChangedArgs::notify(const sp& listener) const { - listener->notifyConfigurationChanged(this); -} - - -// --- NotifyKeyArgs --- - -NotifyKeyArgs::NotifyKeyArgs(nsecs_t eventTime, int32_t deviceId, uint32_t source, - uint32_t policyFlags, - int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, - int32_t metaState, nsecs_t downTime) : - eventTime(eventTime), deviceId(deviceId), source(source), policyFlags(policyFlags), - action(action), flags(flags), keyCode(keyCode), scanCode(scanCode), - metaState(metaState), downTime(downTime) { -} - -NotifyKeyArgs::NotifyKeyArgs(const NotifyKeyArgs& other) : - eventTime(other.eventTime), deviceId(other.deviceId), source(other.source), - policyFlags(other.policyFlags), - action(other.action), flags(other.flags), - keyCode(other.keyCode), scanCode(other.scanCode), - metaState(other.metaState), downTime(other.downTime) { -} - -void NotifyKeyArgs::notify(const sp& listener) const { - listener->notifyKey(this); -} - - -// --- NotifyMotionArgs --- - -NotifyMotionArgs::NotifyMotionArgs(nsecs_t eventTime, int32_t deviceId, uint32_t source, - uint32_t policyFlags, - int32_t action, int32_t actionButton, int32_t flags, int32_t metaState, - int32_t buttonState, int32_t edgeFlags, int32_t displayId, uint32_t pointerCount, - const PointerProperties* pointerProperties, const PointerCoords* pointerCoords, - float xPrecision, float yPrecision, nsecs_t downTime) : - eventTime(eventTime), deviceId(deviceId), source(source), policyFlags(policyFlags), - action(action), actionButton(actionButton), - flags(flags), metaState(metaState), buttonState(buttonState), - edgeFlags(edgeFlags), displayId(displayId), pointerCount(pointerCount), - xPrecision(xPrecision), yPrecision(yPrecision), downTime(downTime) { - for (uint32_t i = 0; i < pointerCount; i++) { - this->pointerProperties[i].copyFrom(pointerProperties[i]); - this->pointerCoords[i].copyFrom(pointerCoords[i]); - } -} - -NotifyMotionArgs::NotifyMotionArgs(const NotifyMotionArgs& other) : - eventTime(other.eventTime), deviceId(other.deviceId), source(other.source), - policyFlags(other.policyFlags), - action(other.action), actionButton(other.actionButton), flags(other.flags), - metaState(other.metaState), buttonState(other.buttonState), - edgeFlags(other.edgeFlags), displayId(other.displayId), pointerCount(other.pointerCount), - xPrecision(other.xPrecision), yPrecision(other.yPrecision), downTime(other.downTime) { - for (uint32_t i = 0; i < pointerCount; i++) { - pointerProperties[i].copyFrom(other.pointerProperties[i]); - pointerCoords[i].copyFrom(other.pointerCoords[i]); - } -} - -void NotifyMotionArgs::notify(const sp& listener) const { - listener->notifyMotion(this); -} - - -// --- NotifySwitchArgs --- - -NotifySwitchArgs::NotifySwitchArgs(nsecs_t eventTime, uint32_t policyFlags, - uint32_t switchValues, uint32_t switchMask) : - eventTime(eventTime), policyFlags(policyFlags), - switchValues(switchValues), switchMask(switchMask) { -} - -NotifySwitchArgs::NotifySwitchArgs(const NotifySwitchArgs& other) : - eventTime(other.eventTime), policyFlags(other.policyFlags), - switchValues(other.switchValues), switchMask(other.switchMask) { -} - -void NotifySwitchArgs::notify(const sp& listener) const { - listener->notifySwitch(this); -} - - -// --- NotifyDeviceResetArgs --- - -NotifyDeviceResetArgs::NotifyDeviceResetArgs(nsecs_t eventTime, int32_t deviceId) : - eventTime(eventTime), deviceId(deviceId) { -} - -NotifyDeviceResetArgs::NotifyDeviceResetArgs(const NotifyDeviceResetArgs& other) : - eventTime(other.eventTime), deviceId(other.deviceId) { -} - -void NotifyDeviceResetArgs::notify(const sp& listener) const { - listener->notifyDeviceReset(this); -} - - -// --- QueuedInputListener --- - -QueuedInputListener::QueuedInputListener(const sp& innerListener) : - mInnerListener(innerListener) { -} - -QueuedInputListener::~QueuedInputListener() { - size_t count = mArgsQueue.size(); - for (size_t i = 0; i < count; i++) { - delete mArgsQueue[i]; - } -} - -void QueuedInputListener::notifyConfigurationChanged( - const NotifyConfigurationChangedArgs* args) { - mArgsQueue.push(new NotifyConfigurationChangedArgs(*args)); -} - -void QueuedInputListener::notifyKey(const NotifyKeyArgs* args) { - mArgsQueue.push(new NotifyKeyArgs(*args)); -} - -void QueuedInputListener::notifyMotion(const NotifyMotionArgs* args) { - mArgsQueue.push(new NotifyMotionArgs(*args)); -} - -void QueuedInputListener::notifySwitch(const NotifySwitchArgs* args) { - mArgsQueue.push(new NotifySwitchArgs(*args)); -} - -void QueuedInputListener::notifyDeviceReset(const NotifyDeviceResetArgs* args) { - mArgsQueue.push(new NotifyDeviceResetArgs(*args)); -} - -void QueuedInputListener::flush() { - size_t count = mArgsQueue.size(); - for (size_t i = 0; i < count; i++) { - NotifyArgs* args = mArgsQueue[i]; - args->notify(mInnerListener); - delete args; - } - mArgsQueue.clear(); -} - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputListener.h android-platform-frameworks-native-21/services/inputflinger/InputListener.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputListener.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputListener.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,198 +0,0 @@ -/* - * 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. - */ - -#ifndef _UI_INPUT_LISTENER_H -#define _UI_INPUT_LISTENER_H - -#include -#include -#include - -namespace android { - -class InputListenerInterface; - - -/* Superclass of all input event argument objects */ -struct NotifyArgs { - virtual ~NotifyArgs() { } - - virtual void notify(const sp& listener) const = 0; -}; - - -/* Describes a configuration change event. */ -struct NotifyConfigurationChangedArgs : public NotifyArgs { - nsecs_t eventTime; - - inline NotifyConfigurationChangedArgs() { } - - NotifyConfigurationChangedArgs(nsecs_t eventTime); - - NotifyConfigurationChangedArgs(const NotifyConfigurationChangedArgs& other); - - virtual ~NotifyConfigurationChangedArgs() { } - - virtual void notify(const sp& listener) const; -}; - - -/* Describes a key event. */ -struct NotifyKeyArgs : public NotifyArgs { - nsecs_t eventTime; - int32_t deviceId; - uint32_t source; - uint32_t policyFlags; - int32_t action; - int32_t flags; - int32_t keyCode; - int32_t scanCode; - int32_t metaState; - nsecs_t downTime; - - inline NotifyKeyArgs() { } - - NotifyKeyArgs(nsecs_t eventTime, int32_t deviceId, uint32_t source, uint32_t policyFlags, - int32_t action, int32_t flags, int32_t keyCode, int32_t scanCode, - int32_t metaState, nsecs_t downTime); - - NotifyKeyArgs(const NotifyKeyArgs& other); - - virtual ~NotifyKeyArgs() { } - - virtual void notify(const sp& listener) const; -}; - - -/* Describes a motion event. */ -struct NotifyMotionArgs : public NotifyArgs { - nsecs_t eventTime; - int32_t deviceId; - uint32_t source; - uint32_t policyFlags; - int32_t action; - int32_t actionButton; - int32_t flags; - int32_t metaState; - int32_t buttonState; - int32_t edgeFlags; - int32_t displayId; - uint32_t pointerCount; - PointerProperties pointerProperties[MAX_POINTERS]; - PointerCoords pointerCoords[MAX_POINTERS]; - float xPrecision; - float yPrecision; - nsecs_t downTime; - - inline NotifyMotionArgs() { } - - NotifyMotionArgs(nsecs_t eventTime, int32_t deviceId, uint32_t source, uint32_t policyFlags, - int32_t action, int32_t actionButton, int32_t flags, - int32_t metaState, int32_t buttonState, - int32_t edgeFlags, int32_t displayId, uint32_t pointerCount, - const PointerProperties* pointerProperties, const PointerCoords* pointerCoords, - float xPrecision, float yPrecision, nsecs_t downTime); - - NotifyMotionArgs(const NotifyMotionArgs& other); - - virtual ~NotifyMotionArgs() { } - - virtual void notify(const sp& listener) const; -}; - - -/* Describes a switch event. */ -struct NotifySwitchArgs : public NotifyArgs { - nsecs_t eventTime; - uint32_t policyFlags; - uint32_t switchValues; - uint32_t switchMask; - - inline NotifySwitchArgs() { } - - NotifySwitchArgs(nsecs_t eventTime, uint32_t policyFlags, - uint32_t switchValues, uint32_t switchMask); - - NotifySwitchArgs(const NotifySwitchArgs& other); - - virtual ~NotifySwitchArgs() { } - - virtual void notify(const sp& listener) const; -}; - - -/* Describes a device reset event, such as when a device is added, - * reconfigured, or removed. */ -struct NotifyDeviceResetArgs : public NotifyArgs { - nsecs_t eventTime; - int32_t deviceId; - - inline NotifyDeviceResetArgs() { } - - NotifyDeviceResetArgs(nsecs_t eventTime, int32_t deviceId); - - NotifyDeviceResetArgs(const NotifyDeviceResetArgs& other); - - virtual ~NotifyDeviceResetArgs() { } - - virtual void notify(const sp& listener) const; -}; - - -/* - * The interface used by the InputReader to notify the InputListener about input events. - */ -class InputListenerInterface : public virtual RefBase { -protected: - InputListenerInterface() { } - virtual ~InputListenerInterface() { } - -public: - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) = 0; - virtual void notifyKey(const NotifyKeyArgs* args) = 0; - virtual void notifyMotion(const NotifyMotionArgs* args) = 0; - virtual void notifySwitch(const NotifySwitchArgs* args) = 0; - virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args) = 0; -}; - - -/* - * An implementation of the listener interface that queues up and defers dispatch - * of decoded events until flushed. - */ -class QueuedInputListener : public InputListenerInterface { -protected: - virtual ~QueuedInputListener(); - -public: - QueuedInputListener(const sp& innerListener); - - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args); - virtual void notifyKey(const NotifyKeyArgs* args); - virtual void notifyMotion(const NotifyMotionArgs* args); - virtual void notifySwitch(const NotifySwitchArgs* args); - virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args); - - void flush(); - -private: - sp mInnerListener; - Vector mArgsQueue; -}; - -} // namespace android - -#endif // _UI_INPUT_LISTENER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputManager.cpp android-platform-frameworks-native-21/services/inputflinger/InputManager.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputManager.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputManager.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "InputManager" - -//#define LOG_NDEBUG 0 - -#include "InputManager.h" - -#include - -namespace android { - -InputManager::InputManager( - const sp& eventHub, - const sp& readerPolicy, - const sp& dispatcherPolicy) { - mDispatcher = new InputDispatcher(dispatcherPolicy); - mReader = new InputReader(eventHub, readerPolicy, mDispatcher); - initialize(); -} - -InputManager::InputManager( - const sp& reader, - const sp& dispatcher) : - mReader(reader), - mDispatcher(dispatcher) { - initialize(); -} - -InputManager::~InputManager() { - stop(); -} - -void InputManager::initialize() { - mReaderThread = new InputReaderThread(mReader); - mDispatcherThread = new InputDispatcherThread(mDispatcher); -} - -status_t InputManager::start() { - status_t result = mDispatcherThread->run("InputDispatcher", PRIORITY_URGENT_DISPLAY); - if (result) { - ALOGE("Could not start InputDispatcher thread due to error %d.", result); - return result; - } - - result = mReaderThread->run("InputReader", PRIORITY_URGENT_DISPLAY); - if (result) { - ALOGE("Could not start InputReader thread due to error %d.", result); - - mDispatcherThread->requestExit(); - return result; - } - - return OK; -} - -status_t InputManager::stop() { - status_t result = mReaderThread->requestExitAndWait(); - if (result) { - ALOGW("Could not stop InputReader thread due to error %d.", result); - } - - result = mDispatcherThread->requestExitAndWait(); - if (result) { - ALOGW("Could not stop InputDispatcher thread due to error %d.", result); - } - - return OK; -} - -sp InputManager::getReader() { - return mReader; -} - -sp InputManager::getDispatcher() { - return mDispatcher; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputManager.h android-platform-frameworks-native-21/services/inputflinger/InputManager.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputManager.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputManager.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,109 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _UI_INPUT_MANAGER_H -#define _UI_INPUT_MANAGER_H - -/** - * Native input manager. - */ - -#include "EventHub.h" -#include "InputReader.h" -#include "InputDispatcher.h" - -#include -#include -#include -#include -#include -#include -#include - -namespace android { - -/* - * The input manager is the core of the system event processing. - * - * The input manager uses two threads. - * - * 1. The InputReaderThread (called "InputReader") reads and preprocesses raw input events, - * applies policy, and posts messages to a queue managed by the DispatcherThread. - * 2. The InputDispatcherThread (called "InputDispatcher") thread waits for new events on the - * queue and asynchronously dispatches them to applications. - * - * By design, the InputReaderThread class and InputDispatcherThread class do not share any - * internal state. Moreover, all communication is done one way from the InputReaderThread - * into the InputDispatcherThread and never the reverse. Both classes may interact with the - * InputDispatchPolicy, however. - * - * The InputManager class never makes any calls into Java itself. Instead, the - * InputDispatchPolicy is responsible for performing all external interactions with the - * system, including calling DVM services. - */ -class InputManagerInterface : public virtual RefBase { -protected: - InputManagerInterface() { } - virtual ~InputManagerInterface() { } - -public: - /* Starts the input manager threads. */ - virtual status_t start() = 0; - - /* Stops the input manager threads and waits for them to exit. */ - virtual status_t stop() = 0; - - /* Gets the input reader. */ - virtual sp getReader() = 0; - - /* Gets the input dispatcher. */ - virtual sp getDispatcher() = 0; -}; - -class InputManager : public InputManagerInterface { -protected: - virtual ~InputManager(); - -public: - InputManager( - const sp& eventHub, - const sp& readerPolicy, - const sp& dispatcherPolicy); - - // (used for testing purposes) - InputManager( - const sp& reader, - const sp& dispatcher); - - virtual status_t start(); - virtual status_t stop(); - - virtual sp getReader(); - virtual sp getDispatcher(); - -private: - sp mReader; - sp mReaderThread; - - sp mDispatcher; - sp mDispatcherThread; - - void initialize(); -}; - -} // namespace android - -#endif // _UI_INPUT_MANAGER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputReader.cpp android-platform-frameworks-native-21/services/inputflinger/InputReader.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputReader.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputReader.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,7070 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#define LOG_TAG "InputReader" - -//#define LOG_NDEBUG 0 - -// Log debug messages for each raw event received from the EventHub. -#define DEBUG_RAW_EVENTS 0 - -// Log debug messages about touch screen filtering hacks. -#define DEBUG_HACKS 0 - -// Log debug messages about virtual key processing. -#define DEBUG_VIRTUAL_KEYS 0 - -// Log debug messages about pointers. -#define DEBUG_POINTERS 0 - -// Log debug messages about pointer assignment calculations. -#define DEBUG_POINTER_ASSIGNMENT 0 - -// Log debug messages about gesture detection. -#define DEBUG_GESTURES 0 - -// Log debug messages about the vibrator. -#define DEBUG_VIBRATOR 0 - -// Log debug messages about fusing stylus data. -#define DEBUG_STYLUS_FUSION 0 - -#include "InputReader.h" - -#include -#include -#include - -#include -#include -#include -#include -#include -#include -#include - -#define INDENT " " -#define INDENT2 " " -#define INDENT3 " " -#define INDENT4 " " -#define INDENT5 " " - -namespace android { - -// --- Constants --- - -// Maximum number of slots supported when using the slot-based Multitouch Protocol B. -static const size_t MAX_SLOTS = 32; - -// Maximum amount of latency to add to touch events while waiting for data from an -// external stylus. -static const nsecs_t EXTERNAL_STYLUS_DATA_TIMEOUT = ms2ns(72); - -// Maximum amount of time to wait on touch data before pushing out new pressure data. -static const nsecs_t TOUCH_DATA_TIMEOUT = ms2ns(20); - -// Artificial latency on synthetic events created from stylus data without corresponding touch -// data. -static const nsecs_t STYLUS_DATA_LATENCY = ms2ns(10); - -// --- Static Functions --- - -template -inline static T abs(const T& value) { - return value < 0 ? - value : value; -} - -template -inline static T min(const T& a, const T& b) { - return a < b ? a : b; -} - -template -inline static void swap(T& a, T& b) { - T temp = a; - a = b; - b = temp; -} - -inline static float avg(float x, float y) { - return (x + y) / 2; -} - -inline static float distance(float x1, float y1, float x2, float y2) { - return hypotf(x1 - x2, y1 - y2); -} - -inline static int32_t signExtendNybble(int32_t value) { - return value >= 8 ? value - 16 : value; -} - -static inline const char* toString(bool value) { - return value ? "true" : "false"; -} - -static int32_t rotateValueUsingRotationMap(int32_t value, int32_t orientation, - const int32_t map[][4], size_t mapSize) { - if (orientation != DISPLAY_ORIENTATION_0) { - for (size_t i = 0; i < mapSize; i++) { - if (value == map[i][0]) { - return map[i][orientation]; - } - } - } - return value; -} - -static const int32_t keyCodeRotationMap[][4] = { - // key codes enumerated counter-clockwise with the original (unrotated) key first - // no rotation, 90 degree rotation, 180 degree rotation, 270 degree rotation - { AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_LEFT }, - { AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_DOWN }, - { AKEYCODE_DPAD_UP, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_RIGHT }, - { AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_UP }, -}; -static const size_t keyCodeRotationMapSize = - sizeof(keyCodeRotationMap) / sizeof(keyCodeRotationMap[0]); - -static int32_t rotateKeyCode(int32_t keyCode, int32_t orientation) { - return rotateValueUsingRotationMap(keyCode, orientation, - keyCodeRotationMap, keyCodeRotationMapSize); -} - -static void rotateDelta(int32_t orientation, float* deltaX, float* deltaY) { - float temp; - switch (orientation) { - case DISPLAY_ORIENTATION_90: - temp = *deltaX; - *deltaX = *deltaY; - *deltaY = -temp; - break; - - case DISPLAY_ORIENTATION_180: - *deltaX = -*deltaX; - *deltaY = -*deltaY; - break; - - case DISPLAY_ORIENTATION_270: - temp = *deltaX; - *deltaX = -*deltaY; - *deltaY = temp; - break; - } -} - -static inline bool sourcesMatchMask(uint32_t sources, uint32_t sourceMask) { - return (sources & sourceMask & ~ AINPUT_SOURCE_CLASS_MASK) != 0; -} - -// Returns true if the pointer should be reported as being down given the specified -// button states. This determines whether the event is reported as a touch event. -static bool isPointerDown(int32_t buttonState) { - return buttonState & - (AMOTION_EVENT_BUTTON_PRIMARY | AMOTION_EVENT_BUTTON_SECONDARY - | AMOTION_EVENT_BUTTON_TERTIARY); -} - -static float calculateCommonVector(float a, float b) { - if (a > 0 && b > 0) { - return a < b ? a : b; - } else if (a < 0 && b < 0) { - return a > b ? a : b; - } else { - return 0; - } -} - -static void synthesizeButtonKey(InputReaderContext* context, int32_t action, - nsecs_t when, int32_t deviceId, uint32_t source, - uint32_t policyFlags, int32_t lastButtonState, int32_t currentButtonState, - int32_t buttonState, int32_t keyCode) { - if ( - (action == AKEY_EVENT_ACTION_DOWN - && !(lastButtonState & buttonState) - && (currentButtonState & buttonState)) - || (action == AKEY_EVENT_ACTION_UP - && (lastButtonState & buttonState) - && !(currentButtonState & buttonState))) { - NotifyKeyArgs args(when, deviceId, source, policyFlags, - action, 0, keyCode, 0, context->getGlobalMetaState(), when); - context->getListener()->notifyKey(&args); - } -} - -static void synthesizeButtonKeys(InputReaderContext* context, int32_t action, - nsecs_t when, int32_t deviceId, uint32_t source, - uint32_t policyFlags, int32_t lastButtonState, int32_t currentButtonState) { - synthesizeButtonKey(context, action, when, deviceId, source, policyFlags, - lastButtonState, currentButtonState, - AMOTION_EVENT_BUTTON_BACK, AKEYCODE_BACK); - synthesizeButtonKey(context, action, when, deviceId, source, policyFlags, - lastButtonState, currentButtonState, - AMOTION_EVENT_BUTTON_FORWARD, AKEYCODE_FORWARD); -} - - -// --- InputReaderConfiguration --- - -bool InputReaderConfiguration::getDisplayInfo(bool external, DisplayViewport* outViewport) const { - const DisplayViewport& viewport = external ? mExternalDisplay : mInternalDisplay; - if (viewport.displayId >= 0) { - *outViewport = viewport; - return true; - } - return false; -} - -void InputReaderConfiguration::setDisplayInfo(bool external, const DisplayViewport& viewport) { - DisplayViewport& v = external ? mExternalDisplay : mInternalDisplay; - v = viewport; -} - - -// -- TouchAffineTransformation -- -void TouchAffineTransformation::applyTo(float& x, float& y) const { - float newX, newY; - newX = x * x_scale + y * x_ymix + x_offset; - newY = x * y_xmix + y * y_scale + y_offset; - - x = newX; - y = newY; -} - - -// --- InputReader --- - -InputReader::InputReader(const sp& eventHub, - const sp& policy, - const sp& listener) : - mContext(this), mEventHub(eventHub), mPolicy(policy), - mGlobalMetaState(0), mGeneration(1), - mDisableVirtualKeysTimeout(LLONG_MIN), mNextTimeout(LLONG_MAX), - mConfigurationChangesToRefresh(0) { - mQueuedListener = new QueuedInputListener(listener); - - { // acquire lock - AutoMutex _l(mLock); - - refreshConfigurationLocked(0); - updateGlobalMetaStateLocked(); - } // release lock -} - -InputReader::~InputReader() { - for (size_t i = 0; i < mDevices.size(); i++) { - delete mDevices.valueAt(i); - } -} - -void InputReader::loopOnce() { - int32_t oldGeneration; - int32_t timeoutMillis; - bool inputDevicesChanged = false; - Vector inputDevices; - { // acquire lock - AutoMutex _l(mLock); - - oldGeneration = mGeneration; - timeoutMillis = -1; - - uint32_t changes = mConfigurationChangesToRefresh; - if (changes) { - mConfigurationChangesToRefresh = 0; - timeoutMillis = 0; - refreshConfigurationLocked(changes); - } else if (mNextTimeout != LLONG_MAX) { - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - timeoutMillis = toMillisecondTimeoutDelay(now, mNextTimeout); - } - } // release lock - - size_t count = mEventHub->getEvents(timeoutMillis, mEventBuffer, EVENT_BUFFER_SIZE); - - { // acquire lock - AutoMutex _l(mLock); - mReaderIsAliveCondition.broadcast(); - - if (count) { - processEventsLocked(mEventBuffer, count); - } - - if (mNextTimeout != LLONG_MAX) { - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - if (now >= mNextTimeout) { -#if DEBUG_RAW_EVENTS - ALOGD("Timeout expired, latency=%0.3fms", (now - mNextTimeout) * 0.000001f); -#endif - mNextTimeout = LLONG_MAX; - timeoutExpiredLocked(now); - } - } - - if (oldGeneration != mGeneration) { - inputDevicesChanged = true; - getInputDevicesLocked(inputDevices); - } - } // release lock - - // Send out a message that the describes the changed input devices. - if (inputDevicesChanged) { - mPolicy->notifyInputDevicesChanged(inputDevices); - } - - // Flush queued events out to the listener. - // This must happen outside of the lock because the listener could potentially call - // back into the InputReader's methods, such as getScanCodeState, or become blocked - // on another thread similarly waiting to acquire the InputReader lock thereby - // resulting in a deadlock. This situation is actually quite plausible because the - // listener is actually the input dispatcher, which calls into the window manager, - // which occasionally calls into the input reader. - mQueuedListener->flush(); -} - -void InputReader::processEventsLocked(const RawEvent* rawEvents, size_t count) { - for (const RawEvent* rawEvent = rawEvents; count;) { - int32_t type = rawEvent->type; - size_t batchSize = 1; - if (type < EventHubInterface::FIRST_SYNTHETIC_EVENT) { - int32_t deviceId = rawEvent->deviceId; - while (batchSize < count) { - if (rawEvent[batchSize].type >= EventHubInterface::FIRST_SYNTHETIC_EVENT - || rawEvent[batchSize].deviceId != deviceId) { - break; - } - batchSize += 1; - } -#if DEBUG_RAW_EVENTS - ALOGD("BatchSize: %d Count: %d", batchSize, count); -#endif - processEventsForDeviceLocked(deviceId, rawEvent, batchSize); - } else { - switch (rawEvent->type) { - case EventHubInterface::DEVICE_ADDED: - addDeviceLocked(rawEvent->when, rawEvent->deviceId); - break; - case EventHubInterface::DEVICE_REMOVED: - removeDeviceLocked(rawEvent->when, rawEvent->deviceId); - break; - case EventHubInterface::FINISHED_DEVICE_SCAN: - handleConfigurationChangedLocked(rawEvent->when); - break; - default: - ALOG_ASSERT(false); // can't happen - break; - } - } - count -= batchSize; - rawEvent += batchSize; - } -} - -void InputReader::addDeviceLocked(nsecs_t when, int32_t deviceId) { - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex >= 0) { - ALOGW("Ignoring spurious device added event for deviceId %d.", deviceId); - return; - } - - InputDeviceIdentifier identifier = mEventHub->getDeviceIdentifier(deviceId); - uint32_t classes = mEventHub->getDeviceClasses(deviceId); - int32_t controllerNumber = mEventHub->getDeviceControllerNumber(deviceId); - - InputDevice* device = createDeviceLocked(deviceId, controllerNumber, identifier, classes); - device->configure(when, &mConfig, 0); - device->reset(when); - - if (device->isIgnored()) { - ALOGI("Device added: id=%d, name='%s' (ignored non-input device)", deviceId, - identifier.name.string()); - } else { - ALOGI("Device added: id=%d, name='%s', sources=0x%08x", deviceId, - identifier.name.string(), device->getSources()); - } - - mDevices.add(deviceId, device); - bumpGenerationLocked(); - - if (device->getClasses() & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) { - notifyExternalStylusPresenceChanged(); - } -} - -void InputReader::removeDeviceLocked(nsecs_t when, int32_t deviceId) { - InputDevice* device = NULL; - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex < 0) { - ALOGW("Ignoring spurious device removed event for deviceId %d.", deviceId); - return; - } - - device = mDevices.valueAt(deviceIndex); - mDevices.removeItemsAt(deviceIndex, 1); - bumpGenerationLocked(); - - if (device->isIgnored()) { - ALOGI("Device removed: id=%d, name='%s' (ignored non-input device)", - device->getId(), device->getName().string()); - } else { - ALOGI("Device removed: id=%d, name='%s', sources=0x%08x", - device->getId(), device->getName().string(), device->getSources()); - } - - if (device->getClasses() & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) { - notifyExternalStylusPresenceChanged(); - } - - device->reset(when); - delete device; -} - -InputDevice* InputReader::createDeviceLocked(int32_t deviceId, int32_t controllerNumber, - const InputDeviceIdentifier& identifier, uint32_t classes) { - InputDevice* device = new InputDevice(&mContext, deviceId, bumpGenerationLocked(), - controllerNumber, identifier, classes); - - // External devices. - if (classes & INPUT_DEVICE_CLASS_EXTERNAL) { - device->setExternal(true); - } - - // Devices with mics. - if (classes & INPUT_DEVICE_CLASS_MIC) { - device->setMic(true); - } - - // Switch-like devices. - if (classes & INPUT_DEVICE_CLASS_SWITCH) { - device->addMapper(new SwitchInputMapper(device)); - } - - // Vibrator-like devices. - if (classes & INPUT_DEVICE_CLASS_VIBRATOR) { - device->addMapper(new VibratorInputMapper(device)); - } - - // Keyboard-like devices. - uint32_t keyboardSource = 0; - int32_t keyboardType = AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC; - if (classes & INPUT_DEVICE_CLASS_KEYBOARD) { - keyboardSource |= AINPUT_SOURCE_KEYBOARD; - } - if (classes & INPUT_DEVICE_CLASS_ALPHAKEY) { - keyboardType = AINPUT_KEYBOARD_TYPE_ALPHABETIC; - } - if (classes & INPUT_DEVICE_CLASS_DPAD) { - keyboardSource |= AINPUT_SOURCE_DPAD; - } - if (classes & INPUT_DEVICE_CLASS_GAMEPAD) { - keyboardSource |= AINPUT_SOURCE_GAMEPAD; - } - - if (keyboardSource != 0) { - device->addMapper(new KeyboardInputMapper(device, keyboardSource, keyboardType)); - } - - // Cursor-like devices. - if (classes & INPUT_DEVICE_CLASS_CURSOR) { - device->addMapper(new CursorInputMapper(device)); - } - - // Touchscreens and touchpad devices. - if (classes & INPUT_DEVICE_CLASS_TOUCH_MT) { - device->addMapper(new MultiTouchInputMapper(device)); - } else if (classes & INPUT_DEVICE_CLASS_TOUCH) { - device->addMapper(new SingleTouchInputMapper(device)); - } - - // Joystick-like devices. - if (classes & INPUT_DEVICE_CLASS_JOYSTICK) { - device->addMapper(new JoystickInputMapper(device)); - } - - // External stylus-like devices. - if (classes & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS) { - device->addMapper(new ExternalStylusInputMapper(device)); - } - - return device; -} - -void InputReader::processEventsForDeviceLocked(int32_t deviceId, - const RawEvent* rawEvents, size_t count) { - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex < 0) { - ALOGW("Discarding event for unknown deviceId %d.", deviceId); - return; - } - - InputDevice* device = mDevices.valueAt(deviceIndex); - if (device->isIgnored()) { - //ALOGD("Discarding event for ignored deviceId %d.", deviceId); - return; - } - - device->process(rawEvents, count); -} - -void InputReader::timeoutExpiredLocked(nsecs_t when) { - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - if (!device->isIgnored()) { - device->timeoutExpired(when); - } - } -} - -void InputReader::handleConfigurationChangedLocked(nsecs_t when) { - // Reset global meta state because it depends on the list of all configured devices. - updateGlobalMetaStateLocked(); - - // Enqueue configuration changed. - NotifyConfigurationChangedArgs args(when); - mQueuedListener->notifyConfigurationChanged(&args); -} - -void InputReader::refreshConfigurationLocked(uint32_t changes) { - mPolicy->getReaderConfiguration(&mConfig); - mEventHub->setExcludedDevices(mConfig.excludedDeviceNames); - - if (changes) { - ALOGI("Reconfiguring input devices. changes=0x%08x", changes); - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - - if (changes & InputReaderConfiguration::CHANGE_MUST_REOPEN) { - mEventHub->requestReopenDevices(); - } else { - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - device->configure(now, &mConfig, changes); - } - } - } -} - -void InputReader::updateGlobalMetaStateLocked() { - mGlobalMetaState = 0; - - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - mGlobalMetaState |= device->getMetaState(); - } -} - -int32_t InputReader::getGlobalMetaStateLocked() { - return mGlobalMetaState; -} - -void InputReader::notifyExternalStylusPresenceChanged() { - refreshConfigurationLocked(InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE); -} - -void InputReader::getExternalStylusDevicesLocked(Vector& outDevices) { - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - if (device->getClasses() & INPUT_DEVICE_CLASS_EXTERNAL_STYLUS && !device->isIgnored()) { - outDevices.push(); - device->getDeviceInfo(&outDevices.editTop()); - } - } -} - -void InputReader::dispatchExternalStylusState(const StylusState& state) { - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - device->updateExternalStylusState(state); - } -} - -void InputReader::disableVirtualKeysUntilLocked(nsecs_t time) { - mDisableVirtualKeysTimeout = time; -} - -bool InputReader::shouldDropVirtualKeyLocked(nsecs_t now, - InputDevice* device, int32_t keyCode, int32_t scanCode) { - if (now < mDisableVirtualKeysTimeout) { - ALOGI("Dropping virtual key from device %s because virtual keys are " - "temporarily disabled for the next %0.3fms. keyCode=%d, scanCode=%d", - device->getName().string(), - (mDisableVirtualKeysTimeout - now) * 0.000001, - keyCode, scanCode); - return true; - } else { - return false; - } -} - -void InputReader::fadePointerLocked() { - for (size_t i = 0; i < mDevices.size(); i++) { - InputDevice* device = mDevices.valueAt(i); - device->fadePointer(); - } -} - -void InputReader::requestTimeoutAtTimeLocked(nsecs_t when) { - if (when < mNextTimeout) { - mNextTimeout = when; - mEventHub->wake(); - } -} - -int32_t InputReader::bumpGenerationLocked() { - return ++mGeneration; -} - -void InputReader::getInputDevices(Vector& outInputDevices) { - AutoMutex _l(mLock); - getInputDevicesLocked(outInputDevices); -} - -void InputReader::getInputDevicesLocked(Vector& outInputDevices) { - outInputDevices.clear(); - - size_t numDevices = mDevices.size(); - for (size_t i = 0; i < numDevices; i++) { - InputDevice* device = mDevices.valueAt(i); - if (!device->isIgnored()) { - outInputDevices.push(); - device->getDeviceInfo(&outInputDevices.editTop()); - } - } -} - -int32_t InputReader::getKeyCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t keyCode) { - AutoMutex _l(mLock); - - return getStateLocked(deviceId, sourceMask, keyCode, &InputDevice::getKeyCodeState); -} - -int32_t InputReader::getScanCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t scanCode) { - AutoMutex _l(mLock); - - return getStateLocked(deviceId, sourceMask, scanCode, &InputDevice::getScanCodeState); -} - -int32_t InputReader::getSwitchState(int32_t deviceId, uint32_t sourceMask, int32_t switchCode) { - AutoMutex _l(mLock); - - return getStateLocked(deviceId, sourceMask, switchCode, &InputDevice::getSwitchState); -} - -int32_t InputReader::getStateLocked(int32_t deviceId, uint32_t sourceMask, int32_t code, - GetStateFunc getStateFunc) { - int32_t result = AKEY_STATE_UNKNOWN; - if (deviceId >= 0) { - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex >= 0) { - InputDevice* device = mDevices.valueAt(deviceIndex); - if (! device->isIgnored() && sourcesMatchMask(device->getSources(), sourceMask)) { - result = (device->*getStateFunc)(sourceMask, code); - } - } - } else { - size_t numDevices = mDevices.size(); - for (size_t i = 0; i < numDevices; i++) { - InputDevice* device = mDevices.valueAt(i); - if (! device->isIgnored() && sourcesMatchMask(device->getSources(), sourceMask)) { - // If any device reports AKEY_STATE_DOWN or AKEY_STATE_VIRTUAL, return that - // value. Otherwise, return AKEY_STATE_UP as long as one device reports it. - int32_t currentResult = (device->*getStateFunc)(sourceMask, code); - if (currentResult >= AKEY_STATE_DOWN) { - return currentResult; - } else if (currentResult == AKEY_STATE_UP) { - result = currentResult; - } - } - } - } - return result; -} - -bool InputReader::hasKeys(int32_t deviceId, uint32_t sourceMask, - size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) { - AutoMutex _l(mLock); - - memset(outFlags, 0, numCodes); - return markSupportedKeyCodesLocked(deviceId, sourceMask, numCodes, keyCodes, outFlags); -} - -bool InputReader::markSupportedKeyCodesLocked(int32_t deviceId, uint32_t sourceMask, - size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) { - bool result = false; - if (deviceId >= 0) { - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex >= 0) { - InputDevice* device = mDevices.valueAt(deviceIndex); - if (! device->isIgnored() && sourcesMatchMask(device->getSources(), sourceMask)) { - result = device->markSupportedKeyCodes(sourceMask, - numCodes, keyCodes, outFlags); - } - } - } else { - size_t numDevices = mDevices.size(); - for (size_t i = 0; i < numDevices; i++) { - InputDevice* device = mDevices.valueAt(i); - if (! device->isIgnored() && sourcesMatchMask(device->getSources(), sourceMask)) { - result |= device->markSupportedKeyCodes(sourceMask, - numCodes, keyCodes, outFlags); - } - } - } - return result; -} - -void InputReader::requestRefreshConfiguration(uint32_t changes) { - AutoMutex _l(mLock); - - if (changes) { - bool needWake = !mConfigurationChangesToRefresh; - mConfigurationChangesToRefresh |= changes; - - if (needWake) { - mEventHub->wake(); - } - } -} - -void InputReader::vibrate(int32_t deviceId, const nsecs_t* pattern, size_t patternSize, - ssize_t repeat, int32_t token) { - AutoMutex _l(mLock); - - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex >= 0) { - InputDevice* device = mDevices.valueAt(deviceIndex); - device->vibrate(pattern, patternSize, repeat, token); - } -} - -void InputReader::cancelVibrate(int32_t deviceId, int32_t token) { - AutoMutex _l(mLock); - - ssize_t deviceIndex = mDevices.indexOfKey(deviceId); - if (deviceIndex >= 0) { - InputDevice* device = mDevices.valueAt(deviceIndex); - device->cancelVibrate(token); - } -} - -void InputReader::dump(String8& dump) { - AutoMutex _l(mLock); - - mEventHub->dump(dump); - dump.append("\n"); - - dump.append("Input Reader State:\n"); - - for (size_t i = 0; i < mDevices.size(); i++) { - mDevices.valueAt(i)->dump(dump); - } - - dump.append(INDENT "Configuration:\n"); - dump.append(INDENT2 "ExcludedDeviceNames: ["); - for (size_t i = 0; i < mConfig.excludedDeviceNames.size(); i++) { - if (i != 0) { - dump.append(", "); - } - dump.append(mConfig.excludedDeviceNames.itemAt(i).string()); - } - dump.append("]\n"); - dump.appendFormat(INDENT2 "VirtualKeyQuietTime: %0.1fms\n", - mConfig.virtualKeyQuietTime * 0.000001f); - - dump.appendFormat(INDENT2 "PointerVelocityControlParameters: " - "scale=%0.3f, lowThreshold=%0.3f, highThreshold=%0.3f, acceleration=%0.3f\n", - mConfig.pointerVelocityControlParameters.scale, - mConfig.pointerVelocityControlParameters.lowThreshold, - mConfig.pointerVelocityControlParameters.highThreshold, - mConfig.pointerVelocityControlParameters.acceleration); - - dump.appendFormat(INDENT2 "WheelVelocityControlParameters: " - "scale=%0.3f, lowThreshold=%0.3f, highThreshold=%0.3f, acceleration=%0.3f\n", - mConfig.wheelVelocityControlParameters.scale, - mConfig.wheelVelocityControlParameters.lowThreshold, - mConfig.wheelVelocityControlParameters.highThreshold, - mConfig.wheelVelocityControlParameters.acceleration); - - dump.appendFormat(INDENT2 "PointerGesture:\n"); - dump.appendFormat(INDENT3 "Enabled: %s\n", - toString(mConfig.pointerGesturesEnabled)); - dump.appendFormat(INDENT3 "QuietInterval: %0.1fms\n", - mConfig.pointerGestureQuietInterval * 0.000001f); - dump.appendFormat(INDENT3 "DragMinSwitchSpeed: %0.1fpx/s\n", - mConfig.pointerGestureDragMinSwitchSpeed); - dump.appendFormat(INDENT3 "TapInterval: %0.1fms\n", - mConfig.pointerGestureTapInterval * 0.000001f); - dump.appendFormat(INDENT3 "TapDragInterval: %0.1fms\n", - mConfig.pointerGestureTapDragInterval * 0.000001f); - dump.appendFormat(INDENT3 "TapSlop: %0.1fpx\n", - mConfig.pointerGestureTapSlop); - dump.appendFormat(INDENT3 "MultitouchSettleInterval: %0.1fms\n", - mConfig.pointerGestureMultitouchSettleInterval * 0.000001f); - dump.appendFormat(INDENT3 "MultitouchMinDistance: %0.1fpx\n", - mConfig.pointerGestureMultitouchMinDistance); - dump.appendFormat(INDENT3 "SwipeTransitionAngleCosine: %0.1f\n", - mConfig.pointerGestureSwipeTransitionAngleCosine); - dump.appendFormat(INDENT3 "SwipeMaxWidthRatio: %0.1f\n", - mConfig.pointerGestureSwipeMaxWidthRatio); - dump.appendFormat(INDENT3 "MovementSpeedRatio: %0.1f\n", - mConfig.pointerGestureMovementSpeedRatio); - dump.appendFormat(INDENT3 "ZoomSpeedRatio: %0.1f\n", - mConfig.pointerGestureZoomSpeedRatio); -} - -void InputReader::monitor() { - // Acquire and release the lock to ensure that the reader has not deadlocked. - mLock.lock(); - mEventHub->wake(); - mReaderIsAliveCondition.wait(mLock); - mLock.unlock(); - - // Check the EventHub - mEventHub->monitor(); -} - - -// --- InputReader::ContextImpl --- - -InputReader::ContextImpl::ContextImpl(InputReader* reader) : - mReader(reader) { -} - -void InputReader::ContextImpl::updateGlobalMetaState() { - // lock is already held by the input loop - mReader->updateGlobalMetaStateLocked(); -} - -int32_t InputReader::ContextImpl::getGlobalMetaState() { - // lock is already held by the input loop - return mReader->getGlobalMetaStateLocked(); -} - -void InputReader::ContextImpl::disableVirtualKeysUntil(nsecs_t time) { - // lock is already held by the input loop - mReader->disableVirtualKeysUntilLocked(time); -} - -bool InputReader::ContextImpl::shouldDropVirtualKey(nsecs_t now, - InputDevice* device, int32_t keyCode, int32_t scanCode) { - // lock is already held by the input loop - return mReader->shouldDropVirtualKeyLocked(now, device, keyCode, scanCode); -} - -void InputReader::ContextImpl::fadePointer() { - // lock is already held by the input loop - mReader->fadePointerLocked(); -} - -void InputReader::ContextImpl::requestTimeoutAtTime(nsecs_t when) { - // lock is already held by the input loop - mReader->requestTimeoutAtTimeLocked(when); -} - -int32_t InputReader::ContextImpl::bumpGeneration() { - // lock is already held by the input loop - return mReader->bumpGenerationLocked(); -} - -void InputReader::ContextImpl::getExternalStylusDevices(Vector& outDevices) { - // lock is already held by whatever called refreshConfigurationLocked - mReader->getExternalStylusDevicesLocked(outDevices); -} - -void InputReader::ContextImpl::dispatchExternalStylusState(const StylusState& state) { - mReader->dispatchExternalStylusState(state); -} - -InputReaderPolicyInterface* InputReader::ContextImpl::getPolicy() { - return mReader->mPolicy.get(); -} - -InputListenerInterface* InputReader::ContextImpl::getListener() { - return mReader->mQueuedListener.get(); -} - -EventHubInterface* InputReader::ContextImpl::getEventHub() { - return mReader->mEventHub.get(); -} - - -// --- InputReaderThread --- - -InputReaderThread::InputReaderThread(const sp& reader) : - Thread(/*canCallJava*/ true), mReader(reader) { -} - -InputReaderThread::~InputReaderThread() { -} - -bool InputReaderThread::threadLoop() { - mReader->loopOnce(); - return true; -} - - -// --- InputDevice --- - -InputDevice::InputDevice(InputReaderContext* context, int32_t id, int32_t generation, - int32_t controllerNumber, const InputDeviceIdentifier& identifier, uint32_t classes) : - mContext(context), mId(id), mGeneration(generation), mControllerNumber(controllerNumber), - mIdentifier(identifier), mClasses(classes), - mSources(0), mIsExternal(false), mHasMic(false), mDropUntilNextSync(false) { -} - -InputDevice::~InputDevice() { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - delete mMappers[i]; - } - mMappers.clear(); -} - -void InputDevice::dump(String8& dump) { - InputDeviceInfo deviceInfo; - getDeviceInfo(& deviceInfo); - - dump.appendFormat(INDENT "Device %d: %s\n", deviceInfo.getId(), - deviceInfo.getDisplayName().string()); - dump.appendFormat(INDENT2 "Generation: %d\n", mGeneration); - dump.appendFormat(INDENT2 "IsExternal: %s\n", toString(mIsExternal)); - dump.appendFormat(INDENT2 "HasMic: %s\n", toString(mHasMic)); - dump.appendFormat(INDENT2 "Sources: 0x%08x\n", deviceInfo.getSources()); - dump.appendFormat(INDENT2 "KeyboardType: %d\n", deviceInfo.getKeyboardType()); - - const Vector& ranges = deviceInfo.getMotionRanges(); - if (!ranges.isEmpty()) { - dump.append(INDENT2 "Motion Ranges:\n"); - for (size_t i = 0; i < ranges.size(); i++) { - const InputDeviceInfo::MotionRange& range = ranges.itemAt(i); - const char* label = getAxisLabel(range.axis); - char name[32]; - if (label) { - strncpy(name, label, sizeof(name)); - name[sizeof(name) - 1] = '\0'; - } else { - snprintf(name, sizeof(name), "%d", range.axis); - } - dump.appendFormat(INDENT3 "%s: source=0x%08x, " - "min=%0.3f, max=%0.3f, flat=%0.3f, fuzz=%0.3f, resolution=%0.3f\n", - name, range.source, range.min, range.max, range.flat, range.fuzz, - range.resolution); - } - } - - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->dump(dump); - } -} - -void InputDevice::addMapper(InputMapper* mapper) { - mMappers.add(mapper); -} - -void InputDevice::configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes) { - mSources = 0; - - if (!isIgnored()) { - if (!changes) { // first time only - mContext->getEventHub()->getConfiguration(mId, &mConfiguration); - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_KEYBOARD_LAYOUTS)) { - if (!(mClasses & INPUT_DEVICE_CLASS_VIRTUAL)) { - sp keyboardLayout = - mContext->getPolicy()->getKeyboardLayoutOverlay(mIdentifier); - if (mContext->getEventHub()->setKeyboardLayoutOverlay(mId, keyboardLayout)) { - bumpGeneration(); - } - } - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_DEVICE_ALIAS)) { - if (!(mClasses & INPUT_DEVICE_CLASS_VIRTUAL)) { - String8 alias = mContext->getPolicy()->getDeviceAlias(mIdentifier); - if (mAlias != alias) { - mAlias = alias; - bumpGeneration(); - } - } - } - - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->configure(when, config, changes); - mSources |= mapper->getSources(); - } - } -} - -void InputDevice::reset(nsecs_t when) { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->reset(when); - } - - mContext->updateGlobalMetaState(); - - notifyReset(when); -} - -void InputDevice::process(const RawEvent* rawEvents, size_t count) { - // Process all of the events in order for each mapper. - // We cannot simply ask each mapper to process them in bulk because mappers may - // have side-effects that must be interleaved. For example, joystick movement events and - // gamepad button presses are handled by different mappers but they should be dispatched - // in the order received. - size_t numMappers = mMappers.size(); - for (const RawEvent* rawEvent = rawEvents; count--; rawEvent++) { -#if DEBUG_RAW_EVENTS - ALOGD("Input event: device=%d type=0x%04x code=0x%04x value=0x%08x when=%lld", - rawEvent->deviceId, rawEvent->type, rawEvent->code, rawEvent->value, - rawEvent->when); -#endif - - if (mDropUntilNextSync) { - if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) { - mDropUntilNextSync = false; -#if DEBUG_RAW_EVENTS - ALOGD("Recovered from input event buffer overrun."); -#endif - } else { -#if DEBUG_RAW_EVENTS - ALOGD("Dropped input event while waiting for next input sync."); -#endif - } - } else if (rawEvent->type == EV_SYN && rawEvent->code == SYN_DROPPED) { - ALOGI("Detected input event buffer overrun for device %s.", getName().string()); - mDropUntilNextSync = true; - reset(rawEvent->when); - } else { - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->process(rawEvent); - } - } - } -} - -void InputDevice::timeoutExpired(nsecs_t when) { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->timeoutExpired(when); - } -} - -void InputDevice::updateExternalStylusState(const StylusState& state) { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->updateExternalStylusState(state); - } -} - -void InputDevice::getDeviceInfo(InputDeviceInfo* outDeviceInfo) { - outDeviceInfo->initialize(mId, mGeneration, mControllerNumber, mIdentifier, mAlias, - mIsExternal, mHasMic); - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->populateDeviceInfo(outDeviceInfo); - } -} - -int32_t InputDevice::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) { - return getState(sourceMask, keyCode, & InputMapper::getKeyCodeState); -} - -int32_t InputDevice::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { - return getState(sourceMask, scanCode, & InputMapper::getScanCodeState); -} - -int32_t InputDevice::getSwitchState(uint32_t sourceMask, int32_t switchCode) { - return getState(sourceMask, switchCode, & InputMapper::getSwitchState); -} - -int32_t InputDevice::getState(uint32_t sourceMask, int32_t code, GetStateFunc getStateFunc) { - int32_t result = AKEY_STATE_UNKNOWN; - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - if (sourcesMatchMask(mapper->getSources(), sourceMask)) { - // If any mapper reports AKEY_STATE_DOWN or AKEY_STATE_VIRTUAL, return that - // value. Otherwise, return AKEY_STATE_UP as long as one mapper reports it. - int32_t currentResult = (mapper->*getStateFunc)(sourceMask, code); - if (currentResult >= AKEY_STATE_DOWN) { - return currentResult; - } else if (currentResult == AKEY_STATE_UP) { - result = currentResult; - } - } - } - return result; -} - -bool InputDevice::markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) { - bool result = false; - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - if (sourcesMatchMask(mapper->getSources(), sourceMask)) { - result |= mapper->markSupportedKeyCodes(sourceMask, numCodes, keyCodes, outFlags); - } - } - return result; -} - -void InputDevice::vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, - int32_t token) { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->vibrate(pattern, patternSize, repeat, token); - } -} - -void InputDevice::cancelVibrate(int32_t token) { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->cancelVibrate(token); - } -} - -void InputDevice::cancelTouch(nsecs_t when) { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->cancelTouch(when); - } -} - -int32_t InputDevice::getMetaState() { - int32_t result = 0; - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - result |= mapper->getMetaState(); - } - return result; -} - -void InputDevice::fadePointer() { - size_t numMappers = mMappers.size(); - for (size_t i = 0; i < numMappers; i++) { - InputMapper* mapper = mMappers[i]; - mapper->fadePointer(); - } -} - -void InputDevice::bumpGeneration() { - mGeneration = mContext->bumpGeneration(); -} - -void InputDevice::notifyReset(nsecs_t when) { - NotifyDeviceResetArgs args(when, mId); - mContext->getListener()->notifyDeviceReset(&args); -} - - -// --- CursorButtonAccumulator --- - -CursorButtonAccumulator::CursorButtonAccumulator() { - clearButtons(); -} - -void CursorButtonAccumulator::reset(InputDevice* device) { - mBtnLeft = device->isKeyPressed(BTN_LEFT); - mBtnRight = device->isKeyPressed(BTN_RIGHT); - mBtnMiddle = device->isKeyPressed(BTN_MIDDLE); - mBtnBack = device->isKeyPressed(BTN_BACK); - mBtnSide = device->isKeyPressed(BTN_SIDE); - mBtnForward = device->isKeyPressed(BTN_FORWARD); - mBtnExtra = device->isKeyPressed(BTN_EXTRA); - mBtnTask = device->isKeyPressed(BTN_TASK); -} - -void CursorButtonAccumulator::clearButtons() { - mBtnLeft = 0; - mBtnRight = 0; - mBtnMiddle = 0; - mBtnBack = 0; - mBtnSide = 0; - mBtnForward = 0; - mBtnExtra = 0; - mBtnTask = 0; -} - -void CursorButtonAccumulator::process(const RawEvent* rawEvent) { - if (rawEvent->type == EV_KEY) { - switch (rawEvent->code) { - case BTN_LEFT: - mBtnLeft = rawEvent->value; - break; - case BTN_RIGHT: - mBtnRight = rawEvent->value; - break; - case BTN_MIDDLE: - mBtnMiddle = rawEvent->value; - break; - case BTN_BACK: - mBtnBack = rawEvent->value; - break; - case BTN_SIDE: - mBtnSide = rawEvent->value; - break; - case BTN_FORWARD: - mBtnForward = rawEvent->value; - break; - case BTN_EXTRA: - mBtnExtra = rawEvent->value; - break; - case BTN_TASK: - mBtnTask = rawEvent->value; - break; - } - } -} - -uint32_t CursorButtonAccumulator::getButtonState() const { - uint32_t result = 0; - if (mBtnLeft) { - result |= AMOTION_EVENT_BUTTON_PRIMARY; - } - if (mBtnRight) { - result |= AMOTION_EVENT_BUTTON_SECONDARY; - } - if (mBtnMiddle) { - result |= AMOTION_EVENT_BUTTON_TERTIARY; - } - if (mBtnBack || mBtnSide) { - result |= AMOTION_EVENT_BUTTON_BACK; - } - if (mBtnForward || mBtnExtra) { - result |= AMOTION_EVENT_BUTTON_FORWARD; - } - return result; -} - - -// --- CursorMotionAccumulator --- - -CursorMotionAccumulator::CursorMotionAccumulator() { - clearRelativeAxes(); -} - -void CursorMotionAccumulator::reset(InputDevice* device) { - clearRelativeAxes(); -} - -void CursorMotionAccumulator::clearRelativeAxes() { - mRelX = 0; - mRelY = 0; -} - -void CursorMotionAccumulator::process(const RawEvent* rawEvent) { - if (rawEvent->type == EV_REL) { - switch (rawEvent->code) { - case REL_X: - mRelX = rawEvent->value; - break; - case REL_Y: - mRelY = rawEvent->value; - break; - } - } -} - -void CursorMotionAccumulator::finishSync() { - clearRelativeAxes(); -} - - -// --- CursorScrollAccumulator --- - -CursorScrollAccumulator::CursorScrollAccumulator() : - mHaveRelWheel(false), mHaveRelHWheel(false) { - clearRelativeAxes(); -} - -void CursorScrollAccumulator::configure(InputDevice* device) { - mHaveRelWheel = device->getEventHub()->hasRelativeAxis(device->getId(), REL_WHEEL); - mHaveRelHWheel = device->getEventHub()->hasRelativeAxis(device->getId(), REL_HWHEEL); -} - -void CursorScrollAccumulator::reset(InputDevice* device) { - clearRelativeAxes(); -} - -void CursorScrollAccumulator::clearRelativeAxes() { - mRelWheel = 0; - mRelHWheel = 0; -} - -void CursorScrollAccumulator::process(const RawEvent* rawEvent) { - if (rawEvent->type == EV_REL) { - switch (rawEvent->code) { - case REL_WHEEL: - mRelWheel = rawEvent->value; - break; - case REL_HWHEEL: - mRelHWheel = rawEvent->value; - break; - } - } -} - -void CursorScrollAccumulator::finishSync() { - clearRelativeAxes(); -} - - -// --- TouchButtonAccumulator --- - -TouchButtonAccumulator::TouchButtonAccumulator() : - mHaveBtnTouch(false), mHaveStylus(false) { - clearButtons(); -} - -void TouchButtonAccumulator::configure(InputDevice* device) { - mHaveBtnTouch = device->hasKey(BTN_TOUCH); - mHaveStylus = device->hasKey(BTN_TOOL_PEN) - || device->hasKey(BTN_TOOL_RUBBER) - || device->hasKey(BTN_TOOL_BRUSH) - || device->hasKey(BTN_TOOL_PENCIL) - || device->hasKey(BTN_TOOL_AIRBRUSH); -} - -void TouchButtonAccumulator::reset(InputDevice* device) { - mBtnTouch = device->isKeyPressed(BTN_TOUCH); - mBtnStylus = device->isKeyPressed(BTN_STYLUS); - // BTN_0 is what gets mapped for the HID usage Digitizers.SecondaryBarrelSwitch - mBtnStylus2 = - device->isKeyPressed(BTN_STYLUS2) || device->isKeyPressed(BTN_0); - mBtnToolFinger = device->isKeyPressed(BTN_TOOL_FINGER); - mBtnToolPen = device->isKeyPressed(BTN_TOOL_PEN); - mBtnToolRubber = device->isKeyPressed(BTN_TOOL_RUBBER); - mBtnToolBrush = device->isKeyPressed(BTN_TOOL_BRUSH); - mBtnToolPencil = device->isKeyPressed(BTN_TOOL_PENCIL); - mBtnToolAirbrush = device->isKeyPressed(BTN_TOOL_AIRBRUSH); - mBtnToolMouse = device->isKeyPressed(BTN_TOOL_MOUSE); - mBtnToolLens = device->isKeyPressed(BTN_TOOL_LENS); - mBtnToolDoubleTap = device->isKeyPressed(BTN_TOOL_DOUBLETAP); - mBtnToolTripleTap = device->isKeyPressed(BTN_TOOL_TRIPLETAP); - mBtnToolQuadTap = device->isKeyPressed(BTN_TOOL_QUADTAP); -} - -void TouchButtonAccumulator::clearButtons() { - mBtnTouch = 0; - mBtnStylus = 0; - mBtnStylus2 = 0; - mBtnToolFinger = 0; - mBtnToolPen = 0; - mBtnToolRubber = 0; - mBtnToolBrush = 0; - mBtnToolPencil = 0; - mBtnToolAirbrush = 0; - mBtnToolMouse = 0; - mBtnToolLens = 0; - mBtnToolDoubleTap = 0; - mBtnToolTripleTap = 0; - mBtnToolQuadTap = 0; -} - -void TouchButtonAccumulator::process(const RawEvent* rawEvent) { - if (rawEvent->type == EV_KEY) { - switch (rawEvent->code) { - case BTN_TOUCH: - mBtnTouch = rawEvent->value; - break; - case BTN_STYLUS: - mBtnStylus = rawEvent->value; - break; - case BTN_STYLUS2: - case BTN_0:// BTN_0 is what gets mapped for the HID usage Digitizers.SecondaryBarrelSwitch - mBtnStylus2 = rawEvent->value; - break; - case BTN_TOOL_FINGER: - mBtnToolFinger = rawEvent->value; - break; - case BTN_TOOL_PEN: - mBtnToolPen = rawEvent->value; - break; - case BTN_TOOL_RUBBER: - mBtnToolRubber = rawEvent->value; - break; - case BTN_TOOL_BRUSH: - mBtnToolBrush = rawEvent->value; - break; - case BTN_TOOL_PENCIL: - mBtnToolPencil = rawEvent->value; - break; - case BTN_TOOL_AIRBRUSH: - mBtnToolAirbrush = rawEvent->value; - break; - case BTN_TOOL_MOUSE: - mBtnToolMouse = rawEvent->value; - break; - case BTN_TOOL_LENS: - mBtnToolLens = rawEvent->value; - break; - case BTN_TOOL_DOUBLETAP: - mBtnToolDoubleTap = rawEvent->value; - break; - case BTN_TOOL_TRIPLETAP: - mBtnToolTripleTap = rawEvent->value; - break; - case BTN_TOOL_QUADTAP: - mBtnToolQuadTap = rawEvent->value; - break; - } - } -} - -uint32_t TouchButtonAccumulator::getButtonState() const { - uint32_t result = 0; - if (mBtnStylus) { - result |= AMOTION_EVENT_BUTTON_STYLUS_PRIMARY; - } - if (mBtnStylus2) { - result |= AMOTION_EVENT_BUTTON_STYLUS_SECONDARY; - } - return result; -} - -int32_t TouchButtonAccumulator::getToolType() const { - if (mBtnToolMouse || mBtnToolLens) { - return AMOTION_EVENT_TOOL_TYPE_MOUSE; - } - if (mBtnToolRubber) { - return AMOTION_EVENT_TOOL_TYPE_ERASER; - } - if (mBtnToolPen || mBtnToolBrush || mBtnToolPencil || mBtnToolAirbrush) { - return AMOTION_EVENT_TOOL_TYPE_STYLUS; - } - if (mBtnToolFinger || mBtnToolDoubleTap || mBtnToolTripleTap || mBtnToolQuadTap) { - return AMOTION_EVENT_TOOL_TYPE_FINGER; - } - return AMOTION_EVENT_TOOL_TYPE_UNKNOWN; -} - -bool TouchButtonAccumulator::isToolActive() const { - return mBtnTouch || mBtnToolFinger || mBtnToolPen || mBtnToolRubber - || mBtnToolBrush || mBtnToolPencil || mBtnToolAirbrush - || mBtnToolMouse || mBtnToolLens - || mBtnToolDoubleTap || mBtnToolTripleTap || mBtnToolQuadTap; -} - -bool TouchButtonAccumulator::isHovering() const { - return mHaveBtnTouch && !mBtnTouch; -} - -bool TouchButtonAccumulator::hasStylus() const { - return mHaveStylus; -} - - -// --- RawPointerAxes --- - -RawPointerAxes::RawPointerAxes() { - clear(); -} - -void RawPointerAxes::clear() { - x.clear(); - y.clear(); - pressure.clear(); - touchMajor.clear(); - touchMinor.clear(); - toolMajor.clear(); - toolMinor.clear(); - orientation.clear(); - distance.clear(); - tiltX.clear(); - tiltY.clear(); - trackingId.clear(); - slot.clear(); -} - - -// --- RawPointerData --- - -RawPointerData::RawPointerData() { - clear(); -} - -void RawPointerData::clear() { - pointerCount = 0; - clearIdBits(); -} - -void RawPointerData::copyFrom(const RawPointerData& other) { - pointerCount = other.pointerCount; - hoveringIdBits = other.hoveringIdBits; - touchingIdBits = other.touchingIdBits; - - for (uint32_t i = 0; i < pointerCount; i++) { - pointers[i] = other.pointers[i]; - - int id = pointers[i].id; - idToIndex[id] = other.idToIndex[id]; - } -} - -void RawPointerData::getCentroidOfTouchingPointers(float* outX, float* outY) const { - float x = 0, y = 0; - uint32_t count = touchingIdBits.count(); - if (count) { - for (BitSet32 idBits(touchingIdBits); !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - const Pointer& pointer = pointerForId(id); - x += pointer.x; - y += pointer.y; - } - x /= count; - y /= count; - } - *outX = x; - *outY = y; -} - - -// --- CookedPointerData --- - -CookedPointerData::CookedPointerData() { - clear(); -} - -void CookedPointerData::clear() { - pointerCount = 0; - hoveringIdBits.clear(); - touchingIdBits.clear(); -} - -void CookedPointerData::copyFrom(const CookedPointerData& other) { - pointerCount = other.pointerCount; - hoveringIdBits = other.hoveringIdBits; - touchingIdBits = other.touchingIdBits; - - for (uint32_t i = 0; i < pointerCount; i++) { - pointerProperties[i].copyFrom(other.pointerProperties[i]); - pointerCoords[i].copyFrom(other.pointerCoords[i]); - - int id = pointerProperties[i].id; - idToIndex[id] = other.idToIndex[id]; - } -} - - -// --- SingleTouchMotionAccumulator --- - -SingleTouchMotionAccumulator::SingleTouchMotionAccumulator() { - clearAbsoluteAxes(); -} - -void SingleTouchMotionAccumulator::reset(InputDevice* device) { - mAbsX = device->getAbsoluteAxisValue(ABS_X); - mAbsY = device->getAbsoluteAxisValue(ABS_Y); - mAbsPressure = device->getAbsoluteAxisValue(ABS_PRESSURE); - mAbsToolWidth = device->getAbsoluteAxisValue(ABS_TOOL_WIDTH); - mAbsDistance = device->getAbsoluteAxisValue(ABS_DISTANCE); - mAbsTiltX = device->getAbsoluteAxisValue(ABS_TILT_X); - mAbsTiltY = device->getAbsoluteAxisValue(ABS_TILT_Y); -} - -void SingleTouchMotionAccumulator::clearAbsoluteAxes() { - mAbsX = 0; - mAbsY = 0; - mAbsPressure = 0; - mAbsToolWidth = 0; - mAbsDistance = 0; - mAbsTiltX = 0; - mAbsTiltY = 0; -} - -void SingleTouchMotionAccumulator::process(const RawEvent* rawEvent) { - if (rawEvent->type == EV_ABS) { - switch (rawEvent->code) { - case ABS_X: - mAbsX = rawEvent->value; - break; - case ABS_Y: - mAbsY = rawEvent->value; - break; - case ABS_PRESSURE: - mAbsPressure = rawEvent->value; - break; - case ABS_TOOL_WIDTH: - mAbsToolWidth = rawEvent->value; - break; - case ABS_DISTANCE: - mAbsDistance = rawEvent->value; - break; - case ABS_TILT_X: - mAbsTiltX = rawEvent->value; - break; - case ABS_TILT_Y: - mAbsTiltY = rawEvent->value; - break; - } - } -} - - -// --- MultiTouchMotionAccumulator --- - -MultiTouchMotionAccumulator::MultiTouchMotionAccumulator() : - mCurrentSlot(-1), mSlots(NULL), mSlotCount(0), mUsingSlotsProtocol(false), - mHaveStylus(false) { -} - -MultiTouchMotionAccumulator::~MultiTouchMotionAccumulator() { - delete[] mSlots; -} - -void MultiTouchMotionAccumulator::configure(InputDevice* device, - size_t slotCount, bool usingSlotsProtocol) { - mSlotCount = slotCount; - mUsingSlotsProtocol = usingSlotsProtocol; - mHaveStylus = device->hasAbsoluteAxis(ABS_MT_TOOL_TYPE); - - delete[] mSlots; - mSlots = new Slot[slotCount]; -} - -void MultiTouchMotionAccumulator::reset(InputDevice* device) { - // Unfortunately there is no way to read the initial contents of the slots. - // So when we reset the accumulator, we must assume they are all zeroes. - if (mUsingSlotsProtocol) { - // Query the driver for the current slot index and use it as the initial slot - // before we start reading events from the device. It is possible that the - // current slot index will not be the same as it was when the first event was - // written into the evdev buffer, which means the input mapper could start - // out of sync with the initial state of the events in the evdev buffer. - // In the extremely unlikely case that this happens, the data from - // two slots will be confused until the next ABS_MT_SLOT event is received. - // This can cause the touch point to "jump", but at least there will be - // no stuck touches. - int32_t initialSlot; - status_t status = device->getEventHub()->getAbsoluteAxisValue(device->getId(), - ABS_MT_SLOT, &initialSlot); - if (status) { - ALOGD("Could not retrieve current multitouch slot index. status=%d", status); - initialSlot = -1; - } - clearSlots(initialSlot); - } else { - clearSlots(-1); - } -} - -void MultiTouchMotionAccumulator::clearSlots(int32_t initialSlot) { - if (mSlots) { - for (size_t i = 0; i < mSlotCount; i++) { - mSlots[i].clear(); - } - } - mCurrentSlot = initialSlot; -} - -void MultiTouchMotionAccumulator::process(const RawEvent* rawEvent) { - if (rawEvent->type == EV_ABS) { - bool newSlot = false; - if (mUsingSlotsProtocol) { - if (rawEvent->code == ABS_MT_SLOT) { - mCurrentSlot = rawEvent->value; - newSlot = true; - } - } else if (mCurrentSlot < 0) { - mCurrentSlot = 0; - } - - if (mCurrentSlot < 0 || size_t(mCurrentSlot) >= mSlotCount) { -#if DEBUG_POINTERS - if (newSlot) { - ALOGW("MultiTouch device emitted invalid slot index %d but it " - "should be between 0 and %d; ignoring this slot.", - mCurrentSlot, mSlotCount - 1); - } -#endif - } else { - Slot* slot = &mSlots[mCurrentSlot]; - - switch (rawEvent->code) { - case ABS_MT_POSITION_X: - slot->mInUse = true; - slot->mAbsMTPositionX = rawEvent->value; - break; - case ABS_MT_POSITION_Y: - slot->mInUse = true; - slot->mAbsMTPositionY = rawEvent->value; - break; - case ABS_MT_TOUCH_MAJOR: - slot->mInUse = true; - slot->mAbsMTTouchMajor = rawEvent->value; - break; - case ABS_MT_TOUCH_MINOR: - slot->mInUse = true; - slot->mAbsMTTouchMinor = rawEvent->value; - slot->mHaveAbsMTTouchMinor = true; - break; - case ABS_MT_WIDTH_MAJOR: - slot->mInUse = true; - slot->mAbsMTWidthMajor = rawEvent->value; - break; - case ABS_MT_WIDTH_MINOR: - slot->mInUse = true; - slot->mAbsMTWidthMinor = rawEvent->value; - slot->mHaveAbsMTWidthMinor = true; - break; - case ABS_MT_ORIENTATION: - slot->mInUse = true; - slot->mAbsMTOrientation = rawEvent->value; - break; - case ABS_MT_TRACKING_ID: - if (mUsingSlotsProtocol && rawEvent->value < 0) { - // The slot is no longer in use but it retains its previous contents, - // which may be reused for subsequent touches. - slot->mInUse = false; - } else { - slot->mInUse = true; - slot->mAbsMTTrackingId = rawEvent->value; - } - break; - case ABS_MT_PRESSURE: - slot->mInUse = true; - slot->mAbsMTPressure = rawEvent->value; - break; - case ABS_MT_DISTANCE: - slot->mInUse = true; - slot->mAbsMTDistance = rawEvent->value; - break; - case ABS_MT_TOOL_TYPE: - slot->mInUse = true; - slot->mAbsMTToolType = rawEvent->value; - slot->mHaveAbsMTToolType = true; - break; - } - } - } else if (rawEvent->type == EV_SYN && rawEvent->code == SYN_MT_REPORT) { - // MultiTouch Sync: The driver has returned all data for *one* of the pointers. - mCurrentSlot += 1; - } -} - -void MultiTouchMotionAccumulator::finishSync() { - if (!mUsingSlotsProtocol) { - clearSlots(-1); - } -} - -bool MultiTouchMotionAccumulator::hasStylus() const { - return mHaveStylus; -} - - -// --- MultiTouchMotionAccumulator::Slot --- - -MultiTouchMotionAccumulator::Slot::Slot() { - clear(); -} - -void MultiTouchMotionAccumulator::Slot::clear() { - mInUse = false; - mHaveAbsMTTouchMinor = false; - mHaveAbsMTWidthMinor = false; - mHaveAbsMTToolType = false; - mAbsMTPositionX = 0; - mAbsMTPositionY = 0; - mAbsMTTouchMajor = 0; - mAbsMTTouchMinor = 0; - mAbsMTWidthMajor = 0; - mAbsMTWidthMinor = 0; - mAbsMTOrientation = 0; - mAbsMTTrackingId = -1; - mAbsMTPressure = 0; - mAbsMTDistance = 0; - mAbsMTToolType = 0; -} - -int32_t MultiTouchMotionAccumulator::Slot::getToolType() const { - if (mHaveAbsMTToolType) { - switch (mAbsMTToolType) { - case MT_TOOL_FINGER: - return AMOTION_EVENT_TOOL_TYPE_FINGER; - case MT_TOOL_PEN: - return AMOTION_EVENT_TOOL_TYPE_STYLUS; - } - } - return AMOTION_EVENT_TOOL_TYPE_UNKNOWN; -} - - -// --- InputMapper --- - -InputMapper::InputMapper(InputDevice* device) : - mDevice(device), mContext(device->getContext()) { -} - -InputMapper::~InputMapper() { -} - -void InputMapper::populateDeviceInfo(InputDeviceInfo* info) { - info->addSource(getSources()); -} - -void InputMapper::dump(String8& dump) { -} - -void InputMapper::configure(nsecs_t when, - const InputReaderConfiguration* config, uint32_t changes) { -} - -void InputMapper::reset(nsecs_t when) { -} - -void InputMapper::timeoutExpired(nsecs_t when) { -} - -int32_t InputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) { - return AKEY_STATE_UNKNOWN; -} - -int32_t InputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { - return AKEY_STATE_UNKNOWN; -} - -int32_t InputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) { - return AKEY_STATE_UNKNOWN; -} - -bool InputMapper::markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) { - return false; -} - -void InputMapper::vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, - int32_t token) { -} - -void InputMapper::cancelVibrate(int32_t token) { -} - -void InputMapper::cancelTouch(nsecs_t when) { -} - -int32_t InputMapper::getMetaState() { - return 0; -} - -void InputMapper::updateExternalStylusState(const StylusState& state) { - -} - -void InputMapper::fadePointer() { -} - -status_t InputMapper::getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo) { - return getEventHub()->getAbsoluteAxisInfo(getDeviceId(), axis, axisInfo); -} - -void InputMapper::bumpGeneration() { - mDevice->bumpGeneration(); -} - -void InputMapper::dumpRawAbsoluteAxisInfo(String8& dump, - const RawAbsoluteAxisInfo& axis, const char* name) { - if (axis.valid) { - dump.appendFormat(INDENT4 "%s: min=%d, max=%d, flat=%d, fuzz=%d, resolution=%d\n", - name, axis.minValue, axis.maxValue, axis.flat, axis.fuzz, axis.resolution); - } else { - dump.appendFormat(INDENT4 "%s: unknown range\n", name); - } -} - -void InputMapper::dumpStylusState(String8& dump, const StylusState& state) { - dump.appendFormat(INDENT4 "When: %" PRId64 "\n", state.when); - dump.appendFormat(INDENT4 "Pressure: %f\n", state.pressure); - dump.appendFormat(INDENT4 "Button State: 0x%08x\n", state.buttons); - dump.appendFormat(INDENT4 "Tool Type: %" PRId32 "\n", state.toolType); -} - -// --- SwitchInputMapper --- - -SwitchInputMapper::SwitchInputMapper(InputDevice* device) : - InputMapper(device), mSwitchValues(0), mUpdatedSwitchMask(0) { -} - -SwitchInputMapper::~SwitchInputMapper() { -} - -uint32_t SwitchInputMapper::getSources() { - return AINPUT_SOURCE_SWITCH; -} - -void SwitchInputMapper::process(const RawEvent* rawEvent) { - switch (rawEvent->type) { - case EV_SW: - processSwitch(rawEvent->code, rawEvent->value); - break; - - case EV_SYN: - if (rawEvent->code == SYN_REPORT) { - sync(rawEvent->when); - } - } -} - -void SwitchInputMapper::processSwitch(int32_t switchCode, int32_t switchValue) { - if (switchCode >= 0 && switchCode < 32) { - if (switchValue) { - mSwitchValues |= 1 << switchCode; - } else { - mSwitchValues &= ~(1 << switchCode); - } - mUpdatedSwitchMask |= 1 << switchCode; - } -} - -void SwitchInputMapper::sync(nsecs_t when) { - if (mUpdatedSwitchMask) { - uint32_t updatedSwitchValues = mSwitchValues & mUpdatedSwitchMask; - NotifySwitchArgs args(when, 0, updatedSwitchValues, mUpdatedSwitchMask); - getListener()->notifySwitch(&args); - - mUpdatedSwitchMask = 0; - } -} - -int32_t SwitchInputMapper::getSwitchState(uint32_t sourceMask, int32_t switchCode) { - return getEventHub()->getSwitchState(getDeviceId(), switchCode); -} - -void SwitchInputMapper::dump(String8& dump) { - dump.append(INDENT2 "Switch Input Mapper:\n"); - dump.appendFormat(INDENT3 "SwitchValues: %x\n", mSwitchValues); -} - -// --- VibratorInputMapper --- - -VibratorInputMapper::VibratorInputMapper(InputDevice* device) : - InputMapper(device), mVibrating(false) { -} - -VibratorInputMapper::~VibratorInputMapper() { -} - -uint32_t VibratorInputMapper::getSources() { - return 0; -} - -void VibratorInputMapper::populateDeviceInfo(InputDeviceInfo* info) { - InputMapper::populateDeviceInfo(info); - - info->setVibrator(true); -} - -void VibratorInputMapper::process(const RawEvent* rawEvent) { - // TODO: Handle FF_STATUS, although it does not seem to be widely supported. -} - -void VibratorInputMapper::vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, - int32_t token) { -#if DEBUG_VIBRATOR - String8 patternStr; - for (size_t i = 0; i < patternSize; i++) { - if (i != 0) { - patternStr.append(", "); - } - patternStr.appendFormat("%lld", pattern[i]); - } - ALOGD("vibrate: deviceId=%d, pattern=[%s], repeat=%ld, token=%d", - getDeviceId(), patternStr.string(), repeat, token); -#endif - - mVibrating = true; - memcpy(mPattern, pattern, patternSize * sizeof(nsecs_t)); - mPatternSize = patternSize; - mRepeat = repeat; - mToken = token; - mIndex = -1; - - nextStep(); -} - -void VibratorInputMapper::cancelVibrate(int32_t token) { -#if DEBUG_VIBRATOR - ALOGD("cancelVibrate: deviceId=%d, token=%d", getDeviceId(), token); -#endif - - if (mVibrating && mToken == token) { - stopVibrating(); - } -} - -void VibratorInputMapper::timeoutExpired(nsecs_t when) { - if (mVibrating) { - if (when >= mNextStepTime) { - nextStep(); - } else { - getContext()->requestTimeoutAtTime(mNextStepTime); - } - } -} - -void VibratorInputMapper::nextStep() { - mIndex += 1; - if (size_t(mIndex) >= mPatternSize) { - if (mRepeat < 0) { - // We are done. - stopVibrating(); - return; - } - mIndex = mRepeat; - } - - bool vibratorOn = mIndex & 1; - nsecs_t duration = mPattern[mIndex]; - if (vibratorOn) { -#if DEBUG_VIBRATOR - ALOGD("nextStep: sending vibrate deviceId=%d, duration=%lld", - getDeviceId(), duration); -#endif - getEventHub()->vibrate(getDeviceId(), duration); - } else { -#if DEBUG_VIBRATOR - ALOGD("nextStep: sending cancel vibrate deviceId=%d", getDeviceId()); -#endif - getEventHub()->cancelVibrate(getDeviceId()); - } - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - mNextStepTime = now + duration; - getContext()->requestTimeoutAtTime(mNextStepTime); -#if DEBUG_VIBRATOR - ALOGD("nextStep: scheduled timeout in %0.3fms", duration * 0.000001f); -#endif -} - -void VibratorInputMapper::stopVibrating() { - mVibrating = false; -#if DEBUG_VIBRATOR - ALOGD("stopVibrating: sending cancel vibrate deviceId=%d", getDeviceId()); -#endif - getEventHub()->cancelVibrate(getDeviceId()); -} - -void VibratorInputMapper::dump(String8& dump) { - dump.append(INDENT2 "Vibrator Input Mapper:\n"); - dump.appendFormat(INDENT3 "Vibrating: %s\n", toString(mVibrating)); -} - - -// --- KeyboardInputMapper --- - -KeyboardInputMapper::KeyboardInputMapper(InputDevice* device, - uint32_t source, int32_t keyboardType) : - InputMapper(device), mSource(source), - mKeyboardType(keyboardType) { -} - -KeyboardInputMapper::~KeyboardInputMapper() { -} - -uint32_t KeyboardInputMapper::getSources() { - return mSource; -} - -void KeyboardInputMapper::populateDeviceInfo(InputDeviceInfo* info) { - InputMapper::populateDeviceInfo(info); - - info->setKeyboardType(mKeyboardType); - info->setKeyCharacterMap(getEventHub()->getKeyCharacterMap(getDeviceId())); -} - -void KeyboardInputMapper::dump(String8& dump) { - dump.append(INDENT2 "Keyboard Input Mapper:\n"); - dumpParameters(dump); - dump.appendFormat(INDENT3 "KeyboardType: %d\n", mKeyboardType); - dump.appendFormat(INDENT3 "Orientation: %d\n", mOrientation); - dump.appendFormat(INDENT3 "KeyDowns: %zu keys currently down\n", mKeyDowns.size()); - dump.appendFormat(INDENT3 "MetaState: 0x%0x\n", mMetaState); - dump.appendFormat(INDENT3 "DownTime: %lld\n", (long long)mDownTime); -} - - -void KeyboardInputMapper::configure(nsecs_t when, - const InputReaderConfiguration* config, uint32_t changes) { - InputMapper::configure(when, config, changes); - - if (!changes) { // first time only - // Configure basic parameters. - configureParameters(); - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_DISPLAY_INFO)) { - if (mParameters.orientationAware && mParameters.hasAssociatedDisplay) { - DisplayViewport v; - if (config->getDisplayInfo(false /*external*/, &v)) { - mOrientation = v.orientation; - } else { - mOrientation = DISPLAY_ORIENTATION_0; - } - } else { - mOrientation = DISPLAY_ORIENTATION_0; - } - } -} - -void KeyboardInputMapper::configureParameters() { - mParameters.orientationAware = false; - getDevice()->getConfiguration().tryGetProperty(String8("keyboard.orientationAware"), - mParameters.orientationAware); - - mParameters.hasAssociatedDisplay = false; - if (mParameters.orientationAware) { - mParameters.hasAssociatedDisplay = true; - } - - mParameters.handlesKeyRepeat = false; - getDevice()->getConfiguration().tryGetProperty(String8("keyboard.handlesKeyRepeat"), - mParameters.handlesKeyRepeat); -} - -void KeyboardInputMapper::dumpParameters(String8& dump) { - dump.append(INDENT3 "Parameters:\n"); - dump.appendFormat(INDENT4 "HasAssociatedDisplay: %s\n", - toString(mParameters.hasAssociatedDisplay)); - dump.appendFormat(INDENT4 "OrientationAware: %s\n", - toString(mParameters.orientationAware)); - dump.appendFormat(INDENT4 "HandlesKeyRepeat: %s\n", - toString(mParameters.handlesKeyRepeat)); -} - -void KeyboardInputMapper::reset(nsecs_t when) { - mMetaState = AMETA_NONE; - mDownTime = 0; - mKeyDowns.clear(); - mCurrentHidUsage = 0; - - resetLedState(); - - InputMapper::reset(when); -} - -void KeyboardInputMapper::process(const RawEvent* rawEvent) { - switch (rawEvent->type) { - case EV_KEY: { - int32_t scanCode = rawEvent->code; - int32_t usageCode = mCurrentHidUsage; - mCurrentHidUsage = 0; - - if (isKeyboardOrGamepadKey(scanCode)) { - processKey(rawEvent->when, rawEvent->value != 0, scanCode, usageCode); - } - break; - } - case EV_MSC: { - if (rawEvent->code == MSC_SCAN) { - mCurrentHidUsage = rawEvent->value; - } - break; - } - case EV_SYN: { - if (rawEvent->code == SYN_REPORT) { - mCurrentHidUsage = 0; - } - } - } -} - -bool KeyboardInputMapper::isKeyboardOrGamepadKey(int32_t scanCode) { - return scanCode < BTN_MOUSE - || scanCode >= KEY_OK - || (scanCode >= BTN_MISC && scanCode < BTN_MOUSE) - || (scanCode >= BTN_JOYSTICK && scanCode < BTN_DIGI); -} - -void KeyboardInputMapper::processKey(nsecs_t when, bool down, int32_t scanCode, - int32_t usageCode) { - int32_t keyCode; - int32_t keyMetaState; - uint32_t policyFlags; - - if (getEventHub()->mapKey(getDeviceId(), scanCode, usageCode, mMetaState, - &keyCode, &keyMetaState, &policyFlags)) { - keyCode = AKEYCODE_UNKNOWN; - keyMetaState = mMetaState; - policyFlags = 0; - } - - if (down) { - // Rotate key codes according to orientation if needed. - if (mParameters.orientationAware && mParameters.hasAssociatedDisplay) { - keyCode = rotateKeyCode(keyCode, mOrientation); - } - - // Add key down. - ssize_t keyDownIndex = findKeyDown(scanCode); - if (keyDownIndex >= 0) { - // key repeat, be sure to use same keycode as before in case of rotation - keyCode = mKeyDowns.itemAt(keyDownIndex).keyCode; - } else { - // key down - if ((policyFlags & POLICY_FLAG_VIRTUAL) - && mContext->shouldDropVirtualKey(when, - getDevice(), keyCode, scanCode)) { - return; - } - if (policyFlags & POLICY_FLAG_GESTURE) { - mDevice->cancelTouch(when); - } - - mKeyDowns.push(); - KeyDown& keyDown = mKeyDowns.editTop(); - keyDown.keyCode = keyCode; - keyDown.scanCode = scanCode; - } - - mDownTime = when; - } else { - // Remove key down. - ssize_t keyDownIndex = findKeyDown(scanCode); - if (keyDownIndex >= 0) { - // key up, be sure to use same keycode as before in case of rotation - keyCode = mKeyDowns.itemAt(keyDownIndex).keyCode; - mKeyDowns.removeAt(size_t(keyDownIndex)); - } else { - // key was not actually down - ALOGI("Dropping key up from device %s because the key was not down. " - "keyCode=%d, scanCode=%d", - getDeviceName().string(), keyCode, scanCode); - return; - } - } - - int32_t oldMetaState = mMetaState; - int32_t newMetaState = updateMetaState(keyCode, down, oldMetaState); - bool metaStateChanged = oldMetaState != newMetaState; - if (metaStateChanged) { - mMetaState = newMetaState; - updateLedState(false); - - // If global meta state changed send it along with the key. - // If it has not changed then we'll use what keymap gave us, - // since key replacement logic might temporarily reset a few - // meta bits for given key. - keyMetaState = newMetaState; - } - - nsecs_t downTime = mDownTime; - - // Key down on external an keyboard should wake the device. - // We don't do this for internal keyboards to prevent them from waking up in your pocket. - // For internal keyboards, the key layout file should specify the policy flags for - // each wake key individually. - // TODO: Use the input device configuration to control this behavior more finely. - if (down && getDevice()->isExternal()) { - policyFlags |= POLICY_FLAG_WAKE; - } - - if (mParameters.handlesKeyRepeat) { - policyFlags |= POLICY_FLAG_DISABLE_KEY_REPEAT; - } - - if (metaStateChanged) { - getContext()->updateGlobalMetaState(); - } - - if (down && !isMetaKey(keyCode)) { - getContext()->fadePointer(); - } - - NotifyKeyArgs args(when, getDeviceId(), mSource, policyFlags, - down ? AKEY_EVENT_ACTION_DOWN : AKEY_EVENT_ACTION_UP, - AKEY_EVENT_FLAG_FROM_SYSTEM, keyCode, scanCode, keyMetaState, downTime); - getListener()->notifyKey(&args); -} - -ssize_t KeyboardInputMapper::findKeyDown(int32_t scanCode) { - size_t n = mKeyDowns.size(); - for (size_t i = 0; i < n; i++) { - if (mKeyDowns[i].scanCode == scanCode) { - return i; - } - } - return -1; -} - -int32_t KeyboardInputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) { - return getEventHub()->getKeyCodeState(getDeviceId(), keyCode); -} - -int32_t KeyboardInputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { - return getEventHub()->getScanCodeState(getDeviceId(), scanCode); -} - -bool KeyboardInputMapper::markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) { - return getEventHub()->markSupportedKeyCodes(getDeviceId(), numCodes, keyCodes, outFlags); -} - -int32_t KeyboardInputMapper::getMetaState() { - return mMetaState; -} - -void KeyboardInputMapper::resetLedState() { - initializeLedState(mCapsLockLedState, ALED_CAPS_LOCK); - initializeLedState(mNumLockLedState, ALED_NUM_LOCK); - initializeLedState(mScrollLockLedState, ALED_SCROLL_LOCK); - - updateLedState(true); -} - -void KeyboardInputMapper::initializeLedState(LedState& ledState, int32_t led) { - ledState.avail = getEventHub()->hasLed(getDeviceId(), led); - ledState.on = false; -} - -void KeyboardInputMapper::updateLedState(bool reset) { - updateLedStateForModifier(mCapsLockLedState, ALED_CAPS_LOCK, - AMETA_CAPS_LOCK_ON, reset); - updateLedStateForModifier(mNumLockLedState, ALED_NUM_LOCK, - AMETA_NUM_LOCK_ON, reset); - updateLedStateForModifier(mScrollLockLedState, ALED_SCROLL_LOCK, - AMETA_SCROLL_LOCK_ON, reset); -} - -void KeyboardInputMapper::updateLedStateForModifier(LedState& ledState, - int32_t led, int32_t modifier, bool reset) { - if (ledState.avail) { - bool desiredState = (mMetaState & modifier) != 0; - if (reset || ledState.on != desiredState) { - getEventHub()->setLedState(getDeviceId(), led, desiredState); - ledState.on = desiredState; - } - } -} - - -// --- CursorInputMapper --- - -CursorInputMapper::CursorInputMapper(InputDevice* device) : - InputMapper(device) { -} - -CursorInputMapper::~CursorInputMapper() { -} - -uint32_t CursorInputMapper::getSources() { - return mSource; -} - -void CursorInputMapper::populateDeviceInfo(InputDeviceInfo* info) { - InputMapper::populateDeviceInfo(info); - - if (mParameters.mode == Parameters::MODE_POINTER) { - float minX, minY, maxX, maxY; - if (mPointerController->getBounds(&minX, &minY, &maxX, &maxY)) { - info->addMotionRange(AMOTION_EVENT_AXIS_X, mSource, minX, maxX, 0.0f, 0.0f, 0.0f); - info->addMotionRange(AMOTION_EVENT_AXIS_Y, mSource, minY, maxY, 0.0f, 0.0f, 0.0f); - } - } else { - info->addMotionRange(AMOTION_EVENT_AXIS_X, mSource, -1.0f, 1.0f, 0.0f, mXScale, 0.0f); - info->addMotionRange(AMOTION_EVENT_AXIS_Y, mSource, -1.0f, 1.0f, 0.0f, mYScale, 0.0f); - } - info->addMotionRange(AMOTION_EVENT_AXIS_PRESSURE, mSource, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f); - - if (mCursorScrollAccumulator.haveRelativeVWheel()) { - info->addMotionRange(AMOTION_EVENT_AXIS_VSCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f); - } - if (mCursorScrollAccumulator.haveRelativeHWheel()) { - info->addMotionRange(AMOTION_EVENT_AXIS_HSCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, 0.0f); - } -} - -void CursorInputMapper::dump(String8& dump) { - dump.append(INDENT2 "Cursor Input Mapper:\n"); - dumpParameters(dump); - dump.appendFormat(INDENT3 "XScale: %0.3f\n", mXScale); - dump.appendFormat(INDENT3 "YScale: %0.3f\n", mYScale); - dump.appendFormat(INDENT3 "XPrecision: %0.3f\n", mXPrecision); - dump.appendFormat(INDENT3 "YPrecision: %0.3f\n", mYPrecision); - dump.appendFormat(INDENT3 "HaveVWheel: %s\n", - toString(mCursorScrollAccumulator.haveRelativeVWheel())); - dump.appendFormat(INDENT3 "HaveHWheel: %s\n", - toString(mCursorScrollAccumulator.haveRelativeHWheel())); - dump.appendFormat(INDENT3 "VWheelScale: %0.3f\n", mVWheelScale); - dump.appendFormat(INDENT3 "HWheelScale: %0.3f\n", mHWheelScale); - dump.appendFormat(INDENT3 "Orientation: %d\n", mOrientation); - dump.appendFormat(INDENT3 "ButtonState: 0x%08x\n", mButtonState); - dump.appendFormat(INDENT3 "Down: %s\n", toString(isPointerDown(mButtonState))); - dump.appendFormat(INDENT3 "DownTime: %lld\n", (long long)mDownTime); -} - -void CursorInputMapper::configure(nsecs_t when, - const InputReaderConfiguration* config, uint32_t changes) { - InputMapper::configure(when, config, changes); - - if (!changes) { // first time only - mCursorScrollAccumulator.configure(getDevice()); - - // Configure basic parameters. - configureParameters(); - - // Configure device mode. - switch (mParameters.mode) { - case Parameters::MODE_POINTER: - mSource = AINPUT_SOURCE_MOUSE; - mXPrecision = 1.0f; - mYPrecision = 1.0f; - mXScale = 1.0f; - mYScale = 1.0f; - mPointerController = getPolicy()->obtainPointerController(getDeviceId()); - break; - case Parameters::MODE_NAVIGATION: - mSource = AINPUT_SOURCE_TRACKBALL; - mXPrecision = TRACKBALL_MOVEMENT_THRESHOLD; - mYPrecision = TRACKBALL_MOVEMENT_THRESHOLD; - mXScale = 1.0f / TRACKBALL_MOVEMENT_THRESHOLD; - mYScale = 1.0f / TRACKBALL_MOVEMENT_THRESHOLD; - break; - } - - mVWheelScale = 1.0f; - mHWheelScale = 1.0f; - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_POINTER_SPEED)) { - mPointerVelocityControl.setParameters(config->pointerVelocityControlParameters); - mWheelXVelocityControl.setParameters(config->wheelVelocityControlParameters); - mWheelYVelocityControl.setParameters(config->wheelVelocityControlParameters); - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_DISPLAY_INFO)) { - if (mParameters.orientationAware && mParameters.hasAssociatedDisplay) { - DisplayViewport v; - if (config->getDisplayInfo(false /*external*/, &v)) { - mOrientation = v.orientation; - } else { - mOrientation = DISPLAY_ORIENTATION_0; - } - } else { - mOrientation = DISPLAY_ORIENTATION_0; - } - bumpGeneration(); - } -} - -void CursorInputMapper::configureParameters() { - mParameters.mode = Parameters::MODE_POINTER; - String8 cursorModeString; - if (getDevice()->getConfiguration().tryGetProperty(String8("cursor.mode"), cursorModeString)) { - if (cursorModeString == "navigation") { - mParameters.mode = Parameters::MODE_NAVIGATION; - } else if (cursorModeString != "pointer" && cursorModeString != "default") { - ALOGW("Invalid value for cursor.mode: '%s'", cursorModeString.string()); - } - } - - mParameters.orientationAware = false; - getDevice()->getConfiguration().tryGetProperty(String8("cursor.orientationAware"), - mParameters.orientationAware); - - mParameters.hasAssociatedDisplay = false; - if (mParameters.mode == Parameters::MODE_POINTER || mParameters.orientationAware) { - mParameters.hasAssociatedDisplay = true; - } -} - -void CursorInputMapper::dumpParameters(String8& dump) { - dump.append(INDENT3 "Parameters:\n"); - dump.appendFormat(INDENT4 "HasAssociatedDisplay: %s\n", - toString(mParameters.hasAssociatedDisplay)); - - switch (mParameters.mode) { - case Parameters::MODE_POINTER: - dump.append(INDENT4 "Mode: pointer\n"); - break; - case Parameters::MODE_NAVIGATION: - dump.append(INDENT4 "Mode: navigation\n"); - break; - default: - ALOG_ASSERT(false); - } - - dump.appendFormat(INDENT4 "OrientationAware: %s\n", - toString(mParameters.orientationAware)); -} - -void CursorInputMapper::reset(nsecs_t when) { - mButtonState = 0; - mDownTime = 0; - - mPointerVelocityControl.reset(); - mWheelXVelocityControl.reset(); - mWheelYVelocityControl.reset(); - - mCursorButtonAccumulator.reset(getDevice()); - mCursorMotionAccumulator.reset(getDevice()); - mCursorScrollAccumulator.reset(getDevice()); - - InputMapper::reset(when); -} - -void CursorInputMapper::process(const RawEvent* rawEvent) { - mCursorButtonAccumulator.process(rawEvent); - mCursorMotionAccumulator.process(rawEvent); - mCursorScrollAccumulator.process(rawEvent); - - if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) { - sync(rawEvent->when); - } -} - -void CursorInputMapper::sync(nsecs_t when) { - int32_t lastButtonState = mButtonState; - int32_t currentButtonState = mCursorButtonAccumulator.getButtonState(); - mButtonState = currentButtonState; - - bool wasDown = isPointerDown(lastButtonState); - bool down = isPointerDown(currentButtonState); - bool downChanged; - if (!wasDown && down) { - mDownTime = when; - downChanged = true; - } else if (wasDown && !down) { - downChanged = true; - } else { - downChanged = false; - } - nsecs_t downTime = mDownTime; - bool buttonsChanged = currentButtonState != lastButtonState; - int32_t buttonsPressed = currentButtonState & ~lastButtonState; - int32_t buttonsReleased = lastButtonState & ~currentButtonState; - - float deltaX = mCursorMotionAccumulator.getRelativeX() * mXScale; - float deltaY = mCursorMotionAccumulator.getRelativeY() * mYScale; - bool moved = deltaX != 0 || deltaY != 0; - - // Rotate delta according to orientation if needed. - if (mParameters.orientationAware && mParameters.hasAssociatedDisplay - && (deltaX != 0.0f || deltaY != 0.0f)) { - rotateDelta(mOrientation, &deltaX, &deltaY); - } - - // Move the pointer. - PointerProperties pointerProperties; - pointerProperties.clear(); - pointerProperties.id = 0; - pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_MOUSE; - - PointerCoords pointerCoords; - pointerCoords.clear(); - - float vscroll = mCursorScrollAccumulator.getRelativeVWheel(); - float hscroll = mCursorScrollAccumulator.getRelativeHWheel(); - bool scrolled = vscroll != 0 || hscroll != 0; - - mWheelYVelocityControl.move(when, NULL, &vscroll); - mWheelXVelocityControl.move(when, &hscroll, NULL); - - mPointerVelocityControl.move(when, &deltaX, &deltaY); - - int32_t displayId; - if (mPointerController != NULL) { - if (moved || scrolled || buttonsChanged) { - mPointerController->setPresentation( - PointerControllerInterface::PRESENTATION_POINTER); - - if (moved) { - mPointerController->move(deltaX, deltaY); - } - - if (buttonsChanged) { - mPointerController->setButtonState(currentButtonState); - } - - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); - } - - float x, y; - mPointerController->getPosition(&x, &y); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); - displayId = ADISPLAY_ID_DEFAULT; - } else { - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, deltaX); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, deltaY); - displayId = ADISPLAY_ID_NONE; - } - - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, down ? 1.0f : 0.0f); - - // Moving an external trackball or mouse should wake the device. - // We don't do this for internal cursor devices to prevent them from waking up - // the device in your pocket. - // TODO: Use the input device configuration to control this behavior more finely. - uint32_t policyFlags = 0; - if ((buttonsPressed || moved || scrolled) && getDevice()->isExternal()) { - policyFlags |= POLICY_FLAG_WAKE; - } - - // Synthesize key down from buttons if needed. - synthesizeButtonKeys(getContext(), AKEY_EVENT_ACTION_DOWN, when, getDeviceId(), mSource, - policyFlags, lastButtonState, currentButtonState); - - // Send motion event. - if (downChanged || moved || scrolled || buttonsChanged) { - int32_t metaState = mContext->getGlobalMetaState(); - int32_t buttonState = lastButtonState; - int32_t motionEventAction; - if (downChanged) { - motionEventAction = down ? AMOTION_EVENT_ACTION_DOWN : AMOTION_EVENT_ACTION_UP; - } else if (down || mPointerController == NULL) { - motionEventAction = AMOTION_EVENT_ACTION_MOVE; - } else { - motionEventAction = AMOTION_EVENT_ACTION_HOVER_MOVE; - } - - if (buttonsReleased) { - BitSet32 released(buttonsReleased); - while (!released.isEmpty()) { - int32_t actionButton = BitSet32::valueForBit(released.clearFirstMarkedBit()); - buttonState &= ~actionButton; - NotifyMotionArgs releaseArgs(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_BUTTON_RELEASE, actionButton, 0, - metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - displayId, 1, &pointerProperties, &pointerCoords, - mXPrecision, mYPrecision, downTime); - getListener()->notifyMotion(&releaseArgs); - } - } - - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - motionEventAction, 0, 0, metaState, currentButtonState, - AMOTION_EVENT_EDGE_FLAG_NONE, - displayId, 1, &pointerProperties, &pointerCoords, - mXPrecision, mYPrecision, downTime); - getListener()->notifyMotion(&args); - - if (buttonsPressed) { - BitSet32 pressed(buttonsPressed); - while (!pressed.isEmpty()) { - int32_t actionButton = BitSet32::valueForBit(pressed.clearFirstMarkedBit()); - buttonState |= actionButton; - NotifyMotionArgs pressArgs(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_BUTTON_PRESS, actionButton, 0, - metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - displayId, 1, &pointerProperties, &pointerCoords, - mXPrecision, mYPrecision, downTime); - getListener()->notifyMotion(&pressArgs); - } - } - - ALOG_ASSERT(buttonState == currentButtonState); - - // Send hover move after UP to tell the application that the mouse is hovering now. - if (motionEventAction == AMOTION_EVENT_ACTION_UP - && mPointerController != NULL) { - NotifyMotionArgs hoverArgs(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_HOVER_MOVE, 0, 0, - metaState, currentButtonState, AMOTION_EVENT_EDGE_FLAG_NONE, - displayId, 1, &pointerProperties, &pointerCoords, - mXPrecision, mYPrecision, downTime); - getListener()->notifyMotion(&hoverArgs); - } - - // Send scroll events. - if (scrolled) { - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_VSCROLL, vscroll); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_HSCROLL, hscroll); - - NotifyMotionArgs scrollArgs(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, currentButtonState, - AMOTION_EVENT_EDGE_FLAG_NONE, - displayId, 1, &pointerProperties, &pointerCoords, - mXPrecision, mYPrecision, downTime); - getListener()->notifyMotion(&scrollArgs); - } - } - - // Synthesize key up from buttons if needed. - synthesizeButtonKeys(getContext(), AKEY_EVENT_ACTION_UP, when, getDeviceId(), mSource, - policyFlags, lastButtonState, currentButtonState); - - mCursorMotionAccumulator.finishSync(); - mCursorScrollAccumulator.finishSync(); -} - -int32_t CursorInputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { - if (scanCode >= BTN_MOUSE && scanCode < BTN_JOYSTICK) { - return getEventHub()->getScanCodeState(getDeviceId(), scanCode); - } else { - return AKEY_STATE_UNKNOWN; - } -} - -void CursorInputMapper::fadePointer() { - if (mPointerController != NULL) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - } -} - - -// --- TouchInputMapper --- - -TouchInputMapper::TouchInputMapper(InputDevice* device) : - InputMapper(device), - mSource(0), mDeviceMode(DEVICE_MODE_DISABLED), - mSurfaceWidth(-1), mSurfaceHeight(-1), mSurfaceLeft(0), mSurfaceTop(0), - mSurfaceOrientation(DISPLAY_ORIENTATION_0) { -} - -TouchInputMapper::~TouchInputMapper() { -} - -uint32_t TouchInputMapper::getSources() { - return mSource; -} - -void TouchInputMapper::populateDeviceInfo(InputDeviceInfo* info) { - InputMapper::populateDeviceInfo(info); - - if (mDeviceMode != DEVICE_MODE_DISABLED) { - info->addMotionRange(mOrientedRanges.x); - info->addMotionRange(mOrientedRanges.y); - info->addMotionRange(mOrientedRanges.pressure); - - if (mOrientedRanges.haveSize) { - info->addMotionRange(mOrientedRanges.size); - } - - if (mOrientedRanges.haveTouchSize) { - info->addMotionRange(mOrientedRanges.touchMajor); - info->addMotionRange(mOrientedRanges.touchMinor); - } - - if (mOrientedRanges.haveToolSize) { - info->addMotionRange(mOrientedRanges.toolMajor); - info->addMotionRange(mOrientedRanges.toolMinor); - } - - if (mOrientedRanges.haveOrientation) { - info->addMotionRange(mOrientedRanges.orientation); - } - - if (mOrientedRanges.haveDistance) { - info->addMotionRange(mOrientedRanges.distance); - } - - if (mOrientedRanges.haveTilt) { - info->addMotionRange(mOrientedRanges.tilt); - } - - if (mCursorScrollAccumulator.haveRelativeVWheel()) { - info->addMotionRange(AMOTION_EVENT_AXIS_VSCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, - 0.0f); - } - if (mCursorScrollAccumulator.haveRelativeHWheel()) { - info->addMotionRange(AMOTION_EVENT_AXIS_HSCROLL, mSource, -1.0f, 1.0f, 0.0f, 0.0f, - 0.0f); - } - if (mCalibration.coverageCalibration == Calibration::COVERAGE_CALIBRATION_BOX) { - const InputDeviceInfo::MotionRange& x = mOrientedRanges.x; - const InputDeviceInfo::MotionRange& y = mOrientedRanges.y; - info->addMotionRange(AMOTION_EVENT_AXIS_GENERIC_1, mSource, x.min, x.max, x.flat, - x.fuzz, x.resolution); - info->addMotionRange(AMOTION_EVENT_AXIS_GENERIC_2, mSource, y.min, y.max, y.flat, - y.fuzz, y.resolution); - info->addMotionRange(AMOTION_EVENT_AXIS_GENERIC_3, mSource, x.min, x.max, x.flat, - x.fuzz, x.resolution); - info->addMotionRange(AMOTION_EVENT_AXIS_GENERIC_4, mSource, y.min, y.max, y.flat, - y.fuzz, y.resolution); - } - info->setButtonUnderPad(mParameters.hasButtonUnderPad); - } -} - -void TouchInputMapper::dump(String8& dump) { - dump.append(INDENT2 "Touch Input Mapper:\n"); - dumpParameters(dump); - dumpVirtualKeys(dump); - dumpRawPointerAxes(dump); - dumpCalibration(dump); - dumpAffineTransformation(dump); - dumpSurface(dump); - - dump.appendFormat(INDENT3 "Translation and Scaling Factors:\n"); - dump.appendFormat(INDENT4 "XTranslate: %0.3f\n", mXTranslate); - dump.appendFormat(INDENT4 "YTranslate: %0.3f\n", mYTranslate); - dump.appendFormat(INDENT4 "XScale: %0.3f\n", mXScale); - dump.appendFormat(INDENT4 "YScale: %0.3f\n", mYScale); - dump.appendFormat(INDENT4 "XPrecision: %0.3f\n", mXPrecision); - dump.appendFormat(INDENT4 "YPrecision: %0.3f\n", mYPrecision); - dump.appendFormat(INDENT4 "GeometricScale: %0.3f\n", mGeometricScale); - dump.appendFormat(INDENT4 "PressureScale: %0.3f\n", mPressureScale); - dump.appendFormat(INDENT4 "SizeScale: %0.3f\n", mSizeScale); - dump.appendFormat(INDENT4 "OrientationScale: %0.3f\n", mOrientationScale); - dump.appendFormat(INDENT4 "DistanceScale: %0.3f\n", mDistanceScale); - dump.appendFormat(INDENT4 "HaveTilt: %s\n", toString(mHaveTilt)); - dump.appendFormat(INDENT4 "TiltXCenter: %0.3f\n", mTiltXCenter); - dump.appendFormat(INDENT4 "TiltXScale: %0.3f\n", mTiltXScale); - dump.appendFormat(INDENT4 "TiltYCenter: %0.3f\n", mTiltYCenter); - dump.appendFormat(INDENT4 "TiltYScale: %0.3f\n", mTiltYScale); - - dump.appendFormat(INDENT3 "Last Raw Button State: 0x%08x\n", mLastRawState.buttonState); - dump.appendFormat(INDENT3 "Last Raw Touch: pointerCount=%d\n", - mLastRawState.rawPointerData.pointerCount); - for (uint32_t i = 0; i < mLastRawState.rawPointerData.pointerCount; i++) { - const RawPointerData::Pointer& pointer = mLastRawState.rawPointerData.pointers[i]; - dump.appendFormat(INDENT4 "[%d]: id=%d, x=%d, y=%d, pressure=%d, " - "touchMajor=%d, touchMinor=%d, toolMajor=%d, toolMinor=%d, " - "orientation=%d, tiltX=%d, tiltY=%d, distance=%d, " - "toolType=%d, isHovering=%s\n", i, - pointer.id, pointer.x, pointer.y, pointer.pressure, - pointer.touchMajor, pointer.touchMinor, - pointer.toolMajor, pointer.toolMinor, - pointer.orientation, pointer.tiltX, pointer.tiltY, pointer.distance, - pointer.toolType, toString(pointer.isHovering)); - } - - dump.appendFormat(INDENT3 "Last Cooked Button State: 0x%08x\n", mLastCookedState.buttonState); - dump.appendFormat(INDENT3 "Last Cooked Touch: pointerCount=%d\n", - mLastCookedState.cookedPointerData.pointerCount); - for (uint32_t i = 0; i < mLastCookedState.cookedPointerData.pointerCount; i++) { - const PointerProperties& pointerProperties = - mLastCookedState.cookedPointerData.pointerProperties[i]; - const PointerCoords& pointerCoords = mLastCookedState.cookedPointerData.pointerCoords[i]; - dump.appendFormat(INDENT4 "[%d]: id=%d, x=%0.3f, y=%0.3f, pressure=%0.3f, " - "touchMajor=%0.3f, touchMinor=%0.3f, toolMajor=%0.3f, toolMinor=%0.3f, " - "orientation=%0.3f, tilt=%0.3f, distance=%0.3f, " - "toolType=%d, isHovering=%s\n", i, - pointerProperties.id, - pointerCoords.getX(), - pointerCoords.getY(), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_TILT), - pointerCoords.getAxisValue(AMOTION_EVENT_AXIS_DISTANCE), - pointerProperties.toolType, - toString(mLastCookedState.cookedPointerData.isHovering(i))); - } - - dump.append(INDENT3 "Stylus Fusion:\n"); - dump.appendFormat(INDENT4 "ExternalStylusConnected: %s\n", - toString(mExternalStylusConnected)); - dump.appendFormat(INDENT4 "External Stylus ID: %" PRId64 "\n", mExternalStylusId); - dump.appendFormat(INDENT4 "External Stylus Data Timeout: %" PRId64 "\n", - mExternalStylusFusionTimeout); - dump.append(INDENT3 "External Stylus State:\n"); - dumpStylusState(dump, mExternalStylusState); - - if (mDeviceMode == DEVICE_MODE_POINTER) { - dump.appendFormat(INDENT3 "Pointer Gesture Detector:\n"); - dump.appendFormat(INDENT4 "XMovementScale: %0.3f\n", - mPointerXMovementScale); - dump.appendFormat(INDENT4 "YMovementScale: %0.3f\n", - mPointerYMovementScale); - dump.appendFormat(INDENT4 "XZoomScale: %0.3f\n", - mPointerXZoomScale); - dump.appendFormat(INDENT4 "YZoomScale: %0.3f\n", - mPointerYZoomScale); - dump.appendFormat(INDENT4 "MaxSwipeWidth: %f\n", - mPointerGestureMaxSwipeWidth); - } -} - -void TouchInputMapper::configure(nsecs_t when, - const InputReaderConfiguration* config, uint32_t changes) { - InputMapper::configure(when, config, changes); - - mConfig = *config; - - if (!changes) { // first time only - // Configure basic parameters. - configureParameters(); - - // Configure common accumulators. - mCursorScrollAccumulator.configure(getDevice()); - mTouchButtonAccumulator.configure(getDevice()); - - // Configure absolute axis information. - configureRawPointerAxes(); - - // Prepare input device calibration. - parseCalibration(); - resolveCalibration(); - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_TOUCH_AFFINE_TRANSFORMATION)) { - // Update location calibration to reflect current settings - updateAffineTransformation(); - } - - if (!changes || (changes & InputReaderConfiguration::CHANGE_POINTER_SPEED)) { - // Update pointer speed. - mPointerVelocityControl.setParameters(mConfig.pointerVelocityControlParameters); - mWheelXVelocityControl.setParameters(mConfig.wheelVelocityControlParameters); - mWheelYVelocityControl.setParameters(mConfig.wheelVelocityControlParameters); - } - - bool resetNeeded = false; - if (!changes || (changes & (InputReaderConfiguration::CHANGE_DISPLAY_INFO - | InputReaderConfiguration::CHANGE_POINTER_GESTURE_ENABLEMENT - | InputReaderConfiguration::CHANGE_SHOW_TOUCHES - | InputReaderConfiguration::CHANGE_EXTERNAL_STYLUS_PRESENCE))) { - // Configure device sources, surface dimensions, orientation and - // scaling factors. - configureSurface(when, &resetNeeded); - } - - if (changes && resetNeeded) { - // Send reset, unless this is the first time the device has been configured, - // in which case the reader will call reset itself after all mappers are ready. - getDevice()->notifyReset(when); - } -} - -void TouchInputMapper::resolveExternalStylusPresence() { - Vector devices; - mContext->getExternalStylusDevices(devices); - mExternalStylusConnected = !devices.isEmpty(); - - if (!mExternalStylusConnected) { - resetExternalStylus(); - } -} - -void TouchInputMapper::configureParameters() { - // Use the pointer presentation mode for devices that do not support distinct - // multitouch. The spot-based presentation relies on being able to accurately - // locate two or more fingers on the touch pad. - mParameters.gestureMode = getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_SEMI_MT) - ? Parameters::GESTURE_MODE_POINTER : Parameters::GESTURE_MODE_SPOTS; - - String8 gestureModeString; - if (getDevice()->getConfiguration().tryGetProperty(String8("touch.gestureMode"), - gestureModeString)) { - if (gestureModeString == "pointer") { - mParameters.gestureMode = Parameters::GESTURE_MODE_POINTER; - } else if (gestureModeString == "spots") { - mParameters.gestureMode = Parameters::GESTURE_MODE_SPOTS; - } else if (gestureModeString != "default") { - ALOGW("Invalid value for touch.gestureMode: '%s'", gestureModeString.string()); - } - } - - if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_DIRECT)) { - // The device is a touch screen. - mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN; - } else if (getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_POINTER)) { - // The device is a pointing device like a track pad. - mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER; - } else if (getEventHub()->hasRelativeAxis(getDeviceId(), REL_X) - || getEventHub()->hasRelativeAxis(getDeviceId(), REL_Y)) { - // The device is a cursor device with a touch pad attached. - // By default don't use the touch pad to move the pointer. - mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD; - } else { - // The device is a touch pad of unknown purpose. - mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER; - } - - mParameters.hasButtonUnderPad= - getEventHub()->hasInputProperty(getDeviceId(), INPUT_PROP_BUTTONPAD); - - String8 deviceTypeString; - if (getDevice()->getConfiguration().tryGetProperty(String8("touch.deviceType"), - deviceTypeString)) { - if (deviceTypeString == "touchScreen") { - mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_SCREEN; - } else if (deviceTypeString == "touchPad") { - mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_PAD; - } else if (deviceTypeString == "touchNavigation") { - mParameters.deviceType = Parameters::DEVICE_TYPE_TOUCH_NAVIGATION; - } else if (deviceTypeString == "pointer") { - mParameters.deviceType = Parameters::DEVICE_TYPE_POINTER; - } else if (deviceTypeString != "default") { - ALOGW("Invalid value for touch.deviceType: '%s'", deviceTypeString.string()); - } - } - - mParameters.orientationAware = mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN; - getDevice()->getConfiguration().tryGetProperty(String8("touch.orientationAware"), - mParameters.orientationAware); - - mParameters.hasAssociatedDisplay = false; - mParameters.associatedDisplayIsExternal = false; - if (mParameters.orientationAware - || mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN - || mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER) { - mParameters.hasAssociatedDisplay = true; - mParameters.associatedDisplayIsExternal = - mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN - && getDevice()->isExternal(); - } - - // Initial downs on external touch devices should wake the device. - // Normally we don't do this for internal touch screens to prevent them from waking - // up in your pocket but you can enable it using the input device configuration. - mParameters.wake = getDevice()->isExternal(); - getDevice()->getConfiguration().tryGetProperty(String8("touch.wake"), - mParameters.wake); -} - -void TouchInputMapper::dumpParameters(String8& dump) { - dump.append(INDENT3 "Parameters:\n"); - - switch (mParameters.gestureMode) { - case Parameters::GESTURE_MODE_POINTER: - dump.append(INDENT4 "GestureMode: pointer\n"); - break; - case Parameters::GESTURE_MODE_SPOTS: - dump.append(INDENT4 "GestureMode: spots\n"); - break; - default: - assert(false); - } - - switch (mParameters.deviceType) { - case Parameters::DEVICE_TYPE_TOUCH_SCREEN: - dump.append(INDENT4 "DeviceType: touchScreen\n"); - break; - case Parameters::DEVICE_TYPE_TOUCH_PAD: - dump.append(INDENT4 "DeviceType: touchPad\n"); - break; - case Parameters::DEVICE_TYPE_TOUCH_NAVIGATION: - dump.append(INDENT4 "DeviceType: touchNavigation\n"); - break; - case Parameters::DEVICE_TYPE_POINTER: - dump.append(INDENT4 "DeviceType: pointer\n"); - break; - default: - ALOG_ASSERT(false); - } - - dump.appendFormat(INDENT4 "AssociatedDisplay: hasAssociatedDisplay=%s, isExternal=%s\n", - toString(mParameters.hasAssociatedDisplay), - toString(mParameters.associatedDisplayIsExternal)); - dump.appendFormat(INDENT4 "OrientationAware: %s\n", - toString(mParameters.orientationAware)); -} - -void TouchInputMapper::configureRawPointerAxes() { - mRawPointerAxes.clear(); -} - -void TouchInputMapper::dumpRawPointerAxes(String8& dump) { - dump.append(INDENT3 "Raw Touch Axes:\n"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.x, "X"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.y, "Y"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.pressure, "Pressure"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.touchMajor, "TouchMajor"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.touchMinor, "TouchMinor"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.toolMajor, "ToolMajor"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.toolMinor, "ToolMinor"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.orientation, "Orientation"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.distance, "Distance"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.tiltX, "TiltX"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.tiltY, "TiltY"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.trackingId, "TrackingId"); - dumpRawAbsoluteAxisInfo(dump, mRawPointerAxes.slot, "Slot"); -} - -bool TouchInputMapper::hasExternalStylus() const { - return mExternalStylusConnected; -} - -void TouchInputMapper::configureSurface(nsecs_t when, bool* outResetNeeded) { - int32_t oldDeviceMode = mDeviceMode; - - resolveExternalStylusPresence(); - - // Determine device mode. - if (mParameters.deviceType == Parameters::DEVICE_TYPE_POINTER - && mConfig.pointerGesturesEnabled) { - mSource = AINPUT_SOURCE_MOUSE; - mDeviceMode = DEVICE_MODE_POINTER; - if (hasStylus()) { - mSource |= AINPUT_SOURCE_STYLUS; - } - } else if (mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_SCREEN - && mParameters.hasAssociatedDisplay) { - mSource = AINPUT_SOURCE_TOUCHSCREEN; - mDeviceMode = DEVICE_MODE_DIRECT; - if (hasStylus()) { - mSource |= AINPUT_SOURCE_STYLUS; - } - if (hasExternalStylus()) { - mSource |= AINPUT_SOURCE_BLUETOOTH_STYLUS; - } - } else if (mParameters.deviceType == Parameters::DEVICE_TYPE_TOUCH_NAVIGATION) { - mSource = AINPUT_SOURCE_TOUCH_NAVIGATION; - mDeviceMode = DEVICE_MODE_NAVIGATION; - } else { - mSource = AINPUT_SOURCE_TOUCHPAD; - mDeviceMode = DEVICE_MODE_UNSCALED; - } - - // Ensure we have valid X and Y axes. - if (!mRawPointerAxes.x.valid || !mRawPointerAxes.y.valid) { - ALOGW(INDENT "Touch device '%s' did not report support for X or Y axis! " - "The device will be inoperable.", getDeviceName().string()); - mDeviceMode = DEVICE_MODE_DISABLED; - return; - } - - // Raw width and height in the natural orientation. - int32_t rawWidth = mRawPointerAxes.x.maxValue - mRawPointerAxes.x.minValue + 1; - int32_t rawHeight = mRawPointerAxes.y.maxValue - mRawPointerAxes.y.minValue + 1; - - // Get associated display dimensions. - DisplayViewport newViewport; - if (mParameters.hasAssociatedDisplay) { - if (!mConfig.getDisplayInfo(mParameters.associatedDisplayIsExternal, &newViewport)) { - ALOGI(INDENT "Touch device '%s' could not query the properties of its associated " - "display. The device will be inoperable until the display size " - "becomes available.", - getDeviceName().string()); - mDeviceMode = DEVICE_MODE_DISABLED; - return; - } - } else { - newViewport.setNonDisplayViewport(rawWidth, rawHeight); - } - bool viewportChanged = mViewport != newViewport; - if (viewportChanged) { - mViewport = newViewport; - - if (mDeviceMode == DEVICE_MODE_DIRECT || mDeviceMode == DEVICE_MODE_POINTER) { - // Convert rotated viewport to natural surface coordinates. - int32_t naturalLogicalWidth, naturalLogicalHeight; - int32_t naturalPhysicalWidth, naturalPhysicalHeight; - int32_t naturalPhysicalLeft, naturalPhysicalTop; - int32_t naturalDeviceWidth, naturalDeviceHeight; - switch (mViewport.orientation) { - case DISPLAY_ORIENTATION_90: - naturalLogicalWidth = mViewport.logicalBottom - mViewport.logicalTop; - naturalLogicalHeight = mViewport.logicalRight - mViewport.logicalLeft; - naturalPhysicalWidth = mViewport.physicalBottom - mViewport.physicalTop; - naturalPhysicalHeight = mViewport.physicalRight - mViewport.physicalLeft; - naturalPhysicalLeft = mViewport.deviceHeight - mViewport.physicalBottom; - naturalPhysicalTop = mViewport.physicalLeft; - naturalDeviceWidth = mViewport.deviceHeight; - naturalDeviceHeight = mViewport.deviceWidth; - break; - case DISPLAY_ORIENTATION_180: - naturalLogicalWidth = mViewport.logicalRight - mViewport.logicalLeft; - naturalLogicalHeight = mViewport.logicalBottom - mViewport.logicalTop; - naturalPhysicalWidth = mViewport.physicalRight - mViewport.physicalLeft; - naturalPhysicalHeight = mViewport.physicalBottom - mViewport.physicalTop; - naturalPhysicalLeft = mViewport.deviceWidth - mViewport.physicalRight; - naturalPhysicalTop = mViewport.deviceHeight - mViewport.physicalBottom; - naturalDeviceWidth = mViewport.deviceWidth; - naturalDeviceHeight = mViewport.deviceHeight; - break; - case DISPLAY_ORIENTATION_270: - naturalLogicalWidth = mViewport.logicalBottom - mViewport.logicalTop; - naturalLogicalHeight = mViewport.logicalRight - mViewport.logicalLeft; - naturalPhysicalWidth = mViewport.physicalBottom - mViewport.physicalTop; - naturalPhysicalHeight = mViewport.physicalRight - mViewport.physicalLeft; - naturalPhysicalLeft = mViewport.physicalTop; - naturalPhysicalTop = mViewport.deviceWidth - mViewport.physicalRight; - naturalDeviceWidth = mViewport.deviceHeight; - naturalDeviceHeight = mViewport.deviceWidth; - break; - case DISPLAY_ORIENTATION_0: - default: - naturalLogicalWidth = mViewport.logicalRight - mViewport.logicalLeft; - naturalLogicalHeight = mViewport.logicalBottom - mViewport.logicalTop; - naturalPhysicalWidth = mViewport.physicalRight - mViewport.physicalLeft; - naturalPhysicalHeight = mViewport.physicalBottom - mViewport.physicalTop; - naturalPhysicalLeft = mViewport.physicalLeft; - naturalPhysicalTop = mViewport.physicalTop; - naturalDeviceWidth = mViewport.deviceWidth; - naturalDeviceHeight = mViewport.deviceHeight; - break; - } - - mSurfaceWidth = naturalLogicalWidth * naturalDeviceWidth / naturalPhysicalWidth; - mSurfaceHeight = naturalLogicalHeight * naturalDeviceHeight / naturalPhysicalHeight; - mSurfaceLeft = naturalPhysicalLeft * naturalLogicalWidth / naturalPhysicalWidth; - mSurfaceTop = naturalPhysicalTop * naturalLogicalHeight / naturalPhysicalHeight; - - mSurfaceOrientation = mParameters.orientationAware ? - mViewport.orientation : DISPLAY_ORIENTATION_0; - } else { - mSurfaceWidth = rawWidth; - mSurfaceHeight = rawHeight; - mSurfaceLeft = 0; - mSurfaceTop = 0; - mSurfaceOrientation = DISPLAY_ORIENTATION_0; - } - } - - // If moving between pointer modes, need to reset some state. - bool deviceModeChanged = mDeviceMode != oldDeviceMode; - if (deviceModeChanged) { - mOrientedRanges.clear(); - } - - // Create pointer controller if needed. - if (mDeviceMode == DEVICE_MODE_POINTER || - (mDeviceMode == DEVICE_MODE_DIRECT && mConfig.showTouches)) { - if (mPointerController == NULL) { - mPointerController = getPolicy()->obtainPointerController(getDeviceId()); - } - } else { - mPointerController.clear(); - } - - if (viewportChanged || deviceModeChanged) { - ALOGI("Device reconfigured: id=%d, name='%s', size %dx%d, orientation %d, mode %d, " - "display id %d", - getDeviceId(), getDeviceName().string(), mSurfaceWidth, mSurfaceHeight, - mSurfaceOrientation, mDeviceMode, mViewport.displayId); - - // Configure X and Y factors. - mXScale = float(mSurfaceWidth) / rawWidth; - mYScale = float(mSurfaceHeight) / rawHeight; - mXTranslate = -mSurfaceLeft; - mYTranslate = -mSurfaceTop; - mXPrecision = 1.0f / mXScale; - mYPrecision = 1.0f / mYScale; - - mOrientedRanges.x.axis = AMOTION_EVENT_AXIS_X; - mOrientedRanges.x.source = mSource; - mOrientedRanges.y.axis = AMOTION_EVENT_AXIS_Y; - mOrientedRanges.y.source = mSource; - - configureVirtualKeys(); - - // Scale factor for terms that are not oriented in a particular axis. - // If the pixels are square then xScale == yScale otherwise we fake it - // by choosing an average. - mGeometricScale = avg(mXScale, mYScale); - - // Size of diagonal axis. - float diagonalSize = hypotf(mSurfaceWidth, mSurfaceHeight); - - // Size factors. - if (mCalibration.sizeCalibration != Calibration::SIZE_CALIBRATION_NONE) { - if (mRawPointerAxes.touchMajor.valid - && mRawPointerAxes.touchMajor.maxValue != 0) { - mSizeScale = 1.0f / mRawPointerAxes.touchMajor.maxValue; - } else if (mRawPointerAxes.toolMajor.valid - && mRawPointerAxes.toolMajor.maxValue != 0) { - mSizeScale = 1.0f / mRawPointerAxes.toolMajor.maxValue; - } else { - mSizeScale = 0.0f; - } - - mOrientedRanges.haveTouchSize = true; - mOrientedRanges.haveToolSize = true; - mOrientedRanges.haveSize = true; - - mOrientedRanges.touchMajor.axis = AMOTION_EVENT_AXIS_TOUCH_MAJOR; - mOrientedRanges.touchMajor.source = mSource; - mOrientedRanges.touchMajor.min = 0; - mOrientedRanges.touchMajor.max = diagonalSize; - mOrientedRanges.touchMajor.flat = 0; - mOrientedRanges.touchMajor.fuzz = 0; - mOrientedRanges.touchMajor.resolution = 0; - - mOrientedRanges.touchMinor = mOrientedRanges.touchMajor; - mOrientedRanges.touchMinor.axis = AMOTION_EVENT_AXIS_TOUCH_MINOR; - - mOrientedRanges.toolMajor.axis = AMOTION_EVENT_AXIS_TOOL_MAJOR; - mOrientedRanges.toolMajor.source = mSource; - mOrientedRanges.toolMajor.min = 0; - mOrientedRanges.toolMajor.max = diagonalSize; - mOrientedRanges.toolMajor.flat = 0; - mOrientedRanges.toolMajor.fuzz = 0; - mOrientedRanges.toolMajor.resolution = 0; - - mOrientedRanges.toolMinor = mOrientedRanges.toolMajor; - mOrientedRanges.toolMinor.axis = AMOTION_EVENT_AXIS_TOOL_MINOR; - - mOrientedRanges.size.axis = AMOTION_EVENT_AXIS_SIZE; - mOrientedRanges.size.source = mSource; - mOrientedRanges.size.min = 0; - mOrientedRanges.size.max = 1.0; - mOrientedRanges.size.flat = 0; - mOrientedRanges.size.fuzz = 0; - mOrientedRanges.size.resolution = 0; - } else { - mSizeScale = 0.0f; - } - - // Pressure factors. - mPressureScale = 0; - if (mCalibration.pressureCalibration == Calibration::PRESSURE_CALIBRATION_PHYSICAL - || mCalibration.pressureCalibration - == Calibration::PRESSURE_CALIBRATION_AMPLITUDE) { - if (mCalibration.havePressureScale) { - mPressureScale = mCalibration.pressureScale; - } else if (mRawPointerAxes.pressure.valid - && mRawPointerAxes.pressure.maxValue != 0) { - mPressureScale = 1.0f / mRawPointerAxes.pressure.maxValue; - } - } - - mOrientedRanges.pressure.axis = AMOTION_EVENT_AXIS_PRESSURE; - mOrientedRanges.pressure.source = mSource; - mOrientedRanges.pressure.min = 0; - mOrientedRanges.pressure.max = 1.0; - mOrientedRanges.pressure.flat = 0; - mOrientedRanges.pressure.fuzz = 0; - mOrientedRanges.pressure.resolution = 0; - - // Tilt - mTiltXCenter = 0; - mTiltXScale = 0; - mTiltYCenter = 0; - mTiltYScale = 0; - mHaveTilt = mRawPointerAxes.tiltX.valid && mRawPointerAxes.tiltY.valid; - if (mHaveTilt) { - mTiltXCenter = avg(mRawPointerAxes.tiltX.minValue, - mRawPointerAxes.tiltX.maxValue); - mTiltYCenter = avg(mRawPointerAxes.tiltY.minValue, - mRawPointerAxes.tiltY.maxValue); - mTiltXScale = M_PI / 180; - mTiltYScale = M_PI / 180; - - mOrientedRanges.haveTilt = true; - - mOrientedRanges.tilt.axis = AMOTION_EVENT_AXIS_TILT; - mOrientedRanges.tilt.source = mSource; - mOrientedRanges.tilt.min = 0; - mOrientedRanges.tilt.max = M_PI_2; - mOrientedRanges.tilt.flat = 0; - mOrientedRanges.tilt.fuzz = 0; - mOrientedRanges.tilt.resolution = 0; - } - - // Orientation - mOrientationScale = 0; - if (mHaveTilt) { - mOrientedRanges.haveOrientation = true; - - mOrientedRanges.orientation.axis = AMOTION_EVENT_AXIS_ORIENTATION; - mOrientedRanges.orientation.source = mSource; - mOrientedRanges.orientation.min = -M_PI; - mOrientedRanges.orientation.max = M_PI; - mOrientedRanges.orientation.flat = 0; - mOrientedRanges.orientation.fuzz = 0; - mOrientedRanges.orientation.resolution = 0; - } else if (mCalibration.orientationCalibration != - Calibration::ORIENTATION_CALIBRATION_NONE) { - if (mCalibration.orientationCalibration - == Calibration::ORIENTATION_CALIBRATION_INTERPOLATED) { - if (mRawPointerAxes.orientation.valid) { - if (mRawPointerAxes.orientation.maxValue > 0) { - mOrientationScale = M_PI_2 / mRawPointerAxes.orientation.maxValue; - } else if (mRawPointerAxes.orientation.minValue < 0) { - mOrientationScale = -M_PI_2 / mRawPointerAxes.orientation.minValue; - } else { - mOrientationScale = 0; - } - } - } - - mOrientedRanges.haveOrientation = true; - - mOrientedRanges.orientation.axis = AMOTION_EVENT_AXIS_ORIENTATION; - mOrientedRanges.orientation.source = mSource; - mOrientedRanges.orientation.min = -M_PI_2; - mOrientedRanges.orientation.max = M_PI_2; - mOrientedRanges.orientation.flat = 0; - mOrientedRanges.orientation.fuzz = 0; - mOrientedRanges.orientation.resolution = 0; - } - - // Distance - mDistanceScale = 0; - if (mCalibration.distanceCalibration != Calibration::DISTANCE_CALIBRATION_NONE) { - if (mCalibration.distanceCalibration - == Calibration::DISTANCE_CALIBRATION_SCALED) { - if (mCalibration.haveDistanceScale) { - mDistanceScale = mCalibration.distanceScale; - } else { - mDistanceScale = 1.0f; - } - } - - mOrientedRanges.haveDistance = true; - - mOrientedRanges.distance.axis = AMOTION_EVENT_AXIS_DISTANCE; - mOrientedRanges.distance.source = mSource; - mOrientedRanges.distance.min = - mRawPointerAxes.distance.minValue * mDistanceScale; - mOrientedRanges.distance.max = - mRawPointerAxes.distance.maxValue * mDistanceScale; - mOrientedRanges.distance.flat = 0; - mOrientedRanges.distance.fuzz = - mRawPointerAxes.distance.fuzz * mDistanceScale; - mOrientedRanges.distance.resolution = 0; - } - - // Compute oriented precision, scales and ranges. - // Note that the maximum value reported is an inclusive maximum value so it is one - // unit less than the total width or height of surface. - switch (mSurfaceOrientation) { - case DISPLAY_ORIENTATION_90: - case DISPLAY_ORIENTATION_270: - mOrientedXPrecision = mYPrecision; - mOrientedYPrecision = mXPrecision; - - mOrientedRanges.x.min = mYTranslate; - mOrientedRanges.x.max = mSurfaceHeight + mYTranslate - 1; - mOrientedRanges.x.flat = 0; - mOrientedRanges.x.fuzz = 0; - mOrientedRanges.x.resolution = mRawPointerAxes.y.resolution * mYScale; - - mOrientedRanges.y.min = mXTranslate; - mOrientedRanges.y.max = mSurfaceWidth + mXTranslate - 1; - mOrientedRanges.y.flat = 0; - mOrientedRanges.y.fuzz = 0; - mOrientedRanges.y.resolution = mRawPointerAxes.x.resolution * mXScale; - break; - - default: - mOrientedXPrecision = mXPrecision; - mOrientedYPrecision = mYPrecision; - - mOrientedRanges.x.min = mXTranslate; - mOrientedRanges.x.max = mSurfaceWidth + mXTranslate - 1; - mOrientedRanges.x.flat = 0; - mOrientedRanges.x.fuzz = 0; - mOrientedRanges.x.resolution = mRawPointerAxes.x.resolution * mXScale; - - mOrientedRanges.y.min = mYTranslate; - mOrientedRanges.y.max = mSurfaceHeight + mYTranslate - 1; - mOrientedRanges.y.flat = 0; - mOrientedRanges.y.fuzz = 0; - mOrientedRanges.y.resolution = mRawPointerAxes.y.resolution * mYScale; - break; - } - - // Location - updateAffineTransformation(); - - if (mDeviceMode == DEVICE_MODE_POINTER) { - // Compute pointer gesture detection parameters. - float rawDiagonal = hypotf(rawWidth, rawHeight); - float displayDiagonal = hypotf(mSurfaceWidth, mSurfaceHeight); - - // Scale movements such that one whole swipe of the touch pad covers a - // given area relative to the diagonal size of the display when no acceleration - // is applied. - // Assume that the touch pad has a square aspect ratio such that movements in - // X and Y of the same number of raw units cover the same physical distance. - mPointerXMovementScale = mConfig.pointerGestureMovementSpeedRatio - * displayDiagonal / rawDiagonal; - mPointerYMovementScale = mPointerXMovementScale; - - // Scale zooms to cover a smaller range of the display than movements do. - // This value determines the area around the pointer that is affected by freeform - // pointer gestures. - mPointerXZoomScale = mConfig.pointerGestureZoomSpeedRatio - * displayDiagonal / rawDiagonal; - mPointerYZoomScale = mPointerXZoomScale; - - // Max width between pointers to detect a swipe gesture is more than some fraction - // of the diagonal axis of the touch pad. Touches that are wider than this are - // translated into freeform gestures. - mPointerGestureMaxSwipeWidth = - mConfig.pointerGestureSwipeMaxWidthRatio * rawDiagonal; - - // Abort current pointer usages because the state has changed. - abortPointerUsage(when, 0 /*policyFlags*/); - } - - // Inform the dispatcher about the changes. - *outResetNeeded = true; - bumpGeneration(); - } -} - -void TouchInputMapper::dumpSurface(String8& dump) { - dump.appendFormat(INDENT3 "Viewport: displayId=%d, orientation=%d, " - "logicalFrame=[%d, %d, %d, %d], " - "physicalFrame=[%d, %d, %d, %d], " - "deviceSize=[%d, %d]\n", - mViewport.displayId, mViewport.orientation, - mViewport.logicalLeft, mViewport.logicalTop, - mViewport.logicalRight, mViewport.logicalBottom, - mViewport.physicalLeft, mViewport.physicalTop, - mViewport.physicalRight, mViewport.physicalBottom, - mViewport.deviceWidth, mViewport.deviceHeight); - - dump.appendFormat(INDENT3 "SurfaceWidth: %dpx\n", mSurfaceWidth); - dump.appendFormat(INDENT3 "SurfaceHeight: %dpx\n", mSurfaceHeight); - dump.appendFormat(INDENT3 "SurfaceLeft: %d\n", mSurfaceLeft); - dump.appendFormat(INDENT3 "SurfaceTop: %d\n", mSurfaceTop); - dump.appendFormat(INDENT3 "SurfaceOrientation: %d\n", mSurfaceOrientation); -} - -void TouchInputMapper::configureVirtualKeys() { - Vector virtualKeyDefinitions; - getEventHub()->getVirtualKeyDefinitions(getDeviceId(), virtualKeyDefinitions); - - mVirtualKeys.clear(); - - if (virtualKeyDefinitions.size() == 0) { - return; - } - - mVirtualKeys.setCapacity(virtualKeyDefinitions.size()); - - int32_t touchScreenLeft = mRawPointerAxes.x.minValue; - int32_t touchScreenTop = mRawPointerAxes.y.minValue; - int32_t touchScreenWidth = mRawPointerAxes.x.maxValue - mRawPointerAxes.x.minValue + 1; - int32_t touchScreenHeight = mRawPointerAxes.y.maxValue - mRawPointerAxes.y.minValue + 1; - - for (size_t i = 0; i < virtualKeyDefinitions.size(); i++) { - const VirtualKeyDefinition& virtualKeyDefinition = - virtualKeyDefinitions[i]; - - mVirtualKeys.add(); - VirtualKey& virtualKey = mVirtualKeys.editTop(); - - virtualKey.scanCode = virtualKeyDefinition.scanCode; - int32_t keyCode; - int32_t dummyKeyMetaState; - uint32_t flags; - if (getEventHub()->mapKey(getDeviceId(), virtualKey.scanCode, 0, 0, - &keyCode, &dummyKeyMetaState, &flags)) { - ALOGW(INDENT "VirtualKey %d: could not obtain key code, ignoring", - virtualKey.scanCode); - mVirtualKeys.pop(); // drop the key - continue; - } - - virtualKey.keyCode = keyCode; - virtualKey.flags = flags; - - // convert the key definition's display coordinates into touch coordinates for a hit box - int32_t halfWidth = virtualKeyDefinition.width / 2; - int32_t halfHeight = virtualKeyDefinition.height / 2; - - virtualKey.hitLeft = (virtualKeyDefinition.centerX - halfWidth) - * touchScreenWidth / mSurfaceWidth + touchScreenLeft; - virtualKey.hitRight= (virtualKeyDefinition.centerX + halfWidth) - * touchScreenWidth / mSurfaceWidth + touchScreenLeft; - virtualKey.hitTop = (virtualKeyDefinition.centerY - halfHeight) - * touchScreenHeight / mSurfaceHeight + touchScreenTop; - virtualKey.hitBottom = (virtualKeyDefinition.centerY + halfHeight) - * touchScreenHeight / mSurfaceHeight + touchScreenTop; - } -} - -void TouchInputMapper::dumpVirtualKeys(String8& dump) { - if (!mVirtualKeys.isEmpty()) { - dump.append(INDENT3 "Virtual Keys:\n"); - - for (size_t i = 0; i < mVirtualKeys.size(); i++) { - const VirtualKey& virtualKey = mVirtualKeys.itemAt(i); - dump.appendFormat(INDENT4 "%zu: scanCode=%d, keyCode=%d, " - "hitLeft=%d, hitRight=%d, hitTop=%d, hitBottom=%d\n", - i, virtualKey.scanCode, virtualKey.keyCode, - virtualKey.hitLeft, virtualKey.hitRight, - virtualKey.hitTop, virtualKey.hitBottom); - } - } -} - -void TouchInputMapper::parseCalibration() { - const PropertyMap& in = getDevice()->getConfiguration(); - Calibration& out = mCalibration; - - // Size - out.sizeCalibration = Calibration::SIZE_CALIBRATION_DEFAULT; - String8 sizeCalibrationString; - if (in.tryGetProperty(String8("touch.size.calibration"), sizeCalibrationString)) { - if (sizeCalibrationString == "none") { - out.sizeCalibration = Calibration::SIZE_CALIBRATION_NONE; - } else if (sizeCalibrationString == "geometric") { - out.sizeCalibration = Calibration::SIZE_CALIBRATION_GEOMETRIC; - } else if (sizeCalibrationString == "diameter") { - out.sizeCalibration = Calibration::SIZE_CALIBRATION_DIAMETER; - } else if (sizeCalibrationString == "box") { - out.sizeCalibration = Calibration::SIZE_CALIBRATION_BOX; - } else if (sizeCalibrationString == "area") { - out.sizeCalibration = Calibration::SIZE_CALIBRATION_AREA; - } else if (sizeCalibrationString != "default") { - ALOGW("Invalid value for touch.size.calibration: '%s'", - sizeCalibrationString.string()); - } - } - - out.haveSizeScale = in.tryGetProperty(String8("touch.size.scale"), - out.sizeScale); - out.haveSizeBias = in.tryGetProperty(String8("touch.size.bias"), - out.sizeBias); - out.haveSizeIsSummed = in.tryGetProperty(String8("touch.size.isSummed"), - out.sizeIsSummed); - - // Pressure - out.pressureCalibration = Calibration::PRESSURE_CALIBRATION_DEFAULT; - String8 pressureCalibrationString; - if (in.tryGetProperty(String8("touch.pressure.calibration"), pressureCalibrationString)) { - if (pressureCalibrationString == "none") { - out.pressureCalibration = Calibration::PRESSURE_CALIBRATION_NONE; - } else if (pressureCalibrationString == "physical") { - out.pressureCalibration = Calibration::PRESSURE_CALIBRATION_PHYSICAL; - } else if (pressureCalibrationString == "amplitude") { - out.pressureCalibration = Calibration::PRESSURE_CALIBRATION_AMPLITUDE; - } else if (pressureCalibrationString != "default") { - ALOGW("Invalid value for touch.pressure.calibration: '%s'", - pressureCalibrationString.string()); - } - } - - out.havePressureScale = in.tryGetProperty(String8("touch.pressure.scale"), - out.pressureScale); - - // Orientation - out.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_DEFAULT; - String8 orientationCalibrationString; - if (in.tryGetProperty(String8("touch.orientation.calibration"), orientationCalibrationString)) { - if (orientationCalibrationString == "none") { - out.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_NONE; - } else if (orientationCalibrationString == "interpolated") { - out.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_INTERPOLATED; - } else if (orientationCalibrationString == "vector") { - out.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_VECTOR; - } else if (orientationCalibrationString != "default") { - ALOGW("Invalid value for touch.orientation.calibration: '%s'", - orientationCalibrationString.string()); - } - } - - // Distance - out.distanceCalibration = Calibration::DISTANCE_CALIBRATION_DEFAULT; - String8 distanceCalibrationString; - if (in.tryGetProperty(String8("touch.distance.calibration"), distanceCalibrationString)) { - if (distanceCalibrationString == "none") { - out.distanceCalibration = Calibration::DISTANCE_CALIBRATION_NONE; - } else if (distanceCalibrationString == "scaled") { - out.distanceCalibration = Calibration::DISTANCE_CALIBRATION_SCALED; - } else if (distanceCalibrationString != "default") { - ALOGW("Invalid value for touch.distance.calibration: '%s'", - distanceCalibrationString.string()); - } - } - - out.haveDistanceScale = in.tryGetProperty(String8("touch.distance.scale"), - out.distanceScale); - - out.coverageCalibration = Calibration::COVERAGE_CALIBRATION_DEFAULT; - String8 coverageCalibrationString; - if (in.tryGetProperty(String8("touch.coverage.calibration"), coverageCalibrationString)) { - if (coverageCalibrationString == "none") { - out.coverageCalibration = Calibration::COVERAGE_CALIBRATION_NONE; - } else if (coverageCalibrationString == "box") { - out.coverageCalibration = Calibration::COVERAGE_CALIBRATION_BOX; - } else if (coverageCalibrationString != "default") { - ALOGW("Invalid value for touch.coverage.calibration: '%s'", - coverageCalibrationString.string()); - } - } -} - -void TouchInputMapper::resolveCalibration() { - // Size - if (mRawPointerAxes.touchMajor.valid || mRawPointerAxes.toolMajor.valid) { - if (mCalibration.sizeCalibration == Calibration::SIZE_CALIBRATION_DEFAULT) { - mCalibration.sizeCalibration = Calibration::SIZE_CALIBRATION_GEOMETRIC; - } - } else { - mCalibration.sizeCalibration = Calibration::SIZE_CALIBRATION_NONE; - } - - // Pressure - if (mRawPointerAxes.pressure.valid) { - if (mCalibration.pressureCalibration == Calibration::PRESSURE_CALIBRATION_DEFAULT) { - mCalibration.pressureCalibration = Calibration::PRESSURE_CALIBRATION_PHYSICAL; - } - } else { - mCalibration.pressureCalibration = Calibration::PRESSURE_CALIBRATION_NONE; - } - - // Orientation - if (mRawPointerAxes.orientation.valid) { - if (mCalibration.orientationCalibration == Calibration::ORIENTATION_CALIBRATION_DEFAULT) { - mCalibration.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_INTERPOLATED; - } - } else { - mCalibration.orientationCalibration = Calibration::ORIENTATION_CALIBRATION_NONE; - } - - // Distance - if (mRawPointerAxes.distance.valid) { - if (mCalibration.distanceCalibration == Calibration::DISTANCE_CALIBRATION_DEFAULT) { - mCalibration.distanceCalibration = Calibration::DISTANCE_CALIBRATION_SCALED; - } - } else { - mCalibration.distanceCalibration = Calibration::DISTANCE_CALIBRATION_NONE; - } - - // Coverage - if (mCalibration.coverageCalibration == Calibration::COVERAGE_CALIBRATION_DEFAULT) { - mCalibration.coverageCalibration = Calibration::COVERAGE_CALIBRATION_NONE; - } -} - -void TouchInputMapper::dumpCalibration(String8& dump) { - dump.append(INDENT3 "Calibration:\n"); - - // Size - switch (mCalibration.sizeCalibration) { - case Calibration::SIZE_CALIBRATION_NONE: - dump.append(INDENT4 "touch.size.calibration: none\n"); - break; - case Calibration::SIZE_CALIBRATION_GEOMETRIC: - dump.append(INDENT4 "touch.size.calibration: geometric\n"); - break; - case Calibration::SIZE_CALIBRATION_DIAMETER: - dump.append(INDENT4 "touch.size.calibration: diameter\n"); - break; - case Calibration::SIZE_CALIBRATION_BOX: - dump.append(INDENT4 "touch.size.calibration: box\n"); - break; - case Calibration::SIZE_CALIBRATION_AREA: - dump.append(INDENT4 "touch.size.calibration: area\n"); - break; - default: - ALOG_ASSERT(false); - } - - if (mCalibration.haveSizeScale) { - dump.appendFormat(INDENT4 "touch.size.scale: %0.3f\n", - mCalibration.sizeScale); - } - - if (mCalibration.haveSizeBias) { - dump.appendFormat(INDENT4 "touch.size.bias: %0.3f\n", - mCalibration.sizeBias); - } - - if (mCalibration.haveSizeIsSummed) { - dump.appendFormat(INDENT4 "touch.size.isSummed: %s\n", - toString(mCalibration.sizeIsSummed)); - } - - // Pressure - switch (mCalibration.pressureCalibration) { - case Calibration::PRESSURE_CALIBRATION_NONE: - dump.append(INDENT4 "touch.pressure.calibration: none\n"); - break; - case Calibration::PRESSURE_CALIBRATION_PHYSICAL: - dump.append(INDENT4 "touch.pressure.calibration: physical\n"); - break; - case Calibration::PRESSURE_CALIBRATION_AMPLITUDE: - dump.append(INDENT4 "touch.pressure.calibration: amplitude\n"); - break; - default: - ALOG_ASSERT(false); - } - - if (mCalibration.havePressureScale) { - dump.appendFormat(INDENT4 "touch.pressure.scale: %0.3f\n", - mCalibration.pressureScale); - } - - // Orientation - switch (mCalibration.orientationCalibration) { - case Calibration::ORIENTATION_CALIBRATION_NONE: - dump.append(INDENT4 "touch.orientation.calibration: none\n"); - break; - case Calibration::ORIENTATION_CALIBRATION_INTERPOLATED: - dump.append(INDENT4 "touch.orientation.calibration: interpolated\n"); - break; - case Calibration::ORIENTATION_CALIBRATION_VECTOR: - dump.append(INDENT4 "touch.orientation.calibration: vector\n"); - break; - default: - ALOG_ASSERT(false); - } - - // Distance - switch (mCalibration.distanceCalibration) { - case Calibration::DISTANCE_CALIBRATION_NONE: - dump.append(INDENT4 "touch.distance.calibration: none\n"); - break; - case Calibration::DISTANCE_CALIBRATION_SCALED: - dump.append(INDENT4 "touch.distance.calibration: scaled\n"); - break; - default: - ALOG_ASSERT(false); - } - - if (mCalibration.haveDistanceScale) { - dump.appendFormat(INDENT4 "touch.distance.scale: %0.3f\n", - mCalibration.distanceScale); - } - - switch (mCalibration.coverageCalibration) { - case Calibration::COVERAGE_CALIBRATION_NONE: - dump.append(INDENT4 "touch.coverage.calibration: none\n"); - break; - case Calibration::COVERAGE_CALIBRATION_BOX: - dump.append(INDENT4 "touch.coverage.calibration: box\n"); - break; - default: - ALOG_ASSERT(false); - } -} - -void TouchInputMapper::dumpAffineTransformation(String8& dump) { - dump.append(INDENT3 "Affine Transformation:\n"); - - dump.appendFormat(INDENT4 "X scale: %0.3f\n", mAffineTransform.x_scale); - dump.appendFormat(INDENT4 "X ymix: %0.3f\n", mAffineTransform.x_ymix); - dump.appendFormat(INDENT4 "X offset: %0.3f\n", mAffineTransform.x_offset); - dump.appendFormat(INDENT4 "Y xmix: %0.3f\n", mAffineTransform.y_xmix); - dump.appendFormat(INDENT4 "Y scale: %0.3f\n", mAffineTransform.y_scale); - dump.appendFormat(INDENT4 "Y offset: %0.3f\n", mAffineTransform.y_offset); -} - -void TouchInputMapper::updateAffineTransformation() { - mAffineTransform = getPolicy()->getTouchAffineTransformation(mDevice->getDescriptor(), - mSurfaceOrientation); -} - -void TouchInputMapper::reset(nsecs_t when) { - mCursorButtonAccumulator.reset(getDevice()); - mCursorScrollAccumulator.reset(getDevice()); - mTouchButtonAccumulator.reset(getDevice()); - - mPointerVelocityControl.reset(); - mWheelXVelocityControl.reset(); - mWheelYVelocityControl.reset(); - - mRawStatesPending.clear(); - mCurrentRawState.clear(); - mCurrentCookedState.clear(); - mLastRawState.clear(); - mLastCookedState.clear(); - mPointerUsage = POINTER_USAGE_NONE; - mSentHoverEnter = false; - mHavePointerIds = false; - mCurrentMotionAborted = false; - mDownTime = 0; - - mCurrentVirtualKey.down = false; - - mPointerGesture.reset(); - mPointerSimple.reset(); - resetExternalStylus(); - - if (mPointerController != NULL) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - mPointerController->clearSpots(); - } - - InputMapper::reset(when); -} - -void TouchInputMapper::resetExternalStylus() { - mExternalStylusState.clear(); - mExternalStylusId = -1; - mExternalStylusFusionTimeout = LLONG_MAX; - mExternalStylusDataPending = false; -} - -void TouchInputMapper::clearStylusDataPendingFlags() { - mExternalStylusDataPending = false; - mExternalStylusFusionTimeout = LLONG_MAX; -} - -void TouchInputMapper::process(const RawEvent* rawEvent) { - mCursorButtonAccumulator.process(rawEvent); - mCursorScrollAccumulator.process(rawEvent); - mTouchButtonAccumulator.process(rawEvent); - - if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) { - sync(rawEvent->when); - } -} - -void TouchInputMapper::sync(nsecs_t when) { - const RawState* last = mRawStatesPending.isEmpty() ? - &mCurrentRawState : &mRawStatesPending.top(); - - // Push a new state. - mRawStatesPending.push(); - RawState* next = &mRawStatesPending.editTop(); - next->clear(); - next->when = when; - - // Sync button state. - next->buttonState = mTouchButtonAccumulator.getButtonState() - | mCursorButtonAccumulator.getButtonState(); - - // Sync scroll - next->rawVScroll = mCursorScrollAccumulator.getRelativeVWheel(); - next->rawHScroll = mCursorScrollAccumulator.getRelativeHWheel(); - mCursorScrollAccumulator.finishSync(); - - // Sync touch - syncTouch(when, next); - - // Assign pointer ids. - if (!mHavePointerIds) { - assignPointerIds(last, next); - } - -#if DEBUG_RAW_EVENTS - ALOGD("syncTouch: pointerCount %d -> %d, touching ids 0x%08x -> 0x%08x, " - "hovering ids 0x%08x -> 0x%08x", - last->rawPointerData.pointerCount, - next->rawPointerData.pointerCount, - last->rawPointerData.touchingIdBits.value, - next->rawPointerData.touchingIdBits.value, - last->rawPointerData.hoveringIdBits.value, - next->rawPointerData.hoveringIdBits.value); -#endif - - processRawTouches(false /*timeout*/); -} - -void TouchInputMapper::processRawTouches(bool timeout) { - if (mDeviceMode == DEVICE_MODE_DISABLED) { - // Drop all input if the device is disabled. - mCurrentRawState.clear(); - mRawStatesPending.clear(); - return; - } - - // Drain any pending touch states. The invariant here is that the mCurrentRawState is always - // valid and must go through the full cook and dispatch cycle. This ensures that anything - // touching the current state will only observe the events that have been dispatched to the - // rest of the pipeline. - const size_t N = mRawStatesPending.size(); - size_t count; - for(count = 0; count < N; count++) { - const RawState& next = mRawStatesPending[count]; - - // A failure to assign the stylus id means that we're waiting on stylus data - // and so should defer the rest of the pipeline. - if (assignExternalStylusId(next, timeout)) { - break; - } - - // All ready to go. - clearStylusDataPendingFlags(); - mCurrentRawState.copyFrom(next); - if (mCurrentRawState.when < mLastRawState.when) { - mCurrentRawState.when = mLastRawState.when; - } - cookAndDispatch(mCurrentRawState.when); - } - if (count != 0) { - mRawStatesPending.removeItemsAt(0, count); - } - - if (mExternalStylusDataPending) { - if (timeout) { - nsecs_t when = mExternalStylusFusionTimeout - STYLUS_DATA_LATENCY; - clearStylusDataPendingFlags(); - mCurrentRawState.copyFrom(mLastRawState); -#if DEBUG_STYLUS_FUSION - ALOGD("Timeout expired, synthesizing event with new stylus data"); -#endif - cookAndDispatch(when); - } else if (mExternalStylusFusionTimeout == LLONG_MAX) { - mExternalStylusFusionTimeout = mExternalStylusState.when + TOUCH_DATA_TIMEOUT; - getContext()->requestTimeoutAtTime(mExternalStylusFusionTimeout); - } - } -} - -void TouchInputMapper::cookAndDispatch(nsecs_t when) { - // Always start with a clean state. - mCurrentCookedState.clear(); - - // Apply stylus buttons to current raw state. - applyExternalStylusButtonState(when); - - // Handle policy on initial down or hover events. - bool initialDown = mLastRawState.rawPointerData.pointerCount == 0 - && mCurrentRawState.rawPointerData.pointerCount != 0; - - uint32_t policyFlags = 0; - bool buttonsPressed = mCurrentRawState.buttonState & ~mLastRawState.buttonState; - if (initialDown || buttonsPressed) { - // If this is a touch screen, hide the pointer on an initial down. - if (mDeviceMode == DEVICE_MODE_DIRECT) { - getContext()->fadePointer(); - } - - if (mParameters.wake) { - policyFlags |= POLICY_FLAG_WAKE; - } - } - - // Consume raw off-screen touches before cooking pointer data. - // If touches are consumed, subsequent code will not receive any pointer data. - if (consumeRawTouches(when, policyFlags)) { - mCurrentRawState.rawPointerData.clear(); - } - - // Cook pointer data. This call populates the mCurrentCookedState.cookedPointerData structure - // with cooked pointer data that has the same ids and indices as the raw data. - // The following code can use either the raw or cooked data, as needed. - cookPointerData(); - - // Apply stylus pressure to current cooked state. - applyExternalStylusTouchState(when); - - // Synthesize key down from raw buttons if needed. - synthesizeButtonKeys(getContext(), AKEY_EVENT_ACTION_DOWN, when, getDeviceId(), mSource, - policyFlags, mLastCookedState.buttonState, mCurrentCookedState.buttonState); - - // Dispatch the touches either directly or by translation through a pointer on screen. - if (mDeviceMode == DEVICE_MODE_POINTER) { - for (BitSet32 idBits(mCurrentRawState.rawPointerData.touchingIdBits); - !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - const RawPointerData::Pointer& pointer = - mCurrentRawState.rawPointerData.pointerForId(id); - if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS - || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) { - mCurrentCookedState.stylusIdBits.markBit(id); - } else if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_FINGER - || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { - mCurrentCookedState.fingerIdBits.markBit(id); - } else if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_MOUSE) { - mCurrentCookedState.mouseIdBits.markBit(id); - } - } - for (BitSet32 idBits(mCurrentRawState.rawPointerData.hoveringIdBits); - !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - const RawPointerData::Pointer& pointer = - mCurrentRawState.rawPointerData.pointerForId(id); - if (pointer.toolType == AMOTION_EVENT_TOOL_TYPE_STYLUS - || pointer.toolType == AMOTION_EVENT_TOOL_TYPE_ERASER) { - mCurrentCookedState.stylusIdBits.markBit(id); - } - } - - // Stylus takes precedence over all tools, then mouse, then finger. - PointerUsage pointerUsage = mPointerUsage; - if (!mCurrentCookedState.stylusIdBits.isEmpty()) { - mCurrentCookedState.mouseIdBits.clear(); - mCurrentCookedState.fingerIdBits.clear(); - pointerUsage = POINTER_USAGE_STYLUS; - } else if (!mCurrentCookedState.mouseIdBits.isEmpty()) { - mCurrentCookedState.fingerIdBits.clear(); - pointerUsage = POINTER_USAGE_MOUSE; - } else if (!mCurrentCookedState.fingerIdBits.isEmpty() || - isPointerDown(mCurrentRawState.buttonState)) { - pointerUsage = POINTER_USAGE_GESTURES; - } - - dispatchPointerUsage(when, policyFlags, pointerUsage); - } else { - if (mDeviceMode == DEVICE_MODE_DIRECT - && mConfig.showTouches && mPointerController != NULL) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT); - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - - mPointerController->setButtonState(mCurrentRawState.buttonState); - mPointerController->setSpots(mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - mCurrentCookedState.cookedPointerData.touchingIdBits); - } - - if (!mCurrentMotionAborted) { - dispatchButtonRelease(when, policyFlags); - dispatchHoverExit(when, policyFlags); - dispatchTouches(when, policyFlags); - dispatchHoverEnterAndMove(when, policyFlags); - dispatchButtonPress(when, policyFlags); - } - - if (mCurrentCookedState.cookedPointerData.pointerCount == 0) { - mCurrentMotionAborted = false; - } - } - - // Synthesize key up from raw buttons if needed. - synthesizeButtonKeys(getContext(), AKEY_EVENT_ACTION_UP, when, getDeviceId(), mSource, - policyFlags, mLastCookedState.buttonState, mCurrentCookedState.buttonState); - - // Clear some transient state. - mCurrentRawState.rawVScroll = 0; - mCurrentRawState.rawHScroll = 0; - - // Copy current touch to last touch in preparation for the next cycle. - mLastRawState.copyFrom(mCurrentRawState); - mLastCookedState.copyFrom(mCurrentCookedState); -} - -void TouchInputMapper::applyExternalStylusButtonState(nsecs_t when) { - if (mDeviceMode == DEVICE_MODE_DIRECT && hasExternalStylus() && mExternalStylusId != -1) { - mCurrentRawState.buttonState |= mExternalStylusState.buttons; - } -} - -void TouchInputMapper::applyExternalStylusTouchState(nsecs_t when) { - CookedPointerData& currentPointerData = mCurrentCookedState.cookedPointerData; - const CookedPointerData& lastPointerData = mLastCookedState.cookedPointerData; - - if (mExternalStylusId != -1 && currentPointerData.isTouching(mExternalStylusId)) { - float pressure = mExternalStylusState.pressure; - if (pressure == 0.0f && lastPointerData.isTouching(mExternalStylusId)) { - const PointerCoords& coords = lastPointerData.pointerCoordsForId(mExternalStylusId); - pressure = coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE); - } - PointerCoords& coords = currentPointerData.editPointerCoordsWithId(mExternalStylusId); - coords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure); - - PointerProperties& properties = - currentPointerData.editPointerPropertiesWithId(mExternalStylusId); - if (mExternalStylusState.toolType != AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { - properties.toolType = mExternalStylusState.toolType; - } - } -} - -bool TouchInputMapper::assignExternalStylusId(const RawState& state, bool timeout) { - if (mDeviceMode != DEVICE_MODE_DIRECT || !hasExternalStylus()) { - return false; - } - - const bool initialDown = mLastRawState.rawPointerData.pointerCount == 0 - && state.rawPointerData.pointerCount != 0; - if (initialDown) { - if (mExternalStylusState.pressure != 0.0f) { -#if DEBUG_STYLUS_FUSION - ALOGD("Have both stylus and touch data, beginning fusion"); -#endif - mExternalStylusId = state.rawPointerData.touchingIdBits.firstMarkedBit(); - } else if (timeout) { -#if DEBUG_STYLUS_FUSION - ALOGD("Timeout expired, assuming touch is not a stylus."); -#endif - resetExternalStylus(); - } else { - if (mExternalStylusFusionTimeout == LLONG_MAX) { - mExternalStylusFusionTimeout = state.when + EXTERNAL_STYLUS_DATA_TIMEOUT; - } -#if DEBUG_STYLUS_FUSION - ALOGD("No stylus data but stylus is connected, requesting timeout " - "(%" PRId64 "ms)", mExternalStylusFusionTimeout); -#endif - getContext()->requestTimeoutAtTime(mExternalStylusFusionTimeout); - return true; - } - } - - // Check if the stylus pointer has gone up. - if (mExternalStylusId != -1 && - !state.rawPointerData.touchingIdBits.hasBit(mExternalStylusId)) { -#if DEBUG_STYLUS_FUSION - ALOGD("Stylus pointer is going up"); -#endif - mExternalStylusId = -1; - } - - return false; -} - -void TouchInputMapper::timeoutExpired(nsecs_t when) { - if (mDeviceMode == DEVICE_MODE_POINTER) { - if (mPointerUsage == POINTER_USAGE_GESTURES) { - dispatchPointerGestures(when, 0 /*policyFlags*/, true /*isTimeout*/); - } - } else if (mDeviceMode == DEVICE_MODE_DIRECT) { - if (mExternalStylusFusionTimeout < when) { - processRawTouches(true /*timeout*/); - } else if (mExternalStylusFusionTimeout != LLONG_MAX) { - getContext()->requestTimeoutAtTime(mExternalStylusFusionTimeout); - } - } -} - -void TouchInputMapper::updateExternalStylusState(const StylusState& state) { - mExternalStylusState.copyFrom(state); - if (mExternalStylusId != -1 || mExternalStylusFusionTimeout != LLONG_MAX) { - // We're either in the middle of a fused stream of data or we're waiting on data before - // dispatching the initial down, so go ahead and dispatch now that we have fresh stylus - // data. - mExternalStylusDataPending = true; - processRawTouches(false /*timeout*/); - } -} - -bool TouchInputMapper::consumeRawTouches(nsecs_t when, uint32_t policyFlags) { - // Check for release of a virtual key. - if (mCurrentVirtualKey.down) { - if (mCurrentRawState.rawPointerData.touchingIdBits.isEmpty()) { - // Pointer went up while virtual key was down. - mCurrentVirtualKey.down = false; - if (!mCurrentVirtualKey.ignored) { -#if DEBUG_VIRTUAL_KEYS - ALOGD("VirtualKeys: Generating key up: keyCode=%d, scanCode=%d", - mCurrentVirtualKey.keyCode, mCurrentVirtualKey.scanCode); -#endif - dispatchVirtualKey(when, policyFlags, - AKEY_EVENT_ACTION_UP, - AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY); - } - return true; - } - - if (mCurrentRawState.rawPointerData.touchingIdBits.count() == 1) { - uint32_t id = mCurrentRawState.rawPointerData.touchingIdBits.firstMarkedBit(); - const RawPointerData::Pointer& pointer = - mCurrentRawState.rawPointerData.pointerForId(id); - const VirtualKey* virtualKey = findVirtualKeyHit(pointer.x, pointer.y); - if (virtualKey && virtualKey->keyCode == mCurrentVirtualKey.keyCode) { - // Pointer is still within the space of the virtual key. - return true; - } - } - - // Pointer left virtual key area or another pointer also went down. - // Send key cancellation but do not consume the touch yet. - // This is useful when the user swipes through from the virtual key area - // into the main display surface. - mCurrentVirtualKey.down = false; - if (!mCurrentVirtualKey.ignored) { -#if DEBUG_VIRTUAL_KEYS - ALOGD("VirtualKeys: Canceling key: keyCode=%d, scanCode=%d", - mCurrentVirtualKey.keyCode, mCurrentVirtualKey.scanCode); -#endif - dispatchVirtualKey(when, policyFlags, - AKEY_EVENT_ACTION_UP, - AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY - | AKEY_EVENT_FLAG_CANCELED); - } - } - - if (mLastRawState.rawPointerData.touchingIdBits.isEmpty() - && !mCurrentRawState.rawPointerData.touchingIdBits.isEmpty()) { - // Pointer just went down. Check for virtual key press or off-screen touches. - uint32_t id = mCurrentRawState.rawPointerData.touchingIdBits.firstMarkedBit(); - const RawPointerData::Pointer& pointer = mCurrentRawState.rawPointerData.pointerForId(id); - if (!isPointInsideSurface(pointer.x, pointer.y)) { - // If exactly one pointer went down, check for virtual key hit. - // Otherwise we will drop the entire stroke. - if (mCurrentRawState.rawPointerData.touchingIdBits.count() == 1) { - const VirtualKey* virtualKey = findVirtualKeyHit(pointer.x, pointer.y); - if (virtualKey) { - mCurrentVirtualKey.down = true; - mCurrentVirtualKey.downTime = when; - mCurrentVirtualKey.keyCode = virtualKey->keyCode; - mCurrentVirtualKey.scanCode = virtualKey->scanCode; - mCurrentVirtualKey.ignored = mContext->shouldDropVirtualKey( - when, getDevice(), virtualKey->keyCode, virtualKey->scanCode); - - if (!mCurrentVirtualKey.ignored) { -#if DEBUG_VIRTUAL_KEYS - ALOGD("VirtualKeys: Generating key down: keyCode=%d, scanCode=%d", - mCurrentVirtualKey.keyCode, - mCurrentVirtualKey.scanCode); -#endif - dispatchVirtualKey(when, policyFlags, - AKEY_EVENT_ACTION_DOWN, - AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY); - } - } - } - return true; - } - } - - // Disable all virtual key touches that happen within a short time interval of the - // most recent touch within the screen area. The idea is to filter out stray - // virtual key presses when interacting with the touch screen. - // - // Problems we're trying to solve: - // - // 1. While scrolling a list or dragging the window shade, the user swipes down into a - // virtual key area that is implemented by a separate touch panel and accidentally - // triggers a virtual key. - // - // 2. While typing in the on screen keyboard, the user taps slightly outside the screen - // area and accidentally triggers a virtual key. This often happens when virtual keys - // are layed out below the screen near to where the on screen keyboard's space bar - // is displayed. - if (mConfig.virtualKeyQuietTime > 0 && - !mCurrentRawState.rawPointerData.touchingIdBits.isEmpty()) { - mContext->disableVirtualKeysUntil(when + mConfig.virtualKeyQuietTime); - } - return false; -} - -void TouchInputMapper::dispatchVirtualKey(nsecs_t when, uint32_t policyFlags, - int32_t keyEventAction, int32_t keyEventFlags) { - int32_t keyCode = mCurrentVirtualKey.keyCode; - int32_t scanCode = mCurrentVirtualKey.scanCode; - nsecs_t downTime = mCurrentVirtualKey.downTime; - int32_t metaState = mContext->getGlobalMetaState(); - policyFlags |= POLICY_FLAG_VIRTUAL; - - NotifyKeyArgs args(when, getDeviceId(), AINPUT_SOURCE_KEYBOARD, policyFlags, - keyEventAction, keyEventFlags, keyCode, scanCode, metaState, downTime); - getListener()->notifyKey(&args); -} - -void TouchInputMapper::abortTouches(nsecs_t when, uint32_t policyFlags) { - BitSet32 currentIdBits = mCurrentCookedState.cookedPointerData.touchingIdBits; - if (!currentIdBits.isEmpty()) { - int32_t metaState = getContext()->getGlobalMetaState(); - int32_t buttonState = mCurrentCookedState.buttonState; - dispatchMotion(when, policyFlags, mSource, AMOTION_EVENT_ACTION_CANCEL, 0, 0, - metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - currentIdBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - mCurrentMotionAborted = true; - } -} - -void TouchInputMapper::dispatchTouches(nsecs_t when, uint32_t policyFlags) { - BitSet32 currentIdBits = mCurrentCookedState.cookedPointerData.touchingIdBits; - BitSet32 lastIdBits = mLastCookedState.cookedPointerData.touchingIdBits; - int32_t metaState = getContext()->getGlobalMetaState(); - int32_t buttonState = mCurrentCookedState.buttonState; - - if (currentIdBits == lastIdBits) { - if (!currentIdBits.isEmpty()) { - // No pointer id changes so this is a move event. - // The listener takes care of batching moves so we don't have to deal with that here. - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_MOVE, 0, 0, metaState, buttonState, - AMOTION_EVENT_EDGE_FLAG_NONE, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - currentIdBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - } - } else { - // There may be pointers going up and pointers going down and pointers moving - // all at the same time. - BitSet32 upIdBits(lastIdBits.value & ~currentIdBits.value); - BitSet32 downIdBits(currentIdBits.value & ~lastIdBits.value); - BitSet32 moveIdBits(lastIdBits.value & currentIdBits.value); - BitSet32 dispatchedIdBits(lastIdBits.value); - - // Update last coordinates of pointers that have moved so that we observe the new - // pointer positions at the same time as other pointers that have just gone up. - bool moveNeeded = updateMovedPointers( - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - mLastCookedState.cookedPointerData.pointerProperties, - mLastCookedState.cookedPointerData.pointerCoords, - mLastCookedState.cookedPointerData.idToIndex, - moveIdBits); - if (buttonState != mLastCookedState.buttonState) { - moveNeeded = true; - } - - // Dispatch pointer up events. - while (!upIdBits.isEmpty()) { - uint32_t upId = upIdBits.clearFirstMarkedBit(); - - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_POINTER_UP, 0, 0, metaState, buttonState, 0, - mLastCookedState.cookedPointerData.pointerProperties, - mLastCookedState.cookedPointerData.pointerCoords, - mLastCookedState.cookedPointerData.idToIndex, - dispatchedIdBits, upId, mOrientedXPrecision, mOrientedYPrecision, mDownTime); - dispatchedIdBits.clearBit(upId); - } - - // Dispatch move events if any of the remaining pointers moved from their old locations. - // Although applications receive new locations as part of individual pointer up - // events, they do not generally handle them except when presented in a move event. - if (moveNeeded && !moveIdBits.isEmpty()) { - ALOG_ASSERT(moveIdBits.value == dispatchedIdBits.value); - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_MOVE, 0, 0, metaState, buttonState, 0, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - dispatchedIdBits, -1, mOrientedXPrecision, mOrientedYPrecision, mDownTime); - } - - // Dispatch pointer down events using the new pointer locations. - while (!downIdBits.isEmpty()) { - uint32_t downId = downIdBits.clearFirstMarkedBit(); - dispatchedIdBits.markBit(downId); - - if (dispatchedIdBits.count() == 1) { - // First pointer is going down. Set down time. - mDownTime = when; - } - - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_POINTER_DOWN, 0, 0, metaState, buttonState, 0, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - dispatchedIdBits, downId, mOrientedXPrecision, mOrientedYPrecision, mDownTime); - } - } -} - -void TouchInputMapper::dispatchHoverExit(nsecs_t when, uint32_t policyFlags) { - if (mSentHoverEnter && - (mCurrentCookedState.cookedPointerData.hoveringIdBits.isEmpty() - || !mCurrentCookedState.cookedPointerData.touchingIdBits.isEmpty())) { - int32_t metaState = getContext()->getGlobalMetaState(); - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_HOVER_EXIT, 0, 0, metaState, mLastCookedState.buttonState, 0, - mLastCookedState.cookedPointerData.pointerProperties, - mLastCookedState.cookedPointerData.pointerCoords, - mLastCookedState.cookedPointerData.idToIndex, - mLastCookedState.cookedPointerData.hoveringIdBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - mSentHoverEnter = false; - } -} - -void TouchInputMapper::dispatchHoverEnterAndMove(nsecs_t when, uint32_t policyFlags) { - if (mCurrentCookedState.cookedPointerData.touchingIdBits.isEmpty() - && !mCurrentCookedState.cookedPointerData.hoveringIdBits.isEmpty()) { - int32_t metaState = getContext()->getGlobalMetaState(); - if (!mSentHoverEnter) { - dispatchMotion(when, policyFlags, mSource, AMOTION_EVENT_ACTION_HOVER_ENTER, - 0, 0, metaState, mCurrentRawState.buttonState, 0, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - mCurrentCookedState.cookedPointerData.hoveringIdBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - mSentHoverEnter = true; - } - - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_HOVER_MOVE, 0, 0, metaState, - mCurrentRawState.buttonState, 0, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, - mCurrentCookedState.cookedPointerData.hoveringIdBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - } -} - -void TouchInputMapper::dispatchButtonRelease(nsecs_t when, uint32_t policyFlags) { - BitSet32 releasedButtons(mLastCookedState.buttonState & ~mCurrentCookedState.buttonState); - const BitSet32& idBits = findActiveIdBits(mLastCookedState.cookedPointerData); - const int32_t metaState = getContext()->getGlobalMetaState(); - int32_t buttonState = mLastCookedState.buttonState; - while (!releasedButtons.isEmpty()) { - int32_t actionButton = BitSet32::valueForBit(releasedButtons.clearFirstMarkedBit()); - buttonState &= ~actionButton; - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_BUTTON_RELEASE, actionButton, - 0, metaState, buttonState, 0, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, idBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - } -} - -void TouchInputMapper::dispatchButtonPress(nsecs_t when, uint32_t policyFlags) { - BitSet32 pressedButtons(mCurrentCookedState.buttonState & ~mLastCookedState.buttonState); - const BitSet32& idBits = findActiveIdBits(mCurrentCookedState.cookedPointerData); - const int32_t metaState = getContext()->getGlobalMetaState(); - int32_t buttonState = mLastCookedState.buttonState; - while (!pressedButtons.isEmpty()) { - int32_t actionButton = BitSet32::valueForBit(pressedButtons.clearFirstMarkedBit()); - buttonState |= actionButton; - dispatchMotion(when, policyFlags, mSource, AMOTION_EVENT_ACTION_BUTTON_PRESS, actionButton, - 0, metaState, buttonState, 0, - mCurrentCookedState.cookedPointerData.pointerProperties, - mCurrentCookedState.cookedPointerData.pointerCoords, - mCurrentCookedState.cookedPointerData.idToIndex, idBits, -1, - mOrientedXPrecision, mOrientedYPrecision, mDownTime); - } -} - -const BitSet32& TouchInputMapper::findActiveIdBits(const CookedPointerData& cookedPointerData) { - if (!cookedPointerData.touchingIdBits.isEmpty()) { - return cookedPointerData.touchingIdBits; - } - return cookedPointerData.hoveringIdBits; -} - -void TouchInputMapper::cookPointerData() { - uint32_t currentPointerCount = mCurrentRawState.rawPointerData.pointerCount; - - mCurrentCookedState.cookedPointerData.clear(); - mCurrentCookedState.cookedPointerData.pointerCount = currentPointerCount; - mCurrentCookedState.cookedPointerData.hoveringIdBits = - mCurrentRawState.rawPointerData.hoveringIdBits; - mCurrentCookedState.cookedPointerData.touchingIdBits = - mCurrentRawState.rawPointerData.touchingIdBits; - - if (mCurrentCookedState.cookedPointerData.pointerCount == 0) { - mCurrentCookedState.buttonState = 0; - } else { - mCurrentCookedState.buttonState = mCurrentRawState.buttonState; - } - - // Walk through the the active pointers and map device coordinates onto - // surface coordinates and adjust for display orientation. - for (uint32_t i = 0; i < currentPointerCount; i++) { - const RawPointerData::Pointer& in = mCurrentRawState.rawPointerData.pointers[i]; - - // Size - float touchMajor, touchMinor, toolMajor, toolMinor, size; - switch (mCalibration.sizeCalibration) { - case Calibration::SIZE_CALIBRATION_GEOMETRIC: - case Calibration::SIZE_CALIBRATION_DIAMETER: - case Calibration::SIZE_CALIBRATION_BOX: - case Calibration::SIZE_CALIBRATION_AREA: - if (mRawPointerAxes.touchMajor.valid && mRawPointerAxes.toolMajor.valid) { - touchMajor = in.touchMajor; - touchMinor = mRawPointerAxes.touchMinor.valid ? in.touchMinor : in.touchMajor; - toolMajor = in.toolMajor; - toolMinor = mRawPointerAxes.toolMinor.valid ? in.toolMinor : in.toolMajor; - size = mRawPointerAxes.touchMinor.valid - ? avg(in.touchMajor, in.touchMinor) : in.touchMajor; - } else if (mRawPointerAxes.touchMajor.valid) { - toolMajor = touchMajor = in.touchMajor; - toolMinor = touchMinor = mRawPointerAxes.touchMinor.valid - ? in.touchMinor : in.touchMajor; - size = mRawPointerAxes.touchMinor.valid - ? avg(in.touchMajor, in.touchMinor) : in.touchMajor; - } else if (mRawPointerAxes.toolMajor.valid) { - touchMajor = toolMajor = in.toolMajor; - touchMinor = toolMinor = mRawPointerAxes.toolMinor.valid - ? in.toolMinor : in.toolMajor; - size = mRawPointerAxes.toolMinor.valid - ? avg(in.toolMajor, in.toolMinor) : in.toolMajor; - } else { - ALOG_ASSERT(false, "No touch or tool axes. " - "Size calibration should have been resolved to NONE."); - touchMajor = 0; - touchMinor = 0; - toolMajor = 0; - toolMinor = 0; - size = 0; - } - - if (mCalibration.haveSizeIsSummed && mCalibration.sizeIsSummed) { - uint32_t touchingCount = - mCurrentRawState.rawPointerData.touchingIdBits.count(); - if (touchingCount > 1) { - touchMajor /= touchingCount; - touchMinor /= touchingCount; - toolMajor /= touchingCount; - toolMinor /= touchingCount; - size /= touchingCount; - } - } - - if (mCalibration.sizeCalibration == Calibration::SIZE_CALIBRATION_GEOMETRIC) { - touchMajor *= mGeometricScale; - touchMinor *= mGeometricScale; - toolMajor *= mGeometricScale; - toolMinor *= mGeometricScale; - } else if (mCalibration.sizeCalibration == Calibration::SIZE_CALIBRATION_AREA) { - touchMajor = touchMajor > 0 ? sqrtf(touchMajor) : 0; - touchMinor = touchMajor; - toolMajor = toolMajor > 0 ? sqrtf(toolMajor) : 0; - toolMinor = toolMajor; - } else if (mCalibration.sizeCalibration == Calibration::SIZE_CALIBRATION_DIAMETER) { - touchMinor = touchMajor; - toolMinor = toolMajor; - } - - mCalibration.applySizeScaleAndBias(&touchMajor); - mCalibration.applySizeScaleAndBias(&touchMinor); - mCalibration.applySizeScaleAndBias(&toolMajor); - mCalibration.applySizeScaleAndBias(&toolMinor); - size *= mSizeScale; - break; - default: - touchMajor = 0; - touchMinor = 0; - toolMajor = 0; - toolMinor = 0; - size = 0; - break; - } - - // Pressure - float pressure; - switch (mCalibration.pressureCalibration) { - case Calibration::PRESSURE_CALIBRATION_PHYSICAL: - case Calibration::PRESSURE_CALIBRATION_AMPLITUDE: - pressure = in.pressure * mPressureScale; - break; - default: - pressure = in.isHovering ? 0 : 1; - break; - } - - // Tilt and Orientation - float tilt; - float orientation; - if (mHaveTilt) { - float tiltXAngle = (in.tiltX - mTiltXCenter) * mTiltXScale; - float tiltYAngle = (in.tiltY - mTiltYCenter) * mTiltYScale; - orientation = atan2f(-sinf(tiltXAngle), sinf(tiltYAngle)); - tilt = acosf(cosf(tiltXAngle) * cosf(tiltYAngle)); - } else { - tilt = 0; - - switch (mCalibration.orientationCalibration) { - case Calibration::ORIENTATION_CALIBRATION_INTERPOLATED: - orientation = in.orientation * mOrientationScale; - break; - case Calibration::ORIENTATION_CALIBRATION_VECTOR: { - int32_t c1 = signExtendNybble((in.orientation & 0xf0) >> 4); - int32_t c2 = signExtendNybble(in.orientation & 0x0f); - if (c1 != 0 || c2 != 0) { - orientation = atan2f(c1, c2) * 0.5f; - float confidence = hypotf(c1, c2); - float scale = 1.0f + confidence / 16.0f; - touchMajor *= scale; - touchMinor /= scale; - toolMajor *= scale; - toolMinor /= scale; - } else { - orientation = 0; - } - break; - } - default: - orientation = 0; - } - } - - // Distance - float distance; - switch (mCalibration.distanceCalibration) { - case Calibration::DISTANCE_CALIBRATION_SCALED: - distance = in.distance * mDistanceScale; - break; - default: - distance = 0; - } - - // Coverage - int32_t rawLeft, rawTop, rawRight, rawBottom; - switch (mCalibration.coverageCalibration) { - case Calibration::COVERAGE_CALIBRATION_BOX: - rawLeft = (in.toolMinor & 0xffff0000) >> 16; - rawRight = in.toolMinor & 0x0000ffff; - rawBottom = in.toolMajor & 0x0000ffff; - rawTop = (in.toolMajor & 0xffff0000) >> 16; - break; - default: - rawLeft = rawTop = rawRight = rawBottom = 0; - break; - } - - // Adjust X,Y coords for device calibration - // TODO: Adjust coverage coords? - float xTransformed = in.x, yTransformed = in.y; - mAffineTransform.applyTo(xTransformed, yTransformed); - - // Adjust X, Y, and coverage coords for surface orientation. - float x, y; - float left, top, right, bottom; - - switch (mSurfaceOrientation) { - case DISPLAY_ORIENTATION_90: - x = float(yTransformed - mRawPointerAxes.y.minValue) * mYScale + mYTranslate; - y = float(mRawPointerAxes.x.maxValue - xTransformed) * mXScale + mXTranslate; - left = float(rawTop - mRawPointerAxes.y.minValue) * mYScale + mYTranslate; - right = float(rawBottom- mRawPointerAxes.y.minValue) * mYScale + mYTranslate; - bottom = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate; - top = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate; - orientation -= M_PI_2; - if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) { - orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min); - } - break; - case DISPLAY_ORIENTATION_180: - x = float(mRawPointerAxes.x.maxValue - xTransformed) * mXScale + mXTranslate; - y = float(mRawPointerAxes.y.maxValue - yTransformed) * mYScale + mYTranslate; - left = float(mRawPointerAxes.x.maxValue - rawRight) * mXScale + mXTranslate; - right = float(mRawPointerAxes.x.maxValue - rawLeft) * mXScale + mXTranslate; - bottom = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate; - top = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate; - orientation -= M_PI; - if (mOrientedRanges.haveOrientation && orientation < mOrientedRanges.orientation.min) { - orientation += (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min); - } - break; - case DISPLAY_ORIENTATION_270: - x = float(mRawPointerAxes.y.maxValue - yTransformed) * mYScale + mYTranslate; - y = float(xTransformed - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; - left = float(mRawPointerAxes.y.maxValue - rawBottom) * mYScale + mYTranslate; - right = float(mRawPointerAxes.y.maxValue - rawTop) * mYScale + mYTranslate; - bottom = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; - top = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; - orientation += M_PI_2; - if (mOrientedRanges.haveOrientation && orientation > mOrientedRanges.orientation.max) { - orientation -= (mOrientedRanges.orientation.max - mOrientedRanges.orientation.min); - } - break; - default: - x = float(xTransformed - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; - y = float(yTransformed - mRawPointerAxes.y.minValue) * mYScale + mYTranslate; - left = float(rawLeft - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; - right = float(rawRight - mRawPointerAxes.x.minValue) * mXScale + mXTranslate; - bottom = float(rawBottom - mRawPointerAxes.y.minValue) * mYScale + mYTranslate; - top = float(rawTop - mRawPointerAxes.y.minValue) * mYScale + mYTranslate; - break; - } - - // Write output coords. - PointerCoords& out = mCurrentCookedState.cookedPointerData.pointerCoords[i]; - out.clear(); - out.setAxisValue(AMOTION_EVENT_AXIS_X, x); - out.setAxisValue(AMOTION_EVENT_AXIS_Y, y); - out.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, pressure); - out.setAxisValue(AMOTION_EVENT_AXIS_SIZE, size); - out.setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR, touchMajor); - out.setAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR, touchMinor); - out.setAxisValue(AMOTION_EVENT_AXIS_ORIENTATION, orientation); - out.setAxisValue(AMOTION_EVENT_AXIS_TILT, tilt); - out.setAxisValue(AMOTION_EVENT_AXIS_DISTANCE, distance); - if (mCalibration.coverageCalibration == Calibration::COVERAGE_CALIBRATION_BOX) { - out.setAxisValue(AMOTION_EVENT_AXIS_GENERIC_1, left); - out.setAxisValue(AMOTION_EVENT_AXIS_GENERIC_2, top); - out.setAxisValue(AMOTION_EVENT_AXIS_GENERIC_3, right); - out.setAxisValue(AMOTION_EVENT_AXIS_GENERIC_4, bottom); - } else { - out.setAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR, toolMajor); - out.setAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR, toolMinor); - } - - // Write output properties. - PointerProperties& properties = - mCurrentCookedState.cookedPointerData.pointerProperties[i]; - uint32_t id = in.id; - properties.clear(); - properties.id = id; - properties.toolType = in.toolType; - - // Write id index. - mCurrentCookedState.cookedPointerData.idToIndex[id] = i; - } -} - -void TouchInputMapper::dispatchPointerUsage(nsecs_t when, uint32_t policyFlags, - PointerUsage pointerUsage) { - if (pointerUsage != mPointerUsage) { - abortPointerUsage(when, policyFlags); - mPointerUsage = pointerUsage; - } - - switch (mPointerUsage) { - case POINTER_USAGE_GESTURES: - dispatchPointerGestures(when, policyFlags, false /*isTimeout*/); - break; - case POINTER_USAGE_STYLUS: - dispatchPointerStylus(when, policyFlags); - break; - case POINTER_USAGE_MOUSE: - dispatchPointerMouse(when, policyFlags); - break; - default: - break; - } -} - -void TouchInputMapper::abortPointerUsage(nsecs_t when, uint32_t policyFlags) { - switch (mPointerUsage) { - case POINTER_USAGE_GESTURES: - abortPointerGestures(when, policyFlags); - break; - case POINTER_USAGE_STYLUS: - abortPointerStylus(when, policyFlags); - break; - case POINTER_USAGE_MOUSE: - abortPointerMouse(when, policyFlags); - break; - default: - break; - } - - mPointerUsage = POINTER_USAGE_NONE; -} - -void TouchInputMapper::dispatchPointerGestures(nsecs_t when, uint32_t policyFlags, - bool isTimeout) { - // Update current gesture coordinates. - bool cancelPreviousGesture, finishPreviousGesture; - bool sendEvents = preparePointerGestures(when, - &cancelPreviousGesture, &finishPreviousGesture, isTimeout); - if (!sendEvents) { - return; - } - if (finishPreviousGesture) { - cancelPreviousGesture = false; - } - - // Update the pointer presentation and spots. - if (mParameters.gestureMode == Parameters::GESTURE_MODE_SPOTS) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_SPOT); - if (finishPreviousGesture || cancelPreviousGesture) { - mPointerController->clearSpots(); - } - mPointerController->setSpots(mPointerGesture.currentGestureCoords, - mPointerGesture.currentGestureIdToIndex, - mPointerGesture.currentGestureIdBits); - } else { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER); - } - - // Show or hide the pointer if needed. - switch (mPointerGesture.currentGestureMode) { - case PointerGesture::NEUTRAL: - case PointerGesture::QUIET: - if (mParameters.gestureMode == Parameters::GESTURE_MODE_SPOTS - && (mPointerGesture.lastGestureMode == PointerGesture::SWIPE - || mPointerGesture.lastGestureMode == PointerGesture::FREEFORM)) { - // Remind the user of where the pointer is after finishing a gesture with spots. - mPointerController->unfade(PointerControllerInterface::TRANSITION_GRADUAL); - } - break; - case PointerGesture::TAP: - case PointerGesture::TAP_DRAG: - case PointerGesture::BUTTON_CLICK_OR_DRAG: - case PointerGesture::HOVER: - case PointerGesture::PRESS: - // Unfade the pointer when the current gesture manipulates the - // area directly under the pointer. - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); - break; - case PointerGesture::SWIPE: - case PointerGesture::FREEFORM: - // Fade the pointer when the current gesture manipulates a different - // area and there are spots to guide the user experience. - if (mParameters.gestureMode == Parameters::GESTURE_MODE_SPOTS) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - } else { - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); - } - break; - } - - // Send events! - int32_t metaState = getContext()->getGlobalMetaState(); - int32_t buttonState = mCurrentCookedState.buttonState; - - // Update last coordinates of pointers that have moved so that we observe the new - // pointer positions at the same time as other pointers that have just gone up. - bool down = mPointerGesture.currentGestureMode == PointerGesture::TAP - || mPointerGesture.currentGestureMode == PointerGesture::TAP_DRAG - || mPointerGesture.currentGestureMode == PointerGesture::BUTTON_CLICK_OR_DRAG - || mPointerGesture.currentGestureMode == PointerGesture::PRESS - || mPointerGesture.currentGestureMode == PointerGesture::SWIPE - || mPointerGesture.currentGestureMode == PointerGesture::FREEFORM; - bool moveNeeded = false; - if (down && !cancelPreviousGesture && !finishPreviousGesture - && !mPointerGesture.lastGestureIdBits.isEmpty() - && !mPointerGesture.currentGestureIdBits.isEmpty()) { - BitSet32 movedGestureIdBits(mPointerGesture.currentGestureIdBits.value - & mPointerGesture.lastGestureIdBits.value); - moveNeeded = updateMovedPointers(mPointerGesture.currentGestureProperties, - mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex, - mPointerGesture.lastGestureProperties, - mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex, - movedGestureIdBits); - if (buttonState != mLastCookedState.buttonState) { - moveNeeded = true; - } - } - - // Send motion events for all pointers that went up or were canceled. - BitSet32 dispatchedGestureIdBits(mPointerGesture.lastGestureIdBits); - if (!dispatchedGestureIdBits.isEmpty()) { - if (cancelPreviousGesture) { - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_CANCEL, 0, 0, metaState, buttonState, - AMOTION_EVENT_EDGE_FLAG_NONE, - mPointerGesture.lastGestureProperties, - mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex, - dispatchedGestureIdBits, -1, 0, - 0, mPointerGesture.downTime); - - dispatchedGestureIdBits.clear(); - } else { - BitSet32 upGestureIdBits; - if (finishPreviousGesture) { - upGestureIdBits = dispatchedGestureIdBits; - } else { - upGestureIdBits.value = dispatchedGestureIdBits.value - & ~mPointerGesture.currentGestureIdBits.value; - } - while (!upGestureIdBits.isEmpty()) { - uint32_t id = upGestureIdBits.clearFirstMarkedBit(); - - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_POINTER_UP, 0, 0, - metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - mPointerGesture.lastGestureProperties, - mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex, - dispatchedGestureIdBits, id, - 0, 0, mPointerGesture.downTime); - - dispatchedGestureIdBits.clearBit(id); - } - } - } - - // Send motion events for all pointers that moved. - if (moveNeeded) { - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_MOVE, 0, 0, metaState, buttonState, - AMOTION_EVENT_EDGE_FLAG_NONE, - mPointerGesture.currentGestureProperties, - mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex, - dispatchedGestureIdBits, -1, - 0, 0, mPointerGesture.downTime); - } - - // Send motion events for all pointers that went down. - if (down) { - BitSet32 downGestureIdBits(mPointerGesture.currentGestureIdBits.value - & ~dispatchedGestureIdBits.value); - while (!downGestureIdBits.isEmpty()) { - uint32_t id = downGestureIdBits.clearFirstMarkedBit(); - dispatchedGestureIdBits.markBit(id); - - if (dispatchedGestureIdBits.count() == 1) { - mPointerGesture.downTime = when; - } - - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_POINTER_DOWN, 0, 0, metaState, buttonState, 0, - mPointerGesture.currentGestureProperties, - mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex, - dispatchedGestureIdBits, id, - 0, 0, mPointerGesture.downTime); - } - } - - // Send motion events for hover. - if (mPointerGesture.currentGestureMode == PointerGesture::HOVER) { - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_HOVER_MOVE, 0, 0, - metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - mPointerGesture.currentGestureProperties, - mPointerGesture.currentGestureCoords, mPointerGesture.currentGestureIdToIndex, - mPointerGesture.currentGestureIdBits, -1, - 0, 0, mPointerGesture.downTime); - } else if (dispatchedGestureIdBits.isEmpty() - && !mPointerGesture.lastGestureIdBits.isEmpty()) { - // Synthesize a hover move event after all pointers go up to indicate that - // the pointer is hovering again even if the user is not currently touching - // the touch pad. This ensures that a view will receive a fresh hover enter - // event after a tap. - float x, y; - mPointerController->getPosition(&x, &y); - - PointerProperties pointerProperties; - pointerProperties.clear(); - pointerProperties.id = 0; - pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; - - PointerCoords pointerCoords; - pointerCoords.clear(); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); - - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_HOVER_MOVE, 0, 0, - metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - mViewport.displayId, 1, &pointerProperties, &pointerCoords, - 0, 0, mPointerGesture.downTime); - getListener()->notifyMotion(&args); - } - - // Update state. - mPointerGesture.lastGestureMode = mPointerGesture.currentGestureMode; - if (!down) { - mPointerGesture.lastGestureIdBits.clear(); - } else { - mPointerGesture.lastGestureIdBits = mPointerGesture.currentGestureIdBits; - for (BitSet32 idBits(mPointerGesture.currentGestureIdBits); !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - uint32_t index = mPointerGesture.currentGestureIdToIndex[id]; - mPointerGesture.lastGestureProperties[index].copyFrom( - mPointerGesture.currentGestureProperties[index]); - mPointerGesture.lastGestureCoords[index].copyFrom( - mPointerGesture.currentGestureCoords[index]); - mPointerGesture.lastGestureIdToIndex[id] = index; - } - } -} - -void TouchInputMapper::abortPointerGestures(nsecs_t when, uint32_t policyFlags) { - // Cancel previously dispatches pointers. - if (!mPointerGesture.lastGestureIdBits.isEmpty()) { - int32_t metaState = getContext()->getGlobalMetaState(); - int32_t buttonState = mCurrentRawState.buttonState; - dispatchMotion(when, policyFlags, mSource, - AMOTION_EVENT_ACTION_CANCEL, 0, 0, metaState, buttonState, - AMOTION_EVENT_EDGE_FLAG_NONE, - mPointerGesture.lastGestureProperties, - mPointerGesture.lastGestureCoords, mPointerGesture.lastGestureIdToIndex, - mPointerGesture.lastGestureIdBits, -1, - 0, 0, mPointerGesture.downTime); - } - - // Reset the current pointer gesture. - mPointerGesture.reset(); - mPointerVelocityControl.reset(); - - // Remove any current spots. - if (mPointerController != NULL) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - mPointerController->clearSpots(); - } -} - -bool TouchInputMapper::preparePointerGestures(nsecs_t when, - bool* outCancelPreviousGesture, bool* outFinishPreviousGesture, bool isTimeout) { - *outCancelPreviousGesture = false; - *outFinishPreviousGesture = false; - - // Handle TAP timeout. - if (isTimeout) { -#if DEBUG_GESTURES - ALOGD("Gestures: Processing timeout"); -#endif - - if (mPointerGesture.lastGestureMode == PointerGesture::TAP) { - if (when <= mPointerGesture.tapUpTime + mConfig.pointerGestureTapDragInterval) { - // The tap/drag timeout has not yet expired. - getContext()->requestTimeoutAtTime(mPointerGesture.tapUpTime - + mConfig.pointerGestureTapDragInterval); - } else { - // The tap is finished. -#if DEBUG_GESTURES - ALOGD("Gestures: TAP finished"); -#endif - *outFinishPreviousGesture = true; - - mPointerGesture.activeGestureId = -1; - mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL; - mPointerGesture.currentGestureIdBits.clear(); - - mPointerVelocityControl.reset(); - return true; - } - } - - // We did not handle this timeout. - return false; - } - - const uint32_t currentFingerCount = mCurrentCookedState.fingerIdBits.count(); - const uint32_t lastFingerCount = mLastCookedState.fingerIdBits.count(); - - // Update the velocity tracker. - { - VelocityTracker::Position positions[MAX_POINTERS]; - uint32_t count = 0; - for (BitSet32 idBits(mCurrentCookedState.fingerIdBits); !idBits.isEmpty(); count++) { - uint32_t id = idBits.clearFirstMarkedBit(); - const RawPointerData::Pointer& pointer = - mCurrentRawState.rawPointerData.pointerForId(id); - positions[count].x = pointer.x * mPointerXMovementScale; - positions[count].y = pointer.y * mPointerYMovementScale; - } - mPointerGesture.velocityTracker.addMovement(when, - mCurrentCookedState.fingerIdBits, positions); - } - - // If the gesture ever enters a mode other than TAP, HOVER or TAP_DRAG, without first returning - // to NEUTRAL, then we should not generate tap event. - if (mPointerGesture.lastGestureMode != PointerGesture::HOVER - && mPointerGesture.lastGestureMode != PointerGesture::TAP - && mPointerGesture.lastGestureMode != PointerGesture::TAP_DRAG) { - mPointerGesture.resetTap(); - } - - // Pick a new active touch id if needed. - // Choose an arbitrary pointer that just went down, if there is one. - // Otherwise choose an arbitrary remaining pointer. - // This guarantees we always have an active touch id when there is at least one pointer. - // We keep the same active touch id for as long as possible. - bool activeTouchChanged = false; - int32_t lastActiveTouchId = mPointerGesture.activeTouchId; - int32_t activeTouchId = lastActiveTouchId; - if (activeTouchId < 0) { - if (!mCurrentCookedState.fingerIdBits.isEmpty()) { - activeTouchChanged = true; - activeTouchId = mPointerGesture.activeTouchId = - mCurrentCookedState.fingerIdBits.firstMarkedBit(); - mPointerGesture.firstTouchTime = when; - } - } else if (!mCurrentCookedState.fingerIdBits.hasBit(activeTouchId)) { - activeTouchChanged = true; - if (!mCurrentCookedState.fingerIdBits.isEmpty()) { - activeTouchId = mPointerGesture.activeTouchId = - mCurrentCookedState.fingerIdBits.firstMarkedBit(); - } else { - activeTouchId = mPointerGesture.activeTouchId = -1; - } - } - - // Determine whether we are in quiet time. - bool isQuietTime = false; - if (activeTouchId < 0) { - mPointerGesture.resetQuietTime(); - } else { - isQuietTime = when < mPointerGesture.quietTime + mConfig.pointerGestureQuietInterval; - if (!isQuietTime) { - if ((mPointerGesture.lastGestureMode == PointerGesture::PRESS - || mPointerGesture.lastGestureMode == PointerGesture::SWIPE - || mPointerGesture.lastGestureMode == PointerGesture::FREEFORM) - && currentFingerCount < 2) { - // Enter quiet time when exiting swipe or freeform state. - // This is to prevent accidentally entering the hover state and flinging the - // pointer when finishing a swipe and there is still one pointer left onscreen. - isQuietTime = true; - } else if (mPointerGesture.lastGestureMode == PointerGesture::BUTTON_CLICK_OR_DRAG - && currentFingerCount >= 2 - && !isPointerDown(mCurrentRawState.buttonState)) { - // Enter quiet time when releasing the button and there are still two or more - // fingers down. This may indicate that one finger was used to press the button - // but it has not gone up yet. - isQuietTime = true; - } - if (isQuietTime) { - mPointerGesture.quietTime = when; - } - } - } - - // Switch states based on button and pointer state. - if (isQuietTime) { - // Case 1: Quiet time. (QUIET) -#if DEBUG_GESTURES - ALOGD("Gestures: QUIET for next %0.3fms", (mPointerGesture.quietTime - + mConfig.pointerGestureQuietInterval - when) * 0.000001f); -#endif - if (mPointerGesture.lastGestureMode != PointerGesture::QUIET) { - *outFinishPreviousGesture = true; - } - - mPointerGesture.activeGestureId = -1; - mPointerGesture.currentGestureMode = PointerGesture::QUIET; - mPointerGesture.currentGestureIdBits.clear(); - - mPointerVelocityControl.reset(); - } else if (isPointerDown(mCurrentRawState.buttonState)) { - // Case 2: Button is pressed. (BUTTON_CLICK_OR_DRAG) - // The pointer follows the active touch point. - // Emit DOWN, MOVE, UP events at the pointer location. - // - // Only the active touch matters; other fingers are ignored. This policy helps - // to handle the case where the user places a second finger on the touch pad - // to apply the necessary force to depress an integrated button below the surface. - // We don't want the second finger to be delivered to applications. - // - // For this to work well, we need to make sure to track the pointer that is really - // active. If the user first puts one finger down to click then adds another - // finger to drag then the active pointer should switch to the finger that is - // being dragged. -#if DEBUG_GESTURES - ALOGD("Gestures: BUTTON_CLICK_OR_DRAG activeTouchId=%d, " - "currentFingerCount=%d", activeTouchId, currentFingerCount); -#endif - // Reset state when just starting. - if (mPointerGesture.lastGestureMode != PointerGesture::BUTTON_CLICK_OR_DRAG) { - *outFinishPreviousGesture = true; - mPointerGesture.activeGestureId = 0; - } - - // Switch pointers if needed. - // Find the fastest pointer and follow it. - if (activeTouchId >= 0 && currentFingerCount > 1) { - int32_t bestId = -1; - float bestSpeed = mConfig.pointerGestureDragMinSwitchSpeed; - for (BitSet32 idBits(mCurrentCookedState.fingerIdBits); !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - float vx, vy; - if (mPointerGesture.velocityTracker.getVelocity(id, &vx, &vy)) { - float speed = hypotf(vx, vy); - if (speed > bestSpeed) { - bestId = id; - bestSpeed = speed; - } - } - } - if (bestId >= 0 && bestId != activeTouchId) { - mPointerGesture.activeTouchId = activeTouchId = bestId; - activeTouchChanged = true; -#if DEBUG_GESTURES - ALOGD("Gestures: BUTTON_CLICK_OR_DRAG switched pointers, " - "bestId=%d, bestSpeed=%0.3f", bestId, bestSpeed); -#endif - } - } - - if (activeTouchId >= 0 && mLastCookedState.fingerIdBits.hasBit(activeTouchId)) { - const RawPointerData::Pointer& currentPointer = - mCurrentRawState.rawPointerData.pointerForId(activeTouchId); - const RawPointerData::Pointer& lastPointer = - mLastRawState.rawPointerData.pointerForId(activeTouchId); - float deltaX = (currentPointer.x - lastPointer.x) * mPointerXMovementScale; - float deltaY = (currentPointer.y - lastPointer.y) * mPointerYMovementScale; - - rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); - mPointerVelocityControl.move(when, &deltaX, &deltaY); - - // Move the pointer using a relative motion. - // When using spots, the click will occur at the position of the anchor - // spot and all other spots will move there. - mPointerController->move(deltaX, deltaY); - } else { - mPointerVelocityControl.reset(); - } - - float x, y; - mPointerController->getPosition(&x, &y); - - mPointerGesture.currentGestureMode = PointerGesture::BUTTON_CLICK_OR_DRAG; - mPointerGesture.currentGestureIdBits.clear(); - mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId); - mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0; - mPointerGesture.currentGestureProperties[0].clear(); - mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId; - mPointerGesture.currentGestureProperties[0].toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; - mPointerGesture.currentGestureCoords[0].clear(); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f); - } else if (currentFingerCount == 0) { - // Case 3. No fingers down and button is not pressed. (NEUTRAL) - if (mPointerGesture.lastGestureMode != PointerGesture::NEUTRAL) { - *outFinishPreviousGesture = true; - } - - // Watch for taps coming out of HOVER or TAP_DRAG mode. - // Checking for taps after TAP_DRAG allows us to detect double-taps. - bool tapped = false; - if ((mPointerGesture.lastGestureMode == PointerGesture::HOVER - || mPointerGesture.lastGestureMode == PointerGesture::TAP_DRAG) - && lastFingerCount == 1) { - if (when <= mPointerGesture.tapDownTime + mConfig.pointerGestureTapInterval) { - float x, y; - mPointerController->getPosition(&x, &y); - if (fabs(x - mPointerGesture.tapX) <= mConfig.pointerGestureTapSlop - && fabs(y - mPointerGesture.tapY) <= mConfig.pointerGestureTapSlop) { -#if DEBUG_GESTURES - ALOGD("Gestures: TAP"); -#endif - - mPointerGesture.tapUpTime = when; - getContext()->requestTimeoutAtTime(when - + mConfig.pointerGestureTapDragInterval); - - mPointerGesture.activeGestureId = 0; - mPointerGesture.currentGestureMode = PointerGesture::TAP; - mPointerGesture.currentGestureIdBits.clear(); - mPointerGesture.currentGestureIdBits.markBit( - mPointerGesture.activeGestureId); - mPointerGesture.currentGestureIdToIndex[ - mPointerGesture.activeGestureId] = 0; - mPointerGesture.currentGestureProperties[0].clear(); - mPointerGesture.currentGestureProperties[0].id = - mPointerGesture.activeGestureId; - mPointerGesture.currentGestureProperties[0].toolType = - AMOTION_EVENT_TOOL_TYPE_FINGER; - mPointerGesture.currentGestureCoords[0].clear(); - mPointerGesture.currentGestureCoords[0].setAxisValue( - AMOTION_EVENT_AXIS_X, mPointerGesture.tapX); - mPointerGesture.currentGestureCoords[0].setAxisValue( - AMOTION_EVENT_AXIS_Y, mPointerGesture.tapY); - mPointerGesture.currentGestureCoords[0].setAxisValue( - AMOTION_EVENT_AXIS_PRESSURE, 1.0f); - - tapped = true; - } else { -#if DEBUG_GESTURES - ALOGD("Gestures: Not a TAP, deltaX=%f, deltaY=%f", - x - mPointerGesture.tapX, - y - mPointerGesture.tapY); -#endif - } - } else { -#if DEBUG_GESTURES - if (mPointerGesture.tapDownTime != LLONG_MIN) { - ALOGD("Gestures: Not a TAP, %0.3fms since down", - (when - mPointerGesture.tapDownTime) * 0.000001f); - } else { - ALOGD("Gestures: Not a TAP, incompatible mode transitions"); - } -#endif - } - } - - mPointerVelocityControl.reset(); - - if (!tapped) { -#if DEBUG_GESTURES - ALOGD("Gestures: NEUTRAL"); -#endif - mPointerGesture.activeGestureId = -1; - mPointerGesture.currentGestureMode = PointerGesture::NEUTRAL; - mPointerGesture.currentGestureIdBits.clear(); - } - } else if (currentFingerCount == 1) { - // Case 4. Exactly one finger down, button is not pressed. (HOVER or TAP_DRAG) - // The pointer follows the active touch point. - // When in HOVER, emit HOVER_MOVE events at the pointer location. - // When in TAP_DRAG, emit MOVE events at the pointer location. - ALOG_ASSERT(activeTouchId >= 0); - - mPointerGesture.currentGestureMode = PointerGesture::HOVER; - if (mPointerGesture.lastGestureMode == PointerGesture::TAP) { - if (when <= mPointerGesture.tapUpTime + mConfig.pointerGestureTapDragInterval) { - float x, y; - mPointerController->getPosition(&x, &y); - if (fabs(x - mPointerGesture.tapX) <= mConfig.pointerGestureTapSlop - && fabs(y - mPointerGesture.tapY) <= mConfig.pointerGestureTapSlop) { - mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG; - } else { -#if DEBUG_GESTURES - ALOGD("Gestures: Not a TAP_DRAG, deltaX=%f, deltaY=%f", - x - mPointerGesture.tapX, - y - mPointerGesture.tapY); -#endif - } - } else { -#if DEBUG_GESTURES - ALOGD("Gestures: Not a TAP_DRAG, %0.3fms time since up", - (when - mPointerGesture.tapUpTime) * 0.000001f); -#endif - } - } else if (mPointerGesture.lastGestureMode == PointerGesture::TAP_DRAG) { - mPointerGesture.currentGestureMode = PointerGesture::TAP_DRAG; - } - - if (mLastCookedState.fingerIdBits.hasBit(activeTouchId)) { - const RawPointerData::Pointer& currentPointer = - mCurrentRawState.rawPointerData.pointerForId(activeTouchId); - const RawPointerData::Pointer& lastPointer = - mLastRawState.rawPointerData.pointerForId(activeTouchId); - float deltaX = (currentPointer.x - lastPointer.x) - * mPointerXMovementScale; - float deltaY = (currentPointer.y - lastPointer.y) - * mPointerYMovementScale; - - rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); - mPointerVelocityControl.move(when, &deltaX, &deltaY); - - // Move the pointer using a relative motion. - // When using spots, the hover or drag will occur at the position of the anchor spot. - mPointerController->move(deltaX, deltaY); - } else { - mPointerVelocityControl.reset(); - } - - bool down; - if (mPointerGesture.currentGestureMode == PointerGesture::TAP_DRAG) { -#if DEBUG_GESTURES - ALOGD("Gestures: TAP_DRAG"); -#endif - down = true; - } else { -#if DEBUG_GESTURES - ALOGD("Gestures: HOVER"); -#endif - if (mPointerGesture.lastGestureMode != PointerGesture::HOVER) { - *outFinishPreviousGesture = true; - } - mPointerGesture.activeGestureId = 0; - down = false; - } - - float x, y; - mPointerController->getPosition(&x, &y); - - mPointerGesture.currentGestureIdBits.clear(); - mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId); - mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0; - mPointerGesture.currentGestureProperties[0].clear(); - mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId; - mPointerGesture.currentGestureProperties[0].toolType = - AMOTION_EVENT_TOOL_TYPE_FINGER; - mPointerGesture.currentGestureCoords[0].clear(); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, x); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, y); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, - down ? 1.0f : 0.0f); - - if (lastFingerCount == 0 && currentFingerCount != 0) { - mPointerGesture.resetTap(); - mPointerGesture.tapDownTime = when; - mPointerGesture.tapX = x; - mPointerGesture.tapY = y; - } - } else { - // Case 5. At least two fingers down, button is not pressed. (PRESS, SWIPE or FREEFORM) - // We need to provide feedback for each finger that goes down so we cannot wait - // for the fingers to move before deciding what to do. - // - // The ambiguous case is deciding what to do when there are two fingers down but they - // have not moved enough to determine whether they are part of a drag or part of a - // freeform gesture, or just a press or long-press at the pointer location. - // - // When there are two fingers we start with the PRESS hypothesis and we generate a - // down at the pointer location. - // - // When the two fingers move enough or when additional fingers are added, we make - // a decision to transition into SWIPE or FREEFORM mode accordingly. - ALOG_ASSERT(activeTouchId >= 0); - - bool settled = when >= mPointerGesture.firstTouchTime - + mConfig.pointerGestureMultitouchSettleInterval; - if (mPointerGesture.lastGestureMode != PointerGesture::PRESS - && mPointerGesture.lastGestureMode != PointerGesture::SWIPE - && mPointerGesture.lastGestureMode != PointerGesture::FREEFORM) { - *outFinishPreviousGesture = true; - } else if (!settled && currentFingerCount > lastFingerCount) { - // Additional pointers have gone down but not yet settled. - // Reset the gesture. -#if DEBUG_GESTURES - ALOGD("Gestures: Resetting gesture since additional pointers went down for MULTITOUCH, " - "settle time remaining %0.3fms", (mPointerGesture.firstTouchTime - + mConfig.pointerGestureMultitouchSettleInterval - when) - * 0.000001f); -#endif - *outCancelPreviousGesture = true; - } else { - // Continue previous gesture. - mPointerGesture.currentGestureMode = mPointerGesture.lastGestureMode; - } - - if (*outFinishPreviousGesture || *outCancelPreviousGesture) { - mPointerGesture.currentGestureMode = PointerGesture::PRESS; - mPointerGesture.activeGestureId = 0; - mPointerGesture.referenceIdBits.clear(); - mPointerVelocityControl.reset(); - - // Use the centroid and pointer location as the reference points for the gesture. -#if DEBUG_GESTURES - ALOGD("Gestures: Using centroid as reference for MULTITOUCH, " - "settle time remaining %0.3fms", (mPointerGesture.firstTouchTime - + mConfig.pointerGestureMultitouchSettleInterval - when) - * 0.000001f); -#endif - mCurrentRawState.rawPointerData.getCentroidOfTouchingPointers( - &mPointerGesture.referenceTouchX, - &mPointerGesture.referenceTouchY); - mPointerController->getPosition(&mPointerGesture.referenceGestureX, - &mPointerGesture.referenceGestureY); - } - - // Clear the reference deltas for fingers not yet included in the reference calculation. - for (BitSet32 idBits(mCurrentCookedState.fingerIdBits.value - & ~mPointerGesture.referenceIdBits.value); !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - mPointerGesture.referenceDeltas[id].dx = 0; - mPointerGesture.referenceDeltas[id].dy = 0; - } - mPointerGesture.referenceIdBits = mCurrentCookedState.fingerIdBits; - - // Add delta for all fingers and calculate a common movement delta. - float commonDeltaX = 0, commonDeltaY = 0; - BitSet32 commonIdBits(mLastCookedState.fingerIdBits.value - & mCurrentCookedState.fingerIdBits.value); - for (BitSet32 idBits(commonIdBits); !idBits.isEmpty(); ) { - bool first = (idBits == commonIdBits); - uint32_t id = idBits.clearFirstMarkedBit(); - const RawPointerData::Pointer& cpd = mCurrentRawState.rawPointerData.pointerForId(id); - const RawPointerData::Pointer& lpd = mLastRawState.rawPointerData.pointerForId(id); - PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id]; - delta.dx += cpd.x - lpd.x; - delta.dy += cpd.y - lpd.y; - - if (first) { - commonDeltaX = delta.dx; - commonDeltaY = delta.dy; - } else { - commonDeltaX = calculateCommonVector(commonDeltaX, delta.dx); - commonDeltaY = calculateCommonVector(commonDeltaY, delta.dy); - } - } - - // Consider transitions from PRESS to SWIPE or MULTITOUCH. - if (mPointerGesture.currentGestureMode == PointerGesture::PRESS) { - float dist[MAX_POINTER_ID + 1]; - int32_t distOverThreshold = 0; - for (BitSet32 idBits(mPointerGesture.referenceIdBits); !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id]; - dist[id] = hypotf(delta.dx * mPointerXZoomScale, - delta.dy * mPointerYZoomScale); - if (dist[id] > mConfig.pointerGestureMultitouchMinDistance) { - distOverThreshold += 1; - } - } - - // Only transition when at least two pointers have moved further than - // the minimum distance threshold. - if (distOverThreshold >= 2) { - if (currentFingerCount > 2) { - // There are more than two pointers, switch to FREEFORM. -#if DEBUG_GESTURES - ALOGD("Gestures: PRESS transitioned to FREEFORM, number of pointers %d > 2", - currentFingerCount); -#endif - *outCancelPreviousGesture = true; - mPointerGesture.currentGestureMode = PointerGesture::FREEFORM; - } else { - // There are exactly two pointers. - BitSet32 idBits(mCurrentCookedState.fingerIdBits); - uint32_t id1 = idBits.clearFirstMarkedBit(); - uint32_t id2 = idBits.firstMarkedBit(); - const RawPointerData::Pointer& p1 = - mCurrentRawState.rawPointerData.pointerForId(id1); - const RawPointerData::Pointer& p2 = - mCurrentRawState.rawPointerData.pointerForId(id2); - float mutualDistance = distance(p1.x, p1.y, p2.x, p2.y); - if (mutualDistance > mPointerGestureMaxSwipeWidth) { - // There are two pointers but they are too far apart for a SWIPE, - // switch to FREEFORM. -#if DEBUG_GESTURES - ALOGD("Gestures: PRESS transitioned to FREEFORM, distance %0.3f > %0.3f", - mutualDistance, mPointerGestureMaxSwipeWidth); -#endif - *outCancelPreviousGesture = true; - mPointerGesture.currentGestureMode = PointerGesture::FREEFORM; - } else { - // There are two pointers. Wait for both pointers to start moving - // before deciding whether this is a SWIPE or FREEFORM gesture. - float dist1 = dist[id1]; - float dist2 = dist[id2]; - if (dist1 >= mConfig.pointerGestureMultitouchMinDistance - && dist2 >= mConfig.pointerGestureMultitouchMinDistance) { - // Calculate the dot product of the displacement vectors. - // When the vectors are oriented in approximately the same direction, - // the angle betweeen them is near zero and the cosine of the angle - // approches 1.0. Recall that dot(v1, v2) = cos(angle) * mag(v1) * mag(v2). - PointerGesture::Delta& delta1 = mPointerGesture.referenceDeltas[id1]; - PointerGesture::Delta& delta2 = mPointerGesture.referenceDeltas[id2]; - float dx1 = delta1.dx * mPointerXZoomScale; - float dy1 = delta1.dy * mPointerYZoomScale; - float dx2 = delta2.dx * mPointerXZoomScale; - float dy2 = delta2.dy * mPointerYZoomScale; - float dot = dx1 * dx2 + dy1 * dy2; - float cosine = dot / (dist1 * dist2); // denominator always > 0 - if (cosine >= mConfig.pointerGestureSwipeTransitionAngleCosine) { - // Pointers are moving in the same direction. Switch to SWIPE. -#if DEBUG_GESTURES - ALOGD("Gestures: PRESS transitioned to SWIPE, " - "dist1 %0.3f >= %0.3f, dist2 %0.3f >= %0.3f, " - "cosine %0.3f >= %0.3f", - dist1, mConfig.pointerGestureMultitouchMinDistance, - dist2, mConfig.pointerGestureMultitouchMinDistance, - cosine, mConfig.pointerGestureSwipeTransitionAngleCosine); -#endif - mPointerGesture.currentGestureMode = PointerGesture::SWIPE; - } else { - // Pointers are moving in different directions. Switch to FREEFORM. -#if DEBUG_GESTURES - ALOGD("Gestures: PRESS transitioned to FREEFORM, " - "dist1 %0.3f >= %0.3f, dist2 %0.3f >= %0.3f, " - "cosine %0.3f < %0.3f", - dist1, mConfig.pointerGestureMultitouchMinDistance, - dist2, mConfig.pointerGestureMultitouchMinDistance, - cosine, mConfig.pointerGestureSwipeTransitionAngleCosine); -#endif - *outCancelPreviousGesture = true; - mPointerGesture.currentGestureMode = PointerGesture::FREEFORM; - } - } - } - } - } - } else if (mPointerGesture.currentGestureMode == PointerGesture::SWIPE) { - // Switch from SWIPE to FREEFORM if additional pointers go down. - // Cancel previous gesture. - if (currentFingerCount > 2) { -#if DEBUG_GESTURES - ALOGD("Gestures: SWIPE transitioned to FREEFORM, number of pointers %d > 2", - currentFingerCount); -#endif - *outCancelPreviousGesture = true; - mPointerGesture.currentGestureMode = PointerGesture::FREEFORM; - } - } - - // Move the reference points based on the overall group motion of the fingers - // except in PRESS mode while waiting for a transition to occur. - if (mPointerGesture.currentGestureMode != PointerGesture::PRESS - && (commonDeltaX || commonDeltaY)) { - for (BitSet32 idBits(mPointerGesture.referenceIdBits); !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - PointerGesture::Delta& delta = mPointerGesture.referenceDeltas[id]; - delta.dx = 0; - delta.dy = 0; - } - - mPointerGesture.referenceTouchX += commonDeltaX; - mPointerGesture.referenceTouchY += commonDeltaY; - - commonDeltaX *= mPointerXMovementScale; - commonDeltaY *= mPointerYMovementScale; - - rotateDelta(mSurfaceOrientation, &commonDeltaX, &commonDeltaY); - mPointerVelocityControl.move(when, &commonDeltaX, &commonDeltaY); - - mPointerGesture.referenceGestureX += commonDeltaX; - mPointerGesture.referenceGestureY += commonDeltaY; - } - - // Report gestures. - if (mPointerGesture.currentGestureMode == PointerGesture::PRESS - || mPointerGesture.currentGestureMode == PointerGesture::SWIPE) { - // PRESS or SWIPE mode. -#if DEBUG_GESTURES - ALOGD("Gestures: PRESS or SWIPE activeTouchId=%d," - "activeGestureId=%d, currentTouchPointerCount=%d", - activeTouchId, mPointerGesture.activeGestureId, currentFingerCount); -#endif - ALOG_ASSERT(mPointerGesture.activeGestureId >= 0); - - mPointerGesture.currentGestureIdBits.clear(); - mPointerGesture.currentGestureIdBits.markBit(mPointerGesture.activeGestureId); - mPointerGesture.currentGestureIdToIndex[mPointerGesture.activeGestureId] = 0; - mPointerGesture.currentGestureProperties[0].clear(); - mPointerGesture.currentGestureProperties[0].id = mPointerGesture.activeGestureId; - mPointerGesture.currentGestureProperties[0].toolType = - AMOTION_EVENT_TOOL_TYPE_FINGER; - mPointerGesture.currentGestureCoords[0].clear(); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_X, - mPointerGesture.referenceGestureX); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_Y, - mPointerGesture.referenceGestureY); - mPointerGesture.currentGestureCoords[0].setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, 1.0f); - } else if (mPointerGesture.currentGestureMode == PointerGesture::FREEFORM) { - // FREEFORM mode. -#if DEBUG_GESTURES - ALOGD("Gestures: FREEFORM activeTouchId=%d," - "activeGestureId=%d, currentTouchPointerCount=%d", - activeTouchId, mPointerGesture.activeGestureId, currentFingerCount); -#endif - ALOG_ASSERT(mPointerGesture.activeGestureId >= 0); - - mPointerGesture.currentGestureIdBits.clear(); - - BitSet32 mappedTouchIdBits; - BitSet32 usedGestureIdBits; - if (mPointerGesture.lastGestureMode != PointerGesture::FREEFORM) { - // Initially, assign the active gesture id to the active touch point - // if there is one. No other touch id bits are mapped yet. - if (!*outCancelPreviousGesture) { - mappedTouchIdBits.markBit(activeTouchId); - usedGestureIdBits.markBit(mPointerGesture.activeGestureId); - mPointerGesture.freeformTouchToGestureIdMap[activeTouchId] = - mPointerGesture.activeGestureId; - } else { - mPointerGesture.activeGestureId = -1; - } - } else { - // Otherwise, assume we mapped all touches from the previous frame. - // Reuse all mappings that are still applicable. - mappedTouchIdBits.value = mLastCookedState.fingerIdBits.value - & mCurrentCookedState.fingerIdBits.value; - usedGestureIdBits = mPointerGesture.lastGestureIdBits; - - // Check whether we need to choose a new active gesture id because the - // current went went up. - for (BitSet32 upTouchIdBits(mLastCookedState.fingerIdBits.value - & ~mCurrentCookedState.fingerIdBits.value); - !upTouchIdBits.isEmpty(); ) { - uint32_t upTouchId = upTouchIdBits.clearFirstMarkedBit(); - uint32_t upGestureId = mPointerGesture.freeformTouchToGestureIdMap[upTouchId]; - if (upGestureId == uint32_t(mPointerGesture.activeGestureId)) { - mPointerGesture.activeGestureId = -1; - break; - } - } - } - -#if DEBUG_GESTURES - ALOGD("Gestures: FREEFORM follow up " - "mappedTouchIdBits=0x%08x, usedGestureIdBits=0x%08x, " - "activeGestureId=%d", - mappedTouchIdBits.value, usedGestureIdBits.value, - mPointerGesture.activeGestureId); -#endif - - BitSet32 idBits(mCurrentCookedState.fingerIdBits); - for (uint32_t i = 0; i < currentFingerCount; i++) { - uint32_t touchId = idBits.clearFirstMarkedBit(); - uint32_t gestureId; - if (!mappedTouchIdBits.hasBit(touchId)) { - gestureId = usedGestureIdBits.markFirstUnmarkedBit(); - mPointerGesture.freeformTouchToGestureIdMap[touchId] = gestureId; -#if DEBUG_GESTURES - ALOGD("Gestures: FREEFORM " - "new mapping for touch id %d -> gesture id %d", - touchId, gestureId); -#endif - } else { - gestureId = mPointerGesture.freeformTouchToGestureIdMap[touchId]; -#if DEBUG_GESTURES - ALOGD("Gestures: FREEFORM " - "existing mapping for touch id %d -> gesture id %d", - touchId, gestureId); -#endif - } - mPointerGesture.currentGestureIdBits.markBit(gestureId); - mPointerGesture.currentGestureIdToIndex[gestureId] = i; - - const RawPointerData::Pointer& pointer = - mCurrentRawState.rawPointerData.pointerForId(touchId); - float deltaX = (pointer.x - mPointerGesture.referenceTouchX) - * mPointerXZoomScale; - float deltaY = (pointer.y - mPointerGesture.referenceTouchY) - * mPointerYZoomScale; - rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); - - mPointerGesture.currentGestureProperties[i].clear(); - mPointerGesture.currentGestureProperties[i].id = gestureId; - mPointerGesture.currentGestureProperties[i].toolType = - AMOTION_EVENT_TOOL_TYPE_FINGER; - mPointerGesture.currentGestureCoords[i].clear(); - mPointerGesture.currentGestureCoords[i].setAxisValue( - AMOTION_EVENT_AXIS_X, mPointerGesture.referenceGestureX + deltaX); - mPointerGesture.currentGestureCoords[i].setAxisValue( - AMOTION_EVENT_AXIS_Y, mPointerGesture.referenceGestureY + deltaY); - mPointerGesture.currentGestureCoords[i].setAxisValue( - AMOTION_EVENT_AXIS_PRESSURE, 1.0f); - } - - if (mPointerGesture.activeGestureId < 0) { - mPointerGesture.activeGestureId = - mPointerGesture.currentGestureIdBits.firstMarkedBit(); -#if DEBUG_GESTURES - ALOGD("Gestures: FREEFORM new " - "activeGestureId=%d", mPointerGesture.activeGestureId); -#endif - } - } - } - - mPointerController->setButtonState(mCurrentRawState.buttonState); - -#if DEBUG_GESTURES - ALOGD("Gestures: finishPreviousGesture=%s, cancelPreviousGesture=%s, " - "currentGestureMode=%d, currentGestureIdBits=0x%08x, " - "lastGestureMode=%d, lastGestureIdBits=0x%08x", - toString(*outFinishPreviousGesture), toString(*outCancelPreviousGesture), - mPointerGesture.currentGestureMode, mPointerGesture.currentGestureIdBits.value, - mPointerGesture.lastGestureMode, mPointerGesture.lastGestureIdBits.value); - for (BitSet32 idBits = mPointerGesture.currentGestureIdBits; !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - uint32_t index = mPointerGesture.currentGestureIdToIndex[id]; - const PointerProperties& properties = mPointerGesture.currentGestureProperties[index]; - const PointerCoords& coords = mPointerGesture.currentGestureCoords[index]; - ALOGD(" currentGesture[%d]: index=%d, toolType=%d, " - "x=%0.3f, y=%0.3f, pressure=%0.3f", - id, index, properties.toolType, - coords.getAxisValue(AMOTION_EVENT_AXIS_X), - coords.getAxisValue(AMOTION_EVENT_AXIS_Y), - coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE)); - } - for (BitSet32 idBits = mPointerGesture.lastGestureIdBits; !idBits.isEmpty(); ) { - uint32_t id = idBits.clearFirstMarkedBit(); - uint32_t index = mPointerGesture.lastGestureIdToIndex[id]; - const PointerProperties& properties = mPointerGesture.lastGestureProperties[index]; - const PointerCoords& coords = mPointerGesture.lastGestureCoords[index]; - ALOGD(" lastGesture[%d]: index=%d, toolType=%d, " - "x=%0.3f, y=%0.3f, pressure=%0.3f", - id, index, properties.toolType, - coords.getAxisValue(AMOTION_EVENT_AXIS_X), - coords.getAxisValue(AMOTION_EVENT_AXIS_Y), - coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE)); - } -#endif - return true; -} - -void TouchInputMapper::dispatchPointerStylus(nsecs_t when, uint32_t policyFlags) { - mPointerSimple.currentCoords.clear(); - mPointerSimple.currentProperties.clear(); - - bool down, hovering; - if (!mCurrentCookedState.stylusIdBits.isEmpty()) { - uint32_t id = mCurrentCookedState.stylusIdBits.firstMarkedBit(); - uint32_t index = mCurrentCookedState.cookedPointerData.idToIndex[id]; - float x = mCurrentCookedState.cookedPointerData.pointerCoords[index].getX(); - float y = mCurrentCookedState.cookedPointerData.pointerCoords[index].getY(); - mPointerController->setPosition(x, y); - - hovering = mCurrentCookedState.cookedPointerData.hoveringIdBits.hasBit(id); - down = !hovering; - - mPointerController->getPosition(&x, &y); - mPointerSimple.currentCoords.copyFrom( - mCurrentCookedState.cookedPointerData.pointerCoords[index]); - mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); - mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); - mPointerSimple.currentProperties.id = 0; - mPointerSimple.currentProperties.toolType = - mCurrentCookedState.cookedPointerData.pointerProperties[index].toolType; - } else { - down = false; - hovering = false; - } - - dispatchPointerSimple(when, policyFlags, down, hovering); -} - -void TouchInputMapper::abortPointerStylus(nsecs_t when, uint32_t policyFlags) { - abortPointerSimple(when, policyFlags); -} - -void TouchInputMapper::dispatchPointerMouse(nsecs_t when, uint32_t policyFlags) { - mPointerSimple.currentCoords.clear(); - mPointerSimple.currentProperties.clear(); - - bool down, hovering; - if (!mCurrentCookedState.mouseIdBits.isEmpty()) { - uint32_t id = mCurrentCookedState.mouseIdBits.firstMarkedBit(); - uint32_t currentIndex = mCurrentRawState.rawPointerData.idToIndex[id]; - if (mLastCookedState.mouseIdBits.hasBit(id)) { - uint32_t lastIndex = mCurrentRawState.rawPointerData.idToIndex[id]; - float deltaX = (mCurrentRawState.rawPointerData.pointers[currentIndex].x - - mLastRawState.rawPointerData.pointers[lastIndex].x) - * mPointerXMovementScale; - float deltaY = (mCurrentRawState.rawPointerData.pointers[currentIndex].y - - mLastRawState.rawPointerData.pointers[lastIndex].y) - * mPointerYMovementScale; - - rotateDelta(mSurfaceOrientation, &deltaX, &deltaY); - mPointerVelocityControl.move(when, &deltaX, &deltaY); - - mPointerController->move(deltaX, deltaY); - } else { - mPointerVelocityControl.reset(); - } - - down = isPointerDown(mCurrentRawState.buttonState); - hovering = !down; - - float x, y; - mPointerController->getPosition(&x, &y); - mPointerSimple.currentCoords.copyFrom( - mCurrentCookedState.cookedPointerData.pointerCoords[currentIndex]); - mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_X, x); - mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_Y, y); - mPointerSimple.currentCoords.setAxisValue(AMOTION_EVENT_AXIS_PRESSURE, - hovering ? 0.0f : 1.0f); - mPointerSimple.currentProperties.id = 0; - mPointerSimple.currentProperties.toolType = - mCurrentCookedState.cookedPointerData.pointerProperties[currentIndex].toolType; - } else { - mPointerVelocityControl.reset(); - - down = false; - hovering = false; - } - - dispatchPointerSimple(when, policyFlags, down, hovering); -} - -void TouchInputMapper::abortPointerMouse(nsecs_t when, uint32_t policyFlags) { - abortPointerSimple(when, policyFlags); - - mPointerVelocityControl.reset(); -} - -void TouchInputMapper::dispatchPointerSimple(nsecs_t when, uint32_t policyFlags, - bool down, bool hovering) { - int32_t metaState = getContext()->getGlobalMetaState(); - - if (mPointerController != NULL) { - if (down || hovering) { - mPointerController->setPresentation(PointerControllerInterface::PRESENTATION_POINTER); - mPointerController->clearSpots(); - mPointerController->setButtonState(mCurrentRawState.buttonState); - mPointerController->unfade(PointerControllerInterface::TRANSITION_IMMEDIATE); - } else if (!down && !hovering && (mPointerSimple.down || mPointerSimple.hovering)) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - } - } - - if (mPointerSimple.down && !down) { - mPointerSimple.down = false; - - // Send up. - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_UP, 0, 0, metaState, mLastRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.lastProperties, &mPointerSimple.lastCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - if (mPointerSimple.hovering && !hovering) { - mPointerSimple.hovering = false; - - // Send hover exit. - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_HOVER_EXIT, 0, 0, metaState, mLastRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.lastProperties, &mPointerSimple.lastCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - if (down) { - if (!mPointerSimple.down) { - mPointerSimple.down = true; - mPointerSimple.downTime = when; - - // Send down. - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_DOWN, 0, 0, metaState, mCurrentRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.currentProperties, &mPointerSimple.currentCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - // Send move. - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_MOVE, 0, 0, metaState, mCurrentRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.currentProperties, &mPointerSimple.currentCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - if (hovering) { - if (!mPointerSimple.hovering) { - mPointerSimple.hovering = true; - - // Send hover enter. - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_HOVER_ENTER, 0, 0, metaState, - mCurrentRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.currentProperties, &mPointerSimple.currentCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - // Send hover move. - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_HOVER_MOVE, 0, 0, metaState, - mCurrentRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.currentProperties, &mPointerSimple.currentCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - if (mCurrentRawState.rawVScroll || mCurrentRawState.rawHScroll) { - float vscroll = mCurrentRawState.rawVScroll; - float hscroll = mCurrentRawState.rawHScroll; - mWheelYVelocityControl.move(when, NULL, &vscroll); - mWheelXVelocityControl.move(when, &hscroll, NULL); - - // Send scroll. - PointerCoords pointerCoords; - pointerCoords.copyFrom(mPointerSimple.currentCoords); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_VSCROLL, vscroll); - pointerCoords.setAxisValue(AMOTION_EVENT_AXIS_HSCROLL, hscroll); - - NotifyMotionArgs args(when, getDeviceId(), mSource, policyFlags, - AMOTION_EVENT_ACTION_SCROLL, 0, 0, metaState, mCurrentRawState.buttonState, 0, - mViewport.displayId, - 1, &mPointerSimple.currentProperties, &pointerCoords, - mOrientedXPrecision, mOrientedYPrecision, - mPointerSimple.downTime); - getListener()->notifyMotion(&args); - } - - // Save state. - if (down || hovering) { - mPointerSimple.lastCoords.copyFrom(mPointerSimple.currentCoords); - mPointerSimple.lastProperties.copyFrom(mPointerSimple.currentProperties); - } else { - mPointerSimple.reset(); - } -} - -void TouchInputMapper::abortPointerSimple(nsecs_t when, uint32_t policyFlags) { - mPointerSimple.currentCoords.clear(); - mPointerSimple.currentProperties.clear(); - - dispatchPointerSimple(when, policyFlags, false, false); -} - -void TouchInputMapper::dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source, - int32_t action, int32_t actionButton, int32_t flags, - int32_t metaState, int32_t buttonState, int32_t edgeFlags, - const PointerProperties* properties, const PointerCoords* coords, - const uint32_t* idToIndex, BitSet32 idBits, int32_t changedId, - float xPrecision, float yPrecision, nsecs_t downTime) { - PointerCoords pointerCoords[MAX_POINTERS]; - PointerProperties pointerProperties[MAX_POINTERS]; - uint32_t pointerCount = 0; - while (!idBits.isEmpty()) { - uint32_t id = idBits.clearFirstMarkedBit(); - uint32_t index = idToIndex[id]; - pointerProperties[pointerCount].copyFrom(properties[index]); - pointerCoords[pointerCount].copyFrom(coords[index]); - - if (changedId >= 0 && id == uint32_t(changedId)) { - action |= pointerCount << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT; - } - - pointerCount += 1; - } - - ALOG_ASSERT(pointerCount != 0); - - if (changedId >= 0 && pointerCount == 1) { - // Replace initial down and final up action. - // We can compare the action without masking off the changed pointer index - // because we know the index is 0. - if (action == AMOTION_EVENT_ACTION_POINTER_DOWN) { - action = AMOTION_EVENT_ACTION_DOWN; - } else if (action == AMOTION_EVENT_ACTION_POINTER_UP) { - action = AMOTION_EVENT_ACTION_UP; - } else { - // Can't happen. - ALOG_ASSERT(false); - } - } - - NotifyMotionArgs args(when, getDeviceId(), source, policyFlags, - action, actionButton, flags, metaState, buttonState, edgeFlags, - mViewport.displayId, pointerCount, pointerProperties, pointerCoords, - xPrecision, yPrecision, downTime); - getListener()->notifyMotion(&args); -} - -bool TouchInputMapper::updateMovedPointers(const PointerProperties* inProperties, - const PointerCoords* inCoords, const uint32_t* inIdToIndex, - PointerProperties* outProperties, PointerCoords* outCoords, const uint32_t* outIdToIndex, - BitSet32 idBits) const { - bool changed = false; - while (!idBits.isEmpty()) { - uint32_t id = idBits.clearFirstMarkedBit(); - uint32_t inIndex = inIdToIndex[id]; - uint32_t outIndex = outIdToIndex[id]; - - const PointerProperties& curInProperties = inProperties[inIndex]; - const PointerCoords& curInCoords = inCoords[inIndex]; - PointerProperties& curOutProperties = outProperties[outIndex]; - PointerCoords& curOutCoords = outCoords[outIndex]; - - if (curInProperties != curOutProperties) { - curOutProperties.copyFrom(curInProperties); - changed = true; - } - - if (curInCoords != curOutCoords) { - curOutCoords.copyFrom(curInCoords); - changed = true; - } - } - return changed; -} - -void TouchInputMapper::fadePointer() { - if (mPointerController != NULL) { - mPointerController->fade(PointerControllerInterface::TRANSITION_GRADUAL); - } -} - -void TouchInputMapper::cancelTouch(nsecs_t when) { - abortPointerUsage(when, 0 /*policyFlags*/); - abortTouches(when, 0 /* policyFlags*/); -} - -bool TouchInputMapper::isPointInsideSurface(int32_t x, int32_t y) { - return x >= mRawPointerAxes.x.minValue && x <= mRawPointerAxes.x.maxValue - && y >= mRawPointerAxes.y.minValue && y <= mRawPointerAxes.y.maxValue; -} - -const TouchInputMapper::VirtualKey* TouchInputMapper::findVirtualKeyHit( - int32_t x, int32_t y) { - size_t numVirtualKeys = mVirtualKeys.size(); - for (size_t i = 0; i < numVirtualKeys; i++) { - const VirtualKey& virtualKey = mVirtualKeys[i]; - -#if DEBUG_VIRTUAL_KEYS - ALOGD("VirtualKeys: Hit test (%d, %d): keyCode=%d, scanCode=%d, " - "left=%d, top=%d, right=%d, bottom=%d", - x, y, - virtualKey.keyCode, virtualKey.scanCode, - virtualKey.hitLeft, virtualKey.hitTop, - virtualKey.hitRight, virtualKey.hitBottom); -#endif - - if (virtualKey.isHit(x, y)) { - return & virtualKey; - } - } - - return NULL; -} - -void TouchInputMapper::assignPointerIds(const RawState* last, RawState* current) { - uint32_t currentPointerCount = current->rawPointerData.pointerCount; - uint32_t lastPointerCount = last->rawPointerData.pointerCount; - - current->rawPointerData.clearIdBits(); - - if (currentPointerCount == 0) { - // No pointers to assign. - return; - } - - if (lastPointerCount == 0) { - // All pointers are new. - for (uint32_t i = 0; i < currentPointerCount; i++) { - uint32_t id = i; - current->rawPointerData.pointers[i].id = id; - current->rawPointerData.idToIndex[id] = i; - current->rawPointerData.markIdBit(id, current->rawPointerData.isHovering(i)); - } - return; - } - - if (currentPointerCount == 1 && lastPointerCount == 1 - && current->rawPointerData.pointers[0].toolType - == last->rawPointerData.pointers[0].toolType) { - // Only one pointer and no change in count so it must have the same id as before. - uint32_t id = last->rawPointerData.pointers[0].id; - current->rawPointerData.pointers[0].id = id; - current->rawPointerData.idToIndex[id] = 0; - current->rawPointerData.markIdBit(id, current->rawPointerData.isHovering(0)); - return; - } - - // General case. - // We build a heap of squared euclidean distances between current and last pointers - // associated with the current and last pointer indices. Then, we find the best - // match (by distance) for each current pointer. - // The pointers must have the same tool type but it is possible for them to - // transition from hovering to touching or vice-versa while retaining the same id. - PointerDistanceHeapElement heap[MAX_POINTERS * MAX_POINTERS]; - - uint32_t heapSize = 0; - for (uint32_t currentPointerIndex = 0; currentPointerIndex < currentPointerCount; - currentPointerIndex++) { - for (uint32_t lastPointerIndex = 0; lastPointerIndex < lastPointerCount; - lastPointerIndex++) { - const RawPointerData::Pointer& currentPointer = - current->rawPointerData.pointers[currentPointerIndex]; - const RawPointerData::Pointer& lastPointer = - last->rawPointerData.pointers[lastPointerIndex]; - if (currentPointer.toolType == lastPointer.toolType) { - int64_t deltaX = currentPointer.x - lastPointer.x; - int64_t deltaY = currentPointer.y - lastPointer.y; - - uint64_t distance = uint64_t(deltaX * deltaX + deltaY * deltaY); - - // Insert new element into the heap (sift up). - heap[heapSize].currentPointerIndex = currentPointerIndex; - heap[heapSize].lastPointerIndex = lastPointerIndex; - heap[heapSize].distance = distance; - heapSize += 1; - } - } - } - - // Heapify - for (uint32_t startIndex = heapSize / 2; startIndex != 0; ) { - startIndex -= 1; - for (uint32_t parentIndex = startIndex; ;) { - uint32_t childIndex = parentIndex * 2 + 1; - if (childIndex >= heapSize) { - break; - } - - if (childIndex + 1 < heapSize - && heap[childIndex + 1].distance < heap[childIndex].distance) { - childIndex += 1; - } - - if (heap[parentIndex].distance <= heap[childIndex].distance) { - break; - } - - swap(heap[parentIndex], heap[childIndex]); - parentIndex = childIndex; - } - } - -#if DEBUG_POINTER_ASSIGNMENT - ALOGD("assignPointerIds - initial distance min-heap: size=%d", heapSize); - for (size_t i = 0; i < heapSize; i++) { - ALOGD(" heap[%d]: cur=%d, last=%d, distance=%lld", - i, heap[i].currentPointerIndex, heap[i].lastPointerIndex, - heap[i].distance); - } -#endif - - // Pull matches out by increasing order of distance. - // To avoid reassigning pointers that have already been matched, the loop keeps track - // of which last and current pointers have been matched using the matchedXXXBits variables. - // It also tracks the used pointer id bits. - BitSet32 matchedLastBits(0); - BitSet32 matchedCurrentBits(0); - BitSet32 usedIdBits(0); - bool first = true; - for (uint32_t i = min(currentPointerCount, lastPointerCount); heapSize > 0 && i > 0; i--) { - while (heapSize > 0) { - if (first) { - // The first time through the loop, we just consume the root element of - // the heap (the one with smallest distance). - first = false; - } else { - // Previous iterations consumed the root element of the heap. - // Pop root element off of the heap (sift down). - heap[0] = heap[heapSize]; - for (uint32_t parentIndex = 0; ;) { - uint32_t childIndex = parentIndex * 2 + 1; - if (childIndex >= heapSize) { - break; - } - - if (childIndex + 1 < heapSize - && heap[childIndex + 1].distance < heap[childIndex].distance) { - childIndex += 1; - } - - if (heap[parentIndex].distance <= heap[childIndex].distance) { - break; - } - - swap(heap[parentIndex], heap[childIndex]); - parentIndex = childIndex; - } - -#if DEBUG_POINTER_ASSIGNMENT - ALOGD("assignPointerIds - reduced distance min-heap: size=%d", heapSize); - for (size_t i = 0; i < heapSize; i++) { - ALOGD(" heap[%d]: cur=%d, last=%d, distance=%lld", - i, heap[i].currentPointerIndex, heap[i].lastPointerIndex, - heap[i].distance); - } -#endif - } - - heapSize -= 1; - - uint32_t currentPointerIndex = heap[0].currentPointerIndex; - if (matchedCurrentBits.hasBit(currentPointerIndex)) continue; // already matched - - uint32_t lastPointerIndex = heap[0].lastPointerIndex; - if (matchedLastBits.hasBit(lastPointerIndex)) continue; // already matched - - matchedCurrentBits.markBit(currentPointerIndex); - matchedLastBits.markBit(lastPointerIndex); - - uint32_t id = last->rawPointerData.pointers[lastPointerIndex].id; - current->rawPointerData.pointers[currentPointerIndex].id = id; - current->rawPointerData.idToIndex[id] = currentPointerIndex; - current->rawPointerData.markIdBit(id, - current->rawPointerData.isHovering(currentPointerIndex)); - usedIdBits.markBit(id); - -#if DEBUG_POINTER_ASSIGNMENT - ALOGD("assignPointerIds - matched: cur=%d, last=%d, id=%d, distance=%lld", - lastPointerIndex, currentPointerIndex, id, heap[0].distance); -#endif - break; - } - } - - // Assign fresh ids to pointers that were not matched in the process. - for (uint32_t i = currentPointerCount - matchedCurrentBits.count(); i != 0; i--) { - uint32_t currentPointerIndex = matchedCurrentBits.markFirstUnmarkedBit(); - uint32_t id = usedIdBits.markFirstUnmarkedBit(); - - current->rawPointerData.pointers[currentPointerIndex].id = id; - current->rawPointerData.idToIndex[id] = currentPointerIndex; - current->rawPointerData.markIdBit(id, - current->rawPointerData.isHovering(currentPointerIndex)); - -#if DEBUG_POINTER_ASSIGNMENT - ALOGD("assignPointerIds - assigned: cur=%d, id=%d", - currentPointerIndex, id); -#endif - } -} - -int32_t TouchInputMapper::getKeyCodeState(uint32_t sourceMask, int32_t keyCode) { - if (mCurrentVirtualKey.down && mCurrentVirtualKey.keyCode == keyCode) { - return AKEY_STATE_VIRTUAL; - } - - size_t numVirtualKeys = mVirtualKeys.size(); - for (size_t i = 0; i < numVirtualKeys; i++) { - const VirtualKey& virtualKey = mVirtualKeys[i]; - if (virtualKey.keyCode == keyCode) { - return AKEY_STATE_UP; - } - } - - return AKEY_STATE_UNKNOWN; -} - -int32_t TouchInputMapper::getScanCodeState(uint32_t sourceMask, int32_t scanCode) { - if (mCurrentVirtualKey.down && mCurrentVirtualKey.scanCode == scanCode) { - return AKEY_STATE_VIRTUAL; - } - - size_t numVirtualKeys = mVirtualKeys.size(); - for (size_t i = 0; i < numVirtualKeys; i++) { - const VirtualKey& virtualKey = mVirtualKeys[i]; - if (virtualKey.scanCode == scanCode) { - return AKEY_STATE_UP; - } - } - - return AKEY_STATE_UNKNOWN; -} - -bool TouchInputMapper::markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) { - size_t numVirtualKeys = mVirtualKeys.size(); - for (size_t i = 0; i < numVirtualKeys; i++) { - const VirtualKey& virtualKey = mVirtualKeys[i]; - - for (size_t i = 0; i < numCodes; i++) { - if (virtualKey.keyCode == keyCodes[i]) { - outFlags[i] = 1; - } - } - } - - return true; -} - - -// --- SingleTouchInputMapper --- - -SingleTouchInputMapper::SingleTouchInputMapper(InputDevice* device) : - TouchInputMapper(device) { -} - -SingleTouchInputMapper::~SingleTouchInputMapper() { -} - -void SingleTouchInputMapper::reset(nsecs_t when) { - mSingleTouchMotionAccumulator.reset(getDevice()); - - TouchInputMapper::reset(when); -} - -void SingleTouchInputMapper::process(const RawEvent* rawEvent) { - TouchInputMapper::process(rawEvent); - - mSingleTouchMotionAccumulator.process(rawEvent); -} - -void SingleTouchInputMapper::syncTouch(nsecs_t when, RawState* outState) { - if (mTouchButtonAccumulator.isToolActive()) { - outState->rawPointerData.pointerCount = 1; - outState->rawPointerData.idToIndex[0] = 0; - - bool isHovering = mTouchButtonAccumulator.getToolType() != AMOTION_EVENT_TOOL_TYPE_MOUSE - && (mTouchButtonAccumulator.isHovering() - || (mRawPointerAxes.pressure.valid - && mSingleTouchMotionAccumulator.getAbsolutePressure() <= 0)); - outState->rawPointerData.markIdBit(0, isHovering); - - RawPointerData::Pointer& outPointer = outState->rawPointerData.pointers[0]; - outPointer.id = 0; - outPointer.x = mSingleTouchMotionAccumulator.getAbsoluteX(); - outPointer.y = mSingleTouchMotionAccumulator.getAbsoluteY(); - outPointer.pressure = mSingleTouchMotionAccumulator.getAbsolutePressure(); - outPointer.touchMajor = 0; - outPointer.touchMinor = 0; - outPointer.toolMajor = mSingleTouchMotionAccumulator.getAbsoluteToolWidth(); - outPointer.toolMinor = mSingleTouchMotionAccumulator.getAbsoluteToolWidth(); - outPointer.orientation = 0; - outPointer.distance = mSingleTouchMotionAccumulator.getAbsoluteDistance(); - outPointer.tiltX = mSingleTouchMotionAccumulator.getAbsoluteTiltX(); - outPointer.tiltY = mSingleTouchMotionAccumulator.getAbsoluteTiltY(); - outPointer.toolType = mTouchButtonAccumulator.getToolType(); - if (outPointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { - outPointer.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; - } - outPointer.isHovering = isHovering; - } -} - -void SingleTouchInputMapper::configureRawPointerAxes() { - TouchInputMapper::configureRawPointerAxes(); - - getAbsoluteAxisInfo(ABS_X, &mRawPointerAxes.x); - getAbsoluteAxisInfo(ABS_Y, &mRawPointerAxes.y); - getAbsoluteAxisInfo(ABS_PRESSURE, &mRawPointerAxes.pressure); - getAbsoluteAxisInfo(ABS_TOOL_WIDTH, &mRawPointerAxes.toolMajor); - getAbsoluteAxisInfo(ABS_DISTANCE, &mRawPointerAxes.distance); - getAbsoluteAxisInfo(ABS_TILT_X, &mRawPointerAxes.tiltX); - getAbsoluteAxisInfo(ABS_TILT_Y, &mRawPointerAxes.tiltY); -} - -bool SingleTouchInputMapper::hasStylus() const { - return mTouchButtonAccumulator.hasStylus(); -} - - -// --- MultiTouchInputMapper --- - -MultiTouchInputMapper::MultiTouchInputMapper(InputDevice* device) : - TouchInputMapper(device) { -} - -MultiTouchInputMapper::~MultiTouchInputMapper() { -} - -void MultiTouchInputMapper::reset(nsecs_t when) { - mMultiTouchMotionAccumulator.reset(getDevice()); - - mPointerIdBits.clear(); - - TouchInputMapper::reset(when); -} - -void MultiTouchInputMapper::process(const RawEvent* rawEvent) { - TouchInputMapper::process(rawEvent); - - mMultiTouchMotionAccumulator.process(rawEvent); -} - -void MultiTouchInputMapper::syncTouch(nsecs_t when, RawState* outState) { - size_t inCount = mMultiTouchMotionAccumulator.getSlotCount(); - size_t outCount = 0; - BitSet32 newPointerIdBits; - - for (size_t inIndex = 0; inIndex < inCount; inIndex++) { - const MultiTouchMotionAccumulator::Slot* inSlot = - mMultiTouchMotionAccumulator.getSlot(inIndex); - if (!inSlot->isInUse()) { - continue; - } - - if (outCount >= MAX_POINTERS) { -#if DEBUG_POINTERS - ALOGD("MultiTouch device %s emitted more than maximum of %d pointers; " - "ignoring the rest.", - getDeviceName().string(), MAX_POINTERS); -#endif - break; // too many fingers! - } - - RawPointerData::Pointer& outPointer = outState->rawPointerData.pointers[outCount]; - outPointer.x = inSlot->getX(); - outPointer.y = inSlot->getY(); - outPointer.pressure = inSlot->getPressure(); - outPointer.touchMajor = inSlot->getTouchMajor(); - outPointer.touchMinor = inSlot->getTouchMinor(); - outPointer.toolMajor = inSlot->getToolMajor(); - outPointer.toolMinor = inSlot->getToolMinor(); - outPointer.orientation = inSlot->getOrientation(); - outPointer.distance = inSlot->getDistance(); - outPointer.tiltX = 0; - outPointer.tiltY = 0; - - outPointer.toolType = inSlot->getToolType(); - if (outPointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { - outPointer.toolType = mTouchButtonAccumulator.getToolType(); - if (outPointer.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { - outPointer.toolType = AMOTION_EVENT_TOOL_TYPE_FINGER; - } - } - - bool isHovering = mTouchButtonAccumulator.getToolType() != AMOTION_EVENT_TOOL_TYPE_MOUSE - && (mTouchButtonAccumulator.isHovering() - || (mRawPointerAxes.pressure.valid && inSlot->getPressure() <= 0)); - outPointer.isHovering = isHovering; - - // Assign pointer id using tracking id if available. - mHavePointerIds = true; - int32_t trackingId = inSlot->getTrackingId(); - int32_t id = -1; - if (trackingId >= 0) { - for (BitSet32 idBits(mPointerIdBits); !idBits.isEmpty(); ) { - uint32_t n = idBits.clearFirstMarkedBit(); - if (mPointerTrackingIdMap[n] == trackingId) { - id = n; - } - } - - if (id < 0 && !mPointerIdBits.isFull()) { - id = mPointerIdBits.markFirstUnmarkedBit(); - mPointerTrackingIdMap[id] = trackingId; - } - } - if (id < 0) { - mHavePointerIds = false; - outState->rawPointerData.clearIdBits(); - newPointerIdBits.clear(); - } else { - outPointer.id = id; - outState->rawPointerData.idToIndex[id] = outCount; - outState->rawPointerData.markIdBit(id, isHovering); - newPointerIdBits.markBit(id); - } - - outCount += 1; - } - - outState->rawPointerData.pointerCount = outCount; - mPointerIdBits = newPointerIdBits; - - mMultiTouchMotionAccumulator.finishSync(); -} - -void MultiTouchInputMapper::configureRawPointerAxes() { - TouchInputMapper::configureRawPointerAxes(); - - getAbsoluteAxisInfo(ABS_MT_POSITION_X, &mRawPointerAxes.x); - getAbsoluteAxisInfo(ABS_MT_POSITION_Y, &mRawPointerAxes.y); - getAbsoluteAxisInfo(ABS_MT_TOUCH_MAJOR, &mRawPointerAxes.touchMajor); - getAbsoluteAxisInfo(ABS_MT_TOUCH_MINOR, &mRawPointerAxes.touchMinor); - getAbsoluteAxisInfo(ABS_MT_WIDTH_MAJOR, &mRawPointerAxes.toolMajor); - getAbsoluteAxisInfo(ABS_MT_WIDTH_MINOR, &mRawPointerAxes.toolMinor); - getAbsoluteAxisInfo(ABS_MT_ORIENTATION, &mRawPointerAxes.orientation); - getAbsoluteAxisInfo(ABS_MT_PRESSURE, &mRawPointerAxes.pressure); - getAbsoluteAxisInfo(ABS_MT_DISTANCE, &mRawPointerAxes.distance); - getAbsoluteAxisInfo(ABS_MT_TRACKING_ID, &mRawPointerAxes.trackingId); - getAbsoluteAxisInfo(ABS_MT_SLOT, &mRawPointerAxes.slot); - - if (mRawPointerAxes.trackingId.valid - && mRawPointerAxes.slot.valid - && mRawPointerAxes.slot.minValue == 0 && mRawPointerAxes.slot.maxValue > 0) { - size_t slotCount = mRawPointerAxes.slot.maxValue + 1; - if (slotCount > MAX_SLOTS) { - ALOGW("MultiTouch Device %s reported %zu slots but the framework " - "only supports a maximum of %zu slots at this time.", - getDeviceName().string(), slotCount, MAX_SLOTS); - slotCount = MAX_SLOTS; - } - mMultiTouchMotionAccumulator.configure(getDevice(), - slotCount, true /*usingSlotsProtocol*/); - } else { - mMultiTouchMotionAccumulator.configure(getDevice(), - MAX_POINTERS, false /*usingSlotsProtocol*/); - } -} - -bool MultiTouchInputMapper::hasStylus() const { - return mMultiTouchMotionAccumulator.hasStylus() - || mTouchButtonAccumulator.hasStylus(); -} - -// --- ExternalStylusInputMapper - -ExternalStylusInputMapper::ExternalStylusInputMapper(InputDevice* device) : - InputMapper(device) { - -} - -uint32_t ExternalStylusInputMapper::getSources() { - return AINPUT_SOURCE_STYLUS; -} - -void ExternalStylusInputMapper::populateDeviceInfo(InputDeviceInfo* info) { - InputMapper::populateDeviceInfo(info); - info->addMotionRange(AMOTION_EVENT_AXIS_PRESSURE, AINPUT_SOURCE_STYLUS, - 0.0f, 1.0f, 0.0f, 0.0f, 0.0f); -} - -void ExternalStylusInputMapper::dump(String8& dump) { - dump.append(INDENT2 "External Stylus Input Mapper:\n"); - dump.append(INDENT3 "Raw Stylus Axes:\n"); - dumpRawAbsoluteAxisInfo(dump, mRawPressureAxis, "Pressure"); - dump.append(INDENT3 "Stylus State:\n"); - dumpStylusState(dump, mStylusState); -} - -void ExternalStylusInputMapper::configure(nsecs_t when, - const InputReaderConfiguration* config, uint32_t changes) { - getAbsoluteAxisInfo(ABS_PRESSURE, &mRawPressureAxis); - mTouchButtonAccumulator.configure(getDevice()); -} - -void ExternalStylusInputMapper::reset(nsecs_t when) { - InputDevice* device = getDevice(); - mSingleTouchMotionAccumulator.reset(device); - mTouchButtonAccumulator.reset(device); - InputMapper::reset(when); -} - -void ExternalStylusInputMapper::process(const RawEvent* rawEvent) { - mSingleTouchMotionAccumulator.process(rawEvent); - mTouchButtonAccumulator.process(rawEvent); - - if (rawEvent->type == EV_SYN && rawEvent->code == SYN_REPORT) { - sync(rawEvent->when); - } -} - -void ExternalStylusInputMapper::sync(nsecs_t when) { - mStylusState.clear(); - - mStylusState.when = when; - - mStylusState.toolType = mTouchButtonAccumulator.getToolType(); - if (mStylusState.toolType == AMOTION_EVENT_TOOL_TYPE_UNKNOWN) { - mStylusState.toolType = AMOTION_EVENT_TOOL_TYPE_STYLUS; - } - - int32_t pressure = mSingleTouchMotionAccumulator.getAbsolutePressure(); - if (mRawPressureAxis.valid) { - mStylusState.pressure = float(pressure) / mRawPressureAxis.maxValue; - } else if (mTouchButtonAccumulator.isToolActive()) { - mStylusState.pressure = 1.0f; - } else { - mStylusState.pressure = 0.0f; - } - - mStylusState.buttons = mTouchButtonAccumulator.getButtonState(); - - mContext->dispatchExternalStylusState(mStylusState); -} - - -// --- JoystickInputMapper --- - -JoystickInputMapper::JoystickInputMapper(InputDevice* device) : - InputMapper(device) { -} - -JoystickInputMapper::~JoystickInputMapper() { -} - -uint32_t JoystickInputMapper::getSources() { - return AINPUT_SOURCE_JOYSTICK; -} - -void JoystickInputMapper::populateDeviceInfo(InputDeviceInfo* info) { - InputMapper::populateDeviceInfo(info); - - for (size_t i = 0; i < mAxes.size(); i++) { - const Axis& axis = mAxes.valueAt(i); - addMotionRange(axis.axisInfo.axis, axis, info); - - if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) { - addMotionRange(axis.axisInfo.highAxis, axis, info); - - } - } -} - -void JoystickInputMapper::addMotionRange(int32_t axisId, const Axis& axis, - InputDeviceInfo* info) { - info->addMotionRange(axisId, AINPUT_SOURCE_JOYSTICK, - axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution); - /* In order to ease the transition for developers from using the old axes - * to the newer, more semantically correct axes, we'll continue to register - * the old axes as duplicates of their corresponding new ones. */ - int32_t compatAxis = getCompatAxis(axisId); - if (compatAxis >= 0) { - info->addMotionRange(compatAxis, AINPUT_SOURCE_JOYSTICK, - axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution); - } -} - -/* A mapping from axes the joystick actually has to the axes that should be - * artificially created for compatibility purposes. - * Returns -1 if no compatibility axis is needed. */ -int32_t JoystickInputMapper::getCompatAxis(int32_t axis) { - switch(axis) { - case AMOTION_EVENT_AXIS_LTRIGGER: - return AMOTION_EVENT_AXIS_BRAKE; - case AMOTION_EVENT_AXIS_RTRIGGER: - return AMOTION_EVENT_AXIS_GAS; - } - return -1; -} - -void JoystickInputMapper::dump(String8& dump) { - dump.append(INDENT2 "Joystick Input Mapper:\n"); - - dump.append(INDENT3 "Axes:\n"); - size_t numAxes = mAxes.size(); - for (size_t i = 0; i < numAxes; i++) { - const Axis& axis = mAxes.valueAt(i); - const char* label = getAxisLabel(axis.axisInfo.axis); - if (label) { - dump.appendFormat(INDENT4 "%s", label); - } else { - dump.appendFormat(INDENT4 "%d", axis.axisInfo.axis); - } - if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) { - label = getAxisLabel(axis.axisInfo.highAxis); - if (label) { - dump.appendFormat(" / %s (split at %d)", label, axis.axisInfo.splitValue); - } else { - dump.appendFormat(" / %d (split at %d)", axis.axisInfo.highAxis, - axis.axisInfo.splitValue); - } - } else if (axis.axisInfo.mode == AxisInfo::MODE_INVERT) { - dump.append(" (invert)"); - } - - dump.appendFormat(": min=%0.5f, max=%0.5f, flat=%0.5f, fuzz=%0.5f, resolution=%0.5f\n", - axis.min, axis.max, axis.flat, axis.fuzz, axis.resolution); - dump.appendFormat(INDENT4 " scale=%0.5f, offset=%0.5f, " - "highScale=%0.5f, highOffset=%0.5f\n", - axis.scale, axis.offset, axis.highScale, axis.highOffset); - dump.appendFormat(INDENT4 " rawAxis=%d, rawMin=%d, rawMax=%d, " - "rawFlat=%d, rawFuzz=%d, rawResolution=%d\n", - mAxes.keyAt(i), axis.rawAxisInfo.minValue, axis.rawAxisInfo.maxValue, - axis.rawAxisInfo.flat, axis.rawAxisInfo.fuzz, axis.rawAxisInfo.resolution); - } -} - -void JoystickInputMapper::configure(nsecs_t when, - const InputReaderConfiguration* config, uint32_t changes) { - InputMapper::configure(when, config, changes); - - if (!changes) { // first time only - // Collect all axes. - for (int32_t abs = 0; abs <= ABS_MAX; abs++) { - if (!(getAbsAxisUsage(abs, getDevice()->getClasses()) - & INPUT_DEVICE_CLASS_JOYSTICK)) { - continue; // axis must be claimed by a different device - } - - RawAbsoluteAxisInfo rawAxisInfo; - getAbsoluteAxisInfo(abs, &rawAxisInfo); - if (rawAxisInfo.valid) { - // Map axis. - AxisInfo axisInfo; - bool explicitlyMapped = !getEventHub()->mapAxis(getDeviceId(), abs, &axisInfo); - if (!explicitlyMapped) { - // Axis is not explicitly mapped, will choose a generic axis later. - axisInfo.mode = AxisInfo::MODE_NORMAL; - axisInfo.axis = -1; - } - - // Apply flat override. - int32_t rawFlat = axisInfo.flatOverride < 0 - ? rawAxisInfo.flat : axisInfo.flatOverride; - - // Calculate scaling factors and limits. - Axis axis; - if (axisInfo.mode == AxisInfo::MODE_SPLIT) { - float scale = 1.0f / (axisInfo.splitValue - rawAxisInfo.minValue); - float highScale = 1.0f / (rawAxisInfo.maxValue - axisInfo.splitValue); - axis.initialize(rawAxisInfo, axisInfo, explicitlyMapped, - scale, 0.0f, highScale, 0.0f, - 0.0f, 1.0f, rawFlat * scale, rawAxisInfo.fuzz * scale, - rawAxisInfo.resolution * scale); - } else if (isCenteredAxis(axisInfo.axis)) { - float scale = 2.0f / (rawAxisInfo.maxValue - rawAxisInfo.minValue); - float offset = avg(rawAxisInfo.minValue, rawAxisInfo.maxValue) * -scale; - axis.initialize(rawAxisInfo, axisInfo, explicitlyMapped, - scale, offset, scale, offset, - -1.0f, 1.0f, rawFlat * scale, rawAxisInfo.fuzz * scale, - rawAxisInfo.resolution * scale); - } else { - float scale = 1.0f / (rawAxisInfo.maxValue - rawAxisInfo.minValue); - axis.initialize(rawAxisInfo, axisInfo, explicitlyMapped, - scale, 0.0f, scale, 0.0f, - 0.0f, 1.0f, rawFlat * scale, rawAxisInfo.fuzz * scale, - rawAxisInfo.resolution * scale); - } - - // To eliminate noise while the joystick is at rest, filter out small variations - // in axis values up front. - axis.filter = axis.fuzz ? axis.fuzz : axis.flat * 0.25f; - - mAxes.add(abs, axis); - } - } - - // If there are too many axes, start dropping them. - // Prefer to keep explicitly mapped axes. - if (mAxes.size() > PointerCoords::MAX_AXES) { - ALOGI("Joystick '%s' has %zu axes but the framework only supports a maximum of %d.", - getDeviceName().string(), mAxes.size(), PointerCoords::MAX_AXES); - pruneAxes(true); - pruneAxes(false); - } - - // Assign generic axis ids to remaining axes. - int32_t nextGenericAxisId = AMOTION_EVENT_AXIS_GENERIC_1; - size_t numAxes = mAxes.size(); - for (size_t i = 0; i < numAxes; i++) { - Axis& axis = mAxes.editValueAt(i); - if (axis.axisInfo.axis < 0) { - while (nextGenericAxisId <= AMOTION_EVENT_AXIS_GENERIC_16 - && haveAxis(nextGenericAxisId)) { - nextGenericAxisId += 1; - } - - if (nextGenericAxisId <= AMOTION_EVENT_AXIS_GENERIC_16) { - axis.axisInfo.axis = nextGenericAxisId; - nextGenericAxisId += 1; - } else { - ALOGI("Ignoring joystick '%s' axis %d because all of the generic axis ids " - "have already been assigned to other axes.", - getDeviceName().string(), mAxes.keyAt(i)); - mAxes.removeItemsAt(i--); - numAxes -= 1; - } - } - } - } -} - -bool JoystickInputMapper::haveAxis(int32_t axisId) { - size_t numAxes = mAxes.size(); - for (size_t i = 0; i < numAxes; i++) { - const Axis& axis = mAxes.valueAt(i); - if (axis.axisInfo.axis == axisId - || (axis.axisInfo.mode == AxisInfo::MODE_SPLIT - && axis.axisInfo.highAxis == axisId)) { - return true; - } - } - return false; -} - -void JoystickInputMapper::pruneAxes(bool ignoreExplicitlyMappedAxes) { - size_t i = mAxes.size(); - while (mAxes.size() > PointerCoords::MAX_AXES && i-- > 0) { - if (ignoreExplicitlyMappedAxes && mAxes.valueAt(i).explicitlyMapped) { - continue; - } - ALOGI("Discarding joystick '%s' axis %d because there are too many axes.", - getDeviceName().string(), mAxes.keyAt(i)); - mAxes.removeItemsAt(i); - } -} - -bool JoystickInputMapper::isCenteredAxis(int32_t axis) { - switch (axis) { - case AMOTION_EVENT_AXIS_X: - case AMOTION_EVENT_AXIS_Y: - case AMOTION_EVENT_AXIS_Z: - case AMOTION_EVENT_AXIS_RX: - case AMOTION_EVENT_AXIS_RY: - case AMOTION_EVENT_AXIS_RZ: - case AMOTION_EVENT_AXIS_HAT_X: - case AMOTION_EVENT_AXIS_HAT_Y: - case AMOTION_EVENT_AXIS_ORIENTATION: - case AMOTION_EVENT_AXIS_RUDDER: - case AMOTION_EVENT_AXIS_WHEEL: - return true; - default: - return false; - } -} - -void JoystickInputMapper::reset(nsecs_t when) { - // Recenter all axes. - size_t numAxes = mAxes.size(); - for (size_t i = 0; i < numAxes; i++) { - Axis& axis = mAxes.editValueAt(i); - axis.resetValue(); - } - - InputMapper::reset(when); -} - -void JoystickInputMapper::process(const RawEvent* rawEvent) { - switch (rawEvent->type) { - case EV_ABS: { - ssize_t index = mAxes.indexOfKey(rawEvent->code); - if (index >= 0) { - Axis& axis = mAxes.editValueAt(index); - float newValue, highNewValue; - switch (axis.axisInfo.mode) { - case AxisInfo::MODE_INVERT: - newValue = (axis.rawAxisInfo.maxValue - rawEvent->value) - * axis.scale + axis.offset; - highNewValue = 0.0f; - break; - case AxisInfo::MODE_SPLIT: - if (rawEvent->value < axis.axisInfo.splitValue) { - newValue = (axis.axisInfo.splitValue - rawEvent->value) - * axis.scale + axis.offset; - highNewValue = 0.0f; - } else if (rawEvent->value > axis.axisInfo.splitValue) { - newValue = 0.0f; - highNewValue = (rawEvent->value - axis.axisInfo.splitValue) - * axis.highScale + axis.highOffset; - } else { - newValue = 0.0f; - highNewValue = 0.0f; - } - break; - default: - newValue = rawEvent->value * axis.scale + axis.offset; - highNewValue = 0.0f; - break; - } - axis.newValue = newValue; - axis.highNewValue = highNewValue; - } - break; - } - - case EV_SYN: - switch (rawEvent->code) { - case SYN_REPORT: - sync(rawEvent->when, false /*force*/); - break; - } - break; - } -} - -void JoystickInputMapper::sync(nsecs_t when, bool force) { - if (!filterAxes(force)) { - return; - } - - int32_t metaState = mContext->getGlobalMetaState(); - int32_t buttonState = 0; - - PointerProperties pointerProperties; - pointerProperties.clear(); - pointerProperties.id = 0; - pointerProperties.toolType = AMOTION_EVENT_TOOL_TYPE_UNKNOWN; - - PointerCoords pointerCoords; - pointerCoords.clear(); - - size_t numAxes = mAxes.size(); - for (size_t i = 0; i < numAxes; i++) { - const Axis& axis = mAxes.valueAt(i); - setPointerCoordsAxisValue(&pointerCoords, axis.axisInfo.axis, axis.currentValue); - if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) { - setPointerCoordsAxisValue(&pointerCoords, axis.axisInfo.highAxis, - axis.highCurrentValue); - } - } - - // Moving a joystick axis should not wake the device because joysticks can - // be fairly noisy even when not in use. On the other hand, pushing a gamepad - // button will likely wake the device. - // TODO: Use the input device configuration to control this behavior more finely. - uint32_t policyFlags = 0; - - NotifyMotionArgs args(when, getDeviceId(), AINPUT_SOURCE_JOYSTICK, policyFlags, - AMOTION_EVENT_ACTION_MOVE, 0, 0, metaState, buttonState, AMOTION_EVENT_EDGE_FLAG_NONE, - ADISPLAY_ID_NONE, 1, &pointerProperties, &pointerCoords, 0, 0, 0); - getListener()->notifyMotion(&args); -} - -void JoystickInputMapper::setPointerCoordsAxisValue(PointerCoords* pointerCoords, - int32_t axis, float value) { - pointerCoords->setAxisValue(axis, value); - /* In order to ease the transition for developers from using the old axes - * to the newer, more semantically correct axes, we'll continue to produce - * values for the old axes as mirrors of the value of their corresponding - * new axes. */ - int32_t compatAxis = getCompatAxis(axis); - if (compatAxis >= 0) { - pointerCoords->setAxisValue(compatAxis, value); - } -} - -bool JoystickInputMapper::filterAxes(bool force) { - bool atLeastOneSignificantChange = force; - size_t numAxes = mAxes.size(); - for (size_t i = 0; i < numAxes; i++) { - Axis& axis = mAxes.editValueAt(i); - if (force || hasValueChangedSignificantly(axis.filter, - axis.newValue, axis.currentValue, axis.min, axis.max)) { - axis.currentValue = axis.newValue; - atLeastOneSignificantChange = true; - } - if (axis.axisInfo.mode == AxisInfo::MODE_SPLIT) { - if (force || hasValueChangedSignificantly(axis.filter, - axis.highNewValue, axis.highCurrentValue, axis.min, axis.max)) { - axis.highCurrentValue = axis.highNewValue; - atLeastOneSignificantChange = true; - } - } - } - return atLeastOneSignificantChange; -} - -bool JoystickInputMapper::hasValueChangedSignificantly( - float filter, float newValue, float currentValue, float min, float max) { - if (newValue != currentValue) { - // Filter out small changes in value unless the value is converging on the axis - // bounds or center point. This is intended to reduce the amount of information - // sent to applications by particularly noisy joysticks (such as PS3). - if (fabs(newValue - currentValue) > filter - || hasMovedNearerToValueWithinFilteredRange(filter, newValue, currentValue, min) - || hasMovedNearerToValueWithinFilteredRange(filter, newValue, currentValue, max) - || hasMovedNearerToValueWithinFilteredRange(filter, newValue, currentValue, 0)) { - return true; - } - } - return false; -} - -bool JoystickInputMapper::hasMovedNearerToValueWithinFilteredRange( - float filter, float newValue, float currentValue, float thresholdValue) { - float newDistance = fabs(newValue - thresholdValue); - if (newDistance < filter) { - float oldDistance = fabs(currentValue - thresholdValue); - if (newDistance < oldDistance) { - return true; - } - } - return false; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputReader.h android-platform-frameworks-native-21/services/inputflinger/InputReader.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputReader.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputReader.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,2006 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef _UI_INPUT_READER_H -#define _UI_INPUT_READER_H - -#include "EventHub.h" -#include "PointerControllerInterface.h" -#include "InputListener.h" - -#include -#include -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include - -// Maximum supported size of a vibration pattern. -// Must be at least 2. -#define MAX_VIBRATE_PATTERN_SIZE 100 - -// Maximum allowable delay value in a vibration pattern before -// which the delay will be truncated. -#define MAX_VIBRATE_PATTERN_DELAY_NSECS (1000000 * 1000000000LL) - -namespace android { - -class InputDevice; -class InputMapper; - -/* - * Describes how coordinates are mapped on a physical display. - * See com.android.server.display.DisplayViewport. - */ -struct DisplayViewport { - int32_t displayId; // -1 if invalid - int32_t orientation; - int32_t logicalLeft; - int32_t logicalTop; - int32_t logicalRight; - int32_t logicalBottom; - int32_t physicalLeft; - int32_t physicalTop; - int32_t physicalRight; - int32_t physicalBottom; - int32_t deviceWidth; - int32_t deviceHeight; - - DisplayViewport() : - displayId(ADISPLAY_ID_NONE), orientation(DISPLAY_ORIENTATION_0), - logicalLeft(0), logicalTop(0), logicalRight(0), logicalBottom(0), - physicalLeft(0), physicalTop(0), physicalRight(0), physicalBottom(0), - deviceWidth(0), deviceHeight(0) { - } - - bool operator==(const DisplayViewport& other) const { - return displayId == other.displayId - && orientation == other.orientation - && logicalLeft == other.logicalLeft - && logicalTop == other.logicalTop - && logicalRight == other.logicalRight - && logicalBottom == other.logicalBottom - && physicalLeft == other.physicalLeft - && physicalTop == other.physicalTop - && physicalRight == other.physicalRight - && physicalBottom == other.physicalBottom - && deviceWidth == other.deviceWidth - && deviceHeight == other.deviceHeight; - } - - bool operator!=(const DisplayViewport& other) const { - return !(*this == other); - } - - inline bool isValid() const { - return displayId >= 0; - } - - void setNonDisplayViewport(int32_t width, int32_t height) { - displayId = ADISPLAY_ID_NONE; - orientation = DISPLAY_ORIENTATION_0; - logicalLeft = 0; - logicalTop = 0; - logicalRight = width; - logicalBottom = height; - physicalLeft = 0; - physicalTop = 0; - physicalRight = width; - physicalBottom = height; - deviceWidth = width; - deviceHeight = height; - } -}; - -/* - * Input reader configuration. - * - * Specifies various options that modify the behavior of the input reader. - */ -struct InputReaderConfiguration { - // Describes changes that have occurred. - enum { - // The pointer speed changed. - CHANGE_POINTER_SPEED = 1 << 0, - - // The pointer gesture control changed. - CHANGE_POINTER_GESTURE_ENABLEMENT = 1 << 1, - - // The display size or orientation changed. - CHANGE_DISPLAY_INFO = 1 << 2, - - // The visible touches option changed. - CHANGE_SHOW_TOUCHES = 1 << 3, - - // The keyboard layouts must be reloaded. - CHANGE_KEYBOARD_LAYOUTS = 1 << 4, - - // The device name alias supplied by the may have changed for some devices. - CHANGE_DEVICE_ALIAS = 1 << 5, - - // The location calibration matrix changed. - CHANGE_TOUCH_AFFINE_TRANSFORMATION = 1 << 6, - - // The presence of an external stylus has changed. - CHANGE_EXTERNAL_STYLUS_PRESENCE = 1 << 7, - - // All devices must be reopened. - CHANGE_MUST_REOPEN = 1 << 31, - }; - - // Gets the amount of time to disable virtual keys after the screen is touched - // in order to filter out accidental virtual key presses due to swiping gestures - // or taps near the edge of the display. May be 0 to disable the feature. - nsecs_t virtualKeyQuietTime; - - // The excluded device names for the platform. - // Devices with these names will be ignored. - Vector excludedDeviceNames; - - // Velocity control parameters for mouse pointer movements. - VelocityControlParameters pointerVelocityControlParameters; - - // Velocity control parameters for mouse wheel movements. - VelocityControlParameters wheelVelocityControlParameters; - - // True if pointer gestures are enabled. - bool pointerGesturesEnabled; - - // Quiet time between certain pointer gesture transitions. - // Time to allow for all fingers or buttons to settle into a stable state before - // starting a new gesture. - nsecs_t pointerGestureQuietInterval; - - // The minimum speed that a pointer must travel for us to consider switching the active - // touch pointer to it during a drag. This threshold is set to avoid switching due - // to noise from a finger resting on the touch pad (perhaps just pressing it down). - float pointerGestureDragMinSwitchSpeed; // in pixels per second - - // Tap gesture delay time. - // The time between down and up must be less than this to be considered a tap. - nsecs_t pointerGestureTapInterval; - - // Tap drag gesture delay time. - // The time between the previous tap's up and the next down must be less than - // this to be considered a drag. Otherwise, the previous tap is finished and a - // new tap begins. - // - // Note that the previous tap will be held down for this entire duration so this - // interval must be shorter than the long press timeout. - nsecs_t pointerGestureTapDragInterval; - - // The distance in pixels that the pointer is allowed to move from initial down - // to up and still be called a tap. - float pointerGestureTapSlop; // in pixels - - // Time after the first touch points go down to settle on an initial centroid. - // This is intended to be enough time to handle cases where the user puts down two - // fingers at almost but not quite exactly the same time. - nsecs_t pointerGestureMultitouchSettleInterval; - - // The transition from PRESS to SWIPE or FREEFORM gesture mode is made when - // at least two pointers have moved at least this far from their starting place. - float pointerGestureMultitouchMinDistance; // in pixels - - // The transition from PRESS to SWIPE gesture mode can only occur when the - // cosine of the angle between the two vectors is greater than or equal to than this value - // which indicates that the vectors are oriented in the same direction. - // When the vectors are oriented in the exactly same direction, the cosine is 1.0. - // (In exactly opposite directions, the cosine is -1.0.) - float pointerGestureSwipeTransitionAngleCosine; - - // The transition from PRESS to SWIPE gesture mode can only occur when the - // fingers are no more than this far apart relative to the diagonal size of - // the touch pad. For example, a ratio of 0.5 means that the fingers must be - // no more than half the diagonal size of the touch pad apart. - float pointerGestureSwipeMaxWidthRatio; - - // The gesture movement speed factor relative to the size of the display. - // Movement speed applies when the fingers are moving in the same direction. - // Without acceleration, a full swipe of the touch pad diagonal in movement mode - // will cover this portion of the display diagonal. - float pointerGestureMovementSpeedRatio; - - // The gesture zoom speed factor relative to the size of the display. - // Zoom speed applies when the fingers are mostly moving relative to each other - // to execute a scale gesture or similar. - // Without acceleration, a full swipe of the touch pad diagonal in zoom mode - // will cover this portion of the display diagonal. - float pointerGestureZoomSpeedRatio; - - // True to show the location of touches on the touch screen as spots. - bool showTouches; - - InputReaderConfiguration() : - virtualKeyQuietTime(0), - pointerVelocityControlParameters(1.0f, 500.0f, 3000.0f, 3.0f), - wheelVelocityControlParameters(1.0f, 15.0f, 50.0f, 4.0f), - pointerGesturesEnabled(true), - pointerGestureQuietInterval(100 * 1000000LL), // 100 ms - pointerGestureDragMinSwitchSpeed(50), // 50 pixels per second - pointerGestureTapInterval(150 * 1000000LL), // 150 ms - pointerGestureTapDragInterval(150 * 1000000LL), // 150 ms - pointerGestureTapSlop(10.0f), // 10 pixels - pointerGestureMultitouchSettleInterval(100 * 1000000LL), // 100 ms - pointerGestureMultitouchMinDistance(15), // 15 pixels - pointerGestureSwipeTransitionAngleCosine(0.2588f), // cosine of 75 degrees - pointerGestureSwipeMaxWidthRatio(0.25f), - pointerGestureMovementSpeedRatio(0.8f), - pointerGestureZoomSpeedRatio(0.3f), - showTouches(false) { } - - bool getDisplayInfo(bool external, DisplayViewport* outViewport) const; - void setDisplayInfo(bool external, const DisplayViewport& viewport); - -private: - DisplayViewport mInternalDisplay; - DisplayViewport mExternalDisplay; -}; - - -struct TouchAffineTransformation { - float x_scale; - float x_ymix; - float x_offset; - float y_xmix; - float y_scale; - float y_offset; - - TouchAffineTransformation() : - x_scale(1.0f), x_ymix(0.0f), x_offset(0.0f), - y_xmix(0.0f), y_scale(1.0f), y_offset(0.0f) { - } - - TouchAffineTransformation(float xscale, float xymix, float xoffset, - float yxmix, float yscale, float yoffset) : - x_scale(xscale), x_ymix(xymix), x_offset(xoffset), - y_xmix(yxmix), y_scale(yscale), y_offset(yoffset) { - } - - void applyTo(float& x, float& y) const; -}; - - -/* - * Input reader policy interface. - * - * The input reader policy is used by the input reader to interact with the Window Manager - * and other system components. - * - * The actual implementation is partially supported by callbacks into the DVM - * via JNI. This interface is also mocked in the unit tests. - * - * These methods must NOT re-enter the input reader since they may be called while - * holding the input reader lock. - */ -class InputReaderPolicyInterface : public virtual RefBase { -protected: - InputReaderPolicyInterface() { } - virtual ~InputReaderPolicyInterface() { } - -public: - /* Gets the input reader configuration. */ - virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) = 0; - - /* Gets a pointer controller associated with the specified cursor device (ie. a mouse). */ - virtual sp obtainPointerController(int32_t deviceId) = 0; - - /* Notifies the input reader policy that some input devices have changed - * and provides information about all current input devices. - */ - virtual void notifyInputDevicesChanged(const Vector& inputDevices) = 0; - - /* Gets the keyboard layout for a particular input device. */ - virtual sp getKeyboardLayoutOverlay( - const InputDeviceIdentifier& identifier) = 0; - - /* Gets a user-supplied alias for a particular input device, or an empty string if none. */ - virtual String8 getDeviceAlias(const InputDeviceIdentifier& identifier) = 0; - - /* Gets the affine calibration associated with the specified device. */ - virtual TouchAffineTransformation getTouchAffineTransformation( - const String8& inputDeviceDescriptor, int32_t surfaceRotation) = 0; -}; - - -/* Processes raw input events and sends cooked event data to an input listener. */ -class InputReaderInterface : public virtual RefBase { -protected: - InputReaderInterface() { } - virtual ~InputReaderInterface() { } - -public: - /* Dumps the state of the input reader. - * - * This method may be called on any thread (usually by the input manager). */ - virtual void dump(String8& dump) = 0; - - /* Called by the heatbeat to ensures that the reader has not deadlocked. */ - virtual void monitor() = 0; - - /* Runs a single iteration of the processing loop. - * Nominally reads and processes one incoming message from the EventHub. - * - * This method should be called on the input reader thread. - */ - virtual void loopOnce() = 0; - - /* Gets information about all input devices. - * - * This method may be called on any thread (usually by the input manager). - */ - virtual void getInputDevices(Vector& outInputDevices) = 0; - - /* Query current input state. */ - virtual int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t scanCode) = 0; - virtual int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t keyCode) = 0; - virtual int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask, - int32_t sw) = 0; - - /* Determine whether physical keys exist for the given framework-domain key codes. */ - virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask, - size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags) = 0; - - /* Requests that a reconfiguration of all input devices. - * The changes flag is a bitfield that indicates what has changed and whether - * the input devices must all be reopened. */ - virtual void requestRefreshConfiguration(uint32_t changes) = 0; - - /* Controls the vibrator of a particular input device. */ - virtual void vibrate(int32_t deviceId, const nsecs_t* pattern, size_t patternSize, - ssize_t repeat, int32_t token) = 0; - virtual void cancelVibrate(int32_t deviceId, int32_t token) = 0; -}; - -struct StylusState { - /* Time the stylus event was received. */ - nsecs_t when; - /* Pressure as reported by the stylus, normalized to the range [0, 1.0]. */ - float pressure; - /* The state of the stylus buttons as a bitfield (e.g. AMOTION_EVENT_BUTTON_SECONDARY). */ - uint32_t buttons; - /* Which tool type the stylus is currently using (e.g. AMOTION_EVENT_TOOL_TYPE_ERASER). */ - int32_t toolType; - - void copyFrom(const StylusState& other) { - when = other.when; - pressure = other.pressure; - buttons = other.buttons; - toolType = other.toolType; - } - - void clear() { - when = LLONG_MAX; - pressure = 0.f; - buttons = 0; - toolType = AMOTION_EVENT_TOOL_TYPE_UNKNOWN; - } -}; - - -/* Internal interface used by individual input devices to access global input device state - * and parameters maintained by the input reader. - */ -class InputReaderContext { -public: - InputReaderContext() { } - virtual ~InputReaderContext() { } - - virtual void updateGlobalMetaState() = 0; - virtual int32_t getGlobalMetaState() = 0; - - virtual void disableVirtualKeysUntil(nsecs_t time) = 0; - virtual bool shouldDropVirtualKey(nsecs_t now, - InputDevice* device, int32_t keyCode, int32_t scanCode) = 0; - - virtual void fadePointer() = 0; - - virtual void requestTimeoutAtTime(nsecs_t when) = 0; - virtual int32_t bumpGeneration() = 0; - - virtual void getExternalStylusDevices(Vector& outDevices) = 0; - virtual void dispatchExternalStylusState(const StylusState& outState) = 0; - - virtual InputReaderPolicyInterface* getPolicy() = 0; - virtual InputListenerInterface* getListener() = 0; - virtual EventHubInterface* getEventHub() = 0; -}; - - -/* The input reader reads raw event data from the event hub and processes it into input events - * that it sends to the input listener. Some functions of the input reader, such as early - * event filtering in low power states, are controlled by a separate policy object. - * - * The InputReader owns a collection of InputMappers. Most of the work it does happens - * on the input reader thread but the InputReader can receive queries from other system - * components running on arbitrary threads. To keep things manageable, the InputReader - * uses a single Mutex to guard its state. The Mutex may be held while calling into the - * EventHub or the InputReaderPolicy but it is never held while calling into the - * InputListener. - */ -class InputReader : public InputReaderInterface { -public: - InputReader(const sp& eventHub, - const sp& policy, - const sp& listener); - virtual ~InputReader(); - - virtual void dump(String8& dump); - virtual void monitor(); - - virtual void loopOnce(); - - virtual void getInputDevices(Vector& outInputDevices); - - virtual int32_t getScanCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t scanCode); - virtual int32_t getKeyCodeState(int32_t deviceId, uint32_t sourceMask, - int32_t keyCode); - virtual int32_t getSwitchState(int32_t deviceId, uint32_t sourceMask, - int32_t sw); - - virtual bool hasKeys(int32_t deviceId, uint32_t sourceMask, - size_t numCodes, const int32_t* keyCodes, uint8_t* outFlags); - - virtual void requestRefreshConfiguration(uint32_t changes); - - virtual void vibrate(int32_t deviceId, const nsecs_t* pattern, size_t patternSize, - ssize_t repeat, int32_t token); - virtual void cancelVibrate(int32_t deviceId, int32_t token); - -protected: - // These members are protected so they can be instrumented by test cases. - virtual InputDevice* createDeviceLocked(int32_t deviceId, int32_t controllerNumber, - const InputDeviceIdentifier& identifier, uint32_t classes); - - class ContextImpl : public InputReaderContext { - InputReader* mReader; - - public: - ContextImpl(InputReader* reader); - - virtual void updateGlobalMetaState(); - virtual int32_t getGlobalMetaState(); - virtual void disableVirtualKeysUntil(nsecs_t time); - virtual bool shouldDropVirtualKey(nsecs_t now, - InputDevice* device, int32_t keyCode, int32_t scanCode); - virtual void fadePointer(); - virtual void requestTimeoutAtTime(nsecs_t when); - virtual int32_t bumpGeneration(); - virtual void getExternalStylusDevices(Vector& outDevices); - virtual void dispatchExternalStylusState(const StylusState& outState); - virtual InputReaderPolicyInterface* getPolicy(); - virtual InputListenerInterface* getListener(); - virtual EventHubInterface* getEventHub(); - } mContext; - - friend class ContextImpl; - -private: - Mutex mLock; - - Condition mReaderIsAliveCondition; - - sp mEventHub; - sp mPolicy; - sp mQueuedListener; - - InputReaderConfiguration mConfig; - - // The event queue. - static const int EVENT_BUFFER_SIZE = 256; - RawEvent mEventBuffer[EVENT_BUFFER_SIZE]; - - KeyedVector mDevices; - - // low-level input event decoding and device management - void processEventsLocked(const RawEvent* rawEvents, size_t count); - - void addDeviceLocked(nsecs_t when, int32_t deviceId); - void removeDeviceLocked(nsecs_t when, int32_t deviceId); - void processEventsForDeviceLocked(int32_t deviceId, const RawEvent* rawEvents, size_t count); - void timeoutExpiredLocked(nsecs_t when); - - void handleConfigurationChangedLocked(nsecs_t when); - - int32_t mGlobalMetaState; - void updateGlobalMetaStateLocked(); - int32_t getGlobalMetaStateLocked(); - - void notifyExternalStylusPresenceChanged(); - void getExternalStylusDevicesLocked(Vector& outDevices); - void dispatchExternalStylusState(const StylusState& state); - - void fadePointerLocked(); - - int32_t mGeneration; - int32_t bumpGenerationLocked(); - - void getInputDevicesLocked(Vector& outInputDevices); - - nsecs_t mDisableVirtualKeysTimeout; - void disableVirtualKeysUntilLocked(nsecs_t time); - bool shouldDropVirtualKeyLocked(nsecs_t now, - InputDevice* device, int32_t keyCode, int32_t scanCode); - - nsecs_t mNextTimeout; - void requestTimeoutAtTimeLocked(nsecs_t when); - - uint32_t mConfigurationChangesToRefresh; - void refreshConfigurationLocked(uint32_t changes); - - // state queries - typedef int32_t (InputDevice::*GetStateFunc)(uint32_t sourceMask, int32_t code); - int32_t getStateLocked(int32_t deviceId, uint32_t sourceMask, int32_t code, - GetStateFunc getStateFunc); - bool markSupportedKeyCodesLocked(int32_t deviceId, uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags); -}; - - -/* Reads raw events from the event hub and processes them, endlessly. */ -class InputReaderThread : public Thread { -public: - InputReaderThread(const sp& reader); - virtual ~InputReaderThread(); - -private: - sp mReader; - - virtual bool threadLoop(); -}; - - -/* Represents the state of a single input device. */ -class InputDevice { -public: - InputDevice(InputReaderContext* context, int32_t id, int32_t generation, int32_t - controllerNumber, const InputDeviceIdentifier& identifier, uint32_t classes); - ~InputDevice(); - - inline InputReaderContext* getContext() { return mContext; } - inline int32_t getId() const { return mId; } - inline int32_t getControllerNumber() const { return mControllerNumber; } - inline int32_t getGeneration() const { return mGeneration; } - inline const String8& getName() const { return mIdentifier.name; } - inline const String8& getDescriptor() { return mIdentifier.descriptor; } - inline uint32_t getClasses() const { return mClasses; } - inline uint32_t getSources() const { return mSources; } - - inline bool isExternal() { return mIsExternal; } - inline void setExternal(bool external) { mIsExternal = external; } - - inline void setMic(bool hasMic) { mHasMic = hasMic; } - inline bool hasMic() const { return mHasMic; } - - inline bool isIgnored() { return mMappers.isEmpty(); } - - void dump(String8& dump); - void addMapper(InputMapper* mapper); - void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - void reset(nsecs_t when); - void process(const RawEvent* rawEvents, size_t count); - void timeoutExpired(nsecs_t when); - void updateExternalStylusState(const StylusState& state); - - void getDeviceInfo(InputDeviceInfo* outDeviceInfo); - int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode); - int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode); - int32_t getSwitchState(uint32_t sourceMask, int32_t switchCode); - bool markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags); - void vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, int32_t token); - void cancelVibrate(int32_t token); - void cancelTouch(nsecs_t when); - - int32_t getMetaState(); - - void fadePointer(); - - void bumpGeneration(); - - void notifyReset(nsecs_t when); - - inline const PropertyMap& getConfiguration() { return mConfiguration; } - inline EventHubInterface* getEventHub() { return mContext->getEventHub(); } - - bool hasKey(int32_t code) { - return getEventHub()->hasScanCode(mId, code); - } - - bool hasAbsoluteAxis(int32_t code) { - RawAbsoluteAxisInfo info; - getEventHub()->getAbsoluteAxisInfo(mId, code, &info); - return info.valid; - } - - bool isKeyPressed(int32_t code) { - return getEventHub()->getScanCodeState(mId, code) == AKEY_STATE_DOWN; - } - - int32_t getAbsoluteAxisValue(int32_t code) { - int32_t value; - getEventHub()->getAbsoluteAxisValue(mId, code, &value); - return value; - } - -private: - InputReaderContext* mContext; - int32_t mId; - int32_t mGeneration; - int32_t mControllerNumber; - InputDeviceIdentifier mIdentifier; - String8 mAlias; - uint32_t mClasses; - - Vector mMappers; - - uint32_t mSources; - bool mIsExternal; - bool mHasMic; - bool mDropUntilNextSync; - - typedef int32_t (InputMapper::*GetStateFunc)(uint32_t sourceMask, int32_t code); - int32_t getState(uint32_t sourceMask, int32_t code, GetStateFunc getStateFunc); - - PropertyMap mConfiguration; -}; - - -/* Keeps track of the state of mouse or touch pad buttons. */ -class CursorButtonAccumulator { -public: - CursorButtonAccumulator(); - void reset(InputDevice* device); - - void process(const RawEvent* rawEvent); - - uint32_t getButtonState() const; - -private: - bool mBtnLeft; - bool mBtnRight; - bool mBtnMiddle; - bool mBtnBack; - bool mBtnSide; - bool mBtnForward; - bool mBtnExtra; - bool mBtnTask; - - void clearButtons(); -}; - - -/* Keeps track of cursor movements. */ - -class CursorMotionAccumulator { -public: - CursorMotionAccumulator(); - void reset(InputDevice* device); - - void process(const RawEvent* rawEvent); - void finishSync(); - - inline int32_t getRelativeX() const { return mRelX; } - inline int32_t getRelativeY() const { return mRelY; } - -private: - int32_t mRelX; - int32_t mRelY; - - void clearRelativeAxes(); -}; - - -/* Keeps track of cursor scrolling motions. */ - -class CursorScrollAccumulator { -public: - CursorScrollAccumulator(); - void configure(InputDevice* device); - void reset(InputDevice* device); - - void process(const RawEvent* rawEvent); - void finishSync(); - - inline bool haveRelativeVWheel() const { return mHaveRelWheel; } - inline bool haveRelativeHWheel() const { return mHaveRelHWheel; } - - inline int32_t getRelativeX() const { return mRelX; } - inline int32_t getRelativeY() const { return mRelY; } - inline int32_t getRelativeVWheel() const { return mRelWheel; } - inline int32_t getRelativeHWheel() const { return mRelHWheel; } - -private: - bool mHaveRelWheel; - bool mHaveRelHWheel; - - int32_t mRelX; - int32_t mRelY; - int32_t mRelWheel; - int32_t mRelHWheel; - - void clearRelativeAxes(); -}; - - -/* Keeps track of the state of touch, stylus and tool buttons. */ -class TouchButtonAccumulator { -public: - TouchButtonAccumulator(); - void configure(InputDevice* device); - void reset(InputDevice* device); - - void process(const RawEvent* rawEvent); - - uint32_t getButtonState() const; - int32_t getToolType() const; - bool isToolActive() const; - bool isHovering() const; - bool hasStylus() const; - -private: - bool mHaveBtnTouch; - bool mHaveStylus; - - bool mBtnTouch; - bool mBtnStylus; - bool mBtnStylus2; - bool mBtnToolFinger; - bool mBtnToolPen; - bool mBtnToolRubber; - bool mBtnToolBrush; - bool mBtnToolPencil; - bool mBtnToolAirbrush; - bool mBtnToolMouse; - bool mBtnToolLens; - bool mBtnToolDoubleTap; - bool mBtnToolTripleTap; - bool mBtnToolQuadTap; - - void clearButtons(); -}; - - -/* Raw axis information from the driver. */ -struct RawPointerAxes { - RawAbsoluteAxisInfo x; - RawAbsoluteAxisInfo y; - RawAbsoluteAxisInfo pressure; - RawAbsoluteAxisInfo touchMajor; - RawAbsoluteAxisInfo touchMinor; - RawAbsoluteAxisInfo toolMajor; - RawAbsoluteAxisInfo toolMinor; - RawAbsoluteAxisInfo orientation; - RawAbsoluteAxisInfo distance; - RawAbsoluteAxisInfo tiltX; - RawAbsoluteAxisInfo tiltY; - RawAbsoluteAxisInfo trackingId; - RawAbsoluteAxisInfo slot; - - RawPointerAxes(); - void clear(); -}; - - -/* Raw data for a collection of pointers including a pointer id mapping table. */ -struct RawPointerData { - struct Pointer { - uint32_t id; - int32_t x; - int32_t y; - int32_t pressure; - int32_t touchMajor; - int32_t touchMinor; - int32_t toolMajor; - int32_t toolMinor; - int32_t orientation; - int32_t distance; - int32_t tiltX; - int32_t tiltY; - int32_t toolType; // a fully decoded AMOTION_EVENT_TOOL_TYPE constant - bool isHovering; - }; - - uint32_t pointerCount; - Pointer pointers[MAX_POINTERS]; - BitSet32 hoveringIdBits, touchingIdBits; - uint32_t idToIndex[MAX_POINTER_ID + 1]; - - RawPointerData(); - void clear(); - void copyFrom(const RawPointerData& other); - void getCentroidOfTouchingPointers(float* outX, float* outY) const; - - inline void markIdBit(uint32_t id, bool isHovering) { - if (isHovering) { - hoveringIdBits.markBit(id); - } else { - touchingIdBits.markBit(id); - } - } - - inline void clearIdBits() { - hoveringIdBits.clear(); - touchingIdBits.clear(); - } - - inline const Pointer& pointerForId(uint32_t id) const { - return pointers[idToIndex[id]]; - } - - inline bool isHovering(uint32_t pointerIndex) { - return pointers[pointerIndex].isHovering; - } -}; - - -/* Cooked data for a collection of pointers including a pointer id mapping table. */ -struct CookedPointerData { - uint32_t pointerCount; - PointerProperties pointerProperties[MAX_POINTERS]; - PointerCoords pointerCoords[MAX_POINTERS]; - BitSet32 hoveringIdBits, touchingIdBits; - uint32_t idToIndex[MAX_POINTER_ID + 1]; - - CookedPointerData(); - void clear(); - void copyFrom(const CookedPointerData& other); - - inline const PointerCoords& pointerCoordsForId(uint32_t id) const { - return pointerCoords[idToIndex[id]]; - } - - inline PointerCoords& editPointerCoordsWithId(uint32_t id) { - return pointerCoords[idToIndex[id]]; - } - - inline PointerProperties& editPointerPropertiesWithId(uint32_t id) { - return pointerProperties[idToIndex[id]]; - } - - inline bool isHovering(uint32_t pointerIndex) const { - return hoveringIdBits.hasBit(pointerProperties[pointerIndex].id); - } - - inline bool isTouching(uint32_t pointerIndex) const { - return touchingIdBits.hasBit(pointerProperties[pointerIndex].id); - } -}; - - -/* Keeps track of the state of single-touch protocol. */ -class SingleTouchMotionAccumulator { -public: - SingleTouchMotionAccumulator(); - - void process(const RawEvent* rawEvent); - void reset(InputDevice* device); - - inline int32_t getAbsoluteX() const { return mAbsX; } - inline int32_t getAbsoluteY() const { return mAbsY; } - inline int32_t getAbsolutePressure() const { return mAbsPressure; } - inline int32_t getAbsoluteToolWidth() const { return mAbsToolWidth; } - inline int32_t getAbsoluteDistance() const { return mAbsDistance; } - inline int32_t getAbsoluteTiltX() const { return mAbsTiltX; } - inline int32_t getAbsoluteTiltY() const { return mAbsTiltY; } - -private: - int32_t mAbsX; - int32_t mAbsY; - int32_t mAbsPressure; - int32_t mAbsToolWidth; - int32_t mAbsDistance; - int32_t mAbsTiltX; - int32_t mAbsTiltY; - - void clearAbsoluteAxes(); -}; - - -/* Keeps track of the state of multi-touch protocol. */ -class MultiTouchMotionAccumulator { -public: - class Slot { - public: - inline bool isInUse() const { return mInUse; } - inline int32_t getX() const { return mAbsMTPositionX; } - inline int32_t getY() const { return mAbsMTPositionY; } - inline int32_t getTouchMajor() const { return mAbsMTTouchMajor; } - inline int32_t getTouchMinor() const { - return mHaveAbsMTTouchMinor ? mAbsMTTouchMinor : mAbsMTTouchMajor; } - inline int32_t getToolMajor() const { return mAbsMTWidthMajor; } - inline int32_t getToolMinor() const { - return mHaveAbsMTWidthMinor ? mAbsMTWidthMinor : mAbsMTWidthMajor; } - inline int32_t getOrientation() const { return mAbsMTOrientation; } - inline int32_t getTrackingId() const { return mAbsMTTrackingId; } - inline int32_t getPressure() const { return mAbsMTPressure; } - inline int32_t getDistance() const { return mAbsMTDistance; } - inline int32_t getToolType() const; - - private: - friend class MultiTouchMotionAccumulator; - - bool mInUse; - bool mHaveAbsMTTouchMinor; - bool mHaveAbsMTWidthMinor; - bool mHaveAbsMTToolType; - - int32_t mAbsMTPositionX; - int32_t mAbsMTPositionY; - int32_t mAbsMTTouchMajor; - int32_t mAbsMTTouchMinor; - int32_t mAbsMTWidthMajor; - int32_t mAbsMTWidthMinor; - int32_t mAbsMTOrientation; - int32_t mAbsMTTrackingId; - int32_t mAbsMTPressure; - int32_t mAbsMTDistance; - int32_t mAbsMTToolType; - - Slot(); - void clear(); - }; - - MultiTouchMotionAccumulator(); - ~MultiTouchMotionAccumulator(); - - void configure(InputDevice* device, size_t slotCount, bool usingSlotsProtocol); - void reset(InputDevice* device); - void process(const RawEvent* rawEvent); - void finishSync(); - bool hasStylus() const; - - inline size_t getSlotCount() const { return mSlotCount; } - inline const Slot* getSlot(size_t index) const { return &mSlots[index]; } - -private: - int32_t mCurrentSlot; - Slot* mSlots; - size_t mSlotCount; - bool mUsingSlotsProtocol; - bool mHaveStylus; - - void clearSlots(int32_t initialSlot); -}; - - -/* An input mapper transforms raw input events into cooked event data. - * A single input device can have multiple associated input mappers in order to interpret - * different classes of events. - * - * InputMapper lifecycle: - * - create - * - configure with 0 changes - * - reset - * - process, process, process (may occasionally reconfigure with non-zero changes or reset) - * - reset - * - destroy - */ -class InputMapper { -public: - InputMapper(InputDevice* device); - virtual ~InputMapper(); - - inline InputDevice* getDevice() { return mDevice; } - inline int32_t getDeviceId() { return mDevice->getId(); } - inline const String8 getDeviceName() { return mDevice->getName(); } - inline InputReaderContext* getContext() { return mContext; } - inline InputReaderPolicyInterface* getPolicy() { return mContext->getPolicy(); } - inline InputListenerInterface* getListener() { return mContext->getListener(); } - inline EventHubInterface* getEventHub() { return mContext->getEventHub(); } - - virtual uint32_t getSources() = 0; - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void dump(String8& dump); - virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent) = 0; - virtual void timeoutExpired(nsecs_t when); - - virtual int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode); - virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode); - virtual int32_t getSwitchState(uint32_t sourceMask, int32_t switchCode); - virtual bool markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags); - virtual void vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, - int32_t token); - virtual void cancelVibrate(int32_t token); - virtual void cancelTouch(nsecs_t when); - - virtual int32_t getMetaState(); - - virtual void updateExternalStylusState(const StylusState& state); - - virtual void fadePointer(); - -protected: - InputDevice* mDevice; - InputReaderContext* mContext; - - status_t getAbsoluteAxisInfo(int32_t axis, RawAbsoluteAxisInfo* axisInfo); - void bumpGeneration(); - - static void dumpRawAbsoluteAxisInfo(String8& dump, - const RawAbsoluteAxisInfo& axis, const char* name); - static void dumpStylusState(String8& dump, const StylusState& state); -}; - - -class SwitchInputMapper : public InputMapper { -public: - SwitchInputMapper(InputDevice* device); - virtual ~SwitchInputMapper(); - - virtual uint32_t getSources(); - virtual void process(const RawEvent* rawEvent); - - virtual int32_t getSwitchState(uint32_t sourceMask, int32_t switchCode); - virtual void dump(String8& dump); - -private: - uint32_t mSwitchValues; - uint32_t mUpdatedSwitchMask; - - void processSwitch(int32_t switchCode, int32_t switchValue); - void sync(nsecs_t when); -}; - - -class VibratorInputMapper : public InputMapper { -public: - VibratorInputMapper(InputDevice* device); - virtual ~VibratorInputMapper(); - - virtual uint32_t getSources(); - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void process(const RawEvent* rawEvent); - - virtual void vibrate(const nsecs_t* pattern, size_t patternSize, ssize_t repeat, - int32_t token); - virtual void cancelVibrate(int32_t token); - virtual void timeoutExpired(nsecs_t when); - virtual void dump(String8& dump); - -private: - bool mVibrating; - nsecs_t mPattern[MAX_VIBRATE_PATTERN_SIZE]; - size_t mPatternSize; - ssize_t mRepeat; - int32_t mToken; - ssize_t mIndex; - nsecs_t mNextStepTime; - - void nextStep(); - void stopVibrating(); -}; - - -class KeyboardInputMapper : public InputMapper { -public: - KeyboardInputMapper(InputDevice* device, uint32_t source, int32_t keyboardType); - virtual ~KeyboardInputMapper(); - - virtual uint32_t getSources(); - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void dump(String8& dump); - virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - - virtual int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode); - virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode); - virtual bool markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags); - - virtual int32_t getMetaState(); - -private: - struct KeyDown { - int32_t keyCode; - int32_t scanCode; - }; - - uint32_t mSource; - int32_t mKeyboardType; - - int32_t mOrientation; // orientation for dpad keys - - Vector mKeyDowns; // keys that are down - int32_t mMetaState; - nsecs_t mDownTime; // time of most recent key down - - int32_t mCurrentHidUsage; // most recent HID usage seen this packet, or 0 if none - - struct LedState { - bool avail; // led is available - bool on; // we think the led is currently on - }; - LedState mCapsLockLedState; - LedState mNumLockLedState; - LedState mScrollLockLedState; - - // Immutable configuration parameters. - struct Parameters { - bool hasAssociatedDisplay; - bool orientationAware; - bool handlesKeyRepeat; - } mParameters; - - void configureParameters(); - void dumpParameters(String8& dump); - - bool isKeyboardOrGamepadKey(int32_t scanCode); - - void processKey(nsecs_t when, bool down, int32_t scanCode, int32_t usageCode); - - ssize_t findKeyDown(int32_t scanCode); - - void resetLedState(); - void initializeLedState(LedState& ledState, int32_t led); - void updateLedState(bool reset); - void updateLedStateForModifier(LedState& ledState, int32_t led, - int32_t modifier, bool reset); -}; - - -class CursorInputMapper : public InputMapper { -public: - CursorInputMapper(InputDevice* device); - virtual ~CursorInputMapper(); - - virtual uint32_t getSources(); - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void dump(String8& dump); - virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - - virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode); - - virtual void fadePointer(); - -private: - // Amount that trackball needs to move in order to generate a key event. - static const int32_t TRACKBALL_MOVEMENT_THRESHOLD = 6; - - // Immutable configuration parameters. - struct Parameters { - enum Mode { - MODE_POINTER, - MODE_NAVIGATION, - }; - - Mode mode; - bool hasAssociatedDisplay; - bool orientationAware; - } mParameters; - - CursorButtonAccumulator mCursorButtonAccumulator; - CursorMotionAccumulator mCursorMotionAccumulator; - CursorScrollAccumulator mCursorScrollAccumulator; - - int32_t mSource; - float mXScale; - float mYScale; - float mXPrecision; - float mYPrecision; - - float mVWheelScale; - float mHWheelScale; - - // Velocity controls for mouse pointer and wheel movements. - // The controls for X and Y wheel movements are separate to keep them decoupled. - VelocityControl mPointerVelocityControl; - VelocityControl mWheelXVelocityControl; - VelocityControl mWheelYVelocityControl; - - int32_t mOrientation; - - sp mPointerController; - - int32_t mButtonState; - nsecs_t mDownTime; - - void configureParameters(); - void dumpParameters(String8& dump); - - void sync(nsecs_t when); -}; - - -class TouchInputMapper : public InputMapper { -public: - TouchInputMapper(InputDevice* device); - virtual ~TouchInputMapper(); - - virtual uint32_t getSources(); - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void dump(String8& dump); - virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - - virtual int32_t getKeyCodeState(uint32_t sourceMask, int32_t keyCode); - virtual int32_t getScanCodeState(uint32_t sourceMask, int32_t scanCode); - virtual bool markSupportedKeyCodes(uint32_t sourceMask, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags); - - virtual void fadePointer(); - virtual void cancelTouch(nsecs_t when); - virtual void timeoutExpired(nsecs_t when); - virtual void updateExternalStylusState(const StylusState& state); - -protected: - CursorButtonAccumulator mCursorButtonAccumulator; - CursorScrollAccumulator mCursorScrollAccumulator; - TouchButtonAccumulator mTouchButtonAccumulator; - - struct VirtualKey { - int32_t keyCode; - int32_t scanCode; - uint32_t flags; - - // computed hit box, specified in touch screen coords based on known display size - int32_t hitLeft; - int32_t hitTop; - int32_t hitRight; - int32_t hitBottom; - - inline bool isHit(int32_t x, int32_t y) const { - return x >= hitLeft && x <= hitRight && y >= hitTop && y <= hitBottom; - } - }; - - // Input sources and device mode. - uint32_t mSource; - - enum DeviceMode { - DEVICE_MODE_DISABLED, // input is disabled - DEVICE_MODE_DIRECT, // direct mapping (touchscreen) - DEVICE_MODE_UNSCALED, // unscaled mapping (touchpad) - DEVICE_MODE_NAVIGATION, // unscaled mapping with assist gesture (touch navigation) - DEVICE_MODE_POINTER, // pointer mapping (pointer) - }; - DeviceMode mDeviceMode; - - // The reader's configuration. - InputReaderConfiguration mConfig; - - // Immutable configuration parameters. - struct Parameters { - enum DeviceType { - DEVICE_TYPE_TOUCH_SCREEN, - DEVICE_TYPE_TOUCH_PAD, - DEVICE_TYPE_TOUCH_NAVIGATION, - DEVICE_TYPE_POINTER, - }; - - DeviceType deviceType; - bool hasAssociatedDisplay; - bool associatedDisplayIsExternal; - bool orientationAware; - bool hasButtonUnderPad; - - enum GestureMode { - GESTURE_MODE_POINTER, - GESTURE_MODE_SPOTS, - }; - GestureMode gestureMode; - - bool wake; - } mParameters; - - // Immutable calibration parameters in parsed form. - struct Calibration { - // Size - enum SizeCalibration { - SIZE_CALIBRATION_DEFAULT, - SIZE_CALIBRATION_NONE, - SIZE_CALIBRATION_GEOMETRIC, - SIZE_CALIBRATION_DIAMETER, - SIZE_CALIBRATION_BOX, - SIZE_CALIBRATION_AREA, - }; - - SizeCalibration sizeCalibration; - - bool haveSizeScale; - float sizeScale; - bool haveSizeBias; - float sizeBias; - bool haveSizeIsSummed; - bool sizeIsSummed; - - // Pressure - enum PressureCalibration { - PRESSURE_CALIBRATION_DEFAULT, - PRESSURE_CALIBRATION_NONE, - PRESSURE_CALIBRATION_PHYSICAL, - PRESSURE_CALIBRATION_AMPLITUDE, - }; - - PressureCalibration pressureCalibration; - bool havePressureScale; - float pressureScale; - - // Orientation - enum OrientationCalibration { - ORIENTATION_CALIBRATION_DEFAULT, - ORIENTATION_CALIBRATION_NONE, - ORIENTATION_CALIBRATION_INTERPOLATED, - ORIENTATION_CALIBRATION_VECTOR, - }; - - OrientationCalibration orientationCalibration; - - // Distance - enum DistanceCalibration { - DISTANCE_CALIBRATION_DEFAULT, - DISTANCE_CALIBRATION_NONE, - DISTANCE_CALIBRATION_SCALED, - }; - - DistanceCalibration distanceCalibration; - bool haveDistanceScale; - float distanceScale; - - enum CoverageCalibration { - COVERAGE_CALIBRATION_DEFAULT, - COVERAGE_CALIBRATION_NONE, - COVERAGE_CALIBRATION_BOX, - }; - - CoverageCalibration coverageCalibration; - - inline void applySizeScaleAndBias(float* outSize) const { - if (haveSizeScale) { - *outSize *= sizeScale; - } - if (haveSizeBias) { - *outSize += sizeBias; - } - if (*outSize < 0) { - *outSize = 0; - } - } - } mCalibration; - - // Affine location transformation/calibration - struct TouchAffineTransformation mAffineTransform; - - RawPointerAxes mRawPointerAxes; - - struct RawState { - nsecs_t when; - - // Raw pointer sample data. - RawPointerData rawPointerData; - - int32_t buttonState; - - // Scroll state. - int32_t rawVScroll; - int32_t rawHScroll; - - void copyFrom(const RawState& other) { - when = other.when; - rawPointerData.copyFrom(other.rawPointerData); - buttonState = other.buttonState; - rawVScroll = other.rawVScroll; - rawHScroll = other.rawHScroll; - } - - void clear() { - when = 0; - rawPointerData.clear(); - buttonState = 0; - rawVScroll = 0; - rawHScroll = 0; - } - }; - - struct CookedState { - // Cooked pointer sample data. - CookedPointerData cookedPointerData; - - // Id bits used to differentiate fingers, stylus and mouse tools. - BitSet32 fingerIdBits; - BitSet32 stylusIdBits; - BitSet32 mouseIdBits; - - int32_t buttonState; - - void copyFrom(const CookedState& other) { - cookedPointerData.copyFrom(other.cookedPointerData); - fingerIdBits = other.fingerIdBits; - stylusIdBits = other.stylusIdBits; - mouseIdBits = other.mouseIdBits; - buttonState = other.buttonState; - } - - void clear() { - cookedPointerData.clear(); - fingerIdBits.clear(); - stylusIdBits.clear(); - mouseIdBits.clear(); - buttonState = 0; - } - }; - - Vector mRawStatesPending; - RawState mCurrentRawState; - CookedState mCurrentCookedState; - RawState mLastRawState; - CookedState mLastCookedState; - - // State provided by an external stylus - StylusState mExternalStylusState; - int64_t mExternalStylusId; - nsecs_t mExternalStylusFusionTimeout; - bool mExternalStylusDataPending; - - // True if we sent a HOVER_ENTER event. - bool mSentHoverEnter; - - // Have we assigned pointer IDs for this stream - bool mHavePointerIds; - - // Is the current stream of direct touch events aborted - bool mCurrentMotionAborted; - - // The time the primary pointer last went down. - nsecs_t mDownTime; - - // The pointer controller, or null if the device is not a pointer. - sp mPointerController; - - Vector mVirtualKeys; - - virtual void configureParameters(); - virtual void dumpParameters(String8& dump); - virtual void configureRawPointerAxes(); - virtual void dumpRawPointerAxes(String8& dump); - virtual void configureSurface(nsecs_t when, bool* outResetNeeded); - virtual void dumpSurface(String8& dump); - virtual void configureVirtualKeys(); - virtual void dumpVirtualKeys(String8& dump); - virtual void parseCalibration(); - virtual void resolveCalibration(); - virtual void dumpCalibration(String8& dump); - virtual void updateAffineTransformation(); - virtual void dumpAffineTransformation(String8& dump); - virtual void resolveExternalStylusPresence(); - virtual bool hasStylus() const = 0; - virtual bool hasExternalStylus() const; - - virtual void syncTouch(nsecs_t when, RawState* outState) = 0; - -private: - // The current viewport. - // The components of the viewport are specified in the display's rotated orientation. - DisplayViewport mViewport; - - // The surface orientation, width and height set by configureSurface(). - // The width and height are derived from the viewport but are specified - // in the natural orientation. - // The surface origin specifies how the surface coordinates should be translated - // to align with the logical display coordinate space. - // The orientation may be different from the viewport orientation as it specifies - // the rotation of the surface coordinates required to produce the viewport's - // requested orientation, so it will depend on whether the device is orientation aware. - int32_t mSurfaceWidth; - int32_t mSurfaceHeight; - int32_t mSurfaceLeft; - int32_t mSurfaceTop; - int32_t mSurfaceOrientation; - - // Translation and scaling factors, orientation-independent. - float mXTranslate; - float mXScale; - float mXPrecision; - - float mYTranslate; - float mYScale; - float mYPrecision; - - float mGeometricScale; - - float mPressureScale; - - float mSizeScale; - - float mOrientationScale; - - float mDistanceScale; - - bool mHaveTilt; - float mTiltXCenter; - float mTiltXScale; - float mTiltYCenter; - float mTiltYScale; - - bool mExternalStylusConnected; - - // Oriented motion ranges for input device info. - struct OrientedRanges { - InputDeviceInfo::MotionRange x; - InputDeviceInfo::MotionRange y; - InputDeviceInfo::MotionRange pressure; - - bool haveSize; - InputDeviceInfo::MotionRange size; - - bool haveTouchSize; - InputDeviceInfo::MotionRange touchMajor; - InputDeviceInfo::MotionRange touchMinor; - - bool haveToolSize; - InputDeviceInfo::MotionRange toolMajor; - InputDeviceInfo::MotionRange toolMinor; - - bool haveOrientation; - InputDeviceInfo::MotionRange orientation; - - bool haveDistance; - InputDeviceInfo::MotionRange distance; - - bool haveTilt; - InputDeviceInfo::MotionRange tilt; - - OrientedRanges() { - clear(); - } - - void clear() { - haveSize = false; - haveTouchSize = false; - haveToolSize = false; - haveOrientation = false; - haveDistance = false; - haveTilt = false; - } - } mOrientedRanges; - - // Oriented dimensions and precision. - float mOrientedXPrecision; - float mOrientedYPrecision; - - struct CurrentVirtualKeyState { - bool down; - bool ignored; - nsecs_t downTime; - int32_t keyCode; - int32_t scanCode; - } mCurrentVirtualKey; - - // Scale factor for gesture or mouse based pointer movements. - float mPointerXMovementScale; - float mPointerYMovementScale; - - // Scale factor for gesture based zooming and other freeform motions. - float mPointerXZoomScale; - float mPointerYZoomScale; - - // The maximum swipe width. - float mPointerGestureMaxSwipeWidth; - - struct PointerDistanceHeapElement { - uint32_t currentPointerIndex : 8; - uint32_t lastPointerIndex : 8; - uint64_t distance : 48; // squared distance - }; - - enum PointerUsage { - POINTER_USAGE_NONE, - POINTER_USAGE_GESTURES, - POINTER_USAGE_STYLUS, - POINTER_USAGE_MOUSE, - }; - PointerUsage mPointerUsage; - - struct PointerGesture { - enum Mode { - // No fingers, button is not pressed. - // Nothing happening. - NEUTRAL, - - // No fingers, button is not pressed. - // Tap detected. - // Emits DOWN and UP events at the pointer location. - TAP, - - // Exactly one finger dragging following a tap. - // Pointer follows the active finger. - // Emits DOWN, MOVE and UP events at the pointer location. - // - // Detect double-taps when the finger goes up while in TAP_DRAG mode. - TAP_DRAG, - - // Button is pressed. - // Pointer follows the active finger if there is one. Other fingers are ignored. - // Emits DOWN, MOVE and UP events at the pointer location. - BUTTON_CLICK_OR_DRAG, - - // Exactly one finger, button is not pressed. - // Pointer follows the active finger. - // Emits HOVER_MOVE events at the pointer location. - // - // Detect taps when the finger goes up while in HOVER mode. - HOVER, - - // Exactly two fingers but neither have moved enough to clearly indicate - // whether a swipe or freeform gesture was intended. We consider the - // pointer to be pressed so this enables clicking or long-pressing on buttons. - // Pointer does not move. - // Emits DOWN, MOVE and UP events with a single stationary pointer coordinate. - PRESS, - - // Exactly two fingers moving in the same direction, button is not pressed. - // Pointer does not move. - // Emits DOWN, MOVE and UP events with a single pointer coordinate that - // follows the midpoint between both fingers. - SWIPE, - - // Two or more fingers moving in arbitrary directions, button is not pressed. - // Pointer does not move. - // Emits DOWN, POINTER_DOWN, MOVE, POINTER_UP and UP events that follow - // each finger individually relative to the initial centroid of the finger. - FREEFORM, - - // Waiting for quiet time to end before starting the next gesture. - QUIET, - }; - - // Time the first finger went down. - nsecs_t firstTouchTime; - - // The active pointer id from the raw touch data. - int32_t activeTouchId; // -1 if none - - // The active pointer id from the gesture last delivered to the application. - int32_t activeGestureId; // -1 if none - - // Pointer coords and ids for the current and previous pointer gesture. - Mode currentGestureMode; - BitSet32 currentGestureIdBits; - uint32_t currentGestureIdToIndex[MAX_POINTER_ID + 1]; - PointerProperties currentGestureProperties[MAX_POINTERS]; - PointerCoords currentGestureCoords[MAX_POINTERS]; - - Mode lastGestureMode; - BitSet32 lastGestureIdBits; - uint32_t lastGestureIdToIndex[MAX_POINTER_ID + 1]; - PointerProperties lastGestureProperties[MAX_POINTERS]; - PointerCoords lastGestureCoords[MAX_POINTERS]; - - // Time the pointer gesture last went down. - nsecs_t downTime; - - // Time when the pointer went down for a TAP. - nsecs_t tapDownTime; - - // Time when the pointer went up for a TAP. - nsecs_t tapUpTime; - - // Location of initial tap. - float tapX, tapY; - - // Time we started waiting for quiescence. - nsecs_t quietTime; - - // Reference points for multitouch gestures. - float referenceTouchX; // reference touch X/Y coordinates in surface units - float referenceTouchY; - float referenceGestureX; // reference gesture X/Y coordinates in pixels - float referenceGestureY; - - // Distance that each pointer has traveled which has not yet been - // subsumed into the reference gesture position. - BitSet32 referenceIdBits; - struct Delta { - float dx, dy; - }; - Delta referenceDeltas[MAX_POINTER_ID + 1]; - - // Describes how touch ids are mapped to gesture ids for freeform gestures. - uint32_t freeformTouchToGestureIdMap[MAX_POINTER_ID + 1]; - - // A velocity tracker for determining whether to switch active pointers during drags. - VelocityTracker velocityTracker; - - void reset() { - firstTouchTime = LLONG_MIN; - activeTouchId = -1; - activeGestureId = -1; - currentGestureMode = NEUTRAL; - currentGestureIdBits.clear(); - lastGestureMode = NEUTRAL; - lastGestureIdBits.clear(); - downTime = 0; - velocityTracker.clear(); - resetTap(); - resetQuietTime(); - } - - void resetTap() { - tapDownTime = LLONG_MIN; - tapUpTime = LLONG_MIN; - } - - void resetQuietTime() { - quietTime = LLONG_MIN; - } - } mPointerGesture; - - struct PointerSimple { - PointerCoords currentCoords; - PointerProperties currentProperties; - PointerCoords lastCoords; - PointerProperties lastProperties; - - // True if the pointer is down. - bool down; - - // True if the pointer is hovering. - bool hovering; - - // Time the pointer last went down. - nsecs_t downTime; - - void reset() { - currentCoords.clear(); - currentProperties.clear(); - lastCoords.clear(); - lastProperties.clear(); - down = false; - hovering = false; - downTime = 0; - } - } mPointerSimple; - - // The pointer and scroll velocity controls. - VelocityControl mPointerVelocityControl; - VelocityControl mWheelXVelocityControl; - VelocityControl mWheelYVelocityControl; - - void resetExternalStylus(); - void clearStylusDataPendingFlags(); - - void sync(nsecs_t when); - - bool consumeRawTouches(nsecs_t when, uint32_t policyFlags); - void processRawTouches(bool timeout); - void cookAndDispatch(nsecs_t when); - void dispatchVirtualKey(nsecs_t when, uint32_t policyFlags, - int32_t keyEventAction, int32_t keyEventFlags); - - void dispatchTouches(nsecs_t when, uint32_t policyFlags); - void dispatchHoverExit(nsecs_t when, uint32_t policyFlags); - void dispatchHoverEnterAndMove(nsecs_t when, uint32_t policyFlags); - void dispatchButtonRelease(nsecs_t when, uint32_t policyFlags); - void dispatchButtonPress(nsecs_t when, uint32_t policyFlags); - const BitSet32& findActiveIdBits(const CookedPointerData& cookedPointerData); - void cookPointerData(); - void abortTouches(nsecs_t when, uint32_t policyFlags); - - void dispatchPointerUsage(nsecs_t when, uint32_t policyFlags, PointerUsage pointerUsage); - void abortPointerUsage(nsecs_t when, uint32_t policyFlags); - - void dispatchPointerGestures(nsecs_t when, uint32_t policyFlags, bool isTimeout); - void abortPointerGestures(nsecs_t when, uint32_t policyFlags); - bool preparePointerGestures(nsecs_t when, - bool* outCancelPreviousGesture, bool* outFinishPreviousGesture, - bool isTimeout); - - void dispatchPointerStylus(nsecs_t when, uint32_t policyFlags); - void abortPointerStylus(nsecs_t when, uint32_t policyFlags); - - void dispatchPointerMouse(nsecs_t when, uint32_t policyFlags); - void abortPointerMouse(nsecs_t when, uint32_t policyFlags); - - void dispatchPointerSimple(nsecs_t when, uint32_t policyFlags, - bool down, bool hovering); - void abortPointerSimple(nsecs_t when, uint32_t policyFlags); - - bool assignExternalStylusId(const RawState& state, bool timeout); - void applyExternalStylusButtonState(nsecs_t when); - void applyExternalStylusTouchState(nsecs_t when); - - // Dispatches a motion event. - // If the changedId is >= 0 and the action is POINTER_DOWN or POINTER_UP, the - // method will take care of setting the index and transmuting the action to DOWN or UP - // it is the first / last pointer to go down / up. - void dispatchMotion(nsecs_t when, uint32_t policyFlags, uint32_t source, - int32_t action, int32_t actionButton, - int32_t flags, int32_t metaState, int32_t buttonState, int32_t edgeFlags, - const PointerProperties* properties, const PointerCoords* coords, - const uint32_t* idToIndex, BitSet32 idBits, - int32_t changedId, float xPrecision, float yPrecision, nsecs_t downTime); - - // Updates pointer coords and properties for pointers with specified ids that have moved. - // Returns true if any of them changed. - bool updateMovedPointers(const PointerProperties* inProperties, - const PointerCoords* inCoords, const uint32_t* inIdToIndex, - PointerProperties* outProperties, PointerCoords* outCoords, - const uint32_t* outIdToIndex, BitSet32 idBits) const; - - bool isPointInsideSurface(int32_t x, int32_t y); - const VirtualKey* findVirtualKeyHit(int32_t x, int32_t y); - - static void assignPointerIds(const RawState* last, RawState* current); -}; - - -class SingleTouchInputMapper : public TouchInputMapper { -public: - SingleTouchInputMapper(InputDevice* device); - virtual ~SingleTouchInputMapper(); - - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - -protected: - virtual void syncTouch(nsecs_t when, RawState* outState); - virtual void configureRawPointerAxes(); - virtual bool hasStylus() const; - -private: - SingleTouchMotionAccumulator mSingleTouchMotionAccumulator; -}; - - -class MultiTouchInputMapper : public TouchInputMapper { -public: - MultiTouchInputMapper(InputDevice* device); - virtual ~MultiTouchInputMapper(); - - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - -protected: - virtual void syncTouch(nsecs_t when, RawState* outState); - virtual void configureRawPointerAxes(); - virtual bool hasStylus() const; - -private: - MultiTouchMotionAccumulator mMultiTouchMotionAccumulator; - - // Specifies the pointer id bits that are in use, and their associated tracking id. - BitSet32 mPointerIdBits; - int32_t mPointerTrackingIdMap[MAX_POINTER_ID + 1]; -}; - -class ExternalStylusInputMapper : public InputMapper { -public: - ExternalStylusInputMapper(InputDevice* device); - virtual ~ExternalStylusInputMapper() = default; - - virtual uint32_t getSources(); - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void dump(String8& dump); - virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - virtual void sync(nsecs_t when); - -private: - SingleTouchMotionAccumulator mSingleTouchMotionAccumulator; - RawAbsoluteAxisInfo mRawPressureAxis; - TouchButtonAccumulator mTouchButtonAccumulator; - - StylusState mStylusState; -}; - - -class JoystickInputMapper : public InputMapper { -public: - JoystickInputMapper(InputDevice* device); - virtual ~JoystickInputMapper(); - - virtual uint32_t getSources(); - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo); - virtual void dump(String8& dump); - virtual void configure(nsecs_t when, const InputReaderConfiguration* config, uint32_t changes); - virtual void reset(nsecs_t when); - virtual void process(const RawEvent* rawEvent); - -private: - struct Axis { - RawAbsoluteAxisInfo rawAxisInfo; - AxisInfo axisInfo; - - bool explicitlyMapped; // true if the axis was explicitly assigned an axis id - - float scale; // scale factor from raw to normalized values - float offset; // offset to add after scaling for normalization - float highScale; // scale factor from raw to normalized values of high split - float highOffset; // offset to add after scaling for normalization of high split - - float min; // normalized inclusive minimum - float max; // normalized inclusive maximum - float flat; // normalized flat region size - float fuzz; // normalized error tolerance - float resolution; // normalized resolution in units/mm - - float filter; // filter out small variations of this size - float currentValue; // current value - float newValue; // most recent value - float highCurrentValue; // current value of high split - float highNewValue; // most recent value of high split - - void initialize(const RawAbsoluteAxisInfo& rawAxisInfo, const AxisInfo& axisInfo, - bool explicitlyMapped, float scale, float offset, - float highScale, float highOffset, - float min, float max, float flat, float fuzz, float resolution) { - this->rawAxisInfo = rawAxisInfo; - this->axisInfo = axisInfo; - this->explicitlyMapped = explicitlyMapped; - this->scale = scale; - this->offset = offset; - this->highScale = highScale; - this->highOffset = highOffset; - this->min = min; - this->max = max; - this->flat = flat; - this->fuzz = fuzz; - this->resolution = resolution; - this->filter = 0; - resetValue(); - } - - void resetValue() { - this->currentValue = 0; - this->newValue = 0; - this->highCurrentValue = 0; - this->highNewValue = 0; - } - }; - - // Axes indexed by raw ABS_* axis index. - KeyedVector mAxes; - - void sync(nsecs_t when, bool force); - - bool haveAxis(int32_t axisId); - void pruneAxes(bool ignoreExplicitlyMappedAxes); - bool filterAxes(bool force); - - static bool hasValueChangedSignificantly(float filter, - float newValue, float currentValue, float min, float max); - static bool hasMovedNearerToValueWithinFilteredRange(float filter, - float newValue, float currentValue, float thresholdValue); - - static bool isCenteredAxis(int32_t axis); - static int32_t getCompatAxis(int32_t axis); - - static void addMotionRange(int32_t axisId, const Axis& axis, InputDeviceInfo* info); - static void setPointerCoordsAxisValue(PointerCoords* pointerCoords, int32_t axis, - float value); -}; - -} // namespace android - -#endif // _UI_INPUT_READER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputWindow.cpp android-platform-frameworks-native-21/services/inputflinger/InputWindow.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputWindow.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputWindow.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,72 +0,0 @@ -/* - * 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. - */ - -#define LOG_TAG "InputWindow" -#define LOG_NDEBUG 0 - -#include "InputWindow.h" - -#include - -#include -#include - -namespace android { - -// --- InputWindowInfo --- -void InputWindowInfo::addTouchableRegion(const Rect& region) { - touchableRegion.orSelf(region); -} - -bool InputWindowInfo::touchableRegionContainsPoint(int32_t x, int32_t y) const { - return touchableRegion.contains(x,y); -} - -bool InputWindowInfo::frameContainsPoint(int32_t x, int32_t y) const { - return x >= frameLeft && x <= frameRight - && y >= frameTop && y <= frameBottom; -} - -bool InputWindowInfo::isTrustedOverlay() const { - return layoutParamsType == TYPE_INPUT_METHOD - || layoutParamsType == TYPE_INPUT_METHOD_DIALOG - || layoutParamsType == TYPE_MAGNIFICATION_OVERLAY - || layoutParamsType == TYPE_SECURE_SYSTEM_OVERLAY; -} - -bool InputWindowInfo::supportsSplitTouch() const { - return layoutParamsFlags & FLAG_SPLIT_TOUCH; -} - - -// --- InputWindowHandle --- - -InputWindowHandle::InputWindowHandle(const sp& inputApplicationHandle) : - inputApplicationHandle(inputApplicationHandle), mInfo(NULL) { -} - -InputWindowHandle::~InputWindowHandle() { - delete mInfo; -} - -void InputWindowHandle::releaseInfo() { - if (mInfo) { - delete mInfo; - mInfo = NULL; - } -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputWindow.h android-platform-frameworks-native-21/services/inputflinger/InputWindow.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/InputWindow.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/InputWindow.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,204 +0,0 @@ -/* - * 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. - */ - -#ifndef _UI_INPUT_WINDOW_H -#define _UI_INPUT_WINDOW_H - -#include -#include -#include -#include -#include -#include -#include - -#include "InputApplication.h" - -namespace android { - - -/* - * Describes the properties of a window that can receive input. - */ -struct InputWindowInfo { - // Window flags from WindowManager.LayoutParams - enum { - FLAG_ALLOW_LOCK_WHILE_SCREEN_ON = 0x00000001, - FLAG_DIM_BEHIND = 0x00000002, - FLAG_BLUR_BEHIND = 0x00000004, - FLAG_NOT_FOCUSABLE = 0x00000008, - FLAG_NOT_TOUCHABLE = 0x00000010, - FLAG_NOT_TOUCH_MODAL = 0x00000020, - FLAG_TOUCHABLE_WHEN_WAKING = 0x00000040, - FLAG_KEEP_SCREEN_ON = 0x00000080, - FLAG_LAYOUT_IN_SCREEN = 0x00000100, - FLAG_LAYOUT_NO_LIMITS = 0x00000200, - FLAG_FULLSCREEN = 0x00000400, - FLAG_FORCE_NOT_FULLSCREEN = 0x00000800, - FLAG_DITHER = 0x00001000, - FLAG_SECURE = 0x00002000, - FLAG_SCALED = 0x00004000, - FLAG_IGNORE_CHEEK_PRESSES = 0x00008000, - FLAG_LAYOUT_INSET_DECOR = 0x00010000, - FLAG_ALT_FOCUSABLE_IM = 0x00020000, - FLAG_WATCH_OUTSIDE_TOUCH = 0x00040000, - FLAG_SHOW_WHEN_LOCKED = 0x00080000, - FLAG_SHOW_WALLPAPER = 0x00100000, - FLAG_TURN_SCREEN_ON = 0x00200000, - FLAG_DISMISS_KEYGUARD = 0x00400000, - FLAG_SPLIT_TOUCH = 0x00800000, - FLAG_SLIPPERY = 0x20000000, - FLAG_NEEDS_MENU_KEY = 0x40000000, - }; - - // Window types from WindowManager.LayoutParams - enum { - FIRST_APPLICATION_WINDOW = 1, - TYPE_BASE_APPLICATION = 1, - TYPE_APPLICATION = 2, - TYPE_APPLICATION_STARTING = 3, - LAST_APPLICATION_WINDOW = 99, - FIRST_SUB_WINDOW = 1000, - TYPE_APPLICATION_PANEL = FIRST_SUB_WINDOW, - TYPE_APPLICATION_MEDIA = FIRST_SUB_WINDOW+1, - TYPE_APPLICATION_SUB_PANEL = FIRST_SUB_WINDOW+2, - TYPE_APPLICATION_ATTACHED_DIALOG = FIRST_SUB_WINDOW+3, - TYPE_APPLICATION_MEDIA_OVERLAY = FIRST_SUB_WINDOW+4, - LAST_SUB_WINDOW = 1999, - FIRST_SYSTEM_WINDOW = 2000, - TYPE_STATUS_BAR = FIRST_SYSTEM_WINDOW, - TYPE_SEARCH_BAR = FIRST_SYSTEM_WINDOW+1, - TYPE_PHONE = FIRST_SYSTEM_WINDOW+2, - TYPE_SYSTEM_ALERT = FIRST_SYSTEM_WINDOW+3, - TYPE_KEYGUARD = FIRST_SYSTEM_WINDOW+4, - TYPE_TOAST = FIRST_SYSTEM_WINDOW+5, - TYPE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+6, - TYPE_PRIORITY_PHONE = FIRST_SYSTEM_WINDOW+7, - TYPE_SYSTEM_DIALOG = FIRST_SYSTEM_WINDOW+8, - TYPE_KEYGUARD_DIALOG = FIRST_SYSTEM_WINDOW+9, - TYPE_SYSTEM_ERROR = FIRST_SYSTEM_WINDOW+10, - TYPE_INPUT_METHOD = FIRST_SYSTEM_WINDOW+11, - TYPE_INPUT_METHOD_DIALOG= FIRST_SYSTEM_WINDOW+12, - TYPE_WALLPAPER = FIRST_SYSTEM_WINDOW+13, - TYPE_STATUS_BAR_PANEL = FIRST_SYSTEM_WINDOW+14, - TYPE_SECURE_SYSTEM_OVERLAY = FIRST_SYSTEM_WINDOW+15, - TYPE_DRAG = FIRST_SYSTEM_WINDOW+16, - TYPE_STATUS_BAR_SUB_PANEL = FIRST_SYSTEM_WINDOW+17, - TYPE_POINTER = FIRST_SYSTEM_WINDOW+18, - TYPE_NAVIGATION_BAR = FIRST_SYSTEM_WINDOW+19, - TYPE_VOLUME_OVERLAY = FIRST_SYSTEM_WINDOW+20, - TYPE_BOOT_PROGRESS = FIRST_SYSTEM_WINDOW+21, - TYPE_MAGNIFICATION_OVERLAY = FIRST_SYSTEM_WINDOW+22, - LAST_SYSTEM_WINDOW = 2999, - }; - - enum { - INPUT_FEATURE_DISABLE_TOUCH_PAD_GESTURES = 0x00000001, - INPUT_FEATURE_NO_INPUT_CHANNEL = 0x00000002, - INPUT_FEATURE_DISABLE_USER_ACTIVITY = 0x00000004, - }; - - sp inputChannel; - String8 name; - int32_t layoutParamsFlags; - int32_t layoutParamsType; - nsecs_t dispatchingTimeout; - int32_t frameLeft; - int32_t frameTop; - int32_t frameRight; - int32_t frameBottom; - float scaleFactor; - Region touchableRegion; - bool visible; - bool canReceiveKeys; - bool hasFocus; - bool hasWallpaper; - bool paused; - int32_t layer; - int32_t ownerPid; - int32_t ownerUid; - int32_t inputFeatures; - int32_t displayId; - - void addTouchableRegion(const Rect& region); - - bool touchableRegionContainsPoint(int32_t x, int32_t y) const; - bool frameContainsPoint(int32_t x, int32_t y) const; - - /* Returns true if the window is of a trusted type that is allowed to silently - * overlay other windows for the purpose of implementing the secure views feature. - * Trusted overlays, such as IME windows, can partly obscure other windows without causing - * motion events to be delivered to them with AMOTION_EVENT_FLAG_WINDOW_IS_OBSCURED. - */ - bool isTrustedOverlay() const; - - bool supportsSplitTouch() const; -}; - - -/* - * Handle for a window that can receive input. - * - * Used by the native input dispatcher to indirectly refer to the window manager objects - * that describe a window. - */ -class InputWindowHandle : public RefBase { -public: - const sp inputApplicationHandle; - - inline const InputWindowInfo* getInfo() const { - return mInfo; - } - - inline sp getInputChannel() const { - return mInfo ? mInfo->inputChannel : NULL; - } - - inline String8 getName() const { - return mInfo ? mInfo->name : String8(""); - } - - inline nsecs_t getDispatchingTimeout(nsecs_t defaultValue) const { - return mInfo ? mInfo->dispatchingTimeout : defaultValue; - } - - /** - * Requests that the state of this object be updated to reflect - * the most current available information about the application. - * - * This method should only be called from within the input dispatcher's - * critical section. - * - * Returns true on success, or false if the handle is no longer valid. - */ - virtual bool updateInfo() = 0; - - /** - * Releases the storage used by the associated information when it is - * no longer needed. - */ - void releaseInfo(); - -protected: - InputWindowHandle(const sp& inputApplicationHandle); - virtual ~InputWindowHandle(); - - InputWindowInfo* mInfo; -}; - -} // namespace android - -#endif // _UI_INPUT_WINDOW_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/PointerControllerInterface.h android-platform-frameworks-native-21/services/inputflinger/PointerControllerInterface.h --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/PointerControllerInterface.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/PointerControllerInterface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,105 +0,0 @@ -/* - * Copyright (C) 2014 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. - */ - -#ifndef _INPUTFLINGER_POINTER_CONTROLLER_INTERFACE_H -#define _INPUTFLINGER_POINTER_CONTROLLER_INTERFACE_H - -#include -#include -#include - -namespace android { - -/** - * Interface for tracking a mouse / touch pad pointer and touch pad spots. - * - * The spots are sprites on screen that visually represent the positions of - * fingers - * - * The pointer controller is responsible for providing synchronization and for tracking - * display orientation changes if needed. - */ -class PointerControllerInterface : public virtual RefBase { -protected: - PointerControllerInterface() { } - virtual ~PointerControllerInterface() { } - -public: - /* Gets the bounds of the region that the pointer can traverse. - * Returns true if the bounds are available. */ - virtual bool getBounds(float* outMinX, float* outMinY, - float* outMaxX, float* outMaxY) const = 0; - - /* Move the pointer. */ - virtual void move(float deltaX, float deltaY) = 0; - - /* Sets a mask that indicates which buttons are pressed. */ - virtual void setButtonState(int32_t buttonState) = 0; - - /* Gets a mask that indicates which buttons are pressed. */ - virtual int32_t getButtonState() const = 0; - - /* Sets the absolute location of the pointer. */ - virtual void setPosition(float x, float y) = 0; - - /* Gets the absolute location of the pointer. */ - virtual void getPosition(float* outX, float* outY) const = 0; - - enum Transition { - // Fade/unfade immediately. - TRANSITION_IMMEDIATE, - // Fade/unfade gradually. - TRANSITION_GRADUAL, - }; - - /* Fades the pointer out now. */ - virtual void fade(Transition transition) = 0; - - /* Makes the pointer visible if it has faded out. - * The pointer never unfades itself automatically. This method must be called - * by the client whenever the pointer is moved or a button is pressed and it - * wants to ensure that the pointer becomes visible again. */ - virtual void unfade(Transition transition) = 0; - - enum Presentation { - // Show the mouse pointer. - PRESENTATION_POINTER, - // Show spots and a spot anchor in place of the mouse pointer. - PRESENTATION_SPOT, - }; - - /* Sets the mode of the pointer controller. */ - virtual void setPresentation(Presentation presentation) = 0; - - /* Sets the spots for the current gesture. - * The spots are not subject to the inactivity timeout like the pointer - * itself it since they are expected to remain visible for so long as - * the fingers are on the touch pad. - * - * The values of the AMOTION_EVENT_AXIS_PRESSURE axis is significant. - * For spotCoords, pressure != 0 indicates that the spot's location is being - * pressed (not hovering). - */ - virtual void setSpots(const PointerCoords* spotCoords, const uint32_t* spotIdToIndex, - BitSet32 spotIdBits) = 0; - - /* Removes all spots. */ - virtual void clearSpots() = 0; -}; - -} // namespace android - -#endif // _INPUTFLINGER_POINTER_CONTROLLER_INTERFACE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/tests/Android.mk android-platform-frameworks-native-21/services/inputflinger/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/tests/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -# Build the unit tests. -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -# Build the unit tests. -test_src_files := \ - InputReader_test.cpp \ - InputDispatcher_test.cpp - -shared_libraries := \ - libcutils \ - liblog \ - libutils \ - libhardware \ - libhardware_legacy \ - libui \ - libskia \ - libinput \ - libinputflinger \ - libinputservice - -c_includes := \ - external/skia/include/core - - -module_tags := tests - -$(foreach file,$(test_src_files), \ - $(eval include $(CLEAR_VARS)) \ - $(eval LOCAL_SHARED_LIBRARIES := $(shared_libraries)) \ - $(eval LOCAL_C_INCLUDES := $(c_includes)) \ - $(eval LOCAL_CFLAGS += -Wno-unused-parameter) \ - $(eval LOCAL_SRC_FILES := $(file)) \ - $(eval LOCAL_MODULE := $(notdir $(file:%.cpp=%))) \ - $(eval LOCAL_MODULE_TAGS := $(module_tags)) \ - $(eval include $(BUILD_NATIVE_TEST)) \ -) - -# Build the manual test programs. -include $(call all-makefiles-under, $(LOCAL_PATH)) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/tests/InputDispatcher_test.cpp android-platform-frameworks-native-21/services/inputflinger/tests/InputDispatcher_test.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/tests/InputDispatcher_test.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/tests/InputDispatcher_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -/* - * Copyright (C) 2010 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 "../InputDispatcher.h" - -#include -#include - -namespace android { - -// An arbitrary time value. -static const nsecs_t ARBITRARY_TIME = 1234; - -// An arbitrary device id. -static const int32_t DEVICE_ID = 1; - -// An arbitrary display id. -static const int32_t DISPLAY_ID = 0; - -// An arbitrary injector pid / uid pair that has permission to inject events. -static const int32_t INJECTOR_PID = 999; -static const int32_t INJECTOR_UID = 1001; - - -// --- FakeInputDispatcherPolicy --- - -class FakeInputDispatcherPolicy : public InputDispatcherPolicyInterface { - InputDispatcherConfiguration mConfig; - -protected: - virtual ~FakeInputDispatcherPolicy() { - } - -public: - FakeInputDispatcherPolicy() { - } - -private: - virtual void notifyConfigurationChanged(nsecs_t) { - } - - virtual nsecs_t notifyANR(const sp&, - const sp&, - const String8&) { - return 0; - } - - virtual void notifyInputChannelBroken(const sp&) { - } - - virtual void getDispatcherConfiguration(InputDispatcherConfiguration* outConfig) { - *outConfig = mConfig; - } - - virtual bool filterInputEvent(const InputEvent*, uint32_t) { - return true; - } - - virtual void interceptKeyBeforeQueueing(const KeyEvent*, uint32_t&) { - } - - virtual void interceptMotionBeforeQueueing(nsecs_t, uint32_t&) { - } - - virtual nsecs_t interceptKeyBeforeDispatching(const sp&, - const KeyEvent*, uint32_t) { - return 0; - } - - virtual bool dispatchUnhandledKey(const sp&, - const KeyEvent*, uint32_t, KeyEvent*) { - return false; - } - - virtual void notifySwitch(nsecs_t, uint32_t, uint32_t, uint32_t) { - } - - virtual void pokeUserActivity(nsecs_t, int32_t) { - } - - virtual bool checkInjectEventsPermissionNonReentrant(int32_t, int32_t) { - return false; - } -}; - - -// --- InputDispatcherTest --- - -class InputDispatcherTest : public testing::Test { -protected: - sp mFakePolicy; - sp mDispatcher; - - virtual void SetUp() { - mFakePolicy = new FakeInputDispatcherPolicy(); - mDispatcher = new InputDispatcher(mFakePolicy); - } - - virtual void TearDown() { - mFakePolicy.clear(); - mDispatcher.clear(); - } -}; - - -TEST_F(InputDispatcherTest, InjectInputEvent_ValidatesKeyEvents) { - KeyEvent event; - - // Rejects undefined key actions. - event.initialize(DEVICE_ID, AINPUT_SOURCE_KEYBOARD, - /*action*/ -1, 0, - AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME, ARBITRARY_TIME); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject key events with undefined action."; - - // Rejects ACTION_MULTIPLE since it is not supported despite being defined in the API. - event.initialize(DEVICE_ID, AINPUT_SOURCE_KEYBOARD, - AKEY_EVENT_ACTION_MULTIPLE, 0, - AKEYCODE_A, KEY_A, AMETA_NONE, 0, ARBITRARY_TIME, ARBITRARY_TIME); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject key events with ACTION_MULTIPLE."; -} - -TEST_F(InputDispatcherTest, InjectInputEvent_ValidatesMotionEvents) { - MotionEvent event; - PointerProperties pointerProperties[MAX_POINTERS + 1]; - PointerCoords pointerCoords[MAX_POINTERS + 1]; - for (int i = 0; i <= MAX_POINTERS; i++) { - pointerProperties[i].clear(); - pointerProperties[i].id = i; - pointerCoords[i].clear(); - } - - // Rejects undefined motion actions. - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - /*action*/ -1, 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with undefined action."; - - // Rejects pointer down with invalid index. - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_POINTER_DOWN | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with pointer down index too large."; - - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_POINTER_DOWN | (-1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with pointer down index too small."; - - // Rejects pointer up with invalid index. - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_POINTER_UP | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with pointer up index too large."; - - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_POINTER_UP | (-1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with pointer up index too small."; - - // Rejects motion events with invalid number of pointers. - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_DOWN, 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 0, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with 0 pointers."; - - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_DOWN, 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ MAX_POINTERS + 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with more than MAX_POINTERS pointers."; - - // Rejects motion events with invalid pointer ids. - pointerProperties[0].id = -1; - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_DOWN, 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with pointer ids less than 0."; - - pointerProperties[0].id = MAX_POINTER_ID + 1; - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_DOWN, 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 1, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with pointer ids greater than MAX_POINTER_ID."; - - // Rejects motion events with duplicate pointer ids. - pointerProperties[0].id = 1; - pointerProperties[1].id = 1; - event.initialize(DEVICE_ID, AINPUT_SOURCE_TOUCHSCREEN, - AMOTION_EVENT_ACTION_DOWN, 0, 0, 0, AMETA_NONE, 0, 0, 0, 0, 0, - ARBITRARY_TIME, ARBITRARY_TIME, - /*pointerCount*/ 2, pointerProperties, pointerCoords); - ASSERT_EQ(INPUT_EVENT_INJECTION_FAILED, mDispatcher->injectInputEvent( - &event, DISPLAY_ID, - INJECTOR_PID, INJECTOR_UID, INPUT_EVENT_INJECTION_SYNC_NONE, 0, 0)) - << "Should reject motion events with duplicate pointer ids."; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/inputflinger/tests/InputReader_test.cpp android-platform-frameworks-native-21/services/inputflinger/tests/InputReader_test.cpp --- android-platform-frameworks-native-6.0.1+r16/services/inputflinger/tests/InputReader_test.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/inputflinger/tests/InputReader_test.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,5161 +0,0 @@ -/* - * Copyright (C) 2010 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 "../InputReader.h" - -#include -#include -#include - -namespace android { - -// An arbitrary time value. -static const nsecs_t ARBITRARY_TIME = 1234; - -// Arbitrary display properties. -static const int32_t DISPLAY_ID = 0; -static const int32_t DISPLAY_WIDTH = 480; -static const int32_t DISPLAY_HEIGHT = 800; - -// Error tolerance for floating point assertions. -static const float EPSILON = 0.001f; - -template -static inline T min(T a, T b) { - return a < b ? a : b; -} - -static inline float avg(float x, float y) { - return (x + y) / 2; -} - - -// --- FakePointerController --- - -class FakePointerController : public PointerControllerInterface { - bool mHaveBounds; - float mMinX, mMinY, mMaxX, mMaxY; - float mX, mY; - int32_t mButtonState; - -protected: - virtual ~FakePointerController() { } - -public: - FakePointerController() : - mHaveBounds(false), mMinX(0), mMinY(0), mMaxX(0), mMaxY(0), mX(0), mY(0), - mButtonState(0) { - } - - void setBounds(float minX, float minY, float maxX, float maxY) { - mHaveBounds = true; - mMinX = minX; - mMinY = minY; - mMaxX = maxX; - mMaxY = maxY; - } - - virtual void setPosition(float x, float y) { - mX = x; - mY = y; - } - - virtual void setButtonState(int32_t buttonState) { - mButtonState = buttonState; - } - - virtual int32_t getButtonState() const { - return mButtonState; - } - - virtual void getPosition(float* outX, float* outY) const { - *outX = mX; - *outY = mY; - } - -private: - virtual bool getBounds(float* outMinX, float* outMinY, float* outMaxX, float* outMaxY) const { - *outMinX = mMinX; - *outMinY = mMinY; - *outMaxX = mMaxX; - *outMaxY = mMaxY; - return mHaveBounds; - } - - virtual void move(float deltaX, float deltaY) { - mX += deltaX; - if (mX < mMinX) mX = mMinX; - if (mX > mMaxX) mX = mMaxX; - mY += deltaY; - if (mY < mMinY) mY = mMinY; - if (mY > mMaxY) mY = mMaxY; - } - - virtual void fade(Transition) { - } - - virtual void unfade(Transition) { - } - - virtual void setPresentation(Presentation) { - } - - virtual void setSpots(const PointerCoords*, const uint32_t*, BitSet32) { - } - - virtual void clearSpots() { - } -}; - - -// --- FakeInputReaderPolicy --- - -class FakeInputReaderPolicy : public InputReaderPolicyInterface { - InputReaderConfiguration mConfig; - KeyedVector > mPointerControllers; - Vector mInputDevices; - TouchAffineTransformation transform; - -protected: - virtual ~FakeInputReaderPolicy() { } - -public: - FakeInputReaderPolicy() { - } - - void setDisplayInfo(int32_t displayId, int32_t width, int32_t height, int32_t orientation) { - // Set the size of both the internal and external display at the same time. - bool isRotated = (orientation == DISPLAY_ORIENTATION_90 - || orientation == DISPLAY_ORIENTATION_270); - DisplayViewport v; - v.displayId = displayId; - v.orientation = orientation; - v.logicalLeft = 0; - v.logicalTop = 0; - v.logicalRight = isRotated ? height : width; - v.logicalBottom = isRotated ? width : height; - v.physicalLeft = 0; - v.physicalTop = 0; - v.physicalRight = isRotated ? height : width; - v.physicalBottom = isRotated ? width : height; - v.deviceWidth = isRotated ? height : width; - v.deviceHeight = isRotated ? width : height; - mConfig.setDisplayInfo(false /*external*/, v); - mConfig.setDisplayInfo(true /*external*/, v); - } - - void addExcludedDeviceName(const String8& deviceName) { - mConfig.excludedDeviceNames.push(deviceName); - } - - void setPointerController(int32_t deviceId, const sp& controller) { - mPointerControllers.add(deviceId, controller); - } - - const InputReaderConfiguration* getReaderConfiguration() const { - return &mConfig; - } - - const Vector& getInputDevices() const { - return mInputDevices; - } - - TouchAffineTransformation getTouchAffineTransformation(const String8& inputDeviceDescriptor, - int32_t surfaceRotation) { - return transform; - } - - void setTouchAffineTransformation(const TouchAffineTransformation t) { - transform = t; - } - -private: - virtual void getReaderConfiguration(InputReaderConfiguration* outConfig) { - *outConfig = mConfig; - } - - virtual sp obtainPointerController(int32_t deviceId) { - return mPointerControllers.valueFor(deviceId); - } - - virtual void notifyInputDevicesChanged(const Vector& inputDevices) { - mInputDevices = inputDevices; - } - - virtual sp getKeyboardLayoutOverlay(const InputDeviceIdentifier&) { - return NULL; - } - - virtual String8 getDeviceAlias(const InputDeviceIdentifier&) { - return String8::empty(); - } -}; - - -// --- FakeInputListener --- - -class FakeInputListener : public InputListenerInterface { -private: - List mNotifyConfigurationChangedArgsQueue; - List mNotifyDeviceResetArgsQueue; - List mNotifyKeyArgsQueue; - List mNotifyMotionArgsQueue; - List mNotifySwitchArgsQueue; - -protected: - virtual ~FakeInputListener() { } - -public: - FakeInputListener() { - } - - void assertNotifyConfigurationChangedWasCalled( - NotifyConfigurationChangedArgs* outEventArgs = NULL) { - ASSERT_FALSE(mNotifyConfigurationChangedArgsQueue.empty()) - << "Expected notifyConfigurationChanged() to have been called."; - if (outEventArgs) { - *outEventArgs = *mNotifyConfigurationChangedArgsQueue.begin(); - } - mNotifyConfigurationChangedArgsQueue.erase(mNotifyConfigurationChangedArgsQueue.begin()); - } - - void assertNotifyDeviceResetWasCalled( - NotifyDeviceResetArgs* outEventArgs = NULL) { - ASSERT_FALSE(mNotifyDeviceResetArgsQueue.empty()) - << "Expected notifyDeviceReset() to have been called."; - if (outEventArgs) { - *outEventArgs = *mNotifyDeviceResetArgsQueue.begin(); - } - mNotifyDeviceResetArgsQueue.erase(mNotifyDeviceResetArgsQueue.begin()); - } - - void assertNotifyKeyWasCalled(NotifyKeyArgs* outEventArgs = NULL) { - ASSERT_FALSE(mNotifyKeyArgsQueue.empty()) - << "Expected notifyKey() to have been called."; - if (outEventArgs) { - *outEventArgs = *mNotifyKeyArgsQueue.begin(); - } - mNotifyKeyArgsQueue.erase(mNotifyKeyArgsQueue.begin()); - } - - void assertNotifyKeyWasNotCalled() { - ASSERT_TRUE(mNotifyKeyArgsQueue.empty()) - << "Expected notifyKey() to not have been called."; - } - - void assertNotifyMotionWasCalled(NotifyMotionArgs* outEventArgs = NULL) { - ASSERT_FALSE(mNotifyMotionArgsQueue.empty()) - << "Expected notifyMotion() to have been called."; - if (outEventArgs) { - *outEventArgs = *mNotifyMotionArgsQueue.begin(); - } - mNotifyMotionArgsQueue.erase(mNotifyMotionArgsQueue.begin()); - } - - void assertNotifyMotionWasNotCalled() { - ASSERT_TRUE(mNotifyMotionArgsQueue.empty()) - << "Expected notifyMotion() to not have been called."; - } - - void assertNotifySwitchWasCalled(NotifySwitchArgs* outEventArgs = NULL) { - ASSERT_FALSE(mNotifySwitchArgsQueue.empty()) - << "Expected notifySwitch() to have been called."; - if (outEventArgs) { - *outEventArgs = *mNotifySwitchArgsQueue.begin(); - } - mNotifySwitchArgsQueue.erase(mNotifySwitchArgsQueue.begin()); - } - -private: - virtual void notifyConfigurationChanged(const NotifyConfigurationChangedArgs* args) { - mNotifyConfigurationChangedArgsQueue.push_back(*args); - } - - virtual void notifyDeviceReset(const NotifyDeviceResetArgs* args) { - mNotifyDeviceResetArgsQueue.push_back(*args); - } - - virtual void notifyKey(const NotifyKeyArgs* args) { - mNotifyKeyArgsQueue.push_back(*args); - } - - virtual void notifyMotion(const NotifyMotionArgs* args) { - mNotifyMotionArgsQueue.push_back(*args); - } - - virtual void notifySwitch(const NotifySwitchArgs* args) { - mNotifySwitchArgsQueue.push_back(*args); - } -}; - - -// --- FakeEventHub --- - -class FakeEventHub : public EventHubInterface { - struct KeyInfo { - int32_t keyCode; - uint32_t flags; - }; - - struct Device { - InputDeviceIdentifier identifier; - uint32_t classes; - PropertyMap configuration; - KeyedVector absoluteAxes; - KeyedVector relativeAxes; - KeyedVector keyCodeStates; - KeyedVector scanCodeStates; - KeyedVector switchStates; - KeyedVector absoluteAxisValue; - KeyedVector keysByScanCode; - KeyedVector keysByUsageCode; - KeyedVector leds; - Vector virtualKeys; - - Device(uint32_t classes) : - classes(classes) { - } - }; - - KeyedVector mDevices; - Vector mExcludedDevices; - List mEvents; - -protected: - virtual ~FakeEventHub() { - for (size_t i = 0; i < mDevices.size(); i++) { - delete mDevices.valueAt(i); - } - } - -public: - FakeEventHub() { } - - void addDevice(int32_t deviceId, const String8& name, uint32_t classes) { - Device* device = new Device(classes); - device->identifier.name = name; - mDevices.add(deviceId, device); - - enqueueEvent(ARBITRARY_TIME, deviceId, EventHubInterface::DEVICE_ADDED, 0, 0); - } - - void removeDevice(int32_t deviceId) { - delete mDevices.valueFor(deviceId); - mDevices.removeItem(deviceId); - - enqueueEvent(ARBITRARY_TIME, deviceId, EventHubInterface::DEVICE_REMOVED, 0, 0); - } - - void finishDeviceScan() { - enqueueEvent(ARBITRARY_TIME, 0, EventHubInterface::FINISHED_DEVICE_SCAN, 0, 0); - } - - void addConfigurationProperty(int32_t deviceId, const String8& key, const String8& value) { - Device* device = getDevice(deviceId); - device->configuration.addProperty(key, value); - } - - void addConfigurationMap(int32_t deviceId, const PropertyMap* configuration) { - Device* device = getDevice(deviceId); - device->configuration.addAll(configuration); - } - - void addAbsoluteAxis(int32_t deviceId, int axis, - int32_t minValue, int32_t maxValue, int flat, int fuzz, int resolution = 0) { - Device* device = getDevice(deviceId); - - RawAbsoluteAxisInfo info; - info.valid = true; - info.minValue = minValue; - info.maxValue = maxValue; - info.flat = flat; - info.fuzz = fuzz; - info.resolution = resolution; - device->absoluteAxes.add(axis, info); - } - - void addRelativeAxis(int32_t deviceId, int32_t axis) { - Device* device = getDevice(deviceId); - device->relativeAxes.add(axis, true); - } - - void setKeyCodeState(int32_t deviceId, int32_t keyCode, int32_t state) { - Device* device = getDevice(deviceId); - device->keyCodeStates.replaceValueFor(keyCode, state); - } - - void setScanCodeState(int32_t deviceId, int32_t scanCode, int32_t state) { - Device* device = getDevice(deviceId); - device->scanCodeStates.replaceValueFor(scanCode, state); - } - - void setSwitchState(int32_t deviceId, int32_t switchCode, int32_t state) { - Device* device = getDevice(deviceId); - device->switchStates.replaceValueFor(switchCode, state); - } - - void setAbsoluteAxisValue(int32_t deviceId, int32_t axis, int32_t value) { - Device* device = getDevice(deviceId); - device->absoluteAxisValue.replaceValueFor(axis, value); - } - - void addKey(int32_t deviceId, int32_t scanCode, int32_t usageCode, - int32_t keyCode, uint32_t flags) { - Device* device = getDevice(deviceId); - KeyInfo info; - info.keyCode = keyCode; - info.flags = flags; - if (scanCode) { - device->keysByScanCode.add(scanCode, info); - } - if (usageCode) { - device->keysByUsageCode.add(usageCode, info); - } - } - - void addLed(int32_t deviceId, int32_t led, bool initialState) { - Device* device = getDevice(deviceId); - device->leds.add(led, initialState); - } - - bool getLedState(int32_t deviceId, int32_t led) { - Device* device = getDevice(deviceId); - return device->leds.valueFor(led); - } - - Vector& getExcludedDevices() { - return mExcludedDevices; - } - - void addVirtualKeyDefinition(int32_t deviceId, const VirtualKeyDefinition& definition) { - Device* device = getDevice(deviceId); - device->virtualKeys.push(definition); - } - - void enqueueEvent(nsecs_t when, int32_t deviceId, int32_t type, - int32_t code, int32_t value) { - RawEvent event; - event.when = when; - event.deviceId = deviceId; - event.type = type; - event.code = code; - event.value = value; - mEvents.push_back(event); - - if (type == EV_ABS) { - setAbsoluteAxisValue(deviceId, code, value); - } - } - - void assertQueueIsEmpty() { - ASSERT_EQ(size_t(0), mEvents.size()) - << "Expected the event queue to be empty (fully consumed)."; - } - -private: - Device* getDevice(int32_t deviceId) const { - ssize_t index = mDevices.indexOfKey(deviceId); - return index >= 0 ? mDevices.valueAt(index) : NULL; - } - - virtual uint32_t getDeviceClasses(int32_t deviceId) const { - Device* device = getDevice(deviceId); - return device ? device->classes : 0; - } - - virtual InputDeviceIdentifier getDeviceIdentifier(int32_t deviceId) const { - Device* device = getDevice(deviceId); - return device ? device->identifier : InputDeviceIdentifier(); - } - - virtual int32_t getDeviceControllerNumber(int32_t) const { - return 0; - } - - virtual void getConfiguration(int32_t deviceId, PropertyMap* outConfiguration) const { - Device* device = getDevice(deviceId); - if (device) { - *outConfiguration = device->configuration; - } - } - - virtual status_t getAbsoluteAxisInfo(int32_t deviceId, int axis, - RawAbsoluteAxisInfo* outAxisInfo) const { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->absoluteAxes.indexOfKey(axis); - if (index >= 0) { - *outAxisInfo = device->absoluteAxes.valueAt(index); - return OK; - } - } - outAxisInfo->clear(); - return -1; - } - - virtual bool hasRelativeAxis(int32_t deviceId, int axis) const { - Device* device = getDevice(deviceId); - if (device) { - return device->relativeAxes.indexOfKey(axis) >= 0; - } - return false; - } - - virtual bool hasInputProperty(int32_t, int) const { - return false; - } - - virtual status_t mapKey(int32_t deviceId, - int32_t scanCode, int32_t usageCode, int32_t metaState, - int32_t* outKeycode, int32_t *outMetaState, uint32_t* outFlags) const { - Device* device = getDevice(deviceId); - if (device) { - const KeyInfo* key = getKey(device, scanCode, usageCode); - if (key) { - if (outKeycode) { - *outKeycode = key->keyCode; - } - if (outFlags) { - *outFlags = key->flags; - } - if (outMetaState) { - *outMetaState = metaState; - } - return OK; - } - } - return NAME_NOT_FOUND; - } - - const KeyInfo* getKey(Device* device, int32_t scanCode, int32_t usageCode) const { - if (usageCode) { - ssize_t index = device->keysByUsageCode.indexOfKey(usageCode); - if (index >= 0) { - return &device->keysByUsageCode.valueAt(index); - } - } - if (scanCode) { - ssize_t index = device->keysByScanCode.indexOfKey(scanCode); - if (index >= 0) { - return &device->keysByScanCode.valueAt(index); - } - } - return NULL; - } - - virtual status_t mapAxis(int32_t, int32_t, AxisInfo*) const { - return NAME_NOT_FOUND; - } - - virtual void setExcludedDevices(const Vector& devices) { - mExcludedDevices = devices; - } - - virtual size_t getEvents(int, RawEvent* buffer, size_t) { - if (mEvents.empty()) { - return 0; - } - - *buffer = *mEvents.begin(); - mEvents.erase(mEvents.begin()); - return 1; - } - - virtual int32_t getScanCodeState(int32_t deviceId, int32_t scanCode) const { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->scanCodeStates.indexOfKey(scanCode); - if (index >= 0) { - return device->scanCodeStates.valueAt(index); - } - } - return AKEY_STATE_UNKNOWN; - } - - virtual int32_t getKeyCodeState(int32_t deviceId, int32_t keyCode) const { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->keyCodeStates.indexOfKey(keyCode); - if (index >= 0) { - return device->keyCodeStates.valueAt(index); - } - } - return AKEY_STATE_UNKNOWN; - } - - virtual int32_t getSwitchState(int32_t deviceId, int32_t sw) const { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->switchStates.indexOfKey(sw); - if (index >= 0) { - return device->switchStates.valueAt(index); - } - } - return AKEY_STATE_UNKNOWN; - } - - virtual status_t getAbsoluteAxisValue(int32_t deviceId, int32_t axis, - int32_t* outValue) const { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->absoluteAxisValue.indexOfKey(axis); - if (index >= 0) { - *outValue = device->absoluteAxisValue.valueAt(index); - return OK; - } - } - *outValue = 0; - return -1; - } - - virtual bool markSupportedKeyCodes(int32_t deviceId, size_t numCodes, const int32_t* keyCodes, - uint8_t* outFlags) const { - bool result = false; - Device* device = getDevice(deviceId); - if (device) { - for (size_t i = 0; i < numCodes; i++) { - for (size_t j = 0; j < device->keysByScanCode.size(); j++) { - if (keyCodes[i] == device->keysByScanCode.valueAt(j).keyCode) { - outFlags[i] = 1; - result = true; - } - } - for (size_t j = 0; j < device->keysByUsageCode.size(); j++) { - if (keyCodes[i] == device->keysByUsageCode.valueAt(j).keyCode) { - outFlags[i] = 1; - result = true; - } - } - } - } - return result; - } - - virtual bool hasScanCode(int32_t deviceId, int32_t scanCode) const { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->keysByScanCode.indexOfKey(scanCode); - return index >= 0; - } - return false; - } - - virtual bool hasLed(int32_t deviceId, int32_t led) const { - Device* device = getDevice(deviceId); - return device && device->leds.indexOfKey(led) >= 0; - } - - virtual void setLedState(int32_t deviceId, int32_t led, bool on) { - Device* device = getDevice(deviceId); - if (device) { - ssize_t index = device->leds.indexOfKey(led); - if (index >= 0) { - device->leds.replaceValueAt(led, on); - } else { - ADD_FAILURE() - << "Attempted to set the state of an LED that the EventHub declared " - "was not present. led=" << led; - } - } - } - - virtual void getVirtualKeyDefinitions(int32_t deviceId, - Vector& outVirtualKeys) const { - outVirtualKeys.clear(); - - Device* device = getDevice(deviceId); - if (device) { - outVirtualKeys.appendVector(device->virtualKeys); - } - } - - virtual sp getKeyCharacterMap(int32_t) const { - return NULL; - } - - virtual bool setKeyboardLayoutOverlay(int32_t, const sp&) { - return false; - } - - virtual void vibrate(int32_t, nsecs_t) { - } - - virtual void cancelVibrate(int32_t) { - } - - virtual bool isExternal(int32_t) const { - return false; - } - - virtual void dump(String8&) { - } - - virtual void monitor() { - } - - virtual void requestReopenDevices() { - } - - virtual void wake() { - } -}; - - -// --- FakeInputReaderContext --- - -class FakeInputReaderContext : public InputReaderContext { - sp mEventHub; - sp mPolicy; - sp mListener; - int32_t mGlobalMetaState; - bool mUpdateGlobalMetaStateWasCalled; - int32_t mGeneration; - -public: - FakeInputReaderContext(const sp& eventHub, - const sp& policy, - const sp& listener) : - mEventHub(eventHub), mPolicy(policy), mListener(listener), - mGlobalMetaState(0) { - } - - virtual ~FakeInputReaderContext() { } - - void assertUpdateGlobalMetaStateWasCalled() { - ASSERT_TRUE(mUpdateGlobalMetaStateWasCalled) - << "Expected updateGlobalMetaState() to have been called."; - mUpdateGlobalMetaStateWasCalled = false; - } - - void setGlobalMetaState(int32_t state) { - mGlobalMetaState = state; - } - -private: - virtual void updateGlobalMetaState() { - mUpdateGlobalMetaStateWasCalled = true; - } - - virtual int32_t getGlobalMetaState() { - return mGlobalMetaState; - } - - virtual EventHubInterface* getEventHub() { - return mEventHub.get(); - } - - virtual InputReaderPolicyInterface* getPolicy() { - return mPolicy.get(); - } - - virtual InputListenerInterface* getListener() { - return mListener.get(); - } - - virtual void disableVirtualKeysUntil(nsecs_t) { - } - - virtual bool shouldDropVirtualKey(nsecs_t, InputDevice*, int32_t, int32_t) { - return false; - } - - virtual void fadePointer() { - } - - virtual void requestTimeoutAtTime(nsecs_t) { - } - - virtual int32_t bumpGeneration() { - return ++mGeneration; - } - - virtual void getExternalStylusDevices(Vector& outDevices) { - - } - - virtual void dispatchExternalStylusState(const StylusState&) { - - } -}; - - -// --- FakeInputMapper --- - -class FakeInputMapper : public InputMapper { - uint32_t mSources; - int32_t mKeyboardType; - int32_t mMetaState; - KeyedVector mKeyCodeStates; - KeyedVector mScanCodeStates; - KeyedVector mSwitchStates; - Vector mSupportedKeyCodes; - RawEvent mLastEvent; - - bool mConfigureWasCalled; - bool mResetWasCalled; - bool mProcessWasCalled; - -public: - FakeInputMapper(InputDevice* device, uint32_t sources) : - InputMapper(device), - mSources(sources), mKeyboardType(AINPUT_KEYBOARD_TYPE_NONE), - mMetaState(0), - mConfigureWasCalled(false), mResetWasCalled(false), mProcessWasCalled(false) { - } - - virtual ~FakeInputMapper() { } - - void setKeyboardType(int32_t keyboardType) { - mKeyboardType = keyboardType; - } - - void setMetaState(int32_t metaState) { - mMetaState = metaState; - } - - void assertConfigureWasCalled() { - ASSERT_TRUE(mConfigureWasCalled) - << "Expected configure() to have been called."; - mConfigureWasCalled = false; - } - - void assertResetWasCalled() { - ASSERT_TRUE(mResetWasCalled) - << "Expected reset() to have been called."; - mResetWasCalled = false; - } - - void assertProcessWasCalled(RawEvent* outLastEvent = NULL) { - ASSERT_TRUE(mProcessWasCalled) - << "Expected process() to have been called."; - if (outLastEvent) { - *outLastEvent = mLastEvent; - } - mProcessWasCalled = false; - } - - void setKeyCodeState(int32_t keyCode, int32_t state) { - mKeyCodeStates.replaceValueFor(keyCode, state); - } - - void setScanCodeState(int32_t scanCode, int32_t state) { - mScanCodeStates.replaceValueFor(scanCode, state); - } - - void setSwitchState(int32_t switchCode, int32_t state) { - mSwitchStates.replaceValueFor(switchCode, state); - } - - void addSupportedKeyCode(int32_t keyCode) { - mSupportedKeyCodes.add(keyCode); - } - -private: - virtual uint32_t getSources() { - return mSources; - } - - virtual void populateDeviceInfo(InputDeviceInfo* deviceInfo) { - InputMapper::populateDeviceInfo(deviceInfo); - - if (mKeyboardType != AINPUT_KEYBOARD_TYPE_NONE) { - deviceInfo->setKeyboardType(mKeyboardType); - } - } - - virtual void configure(nsecs_t, const InputReaderConfiguration*, uint32_t) { - mConfigureWasCalled = true; - } - - virtual void reset(nsecs_t) { - mResetWasCalled = true; - } - - virtual void process(const RawEvent* rawEvent) { - mLastEvent = *rawEvent; - mProcessWasCalled = true; - } - - virtual int32_t getKeyCodeState(uint32_t, int32_t keyCode) { - ssize_t index = mKeyCodeStates.indexOfKey(keyCode); - return index >= 0 ? mKeyCodeStates.valueAt(index) : AKEY_STATE_UNKNOWN; - } - - virtual int32_t getScanCodeState(uint32_t, int32_t scanCode) { - ssize_t index = mScanCodeStates.indexOfKey(scanCode); - return index >= 0 ? mScanCodeStates.valueAt(index) : AKEY_STATE_UNKNOWN; - } - - virtual int32_t getSwitchState(uint32_t, int32_t switchCode) { - ssize_t index = mSwitchStates.indexOfKey(switchCode); - return index >= 0 ? mSwitchStates.valueAt(index) : AKEY_STATE_UNKNOWN; - } - - virtual bool markSupportedKeyCodes(uint32_t, size_t numCodes, - const int32_t* keyCodes, uint8_t* outFlags) { - bool result = false; - for (size_t i = 0; i < numCodes; i++) { - for (size_t j = 0; j < mSupportedKeyCodes.size(); j++) { - if (keyCodes[i] == mSupportedKeyCodes[j]) { - outFlags[i] = 1; - result = true; - } - } - } - return result; - } - - virtual int32_t getMetaState() { - return mMetaState; - } - - virtual void fadePointer() { - } -}; - - -// --- InstrumentedInputReader --- - -class InstrumentedInputReader : public InputReader { - InputDevice* mNextDevice; - -public: - InstrumentedInputReader(const sp& eventHub, - const sp& policy, - const sp& listener) : - InputReader(eventHub, policy, listener), - mNextDevice(NULL) { - } - - virtual ~InstrumentedInputReader() { - if (mNextDevice) { - delete mNextDevice; - } - } - - void setNextDevice(InputDevice* device) { - mNextDevice = device; - } - - InputDevice* newDevice(int32_t deviceId, int32_t controllerNumber, const String8& name, - uint32_t classes) { - InputDeviceIdentifier identifier; - identifier.name = name; - int32_t generation = deviceId + 1; - return new InputDevice(&mContext, deviceId, generation, controllerNumber, identifier, - classes); - } - -protected: - virtual InputDevice* createDeviceLocked(int32_t deviceId, int32_t controllerNumber, - const InputDeviceIdentifier& identifier, uint32_t classes) { - if (mNextDevice) { - InputDevice* device = mNextDevice; - mNextDevice = NULL; - return device; - } - return InputReader::createDeviceLocked(deviceId, controllerNumber, identifier, classes); - } - - friend class InputReaderTest; -}; - - -// --- InputReaderTest --- - -class InputReaderTest : public testing::Test { -protected: - sp mFakeListener; - sp mFakePolicy; - sp mFakeEventHub; - sp mReader; - - virtual void SetUp() { - mFakeEventHub = new FakeEventHub(); - mFakePolicy = new FakeInputReaderPolicy(); - mFakeListener = new FakeInputListener(); - - mReader = new InstrumentedInputReader(mFakeEventHub, mFakePolicy, mFakeListener); - } - - virtual void TearDown() { - mReader.clear(); - - mFakeListener.clear(); - mFakePolicy.clear(); - mFakeEventHub.clear(); - } - - void addDevice(int32_t deviceId, const String8& name, uint32_t classes, - const PropertyMap* configuration) { - mFakeEventHub->addDevice(deviceId, name, classes); - - if (configuration) { - mFakeEventHub->addConfigurationMap(deviceId, configuration); - } - mFakeEventHub->finishDeviceScan(); - mReader->loopOnce(); - mReader->loopOnce(); - mFakeEventHub->assertQueueIsEmpty(); - } - - FakeInputMapper* addDeviceWithFakeInputMapper(int32_t deviceId, int32_t controllerNumber, - const String8& name, uint32_t classes, uint32_t sources, - const PropertyMap* configuration) { - InputDevice* device = mReader->newDevice(deviceId, controllerNumber, name, classes); - FakeInputMapper* mapper = new FakeInputMapper(device, sources); - device->addMapper(mapper); - mReader->setNextDevice(device); - addDevice(deviceId, name, classes, configuration); - return mapper; - } -}; - -TEST_F(InputReaderTest, GetInputDevices) { - ASSERT_NO_FATAL_FAILURE(addDevice(1, String8("keyboard"), - INPUT_DEVICE_CLASS_KEYBOARD, NULL)); - ASSERT_NO_FATAL_FAILURE(addDevice(2, String8("ignored"), - 0, NULL)); // no classes so device will be ignored - - Vector inputDevices; - mReader->getInputDevices(inputDevices); - - ASSERT_EQ(1U, inputDevices.size()); - ASSERT_EQ(1, inputDevices[0].getId()); - ASSERT_STREQ("keyboard", inputDevices[0].getIdentifier().name.string()); - ASSERT_EQ(AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC, inputDevices[0].getKeyboardType()); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, inputDevices[0].getSources()); - ASSERT_EQ(size_t(0), inputDevices[0].getMotionRanges().size()); - - // Should also have received a notification describing the new input devices. - inputDevices = mFakePolicy->getInputDevices(); - ASSERT_EQ(1U, inputDevices.size()); - ASSERT_EQ(1, inputDevices[0].getId()); - ASSERT_STREQ("keyboard", inputDevices[0].getIdentifier().name.string()); - ASSERT_EQ(AINPUT_KEYBOARD_TYPE_NON_ALPHABETIC, inputDevices[0].getKeyboardType()); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, inputDevices[0].getSources()); - ASSERT_EQ(size_t(0), inputDevices[0].getMotionRanges().size()); -} - -TEST_F(InputReaderTest, GetKeyCodeState_ForwardsRequestsToMappers) { - FakeInputMapper* mapper = NULL; - ASSERT_NO_FATAL_FAILURE(mapper = addDeviceWithFakeInputMapper(1, 0, String8("fake"), - INPUT_DEVICE_CLASS_KEYBOARD, AINPUT_SOURCE_KEYBOARD, NULL)); - mapper->setKeyCodeState(AKEYCODE_A, AKEY_STATE_DOWN); - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getKeyCodeState(0, - AINPUT_SOURCE_ANY, AKEYCODE_A)) - << "Should return unknown when the device id is >= 0 but unknown."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getKeyCodeState(1, - AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return unknown when the device id is valid but the sources are not supported by the device."; - - ASSERT_EQ(AKEY_STATE_DOWN, mReader->getKeyCodeState(1, - AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return value provided by mapper when device id is valid and the device supports some of the sources."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getKeyCodeState(-1, - AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return unknown when the device id is < 0 but the sources are not supported by any device."; - - ASSERT_EQ(AKEY_STATE_DOWN, mReader->getKeyCodeState(-1, - AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return value provided by mapper when device id is < 0 and one of the devices supports some of the sources."; -} - -TEST_F(InputReaderTest, GetScanCodeState_ForwardsRequestsToMappers) { - FakeInputMapper* mapper = NULL; - ASSERT_NO_FATAL_FAILURE(mapper = addDeviceWithFakeInputMapper(1, 0, String8("fake"), - INPUT_DEVICE_CLASS_KEYBOARD, AINPUT_SOURCE_KEYBOARD, NULL)); - mapper->setScanCodeState(KEY_A, AKEY_STATE_DOWN); - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getScanCodeState(0, - AINPUT_SOURCE_ANY, KEY_A)) - << "Should return unknown when the device id is >= 0 but unknown."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getScanCodeState(1, - AINPUT_SOURCE_TRACKBALL, KEY_A)) - << "Should return unknown when the device id is valid but the sources are not supported by the device."; - - ASSERT_EQ(AKEY_STATE_DOWN, mReader->getScanCodeState(1, - AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, KEY_A)) - << "Should return value provided by mapper when device id is valid and the device supports some of the sources."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getScanCodeState(-1, - AINPUT_SOURCE_TRACKBALL, KEY_A)) - << "Should return unknown when the device id is < 0 but the sources are not supported by any device."; - - ASSERT_EQ(AKEY_STATE_DOWN, mReader->getScanCodeState(-1, - AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, KEY_A)) - << "Should return value provided by mapper when device id is < 0 and one of the devices supports some of the sources."; -} - -TEST_F(InputReaderTest, GetSwitchState_ForwardsRequestsToMappers) { - FakeInputMapper* mapper = NULL; - ASSERT_NO_FATAL_FAILURE(mapper = addDeviceWithFakeInputMapper(1, 0, String8("fake"), - INPUT_DEVICE_CLASS_KEYBOARD, AINPUT_SOURCE_KEYBOARD, NULL)); - mapper->setSwitchState(SW_LID, AKEY_STATE_DOWN); - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getSwitchState(0, - AINPUT_SOURCE_ANY, SW_LID)) - << "Should return unknown when the device id is >= 0 but unknown."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getSwitchState(1, - AINPUT_SOURCE_TRACKBALL, SW_LID)) - << "Should return unknown when the device id is valid but the sources are not supported by the device."; - - ASSERT_EQ(AKEY_STATE_DOWN, mReader->getSwitchState(1, - AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, SW_LID)) - << "Should return value provided by mapper when device id is valid and the device supports some of the sources."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mReader->getSwitchState(-1, - AINPUT_SOURCE_TRACKBALL, SW_LID)) - << "Should return unknown when the device id is < 0 but the sources are not supported by any device."; - - ASSERT_EQ(AKEY_STATE_DOWN, mReader->getSwitchState(-1, - AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, SW_LID)) - << "Should return value provided by mapper when device id is < 0 and one of the devices supports some of the sources."; -} - -TEST_F(InputReaderTest, MarkSupportedKeyCodes_ForwardsRequestsToMappers) { - FakeInputMapper* mapper = NULL; - ASSERT_NO_FATAL_FAILURE(mapper = addDeviceWithFakeInputMapper(1, 0, String8("fake"), - INPUT_DEVICE_CLASS_KEYBOARD, AINPUT_SOURCE_KEYBOARD, NULL)); - mapper->addSupportedKeyCode(AKEYCODE_A); - mapper->addSupportedKeyCode(AKEYCODE_B); - - const int32_t keyCodes[4] = { AKEYCODE_A, AKEYCODE_B, AKEYCODE_1, AKEYCODE_2 }; - uint8_t flags[4] = { 0, 0, 0, 1 }; - - ASSERT_FALSE(mReader->hasKeys(0, AINPUT_SOURCE_ANY, 4, keyCodes, flags)) - << "Should return false when device id is >= 0 but unknown."; - ASSERT_TRUE(!flags[0] && !flags[1] && !flags[2] && !flags[3]); - - flags[3] = 1; - ASSERT_FALSE(mReader->hasKeys(1, AINPUT_SOURCE_TRACKBALL, 4, keyCodes, flags)) - << "Should return false when device id is valid but the sources are not supported by the device."; - ASSERT_TRUE(!flags[0] && !flags[1] && !flags[2] && !flags[3]); - - flags[3] = 1; - ASSERT_TRUE(mReader->hasKeys(1, AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, 4, keyCodes, flags)) - << "Should return value provided by mapper when device id is valid and the device supports some of the sources."; - ASSERT_TRUE(flags[0] && flags[1] && !flags[2] && !flags[3]); - - flags[3] = 1; - ASSERT_FALSE(mReader->hasKeys(-1, AINPUT_SOURCE_TRACKBALL, 4, keyCodes, flags)) - << "Should return false when the device id is < 0 but the sources are not supported by any device."; - ASSERT_TRUE(!flags[0] && !flags[1] && !flags[2] && !flags[3]); - - flags[3] = 1; - ASSERT_TRUE(mReader->hasKeys(-1, AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TRACKBALL, 4, keyCodes, flags)) - << "Should return value provided by mapper when device id is < 0 and one of the devices supports some of the sources."; - ASSERT_TRUE(flags[0] && flags[1] && !flags[2] && !flags[3]); -} - -TEST_F(InputReaderTest, LoopOnce_WhenDeviceScanFinished_SendsConfigurationChanged) { - addDevice(1, String8("ignored"), INPUT_DEVICE_CLASS_KEYBOARD, NULL); - - NotifyConfigurationChangedArgs args; - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyConfigurationChangedWasCalled(&args)); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); -} - -TEST_F(InputReaderTest, LoopOnce_ForwardsRawEventsToMappers) { - FakeInputMapper* mapper = NULL; - ASSERT_NO_FATAL_FAILURE(mapper = addDeviceWithFakeInputMapper(1, 0, String8("fake"), - INPUT_DEVICE_CLASS_KEYBOARD, AINPUT_SOURCE_KEYBOARD, NULL)); - - mFakeEventHub->enqueueEvent(0, 1, EV_KEY, KEY_A, 1); - mReader->loopOnce(); - ASSERT_NO_FATAL_FAILURE(mFakeEventHub->assertQueueIsEmpty()); - - RawEvent event; - ASSERT_NO_FATAL_FAILURE(mapper->assertProcessWasCalled(&event)); - ASSERT_EQ(0, event.when); - ASSERT_EQ(1, event.deviceId); - ASSERT_EQ(EV_KEY, event.type); - ASSERT_EQ(KEY_A, event.code); - ASSERT_EQ(1, event.value); -} - - -// --- InputDeviceTest --- - -class InputDeviceTest : public testing::Test { -protected: - static const char* DEVICE_NAME; - static const int32_t DEVICE_ID; - static const int32_t DEVICE_GENERATION; - static const int32_t DEVICE_CONTROLLER_NUMBER; - static const uint32_t DEVICE_CLASSES; - - sp mFakeEventHub; - sp mFakePolicy; - sp mFakeListener; - FakeInputReaderContext* mFakeContext; - - InputDevice* mDevice; - - virtual void SetUp() { - mFakeEventHub = new FakeEventHub(); - mFakePolicy = new FakeInputReaderPolicy(); - mFakeListener = new FakeInputListener(); - mFakeContext = new FakeInputReaderContext(mFakeEventHub, mFakePolicy, mFakeListener); - - mFakeEventHub->addDevice(DEVICE_ID, String8(DEVICE_NAME), 0); - InputDeviceIdentifier identifier; - identifier.name = DEVICE_NAME; - mDevice = new InputDevice(mFakeContext, DEVICE_ID, DEVICE_GENERATION, - DEVICE_CONTROLLER_NUMBER, identifier, DEVICE_CLASSES); - } - - virtual void TearDown() { - delete mDevice; - - delete mFakeContext; - mFakeListener.clear(); - mFakePolicy.clear(); - mFakeEventHub.clear(); - } -}; - -const char* InputDeviceTest::DEVICE_NAME = "device"; -const int32_t InputDeviceTest::DEVICE_ID = 1; -const int32_t InputDeviceTest::DEVICE_GENERATION = 2; -const int32_t InputDeviceTest::DEVICE_CONTROLLER_NUMBER = 0; -const uint32_t InputDeviceTest::DEVICE_CLASSES = INPUT_DEVICE_CLASS_KEYBOARD - | INPUT_DEVICE_CLASS_TOUCH | INPUT_DEVICE_CLASS_JOYSTICK; - -TEST_F(InputDeviceTest, ImmutableProperties) { - ASSERT_EQ(DEVICE_ID, mDevice->getId()); - ASSERT_STREQ(DEVICE_NAME, mDevice->getName()); - ASSERT_EQ(DEVICE_CLASSES, mDevice->getClasses()); -} - -TEST_F(InputDeviceTest, WhenNoMappersAreRegistered_DeviceIsIgnored) { - // Configuration. - InputReaderConfiguration config; - mDevice->configure(ARBITRARY_TIME, &config, 0); - - // Reset. - mDevice->reset(ARBITRARY_TIME); - - NotifyDeviceResetArgs resetArgs; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); - ASSERT_EQ(ARBITRARY_TIME, resetArgs.eventTime); - ASSERT_EQ(DEVICE_ID, resetArgs.deviceId); - - // Metadata. - ASSERT_TRUE(mDevice->isIgnored()); - ASSERT_EQ(AINPUT_SOURCE_UNKNOWN, mDevice->getSources()); - - InputDeviceInfo info; - mDevice->getDeviceInfo(&info); - ASSERT_EQ(DEVICE_ID, info.getId()); - ASSERT_STREQ(DEVICE_NAME, info.getIdentifier().name.string()); - ASSERT_EQ(AINPUT_KEYBOARD_TYPE_NONE, info.getKeyboardType()); - ASSERT_EQ(AINPUT_SOURCE_UNKNOWN, info.getSources()); - - // State queries. - ASSERT_EQ(0, mDevice->getMetaState()); - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mDevice->getKeyCodeState(AINPUT_SOURCE_KEYBOARD, 0)) - << "Ignored device should return unknown key code state."; - ASSERT_EQ(AKEY_STATE_UNKNOWN, mDevice->getScanCodeState(AINPUT_SOURCE_KEYBOARD, 0)) - << "Ignored device should return unknown scan code state."; - ASSERT_EQ(AKEY_STATE_UNKNOWN, mDevice->getSwitchState(AINPUT_SOURCE_KEYBOARD, 0)) - << "Ignored device should return unknown switch state."; - - const int32_t keyCodes[2] = { AKEYCODE_A, AKEYCODE_B }; - uint8_t flags[2] = { 0, 1 }; - ASSERT_FALSE(mDevice->markSupportedKeyCodes(AINPUT_SOURCE_KEYBOARD, 2, keyCodes, flags)) - << "Ignored device should never mark any key codes."; - ASSERT_EQ(0, flags[0]) << "Flag for unsupported key should be unchanged."; - ASSERT_EQ(1, flags[1]) << "Flag for unsupported key should be unchanged."; -} - -TEST_F(InputDeviceTest, WhenMappersAreRegistered_DeviceIsNotIgnoredAndForwardsRequestsToMappers) { - // Configuration. - mFakeEventHub->addConfigurationProperty(DEVICE_ID, String8("key"), String8("value")); - - FakeInputMapper* mapper1 = new FakeInputMapper(mDevice, AINPUT_SOURCE_KEYBOARD); - mapper1->setKeyboardType(AINPUT_KEYBOARD_TYPE_ALPHABETIC); - mapper1->setMetaState(AMETA_ALT_ON); - mapper1->addSupportedKeyCode(AKEYCODE_A); - mapper1->addSupportedKeyCode(AKEYCODE_B); - mapper1->setKeyCodeState(AKEYCODE_A, AKEY_STATE_DOWN); - mapper1->setKeyCodeState(AKEYCODE_B, AKEY_STATE_UP); - mapper1->setScanCodeState(2, AKEY_STATE_DOWN); - mapper1->setScanCodeState(3, AKEY_STATE_UP); - mapper1->setSwitchState(4, AKEY_STATE_DOWN); - mDevice->addMapper(mapper1); - - FakeInputMapper* mapper2 = new FakeInputMapper(mDevice, AINPUT_SOURCE_TOUCHSCREEN); - mapper2->setMetaState(AMETA_SHIFT_ON); - mDevice->addMapper(mapper2); - - InputReaderConfiguration config; - mDevice->configure(ARBITRARY_TIME, &config, 0); - - String8 propertyValue; - ASSERT_TRUE(mDevice->getConfiguration().tryGetProperty(String8("key"), propertyValue)) - << "Device should have read configuration during configuration phase."; - ASSERT_STREQ("value", propertyValue.string()); - - ASSERT_NO_FATAL_FAILURE(mapper1->assertConfigureWasCalled()); - ASSERT_NO_FATAL_FAILURE(mapper2->assertConfigureWasCalled()); - - // Reset - mDevice->reset(ARBITRARY_TIME); - ASSERT_NO_FATAL_FAILURE(mapper1->assertResetWasCalled()); - ASSERT_NO_FATAL_FAILURE(mapper2->assertResetWasCalled()); - - NotifyDeviceResetArgs resetArgs; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyDeviceResetWasCalled(&resetArgs)); - ASSERT_EQ(ARBITRARY_TIME, resetArgs.eventTime); - ASSERT_EQ(DEVICE_ID, resetArgs.deviceId); - - // Metadata. - ASSERT_FALSE(mDevice->isIgnored()); - ASSERT_EQ(uint32_t(AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TOUCHSCREEN), mDevice->getSources()); - - InputDeviceInfo info; - mDevice->getDeviceInfo(&info); - ASSERT_EQ(DEVICE_ID, info.getId()); - ASSERT_STREQ(DEVICE_NAME, info.getIdentifier().name.string()); - ASSERT_EQ(AINPUT_KEYBOARD_TYPE_ALPHABETIC, info.getKeyboardType()); - ASSERT_EQ(uint32_t(AINPUT_SOURCE_KEYBOARD | AINPUT_SOURCE_TOUCHSCREEN), info.getSources()); - - // State queries. - ASSERT_EQ(AMETA_ALT_ON | AMETA_SHIFT_ON, mDevice->getMetaState()) - << "Should query mappers and combine meta states."; - - ASSERT_EQ(AKEY_STATE_UNKNOWN, mDevice->getKeyCodeState(AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return unknown key code state when source not supported."; - ASSERT_EQ(AKEY_STATE_UNKNOWN, mDevice->getScanCodeState(AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return unknown scan code state when source not supported."; - ASSERT_EQ(AKEY_STATE_UNKNOWN, mDevice->getSwitchState(AINPUT_SOURCE_TRACKBALL, AKEYCODE_A)) - << "Should return unknown switch state when source not supported."; - - ASSERT_EQ(AKEY_STATE_DOWN, mDevice->getKeyCodeState(AINPUT_SOURCE_KEYBOARD, AKEYCODE_A)) - << "Should query mapper when source is supported."; - ASSERT_EQ(AKEY_STATE_UP, mDevice->getScanCodeState(AINPUT_SOURCE_KEYBOARD, 3)) - << "Should query mapper when source is supported."; - ASSERT_EQ(AKEY_STATE_DOWN, mDevice->getSwitchState(AINPUT_SOURCE_KEYBOARD, 4)) - << "Should query mapper when source is supported."; - - const int32_t keyCodes[4] = { AKEYCODE_A, AKEYCODE_B, AKEYCODE_1, AKEYCODE_2 }; - uint8_t flags[4] = { 0, 0, 0, 1 }; - ASSERT_FALSE(mDevice->markSupportedKeyCodes(AINPUT_SOURCE_TRACKBALL, 4, keyCodes, flags)) - << "Should do nothing when source is unsupported."; - ASSERT_EQ(0, flags[0]) << "Flag should be unchanged when source is unsupported."; - ASSERT_EQ(0, flags[1]) << "Flag should be unchanged when source is unsupported."; - ASSERT_EQ(0, flags[2]) << "Flag should be unchanged when source is unsupported."; - ASSERT_EQ(1, flags[3]) << "Flag should be unchanged when source is unsupported."; - - ASSERT_TRUE(mDevice->markSupportedKeyCodes(AINPUT_SOURCE_KEYBOARD, 4, keyCodes, flags)) - << "Should query mapper when source is supported."; - ASSERT_EQ(1, flags[0]) << "Flag for supported key should be set."; - ASSERT_EQ(1, flags[1]) << "Flag for supported key should be set."; - ASSERT_EQ(0, flags[2]) << "Flag for unsupported key should be unchanged."; - ASSERT_EQ(1, flags[3]) << "Flag for unsupported key should be unchanged."; - - // Event handling. - RawEvent event; - mDevice->process(&event, 1); - - ASSERT_NO_FATAL_FAILURE(mapper1->assertProcessWasCalled()); - ASSERT_NO_FATAL_FAILURE(mapper2->assertProcessWasCalled()); -} - - -// --- InputMapperTest --- - -class InputMapperTest : public testing::Test { -protected: - static const char* DEVICE_NAME; - static const int32_t DEVICE_ID; - static const int32_t DEVICE_GENERATION; - static const int32_t DEVICE_CONTROLLER_NUMBER; - static const uint32_t DEVICE_CLASSES; - - sp mFakeEventHub; - sp mFakePolicy; - sp mFakeListener; - FakeInputReaderContext* mFakeContext; - InputDevice* mDevice; - - virtual void SetUp() { - mFakeEventHub = new FakeEventHub(); - mFakePolicy = new FakeInputReaderPolicy(); - mFakeListener = new FakeInputListener(); - mFakeContext = new FakeInputReaderContext(mFakeEventHub, mFakePolicy, mFakeListener); - InputDeviceIdentifier identifier; - identifier.name = DEVICE_NAME; - mDevice = new InputDevice(mFakeContext, DEVICE_ID, DEVICE_GENERATION, - DEVICE_CONTROLLER_NUMBER, identifier, DEVICE_CLASSES); - - mFakeEventHub->addDevice(DEVICE_ID, String8(DEVICE_NAME), 0); - } - - virtual void TearDown() { - delete mDevice; - delete mFakeContext; - mFakeListener.clear(); - mFakePolicy.clear(); - mFakeEventHub.clear(); - } - - void addConfigurationProperty(const char* key, const char* value) { - mFakeEventHub->addConfigurationProperty(DEVICE_ID, String8(key), String8(value)); - } - - void addMapperAndConfigure(InputMapper* mapper) { - mDevice->addMapper(mapper); - mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), 0); - mDevice->reset(ARBITRARY_TIME); - } - - void setDisplayInfoAndReconfigure(int32_t displayId, int32_t width, int32_t height, - int32_t orientation) { - mFakePolicy->setDisplayInfo(displayId, width, height, orientation); - mDevice->configure(ARBITRARY_TIME, mFakePolicy->getReaderConfiguration(), - InputReaderConfiguration::CHANGE_DISPLAY_INFO); - } - - static void process(InputMapper* mapper, nsecs_t when, int32_t deviceId, int32_t type, - int32_t code, int32_t value) { - RawEvent event; - event.when = when; - event.deviceId = deviceId; - event.type = type; - event.code = code; - event.value = value; - mapper->process(&event); - } - - static void assertMotionRange(const InputDeviceInfo& info, - int32_t axis, uint32_t source, float min, float max, float flat, float fuzz) { - const InputDeviceInfo::MotionRange* range = info.getMotionRange(axis, source); - ASSERT_TRUE(range != NULL) << "Axis: " << axis << " Source: " << source; - ASSERT_EQ(axis, range->axis) << "Axis: " << axis << " Source: " << source; - ASSERT_EQ(source, range->source) << "Axis: " << axis << " Source: " << source; - ASSERT_NEAR(min, range->min, EPSILON) << "Axis: " << axis << " Source: " << source; - ASSERT_NEAR(max, range->max, EPSILON) << "Axis: " << axis << " Source: " << source; - ASSERT_NEAR(flat, range->flat, EPSILON) << "Axis: " << axis << " Source: " << source; - ASSERT_NEAR(fuzz, range->fuzz, EPSILON) << "Axis: " << axis << " Source: " << source; - } - - static void assertPointerCoords(const PointerCoords& coords, - float x, float y, float pressure, float size, - float touchMajor, float touchMinor, float toolMajor, float toolMinor, - float orientation, float distance) { - ASSERT_NEAR(x, coords.getAxisValue(AMOTION_EVENT_AXIS_X), 1); - ASSERT_NEAR(y, coords.getAxisValue(AMOTION_EVENT_AXIS_Y), 1); - ASSERT_NEAR(pressure, coords.getAxisValue(AMOTION_EVENT_AXIS_PRESSURE), EPSILON); - ASSERT_NEAR(size, coords.getAxisValue(AMOTION_EVENT_AXIS_SIZE), EPSILON); - ASSERT_NEAR(touchMajor, coords.getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MAJOR), 1); - ASSERT_NEAR(touchMinor, coords.getAxisValue(AMOTION_EVENT_AXIS_TOUCH_MINOR), 1); - ASSERT_NEAR(toolMajor, coords.getAxisValue(AMOTION_EVENT_AXIS_TOOL_MAJOR), 1); - ASSERT_NEAR(toolMinor, coords.getAxisValue(AMOTION_EVENT_AXIS_TOOL_MINOR), 1); - ASSERT_NEAR(orientation, coords.getAxisValue(AMOTION_EVENT_AXIS_ORIENTATION), EPSILON); - ASSERT_NEAR(distance, coords.getAxisValue(AMOTION_EVENT_AXIS_DISTANCE), EPSILON); - } - - static void assertPosition(const sp& controller, float x, float y) { - float actualX, actualY; - controller->getPosition(&actualX, &actualY); - ASSERT_NEAR(x, actualX, 1); - ASSERT_NEAR(y, actualY, 1); - } -}; - -const char* InputMapperTest::DEVICE_NAME = "device"; -const int32_t InputMapperTest::DEVICE_ID = 1; -const int32_t InputMapperTest::DEVICE_GENERATION = 2; -const int32_t InputMapperTest::DEVICE_CONTROLLER_NUMBER = 0; -const uint32_t InputMapperTest::DEVICE_CLASSES = 0; // not needed for current tests - - -// --- SwitchInputMapperTest --- - -class SwitchInputMapperTest : public InputMapperTest { -protected: -}; - -TEST_F(SwitchInputMapperTest, GetSources) { - SwitchInputMapper* mapper = new SwitchInputMapper(mDevice); - addMapperAndConfigure(mapper); - - ASSERT_EQ(uint32_t(AINPUT_SOURCE_SWITCH), mapper->getSources()); -} - -TEST_F(SwitchInputMapperTest, GetSwitchState) { - SwitchInputMapper* mapper = new SwitchInputMapper(mDevice); - addMapperAndConfigure(mapper); - - mFakeEventHub->setSwitchState(DEVICE_ID, SW_LID, 1); - ASSERT_EQ(1, mapper->getSwitchState(AINPUT_SOURCE_ANY, SW_LID)); - - mFakeEventHub->setSwitchState(DEVICE_ID, SW_LID, 0); - ASSERT_EQ(0, mapper->getSwitchState(AINPUT_SOURCE_ANY, SW_LID)); -} - -TEST_F(SwitchInputMapperTest, Process) { - SwitchInputMapper* mapper = new SwitchInputMapper(mDevice); - addMapperAndConfigure(mapper); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SW, SW_LID, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SW, SW_JACK_PHYSICAL_INSERT, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SW, SW_HEADPHONE_INSERT, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - - NotifySwitchArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifySwitchWasCalled(&args)); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ((1 << SW_LID) | (1 << SW_JACK_PHYSICAL_INSERT), args.switchValues); - ASSERT_EQ((1 << SW_LID) | (1 << SW_JACK_PHYSICAL_INSERT) | (1 << SW_HEADPHONE_INSERT), - args.switchMask); - ASSERT_EQ(uint32_t(0), args.policyFlags); -} - - -// --- KeyboardInputMapperTest --- - -class KeyboardInputMapperTest : public InputMapperTest { -protected: - void testDPadKeyRotation(KeyboardInputMapper* mapper, - int32_t originalScanCode, int32_t originalKeyCode, int32_t rotatedKeyCode); -}; - -void KeyboardInputMapperTest::testDPadKeyRotation(KeyboardInputMapper* mapper, - int32_t originalScanCode, int32_t, int32_t rotatedKeyCode) { - NotifyKeyArgs args; - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, originalScanCode, 1); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(originalScanCode, args.scanCode); - ASSERT_EQ(rotatedKeyCode, args.keyCode); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, originalScanCode, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, args.action); - ASSERT_EQ(originalScanCode, args.scanCode); - ASSERT_EQ(rotatedKeyCode, args.keyCode); -} - - -TEST_F(KeyboardInputMapperTest, GetSources) { - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, mapper->getSources()); -} - -TEST_F(KeyboardInputMapperTest, Process_SimpleKeyPress) { - const int32_t USAGE_A = 0x070004; - const int32_t USAGE_UNKNOWN = 0x07ffff; - mFakeEventHub->addKey(DEVICE_ID, KEY_HOME, 0, AKEYCODE_HOME, POLICY_FLAG_WAKE); - mFakeEventHub->addKey(DEVICE_ID, 0, USAGE_A, AKEYCODE_A, POLICY_FLAG_WAKE); - - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - // Key down by scan code. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_HOME, 1); - NotifyKeyArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(AKEYCODE_HOME, args.keyCode); - ASSERT_EQ(KEY_HOME, args.scanCode); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, args.flags); - ASSERT_EQ(POLICY_FLAG_WAKE, args.policyFlags); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Key up by scan code. - process(mapper, ARBITRARY_TIME + 1, DEVICE_ID, - EV_KEY, KEY_HOME, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(ARBITRARY_TIME + 1, args.eventTime); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, args.action); - ASSERT_EQ(AKEYCODE_HOME, args.keyCode); - ASSERT_EQ(KEY_HOME, args.scanCode); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, args.flags); - ASSERT_EQ(POLICY_FLAG_WAKE, args.policyFlags); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Key down by usage code. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_MSC, MSC_SCAN, USAGE_A); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, 0, 1); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(AKEYCODE_A, args.keyCode); - ASSERT_EQ(0, args.scanCode); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, args.flags); - ASSERT_EQ(POLICY_FLAG_WAKE, args.policyFlags); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Key up by usage code. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_MSC, MSC_SCAN, USAGE_A); - process(mapper, ARBITRARY_TIME + 1, DEVICE_ID, - EV_KEY, 0, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(ARBITRARY_TIME + 1, args.eventTime); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, args.action); - ASSERT_EQ(AKEYCODE_A, args.keyCode); - ASSERT_EQ(0, args.scanCode); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, args.flags); - ASSERT_EQ(POLICY_FLAG_WAKE, args.policyFlags); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Key down with unknown scan code or usage code. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_MSC, MSC_SCAN, USAGE_UNKNOWN); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_UNKNOWN, 1); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(0, args.keyCode); - ASSERT_EQ(KEY_UNKNOWN, args.scanCode); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, args.flags); - ASSERT_EQ(0U, args.policyFlags); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Key up with unknown scan code or usage code. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_MSC, MSC_SCAN, USAGE_UNKNOWN); - process(mapper, ARBITRARY_TIME + 1, DEVICE_ID, - EV_KEY, KEY_UNKNOWN, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(ARBITRARY_TIME + 1, args.eventTime); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, args.action); - ASSERT_EQ(0, args.keyCode); - ASSERT_EQ(KEY_UNKNOWN, args.scanCode); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM, args.flags); - ASSERT_EQ(0U, args.policyFlags); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); -} - -TEST_F(KeyboardInputMapperTest, Process_ShouldUpdateMetaState) { - mFakeEventHub->addKey(DEVICE_ID, KEY_LEFTSHIFT, 0, AKEYCODE_SHIFT_LEFT, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_A, 0, AKEYCODE_A, 0); - - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - // Initial metastate. - ASSERT_EQ(AMETA_NONE, mapper->getMetaState()); - - // Metakey down. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_LEFTSHIFT, 1); - NotifyKeyArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, mapper->getMetaState()); - ASSERT_NO_FATAL_FAILURE(mFakeContext->assertUpdateGlobalMetaStateWasCalled()); - - // Key down. - process(mapper, ARBITRARY_TIME + 1, DEVICE_ID, - EV_KEY, KEY_A, 1); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, mapper->getMetaState()); - - // Key up. - process(mapper, ARBITRARY_TIME + 2, DEVICE_ID, - EV_KEY, KEY_A, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, mapper->getMetaState()); - - // Metakey up. - process(mapper, ARBITRARY_TIME + 3, DEVICE_ID, - EV_KEY, KEY_LEFTSHIFT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AMETA_NONE, args.metaState); - ASSERT_EQ(AMETA_NONE, mapper->getMetaState()); - ASSERT_NO_FATAL_FAILURE(mFakeContext->assertUpdateGlobalMetaStateWasCalled()); -} - -TEST_F(KeyboardInputMapperTest, Process_WhenNotOrientationAware_ShouldNotRotateDPad) { - mFakeEventHub->addKey(DEVICE_ID, KEY_UP, 0, AKEYCODE_DPAD_UP, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_RIGHT, 0, AKEYCODE_DPAD_RIGHT, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_DOWN, 0, AKEYCODE_DPAD_DOWN, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_LEFT, 0, AKEYCODE_DPAD_LEFT, 0); - - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_90); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_UP, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_UP)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_RIGHT, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_RIGHT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_DOWN, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_DOWN)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_LEFT, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_LEFT)); -} - -TEST_F(KeyboardInputMapperTest, Process_WhenOrientationAware_ShouldRotateDPad) { - mFakeEventHub->addKey(DEVICE_ID, KEY_UP, 0, AKEYCODE_DPAD_UP, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_RIGHT, 0, AKEYCODE_DPAD_RIGHT, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_DOWN, 0, AKEYCODE_DPAD_DOWN, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_LEFT, 0, AKEYCODE_DPAD_LEFT, 0); - - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addConfigurationProperty("keyboard.orientationAware", "1"); - addMapperAndConfigure(mapper); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_0); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_UP, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_UP)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_RIGHT, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_RIGHT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_DOWN, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_DOWN)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_LEFT, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_LEFT)); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_90); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_UP, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_LEFT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_RIGHT, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_UP)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_DOWN, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_RIGHT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_LEFT, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_DOWN)); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_180); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_UP, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_DOWN)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_RIGHT, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_LEFT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_DOWN, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_UP)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_LEFT, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_RIGHT)); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_270); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_UP, AKEYCODE_DPAD_UP, AKEYCODE_DPAD_RIGHT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_RIGHT, AKEYCODE_DPAD_RIGHT, AKEYCODE_DPAD_DOWN)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_DOWN, AKEYCODE_DPAD_DOWN, AKEYCODE_DPAD_LEFT)); - ASSERT_NO_FATAL_FAILURE(testDPadKeyRotation(mapper, - KEY_LEFT, AKEYCODE_DPAD_LEFT, AKEYCODE_DPAD_UP)); - - // Special case: if orientation changes while key is down, we still emit the same keycode - // in the key up as we did in the key down. - NotifyKeyArgs args; - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_270); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, KEY_UP, 1); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(KEY_UP, args.scanCode); - ASSERT_EQ(AKEYCODE_DPAD_RIGHT, args.keyCode); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_180); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, KEY_UP, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, args.action); - ASSERT_EQ(KEY_UP, args.scanCode); - ASSERT_EQ(AKEYCODE_DPAD_RIGHT, args.keyCode); -} - -TEST_F(KeyboardInputMapperTest, GetKeyCodeState) { - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - mFakeEventHub->setKeyCodeState(DEVICE_ID, AKEYCODE_A, 1); - ASSERT_EQ(1, mapper->getKeyCodeState(AINPUT_SOURCE_ANY, AKEYCODE_A)); - - mFakeEventHub->setKeyCodeState(DEVICE_ID, AKEYCODE_A, 0); - ASSERT_EQ(0, mapper->getKeyCodeState(AINPUT_SOURCE_ANY, AKEYCODE_A)); -} - -TEST_F(KeyboardInputMapperTest, GetScanCodeState) { - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - mFakeEventHub->setScanCodeState(DEVICE_ID, KEY_A, 1); - ASSERT_EQ(1, mapper->getScanCodeState(AINPUT_SOURCE_ANY, KEY_A)); - - mFakeEventHub->setScanCodeState(DEVICE_ID, KEY_A, 0); - ASSERT_EQ(0, mapper->getScanCodeState(AINPUT_SOURCE_ANY, KEY_A)); -} - -TEST_F(KeyboardInputMapperTest, MarkSupportedKeyCodes) { - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - mFakeEventHub->addKey(DEVICE_ID, KEY_A, 0, AKEYCODE_A, 0); - - const int32_t keyCodes[2] = { AKEYCODE_A, AKEYCODE_B }; - uint8_t flags[2] = { 0, 0 }; - ASSERT_TRUE(mapper->markSupportedKeyCodes(AINPUT_SOURCE_ANY, 1, keyCodes, flags)); - ASSERT_TRUE(flags[0]); - ASSERT_FALSE(flags[1]); -} - -TEST_F(KeyboardInputMapperTest, Process_LockedKeysShouldToggleMetaStateAndLeds) { - mFakeEventHub->addLed(DEVICE_ID, LED_CAPSL, true /*initially on*/); - mFakeEventHub->addLed(DEVICE_ID, LED_NUML, false /*initially off*/); - mFakeEventHub->addLed(DEVICE_ID, LED_SCROLLL, false /*initially off*/); - mFakeEventHub->addKey(DEVICE_ID, KEY_CAPSLOCK, 0, AKEYCODE_CAPS_LOCK, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_NUMLOCK, 0, AKEYCODE_NUM_LOCK, 0); - mFakeEventHub->addKey(DEVICE_ID, KEY_SCROLLLOCK, 0, AKEYCODE_SCROLL_LOCK, 0); - - KeyboardInputMapper* mapper = new KeyboardInputMapper(mDevice, - AINPUT_SOURCE_KEYBOARD, AINPUT_KEYBOARD_TYPE_ALPHABETIC); - addMapperAndConfigure(mapper); - - // Initialization should have turned all of the lights off. - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - - // Toggle caps lock on. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_CAPSLOCK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_CAPSLOCK, 0); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - ASSERT_EQ(AMETA_CAPS_LOCK_ON, mapper->getMetaState()); - - // Toggle num lock on. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_NUMLOCK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_NUMLOCK, 0); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - ASSERT_EQ(AMETA_CAPS_LOCK_ON | AMETA_NUM_LOCK_ON, mapper->getMetaState()); - - // Toggle caps lock off. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_CAPSLOCK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_CAPSLOCK, 0); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - ASSERT_EQ(AMETA_NUM_LOCK_ON, mapper->getMetaState()); - - // Toggle scroll lock on. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_SCROLLLOCK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_SCROLLLOCK, 0); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - ASSERT_EQ(AMETA_NUM_LOCK_ON | AMETA_SCROLL_LOCK_ON, mapper->getMetaState()); - - // Toggle num lock off. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_NUMLOCK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_NUMLOCK, 0); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_TRUE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - ASSERT_EQ(AMETA_SCROLL_LOCK_ON, mapper->getMetaState()); - - // Toggle scroll lock off. - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_SCROLLLOCK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, - EV_KEY, KEY_SCROLLLOCK, 0); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_CAPSL)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_NUML)); - ASSERT_FALSE(mFakeEventHub->getLedState(DEVICE_ID, LED_SCROLLL)); - ASSERT_EQ(AMETA_NONE, mapper->getMetaState()); -} - - -// --- CursorInputMapperTest --- - -class CursorInputMapperTest : public InputMapperTest { -protected: - static const int32_t TRACKBALL_MOVEMENT_THRESHOLD; - - sp mFakePointerController; - - virtual void SetUp() { - InputMapperTest::SetUp(); - - mFakePointerController = new FakePointerController(); - mFakePolicy->setPointerController(DEVICE_ID, mFakePointerController); - } - - void testMotionRotation(CursorInputMapper* mapper, - int32_t originalX, int32_t originalY, int32_t rotatedX, int32_t rotatedY); -}; - -const int32_t CursorInputMapperTest::TRACKBALL_MOVEMENT_THRESHOLD = 6; - -void CursorInputMapperTest::testMotionRotation(CursorInputMapper* mapper, - int32_t originalX, int32_t originalY, int32_t rotatedX, int32_t rotatedY) { - NotifyMotionArgs args; - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_X, originalX); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_Y, originalY); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - float(rotatedX) / TRACKBALL_MOVEMENT_THRESHOLD, - float(rotatedY) / TRACKBALL_MOVEMENT_THRESHOLD, - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -TEST_F(CursorInputMapperTest, WhenModeIsPointer_GetSources_ReturnsMouse) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "pointer"); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper->getSources()); -} - -TEST_F(CursorInputMapperTest, WhenModeIsNavigation_GetSources_ReturnsTrackball) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_TRACKBALL, mapper->getSources()); -} - -TEST_F(CursorInputMapperTest, WhenModeIsPointer_PopulateDeviceInfo_ReturnsRangeFromPointerController) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "pointer"); - addMapperAndConfigure(mapper); - - InputDeviceInfo info; - mapper->populateDeviceInfo(&info); - - // Initially there may not be a valid motion range. - ASSERT_EQ(NULL, info.getMotionRange(AINPUT_MOTION_RANGE_X, AINPUT_SOURCE_MOUSE)); - ASSERT_EQ(NULL, info.getMotionRange(AINPUT_MOTION_RANGE_Y, AINPUT_SOURCE_MOUSE)); - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info, - AINPUT_MOTION_RANGE_PRESSURE, AINPUT_SOURCE_MOUSE, 0.0f, 1.0f, 0.0f, 0.0f)); - - // When the bounds are set, then there should be a valid motion range. - mFakePointerController->setBounds(1, 2, 800 - 1, 480 - 1); - - InputDeviceInfo info2; - mapper->populateDeviceInfo(&info2); - - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info2, - AINPUT_MOTION_RANGE_X, AINPUT_SOURCE_MOUSE, - 1, 800 - 1, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info2, - AINPUT_MOTION_RANGE_Y, AINPUT_SOURCE_MOUSE, - 2, 480 - 1, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info2, - AINPUT_MOTION_RANGE_PRESSURE, AINPUT_SOURCE_MOUSE, - 0.0f, 1.0f, 0.0f, 0.0f)); -} - -TEST_F(CursorInputMapperTest, WhenModeIsNavigation_PopulateDeviceInfo_ReturnsScaledRange) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - InputDeviceInfo info; - mapper->populateDeviceInfo(&info); - - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info, - AINPUT_MOTION_RANGE_X, AINPUT_SOURCE_TRACKBALL, - -1.0f, 1.0f, 0.0f, 1.0f / TRACKBALL_MOVEMENT_THRESHOLD)); - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info, - AINPUT_MOTION_RANGE_Y, AINPUT_SOURCE_TRACKBALL, - -1.0f, 1.0f, 0.0f, 1.0f / TRACKBALL_MOVEMENT_THRESHOLD)); - ASSERT_NO_FATAL_FAILURE(assertMotionRange(info, - AINPUT_MOTION_RANGE_PRESSURE, AINPUT_SOURCE_TRACKBALL, - 0.0f, 1.0f, 0.0f, 0.0f)); -} - -TEST_F(CursorInputMapperTest, Process_ShouldSetAllFieldsAndIncludeGlobalMetaState) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyMotionArgs args; - - // Button press. - // Mostly testing non x/y behavior here so we don't need to check again elsewhere. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MOUSE, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TRACKBALL, args.source); - ASSERT_EQ(uint32_t(0), args.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(0, args.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, args.buttonState); - ASSERT_EQ(0, args.edgeFlags); - ASSERT_EQ(uint32_t(1), args.pointerCount); - ASSERT_EQ(0, args.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, args.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_EQ(TRACKBALL_MOVEMENT_THRESHOLD, args.xPrecision); - ASSERT_EQ(TRACKBALL_MOVEMENT_THRESHOLD, args.yPrecision); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Button release. Should have same down time. - process(mapper, ARBITRARY_TIME + 1, DEVICE_ID, EV_KEY, BTN_MOUSE, 0); - process(mapper, ARBITRARY_TIME + 1, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(ARBITRARY_TIME + 1, args.eventTime); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TRACKBALL, args.source); - ASSERT_EQ(uint32_t(0), args.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, args.action); - ASSERT_EQ(0, args.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(0, args.buttonState); - ASSERT_EQ(0, args.edgeFlags); - ASSERT_EQ(uint32_t(1), args.pointerCount); - ASSERT_EQ(0, args.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, args.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_EQ(TRACKBALL_MOVEMENT_THRESHOLD, args.xPrecision); - ASSERT_EQ(TRACKBALL_MOVEMENT_THRESHOLD, args.yPrecision); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); -} - -TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentXYUpdates) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - NotifyMotionArgs args; - - // Motion in X but not Y. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_X, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 1.0f / TRACKBALL_MOVEMENT_THRESHOLD, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - // Motion in Y but not X. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_Y, -2); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 0.0f, -2.0f / TRACKBALL_MOVEMENT_THRESHOLD, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -TEST_F(CursorInputMapperTest, Process_ShouldHandleIndependentButtonUpdates) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - NotifyMotionArgs args; - - // Button press. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MOUSE, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 0.0f, 0.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - // Button release. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MOUSE, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -TEST_F(CursorInputMapperTest, Process_ShouldHandleCombinedXYAndButtonUpdates) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - NotifyMotionArgs args; - - // Combined X, Y and Button. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_X, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_Y, -2); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MOUSE, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 1.0f / TRACKBALL_MOVEMENT_THRESHOLD, -2.0f / TRACKBALL_MOVEMENT_THRESHOLD, - 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - // Move X, Y a bit while pressed. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_X, 2); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_Y, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 2.0f / TRACKBALL_MOVEMENT_THRESHOLD, 1.0f / TRACKBALL_MOVEMENT_THRESHOLD, - 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - // Release Button. - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MOUSE, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); -} - -TEST_F(CursorInputMapperTest, Process_WhenNotOrientationAware_ShouldNotRotateMotions) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addMapperAndConfigure(mapper); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, - DISPLAY_ORIENTATION_90); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, 0, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 1, 1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 0, 1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, -1, 1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, -1, 0, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, -1, -1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 0, -1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 1, -1, 1)); -} - -TEST_F(CursorInputMapperTest, Process_WhenOrientationAware_ShouldRotateMotions) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "navigation"); - addConfigurationProperty("cursor.orientationAware", "1"); - addMapperAndConfigure(mapper); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_ORIENTATION_0); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, 0, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 1, 1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 0, 1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, -1, 1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, -1, 0, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, -1, -1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 0, -1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 1, -1, 1)); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_ORIENTATION_90); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, 1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 1, 1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 0, 0, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, -1, -1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, -1, -1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, -1, -1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 0, 0, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 1, 1, 1)); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_ORIENTATION_180); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, 0, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 1, -1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 0, -1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, -1, -1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, -1, 0, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, -1, 1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 0, 1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 1, 1, -1)); - - setDisplayInfoAndReconfigure(DISPLAY_ID, - DISPLAY_WIDTH, DISPLAY_HEIGHT, DISPLAY_ORIENTATION_270); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, 1, -1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 1, -1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, 0, 0, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 1, -1, 1, 1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, 0, -1, 1, 0)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, -1, 1, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 0, 0, -1)); - ASSERT_NO_FATAL_FAILURE(testMotionRotation(mapper, -1, 1, -1, -1)); -} - -TEST_F(CursorInputMapperTest, Process_ShouldHandleAllButtons) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "pointer"); - addMapperAndConfigure(mapper); - - mFakePointerController->setBounds(0, 0, 800 - 1, 480 - 1); - mFakePointerController->setPosition(100, 200); - mFakePointerController->setButtonState(0); - - NotifyMotionArgs motionArgs; - NotifyKeyArgs keyArgs; - - // press BTN_LEFT, release BTN_LEFT - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_LEFT, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, mFakePointerController->getButtonState()); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_LEFT, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - // press BTN_RIGHT + BTN_MIDDLE, release BTN_RIGHT, release BTN_MIDDLE - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_RIGHT, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MIDDLE, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_SECONDARY | AMOTION_EVENT_BUTTON_TERTIARY, - motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_SECONDARY | AMOTION_EVENT_BUTTON_TERTIARY, - mFakePointerController->getButtonState()); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_RIGHT, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_TERTIARY, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_TERTIARY, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_MIDDLE, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - // press BTN_BACK, release BTN_BACK - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_BACK, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_BACK, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - - // press BTN_SIDE, release BTN_SIDE - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_SIDE, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_SIDE, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - - // press BTN_FORWARD, release BTN_FORWARD - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_FORWARD, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_FORWARD, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - - // press BTN_EXTRA, release BTN_EXTRA - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_EXTRA, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_EXTRA, 0); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, mFakePointerController->getButtonState()); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - 100.0f, 200.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); -} - -TEST_F(CursorInputMapperTest, Process_WhenModeIsPointer_ShouldMoveThePointerAround) { - CursorInputMapper* mapper = new CursorInputMapper(mDevice); - addConfigurationProperty("cursor.mode", "pointer"); - addMapperAndConfigure(mapper); - - mFakePointerController->setBounds(0, 0, 800 - 1, 480 - 1); - mFakePointerController->setPosition(100, 200); - mFakePointerController->setButtonState(0); - - NotifyMotionArgs args; - - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_X, 10); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_REL, REL_Y, 20); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, args.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - 110.0f, 220.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f)); - ASSERT_NO_FATAL_FAILURE(assertPosition(mFakePointerController, 110.0f, 220.0f)); -} - - -// --- TouchInputMapperTest --- - -class TouchInputMapperTest : public InputMapperTest { -protected: - static const int32_t RAW_X_MIN; - static const int32_t RAW_X_MAX; - static const int32_t RAW_Y_MIN; - static const int32_t RAW_Y_MAX; - static const int32_t RAW_TOUCH_MIN; - static const int32_t RAW_TOUCH_MAX; - static const int32_t RAW_TOOL_MIN; - static const int32_t RAW_TOOL_MAX; - static const int32_t RAW_PRESSURE_MIN; - static const int32_t RAW_PRESSURE_MAX; - static const int32_t RAW_ORIENTATION_MIN; - static const int32_t RAW_ORIENTATION_MAX; - static const int32_t RAW_DISTANCE_MIN; - static const int32_t RAW_DISTANCE_MAX; - static const int32_t RAW_TILT_MIN; - static const int32_t RAW_TILT_MAX; - static const int32_t RAW_ID_MIN; - static const int32_t RAW_ID_MAX; - static const int32_t RAW_SLOT_MIN; - static const int32_t RAW_SLOT_MAX; - static const float X_PRECISION; - static const float Y_PRECISION; - - static const float GEOMETRIC_SCALE; - static const TouchAffineTransformation AFFINE_TRANSFORM; - - static const VirtualKeyDefinition VIRTUAL_KEYS[2]; - - enum Axes { - POSITION = 1 << 0, - TOUCH = 1 << 1, - TOOL = 1 << 2, - PRESSURE = 1 << 3, - ORIENTATION = 1 << 4, - MINOR = 1 << 5, - ID = 1 << 6, - DISTANCE = 1 << 7, - TILT = 1 << 8, - SLOT = 1 << 9, - TOOL_TYPE = 1 << 10, - }; - - void prepareDisplay(int32_t orientation); - void prepareVirtualKeys(); - void prepareLocationCalibration(); - int32_t toRawX(float displayX); - int32_t toRawY(float displayY); - float toCookedX(float rawX, float rawY); - float toCookedY(float rawX, float rawY); - float toDisplayX(int32_t rawX); - float toDisplayY(int32_t rawY); -}; - -const int32_t TouchInputMapperTest::RAW_X_MIN = 25; -const int32_t TouchInputMapperTest::RAW_X_MAX = 1019; -const int32_t TouchInputMapperTest::RAW_Y_MIN = 30; -const int32_t TouchInputMapperTest::RAW_Y_MAX = 1009; -const int32_t TouchInputMapperTest::RAW_TOUCH_MIN = 0; -const int32_t TouchInputMapperTest::RAW_TOUCH_MAX = 31; -const int32_t TouchInputMapperTest::RAW_TOOL_MIN = 0; -const int32_t TouchInputMapperTest::RAW_TOOL_MAX = 15; -const int32_t TouchInputMapperTest::RAW_PRESSURE_MIN = RAW_TOUCH_MIN; -const int32_t TouchInputMapperTest::RAW_PRESSURE_MAX = RAW_TOUCH_MAX; -const int32_t TouchInputMapperTest::RAW_ORIENTATION_MIN = -7; -const int32_t TouchInputMapperTest::RAW_ORIENTATION_MAX = 7; -const int32_t TouchInputMapperTest::RAW_DISTANCE_MIN = 0; -const int32_t TouchInputMapperTest::RAW_DISTANCE_MAX = 7; -const int32_t TouchInputMapperTest::RAW_TILT_MIN = 0; -const int32_t TouchInputMapperTest::RAW_TILT_MAX = 150; -const int32_t TouchInputMapperTest::RAW_ID_MIN = 0; -const int32_t TouchInputMapperTest::RAW_ID_MAX = 9; -const int32_t TouchInputMapperTest::RAW_SLOT_MIN = 0; -const int32_t TouchInputMapperTest::RAW_SLOT_MAX = 9; -const float TouchInputMapperTest::X_PRECISION = float(RAW_X_MAX - RAW_X_MIN + 1) / DISPLAY_WIDTH; -const float TouchInputMapperTest::Y_PRECISION = float(RAW_Y_MAX - RAW_Y_MIN + 1) / DISPLAY_HEIGHT; -const TouchAffineTransformation TouchInputMapperTest::AFFINE_TRANSFORM = - TouchAffineTransformation(1, -2, 3, -4, 5, -6); - -const float TouchInputMapperTest::GEOMETRIC_SCALE = - avg(float(DISPLAY_WIDTH) / (RAW_X_MAX - RAW_X_MIN + 1), - float(DISPLAY_HEIGHT) / (RAW_Y_MAX - RAW_Y_MIN + 1)); - -const VirtualKeyDefinition TouchInputMapperTest::VIRTUAL_KEYS[2] = { - { KEY_HOME, 60, DISPLAY_HEIGHT + 15, 20, 20 }, - { KEY_MENU, DISPLAY_HEIGHT - 60, DISPLAY_WIDTH + 15, 20, 20 }, -}; - -void TouchInputMapperTest::prepareDisplay(int32_t orientation) { - setDisplayInfoAndReconfigure(DISPLAY_ID, DISPLAY_WIDTH, DISPLAY_HEIGHT, orientation); -} - -void TouchInputMapperTest::prepareVirtualKeys() { - mFakeEventHub->addVirtualKeyDefinition(DEVICE_ID, VIRTUAL_KEYS[0]); - mFakeEventHub->addVirtualKeyDefinition(DEVICE_ID, VIRTUAL_KEYS[1]); - mFakeEventHub->addKey(DEVICE_ID, KEY_HOME, 0, AKEYCODE_HOME, POLICY_FLAG_WAKE); - mFakeEventHub->addKey(DEVICE_ID, KEY_MENU, 0, AKEYCODE_MENU, POLICY_FLAG_WAKE); -} - -void TouchInputMapperTest::prepareLocationCalibration() { - mFakePolicy->setTouchAffineTransformation(AFFINE_TRANSFORM); -} - -int32_t TouchInputMapperTest::toRawX(float displayX) { - return int32_t(displayX * (RAW_X_MAX - RAW_X_MIN + 1) / DISPLAY_WIDTH + RAW_X_MIN); -} - -int32_t TouchInputMapperTest::toRawY(float displayY) { - return int32_t(displayY * (RAW_Y_MAX - RAW_Y_MIN + 1) / DISPLAY_HEIGHT + RAW_Y_MIN); -} - -float TouchInputMapperTest::toCookedX(float rawX, float rawY) { - AFFINE_TRANSFORM.applyTo(rawX, rawY); - return rawX; -} - -float TouchInputMapperTest::toCookedY(float rawX, float rawY) { - AFFINE_TRANSFORM.applyTo(rawX, rawY); - return rawY; -} - -float TouchInputMapperTest::toDisplayX(int32_t rawX) { - return float(rawX - RAW_X_MIN) * DISPLAY_WIDTH / (RAW_X_MAX - RAW_X_MIN + 1); -} - -float TouchInputMapperTest::toDisplayY(int32_t rawY) { - return float(rawY - RAW_Y_MIN) * DISPLAY_HEIGHT / (RAW_Y_MAX - RAW_Y_MIN + 1); -} - - -// --- SingleTouchInputMapperTest --- - -class SingleTouchInputMapperTest : public TouchInputMapperTest { -protected: - void prepareButtons(); - void prepareAxes(int axes); - - void processDown(SingleTouchInputMapper* mapper, int32_t x, int32_t y); - void processMove(SingleTouchInputMapper* mapper, int32_t x, int32_t y); - void processUp(SingleTouchInputMapper* mappery); - void processPressure(SingleTouchInputMapper* mapper, int32_t pressure); - void processToolMajor(SingleTouchInputMapper* mapper, int32_t toolMajor); - void processDistance(SingleTouchInputMapper* mapper, int32_t distance); - void processTilt(SingleTouchInputMapper* mapper, int32_t tiltX, int32_t tiltY); - void processKey(SingleTouchInputMapper* mapper, int32_t code, int32_t value); - void processSync(SingleTouchInputMapper* mapper); -}; - -void SingleTouchInputMapperTest::prepareButtons() { - mFakeEventHub->addKey(DEVICE_ID, BTN_TOUCH, 0, AKEYCODE_UNKNOWN, 0); -} - -void SingleTouchInputMapperTest::prepareAxes(int axes) { - if (axes & POSITION) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_X, - RAW_X_MIN, RAW_X_MAX, 0, 0); - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_Y, - RAW_Y_MIN, RAW_Y_MAX, 0, 0); - } - if (axes & PRESSURE) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_PRESSURE, - RAW_PRESSURE_MIN, RAW_PRESSURE_MAX, 0, 0); - } - if (axes & TOOL) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_TOOL_WIDTH, - RAW_TOOL_MIN, RAW_TOOL_MAX, 0, 0); - } - if (axes & DISTANCE) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_DISTANCE, - RAW_DISTANCE_MIN, RAW_DISTANCE_MAX, 0, 0); - } - if (axes & TILT) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_TILT_X, - RAW_TILT_MIN, RAW_TILT_MAX, 0, 0); - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_TILT_Y, - RAW_TILT_MIN, RAW_TILT_MAX, 0, 0); - } -} - -void SingleTouchInputMapperTest::processDown(SingleTouchInputMapper* mapper, int32_t x, int32_t y) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_TOUCH, 1); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_X, x); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_Y, y); -} - -void SingleTouchInputMapperTest::processMove(SingleTouchInputMapper* mapper, int32_t x, int32_t y) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_X, x); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_Y, y); -} - -void SingleTouchInputMapperTest::processUp(SingleTouchInputMapper* mapper) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, BTN_TOUCH, 0); -} - -void SingleTouchInputMapperTest::processPressure( - SingleTouchInputMapper* mapper, int32_t pressure) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_PRESSURE, pressure); -} - -void SingleTouchInputMapperTest::processToolMajor( - SingleTouchInputMapper* mapper, int32_t toolMajor) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_TOOL_WIDTH, toolMajor); -} - -void SingleTouchInputMapperTest::processDistance( - SingleTouchInputMapper* mapper, int32_t distance) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_DISTANCE, distance); -} - -void SingleTouchInputMapperTest::processTilt( - SingleTouchInputMapper* mapper, int32_t tiltX, int32_t tiltY) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_TILT_X, tiltX); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_TILT_Y, tiltY); -} - -void SingleTouchInputMapperTest::processKey( - SingleTouchInputMapper* mapper, int32_t code, int32_t value) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, code, value); -} - -void SingleTouchInputMapperTest::processSync(SingleTouchInputMapper* mapper) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); -} - - -TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecifiedAndNotACursor_ReturnsPointer) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - prepareButtons(); - prepareAxes(POSITION); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_MOUSE, mapper->getSources()); -} - -TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsNotSpecifiedAndIsACursor_ReturnsTouchPad) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - mFakeEventHub->addRelativeAxis(DEVICE_ID, REL_X); - mFakeEventHub->addRelativeAxis(DEVICE_ID, REL_Y); - prepareButtons(); - prepareAxes(POSITION); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper->getSources()); -} - -TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsTouchPad_ReturnsTouchPad) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - prepareButtons(); - prepareAxes(POSITION); - addConfigurationProperty("touch.deviceType", "touchPad"); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_TOUCHPAD, mapper->getSources()); -} - -TEST_F(SingleTouchInputMapperTest, GetSources_WhenDeviceTypeIsTouchScreen_ReturnsTouchScreen) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - prepareButtons(); - prepareAxes(POSITION); - addConfigurationProperty("touch.deviceType", "touchScreen"); - addMapperAndConfigure(mapper); - - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, mapper->getSources()); -} - -TEST_F(SingleTouchInputMapperTest, GetKeyCodeState) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - // Unknown key. - ASSERT_EQ(AKEY_STATE_UNKNOWN, mapper->getKeyCodeState(AINPUT_SOURCE_ANY, AKEYCODE_A)); - - // Virtual key is down. - int32_t x = toRawX(VIRTUAL_KEYS[0].centerX); - int32_t y = toRawY(VIRTUAL_KEYS[0].centerY); - processDown(mapper, x, y); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled()); - - ASSERT_EQ(AKEY_STATE_VIRTUAL, mapper->getKeyCodeState(AINPUT_SOURCE_ANY, AKEYCODE_HOME)); - - // Virtual key is up. - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled()); - - ASSERT_EQ(AKEY_STATE_UP, mapper->getKeyCodeState(AINPUT_SOURCE_ANY, AKEYCODE_HOME)); -} - -TEST_F(SingleTouchInputMapperTest, GetScanCodeState) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - // Unknown key. - ASSERT_EQ(AKEY_STATE_UNKNOWN, mapper->getScanCodeState(AINPUT_SOURCE_ANY, KEY_A)); - - // Virtual key is down. - int32_t x = toRawX(VIRTUAL_KEYS[0].centerX); - int32_t y = toRawY(VIRTUAL_KEYS[0].centerY); - processDown(mapper, x, y); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled()); - - ASSERT_EQ(AKEY_STATE_VIRTUAL, mapper->getScanCodeState(AINPUT_SOURCE_ANY, KEY_HOME)); - - // Virtual key is up. - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled()); - - ASSERT_EQ(AKEY_STATE_UP, mapper->getScanCodeState(AINPUT_SOURCE_ANY, KEY_HOME)); -} - -TEST_F(SingleTouchInputMapperTest, MarkSupportedKeyCodes) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - const int32_t keys[2] = { AKEYCODE_HOME, AKEYCODE_A }; - uint8_t flags[2] = { 0, 0 }; - ASSERT_TRUE(mapper->markSupportedKeyCodes(AINPUT_SOURCE_ANY, 2, keys, flags)); - ASSERT_TRUE(flags[0]); - ASSERT_FALSE(flags[1]); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndReleasedNormally_SendsKeyDownAndKeyUp) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyKeyArgs args; - - // Press virtual key. - int32_t x = toRawX(VIRTUAL_KEYS[0].centerX); - int32_t y = toRawY(VIRTUAL_KEYS[0].centerY); - processDown(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(POLICY_FLAG_VIRTUAL, args.policyFlags); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, args.action); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY, args.flags); - ASSERT_EQ(AKEYCODE_HOME, args.keyCode); - ASSERT_EQ(KEY_HOME, args.scanCode); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Release virtual key. - processUp(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&args)); - ASSERT_EQ(ARBITRARY_TIME, args.eventTime); - ASSERT_EQ(DEVICE_ID, args.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, args.source); - ASSERT_EQ(POLICY_FLAG_VIRTUAL, args.policyFlags); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, args.action); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY, args.flags); - ASSERT_EQ(AKEYCODE_HOME, args.keyCode); - ASSERT_EQ(KEY_HOME, args.scanCode); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, args.metaState); - ASSERT_EQ(ARBITRARY_TIME, args.downTime); - - // Should not have sent any motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenVirtualKeyIsPressedAndMovedOutOfBounds_SendsKeyDownAndKeyCancel) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyKeyArgs keyArgs; - - // Press virtual key. - int32_t x = toRawX(VIRTUAL_KEYS[0].centerX); - int32_t y = toRawY(VIRTUAL_KEYS[0].centerY); - processDown(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(ARBITRARY_TIME, keyArgs.eventTime); - ASSERT_EQ(DEVICE_ID, keyArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, keyArgs.source); - ASSERT_EQ(POLICY_FLAG_VIRTUAL, keyArgs.policyFlags); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY, keyArgs.flags); - ASSERT_EQ(AKEYCODE_HOME, keyArgs.keyCode); - ASSERT_EQ(KEY_HOME, keyArgs.scanCode); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, keyArgs.metaState); - ASSERT_EQ(ARBITRARY_TIME, keyArgs.downTime); - - // Move out of bounds. This should generate a cancel and a pointer down since we moved - // into the display area. - y -= 100; - processMove(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(ARBITRARY_TIME, keyArgs.eventTime); - ASSERT_EQ(DEVICE_ID, keyArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_KEYBOARD, keyArgs.source); - ASSERT_EQ(POLICY_FLAG_VIRTUAL, keyArgs.policyFlags); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEY_EVENT_FLAG_FROM_SYSTEM | AKEY_EVENT_FLAG_VIRTUAL_HARD_KEY - | AKEY_EVENT_FLAG_CANCELED, keyArgs.flags); - ASSERT_EQ(AKEYCODE_HOME, keyArgs.keyCode); - ASSERT_EQ(KEY_HOME, keyArgs.scanCode); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, keyArgs.metaState); - ASSERT_EQ(ARBITRARY_TIME, keyArgs.downTime); - - NotifyMotionArgs motionArgs; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Keep moving out of bounds. Should generate a pointer move. - y -= 50; - processMove(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Release out of bounds. Should generate a pointer up. - processUp(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Should not have sent any more keys or motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenTouchStartsOutsideDisplayAndMovesIn_SendsDownAsTouchEntersDisplay) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyMotionArgs motionArgs; - - // Initially go down out of bounds. - int32_t x = -10; - int32_t y = -10; - processDown(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); - - // Move into the display area. Should generate a pointer down. - x = 50; - y = 75; - processMove(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Release. Should generate a pointer up. - processUp(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Should not have sent any more keys or motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); -} - -TEST_F(SingleTouchInputMapperTest, Process_NormalSingleTouchGesture) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyMotionArgs motionArgs; - - // Down. - int32_t x = 100; - int32_t y = 125; - processDown(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Move. - x += 50; - y += 75; - processMove(mapper, x, y); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Up. - processUp(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x), toDisplayY(y), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Should not have sent any more keys or motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenNotOrientationAware_DoesNotRotateMotions) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareButtons(); - prepareAxes(POSITION); - addConfigurationProperty("touch.orientationAware", "0"); - addMapperAndConfigure(mapper); - - NotifyMotionArgs args; - - // Rotation 90. - prepareDisplay(DISPLAY_ORIENTATION_90); - processDown(mapper, toRawX(50), toRawY(75)); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NEAR(50, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X), 1); - ASSERT_NEAR(75, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y), 1); - - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled()); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenOrientationAware_RotatesMotions) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareButtons(); - prepareAxes(POSITION); - addMapperAndConfigure(mapper); - - NotifyMotionArgs args; - - // Rotation 0. - prepareDisplay(DISPLAY_ORIENTATION_0); - processDown(mapper, toRawX(50), toRawY(75)); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NEAR(50, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X), 1); - ASSERT_NEAR(75, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y), 1); - - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled()); - - // Rotation 90. - prepareDisplay(DISPLAY_ORIENTATION_90); - processDown(mapper, RAW_X_MAX - toRawX(75) + RAW_X_MIN, toRawY(50)); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NEAR(50, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X), 1); - ASSERT_NEAR(75, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y), 1); - - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled()); - - // Rotation 180. - prepareDisplay(DISPLAY_ORIENTATION_180); - processDown(mapper, RAW_X_MAX - toRawX(50) + RAW_X_MIN, RAW_Y_MAX - toRawY(75) + RAW_Y_MIN); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NEAR(50, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X), 1); - ASSERT_NEAR(75, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y), 1); - - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled()); - - // Rotation 270. - prepareDisplay(DISPLAY_ORIENTATION_270); - processDown(mapper, toRawX(75), RAW_Y_MAX - toRawY(50) + RAW_Y_MIN); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NEAR(50, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_X), 1); - ASSERT_NEAR(75, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_Y), 1); - - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled()); -} - -TEST_F(SingleTouchInputMapperTest, Process_AllAxes_DefaultCalibration) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION | PRESSURE | TOOL | DISTANCE | TILT); - addMapperAndConfigure(mapper); - - // These calculations are based on the input device calibration documentation. - int32_t rawX = 100; - int32_t rawY = 200; - int32_t rawPressure = 10; - int32_t rawToolMajor = 12; - int32_t rawDistance = 2; - int32_t rawTiltX = 30; - int32_t rawTiltY = 110; - - float x = toDisplayX(rawX); - float y = toDisplayY(rawY); - float pressure = float(rawPressure) / RAW_PRESSURE_MAX; - float size = float(rawToolMajor) / RAW_TOOL_MAX; - float tool = float(rawToolMajor) * GEOMETRIC_SCALE; - float distance = float(rawDistance); - - float tiltCenter = (RAW_TILT_MAX + RAW_TILT_MIN) * 0.5f; - float tiltScale = M_PI / 180; - float tiltXAngle = (rawTiltX - tiltCenter) * tiltScale; - float tiltYAngle = (rawTiltY - tiltCenter) * tiltScale; - float orientation = atan2f(-sinf(tiltXAngle), sinf(tiltYAngle)); - float tilt = acosf(cosf(tiltXAngle) * cosf(tiltYAngle)); - - processDown(mapper, rawX, rawY); - processPressure(mapper, rawPressure); - processToolMajor(mapper, rawToolMajor); - processDistance(mapper, rawDistance); - processTilt(mapper, rawTiltX, rawTiltY); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, pressure, size, tool, tool, tool, tool, orientation, distance)); - ASSERT_EQ(tilt, args.pointerCoords[0].getAxisValue(AMOTION_EVENT_AXIS_TILT)); -} - -TEST_F(SingleTouchInputMapperTest, Process_XYAxes_AffineCalibration) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareLocationCalibration(); - prepareButtons(); - prepareAxes(POSITION); - addMapperAndConfigure(mapper); - - int32_t rawX = 100; - int32_t rawY = 200; - - float x = toDisplayX(toCookedX(rawX, rawY)); - float y = toDisplayY(toCookedY(rawX, rawY)); - - processDown(mapper, rawX, rawY); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, 1, 0, 0, 0, 0, 0, 0, 0)); -} - -TEST_F(SingleTouchInputMapperTest, Process_ShouldHandleAllButtons) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - NotifyKeyArgs keyArgs; - - processDown(mapper, 100, 200); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(0, motionArgs.buttonState); - - // press BTN_LEFT, release BTN_LEFT - processKey(mapper, BTN_LEFT, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, motionArgs.buttonState); - - processKey(mapper, BTN_LEFT, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // press BTN_RIGHT + BTN_MIDDLE, release BTN_RIGHT, release BTN_MIDDLE - processKey(mapper, BTN_RIGHT, 1); - processKey(mapper, BTN_MIDDLE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_SECONDARY | AMOTION_EVENT_BUTTON_TERTIARY, - motionArgs.buttonState); - - processKey(mapper, BTN_RIGHT, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_TERTIARY, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_MIDDLE, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // press BTN_BACK, release BTN_BACK - processKey(mapper, BTN_BACK, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_BACK, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - - // press BTN_SIDE, release BTN_SIDE - processKey(mapper, BTN_SIDE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_SIDE, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - - // press BTN_FORWARD, release BTN_FORWARD - processKey(mapper, BTN_FORWARD, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_FORWARD, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - - // press BTN_EXTRA, release BTN_EXTRA - processKey(mapper, BTN_EXTRA, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_EXTRA, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - - // press BTN_STYLUS, release BTN_STYLUS - processKey(mapper, BTN_STYLUS, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_SECONDARY, motionArgs.buttonState); - - processKey(mapper, BTN_STYLUS, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // press BTN_STYLUS2, release BTN_STYLUS2 - processKey(mapper, BTN_STYLUS2, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_TERTIARY, motionArgs.buttonState); - - processKey(mapper, BTN_STYLUS2, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // release touch - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(0, motionArgs.buttonState); -} - -TEST_F(SingleTouchInputMapperTest, Process_ShouldHandleAllToolTypes) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - - // default tool type is finger - processDown(mapper, 100, 200); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // eraser - processKey(mapper, BTN_TOOL_RUBBER, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_ERASER, motionArgs.pointerProperties[0].toolType); - - // stylus - processKey(mapper, BTN_TOOL_RUBBER, 0); - processKey(mapper, BTN_TOOL_PEN, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // brush - processKey(mapper, BTN_TOOL_PEN, 0); - processKey(mapper, BTN_TOOL_BRUSH, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // pencil - processKey(mapper, BTN_TOOL_BRUSH, 0); - processKey(mapper, BTN_TOOL_PENCIL, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // airbrush - processKey(mapper, BTN_TOOL_PENCIL, 0); - processKey(mapper, BTN_TOOL_AIRBRUSH, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // mouse - processKey(mapper, BTN_TOOL_AIRBRUSH, 0); - processKey(mapper, BTN_TOOL_MOUSE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, motionArgs.pointerProperties[0].toolType); - - // lens - processKey(mapper, BTN_TOOL_MOUSE, 0); - processKey(mapper, BTN_TOOL_LENS, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, motionArgs.pointerProperties[0].toolType); - - // double-tap - processKey(mapper, BTN_TOOL_LENS, 0); - processKey(mapper, BTN_TOOL_DOUBLETAP, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // triple-tap - processKey(mapper, BTN_TOOL_DOUBLETAP, 0); - processKey(mapper, BTN_TOOL_TRIPLETAP, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // quad-tap - processKey(mapper, BTN_TOOL_TRIPLETAP, 0); - processKey(mapper, BTN_TOOL_QUADTAP, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // finger - processKey(mapper, BTN_TOOL_QUADTAP, 0); - processKey(mapper, BTN_TOOL_FINGER, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // stylus trumps finger - processKey(mapper, BTN_TOOL_PEN, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // eraser trumps stylus - processKey(mapper, BTN_TOOL_RUBBER, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_ERASER, motionArgs.pointerProperties[0].toolType); - - // mouse trumps eraser - processKey(mapper, BTN_TOOL_MOUSE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, motionArgs.pointerProperties[0].toolType); - - // back to default tool type - processKey(mapper, BTN_TOOL_MOUSE, 0); - processKey(mapper, BTN_TOOL_RUBBER, 0); - processKey(mapper, BTN_TOOL_PEN, 0); - processKey(mapper, BTN_TOOL_FINGER, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenBtnTouchPresent_HoversIfItsValueIsZero) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION); - mFakeEventHub->addKey(DEVICE_ID, BTN_TOOL_FINGER, 0, AKEYCODE_UNKNOWN, 0); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - - // initially hovering because BTN_TOUCH not sent yet, pressure defaults to 0 - processKey(mapper, BTN_TOOL_FINGER, 1); - processMove(mapper, 100, 200); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - // move a little - processMove(mapper, 150, 250); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // down when BTN_TOUCH is pressed, pressure defaults to 1 - processKey(mapper, BTN_TOUCH, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - // up when BTN_TOUCH is released, hover restored - processKey(mapper, BTN_TOUCH, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // exit hover when pointer goes away - processKey(mapper, BTN_TOOL_FINGER, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); -} - -TEST_F(SingleTouchInputMapperTest, Process_WhenAbsPressureIsPresent_HoversIfItsValueIsZero) { - SingleTouchInputMapper* mapper = new SingleTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareButtons(); - prepareAxes(POSITION | PRESSURE); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - - // initially hovering because pressure is 0 - processDown(mapper, 100, 200); - processPressure(mapper, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - // move a little - processMove(mapper, 150, 250); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // down when pressure is non-zero - processPressure(mapper, RAW_PRESSURE_MAX); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - // up when pressure becomes 0, hover restored - processPressure(mapper, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // exit hover when pointer goes away - processUp(mapper); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); -} - - -// --- MultiTouchInputMapperTest --- - -class MultiTouchInputMapperTest : public TouchInputMapperTest { -protected: - void prepareAxes(int axes); - - void processPosition(MultiTouchInputMapper* mapper, int32_t x, int32_t y); - void processTouchMajor(MultiTouchInputMapper* mapper, int32_t touchMajor); - void processTouchMinor(MultiTouchInputMapper* mapper, int32_t touchMinor); - void processToolMajor(MultiTouchInputMapper* mapper, int32_t toolMajor); - void processToolMinor(MultiTouchInputMapper* mapper, int32_t toolMinor); - void processOrientation(MultiTouchInputMapper* mapper, int32_t orientation); - void processPressure(MultiTouchInputMapper* mapper, int32_t pressure); - void processDistance(MultiTouchInputMapper* mapper, int32_t distance); - void processId(MultiTouchInputMapper* mapper, int32_t id); - void processSlot(MultiTouchInputMapper* mapper, int32_t slot); - void processToolType(MultiTouchInputMapper* mapper, int32_t toolType); - void processKey(MultiTouchInputMapper* mapper, int32_t code, int32_t value); - void processMTSync(MultiTouchInputMapper* mapper); - void processSync(MultiTouchInputMapper* mapper); -}; - -void MultiTouchInputMapperTest::prepareAxes(int axes) { - if (axes & POSITION) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_POSITION_X, - RAW_X_MIN, RAW_X_MAX, 0, 0); - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_POSITION_Y, - RAW_Y_MIN, RAW_Y_MAX, 0, 0); - } - if (axes & TOUCH) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_TOUCH_MAJOR, - RAW_TOUCH_MIN, RAW_TOUCH_MAX, 0, 0); - if (axes & MINOR) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_TOUCH_MINOR, - RAW_TOUCH_MIN, RAW_TOUCH_MAX, 0, 0); - } - } - if (axes & TOOL) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_WIDTH_MAJOR, - RAW_TOOL_MIN, RAW_TOOL_MAX, 0, 0); - if (axes & MINOR) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_WIDTH_MINOR, - RAW_TOOL_MAX, RAW_TOOL_MAX, 0, 0); - } - } - if (axes & ORIENTATION) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_ORIENTATION, - RAW_ORIENTATION_MIN, RAW_ORIENTATION_MAX, 0, 0); - } - if (axes & PRESSURE) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_PRESSURE, - RAW_PRESSURE_MIN, RAW_PRESSURE_MAX, 0, 0); - } - if (axes & DISTANCE) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_DISTANCE, - RAW_DISTANCE_MIN, RAW_DISTANCE_MAX, 0, 0); - } - if (axes & ID) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_TRACKING_ID, - RAW_ID_MIN, RAW_ID_MAX, 0, 0); - } - if (axes & SLOT) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_SLOT, - RAW_SLOT_MIN, RAW_SLOT_MAX, 0, 0); - mFakeEventHub->setAbsoluteAxisValue(DEVICE_ID, ABS_MT_SLOT, 0); - } - if (axes & TOOL_TYPE) { - mFakeEventHub->addAbsoluteAxis(DEVICE_ID, ABS_MT_TOOL_TYPE, - 0, MT_TOOL_MAX, 0, 0); - } -} - -void MultiTouchInputMapperTest::processPosition( - MultiTouchInputMapper* mapper, int32_t x, int32_t y) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_POSITION_X, x); - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_POSITION_Y, y); -} - -void MultiTouchInputMapperTest::processTouchMajor( - MultiTouchInputMapper* mapper, int32_t touchMajor) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_TOUCH_MAJOR, touchMajor); -} - -void MultiTouchInputMapperTest::processTouchMinor( - MultiTouchInputMapper* mapper, int32_t touchMinor) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_TOUCH_MINOR, touchMinor); -} - -void MultiTouchInputMapperTest::processToolMajor( - MultiTouchInputMapper* mapper, int32_t toolMajor) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_WIDTH_MAJOR, toolMajor); -} - -void MultiTouchInputMapperTest::processToolMinor( - MultiTouchInputMapper* mapper, int32_t toolMinor) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_WIDTH_MINOR, toolMinor); -} - -void MultiTouchInputMapperTest::processOrientation( - MultiTouchInputMapper* mapper, int32_t orientation) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_ORIENTATION, orientation); -} - -void MultiTouchInputMapperTest::processPressure( - MultiTouchInputMapper* mapper, int32_t pressure) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_PRESSURE, pressure); -} - -void MultiTouchInputMapperTest::processDistance( - MultiTouchInputMapper* mapper, int32_t distance) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_DISTANCE, distance); -} - -void MultiTouchInputMapperTest::processId( - MultiTouchInputMapper* mapper, int32_t id) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_TRACKING_ID, id); -} - -void MultiTouchInputMapperTest::processSlot( - MultiTouchInputMapper* mapper, int32_t slot) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_SLOT, slot); -} - -void MultiTouchInputMapperTest::processToolType( - MultiTouchInputMapper* mapper, int32_t toolType) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_ABS, ABS_MT_TOOL_TYPE, toolType); -} - -void MultiTouchInputMapperTest::processKey( - MultiTouchInputMapper* mapper, int32_t code, int32_t value) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_KEY, code, value); -} - -void MultiTouchInputMapperTest::processMTSync(MultiTouchInputMapper* mapper) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_MT_REPORT, 0); -} - -void MultiTouchInputMapperTest::processSync(MultiTouchInputMapper* mapper) { - process(mapper, ARBITRARY_TIME, DEVICE_ID, EV_SYN, SYN_REPORT, 0); -} - - -TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithoutTrackingIds) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyMotionArgs motionArgs; - - // Two fingers down at once. - int32_t x1 = 100, y1 = 125, x2 = 300, y2 = 500; - processPosition(mapper, x1, y1); - processMTSync(mapper); - processPosition(mapper, x2, y2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Move. - x1 += 10; y1 += 15; x2 += 5; y2 -= 10; - processPosition(mapper, x1, y1); - processMTSync(mapper); - processPosition(mapper, x2, y2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // First finger up. - x2 += 15; y2 -= 20; - processPosition(mapper, x2, y2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_UP | (0 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(1, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Move. - x2 += 20; y2 -= 25; - processPosition(mapper, x2, y2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(1, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // New finger down. - int32_t x3 = 700, y3 = 300; - processPosition(mapper, x2, y2); - processMTSync(mapper); - processPosition(mapper, x3, y3); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (0 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Second finger up. - x3 += 30; y3 -= 20; - processPosition(mapper, x3, y3); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_UP | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Last finger up. - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.eventTime); - ASSERT_EQ(DEVICE_ID, motionArgs.deviceId); - ASSERT_EQ(AINPUT_SOURCE_TOUCHSCREEN, motionArgs.source); - ASSERT_EQ(uint32_t(0), motionArgs.policyFlags); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(0, motionArgs.flags); - ASSERT_EQ(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON, motionArgs.metaState); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(0, motionArgs.edgeFlags); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NEAR(X_PRECISION, motionArgs.xPrecision, EPSILON); - ASSERT_NEAR(Y_PRECISION, motionArgs.yPrecision, EPSILON); - ASSERT_EQ(ARBITRARY_TIME, motionArgs.downTime); - - // Should not have sent any more keys or motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); -} - -TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithTrackingIds) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | ID); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyMotionArgs motionArgs; - - // Two fingers down at once. - int32_t x1 = 100, y1 = 125, x2 = 300, y2 = 500; - processPosition(mapper, x1, y1); - processId(mapper, 1); - processMTSync(mapper); - processPosition(mapper, x2, y2); - processId(mapper, 2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Move. - x1 += 10; y1 += 15; x2 += 5; y2 -= 10; - processPosition(mapper, x1, y1); - processId(mapper, 1); - processMTSync(mapper); - processPosition(mapper, x2, y2); - processId(mapper, 2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // First finger up. - x2 += 15; y2 -= 20; - processPosition(mapper, x2, y2); - processId(mapper, 2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_UP | (0 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(1, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Move. - x2 += 20; y2 -= 25; - processPosition(mapper, x2, y2); - processId(mapper, 2); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(1, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // New finger down. - int32_t x3 = 700, y3 = 300; - processPosition(mapper, x2, y2); - processId(mapper, 2); - processMTSync(mapper); - processPosition(mapper, x3, y3); - processId(mapper, 3); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (0 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Second finger up. - x3 += 30; y3 -= 20; - processPosition(mapper, x3, y3); - processId(mapper, 3); - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_UP | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Last finger up. - processMTSync(mapper); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Should not have sent any more keys or motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); -} - -TEST_F(MultiTouchInputMapperTest, Process_NormalMultiTouchGesture_WithSlots) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | ID | SLOT); - prepareVirtualKeys(); - addMapperAndConfigure(mapper); - - mFakeContext->setGlobalMetaState(AMETA_SHIFT_LEFT_ON | AMETA_SHIFT_ON); - - NotifyMotionArgs motionArgs; - - // Two fingers down at once. - int32_t x1 = 100, y1 = 125, x2 = 300, y2 = 500; - processPosition(mapper, x1, y1); - processId(mapper, 1); - processSlot(mapper, 1); - processPosition(mapper, x2, y2); - processId(mapper, 2); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Move. - x1 += 10; y1 += 15; x2 += 5; y2 -= 10; - processSlot(mapper, 0); - processPosition(mapper, x1, y1); - processSlot(mapper, 1); - processPosition(mapper, x2, y2); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // First finger up. - x2 += 15; y2 -= 20; - processSlot(mapper, 0); - processId(mapper, -1); - processSlot(mapper, 1); - processPosition(mapper, x2, y2); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_UP | (0 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x1), toDisplayY(y1), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(1, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Move. - x2 += 20; y2 -= 25; - processPosition(mapper, x2, y2); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(1, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // New finger down. - int32_t x3 = 700, y3 = 300; - processPosition(mapper, x2, y2); - processSlot(mapper, 0); - processId(mapper, 3); - processPosition(mapper, x3, y3); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (0 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Second finger up. - x3 += 30; y3 -= 20; - processSlot(mapper, 1); - processId(mapper, -1); - processSlot(mapper, 0); - processPosition(mapper, x3, y3); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_UP | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - motionArgs.action); - ASSERT_EQ(size_t(2), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_EQ(1, motionArgs.pointerProperties[1].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[1].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[1], - toDisplayX(x2), toDisplayY(y2), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Last finger up. - processId(mapper, -1); - processSync(mapper); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(size_t(1), motionArgs.pointerCount); - ASSERT_EQ(0, motionArgs.pointerProperties[0].id); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(x3), toDisplayY(y3), 1, 0, 0, 0, 0, 0, 0, 0)); - - // Should not have sent any more keys or motions. - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasNotCalled()); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasNotCalled()); -} - -TEST_F(MultiTouchInputMapperTest, Process_AllAxes_WithDefaultCalibration) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | TOUCH | TOOL | PRESSURE | ORIENTATION | ID | MINOR | DISTANCE); - addMapperAndConfigure(mapper); - - // These calculations are based on the input device calibration documentation. - int32_t rawX = 100; - int32_t rawY = 200; - int32_t rawTouchMajor = 7; - int32_t rawTouchMinor = 6; - int32_t rawToolMajor = 9; - int32_t rawToolMinor = 8; - int32_t rawPressure = 11; - int32_t rawDistance = 0; - int32_t rawOrientation = 3; - int32_t id = 5; - - float x = toDisplayX(rawX); - float y = toDisplayY(rawY); - float pressure = float(rawPressure) / RAW_PRESSURE_MAX; - float size = avg(rawTouchMajor, rawTouchMinor) / RAW_TOUCH_MAX; - float toolMajor = float(rawToolMajor) * GEOMETRIC_SCALE; - float toolMinor = float(rawToolMinor) * GEOMETRIC_SCALE; - float touchMajor = float(rawTouchMajor) * GEOMETRIC_SCALE; - float touchMinor = float(rawTouchMinor) * GEOMETRIC_SCALE; - float orientation = float(rawOrientation) / RAW_ORIENTATION_MAX * M_PI_2; - float distance = float(rawDistance); - - processPosition(mapper, rawX, rawY); - processTouchMajor(mapper, rawTouchMajor); - processTouchMinor(mapper, rawTouchMinor); - processToolMajor(mapper, rawToolMajor); - processToolMinor(mapper, rawToolMinor); - processPressure(mapper, rawPressure); - processOrientation(mapper, rawOrientation); - processDistance(mapper, rawDistance); - processId(mapper, id); - processMTSync(mapper); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(0, args.pointerProperties[0].id); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, pressure, size, touchMajor, touchMinor, toolMajor, toolMinor, - orientation, distance)); -} - -TEST_F(MultiTouchInputMapperTest, Process_TouchAndToolAxes_GeometricCalibration) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | TOUCH | TOOL | MINOR); - addConfigurationProperty("touch.size.calibration", "geometric"); - addMapperAndConfigure(mapper); - - // These calculations are based on the input device calibration documentation. - int32_t rawX = 100; - int32_t rawY = 200; - int32_t rawTouchMajor = 140; - int32_t rawTouchMinor = 120; - int32_t rawToolMajor = 180; - int32_t rawToolMinor = 160; - - float x = toDisplayX(rawX); - float y = toDisplayY(rawY); - float size = avg(rawTouchMajor, rawTouchMinor) / RAW_TOUCH_MAX; - float toolMajor = float(rawToolMajor) * GEOMETRIC_SCALE; - float toolMinor = float(rawToolMinor) * GEOMETRIC_SCALE; - float touchMajor = float(rawTouchMajor) * GEOMETRIC_SCALE; - float touchMinor = float(rawTouchMinor) * GEOMETRIC_SCALE; - - processPosition(mapper, rawX, rawY); - processTouchMajor(mapper, rawTouchMajor); - processTouchMinor(mapper, rawTouchMinor); - processToolMajor(mapper, rawToolMajor); - processToolMinor(mapper, rawToolMinor); - processMTSync(mapper); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, 1.0f, size, touchMajor, touchMinor, toolMajor, toolMinor, 0, 0)); -} - -TEST_F(MultiTouchInputMapperTest, Process_TouchAndToolAxes_SummedLinearCalibration) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | TOUCH | TOOL); - addConfigurationProperty("touch.size.calibration", "diameter"); - addConfigurationProperty("touch.size.scale", "10"); - addConfigurationProperty("touch.size.bias", "160"); - addConfigurationProperty("touch.size.isSummed", "1"); - addMapperAndConfigure(mapper); - - // These calculations are based on the input device calibration documentation. - // Note: We only provide a single common touch/tool value because the device is assumed - // not to emit separate values for each pointer (isSummed = 1). - int32_t rawX = 100; - int32_t rawY = 200; - int32_t rawX2 = 150; - int32_t rawY2 = 250; - int32_t rawTouchMajor = 5; - int32_t rawToolMajor = 8; - - float x = toDisplayX(rawX); - float y = toDisplayY(rawY); - float x2 = toDisplayX(rawX2); - float y2 = toDisplayY(rawY2); - float size = float(rawTouchMajor) / 2 / RAW_TOUCH_MAX; - float touch = float(rawTouchMajor) / 2 * 10.0f + 160.0f; - float tool = float(rawToolMajor) / 2 * 10.0f + 160.0f; - - processPosition(mapper, rawX, rawY); - processTouchMajor(mapper, rawTouchMajor); - processToolMajor(mapper, rawToolMajor); - processMTSync(mapper); - processPosition(mapper, rawX2, rawY2); - processTouchMajor(mapper, rawTouchMajor); - processToolMajor(mapper, rawToolMajor); - processMTSync(mapper); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, args.action); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_EQ(AMOTION_EVENT_ACTION_POINTER_DOWN | (1 << AMOTION_EVENT_ACTION_POINTER_INDEX_SHIFT), - args.action); - ASSERT_EQ(size_t(2), args.pointerCount); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, 1.0f, size, touch, touch, tool, tool, 0, 0)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[1], - x2, y2, 1.0f, size, touch, touch, tool, tool, 0, 0)); -} - -TEST_F(MultiTouchInputMapperTest, Process_TouchAndToolAxes_AreaCalibration) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | TOUCH | TOOL); - addConfigurationProperty("touch.size.calibration", "area"); - addConfigurationProperty("touch.size.scale", "43"); - addConfigurationProperty("touch.size.bias", "3"); - addMapperAndConfigure(mapper); - - // These calculations are based on the input device calibration documentation. - int32_t rawX = 100; - int32_t rawY = 200; - int32_t rawTouchMajor = 5; - int32_t rawToolMajor = 8; - - float x = toDisplayX(rawX); - float y = toDisplayY(rawY); - float size = float(rawTouchMajor) / RAW_TOUCH_MAX; - float touch = sqrtf(rawTouchMajor) * 43.0f + 3.0f; - float tool = sqrtf(rawToolMajor) * 43.0f + 3.0f; - - processPosition(mapper, rawX, rawY); - processTouchMajor(mapper, rawTouchMajor); - processToolMajor(mapper, rawToolMajor); - processMTSync(mapper); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, 1.0f, size, touch, touch, tool, tool, 0, 0)); -} - -TEST_F(MultiTouchInputMapperTest, Process_PressureAxis_AmplitudeCalibration) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | PRESSURE); - addConfigurationProperty("touch.pressure.calibration", "amplitude"); - addConfigurationProperty("touch.pressure.scale", "0.01"); - addMapperAndConfigure(mapper); - - // These calculations are based on the input device calibration documentation. - int32_t rawX = 100; - int32_t rawY = 200; - int32_t rawPressure = 60; - - float x = toDisplayX(rawX); - float y = toDisplayY(rawY); - float pressure = float(rawPressure) * 0.01f; - - processPosition(mapper, rawX, rawY); - processPressure(mapper, rawPressure); - processMTSync(mapper); - processSync(mapper); - - NotifyMotionArgs args; - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&args)); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(args.pointerCoords[0], - x, y, pressure, 0, 0, 0, 0, 0, 0, 0)); -} - -TEST_F(MultiTouchInputMapperTest, Process_ShouldHandleAllButtons) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | ID | SLOT); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - NotifyKeyArgs keyArgs; - - processId(mapper, 1); - processPosition(mapper, 100, 200); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(0, motionArgs.buttonState); - - // press BTN_LEFT, release BTN_LEFT - processKey(mapper, BTN_LEFT, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_PRIMARY, motionArgs.buttonState); - - processKey(mapper, BTN_LEFT, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // press BTN_RIGHT + BTN_MIDDLE, release BTN_RIGHT, release BTN_MIDDLE - processKey(mapper, BTN_RIGHT, 1); - processKey(mapper, BTN_MIDDLE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_SECONDARY | AMOTION_EVENT_BUTTON_TERTIARY, - motionArgs.buttonState); - - processKey(mapper, BTN_RIGHT, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_TERTIARY, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_MIDDLE, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // press BTN_BACK, release BTN_BACK - processKey(mapper, BTN_BACK, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_BACK, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - - // press BTN_SIDE, release BTN_SIDE - processKey(mapper, BTN_SIDE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_BACK, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_SIDE, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_BACK, keyArgs.keyCode); - - // press BTN_FORWARD, release BTN_FORWARD - processKey(mapper, BTN_FORWARD, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_FORWARD, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - - // press BTN_EXTRA, release BTN_EXTRA - processKey(mapper, BTN_EXTRA, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_DOWN, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_BUTTON_FORWARD, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - processKey(mapper, BTN_EXTRA, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyKeyWasCalled(&keyArgs)); - ASSERT_EQ(AKEY_EVENT_ACTION_UP, keyArgs.action); - ASSERT_EQ(AKEYCODE_FORWARD, keyArgs.keyCode); - - // press BTN_STYLUS, release BTN_STYLUS - processKey(mapper, BTN_STYLUS, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_SECONDARY, motionArgs.buttonState); - - processKey(mapper, BTN_STYLUS, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // press BTN_STYLUS2, release BTN_STYLUS2 - processKey(mapper, BTN_STYLUS2, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_BUTTON_TERTIARY, motionArgs.buttonState); - - processKey(mapper, BTN_STYLUS2, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(0, motionArgs.buttonState); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - - // release touch - processId(mapper, -1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_EQ(0, motionArgs.buttonState); -} - -TEST_F(MultiTouchInputMapperTest, Process_ShouldHandleAllToolTypes) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | ID | SLOT | TOOL_TYPE); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - - // default tool type is finger - processId(mapper, 1); - processPosition(mapper, 100, 200); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // eraser - processKey(mapper, BTN_TOOL_RUBBER, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_ERASER, motionArgs.pointerProperties[0].toolType); - - // stylus - processKey(mapper, BTN_TOOL_RUBBER, 0); - processKey(mapper, BTN_TOOL_PEN, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // brush - processKey(mapper, BTN_TOOL_PEN, 0); - processKey(mapper, BTN_TOOL_BRUSH, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // pencil - processKey(mapper, BTN_TOOL_BRUSH, 0); - processKey(mapper, BTN_TOOL_PENCIL, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // airbrush - processKey(mapper, BTN_TOOL_PENCIL, 0); - processKey(mapper, BTN_TOOL_AIRBRUSH, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // mouse - processKey(mapper, BTN_TOOL_AIRBRUSH, 0); - processKey(mapper, BTN_TOOL_MOUSE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, motionArgs.pointerProperties[0].toolType); - - // lens - processKey(mapper, BTN_TOOL_MOUSE, 0); - processKey(mapper, BTN_TOOL_LENS, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, motionArgs.pointerProperties[0].toolType); - - // double-tap - processKey(mapper, BTN_TOOL_LENS, 0); - processKey(mapper, BTN_TOOL_DOUBLETAP, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // triple-tap - processKey(mapper, BTN_TOOL_DOUBLETAP, 0); - processKey(mapper, BTN_TOOL_TRIPLETAP, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // quad-tap - processKey(mapper, BTN_TOOL_TRIPLETAP, 0); - processKey(mapper, BTN_TOOL_QUADTAP, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // finger - processKey(mapper, BTN_TOOL_QUADTAP, 0); - processKey(mapper, BTN_TOOL_FINGER, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // stylus trumps finger - processKey(mapper, BTN_TOOL_PEN, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // eraser trumps stylus - processKey(mapper, BTN_TOOL_RUBBER, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_ERASER, motionArgs.pointerProperties[0].toolType); - - // mouse trumps eraser - processKey(mapper, BTN_TOOL_MOUSE, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_MOUSE, motionArgs.pointerProperties[0].toolType); - - // MT tool type trumps BTN tool types: MT_TOOL_FINGER - processToolType(mapper, MT_TOOL_FINGER); // this is the first time we send MT_TOOL_TYPE - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); - - // MT tool type trumps BTN tool types: MT_TOOL_PEN - processToolType(mapper, MT_TOOL_PEN); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_STYLUS, motionArgs.pointerProperties[0].toolType); - - // back to default tool type - processToolType(mapper, -1); // use a deliberately undefined tool type, for testing - processKey(mapper, BTN_TOOL_MOUSE, 0); - processKey(mapper, BTN_TOOL_RUBBER, 0); - processKey(mapper, BTN_TOOL_PEN, 0); - processKey(mapper, BTN_TOOL_FINGER, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_MOVE, motionArgs.action); - ASSERT_EQ(AMOTION_EVENT_TOOL_TYPE_FINGER, motionArgs.pointerProperties[0].toolType); -} - -TEST_F(MultiTouchInputMapperTest, Process_WhenBtnTouchPresent_HoversIfItsValueIsZero) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | ID | SLOT); - mFakeEventHub->addKey(DEVICE_ID, BTN_TOUCH, 0, AKEYCODE_UNKNOWN, 0); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - - // initially hovering because BTN_TOUCH not sent yet, pressure defaults to 0 - processId(mapper, 1); - processPosition(mapper, 100, 200); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - // move a little - processPosition(mapper, 150, 250); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // down when BTN_TOUCH is pressed, pressure defaults to 1 - processKey(mapper, BTN_TOUCH, 1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - // up when BTN_TOUCH is released, hover restored - processKey(mapper, BTN_TOUCH, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // exit hover when pointer goes away - processId(mapper, -1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); -} - -TEST_F(MultiTouchInputMapperTest, Process_WhenAbsMTPressureIsPresent_HoversIfItsValueIsZero) { - MultiTouchInputMapper* mapper = new MultiTouchInputMapper(mDevice); - addConfigurationProperty("touch.deviceType", "touchScreen"); - prepareDisplay(DISPLAY_ORIENTATION_0); - prepareAxes(POSITION | ID | SLOT | PRESSURE); - addMapperAndConfigure(mapper); - - NotifyMotionArgs motionArgs; - - // initially hovering because pressure is 0 - processId(mapper, 1); - processPosition(mapper, 100, 200); - processPressure(mapper, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(100), toDisplayY(200), 0, 0, 0, 0, 0, 0, 0, 0)); - - // move a little - processPosition(mapper, 150, 250); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // down when pressure becomes non-zero - processPressure(mapper, RAW_PRESSURE_MAX); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_DOWN, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - // up when pressure becomes 0, hover restored - processPressure(mapper, 0); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_UP, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 1, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_ENTER, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_MOVE, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); - - // exit hover when pointer goes away - processId(mapper, -1); - processSync(mapper); - ASSERT_NO_FATAL_FAILURE(mFakeListener->assertNotifyMotionWasCalled(&motionArgs)); - ASSERT_EQ(AMOTION_EVENT_ACTION_HOVER_EXIT, motionArgs.action); - ASSERT_NO_FATAL_FAILURE(assertPointerCoords(motionArgs.pointerCoords[0], - toDisplayX(150), toDisplayY(250), 0, 0, 0, 0, 0, 0, 0, 0)); -} - - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/powermanager/Android.mk android-platform-frameworks-native-21/services/powermanager/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/powermanager/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/powermanager/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -2,16 +2,14 @@ include $(CLEAR_VARS) LOCAL_SRC_FILES:= \ - IPowerManager.cpp + IPowerManager.cpp LOCAL_SHARED_LIBRARIES := \ - libutils \ - libbinder + libutils \ + libbinder LOCAL_MODULE:= libpowermanager LOCAL_MODULE_TAGS := optional -LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code - include $(BUILD_SHARED_LIBRARY) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/powermanager/IPowerManager.cpp android-platform-frameworks-native-21/services/powermanager/IPowerManager.cpp --- android-platform-frameworks-native-6.0.1+r16/services/powermanager/IPowerManager.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/powermanager/IPowerManager.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -30,10 +30,7 @@ // must be kept in sync with IPowerManager.aidl enum { ACQUIRE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION, - ACQUIRE_WAKE_LOCK_UID = IBinder::FIRST_CALL_TRANSACTION + 1, - RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 2, - UPDATE_WAKE_LOCK_UIDS = IBinder::FIRST_CALL_TRANSACTION + 3, - POWER_HINT = IBinder::FIRST_CALL_TRANSACTION + 4, + RELEASE_WAKE_LOCK = IBinder::FIRST_CALL_TRANSACTION + 4, }; class BpPowerManager : public BpInterface @@ -44,65 +41,26 @@ { } - virtual status_t acquireWakeLock(int flags, const sp& lock, const String16& tag, - const String16& packageName, bool isOneWay) + virtual status_t acquireWakeLock(int flags, const sp& lock, const String16& tag) { Parcel data, reply; data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); - data.writeStrongBinder(lock); data.writeInt32(flags); - data.writeString16(tag); - data.writeString16(packageName); - data.writeInt32(0); // no WorkSource - data.writeString16(NULL, 0); // no history tag - return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply, - isOneWay ? IBinder::FLAG_ONEWAY : 0); - } - - virtual status_t acquireWakeLockWithUid(int flags, const sp& lock, const String16& tag, - const String16& packageName, int uid, bool isOneWay) - { - Parcel data, reply; - data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); - data.writeStrongBinder(lock); - data.writeInt32(flags); data.writeString16(tag); - data.writeString16(packageName); - data.writeInt32(uid); // uid to blame for the work - return remote()->transact(ACQUIRE_WAKE_LOCK_UID, data, &reply, - isOneWay ? IBinder::FLAG_ONEWAY : 0); + // no WorkSource passed + data.writeInt32(0); + return remote()->transact(ACQUIRE_WAKE_LOCK, data, &reply); } - virtual status_t releaseWakeLock(const sp& lock, int flags, bool isOneWay) + virtual status_t releaseWakeLock(const sp& lock, int flags) { Parcel data, reply; data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); data.writeStrongBinder(lock); data.writeInt32(flags); - return remote()->transact(RELEASE_WAKE_LOCK, data, &reply, - isOneWay ? IBinder::FLAG_ONEWAY : 0); - } - - virtual status_t updateWakeLockUids(const sp& lock, int len, const int *uids, - bool isOneWay) { - Parcel data, reply; - data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); - data.writeStrongBinder(lock); - data.writeInt32Array(len, uids); - return remote()->transact(UPDATE_WAKE_LOCK_UIDS, data, &reply, - isOneWay ? IBinder::FLAG_ONEWAY : 0); - } - - virtual status_t powerHint(int hintId, int param) - { - Parcel data, reply; - data.writeInterfaceToken(IPowerManager::getInterfaceDescriptor()); - data.writeInt32(hintId); - data.writeInt32(param); - // This FLAG_ONEWAY is in the .aidl, so there is no way to disable it - return remote()->transact(POWER_HINT, data, &reply, IBinder::FLAG_ONEWAY); + return remote()->transact(RELEASE_WAKE_LOCK, data, &reply); } }; diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/Android.mk android-platform-frameworks-native-21/services/sensorservice/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - BatteryService.cpp \ - CorrectedGyroSensor.cpp \ - Fusion.cpp \ - GravitySensor.cpp \ - LinearAccelerationSensor.cpp \ - OrientationSensor.cpp \ - RotationVectorSensor.cpp \ - SensorDevice.cpp \ - SensorFusion.cpp \ - SensorInterface.cpp \ - SensorService.cpp - -LOCAL_CFLAGS:= -DLOG_TAG=\"SensorService\" - -LOCAL_CFLAGS += -fvisibility=hidden - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - libhardware \ - libhardware_legacy \ - libutils \ - liblog \ - libbinder \ - libui \ - libgui - -LOCAL_MODULE:= libsensorservice - -include $(BUILD_SHARED_LIBRARY) - -##################################################################### -# build executable -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - main_sensorservice.cpp - -LOCAL_SHARED_LIBRARIES := \ - libsensorservice \ - libbinder \ - libutils - -LOCAL_MODULE_TAGS := optional - -LOCAL_MODULE:= sensorservice - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/BatteryService.cpp android-platform-frameworks-native-21/services/sensorservice/BatteryService.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/BatteryService.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/BatteryService.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,102 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include -#include - -#include -#include -#include - -#include -#include - -#include "BatteryService.h" - -namespace android { -// --------------------------------------------------------------------------- - -BatteryService::BatteryService() { - const sp sm(defaultServiceManager()); - if (sm != NULL) { - const String16 name("batterystats"); - mBatteryStatService = interface_cast(sm->getService(name)); - } -} - -bool BatteryService::addSensor(uid_t uid, int handle) { - Mutex::Autolock _l(mActivationsLock); - Info key(uid, handle); - ssize_t index = mActivations.indexOf(key); - if (index < 0) { - index = mActivations.add(key); - } - Info& info(mActivations.editItemAt(index)); - info.count++; - return info.count == 1; -} - -bool BatteryService::removeSensor(uid_t uid, int handle) { - Mutex::Autolock _l(mActivationsLock); - ssize_t index = mActivations.indexOf(Info(uid, handle)); - if (index < 0) return false; - Info& info(mActivations.editItemAt(index)); - info.count--; - return info.count == 0; -} - - -void BatteryService::enableSensorImpl(uid_t uid, int handle) { - if (mBatteryStatService != 0) { - if (addSensor(uid, handle)) { - int64_t identity = IPCThreadState::self()->clearCallingIdentity(); - mBatteryStatService->noteStartSensor(uid, handle); - IPCThreadState::self()->restoreCallingIdentity(identity); - } - } -} -void BatteryService::disableSensorImpl(uid_t uid, int handle) { - if (mBatteryStatService != 0) { - if (removeSensor(uid, handle)) { - int64_t identity = IPCThreadState::self()->clearCallingIdentity(); - mBatteryStatService->noteStopSensor(uid, handle); - IPCThreadState::self()->restoreCallingIdentity(identity); - } - } -} - -void BatteryService::cleanupImpl(uid_t uid) { - if (mBatteryStatService != 0) { - Mutex::Autolock _l(mActivationsLock); - int64_t identity = IPCThreadState::self()->clearCallingIdentity(); - for (ssize_t i=0 ; inoteStopSensor(info.uid, info.handle); - mActivations.removeAt(i); - i--; - } - } - IPCThreadState::self()->restoreCallingIdentity(identity); - } -} - -ANDROID_SINGLETON_STATIC_INSTANCE(BatteryService) - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/BatteryService.h android-platform-frameworks-native-21/services/sensorservice/BatteryService.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/BatteryService.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/BatteryService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,67 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include - -#include -#include - -namespace android { -// --------------------------------------------------------------------------- - -class BatteryService : public Singleton { - - friend class Singleton; - sp mBatteryStatService; - - BatteryService(); - - void enableSensorImpl(uid_t uid, int handle); - void disableSensorImpl(uid_t uid, int handle); - void cleanupImpl(uid_t uid); - - struct Info { - uid_t uid; - int handle; - int32_t count; - Info() : uid(0), handle(0), count(0) { } - Info(uid_t uid, int handle) : uid(uid), handle(handle), count(0) { } - bool operator < (const Info& rhs) const { - return (uid == rhs.uid) ? (handle < rhs.handle) : (uid < rhs.uid); - } - }; - - Mutex mActivationsLock; - SortedVector mActivations; - bool addSensor(uid_t uid, int handle); - bool removeSensor(uid_t uid, int handle); - -public: - static void enableSensor(uid_t uid, int handle) { - BatteryService::getInstance().enableSensorImpl(uid, handle); - } - static void disableSensor(uid_t uid, int handle) { - BatteryService::getInstance().disableSensorImpl(uid, handle); - } - static void cleanup(uid_t uid) { - BatteryService::getInstance().cleanupImpl(uid); - } -}; - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/CorrectedGyroSensor.cpp android-platform-frameworks-native-21/services/sensorservice/CorrectedGyroSensor.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/CorrectedGyroSensor.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/CorrectedGyroSensor.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,86 +0,0 @@ -/* - * 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 -#include -#include - -#include - -#include - -#include "CorrectedGyroSensor.h" -#include "SensorDevice.h" -#include "SensorFusion.h" - -namespace android { -// --------------------------------------------------------------------------- - -CorrectedGyroSensor::CorrectedGyroSensor(sensor_t const* list, size_t count) - : mSensorDevice(SensorDevice::getInstance()), - mSensorFusion(SensorFusion::getInstance()) -{ - for (size_t i=0 ; idata[0] -= bias.x; - outEvent->data[1] -= bias.y; - outEvent->data[2] -= bias.z; - outEvent->sensor = '_cgy'; - return true; - } - return false; -} - -status_t CorrectedGyroSensor::activate(void* ident, bool enabled) { - mSensorDevice.activate(ident, mGyro.getHandle(), enabled); - return mSensorFusion.activate(ident, enabled); -} - -status_t CorrectedGyroSensor::setDelay(void* ident, int /*handle*/, int64_t ns) { - mSensorDevice.setDelay(ident, mGyro.getHandle(), ns); - return mSensorFusion.setDelay(ident, ns); -} - -Sensor CorrectedGyroSensor::getSensor() const { - sensor_t hwSensor; - hwSensor.name = "Corrected Gyroscope Sensor"; - hwSensor.vendor = "AOSP"; - hwSensor.version = 1; - hwSensor.handle = '_cgy'; - hwSensor.type = SENSOR_TYPE_GYROSCOPE; - hwSensor.maxRange = mGyro.getMaxValue(); - hwSensor.resolution = mGyro.getResolution(); - hwSensor.power = mSensorFusion.getPowerUsage(); - hwSensor.minDelay = mGyro.getMinDelay(); - Sensor sensor(&hwSensor); - return sensor; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/CorrectedGyroSensor.h android-platform-frameworks-native-21/services/sensorservice/CorrectedGyroSensor.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/CorrectedGyroSensor.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/CorrectedGyroSensor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_CORRECTED_GYRO_SENSOR_H -#define ANDROID_CORRECTED_GYRO_SENSOR_H - -#include -#include - -#include - -#include "SensorInterface.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class SensorDevice; -class SensorFusion; - -class CorrectedGyroSensor : public SensorInterface { - SensorDevice& mSensorDevice; - SensorFusion& mSensorFusion; - Sensor mGyro; - -public: - CorrectedGyroSensor(sensor_t const* list, size_t count); - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); - virtual status_t activate(void* ident, bool enabled); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return true; } -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_CORRECTED_GYRO_SENSOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/Fusion.cpp android-platform-frameworks-native-21/services/sensorservice/Fusion.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/Fusion.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/Fusion.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,481 +0,0 @@ -/* - * 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 - -#include - -#include "Fusion.h" - -namespace android { - -// ----------------------------------------------------------------------- - -/* - * gyroVAR gives the measured variance of the gyro's output per - * Hz (or variance at 1 Hz). This is an "intrinsic" parameter of the gyro, - * which is independent of the sampling frequency. - * - * The variance of gyro's output at a given sampling period can be - * calculated as: - * variance(T) = gyroVAR / T - * - * The variance of the INTEGRATED OUTPUT at a given sampling period can be - * calculated as: - * variance_integrate_output(T) = gyroVAR * T - * - */ -static const float gyroVAR = 1e-7; // (rad/s)^2 / Hz -static const float biasVAR = 1e-8; // (rad/s)^2 / s (guessed) - -/* - * Standard deviations of accelerometer and magnetometer - */ -static const float accSTDEV = 0.05f; // m/s^2 (measured 0.08 / CDD 0.05) -static const float magSTDEV = 0.5f; // uT (measured 0.7 / CDD 0.5) - -static const float SYMMETRY_TOLERANCE = 1e-10f; - -/* - * Accelerometer updates will not be performed near free fall to avoid - * ill-conditioning and div by zeros. - * Threshhold: 10% of g, in m/s^2 - */ -static const float FREE_FALL_THRESHOLD = 0.981f; -static const float FREE_FALL_THRESHOLD_SQ = - FREE_FALL_THRESHOLD*FREE_FALL_THRESHOLD; - -/* - * The geomagnetic-field should be between 30uT and 60uT. - * Fields strengths greater than this likely indicate a local magnetic - * disturbance which we do not want to update into the fused frame. - */ -static const float MAX_VALID_MAGNETIC_FIELD = 100; // uT -static const float MAX_VALID_MAGNETIC_FIELD_SQ = - MAX_VALID_MAGNETIC_FIELD*MAX_VALID_MAGNETIC_FIELD; - -/* - * Values of the field smaller than this should be ignored in fusion to avoid - * ill-conditioning. This state can happen with anomalous local magnetic - * disturbances canceling the Earth field. - */ -static const float MIN_VALID_MAGNETIC_FIELD = 10; // uT -static const float MIN_VALID_MAGNETIC_FIELD_SQ = - MIN_VALID_MAGNETIC_FIELD*MIN_VALID_MAGNETIC_FIELD; - -/* - * If the cross product of two vectors has magnitude squared less than this, - * we reject it as invalid due to alignment of the vectors. - * This threshold is used to check for the case where the magnetic field sample - * is parallel to the gravity field, which can happen in certain places due - * to magnetic field disturbances. - */ -static const float MIN_VALID_CROSS_PRODUCT_MAG = 1.0e-3; -static const float MIN_VALID_CROSS_PRODUCT_MAG_SQ = - MIN_VALID_CROSS_PRODUCT_MAG*MIN_VALID_CROSS_PRODUCT_MAG; - -// ----------------------------------------------------------------------- - -template -static mat scaleCovariance( - const mat& A, - const mat& P) { - // A*P*transpose(A); - mat APAt; - for (size_t r=0 ; r -static mat crossMatrix(const vec& p, OTHER_TYPE diag) { - mat r; - r[0][0] = diag; - r[1][1] = diag; - r[2][2] = diag; - r[0][1] = p.z; - r[1][0] =-p.z; - r[0][2] =-p.y; - r[2][0] = p.y; - r[1][2] = p.x; - r[2][1] =-p.x; - return r; -} - - -template -class Covariance { - mat mSumXX; - vec mSumX; - size_t mN; -public: - Covariance() : mSumXX(0.0f), mSumX(0.0f), mN(0) { } - void update(const vec& x) { - mSumXX += x*transpose(x); - mSumX += x; - mN++; - } - mat operator()() const { - const float N = 1.0f / mN; - return mSumXX*N - (mSumX*transpose(mSumX))*(N*N); - } - void reset() { - mN = 0; - mSumXX = 0; - mSumX = 0; - } - size_t getCount() const { - return mN; - } -}; - -// ----------------------------------------------------------------------- - -Fusion::Fusion() { - Phi[0][1] = 0; - Phi[1][1] = 1; - - Ba.x = 0; - Ba.y = 0; - Ba.z = 1; - - Bm.x = 0; - Bm.y = 1; - Bm.z = 0; - - x0 = 0; - x1 = 0; - - init(); -} - -void Fusion::init() { - mInitState = 0; - - mGyroRate = 0; - - mCount[0] = 0; - mCount[1] = 0; - mCount[2] = 0; - - mData = 0; -} - -void Fusion::initFusion(const vec4_t& q, float dT) -{ - // initial estimate: E{ x(t0) } - x0 = q; - x1 = 0; - - // process noise covariance matrix: G.Q.Gt, with - // - // G = | -1 0 | Q = | q00 q10 | - // | 0 1 | | q01 q11 | - // - // q00 = sv^2.dt + 1/3.su^2.dt^3 - // q10 = q01 = 1/2.su^2.dt^2 - // q11 = su^2.dt - // - - const float dT2 = dT*dT; - const float dT3 = dT2*dT; - - // variance of integrated output at 1/dT Hz (random drift) - const float q00 = gyroVAR * dT + 0.33333f * biasVAR * dT3; - - // variance of drift rate ramp - const float q11 = biasVAR * dT; - const float q10 = 0.5f * biasVAR * dT2; - const float q01 = q10; - - GQGt[0][0] = q00; // rad^2 - GQGt[1][0] = -q10; - GQGt[0][1] = -q01; - GQGt[1][1] = q11; // (rad/s)^2 - - // initial covariance: Var{ x(t0) } - // TODO: initialize P correctly - P = 0; -} - -bool Fusion::hasEstimate() const { - return (mInitState == (MAG|ACC|GYRO)); -} - -bool Fusion::checkInitComplete(int what, const vec3_t& d, float dT) { - if (hasEstimate()) - return true; - - if (what == ACC) { - mData[0] += d * (1/length(d)); - mCount[0]++; - mInitState |= ACC; - } else if (what == MAG) { - mData[1] += d * (1/length(d)); - mCount[1]++; - mInitState |= MAG; - } else if (what == GYRO) { - mGyroRate = dT; - mData[2] += d*dT; - mCount[2]++; - if (mCount[2] == 64) { - // 64 samples is good enough to estimate the gyro drift and - // doesn't take too much time. - mInitState |= GYRO; - } - } - - if (mInitState == (MAG|ACC|GYRO)) { - // Average all the values we collected so far - mData[0] *= 1.0f/mCount[0]; - mData[1] *= 1.0f/mCount[1]; - mData[2] *= 1.0f/mCount[2]; - - // calculate the MRPs from the data collection, this gives us - // a rough estimate of our initial state - mat33_t R; - vec3_t up(mData[0]); - vec3_t east(cross_product(mData[1], up)); - east *= 1/length(east); - vec3_t north(cross_product(up, east)); - R << east << north << up; - const vec4_t q = matrixToQuat(R); - - initFusion(q, mGyroRate); - } - - return false; -} - -void Fusion::handleGyro(const vec3_t& w, float dT) { - if (!checkInitComplete(GYRO, w, dT)) - return; - - predict(w, dT); -} - -status_t Fusion::handleAcc(const vec3_t& a) { - // ignore acceleration data if we're close to free-fall - if (length_squared(a) < FREE_FALL_THRESHOLD_SQ) { - return BAD_VALUE; - } - - if (!checkInitComplete(ACC, a)) - return BAD_VALUE; - - const float l = 1/length(a); - update(a*l, Ba, accSTDEV*l); - return NO_ERROR; -} - -status_t Fusion::handleMag(const vec3_t& m) { - // the geomagnetic-field should be between 30uT and 60uT - // reject if too large to avoid spurious magnetic sources - const float magFieldSq = length_squared(m); - if (magFieldSq > MAX_VALID_MAGNETIC_FIELD_SQ) { - return BAD_VALUE; - } else if (magFieldSq < MIN_VALID_MAGNETIC_FIELD_SQ) { - // Also reject if too small since we will get ill-defined (zero mag) - // cross-products below - return BAD_VALUE; - } - - if (!checkInitComplete(MAG, m)) - return BAD_VALUE; - - // Orthogonalize the magnetic field to the gravity field, mapping it into - // tangent to Earth. - const vec3_t up( getRotationMatrix() * Ba ); - const vec3_t east( cross_product(m, up) ); - - // If the m and up vectors align, the cross product magnitude will - // approach 0. - // Reject this case as well to avoid div by zero problems and - // ill-conditioning below. - if (length_squared(east) < MIN_VALID_CROSS_PRODUCT_MAG_SQ) { - return BAD_VALUE; - } - - // If we have created an orthogonal magnetic field successfully, - // then pass it in as the update. - vec3_t north( cross_product(up, east) ); - - const float l = 1 / length(north); - north *= l; - - update(north, Bm, magSTDEV*l); - return NO_ERROR; -} - -void Fusion::checkState() { - // P needs to stay positive semidefinite or the fusion diverges. When we - // detect divergence, we reset the fusion. - // TODO(braun): Instead, find the reason for the divergence and fix it. - - if (!isPositiveSemidefinite(P[0][0], SYMMETRY_TOLERANCE) || - !isPositiveSemidefinite(P[1][1], SYMMETRY_TOLERANCE)) { - ALOGW("Sensor fusion diverged; resetting state."); - P = 0; - } -} - -vec4_t Fusion::getAttitude() const { - return x0; -} - -vec3_t Fusion::getBias() const { - return x1; -} - -mat33_t Fusion::getRotationMatrix() const { - return quatToMatrix(x0); -} - -mat34_t Fusion::getF(const vec4_t& q) { - mat34_t F; - - // This is used to compute the derivative of q - // F = | [q.xyz]x | - // | -q.xyz | - - F[0].x = q.w; F[1].x =-q.z; F[2].x = q.y; - F[0].y = q.z; F[1].y = q.w; F[2].y =-q.x; - F[0].z =-q.y; F[1].z = q.x; F[2].z = q.w; - F[0].w =-q.x; F[1].w =-q.y; F[2].w =-q.z; - return F; -} - -void Fusion::predict(const vec3_t& w, float dT) { - const vec4_t q = x0; - const vec3_t b = x1; - const vec3_t we = w - b; - - // q(k+1) = O(we)*q(k) - // -------------------- - // - // O(w) = | cos(0.5*||w||*dT)*I33 - [psi]x psi | - // | -psi' cos(0.5*||w||*dT) | - // - // psi = sin(0.5*||w||*dT)*w / ||w|| - // - // - // P(k+1) = Phi(k)*P(k)*Phi(k)' + G*Q(k)*G' - // ---------------------------------------- - // - // G = | -I33 0 | - // | 0 I33 | - // - // Phi = | Phi00 Phi10 | - // | 0 1 | - // - // Phi00 = I33 - // - [w]x * sin(||w||*dt)/||w|| - // + [w]x^2 * (1-cos(||w||*dT))/||w||^2 - // - // Phi10 = [w]x * (1 - cos(||w||*dt))/||w||^2 - // - [w]x^2 * (||w||*dT - sin(||w||*dt))/||w||^3 - // - I33*dT - - const mat33_t I33(1); - const mat33_t I33dT(dT); - const mat33_t wx(crossMatrix(we, 0)); - const mat33_t wx2(wx*wx); - const float lwedT = length(we)*dT; - const float hlwedT = 0.5f*lwedT; - const float ilwe = 1/length(we); - const float k0 = (1-cosf(lwedT))*(ilwe*ilwe); - const float k1 = sinf(lwedT); - const float k2 = cosf(hlwedT); - const vec3_t psi(sinf(hlwedT)*ilwe*we); - const mat33_t O33(crossMatrix(-psi, k2)); - mat44_t O; - O[0].xyz = O33[0]; O[0].w = -psi.x; - O[1].xyz = O33[1]; O[1].w = -psi.y; - O[2].xyz = O33[2]; O[2].w = -psi.z; - O[3].xyz = psi; O[3].w = k2; - - Phi[0][0] = I33 - wx*(k1*ilwe) + wx2*k0; - Phi[1][0] = wx*k0 - I33dT - wx2*(ilwe*ilwe*ilwe)*(lwedT-k1); - - x0 = O*q; - if (x0.w < 0) - x0 = -x0; - - P = Phi*P*transpose(Phi) + GQGt; - - checkState(); -} - -void Fusion::update(const vec3_t& z, const vec3_t& Bi, float sigma) { - vec4_t q(x0); - // measured vector in body space: h(p) = A(p)*Bi - const mat33_t A(quatToMatrix(q)); - const vec3_t Bb(A*Bi); - - // Sensitivity matrix H = dh(p)/dp - // H = [ L 0 ] - const mat33_t L(crossMatrix(Bb, 0)); - - // gain... - // K = P*Ht / [H*P*Ht + R] - vec K; - const mat33_t R(sigma*sigma); - const mat33_t S(scaleCovariance(L, P[0][0]) + R); - const mat33_t Si(invert(S)); - const mat33_t LtSi(transpose(L)*Si); - K[0] = P[0][0] * LtSi; - K[1] = transpose(P[1][0])*LtSi; - - // update... - // P = (I-K*H) * P - // P -= K*H*P - // | K0 | * | L 0 | * P = | K0*L 0 | * | P00 P10 | = | K0*L*P00 K0*L*P10 | - // | K1 | | K1*L 0 | | P01 P11 | | K1*L*P00 K1*L*P10 | - // Note: the Joseph form is numerically more stable and given by: - // P = (I-KH) * P * (I-KH)' + K*R*R' - const mat33_t K0L(K[0] * L); - const mat33_t K1L(K[1] * L); - P[0][0] -= K0L*P[0][0]; - P[1][1] -= K1L*P[1][0]; - P[1][0] -= K0L*P[1][0]; - P[0][1] = transpose(P[1][0]); - - const vec3_t e(z - Bb); - const vec3_t dq(K[0]*e); - const vec3_t db(K[1]*e); - - q += getF(q)*(0.5f*dq); - x0 = normalize_quat(q); - x1 += db; - - checkState(); -} - -// ----------------------------------------------------------------------- - -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/Fusion.h android-platform-frameworks-native-21/services/sensorservice/Fusion.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/Fusion.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/Fusion.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_FUSION_H -#define ANDROID_FUSION_H - -#include - -#include "quat.h" -#include "mat.h" -#include "vec.h" - -namespace android { - -typedef mat mat34_t; - -class Fusion { - /* - * the state vector is made of two sub-vector containing respectively: - * - modified Rodrigues parameters - * - the estimated gyro bias - */ - quat_t x0; - vec3_t x1; - - /* - * the predicated covariance matrix is made of 4 3x3 sub-matrices and it is - * semi-definite positive. - * - * P = | P00 P10 | = | P00 P10 | - * | P01 P11 | | P10t P11 | - * - * Since P01 = transpose(P10), the code below never calculates or - * stores P01. - */ - mat P; - - /* - * the process noise covariance matrix - */ - mat GQGt; - -public: - Fusion(); - void init(); - void handleGyro(const vec3_t& w, float dT); - status_t handleAcc(const vec3_t& a); - status_t handleMag(const vec3_t& m); - vec4_t getAttitude() const; - vec3_t getBias() const; - mat33_t getRotationMatrix() const; - bool hasEstimate() const; - -private: - mat Phi; - vec3_t Ba, Bm; - uint32_t mInitState; - float mGyroRate; - vec mData; - size_t mCount[3]; - enum { ACC=0x1, MAG=0x2, GYRO=0x4 }; - bool checkInitComplete(int, const vec3_t& w, float d = 0); - void initFusion(const vec4_t& q0, float dT); - void checkState(); - void predict(const vec3_t& w, float dT); - void update(const vec3_t& z, const vec3_t& Bi, float sigma); - static mat34_t getF(const vec4_t& p); -}; - -}; // namespace android - -#endif // ANDROID_FUSION_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/GravitySensor.cpp android-platform-frameworks-native-21/services/sensorservice/GravitySensor.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/GravitySensor.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/GravitySensor.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include - -#include - -#include - -#include "GravitySensor.h" -#include "SensorDevice.h" -#include "SensorFusion.h" - -namespace android { -// --------------------------------------------------------------------------- - -GravitySensor::GravitySensor(sensor_t const* list, size_t count) - : mSensorDevice(SensorDevice::getInstance()), - mSensorFusion(SensorFusion::getInstance()) -{ - for (size_t i=0 ; idata[0] = g.x; - outEvent->data[1] = g.y; - outEvent->data[2] = g.z; - outEvent->sensor = '_grv'; - outEvent->type = SENSOR_TYPE_GRAVITY; - return true; - } - return false; -} - -status_t GravitySensor::activate(void* ident, bool enabled) { - return mSensorFusion.activate(ident, enabled); -} - -status_t GravitySensor::setDelay(void* ident, int /*handle*/, int64_t ns) { - return mSensorFusion.setDelay(ident, ns); -} - -Sensor GravitySensor::getSensor() const { - sensor_t hwSensor; - hwSensor.name = "Gravity Sensor"; - hwSensor.vendor = "AOSP"; - hwSensor.version = 3; - hwSensor.handle = '_grv'; - hwSensor.type = SENSOR_TYPE_GRAVITY; - hwSensor.maxRange = GRAVITY_EARTH * 2; - hwSensor.resolution = mAccelerometer.getResolution(); - hwSensor.power = mSensorFusion.getPowerUsage(); - hwSensor.minDelay = mSensorFusion.getMinDelay(); - Sensor sensor(&hwSensor); - return sensor; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/GravitySensor.h android-platform-frameworks-native-21/services/sensorservice/GravitySensor.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/GravitySensor.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/GravitySensor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_GRAVITY_SENSOR_H -#define ANDROID_GRAVITY_SENSOR_H - -#include -#include - -#include - -#include "SensorInterface.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class SensorDevice; -class SensorFusion; - -class GravitySensor : public SensorInterface { - SensorDevice& mSensorDevice; - SensorFusion& mSensorFusion; - Sensor mAccelerometer; - -public: - GravitySensor(sensor_t const* list, size_t count); - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); - virtual status_t activate(void* ident, bool enabled); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return true; } -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_GRAVITY_SENSOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/LinearAccelerationSensor.cpp android-platform-frameworks-native-21/services/sensorservice/LinearAccelerationSensor.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/LinearAccelerationSensor.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/LinearAccelerationSensor.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include - -#include - -#include - -#include "LinearAccelerationSensor.h" -#include "SensorDevice.h" -#include "SensorFusion.h" - -namespace android { -// --------------------------------------------------------------------------- - -LinearAccelerationSensor::LinearAccelerationSensor(sensor_t const* list, size_t count) - : mSensorDevice(SensorDevice::getInstance()), - mGravitySensor(list, count) -{ -} - -bool LinearAccelerationSensor::process(sensors_event_t* outEvent, - const sensors_event_t& event) -{ - bool result = mGravitySensor.process(outEvent, event); - if (result && event.type == SENSOR_TYPE_ACCELEROMETER) { - outEvent->data[0] = event.acceleration.x - outEvent->data[0]; - outEvent->data[1] = event.acceleration.y - outEvent->data[1]; - outEvent->data[2] = event.acceleration.z - outEvent->data[2]; - outEvent->sensor = '_lin'; - outEvent->type = SENSOR_TYPE_LINEAR_ACCELERATION; - return true; - } - return false; -} - -status_t LinearAccelerationSensor::activate(void* ident, bool enabled) { - return mGravitySensor.activate(ident, enabled); -} - -status_t LinearAccelerationSensor::setDelay(void* ident, int handle, int64_t ns) { - return mGravitySensor.setDelay(ident, handle, ns); -} - -Sensor LinearAccelerationSensor::getSensor() const { - Sensor gsensor(mGravitySensor.getSensor()); - sensor_t hwSensor; - hwSensor.name = "Linear Acceleration Sensor"; - hwSensor.vendor = "AOSP"; - hwSensor.version = gsensor.getVersion(); - hwSensor.handle = '_lin'; - hwSensor.type = SENSOR_TYPE_LINEAR_ACCELERATION; - hwSensor.maxRange = gsensor.getMaxValue(); - hwSensor.resolution = gsensor.getResolution(); - hwSensor.power = gsensor.getPowerUsage(); - hwSensor.minDelay = gsensor.getMinDelay(); - Sensor sensor(&hwSensor); - return sensor; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/LinearAccelerationSensor.h android-platform-frameworks-native-21/services/sensorservice/LinearAccelerationSensor.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/LinearAccelerationSensor.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/LinearAccelerationSensor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,52 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_LINEAR_ACCELERATION_SENSOR_H -#define ANDROID_LINEAR_ACCELERATION_SENSOR_H - -#include -#include - -#include - -#include "SensorInterface.h" -#include "GravitySensor.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class SensorDevice; -class SensorFusion; - -class LinearAccelerationSensor : public SensorInterface { - SensorDevice& mSensorDevice; - GravitySensor mGravitySensor; - - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); -public: - LinearAccelerationSensor(sensor_t const* list, size_t count); - virtual status_t activate(void* ident, bool enabled); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return true; } -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_LINEAR_ACCELERATION_SENSOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/main_sensorservice.cpp android-platform-frameworks-native-21/services/sensorservice/main_sensorservice.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/main_sensorservice.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/main_sensorservice.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,25 +0,0 @@ -/* - * 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 -#include "SensorService.h" - -using namespace android; - -int main(int /*argc*/, char** /*argv*/) { - SensorService::publishAndJoinThreadPool(); - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/mat.h android-platform-frameworks-native-21/services/sensorservice/mat.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/mat.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/mat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,393 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_MAT_H -#define ANDROID_MAT_H - -#include "vec.h" -#include "traits.h" - -// ----------------------------------------------------------------------- - -namespace android { - -template -class mat; - -namespace helpers { - -template -mat& doAssign( - mat& lhs, - typename TypeTraits::ParameterType rhs) { - for (size_t i=0 ; i -mat PURE doMul( - const mat& lhs, - const mat& rhs) -{ - mat res; - for (size_t c=0 ; c -vec PURE doMul( - const mat& lhs, - const vec& rhs) -{ - vec res; - for (size_t r=0 ; r -mat PURE doMul( - const vec& lhs, - const mat& rhs) -{ - mat res; - for (size_t c=0 ; c -mat PURE doMul( - const mat& rhs, - typename TypeTraits::ParameterType v) -{ - mat res; - for (size_t c=0 ; c -mat PURE doMul( - typename TypeTraits::ParameterType v, - const mat& rhs) -{ - mat res; - for (size_t c=0 ; c -class mat : public vec< vec, C > { - typedef typename TypeTraits::ParameterType pTYPE; - typedef vec< vec, C > base; -public: - // STL-like interface. - typedef TYPE value_type; - typedef TYPE& reference; - typedef TYPE const& const_reference; - typedef size_t size_type; - size_type size() const { return R*C; } - enum { ROWS = R, COLS = C }; - - - // ----------------------------------------------------------------------- - // default constructors - - mat() { } - mat(const mat& rhs) : base(rhs) { } - mat(const base& rhs) : base(rhs) { } - - // ----------------------------------------------------------------------- - // conversion constructors - - // sets the diagonal to the value, off-diagonal to zero - mat(pTYPE rhs) { - helpers::doAssign(*this, rhs); - } - - // ----------------------------------------------------------------------- - // Assignment - - mat& operator=(const mat& rhs) { - base::operator=(rhs); - return *this; - } - - mat& operator=(const base& rhs) { - base::operator=(rhs); - return *this; - } - - mat& operator=(pTYPE rhs) { - return helpers::doAssign(*this, rhs); - } - - // ----------------------------------------------------------------------- - // non-member function declaration and definition - - friend inline mat PURE operator + (const mat& lhs, const mat& rhs) { - return helpers::doAdd( - static_cast(lhs), - static_cast(rhs)); - } - friend inline mat PURE operator - (const mat& lhs, const mat& rhs) { - return helpers::doSub( - static_cast(lhs), - static_cast(rhs)); - } - - // matrix*matrix - template - friend mat PURE operator * ( - const mat& lhs, - const mat& rhs) { - return helpers::doMul(lhs, rhs); - } - - // matrix*vector - friend vec PURE operator * ( - const mat& lhs, const vec& rhs) { - return helpers::doMul(lhs, rhs); - } - - // vector*matrix - friend mat PURE operator * ( - const vec& lhs, const mat& rhs) { - return helpers::doMul(lhs, rhs); - } - - // matrix*scalar - friend inline mat PURE operator * (const mat& lhs, pTYPE v) { - return helpers::doMul(lhs, v); - } - - // scalar*matrix - friend inline mat PURE operator * (pTYPE v, const mat& rhs) { - return helpers::doMul(v, rhs); - } - - // ----------------------------------------------------------------------- - // streaming operator to set the columns of the matrix: - // example: - // mat33_t m; - // m << v0 << v1 << v2; - - // column_builder<> stores the matrix and knows which column to set - template - struct column_builder { - mat& matrix; - column_builder(mat& matrix) : matrix(matrix) { } - }; - - // operator << is not a method of column_builder<> so we can - // overload it for unauthorized values (partial specialization - // not allowed in class-scope). - // we just set the column and return the next column_builder<> - template - friend column_builder operator << ( - const column_builder& lhs, - const vec& rhs) { - lhs.matrix[PREV_COLUMN+1] = rhs; - return column_builder(lhs.matrix); - } - - // we return void here so we get a compile-time error if the - // user tries to set too many columns - friend void operator << ( - const column_builder& lhs, - const vec& rhs) { - lhs.matrix[C-1] = rhs; - } - - // this is where the process starts. we set the first columns and - // return the next column_builder<> - column_builder<0> operator << (const vec& rhs) { - (*this)[0] = rhs; - return column_builder<0>(*this); - } -}; - -// Specialize column matrix so they're exactly equivalent to a vector -template -class mat : public vec { - typedef vec base; -public: - // STL-like interface. - typedef TYPE value_type; - typedef TYPE& reference; - typedef TYPE const& const_reference; - typedef size_t size_type; - size_type size() const { return R; } - enum { ROWS = R, COLS = 1 }; - - mat() { } - mat(const base& rhs) : base(rhs) { } - mat(const mat& rhs) : base(rhs) { } - mat(const TYPE& rhs) { helpers::doAssign(*this, rhs); } - mat& operator=(const mat& rhs) { base::operator=(rhs); return *this; } - mat& operator=(const base& rhs) { base::operator=(rhs); return *this; } - mat& operator=(const TYPE& rhs) { return helpers::doAssign(*this, rhs); } - // we only have one column, so ignore the index - const base& operator[](size_t) const { return *this; } - base& operator[](size_t) { return *this; } - void operator << (const vec& rhs) { base::operator[](0) = rhs; } -}; - -// ----------------------------------------------------------------------- -// matrix functions - -// transpose. this handles matrices of matrices -inline int PURE transpose(int v) { return v; } -inline float PURE transpose(float v) { return v; } -inline double PURE transpose(double v) { return v; } - -// Transpose a matrix -template -mat PURE transpose(const mat& m) { - mat r; - for (size_t i=0 ; i static TYPE trace(const mat& m) { - TYPE t; - for (size_t i=0 ; i -static bool isPositiveSemidefinite(const mat& m, TYPE tolerance) { - for (size_t i=0 ; i tolerance) - return false; - - return true; -} - -// Transpose a vector -template < - template class VEC, - typename TYPE, - size_t SIZE -> -mat PURE transpose(const VEC& v) { - mat r; - for (size_t i=0 ; i -mat PURE invert(const mat& src) { - T t; - size_t swap; - mat tmp(src); - mat inverse(1); - - for (size_t i=0 ; i fabs(tmp[i][i])) { - swap = j; - } - } - - if (swap != i) { - /* swap rows. */ - for (size_t k=0 ; k mat22_t; -typedef mat mat33_t; -typedef mat mat44_t; - -// ----------------------------------------------------------------------- - -}; // namespace android - -#endif /* ANDROID_MAT_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/OrientationSensor.cpp android-platform-frameworks-native-21/services/sensorservice/OrientationSensor.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/OrientationSensor.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/OrientationSensor.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,93 +0,0 @@ -/* - * 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 -#include -#include - -#include - -#include - -#include "OrientationSensor.h" -#include "SensorDevice.h" -#include "SensorFusion.h" - -namespace android { -// --------------------------------------------------------------------------- - -OrientationSensor::OrientationSensor() - : mSensorDevice(SensorDevice::getInstance()), - mSensorFusion(SensorFusion::getInstance()) -{ - // FIXME: instead of using the SensorFusion code, we should use - // the SENSOR_TYPE_ROTATION_VECTOR instead. This way we could use the - // HAL's implementation. -} - -bool OrientationSensor::process(sensors_event_t* outEvent, - const sensors_event_t& event) -{ - if (event.type == SENSOR_TYPE_ACCELEROMETER) { - if (mSensorFusion.hasEstimate()) { - vec3_t g; - const float rad2deg = 180 / M_PI; - const mat33_t R(mSensorFusion.getRotationMatrix()); - g[0] = atan2f(-R[1][0], R[0][0]) * rad2deg; - g[1] = atan2f(-R[2][1], R[2][2]) * rad2deg; - g[2] = asinf ( R[2][0]) * rad2deg; - if (g[0] < 0) - g[0] += 360; - - *outEvent = event; - outEvent->orientation.azimuth = g.x; - outEvent->orientation.pitch = g.y; - outEvent->orientation.roll = g.z; - outEvent->orientation.status = SENSOR_STATUS_ACCURACY_HIGH; - outEvent->sensor = '_ypr'; - outEvent->type = SENSOR_TYPE_ORIENTATION; - return true; - } - } - return false; -} - -status_t OrientationSensor::activate(void* ident, bool enabled) { - return mSensorFusion.activate(ident, enabled); -} - -status_t OrientationSensor::setDelay(void* ident, int /*handle*/, int64_t ns) { - return mSensorFusion.setDelay(ident, ns); -} - -Sensor OrientationSensor::getSensor() const { - sensor_t hwSensor; - hwSensor.name = "Orientation Sensor"; - hwSensor.vendor = "AOSP"; - hwSensor.version = 1; - hwSensor.handle = '_ypr'; - hwSensor.type = SENSOR_TYPE_ORIENTATION; - hwSensor.maxRange = 360.0f; - hwSensor.resolution = 1.0f/256.0f; // FIXME: real value here - hwSensor.power = mSensorFusion.getPowerUsage(); - hwSensor.minDelay = mSensorFusion.getMinDelay(); - Sensor sensor(&hwSensor); - return sensor; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/OrientationSensor.h android-platform-frameworks-native-21/services/sensorservice/OrientationSensor.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/OrientationSensor.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/OrientationSensor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,51 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_ORIENTATION_SENSOR_H -#define ANDROID_ORIENTATION_SENSOR_H - -#include -#include - -#include - -#include "SensorInterface.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class SensorDevice; -class SensorFusion; - -class OrientationSensor : public SensorInterface { - SensorDevice& mSensorDevice; - SensorFusion& mSensorFusion; - -public: - OrientationSensor(); - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); - virtual status_t activate(void* ident, bool enabled); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return true; } -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_ORIENTATION_SENSOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/quat.h android-platform-frameworks-native-21/services/sensorservice/quat.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/quat.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/quat.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,98 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_QUAT_H -#define ANDROID_QUAT_H - -#include - -#include "vec.h" -#include "mat.h" - -// ----------------------------------------------------------------------- -namespace android { -// ----------------------------------------------------------------------- - -template -mat quatToMatrix(const vec& q) { - mat R; - TYPE q0(q.w); - TYPE q1(q.x); - TYPE q2(q.y); - TYPE q3(q.z); - TYPE sq_q1 = 2 * q1 * q1; - TYPE sq_q2 = 2 * q2 * q2; - TYPE sq_q3 = 2 * q3 * q3; - TYPE q1_q2 = 2 * q1 * q2; - TYPE q3_q0 = 2 * q3 * q0; - TYPE q1_q3 = 2 * q1 * q3; - TYPE q2_q0 = 2 * q2 * q0; - TYPE q2_q3 = 2 * q2 * q3; - TYPE q1_q0 = 2 * q1 * q0; - R[0][0] = 1 - sq_q2 - sq_q3; - R[0][1] = q1_q2 - q3_q0; - R[0][2] = q1_q3 + q2_q0; - R[1][0] = q1_q2 + q3_q0; - R[1][1] = 1 - sq_q1 - sq_q3; - R[1][2] = q2_q3 - q1_q0; - R[2][0] = q1_q3 - q2_q0; - R[2][1] = q2_q3 + q1_q0; - R[2][2] = 1 - sq_q1 - sq_q2; - return R; -} - -template -vec matrixToQuat(const mat& R) { - // matrix to quaternion - - struct { - inline TYPE operator()(TYPE v) { - return v < 0 ? 0 : v; - } - } clamp; - - vec q; - const float Hx = R[0].x; - const float My = R[1].y; - const float Az = R[2].z; - q.x = sqrtf( clamp( Hx - My - Az + 1) * 0.25f ); - q.y = sqrtf( clamp(-Hx + My - Az + 1) * 0.25f ); - q.z = sqrtf( clamp(-Hx - My + Az + 1) * 0.25f ); - q.w = sqrtf( clamp( Hx + My + Az + 1) * 0.25f ); - q.x = copysignf(q.x, R[2].y - R[1].z); - q.y = copysignf(q.y, R[0].z - R[2].x); - q.z = copysignf(q.z, R[1].x - R[0].y); - // guaranteed to be unit-quaternion - return q; -} - -template -vec normalize_quat(const vec& q) { - vec r(q); - if (r.w < 0) { - r = -r; - } - return normalize(r); -} - -// ----------------------------------------------------------------------- - -typedef vec4_t quat_t; - -// ----------------------------------------------------------------------- -}; // namespace android - -#endif /* ANDROID_QUAT_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/RotationVectorSensor.cpp android-platform-frameworks-native-21/services/sensorservice/RotationVectorSensor.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/RotationVectorSensor.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/RotationVectorSensor.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,129 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include - -#include - -#include - -#include "RotationVectorSensor.h" - -namespace android { -// --------------------------------------------------------------------------- - -RotationVectorSensor::RotationVectorSensor() - : mSensorDevice(SensorDevice::getInstance()), - mSensorFusion(SensorFusion::getInstance()) -{ -} - -bool RotationVectorSensor::process(sensors_event_t* outEvent, - const sensors_event_t& event) -{ - if (event.type == SENSOR_TYPE_ACCELEROMETER) { - if (mSensorFusion.hasEstimate()) { - const vec4_t q(mSensorFusion.getAttitude()); - *outEvent = event; - outEvent->data[0] = q.x; - outEvent->data[1] = q.y; - outEvent->data[2] = q.z; - outEvent->data[3] = q.w; - outEvent->sensor = '_rov'; - outEvent->type = SENSOR_TYPE_ROTATION_VECTOR; - return true; - } - } - return false; -} - -status_t RotationVectorSensor::activate(void* ident, bool enabled) { - return mSensorFusion.activate(ident, enabled); -} - -status_t RotationVectorSensor::setDelay(void* ident, int /*handle*/, int64_t ns) { - return mSensorFusion.setDelay(ident, ns); -} - -Sensor RotationVectorSensor::getSensor() const { - sensor_t hwSensor; - hwSensor.name = "Rotation Vector Sensor"; - hwSensor.vendor = "AOSP"; - hwSensor.version = 3; - hwSensor.handle = '_rov'; - hwSensor.type = SENSOR_TYPE_ROTATION_VECTOR; - hwSensor.maxRange = 1; - hwSensor.resolution = 1.0f / (1<<24); - hwSensor.power = mSensorFusion.getPowerUsage(); - hwSensor.minDelay = mSensorFusion.getMinDelay(); - Sensor sensor(&hwSensor); - return sensor; -} - -// --------------------------------------------------------------------------- - -GyroDriftSensor::GyroDriftSensor() - : mSensorDevice(SensorDevice::getInstance()), - mSensorFusion(SensorFusion::getInstance()) -{ -} - -bool GyroDriftSensor::process(sensors_event_t* outEvent, - const sensors_event_t& event) -{ - if (event.type == SENSOR_TYPE_ACCELEROMETER) { - if (mSensorFusion.hasEstimate()) { - const vec3_t b(mSensorFusion.getGyroBias()); - *outEvent = event; - outEvent->data[0] = b.x; - outEvent->data[1] = b.y; - outEvent->data[2] = b.z; - outEvent->sensor = '_gbs'; - outEvent->type = SENSOR_TYPE_ACCELEROMETER; - return true; - } - } - return false; -} - -status_t GyroDriftSensor::activate(void* ident, bool enabled) { - return mSensorFusion.activate(ident, enabled); -} - -status_t GyroDriftSensor::setDelay(void* ident, int /*handle*/, int64_t ns) { - return mSensorFusion.setDelay(ident, ns); -} - -Sensor GyroDriftSensor::getSensor() const { - sensor_t hwSensor; - hwSensor.name = "Gyroscope Bias (debug)"; - hwSensor.vendor = "AOSP"; - hwSensor.version = 1; - hwSensor.handle = '_gbs'; - hwSensor.type = SENSOR_TYPE_ACCELEROMETER; - hwSensor.maxRange = 1; - hwSensor.resolution = 1.0f / (1<<24); - hwSensor.power = mSensorFusion.getPowerUsage(); - hwSensor.minDelay = mSensorFusion.getMinDelay(); - Sensor sensor(&hwSensor); - return sensor; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/RotationVectorSensor.h android-platform-frameworks-native-21/services/sensorservice/RotationVectorSensor.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/RotationVectorSensor.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/RotationVectorSensor.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,66 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_ROTATION_VECTOR_SENSOR_H -#define ANDROID_ROTATION_VECTOR_SENSOR_H - -#include -#include - -#include - -#include "SensorDevice.h" -#include "SensorInterface.h" - -#include "Fusion.h" -#include "SensorFusion.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class RotationVectorSensor : public SensorInterface { - SensorDevice& mSensorDevice; - SensorFusion& mSensorFusion; - -public: - RotationVectorSensor(); - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); - virtual status_t activate(void* ident, bool enabled); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return true; } -}; - -class GyroDriftSensor : public SensorInterface { - SensorDevice& mSensorDevice; - SensorFusion& mSensorFusion; - -public: - GyroDriftSensor(); - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); - virtual status_t activate(void* ident, bool enabled); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return true; } -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_ROTATION_VECTOR_SENSOR_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorDevice.cpp android-platform-frameworks-native-21/services/sensorservice/SensorDevice.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorDevice.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorDevice.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,466 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include -#include - -#include -#include -#include - -#include -#include -#include - -#include - -#include "SensorDevice.h" -#include "SensorService.h" - -namespace android { -// --------------------------------------------------------------------------- - -ANDROID_SINGLETON_STATIC_INSTANCE(SensorDevice) - -SensorDevice::SensorDevice() - : mSensorDevice(0), - mSensorModule(0) -{ - status_t err = hw_get_module(SENSORS_HARDWARE_MODULE_ID, - (hw_module_t const**)&mSensorModule); - - ALOGE_IF(err, "couldn't load %s module (%s)", - SENSORS_HARDWARE_MODULE_ID, strerror(-err)); - - if (mSensorModule) { - err = sensors_open_1(&mSensorModule->common, &mSensorDevice); - - ALOGE_IF(err, "couldn't open device for module %s (%s)", - SENSORS_HARDWARE_MODULE_ID, strerror(-err)); - - if (mSensorDevice) { - if (mSensorDevice->common.version == SENSORS_DEVICE_API_VERSION_1_1 || - mSensorDevice->common.version == SENSORS_DEVICE_API_VERSION_1_2) { - ALOGE(">>>> WARNING <<< Upgrade sensor HAL to version 1_3"); - } - - sensor_t const* list; - ssize_t count = mSensorModule->get_sensors_list(mSensorModule, &list); - mActivationCount.setCapacity(count); - Info model; - for (size_t i=0 ; iactivate( - reinterpret_cast(mSensorDevice), - list[i].handle, 0); - } - } - } -} - -void SensorDevice::dump(String8& result) -{ - if (!mSensorModule) return; - sensor_t const* list; - ssize_t count = mSensorModule->get_sensors_list(mSensorModule, &list); - - result.appendFormat("halVersion 0x%08x\n", getHalDeviceVersion()); - result.appendFormat("%d h/w sensors:\n", int(count)); - - Mutex::Autolock _l(mLock); - for (size_t i=0 ; iget_sensors_list(mSensorModule, list); - return count; -} - -status_t SensorDevice::initCheck() const { - return mSensorDevice && mSensorModule ? NO_ERROR : NO_INIT; -} - -ssize_t SensorDevice::poll(sensors_event_t* buffer, size_t count) { - if (!mSensorDevice) return NO_INIT; - ssize_t c; - do { - c = mSensorDevice->poll(reinterpret_cast (mSensorDevice), - buffer, count); - } while (c == -EINTR); - return c; -} - -void SensorDevice::autoDisable(void *ident, int handle) { - Info& info( mActivationCount.editValueFor(handle) ); - Mutex::Autolock _l(mLock); - info.removeBatchParamsForIdent(ident); -} - -status_t SensorDevice::activate(void* ident, int handle, int enabled) -{ - if (!mSensorDevice) return NO_INIT; - status_t err(NO_ERROR); - bool actuateHardware = false; - - Mutex::Autolock _l(mLock); - Info& info( mActivationCount.editValueFor(handle) ); - - ALOGD_IF(DEBUG_CONNECTIONS, - "SensorDevice::activate: ident=%p, handle=0x%08x, enabled=%d, count=%zu", - ident, handle, enabled, info.batchParams.size()); - - if (enabled) { - ALOGD_IF(DEBUG_CONNECTIONS, "enable index=%zd", info.batchParams.indexOfKey(ident)); - - if (isClientDisabledLocked(ident)) { - return INVALID_OPERATION; - } - - if (info.batchParams.indexOfKey(ident) >= 0) { - if (info.numActiveClients() == 1) { - // This is the first connection, we need to activate the underlying h/w sensor. - actuateHardware = true; - } - } else { - // Log error. Every activate call should be preceded by a batch() call. - ALOGE("\t >>>ERROR: activate called without batch"); - } - } else { - ALOGD_IF(DEBUG_CONNECTIONS, "disable index=%zd", info.batchParams.indexOfKey(ident)); - - if (info.removeBatchParamsForIdent(ident) >= 0) { - if (info.numActiveClients() == 0) { - // This is the last connection, we need to de-activate the underlying h/w sensor. - actuateHardware = true; - } else { - const int halVersion = getHalDeviceVersion(); - if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) { - // Call batch for this sensor with the previously calculated best effort - // batch_rate and timeout. One of the apps has unregistered for sensor - // events, and the best effort batch parameters might have changed. - ALOGD_IF(DEBUG_CONNECTIONS, - "\t>>> actuating h/w batch %d %d %" PRId64 " %" PRId64, handle, - info.bestBatchParams.flags, info.bestBatchParams.batchDelay, - info.bestBatchParams.batchTimeout); - mSensorDevice->batch(mSensorDevice, handle,info.bestBatchParams.flags, - info.bestBatchParams.batchDelay, - info.bestBatchParams.batchTimeout); - } - } - } else { - // sensor wasn't enabled for this ident - } - - if (isClientDisabledLocked(ident)) { - return NO_ERROR; - } - } - - if (actuateHardware) { - ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w activate handle=%d enabled=%d", handle, - enabled); - err = mSensorDevice->activate( - reinterpret_cast (mSensorDevice), handle, enabled); - ALOGE_IF(err, "Error %s sensor %d (%s)", enabled ? "activating" : "disabling", handle, - strerror(-err)); - - if (err != NO_ERROR && enabled) { - // Failure when enabling the sensor. Clean up on failure. - info.removeBatchParamsForIdent(ident); - } - } - - // On older devices which do not support batch, call setDelay(). - if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_1 && info.numActiveClients() > 0) { - ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w setDelay %d %" PRId64, handle, - info.bestBatchParams.batchDelay); - mSensorDevice->setDelay( - reinterpret_cast(mSensorDevice), - handle, info.bestBatchParams.batchDelay); - } - return err; -} - -status_t SensorDevice::batch(void* ident, int handle, int flags, int64_t samplingPeriodNs, - int64_t maxBatchReportLatencyNs) { - if (!mSensorDevice) return NO_INIT; - - if (samplingPeriodNs < MINIMUM_EVENTS_PERIOD) { - samplingPeriodNs = MINIMUM_EVENTS_PERIOD; - } - - const int halVersion = getHalDeviceVersion(); - if (halVersion < SENSORS_DEVICE_API_VERSION_1_1 && maxBatchReportLatencyNs != 0) { - // Batch is not supported on older devices return invalid operation. - return INVALID_OPERATION; - } - - ALOGD_IF(DEBUG_CONNECTIONS, - "SensorDevice::batch: ident=%p, handle=0x%08x, flags=%d, period_ns=%" PRId64 " timeout=%" PRId64, - ident, handle, flags, samplingPeriodNs, maxBatchReportLatencyNs); - - Mutex::Autolock _l(mLock); - Info& info(mActivationCount.editValueFor(handle)); - - if (info.batchParams.indexOfKey(ident) < 0) { - BatchParams params(flags, samplingPeriodNs, maxBatchReportLatencyNs); - info.batchParams.add(ident, params); - } else { - // A batch has already been called with this ident. Update the batch parameters. - info.setBatchParamsForIdent(ident, flags, samplingPeriodNs, maxBatchReportLatencyNs); - } - - BatchParams prevBestBatchParams = info.bestBatchParams; - // Find the minimum of all timeouts and batch_rates for this sensor. - info.selectBatchParams(); - - ALOGD_IF(DEBUG_CONNECTIONS, - "\t>>> curr_period=%" PRId64 " min_period=%" PRId64 - " curr_timeout=%" PRId64 " min_timeout=%" PRId64, - prevBestBatchParams.batchDelay, info.bestBatchParams.batchDelay, - prevBestBatchParams.batchTimeout, info.bestBatchParams.batchTimeout); - - status_t err(NO_ERROR); - // If the min period or min timeout has changed since the last batch call, call batch. - if (prevBestBatchParams != info.bestBatchParams) { - if (halVersion >= SENSORS_DEVICE_API_VERSION_1_1) { - ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w BATCH %d %d %" PRId64 " %" PRId64, handle, - info.bestBatchParams.flags, info.bestBatchParams.batchDelay, - info.bestBatchParams.batchTimeout); - err = mSensorDevice->batch(mSensorDevice, handle, info.bestBatchParams.flags, - info.bestBatchParams.batchDelay, - info.bestBatchParams.batchTimeout); - } else { - // For older devices which do not support batch, call setDelay() after activate() is - // called. Some older devices may not support calling setDelay before activate(), so - // call setDelay in SensorDevice::activate() method. - } - if (err != NO_ERROR) { - ALOGE("sensor batch failed %p %d %d %" PRId64 " %" PRId64 " err=%s", - mSensorDevice, handle, - info.bestBatchParams.flags, info.bestBatchParams.batchDelay, - info.bestBatchParams.batchTimeout, strerror(-err)); - info.removeBatchParamsForIdent(ident); - } - } - return err; -} - -status_t SensorDevice::setDelay(void* ident, int handle, int64_t samplingPeriodNs) -{ - if (!mSensorDevice) return NO_INIT; - if (samplingPeriodNs < MINIMUM_EVENTS_PERIOD) { - samplingPeriodNs = MINIMUM_EVENTS_PERIOD; - } - Mutex::Autolock _l(mLock); - if (isClientDisabledLocked(ident)) return INVALID_OPERATION; - Info& info( mActivationCount.editValueFor(handle) ); - // If the underlying sensor is NOT in continuous mode, setDelay() should return an error. - // Calling setDelay() in batch mode is an invalid operation. - if (info.bestBatchParams.batchTimeout != 0) { - return INVALID_OPERATION; - } - ssize_t index = info.batchParams.indexOfKey(ident); - if (index < 0) { - return BAD_INDEX; - } - BatchParams& params = info.batchParams.editValueAt(index); - params.batchDelay = samplingPeriodNs; - info.selectBatchParams(); - return mSensorDevice->setDelay(reinterpret_cast(mSensorDevice), - handle, info.bestBatchParams.batchDelay); -} - -int SensorDevice::getHalDeviceVersion() const { - if (!mSensorDevice) return -1; - return mSensorDevice->common.version; -} - -status_t SensorDevice::flush(void* ident, int handle) { - if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_1) { - return INVALID_OPERATION; - } - if (isClientDisabled(ident)) return INVALID_OPERATION; - ALOGD_IF(DEBUG_CONNECTIONS, "\t>>> actuating h/w flush %d", handle); - return mSensorDevice->flush(mSensorDevice, handle); -} - -bool SensorDevice::isClientDisabled(void* ident) { - Mutex::Autolock _l(mLock); - return isClientDisabledLocked(ident); -} - -bool SensorDevice::isClientDisabledLocked(void* ident) { - return mDisabledClients.indexOf(ident) >= 0; -} - -void SensorDevice::enableAllSensors() { - Mutex::Autolock _l(mLock); - mDisabledClients.clear(); - const int halVersion = getHalDeviceVersion(); - for (size_t i = 0; i< mActivationCount.size(); ++i) { - Info& info = mActivationCount.editValueAt(i); - if (info.batchParams.isEmpty()) continue; - info.selectBatchParams(); - const int sensor_handle = mActivationCount.keyAt(i); - ALOGD_IF(DEBUG_CONNECTIONS, "\t>> reenable actuating h/w sensor enable handle=%d ", - sensor_handle); - status_t err(NO_ERROR); - if (halVersion > SENSORS_DEVICE_API_VERSION_1_0) { - err = mSensorDevice->batch(mSensorDevice, sensor_handle, - info.bestBatchParams.flags, info.bestBatchParams.batchDelay, - info.bestBatchParams.batchTimeout); - ALOGE_IF(err, "Error calling batch on sensor %d (%s)", sensor_handle, strerror(-err)); - } - - if (err == NO_ERROR) { - err = mSensorDevice->activate( - reinterpret_cast(mSensorDevice), - sensor_handle, 1); - ALOGE_IF(err, "Error activating sensor %d (%s)", sensor_handle, strerror(-err)); - } - - if (halVersion <= SENSORS_DEVICE_API_VERSION_1_0) { - err = mSensorDevice->setDelay( - reinterpret_cast(mSensorDevice), - sensor_handle, info.bestBatchParams.batchDelay); - ALOGE_IF(err, "Error calling setDelay sensor %d (%s)", sensor_handle, strerror(-err)); - } - } -} - -void SensorDevice::disableAllSensors() { - Mutex::Autolock _l(mLock); - for (size_t i = 0; i< mActivationCount.size(); ++i) { - const Info& info = mActivationCount.valueAt(i); - // Check if this sensor has been activated previously and disable it. - if (info.batchParams.size() > 0) { - const int sensor_handle = mActivationCount.keyAt(i); - ALOGD_IF(DEBUG_CONNECTIONS, "\t>> actuating h/w sensor disable handle=%d ", - sensor_handle); - mSensorDevice->activate( - reinterpret_cast (mSensorDevice), - sensor_handle, 0); - // Add all the connections that were registered for this sensor to the disabled - // clients list. - for (size_t j = 0; j < info.batchParams.size(); ++j) { - mDisabledClients.add(info.batchParams.keyAt(j)); - } - } - } -} - -status_t SensorDevice::injectSensorData(const sensors_event_t *injected_sensor_event) { - ALOGD_IF(DEBUG_CONNECTIONS, - "sensor_event handle=%d ts=%lld data=%.2f, %.2f, %.2f %.2f %.2f %.2f", - injected_sensor_event->sensor, - injected_sensor_event->timestamp, injected_sensor_event->data[0], - injected_sensor_event->data[1], injected_sensor_event->data[2], - injected_sensor_event->data[3], injected_sensor_event->data[4], - injected_sensor_event->data[5]); - if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_4) { - return INVALID_OPERATION; - } - return mSensorDevice->inject_sensor_data(mSensorDevice, injected_sensor_event); -} - -status_t SensorDevice::setMode(uint32_t mode) { - if (getHalDeviceVersion() < SENSORS_DEVICE_API_VERSION_1_4) { - return INVALID_OPERATION; - } - return mSensorModule->set_operation_mode(mode); -} - -// --------------------------------------------------------------------------- - -int SensorDevice::Info::numActiveClients() { - SensorDevice& device(SensorDevice::getInstance()); - int num = 0; - for (size_t i = 0; i < batchParams.size(); ++i) { - if (!device.isClientDisabledLocked(batchParams.keyAt(i))) { - ++num; - } - } - return num; -} - -status_t SensorDevice::Info::setBatchParamsForIdent(void* ident, int flags, - int64_t samplingPeriodNs, - int64_t maxBatchReportLatencyNs) { - ssize_t index = batchParams.indexOfKey(ident); - if (index < 0) { - ALOGE("Info::setBatchParamsForIdent(ident=%p, period_ns=%" PRId64 " timeout=%" PRId64 ") failed (%s)", - ident, samplingPeriodNs, maxBatchReportLatencyNs, strerror(-index)); - return BAD_INDEX; - } - BatchParams& params = batchParams.editValueAt(index); - params.flags = flags; - params.batchDelay = samplingPeriodNs; - params.batchTimeout = maxBatchReportLatencyNs; - return NO_ERROR; -} - -void SensorDevice::Info::selectBatchParams() { - BatchParams bestParams(0, -1, -1); - SensorDevice& device(SensorDevice::getInstance()); - - for (size_t i = 0; i < batchParams.size(); ++i) { - if (device.isClientDisabledLocked(batchParams.keyAt(i))) continue; - BatchParams params = batchParams.valueAt(i); - if (bestParams.batchDelay == -1 || params.batchDelay < bestParams.batchDelay) { - bestParams.batchDelay = params.batchDelay; - } - if (bestParams.batchTimeout == -1 || params.batchTimeout < bestParams.batchTimeout) { - bestParams.batchTimeout = params.batchTimeout; - } - } - bestBatchParams = bestParams; -} - -ssize_t SensorDevice::Info::removeBatchParamsForIdent(void* ident) { - ssize_t idx = batchParams.removeItem(ident); - if (idx >= 0) { - selectBatchParams(); - } - return idx; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorDevice.h android-platform-frameworks-native-21/services/sensorservice/SensorDevice.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorDevice.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorDevice.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,112 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_SENSOR_DEVICE_H -#define ANDROID_SENSOR_DEVICE_H - -#include -#include - -#include -#include -#include - -#include - -// --------------------------------------------------------------------------- - -namespace android { -// --------------------------------------------------------------------------- - -class SensorDevice : public Singleton { - friend class Singleton; - sensors_poll_device_1_t* mSensorDevice; - struct sensors_module_t* mSensorModule; - static const nsecs_t MINIMUM_EVENTS_PERIOD = 1000000; // 1000 Hz - mutable Mutex mLock; // protect mActivationCount[].batchParams - // fixed-size array after construction - - // Struct to store all the parameters(samplingPeriod, maxBatchReportLatency and flags) from - // batch call. For continous mode clients, maxBatchReportLatency is set to zero. - struct BatchParams { - // TODO: Get rid of flags parameter everywhere. - int flags; - nsecs_t batchDelay, batchTimeout; - BatchParams() : flags(0), batchDelay(0), batchTimeout(0) {} - BatchParams(int flag, nsecs_t delay, nsecs_t timeout): flags(flag), batchDelay(delay), - batchTimeout(timeout) { } - bool operator != (const BatchParams& other) { - return other.batchDelay != batchDelay || other.batchTimeout != batchTimeout || - other.flags != flags; - } - }; - - // Store batch parameters in the KeyedVector and the optimal batch_rate and timeout in - // bestBatchParams. For every batch() call corresponding params are stored in batchParams - // vector. A continuous mode request is batch(... timeout=0 ..) followed by activate(). A batch - // mode request is batch(... timeout > 0 ...) followed by activate(). - // Info is a per-sensor data structure which contains the batch parameters for each client that - // has registered for this sensor. - struct Info { - BatchParams bestBatchParams; - // Key is the unique identifier(ident) for each client, value is the batch parameters - // requested by the client. - KeyedVector batchParams; - - Info() : bestBatchParams(0, -1, -1) {} - // Sets batch parameters for this ident. Returns error if this ident is not already present - // in the KeyedVector above. - status_t setBatchParamsForIdent(void* ident, int flags, int64_t samplingPeriodNs, - int64_t maxBatchReportLatencyNs); - // Finds the optimal parameters for batching and stores them in bestBatchParams variable. - void selectBatchParams(); - // Removes batchParams for an ident and re-computes bestBatchParams. Returns the index of - // the removed ident. If index >=0, ident is present and successfully removed. - ssize_t removeBatchParamsForIdent(void* ident); - - int numActiveClients(); - }; - DefaultKeyedVector mActivationCount; - - // Use this vector to determine which client is activated or deactivated. - SortedVector mDisabledClients; - SensorDevice(); - - bool isClientDisabled(void* ident); - bool isClientDisabledLocked(void* ident); -public: - ssize_t getSensorList(sensor_t const** list); - status_t initCheck() const; - int getHalDeviceVersion() const; - ssize_t poll(sensors_event_t* buffer, size_t count); - status_t activate(void* ident, int handle, int enabled); - status_t batch(void* ident, int handle, int flags, int64_t samplingPeriodNs, - int64_t maxBatchReportLatencyNs); - // Call batch with timeout zero instead of calling setDelay() for newer devices. - status_t setDelay(void* ident, int handle, int64_t ns); - status_t flush(void* ident, int handle); - status_t setMode(uint32_t mode); - void disableAllSensors(); - void enableAllSensors(); - void autoDisable(void *ident, int handle); - status_t injectSensorData(const sensors_event_t *event); - void dump(String8& result); -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SENSOR_DEVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorFusion.cpp android-platform-frameworks-native-21/services/sensorservice/SensorFusion.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorFusion.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorFusion.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,159 +0,0 @@ -/* - * 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 "SensorDevice.h" -#include "SensorFusion.h" -#include "SensorService.h" - -namespace android { -// --------------------------------------------------------------------------- - -ANDROID_SINGLETON_STATIC_INSTANCE(SensorFusion) - -SensorFusion::SensorFusion() - : mSensorDevice(SensorDevice::getInstance()), - mEnabled(false), mGyroTime(0) -{ - sensor_t const* list; - Sensor uncalibratedGyro; - ssize_t count = mSensorDevice.getSensorList(&list); - if (count > 0) { - for (size_t i=0 ; i= 100 && freq<1000) { // filter values obviously wrong - const float alpha = 1 / (1 + dT); // 1s time-constant - mEstimatedGyroRate = freq + (mEstimatedGyroRate - freq)*alpha; - } - } - mGyroTime = event.timestamp; - } else if (event.type == SENSOR_TYPE_MAGNETIC_FIELD) { - const vec3_t mag(event.data); - mFusion.handleMag(mag); - } else if (event.type == SENSOR_TYPE_ACCELEROMETER) { - const vec3_t acc(event.data); - mFusion.handleAcc(acc); - mAttitude = mFusion.getAttitude(); - } -} - -template inline T min(T a, T b) { return a inline T max(T a, T b) { return a>b ? a : b; } - -status_t SensorFusion::activate(void* ident, bool enabled) { - - ALOGD_IF(DEBUG_CONNECTIONS, - "SensorFusion::activate(ident=%p, enabled=%d)", - ident, enabled); - - const ssize_t idx = mClients.indexOf(ident); - if (enabled) { - if (idx < 0) { - mClients.add(ident); - } - } else { - if (idx >= 0) { - mClients.removeItemsAt(idx); - } - } - - mSensorDevice.activate(ident, mAcc.getHandle(), enabled); - mSensorDevice.activate(ident, mMag.getHandle(), enabled); - mSensorDevice.activate(ident, mGyro.getHandle(), enabled); - - const bool newState = mClients.size() != 0; - if (newState != mEnabled) { - mEnabled = newState; - if (newState) { - mFusion.init(); - mGyroTime = 0; - } - } - return NO_ERROR; -} - -status_t SensorFusion::setDelay(void* ident, int64_t ns) { - // Call batch with timeout zero instead of setDelay(). - mSensorDevice.batch(ident, mAcc.getHandle(), 0, ns, 0); - mSensorDevice.batch(ident, mMag.getHandle(), 0, ms2ns(20), 0); - mSensorDevice.batch(ident, mGyro.getHandle(), 0, mTargetDelayNs, 0); - return NO_ERROR; -} - - -float SensorFusion::getPowerUsage() const { - float power = mAcc.getPowerUsage() + - mMag.getPowerUsage() + - mGyro.getPowerUsage(); - return power; -} - -int32_t SensorFusion::getMinDelay() const { - return mAcc.getMinDelay(); -} - -void SensorFusion::dump(String8& result) { - const Fusion& fusion(mFusion); - result.appendFormat("9-axis fusion %s (%zd clients), gyro-rate=%7.2fHz, " - "q=< %g, %g, %g, %g > (%g), " - "b=< %g, %g, %g >\n", - mEnabled ? "enabled" : "disabled", - mClients.size(), - mEstimatedGyroRate, - fusion.getAttitude().x, - fusion.getAttitude().y, - fusion.getAttitude().z, - fusion.getAttitude().w, - length(fusion.getAttitude()), - fusion.getBias().x, - fusion.getBias().y, - fusion.getBias().z); -} - -// --------------------------------------------------------------------------- -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorFusion.h android-platform-frameworks-native-21/services/sensorservice/SensorFusion.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorFusion.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorFusion.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,78 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_SENSOR_FUSION_H -#define ANDROID_SENSOR_FUSION_H - -#include -#include - -#include -#include -#include - -#include - -#include "Fusion.h" - -// --------------------------------------------------------------------------- - -namespace android { -// --------------------------------------------------------------------------- - -class SensorDevice; - -class SensorFusion : public Singleton { - friend class Singleton; - - SensorDevice& mSensorDevice; - Sensor mAcc; - Sensor mMag; - Sensor mGyro; - Fusion mFusion; - bool mEnabled; - float mEstimatedGyroRate; - nsecs_t mTargetDelayNs; - nsecs_t mGyroTime; - vec4_t mAttitude; - SortedVector mClients; - - SensorFusion(); - -public: - void process(const sensors_event_t& event); - - bool isEnabled() const { return mEnabled; } - bool hasEstimate() const { return mFusion.hasEstimate(); } - mat33_t getRotationMatrix() const { return mFusion.getRotationMatrix(); } - vec4_t getAttitude() const { return mAttitude; } - vec3_t getGyroBias() const { return mFusion.getBias(); } - float getEstimatedRate() const { return mEstimatedGyroRate; } - - status_t activate(void* ident, bool enabled); - status_t setDelay(void* ident, int64_t ns); - - float getPowerUsage() const; - int32_t getMinDelay() const; - - void dump(String8& result); -}; - - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SENSOR_FUSION_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorInterface.cpp android-platform-frameworks-native-21/services/sensorservice/SensorInterface.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorInterface.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorInterface.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,74 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include - -#include "SensorInterface.h" - -namespace android { -// --------------------------------------------------------------------------- - -SensorInterface::~SensorInterface() -{ -} - -// --------------------------------------------------------------------------- - -HardwareSensor::HardwareSensor(const sensor_t& sensor) - : mSensorDevice(SensorDevice::getInstance()), - mSensor(&sensor, mSensorDevice.getHalDeviceVersion()) -{ -} - -HardwareSensor::~HardwareSensor() { -} - -bool HardwareSensor::process(sensors_event_t* outEvent, - const sensors_event_t& event) { - *outEvent = event; - return true; -} - -status_t HardwareSensor::activate(void* ident, bool enabled) { - return mSensorDevice.activate(ident, mSensor.getHandle(), enabled); -} - -status_t HardwareSensor::batch(void* ident, int /*handle*/, int flags, - int64_t samplingPeriodNs, int64_t maxBatchReportLatencyNs) { - return mSensorDevice.batch(ident, mSensor.getHandle(), flags, samplingPeriodNs, - maxBatchReportLatencyNs); -} - -status_t HardwareSensor::flush(void* ident, int handle) { - return mSensorDevice.flush(ident, handle); -} - -status_t HardwareSensor::setDelay(void* ident, int handle, int64_t ns) { - return mSensorDevice.setDelay(ident, handle, ns); -} - -void HardwareSensor::autoDisable(void *ident, int handle) { - mSensorDevice.autoDisable(ident, handle); -} - -Sensor HardwareSensor::getSensor() const { - return mSensor; -} - - -// --------------------------------------------------------------------------- -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorInterface.h android-platform-frameworks-native-21/services/sensorservice/SensorInterface.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorInterface.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorInterface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_SENSOR_INTERFACE_H -#define ANDROID_SENSOR_INTERFACE_H - -#include -#include - -#include - -#include "SensorDevice.h" - -// --------------------------------------------------------------------------- - -namespace android { -// --------------------------------------------------------------------------- - -class SensorInterface { -public: - virtual ~SensorInterface(); - - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event) = 0; - - virtual status_t activate(void* ident, bool enabled) = 0; - virtual status_t setDelay(void* ident, int handle, int64_t ns) = 0; - - // Not all sensors need to support batching. - virtual status_t batch(void* ident, int handle, int /*flags*/, int64_t samplingPeriodNs, - int64_t maxBatchReportLatencyNs) { - if (maxBatchReportLatencyNs == 0) { - return setDelay(ident, handle, samplingPeriodNs); - } - return -EINVAL; - } - - virtual status_t flush(void* /*ident*/, int /*handle*/) { - return -EINVAL; - } - - virtual Sensor getSensor() const = 0; - virtual bool isVirtual() const = 0; - virtual void autoDisable(void* /*ident*/, int /*handle*/) { } -}; - -// --------------------------------------------------------------------------- - -class HardwareSensor : public SensorInterface -{ - SensorDevice& mSensorDevice; - Sensor mSensor; - -public: - HardwareSensor(const sensor_t& sensor); - - virtual ~HardwareSensor(); - - virtual bool process(sensors_event_t* outEvent, - const sensors_event_t& event); - - virtual status_t activate(void* ident, bool enabled); - virtual status_t batch(void* ident, int handle, int flags, int64_t samplingPeriodNs, - int64_t maxBatchReportLatencyNs); - virtual status_t setDelay(void* ident, int handle, int64_t ns); - virtual status_t flush(void* ident, int handle); - virtual Sensor getSensor() const; - virtual bool isVirtual() const { return false; } - virtual void autoDisable(void *ident, int handle); -}; - - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SENSOR_INTERFACE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorService.cpp android-platform-frameworks-native-21/services/sensorservice/SensorService.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorService.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorService.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,1966 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include -#include -#include - -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include -#include -#include -#include - -#include -#include -#include - -#include -#include - -#include "BatteryService.h" -#include "CorrectedGyroSensor.h" -#include "GravitySensor.h" -#include "LinearAccelerationSensor.h" -#include "OrientationSensor.h" -#include "RotationVectorSensor.h" -#include "SensorFusion.h" -#include "SensorService.h" - -namespace android { -// --------------------------------------------------------------------------- - -/* - * Notes: - * - * - what about a gyro-corrected magnetic-field sensor? - * - run mag sensor from time to time to force calibration - * - gravity sensor length is wrong (=> drift in linear-acc sensor) - * - */ - -const char* SensorService::WAKE_LOCK_NAME = "SensorService_wakelock"; -// Permissions. -static const String16 sDump("android.permission.DUMP"); - -SensorService::SensorService() - : mInitCheck(NO_INIT), mSocketBufferSize(SOCKET_BUFFER_SIZE_NON_BATCHED), - mWakeLockAcquired(false) -{ -} - -void SensorService::onFirstRef() -{ - ALOGD("nuSensorService starting..."); - SensorDevice& dev(SensorDevice::getInstance()); - - if (dev.initCheck() == NO_ERROR) { - sensor_t const* list; - ssize_t count = dev.getSensorList(&list); - if (count > 0) { - ssize_t orientationIndex = -1; - bool hasGyro = false, hasAccel = false, hasMag = false; - uint32_t virtualSensorsNeeds = - (1< 0) { - batchingSupported = true; - break; - } - } - - if (batchingSupported) { - // Increase socket buffer size to a max of 100 KB for batching capabilities. - mSocketBufferSize = MAX_SOCKET_BUFFER_SIZE_BATCHED; - } else { - mSocketBufferSize = SOCKET_BUFFER_SIZE_NON_BATCHED; - } - - // Compare the socketBufferSize value against the system limits and limit - // it to maxSystemSocketBufferSize if necessary. - FILE *fp = fopen("/proc/sys/net/core/wmem_max", "r"); - char line[128]; - if (fp != NULL && fgets(line, sizeof(line), fp) != NULL) { - line[sizeof(line) - 1] = '\0'; - size_t maxSystemSocketBufferSize; - sscanf(line, "%zu", &maxSystemSocketBufferSize); - if (mSocketBufferSize > maxSystemSocketBufferSize) { - mSocketBufferSize = maxSystemSocketBufferSize; - } - } - if (fp) { - fclose(fp); - } - - mWakeLockAcquired = false; - mLooper = new Looper(false); - const size_t minBufferSize = SensorEventQueue::MAX_RECEIVE_BUFFER_EVENT_COUNT; - mSensorEventBuffer = new sensors_event_t[minBufferSize]; - mSensorEventScratch = new sensors_event_t[minBufferSize]; - mMapFlushEventsToConnections = new SensorEventConnection const * [minBufferSize]; - mCurrentOperatingMode = NORMAL; - - mNextSensorRegIndex = 0; - for (int i = 0; i < SENSOR_REGISTRATIONS_BUF_SIZE; ++i) { - mLastNSensorRegistrations.push(); - } - - mInitCheck = NO_ERROR; - mAckReceiver = new SensorEventAckReceiver(this); - mAckReceiver->run("SensorEventAckReceiver", PRIORITY_URGENT_DISPLAY); - run("SensorService", PRIORITY_URGENT_DISPLAY); - } - } -} - -Sensor SensorService::registerSensor(SensorInterface* s) -{ - sensors_event_t event; - memset(&event, 0, sizeof(event)); - - const Sensor sensor(s->getSensor()); - // add to the sensor list (returned to clients) - mSensorList.add(sensor); - // add to our handle->SensorInterface mapping - mSensorMap.add(sensor.getHandle(), s); - // create an entry in the mLastEventSeen array - mLastEventSeen.add(sensor.getHandle(), NULL); - - return sensor; -} - -Sensor SensorService::registerVirtualSensor(SensorInterface* s) -{ - Sensor sensor = registerSensor(s); - mVirtualSensorList.add( s ); - return sensor; -} - -SensorService::~SensorService() -{ - for (size_t i=0 ; i& args) -{ - String8 result; - if (!PermissionCache::checkCallingPermission(sDump)) { - result.appendFormat("Permission Denial: " - "can't dump SensorService from pid=%d, uid=%d\n", - IPCThreadState::self()->getCallingPid(), - IPCThreadState::self()->getCallingUid()); - } else { - if (args.size() > 2) { - return INVALID_OPERATION; - } - Mutex::Autolock _l(mLock); - SensorDevice& dev(SensorDevice::getInstance()); - if (args.size() == 2 && args[0] == String16("restrict")) { - // If already in restricted mode. Ignore. - if (mCurrentOperatingMode == RESTRICTED) { - return status_t(NO_ERROR); - } - // If in any mode other than normal, ignore. - if (mCurrentOperatingMode != NORMAL) { - return INVALID_OPERATION; - } - mCurrentOperatingMode = RESTRICTED; - dev.disableAllSensors(); - // Clear all pending flush connections for all active sensors. If one of the active - // connections has called flush() and the underlying sensor has been disabled before a - // flush complete event is returned, we need to remove the connection from this queue. - for (size_t i=0 ; i< mActiveSensors.size(); ++i) { - mActiveSensors.valueAt(i)->clearAllPendingFlushConnections(); - } - mWhiteListedPackage.setTo(String8(args[1])); - return status_t(NO_ERROR); - } else if (args.size() == 1 && args[0] == String16("enable")) { - // If currently in restricted mode, reset back to NORMAL mode else ignore. - if (mCurrentOperatingMode == RESTRICTED) { - mCurrentOperatingMode = NORMAL; - dev.enableAllSensors(); - } - if (mCurrentOperatingMode == DATA_INJECTION) { - resetToNormalModeLocked(); - } - mWhiteListedPackage.clear(); - return status_t(NO_ERROR); - } else if (args.size() == 2 && args[0] == String16("data_injection")) { - if (mCurrentOperatingMode == NORMAL) { - dev.disableAllSensors(); - status_t err = dev.setMode(DATA_INJECTION); - if (err == NO_ERROR) { - mCurrentOperatingMode = DATA_INJECTION; - } else { - // Re-enable sensors. - dev.enableAllSensors(); - } - mWhiteListedPackage.setTo(String8(args[1])); - return NO_ERROR; - } else if (mCurrentOperatingMode == DATA_INJECTION) { - // Already in DATA_INJECTION mode. Treat this as a no_op. - return NO_ERROR; - } else { - // Transition to data injection mode supported only from NORMAL mode. - return INVALID_OPERATION; - } - } else if (mSensorList.size() == 0) { - result.append("No Sensors on the device\n"); - } else { - // Default dump the sensor list and debugging information. - result.append("Sensor List:\n"); - for (size_t i=0 ; i 0) { - result.appendFormat("minRate=%.2fHz | ", 1e6f / s.getMaxDelay()); - } else { - result.appendFormat("maxDelay=%dus |", s.getMaxDelay()); - } - - if (s.getMinDelay() > 0) { - result.appendFormat("maxRate=%.2fHz | ", 1e6f / s.getMinDelay()); - } else { - result.appendFormat("minDelay=%dus |", s.getMinDelay()); - } - - if (s.getFifoMaxEventCount() > 0) { - result.appendFormat("FifoMax=%d events | ", - s.getFifoMaxEventCount()); - } else { - result.append("no batching | "); - } - - if (s.isWakeUpSensor()) { - result.appendFormat("wakeUp | "); - } else { - result.appendFormat("non-wakeUp | "); - } - - int bufIndex = mLastEventSeen.indexOfKey(s.getHandle()); - if (bufIndex >= 0) { - const CircularBuffer* buf = mLastEventSeen.valueAt(bufIndex); - if (buf != NULL && s.getRequiredPermission().isEmpty()) { - buf->printBuffer(result); - } else { - result.append("last=<> \n"); - } - } - result.append("\n"); - } - SensorFusion::getInstance().dump(result); - SensorDevice::getInstance().dump(result); - - result.append("Active sensors:\n"); - for (size_t i=0 ; igetNumConnections()); - } - - result.appendFormat("Socket Buffer size = %d events\n", - mSocketBufferSize/sizeof(sensors_event_t)); - result.appendFormat("WakeLock Status: %s \n", mWakeLockAcquired ? "acquired" : - "not held"); - result.appendFormat("Mode :"); - switch(mCurrentOperatingMode) { - case NORMAL: - result.appendFormat(" NORMAL\n"); - break; - case RESTRICTED: - result.appendFormat(" RESTRICTED : %s\n", mWhiteListedPackage.string()); - break; - case DATA_INJECTION: - result.appendFormat(" DATA_INJECTION : %s\n", mWhiteListedPackage.string()); - } - result.appendFormat("%zd active connections\n", mActiveConnections.size()); - - for (size_t i=0 ; i < mActiveConnections.size() ; i++) { - sp connection(mActiveConnections[i].promote()); - if (connection != 0) { - result.appendFormat("Connection Number: %zu \n", i); - connection->dump(result); - } - } - - result.appendFormat("Previous Registrations:\n"); - // Log in the reverse chronological order. - int currentIndex = (mNextSensorRegIndex - 1 + SENSOR_REGISTRATIONS_BUF_SIZE) % - SENSOR_REGISTRATIONS_BUF_SIZE; - const int startIndex = currentIndex; - do { - const SensorRegistrationInfo& reg_info = mLastNSensorRegistrations[currentIndex]; - if (SensorRegistrationInfo::isSentinel(reg_info)) { - // Ignore sentinel, proceed to next item. - currentIndex = (currentIndex - 1 + SENSOR_REGISTRATIONS_BUF_SIZE) % - SENSOR_REGISTRATIONS_BUF_SIZE; - continue; - } - if (reg_info.mActivated) { - result.appendFormat("%02d:%02d:%02d activated package=%s handle=0x%08x " - "samplingRate=%dus maxReportLatency=%dus\n", - reg_info.mHour, reg_info.mMin, reg_info.mSec, - reg_info.mPackageName.string(), reg_info.mSensorHandle, - reg_info.mSamplingRateUs, reg_info.mMaxReportLatencyUs); - } else { - result.appendFormat("%02d:%02d:%02d de-activated package=%s handle=0x%08x\n", - reg_info.mHour, reg_info.mMin, reg_info.mSec, - reg_info.mPackageName.string(), reg_info.mSensorHandle); - } - currentIndex = (currentIndex - 1 + SENSOR_REGISTRATIONS_BUF_SIZE) % - SENSOR_REGISTRATIONS_BUF_SIZE; - } while(startIndex != currentIndex); - } - } - write(fd, result.string(), result.size()); - return NO_ERROR; -} - -void SensorService::cleanupAutoDisabledSensorLocked(const sp& connection, - sensors_event_t const* buffer, const int count) { - for (int i=0 ; ihasSensor(handle)) { - SensorInterface* sensor = mSensorMap.valueFor(handle); - // If this buffer has an event from a one_shot sensor and this connection is registered - // for this particular one_shot sensor, try cleaning up the connection. - if (sensor != NULL && - sensor->getSensor().getReportingMode() == AREPORTING_MODE_ONE_SHOT) { - sensor->autoDisable(connection.get(), handle); - cleanupWithoutDisableLocked(connection, handle); - } - - } - } -} - -bool SensorService::threadLoop() -{ - ALOGD("nuSensorService thread starting..."); - - // each virtual sensor could generate an event per "real" event, that's why we need - // to size numEventMax much smaller than MAX_RECEIVE_BUFFER_EVENT_COUNT. - // in practice, this is too aggressive, but guaranteed to be enough. - const size_t minBufferSize = SensorEventQueue::MAX_RECEIVE_BUFFER_EVENT_COUNT; - const size_t numEventMax = minBufferSize / (1 + mVirtualSensorList.size()); - - SensorDevice& device(SensorDevice::getInstance()); - const size_t vcount = mVirtualSensorList.size(); - - const int halVersion = device.getHalDeviceVersion(); - do { - ssize_t count = device.poll(mSensorEventBuffer, numEventMax); - if (count < 0) { - ALOGE("sensor poll failed (%s)", strerror(-count)); - break; - } - - // Reset sensors_event_t.flags to zero for all events in the buffer. - for (int i = 0; i < count; i++) { - mSensorEventBuffer[i].flags = 0; - } - - // Make a copy of the connection vector as some connections may be removed during the - // course of this loop (especially when one-shot sensor events are present in the - // sensor_event buffer). Promote all connections to StrongPointers before the lock is - // acquired. If the destructor of the sp gets called when the lock is acquired, it may - // result in a deadlock as ~SensorEventConnection() needs to acquire mLock again for - // cleanup. So copy all the strongPointers to a vector before the lock is acquired. - SortedVector< sp > activeConnections; - populateActiveConnections(&activeConnections); - Mutex::Autolock _l(mLock); - // Poll has returned. Hold a wakelock if one of the events is from a wake up sensor. The - // rest of this loop is under a critical section protected by mLock. Acquiring a wakeLock, - // sending events to clients (incrementing SensorEventConnection::mWakeLockRefCount) should - // not be interleaved with decrementing SensorEventConnection::mWakeLockRefCount and - // releasing the wakelock. - bool bufferHasWakeUpEvent = false; - for (int i = 0; i < count; i++) { - if (isWakeUpSensorEvent(mSensorEventBuffer[i])) { - bufferHasWakeUpEvent = true; - break; - } - } - - if (bufferHasWakeUpEvent && !mWakeLockAcquired) { - setWakeLockAcquiredLocked(true); - } - recordLastValueLocked(mSensorEventBuffer, count); - - // handle virtual sensors - if (count && vcount) { - sensors_event_t const * const event = mSensorEventBuffer; - const size_t activeVirtualSensorCount = mActiveVirtualSensors.size(); - if (activeVirtualSensorCount) { - size_t k = 0; - SensorFusion& fusion(SensorFusion::getInstance()); - if (fusion.isEnabled()) { - for (size_t i=0 ; i= minBufferSize) { - ALOGE("buffer too small to hold all events: " - "count=%zd, k=%zu, size=%zu", - count, k, minBufferSize); - break; - } - sensors_event_t out; - SensorInterface* si = mActiveVirtualSensors.valueAt(j); - if (si->process(&out, event[i])) { - mSensorEventBuffer[count + k] = out; - k++; - } - } - } - if (k) { - // record the last synthesized values - recordLastValueLocked(&mSensorEventBuffer[count], k); - count += k; - // sort the buffer by time-stamps - sortEventBuffer(mSensorEventBuffer, count); - } - } - } - - // handle backward compatibility for RotationVector sensor - if (halVersion < SENSORS_DEVICE_API_VERSION_1_0) { - for (int i = 0; i < count; i++) { - if (mSensorEventBuffer[i].type == SENSOR_TYPE_ROTATION_VECTOR) { - // All the 4 components of the quaternion should be available - // No heading accuracy. Set it to -1 - mSensorEventBuffer[i].data[4] = -1; - } - } - } - - // Map flush_complete_events in the buffer to SensorEventConnections which called - // flush on the hardware sensor. mapFlushEventsToConnections[i] will be the - // SensorEventConnection mapped to the corresponding flush_complete_event in - // mSensorEventBuffer[i] if such a mapping exists (NULL otherwise). - for (int i = 0; i < count; ++i) { - mMapFlushEventsToConnections[i] = NULL; - if (mSensorEventBuffer[i].type == SENSOR_TYPE_META_DATA) { - const int sensor_handle = mSensorEventBuffer[i].meta_data.sensor; - SensorRecord* rec = mActiveSensors.valueFor(sensor_handle); - if (rec != NULL) { - mMapFlushEventsToConnections[i] = rec->getFirstPendingFlushConnection(); - rec->removeFirstPendingFlushConnection(); - } - } - } - - // Send our events to clients. Check the state of wake lock for each client and release the - // lock if none of the clients need it. - bool needsWakeLock = false; - size_t numConnections = activeConnections.size(); - for (size_t i=0 ; i < numConnections; ++i) { - if (activeConnections[i] != 0) { - activeConnections[i]->sendEvents(mSensorEventBuffer, count, mSensorEventScratch, - mMapFlushEventsToConnections); - needsWakeLock |= activeConnections[i]->needsWakeLock(); - // If the connection has one-shot sensors, it may be cleaned up after first trigger. - // Early check for one-shot sensors. - if (activeConnections[i]->hasOneShotSensors()) { - cleanupAutoDisabledSensorLocked(activeConnections[i], mSensorEventBuffer, - count); - } - } - } - - if (mWakeLockAcquired && !needsWakeLock) { - setWakeLockAcquiredLocked(false); - } - } while (!Thread::exitPending()); - - ALOGW("Exiting SensorService::threadLoop => aborting..."); - abort(); - return false; -} - -sp SensorService::getLooper() const { - return mLooper; -} - -void SensorService::resetAllWakeLockRefCounts() { - SortedVector< sp > activeConnections; - populateActiveConnections(&activeConnections); - { - Mutex::Autolock _l(mLock); - for (size_t i=0 ; i < activeConnections.size(); ++i) { - if (activeConnections[i] != 0) { - activeConnections[i]->resetWakeLockRefCount(); - } - } - setWakeLockAcquiredLocked(false); - } -} - -void SensorService::setWakeLockAcquiredLocked(bool acquire) { - if (acquire) { - if (!mWakeLockAcquired) { - acquire_wake_lock(PARTIAL_WAKE_LOCK, WAKE_LOCK_NAME); - mWakeLockAcquired = true; - } - mLooper->wake(); - } else { - if (mWakeLockAcquired) { - release_wake_lock(WAKE_LOCK_NAME); - mWakeLockAcquired = false; - } - } -} - -bool SensorService::isWakeLockAcquired() { - Mutex::Autolock _l(mLock); - return mWakeLockAcquired; -} - -bool SensorService::SensorEventAckReceiver::threadLoop() { - ALOGD("new thread SensorEventAckReceiver"); - sp looper = mService->getLooper(); - do { - bool wakeLockAcquired = mService->isWakeLockAcquired(); - int timeout = -1; - if (wakeLockAcquired) timeout = 5000; - int ret = looper->pollOnce(timeout); - if (ret == ALOOPER_POLL_TIMEOUT) { - mService->resetAllWakeLockRefCounts(); - } - } while(!Thread::exitPending()); - return false; -} - -void SensorService::recordLastValueLocked( - const sensors_event_t* buffer, size_t count) { - for (size_t i = 0; i < count; i++) { - if (buffer[i].type != SENSOR_TYPE_META_DATA) { - CircularBuffer* &circular_buf = mLastEventSeen.editValueFor(buffer[i].sensor); - if (circular_buf == NULL) { - circular_buf = new CircularBuffer(buffer[i].type); - } - circular_buf->addEvent(buffer[i]); - } - } -} - -void SensorService::sortEventBuffer(sensors_event_t* buffer, size_t count) -{ - struct compar { - static int cmp(void const* lhs, void const* rhs) { - sensors_event_t const* l = static_cast(lhs); - sensors_event_t const* r = static_cast(rhs); - return l->timestamp - r->timestamp; - } - }; - qsort(buffer, count, sizeof(sensors_event_t), compar::cmp); -} - -String8 SensorService::getSensorName(int handle) const { - size_t count = mUserSensorList.size(); - for (size_t i=0 ; iisVirtual(); -} - -bool SensorService::isWakeUpSensorEvent(const sensors_event_t& event) const { - int handle = event.sensor; - if (event.type == SENSOR_TYPE_META_DATA) { - handle = event.meta_data.sensor; - } - SensorInterface* sensor = mSensorMap.valueFor(handle); - return sensor != NULL && sensor->getSensor().isWakeUpSensor(); -} - -SensorService::SensorRecord * SensorService::getSensorRecord(int handle) { - return mActiveSensors.valueFor(handle); -} - -Vector SensorService::getSensorList(const String16& opPackageName) -{ - char value[PROPERTY_VALUE_MAX]; - property_get("debug.sensors", value, "0"); - const Vector& initialSensorList = (atoi(value)) ? - mUserSensorListDebug : mUserSensorList; - Vector accessibleSensorList; - for (size_t i = 0; i < initialSensorList.size(); i++) { - Sensor sensor = initialSensorList[i]; - if (canAccessSensor(sensor, "getSensorList", opPackageName)) { - accessibleSensorList.add(sensor); - } else { - ALOGI("Skipped sensor %s because it requires permission %s and app op %d", - sensor.getName().string(), - sensor.getRequiredPermission().string(), - sensor.getRequiredAppOp()); - } - } - return accessibleSensorList; -} - -sp SensorService::createSensorEventConnection(const String8& packageName, - int requestedMode, const String16& opPackageName) { - // Only 2 modes supported for a SensorEventConnection ... NORMAL and DATA_INJECTION. - if (requestedMode != NORMAL && requestedMode != DATA_INJECTION) { - return NULL; - } - - Mutex::Autolock _l(mLock); - // To create a client in DATA_INJECTION mode to inject data, SensorService should already be - // operating in DI mode. - if (requestedMode == DATA_INJECTION) { - if (mCurrentOperatingMode != DATA_INJECTION) return NULL; - if (!isWhiteListedPackage(packageName)) return NULL; - } - - uid_t uid = IPCThreadState::self()->getCallingUid(); - sp result(new SensorEventConnection(this, uid, packageName, - requestedMode == DATA_INJECTION, opPackageName)); - if (requestedMode == DATA_INJECTION) { - if (mActiveConnections.indexOf(result) < 0) { - mActiveConnections.add(result); - } - // Add the associated file descriptor to the Looper for polling whenever there is data to - // be injected. - result->updateLooperRegistration(mLooper); - } - return result; -} - -int SensorService::isDataInjectionEnabled() { - Mutex::Autolock _l(mLock); - return (mCurrentOperatingMode == DATA_INJECTION); -} - -status_t SensorService::resetToNormalMode() { - Mutex::Autolock _l(mLock); - return resetToNormalModeLocked(); -} - -status_t SensorService::resetToNormalModeLocked() { - SensorDevice& dev(SensorDevice::getInstance()); - dev.enableAllSensors(); - status_t err = dev.setMode(NORMAL); - mCurrentOperatingMode = NORMAL; - return err; -} - -void SensorService::cleanupConnection(SensorEventConnection* c) -{ - Mutex::Autolock _l(mLock); - const wp connection(c); - size_t size = mActiveSensors.size(); - ALOGD_IF(DEBUG_CONNECTIONS, "%zu active sensors", size); - for (size_t i=0 ; ihasSensor(handle)) { - ALOGD_IF(DEBUG_CONNECTIONS, "%zu: disabling handle=0x%08x", i, handle); - SensorInterface* sensor = mSensorMap.valueFor( handle ); - ALOGE_IF(!sensor, "mSensorMap[handle=0x%08x] is null!", handle); - if (sensor) { - sensor->activate(c, false); - } - c->removeSensor(handle); - } - SensorRecord* rec = mActiveSensors.valueAt(i); - ALOGE_IF(!rec, "mActiveSensors[%zu] is null (handle=0x%08x)!", i, handle); - ALOGD_IF(DEBUG_CONNECTIONS, - "removing connection %p for sensor[%zu].handle=0x%08x", - c, i, handle); - - if (rec && rec->removeConnection(connection)) { - ALOGD_IF(DEBUG_CONNECTIONS, "... and it was the last connection"); - mActiveSensors.removeItemsAt(i, 1); - mActiveVirtualSensors.removeItem(handle); - delete rec; - size--; - } else { - i++; - } - } - c->updateLooperRegistration(mLooper); - mActiveConnections.remove(connection); - BatteryService::cleanup(c->getUid()); - if (c->needsWakeLock()) { - checkWakeLockStateLocked(); - } -} - -Sensor SensorService::getSensorFromHandle(int handle) const { - return mSensorMap.valueFor(handle)->getSensor(); -} - -status_t SensorService::enable(const sp& connection, - int handle, nsecs_t samplingPeriodNs, nsecs_t maxBatchReportLatencyNs, int reservedFlags, - const String16& opPackageName) -{ - if (mInitCheck != NO_ERROR) - return mInitCheck; - - SensorInterface* sensor = mSensorMap.valueFor(handle); - if (sensor == NULL) { - return BAD_VALUE; - } - - if (!canAccessSensor(sensor->getSensor(), "Tried enabling", opPackageName)) { - return BAD_VALUE; - } - - Mutex::Autolock _l(mLock); - if ((mCurrentOperatingMode == RESTRICTED || mCurrentOperatingMode == DATA_INJECTION) - && !isWhiteListedPackage(connection->getPackageName())) { - return INVALID_OPERATION; - } - - SensorRecord* rec = mActiveSensors.valueFor(handle); - if (rec == 0) { - rec = new SensorRecord(connection); - mActiveSensors.add(handle, rec); - if (sensor->isVirtual()) { - mActiveVirtualSensors.add(handle, sensor); - } - } else { - if (rec->addConnection(connection)) { - // this sensor is already activated, but we are adding a connection that uses it. - // Immediately send down the last known value of the requested sensor if it's not a - // "continuous" sensor. - if (sensor->getSensor().getReportingMode() == AREPORTING_MODE_ON_CHANGE) { - // NOTE: The wake_up flag of this event may get set to - // WAKE_UP_SENSOR_EVENT_NEEDS_ACK if this is a wake_up event. - CircularBuffer *circular_buf = mLastEventSeen.valueFor(handle); - if (circular_buf) { - sensors_event_t event; - memset(&event, 0, sizeof(event)); - // It is unlikely that this buffer is empty as the sensor is already active. - // One possible corner case may be two applications activating an on-change - // sensor at the same time. - if(circular_buf->populateLastEvent(&event)) { - event.sensor = handle; - if (event.version == sizeof(sensors_event_t)) { - if (isWakeUpSensorEvent(event) && !mWakeLockAcquired) { - setWakeLockAcquiredLocked(true); - } - connection->sendEvents(&event, 1, NULL); - if (!connection->needsWakeLock() && mWakeLockAcquired) { - checkWakeLockStateLocked(); - } - } - } - } - } - } - } - - if (connection->addSensor(handle)) { - BatteryService::enableSensor(connection->getUid(), handle); - // the sensor was added (which means it wasn't already there) - // so, see if this connection becomes active - if (mActiveConnections.indexOf(connection) < 0) { - mActiveConnections.add(connection); - } - } else { - ALOGW("sensor %08x already enabled in connection %p (ignoring)", - handle, connection.get()); - } - - nsecs_t minDelayNs = sensor->getSensor().getMinDelayNs(); - if (samplingPeriodNs < minDelayNs) { - samplingPeriodNs = minDelayNs; - } - - ALOGD_IF(DEBUG_CONNECTIONS, "Calling batch handle==%d flags=%d" - "rate=%" PRId64 " timeout== %" PRId64"", - handle, reservedFlags, samplingPeriodNs, maxBatchReportLatencyNs); - - status_t err = sensor->batch(connection.get(), handle, 0, samplingPeriodNs, - maxBatchReportLatencyNs); - - // Call flush() before calling activate() on the sensor. Wait for a first - // flush complete event before sending events on this connection. Ignore - // one-shot sensors which don't support flush(). Ignore on-change sensors - // to maintain the on-change logic (any on-change events except the initial - // one should be trigger by a change in value). Also if this sensor isn't - // already active, don't call flush(). - if (err == NO_ERROR && - sensor->getSensor().getReportingMode() != AREPORTING_MODE_ONE_SHOT && - sensor->getSensor().getReportingMode() != AREPORTING_MODE_ON_CHANGE && - rec->getNumConnections() > 1) { - connection->setFirstFlushPending(handle, true); - status_t err_flush = sensor->flush(connection.get(), handle); - // Flush may return error if the underlying h/w sensor uses an older HAL. - if (err_flush == NO_ERROR) { - rec->addPendingFlushConnection(connection.get()); - } else { - connection->setFirstFlushPending(handle, false); - } - } - - if (err == NO_ERROR) { - ALOGD_IF(DEBUG_CONNECTIONS, "Calling activate on %d", handle); - err = sensor->activate(connection.get(), true); - } - - if (err == NO_ERROR) { - connection->updateLooperRegistration(mLooper); - SensorRegistrationInfo ®_info = - mLastNSensorRegistrations.editItemAt(mNextSensorRegIndex); - reg_info.mSensorHandle = handle; - reg_info.mSamplingRateUs = samplingPeriodNs/1000; - reg_info.mMaxReportLatencyUs = maxBatchReportLatencyNs/1000; - reg_info.mActivated = true; - reg_info.mPackageName = connection->getPackageName(); - time_t rawtime = time(NULL); - struct tm * timeinfo = localtime(&rawtime); - reg_info.mHour = timeinfo->tm_hour; - reg_info.mMin = timeinfo->tm_min; - reg_info.mSec = timeinfo->tm_sec; - mNextSensorRegIndex = (mNextSensorRegIndex + 1) % SENSOR_REGISTRATIONS_BUF_SIZE; - } - - if (err != NO_ERROR) { - // batch/activate has failed, reset our state. - cleanupWithoutDisableLocked(connection, handle); - } - return err; -} - -status_t SensorService::disable(const sp& connection, - int handle) -{ - if (mInitCheck != NO_ERROR) - return mInitCheck; - - Mutex::Autolock _l(mLock); - status_t err = cleanupWithoutDisableLocked(connection, handle); - if (err == NO_ERROR) { - SensorInterface* sensor = mSensorMap.valueFor(handle); - err = sensor ? sensor->activate(connection.get(), false) : status_t(BAD_VALUE); - - } - if (err == NO_ERROR) { - SensorRegistrationInfo ®_info = - mLastNSensorRegistrations.editItemAt(mNextSensorRegIndex); - reg_info.mActivated = false; - reg_info.mPackageName= connection->getPackageName(); - reg_info.mSensorHandle = handle; - time_t rawtime = time(NULL); - struct tm * timeinfo = localtime(&rawtime); - reg_info.mHour = timeinfo->tm_hour; - reg_info.mMin = timeinfo->tm_min; - reg_info.mSec = timeinfo->tm_sec; - mNextSensorRegIndex = (mNextSensorRegIndex + 1) % SENSOR_REGISTRATIONS_BUF_SIZE; - } - return err; -} - -status_t SensorService::cleanupWithoutDisable( - const sp& connection, int handle) { - Mutex::Autolock _l(mLock); - return cleanupWithoutDisableLocked(connection, handle); -} - -status_t SensorService::cleanupWithoutDisableLocked( - const sp& connection, int handle) { - SensorRecord* rec = mActiveSensors.valueFor(handle); - if (rec) { - // see if this connection becomes inactive - if (connection->removeSensor(handle)) { - BatteryService::disableSensor(connection->getUid(), handle); - } - if (connection->hasAnySensor() == false) { - connection->updateLooperRegistration(mLooper); - mActiveConnections.remove(connection); - } - // see if this sensor becomes inactive - if (rec->removeConnection(connection)) { - mActiveSensors.removeItem(handle); - mActiveVirtualSensors.removeItem(handle); - delete rec; - } - return NO_ERROR; - } - return BAD_VALUE; -} - -status_t SensorService::setEventRate(const sp& connection, - int handle, nsecs_t ns, const String16& opPackageName) -{ - if (mInitCheck != NO_ERROR) - return mInitCheck; - - SensorInterface* sensor = mSensorMap.valueFor(handle); - if (!sensor) - return BAD_VALUE; - - if (!canAccessSensor(sensor->getSensor(), "Tried configuring", opPackageName)) { - return BAD_VALUE; - } - - if (ns < 0) - return BAD_VALUE; - - nsecs_t minDelayNs = sensor->getSensor().getMinDelayNs(); - if (ns < minDelayNs) { - ns = minDelayNs; - } - - return sensor->setDelay(connection.get(), handle, ns); -} - -status_t SensorService::flushSensor(const sp& connection, - const String16& opPackageName) { - if (mInitCheck != NO_ERROR) return mInitCheck; - SensorDevice& dev(SensorDevice::getInstance()); - const int halVersion = dev.getHalDeviceVersion(); - status_t err(NO_ERROR); - Mutex::Autolock _l(mLock); - // Loop through all sensors for this connection and call flush on each of them. - for (size_t i = 0; i < connection->mSensorInfo.size(); ++i) { - const int handle = connection->mSensorInfo.keyAt(i); - SensorInterface* sensor = mSensorMap.valueFor(handle); - if (sensor->getSensor().getReportingMode() == AREPORTING_MODE_ONE_SHOT) { - ALOGE("flush called on a one-shot sensor"); - err = INVALID_OPERATION; - continue; - } - if (halVersion <= SENSORS_DEVICE_API_VERSION_1_0 || isVirtualSensor(handle)) { - // For older devices just increment pending flush count which will send a trivial - // flush complete event. - connection->incrementPendingFlushCount(handle); - } else { - if (!canAccessSensor(sensor->getSensor(), "Tried flushing", opPackageName)) { - err = INVALID_OPERATION; - continue; - } - status_t err_flush = sensor->flush(connection.get(), handle); - if (err_flush == NO_ERROR) { - SensorRecord* rec = mActiveSensors.valueFor(handle); - if (rec != NULL) rec->addPendingFlushConnection(connection); - } - err = (err_flush != NO_ERROR) ? err_flush : err; - } - } - return err; -} - -bool SensorService::canAccessSensor(const Sensor& sensor, const char* operation, - const String16& opPackageName) { - const String8& requiredPermission = sensor.getRequiredPermission(); - - if (requiredPermission.length() <= 0) { - return true; - } - - bool hasPermission = false; - - // Runtime permissions can't use the cache as they may change. - if (sensor.isRequiredPermissionRuntime()) { - hasPermission = checkPermission(String16(requiredPermission), - IPCThreadState::self()->getCallingPid(), IPCThreadState::self()->getCallingUid()); - } else { - hasPermission = PermissionCache::checkCallingPermission(String16(requiredPermission)); - } - - if (!hasPermission) { - ALOGE("%s a sensor (%s) without holding its required permission: %s", - operation, sensor.getName().string(), sensor.getRequiredPermission().string()); - return false; - } - - const int32_t opCode = sensor.getRequiredAppOp(); - if (opCode >= 0) { - AppOpsManager appOps; - if (appOps.noteOp(opCode, IPCThreadState::self()->getCallingUid(), opPackageName) - != AppOpsManager::MODE_ALLOWED) { - ALOGE("%s a sensor (%s) without enabled required app op: %D", - operation, sensor.getName().string(), opCode); - return false; - } - } - - return true; -} - -void SensorService::checkWakeLockState() { - Mutex::Autolock _l(mLock); - checkWakeLockStateLocked(); -} - -void SensorService::checkWakeLockStateLocked() { - if (!mWakeLockAcquired) { - return; - } - bool releaseLock = true; - for (size_t i=0 ; i connection(mActiveConnections[i].promote()); - if (connection != 0) { - if (connection->needsWakeLock()) { - releaseLock = false; - break; - } - } - } - if (releaseLock) { - setWakeLockAcquiredLocked(false); - } -} - -void SensorService::sendEventsFromCache(const sp& connection) { - Mutex::Autolock _l(mLock); - connection->writeToSocketFromCache(); - if (connection->needsWakeLock()) { - setWakeLockAcquiredLocked(true); - } -} - -void SensorService::populateActiveConnections( - SortedVector< sp >* activeConnections) { - Mutex::Autolock _l(mLock); - for (size_t i=0 ; i < mActiveConnections.size(); ++i) { - sp connection(mActiveConnections[i].promote()); - if (connection != 0) { - activeConnections->add(connection); - } - } -} - -bool SensorService::isWhiteListedPackage(const String8& packageName) { - return (packageName.contains(mWhiteListedPackage.string())); -} - -int SensorService::getNumEventsForSensorType(int sensor_event_type) { - switch (sensor_event_type) { - case SENSOR_TYPE_ROTATION_VECTOR: - case SENSOR_TYPE_GEOMAGNETIC_ROTATION_VECTOR: - return 5; - - case SENSOR_TYPE_MAGNETIC_FIELD_UNCALIBRATED: - case SENSOR_TYPE_GYROSCOPE_UNCALIBRATED: - return 6; - - case SENSOR_TYPE_GAME_ROTATION_VECTOR: - return 4; - - case SENSOR_TYPE_SIGNIFICANT_MOTION: - case SENSOR_TYPE_STEP_DETECTOR: - case SENSOR_TYPE_STEP_COUNTER: - return 1; - - default: - return 3; - } -} - -// --------------------------------------------------------------------------- -SensorService::SensorRecord::SensorRecord( - const sp& connection) -{ - mConnections.add(connection); -} - -bool SensorService::SensorRecord::addConnection( - const sp& connection) -{ - if (mConnections.indexOf(connection) < 0) { - mConnections.add(connection); - return true; - } - return false; -} - -bool SensorService::SensorRecord::removeConnection( - const wp& connection) -{ - ssize_t index = mConnections.indexOf(connection); - if (index >= 0) { - mConnections.removeItemsAt(index, 1); - } - // Remove this connections from the queue of flush() calls made on this sensor. - for (Vector< wp >::iterator it = - mPendingFlushConnections.begin(); it != mPendingFlushConnections.end();) { - - if (it->unsafe_get() == connection.unsafe_get()) { - it = mPendingFlushConnections.erase(it); - } else { - ++it; - } - } - return mConnections.size() ? false : true; -} - -void SensorService::SensorRecord::addPendingFlushConnection( - const sp& connection) { - mPendingFlushConnections.add(connection); -} - -void SensorService::SensorRecord::removeFirstPendingFlushConnection() { - if (mPendingFlushConnections.size() > 0) { - mPendingFlushConnections.removeAt(0); - } -} - -SensorService::SensorEventConnection * -SensorService::SensorRecord::getFirstPendingFlushConnection() { - if (mPendingFlushConnections.size() > 0) { - return mPendingFlushConnections[0].unsafe_get(); - } - return NULL; -} - -void SensorService::SensorRecord::clearAllPendingFlushConnections() { - mPendingFlushConnections.clear(); -} - - -// --------------------------------------------------------------------------- -SensorService::TrimmedSensorEvent::TrimmedSensorEvent(int sensorType) { - mTimestamp = -1; - const int numData = SensorService::getNumEventsForSensorType(sensorType); - if (sensorType == SENSOR_TYPE_STEP_COUNTER) { - mStepCounter = 0; - } else { - mData = new float[numData]; - for (int i = 0; i < numData; ++i) { - mData[i] = -1.0; - } - } - mHour = mMin = mSec = INT32_MIN; -} - -bool SensorService::TrimmedSensorEvent::isSentinel(const TrimmedSensorEvent& event) { - return (event.mHour == INT32_MIN && event.mMin == INT32_MIN && event.mSec == INT32_MIN); -} -// -------------------------------------------------------------------------- -SensorService::CircularBuffer::CircularBuffer(int sensor_event_type) { - mNextInd = 0; - mBufSize = CIRCULAR_BUF_SIZE; - if (sensor_event_type == SENSOR_TYPE_STEP_COUNTER || - sensor_event_type == SENSOR_TYPE_SIGNIFICANT_MOTION || - sensor_event_type == SENSOR_TYPE_ACCELEROMETER) { - mBufSize = CIRCULAR_BUF_SIZE * 5; - } - mTrimmedSensorEventArr = new TrimmedSensorEvent *[mBufSize]; - mSensorType = sensor_event_type; - for (int i = 0; i < mBufSize; ++i) { - mTrimmedSensorEventArr[i] = new TrimmedSensorEvent(mSensorType); - } -} - -void SensorService::CircularBuffer::addEvent(const sensors_event_t& sensor_event) { - TrimmedSensorEvent *curr_event = mTrimmedSensorEventArr[mNextInd]; - curr_event->mTimestamp = sensor_event.timestamp; - if (mSensorType == SENSOR_TYPE_STEP_COUNTER) { - curr_event->mStepCounter = sensor_event.u64.step_counter; - } else { - memcpy(curr_event->mData, sensor_event.data, - sizeof(float) * SensorService::getNumEventsForSensorType(mSensorType)); - } - time_t rawtime = time(NULL); - struct tm * timeinfo = localtime(&rawtime); - curr_event->mHour = timeinfo->tm_hour; - curr_event->mMin = timeinfo->tm_min; - curr_event->mSec = timeinfo->tm_sec; - mNextInd = (mNextInd + 1) % mBufSize; -} - -void SensorService::CircularBuffer::printBuffer(String8& result) const { - const int numData = SensorService::getNumEventsForSensorType(mSensorType); - int i = mNextInd, eventNum = 1; - result.appendFormat("last %d events = < ", mBufSize); - do { - if (TrimmedSensorEvent::isSentinel(*mTrimmedSensorEventArr[i])) { - // Sentinel, ignore. - i = (i + 1) % mBufSize; - continue; - } - result.appendFormat("%d) ", eventNum++); - if (mSensorType == SENSOR_TYPE_STEP_COUNTER) { - result.appendFormat("%llu,", mTrimmedSensorEventArr[i]->mStepCounter); - } else { - for (int j = 0; j < numData; ++j) { - result.appendFormat("%5.1f,", mTrimmedSensorEventArr[i]->mData[j]); - } - } - result.appendFormat("%lld %02d:%02d:%02d ", mTrimmedSensorEventArr[i]->mTimestamp, - mTrimmedSensorEventArr[i]->mHour, mTrimmedSensorEventArr[i]->mMin, - mTrimmedSensorEventArr[i]->mSec); - i = (i + 1) % mBufSize; - } while (i != mNextInd); - result.appendFormat(">\n"); -} - -bool SensorService::CircularBuffer::populateLastEvent(sensors_event_t *event) { - int lastEventInd = (mNextInd - 1 + mBufSize) % mBufSize; - // Check if the buffer is empty. - if (TrimmedSensorEvent::isSentinel(*mTrimmedSensorEventArr[lastEventInd])) { - return false; - } - event->version = sizeof(sensors_event_t); - event->type = mSensorType; - event->timestamp = mTrimmedSensorEventArr[lastEventInd]->mTimestamp; - if (mSensorType == SENSOR_TYPE_STEP_COUNTER) { - event->u64.step_counter = mTrimmedSensorEventArr[lastEventInd]->mStepCounter; - } else { - memcpy(event->data, mTrimmedSensorEventArr[lastEventInd]->mData, - sizeof(float) * SensorService::getNumEventsForSensorType(mSensorType)); - } - return true; -} - -SensorService::CircularBuffer::~CircularBuffer() { - for (int i = 0; i < mBufSize; ++i) { - delete mTrimmedSensorEventArr[i]; - } - delete [] mTrimmedSensorEventArr; -} - -// --------------------------------------------------------------------------- - -SensorService::SensorEventConnection::SensorEventConnection( - const sp& service, uid_t uid, String8 packageName, bool isDataInjectionMode, - const String16& opPackageName) - : mService(service), mUid(uid), mWakeLockRefCount(0), mHasLooperCallbacks(false), - mDead(false), mDataInjectionMode(isDataInjectionMode), mEventCache(NULL), - mCacheSize(0), mMaxCacheSize(0), mPackageName(packageName), mOpPackageName(opPackageName) { - mChannel = new BitTube(mService->mSocketBufferSize); -#if DEBUG_CONNECTIONS - mEventsReceived = mEventsSentFromCache = mEventsSent = 0; - mTotalAcksNeeded = mTotalAcksReceived = 0; -#endif -} - -SensorService::SensorEventConnection::~SensorEventConnection() { - ALOGD_IF(DEBUG_CONNECTIONS, "~SensorEventConnection(%p)", this); - mService->cleanupConnection(this); - if (mEventCache != NULL) { - delete mEventCache; - } -} - -void SensorService::SensorEventConnection::onFirstRef() { - LooperCallback::onFirstRef(); -} - -bool SensorService::SensorEventConnection::needsWakeLock() { - Mutex::Autolock _l(mConnectionLock); - return !mDead && mWakeLockRefCount > 0; -} - -void SensorService::SensorEventConnection::resetWakeLockRefCount() { - Mutex::Autolock _l(mConnectionLock); - mWakeLockRefCount = 0; -} - -void SensorService::SensorEventConnection::dump(String8& result) { - Mutex::Autolock _l(mConnectionLock); - result.appendFormat("\tOperating Mode: %s\n",mDataInjectionMode ? "DATA_INJECTION" : "NORMAL"); - result.appendFormat("\t %s | WakeLockRefCount %d | uid %d | cache size %d | " - "max cache size %d\n", mPackageName.string(), mWakeLockRefCount, mUid, mCacheSize, - mMaxCacheSize); - for (size_t i = 0; i < mSensorInfo.size(); ++i) { - const FlushInfo& flushInfo = mSensorInfo.valueAt(i); - result.appendFormat("\t %s 0x%08x | status: %s | pending flush events %d \n", - mService->getSensorName(mSensorInfo.keyAt(i)).string(), - mSensorInfo.keyAt(i), - flushInfo.mFirstFlushPending ? "First flush pending" : - "active", - flushInfo.mPendingFlushEventsToSend); - } -#if DEBUG_CONNECTIONS - result.appendFormat("\t events recvd: %d | sent %d | cache %d | dropped %d |" - " total_acks_needed %d | total_acks_recvd %d\n", - mEventsReceived, - mEventsSent, - mEventsSentFromCache, - mEventsReceived - (mEventsSentFromCache + mEventsSent + mCacheSize), - mTotalAcksNeeded, - mTotalAcksReceived); -#endif -} - -bool SensorService::SensorEventConnection::addSensor(int32_t handle) { - Mutex::Autolock _l(mConnectionLock); - if (!canAccessSensor(mService->getSensorFromHandle(handle), - "Tried adding", mOpPackageName)) { - return false; - } - if (mSensorInfo.indexOfKey(handle) < 0) { - mSensorInfo.add(handle, FlushInfo()); - return true; - } - return false; -} - -bool SensorService::SensorEventConnection::removeSensor(int32_t handle) { - Mutex::Autolock _l(mConnectionLock); - if (mSensorInfo.removeItem(handle) >= 0) { - return true; - } - return false; -} - -bool SensorService::SensorEventConnection::hasSensor(int32_t handle) const { - Mutex::Autolock _l(mConnectionLock); - return mSensorInfo.indexOfKey(handle) >= 0; -} - -bool SensorService::SensorEventConnection::hasAnySensor() const { - Mutex::Autolock _l(mConnectionLock); - return mSensorInfo.size() ? true : false; -} - -bool SensorService::SensorEventConnection::hasOneShotSensors() const { - Mutex::Autolock _l(mConnectionLock); - for (size_t i = 0; i < mSensorInfo.size(); ++i) { - const int handle = mSensorInfo.keyAt(i); - if (mService->getSensorFromHandle(handle).getReportingMode() == AREPORTING_MODE_ONE_SHOT) { - return true; - } - } - return false; -} - -String8 SensorService::SensorEventConnection::getPackageName() const { - return mPackageName; -} - -void SensorService::SensorEventConnection::setFirstFlushPending(int32_t handle, - bool value) { - Mutex::Autolock _l(mConnectionLock); - ssize_t index = mSensorInfo.indexOfKey(handle); - if (index >= 0) { - FlushInfo& flushInfo = mSensorInfo.editValueAt(index); - flushInfo.mFirstFlushPending = value; - } -} - -void SensorService::SensorEventConnection::updateLooperRegistration(const sp& looper) { - Mutex::Autolock _l(mConnectionLock); - updateLooperRegistrationLocked(looper); -} - -void SensorService::SensorEventConnection::updateLooperRegistrationLocked( - const sp& looper) { - bool isConnectionActive = (mSensorInfo.size() > 0 && !mDataInjectionMode) || - mDataInjectionMode; - // If all sensors are unregistered OR Looper has encountered an error, we - // can remove the Fd from the Looper if it has been previously added. - if (!isConnectionActive || mDead) { - if (mHasLooperCallbacks) { - ALOGD_IF(DEBUG_CONNECTIONS, "%p removeFd fd=%d", this, mChannel->getSendFd()); - looper->removeFd(mChannel->getSendFd()); - mHasLooperCallbacks = false; - } - return; - } - - int looper_flags = 0; - if (mCacheSize > 0) looper_flags |= ALOOPER_EVENT_OUTPUT; - if (mDataInjectionMode) looper_flags |= ALOOPER_EVENT_INPUT; - for (size_t i = 0; i < mSensorInfo.size(); ++i) { - const int handle = mSensorInfo.keyAt(i); - if (mService->getSensorFromHandle(handle).isWakeUpSensor()) { - looper_flags |= ALOOPER_EVENT_INPUT; - break; - } - } - // If flags is still set to zero, we don't need to add this fd to the Looper, if - // the fd has already been added, remove it. This is likely to happen when ALL the - // events stored in the cache have been sent to the corresponding app. - if (looper_flags == 0) { - if (mHasLooperCallbacks) { - ALOGD_IF(DEBUG_CONNECTIONS, "removeFd fd=%d", mChannel->getSendFd()); - looper->removeFd(mChannel->getSendFd()); - mHasLooperCallbacks = false; - } - return; - } - // Add the file descriptor to the Looper for receiving acknowledegments if the app has - // registered for wake-up sensors OR for sending events in the cache. - int ret = looper->addFd(mChannel->getSendFd(), 0, looper_flags, this, NULL); - if (ret == 1) { - ALOGD_IF(DEBUG_CONNECTIONS, "%p addFd fd=%d", this, mChannel->getSendFd()); - mHasLooperCallbacks = true; - } else { - ALOGE("Looper::addFd failed ret=%d fd=%d", ret, mChannel->getSendFd()); - } -} - -void SensorService::SensorEventConnection::incrementPendingFlushCount(int32_t handle) { - Mutex::Autolock _l(mConnectionLock); - ssize_t index = mSensorInfo.indexOfKey(handle); - if (index >= 0) { - FlushInfo& flushInfo = mSensorInfo.editValueAt(index); - flushInfo.mPendingFlushEventsToSend++; - } -} - -status_t SensorService::SensorEventConnection::sendEvents( - sensors_event_t const* buffer, size_t numEvents, - sensors_event_t* scratch, - SensorEventConnection const * const * mapFlushEventsToConnections) { - // filter out events not for this connection - int count = 0; - Mutex::Autolock _l(mConnectionLock); - if (scratch) { - size_t i=0; - while (i(buffer); - count = numEvents; - } - - sendPendingFlushEventsLocked(); - // Early return if there are no events for this connection. - if (count == 0) { - return status_t(NO_ERROR); - } - -#if DEBUG_CONNECTIONS - mEventsReceived += count; -#endif - if (mCacheSize != 0) { - // There are some events in the cache which need to be sent first. Copy this buffer to - // the end of cache. - if (mCacheSize + count <= mMaxCacheSize) { - memcpy(&mEventCache[mCacheSize], scratch, count * sizeof(sensors_event_t)); - mCacheSize += count; - } else { - // Check if any new sensors have registered on this connection which may have increased - // the max cache size that is desired. - if (mCacheSize + count < computeMaxCacheSizeLocked()) { - reAllocateCacheLocked(scratch, count); - return status_t(NO_ERROR); - } - // Some events need to be dropped. - int remaningCacheSize = mMaxCacheSize - mCacheSize; - if (remaningCacheSize != 0) { - memcpy(&mEventCache[mCacheSize], scratch, - remaningCacheSize * sizeof(sensors_event_t)); - } - int numEventsDropped = count - remaningCacheSize; - countFlushCompleteEventsLocked(mEventCache, numEventsDropped); - // Drop the first "numEventsDropped" in the cache. - memmove(mEventCache, &mEventCache[numEventsDropped], - (mCacheSize - numEventsDropped) * sizeof(sensors_event_t)); - - // Copy the remainingEvents in scratch buffer to the end of cache. - memcpy(&mEventCache[mCacheSize - numEventsDropped], scratch + remaningCacheSize, - numEventsDropped * sizeof(sensors_event_t)); - } - return status_t(NO_ERROR); - } - - int index_wake_up_event = findWakeUpSensorEventLocked(scratch, count); - if (index_wake_up_event >= 0) { - scratch[index_wake_up_event].flags |= WAKE_UP_SENSOR_EVENT_NEEDS_ACK; - ++mWakeLockRefCount; -#if DEBUG_CONNECTIONS - ++mTotalAcksNeeded; -#endif - } - - // NOTE: ASensorEvent and sensors_event_t are the same type. - ssize_t size = SensorEventQueue::write(mChannel, - reinterpret_cast(scratch), count); - if (size < 0) { - // Write error, copy events to local cache. - if (index_wake_up_event >= 0) { - // If there was a wake_up sensor_event, reset the flag. - scratch[index_wake_up_event].flags &= ~WAKE_UP_SENSOR_EVENT_NEEDS_ACK; - if (mWakeLockRefCount > 0) { - --mWakeLockRefCount; - } -#if DEBUG_CONNECTIONS - --mTotalAcksNeeded; -#endif - } - if (mEventCache == NULL) { - mMaxCacheSize = computeMaxCacheSizeLocked(); - mEventCache = new sensors_event_t[mMaxCacheSize]; - mCacheSize = 0; - } - memcpy(&mEventCache[mCacheSize], scratch, count * sizeof(sensors_event_t)); - mCacheSize += count; - - // Add this file descriptor to the looper to get a callback when this fd is available for - // writing. - updateLooperRegistrationLocked(mService->getLooper()); - return size; - } - -#if DEBUG_CONNECTIONS - if (size > 0) { - mEventsSent += count; - } -#endif - - return size < 0 ? status_t(size) : status_t(NO_ERROR); -} - -void SensorService::SensorEventConnection::reAllocateCacheLocked(sensors_event_t const* scratch, - int count) { - sensors_event_t *eventCache_new; - const int new_cache_size = computeMaxCacheSizeLocked(); - // Allocate new cache, copy over events from the old cache & scratch, free up memory. - eventCache_new = new sensors_event_t[new_cache_size]; - memcpy(eventCache_new, mEventCache, mCacheSize * sizeof(sensors_event_t)); - memcpy(&eventCache_new[mCacheSize], scratch, count * sizeof(sensors_event_t)); - - ALOGD_IF(DEBUG_CONNECTIONS, "reAllocateCacheLocked maxCacheSize=%d %d", mMaxCacheSize, - new_cache_size); - - delete mEventCache; - mEventCache = eventCache_new; - mCacheSize += count; - mMaxCacheSize = new_cache_size; -} - -void SensorService::SensorEventConnection::sendPendingFlushEventsLocked() { - ASensorEvent flushCompleteEvent; - memset(&flushCompleteEvent, 0, sizeof(flushCompleteEvent)); - flushCompleteEvent.type = SENSOR_TYPE_META_DATA; - // Loop through all the sensors for this connection and check if there are any pending - // flush complete events to be sent. - for (size_t i = 0; i < mSensorInfo.size(); ++i) { - FlushInfo& flushInfo = mSensorInfo.editValueAt(i); - while (flushInfo.mPendingFlushEventsToSend > 0) { - const int sensor_handle = mSensorInfo.keyAt(i); - flushCompleteEvent.meta_data.sensor = sensor_handle; - bool wakeUpSensor = mService->getSensorFromHandle(sensor_handle).isWakeUpSensor(); - if (wakeUpSensor) { - ++mWakeLockRefCount; - flushCompleteEvent.flags |= WAKE_UP_SENSOR_EVENT_NEEDS_ACK; - } - ssize_t size = SensorEventQueue::write(mChannel, &flushCompleteEvent, 1); - if (size < 0) { - if (wakeUpSensor) --mWakeLockRefCount; - return; - } - ALOGD_IF(DEBUG_CONNECTIONS, "sent dropped flush complete event==%d ", - flushCompleteEvent.meta_data.sensor); - flushInfo.mPendingFlushEventsToSend--; - } - } -} - -void SensorService::SensorEventConnection::writeToSocketFromCache() { - // At a time write at most half the size of the receiver buffer in SensorEventQueue OR - // half the size of the socket buffer allocated in BitTube whichever is smaller. - const int maxWriteSize = helpers::min(SensorEventQueue::MAX_RECEIVE_BUFFER_EVENT_COUNT/2, - int(mService->mSocketBufferSize/(sizeof(sensors_event_t)*2))); - Mutex::Autolock _l(mConnectionLock); - // Send pending flush complete events (if any) - sendPendingFlushEventsLocked(); - for (int numEventsSent = 0; numEventsSent < mCacheSize;) { - const int numEventsToWrite = helpers::min(mCacheSize - numEventsSent, maxWriteSize); - int index_wake_up_event = - findWakeUpSensorEventLocked(mEventCache + numEventsSent, numEventsToWrite); - if (index_wake_up_event >= 0) { - mEventCache[index_wake_up_event + numEventsSent].flags |= - WAKE_UP_SENSOR_EVENT_NEEDS_ACK; - ++mWakeLockRefCount; -#if DEBUG_CONNECTIONS - ++mTotalAcksNeeded; -#endif - } - - ssize_t size = SensorEventQueue::write(mChannel, - reinterpret_cast(mEventCache + numEventsSent), - numEventsToWrite); - if (size < 0) { - if (index_wake_up_event >= 0) { - // If there was a wake_up sensor_event, reset the flag. - mEventCache[index_wake_up_event + numEventsSent].flags &= - ~WAKE_UP_SENSOR_EVENT_NEEDS_ACK; - if (mWakeLockRefCount > 0) { - --mWakeLockRefCount; - } -#if DEBUG_CONNECTIONS - --mTotalAcksNeeded; -#endif - } - memmove(mEventCache, &mEventCache[numEventsSent], - (mCacheSize - numEventsSent) * sizeof(sensors_event_t)); - ALOGD_IF(DEBUG_CONNECTIONS, "wrote %d events from cache size==%d ", - numEventsSent, mCacheSize); - mCacheSize -= numEventsSent; - return; - } - numEventsSent += numEventsToWrite; -#if DEBUG_CONNECTIONS - mEventsSentFromCache += numEventsToWrite; -#endif - } - ALOGD_IF(DEBUG_CONNECTIONS, "wrote all events from cache size=%d ", mCacheSize); - // All events from the cache have been sent. Reset cache size to zero. - mCacheSize = 0; - // There are no more events in the cache. We don't need to poll for write on the fd. - // Update Looper registration. - updateLooperRegistrationLocked(mService->getLooper()); -} - -void SensorService::SensorEventConnection::countFlushCompleteEventsLocked( - sensors_event_t const* scratch, const int numEventsDropped) { - ALOGD_IF(DEBUG_CONNECTIONS, "dropping %d events ", numEventsDropped); - // Count flushComplete events in the events that are about to the dropped. These will be sent - // separately before the next batch of events. - for (int j = 0; j < numEventsDropped; ++j) { - if (scratch[j].type == SENSOR_TYPE_META_DATA) { - FlushInfo& flushInfo = mSensorInfo.editValueFor(scratch[j].meta_data.sensor); - flushInfo.mPendingFlushEventsToSend++; - ALOGD_IF(DEBUG_CONNECTIONS, "increment pendingFlushCount %d", - flushInfo.mPendingFlushEventsToSend); - } - } - return; -} - -int SensorService::SensorEventConnection::findWakeUpSensorEventLocked( - sensors_event_t const* scratch, const int count) { - for (int i = 0; i < count; ++i) { - if (mService->isWakeUpSensorEvent(scratch[i])) { - return i; - } - } - return -1; -} - -sp SensorService::SensorEventConnection::getSensorChannel() const -{ - return mChannel; -} - -status_t SensorService::SensorEventConnection::enableDisable( - int handle, bool enabled, nsecs_t samplingPeriodNs, nsecs_t maxBatchReportLatencyNs, - int reservedFlags) -{ - status_t err; - if (enabled) { - err = mService->enable(this, handle, samplingPeriodNs, maxBatchReportLatencyNs, - reservedFlags, mOpPackageName); - - } else { - err = mService->disable(this, handle); - } - return err; -} - -status_t SensorService::SensorEventConnection::setEventRate( - int handle, nsecs_t samplingPeriodNs) -{ - return mService->setEventRate(this, handle, samplingPeriodNs, mOpPackageName); -} - -status_t SensorService::SensorEventConnection::flush() { - return mService->flushSensor(this, mOpPackageName); -} - -int SensorService::SensorEventConnection::handleEvent(int fd, int events, void* /*data*/) { - if (events & ALOOPER_EVENT_HANGUP || events & ALOOPER_EVENT_ERROR) { - { - // If the Looper encounters some error, set the flag mDead, reset mWakeLockRefCount, - // and remove the fd from Looper. Call checkWakeLockState to know if SensorService - // can release the wake-lock. - ALOGD_IF(DEBUG_CONNECTIONS, "%p Looper error %d", this, fd); - Mutex::Autolock _l(mConnectionLock); - mDead = true; - mWakeLockRefCount = 0; - updateLooperRegistrationLocked(mService->getLooper()); - } - mService->checkWakeLockState(); - if (mDataInjectionMode) { - // If the Looper has encountered some error in data injection mode, reset SensorService - // back to normal mode. - mService->resetToNormalMode(); - mDataInjectionMode = false; - } - return 1; - } - - if (events & ALOOPER_EVENT_INPUT) { - unsigned char buf[sizeof(sensors_event_t)]; - ssize_t numBytesRead = ::recv(fd, buf, sizeof(buf), MSG_DONTWAIT); - { - Mutex::Autolock _l(mConnectionLock); - if (numBytesRead == sizeof(sensors_event_t)) { - if (!mDataInjectionMode) { - ALOGE("Data injected in normal mode, dropping event" - "package=%s uid=%d", mPackageName.string(), mUid); - // Unregister call backs. - return 0; - } - SensorDevice& dev(SensorDevice::getInstance()); - sensors_event_t sensor_event; - memset(&sensor_event, 0, sizeof(sensor_event)); - memcpy(&sensor_event, buf, sizeof(sensors_event_t)); - Sensor sensor = mService->getSensorFromHandle(sensor_event.sensor); - sensor_event.type = sensor.getType(); - dev.injectSensorData(&sensor_event); -#if DEBUG_CONNECTIONS - ++mEventsReceived; -#endif - } else if (numBytesRead == sizeof(uint32_t)) { - uint32_t numAcks = 0; - memcpy(&numAcks, buf, numBytesRead); - // Sanity check to ensure there are no read errors in recv, numAcks is always - // within the range and not zero. If any of the above don't hold reset - // mWakeLockRefCount to zero. - if (numAcks > 0 && numAcks < mWakeLockRefCount) { - mWakeLockRefCount -= numAcks; - } else { - mWakeLockRefCount = 0; - } -#if DEBUG_CONNECTIONS - mTotalAcksReceived += numAcks; -#endif - } else { - // Read error, reset wakelock refcount. - mWakeLockRefCount = 0; - } - } - // Check if wakelock can be released by sensorservice. mConnectionLock needs to be released - // here as checkWakeLockState() will need it. - if (mWakeLockRefCount == 0) { - mService->checkWakeLockState(); - } - // continue getting callbacks. - return 1; - } - - if (events & ALOOPER_EVENT_OUTPUT) { - // send sensor data that is stored in mEventCache for this connection. - mService->sendEventsFromCache(this); - } - return 1; -} - -int SensorService::SensorEventConnection::computeMaxCacheSizeLocked() const { - size_t fifoWakeUpSensors = 0; - size_t fifoNonWakeUpSensors = 0; - for (size_t i = 0; i < mSensorInfo.size(); ++i) { - const Sensor& sensor = mService->getSensorFromHandle(mSensorInfo.keyAt(i)); - if (sensor.getFifoReservedEventCount() == sensor.getFifoMaxEventCount()) { - // Each sensor has a reserved fifo. Sum up the fifo sizes for all wake up sensors and - // non wake_up sensors. - if (sensor.isWakeUpSensor()) { - fifoWakeUpSensors += sensor.getFifoReservedEventCount(); - } else { - fifoNonWakeUpSensors += sensor.getFifoReservedEventCount(); - } - } else { - // Shared fifo. Compute the max of the fifo sizes for wake_up and non_wake up sensors. - if (sensor.isWakeUpSensor()) { - fifoWakeUpSensors = fifoWakeUpSensors > sensor.getFifoMaxEventCount() ? - fifoWakeUpSensors : sensor.getFifoMaxEventCount(); - - } else { - fifoNonWakeUpSensors = fifoNonWakeUpSensors > sensor.getFifoMaxEventCount() ? - fifoNonWakeUpSensors : sensor.getFifoMaxEventCount(); - - } - } - } - if (fifoWakeUpSensors + fifoNonWakeUpSensors == 0) { - // It is extremely unlikely that there is a write failure in non batch mode. Return a cache - // size that is equal to that of the batch mode. - // ALOGW("Write failure in non-batch mode"); - return MAX_SOCKET_BUFFER_SIZE_BATCHED/sizeof(sensors_event_t); - } - return fifoWakeUpSensors + fifoNonWakeUpSensors; -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorService.h android-platform-frameworks-native-21/services/sensorservice/SensorService.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/SensorService.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/SensorService.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,434 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_SENSOR_SERVICE_H -#define ANDROID_SENSOR_SERVICE_H - -#include -#include - -#include -#include -#include -#include -#include -#include -#include -#include - -#include - -#include -#include -#include -#include - -#include "SensorInterface.h" - -#if __clang__ -// Clang warns about SensorEventConnection::dump hiding BBinder::dump -// The cause isn't fixable without changing the API, so let's tell clang -// this is indeed intentional. -#pragma clang diagnostic ignored "-Woverloaded-virtual" -#endif - -// --------------------------------------------------------------------------- - -#define DEBUG_CONNECTIONS false -// Max size is 100 KB which is enough to accept a batch of about 1000 events. -#define MAX_SOCKET_BUFFER_SIZE_BATCHED 100 * 1024 -// For older HALs which don't support batching, use a smaller socket buffer size. -#define SOCKET_BUFFER_SIZE_NON_BATCHED 4 * 1024 - -#define CIRCULAR_BUF_SIZE 10 -#define SENSOR_REGISTRATIONS_BUF_SIZE 20 - -struct sensors_poll_device_t; -struct sensors_module_t; - -namespace android { -// --------------------------------------------------------------------------- - -class SensorService : - public BinderService, - public BnSensorServer, - protected Thread -{ - friend class BinderService; - - enum Mode { - // The regular operating mode where any application can register/unregister/call flush on - // sensors. - NORMAL = 0, - // This mode is only used for testing purposes. Not all HALs support this mode. In this - // mode, the HAL ignores the sensor data provided by physical sensors and accepts the data - // that is injected from the SensorService as if it were the real sensor data. This mode - // is primarily used for testing various algorithms like vendor provided SensorFusion, - // Step Counter and Step Detector etc. Typically in this mode, there will be a client - // (a SensorEventConnection) which will be injecting sensor data into the HAL. Normal apps - // can unregister and register for any sensor that supports injection. Registering to sensors - // that do not support injection will give an error. - // TODO(aakella) : Allow exactly one client to inject sensor data at a time. - DATA_INJECTION = 1, - // This mode is used only for testing sensors. Each sensor can be tested in isolation with - // the required sampling_rate and maxReportLatency parameters without having to think about - // the data rates requested by other applications. End user devices are always expected to be - // in NORMAL mode. When this mode is first activated, all active sensors from all connections - // are disabled. Calling flush() will return an error. In this mode, only the requests from - // selected apps whose package names are whitelisted are allowed (typically CTS apps). Only - // these apps can register/unregister/call flush() on sensors. If SensorService switches to - // NORMAL mode again, all sensors that were previously registered to are activated with the - // corresponding paramaters if the application hasn't unregistered for sensors in the mean - // time. - // NOTE: Non whitelisted app whose sensors were previously deactivated may still receive - // events if a whitelisted app requests data from the same sensor. - RESTRICTED = 2 - - // State Transitions supported. - // RESTRICTED <--- NORMAL ---> DATA_INJECTION - // ---> <--- - - // Shell commands to switch modes in SensorService. - // 1) Put SensorService in RESTRICTED mode with packageName .cts. If it is already in - // restricted mode it is treated as a NO_OP (and packageName is NOT changed). - // $ adb shell dumpsys sensorservice restrict .cts. - // - // 2) Put SensorService in DATA_INJECTION mode with packageName .xts. If it is already in - // data_injection mode it is treated as a NO_OP (and packageName is NOT changed). - // $ adb shell dumpsys sensorservice data_injection .xts. - // - // 3) Reset sensorservice back to NORMAL mode. - // $ adb shell dumpsys sensorservice enable - }; - - static const char* WAKE_LOCK_NAME; - - static char const* getServiceName() ANDROID_API { return "sensorservice"; } - SensorService() ANDROID_API; - virtual ~SensorService(); - - virtual void onFirstRef(); - - // Thread interface - virtual bool threadLoop(); - - // ISensorServer interface - virtual Vector getSensorList(const String16& opPackageName); - virtual sp createSensorEventConnection(const String8& packageName, - int requestedMode, const String16& opPackageName); - virtual int isDataInjectionEnabled(); - virtual status_t dump(int fd, const Vector& args); - - class SensorEventConnection : public BnSensorEventConnection, public LooperCallback { - friend class SensorService; - virtual ~SensorEventConnection(); - virtual void onFirstRef(); - virtual sp getSensorChannel() const; - virtual status_t enableDisable(int handle, bool enabled, nsecs_t samplingPeriodNs, - nsecs_t maxBatchReportLatencyNs, int reservedFlags); - virtual status_t setEventRate(int handle, nsecs_t samplingPeriodNs); - virtual status_t flush(); - // Count the number of flush complete events which are about to be dropped in the buffer. - // Increment mPendingFlushEventsToSend in mSensorInfo. These flush complete events will be - // sent separately before the next batch of events. - void countFlushCompleteEventsLocked(sensors_event_t const* scratch, int numEventsDropped); - - // Check if there are any wake up events in the buffer. If yes, return the index of the - // first wake_up sensor event in the buffer else return -1. This wake_up sensor event will - // have the flag WAKE_UP_SENSOR_EVENT_NEEDS_ACK set. Exactly one event per packet will have - // the wake_up flag set. SOCK_SEQPACKET ensures that either the entire packet is read or - // dropped. - int findWakeUpSensorEventLocked(sensors_event_t const* scratch, int count); - - // Send pending flush_complete events. There may have been flush_complete_events that are - // dropped which need to be sent separately before other events. On older HALs (1_0) this - // method emulates the behavior of flush(). - void sendPendingFlushEventsLocked(); - - // Writes events from mEventCache to the socket. - void writeToSocketFromCache(); - - // Compute the approximate cache size from the FIFO sizes of various sensors registered for - // this connection. Wake up and non-wake up sensors have separate FIFOs but FIFO may be - // shared amongst wake-up sensors and non-wake up sensors. - int computeMaxCacheSizeLocked() const; - - // When more sensors register, the maximum cache size desired may change. Compute max cache - // size, reallocate memory and copy over events from the older cache. - void reAllocateCacheLocked(sensors_event_t const* scratch, int count); - - // LooperCallback method. If there is data to read on this fd, it is an ack from the - // app that it has read events from a wake up sensor, decrement mWakeLockRefCount. - // If this fd is available for writing send the data from the cache. - virtual int handleEvent(int fd, int events, void* data); - - // Increment mPendingFlushEventsToSend for the given sensor handle. - void incrementPendingFlushCount(int32_t handle); - - // Add or remove the file descriptor associated with the BitTube to the looper. If mDead is - // set to true or there are no more sensors for this connection, the file descriptor is - // removed if it has been previously added to the Looper. Depending on the state of the - // connection FD may be added to the Looper. The flags to set are determined by the internal - // state of the connection. FDs are added to the looper when wake-up sensors are registered - // (to poll for acknowledgements) and when write fails on the socket when there are too many - // error and the other end hangs up or when this client unregisters for this connection. - void updateLooperRegistration(const sp& looper); - void updateLooperRegistrationLocked(const sp& looper); - - sp const mService; - sp mChannel; - uid_t mUid; - mutable Mutex mConnectionLock; - // Number of events from wake up sensors which are still pending and haven't been delivered - // to the corresponding application. It is incremented by one unit for each write to the - // socket. - uint32_t mWakeLockRefCount; - - // If this flag is set to true, it means that the file descriptor associated with the - // BitTube has been added to the Looper in SensorService. This flag is typically set when - // this connection has wake-up sensors associated with it or when write has failed on this - // connection and we're storing some events in the cache. - bool mHasLooperCallbacks; - // If there are any errors associated with the Looper this flag is set to true and - // mWakeLockRefCount is reset to zero. needsWakeLock method will always return false, if - // this flag is set. - bool mDead; - - bool mDataInjectionMode; - struct FlushInfo { - // The number of flush complete events dropped for this sensor is stored here. - // They are sent separately before the next batch of events. - int mPendingFlushEventsToSend; - // Every activate is preceded by a flush. Only after the first flush complete is - // received, the events for the sensor are sent on that *connection*. - bool mFirstFlushPending; - FlushInfo() : mPendingFlushEventsToSend(0), mFirstFlushPending(false) {} - }; - // protected by SensorService::mLock. Key for this vector is the sensor handle. - KeyedVector mSensorInfo; - sensors_event_t *mEventCache; - int mCacheSize, mMaxCacheSize; - String8 mPackageName; - const String16 mOpPackageName; -#if DEBUG_CONNECTIONS - int mEventsReceived, mEventsSent, mEventsSentFromCache; - int mTotalAcksNeeded, mTotalAcksReceived; -#endif - - public: - SensorEventConnection(const sp& service, uid_t uid, String8 packageName, - bool isDataInjectionMode, const String16& opPackageName); - - status_t sendEvents(sensors_event_t const* buffer, size_t count, - sensors_event_t* scratch, - SensorEventConnection const * const * mapFlushEventsToConnections = NULL); - bool hasSensor(int32_t handle) const; - bool hasAnySensor() const; - bool hasOneShotSensors() const; - bool addSensor(int32_t handle); - bool removeSensor(int32_t handle); - void setFirstFlushPending(int32_t handle, bool value); - void dump(String8& result); - bool needsWakeLock(); - void resetWakeLockRefCount(); - String8 getPackageName() const; - - uid_t getUid() const { return mUid; } - }; - - class SensorRecord { - SortedVector< wp > mConnections; - // A queue of all flush() calls made on this sensor. Flush complete events will be - // sent in this order. - Vector< wp > mPendingFlushConnections; - public: - SensorRecord(const sp& connection); - bool addConnection(const sp& connection); - bool removeConnection(const wp& connection); - size_t getNumConnections() const { return mConnections.size(); } - - void addPendingFlushConnection(const sp& connection); - void removeFirstPendingFlushConnection(); - SensorEventConnection * getFirstPendingFlushConnection(); - void clearAllPendingFlushConnections(); - }; - - class SensorEventAckReceiver : public Thread { - sp const mService; - public: - virtual bool threadLoop(); - SensorEventAckReceiver(const sp& service): mService(service) {} - }; - - // sensor_event_t with only the data and the timestamp. - struct TrimmedSensorEvent { - union { - float *mData; - uint64_t mStepCounter; - }; - // Timestamp from the sensor_event. - int64_t mTimestamp; - // HH:MM:SS local time at which this sensor event is read at SensorService. Useful - // for debugging. - int32_t mHour, mMin, mSec; - - TrimmedSensorEvent(int sensorType); - static bool isSentinel(const TrimmedSensorEvent& event); - - ~TrimmedSensorEvent() { - delete [] mData; - } - }; - - // A circular buffer of TrimmedSensorEvents. The size of this buffer is typically 10. The - // last N events generated from the sensor are stored in this buffer. The buffer is NOT - // cleared when the sensor unregisters and as a result one may see very old data in the - // dumpsys output but this is WAI. - class CircularBuffer { - int mNextInd; - int mSensorType; - int mBufSize; - TrimmedSensorEvent ** mTrimmedSensorEventArr; - public: - CircularBuffer(int sensor_event_type); - void addEvent(const sensors_event_t& sensor_event); - void printBuffer(String8& buffer) const; - bool populateLastEvent(sensors_event_t *event); - ~CircularBuffer(); - }; - - struct SensorRegistrationInfo { - int32_t mSensorHandle; - String8 mPackageName; - bool mActivated; - int32_t mSamplingRateUs; - int32_t mMaxReportLatencyUs; - int32_t mHour, mMin, mSec; - - SensorRegistrationInfo() : mPackageName() { - mSensorHandle = mSamplingRateUs = mMaxReportLatencyUs = INT32_MIN; - mHour = mMin = mSec = INT32_MIN; - mActivated = false; - } - - static bool isSentinel(const SensorRegistrationInfo& info) { - return (info.mHour == INT32_MIN && info.mMin == INT32_MIN && info.mSec == INT32_MIN); - } - }; - - static int getNumEventsForSensorType(int sensor_event_type); - String8 getSensorName(int handle) const; - bool isVirtualSensor(int handle) const; - Sensor getSensorFromHandle(int handle) const; - bool isWakeUpSensor(int type) const; - void recordLastValueLocked(sensors_event_t const* buffer, size_t count); - static void sortEventBuffer(sensors_event_t* buffer, size_t count); - Sensor registerSensor(SensorInterface* sensor); - Sensor registerVirtualSensor(SensorInterface* sensor); - status_t cleanupWithoutDisable( - const sp& connection, int handle); - status_t cleanupWithoutDisableLocked( - const sp& connection, int handle); - void cleanupAutoDisabledSensorLocked(const sp& connection, - sensors_event_t const* buffer, const int count); - static bool canAccessSensor(const Sensor& sensor, const char* operation, - const String16& opPackageName); - // SensorService acquires a partial wakelock for delivering events from wake up sensors. This - // method checks whether all the events from these wake up sensors have been delivered to the - // corresponding applications, if yes the wakelock is released. - void checkWakeLockState(); - void checkWakeLockStateLocked(); - bool isWakeLockAcquired(); - bool isWakeUpSensorEvent(const sensors_event_t& event) const; - - SensorRecord * getSensorRecord(int handle); - - sp getLooper() const; - - // Reset mWakeLockRefCounts for all SensorEventConnections to zero. This may happen if - // SensorService did not receive any acknowledgements from apps which have registered for - // wake_up sensors. - void resetAllWakeLockRefCounts(); - - // Acquire or release wake_lock. If wake_lock is acquired, set the timeout in the looper to - // 5 seconds and wake the looper. - void setWakeLockAcquiredLocked(bool acquire); - - // Send events from the event cache for this particular connection. - void sendEventsFromCache(const sp& connection); - - // Promote all weak referecences in mActiveConnections vector to strong references and add them - // to the output vector. - void populateActiveConnections(SortedVector< sp >* activeConnections); - - // If SensorService is operating in RESTRICTED mode, only select whitelisted packages are - // allowed to register for or call flush on sensors. Typically only cts test packages are - // allowed. - bool isWhiteListedPackage(const String8& packageName); - - // Reset the state of SensorService to NORMAL mode. - status_t resetToNormalMode(); - status_t resetToNormalModeLocked(); - - // constants - Vector mSensorList; - Vector mUserSensorListDebug; - Vector mUserSensorList; - DefaultKeyedVector mSensorMap; - Vector mVirtualSensorList; - status_t mInitCheck; - // Socket buffersize used to initialize BitTube. This size depends on whether batching is - // supported or not. - uint32_t mSocketBufferSize; - sp mLooper; - sp mAckReceiver; - - // protected by mLock - mutable Mutex mLock; - DefaultKeyedVector mActiveSensors; - DefaultKeyedVector mActiveVirtualSensors; - SortedVector< wp > mActiveConnections; - bool mWakeLockAcquired; - sensors_event_t *mSensorEventBuffer, *mSensorEventScratch; - SensorEventConnection const **mMapFlushEventsToConnections; - Mode mCurrentOperatingMode; - // This packagaName is set when SensorService is in RESTRICTED or DATA_INJECTION mode. Only - // applications with this packageName are allowed to activate/deactivate or call flush on - // sensors. To run CTS this is can be set to ".cts." and only CTS tests will get access to - // sensors. - String8 mWhiteListedPackage; - - // The size of this vector is constant, only the items are mutable - KeyedVector mLastEventSeen; - - int mNextSensorRegIndex; - Vector mLastNSensorRegistrations; -public: - void cleanupConnection(SensorEventConnection* connection); - status_t enable(const sp& connection, int handle, - nsecs_t samplingPeriodNs, nsecs_t maxBatchReportLatencyNs, int reservedFlags, - const String16& opPackageName); - status_t disable(const sp& connection, int handle); - status_t setEventRate(const sp& connection, int handle, nsecs_t ns, - const String16& opPackageName); - status_t flushSensor(const sp& connection, - const String16& opPackageName); -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SENSOR_SERVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/tests/Android.mk android-platform-frameworks-native-21/services/sensorservice/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/tests/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/tests/Android.mk 1970-01-01 00:00:00.000000000 +0000 @@ -1,14 +0,0 @@ -LOCAL_PATH:= $(call my-dir) -include $(CLEAR_VARS) - -LOCAL_SRC_FILES:= \ - sensorservicetest.cpp - -LOCAL_SHARED_LIBRARIES := \ - libcutils libutils libui libgui - -LOCAL_MODULE:= test-sensorservice - -LOCAL_MODULE_TAGS := optional - -include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/tests/sensorservicetest.cpp android-platform-frameworks-native-21/services/sensorservice/tests/sensorservicetest.cpp --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/tests/sensorservicetest.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/tests/sensorservicetest.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,111 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include -#include -#include -#include - -using namespace android; - -static nsecs_t sStartTime = 0; - - -int receiver(__unused int fd, __unused int events, void* data) -{ - sp q((SensorEventQueue*)data); - ssize_t n; - ASensorEvent buffer[8]; - - static nsecs_t oldTimeStamp = 0; - - while ((n = q->read(buffer, 8)) > 0) { - for (int i=0 ; i q = mgr.createEventQueue(); - printf("queue=%p\n", q.get()); - - Sensor const* accelerometer = mgr.getDefaultSensor(Sensor::TYPE_ACCELEROMETER); - printf("accelerometer=%p (%s)\n", - accelerometer, accelerometer->getName().string()); - - sStartTime = systemTime(); - - q->enableSensor(accelerometer); - - q->setEventRate(accelerometer, ms2ns(10)); - - sp loop = new Looper(false); - loop->addFd(q->getFd(), 0, ALOOPER_EVENT_INPUT, receiver, q.get()); - - do { - //printf("about to poll...\n"); - int32_t ret = loop->pollOnce(-1); - switch (ret) { - case ALOOPER_POLL_WAKE: - //("ALOOPER_POLL_WAKE\n"); - break; - case ALOOPER_POLL_CALLBACK: - //("ALOOPER_POLL_CALLBACK\n"); - break; - case ALOOPER_POLL_TIMEOUT: - printf("ALOOPER_POLL_TIMEOUT\n"); - break; - case ALOOPER_POLL_ERROR: - printf("ALOOPER_POLL_TIMEOUT\n"); - break; - default: - printf("ugh? poll returned %d\n", ret); - break; - } - } while (1); - - - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/traits.h android-platform-frameworks-native-21/services/sensorservice/traits.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/traits.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/traits.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,118 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_TRAITS_H -#define ANDROID_TRAITS_H - -// ----------------------------------------------------------------------- -// Typelists - -namespace android { - -// end-of-list marker -class NullType {}; - -// type-list node -template -struct TypeList { - typedef T Head; - typedef U Tail; -}; - -// helpers to build typelists -#define TYPELIST_1(T1) TypeList -#define TYPELIST_2(T1, T2) TypeList -#define TYPELIST_3(T1, T2, T3) TypeList -#define TYPELIST_4(T1, T2, T3, T4) TypeList - -// typelists algorithms -namespace TL { -template struct IndexOf; - -template -struct IndexOf { - enum { value = -1 }; -}; - -template -struct IndexOf, T> { - enum { value = 0 }; -}; - -template -struct IndexOf, T> { -private: - enum { temp = IndexOf::value }; -public: - enum { value = temp == -1 ? -1 : 1 + temp }; -}; - -}; // namespace TL - -// type selection based on a boolean -template -struct Select { - typedef T Result; -}; -template -struct Select { - typedef U Result; -}; - -// ----------------------------------------------------------------------- -// Type traits - -template -class TypeTraits { - typedef TYPELIST_4( - unsigned char, unsigned short, - unsigned int, unsigned long int) UnsignedInts; - - typedef TYPELIST_4( - signed char, signed short, - signed int, signed long int) SignedInts; - - typedef TYPELIST_1( - bool) OtherInts; - - typedef TYPELIST_3( - float, double, long double) Floats; - - template struct PointerTraits { - enum { result = false }; - typedef NullType PointeeType; - }; - template struct PointerTraits { - enum { result = true }; - typedef U PointeeType; - }; - -public: - enum { isStdUnsignedInt = TL::IndexOf::value >= 0 }; - enum { isStdSignedInt = TL::IndexOf::value >= 0 }; - enum { isStdIntegral = TL::IndexOf::value >= 0 || isStdUnsignedInt || isStdSignedInt }; - enum { isStdFloat = TL::IndexOf::value >= 0 }; - enum { isPointer = PointerTraits::result }; - enum { isStdArith = isStdIntegral || isStdFloat }; - - // best parameter type for given type - typedef typename Select::Result ParameterType; -}; - -// ----------------------------------------------------------------------- -}; // namespace android - -#endif /* ANDROID_TRAITS_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/sensorservice/vec.h android-platform-frameworks-native-21/services/sensorservice/vec.h --- android-platform-frameworks-native-6.0.1+r16/services/sensorservice/vec.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/sensorservice/vec.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,438 +0,0 @@ -/* - * 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. - */ - -#ifndef ANDROID_VEC_H -#define ANDROID_VEC_H - -#include - -#include -#include - -#include "traits.h" - -// ----------------------------------------------------------------------- - -#define PURE __attribute__((pure)) - -namespace android { - -// ----------------------------------------------------------------------- -// non-inline helpers - -template -class vec; - -template -class vbase; - -namespace helpers { - -template inline T min(T a, T b) { return a inline T max(T a, T b) { return a>b ? a : b; } - -template < template class VEC, - typename TYPE, size_t SIZE, size_t S> -vec& doAssign( - vec& lhs, const VEC& rhs) { - const size_t minSize = min(SIZE, S); - const size_t maxSize = max(SIZE, S); - for (size_t i=0 ; i class VLHS, - template class VRHS, - typename TYPE, - size_t SIZE -> -VLHS PURE doAdd( - const VLHS& lhs, - const VRHS& rhs) { - VLHS r; - for (size_t i=0 ; i class VLHS, - template class VRHS, - typename TYPE, - size_t SIZE -> -VLHS PURE doSub( - const VLHS& lhs, - const VRHS& rhs) { - VLHS r; - for (size_t i=0 ; i class VEC, - typename TYPE, - size_t SIZE -> -VEC PURE doMulScalar( - const VEC& lhs, - typename TypeTraits::ParameterType rhs) { - VEC r; - for (size_t i=0 ; i class VEC, - typename TYPE, - size_t SIZE -> -VEC PURE doScalarMul( - typename TypeTraits::ParameterType lhs, - const VEC& rhs) { - VEC r; - for (size_t i=0 ; i. Without this, an extra conversion to vec<> would be needed. -// -// example: -// vec4_t a; -// vec3_t b; -// vec3_t c = a.xyz + b; -// -// "a.xyz + b" is a mixed-operation between a vbase<> and a vec<>, requiring -// a conversion of vbase<> to vec<>. The template gunk below avoids this, -// by allowing the addition on these different vector types directly -// - -template < - template class VLHS, - template class VRHS, - typename TYPE, - size_t SIZE -> -inline VLHS PURE operator + ( - const VLHS& lhs, - const VRHS& rhs) { - return helpers::doAdd(lhs, rhs); -} - -template < - template class VLHS, - template class VRHS, - typename TYPE, - size_t SIZE -> -inline VLHS PURE operator - ( - const VLHS& lhs, - const VRHS& rhs) { - return helpers::doSub(lhs, rhs); -} - -template < - template class VEC, - typename TYPE, - size_t SIZE -> -inline VEC PURE operator * ( - const VEC& lhs, - typename TypeTraits::ParameterType rhs) { - return helpers::doMulScalar(lhs, rhs); -} - -template < - template class VEC, - typename TYPE, - size_t SIZE -> -inline VEC PURE operator * ( - typename TypeTraits::ParameterType lhs, - const VEC& rhs) { - return helpers::doScalarMul(lhs, rhs); -} - - -template < - template class VLHS, - template class VRHS, - typename TYPE, - size_t SIZE -> -TYPE PURE dot_product( - const VLHS& lhs, - const VRHS& rhs) { - TYPE r(0); - for (size_t i=0 ; i class V, - typename TYPE, - size_t SIZE -> -TYPE PURE length(const V& v) { - return sqrt(dot_product(v, v)); -} - -template < - template class V, - typename TYPE, - size_t SIZE -> -TYPE PURE length_squared(const V& v) { - return dot_product(v, v); -} - -template < - template class V, - typename TYPE, - size_t SIZE -> -V PURE normalize(const V& v) { - return v * (1/length(v)); -} - -template < - template class VLHS, - template class VRHS, - typename TYPE -> -VLHS PURE cross_product( - const VLHS& u, - const VRHS& v) { - VLHS r; - r.x = u.y*v.z - u.z*v.y; - r.y = u.z*v.x - u.x*v.z; - r.z = u.x*v.y - u.y*v.x; - return r; -} - - -template -vec PURE operator - (const vec& lhs) { - vec r; - for (size_t i=0 ; i -struct vbase { - TYPE v[SIZE]; - inline const TYPE& operator[](size_t i) const { return v[i]; } - inline TYPE& operator[](size_t i) { return v[i]; } -}; -template<> struct vbase { - union { - float v[2]; - struct { float x, y; }; - struct { float s, t; }; - }; - inline const float& operator[](size_t i) const { return v[i]; } - inline float& operator[](size_t i) { return v[i]; } -}; -template<> struct vbase { - union { - float v[3]; - struct { float x, y, z; }; - struct { float s, t, r; }; - vbase xy; - vbase st; - }; - inline const float& operator[](size_t i) const { return v[i]; } - inline float& operator[](size_t i) { return v[i]; } -}; -template<> struct vbase { - union { - float v[4]; - struct { float x, y, z, w; }; - struct { float s, t, r, q; }; - vbase xyz; - vbase str; - vbase xy; - vbase st; - }; - inline const float& operator[](size_t i) const { return v[i]; } - inline float& operator[](size_t i) { return v[i]; } -}; - -// ----------------------------------------------------------------------- - -template -class vec : public vbase -{ - typedef typename TypeTraits::ParameterType pTYPE; - typedef vbase base; - -public: - // STL-like interface. - typedef TYPE value_type; - typedef TYPE& reference; - typedef TYPE const& const_reference; - typedef size_t size_type; - - typedef TYPE* iterator; - typedef TYPE const* const_iterator; - iterator begin() { return base::v; } - iterator end() { return base::v + SIZE; } - const_iterator begin() const { return base::v; } - const_iterator end() const { return base::v + SIZE; } - size_type size() const { return SIZE; } - - // ----------------------------------------------------------------------- - // default constructors - - vec() { } - vec(const vec& rhs) : base(rhs) { } - vec(const base& rhs) : base(rhs) { } - - // ----------------------------------------------------------------------- - // conversion constructors - - vec(pTYPE rhs) { - for (size_t i=0 ; i class VEC, size_t S> - explicit vec(const VEC& rhs) { - helpers::doAssign(*this, rhs); - } - - explicit vec(TYPE const* array) { - for (size_t i=0 ; i class VEC, size_t S> - vec& operator = (const VEC& rhs) { - return helpers::doAssign(*this, rhs); - } - - // ----------------------------------------------------------------------- - // operation-assignment - - vec& operator += (const vec& rhs); - vec& operator -= (const vec& rhs); - vec& operator *= (pTYPE rhs); - - // ----------------------------------------------------------------------- - // non-member function declaration and definition - // NOTE: we declare the non-member function as friend inside the class - // so that they are known to the compiler when the class is instantiated. - // This helps the compiler doing template argument deduction when the - // passed types are not identical. Essentially this helps with - // type conversion so that you can multiply a vec by an scalar int - // (for instance). - - friend inline vec PURE operator + (const vec& lhs, const vec& rhs) { - return helpers::doAdd(lhs, rhs); - } - friend inline vec PURE operator - (const vec& lhs, const vec& rhs) { - return helpers::doSub(lhs, rhs); - } - friend inline vec PURE operator * (const vec& lhs, pTYPE v) { - return helpers::doMulScalar(lhs, v); - } - friend inline vec PURE operator * (pTYPE v, const vec& rhs) { - return helpers::doScalarMul(v, rhs); - } - friend inline TYPE PURE dot_product(const vec& lhs, const vec& rhs) { - return android::dot_product(lhs, rhs); - } -}; - -// ----------------------------------------------------------------------- - -template -vec& vec::operator += (const vec& rhs) { - vec& lhs(*this); - for (size_t i=0 ; i -vec& vec::operator -= (const vec& rhs) { - vec& lhs(*this); - for (size_t i=0 ; i -vec& vec::operator *= (vec::pTYPE rhs) { - vec& lhs(*this); - for (size_t i=0 ; i vec2_t; -typedef vec vec3_t; -typedef vec vec4_t; - -// ----------------------------------------------------------------------- - -}; // namespace android - -#endif /* ANDROID_VEC_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Android.mk android-platform-frameworks-native-21/services/surfaceflinger/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,171 +1,58 @@ -LOCAL_PATH := $(call my-dir) +LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_CLANG := true +LOCAL_SRC_FILES:= \ + EventThread.cpp \ + Layer.cpp \ + LayerBase.cpp \ + LayerDim.cpp \ + LayerScreenshot.cpp \ + DisplayHardware/DisplayHardware.cpp \ + DisplayHardware/DisplayHardwareBase.cpp \ + DisplayHardware/HWComposer.cpp \ + DisplayHardware/PowerHAL.cpp \ + GLExtensions.cpp \ + MessageQueue.cpp \ + SurfaceFlinger.cpp \ + SurfaceTextureLayer.cpp \ + Transform.cpp \ + -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk -LOCAL_SRC_FILES := \ - Client.cpp \ - DisplayDevice.cpp \ - DispSync.cpp \ - EventControlThread.cpp \ - EventThread.cpp \ - FrameTracker.cpp \ - Layer.cpp \ - LayerDim.cpp \ - MessageQueue.cpp \ - MonitoredProducer.cpp \ - SurfaceFlinger.cpp \ - SurfaceFlingerConsumer.cpp \ - Transform.cpp \ - DisplayHardware/FramebufferSurface.cpp \ - DisplayHardware/HWComposer.cpp \ - DisplayHardware/PowerHAL.cpp \ - DisplayHardware/VirtualDisplaySurface.cpp \ - Effects/Daltonizer.cpp \ - EventLog/EventLogTags.logtags \ - EventLog/EventLog.cpp \ - RenderEngine/Description.cpp \ - RenderEngine/Mesh.cpp \ - RenderEngine/Program.cpp \ - RenderEngine/ProgramCache.cpp \ - RenderEngine/GLExtensions.cpp \ - RenderEngine/RenderEngine.cpp \ - RenderEngine/Texture.cpp \ - RenderEngine/GLES10RenderEngine.cpp \ - RenderEngine/GLES11RenderEngine.cpp \ - RenderEngine/GLES20RenderEngine.cpp - - -LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\" +LOCAL_CFLAGS:= -DLOG_TAG=\"SurfaceFlinger\" LOCAL_CFLAGS += -DGL_GLEXT_PROTOTYPES -DEGL_EGLEXT_PROTOTYPES -ifeq ($(TARGET_BOARD_PLATFORM),omap4) - LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -endif -ifeq ($(TARGET_BOARD_PLATFORM),s5pc110) - LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY -endif - -ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING),true) - LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING -endif - -ifeq ($(TARGET_FORCE_HWC_FOR_VIRTUAL_DISPLAYS),true) - LOCAL_CFLAGS += -DFORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS -endif - -ifneq ($(NUM_FRAMEBUFFER_SURFACE_BUFFERS),) - LOCAL_CFLAGS += -DNUM_FRAMEBUFFER_SURFACE_BUFFERS=$(NUM_FRAMEBUFFER_SURFACE_BUFFERS) -endif - -ifeq ($(TARGET_RUNNING_WITHOUT_SYNC_FRAMEWORK),true) - LOCAL_CFLAGS += -DRUNNING_WITHOUT_SYNC_FRAMEWORK +ifeq ($(TARGET_BOARD_PLATFORM), omap3) + LOCAL_CFLAGS += -DNO_RGBX_8888 endif - -# See build/target/board/generic/BoardConfig.mk for a description of this setting. -ifneq ($(VSYNC_EVENT_PHASE_OFFSET_NS),) - LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=$(VSYNC_EVENT_PHASE_OFFSET_NS) -else - LOCAL_CFLAGS += -DVSYNC_EVENT_PHASE_OFFSET_NS=0 +ifeq ($(TARGET_BOARD_PLATFORM), omap4) + LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY endif - -# See build/target/board/generic/BoardConfig.mk for a description of this setting. -ifneq ($(SF_VSYNC_EVENT_PHASE_OFFSET_NS),) - LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=$(SF_VSYNC_EVENT_PHASE_OFFSET_NS) -else - LOCAL_CFLAGS += -DSF_VSYNC_EVENT_PHASE_OFFSET_NS=0 -endif - -ifneq ($(PRESENT_TIME_OFFSET_FROM_VSYNC_NS),) - LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=$(PRESENT_TIME_OFFSET_FROM_VSYNC_NS) -else - LOCAL_CFLAGS += -DPRESENT_TIME_OFFSET_FROM_VSYNC_NS=0 +ifeq ($(TARGET_BOARD_PLATFORM), s5pc110) + LOCAL_CFLAGS += -DHAS_CONTEXT_PRIORITY + LOCAL_CFLAGS += -DNEVER_DEFAULT_TO_ASYNC_MODE endif -ifneq ($(MAX_VIRTUAL_DISPLAY_DIMENSION),) - LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=$(MAX_VIRTUAL_DISPLAY_DIMENSION) -else - LOCAL_CFLAGS += -DMAX_VIRTUAL_DISPLAY_DIMENSION=0 +ifeq ($(TARGET_DISABLE_TRIPLE_BUFFERING), true) + LOCAL_CFLAGS += -DTARGET_DISABLE_TRIPLE_BUFFERING endif -LOCAL_CFLAGS += -fvisibility=hidden -Werror=format -LOCAL_CFLAGS += -std=c++11 - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - liblog \ - libdl \ - libhardware \ - libutils \ - libEGL \ - libGLESv1_CM \ - libGLESv2 \ - libbinder \ - libui \ - libgui \ - libpowermanager - -LOCAL_MODULE := libsurfaceflinger - -LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code - -include $(BUILD_SHARED_LIBRARY) - -############################################################### -# build surfaceflinger's executable -include $(CLEAR_VARS) - -LOCAL_CLANG := true - -LOCAL_LDFLAGS := -Wl,--version-script,art/sigchainlib/version-script.txt -Wl,--export-dynamic -LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\" -LOCAL_CPPFLAGS := -std=c++11 - -LOCAL_SRC_FILES := \ - main_surfaceflinger.cpp - LOCAL_SHARED_LIBRARIES := \ - libsurfaceflinger \ - libcutils \ - liblog \ - libbinder \ - libutils \ - libdl - -LOCAL_WHOLE_STATIC_LIBRARIES := libsigchain - -LOCAL_MODULE := surfaceflinger - -ifdef TARGET_32_BIT_SURFACEFLINGER -LOCAL_32_BIT_ONLY := true + libcutils \ + libhardware \ + libutils \ + libEGL \ + libGLESv1_CM \ + libbinder \ + libui \ + libgui + +# this is only needed for DDMS debugging +ifneq ($(TARGET_BUILD_PDK), true) + LOCAL_SHARED_LIBRARIES += libdvm libandroid_runtime + LOCAL_CLFAGS += -DDDMS_DEBUGGING + LOCAL_SRC_FILES += DdmConnection.cpp endif -LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code - -include $(BUILD_EXECUTABLE) - -############################################################### -# uses jni which may not be available in PDK -ifneq ($(wildcard libnativehelper/include),) -include $(CLEAR_VARS) - -LOCAL_CLANG := true - -LOCAL_CFLAGS := -DLOG_TAG=\"SurfaceFlinger\" -LOCAL_CPPFLAGS := -std=c++11 - -LOCAL_SRC_FILES := \ - DdmConnection.cpp - -LOCAL_SHARED_LIBRARIES := \ - libcutils \ - liblog \ - libdl - -LOCAL_MODULE := libsurfaceflinger_ddmconnection - -LOCAL_CFLAGS += -Wall -Werror -Wunused -Wunreachable-code +LOCAL_MODULE:= libsurfaceflinger include $(BUILD_SHARED_LIBRARY) -endif # libnativehelper diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Barrier.h android-platform-frameworks-native-21/services/surfaceflinger/Barrier.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Barrier.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Barrier.h 2012-10-16 22:57:11.000000000 +0000 @@ -28,25 +28,15 @@ public: inline Barrier() : state(CLOSED) { } inline ~Barrier() { } - - // Release any threads waiting at the Barrier. - // Provides release semantics: preceding loads and stores will be visible - // to other threads before they wake up. void open() { Mutex::Autolock _l(lock); state = OPENED; cv.broadcast(); } - - // Reset the Barrier, so wait() will block until open() has been called. void close() { Mutex::Autolock _l(lock); state = CLOSED; } - - // Wait until the Barrier is OPEN. - // Provides acquire semantics: no subsequent loads or stores will occur - // until wait() returns. void wait() const { Mutex::Autolock _l(lock); while (state == CLOSED) { diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Client.cpp android-platform-frameworks-native-21/services/surfaceflinger/Client.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Client.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Client.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,177 +0,0 @@ -/* - * Copyright (C) 2012 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 -#include - -#include -#include - -#include - -#include "Client.h" -#include "Layer.h" -#include "SurfaceFlinger.h" - -namespace android { - -// --------------------------------------------------------------------------- - -const String16 sAccessSurfaceFlinger("android.permission.ACCESS_SURFACE_FLINGER"); - -// --------------------------------------------------------------------------- - -Client::Client(const sp& flinger) - : mFlinger(flinger) -{ -} - -Client::~Client() -{ - const size_t count = mLayers.size(); - for (size_t i=0 ; i layer(mLayers.valueAt(i).promote()); - if (layer != 0) { - mFlinger->removeLayer(layer); - } - } -} - -status_t Client::initCheck() const { - return NO_ERROR; -} - -void Client::attachLayer(const sp& handle, const sp& layer) -{ - Mutex::Autolock _l(mLock); - mLayers.add(handle, layer); -} - -void Client::detachLayer(const Layer* layer) -{ - Mutex::Autolock _l(mLock); - // we do a linear search here, because this doesn't happen often - const size_t count = mLayers.size(); - for (size_t i=0 ; i Client::getLayerUser(const sp& handle) const -{ - Mutex::Autolock _l(mLock); - sp lbc; - wp layer(mLayers.valueFor(handle)); - if (layer != 0) { - lbc = layer.promote(); - ALOGE_IF(lbc==0, "getLayerUser(name=%p) is dead", handle.get()); - } - return lbc; -} - - -status_t Client::onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) -{ - // these must be checked - IPCThreadState* ipc = IPCThreadState::self(); - const int pid = ipc->getCallingPid(); - const int uid = ipc->getCallingUid(); - const int self_pid = getpid(); - if (CC_UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != AID_SYSTEM && uid != 0)) { - // we're called from a different process, do the real check - if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger)) - { - ALOGE("Permission Denial: " - "can't openGlobalTransaction pid=%d, uid=%d", pid, uid); - return PERMISSION_DENIED; - } - } - return BnSurfaceComposerClient::onTransact(code, data, reply, flags); -} - - -status_t Client::createSurface( - const String8& name, - uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, - sp* handle, - sp* gbp) -{ - /* - * createSurface must be called from the GL thread so that it can - * have access to the GL context. - */ - - class MessageCreateLayer : public MessageBase { - SurfaceFlinger* flinger; - Client* client; - sp* handle; - sp* gbp; - status_t result; - const String8& name; - uint32_t w, h; - PixelFormat format; - uint32_t flags; - public: - MessageCreateLayer(SurfaceFlinger* flinger, - const String8& name, Client* client, - uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, - sp* handle, - sp* gbp) - : flinger(flinger), client(client), - handle(handle), gbp(gbp), - name(name), w(w), h(h), format(format), flags(flags) { - } - status_t getResult() const { return result; } - virtual bool handler() { - result = flinger->createLayer(name, client, w, h, format, flags, - handle, gbp); - return true; - } - }; - - sp msg = new MessageCreateLayer(mFlinger.get(), - name, this, w, h, format, flags, handle, gbp); - mFlinger->postMessageSync(msg); - return static_cast( msg.get() )->getResult(); -} - -status_t Client::destroySurface(const sp& handle) { - return mFlinger->onLayerRemoved(this, handle); -} - -status_t Client::clearLayerFrameStats(const sp& handle) const { - sp layer = getLayerUser(handle); - if (layer == NULL) { - return NAME_NOT_FOUND; - } - layer->clearFrameStats(); - return NO_ERROR; -} - -status_t Client::getLayerFrameStats(const sp& handle, FrameStats* outStats) const { - sp layer = getLayerUser(handle); - if (layer == NULL) { - return NAME_NOT_FOUND; - } - layer->getFrameStats(outStats); - return NO_ERROR; -} - -// --------------------------------------------------------------------------- -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Client.h android-platform-frameworks-native-21/services/surfaceflinger/Client.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Client.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Client.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_SF_CLIENT_H -#define ANDROID_SF_CLIENT_H - -#include -#include - -#include -#include -#include - -#include - -namespace android { - -// --------------------------------------------------------------------------- - -class Layer; -class SurfaceFlinger; - -// --------------------------------------------------------------------------- - -class Client : public BnSurfaceComposerClient -{ -public: - Client(const sp& flinger); - ~Client(); - - status_t initCheck() const; - - // protected by SurfaceFlinger::mStateLock - void attachLayer(const sp& handle, const sp& layer); - - void detachLayer(const Layer* layer); - - sp getLayerUser(const sp& handle) const; - -private: - // ISurfaceComposerClient interface - virtual status_t createSurface( - const String8& name, - uint32_t w, uint32_t h,PixelFormat format, uint32_t flags, - sp* handle, - sp* gbp); - - virtual status_t destroySurface(const sp& handle); - - virtual status_t clearLayerFrameStats(const sp& handle) const; - - virtual status_t getLayerFrameStats(const sp& handle, FrameStats* outStats) const; - - virtual status_t onTransact( - uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); - - // constant - sp mFlinger; - - // protected by mLock - DefaultKeyedVector< wp, wp > mLayers; - - // thread-safe - mutable Mutex mLock; -}; - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SF_CLIENT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/clz.cpp android-platform-frameworks-native-21/services/surfaceflinger/clz.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/clz.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/clz.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,37 @@ +/* + * Copyright (C) 2007 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 "clz.h" + +namespace android { + +int clz_impl(int32_t x) +{ +#if defined(__arm__) && !defined(__thumb__) + return __builtin_clz(x); +#else + if (!x) return 32; + int e = 31; + if (x&0xFFFF0000) { e -=16; x >>=16; } + if (x&0x0000FF00) { e -= 8; x >>= 8; } + if (x&0x000000F0) { e -= 4; x >>= 4; } + if (x&0x0000000C) { e -= 2; x >>= 2; } + if (x&0x00000002) { e -= 1; } + return e; +#endif +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Colorizer.h android-platform-frameworks-native-21/services/surfaceflinger/Colorizer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Colorizer.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Colorizer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,65 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SURFACE_FLINGER_COLORIZER_H -#define ANDROID_SURFACE_FLINGER_COLORIZER_H - -namespace android { - -// --------------------------------------------------------------------------- - -class Colorizer { - bool mEnabled; -public: - enum color { - RED = 31, - GREEN = 32, - YELLOW = 33, - BLUE = 34, - MAGENTA = 35, - CYAN = 36, - WHITE = 37 - }; - - Colorizer(bool enabled) - : mEnabled(enabled) { - } - - void colorize(String8& out, color c) { - if (mEnabled) { - out.appendFormat("\e[%dm", c); - } - } - - void bold(String8& out) { - if (mEnabled) { - out.append("\e[1m"); - } - } - - void reset(String8& out) { - if (mEnabled) { - out.append("\e[0m"); - } - } -}; - -// --------------------------------------------------------------------------- - -}; // namespace android - - -#endif /* ANDROID_SURFACE_FLINGER_COLORIZER_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DdmConnection.cpp android-platform-frameworks-native-21/services/surfaceflinger/DdmConnection.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DdmConnection.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DdmConnection.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -14,19 +14,15 @@ * limitations under the License. */ -#include - -#include +#include #include "jni.h" #include "DdmConnection.h" -namespace android { +extern "C" jint Java_com_android_internal_util_WithFramework_registerNatives( + JNIEnv* env, jclass clazz); -void DdmConnection_start(const char* name) { - ALOGI("DdmConnection_start"); - DdmConnection::start(name); -} +namespace android { void DdmConnection::start(const char* name) { JavaVM* vm; @@ -44,49 +40,20 @@ args.nOptions = 1; args.ignoreUnrecognized = JNI_FALSE; - - // TODO: Should this just link against libnativehelper and use its - // JNI_CreateJavaVM wrapper that essential does this dlopen/dlsym - // work based on the current system default runtime? - void* libart_dso = dlopen("libart.so", RTLD_NOW); - ALOGE_IF(!libart_dso, "DdmConnection: %s", dlerror()); - - void* libandroid_runtime_dso = dlopen("libandroid_runtime.so", RTLD_NOW); - ALOGE_IF(!libandroid_runtime_dso, "DdmConnection: %s", dlerror()); - - if (!libart_dso || !libandroid_runtime_dso) { - goto error; - } - - jint (*JNI_CreateJavaVM)(JavaVM** p_vm, JNIEnv** p_env, void* vm_args); - JNI_CreateJavaVM = reinterpret_cast( - dlsym(libart_dso, "JNI_CreateJavaVM")); - ALOGE_IF(!JNI_CreateJavaVM, "DdmConnection: %s", dlerror()); - - jint (*registerNatives)(JNIEnv* env, jclass clazz); - registerNatives = reinterpret_cast( - dlsym(libandroid_runtime_dso, - "Java_com_android_internal_util_WithFramework_registerNatives")); - ALOGE_IF(!registerNatives, "DdmConnection: %s", dlerror()); - - if (!JNI_CreateJavaVM || !registerNatives) { - goto error; - } - if (JNI_CreateJavaVM(&vm, &env, &args) == 0) { jclass startClass; jmethodID startMeth; // register native code - if (registerNatives(env, 0) == 0) { + if (Java_com_android_internal_util_WithFramework_registerNatives(env, 0) == 0) { // set our name by calling DdmHandleAppName.setAppName() startClass = env->FindClass("android/ddm/DdmHandleAppName"); if (startClass) { startMeth = env->GetStaticMethodID(startClass, - "setAppName", "(Ljava/lang/String;I)V"); + "setAppName", "(Ljava/lang/String;)V"); if (startMeth) { jstring str = env->NewStringUTF(name); - env->CallStaticVoidMethod(startClass, startMeth, str, getuid()); + env->CallStaticVoidMethod(startClass, startMeth, str); env->DeleteLocalRef(str); } } @@ -103,15 +70,6 @@ } } } - return; - -error: - if (libandroid_runtime_dso) { - dlclose(libandroid_runtime_dso); - } - if (libart_dso) { - dlclose(libart_dso); - } } }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DdmConnection.h android-platform-frameworks-native-21/services/surfaceflinger/DdmConnection.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DdmConnection.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DdmConnection.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,9 +19,6 @@ namespace android { -// wrapper for dlsym -extern "C" void DdmConnection_start(const char* name); - class DdmConnection { public: static void start(const char* name); diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayDevice.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayDevice.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayDevice.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayDevice.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,522 +0,0 @@ -/* - * Copyright (C) 2007 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 -#include -#include -#include - -#include - -#include -#include - -#include -#include - -#include - -#include - -#include "DisplayHardware/DisplaySurface.h" -#include "DisplayHardware/HWComposer.h" -#include "RenderEngine/RenderEngine.h" - -#include "clz.h" -#include "DisplayDevice.h" -#include "SurfaceFlinger.h" -#include "Layer.h" - -// ---------------------------------------------------------------------------- -using namespace android; -// ---------------------------------------------------------------------------- - -#ifdef EGL_ANDROID_swap_rectangle -static constexpr bool kEGLAndroidSwapRectangle = true; -#else -static constexpr bool kEGLAndroidSwapRectangle = false; -#endif - -#if !defined(EGL_EGLEXT_PROTOTYPES) || !defined(EGL_ANDROID_swap_rectangle) -// Dummy implementation in case it is missing. -inline void eglSetSwapRectangleANDROID (EGLDisplay, EGLSurface, EGLint, EGLint, EGLint, EGLint) { -} -#endif - -/* - * Initialize the display to the specified values. - * - */ - -DisplayDevice::DisplayDevice( - const sp& flinger, - DisplayType type, - int32_t hwcId, - int format, - bool isSecure, - const wp& displayToken, - const sp& displaySurface, - const sp& producer, - EGLConfig config) - : lastCompositionHadVisibleLayers(false), - mFlinger(flinger), - mType(type), mHwcDisplayId(hwcId), - mDisplayToken(displayToken), - mDisplaySurface(displaySurface), - mDisplay(EGL_NO_DISPLAY), - mSurface(EGL_NO_SURFACE), - mDisplayWidth(), mDisplayHeight(), mFormat(), - mFlags(), - mPageFlipCount(), - mIsSecure(isSecure), - mSecureLayerVisible(false), - mLayerStack(NO_LAYER_STACK), - mOrientation(), - mPowerMode(HWC_POWER_MODE_OFF), - mActiveConfig(0) -{ - mNativeWindow = new Surface(producer, false); - ANativeWindow* const window = mNativeWindow.get(); - - /* - * Create our display's surface - */ - - EGLSurface surface; - EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - if (config == EGL_NO_CONFIG) { - config = RenderEngine::chooseEglConfig(display, format); - } - surface = eglCreateWindowSurface(display, config, window, NULL); - eglQuerySurface(display, surface, EGL_WIDTH, &mDisplayWidth); - eglQuerySurface(display, surface, EGL_HEIGHT, &mDisplayHeight); - - // Make sure that composition can never be stalled by a virtual display - // consumer that isn't processing buffers fast enough. We have to do this - // in two places: - // * Here, in case the display is composed entirely by HWC. - // * In makeCurrent(), using eglSwapInterval. Some EGL drivers set the - // window's swap interval in eglMakeCurrent, so they'll override the - // interval we set here. - if (mType >= DisplayDevice::DISPLAY_VIRTUAL) - window->setSwapInterval(window, 0); - - mConfig = config; - mDisplay = display; - mSurface = surface; - mFormat = format; - mPageFlipCount = 0; - mViewport.makeInvalid(); - mFrame.makeInvalid(); - - // virtual displays are always considered enabled - mPowerMode = (mType >= DisplayDevice::DISPLAY_VIRTUAL) ? - HWC_POWER_MODE_NORMAL : HWC_POWER_MODE_OFF; - - // Name the display. The name will be replaced shortly if the display - // was created with createDisplay(). - switch (mType) { - case DISPLAY_PRIMARY: - mDisplayName = "Built-in Screen"; - break; - case DISPLAY_EXTERNAL: - mDisplayName = "HDMI Screen"; - break; - default: - mDisplayName = "Virtual Screen"; // e.g. Overlay #n - break; - } - - // initialize the display orientation transform. - setProjection(DisplayState::eOrientationDefault, mViewport, mFrame); -} - -DisplayDevice::~DisplayDevice() { - if (mSurface != EGL_NO_SURFACE) { - eglDestroySurface(mDisplay, mSurface); - mSurface = EGL_NO_SURFACE; - } -} - -void DisplayDevice::disconnect(HWComposer& hwc) { - if (mHwcDisplayId >= 0) { - hwc.disconnectDisplay(mHwcDisplayId); - if (mHwcDisplayId >= DISPLAY_VIRTUAL) - hwc.freeDisplayId(mHwcDisplayId); - mHwcDisplayId = -1; - } -} - -bool DisplayDevice::isValid() const { - return mFlinger != NULL; -} - -int DisplayDevice::getWidth() const { - return mDisplayWidth; -} - -int DisplayDevice::getHeight() const { - return mDisplayHeight; -} - -PixelFormat DisplayDevice::getFormat() const { - return mFormat; -} - -EGLSurface DisplayDevice::getEGLSurface() const { - return mSurface; -} - -void DisplayDevice::setDisplayName(const String8& displayName) { - if (!displayName.isEmpty()) { - // never override the name with an empty name - mDisplayName = displayName; - } -} - -uint32_t DisplayDevice::getPageFlipCount() const { - return mPageFlipCount; -} - -status_t DisplayDevice::compositionComplete() const { - return mDisplaySurface->compositionComplete(); -} - -void DisplayDevice::flip(const Region& dirty) const -{ - mFlinger->getRenderEngine().checkErrors(); - - if (kEGLAndroidSwapRectangle) { - if (mFlags & SWAP_RECTANGLE) { - const Region newDirty(dirty.intersect(bounds())); - const Rect b(newDirty.getBounds()); - eglSetSwapRectangleANDROID(mDisplay, mSurface, - b.left, b.top, b.width(), b.height()); - } - } - - mPageFlipCount++; -} - -status_t DisplayDevice::beginFrame(bool mustRecompose) const { - return mDisplaySurface->beginFrame(mustRecompose); -} - -status_t DisplayDevice::prepareFrame(const HWComposer& hwc) const { - DisplaySurface::CompositionType compositionType; - bool haveGles = hwc.hasGlesComposition(mHwcDisplayId); - bool haveHwc = hwc.hasHwcComposition(mHwcDisplayId); - if (haveGles && haveHwc) { - compositionType = DisplaySurface::COMPOSITION_MIXED; - } else if (haveGles) { - compositionType = DisplaySurface::COMPOSITION_GLES; - } else if (haveHwc) { - compositionType = DisplaySurface::COMPOSITION_HWC; - } else { - // Nothing to do -- when turning the screen off we get a frame like - // this. Call it a HWC frame since we won't be doing any GLES work but - // will do a prepare/set cycle. - compositionType = DisplaySurface::COMPOSITION_HWC; - } - return mDisplaySurface->prepareFrame(compositionType); -} - -void DisplayDevice::swapBuffers(HWComposer& hwc) const { - // We need to call eglSwapBuffers() if: - // (1) we don't have a hardware composer, or - // (2) we did GLES composition this frame, and either - // (a) we have framebuffer target support (not present on legacy - // devices, where HWComposer::commit() handles things); or - // (b) this is a virtual display - if (hwc.initCheck() != NO_ERROR || - (hwc.hasGlesComposition(mHwcDisplayId) && - (hwc.supportsFramebufferTarget() || mType >= DISPLAY_VIRTUAL))) { - EGLBoolean success = eglSwapBuffers(mDisplay, mSurface); - if (!success) { - EGLint error = eglGetError(); - if (error == EGL_CONTEXT_LOST || - mType == DisplayDevice::DISPLAY_PRIMARY) { - LOG_ALWAYS_FATAL("eglSwapBuffers(%p, %p) failed with 0x%08x", - mDisplay, mSurface, error); - } else { - ALOGE("eglSwapBuffers(%p, %p) failed with 0x%08x", - mDisplay, mSurface, error); - } - } - } - - status_t result = mDisplaySurface->advanceFrame(); - if (result != NO_ERROR) { - ALOGE("[%s] failed pushing new frame to HWC: %d", - mDisplayName.string(), result); - } -} - -void DisplayDevice::onSwapBuffersCompleted(HWComposer& hwc) const { - if (hwc.initCheck() == NO_ERROR) { - mDisplaySurface->onFrameCommitted(); - } -} - -uint32_t DisplayDevice::getFlags() const -{ - return mFlags; -} - -EGLBoolean DisplayDevice::makeCurrent(EGLDisplay dpy, EGLContext ctx) const { - EGLBoolean result = EGL_TRUE; - EGLSurface sur = eglGetCurrentSurface(EGL_DRAW); - if (sur != mSurface) { - result = eglMakeCurrent(dpy, mSurface, mSurface, ctx); - if (result == EGL_TRUE) { - if (mType >= DisplayDevice::DISPLAY_VIRTUAL) - eglSwapInterval(dpy, 0); - } - } - setViewportAndProjection(); - return result; -} - -void DisplayDevice::setViewportAndProjection() const { - size_t w = mDisplayWidth; - size_t h = mDisplayHeight; - Rect sourceCrop(0, 0, w, h); - mFlinger->getRenderEngine().setViewportAndProjection(w, h, sourceCrop, h, - false, Transform::ROT_0); -} - -// ---------------------------------------------------------------------------- - -void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp >& layers) { - mVisibleLayersSortedByZ = layers; - mSecureLayerVisible = false; - size_t count = layers.size(); - for (size_t i=0 ; i& layer(layers[i]); - if (layer->isSecure()) { - mSecureLayerVisible = true; - } - } -} - -const Vector< sp >& DisplayDevice::getVisibleLayersSortedByZ() const { - return mVisibleLayersSortedByZ; -} - -bool DisplayDevice::getSecureLayerVisible() const { - return mSecureLayerVisible; -} - -Region DisplayDevice::getDirtyRegion(bool repaintEverything) const { - Region dirty; - if (repaintEverything) { - dirty.set(getBounds()); - } else { - const Transform& planeTransform(mGlobalTransform); - dirty = planeTransform.transform(this->dirtyRegion); - dirty.andSelf(getBounds()); - } - return dirty; -} - -// ---------------------------------------------------------------------------- -void DisplayDevice::setPowerMode(int mode) { - mPowerMode = mode; -} - -int DisplayDevice::getPowerMode() const { - return mPowerMode; -} - -bool DisplayDevice::isDisplayOn() const { - return (mPowerMode != HWC_POWER_MODE_OFF); -} - -// ---------------------------------------------------------------------------- -void DisplayDevice::setActiveConfig(int mode) { - mActiveConfig = mode; -} - -int DisplayDevice::getActiveConfig() const { - return mActiveConfig; -} - -// ---------------------------------------------------------------------------- - -void DisplayDevice::setLayerStack(uint32_t stack) { - mLayerStack = stack; - dirtyRegion.set(bounds()); -} - -// ---------------------------------------------------------------------------- - -uint32_t DisplayDevice::getOrientationTransform() const { - uint32_t transform = 0; - switch (mOrientation) { - case DisplayState::eOrientationDefault: - transform = Transform::ROT_0; - break; - case DisplayState::eOrientation90: - transform = Transform::ROT_90; - break; - case DisplayState::eOrientation180: - transform = Transform::ROT_180; - break; - case DisplayState::eOrientation270: - transform = Transform::ROT_270; - break; - } - return transform; -} - -status_t DisplayDevice::orientationToTransfrom( - int orientation, int w, int h, Transform* tr) -{ - uint32_t flags = 0; - switch (orientation) { - case DisplayState::eOrientationDefault: - flags = Transform::ROT_0; - break; - case DisplayState::eOrientation90: - flags = Transform::ROT_90; - break; - case DisplayState::eOrientation180: - flags = Transform::ROT_180; - break; - case DisplayState::eOrientation270: - flags = Transform::ROT_270; - break; - default: - return BAD_VALUE; - } - tr->set(flags, w, h); - return NO_ERROR; -} - -void DisplayDevice::setDisplaySize(const int newWidth, const int newHeight) { - dirtyRegion.set(getBounds()); - - if (mSurface != EGL_NO_SURFACE) { - eglDestroySurface(mDisplay, mSurface); - mSurface = EGL_NO_SURFACE; - } - - mDisplaySurface->resizeBuffers(newWidth, newHeight); - - ANativeWindow* const window = mNativeWindow.get(); - mSurface = eglCreateWindowSurface(mDisplay, mConfig, window, NULL); - eglQuerySurface(mDisplay, mSurface, EGL_WIDTH, &mDisplayWidth); - eglQuerySurface(mDisplay, mSurface, EGL_HEIGHT, &mDisplayHeight); - - LOG_FATAL_IF(mDisplayWidth != newWidth, - "Unable to set new width to %d", newWidth); - LOG_FATAL_IF(mDisplayHeight != newHeight, - "Unable to set new height to %d", newHeight); -} - -void DisplayDevice::setProjection(int orientation, - const Rect& newViewport, const Rect& newFrame) { - Rect viewport(newViewport); - Rect frame(newFrame); - - const int w = mDisplayWidth; - const int h = mDisplayHeight; - - Transform R; - DisplayDevice::orientationToTransfrom(orientation, w, h, &R); - - if (!frame.isValid()) { - // the destination frame can be invalid if it has never been set, - // in that case we assume the whole display frame. - frame = Rect(w, h); - } - - if (viewport.isEmpty()) { - // viewport can be invalid if it has never been set, in that case - // we assume the whole display size. - // it's also invalid to have an empty viewport, so we handle that - // case in the same way. - viewport = Rect(w, h); - if (R.getOrientation() & Transform::ROT_90) { - // viewport is always specified in the logical orientation - // of the display (ie: post-rotation). - swap(viewport.right, viewport.bottom); - } - } - - dirtyRegion.set(getBounds()); - - Transform TL, TP, S; - float src_width = viewport.width(); - float src_height = viewport.height(); - float dst_width = frame.width(); - float dst_height = frame.height(); - if (src_width != dst_width || src_height != dst_height) { - float sx = dst_width / src_width; - float sy = dst_height / src_height; - S.set(sx, 0, 0, sy); - } - - float src_x = viewport.left; - float src_y = viewport.top; - float dst_x = frame.left; - float dst_y = frame.top; - TL.set(-src_x, -src_y); - TP.set(dst_x, dst_y); - - // The viewport and frame are both in the logical orientation. - // Apply the logical translation, scale to physical size, apply the - // physical translation and finally rotate to the physical orientation. - mGlobalTransform = R * TP * S * TL; - - const uint8_t type = mGlobalTransform.getType(); - mNeedsFiltering = (!mGlobalTransform.preserveRects() || - (type >= Transform::SCALE)); - - mScissor = mGlobalTransform.transform(viewport); - if (mScissor.isEmpty()) { - mScissor = getBounds(); - } - - mOrientation = orientation; - mViewport = viewport; - mFrame = frame; -} - -void DisplayDevice::dump(String8& result) const { - const Transform& tr(mGlobalTransform); - result.appendFormat( - "+ DisplayDevice: %s\n" - " type=%x, hwcId=%d, layerStack=%u, (%4dx%4d), ANativeWindow=%p, orient=%2d (type=%08x), " - "flips=%u, isSecure=%d, secureVis=%d, powerMode=%d, activeConfig=%d, numLayers=%zu\n" - " v:[%d,%d,%d,%d], f:[%d,%d,%d,%d], s:[%d,%d,%d,%d]," - "transform:[[%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f][%0.3f,%0.3f,%0.3f]]\n", - mDisplayName.string(), mType, mHwcDisplayId, - mLayerStack, mDisplayWidth, mDisplayHeight, mNativeWindow.get(), - mOrientation, tr.getType(), getPageFlipCount(), - mIsSecure, mSecureLayerVisible, mPowerMode, mActiveConfig, - mVisibleLayersSortedByZ.size(), - mViewport.left, mViewport.top, mViewport.right, mViewport.bottom, - mFrame.left, mFrame.top, mFrame.right, mFrame.bottom, - mScissor.left, mScissor.top, mScissor.right, mScissor.bottom, - tr[0][0], tr[1][0], tr[2][0], - tr[0][1], tr[1][1], tr[2][1], - tr[0][2], tr[1][2], tr[2][2]); - - String8 surfaceDump; - mDisplaySurface->dumpAsString(surfaceDump); - result.append(surfaceDump); -} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayDevice.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayDevice.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayDevice.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayDevice.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,233 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef ANDROID_DISPLAY_DEVICE_H -#define ANDROID_DISPLAY_DEVICE_H - -#include - -#include -#include - -#include -#include - -#include -#include -#include - -#include - -#include "Transform.h" - -struct ANativeWindow; - -namespace android { - -struct DisplayInfo; -class DisplaySurface; -class IGraphicBufferProducer; -class Layer; -class SurfaceFlinger; -class HWComposer; - -class DisplayDevice : public LightRefBase -{ -public: - // region in layer-stack space - mutable Region dirtyRegion; - // region in screen space - mutable Region swapRegion; - // region in screen space - Region undefinedRegion; - bool lastCompositionHadVisibleLayers; - - enum DisplayType { - DISPLAY_ID_INVALID = -1, - DISPLAY_PRIMARY = HWC_DISPLAY_PRIMARY, - DISPLAY_EXTERNAL = HWC_DISPLAY_EXTERNAL, - DISPLAY_VIRTUAL = HWC_DISPLAY_VIRTUAL, - NUM_BUILTIN_DISPLAY_TYPES = HWC_NUM_PHYSICAL_DISPLAY_TYPES, - }; - - enum { - PARTIAL_UPDATES = 0x00020000, // video driver feature - SWAP_RECTANGLE = 0x00080000, - }; - - enum { - NO_LAYER_STACK = 0xFFFFFFFF, - }; - - DisplayDevice( - const sp& flinger, - DisplayType type, - int32_t hwcId, // negative for non-HWC-composited displays - int format, - bool isSecure, - const wp& displayToken, - const sp& displaySurface, - const sp& producer, - EGLConfig config); - - ~DisplayDevice(); - - // whether this is a valid object. An invalid DisplayDevice is returned - // when an non existing id is requested - bool isValid() const; - - // isSecure indicates whether this display can be trusted to display - // secure surfaces. - bool isSecure() const { return mIsSecure; } - - // Flip the front and back buffers if the back buffer is "dirty". Might - // be instantaneous, might involve copying the frame buffer around. - void flip(const Region& dirty) const; - - int getWidth() const; - int getHeight() const; - PixelFormat getFormat() const; - uint32_t getFlags() const; - - EGLSurface getEGLSurface() const; - - void setVisibleLayersSortedByZ(const Vector< sp >& layers); - const Vector< sp >& getVisibleLayersSortedByZ() const; - bool getSecureLayerVisible() const; - Region getDirtyRegion(bool repaintEverything) const; - - void setLayerStack(uint32_t stack); - void setDisplaySize(const int newWidth, const int newHeight); - void setProjection(int orientation, const Rect& viewport, const Rect& frame); - - int getOrientation() const { return mOrientation; } - uint32_t getOrientationTransform() const; - const Transform& getTransform() const { return mGlobalTransform; } - const Rect getViewport() const { return mViewport; } - const Rect getFrame() const { return mFrame; } - const Rect& getScissor() const { return mScissor; } - bool needsFiltering() const { return mNeedsFiltering; } - - uint32_t getLayerStack() const { return mLayerStack; } - int32_t getDisplayType() const { return mType; } - int32_t getHwcDisplayId() const { return mHwcDisplayId; } - const wp& getDisplayToken() const { return mDisplayToken; } - - // We pass in mustRecompose so we can keep VirtualDisplaySurface's state - // machine happy without actually queueing a buffer if nothing has changed - status_t beginFrame(bool mustRecompose) const; - status_t prepareFrame(const HWComposer& hwc) const; - - void swapBuffers(HWComposer& hwc) const; - status_t compositionComplete() const; - - // called after h/w composer has completed its set() call - void onSwapBuffersCompleted(HWComposer& hwc) const; - - Rect getBounds() const { - return Rect(mDisplayWidth, mDisplayHeight); - } - inline Rect bounds() const { return getBounds(); } - - void setDisplayName(const String8& displayName); - const String8& getDisplayName() const { return mDisplayName; } - - EGLBoolean makeCurrent(EGLDisplay dpy, EGLContext ctx) const; - void setViewportAndProjection() const; - - /* ------------------------------------------------------------------------ - * Display power mode management. - */ - int getPowerMode() const; - void setPowerMode(int mode); - bool isDisplayOn() const; - - /* ------------------------------------------------------------------------ - * Display active config management. - */ - int getActiveConfig() const; - void setActiveConfig(int mode); - - // release HWC resources (if any) for removable displays - void disconnect(HWComposer& hwc); - - /* ------------------------------------------------------------------------ - * Debugging - */ - uint32_t getPageFlipCount() const; - void dump(String8& result) const; - -private: - /* - * Constants, set during initialization - */ - sp mFlinger; - DisplayType mType; - int32_t mHwcDisplayId; - wp mDisplayToken; - - // ANativeWindow this display is rendering into - sp mNativeWindow; - sp mDisplaySurface; - - EGLConfig mConfig; - EGLDisplay mDisplay; - EGLSurface mSurface; - int mDisplayWidth; - int mDisplayHeight; - PixelFormat mFormat; - uint32_t mFlags; - mutable uint32_t mPageFlipCount; - String8 mDisplayName; - bool mIsSecure; - - /* - * Can only accessed from the main thread, these members - * don't need synchronization. - */ - - // list of visible layers on that display - Vector< sp > mVisibleLayersSortedByZ; - - // Whether we have a visible secure layer on this display - bool mSecureLayerVisible; - - - /* - * Transaction state - */ - static status_t orientationToTransfrom(int orientation, - int w, int h, Transform* tr); - - uint32_t mLayerStack; - int mOrientation; - // user-provided visible area of the layer stack - Rect mViewport; - // user-provided rectangle where mViewport gets mapped to - Rect mFrame; - // pre-computed scissor to apply to the display - Rect mScissor; - Transform mGlobalTransform; - bool mNeedsFiltering; - // Current power mode - int mPowerMode; - // Current active config - int mActiveConfig; -}; - -}; // namespace android - -#endif // ANDROID_DISPLAY_DEVICE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,136 @@ +/* + * Copyright (C) 2012 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 +#include +#include +#include + +#include +#include + +#include + +#include "DisplayHardware/DisplayHardwareBase.h" +#include "SurfaceFlinger.h" + +// ---------------------------------------------------------------------------- +namespace android { + +static char const * const kSleepFileName = "/sys/power/wait_for_fb_sleep"; +static char const * const kWakeFileName = "/sys/power/wait_for_fb_wake"; + +// ---------------------------------------------------------------------------- + +DisplayHardwareBase::DisplayEventThread::DisplayEventThread( + const sp& flinger) + : Thread(false), mFlinger(flinger) { +} + +DisplayHardwareBase::DisplayEventThread::~DisplayEventThread() { +} + +status_t DisplayHardwareBase::DisplayEventThread::initCheck() const { + return ((access(kSleepFileName, R_OK) == 0 && + access(kWakeFileName, R_OK) == 0)) ? NO_ERROR : NO_INIT; +} + +bool DisplayHardwareBase::DisplayEventThread::threadLoop() { + + if (waitForFbSleep() == NO_ERROR) { + sp flinger = mFlinger.promote(); + ALOGD("About to give-up screen, flinger = %p", flinger.get()); + if (flinger != 0) { + flinger->screenReleased(); + } + if (waitForFbWake() == NO_ERROR) { + ALOGD("Screen about to return, flinger = %p", flinger.get()); + if (flinger != 0) { + flinger->screenAcquired(); + } + return true; + } + } + + // error, exit the thread + return false; +} + +status_t DisplayHardwareBase::DisplayEventThread::waitForFbSleep() { + int err = 0; + char buf; + int fd = open(kSleepFileName, O_RDONLY, 0); + // if the file doesn't exist, the error will be caught in read() below + do { + err = read(fd, &buf, 1); + } while (err < 0 && errno == EINTR); + close(fd); + ALOGE_IF(err<0, "*** ANDROID_WAIT_FOR_FB_SLEEP failed (%s)", strerror(errno)); + return err < 0 ? -errno : int(NO_ERROR); +} + +status_t DisplayHardwareBase::DisplayEventThread::waitForFbWake() { + int err = 0; + char buf; + int fd = open(kWakeFileName, O_RDONLY, 0); + // if the file doesn't exist, the error will be caught in read() below + do { + err = read(fd, &buf, 1); + } while (err < 0 && errno == EINTR); + close(fd); + ALOGE_IF(err<0, "*** ANDROID_WAIT_FOR_FB_WAKE failed (%s)", strerror(errno)); + return err < 0 ? -errno : int(NO_ERROR); +} + +// ---------------------------------------------------------------------------- + +DisplayHardwareBase::DisplayHardwareBase(const sp& flinger, + uint32_t displayIndex) +{ + mScreenAcquired = true; + mDisplayEventThread = new DisplayEventThread(flinger); +} + +void DisplayHardwareBase::startSleepManagement() const { + if (mDisplayEventThread->initCheck() == NO_ERROR) { + mDisplayEventThread->run("DisplayEventThread", PRIORITY_URGENT_DISPLAY); + } else { + ALOGW("/sys/power/wait_for_fb_{wake|sleep} don't exist"); + } +} + +DisplayHardwareBase::~DisplayHardwareBase() { + // request exit + mDisplayEventThread->requestExitAndWait(); +} + +bool DisplayHardwareBase::canDraw() const { + return mScreenAcquired; +} + +void DisplayHardwareBase::releaseScreen() const { + mScreenAcquired = false; +} + +void DisplayHardwareBase::acquireScreen() const { + mScreenAcquired = true; +} + +bool DisplayHardwareBase::isScreenAcquired() const { + return mScreenAcquired; +} + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardwareBase.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2012 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. + */ + +#ifndef ANDROID_DISPLAY_HARDWARE_BASE_H +#define ANDROID_DISPLAY_HARDWARE_BASE_H + +#include +#include +#include +#include + +namespace android { + +class SurfaceFlinger; + +class DisplayHardwareBase +{ +public: + DisplayHardwareBase( + const sp& flinger, + uint32_t displayIndex); + + ~DisplayHardwareBase(); + + void startSleepManagement() const; + + // console management + void releaseScreen() const; + void acquireScreen() const; + bool isScreenAcquired() const; + + bool canDraw() const; + + +private: + class DisplayEventThread : public Thread { + wp mFlinger; + status_t waitForFbSleep(); + status_t waitForFbWake(); + public: + DisplayEventThread(const sp& flinger); + virtual ~DisplayEventThread(); + virtual bool threadLoop(); + status_t initCheck() const; + }; + + sp mDisplayEventThread; + mutable int mScreenAcquired; +}; + +}; // namespace android + +#endif // ANDROID_DISPLAY_HARDWARE_BASE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardware.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,481 @@ +/* + * Copyright (C) 2007 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 +#include +#include +#include + +#include + +#include +#include + +#include +#include + +#include +#include +#include + +#include "DisplayHardware/DisplayHardware.h" + +#include + +#include "DisplayHardwareBase.h" +#include "GLExtensions.h" +#include "HWComposer.h" +#include "SurfaceFlinger.h" + +using namespace android; + + +static __attribute__((noinline)) +void checkGLErrors() +{ + do { + // there could be more than one error flag + GLenum error = glGetError(); + if (error == GL_NO_ERROR) + break; + ALOGE("GL error 0x%04x", int(error)); + } while(true); +} + +static __attribute__((noinline)) +void checkEGLErrors(const char* token) +{ + struct EGLUtils { + static const char *strerror(EGLint err) { + switch (err){ + case EGL_SUCCESS: return "EGL_SUCCESS"; + case EGL_NOT_INITIALIZED: return "EGL_NOT_INITIALIZED"; + case EGL_BAD_ACCESS: return "EGL_BAD_ACCESS"; + case EGL_BAD_ALLOC: return "EGL_BAD_ALLOC"; + case EGL_BAD_ATTRIBUTE: return "EGL_BAD_ATTRIBUTE"; + case EGL_BAD_CONFIG: return "EGL_BAD_CONFIG"; + case EGL_BAD_CONTEXT: return "EGL_BAD_CONTEXT"; + case EGL_BAD_CURRENT_SURFACE: return "EGL_BAD_CURRENT_SURFACE"; + case EGL_BAD_DISPLAY: return "EGL_BAD_DISPLAY"; + case EGL_BAD_MATCH: return "EGL_BAD_MATCH"; + case EGL_BAD_NATIVE_PIXMAP: return "EGL_BAD_NATIVE_PIXMAP"; + case EGL_BAD_NATIVE_WINDOW: return "EGL_BAD_NATIVE_WINDOW"; + case EGL_BAD_PARAMETER: return "EGL_BAD_PARAMETER"; + case EGL_BAD_SURFACE: return "EGL_BAD_SURFACE"; + case EGL_CONTEXT_LOST: return "EGL_CONTEXT_LOST"; + default: return "UNKNOWN"; + } + } + }; + + EGLint error = eglGetError(); + if (error && error != EGL_SUCCESS) { + ALOGE("%s: EGL error 0x%04x (%s)", + token, int(error), EGLUtils::strerror(error)); + } +} + +/* + * Initialize the display to the specified values. + * + */ + +DisplayHardware::DisplayHardware( + const sp& flinger, + uint32_t dpy) + : DisplayHardwareBase(flinger, dpy), + mFlinger(flinger), mFlags(0), mHwc(0) +{ + init(dpy); +} + +DisplayHardware::~DisplayHardware() +{ + fini(); +} + +float DisplayHardware::getDpiX() const { return mDpiX; } +float DisplayHardware::getDpiY() const { return mDpiY; } +float DisplayHardware::getDensity() const { return mDensity; } +float DisplayHardware::getRefreshRate() const { return mRefreshRate; } +int DisplayHardware::getWidth() const { return mWidth; } +int DisplayHardware::getHeight() const { return mHeight; } +PixelFormat DisplayHardware::getFormat() const { return mFormat; } +uint32_t DisplayHardware::getMaxTextureSize() const { return mMaxTextureSize; } + +uint32_t DisplayHardware::getMaxViewportDims() const { + return mMaxViewportDims[0] < mMaxViewportDims[1] ? + mMaxViewportDims[0] : mMaxViewportDims[1]; +} + +static status_t selectConfigForPixelFormat( + EGLDisplay dpy, + EGLint const* attrs, + PixelFormat format, + EGLConfig* outConfig) +{ + EGLConfig config = NULL; + EGLint numConfigs = -1, n=0; + eglGetConfigs(dpy, NULL, 0, &numConfigs); + EGLConfig* const configs = new EGLConfig[numConfigs]; + eglChooseConfig(dpy, attrs, configs, numConfigs, &n); + for (int i=0 ; i0 && format == nativeVisualId) { + *outConfig = configs[i]; + delete [] configs; + return NO_ERROR; + } + } + delete [] configs; + return NAME_NOT_FOUND; +} + + +void DisplayHardware::init(uint32_t dpy) +{ + mNativeWindow = new FramebufferNativeWindow(); + framebuffer_device_t const * fbDev = mNativeWindow->getDevice(); + if (!fbDev) { + ALOGE("Display subsystem failed to initialize. check logs. exiting..."); + exit(0); + } + + int format; + ANativeWindow const * const window = mNativeWindow.get(); + window->query(window, NATIVE_WINDOW_FORMAT, &format); + mDpiX = mNativeWindow->xdpi; + mDpiY = mNativeWindow->ydpi; + mRefreshRate = fbDev->fps; + + if (mDpiX == 0 || mDpiY == 0) { + ALOGE("invalid screen resolution from fb HAL (xdpi=%f, ydpi=%f), " + "defaulting to 160 dpi", mDpiX, mDpiY); + mDpiX = mDpiY = 160; + } + + class Density { + static int getDensityFromProperty(char const* propName) { + char property[PROPERTY_VALUE_MAX]; + int density = 0; + if (property_get(propName, property, NULL) > 0) { + density = atoi(property); + } + return density; + } + public: + static int getEmuDensity() { + return getDensityFromProperty("qemu.sf.lcd_density"); } + static int getBuildDensity() { + return getDensityFromProperty("ro.sf.lcd_density"); } + }; + + + // The density of the device is provided by a build property + mDensity = Density::getBuildDensity() / 160.0f; + + if (mDensity == 0) { + // the build doesn't provide a density -- this is wrong! + // use xdpi instead + ALOGE("ro.sf.lcd_density must be defined as a build property"); + mDensity = mDpiX / 160.0f; + } + + if (Density::getEmuDensity()) { + // if "qemu.sf.lcd_density" is specified, it overrides everything + mDpiX = mDpiY = mDensity = Density::getEmuDensity(); + mDensity /= 160.0f; + } + + + + /* FIXME: this is a temporary HACK until we are able to report the refresh rate + * properly from the HAL. The WindowManagerService now relies on this value. + */ +#ifndef REFRESH_RATE + mRefreshRate = fbDev->fps; +#else + mRefreshRate = REFRESH_RATE; +#warning "refresh rate set via makefile to REFRESH_RATE" +#endif + + mRefreshPeriod = nsecs_t(1e9 / mRefreshRate); + + EGLint w, h, dummy; + EGLint numConfigs=0; + EGLSurface surface; + EGLContext context; + EGLBoolean result; + status_t err; + + // initialize EGL + EGLint attribs[] = { + EGL_SURFACE_TYPE, EGL_WINDOW_BIT, + EGL_NONE, 0, + EGL_NONE + }; + + // debug: disable h/w rendering + char property[PROPERTY_VALUE_MAX]; + if (property_get("debug.sf.hw", property, NULL) > 0) { + if (atoi(property) == 0) { + ALOGW("H/W composition disabled"); + attribs[2] = EGL_CONFIG_CAVEAT; + attribs[3] = EGL_SLOW_CONFIG; + } + } + + // TODO: all the extensions below should be queried through + // eglGetProcAddress(). + + EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); + eglInitialize(display, NULL, NULL); + eglGetConfigs(display, NULL, 0, &numConfigs); + + EGLConfig config = NULL; + err = selectConfigForPixelFormat(display, attribs, format, &config); + ALOGE_IF(err, "couldn't find an EGLConfig matching the screen format"); + + EGLint r,g,b,a; + eglGetConfigAttrib(display, config, EGL_RED_SIZE, &r); + eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &g); + eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &b); + eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &a); + + if (mNativeWindow->isUpdateOnDemand()) { + mFlags |= PARTIAL_UPDATES; + } + + if (eglGetConfigAttrib(display, config, EGL_CONFIG_CAVEAT, &dummy) == EGL_TRUE) { + if (dummy == EGL_SLOW_CONFIG) + mFlags |= SLOW_CONFIG; + } + + /* + * Create our main surface + */ + + surface = eglCreateWindowSurface(display, config, mNativeWindow.get(), NULL); + eglQuerySurface(display, surface, EGL_WIDTH, &mWidth); + eglQuerySurface(display, surface, EGL_HEIGHT, &mHeight); + + if (mFlags & PARTIAL_UPDATES) { + // if we have partial updates, we definitely don't need to + // preserve the backbuffer, which may be costly. + eglSurfaceAttrib(display, surface, + EGL_SWAP_BEHAVIOR, EGL_BUFFER_DESTROYED); + } + + /* + * Create our OpenGL ES context + */ + + EGLint contextAttributes[] = { +#ifdef EGL_IMG_context_priority +#ifdef HAS_CONTEXT_PRIORITY +#warning "using EGL_IMG_context_priority" + EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, +#endif +#endif + EGL_NONE, EGL_NONE + }; + context = eglCreateContext(display, config, NULL, contextAttributes); + + mDisplay = display; + mConfig = config; + mSurface = surface; + mContext = context; + mFormat = fbDev->format; + mPageFlipCount = 0; + + /* + * Gather OpenGL ES extensions + */ + + result = eglMakeCurrent(display, surface, surface, context); + if (!result) { + ALOGE("Couldn't create a working GLES context. check logs. exiting..."); + exit(0); + } + + GLExtensions& extensions(GLExtensions::getInstance()); + extensions.initWithGLStrings( + glGetString(GL_VENDOR), + glGetString(GL_RENDERER), + glGetString(GL_VERSION), + glGetString(GL_EXTENSIONS), + eglQueryString(display, EGL_VENDOR), + eglQueryString(display, EGL_VERSION), + eglQueryString(display, EGL_EXTENSIONS)); + + glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); + glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims); + + ALOGI("EGL informations:"); + ALOGI("# of configs : %d", numConfigs); + ALOGI("vendor : %s", extensions.getEglVendor()); + ALOGI("version : %s", extensions.getEglVersion()); + ALOGI("extensions: %s", extensions.getEglExtension()); + ALOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported"); + ALOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config); + + ALOGI("OpenGL informations:"); + ALOGI("vendor : %s", extensions.getVendor()); + ALOGI("renderer : %s", extensions.getRenderer()); + ALOGI("version : %s", extensions.getVersion()); + ALOGI("extensions: %s", extensions.getExtension()); + ALOGI("GL_MAX_TEXTURE_SIZE = %d", mMaxTextureSize); + ALOGI("GL_MAX_VIEWPORT_DIMS = %d x %d", mMaxViewportDims[0], mMaxViewportDims[1]); + ALOGI("flags = %08x", mFlags); + + // Unbind the context from this thread + eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + + + // initialize the H/W composer + mHwc = new HWComposer(mFlinger, *this, mRefreshPeriod); + if (mHwc->initCheck() == NO_ERROR) { + mHwc->setFrameBuffer(mDisplay, mSurface); + } +} + +void DisplayHardware::setVSyncHandler(const sp& handler) { + Mutex::Autolock _l(mLock); + mVSyncHandler = handler; +} + +void DisplayHardware::eventControl(int event, int enabled) { + if (event == EVENT_VSYNC) { + mPowerHAL.vsyncHint(enabled); + } + mHwc->eventControl(event, enabled); +} + +void DisplayHardware::onVSyncReceived(int dpy, nsecs_t timestamp) { + sp handler; + { // scope for the lock + Mutex::Autolock _l(mLock); + mLastHwVSync = timestamp; + if (mVSyncHandler != NULL) { + handler = mVSyncHandler.promote(); + } + } + + if (handler != NULL) { + handler->onVSyncReceived(dpy, timestamp); + } +} + +HWComposer& DisplayHardware::getHwComposer() const { + return *mHwc; +} + +/* + * Clean up. Throw out our local state. + * + * (It's entirely possible we'll never get here, since this is meant + * for real hardware, which doesn't restart.) + */ + +void DisplayHardware::fini() +{ + eglMakeCurrent(mDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); + eglTerminate(mDisplay); +} + +void DisplayHardware::releaseScreen() const +{ + DisplayHardwareBase::releaseScreen(); + if (mHwc->initCheck() == NO_ERROR) { + mHwc->release(); + } +} + +void DisplayHardware::acquireScreen() const +{ + DisplayHardwareBase::acquireScreen(); +} + +uint32_t DisplayHardware::getPageFlipCount() const { + return mPageFlipCount; +} + +nsecs_t DisplayHardware::getRefreshTimestamp() const { + // this returns the last refresh timestamp. + // if the last one is not available, we estimate it based on + // the refresh period and whatever closest timestamp we have. + Mutex::Autolock _l(mLock); + nsecs_t now = systemTime(CLOCK_MONOTONIC); + return now - ((now - mLastHwVSync) % mRefreshPeriod); +} + +nsecs_t DisplayHardware::getRefreshPeriod() const { + return mRefreshPeriod; +} + +status_t DisplayHardware::compositionComplete() const { + return mNativeWindow->compositionComplete(); +} + +void DisplayHardware::flip(const Region& dirty) const +{ + checkGLErrors(); + + EGLDisplay dpy = mDisplay; + EGLSurface surface = mSurface; + +#ifdef EGL_ANDROID_swap_rectangle + if (mFlags & SWAP_RECTANGLE) { + const Region newDirty(dirty.intersect(bounds())); + const Rect b(newDirty.getBounds()); + eglSetSwapRectangleANDROID(dpy, surface, + b.left, b.top, b.width(), b.height()); + } +#endif + + if (mFlags & PARTIAL_UPDATES) { + mNativeWindow->setUpdateRectangle(dirty.getBounds()); + } + + mPageFlipCount++; + + if (mHwc->initCheck() == NO_ERROR) { + mHwc->commit(); + } else { + eglSwapBuffers(dpy, surface); + } + checkEGLErrors("eglSwapBuffers"); + + // for debugging + //glClearColor(1,0,0,0); + //glClear(GL_COLOR_BUFFER_BIT); +} + +uint32_t DisplayHardware::getFlags() const +{ + return mFlags; +} + +void DisplayHardware::makeCurrent() const +{ + eglMakeCurrent(mDisplay, mSurface, mSurface, mContext); +} + +void DisplayHardware::dump(String8& res) const +{ + mNativeWindow->dump(res); +} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardware.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardware.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplayHardware.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplayHardware.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,152 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_DISPLAY_HARDWARE_H +#define ANDROID_DISPLAY_HARDWARE_H + +#include + +#include +#include + +#include +#include +#include +#include + +#include "GLExtensions.h" + +#include "DisplayHardware/DisplayHardwareBase.h" +#include "HWComposer.h" +#include "PowerHAL.h" + +namespace android { + +class FramebufferNativeWindow; + +class DisplayHardware : + public DisplayHardwareBase, + public HWComposer::EventHandler +{ +public: + + class VSyncHandler : virtual public RefBase { + friend class DisplayHardware; + virtual void onVSyncReceived(int dpy, nsecs_t timestamp) = 0; + protected: + virtual ~VSyncHandler() {} + }; + + enum { + COPY_BITS_EXTENSION = 0x00000008, + PARTIAL_UPDATES = 0x00020000, // video driver feature + SLOW_CONFIG = 0x00040000, // software + SWAP_RECTANGLE = 0x00080000, + }; + + DisplayHardware( + const sp& flinger, + uint32_t displayIndex); + + virtual ~DisplayHardware(); + + void releaseScreen() const; + void acquireScreen() const; + + // Flip the front and back buffers if the back buffer is "dirty". Might + // be instantaneous, might involve copying the frame buffer around. + void flip(const Region& dirty) const; + + float getDpiX() const; + float getDpiY() const; + float getRefreshRate() const; + float getDensity() const; + int getWidth() const; + int getHeight() const; + PixelFormat getFormat() const; + uint32_t getFlags() const; + uint32_t getMaxTextureSize() const; + uint32_t getMaxViewportDims() const; + nsecs_t getRefreshPeriod() const; + nsecs_t getRefreshTimestamp() const; + void makeCurrent() const; + + + void setVSyncHandler(const sp& handler); + + enum { + EVENT_VSYNC = HWC_EVENT_VSYNC + }; + + void eventControl(int event, int enabled); + + + uint32_t getPageFlipCount() const; + EGLDisplay getEGLDisplay() const { return mDisplay; } + + void dump(String8& res) const; + + // Hardware Composer + HWComposer& getHwComposer() const; + + status_t compositionComplete() const; + + Rect getBounds() const { + return Rect(mWidth, mHeight); + } + inline Rect bounds() const { return getBounds(); } + +private: + virtual void onVSyncReceived(int dpy, nsecs_t timestamp); + void init(uint32_t displayIndex) __attribute__((noinline)); + void fini() __attribute__((noinline)); + + sp mFlinger; + EGLDisplay mDisplay; + EGLSurface mSurface; + EGLContext mContext; + EGLConfig mConfig; + float mDpiX; + float mDpiY; + float mRefreshRate; + float mDensity; + int mWidth; + int mHeight; + PixelFormat mFormat; + uint32_t mFlags; + mutable uint32_t mPageFlipCount; + GLint mMaxViewportDims[2]; + GLint mMaxTextureSize; + + nsecs_t mRefreshPeriod; + mutable nsecs_t mLastHwVSync; + + // constant once set + HWComposer* mHwc; + PowerHAL mPowerHAL; + + + mutable Mutex mLock; + + // protected by mLock + wp mVSyncHandler; + + sp mNativeWindow; +}; + +}; // namespace android + +#endif // ANDROID_DISPLAY_HARDWARE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplaySurface.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplaySurface.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/DisplaySurface.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/DisplaySurface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SF_DISPLAY_SURFACE_H -#define ANDROID_SF_DISPLAY_SURFACE_H - -#include -#include -#include - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class IGraphicBufferProducer; -class String8; - -class DisplaySurface : public virtual RefBase { -public: - // beginFrame is called at the beginning of the composition loop, before - // the configuration is known. The DisplaySurface should do anything it - // needs to do to enable HWComposer to decide how to compose the frame. - // We pass in mustRecompose so we can keep VirtualDisplaySurface's state - // machine happy without actually queueing a buffer if nothing has changed. - virtual status_t beginFrame(bool mustRecompose) = 0; - - // prepareFrame is called after the composition configuration is known but - // before composition takes place. The DisplaySurface can use the - // composition type to decide how to manage the flow of buffers between - // GLES and HWC for this frame. - enum CompositionType { - COMPOSITION_UNKNOWN = 0, - COMPOSITION_GLES = 1, - COMPOSITION_HWC = 2, - COMPOSITION_MIXED = COMPOSITION_GLES | COMPOSITION_HWC - }; - virtual status_t prepareFrame(CompositionType compositionType) = 0; - - // Should be called when composition rendering is complete for a frame (but - // eglSwapBuffers hasn't necessarily been called). Required by certain - // older drivers for synchronization. - // TODO: Remove this when we drop support for HWC 1.0. - virtual status_t compositionComplete() = 0; - - // Inform the surface that GLES composition is complete for this frame, and - // the surface should make sure that HWComposer has the correct buffer for - // this frame. Some implementations may only push a new buffer to - // HWComposer if GLES composition took place, others need to push a new - // buffer on every frame. - // - // advanceFrame must be followed by a call to onFrameCommitted before - // advanceFrame may be called again. - virtual status_t advanceFrame() = 0; - - // onFrameCommitted is called after the frame has been committed to the - // hardware composer. The surface collects the release fence for this - // frame's buffer. - virtual void onFrameCommitted() = 0; - - virtual void dumpAsString(String8& result) const = 0; - - virtual void resizeBuffers(const uint32_t w, const uint32_t h) = 0; - -protected: - DisplaySurface() {} - virtual ~DisplaySurface() {} -}; - -// --------------------------------------------------------------------------- -} // namespace android -// --------------------------------------------------------------------------- - -#endif // ANDROID_SF_DISPLAY_SURFACE_H - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/FloatRect.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/FloatRect.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/FloatRect.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/FloatRect.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,42 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SF_FLOAT_RECT -#define ANDROID_SF_FLOAT_RECT - -#include - -namespace android { - -class FloatRect -{ -public: - float left; - float top; - float right; - float bottom; - - inline FloatRect() { } - inline FloatRect(const Rect& other) - : left(other.left), top(other.top), right(other.right), bottom(other.bottom) { } - - inline float getWidth() const { return right - left; } - inline float getHeight() const { return bottom - top; } -}; - -}; // namespace android - -#endif // ANDROID_SF_FLOAT_RECT diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/FramebufferSurface.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -/* - ** - ** Copyright 2012 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 -#include -#include -#include - -#include - -#include - -#include - -#include - -#include -#include -#include -#include -#include - -#include "FramebufferSurface.h" -#include "HWComposer.h" - -#ifndef NUM_FRAMEBUFFER_SURFACE_BUFFERS -#define NUM_FRAMEBUFFER_SURFACE_BUFFERS (2) -#endif - -// ---------------------------------------------------------------------------- -namespace android { -// ---------------------------------------------------------------------------- - -/* - * This implements the (main) framebuffer management. This class is used - * mostly by SurfaceFlinger, but also by command line GL application. - * - */ - -FramebufferSurface::FramebufferSurface(HWComposer& hwc, int disp, - const sp& consumer) : - ConsumerBase(consumer), - mDisplayType(disp), - mCurrentBufferSlot(-1), - mCurrentBuffer(0), - mHwc(hwc) -{ - mName = "FramebufferSurface"; - mConsumer->setConsumerName(mName); - mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_FB | - GRALLOC_USAGE_HW_RENDER | - GRALLOC_USAGE_HW_COMPOSER); - mConsumer->setDefaultBufferFormat(mHwc.getFormat(disp)); - mConsumer->setDefaultBufferSize(mHwc.getWidth(disp), mHwc.getHeight(disp)); - mConsumer->setDefaultMaxBufferCount(NUM_FRAMEBUFFER_SURFACE_BUFFERS); -} - -status_t FramebufferSurface::beginFrame(bool /*mustRecompose*/) { - return NO_ERROR; -} - -status_t FramebufferSurface::prepareFrame(CompositionType /*compositionType*/) { - return NO_ERROR; -} - -status_t FramebufferSurface::advanceFrame() { - // Once we remove FB HAL support, we can call nextBuffer() from here - // instead of using onFrameAvailable(). No real benefit, except it'll be - // more like VirtualDisplaySurface. - return NO_ERROR; -} - -status_t FramebufferSurface::nextBuffer(sp& outBuffer, sp& outFence) { - Mutex::Autolock lock(mMutex); - - BufferItem item; - status_t err = acquireBufferLocked(&item, 0); - if (err == BufferQueue::NO_BUFFER_AVAILABLE) { - outBuffer = mCurrentBuffer; - return NO_ERROR; - } else if (err != NO_ERROR) { - ALOGE("error acquiring buffer: %s (%d)", strerror(-err), err); - return err; - } - - // If the BufferQueue has freed and reallocated a buffer in mCurrentSlot - // then we may have acquired the slot we already own. If we had released - // our current buffer before we call acquireBuffer then that release call - // would have returned STALE_BUFFER_SLOT, and we would have called - // freeBufferLocked on that slot. Because the buffer slot has already - // been overwritten with the new buffer all we have to do is skip the - // releaseBuffer call and we should be in the same state we'd be in if we - // had released the old buffer first. - if (mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT && - item.mBuf != mCurrentBufferSlot) { - // Release the previous buffer. - err = releaseBufferLocked(mCurrentBufferSlot, mCurrentBuffer, - EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); - if (err < NO_ERROR) { - ALOGE("error releasing buffer: %s (%d)", strerror(-err), err); - return err; - } - } - mCurrentBufferSlot = item.mBuf; - mCurrentBuffer = mSlots[mCurrentBufferSlot].mGraphicBuffer; - outFence = item.mFence; - outBuffer = mCurrentBuffer; - return NO_ERROR; -} - -// Overrides ConsumerBase::onFrameAvailable(), does not call base class impl. -void FramebufferSurface::onFrameAvailable(const BufferItem& /* item */) { - sp buf; - sp acquireFence; - status_t err = nextBuffer(buf, acquireFence); - if (err != NO_ERROR) { - ALOGE("error latching nnext FramebufferSurface buffer: %s (%d)", - strerror(-err), err); - return; - } - err = mHwc.fbPost(mDisplayType, acquireFence, buf); - if (err != NO_ERROR) { - ALOGE("error posting framebuffer: %d", err); - } -} - -void FramebufferSurface::freeBufferLocked(int slotIndex) { - ConsumerBase::freeBufferLocked(slotIndex); - if (slotIndex == mCurrentBufferSlot) { - mCurrentBufferSlot = BufferQueue::INVALID_BUFFER_SLOT; - } -} - -void FramebufferSurface::onFrameCommitted() { - sp fence = mHwc.getAndResetReleaseFence(mDisplayType); - if (fence->isValid() && - mCurrentBufferSlot != BufferQueue::INVALID_BUFFER_SLOT) { - status_t err = addReleaseFence(mCurrentBufferSlot, - mCurrentBuffer, fence); - ALOGE_IF(err, "setReleaseFenceFd: failed to add the fence: %s (%d)", - strerror(-err), err); - } -} - -status_t FramebufferSurface::compositionComplete() -{ - return mHwc.fbCompositionComplete(); -} - -void FramebufferSurface::dumpAsString(String8& result) const { - ConsumerBase::dump(result); -} - -void FramebufferSurface::dumpLocked(String8& result, const char* prefix) const -{ - mHwc.fbDump(result); - ConsumerBase::dumpLocked(result, prefix); -} - -// ---------------------------------------------------------------------------- -}; // namespace android -// ---------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/FramebufferSurface.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/FramebufferSurface.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/FramebufferSurface.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/FramebufferSurface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,87 +0,0 @@ -/* - * Copyright (C) 2007 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. - */ - -#ifndef ANDROID_SF_FRAMEBUFFER_SURFACE_H -#define ANDROID_SF_FRAMEBUFFER_SURFACE_H - -#include -#include - -#include - -#include "DisplaySurface.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class Rect; -class String8; -class HWComposer; - -// --------------------------------------------------------------------------- - -class FramebufferSurface : public ConsumerBase, - public DisplaySurface { -public: - FramebufferSurface(HWComposer& hwc, int disp, const sp& consumer); - - virtual status_t beginFrame(bool mustRecompose); - virtual status_t prepareFrame(CompositionType compositionType); - virtual status_t compositionComplete(); - virtual status_t advanceFrame(); - virtual void onFrameCommitted(); - virtual void dumpAsString(String8& result) const; - - // Cannot resize a buffers in a FramebufferSurface. Only works with virtual - // displays. - virtual void resizeBuffers(const uint32_t /*w*/, const uint32_t /*h*/) { }; - -private: - virtual ~FramebufferSurface() { }; // this class cannot be overloaded - - virtual void onFrameAvailable(const BufferItem& item); - virtual void freeBufferLocked(int slotIndex); - - virtual void dumpLocked(String8& result, const char* prefix) const; - - // nextBuffer waits for and then latches the next buffer from the - // BufferQueue and releases the previously latched buffer to the - // BufferQueue. The new buffer is returned in the 'buffer' argument. - status_t nextBuffer(sp& outBuffer, sp& outFence); - - // mDisplayType must match one of the HWC display types - int mDisplayType; - - // mCurrentBufferIndex is the slot index of the current buffer or - // INVALID_BUFFER_SLOT to indicate that either there is no current buffer - // or the buffer is not associated with a slot. - int mCurrentBufferSlot; - - // mCurrentBuffer is the current buffer or NULL to indicate that there is - // no current buffer. - sp mCurrentBuffer; - - // Hardware composer, owned by SurfaceFlinger. - HWComposer& mHwc; -}; - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#endif // ANDROID_SF_FRAMEBUFFER_SURFACE_H - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/HWComposer.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/HWComposer.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/HWComposer.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/HWComposer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,8 +16,6 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS -#include -#include #include #include #include @@ -25,165 +23,68 @@ #include #include -#include -#include #include #include #include #include -#include - #include #include -#include - #include #include -#include "HWComposer.h" +#include -#include "../Layer.h" // needed only for debugging -#include "../SurfaceFlinger.h" +#include "LayerBase.h" +#include "HWComposer.h" +#include "SurfaceFlinger.h" namespace android { - -#define MIN_HWC_HEADER_VERSION HWC_HEADER_VERSION - -static uint32_t hwcApiVersion(const hwc_composer_device_1_t* hwc) { - uint32_t hwcVersion = hwc->common.version; - return hwcVersion & HARDWARE_API_VERSION_2_MAJ_MIN_MASK; -} - -static uint32_t hwcHeaderVersion(const hwc_composer_device_1_t* hwc) { - uint32_t hwcVersion = hwc->common.version; - return hwcVersion & HARDWARE_API_VERSION_2_HEADER_MASK; -} - -static bool hwcHasApiVersion(const hwc_composer_device_1_t* hwc, - uint32_t version) { - return hwcApiVersion(hwc) >= (version & HARDWARE_API_VERSION_2_MAJ_MIN_MASK); -} - -// --------------------------------------------------------------------------- - -struct HWComposer::cb_context { - struct callbacks : public hwc_procs_t { - // these are here to facilitate the transition when adding - // new callbacks (an implementation can check for NULL before - // calling a new callback). - void (*zero[4])(void); - }; - callbacks procs; - HWComposer* hwc; -}; - // --------------------------------------------------------------------------- HWComposer::HWComposer( const sp& flinger, - EventHandler& handler) + EventHandler& handler, + nsecs_t refreshPeriod) : mFlinger(flinger), - mFbDev(0), mHwc(0), mNumDisplays(1), - mCBContext(new cb_context), + mModule(0), mHwc(0), mList(0), mCapacity(0), + mNumOVLayers(0), mNumFBLayers(0), + mDpy(EGL_NO_DISPLAY), mSur(EGL_NO_SURFACE), mEventHandler(handler), - mDebugForceFakeVSync(false) + mRefreshPeriod(refreshPeriod), + mVSyncCount(0), mDebugForceFakeVSync(false) { - for (size_t i =0 ; i> 24) & 0xff, - (hwcApiVersion(mHwc) >> 16) & 0xff); - if (mHwc->registerProcs) { - mCBContext->hwc = this; - mCBContext->procs.invalidate = &hook_invalidate; - mCBContext->procs.vsync = &hook_vsync; - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) - mCBContext->procs.hotplug = &hook_hotplug; - else - mCBContext->procs.hotplug = NULL; - memset(mCBContext->procs.zero, 0, sizeof(mCBContext->procs.zero)); - mHwc->registerProcs(mHwc, &mCBContext->procs); - } - - // don't need a vsync thread if we have a hardware composer - needVSyncThread = false; - // always turn vsync off when we start - eventControl(HWC_DISPLAY_PRIMARY, HWC_EVENT_VSYNC, 0); - - // the number of displays we actually have depends on the - // hw composer version - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) { - // 1.3 adds support for virtual displays - mNumDisplays = MAX_HWC_DISPLAYS; - } else if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - // 1.1 adds support for multiple displays - mNumDisplays = NUM_BUILTIN_DISPLAYS; - } else { - mNumDisplays = 1; - } - } - - if (mFbDev) { - ALOG_ASSERT(!(mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)), - "should only have fbdev if no hwc or hwc is 1.0"); - - DisplayData& disp(mDisplayData[HWC_DISPLAY_PRIMARY]); - disp.connected = true; - disp.format = mFbDev->format; - DisplayConfig config = DisplayConfig(); - config.width = mFbDev->width; - config.height = mFbDev->height; - config.xdpi = mFbDev->xdpi; - config.ydpi = mFbDev->ydpi; - config.refresh = nsecs_t(1e9 / mFbDev->fps); - disp.configs.push_back(config); - disp.currentConfig = 0; - } else if (mHwc) { - // here we're guaranteed to have at least HWC 1.1 - for (size_t i =0 ; iregisterProcs) { + mCBContext.hwc = this; + mCBContext.procs.invalidate = &hook_invalidate; + mCBContext.procs.vsync = &hook_vsync; + mHwc->registerProcs(mHwc, &mCBContext.procs); + memset(mCBContext.procs.zero, 0, sizeof(mCBContext.procs.zero)); + } + if (mHwc->common.version >= HWC_DEVICE_API_VERSION_0_3) { + if (mDebugForceFakeVSync) { + // make sure to turn h/w vsync off in "fake vsync" mode + mHwc->methods->eventControl(mHwc, HWC_EVENT_VSYNC, 0); + } + } else { + needVSyncThread = true; + } } + } else { + needVSyncThread = true; } if (needVSyncThread) { @@ -193,377 +94,47 @@ } HWComposer::~HWComposer() { - if (mHwc) { - eventControl(HWC_DISPLAY_PRIMARY, HWC_EVENT_VSYNC, 0); - } + eventControl(EVENT_VSYNC, 0); + free(mList); if (mVSyncThread != NULL) { mVSyncThread->requestExitAndWait(); } if (mHwc) { - hwc_close_1(mHwc); - } - if (mFbDev) { - framebuffer_close(mFbDev); - } - delete mCBContext; -} - -// Load and prepare the hardware composer module. Sets mHwc. -void HWComposer::loadHwcModule() -{ - hw_module_t const* module; - - if (hw_get_module(HWC_HARDWARE_MODULE_ID, &module) != 0) { - ALOGE("%s module not found", HWC_HARDWARE_MODULE_ID); - return; - } - - int err = hwc_open_1(module, &mHwc); - if (err) { - ALOGE("%s device failed to initialize (%s)", - HWC_HARDWARE_COMPOSER, strerror(-err)); - return; - } - - if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_0) || - hwcHeaderVersion(mHwc) < MIN_HWC_HEADER_VERSION || - hwcHeaderVersion(mHwc) > HWC_HEADER_VERSION) { - ALOGE("%s device version %#x unsupported, will not be used", - HWC_HARDWARE_COMPOSER, mHwc->common.version); - hwc_close_1(mHwc); - mHwc = NULL; - return; + hwc_close(mHwc); } } -// Load and prepare the FB HAL, which uses the gralloc module. Sets mFbDev. -int HWComposer::loadFbHalModule() -{ - hw_module_t const* module; - - int err = hw_get_module(GRALLOC_HARDWARE_MODULE_ID, &module); - if (err != 0) { - ALOGE("%s module not found", GRALLOC_HARDWARE_MODULE_ID); - return err; - } - - return framebuffer_open(module, &mFbDev); -} - status_t HWComposer::initCheck() const { return mHwc ? NO_ERROR : NO_INIT; } -void HWComposer::hook_invalidate(const struct hwc_procs* procs) { - cb_context* ctx = reinterpret_cast( - const_cast(procs)); - ctx->hwc->invalidate(); -} - -void HWComposer::hook_vsync(const struct hwc_procs* procs, int disp, - int64_t timestamp) { - cb_context* ctx = reinterpret_cast( - const_cast(procs)); - ctx->hwc->vsync(disp, timestamp); -} - -void HWComposer::hook_hotplug(const struct hwc_procs* procs, int disp, - int connected) { - cb_context* ctx = reinterpret_cast( - const_cast(procs)); - ctx->hwc->hotplug(disp, connected); -} - -void HWComposer::invalidate() { - mFlinger->repaintEverything(); +void HWComposer::hook_invalidate(struct hwc_procs* procs) { + reinterpret_cast(procs)->hwc->invalidate(); } -void HWComposer::vsync(int disp, int64_t timestamp) { - if (uint32_t(disp) < HWC_NUM_PHYSICAL_DISPLAY_TYPES) { - { - Mutex::Autolock _l(mLock); - - // There have been reports of HWCs that signal several vsync events - // with the same timestamp when turning the display off and on. This - // is a bug in the HWC implementation, but filter the extra events - // out here so they don't cause havoc downstream. - if (timestamp == mLastHwVSync[disp]) { - ALOGW("Ignoring duplicate VSYNC event from HWC (t=%" PRId64 ")", - timestamp); - return; - } - - mLastHwVSync[disp] = timestamp; - } - - char tag[16]; - snprintf(tag, sizeof(tag), "HW_VSYNC_%1u", disp); - ATRACE_INT(tag, ++mVSyncCounts[disp] & 1); - - mEventHandler.onVSyncReceived(disp, timestamp); - } +void HWComposer::hook_vsync(struct hwc_procs* procs, int dpy, int64_t timestamp) { + reinterpret_cast(procs)->hwc->vsync(dpy, timestamp); } -void HWComposer::hotplug(int disp, int connected) { - if (disp >= VIRTUAL_DISPLAY_ID_BASE) { - ALOGE("hotplug event received for invalid display: disp=%d connected=%d", - disp, connected); - return; - } - queryDisplayProperties(disp); - // Do not teardown or recreate the primary display - if (disp != HWC_DISPLAY_PRIMARY) { - mEventHandler.onHotplugReceived(disp, bool(connected)); - } -} - -static float getDefaultDensity(uint32_t width, uint32_t height) { - // Default density is based on TVs: 1080p displays get XHIGH density, - // lower-resolution displays get TV density. Maybe eventually we'll need - // to update it for 4K displays, though hopefully those just report - // accurate DPI information to begin with. This is also used for virtual - // displays and even primary displays with older hwcomposers, so be - // careful about orientation. - - uint32_t h = width < height ? width : height; - if (h >= 1080) return ACONFIGURATION_DENSITY_XHIGH; - else return ACONFIGURATION_DENSITY_TV; -} - -static const uint32_t DISPLAY_ATTRIBUTES[] = { - HWC_DISPLAY_VSYNC_PERIOD, - HWC_DISPLAY_WIDTH, - HWC_DISPLAY_HEIGHT, - HWC_DISPLAY_DPI_X, - HWC_DISPLAY_DPI_Y, - HWC_DISPLAY_COLOR_TRANSFORM, - HWC_DISPLAY_NO_ATTRIBUTE, -}; -#define NUM_DISPLAY_ATTRIBUTES (sizeof(DISPLAY_ATTRIBUTES) / sizeof(DISPLAY_ATTRIBUTES)[0]) - -static const uint32_t PRE_HWC15_DISPLAY_ATTRIBUTES[] = { - HWC_DISPLAY_VSYNC_PERIOD, - HWC_DISPLAY_WIDTH, - HWC_DISPLAY_HEIGHT, - HWC_DISPLAY_DPI_X, - HWC_DISPLAY_DPI_Y, - HWC_DISPLAY_NO_ATTRIBUTE, -}; - -status_t HWComposer::queryDisplayProperties(int disp) { - - LOG_ALWAYS_FATAL_IF(!mHwc || !hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)); - - // use zero as default value for unspecified attributes - int32_t values[NUM_DISPLAY_ATTRIBUTES - 1]; - memset(values, 0, sizeof(values)); - - const size_t MAX_NUM_CONFIGS = 128; - uint32_t configs[MAX_NUM_CONFIGS] = {0}; - size_t numConfigs = MAX_NUM_CONFIGS; - status_t err = mHwc->getDisplayConfigs(mHwc, disp, configs, &numConfigs); - if (err != NO_ERROR) { - // this can happen if an unpluggable display is not connected - mDisplayData[disp].connected = false; - return err; - } - - mDisplayData[disp].currentConfig = 0; - for (size_t c = 0; c < numConfigs; ++c) { - err = mHwc->getDisplayAttributes(mHwc, disp, configs[c], - DISPLAY_ATTRIBUTES, values); - // If this is a pre-1.5 HWC, it may not know about color transform, so - // try again with a smaller set of attributes - if (err != NO_ERROR) { - err = mHwc->getDisplayAttributes(mHwc, disp, configs[c], - PRE_HWC15_DISPLAY_ATTRIBUTES, values); - } - if (err != NO_ERROR) { - // we can't get this display's info. turn it off. - mDisplayData[disp].connected = false; - return err; - } - - DisplayConfig config = DisplayConfig(); - for (size_t i = 0; i < NUM_DISPLAY_ATTRIBUTES - 1; i++) { - switch (DISPLAY_ATTRIBUTES[i]) { - case HWC_DISPLAY_VSYNC_PERIOD: - config.refresh = nsecs_t(values[i]); - break; - case HWC_DISPLAY_WIDTH: - config.width = values[i]; - break; - case HWC_DISPLAY_HEIGHT: - config.height = values[i]; - break; - case HWC_DISPLAY_DPI_X: - config.xdpi = values[i] / 1000.0f; - break; - case HWC_DISPLAY_DPI_Y: - config.ydpi = values[i] / 1000.0f; - break; - case HWC_DISPLAY_COLOR_TRANSFORM: - config.colorTransform = values[i]; - break; - default: - ALOG_ASSERT(false, "unknown display attribute[%zu] %#x", - i, DISPLAY_ATTRIBUTES[i]); - break; - } - } - - if (config.xdpi == 0.0f || config.ydpi == 0.0f) { - float dpi = getDefaultDensity(config.width, config.height); - config.xdpi = dpi; - config.ydpi = dpi; - } - - mDisplayData[disp].configs.push_back(config); - } - - // FIXME: what should we set the format to? - mDisplayData[disp].format = HAL_PIXEL_FORMAT_RGBA_8888; - mDisplayData[disp].connected = true; - return NO_ERROR; -} - -status_t HWComposer::setVirtualDisplayProperties(int32_t id, - uint32_t w, uint32_t h, uint32_t format) { - if (id < VIRTUAL_DISPLAY_ID_BASE || id >= int32_t(mNumDisplays) || - !mAllocatedDisplayIDs.hasBit(id)) { - return BAD_INDEX; - } - size_t configId = mDisplayData[id].currentConfig; - mDisplayData[id].format = format; - DisplayConfig& config = mDisplayData[id].configs.editItemAt(configId); - config.width = w; - config.height = h; - config.xdpi = config.ydpi = getDefaultDensity(w, h); - return NO_ERROR; -} - -int32_t HWComposer::allocateDisplayId() { - if (mAllocatedDisplayIDs.count() >= mNumDisplays) { - return NO_MEMORY; - } - int32_t id = mAllocatedDisplayIDs.firstUnmarkedBit(); - mAllocatedDisplayIDs.markBit(id); - mDisplayData[id].connected = true; - mDisplayData[id].configs.resize(1); - mDisplayData[id].currentConfig = 0; - return id; -} - -status_t HWComposer::freeDisplayId(int32_t id) { - if (id < NUM_BUILTIN_DISPLAYS) { - // cannot free the reserved IDs - return BAD_VALUE; - } - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) { - return BAD_INDEX; - } - mAllocatedDisplayIDs.clearBit(id); - mDisplayData[id].connected = false; - return NO_ERROR; -} - -nsecs_t HWComposer::getRefreshTimestamp(int disp) const { - // this returns the last refresh timestamp. - // if the last one is not available, we estimate it based on - // the refresh period and whatever closest timestamp we have. - Mutex::Autolock _l(mLock); - nsecs_t now = systemTime(CLOCK_MONOTONIC); - size_t configId = mDisplayData[disp].currentConfig; - return now - ((now - mLastHwVSync[disp]) % - mDisplayData[disp].configs[configId].refresh); -} - -sp HWComposer::getDisplayFence(int disp) const { - return mDisplayData[disp].lastDisplayFence; -} - -uint32_t HWComposer::getFormat(int disp) const { - if (static_cast(disp) >= MAX_HWC_DISPLAYS || !mAllocatedDisplayIDs.hasBit(disp)) { - return HAL_PIXEL_FORMAT_RGBA_8888; - } else { - return mDisplayData[disp].format; - } -} - -bool HWComposer::isConnected(int disp) const { - return mDisplayData[disp].connected; -} - -uint32_t HWComposer::getWidth(int disp) const { - size_t currentConfig = mDisplayData[disp].currentConfig; - return mDisplayData[disp].configs[currentConfig].width; -} - -uint32_t HWComposer::getHeight(int disp) const { - size_t currentConfig = mDisplayData[disp].currentConfig; - return mDisplayData[disp].configs[currentConfig].height; -} - -float HWComposer::getDpiX(int disp) const { - size_t currentConfig = mDisplayData[disp].currentConfig; - return mDisplayData[disp].configs[currentConfig].xdpi; -} - -float HWComposer::getDpiY(int disp) const { - size_t currentConfig = mDisplayData[disp].currentConfig; - return mDisplayData[disp].configs[currentConfig].ydpi; -} - -nsecs_t HWComposer::getRefreshPeriod(int disp) const { - size_t currentConfig = mDisplayData[disp].currentConfig; - return mDisplayData[disp].configs[currentConfig].refresh; -} - -const Vector& HWComposer::getConfigs(int disp) const { - return mDisplayData[disp].configs; +void HWComposer::invalidate() { + mFlinger->repaintEverything(); } -size_t HWComposer::getCurrentConfig(int disp) const { - return mDisplayData[disp].currentConfig; +void HWComposer::vsync(int dpy, int64_t timestamp) { + ATRACE_INT("VSYNC", ++mVSyncCount&1); + mEventHandler.onVSyncReceived(dpy, timestamp); } -void HWComposer::eventControl(int disp, int event, int enabled) { - if (uint32_t(disp)>31 || !mAllocatedDisplayIDs.hasBit(disp)) { - ALOGD("eventControl ignoring event %d on unallocated disp %d (en=%d)", - event, disp, enabled); - return; - } - if (event != EVENT_VSYNC) { - ALOGW("eventControl got unexpected event %d (disp=%d en=%d)", - event, disp, enabled); - return; - } +void HWComposer::eventControl(int event, int enabled) { status_t err = NO_ERROR; - if (mHwc && !mDebugForceFakeVSync) { - // NOTE: we use our own internal lock here because we have to call - // into the HWC with the lock held, and we want to make sure - // that even if HWC blocks (which it shouldn't), it won't - // affect other threads. - Mutex::Autolock _l(mEventControlLock); - const int32_t eventBit = 1UL << event; - const int32_t newValue = enabled ? eventBit : 0; - const int32_t oldValue = mDisplayData[disp].events & eventBit; - if (newValue != oldValue) { - ATRACE_CALL(); - err = mHwc->eventControl(mHwc, disp, event, enabled); - if (!err) { - int32_t& events(mDisplayData[disp].events); - events = (events & ~eventBit) | newValue; - - char tag[16]; - snprintf(tag, sizeof(tag), "HW_VSYNC_ON_%1u", disp); - ATRACE_INT(tag, enabled); - } + if (mHwc && mHwc->common.version >= HWC_DEVICE_API_VERSION_0_3) { + if (!mDebugForceFakeVSync) { + err = mHwc->methods->eventControl(mHwc, event, enabled); + // error here should not happen -- not sure what we should + // do if it does. + ALOGE_IF(err, "eventControl(%d, %d) failed %s", + event, enabled, strerror(-err)); } - // error here should not happen -- not sure what we should - // do if it does. - ALOGE_IF(err, "eventControl(%d, %d) failed %s", - event, enabled, strerror(-err)); } if (err == NO_ERROR && mVSyncThread != NULL) { @@ -571,690 +142,130 @@ } } -status_t HWComposer::createWorkList(int32_t id, size_t numLayers) { - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) { - return BAD_INDEX; - } +void HWComposer::setFrameBuffer(EGLDisplay dpy, EGLSurface sur) { + mDpy = (hwc_display_t)dpy; + mSur = (hwc_surface_t)sur; +} +status_t HWComposer::createWorkList(size_t numLayers) { if (mHwc) { - DisplayData& disp(mDisplayData[id]); - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - // we need space for the HWC_FRAMEBUFFER_TARGET - numLayers++; - } - if (disp.capacity < numLayers || disp.list == NULL) { - size_t size = sizeof(hwc_display_contents_1_t) - + numLayers * sizeof(hwc_layer_1_t); - free(disp.list); - disp.list = (hwc_display_contents_1_t*)malloc(size); - disp.capacity = numLayers; - } - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - disp.framebufferTarget = &disp.list->hwLayers[numLayers - 1]; - memset(disp.framebufferTarget, 0, sizeof(hwc_layer_1_t)); - const DisplayConfig& currentConfig = - disp.configs[disp.currentConfig]; - const hwc_rect_t r = { 0, 0, - (int) currentConfig.width, (int) currentConfig.height }; - disp.framebufferTarget->compositionType = HWC_FRAMEBUFFER_TARGET; - disp.framebufferTarget->hints = 0; - disp.framebufferTarget->flags = 0; - disp.framebufferTarget->handle = disp.fbTargetHandle; - disp.framebufferTarget->transform = 0; - disp.framebufferTarget->blending = HWC_BLENDING_PREMULT; - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) { - disp.framebufferTarget->sourceCropf.left = 0; - disp.framebufferTarget->sourceCropf.top = 0; - disp.framebufferTarget->sourceCropf.right = - currentConfig.width; - disp.framebufferTarget->sourceCropf.bottom = - currentConfig.height; - } else { - disp.framebufferTarget->sourceCrop = r; - } - disp.framebufferTarget->displayFrame = r; - disp.framebufferTarget->visibleRegionScreen.numRects = 1; - disp.framebufferTarget->visibleRegionScreen.rects = - &disp.framebufferTarget->displayFrame; - disp.framebufferTarget->acquireFenceFd = -1; - disp.framebufferTarget->releaseFenceFd = -1; - disp.framebufferTarget->planeAlpha = 0xFF; + if (!mList || mCapacity < numLayers) { + free(mList); + size_t size = sizeof(hwc_layer_list) + numLayers*sizeof(hwc_layer_t); + mList = (hwc_layer_list_t*)malloc(size); + mCapacity = numLayers; } - disp.list->retireFenceFd = -1; - disp.list->flags = HWC_GEOMETRY_CHANGED; - disp.list->numHwLayers = numLayers; - } - return NO_ERROR; -} - -status_t HWComposer::setFramebufferTarget(int32_t id, - const sp& acquireFence, const sp& buf) { - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) { - return BAD_INDEX; - } - DisplayData& disp(mDisplayData[id]); - if (!disp.framebufferTarget) { - // this should never happen, but apparently eglCreateWindowSurface() - // triggers a Surface::queueBuffer() on some - // devices (!?) -- log and ignore. - ALOGE("HWComposer: framebufferTarget is null"); - return NO_ERROR; - } - - int acquireFenceFd = -1; - if (acquireFence->isValid()) { - acquireFenceFd = acquireFence->dup(); + mList->flags = HWC_GEOMETRY_CHANGED; + mList->numHwLayers = numLayers; } - - // ALOGD("fbPost: handle=%p, fence=%d", buf->handle, acquireFenceFd); - disp.fbTargetHandle = buf->handle; - disp.framebufferTarget->handle = disp.fbTargetHandle; - disp.framebufferTarget->acquireFenceFd = acquireFenceFd; return NO_ERROR; } -status_t HWComposer::prepare() { - Mutex::Autolock _l(mDisplayLock); - for (size_t i=0 ; icompositionType = HWC_FRAMEBUFFER_TARGET; - } - if (!disp.connected && disp.list != NULL) { - ALOGW("WARNING: disp %zu: connected, non-null list, layers=%zu", - i, disp.list->numHwLayers); - } - mLists[i] = disp.list; - if (mLists[i]) { - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) { - mLists[i]->outbuf = disp.outbufHandle; - mLists[i]->outbufAcquireFenceFd = -1; - } else if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - // garbage data to catch improper use - mLists[i]->dpy = (hwc_display_t)0xDEADBEEF; - mLists[i]->sur = (hwc_surface_t)0xDEADBEEF; - } else { - mLists[i]->dpy = EGL_NO_DISPLAY; - mLists[i]->sur = EGL_NO_SURFACE; - } - } - } - - int err = mHwc->prepare(mHwc, mNumDisplays, mLists); - ALOGE_IF(err, "HWComposer: prepare failed (%s)", strerror(-err)); - +status_t HWComposer::prepare() const { + int err = mHwc->prepare(mHwc, mList); if (err == NO_ERROR) { - // here we're just making sure that "skip" layers are set - // to HWC_FRAMEBUFFER and we're also counting how many layers - // we have of each type. - // - // If there are no window layers, we treat the display has having FB - // composition, because SurfaceFlinger will use GLES to draw the - // wormhole region. - for (size_t i=0 ; inumHwLayers ; i++) { - hwc_layer_1_t& l = disp.list->hwLayers[i]; - - //ALOGD("prepare: %d, type=%d, handle=%p", - // i, l.compositionType, l.handle); - - if (l.flags & HWC_SKIP_LAYER) { - l.compositionType = HWC_FRAMEBUFFER; - } - if (l.compositionType == HWC_FRAMEBUFFER) { - disp.hasFbComp = true; - } - if (l.compositionType == HWC_OVERLAY) { - disp.hasOvComp = true; - } - if (l.compositionType == HWC_CURSOR_OVERLAY) { - disp.hasOvComp = true; - } - } - if (disp.list->numHwLayers == (disp.framebufferTarget ? 1 : 0)) { - disp.hasFbComp = true; - } - } else { - disp.hasFbComp = true; + size_t numOVLayers = 0; + size_t numFBLayers = 0; + size_t count = mList->numHwLayers; + for (size_t i=0 ; ihwLayers[i]); + if (l.flags & HWC_SKIP_LAYER) { + l.compositionType = HWC_FRAMEBUFFER; + } + switch (l.compositionType) { + case HWC_OVERLAY: + numOVLayers++; + break; + case HWC_FRAMEBUFFER: + numFBLayers++; + break; } } + mNumOVLayers = numOVLayers; + mNumFBLayers = numFBLayers; } return (status_t)err; } -bool HWComposer::hasHwcComposition(int32_t id) const { - if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) - return false; - return mDisplayData[id].hasOvComp; -} - -bool HWComposer::hasGlesComposition(int32_t id) const { - if (!mHwc || uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) - return true; - return mDisplayData[id].hasFbComp; -} - -sp HWComposer::getAndResetReleaseFence(int32_t id) { - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) - return Fence::NO_FENCE; - - int fd = INVALID_OPERATION; - if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - const DisplayData& disp(mDisplayData[id]); - if (disp.framebufferTarget) { - fd = disp.framebufferTarget->releaseFenceFd; - disp.framebufferTarget->acquireFenceFd = -1; - disp.framebufferTarget->releaseFenceFd = -1; - } - } - return fd >= 0 ? new Fence(fd) : Fence::NO_FENCE; +size_t HWComposer::getLayerCount(int type) const { + switch (type) { + case HWC_OVERLAY: + return mNumOVLayers; + case HWC_FRAMEBUFFER: + return mNumFBLayers; + } + return 0; } -status_t HWComposer::commit() { - int err = NO_ERROR; - if (mHwc) { - if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - // On version 1.0, the OpenGL ES target surface is communicated - // by the (dpy, sur) fields and we are guaranteed to have only - // a single display. - mLists[0]->dpy = eglGetCurrentDisplay(); - mLists[0]->sur = eglGetCurrentSurface(EGL_DRAW); - } - - for (size_t i=VIRTUAL_DISPLAY_ID_BASE; ioutbuf = disp.outbufHandle; - mLists[i]->outbufAcquireFenceFd = - disp.outbufAcquireFence->dup(); - } - } - - err = mHwc->set(mHwc, mNumDisplays, mLists); - - for (size_t i=0 ; iretireFenceFd != -1) { - disp.lastRetireFence = new Fence(disp.list->retireFenceFd); - disp.list->retireFenceFd = -1; - } - disp.list->flags &= ~HWC_GEOMETRY_CHANGED; - } - } +status_t HWComposer::commit() const { + int err = mHwc->set(mHwc, mDpy, mSur, mList); + if (mList) { + mList->flags &= ~HWC_GEOMETRY_CHANGED; } return (status_t)err; } -status_t HWComposer::setPowerMode(int disp, int mode) { - LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE); +status_t HWComposer::release() const { if (mHwc) { - if (mode == HWC_POWER_MODE_OFF) { - eventControl(disp, HWC_EVENT_VSYNC, 0); - } - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) { - return (status_t)mHwc->setPowerMode(mHwc, disp, mode); - } else { - return (status_t)mHwc->blank(mHwc, disp, - mode == HWC_POWER_MODE_OFF ? 1 : 0); + if (mHwc->common.version >= HWC_DEVICE_API_VERSION_0_3) { + mHwc->methods->eventControl(mHwc, HWC_EVENT_VSYNC, 0); } + int err = mHwc->set(mHwc, NULL, NULL, NULL); + return (status_t)err; } return NO_ERROR; } -status_t HWComposer::setActiveConfig(int disp, int mode) { - LOG_FATAL_IF(disp >= VIRTUAL_DISPLAY_ID_BASE); - DisplayData& dd(mDisplayData[disp]); - dd.currentConfig = mode; - if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) { - return (status_t)mHwc->setActiveConfig(mHwc, disp, mode); - } else { - LOG_FATAL_IF(mode != 0); - } - return NO_ERROR; -} - -void HWComposer::disconnectDisplay(int disp) { - LOG_ALWAYS_FATAL_IF(disp < 0 || disp == HWC_DISPLAY_PRIMARY); - DisplayData& dd(mDisplayData[disp]); - free(dd.list); - dd.list = NULL; - dd.framebufferTarget = NULL; // points into dd.list - dd.fbTargetHandle = NULL; - dd.outbufHandle = NULL; - dd.lastRetireFence = Fence::NO_FENCE; - dd.lastDisplayFence = Fence::NO_FENCE; - dd.outbufAcquireFence = Fence::NO_FENCE; - // clear all the previous configs and repopulate when a new - // device is added - dd.configs.clear(); -} - -int HWComposer::getVisualID() const { - if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - // FIXME: temporary hack until HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED - // is supported by the implementation. we can only be in this case - // if we have HWC 1.1 - return HAL_PIXEL_FORMAT_RGBA_8888; - //return HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; - } else { - return mFbDev->format; - } -} - -bool HWComposer::supportsFramebufferTarget() const { - return (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)); -} - -int HWComposer::fbPost(int32_t id, - const sp& acquireFence, const sp& buffer) { - if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - return setFramebufferTarget(id, acquireFence, buffer); - } else { - acquireFence->waitForever("HWComposer::fbPost"); - return mFbDev->post(mFbDev, buffer->handle); - } -} - -int HWComposer::fbCompositionComplete() { - if (mHwc && hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) - return NO_ERROR; - - if (mFbDev->compositionComplete) { - return mFbDev->compositionComplete(mFbDev); - } else { - return INVALID_OPERATION; - } -} - -void HWComposer::fbDump(String8& result) { - if (mFbDev && mFbDev->common.version >= 1 && mFbDev->dump) { - const size_t SIZE = 4096; - char buffer[SIZE]; - mFbDev->dump(mFbDev, buffer, SIZE); - result.append(buffer); +status_t HWComposer::disable() { + if (mHwc) { + free(mList); + mList = NULL; + int err = mHwc->prepare(mHwc, NULL); + return (status_t)err; } -} - -status_t HWComposer::setOutputBuffer(int32_t id, const sp& acquireFence, - const sp& buf) { - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) - return BAD_INDEX; - if (id < VIRTUAL_DISPLAY_ID_BASE) - return INVALID_OPERATION; - - DisplayData& disp(mDisplayData[id]); - disp.outbufHandle = buf->handle; - disp.outbufAcquireFence = acquireFence; return NO_ERROR; } -sp HWComposer::getLastRetireFence(int32_t id) const { - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) - return Fence::NO_FENCE; - return mDisplayData[id].lastRetireFence; +size_t HWComposer::getNumLayers() const { + return mList ? mList->numHwLayers : 0; } -status_t HWComposer::setCursorPositionAsync(int32_t id, const Rect& pos) -{ - if (mHwc->setCursorPositionAsync) { - return (status_t)mHwc->setCursorPositionAsync(mHwc, id, pos.left, pos.top); - } - else { - return NO_ERROR; - } -} - -/* - * Helper template to implement a concrete HWCLayer - * This holds the pointer to the concrete hwc layer type - * and implements the "iterable" side of HWCLayer. - */ -template -class Iterable : public HWComposer::HWCLayer { -protected: - HWCTYPE* const mLayerList; - HWCTYPE* mCurrentLayer; - Iterable(HWCTYPE* layer) : mLayerList(layer), mCurrentLayer(layer) { } - inline HWCTYPE const * getLayer() const { return mCurrentLayer; } - inline HWCTYPE* getLayer() { return mCurrentLayer; } - virtual ~Iterable() { } -private: - // returns a copy of ourselves - virtual HWComposer::HWCLayer* dup() { - return new CONCRETE( static_cast(*this) ); - } - virtual status_t setLayer(size_t index) { - mCurrentLayer = &mLayerList[index]; - return NO_ERROR; - } -}; - -/* - * Concrete implementation of HWCLayer for HWC_DEVICE_API_VERSION_1_0. - * This implements the HWCLayer side of HWCIterableLayer. - */ -class HWCLayerVersion1 : public Iterable { - struct hwc_composer_device_1* mHwc; -public: - HWCLayerVersion1(struct hwc_composer_device_1* hwc, hwc_layer_1_t* layer) - : Iterable(layer), mHwc(hwc) { } - - virtual int32_t getCompositionType() const { - return getLayer()->compositionType; - } - virtual uint32_t getHints() const { - return getLayer()->hints; - } - virtual sp getAndResetReleaseFence() { - int fd = getLayer()->releaseFenceFd; - getLayer()->releaseFenceFd = -1; - return fd >= 0 ? new Fence(fd) : Fence::NO_FENCE; - } - virtual void setAcquireFenceFd(int fenceFd) { - getLayer()->acquireFenceFd = fenceFd; - } - virtual void setPerFrameDefaultState() { - //getLayer()->compositionType = HWC_FRAMEBUFFER; - } - virtual void setPlaneAlpha(uint8_t alpha) { - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_2)) { - getLayer()->planeAlpha = alpha; - } else { - if (alpha < 0xFF) { - getLayer()->flags |= HWC_SKIP_LAYER; - } - } - } - virtual void setDefaultState() { - hwc_layer_1_t* const l = getLayer(); - l->compositionType = HWC_FRAMEBUFFER; - l->hints = 0; - l->flags = HWC_SKIP_LAYER; - l->handle = 0; - l->transform = 0; - l->blending = HWC_BLENDING_NONE; - l->visibleRegionScreen.numRects = 0; - l->visibleRegionScreen.rects = NULL; - l->acquireFenceFd = -1; - l->releaseFenceFd = -1; - l->planeAlpha = 0xFF; - } - virtual void setSkip(bool skip) { - if (skip) { - getLayer()->flags |= HWC_SKIP_LAYER; - } else { - getLayer()->flags &= ~HWC_SKIP_LAYER; - } - } - virtual void setIsCursorLayerHint(bool isCursor) { - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_4)) { - if (isCursor) { - getLayer()->flags |= HWC_IS_CURSOR_LAYER; - } - else { - getLayer()->flags &= ~HWC_IS_CURSOR_LAYER; - } - } - } - virtual void setBlending(uint32_t blending) { - getLayer()->blending = blending; - } - virtual void setTransform(uint32_t transform) { - getLayer()->transform = transform; - } - virtual void setFrame(const Rect& frame) { - getLayer()->displayFrame = reinterpret_cast(frame); - } - virtual void setCrop(const FloatRect& crop) { - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) { - getLayer()->sourceCropf = reinterpret_cast(crop); - } else { - /* - * Since h/w composer didn't support a flot crop rect before version 1.3, - * using integer coordinates instead produces a different output from the GL code in - * Layer::drawWithOpenGL(). The difference can be large if the buffer crop to - * window size ratio is large and a window crop is defined - * (i.e.: if we scale the buffer a lot and we also crop it with a window crop). - */ - hwc_rect_t& r = getLayer()->sourceCrop; - r.left = int(ceilf(crop.left)); - r.top = int(ceilf(crop.top)); - r.right = int(floorf(crop.right)); - r.bottom= int(floorf(crop.bottom)); - } - } - virtual void setVisibleRegionScreen(const Region& reg) { - // Region::getSharedBuffer creates a reference to the underlying - // SharedBuffer of this Region, this reference is freed - // in onDisplayed() - hwc_region_t& visibleRegion = getLayer()->visibleRegionScreen; - SharedBuffer const* sb = reg.getSharedBuffer(&visibleRegion.numRects); - visibleRegion.rects = reinterpret_cast(sb->data()); - } - virtual void setSurfaceDamage(const Region& reg) { - if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_5)) { - return; - } - hwc_region_t& surfaceDamage = getLayer()->surfaceDamage; - // We encode default full-screen damage as INVALID_RECT upstream, but as - // 0 rects for HWComposer - if (reg.isRect() && reg.getBounds() == Rect::INVALID_RECT) { - surfaceDamage.numRects = 0; - surfaceDamage.rects = NULL; - return; - } - SharedBuffer const* sb = reg.getSharedBuffer(&surfaceDamage.numRects); - surfaceDamage.rects = reinterpret_cast(sb->data()); - } - virtual void setSidebandStream(const sp& stream) { - ALOG_ASSERT(stream->handle() != NULL); - getLayer()->compositionType = HWC_SIDEBAND; - getLayer()->sidebandStream = stream->handle(); - } - virtual void setBuffer(const sp& buffer) { - if (buffer == 0 || buffer->handle == 0) { - getLayer()->compositionType = HWC_FRAMEBUFFER; - getLayer()->flags |= HWC_SKIP_LAYER; - getLayer()->handle = 0; - } else { - if (getLayer()->compositionType == HWC_SIDEBAND) { - // If this was a sideband layer but the stream was removed, reset - // it to FRAMEBUFFER. The HWC can change it to OVERLAY in prepare. - getLayer()->compositionType = HWC_FRAMEBUFFER; - } - getLayer()->handle = buffer->handle; - } - } - virtual void onDisplayed() { - hwc_region_t& visibleRegion = getLayer()->visibleRegionScreen; - SharedBuffer const* sb = SharedBuffer::bufferFromData(visibleRegion.rects); - if (sb) { - sb->release(); - // not technically needed but safer - visibleRegion.numRects = 0; - visibleRegion.rects = NULL; - } - - getLayer()->acquireFenceFd = -1; - - if (!hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_5)) { - return; - } - - hwc_region_t& surfaceDamage = getLayer()->surfaceDamage; - sb = SharedBuffer::bufferFromData(surfaceDamage.rects); - if (sb) { - sb->release(); - surfaceDamage.numRects = 0; - surfaceDamage.rects = NULL; - } - } -}; - -/* - * returns an iterator initialized at a given index in the layer list - */ -HWComposer::LayerListIterator HWComposer::getLayerIterator(int32_t id, size_t index) { - if (uint32_t(id)>31 || !mAllocatedDisplayIDs.hasBit(id)) { - return LayerListIterator(); - } - const DisplayData& disp(mDisplayData[id]); - if (!mHwc || !disp.list || index > disp.list->numHwLayers) { - return LayerListIterator(); - } - return LayerListIterator(new HWCLayerVersion1(mHwc, disp.list->hwLayers), index); -} - -/* - * returns an iterator on the beginning of the layer list - */ -HWComposer::LayerListIterator HWComposer::begin(int32_t id) { - return getLayerIterator(id, 0); -} - -/* - * returns an iterator on the end of the layer list - */ -HWComposer::LayerListIterator HWComposer::end(int32_t id) { - size_t numLayers = 0; - if (uint32_t(id) <= 31 && mAllocatedDisplayIDs.hasBit(id)) { - const DisplayData& disp(mDisplayData[id]); - if (mHwc && disp.list) { - numLayers = disp.list->numHwLayers; - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_1)) { - // with HWC 1.1, the last layer is always the HWC_FRAMEBUFFER_TARGET, - // which we ignore when iterating through the layer list. - ALOGE_IF(!numLayers, "mDisplayData[%d].list->numHwLayers is 0", id); - if (numLayers) { - numLayers--; - } - } - } - } - return getLayerIterator(id, numLayers); -} - -// Converts a PixelFormat to a human-readable string. Max 11 chars. -// (Could use a table of prefab String8 objects.) -static String8 getFormatStr(PixelFormat format) { - switch (format) { - case PIXEL_FORMAT_RGBA_8888: return String8("RGBA_8888"); - case PIXEL_FORMAT_RGBX_8888: return String8("RGBx_8888"); - case PIXEL_FORMAT_RGB_888: return String8("RGB_888"); - case PIXEL_FORMAT_RGB_565: return String8("RGB_565"); - case PIXEL_FORMAT_BGRA_8888: return String8("BGRA_8888"); - case HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED: - return String8("ImplDef"); - default: - String8 result; - result.appendFormat("? %08x", format); - return result; - } +hwc_layer_t* HWComposer::getLayers() const { + return mList ? mList->hwLayers : 0; } -void HWComposer::dump(String8& result) const { - Mutex::Autolock _l(mDisplayLock); - if (mHwc) { - result.appendFormat("Hardware Composer state (version %08x):\n", hwcApiVersion(mHwc)); - result.appendFormat(" mDebugForceFakeVSync=%d\n", mDebugForceFakeVSync); - for (size_t i=0 ; i >& visibleLayersSortedByZ = - mFlinger->getLayerSortedByZForHwcDisplay(i); - - - result.appendFormat(" Display[%zd] configurations (* current):\n", i); - for (size_t c = 0; c < disp.configs.size(); ++c) { - const DisplayConfig& config(disp.configs[c]); - result.appendFormat(" %s%zd: %ux%u, xdpi=%f, ydpi=%f" - ", refresh=%" PRId64 ", colorTransform=%d\n", - c == disp.currentConfig ? "* " : "", c, - config.width, config.height, config.xdpi, config.ydpi, - config.refresh, config.colorTransform); - } - - if (disp.list) { - result.appendFormat( - " numHwLayers=%zu, flags=%08x\n", - disp.list->numHwLayers, disp.list->flags); - - result.append( - " type | handle | hint | flag | tr | blnd | format | source crop (l,t,r,b) | frame | name \n" - "-----------+----------+------+------+----+------+-------------+--------------------------------+------------------------+------\n"); - // " _________ | ________ | ____ | ____ | __ | ____ | ___________ |_____._,_____._,_____._,_____._ |_____,_____,_____,_____ | ___... - for (size_t i=0 ; inumHwLayers ; i++) { - const hwc_layer_1_t&l = disp.list->hwLayers[i]; - int32_t format = -1; - String8 name("unknown"); - - if (i < visibleLayersSortedByZ.size()) { - const sp& layer(visibleLayersSortedByZ[i]); - const sp& buffer( - layer->getActiveBuffer()); - if (buffer != NULL) { - format = buffer->getPixelFormat(); - } - name = layer->getName(); - } - - int type = l.compositionType; - if (type == HWC_FRAMEBUFFER_TARGET) { - name = "HWC_FRAMEBUFFER_TARGET"; - format = disp.format; - } - - static char const* compositionTypeName[] = { - "GLES", - "HWC", - "BKGND", - "FB TARGET", - "SIDEBAND", - "HWC_CURSOR", - "UNKNOWN"}; - if (type >= NELEM(compositionTypeName)) - type = NELEM(compositionTypeName) - 1; - - String8 formatStr = getFormatStr(format); - if (hwcHasApiVersion(mHwc, HWC_DEVICE_API_VERSION_1_3)) { - result.appendFormat( - " %9s | %08" PRIxPTR " | %04x | %04x | %02x | %04x | %-11s |%7.1f,%7.1f,%7.1f,%7.1f |%5d,%5d,%5d,%5d | %s\n", - compositionTypeName[type], - intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, formatStr.string(), - l.sourceCropf.left, l.sourceCropf.top, l.sourceCropf.right, l.sourceCropf.bottom, - l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom, - name.string()); - } else { - result.appendFormat( - " %9s | %08" PRIxPTR " | %04x | %04x | %02x | %04x | %-11s |%7d,%7d,%7d,%7d |%5d,%5d,%5d,%5d | %s\n", - compositionTypeName[type], - intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, formatStr.string(), - l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom, - l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom, - name.string()); - } +void HWComposer::dump(String8& result, char* buffer, size_t SIZE, + const Vector< sp >& visibleLayersSortedByZ) const { + if (mHwc && mList) { + result.append("Hardware Composer state:\n"); + result.appendFormat(" mDebugForceFakeVSync=%d\n", + mDebugForceFakeVSync); + result.appendFormat(" numHwLayers=%u, flags=%08x\n", + mList->numHwLayers, mList->flags); + result.append( + " type | handle | hints | flags | tr | blend | format | source crop | frame name \n" + "----------+----------+----------+----------+----+-------+----------+---------------------------+--------------------------------\n"); + // " ________ | ________ | ________ | ________ | __ | _____ | ________ | [_____,_____,_____,_____] | [_____,_____,_____,_____] + for (size_t i=0 ; inumHwLayers ; i++) { + const hwc_layer_t& l(mList->hwLayers[i]); + const sp layer(visibleLayersSortedByZ[i]); + int32_t format = -1; + if (layer->getLayer() != NULL) { + const sp& buffer(layer->getLayer()->getActiveBuffer()); + if (buffer != NULL) { + format = buffer->getPixelFormat(); } } + result.appendFormat( + " %8s | %08x | %08x | %08x | %02x | %05x | %08x | [%5d,%5d,%5d,%5d] | [%5d,%5d,%5d,%5d] %s\n", + l.compositionType ? "OVERLAY" : "FB", + intptr_t(l.handle), l.hints, l.flags, l.transform, l.blending, format, + l.sourceCrop.left, l.sourceCrop.top, l.sourceCrop.right, l.sourceCrop.bottom, + l.displayFrame.left, l.displayFrame.top, l.displayFrame.right, l.displayFrame.bottom, + layer->getName().string()); } } - - if (mHwc && mHwc->dump) { - const size_t SIZE = 4096; - char buffer[SIZE]; + if (mHwc && mHwc->common.version >= HWC_DEVICE_API_VERSION_0_1 && mHwc->dump) { mHwc->dump(mHwc, buffer, SIZE); result.append(buffer); } @@ -1265,16 +276,14 @@ HWComposer::VSyncThread::VSyncThread(HWComposer& hwc) : mHwc(hwc), mEnabled(false), mNextFakeVSync(0), - mRefreshPeriod(hwc.getRefreshPeriod(HWC_DISPLAY_PRIMARY)) + mRefreshPeriod(hwc.mRefreshPeriod) { } void HWComposer::VSyncThread::setEnabled(bool enabled) { Mutex::Autolock _l(mLock); - if (mEnabled != enabled) { - mEnabled = enabled; - mCondition.signal(); - } + mEnabled = enabled; + mCondition.signal(); } void HWComposer::VSyncThread::onFirstRef() { @@ -1316,22 +325,5 @@ return true; } -HWComposer::DisplayData::DisplayData() -: configs(), - currentConfig(0), - format(HAL_PIXEL_FORMAT_RGBA_8888), - connected(false), - hasFbComp(false), hasOvComp(false), - capacity(0), list(NULL), - framebufferTarget(NULL), fbTargetHandle(0), - lastRetireFence(Fence::NO_FENCE), lastDisplayFence(Fence::NO_FENCE), - outbufHandle(NULL), outbufAcquireFence(Fence::NO_FENCE), - events(0) -{} - -HWComposer::DisplayData::~DisplayData() { - free(list); -} - // --------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/HWComposer.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/HWComposer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/HWComposer.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/HWComposer.h 2012-10-16 22:57:11.000000000 +0000 @@ -20,228 +20,65 @@ #include #include -#include +#include -#include +#include -#include -#include -#include #include -#include -#include #include extern "C" int clock_nanosleep(clockid_t clock_id, int flags, const struct timespec *request, struct timespec *remain); -struct hwc_composer_device_1; -struct hwc_display_contents_1; -struct hwc_layer_1; -struct hwc_procs; -struct framebuffer_device_t; - namespace android { // --------------------------------------------------------------------------- -class Fence; -class FloatRect; -class GraphicBuffer; -class NativeHandle; -class Region; class String8; class SurfaceFlinger; +class LayerBase; class HWComposer { public: class EventHandler { friend class HWComposer; - virtual void onVSyncReceived(int disp, nsecs_t timestamp) = 0; - virtual void onHotplugReceived(int disp, bool connected) = 0; + virtual void onVSyncReceived(int dpy, nsecs_t timestamp) = 0; protected: virtual ~EventHandler() {} }; - enum { - NUM_BUILTIN_DISPLAYS = HWC_NUM_PHYSICAL_DISPLAY_TYPES, - MAX_HWC_DISPLAYS = HWC_NUM_DISPLAY_TYPES, - VIRTUAL_DISPLAY_ID_BASE = HWC_DISPLAY_VIRTUAL, - }; - - HWComposer( - const sp& flinger, - EventHandler& handler); - + HWComposer(const sp& flinger, + EventHandler& handler, nsecs_t refreshPeriod); ~HWComposer(); status_t initCheck() const; - // Returns a display ID starting at VIRTUAL_DISPLAY_ID_BASE, this ID is to - // be used with createWorkList (and all other methods requiring an ID - // below). - // IDs below NUM_BUILTIN_DISPLAYS are pre-defined and therefore are - // always valid. - // Returns -1 if an ID cannot be allocated - int32_t allocateDisplayId(); - - // Recycles the given virtual display ID and frees the associated worklist. - // IDs below NUM_BUILTIN_DISPLAYS are not recycled. - status_t freeDisplayId(int32_t id); - - - // Asks the HAL what it can do - status_t prepare(); - - // commits the list - status_t commit(); - - // set power mode - status_t setPowerMode(int disp, int mode); - - // set active config - status_t setActiveConfig(int disp, int mode); - - // reset state when an external, non-virtual display is disconnected - void disconnectDisplay(int disp); + // tells the HAL what the framebuffer is + void setFrameBuffer(EGLDisplay dpy, EGLSurface sur); // create a work list for numLayers layer. sets HWC_GEOMETRY_CHANGED. - status_t createWorkList(int32_t id, size_t numLayers); - - bool supportsFramebufferTarget() const; - - // does this display have layers handled by HWC - bool hasHwcComposition(int32_t id) const; - - // does this display have layers handled by GLES - bool hasGlesComposition(int32_t id) const; - - // get the releaseFence file descriptor for a display's framebuffer layer. - // the release fence is only valid after commit() - sp getAndResetReleaseFence(int32_t id); - - // needed forward declarations - class LayerListIterator; - - // return the visual id to be used to find a suitable EGLConfig for - // *ALL* displays. - int getVisualID() const; - - // Forwarding to FB HAL for pre-HWC-1.1 code (see FramebufferSurface). - int fbPost(int32_t id, const sp& acquireFence, const sp& buf); - int fbCompositionComplete(); - void fbDump(String8& result); - - // Set the output buffer and acquire fence for a virtual display. - // Returns INVALID_OPERATION if id is not a virtual display. - status_t setOutputBuffer(int32_t id, const sp& acquireFence, - const sp& buf); - - // Get the retire fence for the last committed frame. This fence will - // signal when the h/w composer is completely finished with the frame. - // For physical displays, it is no longer being displayed. For virtual - // displays, writes to the output buffer are complete. - sp getLastRetireFence(int32_t id) const; - - status_t setCursorPositionAsync(int32_t id, const Rect &pos); - - /* - * Interface to hardware composer's layers functionality. - * This abstracts the HAL interface to layers which can evolve in - * incompatible ways from one release to another. - * The idea is that we could extend this interface as we add - * features to h/w composer. - */ - class HWCLayerInterface { - protected: - virtual ~HWCLayerInterface() { } - public: - virtual int32_t getCompositionType() const = 0; - virtual uint32_t getHints() const = 0; - virtual sp getAndResetReleaseFence() = 0; - virtual void setDefaultState() = 0; - virtual void setSkip(bool skip) = 0; - virtual void setIsCursorLayerHint(bool isCursor = true) = 0; - virtual void setBlending(uint32_t blending) = 0; - virtual void setTransform(uint32_t transform) = 0; - virtual void setFrame(const Rect& frame) = 0; - virtual void setCrop(const FloatRect& crop) = 0; - virtual void setVisibleRegionScreen(const Region& reg) = 0; - virtual void setSurfaceDamage(const Region& reg) = 0; - virtual void setSidebandStream(const sp& stream) = 0; - virtual void setBuffer(const sp& buffer) = 0; - virtual void setAcquireFenceFd(int fenceFd) = 0; - virtual void setPlaneAlpha(uint8_t alpha) = 0; - virtual void onDisplayed() = 0; - }; - - /* - * Interface used to implement an iterator to a list - * of HWCLayer. - */ - class HWCLayer : public HWCLayerInterface { - friend class LayerListIterator; - // select the layer at the given index - virtual status_t setLayer(size_t index) = 0; - virtual HWCLayer* dup() = 0; - static HWCLayer* copy(HWCLayer *rhs) { - return rhs ? rhs->dup() : NULL; - } - protected: - virtual ~HWCLayer() { } - }; + status_t createWorkList(size_t numLayers); - /* - * Iterator through a HWCLayer list. - * This behaves more or less like a forward iterator. - */ - class LayerListIterator { - friend class HWComposer; - HWCLayer* const mLayerList; - size_t mIndex; - - LayerListIterator() : mLayerList(NULL), mIndex(0) { } - - LayerListIterator(HWCLayer* layer, size_t index) - : mLayerList(layer), mIndex(index) { } + // Asks the HAL what it can do + status_t prepare() const; - // we don't allow assignment, because we don't need it for now - LayerListIterator& operator = (const LayerListIterator& rhs); + // disable hwc until next createWorkList + status_t disable(); - public: - // copy operators - LayerListIterator(const LayerListIterator& rhs) - : mLayerList(HWCLayer::copy(rhs.mLayerList)), mIndex(rhs.mIndex) { - } - - ~LayerListIterator() { delete mLayerList; } - - // pre-increment - LayerListIterator& operator++() { - mLayerList->setLayer(++mIndex); - return *this; - } - - // dereference - HWCLayerInterface& operator * () { return *mLayerList; } - HWCLayerInterface* operator -> () { return mLayerList; } - - // comparison - bool operator == (const LayerListIterator& rhs) const { - return mIndex == rhs.mIndex; - } - bool operator != (const LayerListIterator& rhs) const { - return !operator==(rhs); - } - }; - - // Returns an iterator to the beginning of the layer list - LayerListIterator begin(int32_t id); + // commits the list + status_t commit() const; - // Returns an iterator to the end of the layer list - LayerListIterator end(int32_t id); + // release hardware resources + status_t release() const; + // get the layer array created by createWorkList() + size_t getNumLayers() const; + hwc_layer_t* getLayers() const; + + // get number of layers of the given type as updated in prepare(). + // type is HWC_OVERLAY or HWC_FRAMEBUFFER + size_t getLayerCount(int type) const; // Events handling --------------------------------------------------------- @@ -249,37 +86,7 @@ EVENT_VSYNC = HWC_EVENT_VSYNC }; - void eventControl(int disp, int event, int enabled); - - struct DisplayConfig { - uint32_t width; - uint32_t height; - float xdpi; - float ydpi; - nsecs_t refresh; - int colorTransform; - }; - - // Query display parameters. Pass in a display index (e.g. - // HWC_DISPLAY_PRIMARY). - nsecs_t getRefreshTimestamp(int disp) const; - sp getDisplayFence(int disp) const; - uint32_t getFormat(int disp) const; - bool isConnected(int disp) const; - - // These return the values for the current config of a given display index. - // To get the values for all configs, use getConfigs below. - uint32_t getWidth(int disp) const; - uint32_t getHeight(int disp) const; - float getDpiX(int disp) const; - float getDpiY(int disp) const; - nsecs_t getRefreshPeriod(int disp) const; - - const Vector& getConfigs(int disp) const; - size_t getCurrentConfig(int disp) const; - - status_t setVirtualDisplayProperties(int32_t id, uint32_t w, uint32_t h, - uint32_t format); + void eventControl(int event, int enabled); // this class is only used to fake the VSync event on systems that don't // have it. @@ -300,80 +107,47 @@ friend class VSyncThread; // for debugging ---------------------------------------------------------- - void dump(String8& out) const; + void dump(String8& out, char* scratch, size_t SIZE, + const Vector< sp >& visibleLayersSortedByZ) const; private: - void loadHwcModule(); - int loadFbHalModule(); - LayerListIterator getLayerIterator(int32_t id, size_t index); + struct callbacks : public hwc_procs_t { + // these are here to facilitate the transition when adding + // new callbacks (an implementation can check for NULL before + // calling a new callback). + void (*zero[4])(void); + }; - struct cb_context; + struct cb_context { + callbacks procs; + HWComposer* hwc; + }; - static void hook_invalidate(const struct hwc_procs* procs); - static void hook_vsync(const struct hwc_procs* procs, int disp, - int64_t timestamp); - static void hook_hotplug(const struct hwc_procs* procs, int disp, - int connected); + static void hook_invalidate(struct hwc_procs* procs); + static void hook_vsync(struct hwc_procs* procs, int dpy, int64_t timestamp); inline void invalidate(); - inline void vsync(int disp, int64_t timestamp); - inline void hotplug(int disp, int connected); - - status_t queryDisplayProperties(int disp); - - status_t setFramebufferTarget(int32_t id, - const sp& acquireFence, const sp& buf); + inline void vsync(int dpy, int64_t timestamp); - struct DisplayData { - DisplayData(); - ~DisplayData(); - Vector configs; - size_t currentConfig; - uint32_t format; // pixel format from FB hal, for pre-hwc-1.1 - bool connected; - bool hasFbComp; - bool hasOvComp; - size_t capacity; - hwc_display_contents_1* list; - hwc_layer_1* framebufferTarget; - buffer_handle_t fbTargetHandle; - sp lastRetireFence; // signals when the last set op retires - sp lastDisplayFence; // signals when the last set op takes - // effect on screen - buffer_handle_t outbufHandle; - sp outbufAcquireFence; - - // protected by mEventControlLock - int32_t events; - }; - - sp mFlinger; - framebuffer_device_t* mFbDev; - struct hwc_composer_device_1* mHwc; - // invariant: mLists[0] != NULL iff mHwc != NULL - // mLists[i>0] can be NULL. that display is to be ignored - struct hwc_display_contents_1* mLists[MAX_HWC_DISPLAYS]; - DisplayData mDisplayData[MAX_HWC_DISPLAYS]; - // protect mDisplayData from races between prepare and dump - mutable Mutex mDisplayLock; - size_t mNumDisplays; - - cb_context* mCBContext; - EventHandler& mEventHandler; - size_t mVSyncCounts[HWC_NUM_PHYSICAL_DISPLAY_TYPES]; - sp mVSyncThread; - bool mDebugForceFakeVSync; - BitSet32 mAllocatedDisplayIDs; - - // protected by mLock - mutable Mutex mLock; - mutable nsecs_t mLastHwVSync[HWC_NUM_PHYSICAL_DISPLAY_TYPES]; - - // thread-safe - mutable Mutex mEventControlLock; + sp mFlinger; + hw_module_t const* mModule; + hwc_composer_device_t* mHwc; + hwc_layer_list_t* mList; + size_t mCapacity; + mutable size_t mNumOVLayers; + mutable size_t mNumFBLayers; + hwc_display_t mDpy; + hwc_surface_t mSur; + cb_context mCBContext; + EventHandler& mEventHandler; + nsecs_t mRefreshPeriod; + size_t mVSyncCount; + sp mVSyncThread; + bool mDebugForceFakeVSync; }; + // --------------------------------------------------------------------------- }; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/PowerHAL.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/PowerHAL.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/PowerHAL.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/PowerHAL.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -20,30 +20,38 @@ #include #include -#include -#include -#include - #include "PowerHAL.h" namespace android { // --------------------------------------------------------------------------- +PowerHAL::PowerHAL() : mPowerModule(0), mVSyncHintEnabled(false) { + int err = hw_get_module(POWER_HARDWARE_MODULE_ID, + (const hw_module_t **)&mPowerModule); + ALOGW_IF(err, "%s module not found", POWER_HARDWARE_MODULE_ID); +} + +PowerHAL::~PowerHAL() { +} + +status_t PowerHAL::initCheck() const { + return mPowerModule ? NO_ERROR : NO_INIT; +} + status_t PowerHAL::vsyncHint(bool enabled) { - Mutex::Autolock _l(mlock); - if (mPowerManager == NULL) { - const String16 serviceName("power"); - sp bs = defaultServiceManager()->checkService(serviceName); - if (bs == NULL) { - return NAME_NOT_FOUND; - } - mPowerManager = interface_cast(bs); + if (!mPowerModule) { + return NO_INIT; } - status_t status = mPowerManager->powerHint(POWER_HINT_VSYNC, enabled ? 1 : 0); - if(status == DEAD_OBJECT) { - mPowerManager = NULL; + if (mPowerModule->common.module_api_version >= POWER_MODULE_API_VERSION_0_2) { + if (mPowerModule->powerHint) { + if (mVSyncHintEnabled != bool(enabled)) { + mPowerModule->powerHint(mPowerModule, + POWER_HINT_VSYNC, (void*)enabled); + mVSyncHintEnabled = bool(enabled); + } + } } - return status; + return NO_ERROR; } // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/PowerHAL.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/PowerHAL.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/PowerHAL.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/PowerHAL.h 2012-10-16 22:57:11.000000000 +0000 @@ -19,9 +19,7 @@ #include #include -#include -#include #include namespace android { @@ -30,11 +28,15 @@ class PowerHAL { public: + PowerHAL(); + ~PowerHAL(); + + status_t initCheck() const; status_t vsyncHint(bool enabled); private: - sp mPowerManager; - Mutex mlock; + power_module_t* mPowerModule; + bool mVSyncHintEnabled; }; // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,621 +0,0 @@ -/* - * Copyright 2013 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. - */ - -// #define LOG_NDEBUG 0 -#include "VirtualDisplaySurface.h" -#include "HWComposer.h" - -#include - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -#if defined(FORCE_HWC_COPY_FOR_VIRTUAL_DISPLAYS) -static const bool sForceHwcCopy = true; -#else -static const bool sForceHwcCopy = false; -#endif - -#define VDS_LOGE(msg, ...) ALOGE("[%s] " msg, \ - mDisplayName.string(), ##__VA_ARGS__) -#define VDS_LOGW_IF(cond, msg, ...) ALOGW_IF(cond, "[%s] " msg, \ - mDisplayName.string(), ##__VA_ARGS__) -#define VDS_LOGV(msg, ...) ALOGV("[%s] " msg, \ - mDisplayName.string(), ##__VA_ARGS__) - -static const char* dbgCompositionTypeStr(DisplaySurface::CompositionType type) { - switch (type) { - case DisplaySurface::COMPOSITION_UNKNOWN: return "UNKNOWN"; - case DisplaySurface::COMPOSITION_GLES: return "GLES"; - case DisplaySurface::COMPOSITION_HWC: return "HWC"; - case DisplaySurface::COMPOSITION_MIXED: return "MIXED"; - default: return ""; - } -} - -VirtualDisplaySurface::VirtualDisplaySurface(HWComposer& hwc, int32_t dispId, - const sp& sink, - const sp& bqProducer, - const sp& bqConsumer, - const String8& name) -: ConsumerBase(bqConsumer), - mHwc(hwc), - mDisplayId(dispId), - mDisplayName(name), - mOutputUsage(GRALLOC_USAGE_HW_COMPOSER), - mProducerSlotSource(0), - mDbgState(DBG_STATE_IDLE), - mDbgLastCompositionType(COMPOSITION_UNKNOWN), - mMustRecompose(false) -{ - mSource[SOURCE_SINK] = sink; - mSource[SOURCE_SCRATCH] = bqProducer; - - resetPerFrameState(); - - int sinkWidth, sinkHeight; - sink->query(NATIVE_WINDOW_WIDTH, &sinkWidth); - sink->query(NATIVE_WINDOW_HEIGHT, &sinkHeight); - mSinkBufferWidth = sinkWidth; - mSinkBufferHeight = sinkHeight; - - // Pick the buffer format to request from the sink when not rendering to it - // with GLES. If the consumer needs CPU access, use the default format - // set by the consumer. Otherwise allow gralloc to decide the format based - // on usage bits. - int sinkUsage; - sink->query(NATIVE_WINDOW_CONSUMER_USAGE_BITS, &sinkUsage); - if (sinkUsage & (GRALLOC_USAGE_SW_READ_MASK | GRALLOC_USAGE_SW_WRITE_MASK)) { - int sinkFormat; - sink->query(NATIVE_WINDOW_FORMAT, &sinkFormat); - mDefaultOutputFormat = sinkFormat; - } else { - mDefaultOutputFormat = HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED; - } - mOutputFormat = mDefaultOutputFormat; - - ConsumerBase::mName = String8::format("VDS: %s", mDisplayName.string()); - mConsumer->setConsumerName(ConsumerBase::mName); - mConsumer->setConsumerUsageBits(GRALLOC_USAGE_HW_COMPOSER); - mConsumer->setDefaultBufferSize(sinkWidth, sinkHeight); - mConsumer->setDefaultMaxBufferCount(2); -} - -VirtualDisplaySurface::~VirtualDisplaySurface() { -} - -status_t VirtualDisplaySurface::beginFrame(bool mustRecompose) { - if (mDisplayId < 0) - return NO_ERROR; - - mMustRecompose = mustRecompose; - - VDS_LOGW_IF(mDbgState != DBG_STATE_IDLE, - "Unexpected beginFrame() in %s state", dbgStateStr()); - mDbgState = DBG_STATE_BEGUN; - - return refreshOutputBuffer(); -} - -status_t VirtualDisplaySurface::prepareFrame(CompositionType compositionType) { - if (mDisplayId < 0) - return NO_ERROR; - - VDS_LOGW_IF(mDbgState != DBG_STATE_BEGUN, - "Unexpected prepareFrame() in %s state", dbgStateStr()); - mDbgState = DBG_STATE_PREPARED; - - mCompositionType = compositionType; - if (sForceHwcCopy && mCompositionType == COMPOSITION_GLES) { - // Some hardware can do RGB->YUV conversion more efficiently in hardware - // controlled by HWC than in hardware controlled by the video encoder. - // Forcing GLES-composed frames to go through an extra copy by the HWC - // allows the format conversion to happen there, rather than passing RGB - // directly to the consumer. - // - // On the other hand, when the consumer prefers RGB or can consume RGB - // inexpensively, this forces an unnecessary copy. - mCompositionType = COMPOSITION_MIXED; - } - - if (mCompositionType != mDbgLastCompositionType) { - VDS_LOGV("prepareFrame: composition type changed to %s", - dbgCompositionTypeStr(mCompositionType)); - mDbgLastCompositionType = mCompositionType; - } - - if (mCompositionType != COMPOSITION_GLES && - (mOutputFormat != mDefaultOutputFormat || - mOutputUsage != GRALLOC_USAGE_HW_COMPOSER)) { - // We must have just switched from GLES-only to MIXED or HWC - // composition. Stop using the format and usage requested by the GLES - // driver; they may be suboptimal when HWC is writing to the output - // buffer. For example, if the output is going to a video encoder, and - // HWC can write directly to YUV, some hardware can skip a - // memory-to-memory RGB-to-YUV conversion step. - // - // If we just switched *to* GLES-only mode, we'll change the - // format/usage and get a new buffer when the GLES driver calls - // dequeueBuffer(). - mOutputFormat = mDefaultOutputFormat; - mOutputUsage = GRALLOC_USAGE_HW_COMPOSER; - refreshOutputBuffer(); - } - - return NO_ERROR; -} - -status_t VirtualDisplaySurface::compositionComplete() { - return NO_ERROR; -} - -status_t VirtualDisplaySurface::advanceFrame() { - if (mDisplayId < 0) - return NO_ERROR; - - if (mCompositionType == COMPOSITION_HWC) { - VDS_LOGW_IF(mDbgState != DBG_STATE_PREPARED, - "Unexpected advanceFrame() in %s state on HWC frame", - dbgStateStr()); - } else { - VDS_LOGW_IF(mDbgState != DBG_STATE_GLES_DONE, - "Unexpected advanceFrame() in %s state on GLES/MIXED frame", - dbgStateStr()); - } - mDbgState = DBG_STATE_HWC; - - if (mOutputProducerSlot < 0 || - (mCompositionType != COMPOSITION_HWC && mFbProducerSlot < 0)) { - // Last chance bailout if something bad happened earlier. For example, - // in a GLES configuration, if the sink disappears then dequeueBuffer - // will fail, the GLES driver won't queue a buffer, but SurfaceFlinger - // will soldier on. So we end up here without a buffer. There should - // be lots of scary messages in the log just before this. - VDS_LOGE("advanceFrame: no buffer, bailing out"); - return NO_MEMORY; - } - - sp fbBuffer = mFbProducerSlot >= 0 ? - mProducerBuffers[mFbProducerSlot] : sp(NULL); - sp outBuffer = mProducerBuffers[mOutputProducerSlot]; - VDS_LOGV("advanceFrame: fb=%d(%p) out=%d(%p)", - mFbProducerSlot, fbBuffer.get(), - mOutputProducerSlot, outBuffer.get()); - - // At this point we know the output buffer acquire fence, - // so update HWC state with it. - mHwc.setOutputBuffer(mDisplayId, mOutputFence, outBuffer); - - status_t result = NO_ERROR; - if (fbBuffer != NULL) { - result = mHwc.fbPost(mDisplayId, mFbFence, fbBuffer); - } - - return result; -} - -void VirtualDisplaySurface::onFrameCommitted() { - if (mDisplayId < 0) - return; - - VDS_LOGW_IF(mDbgState != DBG_STATE_HWC, - "Unexpected onFrameCommitted() in %s state", dbgStateStr()); - mDbgState = DBG_STATE_IDLE; - - sp fbFence = mHwc.getAndResetReleaseFence(mDisplayId); - if (mCompositionType == COMPOSITION_MIXED && mFbProducerSlot >= 0) { - // release the scratch buffer back to the pool - Mutex::Autolock lock(mMutex); - int sslot = mapProducer2SourceSlot(SOURCE_SCRATCH, mFbProducerSlot); - VDS_LOGV("onFrameCommitted: release scratch sslot=%d", sslot); - addReleaseFenceLocked(sslot, mProducerBuffers[mFbProducerSlot], fbFence); - releaseBufferLocked(sslot, mProducerBuffers[mFbProducerSlot], - EGL_NO_DISPLAY, EGL_NO_SYNC_KHR); - } - - if (mOutputProducerSlot >= 0) { - int sslot = mapProducer2SourceSlot(SOURCE_SINK, mOutputProducerSlot); - QueueBufferOutput qbo; - sp outFence = mHwc.getLastRetireFence(mDisplayId); - VDS_LOGV("onFrameCommitted: queue sink sslot=%d", sslot); - if (mMustRecompose) { - status_t result = mSource[SOURCE_SINK]->queueBuffer(sslot, - QueueBufferInput( - systemTime(), false /* isAutoTimestamp */, - HAL_DATASPACE_UNKNOWN, - Rect(mSinkBufferWidth, mSinkBufferHeight), - NATIVE_WINDOW_SCALING_MODE_FREEZE, 0 /* transform */, - true /* async*/, - outFence), - &qbo); - if (result == NO_ERROR) { - updateQueueBufferOutput(qbo); - } - } else { - // If the surface hadn't actually been updated, then we only went - // through the motions of updating the display to keep our state - // machine happy. We cancel the buffer to avoid triggering another - // re-composition and causing an infinite loop. - mSource[SOURCE_SINK]->cancelBuffer(sslot, outFence); - } - } - - resetPerFrameState(); -} - -void VirtualDisplaySurface::dumpAsString(String8& /* result */) const { -} - -void VirtualDisplaySurface::resizeBuffers(const uint32_t w, const uint32_t h) { - uint32_t tmpW, tmpH, transformHint, numPendingBuffers; - mQueueBufferOutput.deflate(&tmpW, &tmpH, &transformHint, &numPendingBuffers); - mQueueBufferOutput.inflate(w, h, transformHint, numPendingBuffers); - - mSinkBufferWidth = w; - mSinkBufferHeight = h; -} - -status_t VirtualDisplaySurface::requestBuffer(int pslot, - sp* outBuf) { - if (mDisplayId < 0) - return mSource[SOURCE_SINK]->requestBuffer(pslot, outBuf); - - VDS_LOGW_IF(mDbgState != DBG_STATE_GLES, - "Unexpected requestBuffer pslot=%d in %s state", - pslot, dbgStateStr()); - - *outBuf = mProducerBuffers[pslot]; - return NO_ERROR; -} - -status_t VirtualDisplaySurface::setBufferCount(int bufferCount) { - return mSource[SOURCE_SINK]->setBufferCount(bufferCount); -} - -status_t VirtualDisplaySurface::dequeueBuffer(Source source, - PixelFormat format, uint32_t usage, int* sslot, sp* fence) { - LOG_FATAL_IF(mDisplayId < 0, "mDisplayId=%d but should not be < 0.", mDisplayId); - // Don't let a slow consumer block us - bool async = (source == SOURCE_SINK); - - status_t result = mSource[source]->dequeueBuffer(sslot, fence, async, - mSinkBufferWidth, mSinkBufferHeight, format, usage); - if (result < 0) - return result; - int pslot = mapSource2ProducerSlot(source, *sslot); - VDS_LOGV("dequeueBuffer(%s): sslot=%d pslot=%d result=%d", - dbgSourceStr(source), *sslot, pslot, result); - uint64_t sourceBit = static_cast(source) << pslot; - - if ((mProducerSlotSource & (1ULL << pslot)) != sourceBit) { - // This slot was previously dequeued from the other source; must - // re-request the buffer. - result |= BUFFER_NEEDS_REALLOCATION; - mProducerSlotSource &= ~(1ULL << pslot); - mProducerSlotSource |= sourceBit; - } - - if (result & RELEASE_ALL_BUFFERS) { - for (uint32_t i = 0; i < BufferQueue::NUM_BUFFER_SLOTS; i++) { - if ((mProducerSlotSource & (1ULL << i)) == sourceBit) - mProducerBuffers[i].clear(); - } - } - if (result & BUFFER_NEEDS_REALLOCATION) { - result = mSource[source]->requestBuffer(*sslot, &mProducerBuffers[pslot]); - if (result < 0) { - mProducerBuffers[pslot].clear(); - mSource[source]->cancelBuffer(*sslot, *fence); - return result; - } - VDS_LOGV("dequeueBuffer(%s): buffers[%d]=%p fmt=%d usage=%#x", - dbgSourceStr(source), pslot, mProducerBuffers[pslot].get(), - mProducerBuffers[pslot]->getPixelFormat(), - mProducerBuffers[pslot]->getUsage()); - } - - return result; -} - -status_t VirtualDisplaySurface::dequeueBuffer(int* pslot, sp* fence, bool async, - uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) { - if (mDisplayId < 0) - return mSource[SOURCE_SINK]->dequeueBuffer(pslot, fence, async, w, h, format, usage); - - VDS_LOGW_IF(mDbgState != DBG_STATE_PREPARED, - "Unexpected dequeueBuffer() in %s state", dbgStateStr()); - mDbgState = DBG_STATE_GLES; - - VDS_LOGW_IF(!async, "EGL called dequeueBuffer with !async despite eglSwapInterval(0)"); - VDS_LOGV("dequeueBuffer %dx%d fmt=%d usage=%#x", w, h, format, usage); - - status_t result = NO_ERROR; - Source source = fbSourceForCompositionType(mCompositionType); - - if (source == SOURCE_SINK) { - - if (mOutputProducerSlot < 0) { - // Last chance bailout if something bad happened earlier. For example, - // in a GLES configuration, if the sink disappears then dequeueBuffer - // will fail, the GLES driver won't queue a buffer, but SurfaceFlinger - // will soldier on. So we end up here without a buffer. There should - // be lots of scary messages in the log just before this. - VDS_LOGE("dequeueBuffer: no buffer, bailing out"); - return NO_MEMORY; - } - - // We already dequeued the output buffer. If the GLES driver wants - // something incompatible, we have to cancel and get a new one. This - // will mean that HWC will see a different output buffer between - // prepare and set, but since we're in GLES-only mode already it - // shouldn't matter. - - usage |= GRALLOC_USAGE_HW_COMPOSER; - const sp& buf = mProducerBuffers[mOutputProducerSlot]; - if ((usage & ~buf->getUsage()) != 0 || - (format != 0 && format != buf->getPixelFormat()) || - (w != 0 && w != mSinkBufferWidth) || - (h != 0 && h != mSinkBufferHeight)) { - VDS_LOGV("dequeueBuffer: dequeueing new output buffer: " - "want %dx%d fmt=%d use=%#x, " - "have %dx%d fmt=%d use=%#x", - w, h, format, usage, - mSinkBufferWidth, mSinkBufferHeight, - buf->getPixelFormat(), buf->getUsage()); - mOutputFormat = format; - mOutputUsage = usage; - result = refreshOutputBuffer(); - if (result < 0) - return result; - } - } - - if (source == SOURCE_SINK) { - *pslot = mOutputProducerSlot; - *fence = mOutputFence; - } else { - int sslot; - result = dequeueBuffer(source, format, usage, &sslot, fence); - if (result >= 0) { - *pslot = mapSource2ProducerSlot(source, sslot); - } - } - return result; -} - -status_t VirtualDisplaySurface::detachBuffer(int /* slot */) { - VDS_LOGE("detachBuffer is not available for VirtualDisplaySurface"); - return INVALID_OPERATION; -} - -status_t VirtualDisplaySurface::detachNextBuffer( - sp* /* outBuffer */, sp* /* outFence */) { - VDS_LOGE("detachNextBuffer is not available for VirtualDisplaySurface"); - return INVALID_OPERATION; -} - -status_t VirtualDisplaySurface::attachBuffer(int* /* outSlot */, - const sp& /* buffer */) { - VDS_LOGE("attachBuffer is not available for VirtualDisplaySurface"); - return INVALID_OPERATION; -} - -status_t VirtualDisplaySurface::queueBuffer(int pslot, - const QueueBufferInput& input, QueueBufferOutput* output) { - if (mDisplayId < 0) - return mSource[SOURCE_SINK]->queueBuffer(pslot, input, output); - - VDS_LOGW_IF(mDbgState != DBG_STATE_GLES, - "Unexpected queueBuffer(pslot=%d) in %s state", pslot, - dbgStateStr()); - mDbgState = DBG_STATE_GLES_DONE; - - VDS_LOGV("queueBuffer pslot=%d", pslot); - - status_t result; - if (mCompositionType == COMPOSITION_MIXED) { - // Queue the buffer back into the scratch pool - QueueBufferOutput scratchQBO; - int sslot = mapProducer2SourceSlot(SOURCE_SCRATCH, pslot); - result = mSource[SOURCE_SCRATCH]->queueBuffer(sslot, input, &scratchQBO); - if (result != NO_ERROR) - return result; - - // Now acquire the buffer from the scratch pool -- should be the same - // slot and fence as we just queued. - Mutex::Autolock lock(mMutex); - BufferItem item; - result = acquireBufferLocked(&item, 0); - if (result != NO_ERROR) - return result; - VDS_LOGW_IF(item.mBuf != sslot, - "queueBuffer: acquired sslot %d from SCRATCH after queueing sslot %d", - item.mBuf, sslot); - mFbProducerSlot = mapSource2ProducerSlot(SOURCE_SCRATCH, item.mBuf); - mFbFence = mSlots[item.mBuf].mFence; - - } else { - LOG_FATAL_IF(mCompositionType != COMPOSITION_GLES, - "Unexpected queueBuffer in state %s for compositionType %s", - dbgStateStr(), dbgCompositionTypeStr(mCompositionType)); - - // Extract the GLES release fence for HWC to acquire - int64_t timestamp; - bool isAutoTimestamp; - android_dataspace dataSpace; - Rect crop; - int scalingMode; - uint32_t transform; - bool async; - input.deflate(×tamp, &isAutoTimestamp, &dataSpace, &crop, - &scalingMode, &transform, &async, &mFbFence); - - mFbProducerSlot = pslot; - mOutputFence = mFbFence; - } - - *output = mQueueBufferOutput; - return NO_ERROR; -} - -void VirtualDisplaySurface::cancelBuffer(int pslot, const sp& fence) { - if (mDisplayId < 0) - return mSource[SOURCE_SINK]->cancelBuffer(mapProducer2SourceSlot(SOURCE_SINK, pslot), fence); - - VDS_LOGW_IF(mDbgState != DBG_STATE_GLES, - "Unexpected cancelBuffer(pslot=%d) in %s state", pslot, - dbgStateStr()); - VDS_LOGV("cancelBuffer pslot=%d", pslot); - Source source = fbSourceForCompositionType(mCompositionType); - return mSource[source]->cancelBuffer( - mapProducer2SourceSlot(source, pslot), fence); -} - -int VirtualDisplaySurface::query(int what, int* value) { - switch (what) { - case NATIVE_WINDOW_WIDTH: - *value = mSinkBufferWidth; - break; - case NATIVE_WINDOW_HEIGHT: - *value = mSinkBufferHeight; - break; - default: - return mSource[SOURCE_SINK]->query(what, value); - } - return NO_ERROR; -} - -status_t VirtualDisplaySurface::connect(const sp& listener, - int api, bool producerControlledByApp, - QueueBufferOutput* output) { - QueueBufferOutput qbo; - status_t result = mSource[SOURCE_SINK]->connect(listener, api, - producerControlledByApp, &qbo); - if (result == NO_ERROR) { - updateQueueBufferOutput(qbo); - *output = mQueueBufferOutput; - } - return result; -} - -status_t VirtualDisplaySurface::disconnect(int api) { - return mSource[SOURCE_SINK]->disconnect(api); -} - -status_t VirtualDisplaySurface::setSidebandStream(const sp& /*stream*/) { - return INVALID_OPERATION; -} - -void VirtualDisplaySurface::allocateBuffers(bool /* async */, - uint32_t /* width */, uint32_t /* height */, PixelFormat /* format */, - uint32_t /* usage */) { - // TODO: Should we actually allocate buffers for a virtual display? -} - -status_t VirtualDisplaySurface::allowAllocation(bool /* allow */) { - return INVALID_OPERATION; -} - -status_t VirtualDisplaySurface::setGenerationNumber(uint32_t /* generation */) { - ALOGE("setGenerationNumber not supported on VirtualDisplaySurface"); - return INVALID_OPERATION; -} - -String8 VirtualDisplaySurface::getConsumerName() const { - return String8("VirtualDisplaySurface"); -} - -void VirtualDisplaySurface::updateQueueBufferOutput( - const QueueBufferOutput& qbo) { - uint32_t w, h, transformHint, numPendingBuffers; - qbo.deflate(&w, &h, &transformHint, &numPendingBuffers); - mQueueBufferOutput.inflate(w, h, 0, numPendingBuffers); -} - -void VirtualDisplaySurface::resetPerFrameState() { - mCompositionType = COMPOSITION_UNKNOWN; - mFbFence = Fence::NO_FENCE; - mOutputFence = Fence::NO_FENCE; - mOutputProducerSlot = -1; - mFbProducerSlot = -1; -} - -status_t VirtualDisplaySurface::refreshOutputBuffer() { - if (mOutputProducerSlot >= 0) { - mSource[SOURCE_SINK]->cancelBuffer( - mapProducer2SourceSlot(SOURCE_SINK, mOutputProducerSlot), - mOutputFence); - } - - int sslot; - status_t result = dequeueBuffer(SOURCE_SINK, mOutputFormat, mOutputUsage, - &sslot, &mOutputFence); - if (result < 0) - return result; - mOutputProducerSlot = mapSource2ProducerSlot(SOURCE_SINK, sslot); - - // On GLES-only frames, we don't have the right output buffer acquire fence - // until after GLES calls queueBuffer(). So here we just set the buffer - // (for use in HWC prepare) but not the fence; we'll call this again with - // the proper fence once we have it. - result = mHwc.setOutputBuffer(mDisplayId, Fence::NO_FENCE, - mProducerBuffers[mOutputProducerSlot]); - - return result; -} - -// This slot mapping function is its own inverse, so two copies are unnecessary. -// Both are kept to make the intent clear where the function is called, and for -// the (unlikely) chance that we switch to a different mapping function. -int VirtualDisplaySurface::mapSource2ProducerSlot(Source source, int sslot) { - if (source == SOURCE_SCRATCH) { - return BufferQueue::NUM_BUFFER_SLOTS - sslot - 1; - } else { - return sslot; - } -} -int VirtualDisplaySurface::mapProducer2SourceSlot(Source source, int pslot) { - return mapSource2ProducerSlot(source, pslot); -} - -VirtualDisplaySurface::Source -VirtualDisplaySurface::fbSourceForCompositionType(CompositionType type) { - return type == COMPOSITION_MIXED ? SOURCE_SCRATCH : SOURCE_SINK; -} - -const char* VirtualDisplaySurface::dbgStateStr() const { - switch (mDbgState) { - case DBG_STATE_IDLE: return "IDLE"; - case DBG_STATE_PREPARED: return "PREPARED"; - case DBG_STATE_GLES: return "GLES"; - case DBG_STATE_GLES_DONE: return "GLES_DONE"; - case DBG_STATE_HWC: return "HWC"; - default: return "INVALID"; - } -} - -const char* VirtualDisplaySurface::dbgSourceStr(Source s) { - switch (s) { - case SOURCE_SINK: return "SINK"; - case SOURCE_SCRATCH: return "SCRATCH"; - default: return "INVALID"; - } -} - -// --------------------------------------------------------------------------- -} // namespace android -// --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DisplayHardware/VirtualDisplaySurface.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,247 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef ANDROID_SF_VIRTUAL_DISPLAY_SURFACE_H -#define ANDROID_SF_VIRTUAL_DISPLAY_SURFACE_H - -#include -#include - -#include "DisplaySurface.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class HWComposer; -class IProducerListener; - -/* This DisplaySurface implementation supports virtual displays, where GLES - * and/or HWC compose into a buffer that is then passed to an arbitrary - * consumer (the sink) running in another process. - * - * The simplest case is when the virtual display will never use the h/w - * composer -- either the h/w composer doesn't support writing to buffers, or - * there are more virtual displays than it supports simultaneously. In this - * case, the GLES driver works directly with the output buffer queue, and - * calls to the VirtualDisplay from SurfaceFlinger and DisplayHardware do - * nothing. - * - * If h/w composer might be used, then each frame will fall into one of three - * configurations: GLES-only, HWC-only, and MIXED composition. In all of these, - * we must provide a FB target buffer and output buffer for the HWC set() call. - * - * In GLES-only composition, the GLES driver is given a buffer from the sink to - * render into. When the GLES driver queues the buffer to the - * VirtualDisplaySurface, the VirtualDisplaySurface holds onto it instead of - * immediately queueing it to the sink. The buffer is used as both the FB - * target and output buffer for HWC, though on these frames the HWC doesn't - * do any work for this display and doesn't write to the output buffer. After - * composition is complete, the buffer is queued to the sink. - * - * In HWC-only composition, the VirtualDisplaySurface dequeues a buffer from - * the sink and passes it to HWC as both the FB target buffer and output - * buffer. The HWC doesn't need to read from the FB target buffer, but does - * write to the output buffer. After composition is complete, the buffer is - * queued to the sink. - * - * On MIXED frames, things become more complicated, since some h/w composer - * implementations can't read from and write to the same buffer. This class has - * an internal BufferQueue that it uses as a scratch buffer pool. The GLES - * driver is given a scratch buffer to render into. When it finishes rendering, - * the buffer is queued and then immediately acquired by the - * VirtualDisplaySurface. The scratch buffer is then used as the FB target - * buffer for HWC, and a separate buffer is dequeued from the sink and used as - * the HWC output buffer. When HWC composition is complete, the scratch buffer - * is released and the output buffer is queued to the sink. - */ -class VirtualDisplaySurface : public DisplaySurface, - public BnGraphicBufferProducer, - private ConsumerBase { -public: - VirtualDisplaySurface(HWComposer& hwc, int32_t dispId, - const sp& sink, - const sp& bqProducer, - const sp& bqConsumer, - const String8& name); - - // - // DisplaySurface interface - // - virtual status_t beginFrame(bool mustRecompose); - virtual status_t prepareFrame(CompositionType compositionType); - virtual status_t compositionComplete(); - virtual status_t advanceFrame(); - virtual void onFrameCommitted(); - virtual void dumpAsString(String8& result) const; - virtual void resizeBuffers(const uint32_t w, const uint32_t h); - -private: - enum Source {SOURCE_SINK = 0, SOURCE_SCRATCH = 1}; - - virtual ~VirtualDisplaySurface(); - - // - // IGraphicBufferProducer interface, used by the GLES driver. - // - virtual status_t requestBuffer(int pslot, sp* outBuf); - virtual status_t setBufferCount(int bufferCount); - virtual status_t dequeueBuffer(int* pslot, sp* fence, bool async, - uint32_t w, uint32_t h, PixelFormat format, uint32_t usage); - virtual status_t detachBuffer(int slot); - virtual status_t detachNextBuffer(sp* outBuffer, - sp* outFence); - virtual status_t attachBuffer(int* slot, const sp& buffer); - virtual status_t queueBuffer(int pslot, - const QueueBufferInput& input, QueueBufferOutput* output); - virtual void cancelBuffer(int pslot, const sp& fence); - virtual int query(int what, int* value); - virtual status_t connect(const sp& listener, - int api, bool producerControlledByApp, QueueBufferOutput* output); - virtual status_t disconnect(int api); - virtual status_t setSidebandStream(const sp& stream); - virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - PixelFormat format, uint32_t usage); - virtual status_t allowAllocation(bool allow); - virtual status_t setGenerationNumber(uint32_t generationNumber); - virtual String8 getConsumerName() const override; - - // - // Utility methods - // - static Source fbSourceForCompositionType(CompositionType type); - status_t dequeueBuffer(Source source, PixelFormat format, uint32_t usage, - int* sslot, sp* fence); - void updateQueueBufferOutput(const QueueBufferOutput& qbo); - void resetPerFrameState(); - status_t refreshOutputBuffer(); - - // Both the sink and scratch buffer pools have their own set of slots - // ("source slots", or "sslot"). We have to merge these into the single - // set of slots used by the GLES producer ("producer slots" or "pslot") and - // internally in the VirtualDisplaySurface. To minimize the number of times - // a producer slot switches which source it comes from, we map source slot - // numbers to producer slot numbers differently for each source. - static int mapSource2ProducerSlot(Source source, int sslot); - static int mapProducer2SourceSlot(Source source, int pslot); - - // - // Immutable after construction - // - HWComposer& mHwc; - const int32_t mDisplayId; - const String8 mDisplayName; - sp mSource[2]; // indexed by SOURCE_* - uint32_t mDefaultOutputFormat; - - // - // Inter-frame state - // - - // To avoid buffer reallocations, we track the buffer usage and format - // we used on the previous frame and use it again on the new frame. If - // the composition type changes or the GLES driver starts requesting - // different usage/format, we'll get a new buffer. - uint32_t mOutputFormat; - uint32_t mOutputUsage; - - // Since we present a single producer interface to the GLES driver, but - // are internally muxing between the sink and scratch producers, we have - // to keep track of which source last returned each producer slot from - // dequeueBuffer. Each bit in mProducerSlotSource corresponds to a producer - // slot. Both mProducerSlotSource and mProducerBuffers are indexed by a - // "producer slot"; see the mapSlot*() functions. - uint64_t mProducerSlotSource; - sp mProducerBuffers[BufferQueue::NUM_BUFFER_SLOTS]; - - // The QueueBufferOutput with the latest info from the sink, and with the - // transform hint cleared. Since we defer queueBuffer from the GLES driver - // to the sink, we have to return the previous version. - QueueBufferOutput mQueueBufferOutput; - - // Details of the current sink buffer. These become valid when a buffer is - // dequeued from the sink, and are used when queueing the buffer. - uint32_t mSinkBufferWidth, mSinkBufferHeight; - - // - // Intra-frame state - // - - // Composition type and GLES buffer source for the current frame. - // Valid after prepareFrame(), cleared in onFrameCommitted. - CompositionType mCompositionType; - - // mFbFence is the fence HWC should wait for before reading the framebuffer - // target buffer. - sp mFbFence; - - // mOutputFence is the fence HWC should wait for before writing to the - // output buffer. - sp mOutputFence; - - // Producer slot numbers for the buffers to use for HWC framebuffer target - // and output. - int mFbProducerSlot; - int mOutputProducerSlot; - - // Debug only -- track the sequence of events in each frame so we can make - // sure they happen in the order we expect. This class implicitly models - // a state machine; this enum/variable makes it explicit. - // - // +-----------+-------------------+-------------+ - // | State | Event || Next State | - // +-----------+-------------------+-------------+ - // | IDLE | beginFrame || BEGUN | - // | BEGUN | prepareFrame || PREPARED | - // | PREPARED | dequeueBuffer [1] || GLES | - // | PREPARED | advanceFrame [2] || HWC | - // | GLES | queueBuffer || GLES_DONE | - // | GLES_DONE | advanceFrame || HWC | - // | HWC | onFrameCommitted || IDLE | - // +-----------+-------------------++------------+ - // [1] COMPOSITION_GLES and COMPOSITION_MIXED frames. - // [2] COMPOSITION_HWC frames. - // - enum DbgState { - // no buffer dequeued, don't know anything about the next frame - DBG_STATE_IDLE, - // output buffer dequeued, framebuffer source not yet known - DBG_STATE_BEGUN, - // output buffer dequeued, framebuffer source known but not provided - // to GLES yet. - DBG_STATE_PREPARED, - // GLES driver has a buffer dequeued - DBG_STATE_GLES, - // GLES driver has queued the buffer, we haven't sent it to HWC yet - DBG_STATE_GLES_DONE, - // HWC has the buffer for this frame - DBG_STATE_HWC, - }; - DbgState mDbgState; - CompositionType mDbgLastCompositionType; - - const char* dbgStateStr() const; - static const char* dbgSourceStr(Source s); - - bool mMustRecompose; -}; - -// --------------------------------------------------------------------------- -} // namespace android -// --------------------------------------------------------------------------- - -#endif // ANDROID_SF_VIRTUAL_DISPLAY_SURFACE_H - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DispSync.cpp android-platform-frameworks-native-21/services/surfaceflinger/DispSync.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DispSync.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DispSync.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,579 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#define ATRACE_TAG ATRACE_TAG_GRAPHICS - -// This is needed for stdint.h to define INT64_MAX in C++ -#define __STDC_LIMIT_MACROS - -#include - -#include - -#include - -#include -#include -#include -#include - -#include "DispSync.h" -#include "EventLog/EventLog.h" - -namespace android { - -// Setting this to true enables verbose tracing that can be used to debug -// vsync event model or phase issues. -static const bool kTraceDetailedInfo = false; - -// This is the threshold used to determine when hardware vsync events are -// needed to re-synchronize the software vsync model with the hardware. The -// error metric used is the mean of the squared difference between each -// present time and the nearest software-predicted vsync. -static const nsecs_t kErrorThreshold = 160000000000; // 400 usec squared - -// This is the offset from the present fence timestamps to the corresponding -// vsync event. -static const int64_t kPresentTimeOffset = PRESENT_TIME_OFFSET_FROM_VSYNC_NS; - -class DispSyncThread: public Thread { -public: - - DispSyncThread(): - mStop(false), - mPeriod(0), - mPhase(0), - mReferenceTime(0), - mWakeupLatency(0) { - } - - virtual ~DispSyncThread() {} - - void updateModel(nsecs_t period, nsecs_t phase, nsecs_t referenceTime) { - Mutex::Autolock lock(mMutex); - mPeriod = period; - mPhase = phase; - mReferenceTime = referenceTime; - mCond.signal(); - } - - void stop() { - Mutex::Autolock lock(mMutex); - mStop = true; - mCond.signal(); - } - - virtual bool threadLoop() { - status_t err; - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t nextEventTime = 0; - - while (true) { - Vector callbackInvocations; - - nsecs_t targetTime = 0; - - { // Scope for lock - Mutex::Autolock lock(mMutex); - - if (mStop) { - return false; - } - - if (mPeriod == 0) { - err = mCond.wait(mMutex); - if (err != NO_ERROR) { - ALOGE("error waiting for new events: %s (%d)", - strerror(-err), err); - return false; - } - continue; - } - - nextEventTime = computeNextEventTimeLocked(now); - targetTime = nextEventTime; - - bool isWakeup = false; - - if (now < targetTime) { - err = mCond.waitRelative(mMutex, targetTime - now); - - if (err == TIMED_OUT) { - isWakeup = true; - } else if (err != NO_ERROR) { - ALOGE("error waiting for next event: %s (%d)", - strerror(-err), err); - return false; - } - } - - now = systemTime(SYSTEM_TIME_MONOTONIC); - - if (isWakeup) { - mWakeupLatency = ((mWakeupLatency * 63) + - (now - targetTime)) / 64; - if (mWakeupLatency > 500000) { - // Don't correct by more than 500 us - mWakeupLatency = 500000; - } - if (kTraceDetailedInfo) { - ATRACE_INT64("DispSync:WakeupLat", now - nextEventTime); - ATRACE_INT64("DispSync:AvgWakeupLat", mWakeupLatency); - } - } - - callbackInvocations = gatherCallbackInvocationsLocked(now); - } - - if (callbackInvocations.size() > 0) { - fireCallbackInvocations(callbackInvocations); - } - } - - return false; - } - - status_t addEventListener(nsecs_t phase, const sp& callback) { - Mutex::Autolock lock(mMutex); - - for (size_t i = 0; i < mEventListeners.size(); i++) { - if (mEventListeners[i].mCallback == callback) { - return BAD_VALUE; - } - } - - EventListener listener; - listener.mPhase = phase; - listener.mCallback = callback; - - // We want to allow the firstmost future event to fire without - // allowing any past events to fire. Because - // computeListenerNextEventTimeLocked filters out events within a half - // a period of the last event time, we need to initialize the last - // event time to a half a period in the past. - listener.mLastEventTime = systemTime(SYSTEM_TIME_MONOTONIC) - mPeriod / 2; - - mEventListeners.push(listener); - - mCond.signal(); - - return NO_ERROR; - } - - status_t removeEventListener(const sp& callback) { - Mutex::Autolock lock(mMutex); - - for (size_t i = 0; i < mEventListeners.size(); i++) { - if (mEventListeners[i].mCallback == callback) { - mEventListeners.removeAt(i); - mCond.signal(); - return NO_ERROR; - } - } - - return BAD_VALUE; - } - - // This method is only here to handle the kIgnorePresentFences case. - bool hasAnyEventListeners() { - Mutex::Autolock lock(mMutex); - return !mEventListeners.empty(); - } - -private: - - struct EventListener { - nsecs_t mPhase; - nsecs_t mLastEventTime; - sp mCallback; - }; - - struct CallbackInvocation { - sp mCallback; - nsecs_t mEventTime; - }; - - nsecs_t computeNextEventTimeLocked(nsecs_t now) { - nsecs_t nextEventTime = INT64_MAX; - for (size_t i = 0; i < mEventListeners.size(); i++) { - nsecs_t t = computeListenerNextEventTimeLocked(mEventListeners[i], - now); - - if (t < nextEventTime) { - nextEventTime = t; - } - } - - return nextEventTime; - } - - Vector gatherCallbackInvocationsLocked(nsecs_t now) { - Vector callbackInvocations; - nsecs_t ref = now - mPeriod; - - for (size_t i = 0; i < mEventListeners.size(); i++) { - nsecs_t t = computeListenerNextEventTimeLocked(mEventListeners[i], - ref); - - if (t < now) { - CallbackInvocation ci; - ci.mCallback = mEventListeners[i].mCallback; - ci.mEventTime = t; - callbackInvocations.push(ci); - mEventListeners.editItemAt(i).mLastEventTime = t; - } - } - - return callbackInvocations; - } - - nsecs_t computeListenerNextEventTimeLocked(const EventListener& listener, - nsecs_t ref) { - - nsecs_t lastEventTime = listener.mLastEventTime; - if (ref < lastEventTime) { - ref = lastEventTime; - } - - nsecs_t phase = mReferenceTime + mPhase + listener.mPhase; - nsecs_t t = (((ref - phase) / mPeriod) + 1) * mPeriod + phase; - - if (t - listener.mLastEventTime < mPeriod / 2) { - t += mPeriod; - } - - return t; - } - - void fireCallbackInvocations(const Vector& callbacks) { - for (size_t i = 0; i < callbacks.size(); i++) { - callbacks[i].mCallback->onDispSyncEvent(callbacks[i].mEventTime); - } - } - - bool mStop; - - nsecs_t mPeriod; - nsecs_t mPhase; - nsecs_t mReferenceTime; - nsecs_t mWakeupLatency; - - Vector mEventListeners; - - Mutex mMutex; - Condition mCond; -}; - -class ZeroPhaseTracer : public DispSync::Callback { -public: - ZeroPhaseTracer() : mParity(false) {} - - virtual void onDispSyncEvent(nsecs_t /*when*/) { - mParity = !mParity; - ATRACE_INT("ZERO_PHASE_VSYNC", mParity ? 1 : 0); - } - -private: - bool mParity; -}; - -DispSync::DispSync() : - mRefreshSkipCount(0), - mThread(new DispSyncThread()) { - - mThread->run("DispSync", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); - - reset(); - beginResync(); - - if (kTraceDetailedInfo) { - // If we're not getting present fences then the ZeroPhaseTracer - // would prevent HW vsync event from ever being turned off. - // Even if we're just ignoring the fences, the zero-phase tracing is - // not needed because any time there is an event registered we will - // turn on the HW vsync events. - if (!kIgnorePresentFences) { - addEventListener(0, new ZeroPhaseTracer()); - } - } -} - -DispSync::~DispSync() {} - -void DispSync::reset() { - Mutex::Autolock lock(mMutex); - - mPhase = 0; - mReferenceTime = 0; - mModelUpdated = false; - mNumResyncSamples = 0; - mFirstResyncSample = 0; - mNumResyncSamplesSincePresent = 0; - resetErrorLocked(); -} - -bool DispSync::addPresentFence(const sp& fence) { - Mutex::Autolock lock(mMutex); - - mPresentFences[mPresentSampleOffset] = fence; - mPresentTimes[mPresentSampleOffset] = 0; - mPresentSampleOffset = (mPresentSampleOffset + 1) % NUM_PRESENT_SAMPLES; - mNumResyncSamplesSincePresent = 0; - - for (size_t i = 0; i < NUM_PRESENT_SAMPLES; i++) { - const sp& f(mPresentFences[i]); - if (f != NULL) { - nsecs_t t = f->getSignalTime(); - if (t < INT64_MAX) { - mPresentFences[i].clear(); - mPresentTimes[i] = t + kPresentTimeOffset; - } - } - } - - updateErrorLocked(); - - return !mModelUpdated || mError > kErrorThreshold; -} - -void DispSync::beginResync() { - Mutex::Autolock lock(mMutex); - - mModelUpdated = false; - mNumResyncSamples = 0; -} - -bool DispSync::addResyncSample(nsecs_t timestamp) { - Mutex::Autolock lock(mMutex); - - size_t idx = (mFirstResyncSample + mNumResyncSamples) % MAX_RESYNC_SAMPLES; - mResyncSamples[idx] = timestamp; - if (mNumResyncSamples == 0) { - mPhase = 0; - mReferenceTime = timestamp; - } - - if (mNumResyncSamples < MAX_RESYNC_SAMPLES) { - mNumResyncSamples++; - } else { - mFirstResyncSample = (mFirstResyncSample + 1) % MAX_RESYNC_SAMPLES; - } - - updateModelLocked(); - - if (mNumResyncSamplesSincePresent++ > MAX_RESYNC_SAMPLES_WITHOUT_PRESENT) { - resetErrorLocked(); - } - - if (kIgnorePresentFences) { - // If we don't have the sync framework we will never have - // addPresentFence called. This means we have no way to know whether - // or not we're synchronized with the HW vsyncs, so we just request - // that the HW vsync events be turned on whenever we need to generate - // SW vsync events. - return mThread->hasAnyEventListeners(); - } - - return !mModelUpdated || mError > kErrorThreshold; -} - -void DispSync::endResync() { -} - -status_t DispSync::addEventListener(nsecs_t phase, - const sp& callback) { - - Mutex::Autolock lock(mMutex); - return mThread->addEventListener(phase, callback); -} - -void DispSync::setRefreshSkipCount(int count) { - Mutex::Autolock lock(mMutex); - ALOGD("setRefreshSkipCount(%d)", count); - mRefreshSkipCount = count; - updateModelLocked(); -} - -status_t DispSync::removeEventListener(const sp& callback) { - Mutex::Autolock lock(mMutex); - return mThread->removeEventListener(callback); -} - -void DispSync::setPeriod(nsecs_t period) { - Mutex::Autolock lock(mMutex); - mPeriod = period; - mPhase = 0; - mReferenceTime = 0; - mThread->updateModel(mPeriod, mPhase, mReferenceTime); -} - -nsecs_t DispSync::getPeriod() { - // lock mutex as mPeriod changes multiple times in updateModelLocked - Mutex::Autolock lock(mMutex); - return mPeriod; -} - -void DispSync::updateModelLocked() { - if (mNumResyncSamples >= MIN_RESYNC_SAMPLES_FOR_UPDATE) { - nsecs_t durationSum = 0; - for (size_t i = 1; i < mNumResyncSamples; i++) { - size_t idx = (mFirstResyncSample + i) % MAX_RESYNC_SAMPLES; - size_t prev = (idx + MAX_RESYNC_SAMPLES - 1) % MAX_RESYNC_SAMPLES; - durationSum += mResyncSamples[idx] - mResyncSamples[prev]; - } - - mPeriod = durationSum / (mNumResyncSamples - 1); - - double sampleAvgX = 0; - double sampleAvgY = 0; - double scale = 2.0 * M_PI / double(mPeriod); - for (size_t i = 0; i < mNumResyncSamples; i++) { - size_t idx = (mFirstResyncSample + i) % MAX_RESYNC_SAMPLES; - nsecs_t sample = mResyncSamples[idx] - mReferenceTime; - double samplePhase = double(sample % mPeriod) * scale; - sampleAvgX += cos(samplePhase); - sampleAvgY += sin(samplePhase); - } - - sampleAvgX /= double(mNumResyncSamples); - sampleAvgY /= double(mNumResyncSamples); - - mPhase = nsecs_t(atan2(sampleAvgY, sampleAvgX) / scale); - - if (mPhase < 0) { - mPhase += mPeriod; - } - - if (kTraceDetailedInfo) { - ATRACE_INT64("DispSync:Period", mPeriod); - ATRACE_INT64("DispSync:Phase", mPhase); - } - - // Artificially inflate the period if requested. - mPeriod += mPeriod * mRefreshSkipCount; - - mThread->updateModel(mPeriod, mPhase, mReferenceTime); - mModelUpdated = true; - } -} - -void DispSync::updateErrorLocked() { - if (!mModelUpdated) { - return; - } - - // Need to compare present fences against the un-adjusted refresh period, - // since they might arrive between two events. - nsecs_t period = mPeriod / (1 + mRefreshSkipCount); - - int numErrSamples = 0; - nsecs_t sqErrSum = 0; - - for (size_t i = 0; i < NUM_PRESENT_SAMPLES; i++) { - nsecs_t sample = mPresentTimes[i] - mReferenceTime; - if (sample > mPhase) { - nsecs_t sampleErr = (sample - mPhase) % period; - if (sampleErr > period / 2) { - sampleErr -= period; - } - sqErrSum += sampleErr * sampleErr; - numErrSamples++; - } - } - - if (numErrSamples > 0) { - mError = sqErrSum / numErrSamples; - } else { - mError = 0; - } - - if (kTraceDetailedInfo) { - ATRACE_INT64("DispSync:Error", mError); - } -} - -void DispSync::resetErrorLocked() { - mPresentSampleOffset = 0; - mError = 0; - for (size_t i = 0; i < NUM_PRESENT_SAMPLES; i++) { - mPresentFences[i].clear(); - mPresentTimes[i] = 0; - } -} - -nsecs_t DispSync::computeNextRefresh(int periodOffset) const { - Mutex::Autolock lock(mMutex); - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - nsecs_t phase = mReferenceTime + mPhase; - return (((now - phase) / mPeriod) + periodOffset + 1) * mPeriod + phase; -} - -void DispSync::dump(String8& result) const { - Mutex::Autolock lock(mMutex); - result.appendFormat("present fences are %s\n", - kIgnorePresentFences ? "ignored" : "used"); - result.appendFormat("mPeriod: %" PRId64 " ns (%.3f fps; skipCount=%d)\n", - mPeriod, 1000000000.0 / mPeriod, mRefreshSkipCount); - result.appendFormat("mPhase: %" PRId64 " ns\n", mPhase); - result.appendFormat("mError: %" PRId64 " ns (sqrt=%.1f)\n", - mError, sqrt(mError)); - result.appendFormat("mNumResyncSamplesSincePresent: %d (limit %d)\n", - mNumResyncSamplesSincePresent, MAX_RESYNC_SAMPLES_WITHOUT_PRESENT); - result.appendFormat("mNumResyncSamples: %zd (max %d)\n", - mNumResyncSamples, MAX_RESYNC_SAMPLES); - - result.appendFormat("mResyncSamples:\n"); - nsecs_t previous = -1; - for (size_t i = 0; i < mNumResyncSamples; i++) { - size_t idx = (mFirstResyncSample + i) % MAX_RESYNC_SAMPLES; - nsecs_t sampleTime = mResyncSamples[idx]; - if (i == 0) { - result.appendFormat(" %" PRId64 "\n", sampleTime); - } else { - result.appendFormat(" %" PRId64 " (+%" PRId64 ")\n", - sampleTime, sampleTime - previous); - } - previous = sampleTime; - } - - result.appendFormat("mPresentFences / mPresentTimes [%d]:\n", - NUM_PRESENT_SAMPLES); - nsecs_t now = systemTime(SYSTEM_TIME_MONOTONIC); - previous = 0; - for (size_t i = 0; i < NUM_PRESENT_SAMPLES; i++) { - size_t idx = (i + mPresentSampleOffset) % NUM_PRESENT_SAMPLES; - bool signaled = mPresentFences[idx] == NULL; - nsecs_t presentTime = mPresentTimes[idx]; - if (!signaled) { - result.appendFormat(" [unsignaled fence]\n"); - } else if (presentTime == 0) { - result.appendFormat(" 0\n"); - } else if (previous == 0) { - result.appendFormat(" %" PRId64 " (%.3f ms ago)\n", presentTime, - (now - presentTime) / 1000000.0); - } else { - result.appendFormat(" %" PRId64 " (+%" PRId64 " / %.3f) (%.3f ms ago)\n", - presentTime, presentTime - previous, - (presentTime - previous) / (double) mPeriod, - (now - presentTime) / 1000000.0); - } - previous = presentTime; - } - - result.appendFormat("current monotonic time: %" PRId64 "\n", now); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DispSync.h android-platform-frameworks-native-21/services/surfaceflinger/DispSync.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/DispSync.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/DispSync.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,189 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_DISPSYNC_H -#define ANDROID_DISPSYNC_H - -#include - -#include -#include -#include - -namespace android { - -// Ignore present (retire) fences if the device doesn't have support for the -// sync framework, or if all phase offsets are zero. The latter is useful -// because it allows us to avoid resync bursts on devices that don't need -// phase-offset VSYNC events. -#if defined(RUNNING_WITHOUT_SYNC_FRAMEWORK) || \ - (VSYNC_EVENT_PHASE_OFFSET_NS == 0 && SF_VSYNC_EVENT_PHASE_OFFSET_NS == 0) -static const bool kIgnorePresentFences = true; -#else -static const bool kIgnorePresentFences = false; -#endif - - -class String8; -class Fence; -class DispSyncThread; - -// DispSync maintains a model of the periodic hardware-based vsync events of a -// display and uses that model to execute period callbacks at specific phase -// offsets from the hardware vsync events. The model is constructed by -// feeding consecutive hardware event timestamps to the DispSync object via -// the addResyncSample method. -// -// The model is validated using timestamps from Fence objects that are passed -// to the DispSync object via the addPresentFence method. These fence -// timestamps should correspond to a hardware vsync event, but they need not -// be consecutive hardware vsync times. If this method determines that the -// current model accurately represents the hardware event times it will return -// false to indicate that a resynchronization (via addResyncSample) is not -// needed. -class DispSync { - -public: - - class Callback: public virtual RefBase { - public: - virtual ~Callback() {}; - virtual void onDispSyncEvent(nsecs_t when) = 0; - }; - - DispSync(); - ~DispSync(); - - // reset clears the resync samples and error value. - void reset(); - - // addPresentFence adds a fence for use in validating the current vsync - // event model. The fence need not be signaled at the time - // addPresentFence is called. When the fence does signal, its timestamp - // should correspond to a hardware vsync event. Unlike the - // addResyncSample method, the timestamps of consecutive fences need not - // correspond to consecutive hardware vsync events. - // - // This method should be called with the retire fence from each HWComposer - // set call that affects the display. - bool addPresentFence(const sp& fence); - - // The beginResync, addResyncSample, and endResync methods are used to re- - // synchronize the DispSync's model to the hardware vsync events. The re- - // synchronization process involves first calling beginResync, then - // calling addResyncSample with a sequence of consecutive hardware vsync - // event timestamps, and finally calling endResync when addResyncSample - // indicates that no more samples are needed by returning false. - // - // This resynchronization process should be performed whenever the display - // is turned on (i.e. once immediately after it's turned on) and whenever - // addPresentFence returns true indicating that the model has drifted away - // from the hardware vsync events. - void beginResync(); - bool addResyncSample(nsecs_t timestamp); - void endResync(); - - // The setPeriod method sets the vsync event model's period to a specific - // value. This should be used to prime the model when a display is first - // turned on. It should NOT be used after that. - void setPeriod(nsecs_t period); - - // The getPeriod method returns the current vsync period. - nsecs_t getPeriod(); - - // setRefreshSkipCount specifies an additional number of refresh - // cycles to skip. For example, on a 60Hz display, a skip count of 1 - // will result in events happening at 30Hz. Default is zero. The idea - // is to sacrifice smoothness for battery life. - void setRefreshSkipCount(int count); - - // addEventListener registers a callback to be called repeatedly at the - // given phase offset from the hardware vsync events. The callback is - // called from a separate thread and it should return reasonably quickly - // (i.e. within a few hundred microseconds). - status_t addEventListener(nsecs_t phase, const sp& callback); - - // removeEventListener removes an already-registered event callback. Once - // this method returns that callback will no longer be called by the - // DispSync object. - status_t removeEventListener(const sp& callback); - - // computeNextRefresh computes when the next refresh is expected to begin. - // The periodOffset value can be used to move forward or backward; an - // offset of zero is the next refresh, -1 is the previous refresh, 1 is - // the refresh after next. etc. - nsecs_t computeNextRefresh(int periodOffset) const; - - // dump appends human-readable debug info to the result string. - void dump(String8& result) const; - -private: - - void updateModelLocked(); - void updateErrorLocked(); - void resetErrorLocked(); - - enum { MAX_RESYNC_SAMPLES = 32 }; - enum { MIN_RESYNC_SAMPLES_FOR_UPDATE = 3 }; - enum { NUM_PRESENT_SAMPLES = 8 }; - enum { MAX_RESYNC_SAMPLES_WITHOUT_PRESENT = 4 }; - - // mPeriod is the computed period of the modeled vsync events in - // nanoseconds. - nsecs_t mPeriod; - - // mPhase is the phase offset of the modeled vsync events. It is the - // number of nanoseconds from time 0 to the first vsync event. - nsecs_t mPhase; - - // mReferenceTime is the reference time of the modeled vsync events. - // It is the nanosecond timestamp of the first vsync event after a resync. - nsecs_t mReferenceTime; - - // mError is the computed model error. It is based on the difference - // between the estimated vsync event times and those observed in the - // mPresentTimes array. - nsecs_t mError; - - // Whether we have updated the vsync event model since the last resync. - bool mModelUpdated; - - // These member variables are the state used during the resynchronization - // process to store information about the hardware vsync event times used - // to compute the model. - nsecs_t mResyncSamples[MAX_RESYNC_SAMPLES]; - size_t mFirstResyncSample; - size_t mNumResyncSamples; - int mNumResyncSamplesSincePresent; - - // These member variables store information about the present fences used - // to validate the currently computed model. - sp mPresentFences[NUM_PRESENT_SAMPLES]; - nsecs_t mPresentTimes[NUM_PRESENT_SAMPLES]; - size_t mPresentSampleOffset; - - int mRefreshSkipCount; - - // mThread is the thread from which all the callbacks are called. - sp mThread; - - // mMutex is used to protect access to all member variables. - mutable Mutex mMutex; -}; - -} - -#endif // ANDROID_DISPSYNC_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Effects/Daltonizer.cpp android-platform-frameworks-native-21/services/surfaceflinger/Effects/Daltonizer.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Effects/Daltonizer.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Effects/Daltonizer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,176 +0,0 @@ -/* - * Copyright 2013 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 "Daltonizer.h" -#include - -namespace android { - -Daltonizer::Daltonizer() : - mType(deuteranomaly), mMode(simulation), mDirty(true) { -} - -Daltonizer::~Daltonizer() { -} - -void Daltonizer::setType(Daltonizer::ColorBlindnessTypes type) { - if (type != mType) { - mDirty = true; - mType = type; - } -} - -void Daltonizer::setMode(Daltonizer::Mode mode) { - if (mode != mMode) { - mDirty = true; - mMode = mode; - } -} - -const mat4& Daltonizer::operator()() { - if (mDirty) { - mDirty = false; - update(); - } - return mColorTransform; -} - -void Daltonizer::update() { - // converts a linear RGB color to the XYZ space - const mat4 rgb2xyz( 0.4124, 0.2126, 0.0193, 0, - 0.3576, 0.7152, 0.1192, 0, - 0.1805, 0.0722, 0.9505, 0, - 0 , 0 , 0 , 1); - - // converts a XYZ color to the LMS space. - const mat4 xyz2lms( 0.7328,-0.7036, 0.0030, 0, - 0.4296, 1.6975, 0.0136, 0, - -0.1624, 0.0061, 0.9834, 0, - 0 , 0 , 0 , 1); - - // Direct conversion from linear RGB to LMS - const mat4 rgb2lms(xyz2lms*rgb2xyz); - - // And back from LMS to linear RGB - const mat4 lms2rgb(inverse(rgb2lms)); - - // To simulate color blindness we need to "remove" the data lost by the absence of - // a cone. This cannot be done by just zeroing out the corresponding LMS component - // because it would create a color outside of the RGB gammut. - // Instead we project the color along the axis of the missing component onto a plane - // within the RGB gammut: - // - since the projection happens along the axis of the missing component, a - // color blind viewer perceives the projected color the same. - // - We use the plane defined by 3 points in LMS space: black, white and - // blue and red for protanopia/deuteranopia and tritanopia respectively. - - // LMS space red - const vec3& lms_r(rgb2lms[0].rgb); - // LMS space blue - const vec3& lms_b(rgb2lms[2].rgb); - // LMS space white - const vec3 lms_w((rgb2lms * vec4(1)).rgb); - - // To find the planes we solve the a*L + b*M + c*S = 0 equation for the LMS values - // of the three known points. This equation is trivially solved, and has for - // solution the following cross-products: - const vec3 p0 = cross(lms_w, lms_b); // protanopia/deuteranopia - const vec3 p1 = cross(lms_w, lms_r); // tritanopia - - // The following 3 matrices perform the projection of a LMS color onto the given plane - // along the selected axis - - // projection for protanopia (L = 0) - const mat4 lms2lmsp( 0.0000, 0.0000, 0.0000, 0, - -p0.y / p0.x, 1.0000, 0.0000, 0, - -p0.z / p0.x, 0.0000, 1.0000, 0, - 0 , 0 , 0 , 1); - - // projection for deuteranopia (M = 0) - const mat4 lms2lmsd( 1.0000, -p0.x / p0.y, 0.0000, 0, - 0.0000, 0.0000, 0.0000, 0, - 0.0000, -p0.z / p0.y, 1.0000, 0, - 0 , 0 , 0 , 1); - - // projection for tritanopia (S = 0) - const mat4 lms2lmst( 1.0000, 0.0000, -p1.x / p1.z, 0, - 0.0000, 1.0000, -p1.y / p1.z, 0, - 0.0000, 0.0000, 0.0000, 0, - 0 , 0 , 0 , 1); - - // We will calculate the error between the color and the color viewed by - // a color blind user and "spread" this error onto the healthy cones. - // The matrices below perform this last step and have been chosen arbitrarily. - - // The amount of correction can be adjusted here. - - // error spread for protanopia - const mat4 errp( 1.0, 0.7, 0.7, 0, - 0.0, 1.0, 0.0, 0, - 0.0, 0.0, 1.0, 0, - 0, 0, 0, 1); - - // error spread for deuteranopia - const mat4 errd( 1.0, 0.0, 0.0, 0, - 0.7, 1.0, 0.7, 0, - 0.0, 0.0, 1.0, 0, - 0, 0, 0, 1); - - // error spread for tritanopia - const mat4 errt( 1.0, 0.0, 0.0, 0, - 0.0, 1.0, 0.0, 0, - 0.7, 0.7, 1.0, 0, - 0, 0, 0, 1); - - const mat4 identity; - - // And the magic happens here... - // We construct the matrix that will perform the whole correction. - - // simulation: type of color blindness to simulate: - // set to either lms2lmsp, lms2lmsd, lms2lmst - mat4 simulation; - - // correction: type of color blindness correction (should match the simulation above): - // set to identity, errp, errd, errt ([0] for simulation only) - mat4 correction(0); - - switch (mType) { - case protanopia: - case protanomaly: - simulation = lms2lmsp; - if (mMode == Daltonizer::correction) - correction = errp; - break; - case deuteranopia: - case deuteranomaly: - simulation = lms2lmsd; - if (mMode == Daltonizer::correction) - correction = errd; - break; - case tritanopia: - case tritanomaly: - simulation = lms2lmst; - if (mMode == Daltonizer::correction) - correction = errt; - break; - } - - mColorTransform = lms2rgb * - (simulation * rgb2lms + correction * (rgb2lms - simulation * rgb2lms)); -} - -} /* namespace android */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Effects/Daltonizer.h android-platform-frameworks-native-21/services/surfaceflinger/Effects/Daltonizer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Effects/Daltonizer.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Effects/Daltonizer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef SF_EFFECTS_DALTONIZER_H_ -#define SF_EFFECTS_DALTONIZER_H_ - -#include - -namespace android { - -class Daltonizer { -public: - enum ColorBlindnessTypes { - protanopia, // L (red) cone missing - deuteranopia, // M (green) cone missing - tritanopia, // S (blue) cone missing - protanomaly, // L (red) cone deficient - deuteranomaly, // M (green) cone deficient (most common) - tritanomaly // S (blue) cone deficient - }; - - enum Mode { - simulation, - correction - }; - - Daltonizer(); - ~Daltonizer(); - - void setType(ColorBlindnessTypes type); - void setMode(Mode mode); - - // returns the color transform to apply in the shader - const mat4& operator()(); - -private: - void update(); - - ColorBlindnessTypes mType; - Mode mMode; - bool mDirty; - mat4 mColorTransform; -}; - -} /* namespace android */ -#endif /* SF_EFFECTS_DALTONIZER_H_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventControlThread.cpp android-platform-frameworks-native-21/services/surfaceflinger/EventControlThread.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventControlThread.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventControlThread.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,59 +0,0 @@ -/* - * Copyright (C) 2013 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 "EventControlThread.h" -#include "SurfaceFlinger.h" - -namespace android { - -EventControlThread::EventControlThread(const sp& flinger): - mFlinger(flinger), - mVsyncEnabled(false) { -} - -void EventControlThread::setVsyncEnabled(bool enabled) { - Mutex::Autolock lock(mMutex); - mVsyncEnabled = enabled; - mCond.signal(); -} - -bool EventControlThread::threadLoop() { - Mutex::Autolock lock(mMutex); - - bool vsyncEnabled = mVsyncEnabled; - - mFlinger->eventControl(HWC_DISPLAY_PRIMARY, SurfaceFlinger::EVENT_VSYNC, - mVsyncEnabled); - - while (true) { - status_t err = mCond.wait(mMutex); - if (err != NO_ERROR) { - ALOGE("error waiting for new events: %s (%d)", - strerror(-err), err); - return false; - } - - if (vsyncEnabled != mVsyncEnabled) { - mFlinger->eventControl(HWC_DISPLAY_PRIMARY, - SurfaceFlinger::EVENT_VSYNC, mVsyncEnabled); - vsyncEnabled = mVsyncEnabled; - } - } - - return false; -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventControlThread.h android-platform-frameworks-native-21/services/surfaceflinger/EventControlThread.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventControlThread.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventControlThread.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,48 +0,0 @@ -/* - * Copyright (C) 2013 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. - */ - -#ifndef ANDROID_EVENTCONTROLTHREAD_H -#define ANDROID_EVENTCONTROLTHREAD_H - -#include - -#include -#include - -namespace android { - -class SurfaceFlinger; - -class EventControlThread: public Thread { -public: - - EventControlThread(const sp& flinger); - virtual ~EventControlThread() {} - - void setVsyncEnabled(bool enabled); - virtual bool threadLoop(); - -private: - sp mFlinger; - bool mVsyncEnabled; - - Mutex mMutex; - Condition mCond; -}; - -} - -#endif // ANDROID_DISPSYNC_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventLog/EventLog.cpp android-platform-frameworks-native-21/services/surfaceflinger/EventLog/EventLog.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventLog/EventLog.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventLog/EventLog.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,133 +0,0 @@ -/* - * Copyright 2013 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 -#include -#include -#include - -#include "EventLog.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -ANDROID_SINGLETON_STATIC_INSTANCE(EventLog) - - -EventLog::EventLog() { -} - -void EventLog::doLogFrameDurations(const String8& window, - const int32_t* durations, size_t numDurations) { - EventLog::TagBuffer buffer(LOGTAG_SF_FRAME_DUR); - buffer.startList(1 + numDurations); - buffer.writeString8(window); - for (size_t i = 0; i < numDurations; i++) { - buffer.writeInt32(durations[i]); - } - buffer.endList(); - buffer.log(); -} - -void EventLog::logFrameDurations(const String8& window, - const int32_t* durations, size_t numDurations) { - EventLog::getInstance().doLogFrameDurations(window, durations, - numDurations); -} - -// --------------------------------------------------------------------------- - -EventLog::TagBuffer::TagBuffer(int32_t tag) - : mPos(0), mTag(tag), mOverflow(false) { -} - -void EventLog::TagBuffer::log() { - if (mOverflow) { - ALOGW("couldn't log to binary event log: overflow."); - } else if (android_bWriteLog(mTag, mStorage, mPos) < 0) { - ALOGE("couldn't log to EventLog: %s", strerror(errno)); - } - // purge the buffer - mPos = 0; - mOverflow = false; -} - -void EventLog::TagBuffer::startList(int8_t count) { - if (mOverflow) return; - const size_t needed = 1 + sizeof(count); - if (mPos + needed > STORAGE_MAX_SIZE) { - mOverflow = true; - return; - } - mStorage[mPos + 0] = EVENT_TYPE_LIST; - mStorage[mPos + 1] = count; - mPos += needed; -} - -void EventLog::TagBuffer::endList() { - if (mOverflow) return; - const size_t needed = 1; - if (mPos + needed > STORAGE_MAX_SIZE) { - mOverflow = true; - return; - } - mStorage[mPos + 0] = '\n'; - mPos += needed; -} - -void EventLog::TagBuffer::writeInt32(int32_t value) { - if (mOverflow) return; - const size_t needed = 1 + sizeof(value); - if (mPos + needed > STORAGE_MAX_SIZE) { - mOverflow = true; - return; - } - mStorage[mPos + 0] = EVENT_TYPE_INT; - memcpy(&mStorage[mPos + 1], &value, sizeof(value)); - mPos += needed; -} - -void EventLog::TagBuffer::writeInt64(int64_t value) { - if (mOverflow) return; - const size_t needed = 1 + sizeof(value); - if (mPos + needed > STORAGE_MAX_SIZE) { - mOverflow = true; - return; - } - mStorage[mPos + 0] = EVENT_TYPE_LONG; - memcpy(&mStorage[mPos + 1], &value, sizeof(value)); - mPos += needed; -} - -void EventLog::TagBuffer::writeString8(const String8& value) { - if (mOverflow) return; - const int32_t stringLen = value.length(); - const size_t needed = 1 + sizeof(int32_t) + stringLen; - if (mPos + needed > STORAGE_MAX_SIZE) { - mOverflow = true; - return; - } - mStorage[mPos + 0] = EVENT_TYPE_STRING; - memcpy(&mStorage[mPos + 1], &stringLen, sizeof(int32_t)); - memcpy(&mStorage[mPos + 5], value.string(), stringLen); - mPos += needed; -} - -// --------------------------------------------------------------------------- -}// namespace android - -// --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventLog/EventLog.h android-platform-frameworks-native-21/services/surfaceflinger/EventLog/EventLog.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventLog/EventLog.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventLog/EventLog.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,85 +0,0 @@ -/* - * Copyright 2013 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 -#include -#include - -#ifndef ANDROID_SF_EVENTLOG_H -#define ANDROID_SF_EVENTLOG_H - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class String8; - -class EventLog : public Singleton { - -public: - static void logFrameDurations(const String8& window, - const int32_t* durations, size_t numDurations); - -protected: - EventLog(); - -private: - /* - * EventLogBuffer is a helper class to construct an in-memory event log - * tag. In this version the buffer is not dynamic, so write operation can - * fail if there is not enough space in the temporary buffer. - * Once constructed, the buffer can be logger by calling the log() - * method. - */ - - class TagBuffer { - enum { STORAGE_MAX_SIZE = 128 }; - int32_t mPos; - int32_t mTag; - bool mOverflow; - char mStorage[STORAGE_MAX_SIZE]; - public: - TagBuffer(int32_t tag); - - // starts list of items - void startList(int8_t count); - // terminates the list - void endList(); - // write a 32-bit integer - void writeInt32(int32_t value); - // write a 64-bit integer - void writeInt64(int64_t value); - // write a C string - void writeString8(const String8& value); - - // outputs the the buffer to the log - void log(); - }; - - friend class Singleton; - EventLog(const EventLog&); - EventLog& operator =(const EventLog&); - - enum { LOGTAG_SF_FRAME_DUR = 60100 }; - void doLogFrameDurations(const String8& window, const int32_t* durations, - size_t numDurations); -}; - -// --------------------------------------------------------------------------- -}// namespace android -// --------------------------------------------------------------------------- - -#endif /* ANDROID_SF_EVENTLOG_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventLog/EventLogTags.logtags android-platform-frameworks-native-21/services/surfaceflinger/EventLog/EventLogTags.logtags --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventLog/EventLogTags.logtags 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventLog/EventLogTags.logtags 1970-01-01 00:00:00.000000000 +0000 @@ -1,41 +0,0 @@ -# The entries in this file map a sparse set of log tag numbers to tag names. -# This is installed on the device, in /system/etc, and parsed by logcat. -# -# Tag numbers are decimal integers, from 0 to 2^31. (Let's leave the -# negative values alone for now.) -# -# Tag names are one or more ASCII letters and numbers or underscores, i.e. -# "[A-Z][a-z][0-9]_". Do not include spaces or punctuation (the former -# impacts log readability, the latter makes regex searches more annoying). -# -# Tag numbers and names are separated by whitespace. Blank lines and lines -# starting with '#' are ignored. -# -# Optionally, after the tag names can be put a description for the value(s) -# of the tag. Description are in the format -# (|data type[|data unit]) -# Multiple values are separated by commas. -# -# The data type is a number from the following values: -# 1: int -# 2: long -# 3: string -# 4: list -# -# The data unit is a number taken from the following list: -# 1: Number of objects -# 2: Number of bytes -# 3: Number of milliseconds -# 4: Number of allocations -# 5: Id -# 6: Percent -# Default value for data of type int/long is 2 (bytes). -# -# See system/core/logcat/event.logtags for the master copy of the tags. - -# 60100 - 60199 reserved for surfaceflinger - -60100 sf_frame_dur (window|3),(dur0|1),(dur1|1),(dur2|1),(dur3|1),(dur4|1),(dur5|1),(dur6|1) - -# NOTE - the range 1000000-2000000 is reserved for partners and others who -# want to define their own log tags without conflicting with the core platform. diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventThread.cpp android-platform-frameworks-native-21/services/surfaceflinger/EventThread.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventThread.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventThread.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -19,77 +19,36 @@ #include #include -#include - #include #include #include #include -#include #include +#include "DisplayHardware/DisplayHardware.h" #include "EventThread.h" #include "SurfaceFlinger.h" // --------------------------------------------------------------------------- + namespace android { -// --------------------------------------------------------------------------- -// time to wait between VSYNC requests before sending a VSYNC OFF power hint: 40msec. -const long vsyncHintOffDelay = 40000000; -static void vsyncOffCallback(union sigval val) { - EventThread *ev = (EventThread *)val.sival_ptr; - ev->sendVsyncHintOff(); - return; -} +// --------------------------------------------------------------------------- -EventThread::EventThread(const sp& src) - : mVSyncSource(src), +EventThread::EventThread(const sp& flinger) + : mFlinger(flinger), + mHw(flinger->graphicPlane(0).editDisplayHardware()), + mLastVSyncTimestamp(0), + mVSyncTimestamp(0), mUseSoftwareVSync(false), - mVsyncEnabled(false), - mDebugVsyncEnabled(false), - mVsyncHintSent(false) { - - for (int32_t i=0 ; isetPhaseOffset(phaseOffset); -} - -void EventThread::sendVsyncHintOnLocked() { - struct itimerspec ts; - if(!mVsyncHintSent) { - mPowerHAL.vsyncHint(true); - mVsyncHintSent = true; - } - ts.it_value.tv_sec = 0; - ts.it_value.tv_nsec = vsyncHintOffDelay; - ts.it_interval.tv_sec = 0; - ts.it_interval.tv_nsec = 0; - timer_settime(mTimerId, 0, &ts, NULL); + mDeliveredEvents(0), + mDebugVsyncEnabled(false) +{ } void EventThread::onFirstRef() { + mHw.setVSyncHandler(this); run("EventThread", PRIORITY_URGENT_DISPLAY + PRIORITY_MORE_FAVORABLE); } @@ -105,6 +64,14 @@ return NO_ERROR; } +status_t EventThread::unregisterDisplayEventConnection( + const wp& connection) { + Mutex::Autolock _l(mLock); + mDisplayEventConnections.remove(connection); + mCondition.broadcast(); + return NO_ERROR; +} + void EventThread::removeDisplayEventConnection( const wp& connection) { Mutex::Autolock _l(mLock); @@ -150,225 +117,166 @@ } } -void EventThread::onVSyncEvent(nsecs_t timestamp) { - Mutex::Autolock _l(mLock); - mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; - mVSyncEvent[0].header.id = 0; - mVSyncEvent[0].header.timestamp = timestamp; - mVSyncEvent[0].vsync.count++; - mCondition.broadcast(); -} - -void EventThread::onHotplugReceived(int type, bool connected) { - ALOGE_IF(type >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES, - "received hotplug event for an invalid display (id=%d)", type); +void EventThread::onVSyncReceived(int, nsecs_t timestamp) { Mutex::Autolock _l(mLock); - if (type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) { - DisplayEventReceiver::Event event; - event.header.type = DisplayEventReceiver::DISPLAY_EVENT_HOTPLUG; - event.header.id = type; - event.header.timestamp = systemTime(); - event.hotplug.connected = connected; - mPendingEvents.add(event); - mCondition.broadcast(); - } + mVSyncTimestamp = timestamp; + mCondition.broadcast(); } bool EventThread::threadLoop() { - DisplayEventReceiver::Event event; - Vector< sp > signalConnections; - signalConnections = waitForEvent(&event); - - // dispatch events to listeners... - const size_t count = signalConnections.size(); - for (size_t i=0 ; i& conn(signalConnections[i]); - // now see if we still need to report this event - status_t err = conn->postEvent(event); - if (err == -EAGAIN || err == -EWOULDBLOCK) { - // The destination doesn't accept events anymore, it's probably - // full. For now, we just drop the events on the floor. - // FIXME: Note that some events cannot be dropped and would have - // to be re-sent later. - // Right-now we don't have the ability to do this. - ALOGW("EventThread: dropping event (%08x) for connection %p", - event.header.type, conn.get()); - } else if (err < 0) { - // handle any other error on the pipe as fatal. the only - // reasonable thing to do is to clean-up this connection. - // The most common error we'll get here is -EPIPE. - removeDisplayEventConnection(signalConnections[i]); - } - } - return true; -} -// This will return when (1) a vsync event has been received, and (2) there was -// at least one connection interested in receiving it when we started waiting. -Vector< sp > EventThread::waitForEvent( - DisplayEventReceiver::Event* event) -{ - Mutex::Autolock _l(mLock); - Vector< sp > signalConnections; + nsecs_t timestamp; + DisplayEventReceiver::Event vsync; + Vector< wp > displayEventConnections; do { - bool eventPending = false; - bool waitForVSync = false; + Mutex::Autolock _l(mLock); + do { + // latch VSYNC event if any + timestamp = mVSyncTimestamp; + mVSyncTimestamp = 0; + + // check if we should be waiting for VSYNC events + bool waitForNextVsync = false; + size_t count = mDisplayEventConnections.size(); + for (size_t i=0 ; i connection = + mDisplayEventConnections.itemAt(i).promote(); + if (connection!=0 && connection->count >= 0) { + // at least one continuous mode or active one-shot event + waitForNextVsync = true; + break; + } + } - size_t vsyncCount = 0; - nsecs_t timestamp = 0; - for (int32_t i=0 ; i connection(mDisplayEventConnections[i].promote()); - if (connection != NULL) { - bool added = false; - if (connection->count >= 0) { - // we need vsync events because at least - // one connection is waiting for it - waitForVSync = true; - if (timestamp) { - // we consume the event only if it's time - // (ie: we received a vsync event) - if (connection->count == 0) { - // fired this time around - connection->count = -1; - signalConnections.add(connection); - added = true; - } else if (connection->count == 1 || - (vsyncCount % connection->count) == 0) { - // continuous event, and time to report it - signalConnections.add(connection); - added = true; - } - } + bool reportVsync = false; + sp connection = + mDisplayEventConnections.itemAt(i).promote(); + if (connection == 0) + continue; + + const int32_t count = connection->count; + if (count >= 1) { + if (count==1 || (mDeliveredEvents % count) == 0) { + // continuous event, and time to report it + reportVsync = true; } - - if (eventPending && !timestamp && !added) { - // we don't have a vsync event to process - // (timestamp==0), but we have some pending - // messages. - signalConnections.add(connection); + } else if (count >= -1) { + if (count == 0) { + // fired this time around + reportVsync = true; } - } else { - // we couldn't promote this reference, the connection has - // died, so clean-up! - mDisplayEventConnections.removeAt(i); - --i; --count; + connection->count--; + } + if (reportVsync) { + displayEventConnections.add(connection); } } + } while (!displayEventConnections.size()); - // Here we figure out if we need to enable or disable vsyncs - if (timestamp && !waitForVSync) { - // we received a VSYNC but we have no clients - // don't report it, and disable VSYNC events - disableVSyncLocked(); - } else if (!timestamp && waitForVSync) { - // we have at least one client, so we want vsync enabled - // (TODO: this function is called right after we finish - // notifying clients of a vsync, so this call will be made - // at the vsync rate, e.g. 60fps. If we can accurately - // track the current state we could avoid making this call - // so often.) - enableVSyncLocked(); - } + // dispatch vsync events to listeners... + vsync.header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; + vsync.header.timestamp = timestamp; + vsync.vsync.count = mDeliveredEvents; - // note: !timestamp implies signalConnections.isEmpty(), because we - // don't populate signalConnections if there's no vsync pending - if (!timestamp && !eventPending) { - // wait for something to happen - if (waitForVSync) { - // This is where we spend most of our time, waiting - // for vsync events and new client registrations. - // - // If the screen is off, we can't use h/w vsync, so we - // use a 16ms timeout instead. It doesn't need to be - // precise, we just need to keep feeding our clients. - // - // We don't want to stall if there's a driver bug, so we - // use a (long) timeout when waiting for h/w vsync, and - // generate fake events when necessary. - bool softwareSync = mUseSoftwareVSync; - nsecs_t timeout = softwareSync ? ms2ns(16) : ms2ns(1000); - if (mCondition.waitRelative(mLock, timeout) == TIMED_OUT) { - if (!softwareSync) { - ALOGW("Timed out waiting for hw vsync; faking it"); - } - // FIXME: how do we decide which display id the fake - // vsync came from ? - mVSyncEvent[0].header.type = DisplayEventReceiver::DISPLAY_EVENT_VSYNC; - mVSyncEvent[0].header.id = DisplayDevice::DISPLAY_PRIMARY; - mVSyncEvent[0].header.timestamp = systemTime(SYSTEM_TIME_MONOTONIC); - mVSyncEvent[0].vsync.count++; - } - } else { - // Nobody is interested in vsync, so we just want to sleep. - // h/w vsync should be disabled, so this will wait until we - // get a new connection, or an existing connection becomes - // interested in receiving vsync again. - mCondition.wait(mLock); + const size_t count = displayEventConnections.size(); + for (size_t i=0 ; i conn(displayEventConnections[i].promote()); + // make sure the connection didn't die + if (conn != NULL) { + status_t err = conn->postEvent(vsync); + if (err == -EAGAIN || err == -EWOULDBLOCK) { + // The destination doesn't accept events anymore, it's probably + // full. For now, we just drop the events on the floor. + // Note that some events cannot be dropped and would have to be + // re-sent later. Right-now we don't have the ability to do + // this, but it doesn't matter for VSYNC. + } else if (err < 0) { + // handle any other error on the pipe as fatal. the only + // reasonable thing to do is to clean-up this connection. + // The most common error we'll get here is -EPIPE. + removeDisplayEventConnection(displayEventConnections[i]); } + } else { + // somehow the connection is dead, but we still have it in our list + // just clean the list. + removeDisplayEventConnection(displayEventConnections[i]); } - } while (signalConnections.isEmpty()); + } + + // clear all our references without holding mLock + displayEventConnections.clear(); - // here we're guaranteed to have a timestamp and some connections to signal - // (The connections might have dropped out of mDisplayEventConnections - // while we were asleep, but we'll still have strong references to them.) - return signalConnections; + return true; } void EventThread::enableVSyncLocked() { if (!mUseSoftwareVSync) { // never enable h/w VSYNC when screen is off - if (!mVsyncEnabled) { - mVsyncEnabled = true; - mVSyncSource->setCallback(static_cast(this)); - mVSyncSource->setVSyncEnabled(true); - } + mHw.eventControl(DisplayHardware::EVENT_VSYNC, true); } mDebugVsyncEnabled = true; - sendVsyncHintOnLocked(); } void EventThread::disableVSyncLocked() { - if (mVsyncEnabled) { - mVsyncEnabled = false; - mVSyncSource->setVSyncEnabled(false); - mDebugVsyncEnabled = false; - } + mHw.eventControl(DisplayHardware::EVENT_VSYNC, false); + mDebugVsyncEnabled = false; +} + +status_t EventThread::readyToRun() { + ALOGI("EventThread ready to run."); + return NO_ERROR; } -void EventThread::dump(String8& result) const { +void EventThread::dump(String8& result, char* buffer, size_t SIZE) const { Mutex::Autolock _l(mLock); result.appendFormat("VSYNC state: %s\n", mDebugVsyncEnabled?"enabled":"disabled"); result.appendFormat(" soft-vsync: %s\n", mUseSoftwareVSync?"enabled":"disabled"); - result.appendFormat(" numListeners=%zu,\n events-delivered: %u\n", - mDisplayEventConnections.size(), - mVSyncEvent[DisplayDevice::DISPLAY_PRIMARY].vsync.count); + result.appendFormat(" numListeners=%u,\n events-delivered: %u\n", + mDisplayEventConnections.size(), mDeliveredEvents); for (size_t i=0 ; i connection = mDisplayEventConnections.itemAt(i).promote(); @@ -386,8 +294,7 @@ } EventThread::Connection::~Connection() { - // do nothing here -- clean-up will happen automatically - // when the main thread wakes up + mEventThread->unregisterDisplayEventConnection(this); } void EventThread::Connection::onFirstRef() { diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventThread.h android-platform-frameworks-native-21/services/surfaceflinger/EventThread.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/EventThread.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/EventThread.h 2012-10-16 22:57:11.000000000 +0000 @@ -27,34 +27,19 @@ #include #include -#include "DisplayDevice.h" -#include "DisplayHardware/PowerHAL.h" +#include "DisplayHardware/DisplayHardware.h" // --------------------------------------------------------------------------- + namespace android { + // --------------------------------------------------------------------------- class SurfaceFlinger; -class String8; // --------------------------------------------------------------------------- - -class VSyncSource : public virtual RefBase { -public: - class Callback: public virtual RefBase { - public: - virtual ~Callback() {} - virtual void onVSyncEvent(nsecs_t when) = 0; - }; - - virtual ~VSyncSource() {} - virtual void setVSyncEnabled(bool enable) = 0; - virtual void setCallback(const sp& callback) = 0; - virtual void setPhaseOffset(nsecs_t phaseOffset) = 0; -}; - -class EventThread : public Thread, private VSyncSource::Callback { +class EventThread : public Thread, public DisplayHardware::VSyncHandler { class Connection : public BnDisplayEventConnection { public: Connection(const sp& eventThread); @@ -63,6 +48,7 @@ // count >= 1 : continuous event. count is the vsync rate // count == 0 : one-shot event that has not fired // count ==-1 : one-shot event that fired this round / disabled + // count ==-2 : one-shot event that fired the round before int32_t count; private: @@ -77,10 +63,11 @@ public: - EventThread(const sp& src); + EventThread(const sp& flinger); sp createEventConnection() const; status_t registerDisplayEventConnection(const sp& connection); + status_t unregisterDisplayEventConnection(const wp& connection); void setVsyncRate(uint32_t count, const sp& connection); void requestNextVsync(const sp& connection); @@ -91,47 +78,36 @@ // called after the screen is turned on from main thread void onScreenAcquired(); - // called when receiving a hotplug event - void onHotplugReceived(int type, bool connected); - - Vector< sp > waitForEvent( - DisplayEventReceiver::Event* event); - - void dump(String8& result) const; - void sendVsyncHintOff(); - - void setPhaseOffset(nsecs_t phaseOffset); + void dump(String8& result, char* buffer, size_t SIZE) const; private: virtual bool threadLoop(); + virtual status_t readyToRun(); virtual void onFirstRef(); - - virtual void onVSyncEvent(nsecs_t timestamp); + virtual void onVSyncReceived(int, nsecs_t timestamp); void removeDisplayEventConnection(const wp& connection); void enableVSyncLocked(); void disableVSyncLocked(); - void sendVsyncHintOnLocked(); // constants - sp mVSyncSource; - PowerHAL mPowerHAL; + sp mFlinger; + DisplayHardware& mHw; mutable Mutex mLock; mutable Condition mCondition; // protected by mLock SortedVector< wp > mDisplayEventConnections; - Vector< DisplayEventReceiver::Event > mPendingEvents; - DisplayEventReceiver::Event mVSyncEvent[DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES]; + nsecs_t mLastVSyncTimestamp; + nsecs_t mVSyncTimestamp; bool mUseSoftwareVSync; - bool mVsyncEnabled; + + // main thread only + size_t mDeliveredEvents; // for debugging bool mDebugVsyncEnabled; - - bool mVsyncHintSent; - timer_t mTimerId; }; // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/FrameTracker.cpp android-platform-frameworks-native-21/services/surfaceflinger/FrameTracker.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/FrameTracker.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/FrameTracker.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,251 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -// This is needed for stdint.h to define INT64_MAX in C++ -#define __STDC_LIMIT_MACROS - -#include - -#include - -#include -#include - -#include - -#include "FrameTracker.h" -#include "EventLog/EventLog.h" - -namespace android { - -FrameTracker::FrameTracker() : - mOffset(0), - mNumFences(0), - mDisplayPeriod(0) { - resetFrameCountersLocked(); -} - -void FrameTracker::setDesiredPresentTime(nsecs_t presentTime) { - Mutex::Autolock lock(mMutex); - mFrameRecords[mOffset].desiredPresentTime = presentTime; -} - -void FrameTracker::setFrameReadyTime(nsecs_t readyTime) { - Mutex::Autolock lock(mMutex); - mFrameRecords[mOffset].frameReadyTime = readyTime; -} - -void FrameTracker::setFrameReadyFence(const sp& readyFence) { - Mutex::Autolock lock(mMutex); - mFrameRecords[mOffset].frameReadyFence = readyFence; - mNumFences++; -} - -void FrameTracker::setActualPresentTime(nsecs_t presentTime) { - Mutex::Autolock lock(mMutex); - mFrameRecords[mOffset].actualPresentTime = presentTime; -} - -void FrameTracker::setActualPresentFence(const sp& readyFence) { - Mutex::Autolock lock(mMutex); - mFrameRecords[mOffset].actualPresentFence = readyFence; - mNumFences++; -} - -void FrameTracker::setDisplayRefreshPeriod(nsecs_t displayPeriod) { - Mutex::Autolock lock(mMutex); - mDisplayPeriod = displayPeriod; -} - -void FrameTracker::advanceFrame() { - Mutex::Autolock lock(mMutex); - - // Update the statistic to include the frame we just finished. - updateStatsLocked(mOffset); - - // Advance to the next frame. - mOffset = (mOffset+1) % NUM_FRAME_RECORDS; - mFrameRecords[mOffset].desiredPresentTime = INT64_MAX; - mFrameRecords[mOffset].frameReadyTime = INT64_MAX; - mFrameRecords[mOffset].actualPresentTime = INT64_MAX; - - if (mFrameRecords[mOffset].frameReadyFence != NULL) { - // We're clobbering an unsignaled fence, so we need to decrement the - // fence count. - mFrameRecords[mOffset].frameReadyFence = NULL; - mNumFences--; - } - - if (mFrameRecords[mOffset].actualPresentFence != NULL) { - // We're clobbering an unsignaled fence, so we need to decrement the - // fence count. - mFrameRecords[mOffset].actualPresentFence = NULL; - mNumFences--; - } - - // Clean up the signaled fences to keep the number of open fence FDs in - // this process reasonable. - processFencesLocked(); -} - -void FrameTracker::clearStats() { - Mutex::Autolock lock(mMutex); - for (size_t i = 0; i < NUM_FRAME_RECORDS; i++) { - mFrameRecords[i].desiredPresentTime = 0; - mFrameRecords[i].frameReadyTime = 0; - mFrameRecords[i].actualPresentTime = 0; - mFrameRecords[i].frameReadyFence.clear(); - mFrameRecords[i].actualPresentFence.clear(); - } - mNumFences = 0; - mFrameRecords[mOffset].desiredPresentTime = INT64_MAX; - mFrameRecords[mOffset].frameReadyTime = INT64_MAX; - mFrameRecords[mOffset].actualPresentTime = INT64_MAX; -} - -void FrameTracker::getStats(FrameStats* outStats) const { - Mutex::Autolock lock(mMutex); - processFencesLocked(); - - outStats->refreshPeriodNano = mDisplayPeriod; - - const size_t offset = mOffset; - for (size_t i = 1; i < NUM_FRAME_RECORDS; i++) { - const size_t index = (offset + i) % NUM_FRAME_RECORDS; - - // Skip frame records with no data (if buffer not yet full). - if (mFrameRecords[index].desiredPresentTime == 0) { - continue; - } - - nsecs_t desiredPresentTimeNano = mFrameRecords[index].desiredPresentTime; - outStats->desiredPresentTimesNano.push_back(desiredPresentTimeNano); - - nsecs_t actualPresentTimeNano = mFrameRecords[index].actualPresentTime; - outStats->actualPresentTimesNano.push_back(actualPresentTimeNano); - - nsecs_t frameReadyTimeNano = mFrameRecords[index].frameReadyTime; - outStats->frameReadyTimesNano.push_back(frameReadyTimeNano); - } -} - -void FrameTracker::logAndResetStats(const String8& name) { - Mutex::Autolock lock(mMutex); - logStatsLocked(name); - resetFrameCountersLocked(); -} - -void FrameTracker::processFencesLocked() const { - FrameRecord* records = const_cast(mFrameRecords); - int& numFences = const_cast(mNumFences); - - for (int i = 1; i < NUM_FRAME_RECORDS && numFences > 0; i++) { - size_t idx = (mOffset+NUM_FRAME_RECORDS-i) % NUM_FRAME_RECORDS; - bool updated = false; - - const sp& rfence = records[idx].frameReadyFence; - if (rfence != NULL) { - records[idx].frameReadyTime = rfence->getSignalTime(); - if (records[idx].frameReadyTime < INT64_MAX) { - records[idx].frameReadyFence = NULL; - numFences--; - updated = true; - } - } - - const sp& pfence = records[idx].actualPresentFence; - if (pfence != NULL) { - records[idx].actualPresentTime = pfence->getSignalTime(); - if (records[idx].actualPresentTime < INT64_MAX) { - records[idx].actualPresentFence = NULL; - numFences--; - updated = true; - } - } - - if (updated) { - updateStatsLocked(idx); - } - } -} - -void FrameTracker::updateStatsLocked(size_t newFrameIdx) const { - int* numFrames = const_cast(mNumFrames); - - if (mDisplayPeriod > 0 && isFrameValidLocked(newFrameIdx)) { - size_t prevFrameIdx = (newFrameIdx+NUM_FRAME_RECORDS-1) % - NUM_FRAME_RECORDS; - - if (isFrameValidLocked(prevFrameIdx)) { - nsecs_t newPresentTime = - mFrameRecords[newFrameIdx].actualPresentTime; - nsecs_t prevPresentTime = - mFrameRecords[prevFrameIdx].actualPresentTime; - - nsecs_t duration = newPresentTime - prevPresentTime; - int numPeriods = int((duration + mDisplayPeriod/2) / - mDisplayPeriod); - - for (int i = 0; i < NUM_FRAME_BUCKETS-1; i++) { - int nextBucket = 1 << (i+1); - if (numPeriods < nextBucket) { - numFrames[i]++; - return; - } - } - - // The last duration bucket is a catch-all. - numFrames[NUM_FRAME_BUCKETS-1]++; - } - } -} - -void FrameTracker::resetFrameCountersLocked() { - for (int i = 0; i < NUM_FRAME_BUCKETS; i++) { - mNumFrames[i] = 0; - } -} - -void FrameTracker::logStatsLocked(const String8& name) const { - for (int i = 0; i < NUM_FRAME_BUCKETS; i++) { - if (mNumFrames[i] > 0) { - EventLog::logFrameDurations(name, mNumFrames, NUM_FRAME_BUCKETS); - return; - } - } -} - -bool FrameTracker::isFrameValidLocked(size_t idx) const { - return mFrameRecords[idx].actualPresentTime > 0 && - mFrameRecords[idx].actualPresentTime < INT64_MAX; -} - -void FrameTracker::dumpStats(String8& result) const { - Mutex::Autolock lock(mMutex); - processFencesLocked(); - - const size_t o = mOffset; - for (size_t i = 1; i < NUM_FRAME_RECORDS; i++) { - const size_t index = (o+i) % NUM_FRAME_RECORDS; - result.appendFormat("%" PRId64 "\t%" PRId64 "\t%" PRId64 "\n", - mFrameRecords[index].desiredPresentTime, - mFrameRecords[index].actualPresentTime, - mFrameRecords[index].frameReadyTime); - } - result.append("\n"); -} - -} // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/FrameTracker.h android-platform-frameworks-native-21/services/surfaceflinger/FrameTracker.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/FrameTracker.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/FrameTracker.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,164 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_FRAMETRACKER_H -#define ANDROID_FRAMETRACKER_H - -#include - -#include -#include -#include - -namespace android { - -class String8; -class Fence; - -// FrameTracker tracks information about the most recently rendered frames. It -// uses a circular buffer of frame records, and is *NOT* thread-safe - -// mutexing must be done at a higher level if multi-threaded access is -// possible. -// -// Some of the time values tracked may be set either as a specific timestamp -// or a fence. When a non-NULL fence is set for a given time value, the -// signal time of that fence is used instead of the timestamp. -class FrameTracker { - -public: - // NUM_FRAME_RECORDS is the size of the circular buffer used to track the - // frame time history. - enum { NUM_FRAME_RECORDS = 128 }; - - enum { NUM_FRAME_BUCKETS = 7 }; - - FrameTracker(); - - // setDesiredPresentTime sets the time at which the current frame - // should be presented to the user under ideal (i.e. zero latency) - // conditions. - void setDesiredPresentTime(nsecs_t desiredPresentTime); - - // setFrameReadyTime sets the time at which the current frame became ready - // to be presented to the user. For example, if the frame contents is - // being written to memory by some asynchronous hardware, this would be - // the time at which those writes completed. - void setFrameReadyTime(nsecs_t readyTime); - - // setFrameReadyFence sets the fence that is used to get the time at which - // the current frame became ready to be presented to the user. - void setFrameReadyFence(const sp& readyFence); - - // setActualPresentTime sets the timestamp at which the current frame became - // visible to the user. - void setActualPresentTime(nsecs_t displayTime); - - // setActualPresentFence sets the fence that is used to get the time - // at which the current frame became visible to the user. - void setActualPresentFence(const sp& fence); - - // setDisplayRefreshPeriod sets the display refresh period in nanoseconds. - // This is used to compute frame presentation duration statistics relative - // to this period. - void setDisplayRefreshPeriod(nsecs_t displayPeriod); - - // advanceFrame advances the frame tracker to the next frame. - void advanceFrame(); - - // clearStats clears the tracked frame stats. - void clearStats(); - - // getStats gets the tracked frame stats. - void getStats(FrameStats* outStats) const; - - // logAndResetStats dumps the current statistics to the binary event log - // and then resets the accumulated statistics to their initial values. - void logAndResetStats(const String8& name); - - // dumpStats dump appends the current frame display time history to the result string. - void dumpStats(String8& result) const; - -private: - struct FrameRecord { - FrameRecord() : - desiredPresentTime(0), - frameReadyTime(0), - actualPresentTime(0) {} - nsecs_t desiredPresentTime; - nsecs_t frameReadyTime; - nsecs_t actualPresentTime; - sp frameReadyFence; - sp actualPresentFence; - }; - - // processFences iterates over all the frame records that have a fence set - // and replaces that fence with a timestamp if the fence has signaled. If - // the fence is not signaled the record's displayTime is set to INT64_MAX. - // - // This method is const because although it modifies the frame records it - // does so in such a way that the information represented should not - // change. This allows it to be called from the dump method. - void processFencesLocked() const; - - // updateStatsLocked updates the running statistics that are gathered - // about the frame times. - void updateStatsLocked(size_t newFrameIdx) const; - - // resetFrameCounteresLocked sets all elements of the mNumFrames array to - // 0. - void resetFrameCountersLocked(); - - // logStatsLocked dumps the current statistics to the binary event log. - void logStatsLocked(const String8& name) const; - - // isFrameValidLocked returns true if the data for the given frame index is - // valid and has all arrived (i.e. there are no oustanding fences). - bool isFrameValidLocked(size_t idx) const; - - // mFrameRecords is the circular buffer storing the tracked data for each - // frame. - FrameRecord mFrameRecords[NUM_FRAME_RECORDS]; - - // mOffset is the offset into mFrameRecords of the current frame. - size_t mOffset; - - // mNumFences is the total number of fences set in the frame records. It - // is incremented each time a fence is added and decremented each time a - // signaled fence is removed in processFences or if advanceFrame clobbers - // a fence. - // - // The number of fences is tracked so that the run time of processFences - // doesn't grow with NUM_FRAME_RECORDS. - int mNumFences; - - // mNumFrames keeps a count of the number of frames with a duration in a - // particular range of vsync periods. Element n of the array stores the - // number of frames with duration in the half-inclusive range - // [2^n, 2^(n+1)). The last element of the array contains the count for - // all frames with duration greater than 2^(NUM_FRAME_BUCKETS-1). - int32_t mNumFrames[NUM_FRAME_BUCKETS]; - - // mDisplayPeriod is the display refresh period of the display for which - // this FrameTracker is gathering information. - nsecs_t mDisplayPeriod; - - // mMutex is used to protect access to all member variables. - mutable Mutex mMutex; -}; - -} - -#endif // ANDROID_FRAMETRACKER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/GLExtensions.cpp android-platform-frameworks-native-21/services/surfaceflinger/GLExtensions.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/GLExtensions.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/GLExtensions.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,137 @@ +/* + * Copyright (C) 2010 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 +#include +#include + +#include "GLExtensions.h" + +namespace android { +// --------------------------------------------------------------------------- + +ANDROID_SINGLETON_STATIC_INSTANCE( GLExtensions ) + +GLExtensions::GLExtensions() + : mHaveTextureExternal(false), + mHaveNpot(false), + mHaveDirectTexture(false) +{ +} + +void GLExtensions::initWithGLStrings( + GLubyte const* vendor, + GLubyte const* renderer, + GLubyte const* version, + GLubyte const* extensions, + char const* egl_vendor, + char const* egl_version, + char const* egl_extensions) +{ + mVendor = (char const*)vendor; + mRenderer = (char const*)renderer; + mVersion = (char const*)version; + mExtensions = (char const*)extensions; + mEglVendor = egl_vendor; + mEglVersion = egl_version; + mEglExtensions = egl_extensions; + + char const* curr = (char const*)extensions; + char const* head = curr; + do { + head = strchr(curr, ' '); + String8 s(curr, head ? head-curr : strlen(curr)); + if (s.length()) { + mExtensionList.add(s); + } + curr = head+1; + } while (head); + + curr = egl_extensions; + head = curr; + do { + head = strchr(curr, ' '); + String8 s(curr, head ? head-curr : strlen(curr)); + if (s.length()) { + mExtensionList.add(s); + } + curr = head+1; + } while (head); + +#ifdef EGL_ANDROID_image_native_buffer + if (hasExtension("GL_OES_EGL_image") && + (hasExtension("EGL_KHR_image_base") || hasExtension("EGL_KHR_image")) && + hasExtension("EGL_ANDROID_image_native_buffer")) + { + mHaveDirectTexture = true; + } +#else +#warning "EGL_ANDROID_image_native_buffer not supported" +#endif + + if (hasExtension("GL_ARB_texture_non_power_of_two")) { + mHaveNpot = true; + } + + if (hasExtension("GL_OES_EGL_image_external")) { + mHaveTextureExternal = true; + } else if (strstr(mRenderer.string(), "Adreno")) { + // hack for Adreno 200 + mHaveTextureExternal = true; + } + + if (hasExtension("GL_OES_framebuffer_object")) { + mHaveFramebufferObject = true; + } +} + +bool GLExtensions::hasExtension(char const* extension) const +{ + const String8 s(extension); + return mExtensionList.indexOf(s) >= 0; +} + +char const* GLExtensions::getVendor() const { + return mVendor.string(); +} + +char const* GLExtensions::getRenderer() const { + return mRenderer.string(); +} + +char const* GLExtensions::getVersion() const { + return mVersion.string(); +} + +char const* GLExtensions::getExtension() const { + return mExtensions.string(); +} + +char const* GLExtensions::getEglVendor() const { + return mEglVendor.string(); +} + +char const* GLExtensions::getEglVersion() const { + return mEglVersion.string(); +} + +char const* GLExtensions::getEglExtension() const { + return mEglExtensions.string(); +} + + +// --------------------------------------------------------------------------- +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/GLExtensions.h android-platform-frameworks-native-21/services/surfaceflinger/GLExtensions.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/GLExtensions.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/GLExtensions.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,99 @@ +/* + * Copyright (C) 2010 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. + */ + +#ifndef ANDROID_SF_GLEXTENSION_H +#define ANDROID_SF_GLEXTENSION_H + +#include +#include + +#include +#include +#include + +#include +#include +#include +#include + +namespace android { +// --------------------------------------------------------------------------- + +class GLExtensions : public Singleton +{ + friend class Singleton; + + bool mHaveTextureExternal : 1; + bool mHaveNpot : 1; + bool mHaveDirectTexture : 1; + bool mHaveFramebufferObject : 1; + + String8 mVendor; + String8 mRenderer; + String8 mVersion; + String8 mExtensions; + String8 mEglVendor; + String8 mEglVersion; + String8 mEglExtensions; + SortedVector mExtensionList; + + GLExtensions(const GLExtensions&); + GLExtensions& operator = (const GLExtensions&); + +protected: + GLExtensions(); + +public: + inline bool haveTextureExternal() const { + return mHaveTextureExternal; + } + inline bool haveNpot() const { + return mHaveNpot; + } + inline bool haveDirectTexture() const { + return mHaveDirectTexture; + } + + inline bool haveFramebufferObject() const { + return mHaveFramebufferObject; + } + + void initWithGLStrings( + GLubyte const* vendor, + GLubyte const* renderer, + GLubyte const* version, + GLubyte const* extensions, + char const* egl_vendor, + char const* egl_version, + char const* egl_extensions); + + char const* getVendor() const; + char const* getRenderer() const; + char const* getVersion() const; + char const* getExtension() const; + + char const* getEglVendor() const; + char const* getEglVersion() const; + char const* getEglExtension() const; + + bool hasExtension(char const* extension) const; +}; + + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_SF_GLEXTENSION_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerBase.cpp android-platform-frameworks-native-21/services/surfaceflinger/LayerBase.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerBase.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/LayerBase.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,568 @@ +/* + * Copyright (C) 2007 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 +#include +#include + +#include +#include +#include +#include + +#include +#include + +#include + +#include "clz.h" +#include "LayerBase.h" +#include "SurfaceFlinger.h" +#include "DisplayHardware/DisplayHardware.h" + +namespace android { + +// --------------------------------------------------------------------------- + +int32_t LayerBase::sSequence = 1; + +LayerBase::LayerBase(SurfaceFlinger* flinger, DisplayID display) + : dpy(display), contentDirty(false), + sequence(uint32_t(android_atomic_inc(&sSequence))), + mFlinger(flinger), mFiltering(false), + mNeedsFiltering(false), + mOrientation(0), + mPlaneOrientation(0), + mTransactionFlags(0), + mPremultipliedAlpha(true), mName("unnamed"), mDebug(false) +{ + const DisplayHardware& hw(flinger->graphicPlane(0).displayHardware()); + mFlags = hw.getFlags(); +} + +LayerBase::~LayerBase() +{ +} + +void LayerBase::setName(const String8& name) { + mName = name; +} + +String8 LayerBase::getName() const { + return mName; +} + +const GraphicPlane& LayerBase::graphicPlane(int dpy) const +{ + return mFlinger->graphicPlane(dpy); +} + +GraphicPlane& LayerBase::graphicPlane(int dpy) +{ + return mFlinger->graphicPlane(dpy); +} + +void LayerBase::initStates(uint32_t w, uint32_t h, uint32_t flags) +{ + uint32_t layerFlags = 0; + if (flags & ISurfaceComposer::eHidden) + layerFlags = ISurfaceComposer::eLayerHidden; + + if (flags & ISurfaceComposer::eNonPremultiplied) + mPremultipliedAlpha = false; + + mCurrentState.active.w = w; + mCurrentState.active.h = h; + mCurrentState.active.crop.makeInvalid(); + mCurrentState.z = 0; + mCurrentState.alpha = 0xFF; + mCurrentState.flags = layerFlags; + mCurrentState.sequence = 0; + mCurrentState.transform.set(0, 0); + mCurrentState.requested = mCurrentState.active; + + // drawing state & current state are identical + mDrawingState = mCurrentState; +} + +void LayerBase::commitTransaction() { + mDrawingState = mCurrentState; +} +void LayerBase::forceVisibilityTransaction() { + // this can be called without SurfaceFlinger.mStateLock, but if we + // can atomically increment the sequence number, it doesn't matter. + android_atomic_inc(&mCurrentState.sequence); + requestTransaction(); +} +bool LayerBase::requestTransaction() { + int32_t old = setTransactionFlags(eTransactionNeeded); + return ((old & eTransactionNeeded) == 0); +} +uint32_t LayerBase::getTransactionFlags(uint32_t flags) { + return android_atomic_and(~flags, &mTransactionFlags) & flags; +} +uint32_t LayerBase::setTransactionFlags(uint32_t flags) { + return android_atomic_or(flags, &mTransactionFlags); +} + +bool LayerBase::setPosition(float x, float y) { + if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y) + return false; + mCurrentState.sequence++; + mCurrentState.transform.set(x, y); + requestTransaction(); + return true; +} +bool LayerBase::setLayer(uint32_t z) { + if (mCurrentState.z == z) + return false; + mCurrentState.sequence++; + mCurrentState.z = z; + requestTransaction(); + return true; +} +bool LayerBase::setSize(uint32_t w, uint32_t h) { + if (mCurrentState.requested.w == w && mCurrentState.requested.h == h) + return false; + mCurrentState.requested.w = w; + mCurrentState.requested.h = h; + requestTransaction(); + return true; +} +bool LayerBase::setAlpha(uint8_t alpha) { + if (mCurrentState.alpha == alpha) + return false; + mCurrentState.sequence++; + mCurrentState.alpha = alpha; + requestTransaction(); + return true; +} +bool LayerBase::setMatrix(const layer_state_t::matrix22_t& matrix) { + mCurrentState.sequence++; + mCurrentState.transform.set( + matrix.dsdx, matrix.dsdy, matrix.dtdx, matrix.dtdy); + requestTransaction(); + return true; +} +bool LayerBase::setTransparentRegionHint(const Region& transparent) { + mCurrentState.sequence++; + mCurrentState.transparentRegion = transparent; + requestTransaction(); + return true; +} +bool LayerBase::setFlags(uint8_t flags, uint8_t mask) { + const uint32_t newFlags = (mCurrentState.flags & ~mask) | (flags & mask); + if (mCurrentState.flags == newFlags) + return false; + mCurrentState.sequence++; + mCurrentState.flags = newFlags; + requestTransaction(); + return true; +} +bool LayerBase::setCrop(const Rect& crop) { + if (mCurrentState.requested.crop == crop) + return false; + mCurrentState.sequence++; + mCurrentState.requested.crop = crop; + requestTransaction(); + return true; +} + +Rect LayerBase::visibleBounds() const +{ + return mTransformedBounds; +} + +void LayerBase::setVisibleRegion(const Region& visibleRegion) { + // always called from main thread + visibleRegionScreen = visibleRegion; +} + +void LayerBase::setCoveredRegion(const Region& coveredRegion) { + // always called from main thread + coveredRegionScreen = coveredRegion; +} + +void LayerBase::setVisibleNonTransparentRegion(const Region& + visibleNonTransparentRegion) { + // always called from main thread + this->visibleNonTransparentRegion = visibleNonTransparentRegion; +} + +uint32_t LayerBase::doTransaction(uint32_t flags) +{ + const Layer::State& front(drawingState()); + const Layer::State& temp(currentState()); + + // always set active to requested, unless we're asked not to + // this is used by Layer, which special cases resizes. + if (flags & eDontUpdateGeometryState) { + } else { + Layer::State& editTemp(currentState()); + editTemp.active = temp.requested; + } + + if (front.active != temp.active) { + // invalidate and recompute the visible regions if needed + flags |= Layer::eVisibleRegion; + } + + if (temp.sequence != front.sequence) { + // invalidate and recompute the visible regions if needed + flags |= eVisibleRegion; + this->contentDirty = true; + + // we may use linear filtering, if the matrix scales us + const uint8_t type = temp.transform.getType(); + mNeedsFiltering = (!temp.transform.preserveRects() || + (type >= Transform::SCALE)); + } + + // Commit the transaction + commitTransaction(); + return flags; +} + +void LayerBase::validateVisibility(const Transform& planeTransform) +{ + const Layer::State& s(drawingState()); + const Transform tr(planeTransform * s.transform); + const bool transformed = tr.transformed(); + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const uint32_t hw_h = hw.getHeight(); + const Rect& crop(s.active.crop); + + Rect win(s.active.w, s.active.h); + if (!crop.isEmpty()) { + win.intersect(crop, &win); + } + + mNumVertices = 4; + tr.transform(mVertices[0], win.left, win.top); + tr.transform(mVertices[1], win.left, win.bottom); + tr.transform(mVertices[2], win.right, win.bottom); + tr.transform(mVertices[3], win.right, win.top); + for (size_t i=0 ; i<4 ; i++) + mVertices[i][1] = hw_h - mVertices[i][1]; + + if (CC_UNLIKELY(transformed)) { + // NOTE: here we could also punt if we have too many rectangles + // in the transparent region + if (tr.preserveRects()) { + // transform the transparent region + transparentRegionScreen = tr.transform(s.transparentRegion); + } else { + // transformation too complex, can't do the transparent region + // optimization. + transparentRegionScreen.clear(); + } + } else { + transparentRegionScreen = s.transparentRegion; + } + + // cache a few things... + mOrientation = tr.getOrientation(); + mPlaneOrientation = planeTransform.getOrientation(); + mTransform = tr; + mTransformedBounds = tr.transform(win); +} + +void LayerBase::lockPageFlip(bool& recomputeVisibleRegions) { +} + +void LayerBase::unlockPageFlip( + const Transform& planeTransform, Region& outDirtyRegion) { +} + +void LayerBase::setGeometry(hwc_layer_t* hwcl) +{ + hwcl->compositionType = HWC_FRAMEBUFFER; + hwcl->hints = 0; + hwcl->flags = HWC_SKIP_LAYER; + hwcl->transform = 0; + hwcl->blending = HWC_BLENDING_NONE; + + // this gives us only the "orientation" component of the transform + const State& s(drawingState()); + const uint32_t finalTransform = s.transform.getOrientation(); + // we can only handle simple transformation + if (finalTransform & Transform::ROT_INVALID) { + hwcl->flags = HWC_SKIP_LAYER; + } else { + hwcl->transform = finalTransform; + } + + if (!isOpaque()) { + hwcl->blending = mPremultipliedAlpha ? + HWC_BLENDING_PREMULT : HWC_BLENDING_COVERAGE; + } + + // scaling is already applied in mTransformedBounds + hwcl->displayFrame.left = mTransformedBounds.left; + hwcl->displayFrame.top = mTransformedBounds.top; + hwcl->displayFrame.right = mTransformedBounds.right; + hwcl->displayFrame.bottom = mTransformedBounds.bottom; + hwcl->visibleRegionScreen.rects = + reinterpret_cast( + visibleRegionScreen.getArray( + &hwcl->visibleRegionScreen.numRects)); + + hwcl->sourceCrop.left = 0; + hwcl->sourceCrop.top = 0; + hwcl->sourceCrop.right = mTransformedBounds.width(); + hwcl->sourceCrop.bottom = mTransformedBounds.height(); +} + +void LayerBase::setPerFrameData(hwc_layer_t* hwcl) { + hwcl->compositionType = HWC_FRAMEBUFFER; + hwcl->handle = NULL; +} + +void LayerBase::setFiltering(bool filtering) +{ + mFiltering = filtering; +} + +bool LayerBase::getFiltering() const +{ + return mFiltering; +} + +void LayerBase::draw(const Region& clip) const +{ + onDraw(clip); +} + +void LayerBase::drawForSreenShot() +{ + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + setFiltering(true); + onDraw( Region(hw.bounds()) ); + setFiltering(false); +} + +void LayerBase::clearWithOpenGL(const Region& clip, GLclampf red, + GLclampf green, GLclampf blue, + GLclampf alpha) const +{ + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const uint32_t fbHeight = hw.getHeight(); + glColor4f(red,green,blue,alpha); + + glDisable(GL_TEXTURE_EXTERNAL_OES); + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + glVertexPointer(2, GL_FLOAT, 0, mVertices); + glDrawArrays(GL_TRIANGLE_FAN, 0, mNumVertices); +} + +void LayerBase::clearWithOpenGL(const Region& clip) const +{ + clearWithOpenGL(clip,0,0,0,0); +} + +void LayerBase::drawWithOpenGL(const Region& clip) const +{ + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const uint32_t fbHeight = hw.getHeight(); + const State& s(drawingState()); + + GLenum src = mPremultipliedAlpha ? GL_ONE : GL_SRC_ALPHA; + if (CC_UNLIKELY(s.alpha < 0xFF)) { + const GLfloat alpha = s.alpha * (1.0f/255.0f); + if (mPremultipliedAlpha) { + glColor4f(alpha, alpha, alpha, alpha); + } else { + glColor4f(1, 1, 1, alpha); + } + glEnable(GL_BLEND); + glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + } else { + glColor4f(1, 1, 1, 1); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + if (!isOpaque()) { + glEnable(GL_BLEND); + glBlendFunc(src, GL_ONE_MINUS_SRC_ALPHA); + } else { + glDisable(GL_BLEND); + } + } + + struct TexCoords { + GLfloat u; + GLfloat v; + }; + + Rect crop(s.active.w, s.active.h); + if (!s.active.crop.isEmpty()) { + crop = s.active.crop; + } + GLfloat left = GLfloat(crop.left) / GLfloat(s.active.w); + GLfloat top = GLfloat(crop.top) / GLfloat(s.active.h); + GLfloat right = GLfloat(crop.right) / GLfloat(s.active.w); + GLfloat bottom = GLfloat(crop.bottom) / GLfloat(s.active.h); + + TexCoords texCoords[4]; + texCoords[0].u = left; + texCoords[0].v = top; + texCoords[1].u = left; + texCoords[1].v = bottom; + texCoords[2].u = right; + texCoords[2].v = bottom; + texCoords[3].u = right; + texCoords[3].v = top; + for (int i = 0; i < 4; i++) { + texCoords[i].v = 1.0f - texCoords[i].v; + } + + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, mVertices); + glTexCoordPointer(2, GL_FLOAT, 0, texCoords); + glDrawArrays(GL_TRIANGLE_FAN, 0, mNumVertices); + + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDisable(GL_BLEND); +} + +void LayerBase::dump(String8& result, char* buffer, size_t SIZE) const +{ + const Layer::State& s(drawingState()); + + snprintf(buffer, SIZE, + "+ %s %p (%s)\n", + getTypeId(), this, getName().string()); + result.append(buffer); + + s.transparentRegion.dump(result, "transparentRegion"); + transparentRegionScreen.dump(result, "transparentRegionScreen"); + visibleRegionScreen.dump(result, "visibleRegionScreen"); + + snprintf(buffer, SIZE, + " " + "z=%9d, pos=(%g,%g), size=(%4d,%4d), crop=(%4d,%4d,%4d,%4d), " + "isOpaque=%1d, needsDithering=%1d, invalidate=%1d, " + "alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n", + s.z, s.transform.tx(), s.transform.ty(), s.active.w, s.active.h, + s.active.crop.left, s.active.crop.top, + s.active.crop.right, s.active.crop.bottom, + isOpaque(), needsDithering(), contentDirty, + s.alpha, s.flags, + s.transform[0][0], s.transform[0][1], + s.transform[1][0], s.transform[1][1]); + result.append(buffer); +} + +void LayerBase::shortDump(String8& result, char* scratch, size_t size) const { + LayerBase::dump(result, scratch, size); +} + +void LayerBase::dumpStats(String8& result, char* scratch, size_t SIZE) const { +} + +void LayerBase::clearStats() { +} + +// --------------------------------------------------------------------------- + +int32_t LayerBaseClient::sIdentity = 1; + +LayerBaseClient::LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, + const sp& client) + : LayerBase(flinger, display), + mHasSurface(false), + mClientRef(client), + mIdentity(uint32_t(android_atomic_inc(&sIdentity))) +{ +} + +LayerBaseClient::~LayerBaseClient() +{ + sp c(mClientRef.promote()); + if (c != 0) { + c->detachLayer(this); + } +} + +sp LayerBaseClient::createSurface() +{ + class BSurface : public BnSurface, public LayerCleaner { + virtual sp getSurfaceTexture() const { return 0; } + public: + BSurface(const sp& flinger, + const sp& layer) + : LayerCleaner(flinger, layer) { } + }; + sp sur(new BSurface(mFlinger, this)); + return sur; +} + +sp LayerBaseClient::getSurface() +{ + sp s; + Mutex::Autolock _l(mLock); + + LOG_ALWAYS_FATAL_IF(mHasSurface, + "LayerBaseClient::getSurface() has already been called"); + + mHasSurface = true; + s = createSurface(); + mClientSurfaceBinder = s->asBinder(); + return s; +} + +wp LayerBaseClient::getSurfaceBinder() const { + return mClientSurfaceBinder; +} + +wp LayerBaseClient::getSurfaceTextureBinder() const { + return 0; +} + +void LayerBaseClient::dump(String8& result, char* buffer, size_t SIZE) const +{ + LayerBase::dump(result, buffer, SIZE); + + sp client(mClientRef.promote()); + snprintf(buffer, SIZE, + " client=%p, identity=%u\n", + client.get(), getIdentity()); + + result.append(buffer); +} + + +void LayerBaseClient::shortDump(String8& result, char* scratch, size_t size) const +{ + LayerBaseClient::dump(result, scratch, size); +} + +// --------------------------------------------------------------------------- + +LayerBaseClient::LayerCleaner::LayerCleaner(const sp& flinger, + const sp& layer) + : mFlinger(flinger), mLayer(layer) { +} + +LayerBaseClient::LayerCleaner::~LayerCleaner() { + // destroy client resources + mFlinger->destroySurface(mLayer); +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerBase.h android-platform-frameworks-native-21/services/surfaceflinger/LayerBase.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerBase.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/LayerBase.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,355 @@ +/* + * Copyright (C) 2007 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. + */ + +#ifndef ANDROID_LAYER_BASE_H +#define ANDROID_LAYER_BASE_H + +#include +#include + +#include +#include +#include + +#include + +#include + +#include + +#include + +#include + +#include "DisplayHardware/DisplayHardware.h" +#include "Transform.h" + +namespace android { + +// --------------------------------------------------------------------------- + +class Client; +class DisplayHardware; +class GraphicBuffer; +class GraphicPlane; +class Layer; +class LayerBaseClient; +class SurfaceFlinger; + +// --------------------------------------------------------------------------- + +class LayerBase : public RefBase +{ + static int32_t sSequence; + +public: + LayerBase(SurfaceFlinger* flinger, DisplayID display); + + DisplayID dpy; + mutable bool contentDirty; + Region visibleRegionScreen; + Region transparentRegionScreen; + Region coveredRegionScreen; + Region visibleNonTransparentRegion; + int32_t sequence; + + struct Geometry { + uint32_t w; + uint32_t h; + Rect crop; + inline bool operator == (const Geometry& rhs) const { + return (w==rhs.w && h==rhs.h && crop==rhs.crop); + } + inline bool operator != (const Geometry& rhs) const { + return !operator == (rhs); + } + }; + + struct State { + Geometry active; + Geometry requested; + uint32_t z; + uint8_t alpha; + uint8_t flags; + uint8_t reserved[2]; + int32_t sequence; // changes when visible regions can change + Transform transform; + Region transparentRegion; + }; + + virtual void setName(const String8& name); + String8 getName() const; + + // modify current state + bool setPosition(float x, float y); + bool setLayer(uint32_t z); + bool setSize(uint32_t w, uint32_t h); + bool setAlpha(uint8_t alpha); + bool setMatrix(const layer_state_t::matrix22_t& matrix); + bool setTransparentRegionHint(const Region& transparent); + bool setFlags(uint8_t flags, uint8_t mask); + bool setCrop(const Rect& crop); + + void commitTransaction(); + bool requestTransaction(); + void forceVisibilityTransaction(); + + uint32_t getTransactionFlags(uint32_t flags); + uint32_t setTransactionFlags(uint32_t flags); + + Rect visibleBounds() const; + + virtual sp getLayerBaseClient() const { return 0; } + virtual sp getLayer() const { return 0; } + + virtual const char* getTypeId() const { return "LayerBase"; } + + virtual void setGeometry(hwc_layer_t* hwcl); + virtual void setPerFrameData(hwc_layer_t* hwcl); + + + /** + * draw - performs some global clipping optimizations + * and calls onDraw(). + * Typically this method is not overridden, instead implement onDraw() + * to perform the actual drawing. + */ + virtual void draw(const Region& clip) const; + virtual void drawForSreenShot(); + + /** + * onDraw - draws the surface. + */ + virtual void onDraw(const Region& clip) const = 0; + + /** + * initStates - called just after construction + */ + virtual void initStates(uint32_t w, uint32_t h, uint32_t flags); + + /** + * doTransaction - process the transaction. This is a good place to figure + * out which attributes of the surface have changed. + */ + virtual uint32_t doTransaction(uint32_t transactionFlags); + + /** + * setVisibleRegion - called to set the new visible region. This gives + * a chance to update the new visible region or record the fact it changed. + */ + virtual void setVisibleRegion(const Region& visibleRegion); + + /** + * setCoveredRegion - called when the covered region changes. The covered + * region corresponds to any area of the surface that is covered + * (transparently or not) by another surface. + */ + virtual void setCoveredRegion(const Region& coveredRegion); + + /** + * setVisibleNonTransparentRegion - called when the visible and + * non-transparent region changes. + */ + virtual void setVisibleNonTransparentRegion(const Region& + visibleNonTransparentRegion); + + /** + * validateVisibility - cache a bunch of things + */ + virtual void validateVisibility(const Transform& globalTransform); + + /** + * lockPageFlip - called each time the screen is redrawn and returns whether + * the visible regions need to be recomputed (this is a fairly heavy + * operation, so this should be set only if needed). Typically this is used + * to figure out if the content or size of a surface has changed. + */ + virtual void lockPageFlip(bool& recomputeVisibleRegions); + + /** + * unlockPageFlip - called each time the screen is redrawn. updates the + * final dirty region wrt the planeTransform. + * At this point, all visible regions, surface position and size, etc... are + * correct. + */ + virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion); + + /** + * isOpaque - true if this surface is opaque + */ + virtual bool isOpaque() const { return true; } + + /** + * needsDithering - true if this surface needs dithering + */ + virtual bool needsDithering() const { return false; } + + /** + * needsLinearFiltering - true if this surface's state requires filtering + */ + virtual bool needsFiltering() const { return mNeedsFiltering; } + + /** + * isSecure - true if this surface is secure, that is if it prevents + * screenshots or VNC servers. + */ + virtual bool isSecure() const { return false; } + + /** + * isProtected - true if the layer may contain protected content in the + * GRALLOC_USAGE_PROTECTED sense. + */ + virtual bool isProtected() const { return false; } + + /** called with the state lock when the surface is removed from the + * current list */ + virtual void onRemoved() { } + + /** called after page-flip + */ + virtual void onLayerDisplayed() { } + + /** called before composition. + * returns true if the layer has pending updates. + */ + virtual bool onPreComposition() { return false; } + + /** always call base class first */ + virtual void dump(String8& result, char* scratch, size_t size) const; + virtual void shortDump(String8& result, char* scratch, size_t size) const; + virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const; + virtual void clearStats(); + + + enum { // flags for doTransaction() + eDontUpdateGeometryState = 0x00000001, + eVisibleRegion = 0x00000002, + }; + + + inline const State& drawingState() const { return mDrawingState; } + inline const State& currentState() const { return mCurrentState; } + inline State& currentState() { return mCurrentState; } + + int32_t getOrientation() const { return mOrientation; } + int32_t getPlaneOrientation() const { return mPlaneOrientation; } + + void clearWithOpenGL(const Region& clip) const; + +protected: + const GraphicPlane& graphicPlane(int dpy) const; + GraphicPlane& graphicPlane(int dpy); + + void clearWithOpenGL(const Region& clip, GLclampf r, GLclampf g, + GLclampf b, GLclampf alpha) const; + void drawWithOpenGL(const Region& clip) const; + + void setFiltering(bool filtering); + bool getFiltering() const; + + sp mFlinger; + uint32_t mFlags; + +private: + // accessed only in the main thread + // Whether filtering is forced on or not + bool mFiltering; + + // cached during validateVisibility() + // Whether filtering is needed b/c of the drawingstate + bool mNeedsFiltering; + +protected: + // cached during validateVisibility() + int32_t mOrientation; + int32_t mPlaneOrientation; + Transform mTransform; + GLfloat mVertices[4][2]; + size_t mNumVertices; + Rect mTransformedBounds; + + // these are protected by an external lock + State mCurrentState; + State mDrawingState; + volatile int32_t mTransactionFlags; + + // don't change, don't need a lock + bool mPremultipliedAlpha; + String8 mName; + mutable bool mDebug; + + +public: + // called from class SurfaceFlinger + virtual ~LayerBase(); + +private: + LayerBase(const LayerBase& rhs); +}; + + +// --------------------------------------------------------------------------- + +class LayerBaseClient : public LayerBase +{ +public: + LayerBaseClient(SurfaceFlinger* flinger, DisplayID display, + const sp& client); + + virtual ~LayerBaseClient(); + + sp getSurface(); + wp getSurfaceBinder() const; + virtual wp getSurfaceTextureBinder() const; + + virtual sp getLayerBaseClient() const { + return const_cast(this); } + + virtual const char* getTypeId() const { return "LayerBaseClient"; } + + uint32_t getIdentity() const { return mIdentity; } + +protected: + virtual void dump(String8& result, char* scratch, size_t size) const; + virtual void shortDump(String8& result, char* scratch, size_t size) const; + + class LayerCleaner { + sp mFlinger; + wp mLayer; + protected: + ~LayerCleaner(); + public: + LayerCleaner(const sp& flinger, + const sp& layer); + }; + +private: + virtual sp createSurface(); + + mutable Mutex mLock; + mutable bool mHasSurface; + wp mClientSurfaceBinder; + const wp mClientRef; + // only read + const uint32_t mIdentity; + static int32_t sIdentity; +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_LAYER_BASE_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Layer.cpp android-platform-frameworks-native-21/services/surfaceflinger/Layer.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Layer.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Layer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -27,26 +27,21 @@ #include #include -#include #include #include #include #include -#include #include #include "clz.h" -#include "Colorizer.h" -#include "DisplayDevice.h" +#include "DisplayHardware/DisplayHardware.h" +#include "DisplayHardware/HWComposer.h" +#include "GLExtensions.h" #include "Layer.h" -#include "MonitoredProducer.h" #include "SurfaceFlinger.h" - -#include "DisplayHardware/HWComposer.h" - -#include "RenderEngine/RenderEngine.h" +#include "SurfaceTextureLayer.h" #define DEBUG_RESIZE 0 @@ -54,198 +49,144 @@ // --------------------------------------------------------------------------- -int32_t Layer::sSequence = 1; - -Layer::Layer(SurfaceFlinger* flinger, const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags) - : contentDirty(false), - sequence(uint32_t(android_atomic_inc(&sSequence))), - mFlinger(flinger), +Layer::Layer(SurfaceFlinger* flinger, + DisplayID display, const sp& client) + : LayerBaseClient(flinger, display, client), mTextureName(-1U), - mPremultipliedAlpha(true), - mName("unnamed"), - mFormat(PIXEL_FORMAT_NONE), - mTransactionFlags(0), mQueuedFrames(0), - mSidebandStreamChanged(false), mCurrentTransform(0), mCurrentScalingMode(NATIVE_WINDOW_SCALING_MODE_FREEZE), mCurrentOpacity(true), mRefreshPending(false), mFrameLatencyNeeded(false), - mFiltering(false), - mNeedsFiltering(false), - mMesh(Mesh::TRIANGLE_FAN, 4, 2, 2), - mProtectedByApp(false), - mHasSurface(false), - mClientRef(client), - mPotentialCursor(false), - mQueueItemLock(), - mQueueItemCondition(), - mQueueItems(), - mLastFrameNumberReceived(0), - mUpdateTexImageFailed(false) + mFrameLatencyOffset(0), + mFormat(PIXEL_FORMAT_NONE), + mGLExtensions(GLExtensions::getInstance()), + mOpaqueLayer(true), + mNeedsDithering(false), + mSecure(false), + mProtectedByApp(false) { mCurrentCrop.makeInvalid(); - mFlinger->getRenderEngine().genTextures(1, &mTextureName); - mTexture.init(Texture::TEXTURE_EXTERNAL, mTextureName); - - uint32_t layerFlags = 0; - if (flags & ISurfaceComposerClient::eHidden) - layerFlags |= layer_state_t::eLayerHidden; - if (flags & ISurfaceComposerClient::eOpaque) - layerFlags |= layer_state_t::eLayerOpaque; - if (flags & ISurfaceComposerClient::eSecure) - layerFlags |= layer_state_t::eLayerSecure; - - if (flags & ISurfaceComposerClient::eNonPremultiplied) - mPremultipliedAlpha = false; - - mName = name; - - mCurrentState.active.w = w; - mCurrentState.active.h = h; - mCurrentState.active.crop.makeInvalid(); - mCurrentState.z = 0; - mCurrentState.alpha = 0xFF; - mCurrentState.layerStack = 0; - mCurrentState.flags = layerFlags; - mCurrentState.sequence = 0; - mCurrentState.transform.set(0, 0); - mCurrentState.requested = mCurrentState.active; - - // drawing state & current state are identical - mDrawingState = mCurrentState; - - nsecs_t displayPeriod = - flinger->getHwComposer().getRefreshPeriod(HWC_DISPLAY_PRIMARY); - mFrameTracker.setDisplayRefreshPeriod(displayPeriod); -} - -void Layer::onFirstRef() { - // Creates a custom BufferQueue for SurfaceFlingerConsumer to use - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - mProducer = new MonitoredProducer(producer, mFlinger); - mSurfaceFlingerConsumer = new SurfaceFlingerConsumer(consumer, mTextureName); - mSurfaceFlingerConsumer->setConsumerUsageBits(getEffectiveUsage(0)); - mSurfaceFlingerConsumer->setContentsChangedListener(this); - mSurfaceFlingerConsumer->setName(mName); - -#ifdef TARGET_DISABLE_TRIPLE_BUFFERING -#warning "disabling triple buffering" - mSurfaceFlingerConsumer->setDefaultMaxBufferCount(2); -#else - mSurfaceFlingerConsumer->setDefaultMaxBufferCount(3); -#endif - - const sp hw(mFlinger->getDefaultDisplayDevice()); - updateTransformHint(hw); -} - -Layer::~Layer() { - sp c(mClientRef.promote()); - if (c != 0) { - c->detachLayer(this); - } - mFlinger->deleteTextureAsync(mTextureName); - mFrameTracker.logAndResetStats(mName); + glGenTextures(1, &mTextureName); } -// --------------------------------------------------------------------------- -// callbacks -// --------------------------------------------------------------------------- - -void Layer::onLayerDisplayed(const sp& /* hw */, - HWComposer::HWCLayerInterface* layer) { - if (layer) { - layer->onDisplayed(); - mSurfaceFlingerConsumer->setReleaseFence(layer->getAndResetReleaseFence()); +void Layer::onLayerDisplayed() { + if (mFrameLatencyNeeded) { + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + mFrameStats[mFrameLatencyOffset].timestamp = mSurfaceTexture->getTimestamp(); + mFrameStats[mFrameLatencyOffset].set = systemTime(); + mFrameStats[mFrameLatencyOffset].vsync = hw.getRefreshTimestamp(); + mFrameLatencyOffset = (mFrameLatencyOffset + 1) % 128; + mFrameLatencyNeeded = false; } } -void Layer::onFrameAvailable(const BufferItem& item) { - // Add this buffer from our internal queue tracker - { // Autolock scope - Mutex::Autolock lock(mQueueItemLock); - - // Reset the frame number tracker when we receive the first buffer after - // a frame number reset - if (item.mFrameNumber == 1) { - mLastFrameNumberReceived = 0; - } +void Layer::onFirstRef() +{ + LayerBaseClient::onFirstRef(); - // Ensure that callbacks are handled in order - while (item.mFrameNumber != mLastFrameNumberReceived + 1) { - status_t result = mQueueItemCondition.waitRelative(mQueueItemLock, - ms2ns(500)); - if (result != NO_ERROR) { - ALOGE("[%s] Timed out waiting on callback", mName.string()); + struct FrameQueuedListener : public SurfaceTexture::FrameAvailableListener { + FrameQueuedListener(Layer* layer) : mLayer(layer) { } + private: + wp mLayer; + virtual void onFrameAvailable() { + sp that(mLayer.promote()); + if (that != 0) { + that->onFrameQueued(); } } + }; - mQueueItems.push_back(item); - android_atomic_inc(&mQueuedFrames); - - // Wake up any pending callbacks - mLastFrameNumberReceived = item.mFrameNumber; - mQueueItemCondition.broadcast(); - } + // Creates a custom BufferQueue for SurfaceTexture to use + sp bq = new SurfaceTextureLayer(); + mSurfaceTexture = new SurfaceTexture(mTextureName, true, + GL_TEXTURE_EXTERNAL_OES, false, bq); + + mSurfaceTexture->setConsumerUsageBits(getEffectiveUsage(0)); + mSurfaceTexture->setFrameAvailableListener(new FrameQueuedListener(this)); + mSurfaceTexture->setSynchronousMode(true); - mFlinger->signalLayerUpdate(); +#ifdef TARGET_DISABLE_TRIPLE_BUFFERING +#warning "disabling triple buffering" + mSurfaceTexture->setBufferCountServer(2); +#else + mSurfaceTexture->setBufferCountServer(3); +#endif } -void Layer::onFrameReplaced(const BufferItem& item) { - Mutex::Autolock lock(mQueueItemLock); - - // Ensure that callbacks are handled in order - while (item.mFrameNumber != mLastFrameNumberReceived + 1) { - status_t result = mQueueItemCondition.waitRelative(mQueueItemLock, - ms2ns(500)); - if (result != NO_ERROR) { - ALOGE("[%s] Timed out waiting on callback", mName.string()); - } - } +Layer::~Layer() +{ + mFlinger->postMessageAsync( + new SurfaceFlinger::MessageDestroyGLTexture(mTextureName) ); +} - if (mQueueItems.empty()) { - ALOGE("Can't replace a frame on an empty queue"); - return; - } - mQueueItems.editItemAt(0) = item; +void Layer::onFrameQueued() { + android_atomic_inc(&mQueuedFrames); + mFlinger->signalLayerUpdate(); +} - // Wake up any pending callbacks - mLastFrameNumberReceived = item.mFrameNumber; - mQueueItemCondition.broadcast(); +// called with SurfaceFlinger::mStateLock as soon as the layer is entered +// in the purgatory list +void Layer::onRemoved() +{ + mSurfaceTexture->abandon(); } -void Layer::onSidebandStreamChanged() { - if (android_atomic_release_cas(false, true, &mSidebandStreamChanged) == 0) { - // mSidebandStreamChanged was false - mFlinger->signalLayerUpdate(); - } +void Layer::setName(const String8& name) { + LayerBase::setName(name); + mSurfaceTexture->setName(name); } -// called with SurfaceFlinger::mStateLock from the drawing thread after -// the layer has been remove from the current state list (and just before -// it's removed from the drawing state list) -void Layer::onRemoved() { - mSurfaceFlingerConsumer->abandon(); +void Layer::validateVisibility(const Transform& globalTransform) { + LayerBase::validateVisibility(globalTransform); + + // This optimization allows the SurfaceTexture to bake in + // the rotation so hardware overlays can be used + mSurfaceTexture->setTransformHint(getTransformHint()); } -// --------------------------------------------------------------------------- -// set-up -// --------------------------------------------------------------------------- +sp Layer::createSurface() +{ + class BSurface : public BnSurface, public LayerCleaner { + wp mOwner; + virtual sp getSurfaceTexture() const { + sp res; + sp that( mOwner.promote() ); + if (that != NULL) { + res = that->mSurfaceTexture->getBufferQueue(); + } + return res; + } + public: + BSurface(const sp& flinger, + const sp& layer) + : LayerCleaner(flinger, layer), mOwner(layer) { } + }; + sp sur(new BSurface(mFlinger, this)); + return sur; +} -const String8& Layer::getName() const { - return mName; +wp Layer::getSurfaceTextureBinder() const +{ + return mSurfaceTexture->getBufferQueue()->asBinder(); } status_t Layer::setBuffers( uint32_t w, uint32_t h, PixelFormat format, uint32_t flags) { + // this surfaces pixel format + PixelFormatInfo info; + status_t err = getPixelFormatInfo(format, &info); + if (err) { + ALOGE("unsupported pixelformat %d", format); + return err; + } + + // the display's pixel format + const DisplayHardware& hw(graphicPlane(0).displayHardware()); uint32_t const maxSurfaceDims = min( - mFlinger->getMaxTextureSize(), mFlinger->getMaxViewportDims()); + hw.getMaxTextureSize(), hw.getMaxViewportDims()); // never allow a surface larger than what our underlying GL implementation // can handle. @@ -254,372 +195,125 @@ return BAD_VALUE; } + PixelFormatInfo displayInfo; + getPixelFormatInfo(hw.getFormat(), &displayInfo); + const uint32_t hwFlags = hw.getFlags(); + mFormat = format; - mPotentialCursor = (flags & ISurfaceComposerClient::eCursorWindow) ? true : false; - mProtectedByApp = (flags & ISurfaceComposerClient::eProtectedByApp) ? true : false; + mSecure = (flags & ISurfaceComposer::eSecure) ? true : false; + mProtectedByApp = (flags & ISurfaceComposer::eProtectedByApp) ? true : false; + mOpaqueLayer = (flags & ISurfaceComposer::eOpaque); mCurrentOpacity = getOpacityForFormat(format); - mSurfaceFlingerConsumer->setDefaultBufferSize(w, h); - mSurfaceFlingerConsumer->setDefaultBufferFormat(format); - mSurfaceFlingerConsumer->setConsumerUsageBits(getEffectiveUsage(0)); + mSurfaceTexture->setDefaultBufferSize(w, h); + mSurfaceTexture->setDefaultBufferFormat(format); + mSurfaceTexture->setConsumerUsageBits(getEffectiveUsage(0)); + + // we use the red index + int displayRedSize = displayInfo.getSize(PixelFormatInfo::INDEX_RED); + int layerRedsize = info.getSize(PixelFormatInfo::INDEX_RED); + mNeedsDithering = layerRedsize > displayRedSize; return NO_ERROR; } -sp Layer::getHandle() { - Mutex::Autolock _l(mLock); - - LOG_ALWAYS_FATAL_IF(mHasSurface, - "Layer::getHandle() has already been called"); - - mHasSurface = true; - - /* - * The layer handle is just a BBinder object passed to the client - * (remote process) -- we don't keep any reference on our side such that - * the dtor is called when the remote side let go of its reference. - * - * LayerCleaner ensures that mFlinger->onLayerDestroyed() is called for - * this layer when the handle is destroyed. - */ - - class Handle : public BBinder, public LayerCleaner { - wp mOwner; - public: - Handle(const sp& flinger, const sp& layer) - : LayerCleaner(flinger, layer), mOwner(layer) { - } - }; - - return new Handle(mFlinger, this); -} - -sp Layer::getProducer() const { - return mProducer; -} - -// --------------------------------------------------------------------------- -// h/w composer set-up -// --------------------------------------------------------------------------- - -Rect Layer::getContentCrop() const { - // this is the crop rectangle that applies to the buffer - // itself (as opposed to the window) +Rect Layer::computeBufferCrop() const { + // Start with the SurfaceTexture's buffer crop... Rect crop; if (!mCurrentCrop.isEmpty()) { - // if the buffer crop is defined, we use that crop = mCurrentCrop; - } else if (mActiveBuffer != NULL) { - // otherwise we use the whole buffer - crop = mActiveBuffer->getBounds(); + } else if (mActiveBuffer != NULL){ + crop = Rect(mActiveBuffer->getWidth(), mActiveBuffer->getHeight()); } else { - // if we don't have a buffer yet, we use an empty/invalid crop - crop.makeInvalid(); - } - return crop; -} - -static Rect reduce(const Rect& win, const Region& exclude) { - if (CC_LIKELY(exclude.isEmpty())) { - return win; - } - if (exclude.isRect()) { - return win.reduce(exclude.getBounds()); - } - return Region(win).subtract(exclude).getBounds(); -} - -Rect Layer::computeBounds() const { - const Layer::State& s(getDrawingState()); - return computeBounds(s.activeTransparentRegion); -} - -Rect Layer::computeBounds(const Region& activeTransparentRegion) const { - const Layer::State& s(getDrawingState()); - Rect win(s.active.w, s.active.h); - if (!s.active.crop.isEmpty()) { - win.intersect(s.active.crop, &win); + crop = Rect(mTransformedBounds.width(), mTransformedBounds.height()); } - // subtract the transparent region and snap to the bounds - return reduce(win, activeTransparentRegion); -} - -FloatRect Layer::computeCrop(const sp& hw) const { - // the content crop is the area of the content that gets scaled to the - // layer's size. - FloatRect crop(getContentCrop()); - - // the active.crop is the area of the window that gets cropped, but not - // scaled in any ways. - const State& s(getDrawingState()); - // apply the projection's clipping to the window crop in - // layerstack space, and convert-back to layer space. - // if there are no window scaling involved, this operation will map to full - // pixels in the buffer. - // FIXME: the 3 lines below can produce slightly incorrect clipping when we have - // a viewport clipping and a window transform. we should use floating point to fix this. - - Rect activeCrop(s.active.w, s.active.h); + // ... then reduce that in the same proportions as the window crop reduces + // the window size. + const State& s(drawingState()); if (!s.active.crop.isEmpty()) { - activeCrop = s.active.crop; - } - - activeCrop = s.transform.transform(activeCrop); - activeCrop.intersect(hw->getViewport(), &activeCrop); - activeCrop = s.transform.inverse().transform(activeCrop); - - // This needs to be here as transform.transform(Rect) computes the - // transformed rect and then takes the bounding box of the result before - // returning. This means - // transform.inverse().transform(transform.transform(Rect)) != Rect - // in which case we need to make sure the final rect is clipped to the - // display bounds. - activeCrop.intersect(Rect(s.active.w, s.active.h), &activeCrop); - - // subtract the transparent region and snap to the bounds - activeCrop = reduce(activeCrop, s.activeTransparentRegion); - - if (!activeCrop.isEmpty()) { // Transform the window crop to match the buffer coordinate system, // which means using the inverse of the current transform set on the - // SurfaceFlingerConsumer. + // SurfaceTexture. uint32_t invTransform = mCurrentTransform; - if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { - /* - * the code below applies the display's inverse transform to the buffer - */ - uint32_t invTransformOrient = hw->getOrientationTransform(); - // calculate the inverse transform - if (invTransformOrient & NATIVE_WINDOW_TRANSFORM_ROT_90) { - invTransformOrient ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | - NATIVE_WINDOW_TRANSFORM_FLIP_H; - // If the transform has been rotated the axis of flip has been swapped - // so we need to swap which flip operations we are performing - bool is_h_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0; - bool is_v_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0; - if (is_h_flipped != is_v_flipped) { - invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | - NATIVE_WINDOW_TRANSFORM_FLIP_H; - } - } - // and apply to the current transform - invTransform = (Transform(invTransform) * Transform(invTransformOrient)).getOrientation(); - } - int winWidth = s.active.w; int winHeight = s.active.h; if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { - // If the activeCrop has been rotate the ends are rotated but not - // the space itself so when transforming ends back we can't rely on - // a modification of the axes of rotation. To account for this we - // need to reorient the inverse rotation in terms of the current - // axes of rotation. - bool is_h_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0; - bool is_v_flipped = (invTransform & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0; - if (is_h_flipped == is_v_flipped) { - invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | - NATIVE_WINDOW_TRANSFORM_FLIP_H; - } + invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | + NATIVE_WINDOW_TRANSFORM_FLIP_H; winWidth = s.active.h; winHeight = s.active.w; } - const Rect winCrop = activeCrop.transform( - invTransform, s.active.w, s.active.h); + Rect winCrop = s.active.crop.transform(invTransform, + s.active.w, s.active.h); - // below, crop is intersected with winCrop expressed in crop's coordinate space - float xScale = crop.getWidth() / float(winWidth); - float yScale = crop.getHeight() / float(winHeight); - - float insetL = winCrop.left * xScale; - float insetT = winCrop.top * yScale; - float insetR = (winWidth - winCrop.right ) * xScale; - float insetB = (winHeight - winCrop.bottom) * yScale; - - crop.left += insetL; - crop.top += insetT; - crop.right -= insetR; - crop.bottom -= insetB; + float xScale = float(crop.width()) / float(winWidth); + float yScale = float(crop.height()) / float(winHeight); + crop.left += int(ceilf(float(winCrop.left) * xScale)); + crop.top += int(ceilf(float(winCrop.top) * yScale)); + crop.right -= int(ceilf(float(winWidth - winCrop.right) * xScale)); + crop.bottom -= int(ceilf(float(winHeight - winCrop.bottom) * yScale)); } + return crop; } -void Layer::setGeometry( - const sp& hw, - HWComposer::HWCLayerInterface& layer) +void Layer::setGeometry(hwc_layer_t* hwcl) { - layer.setDefaultState(); + LayerBaseClient::setGeometry(hwcl); - // enable this layer - layer.setSkip(false); + hwcl->flags &= ~HWC_SKIP_LAYER; - if (isSecure() && !hw->isSecure()) { - layer.setSkip(true); + // we can't do alpha-fade with the hwc HAL + const State& s(drawingState()); + if (s.alpha < 0xFF) { + hwcl->flags = HWC_SKIP_LAYER; } - // this gives us only the "orientation" component of the transform - const State& s(getDrawingState()); - if (!isOpaque(s) || s.alpha != 0xFF) { - layer.setBlending(mPremultipliedAlpha ? - HWC_BLENDING_PREMULT : - HWC_BLENDING_COVERAGE); - } - - // apply the layer's transform, followed by the display's global transform - // here we're guaranteed that the layer's transform preserves rects - Region activeTransparentRegion(s.activeTransparentRegion); - if (!s.active.crop.isEmpty()) { - Rect activeCrop(s.active.crop); - activeCrop = s.transform.transform(activeCrop); - activeCrop.intersect(hw->getViewport(), &activeCrop); - activeCrop = s.transform.inverse().transform(activeCrop); - // This needs to be here as transform.transform(Rect) computes the - // transformed rect and then takes the bounding box of the result before - // returning. This means - // transform.inverse().transform(transform.transform(Rect)) != Rect - // in which case we need to make sure the final rect is clipped to the - // display bounds. - activeCrop.intersect(Rect(s.active.w, s.active.h), &activeCrop); - // mark regions outside the crop as transparent - activeTransparentRegion.orSelf(Rect(0, 0, s.active.w, activeCrop.top)); - activeTransparentRegion.orSelf(Rect(0, activeCrop.bottom, - s.active.w, s.active.h)); - activeTransparentRegion.orSelf(Rect(0, activeCrop.top, - activeCrop.left, activeCrop.bottom)); - activeTransparentRegion.orSelf(Rect(activeCrop.right, activeCrop.top, - s.active.w, activeCrop.bottom)); - } - Rect frame(s.transform.transform(computeBounds(activeTransparentRegion))); - frame.intersect(hw->getViewport(), &frame); - const Transform& tr(hw->getTransform()); - layer.setFrame(tr.transform(frame)); - layer.setCrop(computeCrop(hw)); - layer.setPlaneAlpha(s.alpha); - /* * Transformations are applied in this order: * 1) buffer orientation/flip/mirror * 2) state transformation (window manager) * 3) layer orientation (screen orientation) + * mTransform is already the composition of (2) and (3) * (NOTE: the matrices are multiplied in reverse order) */ const Transform bufferOrientation(mCurrentTransform); - Transform transform(tr * s.transform * bufferOrientation); - - if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { - /* - * the code below applies the display's inverse transform to the buffer - */ - uint32_t invTransform = hw->getOrientationTransform(); - uint32_t t_orientation = transform.getOrientation(); - // calculate the inverse transform - if (invTransform & NATIVE_WINDOW_TRANSFORM_ROT_90) { - invTransform ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | - NATIVE_WINDOW_TRANSFORM_FLIP_H; - // If the transform has been rotated the axis of flip has been swapped - // so we need to swap which flip operations we are performing - bool is_h_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_H) != 0; - bool is_v_flipped = (t_orientation & NATIVE_WINDOW_TRANSFORM_FLIP_V) != 0; - if (is_h_flipped != is_v_flipped) { - t_orientation ^= NATIVE_WINDOW_TRANSFORM_FLIP_V | - NATIVE_WINDOW_TRANSFORM_FLIP_H; - } - } - // and apply to the current transform - transform = Transform(t_orientation) * Transform(invTransform); - } + const Transform tr(mTransform * bufferOrientation); // this gives us only the "orientation" component of the transform - const uint32_t orientation = transform.getOrientation(); - if (orientation & Transform::ROT_INVALID) { - // we can only handle simple transformation - layer.setSkip(true); - } else { - layer.setTransform(orientation); - } -} - -void Layer::setPerFrameData(const sp& hw, - HWComposer::HWCLayerInterface& layer) { - // we have to set the visible region on every frame because - // we currently free it during onLayerDisplayed(), which is called - // after HWComposer::commit() -- every frame. - // Apply this display's projection's viewport to the visible region - // before giving it to the HWC HAL. - const Transform& tr = hw->getTransform(); - Region visible = tr.transform(visibleRegion.intersect(hw->getViewport())); - layer.setVisibleRegionScreen(visible); - layer.setSurfaceDamage(surfaceDamageRegion); + const uint32_t finalTransform = tr.getOrientation(); - if (mSidebandStream.get()) { - layer.setSidebandStream(mSidebandStream); + // we can only handle simple transformation + if (finalTransform & Transform::ROT_INVALID) { + hwcl->flags = HWC_SKIP_LAYER; } else { - // NOTE: buffer can be NULL if the client never drew into this - // layer yet, or if we ran out of memory - layer.setBuffer(mActiveBuffer); + hwcl->transform = finalTransform; } -} - -void Layer::setAcquireFence(const sp& /* hw */, - HWComposer::HWCLayerInterface& layer) { - int fenceFd = -1; - - // TODO: there is a possible optimization here: we only need to set the - // acquire fence the first time a new buffer is acquired on EACH display. - - if (layer.getCompositionType() == HWC_OVERLAY || layer.getCompositionType() == HWC_CURSOR_OVERLAY) { - sp fence = mSurfaceFlingerConsumer->getCurrentFence(); - if (fence->isValid()) { - fenceFd = fence->dup(); - if (fenceFd == -1) { - ALOGW("failed to dup layer fence, skipping sync: %d", errno); - } - } - } - layer.setAcquireFenceFd(fenceFd); -} -Rect Layer::getPosition( - const sp& hw) -{ - // this gives us only the "orientation" component of the transform - const State& s(getCurrentState()); - - // apply the layer's transform, followed by the display's global transform - // here we're guaranteed that the layer's transform preserves rects - Rect win(s.active.w, s.active.h); - if (!s.active.crop.isEmpty()) { - win.intersect(s.active.crop, &win); + Rect crop = computeBufferCrop(); + hwcl->sourceCrop.left = crop.left; + hwcl->sourceCrop.top = crop.top; + hwcl->sourceCrop.right = crop.right; + hwcl->sourceCrop.bottom = crop.bottom; +} + +void Layer::setPerFrameData(hwc_layer_t* hwcl) { + const sp& buffer(mActiveBuffer); + if (buffer == NULL) { + // this can happen if the client never drew into this layer yet, + // or if we ran out of memory. In that case, don't let + // HWC handle it. + hwcl->flags |= HWC_SKIP_LAYER; + hwcl->handle = NULL; + } else { + hwcl->handle = buffer->handle; } - // subtract the transparent region and snap to the bounds - Rect bounds = reduce(win, s.activeTransparentRegion); - Rect frame(s.transform.transform(bounds)); - frame.intersect(hw->getViewport(), &frame); - const Transform& tr(hw->getTransform()); - return Rect(tr.transform(frame)); } -// --------------------------------------------------------------------------- -// drawing... -// --------------------------------------------------------------------------- - -void Layer::draw(const sp& hw, const Region& clip) const { - onDraw(hw, clip, false); -} - -void Layer::draw(const sp& hw, - bool useIdentityTransform) const { - onDraw(hw, Region(hw->bounds()), useIdentityTransform); -} - -void Layer::draw(const sp& hw) const { - onDraw(hw, Region(hw->bounds()), false); -} - -void Layer::onDraw(const sp& hw, const Region& clip, - bool useIdentityTransform) const +void Layer::onDraw(const Region& clip) const { ATRACE_CALL(); @@ -638,156 +332,54 @@ mFlinger->mDrawingState.layersSortedByZ); const size_t count = drawingLayers.size(); for (size_t i=0 ; i& layer(drawingLayers[i]); - if (layer.get() == static_cast(this)) + const sp& layer(drawingLayers[i]); + if (layer.get() == static_cast(this)) break; - under.orSelf( hw->getTransform().transform(layer->visibleRegion) ); + under.orSelf(layer->visibleRegionScreen); } // if not everything below us is covered, we plug the holes! Region holes(clip.subtract(under)); if (!holes.isEmpty()) { - clearWithOpenGL(hw, holes, 0, 0, 0, 1); + clearWithOpenGL(holes, 0, 0, 0, 1); } return; } - // Bind the current buffer to the GL texture, and wait for it to be - // ready for us to draw into. - status_t err = mSurfaceFlingerConsumer->bindTextureImage(); - if (err != NO_ERROR) { - ALOGW("onDraw: bindTextureImage failed (err=%d)", err); - // Go ahead and draw the buffer anyway; no matter what we do the screen - // is probably going to have something visibly wrong. - } - - bool blackOutLayer = isProtected() || (isSecure() && !hw->isSecure()); - - RenderEngine& engine(mFlinger->getRenderEngine()); - - if (!blackOutLayer) { + if (!isProtected()) { // TODO: we could be more subtle with isFixedSize() - const bool useFiltering = getFiltering() || needsFiltering(hw) || isFixedSize(); + const bool useFiltering = getFiltering() || needsFiltering() || isFixedSize(); // Query the texture matrix given our current filtering mode. float textureMatrix[16]; - mSurfaceFlingerConsumer->setFilteringEnabled(useFiltering); - mSurfaceFlingerConsumer->getTransformMatrix(textureMatrix); - - if (mSurfaceFlingerConsumer->getTransformToDisplayInverse()) { - - /* - * the code below applies the display's inverse transform to the texture transform - */ - - // create a 4x4 transform matrix from the display transform flags - const mat4 flipH(-1,0,0,0, 0,1,0,0, 0,0,1,0, 1,0,0,1); - const mat4 flipV( 1,0,0,0, 0,-1,0,0, 0,0,1,0, 0,1,0,1); - const mat4 rot90( 0,1,0,0, -1,0,0,0, 0,0,1,0, 1,0,0,1); - - mat4 tr; - uint32_t transform = hw->getOrientationTransform(); - if (transform & NATIVE_WINDOW_TRANSFORM_ROT_90) - tr = tr * rot90; - if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_H) - tr = tr * flipH; - if (transform & NATIVE_WINDOW_TRANSFORM_FLIP_V) - tr = tr * flipV; - - // calculate the inverse - tr = inverse(tr); - - // and finally apply it to the original texture matrix - const mat4 texTransform(mat4(static_cast(textureMatrix)) * tr); - memcpy(textureMatrix, texTransform.asArray(), sizeof(textureMatrix)); - } + mSurfaceTexture->setFilteringEnabled(useFiltering); + mSurfaceTexture->getTransformMatrix(textureMatrix); // Set things up for texturing. - mTexture.setDimensions(mActiveBuffer->getWidth(), mActiveBuffer->getHeight()); - mTexture.setFiltering(useFiltering); - mTexture.setMatrix(textureMatrix); - - engine.setupLayerTexturing(mTexture); + glBindTexture(GL_TEXTURE_EXTERNAL_OES, mTextureName); + GLenum filter = GL_NEAREST; + if (useFiltering) { + filter = GL_LINEAR; + } + glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MAG_FILTER, filter); + glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_MIN_FILTER, filter); + glMatrixMode(GL_TEXTURE); + glLoadMatrixf(textureMatrix); + glMatrixMode(GL_MODELVIEW); + glDisable(GL_TEXTURE_2D); + glEnable(GL_TEXTURE_EXTERNAL_OES); } else { - engine.setupLayerBlackedOut(); - } - drawWithOpenGL(hw, clip, useIdentityTransform); - engine.disableTexturing(); -} - - -void Layer::clearWithOpenGL(const sp& hw, - const Region& /* clip */, float red, float green, float blue, - float alpha) const -{ - RenderEngine& engine(mFlinger->getRenderEngine()); - computeGeometry(hw, mMesh, false); - engine.setupFillWithColor(red, green, blue, alpha); - engine.drawMesh(mMesh); -} - -void Layer::clearWithOpenGL( - const sp& hw, const Region& clip) const { - clearWithOpenGL(hw, clip, 0,0,0,0); -} - -void Layer::drawWithOpenGL(const sp& hw, - const Region& /* clip */, bool useIdentityTransform) const { - const State& s(getDrawingState()); - - computeGeometry(hw, mMesh, useIdentityTransform); - - /* - * NOTE: the way we compute the texture coordinates here produces - * different results than when we take the HWC path -- in the later case - * the "source crop" is rounded to texel boundaries. - * This can produce significantly different results when the texture - * is scaled by a large amount. - * - * The GL code below is more logical (imho), and the difference with - * HWC is due to a limitation of the HWC API to integers -- a question - * is suspend is whether we should ignore this problem or revert to - * GL composition when a buffer scaling is applied (maybe with some - * minimal value)? Or, we could make GL behave like HWC -- but this feel - * like more of a hack. - */ - const Rect win(computeBounds()); - - float left = float(win.left) / float(s.active.w); - float top = float(win.top) / float(s.active.h); - float right = float(win.right) / float(s.active.w); - float bottom = float(win.bottom) / float(s.active.h); - - // TODO: we probably want to generate the texture coords with the mesh - // here we assume that we only have 4 vertices - Mesh::VertexArray texCoords(mMesh.getTexCoordArray()); - texCoords[0] = vec2(left, 1.0f - top); - texCoords[1] = vec2(left, 1.0f - bottom); - texCoords[2] = vec2(right, 1.0f - bottom); - texCoords[3] = vec2(right, 1.0f - top); - - RenderEngine& engine(mFlinger->getRenderEngine()); - engine.setupLayerBlending(mPremultipliedAlpha, isOpaque(s), s.alpha); - engine.drawMesh(mMesh); - engine.disableBlending(); -} - -uint32_t Layer::getProducerStickyTransform() const { - int producerStickyTransform = 0; - int ret = mProducer->query(NATIVE_WINDOW_STICKY_TRANSFORM, &producerStickyTransform); - if (ret != OK) { - ALOGW("%s: Error %s (%d) while querying window sticky transform.", __FUNCTION__, - strerror(-ret), ret); - return 0; + glBindTexture(GL_TEXTURE_2D, mFlinger->getProtectedTexName()); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glDisable(GL_TEXTURE_EXTERNAL_OES); + glEnable(GL_TEXTURE_2D); } - return static_cast(producerStickyTransform); -} -void Layer::setFiltering(bool filtering) { - mFiltering = filtering; -} + drawWithOpenGL(clip); -bool Layer::getFiltering() const { - return mFiltering; + glDisable(GL_TEXTURE_EXTERNAL_OES); + glDisable(GL_TEXTURE_2D); } // As documented in libhardware header, formats in the range @@ -797,48 +389,19 @@ // hardware.h, instead of using hard-coded values here. #define HARDWARE_IS_DEVICE_FORMAT(f) ((f) >= 0x100 && (f) <= 0x1FF) -bool Layer::getOpacityForFormat(uint32_t format) { +bool Layer::getOpacityForFormat(uint32_t format) +{ if (HARDWARE_IS_DEVICE_FORMAT(format)) { return true; } - switch (format) { - case HAL_PIXEL_FORMAT_RGBA_8888: - case HAL_PIXEL_FORMAT_BGRA_8888: - return false; - } - // in all other case, we have no blending (also for unknown formats) - return true; + PixelFormatInfo info; + status_t err = getPixelFormatInfo(PixelFormat(format), &info); + // in case of error (unknown format), we assume no blending + return (err || info.h_alpha <= info.l_alpha); } -// ---------------------------------------------------------------------------- -// local state -// ---------------------------------------------------------------------------- -void Layer::computeGeometry(const sp& hw, Mesh& mesh, - bool useIdentityTransform) const -{ - const Layer::State& s(getDrawingState()); - const Transform tr(useIdentityTransform ? - hw->getTransform() : hw->getTransform() * s.transform); - const uint32_t hw_h = hw->getHeight(); - Rect win(s.active.w, s.active.h); - if (!s.active.crop.isEmpty()) { - win.intersect(s.active.crop, &win); - } - // subtract the transparent region and snap to the bounds - win = reduce(win, s.activeTransparentRegion); - - Mesh::VertexArray position(mesh.getPositionArray()); - position[0] = tr.transform(win.left, win.top); - position[1] = tr.transform(win.left, win.bottom); - position[2] = tr.transform(win.right, win.bottom); - position[3] = tr.transform(win.right, win.top); - for (size_t i=0 ; i<4 ; i++) { - position[i].y = hw_h - position[i].y; - } -} - -bool Layer::isOpaque(const Layer::State& s) const +bool Layer::isOpaque() const { // if we don't have a buffer yet, we're translucent regardless of the // layer's opaque flag. @@ -848,13 +411,7 @@ // if the layer has the opaque flag, then we're always opaque, // otherwise we use the current buffer's format. - return ((s.flags & layer_state_t::eLayerOpaque) != 0) || mCurrentOpacity; -} - -bool Layer::isSecure() const -{ - const Layer::State& s(mDrawingState); - return (s.flags & layer_state_t::eLayerSecure); + return mOpaqueLayer || mCurrentOpacity; } bool Layer::isProtected() const @@ -864,98 +421,67 @@ (activeBuffer->getUsage() & GRALLOC_USAGE_PROTECTED); } -bool Layer::isFixedSize() const { - return mCurrentScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE; -} - -bool Layer::isCropped() const { - return !mCurrentCrop.isEmpty(); -} - -bool Layer::needsFiltering(const sp& hw) const { - return mNeedsFiltering || hw->needsFiltering(); -} - -void Layer::setVisibleRegion(const Region& visibleRegion) { - // always called from main thread - this->visibleRegion = visibleRegion; -} - -void Layer::setCoveredRegion(const Region& coveredRegion) { - // always called from main thread - this->coveredRegion = coveredRegion; -} - -void Layer::setVisibleNonTransparentRegion(const Region& - setVisibleNonTransparentRegion) { - // always called from main thread - this->visibleNonTransparentRegion = setVisibleNonTransparentRegion; -} - -// ---------------------------------------------------------------------------- -// transaction -// ---------------------------------------------------------------------------- - -uint32_t Layer::doTransaction(uint32_t flags) { +uint32_t Layer::doTransaction(uint32_t flags) +{ ATRACE_CALL(); - const Layer::State& s(getDrawingState()); - const Layer::State& c(getCurrentState()); + const Layer::State& front(drawingState()); + const Layer::State& temp(currentState()); - const bool sizeChanged = (c.requested.w != s.requested.w) || - (c.requested.h != s.requested.h); + const bool sizeChanged = (temp.requested.w != front.requested.w) || + (temp.requested.h != front.requested.h); if (sizeChanged) { // the size changed, we need to ask our client to request a new buffer ALOGD_IF(DEBUG_RESIZE, - "doTransaction: geometry (layer=%p '%s'), tr=%02x, scalingMode=%d\n" + "doTransaction: geometry (layer=%p), scalingMode=%d\n" " current={ active ={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }\n" " requested={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }}\n" " drawing={ active ={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }\n" " requested={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }}\n", - this, getName().string(), mCurrentTransform, mCurrentScalingMode, - c.active.w, c.active.h, - c.active.crop.left, - c.active.crop.top, - c.active.crop.right, - c.active.crop.bottom, - c.active.crop.getWidth(), - c.active.crop.getHeight(), - c.requested.w, c.requested.h, - c.requested.crop.left, - c.requested.crop.top, - c.requested.crop.right, - c.requested.crop.bottom, - c.requested.crop.getWidth(), - c.requested.crop.getHeight(), - s.active.w, s.active.h, - s.active.crop.left, - s.active.crop.top, - s.active.crop.right, - s.active.crop.bottom, - s.active.crop.getWidth(), - s.active.crop.getHeight(), - s.requested.w, s.requested.h, - s.requested.crop.left, - s.requested.crop.top, - s.requested.crop.right, - s.requested.crop.bottom, - s.requested.crop.getWidth(), - s.requested.crop.getHeight()); + this, mCurrentScalingMode, + temp.active.w, temp.active.h, + temp.active.crop.left, + temp.active.crop.top, + temp.active.crop.right, + temp.active.crop.bottom, + temp.active.crop.getWidth(), + temp.active.crop.getHeight(), + temp.requested.w, temp.requested.h, + temp.requested.crop.left, + temp.requested.crop.top, + temp.requested.crop.right, + temp.requested.crop.bottom, + temp.requested.crop.getWidth(), + temp.requested.crop.getHeight(), + front.active.w, front.active.h, + front.active.crop.left, + front.active.crop.top, + front.active.crop.right, + front.active.crop.bottom, + front.active.crop.getWidth(), + front.active.crop.getHeight(), + front.requested.w, front.requested.h, + front.requested.crop.left, + front.requested.crop.top, + front.requested.crop.right, + front.requested.crop.bottom, + front.requested.crop.getWidth(), + front.requested.crop.getHeight()); // record the new size, form this point on, when the client request // a buffer, it'll get the new size. - mSurfaceFlingerConsumer->setDefaultBufferSize( - c.requested.w, c.requested.h); + mSurfaceTexture->setDefaultBufferSize( + temp.requested.w, temp.requested.h); } if (!isFixedSize()) { - const bool resizePending = (c.requested.w != c.active.w) || - (c.requested.h != c.active.h); + const bool resizePending = (temp.requested.w != temp.active.w) || + (temp.requested.h != temp.active.h); - if (resizePending && mSidebandStream == NULL) { - // don't let Layer::doTransaction update the drawing state + if (resizePending) { + // don't let LayerBase::doTransaction update the drawing state // if we have a pending resize, unless we are in fixed-size mode. // the drawing state will be updated only once we receive a buffer // with the correct size. @@ -963,225 +489,35 @@ // in particular, we want to make sure the clip (which is part // of the geometry state) is latched together with the size but is // latched immediately when no resizing is involved. - // - // If a sideband stream is attached, however, we want to skip this - // optimization so that transactions aren't missed when a buffer - // never arrives flags |= eDontUpdateGeometryState; } } - // always set active to requested, unless we're asked not to - // this is used by Layer, which special cases resizes. - if (flags & eDontUpdateGeometryState) { - } else { - Layer::State& editCurrentState(getCurrentState()); - editCurrentState.active = c.requested; - } - - if (s.active != c.active) { - // invalidate and recompute the visible regions if needed - flags |= Layer::eVisibleRegion; - } - - if (c.sequence != s.sequence) { - // invalidate and recompute the visible regions if needed - flags |= eVisibleRegion; - this->contentDirty = true; - - // we may use linear filtering, if the matrix scales us - const uint8_t type = c.transform.getType(); - mNeedsFiltering = (!c.transform.preserveRects() || - (type >= Transform::SCALE)); - } - - // Commit the transaction - commitTransaction(); - return flags; -} - -void Layer::commitTransaction() { - mDrawingState = mCurrentState; + return LayerBase::doTransaction(flags); } -uint32_t Layer::getTransactionFlags(uint32_t flags) { - return android_atomic_and(~flags, &mTransactionFlags) & flags; -} - -uint32_t Layer::setTransactionFlags(uint32_t flags) { - return android_atomic_or(flags, &mTransactionFlags); -} - -bool Layer::setPosition(float x, float y) { - if (mCurrentState.transform.tx() == x && mCurrentState.transform.ty() == y) - return false; - mCurrentState.sequence++; - mCurrentState.transform.set(x, y); - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setLayer(uint32_t z) { - if (mCurrentState.z == z) - return false; - mCurrentState.sequence++; - mCurrentState.z = z; - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setSize(uint32_t w, uint32_t h) { - if (mCurrentState.requested.w == w && mCurrentState.requested.h == h) - return false; - mCurrentState.requested.w = w; - mCurrentState.requested.h = h; - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setAlpha(uint8_t alpha) { - if (mCurrentState.alpha == alpha) - return false; - mCurrentState.sequence++; - mCurrentState.alpha = alpha; - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setMatrix(const layer_state_t::matrix22_t& matrix) { - mCurrentState.sequence++; - mCurrentState.transform.set( - matrix.dsdx, matrix.dsdy, matrix.dtdx, matrix.dtdy); - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setTransparentRegionHint(const Region& transparent) { - mCurrentState.requestedTransparentRegion = transparent; - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setFlags(uint8_t flags, uint8_t mask) { - const uint32_t newFlags = (mCurrentState.flags & ~mask) | (flags & mask); - if (mCurrentState.flags == newFlags) - return false; - mCurrentState.sequence++; - mCurrentState.flags = newFlags; - setTransactionFlags(eTransactionNeeded); - return true; -} -bool Layer::setCrop(const Rect& crop) { - if (mCurrentState.requested.crop == crop) - return false; - mCurrentState.sequence++; - mCurrentState.requested.crop = crop; - setTransactionFlags(eTransactionNeeded); - return true; -} - -bool Layer::setLayerStack(uint32_t layerStack) { - if (mCurrentState.layerStack == layerStack) - return false; - mCurrentState.sequence++; - mCurrentState.layerStack = layerStack; - setTransactionFlags(eTransactionNeeded); - return true; -} - -void Layer::useSurfaceDamage() { - if (mFlinger->mForceFullDamage) { - surfaceDamageRegion = Region::INVALID_REGION; - } else { - surfaceDamageRegion = mSurfaceFlingerConsumer->getSurfaceDamage(); - } +bool Layer::isFixedSize() const { + return mCurrentScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE; } -void Layer::useEmptyDamage() { - surfaceDamageRegion.clear(); +bool Layer::isCropped() const { + return !mCurrentCrop.isEmpty(); } // ---------------------------------------------------------------------------- // pageflip handling... // ---------------------------------------------------------------------------- -bool Layer::shouldPresentNow(const DispSync& dispSync) const { - if (mSidebandStreamChanged) { - return true; - } - - Mutex::Autolock lock(mQueueItemLock); - if (mQueueItems.empty()) { - return false; - } - auto timestamp = mQueueItems[0].mTimestamp; - nsecs_t expectedPresent = - mSurfaceFlingerConsumer->computeExpectedPresent(dispSync); - - // Ignore timestamps more than a second in the future - bool isPlausible = timestamp < (expectedPresent + s2ns(1)); - ALOGW_IF(!isPlausible, "[%s] Timestamp %" PRId64 " seems implausible " - "relative to expectedPresent %" PRId64, mName.string(), timestamp, - expectedPresent); - - bool isDue = timestamp < expectedPresent; - return isDue || !isPlausible; -} - bool Layer::onPreComposition() { mRefreshPending = false; - return mQueuedFrames > 0 || mSidebandStreamChanged; + return mQueuedFrames > 0; } -void Layer::onPostComposition() { - if (mFrameLatencyNeeded) { - nsecs_t desiredPresentTime = mSurfaceFlingerConsumer->getTimestamp(); - mFrameTracker.setDesiredPresentTime(desiredPresentTime); - - sp frameReadyFence = mSurfaceFlingerConsumer->getCurrentFence(); - if (frameReadyFence->isValid()) { - mFrameTracker.setFrameReadyFence(frameReadyFence); - } else { - // There was no fence for this frame, so assume that it was ready - // to be presented at the desired present time. - mFrameTracker.setFrameReadyTime(desiredPresentTime); - } - - const HWComposer& hwc = mFlinger->getHwComposer(); - sp presentFence = hwc.getDisplayFence(HWC_DISPLAY_PRIMARY); - if (presentFence->isValid()) { - mFrameTracker.setActualPresentFence(presentFence); - } else { - // The HWC doesn't support present fences, so use the refresh - // timestamp instead. - nsecs_t presentTime = hwc.getRefreshTimestamp(HWC_DISPLAY_PRIMARY); - mFrameTracker.setActualPresentTime(presentTime); - } - - mFrameTracker.advanceFrame(); - mFrameLatencyNeeded = false; - } -} - -bool Layer::isVisible() const { - const Layer::State& s(mDrawingState); - return !(s.flags & layer_state_t::eLayerHidden) && s.alpha - && (mActiveBuffer != NULL || mSidebandStream != NULL); -} - -Region Layer::latchBuffer(bool& recomputeVisibleRegions) +void Layer::lockPageFlip(bool& recomputeVisibleRegions) { ATRACE_CALL(); - if (android_atomic_acquire_cas(true, false, &mSidebandStreamChanged) == 0) { - // mSidebandStreamChanged was true - mSidebandStream = mSurfaceFlingerConsumer->getSidebandStream(); - if (mSidebandStream != NULL) { - setTransactionFlags(eTransactionNeeded); - mFlinger->setTransactionFlags(eTraversalNeeded); - } - recomputeVisibleRegions = true; - - const State& s(getDrawingState()); - return s.transform.transform(Region(Rect(s.active.w, s.active.h))); - } - - Region outDirtyRegion; if (mQueuedFrames > 0) { // if we've already called updateTexImage() without going through @@ -1190,28 +526,31 @@ // compositionComplete() call. // we'll trigger an update in onPreComposition(). if (mRefreshPending) { - return outDirtyRegion; + mPostedDirtyRegion.clear(); + return; } // Capture the old state of the layer for comparisons later - const State& s(getDrawingState()); - const bool oldOpacity = isOpaque(s); + const bool oldOpacity = isOpaque(); sp oldActiveBuffer = mActiveBuffer; - struct Reject : public SurfaceFlingerConsumer::BufferRejecter { + // signal another event if we have more frames pending + if (android_atomic_dec(&mQueuedFrames) > 1) { + mFlinger->signalLayerUpdate(); + } + + struct Reject : public SurfaceTexture::BufferRejecter { Layer::State& front; Layer::State& current; bool& recomputeVisibleRegions; - bool stickyTransformSet; Reject(Layer::State& front, Layer::State& current, - bool& recomputeVisibleRegions, bool stickySet) + bool& recomputeVisibleRegions) : front(front), current(current), - recomputeVisibleRegions(recomputeVisibleRegions), - stickyTransformSet(stickySet) { + recomputeVisibleRegions(recomputeVisibleRegions) { } virtual bool reject(const sp& buf, - const BufferItem& item) { + const BufferQueue::BufferItem& item) { if (buf == NULL) { return false; } @@ -1225,6 +564,7 @@ swap(bufWidth, bufHeight); } + bool isFixedSize = item.mScalingMode != NATIVE_WINDOW_SCALING_MODE_FREEZE; if (front.active != front.requested) { @@ -1250,10 +590,10 @@ } ALOGD_IF(DEBUG_RESIZE, - "latchBuffer/reject: buffer (%ux%u, tr=%02x), scalingMode=%d\n" + "lockPageFlip: (layer=%p), buffer (%ux%u, tr=%02x), scalingMode=%d\n" " drawing={ active ={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }\n" " requested={ wh={%4u,%4u} crop={%4d,%4d,%4d,%4d} (%4d,%4d) }}\n", - bufWidth, bufHeight, item.mTransform, item.mScalingMode, + this, bufWidth, bufHeight, item.mTransform, item.mScalingMode, front.active.w, front.active.h, front.active.crop.left, front.active.crop.top, @@ -1270,116 +610,31 @@ front.requested.crop.getHeight()); } - if (!isFixedSize && !stickyTransformSet) { + if (!isFixedSize) { if (front.active.w != bufWidth || front.active.h != bufHeight) { // reject this buffer - ALOGE("rejecting buffer: bufWidth=%d, bufHeight=%d, front.active.{w=%d, h=%d}", - bufWidth, bufHeight, front.active.w, front.active.h); return true; } } - - // if the transparent region has changed (this test is - // conservative, but that's fine, worst case we're doing - // a bit of extra work), we latch the new one and we - // trigger a visible-region recompute. - if (!front.activeTransparentRegion.isTriviallyEqual( - front.requestedTransparentRegion)) { - front.activeTransparentRegion = front.requestedTransparentRegion; - - // We also need to update the current state so that - // we don't end-up overwriting the drawing state with - // this stale current state during the next transaction - // - // NOTE: We don't need to hold the transaction lock here - // because State::active is only accessed from this thread. - current.activeTransparentRegion = front.activeTransparentRegion; - - // recompute visible region - recomputeVisibleRegions = true; - } - return false; } }; - Reject r(mDrawingState, getCurrentState(), recomputeVisibleRegions, - getProducerStickyTransform() != 0); - - uint64_t maxFrameNumber = 0; - { - Mutex::Autolock lock(mQueueItemLock); - maxFrameNumber = mLastFrameNumberReceived; - } - - status_t updateResult = mSurfaceFlingerConsumer->updateTexImage(&r, - mFlinger->mPrimaryDispSync, maxFrameNumber); - if (updateResult == BufferQueue::PRESENT_LATER) { - // Producer doesn't want buffer to be displayed yet. Signal a - // layer update so we check again at the next opportunity. - mFlinger->signalLayerUpdate(); - return outDirtyRegion; - } else if (updateResult == SurfaceFlingerConsumer::BUFFER_REJECTED) { - // If the buffer has been rejected, remove it from the shadow queue - // and return early - Mutex::Autolock lock(mQueueItemLock); - mQueueItems.removeAt(0); - android_atomic_dec(&mQueuedFrames); - return outDirtyRegion; - } else if (updateResult != NO_ERROR || mUpdateTexImageFailed) { - // This can occur if something goes wrong when trying to create the - // EGLImage for this buffer. If this happens, the buffer has already - // been released, so we need to clean up the queue and bug out - // early. - { - Mutex::Autolock lock(mQueueItemLock); - mQueueItems.clear(); - android_atomic_and(0, &mQueuedFrames); - } - - // Once we have hit this state, the shadow queue may no longer - // correctly reflect the incoming BufferQueue's contents, so even if - // updateTexImage starts working, the only safe course of action is - // to continue to ignore updates. - mUpdateTexImageFailed = true; - - return outDirtyRegion; - } - - { // Autolock scope - auto currentFrameNumber = mSurfaceFlingerConsumer->getFrameNumber(); - Mutex::Autolock lock(mQueueItemLock); + Reject r(mDrawingState, currentState(), recomputeVisibleRegions); - // Remove any stale buffers that have been dropped during - // updateTexImage - while (mQueueItems[0].mFrameNumber != currentFrameNumber) { - mQueueItems.removeAt(0); - android_atomic_dec(&mQueuedFrames); - } - - mQueueItems.removeAt(0); - } - - - // Decrement the queued-frames count. Signal another event if we - // have more frames pending. - if (android_atomic_dec(&mQueuedFrames) > 1) { - mFlinger->signalLayerUpdate(); - } - - if (updateResult != NO_ERROR) { + if (mSurfaceTexture->updateTexImage(&r) < NO_ERROR) { // something happened! recomputeVisibleRegions = true; - return outDirtyRegion; + return; } // update the active buffer - mActiveBuffer = mSurfaceFlingerConsumer->getCurrentBuffer(); + mActiveBuffer = mSurfaceTexture->getCurrentBuffer(); if (mActiveBuffer == NULL) { // this can only happen if the very first buffer was rejected. - return outDirtyRegion; + return; } mRefreshPending = true; @@ -1387,12 +642,12 @@ if (oldActiveBuffer == NULL) { // the first time we receive a buffer, we need to trigger a // geometry invalidation. - recomputeVisibleRegions = true; + mFlinger->invalidateHwcGeometry(); } - Rect crop(mSurfaceFlingerConsumer->getCurrentCrop()); - const uint32_t transform(mSurfaceFlingerConsumer->getCurrentTransform()); - const uint32_t scalingMode(mSurfaceFlingerConsumer->getCurrentScalingMode()); + Rect crop(mSurfaceTexture->getCurrentCrop()); + const uint32_t transform(mSurfaceTexture->getCurrentTransform()); + const uint32_t scalingMode(mSurfaceTexture->getCurrentScalingMode()); if ((crop != mCurrentCrop) || (transform != mCurrentTransform) || (scalingMode != mCurrentScalingMode)) @@ -1400,7 +655,7 @@ mCurrentCrop = crop; mCurrentTransform = transform; mCurrentScalingMode = scalingMode; - recomputeVisibleRegions = true; + mFlinger->invalidateHwcGeometry(); } if (oldActiveBuffer != NULL) { @@ -1408,85 +663,52 @@ uint32_t bufHeight = mActiveBuffer->getHeight(); if (bufWidth != uint32_t(oldActiveBuffer->width) || bufHeight != uint32_t(oldActiveBuffer->height)) { - recomputeVisibleRegions = true; + mFlinger->invalidateHwcGeometry(); } } mCurrentOpacity = getOpacityForFormat(mActiveBuffer->format); - if (oldOpacity != isOpaque(s)) { + if (oldOpacity != isOpaque()) { recomputeVisibleRegions = true; } - // FIXME: postedRegion should be dirty & bounds - Region dirtyRegion(Rect(s.active.w, s.active.h)); + // FIXME: mPostedDirtyRegion = dirty & bounds + const Layer::State& front(drawingState()); + mPostedDirtyRegion.set(front.active.w, front.active.h); - // transform the dirty region to window-manager space - outDirtyRegion = (s.transform.transform(dirtyRegion)); + glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterx(GL_TEXTURE_EXTERNAL_OES, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); } - return outDirtyRegion; } -uint32_t Layer::getEffectiveUsage(uint32_t usage) const +void Layer::unlockPageFlip( + const Transform& planeTransform, Region& outDirtyRegion) { - // TODO: should we do something special if mSecure is set? - if (mProtectedByApp) { - // need a hardware-protected path to external video sink - usage |= GraphicBuffer::USAGE_PROTECTED; - } - if (mPotentialCursor) { - usage |= GraphicBuffer::USAGE_CURSOR; - } - usage |= GraphicBuffer::USAGE_HW_COMPOSER; - return usage; -} + ATRACE_CALL(); -void Layer::updateTransformHint(const sp& hw) const { - uint32_t orientation = 0; - if (!mFlinger->mDebugDisableTransformHint) { - // The transform hint is used to improve performance, but we can - // only have a single transform hint, it cannot - // apply to all displays. - const Transform& planeTransform(hw->getTransform()); - orientation = planeTransform.getOrientation(); - if (orientation & Transform::ROT_INVALID) { - orientation = 0; + Region postedRegion(mPostedDirtyRegion); + if (!postedRegion.isEmpty()) { + mPostedDirtyRegion.clear(); + if (!visibleRegionScreen.isEmpty()) { + // The dirty region is given in the layer's coordinate space + // transform the dirty region by the surface's transformation + // and the global transformation. + const Layer::State& s(drawingState()); + const Transform tr(planeTransform * s.transform); + postedRegion = tr.transform(postedRegion); + + // At this point, the dirty region is in screen space. + // Make sure it's constrained by the visible region (which + // is in screen space as well). + postedRegion.andSelf(visibleRegionScreen); + outDirtyRegion.orSelf(postedRegion); } } - mSurfaceFlingerConsumer->setTransformHint(orientation); } -// ---------------------------------------------------------------------------- -// debugging -// ---------------------------------------------------------------------------- - -void Layer::dump(String8& result, Colorizer& colorizer) const +void Layer::dump(String8& result, char* buffer, size_t SIZE) const { - const Layer::State& s(getDrawingState()); - - colorizer.colorize(result, Colorizer::GREEN); - result.appendFormat( - "+ %s %p (%s)\n", - getTypeId(), this, getName().string()); - colorizer.reset(result); - - s.activeTransparentRegion.dump(result, "transparentRegion"); - visibleRegion.dump(result, "visibleRegion"); - surfaceDamageRegion.dump(result, "surfaceDamageRegion"); - sp client(mClientRef.promote()); - - result.appendFormat( " " - "layerStack=%4d, z=%9d, pos=(%g,%g), size=(%4d,%4d), crop=(%4d,%4d,%4d,%4d), " - "isOpaque=%1d, invalidate=%1d, " - "alpha=0x%02x, flags=0x%08x, tr=[%.2f, %.2f][%.2f, %.2f]\n" - " client=%p\n", - s.layerStack, s.z, s.transform.tx(), s.transform.ty(), s.active.w, s.active.h, - s.active.crop.left, s.active.crop.top, - s.active.crop.right, s.active.crop.bottom, - isOpaque(s), contentDirty, - s.alpha, s.flags, - s.transform[0][0], s.transform[0][1], - s.transform[1][0], s.transform[1][1], - client.get()); + LayerBaseClient::dump(result, buffer, SIZE); sp buf0(mActiveBuffer); uint32_t w0=0, h0=0, s0=0, f0=0; @@ -1496,53 +718,69 @@ s0 = buf0->getStride(); f0 = buf0->format; } - result.appendFormat( + snprintf(buffer, SIZE, " " "format=%2d, activeBuffer=[%4ux%4u:%4u,%3X]," - " queued-frames=%d, mRefreshPending=%d\n", + " transform-hint=0x%02x, queued-frames=%d, mRefreshPending=%d\n", mFormat, w0, h0, s0,f0, - mQueuedFrames, mRefreshPending); + getTransformHint(), mQueuedFrames, mRefreshPending); + + result.append(buffer); - if (mSurfaceFlingerConsumer != 0) { - mSurfaceFlingerConsumer->dump(result, " "); + if (mSurfaceTexture != 0) { + mSurfaceTexture->dump(result, " ", buffer, SIZE); } } -void Layer::dumpFrameStats(String8& result) const { - mFrameTracker.dumpStats(result); +void Layer::dumpStats(String8& result, char* buffer, size_t SIZE) const +{ + LayerBaseClient::dumpStats(result, buffer, SIZE); + const size_t o = mFrameLatencyOffset; + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const nsecs_t period = hw.getRefreshPeriod(); + result.appendFormat("%lld\n", period); + for (size_t i=0 ; i<128 ; i++) { + const size_t index = (o+i) % 128; + const nsecs_t time_app = mFrameStats[index].timestamp; + const nsecs_t time_set = mFrameStats[index].set; + const nsecs_t time_vsync = mFrameStats[index].vsync; + result.appendFormat("%lld\t%lld\t%lld\n", + time_app, + time_vsync, + time_set); + } + result.append("\n"); } -void Layer::clearFrameStats() { - mFrameTracker.clearStats(); +void Layer::clearStats() +{ + LayerBaseClient::clearStats(); + memset(mFrameStats, 0, sizeof(mFrameStats)); } -void Layer::logFrameStats() { - mFrameTracker.logAndResetStats(mName); +uint32_t Layer::getEffectiveUsage(uint32_t usage) const +{ + // TODO: should we do something special if mSecure is set? + if (mProtectedByApp) { + // need a hardware-protected path to external video sink + usage |= GraphicBuffer::USAGE_PROTECTED; + } + usage |= GraphicBuffer::USAGE_HW_COMPOSER; + return usage; } -void Layer::getFrameStats(FrameStats* outStats) const { - mFrameTracker.getStats(outStats); +uint32_t Layer::getTransformHint() const { + uint32_t orientation = 0; + if (!mFlinger->mDebugDisableTransformHint) { + orientation = getPlaneOrientation(); + if (orientation & Transform::ROT_INVALID) { + orientation = 0; + } + } + return orientation; } // --------------------------------------------------------------------------- -Layer::LayerCleaner::LayerCleaner(const sp& flinger, - const sp& layer) - : mFlinger(flinger), mLayer(layer) { -} - -Layer::LayerCleaner::~LayerCleaner() { - // destroy client resources - mFlinger->onLayerDestroyed(mLayer); -} -// --------------------------------------------------------------------------- }; // namespace android - -#if defined(__gl_h_) -#error "don't include gl/gl.h in this file" -#endif - -#if defined(__gl2_h_) -#error "don't include gl2/gl2.h in this file" -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerDim.cpp android-platform-frameworks-native-21/services/surfaceflinger/LayerDim.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerDim.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/LayerDim.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -25,39 +25,47 @@ #include "LayerDim.h" #include "SurfaceFlinger.h" -#include "DisplayDevice.h" -#include "RenderEngine/RenderEngine.h" +#include "DisplayHardware/DisplayHardware.h" namespace android { // --------------------------------------------------------------------------- -LayerDim::LayerDim(SurfaceFlinger* flinger, const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags) - : Layer(flinger, client, name, w, h, flags) { +LayerDim::LayerDim(SurfaceFlinger* flinger, DisplayID display, + const sp& client) + : LayerBaseClient(flinger, display, client) +{ } -LayerDim::~LayerDim() { +LayerDim::~LayerDim() +{ } -void LayerDim::onDraw(const sp& hw, - const Region& /* clip */, bool useIdentityTransform) const +void LayerDim::onDraw(const Region& clip) const { - const State& s(getDrawingState()); + const State& s(drawingState()); if (s.alpha>0) { - Mesh mesh(Mesh::TRIANGLE_FAN, 4, 2); - computeGeometry(hw, mesh, useIdentityTransform); - RenderEngine& engine(mFlinger->getRenderEngine()); - engine.setupDimLayerBlending(s.alpha); - engine.drawMesh(mesh); - engine.disableBlending(); - } -} + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const GLfloat alpha = s.alpha/255.0f; + const uint32_t fbHeight = hw.getHeight(); + glDisable(GL_TEXTURE_EXTERNAL_OES); + glDisable(GL_TEXTURE_2D); + + if (s.alpha == 0xFF) { + glDisable(GL_BLEND); + } else { + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); + } -bool LayerDim::isVisible() const { - const Layer::State& s(getDrawingState()); - return !(s.flags & layer_state_t::eLayerHidden) && s.alpha; -} + glColor4f(0, 0, 0, alpha); + + glVertexPointer(2, GL_FLOAT, 0, mVertices); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + glDisable(GL_BLEND); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } +} // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerDim.h android-platform-frameworks-native-21/services/surfaceflinger/LayerDim.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerDim.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/LayerDim.h 2012-10-16 22:57:11.000000000 +0000 @@ -20,26 +20,28 @@ #include #include -#include "Layer.h" +#include +#include + +#include "LayerBase.h" // --------------------------------------------------------------------------- namespace android { -class LayerDim : public Layer +class LayerDim : public LayerBaseClient { -public: - LayerDim(SurfaceFlinger* flinger, const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags); +public: + LayerDim(SurfaceFlinger* flinger, DisplayID display, + const sp& client); virtual ~LayerDim(); - virtual const char* getTypeId() const { return "LayerDim"; } - virtual void onDraw(const sp& hw, const Region& clip, - bool useIdentityTransform) const; - virtual bool isOpaque(const Layer::State&) const { return false; } + virtual void onDraw(const Region& clip) const; + virtual bool isOpaque() const { return false; } virtual bool isSecure() const { return false; } - virtual bool isFixedSize() const { return true; } - virtual bool isVisible() const; + virtual bool isProtectedByApp() const { return false; } + virtual bool isProtectedByDRM() const { return false; } + virtual const char* getTypeId() const { return "LayerDim"; } }; // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Layer.h android-platform-frameworks-native-21/services/surfaceflinger/Layer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Layer.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Layer.h 2012-10-16 22:57:11.000000000 +0000 @@ -20,405 +20,129 @@ #include #include -#include -#include +#include -#include -#include #include -#include #include #include -#include #include -#include +#include +#include +#include +#include -#include "FrameTracker.h" -#include "Client.h" -#include "MonitoredProducer.h" -#include "SurfaceFlinger.h" -#include "SurfaceFlingerConsumer.h" +#include "LayerBase.h" +#include "SurfaceTextureLayer.h" #include "Transform.h" -#include "DisplayHardware/HWComposer.h" -#include "DisplayHardware/FloatRect.h" -#include "RenderEngine/Mesh.h" -#include "RenderEngine/Texture.h" - namespace android { // --------------------------------------------------------------------------- class Client; -class Colorizer; -class DisplayDevice; -class GraphicBuffer; -class SurfaceFlinger; +class GLExtensions; // --------------------------------------------------------------------------- -/* - * A new BufferQueue and a new SurfaceFlingerConsumer are created when the - * Layer is first referenced. - * - * This also implements onFrameAvailable(), which notifies SurfaceFlinger - * that new data has arrived. - */ -class Layer : public SurfaceFlingerConsumer::ContentsChangedListener { - static int32_t sSequence; - +class Layer : public LayerBaseClient +{ public: - mutable bool contentDirty; - // regions below are in window-manager space - Region visibleRegion; - Region coveredRegion; - Region visibleNonTransparentRegion; - Region surfaceDamageRegion; - - // Layer serial number. This gives layers an explicit ordering, so we - // have a stable sort order when their layer stack and Z-order are - // the same. - int32_t sequence; - - enum { // flags for doTransaction() - eDontUpdateGeometryState = 0x00000001, - eVisibleRegion = 0x00000002, - }; - - struct Geometry { - uint32_t w; - uint32_t h; - Rect crop; - inline bool operator ==(const Geometry& rhs) const { - return (w == rhs.w && h == rhs.h && crop == rhs.crop); - } - inline bool operator !=(const Geometry& rhs) const { - return !operator ==(rhs); - } - }; - - struct State { - Geometry active; - Geometry requested; - uint32_t z; - uint32_t layerStack; - uint8_t alpha; - uint8_t flags; - uint8_t reserved[2]; - int32_t sequence; // changes when visible regions can change - Transform transform; - // the transparentRegion hint is a bit special, it's latched only - // when we receive a buffer -- this is because it's "content" - // dependent. - Region activeTransparentRegion; - Region requestedTransparentRegion; - }; - - // ----------------------------------------------------------------------- - - Layer(SurfaceFlinger* flinger, const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags); + Layer(SurfaceFlinger* flinger, DisplayID display, + const sp& client); virtual ~Layer(); - // the this layer's size and format - status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags); - - // modify current state - bool setPosition(float x, float y); - bool setLayer(uint32_t z); - bool setSize(uint32_t w, uint32_t h); - bool setAlpha(uint8_t alpha); - bool setMatrix(const layer_state_t::matrix22_t& matrix); - bool setTransparentRegionHint(const Region& transparent); - bool setFlags(uint8_t flags, uint8_t mask); - bool setCrop(const Rect& crop); - bool setLayerStack(uint32_t layerStack); - - // If we have received a new buffer this frame, we will pass its surface - // damage down to hardware composer. Otherwise, we must send a region with - // one empty rect. - void useSurfaceDamage(); - void useEmptyDamage(); - - uint32_t getTransactionFlags(uint32_t flags); - uint32_t setTransactionFlags(uint32_t flags); - - void computeGeometry(const sp& hw, Mesh& mesh, - bool useIdentityTransform) const; - Rect computeBounds(const Region& activeTransparentRegion) const; - Rect computeBounds() const; - - sp getHandle(); - sp getProducer() const; - const String8& getName() const; - - // ----------------------------------------------------------------------- - // Virtuals - virtual const char* getTypeId() const { return "Layer"; } - /* - * isOpaque - true if this surface is opaque - * - * This takes into account the buffer format (i.e. whether or not the - * pixel format includes an alpha channel) and the "opaque" flag set - * on the layer. It does not examine the current plane alpha value. - */ - virtual bool isOpaque(const Layer::State& s) const; - - /* - * isSecure - true if this surface is secure, that is if it prevents - * screenshots or VNC servers. - */ - virtual bool isSecure() const; - - /* - * isProtected - true if the layer may contain protected content in the - * GRALLOC_USAGE_PROTECTED sense. - */ - virtual bool isProtected() const; - - /* - * isVisible - true if this layer is visible, false otherwise - */ - virtual bool isVisible() const; - - /* - * isFixedSize - true if content has a fixed size - */ - virtual bool isFixedSize() const; - -protected: - /* - * onDraw - draws the surface. - */ - virtual void onDraw(const sp& hw, const Region& clip, - bool useIdentityTransform) const; + // the this layer's size and format + status_t setBuffers(uint32_t w, uint32_t h, + PixelFormat format, uint32_t flags=0); -public: - // ----------------------------------------------------------------------- + bool isFixedSize() const; - void setGeometry(const sp& hw, - HWComposer::HWCLayerInterface& layer); - void setPerFrameData(const sp& hw, - HWComposer::HWCLayerInterface& layer); - void setAcquireFence(const sp& hw, - HWComposer::HWCLayerInterface& layer); - - Rect getPosition(const sp& hw); - - /* - * called after page-flip - */ - void onLayerDisplayed(const sp& hw, - HWComposer::HWCLayerInterface* layer); - - bool shouldPresentNow(const DispSync& dispSync) const; - - /* - * called before composition. - * returns true if the layer has pending updates. - */ - bool onPreComposition(); - - /* - * called after composition. - */ - void onPostComposition(); - - /* - * draw - performs some global clipping optimizations - * and calls onDraw(). - */ - void draw(const sp& hw, const Region& clip) const; - void draw(const sp& hw, bool useIdentityTransform) const; - void draw(const sp& hw) const; - - /* - * doTransaction - process the transaction. This is a good place to figure - * out which attributes of the surface have changed. - */ - uint32_t doTransaction(uint32_t transactionFlags); - - /* - * setVisibleRegion - called to set the new visible region. This gives - * a chance to update the new visible region or record the fact it changed. - */ - void setVisibleRegion(const Region& visibleRegion); - - /* - * setCoveredRegion - called when the covered region changes. The covered - * region corresponds to any area of the surface that is covered - * (transparently or not) by another surface. - */ - void setCoveredRegion(const Region& coveredRegion); - - /* - * setVisibleNonTransparentRegion - called when the visible and - * non-transparent region changes. - */ - void setVisibleNonTransparentRegion(const Region& - visibleNonTransparentRegion); - - /* - * latchBuffer - called each time the screen is redrawn and returns whether - * the visible regions need to be recomputed (this is a fairly heavy - * operation, so this should be set only if needed). Typically this is used - * to figure out if the content or size of a surface has changed. - */ - Region latchBuffer(bool& recomputeVisibleRegions); - - bool isPotentialCursor() const { return mPotentialCursor;} - - /* - * called with the state lock when the surface is removed from the - * current list - */ - void onRemoved(); - - - // Updates the transform hint in our SurfaceFlingerConsumer to match - // the current orientation of the display device. - void updateTransformHint(const sp& hw) const; - - /* - * returns the rectangle that crops the content of the layer and scales it - * to the layer's size. - */ - Rect getContentCrop() const; - - /* - * Returns if a frame is queued. - */ - bool hasQueuedFrame() const { return mQueuedFrames > 0 || mSidebandStreamChanged; } + // LayerBase interface + virtual void setGeometry(hwc_layer_t* hwcl); + virtual void setPerFrameData(hwc_layer_t* hwcl); + virtual void onDraw(const Region& clip) const; + virtual uint32_t doTransaction(uint32_t transactionFlags); + virtual void lockPageFlip(bool& recomputeVisibleRegions); + virtual void unlockPageFlip(const Transform& planeTransform, Region& outDirtyRegion); + virtual bool isOpaque() const; + virtual bool needsDithering() const { return mNeedsDithering; } + virtual bool isSecure() const { return mSecure; } + virtual bool isProtected() const; + virtual void onRemoved(); + virtual sp getLayer() const { return const_cast(this); } + virtual void setName(const String8& name); + virtual void validateVisibility(const Transform& globalTransform); - // ----------------------------------------------------------------------- + // LayerBaseClient interface + virtual wp getSurfaceTextureBinder() const; - void clearWithOpenGL(const sp& hw, const Region& clip) const; - void setFiltering(bool filtering); - bool getFiltering() const; + virtual void onLayerDisplayed(); + virtual bool onPreComposition(); // only for debugging inline const sp& getActiveBuffer() const { return mActiveBuffer; } - inline const State& getDrawingState() const { return mDrawingState; } - inline const State& getCurrentState() const { return mCurrentState; } - inline State& getCurrentState() { return mCurrentState; } - - - /* always call base class first */ - void dump(String8& result, Colorizer& colorizer) const; - void dumpFrameStats(String8& result) const; - void clearFrameStats(); - void logFrameStats(); - void getFrameStats(FrameStats* outStats) const; - protected: - // constant - sp mFlinger; - virtual void onFirstRef(); - - /* - * Trivial class, used to ensure that mFlinger->onLayerDestroyed(mLayer) - * is called. - */ - class LayerCleaner { - sp mFlinger; - wp mLayer; - protected: - ~LayerCleaner(); - public: - LayerCleaner(const sp& flinger, const sp& layer); - }; - + virtual void dump(String8& result, char* scratch, size_t size) const; + virtual void dumpStats(String8& result, char* buffer, size_t SIZE) const; + virtual void clearStats(); private: - // Interface implementation for SurfaceFlingerConsumer::ContentsChangedListener - virtual void onFrameAvailable(const BufferItem& item) override; - virtual void onFrameReplaced(const BufferItem& item) override; - virtual void onSidebandStreamChanged() override; - - void commitTransaction(); - - // needsLinearFiltering - true if this surface's state requires filtering - bool needsFiltering(const sp& hw) const; - + friend class SurfaceTextureLayer; + void onFrameQueued(); + virtual sp createSurface(); uint32_t getEffectiveUsage(uint32_t usage) const; - FloatRect computeCrop(const sp& hw) const; + uint32_t getTransformHint() const; bool isCropped() const; + Rect computeBufferCrop() const; static bool getOpacityForFormat(uint32_t format); - // drawing - void clearWithOpenGL(const sp& hw, const Region& clip, - float r, float g, float b, float alpha) const; - void drawWithOpenGL(const sp& hw, const Region& clip, - bool useIdentityTransform) const; - - // Temporary - Used only for LEGACY camera mode. - uint32_t getProducerStickyTransform() const; - - // ----------------------------------------------------------------------- // constants - sp mSurfaceFlingerConsumer; - sp mProducer; - uint32_t mTextureName; // from GLES - bool mPremultipliedAlpha; - String8 mName; - PixelFormat mFormat; - - // these are protected by an external lock - State mCurrentState; - State mDrawingState; - volatile int32_t mTransactionFlags; + sp mSurfaceTexture; + GLuint mTextureName; // thread-safe volatile int32_t mQueuedFrames; - volatile int32_t mSidebandStreamChanged; // used like an atomic boolean - FrameTracker mFrameTracker; // main thread sp mActiveBuffer; - sp mSidebandStream; Rect mCurrentCrop; uint32_t mCurrentTransform; uint32_t mCurrentScalingMode; bool mCurrentOpacity; bool mRefreshPending; bool mFrameLatencyNeeded; - // Whether filtering is forced on or not - bool mFiltering; - // Whether filtering is needed b/c of the drawingstate - bool mNeedsFiltering; - // The mesh used to draw the layer in GLES composition mode - mutable Mesh mMesh; - // The texture used to draw the layer in GLES composition mode - mutable Texture mTexture; + int mFrameLatencyOffset; - // page-flip thread (currently main thread) - bool mProtectedByApp; // application requires protected path to external sink + struct Statistics { + Statistics() : timestamp(0), set(0), vsync(0) { } + nsecs_t timestamp; // buffer timestamp + nsecs_t set; // buffer displayed timestamp + nsecs_t vsync; // vsync immediately before set + }; // protected by mLock - mutable Mutex mLock; - // Set to true once we've returned this surface's handle - mutable bool mHasSurface; - const wp mClientRef; - - // This layer can be a cursor on some displays. - bool mPotentialCursor; - - // Local copy of the queued contents of the incoming BufferQueue - mutable Mutex mQueueItemLock; - Condition mQueueItemCondition; - Vector mQueueItems; - uint64_t mLastFrameNumberReceived; - bool mUpdateTexImageFailed; // This is only modified from the main thread + Statistics mFrameStats[128]; + + // constants + PixelFormat mFormat; + const GLExtensions& mGLExtensions; + bool mOpaqueLayer; + bool mNeedsDithering; + + // page-flip thread (currently main thread) + bool mSecure; // no screenshots + bool mProtectedByApp; // application requires protected path to external sink + Region mPostedDirtyRegion; }; // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerScreenshot.cpp android-platform-frameworks-native-21/services/surfaceflinger/LayerScreenshot.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerScreenshot.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/LayerScreenshot.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,148 @@ +/* + * 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 +#include +#include + +#include +#include + +#include + +#include "LayerScreenshot.h" +#include "SurfaceFlinger.h" +#include "DisplayHardware/DisplayHardware.h" + + +namespace android { +// --------------------------------------------------------------------------- + +LayerScreenshot::LayerScreenshot(SurfaceFlinger* flinger, DisplayID display, + const sp& client) + : LayerBaseClient(flinger, display, client), + mTextureName(0), mFlinger(flinger) +{ +} + +LayerScreenshot::~LayerScreenshot() +{ + if (mTextureName) { + mFlinger->postMessageAsync( + new SurfaceFlinger::MessageDestroyGLTexture(mTextureName) ); + } +} + +status_t LayerScreenshot::captureLocked() { + GLfloat u, v; + status_t result = mFlinger->renderScreenToTextureLocked(0, &mTextureName, &u, &v); + if (result != NO_ERROR) { + return result; + } + initTexture(u, v); + return NO_ERROR; +} + +status_t LayerScreenshot::capture() { + GLfloat u, v; + status_t result = mFlinger->renderScreenToTexture(0, &mTextureName, &u, &v); + if (result != NO_ERROR) { + return result; + } + initTexture(u, v); + return NO_ERROR; +} + +void LayerScreenshot::initTexture(GLfloat u, GLfloat v) { + glBindTexture(GL_TEXTURE_2D, mTextureName); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + mTexCoords[0] = 0; mTexCoords[1] = v; + mTexCoords[2] = 0; mTexCoords[3] = 0; + mTexCoords[4] = u; mTexCoords[5] = 0; + mTexCoords[6] = u; mTexCoords[7] = v; +} + +void LayerScreenshot::initStates(uint32_t w, uint32_t h, uint32_t flags) { + LayerBaseClient::initStates(w, h, flags); + if (!(flags & ISurfaceComposer::eHidden)) { + capture(); + } +} + +uint32_t LayerScreenshot::doTransaction(uint32_t flags) +{ + const Layer::State& draw(drawingState()); + const Layer::State& curr(currentState()); + + if (draw.flags & ISurfaceComposer::eLayerHidden) { + if (!(curr.flags & ISurfaceComposer::eLayerHidden)) { + // we're going from hidden to visible + status_t err = captureLocked(); + if (err != NO_ERROR) { + ALOGW("createScreenshotSurface failed (%s)", strerror(-err)); + } + } + } else if (curr.flags & ISurfaceComposer::eLayerHidden) { + // we're going from visible to hidden + if (mTextureName) { + glDeleteTextures(1, &mTextureName); + mTextureName = 0; + } + } + return LayerBaseClient::doTransaction(flags); +} + +void LayerScreenshot::onDraw(const Region& clip) const +{ + const State& s(drawingState()); + if (s.alpha>0) { + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const GLfloat alpha = s.alpha/255.0f; + const uint32_t fbHeight = hw.getHeight(); + + if (s.alpha == 0xFF) { + glDisable(GL_BLEND); + } else { + glEnable(GL_BLEND); + glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); + } + + glColor4f(0, 0, 0, alpha); + + glDisable(GL_TEXTURE_EXTERNAL_OES); + glEnable(GL_TEXTURE_2D); + + glBindTexture(GL_TEXTURE_2D, mTextureName); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glTexCoordPointer(2, GL_FLOAT, 0, mTexCoords); + glVertexPointer(2, GL_FLOAT, 0, mVertices); + glDrawArrays(GL_TRIANGLE_FAN, 0, mNumVertices); + + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + } +} + +// --------------------------------------------------------------------------- + +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerScreenshot.h android-platform-frameworks-native-21/services/surfaceflinger/LayerScreenshot.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/LayerScreenshot.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/LayerScreenshot.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,62 @@ +/* + * 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. + */ + +#ifndef ANDROID_LAYER_SCREENSHOT_H +#define ANDROID_LAYER_SCREENSHOT_H + +#include +#include + +#include +#include + +#include "LayerBase.h" + +// --------------------------------------------------------------------------- + +namespace android { + +class LayerScreenshot : public LayerBaseClient +{ + GLuint mTextureName; + GLfloat mTexCoords[8]; + sp mFlinger; +public: + LayerScreenshot(SurfaceFlinger* flinger, DisplayID display, + const sp& client); + virtual ~LayerScreenshot(); + + status_t capture(); + + virtual void initStates(uint32_t w, uint32_t h, uint32_t flags); + virtual uint32_t doTransaction(uint32_t flags); + virtual void onDraw(const Region& clip) const; + virtual bool isOpaque() const { return false; } + virtual bool isSecure() const { return false; } + virtual bool isProtectedByApp() const { return false; } + virtual bool isProtectedByDRM() const { return false; } + virtual const char* getTypeId() const { return "LayerScreenshot"; } + +private: + status_t captureLocked(); + void initTexture(GLfloat u, GLfloat v); +}; + +// --------------------------------------------------------------------------- + +}; // namespace android + +#endif // ANDROID_LAYER_SCREENSHOT_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/main_surfaceflinger.cpp android-platform-frameworks-native-21/services/surfaceflinger/main_surfaceflinger.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/main_surfaceflinger.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/main_surfaceflinger.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,55 +0,0 @@ -/* - * Copyright (C) 2010 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 - -#include -#include -#include -#include -#include -#include "SurfaceFlinger.h" - -using namespace android; - -int main(int, char**) { - // When SF is launched in its own process, limit the number of - // binder threads to 4. - ProcessState::self()->setThreadPoolMaxThreadCount(4); - - // start the thread pool - sp ps(ProcessState::self()); - ps->startThreadPool(); - - // instantiate surfaceflinger - sp flinger = new SurfaceFlinger(); - - setpriority(PRIO_PROCESS, 0, PRIORITY_URGENT_DISPLAY); - - set_sched_policy(0, SP_FOREGROUND); - - // initialize before clients can connect - flinger->init(); - - // publish surface flinger - sp sm(defaultServiceManager()); - sm->addService(String16(SurfaceFlinger::getServiceName()), flinger, false); - - // run in this thread - flinger->run(); - - return 0; -} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MessageQueue.cpp android-platform-frameworks-native-21/services/surfaceflinger/MessageQueue.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MessageQueue.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/MessageQueue.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -49,24 +49,18 @@ // --------------------------------------------------------------------------- -void MessageQueue::Handler::dispatchRefresh() { +void MessageQueue::Handler::signalRefresh() { if ((android_atomic_or(eventMaskRefresh, &mEventMask) & eventMaskRefresh) == 0) { mQueue.mLooper->sendMessage(this, Message(MessageQueue::REFRESH)); } } -void MessageQueue::Handler::dispatchInvalidate() { +void MessageQueue::Handler::signalInvalidate() { if ((android_atomic_or(eventMaskInvalidate, &mEventMask) & eventMaskInvalidate) == 0) { mQueue.mLooper->sendMessage(this, Message(MessageQueue::INVALIDATE)); } } -void MessageQueue::Handler::dispatchTransaction() { - if ((android_atomic_or(eventMaskTransaction, &mEventMask) & eventMaskTransaction) == 0) { - mQueue.mLooper->sendMessage(this, Message(MessageQueue::TRANSACTION)); - } -} - void MessageQueue::Handler::handleMessage(const Message& message) { switch (message.what) { case INVALIDATE: @@ -77,10 +71,6 @@ android_atomic_and(~eventMaskRefresh, &mEventMask); mQueue.mFlinger->onMessageReceived(message.what); break; - case TRANSACTION: - android_atomic_and(~eventMaskTransaction, &mEventMask); - mQueue.mFlinger->onMessageReceived(message.what); - break; } } @@ -105,7 +95,7 @@ mEventThread = eventThread; mEvents = eventThread->createEventConnection(); mEventTube = mEvents->getDataChannel(); - mLooper->addFd(mEventTube->getFd(), 0, Looper::EVENT_INPUT, + mLooper->addFd(mEventTube->getFd(), 0, ALOOPER_EVENT_INPUT, MessageQueue::cb_eventReceiver, this); } @@ -114,12 +104,12 @@ IPCThreadState::self()->flushCommands(); int32_t ret = mLooper->pollOnce(-1); switch (ret) { - case Looper::POLL_WAKE: - case Looper::POLL_CALLBACK: + case ALOOPER_POLL_WAKE: + case ALOOPER_POLL_CALLBACK: continue; - case Looper::POLL_ERROR: - ALOGE("Looper::POLL_ERROR"); - case Looper::POLL_TIMEOUT: + case ALOOPER_POLL_ERROR: + ALOGE("ALOOPER_POLL_ERROR"); + case ALOOPER_POLL_TIMEOUT: // timeout (should not happen) continue; default: @@ -142,36 +132,13 @@ return NO_ERROR; } - -/* when INVALIDATE_ON_VSYNC is set SF only processes - * buffer updates on VSYNC and performs a refresh immediately - * after. - * - * when INVALIDATE_ON_VSYNC is set to false, SF will instead - * perform the buffer updates immediately, but the refresh only - * at the next VSYNC. - * THIS MODE IS BUGGY ON GALAXY NEXUS AND WILL CAUSE HANGS - */ -#define INVALIDATE_ON_VSYNC 1 - -void MessageQueue::invalidateTransactionNow() { - mHandler->dispatchTransaction(); -} - void MessageQueue::invalidate() { -#if INVALIDATE_ON_VSYNC +// mHandler->signalInvalidate(); mEvents->requestNextVsync(); -#else - mHandler->dispatchInvalidate(); -#endif } void MessageQueue::refresh() { -#if INVALIDATE_ON_VSYNC - mHandler->dispatchRefresh(); -#else mEvents->requestNextVsync(); -#endif } int MessageQueue::cb_eventReceiver(int fd, int events, void* data) { @@ -179,17 +146,13 @@ return queue->eventReceiver(fd, events); } -int MessageQueue::eventReceiver(int /*fd*/, int /*events*/) { +int MessageQueue::eventReceiver(int fd, int events) { ssize_t n; DisplayEventReceiver::Event buffer[8]; while ((n = DisplayEventReceiver::getEvents(mEventTube, buffer, 8)) > 0) { for (int i=0 ; idispatchInvalidate(); -#else - mHandler->dispatchRefresh(); -#endif + mHandler->signalRefresh(); break; } } diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MessageQueue.h android-platform-frameworks-native-21/services/surfaceflinger/MessageQueue.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MessageQueue.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/MessageQueue.h 2012-10-16 22:57:11.000000000 +0000 @@ -62,18 +62,16 @@ class MessageQueue { class Handler : public MessageHandler { enum { - eventMaskInvalidate = 0x1, - eventMaskRefresh = 0x2, - eventMaskTransaction = 0x4 + eventMaskInvalidate = 0x1, + eventMaskRefresh = 0x2 }; MessageQueue& mQueue; int32_t mEventMask; public: Handler(MessageQueue& queue) : mQueue(queue), mEventMask(0) { } virtual void handleMessage(const Message& message); - void dispatchRefresh(); - void dispatchInvalidate(); - void dispatchTransaction(); + void signalRefresh(); + void signalInvalidate(); }; friend class Handler; @@ -91,9 +89,8 @@ public: enum { - INVALIDATE = 0, - REFRESH = 1, - TRANSACTION = 2 + INVALIDATE = 0, + REFRESH = 1, }; MessageQueue(); @@ -103,13 +100,8 @@ void waitMessage(); status_t postMessage(const sp& message, nsecs_t reltime=0); - - // sends INVALIDATE message at next VSYNC void invalidate(); - // sends REFRESH message at next VSYNC void refresh(); - // sends TRANSACTION message immediately - void invalidateTransactionNow(); }; // --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MonitoredProducer.cpp android-platform-frameworks-native-21/services/surfaceflinger/MonitoredProducer.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MonitoredProducer.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/MonitoredProducer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,130 +0,0 @@ -/* - * Copyright 2014 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 "MessageQueue.h" -#include "MonitoredProducer.h" -#include "SurfaceFlinger.h" - -namespace android { - -MonitoredProducer::MonitoredProducer(const sp& producer, - const sp& flinger) : - mProducer(producer), - mFlinger(flinger) {} - -MonitoredProducer::~MonitoredProducer() { - // Remove ourselves from SurfaceFlinger's list. We do this asynchronously - // because we don't know where this destructor is called from. It could be - // called with the mStateLock held, leading to a dead-lock (it actually - // happens). - class MessageCleanUpList : public MessageBase { - public: - MessageCleanUpList(const sp& flinger, - const wp& producer) - : mFlinger(flinger), mProducer(producer) {} - - virtual ~MessageCleanUpList() {} - - virtual bool handler() { - Mutex::Autolock _l(mFlinger->mStateLock); - mFlinger->mGraphicBufferProducerList.remove(mProducer); - return true; - } - - private: - sp mFlinger; - wp mProducer; - }; - - mFlinger->postMessageAsync(new MessageCleanUpList(mFlinger, asBinder(this))); -} - -status_t MonitoredProducer::requestBuffer(int slot, sp* buf) { - return mProducer->requestBuffer(slot, buf); -} - -status_t MonitoredProducer::setBufferCount(int bufferCount) { - return mProducer->setBufferCount(bufferCount); -} - -status_t MonitoredProducer::dequeueBuffer(int* slot, sp* fence, - bool async, uint32_t w, uint32_t h, PixelFormat format, uint32_t usage) { - return mProducer->dequeueBuffer(slot, fence, async, w, h, format, usage); -} - -status_t MonitoredProducer::detachBuffer(int slot) { - return mProducer->detachBuffer(slot); -} - -status_t MonitoredProducer::detachNextBuffer(sp* outBuffer, - sp* outFence) { - return mProducer->detachNextBuffer(outBuffer, outFence); -} - -status_t MonitoredProducer::attachBuffer(int* outSlot, - const sp& buffer) { - return mProducer->attachBuffer(outSlot, buffer); -} - -status_t MonitoredProducer::queueBuffer(int slot, const QueueBufferInput& input, - QueueBufferOutput* output) { - return mProducer->queueBuffer(slot, input, output); -} - -void MonitoredProducer::cancelBuffer(int slot, const sp& fence) { - mProducer->cancelBuffer(slot, fence); -} - -int MonitoredProducer::query(int what, int* value) { - return mProducer->query(what, value); -} - -status_t MonitoredProducer::connect(const sp& listener, - int api, bool producerControlledByApp, QueueBufferOutput* output) { - return mProducer->connect(listener, api, producerControlledByApp, output); -} - -status_t MonitoredProducer::disconnect(int api) { - return mProducer->disconnect(api); -} - -status_t MonitoredProducer::setSidebandStream(const sp& stream) { - return mProducer->setSidebandStream(stream); -} - -void MonitoredProducer::allocateBuffers(bool async, uint32_t width, - uint32_t height, PixelFormat format, uint32_t usage) { - mProducer->allocateBuffers(async, width, height, format, usage); -} - -status_t MonitoredProducer::allowAllocation(bool allow) { - return mProducer->allowAllocation(allow); -} - -status_t MonitoredProducer::setGenerationNumber(uint32_t generationNumber) { - return mProducer->setGenerationNumber(generationNumber); -} - -String8 MonitoredProducer::getConsumerName() const { - return mProducer->getConsumerName(); -} - -IBinder* MonitoredProducer::onAsBinder() { - return IInterface::asBinder(mProducer).get(); -} - -// --------------------------------------------------------------------------- -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MonitoredProducer.h android-platform-frameworks-native-21/services/surfaceflinger/MonitoredProducer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/MonitoredProducer.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/MonitoredProducer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,68 +0,0 @@ -/* - * Copyright 2014 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. - */ - -#ifndef ANDROID_MONITORED_PRODUCER_H -#define ANDROID_MONITORED_PRODUCER_H - -#include - -namespace android { - -class IProducerListener; -class NativeHandle; -class SurfaceFlinger; - -// MonitoredProducer wraps an IGraphicBufferProducer so that SurfaceFlinger will -// be notified upon its destruction -class MonitoredProducer : public IGraphicBufferProducer { -public: - MonitoredProducer(const sp& producer, - const sp& flinger); - virtual ~MonitoredProducer(); - - // From IGraphicBufferProducer - virtual status_t requestBuffer(int slot, sp* buf); - virtual status_t setBufferCount(int bufferCount); - virtual status_t dequeueBuffer(int* slot, sp* fence, bool async, - uint32_t w, uint32_t h, PixelFormat format, uint32_t usage); - virtual status_t detachBuffer(int slot); - virtual status_t detachNextBuffer(sp* outBuffer, - sp* outFence); - virtual status_t attachBuffer(int* outSlot, - const sp& buffer); - virtual status_t queueBuffer(int slot, const QueueBufferInput& input, - QueueBufferOutput* output); - virtual void cancelBuffer(int slot, const sp& fence); - virtual int query(int what, int* value); - virtual status_t connect(const sp& token, int api, - bool producerControlledByApp, QueueBufferOutput* output); - virtual status_t disconnect(int api); - virtual status_t setSidebandStream(const sp& stream); - virtual void allocateBuffers(bool async, uint32_t width, uint32_t height, - PixelFormat format, uint32_t usage); - virtual status_t allowAllocation(bool allow); - virtual status_t setGenerationNumber(uint32_t generationNumber); - virtual String8 getConsumerName() const override; - virtual IBinder* onAsBinder(); - -private: - sp mProducer; - sp mFlinger; -}; - -}; // namespace android - -#endif // ANDROID_MONITORED_PRODUCER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Description.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Description.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Description.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Description.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,96 +0,0 @@ -/* - * Copyright 2013 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 -#include - -#include - -#include -#include - -#include "Description.h" - -namespace android { - -Description::Description() : - mUniformsDirty(true) { - mPlaneAlpha = 1.0f; - mPremultipliedAlpha = false; - mOpaque = true; - mTextureEnabled = false; - mColorMatrixEnabled = false; - - memset(mColor, 0, sizeof(mColor)); -} - -Description::~Description() { -} - -void Description::setPlaneAlpha(GLclampf planeAlpha) { - if (planeAlpha != mPlaneAlpha) { - mUniformsDirty = true; - mPlaneAlpha = planeAlpha; - } -} - -void Description::setPremultipliedAlpha(bool premultipliedAlpha) { - if (premultipliedAlpha != mPremultipliedAlpha) { - mPremultipliedAlpha = premultipliedAlpha; - } -} - -void Description::setOpaque(bool opaque) { - if (opaque != mOpaque) { - mOpaque = opaque; - } -} - -void Description::setTexture(const Texture& texture) { - mTexture = texture; - mTextureEnabled = true; - mUniformsDirty = true; -} - -void Description::disableTexture() { - mTextureEnabled = false; -} - -void Description::setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha) { - mColor[0] = red; - mColor[1] = green; - mColor[2] = blue; - mColor[3] = alpha; - mUniformsDirty = true; -} - -void Description::setProjectionMatrix(const mat4& mtx) { - mProjectionMatrix = mtx; - mUniformsDirty = true; -} - -void Description::setColorMatrix(const mat4& mtx) { - const mat4 identity; - mColorMatrix = mtx; - mColorMatrixEnabled = (mtx != identity); -} - -const mat4& Description::getColorMatrix() const { - return mColorMatrix; -} - - -} /* namespace android */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Description.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Description.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Description.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Description.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright 2013 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 -#include "Texture.h" - -#ifndef SF_RENDER_ENGINE_DESCRIPTION_H_ -#define SF_RENDER_ENGINE_DESCRIPTION_H_ - -namespace android { - -class Program; - -/* - * This holds the state of the rendering engine. This class is used - * to generate a corresponding GLSL program and set the appropriate - * uniform. - * - * Program and ProgramCache are friends and access the state directly - */ -class Description { - friend class Program; - friend class ProgramCache; - - // value of the plane-alpha, between 0 and 1 - GLclampf mPlaneAlpha; - // whether textures are premultiplied - bool mPremultipliedAlpha; - // whether this layer is marked as opaque - bool mOpaque; - - // Texture this layer uses - Texture mTexture; - bool mTextureEnabled; - - // color used when texturing is disabled - GLclampf mColor[4]; - // projection matrix - mat4 mProjectionMatrix; - - bool mColorMatrixEnabled; - mat4 mColorMatrix; - -public: - Description(); - ~Description(); - - void setPlaneAlpha(GLclampf planeAlpha); - void setPremultipliedAlpha(bool premultipliedAlpha); - void setOpaque(bool opaque); - void setTexture(const Texture& texture); - void disableTexture(); - void setColor(GLclampf red, GLclampf green, GLclampf blue, GLclampf alpha); - void setProjectionMatrix(const mat4& mtx); - void setColorMatrix(const mat4& mtx); - const mat4& getColorMatrix() const; - -private: - bool mUniformsDirty; -}; - -} /* namespace android */ - -#endif /* SF_RENDER_ENGINE_DESCRIPTION_H_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES10RenderEngine.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES10RenderEngine.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES10RenderEngine.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES10RenderEngine.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,61 +0,0 @@ -/* - * Copyright 2013 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 - -#include - -#include "GLES10RenderEngine.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -GLES10RenderEngine::~GLES10RenderEngine() { -} - -void GLES10RenderEngine::setupLayerBlending( - bool premultipliedAlpha, bool opaque, int alpha) { - // OpenGL ES 1.0 doesn't support texture combiners. - // This path doesn't properly handle opaque layers that have non-opaque - // alpha values. The alpha channel will be copied into the framebuffer or - // screenshot, so if the framebuffer or screenshot is blended on top of - // something else, whatever is below the window will incorrectly show - // through. - if (CC_UNLIKELY(alpha < 0xFF)) { - GLfloat floatAlpha = alpha * (1.0f / 255.0f); - if (premultipliedAlpha) { - glColor4f(floatAlpha, floatAlpha, floatAlpha, floatAlpha); - } else { - glColor4f(1.0f, 1.0f, 1.0f, floatAlpha); - } - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); - } else { - glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); - } - - if (alpha < 0xFF || !opaque) { - glEnable(GL_BLEND); - glBlendFunc(premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA); - } else { - glDisable(GL_BLEND); - } -} - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES10RenderEngine.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES10RenderEngine.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES10RenderEngine.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES10RenderEngine.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,40 +0,0 @@ -/* - * Copyright 2013 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. - */ - - -#ifndef SF_GLES10RENDERENGINE_H_ -#define SF_GLES10RENDERENGINE_H_ - -#include -#include - -#include "GLES11RenderEngine.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class GLES10RenderEngine : public GLES11RenderEngine { - virtual ~GLES10RenderEngine(); -protected: - virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha); -}; - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#endif /* SF_GLES10RENDERENGINE_H_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES11RenderEngine.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,275 +0,0 @@ -/* - * Copyright 2013 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 -#include - -#include - -#include -#include -#include - -#include "GLES11RenderEngine.h" -#include "Mesh.h" -#include "Texture.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -GLES11RenderEngine::GLES11RenderEngine() { - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); - glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - glEnableClientState(GL_VERTEX_ARRAY); - glShadeModel(GL_FLAT); - glDisable(GL_DITHER); - glDisable(GL_CULL_FACE); - - const uint16_t protTexData[] = { 0 }; - glGenTextures(1, &mProtectedTexName); - glBindTexture(GL_TEXTURE_2D, mProtectedTexName); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, protTexData); -} - -GLES11RenderEngine::~GLES11RenderEngine() { -} - - -size_t GLES11RenderEngine::getMaxTextureSize() const { - return mMaxTextureSize; -} - -size_t GLES11RenderEngine::getMaxViewportDims() const { - return - mMaxViewportDims[0] < mMaxViewportDims[1] ? - mMaxViewportDims[0] : mMaxViewportDims[1]; -} - -void GLES11RenderEngine::setViewportAndProjection( - size_t vpw, size_t vph, Rect sourceCrop, size_t hwh, bool yswap, - Transform::orientation_flags rotation) { - glViewport(0, 0, vpw, vph); - glMatrixMode(GL_PROJECTION); - glLoadIdentity(); - - size_t l = sourceCrop.left; - size_t r = sourceCrop.right; - - // In GL, (0, 0) is the bottom-left corner, so flip y coordinates - size_t t = hwh - sourceCrop.top; - size_t b = hwh - sourceCrop.bottom; - - if (yswap) { - glOrthof(l, r, t, b, 0, 1); - } else { - glOrthof(l, r, b, t, 0, 1); - } - - switch (rotation) { - case Transform::ROT_0: - break; - case Transform::ROT_90: - glRotatef(90, 0, 0, 1); - break; - case Transform::ROT_180: - glRotatef(180, 0, 0, 1); - break; - case Transform::ROT_270: - glRotatef(270, 0, 0, 1); - break; - default: - break; - } - - glMatrixMode(GL_MODELVIEW); -} - -void GLES11RenderEngine::setupLayerBlending( - bool premultipliedAlpha, bool opaque, int alpha) { - GLenum combineRGB; - GLenum combineAlpha; - GLenum src0Alpha; - GLfloat envColor[4]; - - if (CC_UNLIKELY(alpha < 0xFF)) { - // Cv = premultiplied ? Cs*alpha : Cs - // Av = !opaque ? As*alpha : As - combineRGB = premultipliedAlpha ? GL_MODULATE : GL_REPLACE; - combineAlpha = !opaque ? GL_MODULATE : GL_REPLACE; - src0Alpha = GL_CONSTANT; - envColor[0] = alpha * (1.0f / 255.0f); - } else { - // Cv = Cs - // Av = opaque ? 1.0 : As - combineRGB = GL_REPLACE; - combineAlpha = GL_REPLACE; - src0Alpha = opaque ? GL_CONSTANT : GL_TEXTURE; - envColor[0] = 1.0f; - } - - glTexEnvi(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_COMBINE); - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_RGB, combineRGB); - glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_RGB, GL_TEXTURE); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_RGB, GL_SRC_COLOR); - if (combineRGB == GL_MODULATE) { - glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_RGB, GL_CONSTANT); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_RGB, GL_SRC_COLOR); - } - glTexEnvi(GL_TEXTURE_ENV, GL_COMBINE_ALPHA, combineAlpha); - glTexEnvi(GL_TEXTURE_ENV, GL_SRC0_ALPHA, src0Alpha); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND0_ALPHA, GL_SRC_ALPHA); - if (combineAlpha == GL_MODULATE) { - glTexEnvi(GL_TEXTURE_ENV, GL_SRC1_ALPHA, GL_TEXTURE); - glTexEnvi(GL_TEXTURE_ENV, GL_OPERAND1_ALPHA, GL_SRC_ALPHA); - } - if (combineRGB == GL_MODULATE || src0Alpha == GL_CONSTANT) { - envColor[1] = envColor[0]; - envColor[2] = envColor[0]; - envColor[3] = envColor[0]; - glTexEnvfv(GL_TEXTURE_ENV, GL_TEXTURE_ENV_COLOR, envColor); - } - - if (alpha < 0xFF || !opaque) { - glEnable(GL_BLEND); - glBlendFunc(premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA, - GL_ONE_MINUS_SRC_ALPHA); - } else { - glDisable(GL_BLEND); - } -} - -void GLES11RenderEngine::setupDimLayerBlending(int alpha) { - glDisable(GL_TEXTURE_EXTERNAL_OES); - glDisable(GL_TEXTURE_2D); - if (alpha == 0xFF) { - glDisable(GL_BLEND); - } else { - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } - glColor4f(0, 0, 0, alpha/255.0f); -} - -void GLES11RenderEngine::setupLayerTexturing(const Texture& texture) { - GLuint target = texture.getTextureTarget(); - glBindTexture(target, texture.getTextureName()); - GLenum filter = GL_NEAREST; - if (texture.getFiltering()) { - filter = GL_LINEAR; - } - glTexParameterx(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameterx(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameterx(target, GL_TEXTURE_MAG_FILTER, filter); - glTexParameterx(target, GL_TEXTURE_MIN_FILTER, filter); - glMatrixMode(GL_TEXTURE); - glLoadMatrixf(texture.getMatrix().asArray()); - glMatrixMode(GL_MODELVIEW); - glDisable(GL_TEXTURE_2D); - glEnable(GL_TEXTURE_EXTERNAL_OES); -} - -void GLES11RenderEngine::setupLayerBlackedOut() { - glBindTexture(GL_TEXTURE_2D, mProtectedTexName); - glMatrixMode(GL_TEXTURE); - glLoadIdentity(); - glMatrixMode(GL_MODELVIEW); - glDisable(GL_TEXTURE_EXTERNAL_OES); - glEnable(GL_TEXTURE_2D); -} - -void GLES11RenderEngine::disableTexturing() { - glDisable(GL_TEXTURE_EXTERNAL_OES); - glDisable(GL_TEXTURE_2D); -} - -void GLES11RenderEngine::disableBlending() { - glDisable(GL_BLEND); -} - -void GLES11RenderEngine::bindImageAsFramebuffer(EGLImageKHR image, - uint32_t* texName, uint32_t* fbName, uint32_t* status) { - GLuint tname, name; - // turn our EGLImage into a texture - glGenTextures(1, &tname); - glBindTexture(GL_TEXTURE_2D, tname); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)image); - - // create a Framebuffer Object to render into - glGenFramebuffersOES(1, &name); - glBindFramebufferOES(GL_FRAMEBUFFER_OES, name); - glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, - GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tname, 0); - - *status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); - *texName = tname; - *fbName = name; -} - -void GLES11RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { - glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); - glDeleteFramebuffersOES(1, &fbName); - glDeleteTextures(1, &texName); -} - -void GLES11RenderEngine::setupFillWithColor(float r, float g, float b, float a) { - glColor4f(r, g, b, a); - glDisable(GL_TEXTURE_EXTERNAL_OES); - glDisable(GL_TEXTURE_2D); - glDisable(GL_BLEND); -} - -void GLES11RenderEngine::drawMesh(const Mesh& mesh) { - if (mesh.getTexCoordsSize()) { - glEnableClientState(GL_TEXTURE_COORD_ARRAY); - glTexCoordPointer(mesh.getTexCoordsSize(), - GL_FLOAT, - mesh.getByteStride(), - mesh.getTexCoords()); - } - - glVertexPointer(mesh.getVertexSize(), - GL_FLOAT, - mesh.getByteStride(), - mesh.getPositions()); - - glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount()); - - if (mesh.getTexCoordsSize()) { - glDisableClientState(GL_TEXTURE_COORD_ARRAY); - } -} - -void GLES11RenderEngine::dump(String8& result) { - RenderEngine::dump(result); -} - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#if defined(__gl2_h_) -#error "don't include gl2/gl2.h in this file" -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES11RenderEngine.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,73 +0,0 @@ -/* - * Copyright 2013 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. - */ - - -#ifndef SF_GLES11RENDERENGINE_H_ -#define SF_GLES11RENDERENGINE_H_ - -#include -#include - -#include -#include - -#include "RenderEngine.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class String8; -class Mesh; -class Texture; - -class GLES11RenderEngine : public RenderEngine { - GLuint mProtectedTexName; - GLint mMaxViewportDims[2]; - GLint mMaxTextureSize; - - virtual void bindImageAsFramebuffer(EGLImageKHR image, - uint32_t* texName, uint32_t* fbName, uint32_t* status); - virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName); - -public: - GLES11RenderEngine(); - -protected: - virtual ~GLES11RenderEngine(); - - virtual void dump(String8& result); - virtual void setViewportAndProjection(size_t vpw, size_t vph, - Rect sourceCrop, size_t hwh, bool yswap, Transform::orientation_flags rotation); - virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha); - virtual void setupDimLayerBlending(int alpha); - virtual void setupLayerTexturing(const Texture& texture); - virtual void setupLayerBlackedOut(); - virtual void setupFillWithColor(float r, float g, float b, float a) ; - virtual void disableTexturing(); - virtual void disableBlending(); - - virtual void drawMesh(const Mesh& mesh); - - virtual size_t getMaxTextureSize() const; - virtual size_t getMaxViewportDims() const; -}; - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#endif /* SF_GLES11RENDERENGINE_H_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES20RenderEngine.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,256 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#define ATRACE_TAG ATRACE_TAG_GRAPHICS - -#include -#include - -#include - -#include -#include - -#include -#include -#include - -#include "GLES20RenderEngine.h" -#include "Program.h" -#include "ProgramCache.h" -#include "Description.h" -#include "Mesh.h" -#include "Texture.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -GLES20RenderEngine::GLES20RenderEngine() : - mVpWidth(0), mVpHeight(0) { - - glGetIntegerv(GL_MAX_TEXTURE_SIZE, &mMaxTextureSize); - glGetIntegerv(GL_MAX_VIEWPORT_DIMS, mMaxViewportDims); - - glPixelStorei(GL_UNPACK_ALIGNMENT, 4); - glPixelStorei(GL_PACK_ALIGNMENT, 4); - - const uint16_t protTexData[] = { 0 }; - glGenTextures(1, &mProtectedTexName); - glBindTexture(GL_TEXTURE_2D, mProtectedTexName); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); - glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); - glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, - GL_RGB, GL_UNSIGNED_SHORT_5_6_5, protTexData); - - //mColorBlindnessCorrection = M; -} - -GLES20RenderEngine::~GLES20RenderEngine() { -} - - -size_t GLES20RenderEngine::getMaxTextureSize() const { - return mMaxTextureSize; -} - -size_t GLES20RenderEngine::getMaxViewportDims() const { - return - mMaxViewportDims[0] < mMaxViewportDims[1] ? - mMaxViewportDims[0] : mMaxViewportDims[1]; -} - -void GLES20RenderEngine::setViewportAndProjection( - size_t vpw, size_t vph, Rect sourceCrop, size_t hwh, bool yswap, - Transform::orientation_flags rotation) { - - size_t l = sourceCrop.left; - size_t r = sourceCrop.right; - - // In GL, (0, 0) is the bottom-left corner, so flip y coordinates - size_t t = hwh - sourceCrop.top; - size_t b = hwh - sourceCrop.bottom; - - mat4 m; - if (yswap) { - m = mat4::ortho(l, r, t, b, 0, 1); - } else { - m = mat4::ortho(l, r, b, t, 0, 1); - } - - // Apply custom rotation to the projection. - float rot90InRadians = 2.0f * static_cast(M_PI) / 4.0f; - switch (rotation) { - case Transform::ROT_0: - break; - case Transform::ROT_90: - m = mat4::rotate(rot90InRadians, vec3(0,0,1)) * m; - break; - case Transform::ROT_180: - m = mat4::rotate(rot90InRadians * 2.0f, vec3(0,0,1)) * m; - break; - case Transform::ROT_270: - m = mat4::rotate(rot90InRadians * 3.0f, vec3(0,0,1)) * m; - break; - default: - break; - } - - glViewport(0, 0, vpw, vph); - mState.setProjectionMatrix(m); - mVpWidth = vpw; - mVpHeight = vph; -} - -void GLES20RenderEngine::setupLayerBlending( - bool premultipliedAlpha, bool opaque, int alpha) { - - mState.setPremultipliedAlpha(premultipliedAlpha); - mState.setOpaque(opaque); - mState.setPlaneAlpha(alpha / 255.0f); - - if (alpha < 0xFF || !opaque) { - glEnable(GL_BLEND); - glBlendFunc(premultipliedAlpha ? GL_ONE : GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA); - } else { - glDisable(GL_BLEND); - } -} - -void GLES20RenderEngine::setupDimLayerBlending(int alpha) { - mState.setPlaneAlpha(1.0f); - mState.setPremultipliedAlpha(true); - mState.setOpaque(false); - mState.setColor(0, 0, 0, alpha/255.0f); - mState.disableTexture(); - - if (alpha == 0xFF) { - glDisable(GL_BLEND); - } else { - glEnable(GL_BLEND); - glBlendFunc(GL_ONE, GL_ONE_MINUS_SRC_ALPHA); - } -} - -void GLES20RenderEngine::setupLayerTexturing(const Texture& texture) { - GLuint target = texture.getTextureTarget(); - glBindTexture(target, texture.getTextureName()); - GLenum filter = GL_NEAREST; - if (texture.getFiltering()) { - filter = GL_LINEAR; - } - glTexParameteri(target, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); - glTexParameteri(target, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); - glTexParameteri(target, GL_TEXTURE_MAG_FILTER, filter); - glTexParameteri(target, GL_TEXTURE_MIN_FILTER, filter); - - mState.setTexture(texture); -} - -void GLES20RenderEngine::setupLayerBlackedOut() { - glBindTexture(GL_TEXTURE_2D, mProtectedTexName); - Texture texture(Texture::TEXTURE_2D, mProtectedTexName); - texture.setDimensions(1, 1); // FIXME: we should get that from somewhere - mState.setTexture(texture); -} - -mat4 GLES20RenderEngine::setupColorTransform(const mat4& colorTransform) { - mat4 oldTransform = mState.getColorMatrix(); - mState.setColorMatrix(colorTransform); - return oldTransform; -} - -void GLES20RenderEngine::disableTexturing() { - mState.disableTexture(); -} - -void GLES20RenderEngine::disableBlending() { - glDisable(GL_BLEND); -} - - -void GLES20RenderEngine::bindImageAsFramebuffer(EGLImageKHR image, - uint32_t* texName, uint32_t* fbName, uint32_t* status) { - GLuint tname, name; - // turn our EGLImage into a texture - glGenTextures(1, &tname); - glBindTexture(GL_TEXTURE_2D, tname); - glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, (GLeglImageOES)image); - - // create a Framebuffer Object to render into - glGenFramebuffers(1, &name); - glBindFramebuffer(GL_FRAMEBUFFER, name); - glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, tname, 0); - - *status = glCheckFramebufferStatus(GL_FRAMEBUFFER); - *texName = tname; - *fbName = name; -} - -void GLES20RenderEngine::unbindFramebuffer(uint32_t texName, uint32_t fbName) { - glBindFramebuffer(GL_FRAMEBUFFER, 0); - glDeleteFramebuffers(1, &fbName); - glDeleteTextures(1, &texName); -} - -void GLES20RenderEngine::setupFillWithColor(float r, float g, float b, float a) { - mState.setPlaneAlpha(1.0f); - mState.setPremultipliedAlpha(true); - mState.setOpaque(false); - mState.setColor(r, g, b, a); - mState.disableTexture(); - glDisable(GL_BLEND); -} - -void GLES20RenderEngine::drawMesh(const Mesh& mesh) { - - ProgramCache::getInstance().useProgram(mState); - - if (mesh.getTexCoordsSize()) { - glEnableVertexAttribArray(Program::texCoords); - glVertexAttribPointer(Program::texCoords, - mesh.getTexCoordsSize(), - GL_FLOAT, GL_FALSE, - mesh.getByteStride(), - mesh.getTexCoords()); - } - - glVertexAttribPointer(Program::position, - mesh.getVertexSize(), - GL_FLOAT, GL_FALSE, - mesh.getByteStride(), - mesh.getPositions()); - - glDrawArrays(mesh.getPrimitive(), 0, mesh.getVertexCount()); - - if (mesh.getTexCoordsSize()) { - glDisableVertexAttribArray(Program::texCoords); - } -} - -void GLES20RenderEngine::dump(String8& result) { - RenderEngine::dump(result); -} - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#if defined(__gl_h_) -#error "don't include gl/gl.h in this file" -#endif diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLES20RenderEngine.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,89 +0,0 @@ -/* - * Copyright 2013 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. - */ - - -#ifndef SF_GLES20RENDERENGINE_H_ -#define SF_GLES20RENDERENGINE_H_ - -#include -#include - -#include -#include - -#include "RenderEngine.h" -#include "ProgramCache.h" -#include "Description.h" - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class String8; -class Mesh; -class Texture; - -class GLES20RenderEngine : public RenderEngine { - GLuint mProtectedTexName; - GLint mMaxViewportDims[2]; - GLint mMaxTextureSize; - GLuint mVpWidth; - GLuint mVpHeight; - - struct Group { - GLuint texture; - GLuint fbo; - GLuint width; - GLuint height; - mat4 colorTransform; - }; - - Description mState; - Vector mGroupStack; - - virtual void bindImageAsFramebuffer(EGLImageKHR image, - uint32_t* texName, uint32_t* fbName, uint32_t* status); - virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName); - -public: - GLES20RenderEngine(); - -protected: - virtual ~GLES20RenderEngine(); - - virtual void dump(String8& result); - virtual void setViewportAndProjection(size_t vpw, size_t vph, - Rect sourceCrop, size_t hwh, bool yswap, Transform::orientation_flags rotation); - virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha); - virtual void setupDimLayerBlending(int alpha); - virtual void setupLayerTexturing(const Texture& texture); - virtual void setupLayerBlackedOut(); - virtual void setupFillWithColor(float r, float g, float b, float a); - virtual mat4 setupColorTransform(const mat4& colorTransform); - virtual void disableTexturing(); - virtual void disableBlending(); - - virtual void drawMesh(const Mesh& mesh); - - virtual size_t getMaxTextureSize() const; - virtual size_t getMaxViewportDims() const; -}; - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#endif /* SF_GLES20RENDERENGINE_H_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLExtensions.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLExtensions.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLExtensions.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLExtensions.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,83 +0,0 @@ -/* - * Copyright (C) 2010 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 -#include -#include - -#include "GLExtensions.h" - -namespace android { -// --------------------------------------------------------------------------- - -ANDROID_SINGLETON_STATIC_INSTANCE( GLExtensions ) - -GLExtensions::GLExtensions() - : mHaveFramebufferObject(false) -{ -} - -void GLExtensions::initWithGLStrings( - GLubyte const* vendor, - GLubyte const* renderer, - GLubyte const* version, - GLubyte const* extensions) -{ - mVendor = (char const*)vendor; - mRenderer = (char const*)renderer; - mVersion = (char const*)version; - mExtensions = (char const*)extensions; - - char const* curr = (char const*)extensions; - char const* head = curr; - do { - head = strchr(curr, ' '); - String8 s(curr, head ? head-curr : strlen(curr)); - if (s.length()) { - mExtensionList.add(s); - } - curr = head+1; - } while (head); - - if (hasExtension("GL_OES_framebuffer_object")) { - mHaveFramebufferObject = true; - } -} - -bool GLExtensions::hasExtension(char const* extension) const -{ - const String8 s(extension); - return mExtensionList.indexOf(s) >= 0; -} - -char const* GLExtensions::getVendor() const { - return mVendor.string(); -} - -char const* GLExtensions::getRenderer() const { - return mRenderer.string(); -} - -char const* GLExtensions::getVersion() const { - return mVersion.string(); -} - -char const* GLExtensions::getExtension() const { - return mExtensions.string(); -} - -// --------------------------------------------------------------------------- -}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLExtensions.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLExtensions.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/GLExtensions.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/GLExtensions.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,77 +0,0 @@ -/* - * Copyright (C) 2010 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. - */ - -#ifndef ANDROID_SF_GLEXTENSION_H -#define ANDROID_SF_GLEXTENSION_H - -#include -#include - -#include -#include -#include - -#include -#include -#include -#include - -namespace android { -// --------------------------------------------------------------------------- - -class GLExtensions : public Singleton -{ - friend class Singleton; - - bool mHaveFramebufferObject : 1; - - String8 mVendor; - String8 mRenderer; - String8 mVersion; - String8 mExtensions; - SortedVector mExtensionList; - - GLExtensions(const GLExtensions&); - GLExtensions& operator = (const GLExtensions&); - -protected: - GLExtensions(); - -public: - - inline bool haveFramebufferObject() const { - return mHaveFramebufferObject; - } - - void initWithGLStrings( - GLubyte const* vendor, - GLubyte const* renderer, - GLubyte const* version, - GLubyte const* extensions); - - char const* getVendor() const; - char const* getRenderer() const; - char const* getVersion() const; - char const* getExtension() const; - - bool hasExtension(char const* extension) const; -}; - - -// --------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SF_GLEXTENSION_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Mesh.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Mesh.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Mesh.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Mesh.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* - * Copyright 2013 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 "Mesh.h" - -#include - -namespace android { - -Mesh::Mesh(Primitive primitive, size_t vertexCount, size_t vertexSize, size_t texCoordSize) - : mVertexCount(vertexCount), mVertexSize(vertexSize), mTexCoordsSize(texCoordSize), - mPrimitive(primitive) -{ - if (vertexCount == 0) { - mVertices = new float[1]; - mVertices[0] = 0.0f; - mStride = 0; - return; - } - - size_t stride = vertexSize + texCoordSize; - size_t remainder = (stride * vertexCount) / vertexCount; - // Since all of the input parameters are unsigned, if stride is less than - // either vertexSize or texCoordSize, it must have overflowed. remainder - // will be equal to stride as long as stride * vertexCount doesn't overflow. - if ((stride < vertexSize) || (remainder != stride)) { - ALOGE("Overflow in Mesh(..., %zu, %zu, %zu)", vertexCount, vertexSize, - texCoordSize); - mVertices = new float[1]; - mVertices[0] = 0.0f; - mVertexCount = 0; - mVertexSize = 0; - mTexCoordsSize = 0; - mStride = 0; - return; - } - - mVertices = new float[stride * vertexCount]; - mStride = stride; -} - -Mesh::~Mesh() { - delete [] mVertices; -} - -Mesh::Primitive Mesh::getPrimitive() const { - return mPrimitive; -} - - -float const* Mesh::getPositions() const { - return mVertices; -} -float* Mesh::getPositions() { - return mVertices; -} - -float const* Mesh::getTexCoords() const { - return mVertices + mVertexSize; -} -float* Mesh::getTexCoords() { - return mVertices + mVertexSize; -} - - -size_t Mesh::getVertexCount() const { - return mVertexCount; -} - -size_t Mesh::getVertexSize() const { - return mVertexSize; -} - -size_t Mesh::getTexCoordsSize() const { - return mTexCoordsSize; -} - -size_t Mesh::getByteStride() const { - return mStride*sizeof(float); -} - -size_t Mesh::getStride() const { - return mStride; -} - -} /* namespace android */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Mesh.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Mesh.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Mesh.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Mesh.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,99 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef SF_RENDER_ENGINE_MESH_H -#define SF_RENDER_ENGINE_MESH_H - -#include - -namespace android { - -class Mesh { -public: - enum Primitive { - TRIANGLES = 0x0004, // GL_TRIANGLES - TRIANGLE_STRIP = 0x0005, // GL_TRIANGLE_STRIP - TRIANGLE_FAN = 0x0006 // GL_TRIANGLE_FAN - }; - - Mesh(Primitive primitive, size_t vertexCount, size_t vertexSize, size_t texCoordsSize = 0); - ~Mesh(); - - /* - * VertexArray handles the stride automatically. - */ - template - class VertexArray { - friend class Mesh; - float* mData; - size_t mStride; - VertexArray(float* data, size_t stride) : mData(data), mStride(stride) { } - public: - TYPE& operator[](size_t index) { - return *reinterpret_cast(&mData[index*mStride]); - } - TYPE const& operator[](size_t index) const { - return *reinterpret_cast(&mData[index*mStride]); - } - }; - - template - VertexArray getPositionArray() { return VertexArray(getPositions(), mStride); } - - template - VertexArray getTexCoordArray() { return VertexArray(getTexCoords(), mStride); } - - Primitive getPrimitive() const; - - // returns a pointer to the vertices positions - float const* getPositions() const; - - // returns a pointer to the vertices texture coordinates - float const* getTexCoords() const; - - // number of vertices in this mesh - size_t getVertexCount() const; - - // dimension of vertices - size_t getVertexSize() const; - - // dimension of texture coordinates - size_t getTexCoordsSize() const; - - // return stride in bytes - size_t getByteStride() const; - - // return stride in floats - size_t getStride() const; - -private: - Mesh(const Mesh&); - Mesh& operator = (const Mesh&); - Mesh const& operator = (const Mesh&) const; - - float* getPositions(); - float* getTexCoords(); - float* mVertices; - size_t mVertexCount; - size_t mVertexSize; - size_t mTexCoordsSize; - size_t mStride; - Primitive mPrimitive; -}; - - -} /* namespace android */ -#endif /* SF_RENDER_ENGINE_MESH_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/ProgramCache.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/ProgramCache.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/ProgramCache.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/ProgramCache.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,251 +0,0 @@ -/* - * Copyright 2013 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 -#include - -#include - -#include "ProgramCache.h" -#include "Program.h" -#include "Description.h" - -namespace android { -// ----------------------------------------------------------------------------------------------- - - -/* - * A simple formatter class to automatically add the endl and - * manage the indentation. - */ - -class Formatter; -static Formatter& indent(Formatter& f); -static Formatter& dedent(Formatter& f); - -class Formatter { - String8 mString; - int mIndent; - typedef Formatter& (*FormaterManipFunc)(Formatter&); - friend Formatter& indent(Formatter& f); - friend Formatter& dedent(Formatter& f); -public: - Formatter() : mIndent(0) {} - - String8 getString() const { - return mString; - } - - friend Formatter& operator << (Formatter& out, const char* in) { - for (int i=0 ; i(timeAfter - timeBefore) / 1.0E6; - ALOGD("shader cache generated - %u shaders in %f ms\n", shaderCount, compileTimeMs); -} - -ProgramCache::Key ProgramCache::computeKey(const Description& description) { - Key needs; - needs.set(Key::TEXTURE_MASK, - !description.mTextureEnabled ? Key::TEXTURE_OFF : - description.mTexture.getTextureTarget() == GL_TEXTURE_EXTERNAL_OES ? Key::TEXTURE_EXT : - description.mTexture.getTextureTarget() == GL_TEXTURE_2D ? Key::TEXTURE_2D : - Key::TEXTURE_OFF) - .set(Key::PLANE_ALPHA_MASK, - (description.mPlaneAlpha < 1) ? Key::PLANE_ALPHA_LT_ONE : Key::PLANE_ALPHA_EQ_ONE) - .set(Key::BLEND_MASK, - description.mPremultipliedAlpha ? Key::BLEND_PREMULT : Key::BLEND_NORMAL) - .set(Key::OPACITY_MASK, - description.mOpaque ? Key::OPACITY_OPAQUE : Key::OPACITY_TRANSLUCENT) - .set(Key::COLOR_MATRIX_MASK, - description.mColorMatrixEnabled ? Key::COLOR_MATRIX_ON : Key::COLOR_MATRIX_OFF); - return needs; -} - -String8 ProgramCache::generateVertexShader(const Key& needs) { - Formatter vs; - if (needs.isTexturing()) { - vs << "attribute vec4 texCoords;" - << "varying vec2 outTexCoords;"; - } - vs << "attribute vec4 position;" - << "uniform mat4 projection;" - << "uniform mat4 texture;" - << "void main(void) {" << indent - << "gl_Position = projection * position;"; - if (needs.isTexturing()) { - vs << "outTexCoords = (texture * texCoords).st;"; - } - vs << dedent << "}"; - return vs.getString(); -} - -String8 ProgramCache::generateFragmentShader(const Key& needs) { - Formatter fs; - if (needs.getTextureTarget() == Key::TEXTURE_EXT) { - fs << "#extension GL_OES_EGL_image_external : require"; - } - - // default precision is required-ish in fragment shaders - fs << "precision mediump float;"; - - if (needs.getTextureTarget() == Key::TEXTURE_EXT) { - fs << "uniform samplerExternalOES sampler;" - << "varying vec2 outTexCoords;"; - } else if (needs.getTextureTarget() == Key::TEXTURE_2D) { - fs << "uniform sampler2D sampler;" - << "varying vec2 outTexCoords;"; - } else if (needs.getTextureTarget() == Key::TEXTURE_OFF) { - fs << "uniform vec4 color;"; - } - if (needs.hasPlaneAlpha()) { - fs << "uniform float alphaPlane;"; - } - if (needs.hasColorMatrix()) { - fs << "uniform mat4 colorMatrix;"; - } - fs << "void main(void) {" << indent; - if (needs.isTexturing()) { - fs << "gl_FragColor = texture2D(sampler, outTexCoords);"; - } else { - fs << "gl_FragColor = color;"; - } - if (needs.isOpaque()) { - fs << "gl_FragColor.a = 1.0;"; - } - if (needs.hasPlaneAlpha()) { - // modulate the alpha value with planeAlpha - if (needs.isPremultiplied()) { - // ... and the color too if we're premultiplied - fs << "gl_FragColor *= alphaPlane;"; - } else { - fs << "gl_FragColor.a *= alphaPlane;"; - } - } - - if (needs.hasColorMatrix()) { - if (!needs.isOpaque() && needs.isPremultiplied()) { - // un-premultiply if needed before linearization - fs << "gl_FragColor.rgb = gl_FragColor.rgb/gl_FragColor.a;"; - } - fs << "vec4 transformed = colorMatrix * vec4(gl_FragColor.rgb, 1);"; - fs << "gl_FragColor.rgb = transformed.rgb/transformed.a;"; - if (!needs.isOpaque() && needs.isPremultiplied()) { - // and re-premultiply if needed after gamma correction - fs << "gl_FragColor.rgb = gl_FragColor.rgb*gl_FragColor.a;"; - } - } - - fs << dedent << "}"; - return fs.getString(); -} - -Program* ProgramCache::generateProgram(const Key& needs) { - // vertex shader - String8 vs = generateVertexShader(needs); - - // fragment shader - String8 fs = generateFragmentShader(needs); - - Program* program = new Program(needs, vs.string(), fs.string()); - return program; -} - -void ProgramCache::useProgram(const Description& description) { - - // generate the key for the shader based on the description - Key needs(computeKey(description)); - - // look-up the program in the cache - Program* program = mCache.valueFor(needs); - if (program == NULL) { - // we didn't find our program, so generate one... - nsecs_t time = -systemTime(); - program = generateProgram(needs); - mCache.add(needs, program); - time += systemTime(); - - //ALOGD(">>> generated new program: needs=%08X, time=%u ms (%d programs)", - // needs.mNeeds, uint32_t(ns2ms(time)), mCache.size()); - } - - // here we have a suitable program for this description - if (program->isValid()) { - program->use(); - program->setUniforms(description); - } -} - - -} /* namespace android */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/ProgramCache.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/ProgramCache.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/ProgramCache.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/ProgramCache.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,136 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef SF_RENDER_ENGINE_PROGRAMCACHE_H -#define SF_RENDER_ENGINE_PROGRAMCACHE_H - -#include - -#include -#include -#include - -#include "Description.h" - -namespace android { - -class Description; -class Program; -class String8; - -/* - * This class generates GLSL programs suitable to handle a given - * Description. It's responsible for figuring out what to - * generate from a Description. - * It also maintains a cache of these Programs. - */ -class ProgramCache : public Singleton { -public: - /* - * Key is used to retrieve a Program in the cache. - * A Key is generated from a Description. - */ - class Key { - friend class ProgramCache; - typedef uint32_t key_t; - key_t mKey; - public: - enum { - BLEND_PREMULT = 0x00000001, - BLEND_NORMAL = 0x00000000, - BLEND_MASK = 0x00000001, - - OPACITY_OPAQUE = 0x00000002, - OPACITY_TRANSLUCENT = 0x00000000, - OPACITY_MASK = 0x00000002, - - PLANE_ALPHA_LT_ONE = 0x00000004, - PLANE_ALPHA_EQ_ONE = 0x00000000, - PLANE_ALPHA_MASK = 0x00000004, - - TEXTURE_OFF = 0x00000000, - TEXTURE_EXT = 0x00000008, - TEXTURE_2D = 0x00000010, - TEXTURE_MASK = 0x00000018, - - COLOR_MATRIX_OFF = 0x00000000, - COLOR_MATRIX_ON = 0x00000020, - COLOR_MATRIX_MASK = 0x00000020, - }; - - inline Key() : mKey(0) { } - inline Key(const Key& rhs) : mKey(rhs.mKey) { } - - inline Key& set(key_t mask, key_t value) { - mKey = (mKey & ~mask) | value; - return *this; - } - - inline bool isTexturing() const { - return (mKey & TEXTURE_MASK) != TEXTURE_OFF; - } - inline int getTextureTarget() const { - return (mKey & TEXTURE_MASK); - } - inline bool isPremultiplied() const { - return (mKey & BLEND_MASK) == BLEND_PREMULT; - } - inline bool isOpaque() const { - return (mKey & OPACITY_MASK) == OPACITY_OPAQUE; - } - inline bool hasPlaneAlpha() const { - return (mKey & PLANE_ALPHA_MASK) == PLANE_ALPHA_LT_ONE; - } - inline bool hasColorMatrix() const { - return (mKey & COLOR_MATRIX_MASK) == COLOR_MATRIX_ON; - } - - // this is the definition of a friend function -- not a method of class Needs - friend inline int strictly_order_type(const Key& lhs, const Key& rhs) { - return (lhs.mKey < rhs.mKey) ? 1 : 0; - } - }; - - ProgramCache(); - ~ProgramCache(); - - // useProgram lookup a suitable program in the cache or generates one - // if none can be found. - void useProgram(const Description& description); - -private: - // Generate shaders to populate the cache - void primeCache(); - // compute a cache Key from a Description - static Key computeKey(const Description& description); - // generates a program from the Key - static Program* generateProgram(const Key& needs); - // generates the vertex shader from the Key - static String8 generateVertexShader(const Key& needs); - // generates the fragment shader from the Key - static String8 generateFragmentShader(const Key& needs); - - // Key/Value map used for caching Programs. Currently the cache - // is never shrunk. - DefaultKeyedVector mCache; -}; - - -ANDROID_BASIC_TYPES_TRAITS(ProgramCache::Key) - -} /* namespace android */ - -#endif /* SF_RENDER_ENGINE_PROGRAMCACHE_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Program.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Program.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Program.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Program.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,148 +0,0 @@ -/*Gluint - * Copyright 2013 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 - -#include - -#include "Program.h" -#include "ProgramCache.h" -#include "Description.h" -#include - -namespace android { - -Program::Program(const ProgramCache::Key& /*needs*/, const char* vertex, const char* fragment) - : mInitialized(false) { - GLuint vertexId = buildShader(vertex, GL_VERTEX_SHADER); - GLuint fragmentId = buildShader(fragment, GL_FRAGMENT_SHADER); - GLuint programId = glCreateProgram(); - glAttachShader(programId, vertexId); - glAttachShader(programId, fragmentId); - glBindAttribLocation(programId, position, "position"); - glBindAttribLocation(programId, texCoords, "texCoords"); - glLinkProgram(programId); - - GLint status; - glGetProgramiv(programId, GL_LINK_STATUS, &status); - if (status != GL_TRUE) { - ALOGE("Error while linking shaders:"); - GLint infoLen = 0; - glGetProgramiv(programId, GL_INFO_LOG_LENGTH, &infoLen); - if (infoLen > 1) { - GLchar log[infoLen]; - glGetProgramInfoLog(programId, infoLen, 0, &log[0]); - ALOGE("%s", log); - } - glDetachShader(programId, vertexId); - glDetachShader(programId, fragmentId); - glDeleteShader(vertexId); - glDeleteShader(fragmentId); - glDeleteProgram(programId); - } else { - mProgram = programId; - mVertexShader = vertexId; - mFragmentShader = fragmentId; - mInitialized = true; - - mColorMatrixLoc = glGetUniformLocation(programId, "colorMatrix"); - mProjectionMatrixLoc = glGetUniformLocation(programId, "projection"); - mTextureMatrixLoc = glGetUniformLocation(programId, "texture"); - mSamplerLoc = glGetUniformLocation(programId, "sampler"); - mColorLoc = glGetUniformLocation(programId, "color"); - mAlphaPlaneLoc = glGetUniformLocation(programId, "alphaPlane"); - - // set-up the default values for our uniforms - glUseProgram(programId); - const GLfloat m[16] = {1,0,0,0, 0,1,0,0, 0,0,1,0, 0,0,0,1 }; - glUniformMatrix4fv(mProjectionMatrixLoc, 1, GL_FALSE, m); - glEnableVertexAttribArray(0); - } -} - -Program::~Program() { -} - -bool Program::isValid() const { - return mInitialized; -} - -void Program::use() { - glUseProgram(mProgram); -} - -GLuint Program::getAttrib(const char* name) const { - // TODO: maybe use a local cache - return glGetAttribLocation(mProgram, name); -} - -GLint Program::getUniform(const char* name) const { - // TODO: maybe use a local cache - return glGetUniformLocation(mProgram, name); -} - -GLuint Program::buildShader(const char* source, GLenum type) { - GLuint shader = glCreateShader(type); - glShaderSource(shader, 1, &source, 0); - glCompileShader(shader); - GLint status; - glGetShaderiv(shader, GL_COMPILE_STATUS, &status); - if (status != GL_TRUE) { - // Some drivers return wrong values for GL_INFO_LOG_LENGTH - // use a fixed size instead - GLchar log[512]; - glGetShaderInfoLog(shader, sizeof(log), 0, log); - ALOGE("Error while compiling shader: \n%s\n%s", source, log); - glDeleteShader(shader); - return 0; - } - return shader; -} - -String8& Program::dumpShader(String8& result, GLenum /*type*/) { - GLuint shader = GL_FRAGMENT_SHADER ? mFragmentShader : mVertexShader; - GLint l; - glGetShaderiv(shader, GL_SHADER_SOURCE_LENGTH, &l); - char* src = new char[l]; - glGetShaderSource(shader, l, NULL, src); - result.append(src); - delete [] src; - return result; -} - -void Program::setUniforms(const Description& desc) { - - // TODO: we should have a mechanism here to not always reset uniforms that - // didn't change for this program. - - if (mSamplerLoc >= 0) { - glUniform1i(mSamplerLoc, 0); - glUniformMatrix4fv(mTextureMatrixLoc, 1, GL_FALSE, desc.mTexture.getMatrix().asArray()); - } - if (mAlphaPlaneLoc >= 0) { - glUniform1f(mAlphaPlaneLoc, desc.mPlaneAlpha); - } - if (mColorLoc >= 0) { - glUniform4fv(mColorLoc, 1, desc.mColor); - } - if (mColorMatrixLoc >= 0) { - glUniformMatrix4fv(mColorMatrixLoc, 1, GL_FALSE, desc.mColorMatrix.asArray()); - } - // these uniforms are always present - glUniformMatrix4fv(mProjectionMatrixLoc, 1, GL_FALSE, desc.mProjectionMatrix.asArray()); -} - -} /* namespace android */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Program.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Program.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Program.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Program.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,92 +0,0 @@ -/* - * Copyright 2013 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. - */ - -#ifndef SF_RENDER_ENGINE_PROGRAM_H -#define SF_RENDER_ENGINE_PROGRAM_H - -#include - -#include - -#include "Description.h" -#include "ProgramCache.h" - -namespace android { - -class String8; - -/* - * Abstracts a GLSL program comprising a vertex and fragment shader - */ -class Program { -public: - // known locations for position and texture coordinates - enum { position=0, texCoords=1 }; - - Program(const ProgramCache::Key& needs, const char* vertex, const char* fragment); - ~Program(); - - /* whether this object is usable */ - bool isValid() const; - - /* Binds this program to the GLES context */ - void use(); - - /* Returns the location of the specified attribute */ - GLuint getAttrib(const char* name) const; - - /* Returns the location of the specified uniform */ - GLint getUniform(const char* name) const; - - /* set-up uniforms from the description */ - void setUniforms(const Description& desc); - - -private: - GLuint buildShader(const char* source, GLenum type); - String8& dumpShader(String8& result, GLenum type); - - // whether the initialization succeeded - bool mInitialized; - - // Name of the OpenGL program and shaders - GLuint mProgram; - GLuint mVertexShader; - GLuint mFragmentShader; - - /* location of the projection matrix uniform */ - GLint mProjectionMatrixLoc; - - /* location of the color matrix uniform */ - GLint mColorMatrixLoc; - - /* location of the texture matrix uniform */ - GLint mTextureMatrixLoc; - - /* location of the sampler uniform */ - GLint mSamplerLoc; - - /* location of the alpha plane uniform */ - GLint mAlphaPlaneLoc; - - /* location of the color uniform */ - GLint mColorLoc; -}; - - -} /* namespace android */ - -#endif /* SF_RENDER_ENGINE_PROGRAM_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/RenderEngine.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/RenderEngine.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/RenderEngine.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/RenderEngine.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,441 +0,0 @@ -/* - * Copyright 2013 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 -#include -#include - -#include "RenderEngine.h" -#include "GLES10RenderEngine.h" -#include "GLES11RenderEngine.h" -#include "GLES20RenderEngine.h" -#include "GLExtensions.h" -#include "Mesh.h" - -EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -static bool findExtension(const char* exts, const char* name) { - if (!exts) - return false; - size_t len = strlen(name); - - const char* pos = exts; - while ((pos = strstr(pos, name)) != NULL) { - if (pos[len] == '\0' || pos[len] == ' ') - return true; - pos += len; - } - - return false; -} - -RenderEngine* RenderEngine::create(EGLDisplay display, int hwcFormat) { - // EGL_ANDROIDX_no_config_context is an experimental extension with no - // written specification. It will be replaced by something more formal. - // SurfaceFlinger is using it to allow a single EGLContext to render to - // both a 16-bit primary display framebuffer and a 32-bit virtual display - // framebuffer. - // - // The code assumes that ES2 or later is available if this extension is - // supported. - EGLConfig config = EGL_NO_CONFIG; - if (!findExtension( - eglQueryStringImplementationANDROID(display, EGL_EXTENSIONS), - "EGL_ANDROIDX_no_config_context")) { - config = chooseEglConfig(display, hwcFormat); - } - - EGLint renderableType = 0; - if (config == EGL_NO_CONFIG) { - renderableType = EGL_OPENGL_ES2_BIT; - } else if (!eglGetConfigAttrib(display, config, - EGL_RENDERABLE_TYPE, &renderableType)) { - LOG_ALWAYS_FATAL("can't query EGLConfig RENDERABLE_TYPE"); - } - EGLint contextClientVersion = 0; - if (renderableType & EGL_OPENGL_ES2_BIT) { - contextClientVersion = 2; - } else if (renderableType & EGL_OPENGL_ES_BIT) { - contextClientVersion = 1; - } else { - LOG_ALWAYS_FATAL("no supported EGL_RENDERABLE_TYPEs"); - } - - // Also create our EGLContext - EGLint contextAttributes[] = { - EGL_CONTEXT_CLIENT_VERSION, contextClientVersion, // MUST be first -#ifdef EGL_IMG_context_priority -#ifdef HAS_CONTEXT_PRIORITY -#warning "using EGL_IMG_context_priority" - EGL_CONTEXT_PRIORITY_LEVEL_IMG, EGL_CONTEXT_PRIORITY_HIGH_IMG, -#endif -#endif - EGL_NONE, EGL_NONE - }; - EGLContext ctxt = eglCreateContext(display, config, NULL, contextAttributes); - - // if can't create a GL context, we can only abort. - LOG_ALWAYS_FATAL_IF(ctxt==EGL_NO_CONTEXT, "EGLContext creation failed"); - - - // now figure out what version of GL did we actually get - // NOTE: a dummy surface is not needed if KHR_create_context is supported - - EGLConfig dummyConfig = config; - if (dummyConfig == EGL_NO_CONFIG) { - dummyConfig = chooseEglConfig(display, hwcFormat); - } - EGLint attribs[] = { EGL_WIDTH, 1, EGL_HEIGHT, 1, EGL_NONE, EGL_NONE }; - EGLSurface dummy = eglCreatePbufferSurface(display, dummyConfig, attribs); - LOG_ALWAYS_FATAL_IF(dummy==EGL_NO_SURFACE, "can't create dummy pbuffer"); - EGLBoolean success = eglMakeCurrent(display, dummy, dummy, ctxt); - LOG_ALWAYS_FATAL_IF(!success, "can't make dummy pbuffer current"); - - GLExtensions& extensions(GLExtensions::getInstance()); - extensions.initWithGLStrings( - glGetString(GL_VENDOR), - glGetString(GL_RENDERER), - glGetString(GL_VERSION), - glGetString(GL_EXTENSIONS)); - - GlesVersion version = parseGlesVersion( extensions.getVersion() ); - - // initialize the renderer while GL is current - - RenderEngine* engine = NULL; - switch (version) { - case GLES_VERSION_1_0: - engine = new GLES10RenderEngine(); - break; - case GLES_VERSION_1_1: - engine = new GLES11RenderEngine(); - break; - case GLES_VERSION_2_0: - case GLES_VERSION_3_0: - engine = new GLES20RenderEngine(); - break; - } - engine->setEGLHandles(config, ctxt); - - ALOGI("OpenGL ES informations:"); - ALOGI("vendor : %s", extensions.getVendor()); - ALOGI("renderer : %s", extensions.getRenderer()); - ALOGI("version : %s", extensions.getVersion()); - ALOGI("extensions: %s", extensions.getExtension()); - ALOGI("GL_MAX_TEXTURE_SIZE = %zu", engine->getMaxTextureSize()); - ALOGI("GL_MAX_VIEWPORT_DIMS = %zu", engine->getMaxViewportDims()); - - eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglDestroySurface(display, dummy); - - return engine; -} - -RenderEngine::RenderEngine() : mEGLContext(EGL_NO_CONTEXT) { -} - -RenderEngine::~RenderEngine() { -} - -void RenderEngine::setEGLHandles(EGLConfig config, EGLContext ctxt) { - mEGLConfig = config; - mEGLContext = ctxt; -} - -EGLContext RenderEngine::getEGLConfig() const { - return mEGLConfig; -} - -EGLContext RenderEngine::getEGLContext() const { - return mEGLContext; -} - -void RenderEngine::checkErrors() const { - do { - // there could be more than one error flag - GLenum error = glGetError(); - if (error == GL_NO_ERROR) - break; - ALOGE("GL error 0x%04x", int(error)); - } while (true); -} - -RenderEngine::GlesVersion RenderEngine::parseGlesVersion(const char* str) { - int major, minor; - if (sscanf(str, "OpenGL ES-CM %d.%d", &major, &minor) != 2) { - if (sscanf(str, "OpenGL ES %d.%d", &major, &minor) != 2) { - ALOGW("Unable to parse GL_VERSION string: \"%s\"", str); - return GLES_VERSION_1_0; - } - } - - if (major == 1 && minor == 0) return GLES_VERSION_1_0; - if (major == 1 && minor >= 1) return GLES_VERSION_1_1; - if (major == 2 && minor >= 0) return GLES_VERSION_2_0; - if (major == 3 && minor >= 0) return GLES_VERSION_3_0; - - ALOGW("Unrecognized OpenGL ES version: %d.%d", major, minor); - return GLES_VERSION_1_0; -} - -void RenderEngine::fillRegionWithColor(const Region& region, uint32_t height, - float red, float green, float blue, float alpha) { - size_t c; - Rect const* r = region.getArray(&c); - Mesh mesh(Mesh::TRIANGLES, c*6, 2); - Mesh::VertexArray position(mesh.getPositionArray()); - for (size_t i=0 ; ileft; - position[i*6 + 0].y = height - r->top; - position[i*6 + 1].x = r->left; - position[i*6 + 1].y = height - r->bottom; - position[i*6 + 2].x = r->right; - position[i*6 + 2].y = height - r->bottom; - position[i*6 + 3].x = r->left; - position[i*6 + 3].y = height - r->top; - position[i*6 + 4].x = r->right; - position[i*6 + 4].y = height - r->bottom; - position[i*6 + 5].x = r->right; - position[i*6 + 5].y = height - r->top; - } - setupFillWithColor(red, green, blue, alpha); - drawMesh(mesh); -} - -void RenderEngine::flush() { - glFlush(); -} - -void RenderEngine::clearWithColor(float red, float green, float blue, float alpha) { - glClearColor(red, green, blue, alpha); - glClear(GL_COLOR_BUFFER_BIT); -} - -void RenderEngine::setScissor( - uint32_t left, uint32_t bottom, uint32_t right, uint32_t top) { - glScissor(left, bottom, right, top); - glEnable(GL_SCISSOR_TEST); -} - -void RenderEngine::disableScissor() { - glDisable(GL_SCISSOR_TEST); -} - -void RenderEngine::genTextures(size_t count, uint32_t* names) { - glGenTextures(count, names); -} - -void RenderEngine::deleteTextures(size_t count, uint32_t const* names) { - glDeleteTextures(count, names); -} - -void RenderEngine::readPixels(size_t l, size_t b, size_t w, size_t h, uint32_t* pixels) { - glReadPixels(l, b, w, h, GL_RGBA, GL_UNSIGNED_BYTE, pixels); -} - -void RenderEngine::dump(String8& result) { - const GLExtensions& extensions(GLExtensions::getInstance()); - result.appendFormat("GLES: %s, %s, %s\n", - extensions.getVendor(), - extensions.getRenderer(), - extensions.getVersion()); - result.appendFormat("%s\n", extensions.getExtension()); -} - -// --------------------------------------------------------------------------- - -RenderEngine::BindImageAsFramebuffer::BindImageAsFramebuffer( - RenderEngine& engine, EGLImageKHR image) : mEngine(engine) -{ - mEngine.bindImageAsFramebuffer(image, &mTexName, &mFbName, &mStatus); - - ALOGE_IF(mStatus != GL_FRAMEBUFFER_COMPLETE_OES, - "glCheckFramebufferStatusOES error %d", mStatus); -} - -RenderEngine::BindImageAsFramebuffer::~BindImageAsFramebuffer() { - // back to main framebuffer - mEngine.unbindFramebuffer(mTexName, mFbName); -} - -status_t RenderEngine::BindImageAsFramebuffer::getStatus() const { - return mStatus == GL_FRAMEBUFFER_COMPLETE_OES ? NO_ERROR : BAD_VALUE; -} - -// --------------------------------------------------------------------------- - -static status_t selectConfigForAttribute(EGLDisplay dpy, EGLint const* attrs, - EGLint attribute, EGLint wanted, EGLConfig* outConfig) { - EGLint numConfigs = -1, n = 0; - eglGetConfigs(dpy, NULL, 0, &numConfigs); - EGLConfig* const configs = new EGLConfig[numConfigs]; - eglChooseConfig(dpy, attrs, configs, numConfigs, &n); - - if (n) { - if (attribute != EGL_NONE) { - for (int i=0 ; i mList; - struct Attribute { - Attribute() {}; - Attribute(EGLint v) : v(v) { } - EGLint v; - bool operator < (const Attribute& other) const { - // this places EGL_NONE at the end - EGLint lhs(v); - EGLint rhs(other.v); - if (lhs == EGL_NONE) lhs = 0x7FFFFFFF; - if (rhs == EGL_NONE) rhs = 0x7FFFFFFF; - return lhs < rhs; - } - }; - class Adder { - friend class EGLAttributeVector; - EGLAttributeVector& v; - EGLint attribute; - Adder(EGLAttributeVector& v, EGLint attribute) - : v(v), attribute(attribute) { - } - public: - void operator = (EGLint value) { - if (attribute != EGL_NONE) { - v.mList.add(attribute, value); - } - } - operator EGLint () const { return v.mList[attribute]; } - }; -public: - EGLAttributeVector() { - mList.add(EGL_NONE, EGL_NONE); - } - void remove(EGLint attribute) { - if (attribute != EGL_NONE) { - mList.removeItem(attribute); - } - } - Adder operator [] (EGLint attribute) { - return Adder(*this, attribute); - } - EGLint operator [] (EGLint attribute) const { - return mList[attribute]; - } - // cast-operator to (EGLint const*) - operator EGLint const* () const { return &mList.keyAt(0).v; } -}; - - -static status_t selectEGLConfig(EGLDisplay display, EGLint format, - EGLint renderableType, EGLConfig* config) { - // select our EGLConfig. It must support EGL_RECORDABLE_ANDROID if - // it is to be used with WIFI displays - status_t err; - EGLint wantedAttribute; - EGLint wantedAttributeValue; - - EGLAttributeVector attribs; - if (renderableType) { - attribs[EGL_RENDERABLE_TYPE] = renderableType; - attribs[EGL_RECORDABLE_ANDROID] = EGL_TRUE; - attribs[EGL_SURFACE_TYPE] = EGL_WINDOW_BIT|EGL_PBUFFER_BIT; - attribs[EGL_FRAMEBUFFER_TARGET_ANDROID] = EGL_TRUE; - attribs[EGL_RED_SIZE] = 8; - attribs[EGL_GREEN_SIZE] = 8; - attribs[EGL_BLUE_SIZE] = 8; - wantedAttribute = EGL_NONE; - wantedAttributeValue = EGL_NONE; - } else { - // if no renderable type specified, fallback to a simplified query - wantedAttribute = EGL_NATIVE_VISUAL_ID; - wantedAttributeValue = format; - } - - err = selectConfigForAttribute(display, attribs, - wantedAttribute, wantedAttributeValue, config); - if (err == NO_ERROR) { - EGLint caveat; - if (eglGetConfigAttrib(display, *config, EGL_CONFIG_CAVEAT, &caveat)) - ALOGW_IF(caveat == EGL_SLOW_CONFIG, "EGL_SLOW_CONFIG selected!"); - } - - return err; -} - -EGLConfig RenderEngine::chooseEglConfig(EGLDisplay display, int format) { - status_t err; - EGLConfig config; - - // First try to get an ES2 config - err = selectEGLConfig(display, format, EGL_OPENGL_ES2_BIT, &config); - if (err != NO_ERROR) { - // If ES2 fails, try ES1 - err = selectEGLConfig(display, format, EGL_OPENGL_ES_BIT, &config); - if (err != NO_ERROR) { - // still didn't work, probably because we're on the emulator... - // try a simplified query - ALOGW("no suitable EGLConfig found, trying a simpler query"); - err = selectEGLConfig(display, format, 0, &config); - if (err != NO_ERROR) { - // this EGL is too lame for android - LOG_ALWAYS_FATAL("no suitable EGLConfig found, giving up"); - } - } - } - - // print some debugging info - EGLint r,g,b,a; - eglGetConfigAttrib(display, config, EGL_RED_SIZE, &r); - eglGetConfigAttrib(display, config, EGL_GREEN_SIZE, &g); - eglGetConfigAttrib(display, config, EGL_BLUE_SIZE, &b); - eglGetConfigAttrib(display, config, EGL_ALPHA_SIZE, &a); - ALOGI("EGL information:"); - ALOGI("vendor : %s", eglQueryString(display, EGL_VENDOR)); - ALOGI("version : %s", eglQueryString(display, EGL_VERSION)); - ALOGI("extensions: %s", eglQueryString(display, EGL_EXTENSIONS)); - ALOGI("Client API: %s", eglQueryString(display, EGL_CLIENT_APIS)?:"Not Supported"); - ALOGI("EGLSurface: %d-%d-%d-%d, config=%p", r, g, b, a, config); - - return config; -} - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/RenderEngine.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/RenderEngine.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/RenderEngine.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/RenderEngine.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,124 +0,0 @@ -/* - * Copyright 2013 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. - */ - - -#ifndef SF_RENDERENGINE_H_ -#define SF_RENDERENGINE_H_ - -#include -#include - -#include -#include -#include -#include - -#define EGL_NO_CONFIG ((EGLConfig)0) - -// --------------------------------------------------------------------------- -namespace android { -// --------------------------------------------------------------------------- - -class String8; -class Rect; -class Region; -class Mesh; -class Texture; - -class RenderEngine { - enum GlesVersion { - GLES_VERSION_1_0 = 0x10000, - GLES_VERSION_1_1 = 0x10001, - GLES_VERSION_2_0 = 0x20000, - GLES_VERSION_3_0 = 0x30000, - }; - static GlesVersion parseGlesVersion(const char* str); - - EGLConfig mEGLConfig; - EGLContext mEGLContext; - void setEGLHandles(EGLConfig config, EGLContext ctxt); - - virtual void bindImageAsFramebuffer(EGLImageKHR image, uint32_t* texName, uint32_t* fbName, uint32_t* status) = 0; - virtual void unbindFramebuffer(uint32_t texName, uint32_t fbName) = 0; - -protected: - RenderEngine(); - virtual ~RenderEngine() = 0; - -public: - static RenderEngine* create(EGLDisplay display, int hwcFormat); - - static EGLConfig chooseEglConfig(EGLDisplay display, int format); - - // dump the extension strings. always call the base class. - virtual void dump(String8& result); - - // helpers - void flush(); - void clearWithColor(float red, float green, float blue, float alpha); - void fillRegionWithColor(const Region& region, uint32_t height, - float red, float green, float blue, float alpha); - - // common to all GL versions - void setScissor(uint32_t left, uint32_t bottom, uint32_t right, uint32_t top); - void disableScissor(); - void genTextures(size_t count, uint32_t* names); - void deleteTextures(size_t count, uint32_t const* names); - void readPixels(size_t l, size_t b, size_t w, size_t h, uint32_t* pixels); - - class BindImageAsFramebuffer { - RenderEngine& mEngine; - uint32_t mTexName, mFbName; - uint32_t mStatus; - public: - BindImageAsFramebuffer(RenderEngine& engine, EGLImageKHR image); - ~BindImageAsFramebuffer(); - int getStatus() const; - }; - - // set-up - virtual void checkErrors() const; - virtual void setViewportAndProjection(size_t vpw, size_t vph, - Rect sourceCrop, size_t hwh, bool yswap, Transform::orientation_flags rotation) = 0; - virtual void setupLayerBlending(bool premultipliedAlpha, bool opaque, int alpha) = 0; - virtual void setupDimLayerBlending(int alpha) = 0; - virtual void setupLayerTexturing(const Texture& texture) = 0; - virtual void setupLayerBlackedOut() = 0; - virtual void setupFillWithColor(float r, float g, float b, float a) = 0; - - virtual mat4 setupColorTransform(const mat4& /* colorTransform */) { - return mat4(); - } - - virtual void disableTexturing() = 0; - virtual void disableBlending() = 0; - - // drawing - virtual void drawMesh(const Mesh& mesh) = 0; - - // queries - virtual size_t getMaxTextureSize() const = 0; - virtual size_t getMaxViewportDims() const = 0; - - EGLConfig getEGLConfig() const; - EGLContext getEGLContext() const; -}; - -// --------------------------------------------------------------------------- -}; // namespace android -// --------------------------------------------------------------------------- - -#endif /* SF_RENDERENGINE_H_ */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Texture.cpp android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Texture.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Texture.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Texture.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,79 +0,0 @@ -/* - * Copyright 2013 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 - -#include "Texture.h" - -namespace android { - -Texture::Texture() : - mTextureName(0), mTextureTarget(TEXTURE_2D), - mWidth(0), mHeight(0), mFiltering(false) { -} - -Texture::Texture(Target textureTarget, uint32_t textureName) : - mTextureName(textureName), mTextureTarget(textureTarget), - mWidth(0), mHeight(0), mFiltering(false) { -} - -void Texture::init(Target textureTarget, uint32_t textureName) { - mTextureName = textureName; - mTextureTarget = textureTarget; -} - -Texture::~Texture() { -} - - -void Texture::setMatrix(float const* matrix) { - mTextureMatrix = mat4(matrix); -} - -void Texture::setFiltering(bool enabled) { - mFiltering = enabled; -} - -void Texture::setDimensions(size_t width, size_t height) { - mWidth = width; - mHeight = height; -} - -uint32_t Texture::getTextureName() const { - return mTextureName; -} - -uint32_t Texture::getTextureTarget() const { - return mTextureTarget; -} - -const mat4& Texture::getMatrix() const { - return mTextureMatrix; -} - -bool Texture::getFiltering() const { - return mFiltering; -} - -size_t Texture::getWidth() const { - return mWidth; -} - -size_t Texture::getHeight() const { - return mHeight; -} - -} /* namespace android */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Texture.h android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Texture.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/RenderEngine/Texture.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/RenderEngine/Texture.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,56 +0,0 @@ -/* - * Copyright 2013 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 -#include - -#ifndef SF_RENDER_ENGINE_TEXTURE_H -#define SF_RENDER_ENGINE_TEXTURE_H - -namespace android { - -class Texture { - uint32_t mTextureName; - uint32_t mTextureTarget; - size_t mWidth; - size_t mHeight; - bool mFiltering; - mat4 mTextureMatrix; - -public: - enum Target { TEXTURE_2D = 0x0DE1, TEXTURE_EXTERNAL = 0x8D65 }; - - Texture(); - Texture(Target textureTarget, uint32_t textureName); - ~Texture(); - - void init(Target textureTarget, uint32_t textureName); - - void setMatrix(float const* matrix); - void setFiltering(bool enabled); - void setDimensions(size_t width, size_t height); - - uint32_t getTextureName() const; - uint32_t getTextureTarget() const; - - const mat4& getMatrix() const; - bool getFiltering() const; - size_t getWidth() const; - size_t getHeight() const; -}; - -} /* namespace android */ -#endif /* SF_RENDER_ENGINE_TEXTURE_H */ diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlingerConsumer.cpp android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlingerConsumer.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlingerConsumer.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlingerConsumer.cpp 1970-01-01 00:00:00.000000000 +0000 @@ -1,200 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#define ATRACE_TAG ATRACE_TAG_GRAPHICS -//#define LOG_NDEBUG 0 - -#include "SurfaceFlingerConsumer.h" - -#include - -#include - -#include -#include -#include - -namespace android { - -// --------------------------------------------------------------------------- - -status_t SurfaceFlingerConsumer::updateTexImage(BufferRejecter* rejecter, - const DispSync& dispSync, uint64_t maxFrameNumber) -{ - ATRACE_CALL(); - ALOGV("updateTexImage"); - Mutex::Autolock lock(mMutex); - - if (mAbandoned) { - ALOGE("updateTexImage: GLConsumer is abandoned!"); - return NO_INIT; - } - - // Make sure the EGL state is the same as in previous calls. - status_t err = checkAndUpdateEglStateLocked(); - if (err != NO_ERROR) { - return err; - } - - BufferItem item; - - // Acquire the next buffer. - // In asynchronous mode the list is guaranteed to be one buffer - // deep, while in synchronous mode we use the oldest buffer. - err = acquireBufferLocked(&item, computeExpectedPresent(dispSync), - maxFrameNumber); - if (err != NO_ERROR) { - if (err == BufferQueue::NO_BUFFER_AVAILABLE) { - err = NO_ERROR; - } else if (err == BufferQueue::PRESENT_LATER) { - // return the error, without logging - } else { - ALOGE("updateTexImage: acquire failed: %s (%d)", - strerror(-err), err); - } - return err; - } - - - // We call the rejecter here, in case the caller has a reason to - // not accept this buffer. This is used by SurfaceFlinger to - // reject buffers which have the wrong size - int buf = item.mBuf; - if (rejecter && rejecter->reject(mSlots[buf].mGraphicBuffer, item)) { - releaseBufferLocked(buf, mSlots[buf].mGraphicBuffer, EGL_NO_SYNC_KHR); - return BUFFER_REJECTED; - } - - // Release the previous buffer. - err = updateAndReleaseLocked(item); - if (err != NO_ERROR) { - return err; - } - - if (!SyncFeatures::getInstance().useNativeFenceSync()) { - // Bind the new buffer to the GL texture. - // - // Older devices require the "implicit" synchronization provided - // by glEGLImageTargetTexture2DOES, which this method calls. Newer - // devices will either call this in Layer::onDraw, or (if it's not - // a GL-composited layer) not at all. - err = bindTextureImageLocked(); - } - - return err; -} - -status_t SurfaceFlingerConsumer::bindTextureImage() -{ - Mutex::Autolock lock(mMutex); - - return bindTextureImageLocked(); -} - -status_t SurfaceFlingerConsumer::acquireBufferLocked(BufferItem* item, - nsecs_t presentWhen, uint64_t maxFrameNumber) { - status_t result = GLConsumer::acquireBufferLocked(item, presentWhen, - maxFrameNumber); - if (result == NO_ERROR) { - mTransformToDisplayInverse = item->mTransformToDisplayInverse; - mSurfaceDamage = item->mSurfaceDamage; - } - return result; -} - -bool SurfaceFlingerConsumer::getTransformToDisplayInverse() const { - return mTransformToDisplayInverse; -} - -const Region& SurfaceFlingerConsumer::getSurfaceDamage() const { - return mSurfaceDamage; -} - -sp SurfaceFlingerConsumer::getSidebandStream() const { - return mConsumer->getSidebandStream(); -} - -// We need to determine the time when a buffer acquired now will be -// displayed. This can be calculated: -// time when previous buffer's actual-present fence was signaled -// + current display refresh rate * HWC latency -// + a little extra padding -// -// Buffer producers are expected to set their desired presentation time -// based on choreographer time stamps, which (coming from vsync events) -// will be slightly later then the actual-present timing. If we get a -// desired-present time that is unintentionally a hair after the next -// vsync, we'll hold the frame when we really want to display it. We -// need to take the offset between actual-present and reported-vsync -// into account. -// -// If the system is configured without a DispSync phase offset for the app, -// we also want to throw in a bit of padding to avoid edge cases where we -// just barely miss. We want to do it here, not in every app. A major -// source of trouble is the app's use of the display's ideal refresh time -// (via Display.getRefreshRate()), which could be off of the actual refresh -// by a few percent, with the error multiplied by the number of frames -// between now and when the buffer should be displayed. -// -// If the refresh reported to the app has a phase offset, we shouldn't need -// to tweak anything here. -nsecs_t SurfaceFlingerConsumer::computeExpectedPresent(const DispSync& dispSync) -{ - // The HWC doesn't currently have a way to report additional latency. - // Assume that whatever we submit now will appear right after the flip. - // For a smart panel this might be 1. This is expressed in frames, - // rather than time, because we expect to have a constant frame delay - // regardless of the refresh rate. - const uint32_t hwcLatency = 0; - - // Ask DispSync when the next refresh will be (CLOCK_MONOTONIC). - const nsecs_t nextRefresh = dispSync.computeNextRefresh(hwcLatency); - - // The DispSync time is already adjusted for the difference between - // vsync and reported-vsync (PRESENT_TIME_OFFSET_FROM_VSYNC_NS), so - // we don't need to factor that in here. Pad a little to avoid - // weird effects if apps might be requesting times right on the edge. - nsecs_t extraPadding = 0; - if (VSYNC_EVENT_PHASE_OFFSET_NS == 0) { - extraPadding = 1000000; // 1ms (6% of 60Hz) - } - - return nextRefresh + extraPadding; -} - -void SurfaceFlingerConsumer::setContentsChangedListener( - const wp& listener) { - setFrameAvailableListener(listener); - Mutex::Autolock lock(mMutex); - mContentsChangedListener = listener; -} - -void SurfaceFlingerConsumer::onSidebandStreamChanged() { - sp listener; - { // scope for the lock - Mutex::Autolock lock(mMutex); - ALOG_ASSERT(mFrameAvailableListener.unsafe_get() == mContentsChangedListener.unsafe_get()); - listener = mContentsChangedListener.promote(); - } - - if (listener != NULL) { - listener->onSidebandStreamChanged(); - } -} - -// --------------------------------------------------------------------------- -}; // namespace android - diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlingerConsumer.h android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlingerConsumer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlingerConsumer.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlingerConsumer.h 1970-01-01 00:00:00.000000000 +0000 @@ -1,94 +0,0 @@ -/* - * Copyright (C) 2012 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. - */ - -#ifndef ANDROID_SURFACEFLINGERCONSUMER_H -#define ANDROID_SURFACEFLINGERCONSUMER_H - -#include "DispSync.h" -#include - -namespace android { -// ---------------------------------------------------------------------------- - -/* - * This is a thin wrapper around GLConsumer. - */ -class SurfaceFlingerConsumer : public GLConsumer { -public: - static const status_t BUFFER_REJECTED = UNKNOWN_ERROR + 8; - - struct ContentsChangedListener: public FrameAvailableListener { - virtual void onSidebandStreamChanged() = 0; - }; - - SurfaceFlingerConsumer(const sp& consumer, - uint32_t tex) - : GLConsumer(consumer, tex, GLConsumer::TEXTURE_EXTERNAL, false, false), - mTransformToDisplayInverse(false), mSurfaceDamage() - {} - - class BufferRejecter { - friend class SurfaceFlingerConsumer; - virtual bool reject(const sp& buf, - const BufferItem& item) = 0; - - protected: - virtual ~BufferRejecter() { } - }; - - virtual status_t acquireBufferLocked(BufferItem *item, nsecs_t presentWhen, - uint64_t maxFrameNumber = 0) override; - - // This version of updateTexImage() takes a functor that may be used to - // reject the newly acquired buffer. Unlike the GLConsumer version, - // this does not guarantee that the buffer has been bound to the GL - // texture. - status_t updateTexImage(BufferRejecter* rejecter, const DispSync& dispSync, - uint64_t maxFrameNumber = 0); - - // See GLConsumer::bindTextureImageLocked(). - status_t bindTextureImage(); - - // must be called from SF main thread - bool getTransformToDisplayInverse() const; - const Region& getSurfaceDamage() const; - - // Sets the contents changed listener. This should be used instead of - // ConsumerBase::setFrameAvailableListener(). - void setContentsChangedListener(const wp& listener); - - sp getSidebandStream() const; - - nsecs_t computeExpectedPresent(const DispSync& dispSync); - -private: - virtual void onSidebandStreamChanged(); - - wp mContentsChangedListener; - - // Indicates this buffer must be transformed by the inverse transform of the screen - // it is displayed onto. This is applied after GLConsumer::mCurrentTransform. - // This must be set/read from SurfaceFlinger's main thread. - bool mTransformToDisplayInverse; - - // The portion of this surface that has changed since the previous frame - Region mSurfaceDamage; -}; - -// ---------------------------------------------------------------------------- -}; // namespace android - -#endif // ANDROID_SURFACEFLINGERCONSUMER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlinger.cpp android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlinger.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlinger.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlinger.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,15 +16,17 @@ #define ATRACE_TAG ATRACE_TAG_GRAPHICS +#include +#include #include -#include +#include +#include #include #include -#include -#include -#include - -#include +#include +#include +#include +#include #include #include @@ -34,87 +36,39 @@ #include #include -#include -#include - -#include -#include -#include #include -#include -#include - -#include -#include -#include -#include #include #include #include #include -#include -#include +#include +#include + +#include -#include "Client.h" #include "clz.h" -#include "Colorizer.h" #include "DdmConnection.h" -#include "DisplayDevice.h" -#include "DispSync.h" -#include "EventControlThread.h" #include "EventThread.h" +#include "GLExtensions.h" #include "Layer.h" #include "LayerDim.h" +#include "LayerScreenshot.h" #include "SurfaceFlinger.h" -#include "DisplayHardware/FramebufferSurface.h" +#include "DisplayHardware/DisplayHardware.h" #include "DisplayHardware/HWComposer.h" -#include "DisplayHardware/VirtualDisplaySurface.h" -#include "Effects/Daltonizer.h" +#include +#include +#include -#include "RenderEngine/RenderEngine.h" -#include +#define EGL_VERSION_HW_ANDROID 0x3143 #define DISPLAY_COUNT 1 -/* - * DEBUG_SCREENSHOTS: set to true to check that screenshots are not all - * black pixels. - */ -#define DEBUG_SCREENSHOTS false - -EGLAPI const char* eglQueryStringImplementationANDROID(EGLDisplay dpy, EGLint name); - namespace android { - -// This is the phase offset in nanoseconds of the software vsync event -// relative to the vsync event reported by HWComposer. The software vsync -// event is when SurfaceFlinger and Choreographer-based applications run each -// frame. -// -// This phase offset allows adjustment of the minimum latency from application -// wake-up (by Choregographer) time to the time at which the resulting window -// image is displayed. This value may be either positive (after the HW vsync) -// or negative (before the HW vsync). Setting it to 0 will result in a -// minimum latency of two vsync periods because the app and SurfaceFlinger -// will run just after the HW vsync. Setting it to a positive number will -// result in the minimum latency being: -// -// (2 * VSYNC_PERIOD - (vsyncPhaseOffsetNs % VSYNC_PERIOD)) -// -// Note that reducing this latency makes it more likely for the applications -// to not have their window content image ready in time. When this happens -// the latency will end up being an additional vsync period, and animations -// will hiccup. Therefore, this latency should be tuned somewhat -// conservatively (or at least with awareness of the trade-off being made). -static const int64_t vsyncPhaseOffsetNs = VSYNC_EVENT_PHASE_OFFSET_NS; - -// This is the phase offset at which SurfaceFlinger's composition runs. -static const int64_t sfVsyncPhaseOffsetNs = SF_VSYNC_EVENT_PHASE_OFFSET_NS; - // --------------------------------------------------------------------------- const String16 sHardwareTest("android.permission.HARDWARE_TEST"); @@ -125,17 +79,14 @@ // --------------------------------------------------------------------------- SurfaceFlinger::SurfaceFlinger() - : BnSurfaceComposer(), + : BnSurfaceComposer(), Thread(false), mTransactionFlags(0), - mTransactionPending(false), - mAnimTransactionPending(false), + mTransationPending(false), mLayersRemoved(false), - mRepaintEverything(0), - mRenderEngine(NULL), mBootTime(systemTime()), mVisibleRegionsDirty(false), mHwWorkListDirty(false), - mAnimCompositionPending(false), + mElectronBeamAnimationMode(0), mDebugRegion(0), mDebugDDMS(0), mDebugDisableHWC(0), @@ -145,65 +96,66 @@ mDebugInTransaction(0), mLastTransactionTime(0), mBootFinished(false), - mForceFullDamage(false), - mPrimaryHWVsyncEnabled(false), - mHWVsyncAvailable(false), - mDaltonize(false), - mHasColorMatrix(false), - mHasPoweredOff(false), - mFrameBuckets(), - mTotalTime(0), - mLastSwapTime(0) + mSecureFrameBuffer(0) +{ + init(); +} + +void SurfaceFlinger::init() { ALOGI("SurfaceFlinger is starting"); // debugging stuff... char value[PROPERTY_VALUE_MAX]; - property_get("ro.bq.gpu_to_cpu_unsupported", value, "0"); - mGpuToCpuSupported = !atoi(value); - - property_get("debug.sf.drop_missed_frames", value, "0"); - mDropMissedFrames = atoi(value); - property_get("debug.sf.showupdates", value, "0"); mDebugRegion = atoi(value); +#ifdef DDMS_DEBUGGING property_get("debug.sf.ddms", value, "0"); mDebugDDMS = atoi(value); if (mDebugDDMS) { - if (!startDdmConnection()) { - // start failed, and DDMS debugging not enabled - mDebugDDMS = 0; - } + DdmConnection::start(getServiceName()); } - ALOGI_IF(mDebugRegion, "showupdates enabled"); - ALOGI_IF(mDebugDDMS, "DDMS debugging enabled"); +#endif + + ALOGI_IF(mDebugRegion, "showupdates enabled"); + ALOGI_IF(mDebugDDMS, "DDMS debugging enabled"); } void SurfaceFlinger::onFirstRef() { mEventQueue.init(this); + + run("SurfaceFlinger", PRIORITY_URGENT_DISPLAY); + + // Wait for the main thread to be done with its initialization + mReadyToRunBarrier.wait(); } + SurfaceFlinger::~SurfaceFlinger() { - EGLDisplay display = eglGetDisplay(EGL_DEFAULT_DISPLAY); - eglMakeCurrent(display, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - eglTerminate(display); + glDeleteTextures(1, &mWormholeTexName); } -void SurfaceFlinger::binderDied(const wp& /* who */) +void SurfaceFlinger::binderDied(const wp& who) { // the window manager died on us. prepare its eulogy. - // restore initial conditions (default device unblank, etc) - initializeDisplays(); + // reset screen orientation + Vector state; + setTransactionState(state, eOrientationDefault, 0); // restart the boot-animation startBootAnim(); } +sp SurfaceFlinger::getCblk() const +{ + return mServerHeap; +} + sp SurfaceFlinger::createConnection() { sp bclient; @@ -215,75 +167,23 @@ return bclient; } -sp SurfaceFlinger::createDisplay(const String8& displayName, - bool secure) +sp SurfaceFlinger::createGraphicBufferAlloc() { - class DisplayToken : public BBinder { - sp flinger; - virtual ~DisplayToken() { - // no more references, this display must be terminated - Mutex::Autolock _l(flinger->mStateLock); - flinger->mCurrentState.displays.removeItem(this); - flinger->setTransactionFlags(eDisplayTransactionNeeded); - } - public: - DisplayToken(const sp& flinger) - : flinger(flinger) { - } - }; - - sp token = new DisplayToken(this); - - Mutex::Autolock _l(mStateLock); - DisplayDeviceState info(DisplayDevice::DISPLAY_VIRTUAL); - info.displayName = displayName; - info.isSecure = secure; - mCurrentState.displays.add(token, info); - - return token; -} - -void SurfaceFlinger::destroyDisplay(const sp& display) { - Mutex::Autolock _l(mStateLock); - - ssize_t idx = mCurrentState.displays.indexOfKey(display); - if (idx < 0) { - ALOGW("destroyDisplay: invalid display token"); - return; - } - - const DisplayDeviceState& info(mCurrentState.displays.valueAt(idx)); - if (!info.isVirtualDisplay()) { - ALOGE("destroyDisplay called for non-virtual display"); - return; - } - - mCurrentState.displays.removeItemsAt(idx); - setTransactionFlags(eDisplayTransactionNeeded); + sp gba(new GraphicBufferAlloc()); + return gba; } -void SurfaceFlinger::createBuiltinDisplayLocked(DisplayDevice::DisplayType type) { - ALOGW_IF(mBuiltinDisplays[type], - "Overwriting display token for display type %d", type); - mBuiltinDisplays[type] = new BBinder(); - DisplayDeviceState info(type); - // All non-virtual displays are currently considered secure. - info.isSecure = true; - mCurrentState.displays.add(mBuiltinDisplays[type], info); -} - -sp SurfaceFlinger::getBuiltInDisplay(int32_t id) { - if (uint32_t(id) >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) { - ALOGE("getDefaultDisplay: id=%d is not a valid default display id", id); - return NULL; - } - return mBuiltinDisplays[id]; +const GraphicPlane& SurfaceFlinger::graphicPlane(int dpy) const +{ + ALOGE_IF(uint32_t(dpy) >= DISPLAY_COUNT, "Invalid DisplayID %d", dpy); + const GraphicPlane& plane(mGraphicPlanes[dpy]); + return plane; } -sp SurfaceFlinger::createGraphicBufferAlloc() +GraphicPlane& SurfaceFlinger::graphicPlane(int dpy) { - sp gba(new GraphicBufferAlloc()); - return gba; + return const_cast( + const_cast(this)->graphicPlane(dpy)); } void SurfaceFlinger::bootFinished() @@ -297,7 +197,7 @@ const String16 name("window"); sp window(defaultServiceManager()->getService(name)); if (window != 0) { - window->linkToDeath(static_cast(this)); + window->linkToDeath(this); } // stop boot animation @@ -306,226 +206,111 @@ property_set("service.bootanim.exit", "1"); } -void SurfaceFlinger::deleteTextureAsync(uint32_t texture) { - class MessageDestroyGLTexture : public MessageBase { - RenderEngine& engine; - uint32_t texture; - public: - MessageDestroyGLTexture(RenderEngine& engine, uint32_t texture) - : engine(engine), texture(texture) { - } - virtual bool handler() { - engine.deleteTextures(1, &texture); - return true; - } - }; - postMessageAsync(new MessageDestroyGLTexture(getRenderEngine(), texture)); +static inline uint16_t pack565(int r, int g, int b) { + return (r<<11)|(g<<5)|b; } -class DispSyncSource : public VSyncSource, private DispSync::Callback { -public: - DispSyncSource(DispSync* dispSync, nsecs_t phaseOffset, bool traceVsync, - const char* label) : - mValue(0), - mTraceVsync(traceVsync), - mVsyncOnLabel(String8::format("VsyncOn-%s", label)), - mVsyncEventLabel(String8::format("VSYNC-%s", label)), - mDispSync(dispSync), - mCallbackMutex(), - mCallback(), - mVsyncMutex(), - mPhaseOffset(phaseOffset), - mEnabled(false) {} - - virtual ~DispSyncSource() {} - - virtual void setVSyncEnabled(bool enable) { - Mutex::Autolock lock(mVsyncMutex); - if (enable) { - status_t err = mDispSync->addEventListener(mPhaseOffset, - static_cast(this)); - if (err != NO_ERROR) { - ALOGE("error registering vsync callback: %s (%d)", - strerror(-err), err); - } - //ATRACE_INT(mVsyncOnLabel.string(), 1); - } else { - status_t err = mDispSync->removeEventListener( - static_cast(this)); - if (err != NO_ERROR) { - ALOGE("error unregistering vsync callback: %s (%d)", - strerror(-err), err); - } - //ATRACE_INT(mVsyncOnLabel.string(), 0); - } - mEnabled = enable; - } - - virtual void setCallback(const sp& callback) { - Mutex::Autolock lock(mCallbackMutex); - mCallback = callback; - } - - virtual void setPhaseOffset(nsecs_t phaseOffset) { - Mutex::Autolock lock(mVsyncMutex); - - // Normalize phaseOffset to [0, period) - auto period = mDispSync->getPeriod(); - phaseOffset %= period; - if (phaseOffset < 0) { - // If we're here, then phaseOffset is in (-period, 0). After this - // operation, it will be in (0, period) - phaseOffset += period; - } - mPhaseOffset = phaseOffset; - - // If we're not enabled, we don't need to mess with the listeners - if (!mEnabled) { - return; - } - - // Remove the listener with the old offset - status_t err = mDispSync->removeEventListener( - static_cast(this)); - if (err != NO_ERROR) { - ALOGE("error unregistering vsync callback: %s (%d)", - strerror(-err), err); - } - - // Add a listener with the new offset - err = mDispSync->addEventListener(mPhaseOffset, - static_cast(this)); - if (err != NO_ERROR) { - ALOGE("error registering vsync callback: %s (%d)", - strerror(-err), err); - } - } - -private: - virtual void onDispSyncEvent(nsecs_t when) { - sp callback; - { - Mutex::Autolock lock(mCallbackMutex); - callback = mCallback; - - if (mTraceVsync) { - mValue = (mValue + 1) % 2; - ATRACE_INT(mVsyncEventLabel.string(), mValue); - } - } - - if (callback != NULL) { - callback->onVSyncEvent(when); - } - } - - int mValue; - - const bool mTraceVsync; - const String8 mVsyncOnLabel; - const String8 mVsyncEventLabel; - - DispSync* mDispSync; - - Mutex mCallbackMutex; // Protects the following - sp mCallback; - - Mutex mVsyncMutex; // Protects the following - nsecs_t mPhaseOffset; - bool mEnabled; -}; - -void SurfaceFlinger::init() { - ALOGI( "SurfaceFlinger's main thread ready to run. " +status_t SurfaceFlinger::readyToRun() +{ + ALOGI( "SurfaceFlinger's main thread ready to run. " "Initializing graphics H/W..."); - Mutex::Autolock _l(mStateLock); + // we only support one display currently + int dpy = 0; + + { + // initialize the main display + GraphicPlane& plane(graphicPlane(dpy)); + DisplayHardware* const hw = new DisplayHardware(this, dpy); + plane.setDisplayHardware(hw); + } + + // create the shared control-block + mServerHeap = new MemoryHeapBase(4096, + MemoryHeapBase::READ_ONLY, "SurfaceFlinger read-only heap"); + ALOGE_IF(mServerHeap==0, "can't create shared memory dealer"); + + mServerCblk = static_cast(mServerHeap->getBase()); + ALOGE_IF(mServerCblk==0, "can't get to shared control block's address"); + + new(mServerCblk) surface_flinger_cblk_t; + + // initialize primary screen + // (other display should be initialized in the same manner, but + // asynchronously, as they could come and go. None of this is supported + // yet). + const GraphicPlane& plane(graphicPlane(dpy)); + const DisplayHardware& hw = plane.displayHardware(); + const uint32_t w = hw.getWidth(); + const uint32_t h = hw.getHeight(); + const uint32_t f = hw.getFormat(); + hw.makeCurrent(); + + // initialize the shared control block + mServerCblk->connected |= 1<displays + dpy; + memset(dcblk, 0, sizeof(display_cblk_t)); + dcblk->w = plane.getWidth(); + dcblk->h = plane.getHeight(); + dcblk->format = f; + dcblk->orientation = ISurfaceComposer::eOrientationDefault; + dcblk->xdpi = hw.getDpiX(); + dcblk->ydpi = hw.getDpiY(); + dcblk->fps = hw.getRefreshRate(); + dcblk->density = hw.getDensity(); + + // Initialize OpenGL|ES + glPixelStorei(GL_UNPACK_ALIGNMENT, 4); + glPixelStorei(GL_PACK_ALIGNMENT, 4); + glEnableClientState(GL_VERTEX_ARRAY); + glShadeModel(GL_FLAT); + glDisable(GL_DITHER); + glDisable(GL_CULL_FACE); + + const uint16_t g0 = pack565(0x0F,0x1F,0x0F); + const uint16_t g1 = pack565(0x17,0x2f,0x17); + const uint16_t wormholeTexData[4] = { g0, g1, g1, g0 }; + glGenTextures(1, &mWormholeTexName); + glBindTexture(GL_TEXTURE_2D, mWormholeTexName); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 2, 2, 0, + GL_RGB, GL_UNSIGNED_SHORT_5_6_5, wormholeTexData); + + const uint16_t protTexData[] = { pack565(0x03, 0x03, 0x03) }; + glGenTextures(1, &mProtectedTexName); + glBindTexture(GL_TEXTURE_2D, mProtectedTexName); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_REPEAT); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_REPEAT); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, 1, 1, 0, + GL_RGB, GL_UNSIGNED_SHORT_5_6_5, protTexData); + + glViewport(0, 0, w, h); + glMatrixMode(GL_PROJECTION); + glLoadIdentity(); + // put the origin in the left-bottom corner + glOrthof(0, w, 0, h, 0, 1); // l=0, r=w ; b=0, t=h - // initialize EGL for the default display - mEGLDisplay = eglGetDisplay(EGL_DEFAULT_DISPLAY); - eglInitialize(mEGLDisplay, NULL, NULL); // start the EventThread - sp vsyncSrc = new DispSyncSource(&mPrimaryDispSync, - vsyncPhaseOffsetNs, true, "app"); - mEventThread = new EventThread(vsyncSrc); - sp sfVsyncSrc = new DispSyncSource(&mPrimaryDispSync, - sfVsyncPhaseOffsetNs, true, "sf"); - mSFEventThread = new EventThread(sfVsyncSrc); - mEventQueue.setEventThread(mSFEventThread); - - // Initialize the H/W composer object. There may or may not be an - // actual hardware composer underneath. - mHwc = new HWComposer(this, - *static_cast(this)); - - // get a RenderEngine for the given display / config (can't fail) - mRenderEngine = RenderEngine::create(mEGLDisplay, mHwc->getVisualID()); - - // retrieve the EGL context that was selected/created - mEGLContext = mRenderEngine->getEGLContext(); - - LOG_ALWAYS_FATAL_IF(mEGLContext == EGL_NO_CONTEXT, - "couldn't create EGLContext"); - - // initialize our non-virtual displays - for (size_t i=0 ; iisConnected(i) || type==DisplayDevice::DISPLAY_PRIMARY) { - // All non-virtual displays are currently considered secure. - bool isSecure = true; - createBuiltinDisplayLocked(type); - wp token = mBuiltinDisplays[i]; - - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer, - new GraphicBufferAlloc()); - - sp fbs = new FramebufferSurface(*mHwc, i, - consumer); - int32_t hwcId = allocateHwcDisplayId(type); - sp hw = new DisplayDevice(this, - type, hwcId, mHwc->getFormat(hwcId), isSecure, token, - fbs, producer, - mRenderEngine->getEGLConfig()); - if (i > DisplayDevice::DISPLAY_PRIMARY) { - // FIXME: currently we don't get blank/unblank requests - // for displays other than the main display, so we always - // assume a connected display is unblanked. - ALOGD("marking display %zu as acquired/unblanked", i); - hw->setPowerMode(HWC_POWER_MODE_NORMAL); - } - mDisplays.add(token, hw); - } - } - - // make the GLContext current so that we can create textures when creating Layers - // (which may happens before we render something) - getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext); - - mEventControlThread = new EventControlThread(this); - mEventControlThread->run("EventControl", PRIORITY_URGENT_DISPLAY); - - // set a fake vsync period if there is no HWComposer - if (mHwc->initCheck() != NO_ERROR) { - mPrimaryDispSync.setPeriod(16666667); - } + mEventThread = new EventThread(this); + mEventQueue.setEventThread(mEventThread); + hw.startSleepManagement(); - // initialize our drawing state - mDrawingState = mCurrentState; + /* + * We're now ready to accept clients... + */ - // set initial conditions (e.g. unblank default device) - initializeDisplays(); + mReadyToRunBarrier.open(); // start boot animation startBootAnim(); -} -int32_t SurfaceFlinger::allocateHwcDisplayId(DisplayDevice::DisplayType type) { - return (uint32_t(type) < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) ? - type : mHwc->allocateDisplayId(); + return NO_ERROR; } void SurfaceFlinger::startBootAnim() { @@ -534,215 +319,47 @@ property_set("ctl.start", "bootanim"); } -size_t SurfaceFlinger::getMaxTextureSize() const { - return mRenderEngine->getMaxTextureSize(); -} - -size_t SurfaceFlinger::getMaxViewportDims() const { - return mRenderEngine->getMaxViewportDims(); -} - // ---------------------------------------------------------------------------- bool SurfaceFlinger::authenticateSurfaceTexture( - const sp& bufferProducer) const { + const sp& surfaceTexture) const { Mutex::Autolock _l(mStateLock); - sp surfaceTextureBinder(IInterface::asBinder(bufferProducer)); - return mGraphicBufferProducerList.indexOf(surfaceTextureBinder) >= 0; -} - -status_t SurfaceFlinger::getDisplayConfigs(const sp& display, - Vector* configs) { - if ((configs == NULL) || (display.get() == NULL)) { - return BAD_VALUE; - } - - if (!display.get()) - return NAME_NOT_FOUND; + sp surfaceTextureBinder(surfaceTexture->asBinder()); - int32_t type = NAME_NOT_FOUND; - for (int i=0 ; i 0) { - density = atoi(property); + // Check the visible layer list for the ISurface + const LayerVector& currentLayers = mCurrentState.layersSortedByZ; + size_t count = currentLayers.size(); + for (size_t i=0 ; i& layer(currentLayers[i]); + sp lbc(layer->getLayerBaseClient()); + if (lbc != NULL) { + wp lbcBinder = lbc->getSurfaceTextureBinder(); + if (lbcBinder == surfaceTextureBinder) { + return true; } - return density; } - public: - static int getEmuDensity() { - return getDensityFromProperty("qemu.sf.lcd_density"); } - static int getBuildDensity() { - return getDensityFromProperty("ro.sf.lcd_density"); } - }; - - configs->clear(); - - const Vector& hwConfigs = - getHwComposer().getConfigs(type); - for (size_t c = 0; c < hwConfigs.size(); ++c) { - const HWComposer::DisplayConfig& hwConfig = hwConfigs[c]; - DisplayInfo info = DisplayInfo(); - - float xdpi = hwConfig.xdpi; - float ydpi = hwConfig.ydpi; - - if (type == DisplayDevice::DISPLAY_PRIMARY) { - // The density of the device is provided by a build property - float density = Density::getBuildDensity() / 160.0f; - if (density == 0) { - // the build doesn't provide a density -- this is wrong! - // use xdpi instead - ALOGE("ro.sf.lcd_density must be defined as a build property"); - density = xdpi / 160.0f; - } - if (Density::getEmuDensity()) { - // if "qemu.sf.lcd_density" is specified, it overrides everything - xdpi = ydpi = density = Density::getEmuDensity(); - density /= 160.0f; - } - info.density = density; - - // TODO: this needs to go away (currently needed only by webkit) - sp hw(getDefaultDisplayDevice()); - info.orientation = hw->getOrientation(); - } else { - // TODO: where should this value come from? - static const int TV_DENSITY = 213; - info.density = TV_DENSITY / 160.0f; - info.orientation = 0; - } - - info.w = hwConfig.width; - info.h = hwConfig.height; - info.xdpi = xdpi; - info.ydpi = ydpi; - info.fps = float(1e9 / hwConfig.refresh); - info.appVsyncOffset = VSYNC_EVENT_PHASE_OFFSET_NS; - info.colorTransform = hwConfig.colorTransform; - - // This is how far in advance a buffer must be queued for - // presentation at a given time. If you want a buffer to appear - // on the screen at time N, you must submit the buffer before - // (N - presentationDeadline). - // - // Normally it's one full refresh period (to give SF a chance to - // latch the buffer), but this can be reduced by configuring a - // DispSync offset. Any additional delays introduced by the hardware - // composer or panel must be accounted for here. - // - // We add an additional 1ms to allow for processing time and - // differences between the ideal and actual refresh rate. - info.presentationDeadline = - hwConfig.refresh - SF_VSYNC_EVENT_PHASE_OFFSET_NS + 1000000; - - // All non-virtual displays are currently considered secure. - info.secure = true; - - configs->push_back(info); - } - - return NO_ERROR; -} - -status_t SurfaceFlinger::getDisplayStats(const sp& /* display */, - DisplayStatInfo* stats) { - if (stats == NULL) { - return BAD_VALUE; - } - - // FIXME for now we always return stats for the primary display - memset(stats, 0, sizeof(*stats)); - stats->vsyncTime = mPrimaryDispSync.computeNextRefresh(0); - stats->vsyncPeriod = mPrimaryDispSync.getPeriod(); - return NO_ERROR; -} - -int SurfaceFlinger::getActiveConfig(const sp& display) { - sp device(getDisplayDevice(display)); - if (device != NULL) { - return device->getActiveConfig(); - } - return BAD_VALUE; -} - -void SurfaceFlinger::setActiveConfigInternal(const sp& hw, int mode) { - ALOGD("Set active config mode=%d, type=%d flinger=%p", mode, hw->getDisplayType(), - this); - int32_t type = hw->getDisplayType(); - int currentMode = hw->getActiveConfig(); - - if (mode == currentMode) { - ALOGD("Screen type=%d is already mode=%d", hw->getDisplayType(), mode); - return; } - if (type >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) { - ALOGW("Trying to set config for virtual display"); - return; - } - - hw->setActiveConfig(mode); - getHwComposer().setActiveConfig(type, mode); -} - -status_t SurfaceFlinger::setActiveConfig(const sp& display, int mode) { - class MessageSetActiveConfig: public MessageBase { - SurfaceFlinger& mFlinger; - sp mDisplay; - int mMode; - public: - MessageSetActiveConfig(SurfaceFlinger& flinger, const sp& disp, - int mode) : - mFlinger(flinger), mDisplay(disp) { mMode = mode; } - virtual bool handler() { - Vector configs; - mFlinger.getDisplayConfigs(mDisplay, &configs); - if (mMode < 0 || mMode >= static_cast(configs.size())) { - ALOGE("Attempt to set active config = %d for display with %zu configs", - mMode, configs.size()); - } - sp hw(mFlinger.getDisplayDevice(mDisplay)); - if (hw == NULL) { - ALOGE("Attempt to set active config = %d for null display %p", - mMode, mDisplay.get()); - } else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) { - ALOGW("Attempt to set active config = %d for virtual display", - mMode); - } else { - mFlinger.setActiveConfigInternal(hw, mMode); + // Check the layers in the purgatory. This check is here so that if a + // SurfaceTexture gets destroyed before all the clients are done using it, + // the error will not be reported as "surface XYZ is not authenticated", but + // will instead fail later on when the client tries to use the surface, + // which should be reported as "surface XYZ returned an -ENODEV". The + // purgatorized layers are no less authentic than the visible ones, so this + // should not cause any harm. + size_t purgatorySize = mLayerPurgatory.size(); + for (size_t i=0 ; i& layer(mLayerPurgatory.itemAt(i)); + sp lbc(layer->getLayerBaseClient()); + if (lbc != NULL) { + wp lbcBinder = lbc->getSurfaceTextureBinder(); + if (lbcBinder == surfaceTextureBinder) { + return true; } - return true; } - }; - sp msg = new MessageSetActiveConfig(*this, display, mode); - postMessageSync(msg); - return NO_ERROR; -} - -status_t SurfaceFlinger::clearAnimationFrameStats() { - Mutex::Autolock _l(mStateLock); - mAnimFrameTracker.clearStats(); - return NO_ERROR; -} + } -status_t SurfaceFlinger::getAnimationFrameStats(FrameStats* outStats) const { - Mutex::Autolock _l(mStateLock); - mAnimFrameTracker.getStats(outStats); - return NO_ERROR; + return false; } // ---------------------------------------------------------------------------- @@ -770,12 +387,12 @@ } status_t SurfaceFlinger::postMessageAsync(const sp& msg, - nsecs_t reltime, uint32_t /* flags */) { + nsecs_t reltime, uint32_t flags) { return mEventQueue.postMessage(msg, reltime); } status_t SurfaceFlinger::postMessageSync(const sp& msg, - nsecs_t reltime, uint32_t /* flags */) { + nsecs_t reltime, uint32_t flags) { status_t res = mEventQueue.postMessage(msg, reltime); if (res == NO_ERROR) { msg->wait(); @@ -783,556 +400,125 @@ return res; } -void SurfaceFlinger::run() { - do { - waitForEvent(); - } while (true); -} - -void SurfaceFlinger::enableHardwareVsync() { - Mutex::Autolock _l(mHWVsyncLock); - if (!mPrimaryHWVsyncEnabled && mHWVsyncAvailable) { - mPrimaryDispSync.beginResync(); - //eventControl(HWC_DISPLAY_PRIMARY, SurfaceFlinger::EVENT_VSYNC, true); - mEventControlThread->setVsyncEnabled(true); - mPrimaryHWVsyncEnabled = true; - } +bool SurfaceFlinger::threadLoop() +{ + waitForEvent(); + return true; } -void SurfaceFlinger::resyncToHardwareVsync(bool makeAvailable) { - Mutex::Autolock _l(mHWVsyncLock); +void SurfaceFlinger::onMessageReceived(int32_t what) +{ + ATRACE_CALL(); + switch (what) { + case MessageQueue::REFRESH: { +// case MessageQueue::INVALIDATE: { + // if we're in a global transaction, don't do anything. + const uint32_t mask = eTransactionNeeded | eTraversalNeeded; + uint32_t transactionFlags = peekTransactionFlags(mask); + if (CC_UNLIKELY(transactionFlags)) { + handleTransaction(transactionFlags); + } - if (makeAvailable) { - mHWVsyncAvailable = true; - } else if (!mHWVsyncAvailable) { - ALOGE("resyncToHardwareVsync called when HW vsync unavailable"); - return; - } + // post surfaces (if needed) + handlePageFlip(); - const nsecs_t period = - getHwComposer().getRefreshPeriod(HWC_DISPLAY_PRIMARY); +// signalRefresh(); +// +// } break; +// +// case MessageQueue::REFRESH: { - mPrimaryDispSync.reset(); - mPrimaryDispSync.setPeriod(period); + handleRefresh(); - if (!mPrimaryHWVsyncEnabled) { - mPrimaryDispSync.beginResync(); - //eventControl(HWC_DISPLAY_PRIMARY, SurfaceFlinger::EVENT_VSYNC, true); - mEventControlThread->setVsyncEnabled(true); - mPrimaryHWVsyncEnabled = true; - } -} + const DisplayHardware& hw(graphicPlane(0).displayHardware()); -void SurfaceFlinger::disableHardwareVsync(bool makeUnavailable) { - Mutex::Autolock _l(mHWVsyncLock); - if (mPrimaryHWVsyncEnabled) { - //eventControl(HWC_DISPLAY_PRIMARY, SurfaceFlinger::EVENT_VSYNC, false); - mEventControlThread->setVsyncEnabled(false); - mPrimaryDispSync.endResync(); - mPrimaryHWVsyncEnabled = false; - } - if (makeUnavailable) { - mHWVsyncAvailable = false; - } -} +// if (mDirtyRegion.isEmpty()) { +// return; +// } -void SurfaceFlinger::onVSyncReceived(int type, nsecs_t timestamp) { - bool needsHwVsync = false; + if (CC_UNLIKELY(mHwWorkListDirty)) { + // build the h/w work list + handleWorkList(); + } - { // Scope for the lock - Mutex::Autolock _l(mHWVsyncLock); - if (type == 0 && mPrimaryHWVsyncEnabled) { - needsHwVsync = mPrimaryDispSync.addResyncSample(timestamp); - } - } + if (CC_LIKELY(hw.canDraw())) { + // repaint the framebuffer (if needed) + handleRepaint(); + // inform the h/w that we're done compositing + hw.compositionComplete(); + postFramebuffer(); + } else { + // pretend we did the post + hw.compositionComplete(); + } - if (needsHwVsync) { - enableHardwareVsync(); - } else { - disableHardwareVsync(false); + } break; } } -void SurfaceFlinger::onHotplugReceived(int type, bool connected) { - if (mEventThread == NULL) { - // This is a temporary workaround for b/7145521. A non-null pointer - // does not mean EventThread has finished initializing, so this - // is not a correct fix. - ALOGW("WARNING: EventThread not started, ignoring hotplug"); - return; - } +void SurfaceFlinger::postFramebuffer() +{ + ATRACE_CALL(); + // mSwapRegion can be empty here is some cases, for instance if a hidden + // or fully transparent window is updating. + // in that case, we need to flip anyways to not risk a deadlock with + // h/w composer. - if (uint32_t(type) < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) { - Mutex::Autolock _l(mStateLock); - if (connected) { - createBuiltinDisplayLocked((DisplayDevice::DisplayType)type); - } else { - mCurrentState.displays.removeItem(mBuiltinDisplays[type]); - mBuiltinDisplays[type].clear(); - } - setTransactionFlags(eDisplayTransactionNeeded); + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const nsecs_t now = systemTime(); + mDebugInSwapBuffers = now; + hw.flip(mSwapRegion); - // Defer EventThread notification until SF has updated mDisplays. + size_t numLayers = mVisibleLayersSortedByZ.size(); + for (size_t i = 0; i < numLayers; i++) { + mVisibleLayersSortedByZ[i]->onLayerDisplayed(); } -} -void SurfaceFlinger::eventControl(int disp, int event, int enabled) { - ATRACE_CALL(); - getHwComposer().eventControl(disp, event, enabled); + mLastSwapBufferTime = systemTime() - now; + mDebugInSwapBuffers = 0; + mSwapRegion.clear(); } -void SurfaceFlinger::onMessageReceived(int32_t what) { +void SurfaceFlinger::handleTransaction(uint32_t transactionFlags) +{ ATRACE_CALL(); - switch (what) { - case MessageQueue::TRANSACTION: { - handleMessageTransaction(); - break; - } - case MessageQueue::INVALIDATE: { - bool refreshNeeded = handleMessageTransaction(); - refreshNeeded |= handleMessageInvalidate(); - refreshNeeded |= mRepaintEverything; - if (refreshNeeded) { - // Signal a refresh if a transaction modified the window state, - // a new buffer was latched, or if HWC has requested a full - // repaint - signalRefresh(); - } - break; - } - case MessageQueue::REFRESH: { - handleMessageRefresh(); - break; - } - } -} - -bool SurfaceFlinger::handleMessageTransaction() { - uint32_t transactionFlags = peekTransactionFlags(eTransactionMask); - if (transactionFlags) { - handleTransaction(transactionFlags); - return true; - } - return false; -} -bool SurfaceFlinger::handleMessageInvalidate() { - ATRACE_CALL(); - return handlePageFlip(); -} + Mutex::Autolock _l(mStateLock); + const nsecs_t now = systemTime(); + mDebugInTransaction = now; -void SurfaceFlinger::handleMessageRefresh() { - ATRACE_CALL(); + // Here we're guaranteed that some transaction flags are set + // so we can call handleTransactionLocked() unconditionally. + // We call getTransactionFlags(), which will also clear the flags, + // with mStateLock held to guarantee that mCurrentState won't change + // until the transaction is committed. - static nsecs_t previousExpectedPresent = 0; - nsecs_t expectedPresent = mPrimaryDispSync.computeNextRefresh(0); - static bool previousFrameMissed = false; - bool frameMissed = (expectedPresent == previousExpectedPresent); - if (frameMissed != previousFrameMissed) { - ATRACE_INT("FrameMissed", static_cast(frameMissed)); - } - previousFrameMissed = frameMissed; - - if (CC_UNLIKELY(mDropMissedFrames && frameMissed)) { - // Latch buffers, but don't send anything to HWC, then signal another - // wakeup for the next vsync - preComposition(); - repaintEverything(); - } else { - preComposition(); - rebuildLayerStacks(); - setUpHWComposer(); - doDebugFlashRegions(); - doComposition(); - postComposition(); - } + const uint32_t mask = eTransactionNeeded | eTraversalNeeded; + transactionFlags = getTransactionFlags(mask); + handleTransactionLocked(transactionFlags); - previousExpectedPresent = mPrimaryDispSync.computeNextRefresh(0); + mLastTransactionTime = systemTime() - now; + mDebugInTransaction = 0; + invalidateHwcGeometry(); + // here the transaction has been committed } -void SurfaceFlinger::doDebugFlashRegions() +void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) { - // is debugging enabled - if (CC_LIKELY(!mDebugRegion)) - return; + const LayerVector& currentLayers(mCurrentState.layersSortedByZ); + const size_t count = currentLayers.size(); - const bool repaintEverything = mRepaintEverything; - for (size_t dpy=0 ; dpy& hw(mDisplays[dpy]); - if (hw->isDisplayOn()) { - // transform the dirty region into this screen's coordinate space - const Region dirtyRegion(hw->getDirtyRegion(repaintEverything)); - if (!dirtyRegion.isEmpty()) { - // redraw the whole screen - doComposeSurfaces(hw, Region(hw->bounds())); + /* + * Traversal of the children + * (perform the transaction for each of them if needed) + */ - // and draw the dirty region - const int32_t height = hw->getHeight(); - RenderEngine& engine(getRenderEngine()); - engine.fillRegionWithColor(dirtyRegion, height, 1, 0, 1, 1); - - hw->compositionComplete(); - hw->swapBuffers(getHwComposer()); - } - } - } - - postFramebuffer(); - - if (mDebugRegion > 1) { - usleep(mDebugRegion * 1000); - } - - HWComposer& hwc(getHwComposer()); - if (hwc.initCheck() == NO_ERROR) { - status_t err = hwc.prepare(); - ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); - } -} - -void SurfaceFlinger::preComposition() -{ - bool needExtraInvalidate = false; - const LayerVector& layers(mDrawingState.layersSortedByZ); - const size_t count = layers.size(); - for (size_t i=0 ; ionPreComposition()) { - needExtraInvalidate = true; - } - } - if (needExtraInvalidate) { - signalLayerUpdate(); - } -} - -void SurfaceFlinger::postComposition() -{ - const LayerVector& layers(mDrawingState.layersSortedByZ); - const size_t count = layers.size(); - for (size_t i=0 ; ionPostComposition(); - } - - const HWComposer& hwc = getHwComposer(); - sp presentFence = hwc.getDisplayFence(HWC_DISPLAY_PRIMARY); - - if (presentFence->isValid()) { - if (mPrimaryDispSync.addPresentFence(presentFence)) { - enableHardwareVsync(); - } else { - disableHardwareVsync(false); - } - } - - const sp hw(getDefaultDisplayDevice()); - if (kIgnorePresentFences) { - if (hw->isDisplayOn()) { - enableHardwareVsync(); - } - } - - if (mAnimCompositionPending) { - mAnimCompositionPending = false; - - if (presentFence->isValid()) { - mAnimFrameTracker.setActualPresentFence(presentFence); - } else { - // The HWC doesn't support present fences, so use the refresh - // timestamp instead. - nsecs_t presentTime = hwc.getRefreshTimestamp(HWC_DISPLAY_PRIMARY); - mAnimFrameTracker.setActualPresentTime(presentTime); - } - mAnimFrameTracker.advanceFrame(); - } - - if (hw->getPowerMode() == HWC_POWER_MODE_OFF) { - return; - } - - nsecs_t currentTime = systemTime(); - if (mHasPoweredOff) { - mHasPoweredOff = false; - } else { - nsecs_t period = mPrimaryDispSync.getPeriod(); - nsecs_t elapsedTime = currentTime - mLastSwapTime; - size_t numPeriods = static_cast(elapsedTime / period); - if (numPeriods < NUM_BUCKETS - 1) { - mFrameBuckets[numPeriods] += elapsedTime; - } else { - mFrameBuckets[NUM_BUCKETS - 1] += elapsedTime; - } - mTotalTime += elapsedTime; - } - mLastSwapTime = currentTime; -} - -void SurfaceFlinger::rebuildLayerStacks() { - // rebuild the visible layer list per screen - if (CC_UNLIKELY(mVisibleRegionsDirty)) { - ATRACE_CALL(); - mVisibleRegionsDirty = false; - invalidateHwcGeometry(); - - const LayerVector& layers(mDrawingState.layersSortedByZ); - for (size_t dpy=0 ; dpy > layersSortedByZ; - const sp& hw(mDisplays[dpy]); - const Transform& tr(hw->getTransform()); - const Rect bounds(hw->getBounds()); - if (hw->isDisplayOn()) { - SurfaceFlinger::computeVisibleRegions(layers, - hw->getLayerStack(), dirtyRegion, opaqueRegion); - - const size_t count = layers.size(); - for (size_t i=0 ; i& layer(layers[i]); - const Layer::State& s(layer->getDrawingState()); - if (s.layerStack == hw->getLayerStack()) { - Region drawRegion(tr.transform( - layer->visibleNonTransparentRegion)); - drawRegion.andSelf(bounds); - if (!drawRegion.isEmpty()) { - layersSortedByZ.add(layer); - } - } - } - } - hw->setVisibleLayersSortedByZ(layersSortedByZ); - hw->undefinedRegion.set(bounds); - hw->undefinedRegion.subtractSelf(tr.transform(opaqueRegion)); - hw->dirtyRegion.orSelf(dirtyRegion); - } - } -} - -void SurfaceFlinger::setUpHWComposer() { - for (size_t dpy=0 ; dpygetDirtyRegion(false).isEmpty(); - bool empty = mDisplays[dpy]->getVisibleLayersSortedByZ().size() == 0; - bool wasEmpty = !mDisplays[dpy]->lastCompositionHadVisibleLayers; - - // If nothing has changed (!dirty), don't recompose. - // If something changed, but we don't currently have any visible layers, - // and didn't when we last did a composition, then skip it this time. - // The second rule does two things: - // - When all layers are removed from a display, we'll emit one black - // frame, then nothing more until we get new layers. - // - When a display is created with a private layer stack, we won't - // emit any black frames until a layer is added to the layer stack. - bool mustRecompose = dirty && !(empty && wasEmpty); - - ALOGV_IF(mDisplays[dpy]->getDisplayType() == DisplayDevice::DISPLAY_VIRTUAL, - "dpy[%zu]: %s composition (%sdirty %sempty %swasEmpty)", dpy, - mustRecompose ? "doing" : "skipping", - dirty ? "+" : "-", - empty ? "+" : "-", - wasEmpty ? "+" : "-"); - - mDisplays[dpy]->beginFrame(mustRecompose); - - if (mustRecompose) { - mDisplays[dpy]->lastCompositionHadVisibleLayers = !empty; - } - } - - HWComposer& hwc(getHwComposer()); - if (hwc.initCheck() == NO_ERROR) { - // build the h/w work list - if (CC_UNLIKELY(mHwWorkListDirty)) { - mHwWorkListDirty = false; - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - const int32_t id = hw->getHwcDisplayId(); - if (id >= 0) { - const Vector< sp >& currentLayers( - hw->getVisibleLayersSortedByZ()); - const size_t count = currentLayers.size(); - if (hwc.createWorkList(id, count) == NO_ERROR) { - HWComposer::LayerListIterator cur = hwc.begin(id); - const HWComposer::LayerListIterator end = hwc.end(id); - for (size_t i=0 ; cur!=end && i& layer(currentLayers[i]); - layer->setGeometry(hw, *cur); - if (mDebugDisableHWC || mDebugRegion || mDaltonize || mHasColorMatrix) { - cur->setSkip(true); - } - } - } - } - } - } - - // set the per-frame data - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - const int32_t id = hw->getHwcDisplayId(); - if (id >= 0) { - const Vector< sp >& currentLayers( - hw->getVisibleLayersSortedByZ()); - const size_t count = currentLayers.size(); - HWComposer::LayerListIterator cur = hwc.begin(id); - const HWComposer::LayerListIterator end = hwc.end(id); - for (size_t i=0 ; cur!=end && i& layer(currentLayers[i]); - layer->setPerFrameData(hw, *cur); - } - } - } - - // If possible, attempt to use the cursor overlay on each display. - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - const int32_t id = hw->getHwcDisplayId(); - if (id >= 0) { - const Vector< sp >& currentLayers( - hw->getVisibleLayersSortedByZ()); - const size_t count = currentLayers.size(); - HWComposer::LayerListIterator cur = hwc.begin(id); - const HWComposer::LayerListIterator end = hwc.end(id); - for (size_t i=0 ; cur!=end && i& layer(currentLayers[i]); - if (layer->isPotentialCursor()) { - cur->setIsCursorLayerHint(); - break; - } - } - } - } - - status_t err = hwc.prepare(); - ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); - - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - hw->prepareFrame(hwc); - } - } -} - -void SurfaceFlinger::doComposition() { - ATRACE_CALL(); - const bool repaintEverything = android_atomic_and(0, &mRepaintEverything); - for (size_t dpy=0 ; dpy& hw(mDisplays[dpy]); - if (hw->isDisplayOn()) { - // transform the dirty region into this screen's coordinate space - const Region dirtyRegion(hw->getDirtyRegion(repaintEverything)); - - // repaint the framebuffer (if needed) - doDisplayComposition(hw, dirtyRegion); - - hw->dirtyRegion.clear(); - hw->flip(hw->swapRegion); - hw->swapRegion.clear(); - } - // inform the h/w that we're done compositing - hw->compositionComplete(); - } - postFramebuffer(); -} - -void SurfaceFlinger::postFramebuffer() -{ - ATRACE_CALL(); - - const nsecs_t now = systemTime(); - mDebugInSwapBuffers = now; - - HWComposer& hwc(getHwComposer()); - if (hwc.initCheck() == NO_ERROR) { - if (!hwc.supportsFramebufferTarget()) { - // EGL spec says: - // "surface must be bound to the calling thread's current context, - // for the current rendering API." - getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext); - } - hwc.commit(); - } - - // make the default display current because the VirtualDisplayDevice code cannot - // deal with dequeueBuffer() being called outside of the composition loop; however - // the code below can call glFlush() which is allowed (and does in some case) call - // dequeueBuffer(). - getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext); - - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - const Vector< sp >& currentLayers(hw->getVisibleLayersSortedByZ()); - hw->onSwapBuffersCompleted(hwc); - const size_t count = currentLayers.size(); - int32_t id = hw->getHwcDisplayId(); - if (id >=0 && hwc.initCheck() == NO_ERROR) { - HWComposer::LayerListIterator cur = hwc.begin(id); - const HWComposer::LayerListIterator end = hwc.end(id); - for (size_t i = 0; cur != end && i < count; ++i, ++cur) { - currentLayers[i]->onLayerDisplayed(hw, &*cur); - } - } else { - for (size_t i = 0; i < count; i++) { - currentLayers[i]->onLayerDisplayed(hw, NULL); - } - } - } - - mLastSwapBufferTime = systemTime() - now; - mDebugInSwapBuffers = 0; - - uint32_t flipCount = getDefaultDisplayDevice()->getPageFlipCount(); - if (flipCount % LOG_FRAME_STATS_PERIOD == 0) { - logFrameStats(); - } -} - -void SurfaceFlinger::handleTransaction(uint32_t transactionFlags) -{ - ATRACE_CALL(); - - // here we keep a copy of the drawing state (that is the state that's - // going to be overwritten by handleTransactionLocked()) outside of - // mStateLock so that the side-effects of the State assignment - // don't happen with mStateLock held (which can cause deadlocks). - State drawingState(mDrawingState); - - Mutex::Autolock _l(mStateLock); - const nsecs_t now = systemTime(); - mDebugInTransaction = now; - - // Here we're guaranteed that some transaction flags are set - // so we can call handleTransactionLocked() unconditionally. - // We call getTransactionFlags(), which will also clear the flags, - // with mStateLock held to guarantee that mCurrentState won't change - // until the transaction is committed. - - transactionFlags = getTransactionFlags(eTransactionMask); - handleTransactionLocked(transactionFlags); - - mLastTransactionTime = systemTime() - now; - mDebugInTransaction = 0; - invalidateHwcGeometry(); - // here the transaction has been committed -} - -void SurfaceFlinger::handleTransactionLocked(uint32_t transactionFlags) -{ - const LayerVector& currentLayers(mCurrentState.layersSortedByZ); - const size_t count = currentLayers.size(); - - /* - * Traversal of the children - * (perform the transaction for each of them if needed) - */ - - if (transactionFlags & eTraversalNeeded) { - for (size_t i=0 ; i& layer(currentLayers[i]); - uint32_t trFlags = layer->getTransactionFlags(eTransactionNeeded); - if (!trFlags) continue; + const bool layersNeedTransaction = transactionFlags & eTraversalNeeded; + if (layersNeedTransaction) { + for (size_t i=0 ; i& layer = currentLayers[i]; + uint32_t trFlags = layer->getTransactionFlags(eTransactionNeeded); + if (!trFlags) continue; const uint32_t flags = layer->doTransaction(0); if (flags & Layer::eVisibleRegion) @@ -1341,330 +527,79 @@ } /* - * Perform display own transactions if needed + * Perform our own transaction if needed */ - if (transactionFlags & eDisplayTransactionNeeded) { - // here we take advantage of Vector's copy-on-write semantics to - // improve performance by skipping the transaction entirely when - // know that the lists are identical - const KeyedVector< wp, DisplayDeviceState>& curr(mCurrentState.displays); - const KeyedVector< wp, DisplayDeviceState>& draw(mDrawingState.displays); - if (!curr.isIdenticalTo(draw)) { - mVisibleRegionsDirty = true; - const size_t cc = curr.size(); - size_t dc = draw.size(); - - // find the displays that were removed - // (ie: in drawing state but not in current state) - // also handle displays that changed - // (ie: displays that are in both lists) - for (size_t i=0 ; i defaultDisplay(getDefaultDisplayDevice()); - defaultDisplay->makeCurrent(mEGLDisplay, mEGLContext); - sp hw(getDisplayDevice(draw.keyAt(i))); - if (hw != NULL) - hw->disconnect(getHwComposer()); - if (draw[i].type < DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) - mEventThread->onHotplugReceived(draw[i].type, false); - mDisplays.removeItem(draw.keyAt(i)); - } else { - ALOGW("trying to remove the main display"); - } - } else { - // this display is in both lists. see if something changed. - const DisplayDeviceState& state(curr[j]); - const wp& display(curr.keyAt(j)); - const sp state_binder = IInterface::asBinder(state.surface); - const sp draw_binder = IInterface::asBinder(draw[i].surface); - if (state_binder != draw_binder) { - // changing the surface is like destroying and - // recreating the DisplayDevice, so we just remove it - // from the drawing state, so that it get re-added - // below. - sp hw(getDisplayDevice(display)); - if (hw != NULL) - hw->disconnect(getHwComposer()); - mDisplays.removeItem(display); - mDrawingState.displays.removeItemsAt(i); - dc--; i--; - // at this point we must loop to the next item - continue; - } - - const sp disp(getDisplayDevice(display)); - if (disp != NULL) { - if (state.layerStack != draw[i].layerStack) { - disp->setLayerStack(state.layerStack); - } - if ((state.orientation != draw[i].orientation) - || (state.viewport != draw[i].viewport) - || (state.frame != draw[i].frame)) - { - disp->setProjection(state.orientation, - state.viewport, state.frame); - } - if (state.width != draw[i].width || state.height != draw[i].height) { - disp->setDisplaySize(state.width, state.height); - } - } - } - } - - // find displays that were added - // (ie: in current state but not in drawing state) - for (size_t i=0 ; i dispSurface; - sp producer; - sp bqProducer; - sp bqConsumer; - BufferQueue::createBufferQueue(&bqProducer, &bqConsumer, - new GraphicBufferAlloc()); - - int32_t hwcDisplayId = -1; - if (state.isVirtualDisplay()) { - // Virtual displays without a surface are dormant: - // they have external state (layer stack, projection, - // etc.) but no internal state (i.e. a DisplayDevice). - if (state.surface != NULL) { - - int width = 0; - int status = state.surface->query( - NATIVE_WINDOW_WIDTH, &width); - ALOGE_IF(status != NO_ERROR, - "Unable to query width (%d)", status); - int height = 0; - status = state.surface->query( - NATIVE_WINDOW_HEIGHT, &height); - ALOGE_IF(status != NO_ERROR, - "Unable to query height (%d)", status); - if (MAX_VIRTUAL_DISPLAY_DIMENSION == 0 || - (width <= MAX_VIRTUAL_DISPLAY_DIMENSION && - height <= MAX_VIRTUAL_DISPLAY_DIMENSION)) { - hwcDisplayId = allocateHwcDisplayId(state.type); - } - - sp vds = new VirtualDisplaySurface( - *mHwc, hwcDisplayId, state.surface, - bqProducer, bqConsumer, state.displayName); - - dispSurface = vds; - producer = vds; - } - } else { - ALOGE_IF(state.surface!=NULL, - "adding a supported display, but rendering " - "surface is provided (%p), ignoring it", - state.surface.get()); - hwcDisplayId = allocateHwcDisplayId(state.type); - // for supported (by hwc) displays we provide our - // own rendering surface - dispSurface = new FramebufferSurface(*mHwc, state.type, - bqConsumer); - producer = bqProducer; - } + if (transactionFlags & eTransactionNeeded) { + if (mCurrentState.orientation != mDrawingState.orientation) { + // the orientation has changed, recompute all visible regions + // and invalidate everything. + + const int dpy = 0; + const int orientation = mCurrentState.orientation; + // Currently unused: const uint32_t flags = mCurrentState.orientationFlags; + GraphicPlane& plane(graphicPlane(dpy)); + plane.setOrientation(orientation); + + // update the shared control block + const DisplayHardware& hw(plane.displayHardware()); + volatile display_cblk_t* dcblk = mServerCblk->displays + dpy; + dcblk->orientation = orientation; + dcblk->w = plane.getWidth(); + dcblk->h = plane.getHeight(); - const wp& display(curr.keyAt(i)); - if (dispSurface != NULL) { - sp hw = new DisplayDevice(this, - state.type, hwcDisplayId, - mHwc->getFormat(hwcDisplayId), state.isSecure, - display, dispSurface, producer, - mRenderEngine->getEGLConfig()); - hw->setLayerStack(state.layerStack); - hw->setProjection(state.orientation, - state.viewport, state.frame); - hw->setDisplayName(state.displayName); - mDisplays.add(display, hw); - if (state.isVirtualDisplay()) { - if (hwcDisplayId >= 0) { - mHwc->setVirtualDisplayProperties(hwcDisplayId, - hw->getWidth(), hw->getHeight(), - hw->getFormat()); - } - } else { - mEventThread->onHotplugReceived(state.type, true); - } - } - } - } + mVisibleRegionsDirty = true; + mDirtyRegion.set(hw.bounds()); } - } - if (transactionFlags & (eTraversalNeeded|eDisplayTransactionNeeded)) { - // The transform hint might have changed for some layers - // (either because a display has changed, or because a layer - // as changed). - // - // Walk through all the layers in currentLayers, - // and update their transform hint. - // - // If a layer is visible only on a single display, then that - // display is used to calculate the hint, otherwise we use the - // default display. - // - // NOTE: we do this here, rather than in rebuildLayerStacks() so that - // the hint is set before we acquire a buffer from the surface texture. - // - // NOTE: layer transactions have taken place already, so we use their - // drawing state. However, SurfaceFlinger's own transaction has not - // happened yet, so we must use the current state layer list - // (soon to become the drawing state list). - // - sp disp; - uint32_t currentlayerStack = 0; - for (size_t i=0; i& layer(currentLayers[i]); - uint32_t layerStack = layer->getDrawingState().layerStack; - if (i==0 || currentlayerStack != layerStack) { - currentlayerStack = layerStack; - // figure out if this layerstack is mirrored - // (more than one display) if so, pick the default display, - // if not, pick the only display it's on. - disp.clear(); - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - if (hw->getLayerStack() == currentlayerStack) { - if (disp == NULL) { - disp = hw; - } else { - disp = NULL; - break; - } - } - } - } - if (disp == NULL) { - // NOTE: TEMPORARY FIX ONLY. Real fix should cause layers to - // redraw after transform hint changes. See bug 8508397. - - // could be null when this layer is using a layerStack - // that is not visible on any display. Also can occur at - // screen off/on times. - disp = getDefaultDisplayDevice(); - } - layer->updateTransformHint(disp); + if (currentLayers.size() > mDrawingState.layersSortedByZ.size()) { + // layers have been added + mVisibleRegionsDirty = true; } - } - - - /* - * Perform our own transaction if needed - */ - - const LayerVector& layers(mDrawingState.layersSortedByZ); - if (currentLayers.size() > layers.size()) { - // layers have been added - mVisibleRegionsDirty = true; - } - // some layers might have been removed, so - // we need to update the regions they're exposing. - if (mLayersRemoved) { - mLayersRemoved = false; - mVisibleRegionsDirty = true; - const size_t count = layers.size(); - for (size_t i=0 ; i& layer(layers[i]); - if (currentLayers.indexOf(layer) < 0) { - // this layer is not visible anymore - // TODO: we could traverse the tree from front to back and - // compute the actual visible region - // TODO: we could cache the transformed region - const Layer::State& s(layer->getDrawingState()); - Region visibleReg = s.transform.transform( - Region(Rect(s.active.w, s.active.h))); - invalidateLayerStack(s.layerStack, visibleReg); + // some layers might have been removed, so + // we need to update the regions they're exposing. + if (mLayersRemoved) { + mLayersRemoved = false; + mVisibleRegionsDirty = true; + const LayerVector& previousLayers(mDrawingState.layersSortedByZ); + const size_t count = previousLayers.size(); + for (size_t i=0 ; i& layer(previousLayers[i]); + if (currentLayers.indexOf( layer ) < 0) { + // this layer is not visible anymore + mDirtyRegionRemovedLayer.orSelf(layer->visibleRegionScreen); + } } } } commitTransaction(); - - updateCursorAsync(); -} - -void SurfaceFlinger::updateCursorAsync() -{ - HWComposer& hwc(getHwComposer()); - for (size_t dpy=0 ; dpy hw(mDisplays[dpy]); - const int32_t id = hw->getHwcDisplayId(); - if (id < 0) { - continue; - } - const Vector< sp >& currentLayers( - hw->getVisibleLayersSortedByZ()); - const size_t count = currentLayers.size(); - HWComposer::LayerListIterator cur = hwc.begin(id); - const HWComposer::LayerListIterator end = hwc.end(id); - for (size_t i=0 ; cur!=end && igetCompositionType() != HWC_CURSOR_OVERLAY) { - continue; - } - const sp& layer(currentLayers[i]); - Rect cursorPos = layer->getPosition(hw); - hwc.setCursorPositionAsync(id, cursorPos); - break; - } - } -} - -void SurfaceFlinger::commitTransaction() -{ - if (!mLayersPendingRemoval.isEmpty()) { - // Notify removed layers now that they can't be drawn from - for (size_t i = 0; i < mLayersPendingRemoval.size(); i++) { - mLayersPendingRemoval[i]->onRemoved(); - } - mLayersPendingRemoval.clear(); - } - - // If this transaction is part of a window animation then the next frame - // we composite should be considered an animation as well. - mAnimCompositionPending = mAnimTransactionPending; - - mDrawingState = mCurrentState; - mTransactionPending = false; - mAnimTransactionPending = false; - mTransactionCV.broadcast(); } void SurfaceFlinger::computeVisibleRegions( - const LayerVector& currentLayers, uint32_t layerStack, - Region& outDirtyRegion, Region& outOpaqueRegion) + const LayerVector& currentLayers, Region& dirtyRegion, Region& opaqueRegion) { ATRACE_CALL(); + const GraphicPlane& plane(graphicPlane(0)); + const Transform& planeTransform(plane.transform()); + const DisplayHardware& hw(plane.displayHardware()); + const Region screenRegion(hw.bounds()); + Region aboveOpaqueLayers; Region aboveCoveredLayers; Region dirty; - outDirtyRegion.clear(); + bool secureFrameBuffer = false; size_t i = currentLayers.size(); while (i--) { - const sp& layer = currentLayers[i]; + const sp& layer = currentLayers[i]; + layer->validateVisibility(planeTransform); // start with the whole surface at its current location - const Layer::State& s(layer->getDrawingState()); - - // only consider the layers on the given layer stack - if (s.layerStack != layerStack) - continue; + const Layer::State& s(layer->drawingState()); /* * opaqueRegion: area of a surface that is fully opaque. @@ -1697,30 +632,19 @@ // handle hidden surfaces by setting the visible region to empty - if (CC_LIKELY(layer->isVisible())) { - const bool translucent = !layer->isOpaque(s); - Rect bounds(s.transform.transform(layer->computeBounds())); + if (CC_LIKELY(!(s.flags & ISurfaceComposer::eLayerHidden) && s.alpha)) { + const bool translucent = !layer->isOpaque(); + const Rect bounds(layer->visibleBounds()); visibleRegion.set(bounds); + visibleRegion.andSelf(screenRegion); if (!visibleRegion.isEmpty()) { // Remove the transparent area from the visible region if (translucent) { - const Transform tr(s.transform); - if (tr.transformed()) { - if (tr.preserveRects()) { - // transform the transparent region - transparentRegion = tr.transform(s.activeTransparentRegion); - } else { - // transformation too complex, can't do the - // transparent region optimization. - transparentRegion.clear(); - } - } else { - transparentRegion = s.activeTransparentRegion; - } + transparentRegion = layer->transparentRegionScreen; } // compute the opaque region - const int32_t layerOrientation = s.transform.getOrientation(); + const int32_t layerOrientation = layer->getOrientation(); if (s.alpha==255 && !translucent && ((layerOrientation & Transform::ROT_INVALID) == false)) { // the opaque region is the layer's footprint @@ -1743,7 +667,7 @@ // we need to invalidate the whole region dirty = visibleRegion; // as well, as the old visible region - dirty.orSelf(layer->visibleRegion); + dirty.orSelf(layer->visibleRegionScreen); layer->contentDirty = false; } else { /* compute the exposed region: @@ -1759,89 +683,88 @@ * exposed because of a resize. */ const Region newExposed = visibleRegion - coveredRegion; - const Region oldVisibleRegion = layer->visibleRegion; - const Region oldCoveredRegion = layer->coveredRegion; + const Region oldVisibleRegion = layer->visibleRegionScreen; + const Region oldCoveredRegion = layer->coveredRegionScreen; const Region oldExposed = oldVisibleRegion - oldCoveredRegion; dirty = (visibleRegion&oldCoveredRegion) | (newExposed-oldExposed); } dirty.subtractSelf(aboveOpaqueLayers); // accumulate to the screen dirty region - outDirtyRegion.orSelf(dirty); + dirtyRegion.orSelf(dirty); // Update aboveOpaqueLayers for next (lower) layer aboveOpaqueLayers.orSelf(opaqueRegion); - // Store the visible region in screen space + // Store the visible region is screen space layer->setVisibleRegion(visibleRegion); layer->setCoveredRegion(coveredRegion); layer->setVisibleNonTransparentRegion( visibleRegion.subtract(transparentRegion)); + + // If a secure layer is partially visible, lock-down the screen! + if (layer->isSecure() && !visibleRegion.isEmpty()) { + secureFrameBuffer = true; + } } - outOpaqueRegion = aboveOpaqueLayers; + // invalidate the areas where a layer was removed + dirtyRegion.orSelf(mDirtyRegionRemovedLayer); + mDirtyRegionRemovedLayer.clear(); + + mSecureFrameBuffer = secureFrameBuffer; + opaqueRegion = aboveOpaqueLayers; } -void SurfaceFlinger::invalidateLayerStack(uint32_t layerStack, - const Region& dirty) { - for (size_t dpy=0 ; dpy& hw(mDisplays[dpy]); - if (hw->getLayerStack() == layerStack) { - hw->dirtyRegion.orSelf(dirty); + +void SurfaceFlinger::commitTransaction() +{ + if (!mLayersPendingRemoval.isEmpty()) { + // Notify removed layers now that they can't be drawn from + for (size_t i = 0; i < mLayersPendingRemoval.size(); i++) { + mLayersPendingRemoval[i]->onRemoved(); } + mLayersPendingRemoval.clear(); } + + mDrawingState = mCurrentState; + mTransationPending = false; + mTransactionCV.broadcast(); } -bool SurfaceFlinger::handlePageFlip() -{ - Region dirtyRegion; - - bool visibleRegions = false; - const LayerVector& layers(mDrawingState.layersSortedByZ); - bool frameQueued = false; - - // Store the set of layers that need updates. This set must not change as - // buffers are being latched, as this could result in a deadlock. - // Example: Two producers share the same command stream and: - // 1.) Layer 0 is latched - // 2.) Layer 0 gets a new frame - // 2.) Layer 1 gets a new frame - // 3.) Layer 1 is latched. - // Display is now waiting on Layer 1's frame, which is behind layer 0's - // second frame. But layer 0's second frame could be waiting on display. - Vector layersWithQueuedFrames; - for (size_t i = 0, count = layers.size(); i& layer(layers[i]); - if (layer->hasQueuedFrame()) { - frameQueued = true; - if (layer->shouldPresentNow(mPrimaryDispSync)) { - layersWithQueuedFrames.push_back(layer.get()); - } else { - layer->useEmptyDamage(); +void SurfaceFlinger::handlePageFlip() +{ + ATRACE_CALL(); + const DisplayHardware& hw = graphicPlane(0).displayHardware(); + const Region screenRegion(hw.bounds()); + + const LayerVector& currentLayers(mDrawingState.layersSortedByZ); + const bool visibleRegions = lockPageFlip(currentLayers); + + if (visibleRegions || mVisibleRegionsDirty) { + Region opaqueRegion; + computeVisibleRegions(currentLayers, mDirtyRegion, opaqueRegion); + + /* + * rebuild the visible layer list + */ + const size_t count = currentLayers.size(); + mVisibleLayersSortedByZ.clear(); + mVisibleLayersSortedByZ.setCapacity(count); + for (size_t i=0 ; ivisibleNonTransparentRegion.isEmpty()) + mVisibleLayersSortedByZ.add(currentLayers[i]); } - } else { - layer->useEmptyDamage(); - } - } - for (size_t i = 0, count = layersWithQueuedFrames.size() ; ilatchBuffer(visibleRegions)); - layer->useSurfaceDamage(); - const Layer::State& s(layer->getDrawingState()); - invalidateLayerStack(s.layerStack, dirty); - } - mVisibleRegionsDirty |= visibleRegions; + mWormholeRegion = screenRegion.subtract(opaqueRegion); + mVisibleRegionsDirty = false; + invalidateHwcGeometry(); + } - // If we will need to wake up at some time in the future to deal with a - // queued frame that shouldn't be displayed during this vsync period, wake - // up during the next vsync period to check again. - if (frameQueued && layersWithQueuedFrames.empty()) { - signalLayerUpdate(); - } + unlockPageFlip(currentLayers); - // Only continue with the refresh if there is actually new work to do - return !layersWithQueuedFrames.empty(); + mDirtyRegion.orSelf(getAndClearInvalidateRegion()); + mDirtyRegion.andSelf(screenRegion); } void SurfaceFlinger::invalidateHwcGeometry() @@ -1849,240 +772,360 @@ mHwWorkListDirty = true; } +bool SurfaceFlinger::lockPageFlip(const LayerVector& currentLayers) +{ + bool recomputeVisibleRegions = false; + size_t count = currentLayers.size(); + sp const* layers = currentLayers.array(); + for (size_t i=0 ; i& layer(layers[i]); + layer->lockPageFlip(recomputeVisibleRegions); + } + return recomputeVisibleRegions; +} -void SurfaceFlinger::doDisplayComposition(const sp& hw, - const Region& inDirtyRegion) +void SurfaceFlinger::unlockPageFlip(const LayerVector& currentLayers) { - // We only need to actually compose the display if: - // 1) It is being handled by hardware composer, which may need this to - // keep its virtual display state machine in sync, or - // 2) There is work to be done (the dirty region isn't empty) - bool isHwcDisplay = hw->getHwcDisplayId() >= 0; - if (!isHwcDisplay && inDirtyRegion.isEmpty()) { - return; + const GraphicPlane& plane(graphicPlane(0)); + const Transform& planeTransform(plane.transform()); + const size_t count = currentLayers.size(); + sp const* layers = currentLayers.array(); + for (size_t i=0 ; i& layer(layers[i]); + layer->unlockPageFlip(planeTransform, mDirtyRegion); } +} - Region dirtyRegion(inDirtyRegion); +void SurfaceFlinger::handleRefresh() +{ + bool needInvalidate = false; + const LayerVector& currentLayers(mDrawingState.layersSortedByZ); + const size_t count = currentLayers.size(); + for (size_t i=0 ; i& layer(currentLayers[i]); + if (layer->onPreComposition()) { + needInvalidate = true; + } + } + if (needInvalidate) { + signalLayerUpdate(); + } +} - // compute the invalid region - hw->swapRegion.orSelf(dirtyRegion); - uint32_t flags = hw->getFlags(); - if (flags & DisplayDevice::SWAP_RECTANGLE) { - // we can redraw only what's dirty, but since SWAP_RECTANGLE only - // takes a rectangle, we must make sure to update that whole +void SurfaceFlinger::handleWorkList() +{ + mHwWorkListDirty = false; + HWComposer& hwc(graphicPlane(0).displayHardware().getHwComposer()); + if (hwc.initCheck() == NO_ERROR) { + const Vector< sp >& currentLayers(mVisibleLayersSortedByZ); + const size_t count = currentLayers.size(); + hwc.createWorkList(count); + hwc_layer_t* const cur(hwc.getLayers()); + for (size_t i=0 ; cur && isetGeometry(&cur[i]); + if (mDebugDisableHWC || mDebugRegion) { + cur[i].compositionType = HWC_FRAMEBUFFER; + cur[i].flags |= HWC_SKIP_LAYER; + } + } + } +} + +void SurfaceFlinger::handleRepaint() +{ + ATRACE_CALL(); + + // compute the invalid region + mSwapRegion.orSelf(mDirtyRegion); + + if (CC_UNLIKELY(mDebugRegion)) { + debugFlashRegions(); + } + + // set the frame buffer + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + uint32_t flags = hw.getFlags(); + if (flags & DisplayHardware::SWAP_RECTANGLE) { + // we can redraw only what's dirty, but since SWAP_RECTANGLE only + // takes a rectangle, we must make sure to update that whole // rectangle in that case - dirtyRegion.set(hw->swapRegion.bounds()); + mDirtyRegion.set(mSwapRegion.bounds()); } else { - if (flags & DisplayDevice::PARTIAL_UPDATES) { + if (flags & DisplayHardware::PARTIAL_UPDATES) { // We need to redraw the rectangle that will be updated // (pushed to the framebuffer). // This is needed because PARTIAL_UPDATES only takes one - // rectangle instead of a region (see DisplayDevice::flip()) - dirtyRegion.set(hw->swapRegion.bounds()); + // rectangle instead of a region (see DisplayHardware::flip()) + mDirtyRegion.set(mSwapRegion.bounds()); } else { // we need to redraw everything (the whole screen) - dirtyRegion.set(hw->bounds()); - hw->swapRegion = dirtyRegion; + mDirtyRegion.set(hw.bounds()); + mSwapRegion = mDirtyRegion; } } - if (CC_LIKELY(!mDaltonize && !mHasColorMatrix)) { - if (!doComposeSurfaces(hw, dirtyRegion)) return; - } else { - RenderEngine& engine(getRenderEngine()); - mat4 colorMatrix = mColorMatrix; - if (mDaltonize) { - colorMatrix = colorMatrix * mDaltonizer(); - } - mat4 oldMatrix = engine.setupColorTransform(colorMatrix); - doComposeSurfaces(hw, dirtyRegion); - engine.setupColorTransform(oldMatrix); - } + setupHardwareComposer(); + composeSurfaces(mDirtyRegion); // update the swap region and clear the dirty region - hw->swapRegion.orSelf(dirtyRegion); + mSwapRegion.orSelf(mDirtyRegion); + mDirtyRegion.clear(); +} + +void SurfaceFlinger::setupHardwareComposer() +{ + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + HWComposer& hwc(hw.getHwComposer()); + hwc_layer_t* const cur(hwc.getLayers()); + if (!cur) { + return; + } + + const Vector< sp >& layers(mVisibleLayersSortedByZ); + size_t count = layers.size(); + + ALOGE_IF(hwc.getNumLayers() != count, + "HAL number of layers (%d) doesn't match surfaceflinger (%d)", + hwc.getNumLayers(), count); + + // just to be extra-safe, use the smallest count + if (hwc.initCheck() == NO_ERROR) { + count = count < hwc.getNumLayers() ? count : hwc.getNumLayers(); + } - // swap buffers (presentation) - hw->swapBuffers(getHwComposer()); + /* + * update the per-frame h/w composer data for each layer + * and build the transparent region of the FB + */ + for (size_t i=0 ; i& layer(layers[i]); + layer->setPerFrameData(&cur[i]); + } + status_t err = hwc.prepare(); + ALOGE_IF(err, "HWComposer::prepare failed (%s)", strerror(-err)); } -bool SurfaceFlinger::doComposeSurfaces(const sp& hw, const Region& dirty) +void SurfaceFlinger::composeSurfaces(const Region& dirty) { - RenderEngine& engine(getRenderEngine()); - const int32_t id = hw->getHwcDisplayId(); - HWComposer& hwc(getHwComposer()); - HWComposer::LayerListIterator cur = hwc.begin(id); - const HWComposer::LayerListIterator end = hwc.end(id); - - bool hasGlesComposition = hwc.hasGlesComposition(id); - if (hasGlesComposition) { - if (!hw->makeCurrent(mEGLDisplay, mEGLContext)) { - ALOGW("DisplayDevice::makeCurrent failed. Aborting surface composition for display %s", - hw->getDisplayName().string()); - eglMakeCurrent(mEGLDisplay, EGL_NO_SURFACE, EGL_NO_SURFACE, EGL_NO_CONTEXT); - if(!getDefaultDisplayDevice()->makeCurrent(mEGLDisplay, mEGLContext)) { - ALOGE("DisplayDevice::makeCurrent on default display failed. Aborting."); - } - return false; - } + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + HWComposer& hwc(hw.getHwComposer()); + hwc_layer_t* const cur(hwc.getLayers()); + const size_t fbLayerCount = hwc.getLayerCount(HWC_FRAMEBUFFER); + if (!cur || fbLayerCount) { // Never touch the framebuffer if we don't have any framebuffer layers - const bool hasHwcComposition = hwc.hasHwcComposition(id); - if (hasHwcComposition) { + + if (hwc.getLayerCount(HWC_OVERLAY)) { // when using overlays, we assume a fully transparent framebuffer // NOTE: we could reduce how much we need to clear, for instance // remove where there are opaque FB layers. however, on some - // GPUs doing a "clean slate" clear might be more efficient. + // GPUs doing a "clean slate" glClear might be more efficient. // We'll revisit later if needed. - engine.clearWithColor(0, 0, 0, 0); + glClearColor(0, 0, 0, 0); + glClear(GL_COLOR_BUFFER_BIT); } else { - // we start with the whole screen area - const Region bounds(hw->getBounds()); - - // we remove the scissor part - // we're left with the letterbox region - // (common case is that letterbox ends-up being empty) - const Region letterbox(bounds.subtract(hw->getScissor())); - - // compute the area to clear - Region region(hw->undefinedRegion.merge(letterbox)); - - // but limit it to the dirty region - region.andSelf(dirty); - // screen is already cleared here - if (!region.isEmpty()) { + if (!mWormholeRegion.isEmpty()) { // can happen with SurfaceView - drawWormhole(hw, region); + drawWormhole(); } } - if (hw->getDisplayType() != DisplayDevice::DISPLAY_PRIMARY) { - // just to be on the safe side, we don't set the - // scissor on the main display. It should never be needed - // anyways (though in theory it could since the API allows it). - const Rect& bounds(hw->getBounds()); - const Rect& scissor(hw->getScissor()); - if (scissor != bounds) { - // scissor doesn't match the screen's dimensions, so we - // need to clear everything outside of it and enable - // the GL scissor so we don't draw anything where we shouldn't - - // enable scissor for this frame - const uint32_t height = hw->getHeight(); - engine.setScissor(scissor.left, height - scissor.bottom, - scissor.getWidth(), scissor.getHeight()); - } - } - } + /* + * and then, render the layers targeted at the framebuffer + */ - /* - * and then, render the layers targeted at the framebuffer - */ + const Vector< sp >& layers(mVisibleLayersSortedByZ); + const size_t count = layers.size(); - const Vector< sp >& layers(hw->getVisibleLayersSortedByZ()); - const size_t count = layers.size(); - const Transform& tr = hw->getTransform(); - if (cur != end) { - // we're using h/w composer - for (size_t i=0 ; i& layer(layers[i]); - const Region clip(dirty.intersect(tr.transform(layer->visibleRegion))); + for (size_t i=0 ; i& layer(layers[i]); + const Region clip(dirty.intersect(layer->visibleRegionScreen)); if (!clip.isEmpty()) { - switch (cur->getCompositionType()) { - case HWC_CURSOR_OVERLAY: - case HWC_OVERLAY: { - const Layer::State& state(layer->getDrawingState()); - if ((cur->getHints() & HWC_HINT_CLEAR_FB) - && i - && layer->isOpaque(state) && (state.alpha == 0xFF) - && hasGlesComposition) { - // never clear the very first layer since we're - // guaranteed the FB is already cleared - layer->clearWithOpenGL(hw, clip); - } - break; - } - case HWC_FRAMEBUFFER: { - layer->draw(hw, clip); - break; - } - case HWC_FRAMEBUFFER_TARGET: { - // this should not happen as the iterator shouldn't - // let us get there. - ALOGW("HWC_FRAMEBUFFER_TARGET found in hwc list (index=%zu)", i); - break; + if (cur && (cur[i].compositionType == HWC_OVERLAY)) { + if (i && (cur[i].hints & HWC_HINT_CLEAR_FB) + && layer->isOpaque()) { + // never clear the very first layer since we're + // guaranteed the FB is already cleared + layer->clearWithOpenGL(clip); } + continue; } + // render the layer + layer->draw(clip); } - layer->setAcquireFence(hw, *cur); } + } +} + +void SurfaceFlinger::debugFlashRegions() +{ + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const uint32_t flags = hw.getFlags(); + const int32_t height = hw.getHeight(); + if (mSwapRegion.isEmpty()) { + return; + } + + if (!(flags & DisplayHardware::SWAP_RECTANGLE)) { + const Region repaint((flags & DisplayHardware::PARTIAL_UPDATES) ? + mDirtyRegion.bounds() : hw.bounds()); + composeSurfaces(repaint); + } + + glDisable(GL_TEXTURE_EXTERNAL_OES); + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + + static int toggle = 0; + toggle = 1 - toggle; + if (toggle) { + glColor4f(1, 0, 1, 1); } else { - // we're not using h/w composer - for (size_t i=0 ; i& layer(layers[i]); - const Region clip(dirty.intersect( - tr.transform(layer->visibleRegion))); - if (!clip.isEmpty()) { - layer->draw(hw, clip); - } - } + glColor4f(1, 1, 0, 1); } - // disable scissor at the end of the frame - engine.disableScissor(); - return true; -} + Region::const_iterator it = mDirtyRegion.begin(); + Region::const_iterator const end = mDirtyRegion.end(); + while (it != end) { + const Rect& r = *it++; + GLfloat vertices[][2] = { + { r.left, height - r.top }, + { r.left, height - r.bottom }, + { r.right, height - r.bottom }, + { r.right, height - r.top } + }; + glVertexPointer(2, GL_FLOAT, 0, vertices); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + } + + hw.flip(mSwapRegion); -void SurfaceFlinger::drawWormhole(const sp& hw, const Region& region) const { - const int32_t height = hw->getHeight(); - RenderEngine& engine(getRenderEngine()); - engine.fillRegionWithColor(region, height, 0, 0, 0, 0); + if (mDebugRegion > 1) + usleep(mDebugRegion * 1000); } -status_t SurfaceFlinger::addClientLayer(const sp& client, - const sp& handle, - const sp& gbc, - const sp& lbc) +void SurfaceFlinger::drawWormhole() const { - // add this layer to the current state list - { - Mutex::Autolock _l(mStateLock); - if (mCurrentState.layersSortedByZ.size() >= MAX_LAYERS) { - return NO_MEMORY; - } - mCurrentState.layersSortedByZ.add(lbc); - mGraphicBufferProducerList.add(IInterface::asBinder(gbc)); + const Region region(mWormholeRegion.intersect(mDirtyRegion)); + if (region.isEmpty()) + return; + + glDisable(GL_TEXTURE_EXTERNAL_OES); + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); + glColor4f(0,0,0,0); + + GLfloat vertices[4][2]; + glVertexPointer(2, GL_FLOAT, 0, vertices); + Region::const_iterator it = region.begin(); + Region::const_iterator const end = region.end(); + while (it != end) { + const Rect& r = *it++; + vertices[0][0] = r.left; + vertices[0][1] = r.top; + vertices[1][0] = r.right; + vertices[1][1] = r.top; + vertices[2][0] = r.right; + vertices[2][1] = r.bottom; + vertices[3][0] = r.left; + vertices[3][1] = r.bottom; + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); } +} + +status_t SurfaceFlinger::addLayer(const sp& layer) +{ + Mutex::Autolock _l(mStateLock); + addLayer_l(layer); + setTransactionFlags(eTransactionNeeded|eTraversalNeeded); + return NO_ERROR; +} + +status_t SurfaceFlinger::addLayer_l(const sp& layer) +{ + ssize_t i = mCurrentState.layersSortedByZ.add(layer); + return (i < 0) ? status_t(i) : status_t(NO_ERROR); +} +ssize_t SurfaceFlinger::addClientLayer(const sp& client, + const sp& lbc) +{ // attach this layer to the client - client->attachLayer(handle, lbc); + size_t name = client->attachLayer(lbc); - return NO_ERROR; + Mutex::Autolock _l(mStateLock); + + // add this layer to the current state list + addLayer_l(lbc); + + return ssize_t(name); } -status_t SurfaceFlinger::removeLayer(const sp& layer) { +status_t SurfaceFlinger::removeLayer(const sp& layer) +{ Mutex::Autolock _l(mStateLock); - ssize_t index = mCurrentState.layersSortedByZ.remove(layer); + status_t err = purgatorizeLayer_l(layer); + if (err == NO_ERROR) + setTransactionFlags(eTransactionNeeded); + return err; +} + +status_t SurfaceFlinger::removeLayer_l(const sp& layerBase) +{ + sp lbc(layerBase->getLayerBaseClient()); + if (lbc != 0) { + mLayerMap.removeItem( lbc->getSurfaceBinder() ); + } + ssize_t index = mCurrentState.layersSortedByZ.remove(layerBase); if (index >= 0) { - mLayersPendingRemoval.push(layer); mLayersRemoved = true; - setTransactionFlags(eTransactionNeeded); return NO_ERROR; } return status_t(index); } -uint32_t SurfaceFlinger::peekTransactionFlags(uint32_t /* flags */) { +status_t SurfaceFlinger::purgatorizeLayer_l(const sp& layerBase) +{ + // First add the layer to the purgatory list, which makes sure it won't + // go away, then remove it from the main list (through a transaction). + ssize_t err = removeLayer_l(layerBase); + if (err >= 0) { + mLayerPurgatory.add(layerBase); + } + + mLayersPendingRemoval.push(layerBase); + + // it's possible that we don't find a layer, because it might + // have been destroyed already -- this is not technically an error + // from the user because there is a race between Client::destroySurface(), + // ~Client() and ~ISurface(). + return (err == NAME_NOT_FOUND) ? status_t(NO_ERROR) : err; +} + +status_t SurfaceFlinger::invalidateLayerVisibility(const sp& layer) +{ + layer->forceVisibilityTransaction(); + setTransactionFlags(eTraversalNeeded); + return NO_ERROR; +} + +uint32_t SurfaceFlinger::peekTransactionFlags(uint32_t flags) +{ return android_atomic_release_load(&mTransactionFlags); } -uint32_t SurfaceFlinger::getTransactionFlags(uint32_t flags) { +uint32_t SurfaceFlinger::getTransactionFlags(uint32_t flags) +{ return android_atomic_and(~flags, &mTransactionFlags) & flags; } -uint32_t SurfaceFlinger::setTransactionFlags(uint32_t flags) { +uint32_t SurfaceFlinger::setTransactionFlags(uint32_t flags) +{ uint32_t old = android_atomic_or(flags, &mTransactionFlags); if ((old & flags)==0) { // wake the server up signalTransaction(); @@ -2090,57 +1133,27 @@ return old; } -void SurfaceFlinger::setTransactionState( - const Vector& state, - const Vector& displays, - uint32_t flags) -{ - ATRACE_CALL(); + +void SurfaceFlinger::setTransactionState(const Vector& state, + int orientation, uint32_t flags) { Mutex::Autolock _l(mStateLock); - uint32_t transactionFlags = 0; - if (flags & eAnimation) { - // For window updates that are part of an animation we must wait for - // previous animation "frames" to be handled. - while (mAnimTransactionPending) { - status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5)); - if (CC_UNLIKELY(err != NO_ERROR)) { - // just in case something goes wrong in SF, return to the - // caller after a few seconds. - ALOGW_IF(err == TIMED_OUT, "setTransactionState timed out " - "waiting for previous animation frame"); - mAnimTransactionPending = false; - break; - } + uint32_t transactionFlags = 0; + if (mCurrentState.orientation != orientation) { + if (uint32_t(orientation)<=eOrientation270 || orientation==42) { + mCurrentState.orientation = orientation; + transactionFlags |= eTransactionNeeded; + } else if (orientation != eOrientationUnchanged) { + ALOGW("setTransactionState: ignoring unrecognized orientation: %d", + orientation); } } - size_t count = displays.size(); - for (size_t i=0 ; i binder = IInterface::asBinder(s.client); - if (binder != NULL) { - String16 desc(binder->getInterfaceDescriptor()); - if (desc == ISurfaceComposerClient::descriptor) { - sp client( static_cast(s.client.get()) ); - transactionFlags |= setClientStateLocked(client, s.state); - } - } - } + sp client( static_cast(s.client.get()) ); + transactionFlags |= setClientStateLocked(client, s.state); } if (transactionFlags) { @@ -2150,72 +1163,170 @@ // if this is a synchronous transaction, wait for it to take effect // before returning. if (flags & eSynchronous) { - mTransactionPending = true; + mTransationPending = true; } - if (flags & eAnimation) { - mAnimTransactionPending = true; - } - while (mTransactionPending) { + while (mTransationPending) { status_t err = mTransactionCV.waitRelative(mStateLock, s2ns(5)); if (CC_UNLIKELY(err != NO_ERROR)) { // just in case something goes wrong in SF, return to the // called after a few seconds. - ALOGW_IF(err == TIMED_OUT, "setTransactionState timed out!"); - mTransactionPending = false; + ALOGW_IF(err == TIMED_OUT, "closeGlobalTransaction timed out!"); + mTransationPending = false; break; } } } } -uint32_t SurfaceFlinger::setDisplayStateLocked(const DisplayState& s) +sp SurfaceFlinger::createSurface( + ISurfaceComposerClient::surface_data_t* params, + const String8& name, + const sp& client, + DisplayID d, uint32_t w, uint32_t h, PixelFormat format, + uint32_t flags) { - ssize_t dpyIdx = mCurrentState.displays.indexOfKey(s.token); - if (dpyIdx < 0) - return 0; + sp layer; + sp surfaceHandle; - uint32_t flags = 0; - DisplayDeviceState& disp(mCurrentState.displays.editValueAt(dpyIdx)); - if (disp.isValid()) { - const uint32_t what = s.what; - if (what & DisplayState::eSurfaceChanged) { - if (IInterface::asBinder(disp.surface) != IInterface::asBinder(s.surface)) { - disp.surface = s.surface; - flags |= eDisplayTransactionNeeded; - } - } - if (what & DisplayState::eLayerStackChanged) { - if (disp.layerStack != s.layerStack) { - disp.layerStack = s.layerStack; - flags |= eDisplayTransactionNeeded; + if (int32_t(w|h) < 0) { + ALOGE("createSurface() failed, w or h is negative (w=%d, h=%d)", + int(w), int(h)); + return surfaceHandle; + } + + //ALOGD("createSurface for (%d x %d), name=%s", w, h, name.string()); + sp normalLayer; + switch (flags & eFXSurfaceMask) { + case eFXSurfaceNormal: + normalLayer = createNormalSurface(client, d, w, h, flags, format); + layer = normalLayer; + break; + case eFXSurfaceBlur: + // for now we treat Blur as Dim, until we can implement it + // efficiently. + case eFXSurfaceDim: + layer = createDimSurface(client, d, w, h, flags); + break; + case eFXSurfaceScreenshot: + layer = createScreenshotSurface(client, d, w, h, flags); + break; + } + + if (layer != 0) { + layer->initStates(w, h, flags); + layer->setName(name); + ssize_t token = addClientLayer(client, layer); + + surfaceHandle = layer->getSurface(); + if (surfaceHandle != 0) { + params->token = token; + params->identity = layer->getIdentity(); + if (normalLayer != 0) { + Mutex::Autolock _l(mStateLock); + mLayerMap.add(layer->getSurfaceBinder(), normalLayer); } } - if (what & DisplayState::eDisplayProjectionChanged) { - if (disp.orientation != s.orientation) { - disp.orientation = s.orientation; - flags |= eDisplayTransactionNeeded; - } - if (disp.frame != s.frame) { - disp.frame = s.frame; - flags |= eDisplayTransactionNeeded; - } - if (disp.viewport != s.viewport) { - disp.viewport = s.viewport; - flags |= eDisplayTransactionNeeded; - } + + setTransactionFlags(eTransactionNeeded); + } + + return surfaceHandle; +} + +sp SurfaceFlinger::createNormalSurface( + const sp& client, DisplayID display, + uint32_t w, uint32_t h, uint32_t flags, + PixelFormat& format) +{ + // initialize the surfaces + switch (format) { // TODO: take h/w into account + case PIXEL_FORMAT_TRANSPARENT: + case PIXEL_FORMAT_TRANSLUCENT: + format = PIXEL_FORMAT_RGBA_8888; + break; + case PIXEL_FORMAT_OPAQUE: +#ifdef NO_RGBX_8888 + format = PIXEL_FORMAT_RGB_565; +#else + format = PIXEL_FORMAT_RGBX_8888; +#endif + break; + } + +#ifdef NO_RGBX_8888 + if (format == PIXEL_FORMAT_RGBX_8888) + format = PIXEL_FORMAT_RGBA_8888; +#endif + + sp layer = new Layer(this, display, client); + status_t err = layer->setBuffers(w, h, format, flags); + if (CC_LIKELY(err != NO_ERROR)) { + ALOGE("createNormalSurfaceLocked() failed (%s)", strerror(-err)); + layer.clear(); + } + return layer; +} + +sp SurfaceFlinger::createDimSurface( + const sp& client, DisplayID display, + uint32_t w, uint32_t h, uint32_t flags) +{ + sp layer = new LayerDim(this, display, client); + return layer; +} + +sp SurfaceFlinger::createScreenshotSurface( + const sp& client, DisplayID display, + uint32_t w, uint32_t h, uint32_t flags) +{ + sp layer = new LayerScreenshot(this, display, client); + return layer; +} + +status_t SurfaceFlinger::removeSurface(const sp& client, SurfaceID sid) +{ + /* + * called by the window manager, when a surface should be marked for + * destruction. + * + * The surface is removed from the current and drawing lists, but placed + * in the purgatory queue, so it's not destroyed right-away (we need + * to wait for all client's references to go away first). + */ + + status_t err = NAME_NOT_FOUND; + Mutex::Autolock _l(mStateLock); + sp layer = client->getLayerUser(sid); + + if (layer != 0) { + err = purgatorizeLayer_l(layer); + if (err == NO_ERROR) { + setTransactionFlags(eTransactionNeeded); } - if (what & DisplayState::eDisplaySizeChanged) { - if (disp.width != s.width) { - disp.width = s.width; - flags |= eDisplayTransactionNeeded; - } - if (disp.height != s.height) { - disp.height = s.height; - flags |= eDisplayTransactionNeeded; - } + } + return err; +} + +status_t SurfaceFlinger::destroySurface(const wp& layer) +{ + // called by ~ISurface() when all references are gone + status_t err = NO_ERROR; + sp l(layer.promote()); + if (l != NULL) { + Mutex::Autolock _l(mStateLock); + err = removeLayer_l(l); + if (err == NAME_NOT_FOUND) { + // The surface wasn't in the current list, which means it was + // removed already, which means it is in the purgatory, + // and need to be removed from there. + ssize_t idx = mLayerPurgatory.remove(l); + ALOGE_IF(idx < 0, + "layer=%p is not in the purgatory list", l.get()); } + ALOGE_IF(err<0 && err != NAME_NOT_FOUND, + "error removing layer=%p (%s)", l.get(), strerror(-err)); } - return flags; + return err; } uint32_t SurfaceFlinger::setClientStateLocked( @@ -2223,15 +1334,14 @@ const layer_state_t& s) { uint32_t flags = 0; - sp layer(client->getLayerUser(s.surface)); + sp layer(client->getLayerUser(s.surface)); if (layer != 0) { const uint32_t what = s.what; - if (what & layer_state_t::ePositionChanged) { + if (what & ePositionChanged) { if (layer->setPosition(s.x, s.y)) flags |= eTraversalNeeded; } - if (what & layer_state_t::eLayerChanged) { - // NOTE: index needs to be calculated before we update the state + if (what & eLayerChanged) { ssize_t idx = mCurrentState.layersSortedByZ.indexOf(layer); if (layer->setLayer(s.z)) { mCurrentState.layersSortedByZ.removeAt(idx); @@ -2241,289 +1351,113 @@ flags |= eTransactionNeeded|eTraversalNeeded; } } - if (what & layer_state_t::eSizeChanged) { + if (what & eSizeChanged) { if (layer->setSize(s.w, s.h)) { flags |= eTraversalNeeded; } } - if (what & layer_state_t::eAlphaChanged) { + if (what & eAlphaChanged) { if (layer->setAlpha(uint8_t(255.0f*s.alpha+0.5f))) flags |= eTraversalNeeded; } - if (what & layer_state_t::eMatrixChanged) { + if (what & eMatrixChanged) { if (layer->setMatrix(s.matrix)) flags |= eTraversalNeeded; } - if (what & layer_state_t::eTransparentRegionChanged) { + if (what & eTransparentRegionChanged) { if (layer->setTransparentRegionHint(s.transparentRegion)) flags |= eTraversalNeeded; } - if (what & layer_state_t::eFlagsChanged) { + if (what & eVisibilityChanged) { if (layer->setFlags(s.flags, s.mask)) flags |= eTraversalNeeded; } - if (what & layer_state_t::eCropChanged) { + if (what & eCropChanged) { if (layer->setCrop(s.crop)) flags |= eTraversalNeeded; } - if (what & layer_state_t::eLayerStackChanged) { - // NOTE: index needs to be calculated before we update the state - ssize_t idx = mCurrentState.layersSortedByZ.indexOf(layer); - if (layer->setLayerStack(s.layerStack)) { - mCurrentState.layersSortedByZ.removeAt(idx); - mCurrentState.layersSortedByZ.add(layer); - // we need traversal (state changed) - // AND transaction (list changed) - flags |= eTransactionNeeded|eTraversalNeeded; - } - } } return flags; } -status_t SurfaceFlinger::createLayer( - const String8& name, - const sp& client, - uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, - sp* handle, sp* gbp) -{ - //ALOGD("createLayer for (%d x %d), name=%s", w, h, name.string()); - if (int32_t(w|h) < 0) { - ALOGE("createLayer() failed, w or h is negative (w=%d, h=%d)", - int(w), int(h)); - return BAD_VALUE; - } - - status_t result = NO_ERROR; - - sp layer; - - switch (flags & ISurfaceComposerClient::eFXSurfaceMask) { - case ISurfaceComposerClient::eFXSurfaceNormal: - result = createNormalLayer(client, - name, w, h, flags, format, - handle, gbp, &layer); - break; - case ISurfaceComposerClient::eFXSurfaceDim: - result = createDimLayer(client, - name, w, h, flags, - handle, gbp, &layer); - break; - default: - result = BAD_VALUE; - break; - } +// --------------------------------------------------------------------------- - if (result != NO_ERROR) { - return result; +void SurfaceFlinger::onScreenAcquired() { + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + hw.acquireScreen(); + mEventThread->onScreenAcquired(); + // this is a temporary work-around, eventually this should be called + // by the power-manager + SurfaceFlinger::turnElectronBeamOn(mElectronBeamAnimationMode); + // from this point on, SF will process updates again + repaintEverything(); +} + +void SurfaceFlinger::onScreenReleased() { + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + if (hw.isScreenAcquired()) { + mEventThread->onScreenReleased(); + hw.releaseScreen(); + // from this point on, SF will stop drawing } +} - result = addClientLayer(client, *handle, *gbp, layer); - if (result != NO_ERROR) { - return result; - } +void SurfaceFlinger::screenAcquired() { + class MessageScreenAcquired : public MessageBase { + SurfaceFlinger* flinger; + public: + MessageScreenAcquired(SurfaceFlinger* flinger) : flinger(flinger) { } + virtual bool handler() { + flinger->onScreenAcquired(); + return true; + } + }; + sp msg = new MessageScreenAcquired(this); + postMessageSync(msg); +} - setTransactionFlags(eTransactionNeeded); - return result; +void SurfaceFlinger::screenReleased() { + class MessageScreenReleased : public MessageBase { + SurfaceFlinger* flinger; + public: + MessageScreenReleased(SurfaceFlinger* flinger) : flinger(flinger) { } + virtual bool handler() { + flinger->onScreenReleased(); + return true; + } + }; + sp msg = new MessageScreenReleased(this); + postMessageSync(msg); } -status_t SurfaceFlinger::createNormalLayer(const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, - sp* handle, sp* gbp, sp* outLayer) -{ - // initialize the surfaces - switch (format) { - case PIXEL_FORMAT_TRANSPARENT: - case PIXEL_FORMAT_TRANSLUCENT: - format = PIXEL_FORMAT_RGBA_8888; - break; - case PIXEL_FORMAT_OPAQUE: - format = PIXEL_FORMAT_RGBX_8888; - break; - } - - *outLayer = new Layer(this, client, name, w, h, flags); - status_t err = (*outLayer)->setBuffers(w, h, format, flags); - if (err == NO_ERROR) { - *handle = (*outLayer)->getHandle(); - *gbp = (*outLayer)->getProducer(); - } - - ALOGE_IF(err, "createNormalLayer() failed (%s)", strerror(-err)); - return err; -} - -status_t SurfaceFlinger::createDimLayer(const sp& client, - const String8& name, uint32_t w, uint32_t h, uint32_t flags, - sp* handle, sp* gbp, sp* outLayer) -{ - *outLayer = new LayerDim(this, client, name, w, h, flags); - *handle = (*outLayer)->getHandle(); - *gbp = (*outLayer)->getProducer(); - return NO_ERROR; -} - -status_t SurfaceFlinger::onLayerRemoved(const sp& client, const sp& handle) -{ - // called by the window manager when it wants to remove a Layer - status_t err = NO_ERROR; - sp l(client->getLayerUser(handle)); - if (l != NULL) { - err = removeLayer(l); - ALOGE_IF(err<0 && err != NAME_NOT_FOUND, - "error removing layer=%p (%s)", l.get(), strerror(-err)); - } - return err; -} - -status_t SurfaceFlinger::onLayerDestroyed(const wp& layer) -{ - // called by ~LayerCleaner() when all references to the IBinder (handle) - // are gone - status_t err = NO_ERROR; - sp l(layer.promote()); - if (l != NULL) { - err = removeLayer(l); - ALOGE_IF(err<0 && err != NAME_NOT_FOUND, - "error removing layer=%p (%s)", l.get(), strerror(-err)); - } - return err; -} - -// --------------------------------------------------------------------------- - -void SurfaceFlinger::onInitializeDisplays() { - // reset screen orientation and use primary layer stack - Vector state; - Vector displays; - DisplayState d; - d.what = DisplayState::eDisplayProjectionChanged | - DisplayState::eLayerStackChanged; - d.token = mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]; - d.layerStack = 0; - d.orientation = DisplayState::eOrientationDefault; - d.frame.makeInvalid(); - d.viewport.makeInvalid(); - d.width = 0; - d.height = 0; - displays.add(d); - setTransactionState(state, displays, 0); - setPowerModeInternal(getDisplayDevice(d.token), HWC_POWER_MODE_NORMAL); - - const nsecs_t period = - getHwComposer().getRefreshPeriod(HWC_DISPLAY_PRIMARY); - mAnimFrameTracker.setDisplayRefreshPeriod(period); -} - -void SurfaceFlinger::initializeDisplays() { - class MessageScreenInitialized : public MessageBase { - SurfaceFlinger* flinger; - public: - MessageScreenInitialized(SurfaceFlinger* flinger) : flinger(flinger) { } - virtual bool handler() { - flinger->onInitializeDisplays(); - return true; - } - }; - sp msg = new MessageScreenInitialized(this); - postMessageAsync(msg); // we may be called from main thread, use async message -} - -void SurfaceFlinger::setPowerModeInternal(const sp& hw, - int mode) { - ALOGD("Set power mode=%d, type=%d flinger=%p", mode, hw->getDisplayType(), - this); - int32_t type = hw->getDisplayType(); - int currentMode = hw->getPowerMode(); - - if (mode == currentMode) { - ALOGD("Screen type=%d is already mode=%d", hw->getDisplayType(), mode); - return; - } - - hw->setPowerMode(mode); - if (type >= DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES) { - ALOGW("Trying to set power mode for virtual display"); - return; - } - - if (currentMode == HWC_POWER_MODE_OFF) { - getHwComposer().setPowerMode(type, mode); - if (type == DisplayDevice::DISPLAY_PRIMARY) { - // FIXME: eventthread only knows about the main display right now - mEventThread->onScreenAcquired(); - resyncToHardwareVsync(true); - } - - mVisibleRegionsDirty = true; - mHasPoweredOff = true; - repaintEverything(); - } else if (mode == HWC_POWER_MODE_OFF) { - if (type == DisplayDevice::DISPLAY_PRIMARY) { - disableHardwareVsync(true); // also cancels any in-progress resync - - // FIXME: eventthread only knows about the main display right now - mEventThread->onScreenReleased(); - } - - getHwComposer().setPowerMode(type, mode); - mVisibleRegionsDirty = true; - // from this point on, SF will stop drawing on this display - } else { - getHwComposer().setPowerMode(type, mode); - } -} - -void SurfaceFlinger::setPowerMode(const sp& display, int mode) { - class MessageSetPowerMode: public MessageBase { - SurfaceFlinger& mFlinger; - sp mDisplay; - int mMode; - public: - MessageSetPowerMode(SurfaceFlinger& flinger, - const sp& disp, int mode) : mFlinger(flinger), - mDisplay(disp) { mMode = mode; } - virtual bool handler() { - sp hw(mFlinger.getDisplayDevice(mDisplay)); - if (hw == NULL) { - ALOGE("Attempt to set power mode = %d for null display %p", - mMode, mDisplay.get()); - } else if (hw->getDisplayType() >= DisplayDevice::DISPLAY_VIRTUAL) { - ALOGW("Attempt to set power mode = %d for virtual display", - mMode); - } else { - mFlinger.setPowerModeInternal(hw, mMode); - } - return true; - } - }; - sp msg = new MessageSetPowerMode(*this, display, mode); - postMessageSync(msg); -} - -// --------------------------------------------------------------------------- - -status_t SurfaceFlinger::dump(int fd, const Vector& args) +// --------------------------------------------------------------------------- + +status_t SurfaceFlinger::dump(int fd, const Vector& args) { + const size_t SIZE = 4096; + char buffer[SIZE]; String8 result; - IPCThreadState* ipc = IPCThreadState::self(); - const int pid = ipc->getCallingPid(); - const int uid = ipc->getCallingUid(); - if ((uid != AID_SHELL) && - !PermissionCache::checkPermission(sDump, pid, uid)) { - result.appendFormat("Permission Denial: " - "can't dump SurfaceFlinger from pid=%d, uid=%d\n", pid, uid); + if (!PermissionCache::checkCallingPermission(sDump)) { + snprintf(buffer, SIZE, "Permission Denial: " + "can't dump SurfaceFlinger from pid=%d, uid=%d\n", + IPCThreadState::self()->getCallingPid(), + IPCThreadState::self()->getCallingUid()); + result.append(buffer); } else { - // Try to get the main lock, but give up after one second + // Try to get the main lock, but don't insist if we can't // (this would indicate SF is stuck, but we want to be able to // print something in dumpsys). - status_t err = mStateLock.timedLock(s2ns(1)); - bool locked = (err == NO_ERROR); + int retry = 3; + while (mStateLock.tryLock()<0 && --retry>=0) { + usleep(1000000); + } + const bool locked(retry >= 0); if (!locked) { - result.appendFormat( - "SurfaceFlinger appears to be unresponsive (%s [%d]), " - "dumping anyways (no locks held)\n", strerror(-err), err); + snprintf(buffer, SIZE, + "SurfaceFlinger appears to be unresponsive, " + "dumping anyways (no locks held)\n"); + result.append(buffer); } bool dumpAll = true; @@ -2533,41 +1467,27 @@ if ((index < numArgs) && (args[index] == String16("--list"))) { index++; - listLayersLocked(args, index, result); + listLayersLocked(args, index, result, buffer, SIZE); dumpAll = false; } if ((index < numArgs) && (args[index] == String16("--latency"))) { index++; - dumpStatsLocked(args, index, result); + dumpStatsLocked(args, index, result, buffer, SIZE); dumpAll = false; } if ((index < numArgs) && (args[index] == String16("--latency-clear"))) { index++; - clearStatsLocked(args, index, result); - dumpAll = false; - } - - if ((index < numArgs) && - (args[index] == String16("--dispsync"))) { - index++; - mPrimaryDispSync.dump(result); - dumpAll = false; - } - - if ((index < numArgs) && - (args[index] == String16("--static-screen"))) { - index++; - dumpStaticScreenStats(result); + clearStatsLocked(args, index, result, buffer, SIZE); dumpAll = false; } } if (dumpAll) { - dumpAllLocked(args, index, result); + dumpAllLocked(result, buffer, SIZE); } if (locked) { @@ -2578,19 +1498,20 @@ return NO_ERROR; } -void SurfaceFlinger::listLayersLocked(const Vector& /* args */, - size_t& /* index */, String8& result) const +void SurfaceFlinger::listLayersLocked(const Vector& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const { const LayerVector& currentLayers = mCurrentState.layersSortedByZ; const size_t count = currentLayers.size(); for (size_t i=0 ; i& layer(currentLayers[i]); - result.appendFormat("%s\n", layer->getName().string()); + const sp& layer(currentLayers[i]); + snprintf(buffer, SIZE, "%s\n", layer->getName().string()); + result.append(buffer); } } void SurfaceFlinger::dumpStatsLocked(const Vector& args, size_t& index, - String8& result) const + String8& result, char* buffer, size_t SIZE) const { String8 name; if (index < args.size()) { @@ -2598,26 +1519,22 @@ index++; } - const nsecs_t period = - getHwComposer().getRefreshPeriod(HWC_DISPLAY_PRIMARY); - result.appendFormat("%" PRId64 "\n", period); - - if (name.isEmpty()) { - mAnimFrameTracker.dumpStats(result); - } else { - const LayerVector& currentLayers = mCurrentState.layersSortedByZ; - const size_t count = currentLayers.size(); - for (size_t i=0 ; i& layer(currentLayers[i]); - if (name == layer->getName()) { - layer->dumpFrameStats(result); - } + const LayerVector& currentLayers = mCurrentState.layersSortedByZ; + const size_t count = currentLayers.size(); + for (size_t i=0 ; i& layer(currentLayers[i]); + if (name.isEmpty()) { + snprintf(buffer, SIZE, "%s\n", layer->getName().string()); + result.append(buffer); + } + if (name.isEmpty() || (name == layer->getName())) { + layer->dumpStats(result, buffer, SIZE); } } } void SurfaceFlinger::clearStatsLocked(const Vector& args, size_t& index, - String8& /* result */) + String8& result, char* buffer, size_t SIZE) const { String8 name; if (index < args.size()) { @@ -2628,74 +1545,16 @@ const LayerVector& currentLayers = mCurrentState.layersSortedByZ; const size_t count = currentLayers.size(); for (size_t i=0 ; i& layer(currentLayers[i]); + const sp& layer(currentLayers[i]); if (name.isEmpty() || (name == layer->getName())) { - layer->clearFrameStats(); + layer->clearStats(); } } - - mAnimFrameTracker.clearStats(); } -// This should only be called from the main thread. Otherwise it would need -// the lock and should use mCurrentState rather than mDrawingState. -void SurfaceFlinger::logFrameStats() { - const LayerVector& drawingLayers = mDrawingState.layersSortedByZ; - const size_t count = drawingLayers.size(); - for (size_t i=0 ; i& layer(drawingLayers[i]); - layer->logFrameStats(); - } - - mAnimFrameTracker.logAndResetStats(String8("")); -} - -/*static*/ void SurfaceFlinger::appendSfConfigString(String8& result) +void SurfaceFlinger::dumpAllLocked( + String8& result, char* buffer, size_t SIZE) const { - static const char* config = - " [sf" -#ifdef HAS_CONTEXT_PRIORITY - " HAS_CONTEXT_PRIORITY" -#endif -#ifdef NEVER_DEFAULT_TO_ASYNC_MODE - " NEVER_DEFAULT_TO_ASYNC_MODE" -#endif -#ifdef TARGET_DISABLE_TRIPLE_BUFFERING - " TARGET_DISABLE_TRIPLE_BUFFERING" -#endif - "]"; - result.append(config); -} - -void SurfaceFlinger::dumpStaticScreenStats(String8& result) const -{ - result.appendFormat("Static screen stats:\n"); - for (size_t b = 0; b < NUM_BUCKETS - 1; ++b) { - float bucketTimeSec = mFrameBuckets[b] / 1e9; - float percent = 100.0f * - static_cast(mFrameBuckets[b]) / mTotalTime; - result.appendFormat(" < %zd frames: %.3f s (%.1f%%)\n", - b + 1, bucketTimeSec, percent); - } - float bucketTimeSec = mFrameBuckets[NUM_BUCKETS - 1] / 1e9; - float percent = 100.0f * - static_cast(mFrameBuckets[NUM_BUCKETS - 1]) / mTotalTime; - result.appendFormat(" %zd+ frames: %.3f s (%.1f%%)\n", - NUM_BUCKETS - 1, bucketTimeSec, percent); -} - -void SurfaceFlinger::dumpAllLocked(const Vector& args, size_t& index, - String8& result) const -{ - bool colorize = false; - if (index < args.size() - && (args[index] == String16("--color"))) { - colorize = true; - index++; - } - - Colorizer colorizer(colorize); - // figure out if we're stuck somewhere const nsecs_t now = systemTime(); const nsecs_t inSwapBuffers(mDebugInSwapBuffers); @@ -2704,166 +1563,105 @@ nsecs_t inTransactionDuration = (inTransaction) ? now-inTransaction : 0; /* - * Dump library configuration. - */ - - colorizer.bold(result); - result.append("Build configuration:"); - colorizer.reset(result); - appendSfConfigString(result); - appendUiConfigString(result); - appendGuiConfigString(result); - result.append("\n"); - - colorizer.bold(result); - result.append("Sync configuration: "); - colorizer.reset(result); - result.append(SyncFeatures::getInstance().toString()); - result.append("\n"); - - colorizer.bold(result); - result.append("DispSync configuration: "); - colorizer.reset(result); - result.appendFormat("app phase %" PRId64 " ns, sf phase %" PRId64 " ns, " - "present offset %d ns (refresh %" PRId64 " ns)", - vsyncPhaseOffsetNs, sfVsyncPhaseOffsetNs, PRESENT_TIME_OFFSET_FROM_VSYNC_NS, - mHwc->getRefreshPeriod(HWC_DISPLAY_PRIMARY)); - result.append("\n"); - - // Dump static screen stats - result.append("\n"); - dumpStaticScreenStats(result); - result.append("\n"); - - /* * Dump the visible layer list */ const LayerVector& currentLayers = mCurrentState.layersSortedByZ; const size_t count = currentLayers.size(); - colorizer.bold(result); - result.appendFormat("Visible layers (count = %zu)\n", count); - colorizer.reset(result); + snprintf(buffer, SIZE, "Visible layers (count = %d)\n", count); + result.append(buffer); for (size_t i=0 ; i& layer(currentLayers[i]); - layer->dump(result, colorizer); + const sp& layer(currentLayers[i]); + layer->dump(result, buffer, SIZE); } /* - * Dump Display state + * Dump the layers in the purgatory */ - colorizer.bold(result); - result.appendFormat("Displays (%zu entries)\n", mDisplays.size()); - colorizer.reset(result); - for (size_t dpy=0 ; dpy& hw(mDisplays[dpy]); - hw->dump(result); + const size_t purgatorySize = mLayerPurgatory.size(); + snprintf(buffer, SIZE, "Purgatory state (%d entries)\n", purgatorySize); + result.append(buffer); + for (size_t i=0 ; i& layer(mLayerPurgatory.itemAt(i)); + layer->shortDump(result, buffer, SIZE); } /* * Dump SurfaceFlinger global state */ - colorizer.bold(result); - result.append("SurfaceFlinger global state:\n"); - colorizer.reset(result); - - HWComposer& hwc(getHwComposer()); - sp hw(getDefaultDisplayDevice()); - - colorizer.bold(result); - result.appendFormat("EGL implementation : %s\n", - eglQueryStringImplementationANDROID(mEGLDisplay, EGL_VERSION)); - colorizer.reset(result); - result.appendFormat("%s\n", - eglQueryStringImplementationANDROID(mEGLDisplay, EGL_EXTENSIONS)); - - mRenderEngine->dump(result); - - hw->undefinedRegion.dump(result, "undefinedRegion"); - result.appendFormat(" orientation=%d, isDisplayOn=%d\n", - hw->getOrientation(), hw->isDisplayOn()); - result.appendFormat( + snprintf(buffer, SIZE, "SurfaceFlinger global state:\n"); + result.append(buffer); + + const GLExtensions& extensions(GLExtensions::getInstance()); + snprintf(buffer, SIZE, "GLES: %s, %s, %s\n", + extensions.getVendor(), + extensions.getRenderer(), + extensions.getVersion()); + result.append(buffer); + + snprintf(buffer, SIZE, "EGL : %s\n", + eglQueryString(graphicPlane(0).getEGLDisplay(), + EGL_VERSION_HW_ANDROID)); + result.append(buffer); + + snprintf(buffer, SIZE, "EXTS: %s\n", extensions.getExtension()); + result.append(buffer); + + mWormholeRegion.dump(result, "WormholeRegion"); + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + snprintf(buffer, SIZE, + " orientation=%d, canDraw=%d\n", + mCurrentState.orientation, hw.canDraw()); + result.append(buffer); + snprintf(buffer, SIZE, " last eglSwapBuffers() time: %f us\n" " last transaction time : %f us\n" " transaction-flags : %08x\n" " refresh-rate : %f fps\n" " x-dpi : %f\n" " y-dpi : %f\n" - " gpu_to_cpu_unsupported : %d\n" - , + " density : %f\n", mLastSwapBufferTime/1000.0, mLastTransactionTime/1000.0, mTransactionFlags, - 1e9 / hwc.getRefreshPeriod(HWC_DISPLAY_PRIMARY), - hwc.getDpiX(HWC_DISPLAY_PRIMARY), - hwc.getDpiY(HWC_DISPLAY_PRIMARY), - !mGpuToCpuSupported); + hw.getRefreshRate(), + hw.getDpiX(), + hw.getDpiY(), + hw.getDensity()); + result.append(buffer); - result.appendFormat(" eglSwapBuffers time: %f us\n", + snprintf(buffer, SIZE, " eglSwapBuffers time: %f us\n", inSwapBuffersDuration/1000.0); + result.append(buffer); - result.appendFormat(" transaction time: %f us\n", + snprintf(buffer, SIZE, " transaction time: %f us\n", inTransactionDuration/1000.0); + result.append(buffer); /* * VSYNC state */ - mEventThread->dump(result); + mEventThread->dump(result, buffer, SIZE); /* * Dump HWComposer state */ - colorizer.bold(result); - result.append("h/w composer state:\n"); - colorizer.reset(result); - result.appendFormat(" h/w composer %s and %s\n", + HWComposer& hwc(hw.getHwComposer()); + snprintf(buffer, SIZE, "h/w composer state:\n"); + result.append(buffer); + snprintf(buffer, SIZE, " h/w composer %s and %s\n", hwc.initCheck()==NO_ERROR ? "present" : "not present", - (mDebugDisableHWC || mDebugRegion || mDaltonize - || mHasColorMatrix) ? "disabled" : "enabled"); - hwc.dump(result); + (mDebugDisableHWC || mDebugRegion) ? "disabled" : "enabled"); + result.append(buffer); + hwc.dump(result, buffer, SIZE, mVisibleLayersSortedByZ); /* * Dump gralloc state */ const GraphicBufferAllocator& alloc(GraphicBufferAllocator::get()); alloc.dump(result); -} - -const Vector< sp >& -SurfaceFlinger::getLayerSortedByZForHwcDisplay(int id) { - // Note: mStateLock is held here - wp dpy; - for (size_t i=0 ; igetHwcDisplayId() == id) { - dpy = mDisplays.keyAt(i); - break; - } - } - if (dpy == NULL) { - ALOGE("getLayerSortedByZForHwcDisplay: invalid hwc display id %d", id); - // Just use the primary display so we have something to return - dpy = getBuiltInDisplay(DisplayDevice::DISPLAY_PRIMARY); - } - return getDisplayDevice(dpy)->getVisibleLayersSortedByZ(); -} - -bool SurfaceFlinger::startDdmConnection() -{ - void* libddmconnection_dso = - dlopen("libsurfaceflinger_ddmconnection.so", RTLD_NOW); - if (!libddmconnection_dso) { - return false; - } - void (*DdmConnection_start)(const char* name); - DdmConnection_start = - (decltype(DdmConnection_start))dlsym(libddmconnection_dso, "DdmConnection_start"); - if (!DdmConnection_start) { - dlclose(libddmconnection_dso); - return false; - } - (*DdmConnection_start)(getServiceName()); - return true; + hw.dump(result); } status_t SurfaceFlinger::onTransact( @@ -2871,18 +1669,17 @@ { switch (code) { case CREATE_CONNECTION: - case CREATE_DISPLAY: case SET_TRANSACTION_STATE: + case SET_ORIENTATION: case BOOT_FINISHED: - case CLEAR_ANIMATION_FRAME_STATS: - case GET_ANIMATION_FRAME_STATS: - case SET_POWER_MODE: + case TURN_ELECTRON_BEAM_OFF: + case TURN_ELECTRON_BEAM_ON: { // codes that require permission check IPCThreadState* ipc = IPCThreadState::self(); const int pid = ipc->getCallingPid(); const int uid = ipc->getCallingUid(); - if ((uid != AID_GRAPHICS && uid != AID_SYSTEM) && + if ((uid != AID_GRAPHICS) && !PermissionCache::checkPermission(sAccessSurfaceFlinger, pid, uid)) { ALOGE("Permission Denial: " "can't access SurfaceFlinger pid=%d, uid=%d", pid, uid); @@ -2933,10 +1730,7 @@ return NO_ERROR; } case 1005:{ // force transaction - setTransactionFlags( - eTransactionNeeded| - eDisplayTransactionNeeded| - eTraversalNeeded); + setTransactionFlags(eTransactionNeeded|eTraversalNeeded); return NO_ERROR; } case 1006:{ // send empty update @@ -2964,584 +1758,1038 @@ return NO_ERROR; case 1013: { Mutex::Autolock _l(mStateLock); - sp hw(getDefaultDisplayDevice()); - reply->writeInt32(hw->getPageFlipCount()); - return NO_ERROR; - } - case 1014: { - // daltonize - n = data.readInt32(); - switch (n % 10) { - case 1: mDaltonizer.setType(Daltonizer::protanomaly); break; - case 2: mDaltonizer.setType(Daltonizer::deuteranomaly); break; - case 3: mDaltonizer.setType(Daltonizer::tritanomaly); break; - } - if (n >= 10) { - mDaltonizer.setMode(Daltonizer::correction); - } else { - mDaltonizer.setMode(Daltonizer::simulation); - } - mDaltonize = n > 0; - invalidateHwcGeometry(); - repaintEverything(); - return NO_ERROR; - } - case 1015: { - // apply a color matrix - n = data.readInt32(); - mHasColorMatrix = n ? 1 : 0; - if (n) { - // color matrix is sent as mat3 matrix followed by vec3 - // offset, then packed into a mat4 where the last row is - // the offset and extra values are 0 - for (size_t i = 0 ; i < 4; i++) { - for (size_t j = 0; j < 4; j++) { - mColorMatrix[i][j] = data.readFloat(); - } - } - } else { - mColorMatrix = mat4(); - } - invalidateHwcGeometry(); - repaintEverything(); - return NO_ERROR; - } - // This is an experimental interface - // Needs to be shifted to proper binder interface when we productize - case 1016: { - n = data.readInt32(); - mPrimaryDispSync.setRefreshSkipCount(n); - return NO_ERROR; - } - case 1017: { - n = data.readInt32(); - mForceFullDamage = static_cast(n); - return NO_ERROR; - } - case 1018: { // Modify Choreographer's phase offset - n = data.readInt32(); - mEventThread->setPhaseOffset(static_cast(n)); - return NO_ERROR; - } - case 1019: { // Modify SurfaceFlinger's phase offset - n = data.readInt32(); - mSFEventThread->setPhaseOffset(static_cast(n)); - return NO_ERROR; + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + reply->writeInt32(hw.getPageFlipCount()); } + return NO_ERROR; } } return err; } void SurfaceFlinger::repaintEverything() { - android_atomic_or(1, &mRepaintEverything); + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const Rect bounds(hw.getBounds()); + setInvalidateRegion(Region(bounds)); signalTransaction(); } +void SurfaceFlinger::setInvalidateRegion(const Region& reg) { + Mutex::Autolock _l(mInvalidateLock); + mInvalidateRegion = reg; +} + +Region SurfaceFlinger::getAndClearInvalidateRegion() { + Mutex::Autolock _l(mInvalidateLock); + Region reg(mInvalidateRegion); + mInvalidateRegion.clear(); + return reg; +} + // --------------------------------------------------------------------------- -// Capture screen into an IGraphiBufferProducer + +status_t SurfaceFlinger::renderScreenToTexture(DisplayID dpy, + GLuint* textureName, GLfloat* uOut, GLfloat* vOut) +{ + Mutex::Autolock _l(mStateLock); + return renderScreenToTextureLocked(dpy, textureName, uOut, vOut); +} + +status_t SurfaceFlinger::renderScreenToTextureLocked(DisplayID dpy, + GLuint* textureName, GLfloat* uOut, GLfloat* vOut) +{ + ATRACE_CALL(); + + if (!GLExtensions::getInstance().haveFramebufferObject()) + return INVALID_OPERATION; + + // get screen geometry + const DisplayHardware& hw(graphicPlane(dpy).displayHardware()); + const uint32_t hw_w = hw.getWidth(); + const uint32_t hw_h = hw.getHeight(); + GLfloat u = 1; + GLfloat v = 1; + + // make sure to clear all GL error flags + while ( glGetError() != GL_NO_ERROR ) ; + + // create a FBO + GLuint name, tname; + glGenTextures(1, &tname); + glBindTexture(GL_TEXTURE_2D, tname); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, + hw_w, hw_h, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); + if (glGetError() != GL_NO_ERROR) { + while ( glGetError() != GL_NO_ERROR ) ; + GLint tw = (2 << (31 - clz(hw_w))); + GLint th = (2 << (31 - clz(hw_h))); + glTexImage2D(GL_TEXTURE_2D, 0, GL_RGB, + tw, th, 0, GL_RGB, GL_UNSIGNED_BYTE, 0); + u = GLfloat(hw_w) / tw; + v = GLfloat(hw_h) / th; + } + glGenFramebuffersOES(1, &name); + glBindFramebufferOES(GL_FRAMEBUFFER_OES, name); + glFramebufferTexture2DOES(GL_FRAMEBUFFER_OES, + GL_COLOR_ATTACHMENT0_OES, GL_TEXTURE_2D, tname, 0); + + // redraw the screen entirely... + glDisable(GL_TEXTURE_EXTERNAL_OES); + glDisable(GL_TEXTURE_2D); + glClearColor(0,0,0,1); + glClear(GL_COLOR_BUFFER_BIT); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + const Vector< sp >& layers(mVisibleLayersSortedByZ); + const size_t count = layers.size(); + for (size_t i=0 ; i& layer(layers[i]); + layer->drawForSreenShot(); + } + + hw.compositionComplete(); + + // back to main framebuffer + glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); + glDeleteFramebuffersOES(1, &name); + + *textureName = tname; + *uOut = u; + *vOut = v; + return NO_ERROR; +} + // --------------------------------------------------------------------------- -/* The code below is here to handle b/8734824 - * - * We create a IGraphicBufferProducer wrapper that forwards all calls - * from the surfaceflinger thread to the calling binder thread, where they - * are executed. This allows the calling thread in the calling process to be - * reused and not depend on having "enough" binder threads to handle the - * requests. - */ -class GraphicProducerWrapper : public BBinder, public MessageHandler { - /* Parts of GraphicProducerWrapper are run on two different threads, - * communicating by sending messages via Looper but also by shared member - * data. Coherence maintenance is subtle and in places implicit (ugh). +class VSyncWaiter { + DisplayEventReceiver::Event buffer[4]; + sp looper; + sp events; + sp eventTube; +public: + VSyncWaiter(const sp& eventThread) { + looper = new Looper(true); + events = eventThread->createEventConnection(); + eventTube = events->getDataChannel(); + looper->addFd(eventTube->getFd(), 0, ALOOPER_EVENT_INPUT, 0, 0); + events->requestNextVsync(); + } + + void wait() { + ssize_t n; + + looper->pollOnce(-1); + // we don't handle any errors here, it doesn't matter + // and we don't want to take the risk to get stuck. + + // drain the events... + while ((n = DisplayEventReceiver::getEvents( + eventTube, buffer, 4)) > 0) ; + + events->requestNextVsync(); + } +}; + +status_t SurfaceFlinger::electronBeamOffAnimationImplLocked() +{ + // get screen geometry + const DisplayHardware& hw(graphicPlane(0).displayHardware()); + const uint32_t hw_w = hw.getWidth(); + const uint32_t hw_h = hw.getHeight(); + const Region screenBounds(hw.getBounds()); + + GLfloat u, v; + GLuint tname; + status_t result = renderScreenToTextureLocked(0, &tname, &u, &v); + if (result != NO_ERROR) { + return result; + } + + GLfloat vtx[8]; + const GLfloat texCoords[4][2] = { {0,0}, {0,v}, {u,v}, {u,0} }; + glBindTexture(GL_TEXTURE_2D, tname); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_REPLACE); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexCoordPointer(2, GL_FLOAT, 0, texCoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, vtx); + + /* + * Texture coordinate mapping * - * Don't rely on Looper's sendMessage/handleMessage providing - * release/acquire semantics for any data not actually in the Message. - * Data going from surfaceflinger to binder threads needs to be - * synchronized explicitly. + * u + * 1 +----------+---+ + * | | | | image is inverted + * | V | | w.r.t. the texture + * 1-v +----------+ | coordinates + * | | + * | | + * | | + * 0 +--------------+ + * 0 1 * - * Barrier open/wait do provide release/acquire semantics. This provides - * implicit synchronization for data coming back from binder to - * surfaceflinger threads. */ - sp impl; - sp looper; - status_t result; - bool exitPending; - bool exitRequested; - Barrier barrier; - uint32_t code; - Parcel const* data; - Parcel* reply; - - enum { - MSG_API_CALL, - MSG_EXIT + class s_curve_interpolator { + const float nbFrames, s, v; + public: + s_curve_interpolator(int nbFrames, float s) + : nbFrames(1.0f / (nbFrames-1)), s(s), + v(1.0f + expf(-s + 0.5f*s)) { + } + float operator()(int f) { + const float x = f * nbFrames; + return ((1.0f/(1.0f + expf(-x*s + 0.5f*s))) - 0.5f) * v + 0.5f; + } }; - /* - * Called on surfaceflinger thread. This is called by our "fake" - * BpGraphicBufferProducer. We package the data and reply Parcel and - * forward them to the binder thread. - */ - virtual status_t transact(uint32_t code, - const Parcel& data, Parcel* reply, uint32_t /* flags */) { - this->code = code; - this->data = &data; - this->reply = reply; - if (exitPending) { - // if we've exited, we run the message synchronously right here. - // note (JH): as far as I can tell from looking at the code, this - // never actually happens. if it does, i'm not sure if it happens - // on the surfaceflinger or binder thread. - handleMessage(Message(MSG_API_CALL)); - } else { - barrier.close(); - // Prevent stores to this->{code, data, reply} from being - // reordered later than the construction of Message. - atomic_thread_fence(memory_order_release); - looper->sendMessage(this, Message(MSG_API_CALL)); - barrier.wait(); + class v_stretch { + const GLfloat hw_w, hw_h; + public: + v_stretch(uint32_t hw_w, uint32_t hw_h) + : hw_w(hw_w), hw_h(hw_h) { } - return result; - } + void operator()(GLfloat* vtx, float v) { + const GLfloat w = hw_w + (hw_w * v); + const GLfloat h = hw_h - (hw_h * v); + const GLfloat x = (hw_w - w) * 0.5f; + const GLfloat y = (hw_h - h) * 0.5f; + vtx[0] = x; vtx[1] = y; + vtx[2] = x; vtx[3] = y + h; + vtx[4] = x + w; vtx[5] = y + h; + vtx[6] = x + w; vtx[7] = y; + } + }; - /* - * here we run on the binder thread. All we've got to do is - * call the real BpGraphicBufferProducer. - */ - virtual void handleMessage(const Message& message) { - int what = message.what; - // Prevent reads below from happening before the read from Message - atomic_thread_fence(memory_order_acquire); - if (what == MSG_API_CALL) { - result = IInterface::asBinder(impl)->transact(code, data[0], reply); - barrier.open(); - } else if (what == MSG_EXIT) { - exitRequested = true; + class h_stretch { + const GLfloat hw_w, hw_h; + public: + h_stretch(uint32_t hw_w, uint32_t hw_h) + : hw_w(hw_w), hw_h(hw_h) { } - } + void operator()(GLfloat* vtx, float v) { + const GLfloat w = hw_w - (hw_w * v); + const GLfloat h = 1.0f; + const GLfloat x = (hw_w - w) * 0.5f; + const GLfloat y = (hw_h - h) * 0.5f; + vtx[0] = x; vtx[1] = y; + vtx[2] = x; vtx[3] = y + h; + vtx[4] = x + w; vtx[5] = y + h; + vtx[6] = x + w; vtx[7] = y; + } + }; -public: - GraphicProducerWrapper(const sp& impl) - : impl(impl), - looper(new Looper(true)), - exitPending(false), - exitRequested(false) - {} - - // Binder thread - status_t waitForResponse() { - do { - looper->pollOnce(-1); - } while (!exitRequested); + VSyncWaiter vsync(mEventThread); + + // the full animation is 24 frames + char value[PROPERTY_VALUE_MAX]; + property_get("debug.sf.electron_frames", value, "24"); + int nbFrames = (atoi(value) + 1) >> 1; + if (nbFrames <= 0) // just in case + nbFrames = 24; + + s_curve_interpolator itr(nbFrames, 7.5f); + s_curve_interpolator itg(nbFrames, 8.0f); + s_curve_interpolator itb(nbFrames, 8.5f); + + v_stretch vverts(hw_w, hw_h); + + glMatrixMode(GL_TEXTURE); + glLoadIdentity(); + glMatrixMode(GL_MODELVIEW); + glLoadIdentity(); + + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + for (int i=0 ; iresult = result; - exitPending = true; - // Ensure this->result is visible to the binder thread before it - // handles the message. - atomic_thread_fence(memory_order_release); - looper->sendMessage(this, Message(MSG_EXIT)); - } -}; + GLfloat vtx[8]; + const GLfloat texCoords[4][2] = { {0,v}, {0,0}, {u,0}, {u,v} }; + glBindTexture(GL_TEXTURE_2D, tname); + glTexEnvx(GL_TEXTURE_ENV, GL_TEXTURE_ENV_MODE, GL_MODULATE); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); + glTexParameterx(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); + glTexCoordPointer(2, GL_FLOAT, 0, texCoords); + glEnableClientState(GL_TEXTURE_COORD_ARRAY); + glVertexPointer(2, GL_FLOAT, 0, vtx); + + class s_curve_interpolator { + const float nbFrames, s, v; + public: + s_curve_interpolator(int nbFrames, float s) + : nbFrames(1.0f / (nbFrames-1)), s(s), + v(1.0f + expf(-s + 0.5f*s)) { + } + float operator()(int f) { + const float x = f * nbFrames; + return ((1.0f/(1.0f + expf(-x*s + 0.5f*s))) - 0.5f) * v + 0.5f; + } + }; + class v_stretch { + const GLfloat hw_w, hw_h; + public: + v_stretch(uint32_t hw_w, uint32_t hw_h) + : hw_w(hw_w), hw_h(hw_h) { + } + void operator()(GLfloat* vtx, float v) { + const GLfloat w = hw_w + (hw_w * v); + const GLfloat h = hw_h - (hw_h * v); + const GLfloat x = (hw_w - w) * 0.5f; + const GLfloat y = (hw_h - h) * 0.5f; + vtx[0] = x; vtx[1] = y; + vtx[2] = x; vtx[3] = y + h; + vtx[4] = x + w; vtx[5] = y + h; + vtx[6] = x + w; vtx[7] = y; + } + }; -status_t SurfaceFlinger::captureScreen(const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, ISurfaceComposer::Rotation rotation) { + class h_stretch { + const GLfloat hw_w, hw_h; + public: + h_stretch(uint32_t hw_w, uint32_t hw_h) + : hw_w(hw_w), hw_h(hw_h) { + } + void operator()(GLfloat* vtx, float v) { + const GLfloat w = hw_w - (hw_w * v); + const GLfloat h = 1.0f; + const GLfloat x = (hw_w - w) * 0.5f; + const GLfloat y = (hw_h - h) * 0.5f; + vtx[0] = x; vtx[1] = y; + vtx[2] = x; vtx[3] = y + h; + vtx[4] = x + w; vtx[5] = y + h; + vtx[6] = x + w; vtx[7] = y; + } + }; - if (CC_UNLIKELY(display == 0)) - return BAD_VALUE; + VSyncWaiter vsync(mEventThread); - if (CC_UNLIKELY(producer == 0)) - return BAD_VALUE; + // the full animation is 12 frames + int nbFrames = 8; + s_curve_interpolator itr(nbFrames, 7.5f); + s_curve_interpolator itg(nbFrames, 8.0f); + s_curve_interpolator itb(nbFrames, 8.5f); + + h_stretch hverts(hw_w, hw_h); + glDisable(GL_BLEND); + glDisable(GL_TEXTURE_2D); + glColorMask(1,1,1,1); + for (int i=nbFrames-1 ; i>=0 ; i--) { + const float v = itg(i); + hverts(vtx, v); + + // wait for vsync + vsync.wait(); + + glClear(GL_COLOR_BUFFER_BIT); + glColor4f(1-v, 1-v, 1-v, 1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + hw.flip(screenBounds); + } + + nbFrames = 4; + v_stretch vverts(hw_w, hw_h); + glEnable(GL_BLEND); + glBlendFunc(GL_ONE, GL_ONE); + for (int i=nbFrames-1 ; i>=0 ; i--) { + float x, y, w, h; + const float vr = itr(i); + const float vg = itg(i); + const float vb = itb(i); + + // wait for vsync + vsync.wait(); + + // clear screen + glColorMask(1,1,1,1); + glClear(GL_COLOR_BUFFER_BIT); + glEnable(GL_TEXTURE_2D); + + // draw the red plane + vverts(vtx, vr); + glColorMask(1,0,0,1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + // draw the green plane + vverts(vtx, vg); + glColorMask(0,1,0,1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + // draw the blue plane + vverts(vtx, vb); + glColorMask(0,0,1,1); + glDrawArrays(GL_TRIANGLE_FAN, 0, 4); + + hw.flip(screenBounds); + } + + glColorMask(1,1,1,1); + glDisableClientState(GL_TEXTURE_COORD_ARRAY); + glDeleteTextures(1, &tname); + glDisable(GL_TEXTURE_2D); + glDisable(GL_BLEND); - // if we have secure windows on this display, never allow the screen capture - // unless the producer interface is local (i.e.: we can take a screenshot for - // ourselves). - if (!IInterface::asBinder(producer)->localBinder()) { - Mutex::Autolock _l(mStateLock); - sp hw(getDisplayDevice(display)); - if (hw->getSecureLayerVisible()) { - ALOGW("FB is protected: PERMISSION_DENIED"); - return PERMISSION_DENIED; - } + return NO_ERROR; +} + +// --------------------------------------------------------------------------- + +status_t SurfaceFlinger::turnElectronBeamOffImplLocked(int32_t mode) +{ + ATRACE_CALL(); + + DisplayHardware& hw(graphicPlane(0).editDisplayHardware()); + if (!hw.canDraw()) { + // we're already off + return NO_ERROR; } - // Convert to surfaceflinger's internal rotation type. - Transform::orientation_flags rotationFlags; - switch (rotation) { - case ISurfaceComposer::eRotateNone: - rotationFlags = Transform::ROT_0; - break; - case ISurfaceComposer::eRotate90: - rotationFlags = Transform::ROT_90; - break; - case ISurfaceComposer::eRotate180: - rotationFlags = Transform::ROT_180; - break; - case ISurfaceComposer::eRotate270: - rotationFlags = Transform::ROT_270; - break; - default: - rotationFlags = Transform::ROT_0; - ALOGE("Invalid rotation passed to captureScreen(): %d\n", rotation); - break; + // turn off hwc while we're doing the animation + hw.getHwComposer().disable(); + // and make sure to turn it back on (if needed) next time we compose + invalidateHwcGeometry(); + + if (mode & ISurfaceComposer::eElectronBeamAnimationOff) { + electronBeamOffAnimationImplLocked(); } - class MessageCaptureScreen : public MessageBase { + // always clear the whole screen at the end of the animation + glClearColor(0,0,0,1); + glClear(GL_COLOR_BUFFER_BIT); + hw.flip( Region(hw.bounds()) ); + + return NO_ERROR; +} + +status_t SurfaceFlinger::turnElectronBeamOff(int32_t mode) +{ + class MessageTurnElectronBeamOff : public MessageBase { SurfaceFlinger* flinger; - sp display; - sp producer; - Rect sourceCrop; - uint32_t reqWidth, reqHeight; - uint32_t minLayerZ,maxLayerZ; - bool useIdentityTransform; - Transform::orientation_flags rotation; + int32_t mode; status_t result; public: - MessageCaptureScreen(SurfaceFlinger* flinger, - const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, Transform::orientation_flags rotation) - : flinger(flinger), display(display), producer(producer), - sourceCrop(sourceCrop), reqWidth(reqWidth), reqHeight(reqHeight), - minLayerZ(minLayerZ), maxLayerZ(maxLayerZ), - useIdentityTransform(useIdentityTransform), - rotation(rotation), - result(PERMISSION_DENIED) - { + MessageTurnElectronBeamOff(SurfaceFlinger* flinger, int32_t mode) + : flinger(flinger), mode(mode), result(PERMISSION_DENIED) { } status_t getResult() const { return result; } virtual bool handler() { Mutex::Autolock _l(flinger->mStateLock); - sp hw(flinger->getDisplayDevice(display)); - result = flinger->captureScreenImplLocked(hw, producer, - sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, - useIdentityTransform, rotation); - static_cast(IInterface::asBinder(producer).get())->exit(result); + result = flinger->turnElectronBeamOffImplLocked(mode); return true; } }; - // make sure to process transactions before screenshots -- a transaction - // might already be pending but scheduled for VSYNC; this guarantees we - // will handle it before the screenshot. When VSYNC finally arrives - // the scheduled transaction will be a no-op. If no transactions are - // scheduled at this time, this will end-up being a no-op as well. - mEventQueue.invalidateTransactionNow(); - - // this creates a "fake" BBinder which will serve as a "fake" remote - // binder to receive the marshaled calls and forward them to the - // real remote (a BpGraphicBufferProducer) - sp wrapper = new GraphicProducerWrapper(producer); - - // the asInterface() call below creates our "fake" BpGraphicBufferProducer - // which does the marshaling work forwards to our "fake remote" above. - sp msg = new MessageCaptureScreen(this, - display, IGraphicBufferProducer::asInterface( wrapper ), - sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, - useIdentityTransform, rotationFlags); - - status_t res = postMessageAsync(msg); + sp msg = new MessageTurnElectronBeamOff(this, mode); + status_t res = postMessageSync(msg); if (res == NO_ERROR) { - res = wrapper->waitForResponse(); + res = static_cast( msg.get() )->getResult(); + + // work-around: when the power-manager calls us we activate the + // animation. eventually, the "on" animation will be called + // by the power-manager itself + mElectronBeamAnimationMode = mode; } return res; } +// --------------------------------------------------------------------------- + +status_t SurfaceFlinger::turnElectronBeamOnImplLocked(int32_t mode) +{ + DisplayHardware& hw(graphicPlane(0).editDisplayHardware()); + if (hw.canDraw()) { + // we're already on + return NO_ERROR; + } + if (mode & ISurfaceComposer::eElectronBeamAnimationOn) { + electronBeamOnAnimationImplLocked(); + } + + // make sure to redraw the whole screen when the animation is done + mDirtyRegion.set(hw.bounds()); + signalTransaction(); + + return NO_ERROR; +} + +status_t SurfaceFlinger::turnElectronBeamOn(int32_t mode) +{ + class MessageTurnElectronBeamOn : public MessageBase { + SurfaceFlinger* flinger; + int32_t mode; + status_t result; + public: + MessageTurnElectronBeamOn(SurfaceFlinger* flinger, int32_t mode) + : flinger(flinger), mode(mode), result(PERMISSION_DENIED) { + } + status_t getResult() const { + return result; + } + virtual bool handler() { + Mutex::Autolock _l(flinger->mStateLock); + result = flinger->turnElectronBeamOnImplLocked(mode); + return true; + } + }; + + postMessageAsync( new MessageTurnElectronBeamOn(this, mode) ); + return NO_ERROR; +} + +// --------------------------------------------------------------------------- -void SurfaceFlinger::renderScreenImplLocked( - const sp& hw, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool yswap, bool useIdentityTransform, Transform::orientation_flags rotation) +status_t SurfaceFlinger::captureScreenImplLocked(DisplayID dpy, + sp* heap, + uint32_t* w, uint32_t* h, PixelFormat* f, + uint32_t sw, uint32_t sh, + uint32_t minLayerZ, uint32_t maxLayerZ) { ATRACE_CALL(); - RenderEngine& engine(getRenderEngine()); + + status_t result = PERMISSION_DENIED; + + // only one display supported for now + if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) + return BAD_VALUE; + + if (!GLExtensions::getInstance().haveFramebufferObject()) + return INVALID_OPERATION; // get screen geometry - const int32_t hw_w = hw->getWidth(); - const int32_t hw_h = hw->getHeight(); - const bool filtering = static_cast(reqWidth) != hw_w || - static_cast(reqHeight) != hw_h; - - // if a default or invalid sourceCrop is passed in, set reasonable values - if (sourceCrop.width() == 0 || sourceCrop.height() == 0 || - !sourceCrop.isValid()) { - sourceCrop.setLeftTop(Point(0, 0)); - sourceCrop.setRightBottom(Point(hw_w, hw_h)); - } - - // ensure that sourceCrop is inside screen - if (sourceCrop.left < 0) { - ALOGE("Invalid crop rect: l = %d (< 0)", sourceCrop.left); - } - if (sourceCrop.right > hw_w) { - ALOGE("Invalid crop rect: r = %d (> %d)", sourceCrop.right, hw_w); - } - if (sourceCrop.top < 0) { - ALOGE("Invalid crop rect: t = %d (< 0)", sourceCrop.top); - } - if (sourceCrop.bottom > hw_h) { - ALOGE("Invalid crop rect: b = %d (> %d)", sourceCrop.bottom, hw_h); - } + const DisplayHardware& hw(graphicPlane(dpy).displayHardware()); + const uint32_t hw_w = hw.getWidth(); + const uint32_t hw_h = hw.getHeight(); + + if ((sw > hw_w) || (sh > hw_h)) + return BAD_VALUE; + + sw = (!sw) ? hw_w : sw; + sh = (!sh) ? hw_h : sh; + const size_t size = sw * sh * 4; + + //ALOGD("screenshot: sw=%d, sh=%d, minZ=%d, maxZ=%d", + // sw, sh, minLayerZ, maxLayerZ); // make sure to clear all GL error flags - engine.checkErrors(); + while ( glGetError() != GL_NO_ERROR ) ; - // set-up our viewport - engine.setViewportAndProjection( - reqWidth, reqHeight, sourceCrop, hw_h, yswap, rotation); - engine.disableTexturing(); + // create a FBO + GLuint name, tname; + glGenRenderbuffersOES(1, &tname); + glBindRenderbufferOES(GL_RENDERBUFFER_OES, tname); + glRenderbufferStorageOES(GL_RENDERBUFFER_OES, GL_RGBA8_OES, sw, sh); + + glGenFramebuffersOES(1, &name); + glBindFramebufferOES(GL_FRAMEBUFFER_OES, name); + glFramebufferRenderbufferOES(GL_FRAMEBUFFER_OES, + GL_COLOR_ATTACHMENT0_OES, GL_RENDERBUFFER_OES, tname); + + GLenum status = glCheckFramebufferStatusOES(GL_FRAMEBUFFER_OES); + + if (status == GL_FRAMEBUFFER_COMPLETE_OES) { + + // invert everything, b/c glReadPixel() below will invert the FB + glViewport(0, 0, sw, sh); + glMatrixMode(GL_PROJECTION); + glPushMatrix(); + glLoadIdentity(); + glOrthof(0, hw_w, hw_h, 0, 0, 1); + glMatrixMode(GL_MODELVIEW); + + // redraw the screen entirely... + glClearColor(0,0,0,1); + glClear(GL_COLOR_BUFFER_BIT); - // redraw the screen entirely... - engine.clearWithColor(0, 0, 0, 1); + const LayerVector& layers(mDrawingState.layersSortedByZ); + const size_t count = layers.size(); + for (size_t i=0 ; i& layer(layers[i]); + const uint32_t flags = layer->drawingState().flags; + if (!(flags & ISurfaceComposer::eLayerHidden)) { + const uint32_t z = layer->drawingState().z; + if (z >= minLayerZ && z <= maxLayerZ) { + layer->drawForSreenShot(); + } + } + } - const LayerVector& layers( mDrawingState.layersSortedByZ ); - const size_t count = layers.size(); - for (size_t i=0 ; i& layer(layers[i]); - const Layer::State& state(layer->getDrawingState()); - if (state.layerStack == hw->getLayerStack()) { - if (state.z >= minLayerZ && state.z <= maxLayerZ) { - if (layer->isVisible()) { - if (filtering) layer->setFiltering(true); - layer->draw(hw, useIdentityTransform); - if (filtering) layer->setFiltering(false); + // check for errors and return screen capture + if (glGetError() != GL_NO_ERROR) { + // error while rendering + result = INVALID_OPERATION; + } else { + // allocate shared memory large enough to hold the + // screen capture + sp base( + new MemoryHeapBase(size, 0, "screen-capture") ); + void* const ptr = base->getBase(); + if (ptr) { + // capture the screen with glReadPixels() + ScopedTrace _t(ATRACE_TAG, "glReadPixels"); + glReadPixels(0, 0, sw, sh, GL_RGBA, GL_UNSIGNED_BYTE, ptr); + if (glGetError() == GL_NO_ERROR) { + *heap = base; + *w = sw; + *h = sh; + *f = PIXEL_FORMAT_RGBA_8888; + result = NO_ERROR; } + } else { + result = NO_MEMORY; } } + glViewport(0, 0, hw_w, hw_h); + glMatrixMode(GL_PROJECTION); + glPopMatrix(); + glMatrixMode(GL_MODELVIEW); + } else { + result = BAD_VALUE; } - // compositionComplete is needed for older driver - hw->compositionComplete(); - hw->setViewportAndProjection(); + // release FBO resources + glBindFramebufferOES(GL_FRAMEBUFFER_OES, 0); + glDeleteRenderbuffersOES(1, &tname); + glDeleteFramebuffersOES(1, &name); + + hw.compositionComplete(); + + // ALOGD("screenshot: result = %s", result<0 ? strerror(result) : "OK"); + + return result; } -status_t SurfaceFlinger::captureScreenImplLocked( - const sp& hw, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, Transform::orientation_flags rotation) +status_t SurfaceFlinger::captureScreen(DisplayID dpy, + sp* heap, + uint32_t* width, uint32_t* height, PixelFormat* format, + uint32_t sw, uint32_t sh, + uint32_t minLayerZ, uint32_t maxLayerZ) { - ATRACE_CALL(); + // only one display supported for now + if (CC_UNLIKELY(uint32_t(dpy) >= DISPLAY_COUNT)) + return BAD_VALUE; - // get screen geometry - uint32_t hw_w = hw->getWidth(); - uint32_t hw_h = hw->getHeight(); + if (!GLExtensions::getInstance().haveFramebufferObject()) + return INVALID_OPERATION; - if (rotation & Transform::ROT_90) { - std::swap(hw_w, hw_h); + class MessageCaptureScreen : public MessageBase { + SurfaceFlinger* flinger; + DisplayID dpy; + sp* heap; + uint32_t* w; + uint32_t* h; + PixelFormat* f; + uint32_t sw; + uint32_t sh; + uint32_t minLayerZ; + uint32_t maxLayerZ; + status_t result; + public: + MessageCaptureScreen(SurfaceFlinger* flinger, DisplayID dpy, + sp* heap, uint32_t* w, uint32_t* h, PixelFormat* f, + uint32_t sw, uint32_t sh, + uint32_t minLayerZ, uint32_t maxLayerZ) + : flinger(flinger), dpy(dpy), + heap(heap), w(w), h(h), f(f), sw(sw), sh(sh), + minLayerZ(minLayerZ), maxLayerZ(maxLayerZ), + result(PERMISSION_DENIED) + { + } + status_t getResult() const { + return result; + } + virtual bool handler() { + Mutex::Autolock _l(flinger->mStateLock); + + // if we have secure windows, never allow the screen capture + if (flinger->mSecureFrameBuffer) + return true; + + result = flinger->captureScreenImplLocked(dpy, + heap, w, h, f, sw, sh, minLayerZ, maxLayerZ); + + return true; + } + }; + + sp msg = new MessageCaptureScreen(this, + dpy, heap, width, height, format, sw, sh, minLayerZ, maxLayerZ); + status_t res = postMessageSync(msg); + if (res == NO_ERROR) { + res = static_cast( msg.get() )->getResult(); } + return res; +} - if ((reqWidth > hw_w) || (reqHeight > hw_h)) { - ALOGE("size mismatch (%d, %d) > (%d, %d)", - reqWidth, reqHeight, hw_w, hw_h); - return BAD_VALUE; +// --------------------------------------------------------------------------- + +sp SurfaceFlinger::getLayer(const sp& sur) const +{ + sp result; + Mutex::Autolock _l(mStateLock); + result = mLayerMap.valueFor( sur->asBinder() ).promote(); + return result; +} + +// --------------------------------------------------------------------------- + +Client::Client(const sp& flinger) + : mFlinger(flinger), mNameGenerator(1) +{ +} + +Client::~Client() +{ + const size_t count = mLayers.size(); + for (size_t i=0 ; i layer(mLayers.valueAt(i).promote()); + if (layer != 0) { + mFlinger->removeLayer(layer); + } } +} - reqWidth = (!reqWidth) ? hw_w : reqWidth; - reqHeight = (!reqHeight) ? hw_h : reqHeight; +status_t Client::initCheck() const { + return NO_ERROR; +} - // create a surface (because we're a producer, and we need to - // dequeue/queue a buffer) - sp sur = new Surface(producer, false); - ANativeWindow* window = sur.get(); - - status_t result = native_window_api_connect(window, NATIVE_WINDOW_API_EGL); - if (result == NO_ERROR) { - uint32_t usage = GRALLOC_USAGE_SW_READ_OFTEN | GRALLOC_USAGE_SW_WRITE_OFTEN | - GRALLOC_USAGE_HW_RENDER | GRALLOC_USAGE_HW_TEXTURE; - - int err = 0; - err = native_window_set_buffers_dimensions(window, reqWidth, reqHeight); - err |= native_window_set_scaling_mode(window, NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW); - err |= native_window_set_buffers_format(window, HAL_PIXEL_FORMAT_RGBA_8888); - err |= native_window_set_usage(window, usage); +size_t Client::attachLayer(const sp& layer) +{ + Mutex::Autolock _l(mLock); + size_t name = mNameGenerator++; + mLayers.add(name, layer); + return name; +} - if (err == NO_ERROR) { - ANativeWindowBuffer* buffer; - /* TODO: Once we have the sync framework everywhere this can use - * server-side waits on the fence that dequeueBuffer returns. - */ - result = native_window_dequeue_buffer_and_wait(window, &buffer); - if (result == NO_ERROR) { - int syncFd = -1; - // create an EGLImage from the buffer so we can later - // turn it into a texture - EGLImageKHR image = eglCreateImageKHR(mEGLDisplay, EGL_NO_CONTEXT, - EGL_NATIVE_BUFFER_ANDROID, buffer, NULL); - if (image != EGL_NO_IMAGE_KHR) { - // this binds the given EGLImage as a framebuffer for the - // duration of this scope. - RenderEngine::BindImageAsFramebuffer imageBond(getRenderEngine(), image); - if (imageBond.getStatus() == NO_ERROR) { - // this will in fact render into our dequeued buffer - // via an FBO, which means we didn't have to create - // an EGLSurface and therefore we're not - // dependent on the context's EGLConfig. - renderScreenImplLocked( - hw, sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ, true, - useIdentityTransform, rotation); - - // Attempt to create a sync khr object that can produce a sync point. If that - // isn't available, create a non-dupable sync object in the fallback path and - // wait on it directly. - EGLSyncKHR sync; - if (!DEBUG_SCREENSHOTS) { - sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_NATIVE_FENCE_ANDROID, NULL); - // native fence fd will not be populated until flush() is done. - getRenderEngine().flush(); - } else { - sync = EGL_NO_SYNC_KHR; - } - if (sync != EGL_NO_SYNC_KHR) { - // get the sync fd - syncFd = eglDupNativeFenceFDANDROID(mEGLDisplay, sync); - if (syncFd == EGL_NO_NATIVE_FENCE_FD_ANDROID) { - ALOGW("captureScreen: failed to dup sync khr object"); - syncFd = -1; - } - eglDestroySyncKHR(mEGLDisplay, sync); - } else { - // fallback path - sync = eglCreateSyncKHR(mEGLDisplay, EGL_SYNC_FENCE_KHR, NULL); - if (sync != EGL_NO_SYNC_KHR) { - EGLint result = eglClientWaitSyncKHR(mEGLDisplay, sync, - EGL_SYNC_FLUSH_COMMANDS_BIT_KHR, 2000000000 /*2 sec*/); - EGLint eglErr = eglGetError(); - if (result == EGL_TIMEOUT_EXPIRED_KHR) { - ALOGW("captureScreen: fence wait timed out"); - } else { - ALOGW_IF(eglErr != EGL_SUCCESS, - "captureScreen: error waiting on EGL fence: %#x", eglErr); - } - eglDestroySyncKHR(mEGLDisplay, sync); - } else { - ALOGW("captureScreen: error creating EGL fence: %#x", eglGetError()); - } - } - if (DEBUG_SCREENSHOTS) { - uint32_t* pixels = new uint32_t[reqWidth*reqHeight]; - getRenderEngine().readPixels(0, 0, reqWidth, reqHeight, pixels); - checkScreenshot(reqWidth, reqHeight, reqWidth, pixels, - hw, minLayerZ, maxLayerZ); - delete [] pixels; - } - - } else { - ALOGE("got GL_FRAMEBUFFER_COMPLETE_OES error while taking screenshot"); - result = INVALID_OPERATION; - } - // destroy our image - eglDestroyImageKHR(mEGLDisplay, image); - } else { - result = BAD_VALUE; - } - // queueBuffer takes ownership of syncFd - result = window->queueBuffer(window, buffer, syncFd); - } - } else { - result = BAD_VALUE; +void Client::detachLayer(const LayerBaseClient* layer) +{ + Mutex::Autolock _l(mLock); + // we do a linear search here, because this doesn't happen often + const size_t count = mLayers.size(); + for (size_t i=0 ; i Client::getLayerUser(int32_t i) const +{ + Mutex::Autolock _l(mLock); + sp lbc; + wp layer(mLayers.valueFor(i)); + if (layer != 0) { + lbc = layer.promote(); + ALOGE_IF(lbc==0, "getLayerUser(name=%d) is dead", int(i)); + } + return lbc; +} - return result; + +status_t Client::onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags) +{ + // these must be checked + IPCThreadState* ipc = IPCThreadState::self(); + const int pid = ipc->getCallingPid(); + const int uid = ipc->getCallingUid(); + const int self_pid = getpid(); + if (CC_UNLIKELY(pid != self_pid && uid != AID_GRAPHICS && uid != 0)) { + // we're called from a different process, do the real check + if (!PermissionCache::checkCallingPermission(sAccessSurfaceFlinger)) + { + ALOGE("Permission Denial: " + "can't openGlobalTransaction pid=%d, uid=%d", pid, uid); + return PERMISSION_DENIED; + } + } + return BnSurfaceComposerClient::onTransact(code, data, reply, flags); } -void SurfaceFlinger::checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr, - const sp& hw, uint32_t minLayerZ, uint32_t maxLayerZ) { - if (DEBUG_SCREENSHOTS) { - for (size_t y=0 ; y Client::createSurface( + ISurfaceComposerClient::surface_data_t* params, + const String8& name, + DisplayID display, uint32_t w, uint32_t h, PixelFormat format, + uint32_t flags) +{ + /* + * createSurface must be called from the GL thread so that it can + * have access to the GL context. + */ + + class MessageCreateSurface : public MessageBase { + sp result; + SurfaceFlinger* flinger; + ISurfaceComposerClient::surface_data_t* params; + Client* client; + const String8& name; + DisplayID display; + uint32_t w, h; + PixelFormat format; + uint32_t flags; + public: + MessageCreateSurface(SurfaceFlinger* flinger, + ISurfaceComposerClient::surface_data_t* params, + const String8& name, Client* client, + DisplayID display, uint32_t w, uint32_t h, PixelFormat format, + uint32_t flags) + : flinger(flinger), params(params), client(client), name(name), + display(display), w(w), h(h), format(format), flags(flags) + { } - ALOGE("*** we just took a black screenshot ***\n" - "requested minz=%d, maxz=%d, layerStack=%d", - minLayerZ, maxLayerZ, hw->getLayerStack()); - const LayerVector& layers( mDrawingState.layersSortedByZ ); - const size_t count = layers.size(); - for (size_t i=0 ; i& layer(layers[i]); - const Layer::State& state(layer->getDrawingState()); - const bool visible = (state.layerStack == hw->getLayerStack()) - && (state.z >= minLayerZ && state.z <= maxLayerZ) - && (layer->isVisible()); - ALOGE("%c index=%zu, name=%s, layerStack=%d, z=%d, visible=%d, flags=%x, alpha=%x", - visible ? '+' : '-', - i, layer->getName().string(), state.layerStack, state.z, - layer->isVisible(), state.flags, state.alpha); + sp getResult() const { return result; } + virtual bool handler() { + result = flinger->createSurface(params, name, client, + display, w, h, format, flags); + return true; } + }; + + sp msg = new MessageCreateSurface(mFlinger.get(), + params, name, this, display, w, h, format, flags); + mFlinger->postMessageSync(msg); + return static_cast( msg.get() )->getResult(); +} +status_t Client::destroySurface(SurfaceID sid) { + return mFlinger->removeSurface(this, sid); +} + +// --------------------------------------------------------------------------- + +GraphicBufferAlloc::GraphicBufferAlloc() {} + +GraphicBufferAlloc::~GraphicBufferAlloc() {} + +sp GraphicBufferAlloc::createGraphicBuffer(uint32_t w, uint32_t h, + PixelFormat format, uint32_t usage, status_t* error) { + sp graphicBuffer(new GraphicBuffer(w, h, format, usage)); + status_t err = graphicBuffer->initCheck(); + *error = err; + if (err != 0 || graphicBuffer->handle == 0) { + if (err == NO_MEMORY) { + GraphicBuffer::dumpAllocationsToSystemLog(); + } + ALOGE("GraphicBufferAlloc::createGraphicBuffer(w=%d, h=%d) " + "failed (%s), handle=%p", + w, h, strerror(-err), graphicBuffer->handle); + return 0; } + return graphicBuffer; } // --------------------------------------------------------------------------- -SurfaceFlinger::LayerVector::LayerVector() { +GraphicPlane::GraphicPlane() + : mHw(0) +{ +} + +GraphicPlane::~GraphicPlane() { + delete mHw; } -SurfaceFlinger::LayerVector::LayerVector(const LayerVector& rhs) - : SortedVector >(rhs) { +bool GraphicPlane::initialized() const { + return mHw ? true : false; } -int SurfaceFlinger::LayerVector::do_compare(const void* lhs, - const void* rhs) const +int GraphicPlane::getWidth() const { + return mWidth; +} + +int GraphicPlane::getHeight() const { + return mHeight; +} + +void GraphicPlane::setDisplayHardware(DisplayHardware *hw) { - // sort layers per layer-stack, then by z-order and finally by sequence - const sp& l(*reinterpret_cast*>(lhs)); - const sp& r(*reinterpret_cast*>(rhs)); + mHw = hw; - uint32_t ls = l->getCurrentState().layerStack; - uint32_t rs = r->getCurrentState().layerStack; - if (ls != rs) - return ls - rs; + // initialize the display orientation transform. + // it's a constant that should come from the display driver. + int displayOrientation = ISurfaceComposer::eOrientationDefault; + char property[PROPERTY_VALUE_MAX]; + if (property_get("ro.sf.hwrotation", property, NULL) > 0) { + //displayOrientation + switch (atoi(property)) { + case 90: + displayOrientation = ISurfaceComposer::eOrientation90; + break; + case 270: + displayOrientation = ISurfaceComposer::eOrientation270; + break; + } + } - uint32_t lz = l->getCurrentState().z; - uint32_t rz = r->getCurrentState().z; - if (lz != rz) - return lz - rz; + const float w = hw->getWidth(); + const float h = hw->getHeight(); + GraphicPlane::orientationToTransfrom(displayOrientation, w, h, + &mDisplayTransform); + if (displayOrientation & ISurfaceComposer::eOrientationSwapMask) { + mDisplayWidth = h; + mDisplayHeight = w; + } else { + mDisplayWidth = w; + mDisplayHeight = h; + } - return l->sequence - r->sequence; + setOrientation(ISurfaceComposer::eOrientationDefault); } -// --------------------------------------------------------------------------- +status_t GraphicPlane::orientationToTransfrom( + int orientation, int w, int h, Transform* tr) +{ + uint32_t flags = 0; + switch (orientation) { + case ISurfaceComposer::eOrientationDefault: + flags = Transform::ROT_0; + break; + case ISurfaceComposer::eOrientation90: + flags = Transform::ROT_90; + break; + case ISurfaceComposer::eOrientation180: + flags = Transform::ROT_180; + break; + case ISurfaceComposer::eOrientation270: + flags = Transform::ROT_270; + break; + default: + return BAD_VALUE; + } + tr->set(flags, w, h); + return NO_ERROR; +} -SurfaceFlinger::DisplayDeviceState::DisplayDeviceState() - : type(DisplayDevice::DISPLAY_ID_INVALID), width(0), height(0) { +status_t GraphicPlane::setOrientation(int orientation) +{ + // If the rotation can be handled in hardware, this is where + // the magic should happen. + + const DisplayHardware& hw(displayHardware()); + const float w = mDisplayWidth; + const float h = mDisplayHeight; + mWidth = int(w); + mHeight = int(h); + + Transform orientationTransform; + GraphicPlane::orientationToTransfrom(orientation, w, h, + &orientationTransform); + if (orientation & ISurfaceComposer::eOrientationSwapMask) { + mWidth = int(h); + mHeight = int(w); + } + + mOrientation = orientation; + mGlobalTransform = mDisplayTransform * orientationTransform; + return NO_ERROR; } -SurfaceFlinger::DisplayDeviceState::DisplayDeviceState(DisplayDevice::DisplayType type) - : type(type), layerStack(DisplayDevice::NO_LAYER_STACK), orientation(0), width(0), height(0) { - viewport.makeInvalid(); - frame.makeInvalid(); +const DisplayHardware& GraphicPlane::displayHardware() const { + return *mHw; } -// --------------------------------------------------------------------------- +DisplayHardware& GraphicPlane::editDisplayHardware() { + return *mHw; +} -}; // namespace android +const Transform& GraphicPlane::transform() const { + return mGlobalTransform; +} +EGLDisplay GraphicPlane::getEGLDisplay() const { + return mHw->getEGLDisplay(); +} -#if defined(__gl_h_) -#error "don't include gl/gl.h in this file" -#endif +// --------------------------------------------------------------------------- -#if defined(__gl2_h_) -#error "don't include gl2/gl2.h in this file" -#endif +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlinger.h android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlinger.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceFlinger.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/SurfaceFlinger.h 2012-10-16 22:57:11.000000000 +0000 @@ -20,12 +20,6 @@ #include #include -#include - -/* - * NOTE: Make sure this file doesn't include anything from or - */ - #include #include @@ -35,479 +29,403 @@ #include #include +#include #include #include -#include - +#include #include #include -#include - -#include - #include "Barrier.h" -#include "DisplayDevice.h" -#include "DispSync.h" -#include "FrameTracker.h" -#include "MessageQueue.h" +#include "Layer.h" -#include "DisplayHardware/HWComposer.h" -#include "Effects/Daltonizer.h" +#include "MessageQueue.h" namespace android { // --------------------------------------------------------------------------- class Client; +class DisplayHardware; class DisplayEventConnection; class EventThread; -class IGraphicBufferAlloc; class Layer; class LayerDim; -class Surface; -class RenderEngine; -class EventControlThread; +class LayerScreenshot; +struct surface_flinger_cblk_t; + +// --------------------------------------------------------------------------- + +class Client : public BnSurfaceComposerClient +{ +public: + Client(const sp& flinger); + ~Client(); + + status_t initCheck() const; + + // protected by SurfaceFlinger::mStateLock + size_t attachLayer(const sp& layer); + void detachLayer(const LayerBaseClient* layer); + sp getLayerUser(int32_t i) const; + +private: + // ISurfaceComposerClient interface + virtual sp createSurface( + surface_data_t* params, const String8& name, + DisplayID display, uint32_t w, uint32_t h,PixelFormat format, + uint32_t flags); + virtual status_t destroySurface(SurfaceID surfaceId); + virtual status_t onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); + + // constant + sp mFlinger; + + // protected by mLock + DefaultKeyedVector< size_t, wp > mLayers; + size_t mNameGenerator; + + // thread-safe + mutable Mutex mLock; +}; + +class GraphicBufferAlloc : public BnGraphicBufferAlloc +{ +public: + GraphicBufferAlloc(); + virtual ~GraphicBufferAlloc(); + virtual sp createGraphicBuffer(uint32_t w, uint32_t h, + PixelFormat format, uint32_t usage, status_t* error); +}; + +// --------------------------------------------------------------------------- + +class GraphicPlane +{ +public: + static status_t orientationToTransfrom(int orientation, int w, int h, + Transform* tr); + + GraphicPlane(); + ~GraphicPlane(); + + bool initialized() const; + + void setDisplayHardware(DisplayHardware *); + status_t setOrientation(int orientation); + int getOrientation() const { return mOrientation; } + int getWidth() const; + int getHeight() const; + + const DisplayHardware& displayHardware() const; + DisplayHardware& editDisplayHardware(); + const Transform& transform() const; + EGLDisplay getEGLDisplay() const; + +private: + GraphicPlane(const GraphicPlane&); + GraphicPlane operator = (const GraphicPlane&); + + DisplayHardware* mHw; + Transform mGlobalTransform; + Transform mDisplayTransform; + int mOrientation; + float mDisplayWidth; + float mDisplayHeight; + int mWidth; + int mHeight; +}; // --------------------------------------------------------------------------- enum { - eTransactionNeeded = 0x01, - eTraversalNeeded = 0x02, - eDisplayTransactionNeeded = 0x04, - eTransactionMask = 0x07 + eTransactionNeeded = 0x01, + eTraversalNeeded = 0x02 }; -class SurfaceFlinger : public BnSurfaceComposer, - private IBinder::DeathRecipient, - private HWComposer::EventHandler +class SurfaceFlinger : + public BinderService, + public BnSurfaceComposer, + public IBinder::DeathRecipient, + protected Thread { public: - static char const* getServiceName() ANDROID_API { - return "SurfaceFlinger"; - } + static char const* getServiceName() { return "SurfaceFlinger"; } + + SurfaceFlinger(); + virtual ~SurfaceFlinger(); + void init(); - SurfaceFlinger() ANDROID_API; + virtual status_t onTransact( + uint32_t code, const Parcel& data, Parcel* reply, uint32_t flags); - // must be called before clients can connect - void init() ANDROID_API; + virtual status_t dump(int fd, const Vector& args); - // starts SurfaceFlinger main loop in the current thread - void run() ANDROID_API; + // ISurfaceComposer interface + virtual sp createConnection(); + virtual sp createGraphicBufferAlloc(); + virtual sp getCblk() const; + virtual void bootFinished(); + virtual void setTransactionState(const Vector& state, + int orientation, uint32_t flags); + virtual bool authenticateSurfaceTexture(const sp& surface) const; + virtual sp createDisplayEventConnection(); - enum { - EVENT_VSYNC = HWC_EVENT_VSYNC - }; + virtual status_t captureScreen(DisplayID dpy, + sp* heap, + uint32_t* width, uint32_t* height, + PixelFormat* format, uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ); - // post an asynchronous message to the main thread - status_t postMessageAsync(const sp& msg, nsecs_t reltime = 0, uint32_t flags = 0); + virtual status_t turnElectronBeamOff(int32_t mode); + virtual status_t turnElectronBeamOn(int32_t mode); - // post a synchronous message to the main thread - status_t postMessageSync(const sp& msg, nsecs_t reltime = 0, uint32_t flags = 0); - // force full composition on all displays - void repaintEverything(); + // called when screen needs to turn off + void screenReleased(); + // called when screen is turning back on + void screenAcquired(); - // returns the default Display - sp getDefaultDisplayDevice() const { - return getDisplayDevice(mBuiltinDisplays[DisplayDevice::DISPLAY_PRIMARY]); - } - - // utility function to delete a texture on the main thread - void deleteTextureAsync(uint32_t texture); - - // enable/disable h/w composer event - // TODO: this should be made accessible only to EventThread - void eventControl(int disp, int event, int enabled); - - // called on the main thread by MessageQueue when an internal message - // is received - // TODO: this should be made accessible only to MessageQueue - void onMessageReceived(int32_t what); - - // for debugging only - // TODO: this should be made accessible only to HWComposer - const Vector< sp >& getLayerSortedByZForHwcDisplay(int id); - - RenderEngine& getRenderEngine() const { - return *mRenderEngine; - } + // called on the main thread in response to screenReleased() + void onScreenReleased(); + // called on the main thread in response to screenAcquired() + void onScreenAcquired(); -private: - friend class Client; - friend class DisplayEventConnection; - friend class Layer; - friend class MonitoredProducer; - // This value is specified in number of frames. Log frame stats at most - // every half hour. - enum { LOG_FRAME_STATS_PERIOD = 30*60*60 }; + status_t renderScreenToTexture(DisplayID dpy, + GLuint* textureName, GLfloat* uOut, GLfloat* vOut); + status_t renderScreenToTextureLocked(DisplayID dpy, + GLuint* textureName, GLfloat* uOut, GLfloat* vOut); - static const size_t MAX_LAYERS = 4096; + void onMessageReceived(int32_t what); - // We're reference counted, never destroy SurfaceFlinger directly - virtual ~SurfaceFlinger(); + status_t postMessageAsync(const sp& msg, + nsecs_t reltime=0, uint32_t flags = 0); - /* ------------------------------------------------------------------------ - * Internal data structures - */ + status_t postMessageSync(const sp& msg, + nsecs_t reltime=0, uint32_t flags = 0); - class LayerVector : public SortedVector< sp > { - public: - LayerVector(); - LayerVector(const LayerVector& rhs); - virtual int do_compare(const void* lhs, const void* rhs) const; - }; + status_t removeLayer(const sp& layer); + status_t addLayer(const sp& layer); + status_t invalidateLayerVisibility(const sp& layer); + void invalidateHwcGeometry(); - struct DisplayDeviceState { - DisplayDeviceState(); - DisplayDeviceState(DisplayDevice::DisplayType type); - bool isValid() const { return type >= 0; } - bool isMainDisplay() const { return type == DisplayDevice::DISPLAY_PRIMARY; } - bool isVirtualDisplay() const { return type >= DisplayDevice::DISPLAY_VIRTUAL; } - DisplayDevice::DisplayType type; - sp surface; - uint32_t layerStack; - Rect viewport; - Rect frame; - uint8_t orientation; - uint32_t width, height; - String8 displayName; - bool isSecure; - }; + sp getLayer(const sp& sur) const; - struct State { - LayerVector layersSortedByZ; - DefaultKeyedVector< wp, DisplayDeviceState> displays; + GLuint getProtectedTexName() const { return mProtectedTexName; } + + + class MessageDestroyGLTexture : public MessageBase { + GLuint texture; + public: + MessageDestroyGLTexture(GLuint texture) : texture(texture) { } + virtual bool handler() { + glDeleteTextures(1, &texture); + return true; + } }; - /* ------------------------------------------------------------------------ - * IBinder interface - */ - virtual status_t onTransact(uint32_t code, const Parcel& data, - Parcel* reply, uint32_t flags); - virtual status_t dump(int fd, const Vector& args); - /* ------------------------------------------------------------------------ - * ISurfaceComposer interface - */ - virtual sp createConnection(); - virtual sp createGraphicBufferAlloc(); - virtual sp createDisplay(const String8& displayName, bool secure); - virtual void destroyDisplay(const sp& display); - virtual sp getBuiltInDisplay(int32_t id); - virtual void setTransactionState(const Vector& state, - const Vector& displays, uint32_t flags); - virtual void bootFinished(); - virtual bool authenticateSurfaceTexture( - const sp& bufferProducer) const; - virtual sp createDisplayEventConnection(); - virtual status_t captureScreen(const sp& display, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, ISurfaceComposer::Rotation rotation); - virtual status_t getDisplayStats(const sp& display, - DisplayStatInfo* stats); - virtual status_t getDisplayConfigs(const sp& display, - Vector* configs); - virtual int getActiveConfig(const sp& display); - virtual void setPowerMode(const sp& display, int mode); - virtual status_t setActiveConfig(const sp& display, int id); - virtual status_t clearAnimationFrameStats(); - virtual status_t getAnimationFrameStats(FrameStats* outStats) const; - - /* ------------------------------------------------------------------------ - * DeathRecipient interface - */ +private: + // DeathRecipient interface virtual void binderDied(const wp& who); - /* ------------------------------------------------------------------------ - * RefBase interface - */ - virtual void onFirstRef(); - - /* ------------------------------------------------------------------------ - * HWComposer::EventHandler interface - */ - virtual void onVSyncReceived(int type, nsecs_t timestamp); - virtual void onHotplugReceived(int disp, bool connected); - - /* ------------------------------------------------------------------------ - * Message handling - */ - void waitForEvent(); - void signalTransaction(); - void signalLayerUpdate(); - void signalRefresh(); - - // called on the main thread in response to initializeDisplays() - void onInitializeDisplays(); - // called on the main thread in response to setActiveConfig() - void setActiveConfigInternal(const sp& hw, int mode); - // called on the main thread in response to setPowerMode() - void setPowerModeInternal(const sp& hw, int mode); - - // Returns whether the transaction actually modified any state - bool handleMessageTransaction(); - - // Returns whether a new buffer has been latched (see handlePageFlip()) - bool handleMessageInvalidate(); - - void handleMessageRefresh(); - - void handleTransaction(uint32_t transactionFlags); - void handleTransactionLocked(uint32_t transactionFlags); - - void updateCursorAsync(); - - /* handlePageFlip - latch a new buffer if available and compute the dirty - * region. Returns whether a new buffer has been latched, i.e., whether it - * is necessary to perform a refresh during this vsync. - */ - bool handlePageFlip(); - - /* ------------------------------------------------------------------------ - * Transactions - */ - uint32_t getTransactionFlags(uint32_t flags); - uint32_t peekTransactionFlags(uint32_t flags); - uint32_t setTransactionFlags(uint32_t flags); - void commitTransaction(); +private: + friend class Client; + friend class DisplayEventConnection; + friend class LayerBase; + friend class LayerBaseClient; + friend class Layer; + + sp createSurface( + ISurfaceComposerClient::surface_data_t* params, + const String8& name, + const sp& client, + DisplayID display, uint32_t w, uint32_t h, PixelFormat format, + uint32_t flags); + + sp createNormalSurface( + const sp& client, DisplayID display, + uint32_t w, uint32_t h, uint32_t flags, + PixelFormat& format); + + sp createDimSurface( + const sp& client, DisplayID display, + uint32_t w, uint32_t h, uint32_t flags); + + sp createScreenshotSurface( + const sp& client, DisplayID display, + uint32_t w, uint32_t h, uint32_t flags); + + status_t removeSurface(const sp& client, SurfaceID sid); + status_t destroySurface(const wp& layer); uint32_t setClientStateLocked(const sp& client, const layer_state_t& s); - uint32_t setDisplayStateLocked(const DisplayState& s); - /* ------------------------------------------------------------------------ - * Layer management - */ - status_t createLayer(const String8& name, const sp& client, - uint32_t w, uint32_t h, PixelFormat format, uint32_t flags, - sp* handle, sp* gbp); - - status_t createNormalLayer(const sp& client, const String8& name, - uint32_t w, uint32_t h, uint32_t flags, PixelFormat& format, - sp* outHandle, sp* outGbp, - sp* outLayer); - - status_t createDimLayer(const sp& client, const String8& name, - uint32_t w, uint32_t h, uint32_t flags, sp* outHandle, - sp* outGbp, sp* outLayer); - - // called in response to the window-manager calling - // ISurfaceComposerClient::destroySurface() - status_t onLayerRemoved(const sp& client, const sp& handle); - - // called when all clients have released all their references to - // this layer meaning it is entirely safe to destroy all - // resources associated to this layer. - status_t onLayerDestroyed(const wp& layer); - - // remove a layer from SurfaceFlinger immediately - status_t removeLayer(const sp& layer); - - // add a layer to SurfaceFlinger - status_t addClientLayer(const sp& client, - const sp& handle, - const sp& gbc, - const sp& lbc); - - /* ------------------------------------------------------------------------ - * Boot animation, on/off animations and screen capture - */ - - void startBootAnim(); - - void renderScreenImplLocked( - const sp& hw, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool yswap, bool useIdentityTransform, Transform::orientation_flags rotation); - - status_t captureScreenImplLocked( - const sp& hw, - const sp& producer, - Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight, - uint32_t minLayerZ, uint32_t maxLayerZ, - bool useIdentityTransform, Transform::orientation_flags rotation); - - /* ------------------------------------------------------------------------ - * EGL - */ - size_t getMaxTextureSize() const; - size_t getMaxViewportDims() const; - - /* ------------------------------------------------------------------------ - * Display and layer stack management - */ - // called when starting, or restarting after system_server death - void initializeDisplays(); - - // Create an IBinder for a builtin display and add it to current state - void createBuiltinDisplayLocked(DisplayDevice::DisplayType type); - - // NOTE: can only be called from the main thread or with mStateLock held - sp getDisplayDevice(const wp& dpy) const { - return mDisplays.valueFor(dpy); - } - - // NOTE: can only be called from the main thread or with mStateLock held - sp getDisplayDevice(const wp& dpy) { - return mDisplays.valueFor(dpy); - } - - // mark a region of a layer stack dirty. this updates the dirty - // region of all screens presenting this layer stack. - void invalidateLayerStack(uint32_t layerStack, const Region& dirty); - - // allocate a h/w composer display id - int32_t allocateHwcDisplayId(DisplayDevice::DisplayType type); - - /* ------------------------------------------------------------------------ - * H/W composer - */ - - HWComposer& getHwComposer() const { return *mHwc; } - - /* ------------------------------------------------------------------------ - * Compositing - */ - void invalidateHwcGeometry(); - static void computeVisibleRegions( - const LayerVector& currentLayers, uint32_t layerStack, - Region& dirtyRegion, Region& opaqueRegion); - - void preComposition(); - void postComposition(); - void rebuildLayerStacks(); - void setUpHWComposer(); - void doComposition(); - void doDebugFlashRegions(); - void doDisplayComposition(const sp& hw, const Region& dirtyRegion); - - // compose surfaces for display hw. this fails if using GL and the surface - // has been destroyed and is no longer valid. - bool doComposeSurfaces(const sp& hw, const Region& dirty); - - void postFramebuffer(); - void drawWormhole(const sp& hw, const Region& region) const; - - /* ------------------------------------------------------------------------ - * Display management - */ - - /* ------------------------------------------------------------------------ - * VSync - */ - void enableHardwareVsync(); - void disableHardwareVsync(bool makeUnavailable); - void resyncToHardwareVsync(bool makeAvailable); - - /* ------------------------------------------------------------------------ - * Debugging & dumpsys - */ - void listLayersLocked(const Vector& args, size_t& index, String8& result) const; - void dumpStatsLocked(const Vector& args, size_t& index, String8& result) const; - void clearStatsLocked(const Vector& args, size_t& index, String8& result); - void dumpAllLocked(const Vector& args, size_t& index, String8& result) const; - bool startDdmConnection(); - static void appendSfConfigString(String8& result); - void checkScreenshot(size_t w, size_t s, size_t h, void const* vaddr, - const sp& hw, - uint32_t minLayerZ, uint32_t maxLayerZ); + class LayerVector : public SortedVector< sp > { + public: + LayerVector() { } + LayerVector(const LayerVector& rhs) : SortedVector< sp >(rhs) { } + virtual int do_compare(const void* lhs, const void* rhs) const { + const sp& l(*reinterpret_cast*>(lhs)); + const sp& r(*reinterpret_cast*>(rhs)); + // sort layers by Z order + uint32_t lz = l->currentState().z; + uint32_t rz = r->currentState().z; + // then by sequence, so we get a stable ordering + return (lz != rz) ? (lz - rz) : (l->sequence - r->sequence); + } + }; + + struct State { + State() + : orientation(ISurfaceComposer::eOrientationDefault), + orientationFlags(0) { + } + LayerVector layersSortedByZ; + uint8_t orientation; + uint8_t orientationFlags; + }; - void logFrameStats(); + virtual bool threadLoop(); + virtual status_t readyToRun(); + virtual void onFirstRef(); + +public: // hack to work around gcc 4.0.3 bug + const GraphicPlane& graphicPlane(int dpy) const; + GraphicPlane& graphicPlane(int dpy); + + void signalTransaction(); + void signalLayerUpdate(); + void signalRefresh(); + void repaintEverything(); - void dumpStaticScreenStats(String8& result) const; +private: + void waitForEvent(); + void handleTransaction(uint32_t transactionFlags); + void handleTransactionLocked(uint32_t transactionFlags); + + void computeVisibleRegions( + const LayerVector& currentLayers, + Region& dirtyRegion, + Region& wormholeRegion); + + void handlePageFlip(); + bool lockPageFlip(const LayerVector& currentLayers); + void unlockPageFlip(const LayerVector& currentLayers); + void handleRefresh(); + void handleWorkList(); + void handleRepaint(); + void postFramebuffer(); + void setupHardwareComposer(); + void composeSurfaces(const Region& dirty); + + + void setInvalidateRegion(const Region& reg); + Region getAndClearInvalidateRegion(); + + ssize_t addClientLayer(const sp& client, + const sp& lbc); + status_t addLayer_l(const sp& layer); + status_t removeLayer_l(const sp& layer); + status_t purgatorizeLayer_l(const sp& layer); + + uint32_t getTransactionFlags(uint32_t flags); + uint32_t peekTransactionFlags(uint32_t flags); + uint32_t setTransactionFlags(uint32_t flags); + void commitTransaction(); + + + status_t captureScreenImplLocked(DisplayID dpy, + sp* heap, + uint32_t* width, uint32_t* height, PixelFormat* format, + uint32_t reqWidth, uint32_t reqHeight, + uint32_t minLayerZ, uint32_t maxLayerZ); + + status_t turnElectronBeamOffImplLocked(int32_t mode); + status_t turnElectronBeamOnImplLocked(int32_t mode); + status_t electronBeamOffAnimationImplLocked(); + status_t electronBeamOnAnimationImplLocked(); + + void debugFlashRegions(); + void drawWormhole() const; + + void startBootAnim(); + + void listLayersLocked(const Vector& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const; + void dumpStatsLocked(const Vector& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const; + void clearStatsLocked(const Vector& args, size_t& index, + String8& result, char* buffer, size_t SIZE) const; + void dumpAllLocked(String8& result, char* buffer, size_t SIZE) const; + + mutable MessageQueue mEventQueue; + + // access must be protected by mStateLock + mutable Mutex mStateLock; + State mCurrentState; + volatile int32_t mTransactionFlags; + Condition mTransactionCV; + SortedVector< sp > mLayerPurgatory; + bool mTransationPending; + Vector< sp > mLayersPendingRemoval; + + // protected by mStateLock (but we could use another lock) + GraphicPlane mGraphicPlanes[1]; + bool mLayersRemoved; + DefaultKeyedVector< wp, wp > mLayerMap; + + // access must be protected by mInvalidateLock + mutable Mutex mInvalidateLock; + Region mInvalidateRegion; + + // constant members (no synchronization needed for access) + sp mServerHeap; + surface_flinger_cblk_t* mServerCblk; + GLuint mWormholeTexName; + GLuint mProtectedTexName; + nsecs_t mBootTime; + sp mEventThread; + + // Can only accessed from the main thread, these members + // don't need synchronization + State mDrawingState; + Region mDirtyRegion; + Region mDirtyRegionRemovedLayer; + Region mSwapRegion; + Region mWormholeRegion; + bool mVisibleRegionsDirty; + bool mHwWorkListDirty; + int32_t mElectronBeamAnimationMode; + Vector< sp > mVisibleLayersSortedByZ; + + + // don't use a lock for these, we don't care + int mDebugRegion; + int mDebugDDMS; + int mDebugDisableHWC; + int mDebugDisableTransformHint; + volatile nsecs_t mDebugInSwapBuffers; + nsecs_t mLastSwapBufferTime; + volatile nsecs_t mDebugInTransaction; + nsecs_t mLastTransactionTime; + bool mBootFinished; + + // these are thread safe + mutable Barrier mReadyToRunBarrier; + + + // protected by mDestroyedLayerLock; + mutable Mutex mDestroyedLayerLock; + Vector mDestroyedLayers; - /* ------------------------------------------------------------------------ - * Attributes - */ - - // access must be protected by mStateLock - mutable Mutex mStateLock; - State mCurrentState; - volatile int32_t mTransactionFlags; - Condition mTransactionCV; - bool mTransactionPending; - bool mAnimTransactionPending; - Vector< sp > mLayersPendingRemoval; - SortedVector< wp > mGraphicBufferProducerList; - - // protected by mStateLock (but we could use another lock) - bool mLayersRemoved; - - // access must be protected by mInvalidateLock - volatile int32_t mRepaintEverything; - - // constant members (no synchronization needed for access) - HWComposer* mHwc; - RenderEngine* mRenderEngine; - nsecs_t mBootTime; - bool mGpuToCpuSupported; - bool mDropMissedFrames; - sp mEventThread; - sp mSFEventThread; - sp mEventControlThread; - EGLContext mEGLContext; - EGLDisplay mEGLDisplay; - sp mBuiltinDisplays[DisplayDevice::NUM_BUILTIN_DISPLAY_TYPES]; - - // Can only accessed from the main thread, these members - // don't need synchronization - State mDrawingState; - bool mVisibleRegionsDirty; - bool mHwWorkListDirty; - bool mAnimCompositionPending; - - // this may only be written from the main thread with mStateLock held - // it may be read from other threads with mStateLock held - DefaultKeyedVector< wp, sp > mDisplays; - - // don't use a lock for these, we don't care - int mDebugRegion; - int mDebugDDMS; - int mDebugDisableHWC; - int mDebugDisableTransformHint; - volatile nsecs_t mDebugInSwapBuffers; - nsecs_t mLastSwapBufferTime; - volatile nsecs_t mDebugInTransaction; - nsecs_t mLastTransactionTime; - bool mBootFinished; - bool mForceFullDamage; - - // these are thread safe - mutable MessageQueue mEventQueue; - FrameTracker mAnimFrameTracker; - DispSync mPrimaryDispSync; - - // protected by mDestroyedLayerLock; - mutable Mutex mDestroyedLayerLock; - Vector mDestroyedLayers; - - // protected by mHWVsyncLock - Mutex mHWVsyncLock; - bool mPrimaryHWVsyncEnabled; - bool mHWVsyncAvailable; - - /* ------------------------------------------------------------------------ - * Feature prototyping - */ - - Daltonizer mDaltonizer; - bool mDaltonize; - - mat4 mColorMatrix; - bool mHasColorMatrix; - - // Static screen stats - bool mHasPoweredOff; - static const size_t NUM_BUCKETS = 8; // < 1-7, 7+ - nsecs_t mFrameBuckets[NUM_BUCKETS]; - nsecs_t mTotalTime; - nsecs_t mLastSwapTime; + // only written in the main thread, only read in other threads + volatile int32_t mSecureFrameBuffer; }; +// --------------------------------------------------------------------------- }; // namespace android #endif // ANDROID_SURFACE_FLINGER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceTextureLayer.cpp android-platform-frameworks-native-21/services/surfaceflinger/SurfaceTextureLayer.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceTextureLayer.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/SurfaceTextureLayer.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,65 @@ +/* + * 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 +#include +#include + +#include + +#include "Layer.h" +#include "SurfaceTextureLayer.h" + +namespace android { +// --------------------------------------------------------------------------- + + +SurfaceTextureLayer::SurfaceTextureLayer() + : BufferQueue(true) { +} + +SurfaceTextureLayer::~SurfaceTextureLayer() { +} + +status_t SurfaceTextureLayer::connect(int api, QueueBufferOutput* output) { + status_t err = BufferQueue::connect(api, output); + if (err == NO_ERROR) { + switch(api) { + case NATIVE_WINDOW_API_MEDIA: + case NATIVE_WINDOW_API_CAMERA: + // Camera preview and videos are rate-limited on the producer + // side. If enabled for this build, we use async mode to always + // show the most recent frame at the cost of requiring an + // additional buffer. +#ifndef NEVER_DEFAULT_TO_ASYNC_MODE + err = setSynchronousMode(false); + break; +#endif + // fall through to set synchronous mode when not defaulting to + // async mode. + default: + err = setSynchronousMode(true); + break; + } + if (err != NO_ERROR) { + disconnect(api); + } + } + return err; +} + +// --------------------------------------------------------------------------- +}; // namespace android diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceTextureLayer.h android-platform-frameworks-native-21/services/surfaceflinger/SurfaceTextureLayer.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/SurfaceTextureLayer.h 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/SurfaceTextureLayer.h 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,46 @@ +/* + * 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. + */ + +#ifndef ANDROID_SURFACE_TEXTURE_LAYER_H +#define ANDROID_SURFACE_TEXTURE_LAYER_H + +#include +#include +#include + +#include +#include + +namespace android { +// --------------------------------------------------------------------------- + +class Layer; + +// SurfaceTextureLayer is now a BufferQueue since SurfaceTexture has been +// refactored +class SurfaceTextureLayer : public BufferQueue +{ +public: + SurfaceTextureLayer(); + ~SurfaceTextureLayer(); + + virtual status_t connect(int api, QueueBufferOutput* output); +}; + +// --------------------------------------------------------------------------- +}; // namespace android + +#endif // ANDROID_SURFACE_TEXTURE_LAYER_H diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/Android.mk android-platform-frameworks-native-21/services/surfaceflinger/tests/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/Android.mk 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -1,7 +1,6 @@ # Build the unit tests, LOCAL_PATH:= $(call my-dir) include $(CLEAR_VARS) -LOCAL_ADDITIONAL_DEPENDENCIES := $(LOCAL_PATH)/Android.mk LOCAL_MODULE := SurfaceFlinger_test @@ -16,9 +15,16 @@ libbinder \ libcutils \ libgui \ + libstlport \ libui \ libutils \ +LOCAL_C_INCLUDES := \ + bionic \ + bionic/libstdc++/include \ + external/gtest/include \ + external/stlport/stlport \ + # Build the binary to $(TARGET_OUT_DATA_NATIVE_TESTS)/$(LOCAL_MODULE) # to integrate with auto-test framework. include $(BUILD_NATIVE_TEST) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/resize/resize.cpp android-platform-frameworks-native-21/services/surfaceflinger/tests/resize/resize.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/resize/resize.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/resize/resize.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -38,27 +38,26 @@ // create a client to surfaceflinger sp client = new SurfaceComposerClient(); - sp surfaceControl = client->createSurface(String8("resize"), - 160, 240, PIXEL_FORMAT_RGB_565, 0); + sp surface = client->createSurface(0, 160, 240, + PIXEL_FORMAT_RGB_565); - sp surface = surfaceControl->getSurface(); SurfaceComposerClient::openGlobalTransaction(); - surfaceControl->setLayer(100000); + surface->setLayer(100000); SurfaceComposerClient::closeGlobalTransaction(); - ANativeWindow_Buffer outBuffer; - surface->lock(&outBuffer, NULL); - ssize_t bpr = outBuffer.stride * bytesPerPixel(outBuffer.format); - android_memset16((uint16_t*)outBuffer.bits, 0xF800, bpr*outBuffer.height); + Surface::SurfaceInfo info; + surface->lock(&info); + ssize_t bpr = info.s * bytesPerPixel(info.format); + android_memset16((uint16_t*)info.bits, 0xF800, bpr*info.h); surface->unlockAndPost(); - surface->lock(&outBuffer); - android_memset16((uint16_t*)outBuffer.bits, 0x07E0, bpr*outBuffer.height); + surface->lock(&info); + android_memset16((uint16_t*)info.bits, 0x07E0, bpr*info.h); surface->unlockAndPost(); SurfaceComposerClient::openGlobalTransaction(); - surfaceControl->setSize(320, 240); + surface->setSize(320, 240); SurfaceComposerClient::closeGlobalTransaction(); diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/screencap/screencap.cpp android-platform-frameworks-native-21/services/surfaceflinger/tests/screencap/screencap.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/screencap/screencap.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/screencap/screencap.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -42,8 +42,7 @@ sp heap; uint32_t w, h; PixelFormat f; - sp display(composer->getBuiltInDisplay(ISurfaceComposer::eDisplayIdMain)); - status_t err = composer->captureScreen(display, &heap, &w, &h, &f, 0, 0); + status_t err = composer->captureScreen(0, &heap, &w, &h, &f, 0, 0); if (err != NO_ERROR) { fprintf(stderr, "screen capture failed: %s\n", strerror(-err)); exit(0); diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/surface/Android.mk android-platform-frameworks-native-21/services/surfaceflinger/tests/surface/Android.mk --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/surface/Android.mk 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/surface/Android.mk 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,18 @@ +LOCAL_PATH:= $(call my-dir) +include $(CLEAR_VARS) + +LOCAL_SRC_FILES:= \ + surface.cpp + +LOCAL_SHARED_LIBRARIES := \ + libcutils \ + libutils \ + libbinder \ + libui \ + libgui + +LOCAL_MODULE:= test-surface + +LOCAL_MODULE_TAGS := tests + +include $(BUILD_EXECUTABLE) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/surface/surface.cpp android-platform-frameworks-native-21/services/surfaceflinger/tests/surface/surface.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/surface/surface.cpp 1970-01-01 00:00:00.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/surface/surface.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -0,0 +1,66 @@ +/* + * Copyright (C) 2010 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 + +#include + +#include +#include +#include + +#include +#include + +using namespace android; + +int main(int argc, char** argv) +{ + // set up the thread-pool + sp proc(ProcessState::self()); + ProcessState::self()->startThreadPool(); + + // create a client to surfaceflinger + sp client = new SurfaceComposerClient(); + + sp surfaceControl = client->createSurface( + 0, 160, 240, PIXEL_FORMAT_RGB_565); + SurfaceComposerClient::openGlobalTransaction(); + surfaceControl->setLayer(100000); + SurfaceComposerClient::closeGlobalTransaction(); + + // pretend it went cross-process + Parcel parcel; + SurfaceControl::writeSurfaceToParcel(surfaceControl, &parcel); + parcel.setDataPosition(0); + sp surface = Surface::readFromParcel(parcel); + ANativeWindow* window = surface.get(); + + printf("window=%p\n", window); + + int err = native_window_set_buffer_count(window, 8); + ANativeWindowBuffer* buffer; + + for (int i=0 ; i<8 ; i++) { + window->dequeueBuffer(window, &buffer); + printf("buffer %d: %p\n", i, buffer); + } + + printf("test complete. CTRL+C to finish.\n"); + + IPCThreadState::self()->joinThreadPool(); + return 0; +} diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/Transaction_test.cpp android-platform-frameworks-native-21/services/surfaceflinger/tests/Transaction_test.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/Transaction_test.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/Transaction_test.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -16,8 +16,6 @@ #include -#include - #include #include @@ -26,21 +24,20 @@ #include #include -#include namespace android { // Fill an RGBA_8888 formatted surface with a single color. static void fillSurfaceRGBA8(const sp& sc, uint8_t r, uint8_t g, uint8_t b) { - ANativeWindow_Buffer outBuffer; + Surface::SurfaceInfo info; sp s = sc->getSurface(); ASSERT_TRUE(s != NULL); - ASSERT_EQ(NO_ERROR, s->lock(&outBuffer, NULL)); - uint8_t* img = reinterpret_cast(outBuffer.bits); - for (uint32_t y = 0; y < outBuffer.height; y++) { - for (uint32_t x = 0; x < outBuffer.width; x++) { - uint8_t* pixel = img + (4 * (y*outBuffer.stride + x)); + ASSERT_EQ(NO_ERROR, s->lock(&info)); + uint8_t* img = reinterpret_cast(info.bits); + for (uint32_t y = 0; y < info.h; y++) { + for (uint32_t x = 0; x < info.w; x++) { + uint8_t* pixel = img + (4 * (y*info.s + x)); pixel[0] = r; pixel[1] = g; pixel[2] = b; @@ -55,23 +52,20 @@ class ScreenCapture : public RefBase { public: static void captureScreen(sp* sc) { - sp producer; - sp consumer; - BufferQueue::createBufferQueue(&producer, &consumer); - IGraphicBufferProducer::QueueBufferOutput bufferOutput; - sp cpuConsumer = new CpuConsumer(consumer, 1); + sp heap; + uint32_t w=0, h=0; + PixelFormat fmt=0; sp sf(ComposerService::getComposerService()); - sp display(sf->getBuiltInDisplay( - ISurfaceComposer::eDisplayIdMain)); - ASSERT_EQ(NO_ERROR, sf->captureScreen(display, producer, Rect(), 0, 0, - 0, INT_MAX, false)); - *sc = new ScreenCapture(cpuConsumer); + ASSERT_EQ(NO_ERROR, sf->captureScreen(0, &heap, &w, &h, &fmt, 0, 0, + 0, INT_MAX)); + ASSERT_TRUE(heap != NULL); + ASSERT_EQ(PIXEL_FORMAT_RGBA_8888, fmt); + *sc = new ScreenCapture(w, h, heap); } void checkPixel(uint32_t x, uint32_t y, uint8_t r, uint8_t g, uint8_t b) { - ASSERT_EQ(HAL_PIXEL_FORMAT_RGBA_8888, mBuf.format); - const uint8_t* img = static_cast(mBuf.data); - const uint8_t* pixel = img + (4 * (y * mBuf.stride + x)); + const uint8_t* img = reinterpret_cast(mHeap->base()); + const uint8_t* pixel = img + (4 * (y*mWidth + x)); if (r != pixel[0] || g != pixel[1] || b != pixel[2]) { String8 err(String8::format("pixel @ (%3d, %3d): " "expected [%3d, %3d, %3d], got [%3d, %3d, %3d]", @@ -81,17 +75,15 @@ } private: - ScreenCapture(const sp& cc) : - mCC(cc) { - EXPECT_EQ(NO_ERROR, mCC->lockNextBuffer(&mBuf)); - } - - ~ScreenCapture() { - mCC->unlockBuffer(mBuf); - } - - sp mCC; - CpuConsumer::LockedBuffer mBuf; + ScreenCapture(uint32_t w, uint32_t h, const sp& heap) : + mWidth(w), + mHeight(h), + mHeap(heap) + {} + + const uint32_t mWidth; + const uint32_t mHeight; + sp mHeap; }; class LayerUpdateTest : public ::testing::Test { @@ -100,17 +92,12 @@ mComposerClient = new SurfaceComposerClient; ASSERT_EQ(NO_ERROR, mComposerClient->initCheck()); - sp display(SurfaceComposerClient::getBuiltInDisplay( - ISurfaceComposer::eDisplayIdMain)); - DisplayInfo info; - SurfaceComposerClient::getDisplayInfo(display, &info); - - ssize_t displayWidth = info.w; - ssize_t displayHeight = info.h; + ssize_t displayWidth = mComposerClient->getDisplayWidth(0); + ssize_t displayHeight = mComposerClient->getDisplayHeight(0); // Background surface mBGSurfaceControl = mComposerClient->createSurface( - String8("BG Test Surface"), displayWidth, displayHeight, + String8("BG Test Surface"), 0, displayWidth, displayHeight, PIXEL_FORMAT_RGBA_8888, 0); ASSERT_TRUE(mBGSurfaceControl != NULL); ASSERT_TRUE(mBGSurfaceControl->isValid()); @@ -118,7 +105,7 @@ // Foreground surface mFGSurfaceControl = mComposerClient->createSurface( - String8("FG Test Surface"), 64, 64, PIXEL_FORMAT_RGBA_8888, 0); + String8("FG Test Surface"), 0, 64, 64, PIXEL_FORMAT_RGBA_8888, 0); ASSERT_TRUE(mFGSurfaceControl != NULL); ASSERT_TRUE(mFGSurfaceControl->isValid()); @@ -126,7 +113,7 @@ // Synchronization surface mSyncSurfaceControl = mComposerClient->createSurface( - String8("Sync Test Surface"), 1, 1, PIXEL_FORMAT_RGBA_8888, 0); + String8("Sync Test Surface"), 0, 1, 1, PIXEL_FORMAT_RGBA_8888, 0); ASSERT_TRUE(mSyncSurfaceControl != NULL); ASSERT_TRUE(mSyncSurfaceControl->isValid()); diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/vsync/vsync.cpp android-platform-frameworks-native-21/services/surfaceflinger/tests/vsync/vsync.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/vsync/vsync.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/vsync/vsync.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -14,7 +14,6 @@ * limitations under the License. */ -#include #include #include diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp android-platform-frameworks-native-21/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/tests/waitforvsync/waitforvsync.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -23,7 +23,6 @@ #include #include #include -#include #ifndef FBIO_WAITFORVSYNC #define FBIO_WAITFORVSYNC _IOW('F', 0x20, __u32) diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Transform.cpp android-platform-frameworks-native-21/services/surfaceflinger/Transform.cpp --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Transform.cpp 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Transform.cpp 2012-10-16 22:57:11.000000000 +0000 @@ -83,8 +83,8 @@ return r; } -const vec3& Transform::operator [] (size_t i) const { - return mMatrix[i]; +float const* Transform::operator [] (int i) const { + return mMatrix[i].v; } bool Transform::transformed() const { @@ -173,7 +173,7 @@ return NO_ERROR; } -vec2 Transform::transform(const vec2& v) const { +Transform::vec2 Transform::transform(const vec2& v) const { vec2 r; const mat33& M(mMatrix); r[0] = M[0][0]*v[0] + M[1][0]*v[1] + M[2][0]; @@ -181,7 +181,7 @@ return r; } -vec3 Transform::transform(const vec3& v) const { +Transform::vec3 Transform::transform(const vec3& v) const { vec3 r; const mat33& M(mMatrix); r[0] = M[0][0]*v[0] + M[1][0]*v[1] + M[2][0]*v[2]; @@ -190,9 +190,13 @@ return r; } -vec2 Transform::transform(int x, int y) const +void Transform::transform(float* point, int x, int y) const { - return transform(vec2(x,y)); + const mat33& M(mMatrix); + vec2 v(x, y); + v = transform(v); + point[0] = v[0]; + point[1] = v[1]; } Rect Transform::makeBounds(int w, int h) const @@ -295,45 +299,6 @@ return mType; } -Transform Transform::inverse() const { - // our 3x3 matrix is always of the form of a 2x2 transformation - // followed by a translation: T*M, therefore: - // (T*M)^-1 = M^-1 * T^-1 - Transform result; - if (mType <= TRANSLATE) { - // 1 0 0 - // 0 1 0 - // x y 1 - result = *this; - result.mMatrix[2][0] = -result.mMatrix[2][0]; - result.mMatrix[2][1] = -result.mMatrix[2][1]; - } else { - // a c 0 - // b d 0 - // x y 1 - const mat33& M(mMatrix); - const float a = M[0][0]; - const float b = M[1][0]; - const float c = M[0][1]; - const float d = M[1][1]; - const float x = M[2][0]; - const float y = M[2][1]; - - const float idet = 1.0 / (a*d - b*c); - result.mMatrix[0][0] = d*idet; - result.mMatrix[0][1] = -c*idet; - result.mMatrix[1][0] = -b*idet; - result.mMatrix[1][1] = a*idet; - result.mType = mType; - - vec2 T(-x, -y); - T = result.transform(T); - result.mMatrix[2][0] = T[0]; - result.mMatrix[2][1] = T[1]; - } - return result; -} - uint32_t Transform::getType() const { return type() & 0xFF; } diff -Nru android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Transform.h android-platform-frameworks-native-21/services/surfaceflinger/Transform.h --- android-platform-frameworks-native-6.0.1+r16/services/surfaceflinger/Transform.h 2016-02-15 21:17:12.000000000 +0000 +++ android-platform-frameworks-native-21/services/surfaceflinger/Transform.h 2012-10-16 22:57:11.000000000 +0000 @@ -22,8 +22,6 @@ #include #include -#include -#include #include @@ -65,7 +63,7 @@ uint32_t getType() const; uint32_t getOrientation() const; - const vec3& operator [] (size_t i) const; // returns column i + float const* operator [] (int i) const; // returns column i float tx() const; float ty() const; @@ -77,17 +75,33 @@ // transform data Rect makeBounds(int w, int h) const; - vec2 transform(int x, int y) const; + void transform(float* point, int x, int y) const; Region transform(const Region& reg) const; Rect transform(const Rect& bounds) const; Transform operator * (const Transform& rhs) const; - Transform inverse() const; - // for debugging void dump(const char* name) const; private: + struct vec3 { + float v[3]; + inline vec3() { } + inline vec3(float a, float b, float c) { + v[0] = a; v[1] = b; v[2] = c; + } + inline float operator [] (int i) const { return v[i]; } + inline float& operator [] (int i) { return v[i]; } + }; + struct vec2 { + float v[2]; + inline vec2() { } + inline vec2(float a, float b) { + v[0] = a; v[1] = b; + } + inline float operator [] (int i) const { return v[i]; } + inline float& operator [] (int i) { return v[i]; } + }; struct mat33 { vec3 v[3]; inline const vec3& operator [] (int i) const { return v[i]; }