Merge "Refresh the native app ops manager's token if needed." into nyc-dev
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 0471fc0..315a3ca 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -485,7 +485,8 @@
/* adds a new entry to the existing zip file. */
static bool add_zip_entry_from_fd(const std::string& entry_name, int fd) {
if (!zip_writer) {
- MYLOGD("Not adding zip entry %s from fd because zip_writer is not set\n", entry_name.c_str());
+ MYLOGD("Not adding zip entry %s from fd because zip_writer is not set\n",
+ entry_name.c_str());
return false;
}
// Logging statement below is useful to time how long each entry takes, but it's too verbose.
@@ -545,6 +546,7 @@
MYLOGD("Not adding dir %s because zip_writer is not set\n", dir);
return;
}
+ MYLOGD("Adding dir %s (recursive: %d)\n", dir, recursive);
DurationReporter duration_reporter(dir, NULL);
dump_files(NULL, dir, recursive ? skip_none : is_dir, _add_file_from_fd);
}
@@ -1064,6 +1066,7 @@
}
/* parse arguments */
+ log_args("Dumpstate command line", argc, const_cast<const char **>(argv));
int c;
while ((c = getopt(argc, argv, "dho:svqzpPBRV:")) != -1) {
switch (c) {
@@ -1276,14 +1279,6 @@
dumpstate(do_early_screenshot ? "": screenshot_path, version);
- /* done */
- if (vibrator) {
- for (int i = 0; i < 3; i++) {
- vibrate(vibrator.get(), 75);
- usleep((75 + 50) * 1000);
- }
- }
-
/* close output if needed */
if (is_redirecting) {
fclose(stdout);
@@ -1325,8 +1320,9 @@
bool do_text_file = true;
if (do_zip_file) {
- MYLOGD("Adding text entry to .zip bugreport\n");
- if (!finish_zip_file(base_name + "-" + suffix + ".txt", tmp_path, now)) {
+ std::string entry_name = base_name + "-" + suffix + ".txt";
+ MYLOGD("Adding main entry (%s) to .zip bugreport\n", entry_name.c_str());
+ if (!finish_zip_file(entry_name, tmp_path, now)) {
MYLOGE("Failed to finish zip file; sending text bugreport instead\n");
do_text_file = true;
} else {
@@ -1334,8 +1330,8 @@
}
}
if (do_text_file) {
- MYLOGD("Generating .txt bugreport\n");
path = bugreport_dir + "/" + base_name + "-" + suffix + ".txt";
+ MYLOGD("Generating .txt bugreport at %s from %s\n", path.c_str(), tmp_path.c_str());
if (rename(tmp_path.c_str(), path.c_str())) {
MYLOGE("rename(%s, %s): %s\n", tmp_path.c_str(), path.c_str(), strerror(errno));
path.clear();
@@ -1343,6 +1339,14 @@
}
}
+ /* vibrate a few but shortly times to let user know it's finished */
+ if (vibrator) {
+ for (int i = 0; i < 3; i++) {
+ vibrate(vibrator.get(), 75);
+ usleep((75 + 50) * 1000);
+ }
+ }
+
/* tell activity manager we're done */
if (do_broadcast) {
if (!path.empty()) {
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index a8aea42..9c975d2 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -171,6 +171,9 @@
/* dump eMMC Extended CSD data */
void dump_emmc_ecsd(const char *ext_csd_path);
+/** logs command-line arguments */
+void log_args(const std::string& message, int argc, const char *argv[]);
+
/*
* Helper class used to report how long it takes for a section to finish.
*
diff --git a/cmds/dumpstate/utils.cpp b/cmds/dumpstate/utils.cpp
index 282a772..f0ae325 100644
--- a/cmds/dumpstate/utils.cpp
+++ b/cmds/dumpstate/utils.cpp
@@ -713,6 +713,7 @@
}
// Always terminate with NULL.
am_args[am_index + 1] = NULL;
+ log_args("send_broadcast arguments", am_index, am_args);
run_command_always(NULL, 5, am_args);
}
@@ -1187,3 +1188,12 @@
printf("\n");
}
+
+void log_args(const std::string& message, int argc, const char *argv[]) {
+ std::string args;
+ for (int i = 0; i < argc; i++) {
+ args.append(argv[i]);
+ args.append(" ");
+ }
+ MYLOGI("%s: %s\n", message.c_str(), args.c_str());
+}
diff --git a/data/etc/android.hardware.vulkan.level-0.xml b/data/etc/android.hardware.vulkan.level-0.xml
new file mode 100644
index 0000000..39c65ac
--- /dev/null
+++ b/data/etc/android.hardware.vulkan.level-0.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT 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 the standard feature indicating that the device supports Vulkan
+ hardware level 0. -->
+<permissions>
+ <feature name="android.hardware.vulkan.level" version="0" />
+</permissions>
diff --git a/data/etc/android.hardware.vulkan.level-1.xml b/data/etc/android.hardware.vulkan.level-1.xml
new file mode 100644
index 0000000..c3f5513
--- /dev/null
+++ b/data/etc/android.hardware.vulkan.level-1.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT 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 the standard feature indicating that the device supports Vulkan
+ hardware level 1. -->
+<permissions>
+ <feature name="android.hardware.vulkan.level" version="1" />
+</permissions>
diff --git a/data/etc/android.hardware.vulkan.version-1_0_3.xml b/data/etc/android.hardware.vulkan.version-1_0_3.xml
new file mode 100644
index 0000000..adc5a5d
--- /dev/null
+++ b/data/etc/android.hardware.vulkan.version-1_0_3.xml
@@ -0,0 +1,21 @@
+<?xml version="1.0" encoding="utf-8"?>
+<!-- Copyright 2016 The Android Open Source Project
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT 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 the standard feature indicating that the device has a Vulkan
+ driver that supports API version 1.0.3 (0x00400003) -->
+<permissions>
+ <feature name="android.hardware.vulkan.version" version="4194307" />
+</permissions>
diff --git a/opengl/libs/EGL/Loader.cpp b/opengl/libs/EGL/Loader.cpp
index e593a72..49f501d 100644
--- a/opengl/libs/EGL/Loader.cpp
+++ b/opengl/libs/EGL/Loader.cpp
@@ -92,7 +92,7 @@
return -1;
/* We are in the emulator, get GPU status value */
- property_get("ro.kernel.qemu.gles",prop,"0");
+ property_get("qemu.gles",prop,"0");
return atoi(prop);
}
@@ -174,11 +174,45 @@
#endif
#endif
+static void setEmulatorGlesValue(void) {
+ char prop[PROPERTY_VALUE_MAX];
+ property_get("ro.kernel.qemu", prop, "0");
+ if (atoi(prop) != 1) return;
+
+ property_get("ro.kernel.qemu.gles",prop,"0");
+ if (atoi(prop) == 1) {
+ ALOGD("Emulator has host GPU support, qemu.gles is set to 1.");
+ property_set("qemu.gles", "1");
+ return;
+ }
+
+ // for now, checking the following
+ // directory is good enough for emulator system images
+ const char* vendor_lib_path =
+#if defined(__LP64__)
+ "/vendor/lib64/egl";
+#else
+ "/vendor/lib/egl";
+#endif
+
+ const bool has_vendor_lib = (access(vendor_lib_path, R_OK) == 0);
+ if (has_vendor_lib) {
+ ALOGD("Emulator has vendor provided software renderer, qemu.gles is set to 2.");
+ property_set("qemu.gles", "2");
+ } else {
+ ALOGD("Emulator without GPU support detected. "
+ "Fallback to legacy software renderer, qemu.gles is set to 0.");
+ property_set("qemu.gles", "0");
+ }
+}
+
void* Loader::open(egl_connection_t* cnx)
{
void* dso;
driver_t* hnd = 0;
+ setEmulatorGlesValue();
+
dso = load_driver("GLES", cnx, EGL | GLESv1_CM | GLESv2);
if (dso) {
hnd = new driver_t(dso);
@@ -280,8 +314,6 @@
int emulationStatus = checkGlesEmulationStatus();
switch (emulationStatus) {
case 0:
- ALOGD("Emulator without GPU support detected. "
- "Fallback to legacy software renderer.");
#if defined(__LP64__)
result.setTo("/system/lib64/egl/libGLES_android.so");
#else
diff --git a/opengl/tools/glgen/specs/gles11/GLES30.spec b/opengl/tools/glgen/specs/gles11/GLES30.spec
index a426eb0..f190fc0 100644
--- a/opengl/tools/glgen/specs/gles11/GLES30.spec
+++ b/opengl/tools/glgen/specs/gles11/GLES30.spec
@@ -108,3 +108,4 @@
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 )
+void glReadPixels ( GLint x, GLint y, GLsizei width, GLsizei height, GLenum format, GLenum type, GLint offset )
diff --git a/services/surfaceflinger/DisplayDevice.cpp b/services/surfaceflinger/DisplayDevice.cpp
index bdf8f74..e9cbbca 100644
--- a/services/surfaceflinger/DisplayDevice.cpp
+++ b/services/surfaceflinger/DisplayDevice.cpp
@@ -82,7 +82,6 @@
mFlags(),
mPageFlipCount(),
mIsSecure(isSecure),
- mSecureLayerVisible(false),
mLayerStack(NO_LAYER_STACK),
mOrientation(),
mPowerMode(HWC_POWER_MODE_OFF),
@@ -307,24 +306,12 @@
void DisplayDevice::setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers) {
mVisibleLayersSortedByZ = layers;
- mSecureLayerVisible = false;
- size_t count = layers.size();
- for (size_t i=0 ; i<count ; i++) {
- const sp<Layer>& layer(layers[i]);
- if (layer->isSecure()) {
- mSecureLayerVisible = true;
- }
- }
}
const Vector< sp<Layer> >& DisplayDevice::getVisibleLayersSortedByZ() const {
return mVisibleLayersSortedByZ;
}
-bool DisplayDevice::getSecureLayerVisible() const {
- return mSecureLayerVisible;
-}
-
Region DisplayDevice::getDirtyRegion(bool repaintEverything) const {
Region dirty;
if (repaintEverything) {
@@ -506,13 +493,13 @@
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"
+ "flips=%u, isSecure=%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,
+ mIsSecure, mPowerMode, mActiveConfig,
mVisibleLayersSortedByZ.size(),
mViewport.left, mViewport.top, mViewport.right, mViewport.bottom,
mFrame.left, mFrame.top, mFrame.right, mFrame.bottom,
diff --git a/services/surfaceflinger/DisplayDevice.h b/services/surfaceflinger/DisplayDevice.h
index 8695a44..6d380d1 100644
--- a/services/surfaceflinger/DisplayDevice.h
+++ b/services/surfaceflinger/DisplayDevice.h
@@ -106,7 +106,6 @@
void setVisibleLayersSortedByZ(const Vector< sp<Layer> >& layers);
const Vector< sp<Layer> >& getVisibleLayersSortedByZ() const;
- bool getSecureLayerVisible() const;
Region getDirtyRegion(bool repaintEverything) const;
void setLayerStack(uint32_t stack);
@@ -202,10 +201,6 @@
// list of visible layers on that display
Vector< sp<Layer> > mVisibleLayersSortedByZ;
- // Whether we have a visible secure layer on this display
- bool mSecureLayerVisible;
-
-
/*
* Transaction state
*/
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 1e33847..737cc82 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -3183,14 +3183,7 @@
// 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<const DisplayDevice> hw(getDisplayDevice(display));
- if (hw->getSecureLayerVisible()) {
- ALOGW("FB is protected: PERMISSION_DENIED");
- return PERMISSION_DENIED;
- }
- }
+ bool isLocalScreenshot = IInterface::asBinder(producer)->localBinder();
// Convert to surfaceflinger's internal rotation type.
Transform::orientation_flags rotationFlags;
@@ -3223,19 +3216,22 @@
bool useIdentityTransform;
Transform::orientation_flags rotation;
status_t result;
+ bool isLocalScreenshot;
public:
MessageCaptureScreen(SurfaceFlinger* flinger,
const sp<IBinder>& display,
const sp<IGraphicBufferProducer>& producer,
Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
uint32_t minLayerZ, uint32_t maxLayerZ,
- bool useIdentityTransform, Transform::orientation_flags rotation)
+ bool useIdentityTransform,
+ Transform::orientation_flags rotation,
+ bool isLocalScreenshot)
: flinger(flinger), display(display), producer(producer),
sourceCrop(sourceCrop), reqWidth(reqWidth), reqHeight(reqHeight),
minLayerZ(minLayerZ), maxLayerZ(maxLayerZ),
useIdentityTransform(useIdentityTransform),
- rotation(rotation),
- result(PERMISSION_DENIED)
+ rotation(rotation), result(PERMISSION_DENIED),
+ isLocalScreenshot(isLocalScreenshot)
{
}
status_t getResult() const {
@@ -3246,7 +3242,7 @@
sp<const DisplayDevice> hw(flinger->getDisplayDevice(display));
result = flinger->captureScreenImplLocked(hw, producer,
sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ,
- useIdentityTransform, rotation);
+ useIdentityTransform, rotation, isLocalScreenshot);
static_cast<GraphicProducerWrapper*>(IInterface::asBinder(producer).get())->exit(result);
return true;
}
@@ -3269,7 +3265,7 @@
sp<MessageBase> msg = new MessageCaptureScreen(this,
display, IGraphicBufferProducer::asInterface( wrapper ),
sourceCrop, reqWidth, reqHeight, minLayerZ, maxLayerZ,
- useIdentityTransform, rotationFlags);
+ useIdentityTransform, rotationFlags, isLocalScreenshot);
status_t res = postMessageAsync(msg);
if (res == NO_ERROR) {
@@ -3353,7 +3349,8 @@
const sp<IGraphicBufferProducer>& producer,
Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
uint32_t minLayerZ, uint32_t maxLayerZ,
- bool useIdentityTransform, Transform::orientation_flags rotation)
+ bool useIdentityTransform, Transform::orientation_flags rotation,
+ bool isLocalScreenshot)
{
ATRACE_CALL();
@@ -3374,6 +3371,24 @@
reqWidth = (!reqWidth) ? hw_w : reqWidth;
reqHeight = (!reqHeight) ? hw_h : reqHeight;
+ bool secureLayerIsVisible = false;
+ const LayerVector& layers(mDrawingState.layersSortedByZ);
+ const size_t count = layers.size();
+ for (size_t i = 0 ; i < count ; ++i) {
+ const sp<Layer>& layer(layers[i]);
+ const Layer::State& state(layer->getDrawingState());
+ if (state.layerStack == hw->getLayerStack() && state.z >= minLayerZ &&
+ state.z <= maxLayerZ && layer->isVisible() &&
+ layer->isSecure()) {
+ secureLayerIsVisible = true;
+ }
+ }
+
+ if (!isLocalScreenshot && secureLayerIsVisible) {
+ ALOGW("FB is protected: PERMISSION_DENIED");
+ return PERMISSION_DENIED;
+ }
+
// create a surface (because we're a producer, and we need to
// dequeue/queue a buffer)
sp<Surface> sur = new Surface(producer, false);
diff --git a/services/surfaceflinger/SurfaceFlinger.h b/services/surfaceflinger/SurfaceFlinger.h
index 4e0160a..4101a70 100644
--- a/services/surfaceflinger/SurfaceFlinger.h
+++ b/services/surfaceflinger/SurfaceFlinger.h
@@ -329,7 +329,8 @@
const sp<IGraphicBufferProducer>& producer,
Rect sourceCrop, uint32_t reqWidth, uint32_t reqHeight,
uint32_t minLayerZ, uint32_t maxLayerZ,
- bool useIdentityTransform, Transform::orientation_flags rotation);
+ bool useIdentityTransform, Transform::orientation_flags rotation,
+ bool isLocalScreenshot);
/* ------------------------------------------------------------------------
* EGL
diff --git a/vulkan/api/templates/vulkan_h.tmpl b/vulkan/api/templates/vulkan_h.tmpl
index b2a77ec..83a5e40 100644
--- a/vulkan/api/templates/vulkan_h.tmpl
+++ b/vulkan/api/templates/vulkan_h.tmpl
@@ -17,7 +17,7 @@
#endif
¶
/*
-** Copyright (c) 2015 The Khronos Group Inc.
+** Copyright (c) 2015-2016 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
@@ -47,12 +47,16 @@
#define VK_VERSION_1_0 1
#include "vk_platform.h"
¶
-#define VK_MAKE_VERSION(major, minor, patch) ((major << 22) | (minor << 12) | patch)
+#define VK_MAKE_VERSION(major, minor, patch) (((major) << 22) | ((minor) << 12) | (patch))
¶
// Vulkan API version supported by this file
#define VK_API_VERSION \
VK_MAKE_VERSION({{Global "VERSION_MAJOR"}}, {{Global "VERSION_MINOR"}}, {{Global "VERSION_PATCH"}})
¶
+#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
+#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
+#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
+¶
#if defined(__cplusplus) && ((defined(_MSC_VER) && _MSC_VER >= 1800 || __cplusplus >= 201103L)
#define VK_NULL_HANDLE nullptr
#else
diff --git a/vulkan/api/vulkan.api b/vulkan/api/vulkan.api
index 9b1e684..10565ab 100644
--- a/vulkan/api/vulkan.api
+++ b/vulkan/api/vulkan.api
@@ -28,7 +28,7 @@
// API version (major.minor.patch)
define VERSION_MAJOR 1
define VERSION_MINOR 0
-define VERSION_PATCH 2
+define VERSION_PATCH 3
// API limits
define VK_MAX_PHYSICAL_DEVICE_NAME_SIZE 256
@@ -75,7 +75,7 @@
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_SPEC_VERSION 5
@extension("VK_KHR_win32_surface") define VK_KHR_WIN32_SURFACE_NAME "VK_KHR_win32_surface"
-@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
+@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1
@extension("VK_EXT_debug_report") define VK_EXT_DEBUG_REPORT_NAME "VK_EXT_debug_report"
@@ -1299,9 +1299,9 @@
type VkFlags VkDebugReportFlagsEXT
@extension("VK_EXT_debug_report")
bitfield VkDebugReportFlagBitsEXT {
- VK_DEBUG_REPORT_INFO_BIT_EXT = 0x00000001,
- VK_DEBUG_REPORT_WARN_BIT_EXT = 0x00000002,
- VK_DEBUG_REPORT_PERF_WARN_BIT_EXT = 0x00000004,
+ VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001,
+ VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002,
+ VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
}
@@ -5130,7 +5130,7 @@
cmd VkResult vkGetPhysicalDeviceWin32PresentationSupportKHR(
VkPhysicalDevice physicalDevice,
u32 queueFamilyIndex) {
- physicalDeviceObject := GetPhysicalDevice(physicalDevice)
+ physicalDeviceObject := GetPhysicalDevice(physicalDevice)
return ?
}
diff --git a/vulkan/include/vulkan/vk_ext_debug_report.h b/vulkan/include/vulkan/vk_ext_debug_report.h
deleted file mode 100644
index c391033..0000000
--- a/vulkan/include/vulkan/vk_ext_debug_report.h
+++ /dev/null
@@ -1,149 +0,0 @@
-//
-// File: vk_ext_debug_report.h
-//
-/*
- *
- * Copyright (C) 2015 Valve Corporation
- * Copyright (C) 2015 Google 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.
- *
- * Author: Cody Northrop <cody@lunarg.com>
- * Author: Courtney Goeltzenleuchter <courtney@LunarG.com>
- * Author: Tony Barbour <tony@LunarG.com>
- *
- */
-
-#pragma once
-
-#include "vulkan/vulkan.h"
-
-#ifdef __cplusplus
-extern "C"
-{
-#endif // __cplusplus
-
-/*
-***************************************************************************************************
-* DebugReport Vulkan Extension API
-***************************************************************************************************
-*/
-#define VK_EXT_debug_report 1
-VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
-
-#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 2
-#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
-
-
-typedef enum VkDebugReportObjectTypeEXT {
- VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0,
- VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1,
- VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2,
- VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3,
- VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4,
- VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6,
- VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7,
- VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8,
- VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9,
- VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10,
- VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11,
- VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12,
- VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13,
- VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14,
- VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15,
- VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16,
- VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17,
- VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18,
- VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20,
- VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22,
- VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23,
- VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24,
- VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25,
- VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
- VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
- VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
-} VkDebugReportObjectTypeEXT;
-
-typedef enum VkDebugReportErrorEXT {
- VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
- VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
-} VkDebugReportErrorEXT;
-
-typedef enum VkDebugReportFlagBitsEXT {
- VK_DEBUG_REPORT_INFO_BIT_EXT = 0x00000001,
- VK_DEBUG_REPORT_WARN_BIT_EXT = 0x00000002,
- VK_DEBUG_REPORT_PERF_WARN_BIT_EXT = 0x00000004,
- VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
- VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
-} VkDebugReportFlagBitsEXT;
-typedef VkFlags VkDebugReportFlagsEXT;
-
-typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(
- VkDebugReportFlagsEXT flags,
- VkDebugReportObjectTypeEXT objectType,
- uint64_t object,
- size_t location,
- int32_t messageCode,
- const char* pLayerPrefix,
- const char* pMessage,
- void* pUserData);
-
-
-typedef struct VkDebugReportCallbackCreateInfoEXT {
- VkStructureType sType;
- const void* pNext;
- VkDebugReportFlagsEXT flags;
- PFN_vkDebugReportCallbackEXT pfnCallback;
- void* pUserData;
-} VkDebugReportCallbackCreateInfoEXT;
-
-typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
-typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
-typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
-
-#ifndef VK_NO_PROTOTYPES
-VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(
- VkInstance instance,
- const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
- const VkAllocationCallbacks* pAllocator,
- VkDebugReportCallbackEXT* pCallback);
-
-VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(
- VkInstance instance,
- VkDebugReportCallbackEXT callback,
- const VkAllocationCallbacks* pAllocator);
-
-VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
- VkInstance instance,
- VkDebugReportFlagsEXT flags,
- VkDebugReportObjectTypeEXT objectType,
- uint64_t object,
- size_t location,
- int32_t messageCode,
- const char* pLayerPrefix,
- const char* pMessage);
-#endif
-
-#ifdef __cplusplus
-} // extern "C"
-#endif // __cplusplus
-
diff --git a/vulkan/include/vulkan/vk_layer_interface.h b/vulkan/include/vulkan/vk_layer_interface.h
index 8aef495..5aae51e 100644
--- a/vulkan/include/vulkan/vk_layer_interface.h
+++ b/vulkan/include/vulkan/vk_layer_interface.h
@@ -31,7 +31,6 @@
#pragma once
#include <vulkan/vulkan.h>
-#include <vulkan/vk_ext_debug_report.h>
// ------------------------------------------------------------------------------------------------
// CreateInstance and CreateDevice support structures
diff --git a/vulkan/include/vulkan/vulkan.h b/vulkan/include/vulkan/vulkan.h
index 9940f85..cd6a71a 100644
--- a/vulkan/include/vulkan/vulkan.h
+++ b/vulkan/include/vulkan/vulkan.h
@@ -6,7 +6,7 @@
#endif
/*
-** Copyright (c) 2015 The Khronos Group Inc.
+** Copyright (c) 2015-2016 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
@@ -38,11 +38,14 @@
#include "vk_platform.h"
#define VK_MAKE_VERSION(major, minor, patch) \
- ((major << 22) | (minor << 12) | patch)
+ (((major) << 22) | ((minor) << 12) | (patch))
// Vulkan API version supported by this file
-#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 2)
+#define VK_API_VERSION VK_MAKE_VERSION(1, 0, 3)
+#define VK_VERSION_MAJOR(version) ((uint32_t)(version) >> 22)
+#define VK_VERSION_MINOR(version) (((uint32_t)(version) >> 12) & 0x3ff)
+#define VK_VERSION_PATCH(version) ((uint32_t)(version) & 0xfff)
#define VK_NULL_HANDLE 0
@@ -3664,6 +3667,107 @@
#endif
#endif /* VK_USE_PLATFORM_WIN32_KHR */
+#define VK_EXT_debug_report 1
+VK_DEFINE_NON_DISPATCHABLE_HANDLE(VkDebugReportCallbackEXT)
+
+#define VK_EXT_DEBUG_REPORT_SPEC_VERSION 1
+#define VK_EXT_DEBUG_REPORT_EXTENSION_NAME "VK_EXT_debug_report"
+
+
+typedef enum VkDebugReportObjectTypeEXT {
+ VK_DEBUG_REPORT_OBJECT_TYPE_UNKNOWN_EXT = 0,
+ VK_DEBUG_REPORT_OBJECT_TYPE_INSTANCE_EXT = 1,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PHYSICAL_DEVICE_EXT = 2,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_EXT = 3,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUEUE_EXT = 4,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SEMAPHORE_EXT = 5,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_BUFFER_EXT = 6,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FENCE_EXT = 7,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEVICE_MEMORY_EXT = 8,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_EXT = 9,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_EXT = 10,
+ VK_DEBUG_REPORT_OBJECT_TYPE_EVENT_EXT = 11,
+ VK_DEBUG_REPORT_OBJECT_TYPE_QUERY_POOL_EXT = 12,
+ VK_DEBUG_REPORT_OBJECT_TYPE_BUFFER_VIEW_EXT = 13,
+ VK_DEBUG_REPORT_OBJECT_TYPE_IMAGE_VIEW_EXT = 14,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SHADER_MODULE_EXT = 15,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_CACHE_EXT = 16,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_LAYOUT_EXT = 17,
+ VK_DEBUG_REPORT_OBJECT_TYPE_RENDER_PASS_EXT = 18,
+ VK_DEBUG_REPORT_OBJECT_TYPE_PIPELINE_EXT = 19,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_LAYOUT_EXT = 20,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SAMPLER_EXT = 21,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_POOL_EXT = 22,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DESCRIPTOR_SET_EXT = 23,
+ VK_DEBUG_REPORT_OBJECT_TYPE_FRAMEBUFFER_EXT = 24,
+ VK_DEBUG_REPORT_OBJECT_TYPE_COMMAND_POOL_EXT = 25,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SURFACE_KHR_EXT = 26,
+ VK_DEBUG_REPORT_OBJECT_TYPE_SWAPCHAIN_KHR_EXT = 27,
+ VK_DEBUG_REPORT_OBJECT_TYPE_DEBUG_REPORT_EXT = 28,
+} VkDebugReportObjectTypeEXT;
+
+typedef enum VkDebugReportErrorEXT {
+ VK_DEBUG_REPORT_ERROR_NONE_EXT = 0,
+ VK_DEBUG_REPORT_ERROR_CALLBACK_REF_EXT = 1,
+} VkDebugReportErrorEXT;
+
+
+typedef enum VkDebugReportFlagBitsEXT {
+ VK_DEBUG_REPORT_INFORMATION_BIT_EXT = 0x00000001,
+ VK_DEBUG_REPORT_WARNING_BIT_EXT = 0x00000002,
+ VK_DEBUG_REPORT_PERFORMANCE_WARNING_BIT_EXT = 0x00000004,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT = 0x00000008,
+ VK_DEBUG_REPORT_DEBUG_BIT_EXT = 0x00000010,
+} VkDebugReportFlagBitsEXT;
+typedef VkFlags VkDebugReportFlagsEXT;
+
+typedef VkBool32 (VKAPI_PTR *PFN_vkDebugReportCallbackEXT)(
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage,
+ void* pUserData);
+
+
+typedef struct VkDebugReportCallbackCreateInfoEXT {
+ VkStructureType sType;
+ const void* pNext;
+ VkDebugReportFlagsEXT flags;
+ PFN_vkDebugReportCallbackEXT pfnCallback;
+ void* pUserData;
+} VkDebugReportCallbackCreateInfoEXT;
+
+
+typedef VkResult (VKAPI_PTR *PFN_vkCreateDebugReportCallbackEXT)(VkInstance instance, const VkDebugReportCallbackCreateInfoEXT* pCreateInfo, const VkAllocationCallbacks* pAllocator, VkDebugReportCallbackEXT* pCallback);
+typedef void (VKAPI_PTR *PFN_vkDestroyDebugReportCallbackEXT)(VkInstance instance, VkDebugReportCallbackEXT callback, const VkAllocationCallbacks* pAllocator);
+typedef void (VKAPI_PTR *PFN_vkDebugReportMessageEXT)(VkInstance instance, VkDebugReportFlagsEXT flags, VkDebugReportObjectTypeEXT objectType, uint64_t object, size_t location, int32_t messageCode, const char* pLayerPrefix, const char* pMessage);
+
+#ifndef VK_NO_PROTOTYPES
+VKAPI_ATTR VkResult VKAPI_CALL vkCreateDebugReportCallbackEXT(
+ VkInstance instance,
+ const VkDebugReportCallbackCreateInfoEXT* pCreateInfo,
+ const VkAllocationCallbacks* pAllocator,
+ VkDebugReportCallbackEXT* pCallback);
+
+VKAPI_ATTR void VKAPI_CALL vkDestroyDebugReportCallbackEXT(
+ VkInstance instance,
+ VkDebugReportCallbackEXT callback,
+ const VkAllocationCallbacks* pAllocator);
+
+VKAPI_ATTR void VKAPI_CALL vkDebugReportMessageEXT(
+ VkInstance instance,
+ VkDebugReportFlagsEXT flags,
+ VkDebugReportObjectTypeEXT objectType,
+ uint64_t object,
+ size_t location,
+ int32_t messageCode,
+ const char* pLayerPrefix,
+ const char* pMessage);
+#endif
+
#ifdef __cplusplus
}
#endif
diff --git a/vulkan/libvulkan/debug_report.h b/vulkan/libvulkan/debug_report.h
index 5bce240..c6f7570 100644
--- a/vulkan/libvulkan/debug_report.h
+++ b/vulkan/libvulkan/debug_report.h
@@ -18,7 +18,6 @@
#define LIBVULKAN_DEBUG_REPORT_H 1
#include <shared_mutex>
-#include <vulkan/vk_ext_debug_report.h>
namespace vulkan {
diff --git a/vulkan/libvulkan/dispatch.tmpl b/vulkan/libvulkan/dispatch.tmpl
index 306aae4..0a0338e 100644
--- a/vulkan/libvulkan/dispatch.tmpl
+++ b/vulkan/libvulkan/dispatch.tmpl
@@ -46,7 +46,6 @@
¶
#define VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
-#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
¶
namespace vulkan {
diff --git a/vulkan/libvulkan/dispatch_gen.h b/vulkan/libvulkan/dispatch_gen.h
index 7bab6ca..cef4ccf 100644
--- a/vulkan/libvulkan/dispatch_gen.h
+++ b/vulkan/libvulkan/dispatch_gen.h
@@ -18,7 +18,6 @@
#define VK_USE_PLATFORM_ANDROID_KHR
#include <vulkan/vk_android_native_buffer.h>
-#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
namespace vulkan {
diff --git a/vulkan/libvulkan/loader.cpp b/vulkan/libvulkan/loader.cpp
index 1a57c22..fc60f35 100644
--- a/vulkan/libvulkan/loader.cpp
+++ b/vulkan/libvulkan/loader.cpp
@@ -496,7 +496,7 @@
void* /*user_data*/) {
if (flags & VK_DEBUG_REPORT_ERROR_BIT_EXT) {
ALOGE("[%s] Code %d : %s", layer_prefix, message_code, message);
- } else if (flags & VK_DEBUG_REPORT_WARN_BIT_EXT) {
+ } else if (flags & VK_DEBUG_REPORT_WARNING_BIT_EXT) {
ALOGW("[%s] Code %d : %s", layer_prefix, message_code, message);
}
return false;
@@ -1205,7 +1205,7 @@
const VkDebugReportCallbackCreateInfoEXT callback_create_info = {
.sType = VK_STRUCTURE_TYPE_DEBUG_REPORT_CREATE_INFO_EXT,
.flags =
- VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARN_BIT_EXT,
+ VK_DEBUG_REPORT_ERROR_BIT_EXT | VK_DEBUG_REPORT_WARNING_BIT_EXT,
.pfnCallback = LogDebugMessageCallback,
};
PFN_vkCreateDebugReportCallbackEXT create_debug_report_callback =
diff --git a/vulkan/libvulkan/swapchain.cpp b/vulkan/libvulkan/swapchain.cpp
index f8de675..5fefc62 100644
--- a/vulkan/libvulkan/swapchain.cpp
+++ b/vulkan/libvulkan/swapchain.cpp
@@ -107,6 +107,79 @@
}
}
+const VkSurfaceTransformFlagsKHR kSupportedTransforms =
+ VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR |
+ VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR |
+ VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR |
+ VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR |
+ // TODO(jessehall): See TODO in TranslateNativeToVulkanTransform.
+ // VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR |
+ // VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR |
+ // VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR |
+ // VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR |
+ VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR;
+
+VkSurfaceTransformFlagBitsKHR TranslateNativeToVulkanTransform(int native) {
+ // Native and Vulkan transforms are isomorphic, but are represented
+ // differently. Vulkan transforms are built up of an optional horizontal
+ // mirror, followed by a clockwise 0/90/180/270-degree rotation. Native
+ // transforms are built up from a horizontal flip, vertical flip, and
+ // 90-degree rotation, all optional but always in that order.
+
+ // TODO(jessehall): For now, only support pure rotations, not
+ // flip or flip-and-rotate, until I have more time to test them and build
+ // sample code. As far as I know we never actually use anything besides
+ // pure rotations anyway.
+
+ switch (native) {
+ case 0: // 0x0
+ return VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+ // case NATIVE_WINDOW_TRANSFORM_FLIP_H: // 0x1
+ // return VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR;
+ // case NATIVE_WINDOW_TRANSFORM_FLIP_V: // 0x2
+ // return VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR;
+ case NATIVE_WINDOW_TRANSFORM_ROT_180: // FLIP_H | FLIP_V
+ return VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR;
+ case NATIVE_WINDOW_TRANSFORM_ROT_90: // 0x4
+ return VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR;
+ // case NATIVE_WINDOW_TRANSFORM_FLIP_H | NATIVE_WINDOW_TRANSFORM_ROT_90:
+ // return VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR;
+ // case NATIVE_WINDOW_TRANSFORM_FLIP_V | NATIVE_WINDOW_TRANSFORM_ROT_90:
+ // return VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR;
+ case NATIVE_WINDOW_TRANSFORM_ROT_270: // FLIP_H | FLIP_V | ROT_90
+ return VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR;
+ case NATIVE_WINDOW_TRANSFORM_INVERSE_DISPLAY:
+ default:
+ return VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+ }
+}
+
+int InvertTransformToNative(VkSurfaceTransformFlagBitsKHR transform) {
+ switch (transform) {
+ case VK_SURFACE_TRANSFORM_ROTATE_90_BIT_KHR:
+ return NATIVE_WINDOW_TRANSFORM_ROT_270;
+ case VK_SURFACE_TRANSFORM_ROTATE_180_BIT_KHR:
+ return NATIVE_WINDOW_TRANSFORM_ROT_180;
+ case VK_SURFACE_TRANSFORM_ROTATE_270_BIT_KHR:
+ return NATIVE_WINDOW_TRANSFORM_ROT_90;
+ // TODO(jessehall): See TODO in TranslateNativeToVulkanTransform.
+ // case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_BIT_KHR:
+ // return NATIVE_WINDOW_TRANSFORM_FLIP_H;
+ // case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_90_BIT_KHR:
+ // return NATIVE_WINDOW_TRANSFORM_FLIP_H |
+ // NATIVE_WINDOW_TRANSFORM_ROT_90;
+ // case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_180_BIT_KHR:
+ // return NATIVE_WINDOW_TRANSFORM_FLIP_V;
+ // case VK_SURFACE_TRANSFORM_HORIZONTAL_MIRROR_ROTATE_270_BIT_KHR:
+ // return NATIVE_WINDOW_TRANSFORM_FLIP_V |
+ // NATIVE_WINDOW_TRANSFORM_ROT_90;
+ case VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR:
+ case VK_SURFACE_TRANSFORM_INHERIT_BIT_KHR:
+ default:
+ return 0;
+ }
+}
+
// ----------------------------------------------------------------------------
struct Surface {
@@ -238,6 +311,14 @@
return VK_ERROR_INITIALIZATION_FAILED;
}
+ int transform_hint;
+ err = window->query(window, NATIVE_WINDOW_TRANSFORM_HINT, &transform_hint);
+ if (err != 0) {
+ ALOGE("NATIVE_WINDOW_TRANSFORM_HINT query failed: %s (%d)",
+ strerror(-err), err);
+ return VK_ERROR_INITIALIZATION_FAILED;
+ }
+
// TODO(jessehall): Figure out what the min/max values should be.
capabilities->minImageCount = 2;
capabilities->maxImageCount = 3;
@@ -252,12 +333,9 @@
capabilities->maxImageArrayLayers = 1;
- // TODO(jessehall): We can support all transforms, fix this once
- // implemented.
- capabilities->supportedTransforms = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
-
- // TODO(jessehall): Implement based on NATIVE_WINDOW_TRANSFORM_HINT.
- capabilities->currentTransform = VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR;
+ capabilities->supportedTransforms = kSupportedTransforms;
+ capabilities->currentTransform =
+ TranslateNativeToVulkanTransform(transform_hint);
// On Android, window composition is a WindowManager property, not something
// associated with the bufferqueue. It can't be changed from here.
@@ -347,8 +425,9 @@
"color spaces other than SRGB_NONLINEAR not yet implemented");
ALOGE_IF(create_info->oldSwapchain,
"swapchain re-creation not yet implemented");
- ALOGE_IF(create_info->preTransform != VK_SURFACE_TRANSFORM_IDENTITY_BIT_KHR,
- "swapchain preTransform not yet implemented");
+ ALOGE_IF((create_info->preTransform & ~kSupportedTransforms) != 0,
+ "swapchain preTransform %d not supported",
+ create_info->preTransform);
ALOGW_IF(!(create_info->presentMode == VK_PRESENT_MODE_FIFO_KHR ||
create_info->presentMode == VK_PRESENT_MODE_MAILBOX_KHR),
"swapchain present mode %d not supported",
@@ -402,6 +481,26 @@
return VK_ERROR_INITIALIZATION_FAILED;
}
+ // VkSwapchainCreateInfo::preTransform indicates the transformation the app
+ // applied during rendering. native_window_set_transform() expects the
+ // inverse: the transform the app is requesting that the compositor perform
+ // during composition. With native windows, pre-transform works by rendering
+ // with the same transform the compositor is applying (as in Vulkan), but
+ // then requesting the inverse transform, so that when the compositor does
+ // it's job the two transforms cancel each other out and the compositor ends
+ // up applying an identity transform to the app's buffer.
+ err = native_window_set_buffers_transform(
+ surface.window.get(),
+ InvertTransformToNative(create_info->preTransform));
+ if (err != 0) {
+ // TODO(jessehall): Improve error reporting. Can we enumerate possible
+ // errors and translate them to valid Vulkan result codes?
+ ALOGE("native_window_set_buffers_transform(%d) failed: %s (%d)",
+ InvertTransformToNative(create_info->preTransform),
+ strerror(-err), err);
+ return VK_ERROR_INITIALIZATION_FAILED;
+ }
+
err = native_window_set_scaling_mode(
surface.window.get(), NATIVE_WINDOW_SCALING_MODE_SCALE_TO_WINDOW);
if (err != 0) {
diff --git a/vulkan/nulldrv/null_driver.cpp b/vulkan/nulldrv/null_driver.cpp
index cd61e86..6f57238 100644
--- a/vulkan/nulldrv/null_driver.cpp
+++ b/vulkan/nulldrv/null_driver.cpp
@@ -15,7 +15,6 @@
*/
#include <hardware/hwvulkan.h>
-#include <vulkan/vk_ext_debug_report.h>
#include <algorithm>
#include <array>
diff --git a/vulkan/nulldrv/null_driver.tmpl b/vulkan/nulldrv/null_driver.tmpl
index 7488692..3a84971 100644
--- a/vulkan/nulldrv/null_driver.tmpl
+++ b/vulkan/nulldrv/null_driver.tmpl
@@ -49,7 +49,6 @@
#define NULLDRV_NULL_DRIVER_H 1
¶
#include <vulkan/vk_android_native_buffer.h>
-#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
¶
namespace null_driver {«
diff --git a/vulkan/nulldrv/null_driver_gen.h b/vulkan/nulldrv/null_driver_gen.h
index 87ff681..98952b8 100644
--- a/vulkan/nulldrv/null_driver_gen.h
+++ b/vulkan/nulldrv/null_driver_gen.h
@@ -20,7 +20,6 @@
#define NULLDRV_NULL_DRIVER_H 1
#include <vulkan/vk_android_native_buffer.h>
-#include <vulkan/vk_ext_debug_report.h>
#include <vulkan/vulkan.h>
namespace null_driver {
diff --git a/vulkan/tools/Android.mk b/vulkan/tools/Android.mk
index 31d6089..337e683 100644
--- a/vulkan/tools/Android.mk
+++ b/vulkan/tools/Android.mk
@@ -21,7 +21,8 @@
LOCAL_CFLAGS += -Weverything -Werror -Wno-padded -Wno-undef -Wno-switch-enum
LOCAL_CPPFLAGS := -std=c++1y \
-Wno-c++98-compat-pedantic \
- -Wno-c99-extensions
+ -Wno-c99-extensions \
+ -Wno-old-style-cast
LOCAL_C_INCLUDES := \
frameworks/native/vulkan/include
diff --git a/vulkan/tools/vkinfo.cpp b/vulkan/tools/vkinfo.cpp
index e650a27..e97e5f5 100644
--- a/vulkan/tools/vkinfo.cpp
+++ b/vulkan/tools/vkinfo.cpp
@@ -22,7 +22,6 @@
#include <vector>
#include <vulkan/vulkan.h>
-#include <vulkan/vk_ext_debug_report.h>
#define LOG_TAG "vkinfo"
#include <log/log.h>
@@ -258,8 +257,17 @@
// clang-format on
uint32_t num_layers = sizeof(kValidationLayers) / sizeof(char*);
+ const VkApplicationInfo application_info = {
+ .sType = VK_STRUCTURE_TYPE_APPLICATION_INFO,
+ .pApplicationName = "vkinfo",
+ .applicationVersion = 0,
+ .pEngineName = "vkinfo",
+ .engineVersion = 0,
+ .apiVersion = VK_API_VERSION,
+ };
const VkInstanceCreateInfo create_info = {
.sType = VK_STRUCTURE_TYPE_INSTANCE_CREATE_INFO,
+ .pApplicationInfo = &application_info,
.enabledExtensionCount = num_extensions,
.ppEnabledExtensionNames = extensions,
.enabledLayerCount = (options.validate) ? num_layers : 0,
@@ -305,16 +313,6 @@
(kIndent.size() - (kIndentSize * std::min(n, kMaxIndent) + 1));
}
-uint32_t ExtractMajorVersion(uint32_t version) {
- return (version >> 22) & 0x3FF;
-}
-uint32_t ExtractMinorVersion(uint32_t version) {
- return (version >> 12) & 0x3FF;
-}
-uint32_t ExtractPatchVersion(uint32_t version) {
- return (version >> 0) & 0xFFF;
-}
-
const char* VkPhysicalDeviceTypeStr(VkPhysicalDeviceType type) {
switch (type) {
case VK_PHYSICAL_DEVICE_TYPE_OTHER:
@@ -346,9 +344,9 @@
size_t indent) {
for (size_t i = 0; i < layers.size(); i++) {
printf("%s%s %u.%u.%u/%u\n", Indent(indent), layers[i].layerName,
- ExtractMajorVersion(layers[i].specVersion),
- ExtractMinorVersion(layers[i].specVersion),
- ExtractPatchVersion(layers[i].specVersion),
+ VK_VERSION_MAJOR(layers[i].specVersion),
+ VK_VERSION_MINOR(layers[i].specVersion),
+ VK_VERSION_PATCH(layers[i].specVersion),
layers[i].implementationVersion);
if (options.layer_description)
printf("%s%s\n", Indent(indent + 1), layers[i].description);
@@ -491,9 +489,9 @@
printf("%s\"%s\" (%s) %u.%u.%u/%#x [%04x:%04x]\n", Indent(indent),
info.properties.deviceName,
VkPhysicalDeviceTypeStr(info.properties.deviceType),
- ExtractMajorVersion(info.properties.apiVersion),
- ExtractMinorVersion(info.properties.apiVersion),
- ExtractPatchVersion(info.properties.apiVersion),
+ VK_VERSION_MAJOR(info.properties.apiVersion),
+ VK_VERSION_MINOR(info.properties.apiVersion),
+ VK_VERSION_PATCH(info.properties.apiVersion),
info.properties.driverVersion, info.properties.vendorID,
info.properties.deviceID);