Merge "BufferQueueProducer: Signal consumer when a buffer is detached" into nyc-dev
diff --git a/cmds/bugreportz/bugreportz.cpp b/cmds/bugreportz/bugreportz.cpp
index 19d2d64..312dceb 100644
--- a/cmds/bugreportz/bugreportz.cpp
+++ b/cmds/bugreportz/bugreportz.cpp
@@ -80,8 +80,8 @@
}
if (s == -1) {
- printf("Failed to connect to dumpstatez service: %s\n", strerror(errno));
- return EXIT_FAILURE;
+ printf("FAIL:Failed to connect to dumpstatez service: %s\n", strerror(errno));
+ return EXIT_SUCCESS;
}
// Set a timeout so that if nothing is read in 10 minutes, we'll stop
@@ -91,7 +91,7 @@
tv.tv_sec = 10 * 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));
+ fprintf(stderr, "WARNING: Cannot set socket timeout: %s\n", strerror(errno));
}
while (1) {
@@ -105,8 +105,7 @@
if (errno == EAGAIN) {
errno = ETIMEDOUT;
}
- printf("\nBugreport read terminated abnormally (%s).\n",
- strerror(errno));
+ printf("FAIL:Bugreport read terminated abnormally (%s)\n", strerror(errno));
break;
}
@@ -117,15 +116,17 @@
write(STDOUT_FILENO, buffer + bytes_read - bytes_to_send,
bytes_to_send));
if (bytes_written == -1) {
- printf(
+ fprintf(stderr,
"Failed to write data to stdout: read %zd, trying to send %zd (%s)\n",
bytes_read, bytes_to_send, strerror(errno));
- return EXIT_FAILURE;
+ break;
}
bytes_to_send -= bytes_written;
} while (bytes_written != 0 && bytes_to_send > 0);
}
- close(s);
+ if (close(s) == -1) {
+ fprintf(stderr, "WARNING: error closing socket: %s\n", strerror(errno));
+ }
return EXIT_SUCCESS;
}
diff --git a/cmds/dumpstate/bugreport-format.md b/cmds/dumpstate/bugreport-format.md
index d7837ae..ca7d574 100644
--- a/cmds/dumpstate/bugreport-format.md
+++ b/cmds/dumpstate/bugreport-format.md
@@ -15,13 +15,13 @@
format _YYYY-MM-DD-HH-MM-SS_), and Shell simply propagates it as an attachment
in the `ACTION_SEND_MULTIPLE` intent.
-## Version v0 (Android M)
+## Version 0 (Android M)
On _Android M (Marshmallow)_, dumpstate still generates a flat
_bugreport-DATE.txt_ file, but then **Shell** creates a zip file called
_bugreport-DATE.zip_ containing a _bugreport-DATE.txt_ entry and sends that
file as the `ACTION_SEND_MULTIPLE` attachment.
-## Version v1 (Android N)
+## Version 1.0 (Android N)
On _Android N (TBD)_, `dumpstate` generates a zip file directly (unless there
is a failure, in which case it reverts to the flat file that is zipped by
**Shell** and hence the end result is the _v0_ format).
@@ -33,7 +33,7 @@
The zip file also contains 2 metadata entries generated by `dumpstate`:
-- `version.txt`: whose value is **v1**.
+- `version.txt`: whose value is **1.0**.
- `main-entry.txt`: whose value is the name of the flat text entry (i.e.,
_bugreport-BUILD_ID-DATE.txt_ or _bugreport-NEW_NAME.txt_).
@@ -61,16 +61,16 @@
changes become stable.
For example, the initial version during _Android N_ development was
-**v1-dev1**. When `dumpsys` was split in 2 sections but not all tools were
-ready to parse that format, the version was named **v1-dev2**,
+**1.0-dev1**. When `dumpsys` was split in 2 sections but not all tools were
+ready to parse that format, the version was named **1.0-dev2**,
which had to be passed do `dumpsys` explicitly (i.e., trhough a
-`-V v1-dev2` argument). Once that format became stable and tools
-knew how to parse it, the default version became **v1-dev2**.
+`-V 1.0-dev2` argument). Once that format became stable and tools
+knew how to parse it, the default version became **1.0-dev2**.
Similarly, if changes in the file format are made after the initial release of
Android defining that format, then a new _sub-version_ will be used.
For example, if after _Android N_ launches changes are made for the next _N_
-release, the version will be called **v1.1** or something like that.
+release, the version will be called **1.1** or something like that.
Determining version and main entry
-----------------------------------------------
@@ -83,7 +83,7 @@
version = read("version.txt")
main_entry = read("main_entry.txt")
else
- version = v0
+ version = 0
main_entry = entries[0]
fi
```
diff --git a/cmds/dumpstate/dumpstate.cpp b/cmds/dumpstate/dumpstate.cpp
index 1add346..b9c9e75 100644
--- a/cmds/dumpstate/dumpstate.cpp
+++ b/cmds/dumpstate/dumpstate.cpp
@@ -94,10 +94,9 @@
*
* See bugreport-format.txt for more info.
*/
-// TODO: change to "v1" before final N build
-static std::string VERSION_DEFAULT = "v1-dev4";
+static std::string VERSION_DEFAULT = "1.0";
-static bool is_user_build() {
+bool is_user_build() {
return 0 == strncmp(build_type, "user", PROPERTY_VALUE_MAX - 1);
}
@@ -586,7 +585,6 @@
return add_zip_entry_from_fd(ZIP_ROOT_DIR + path, fd) ? 0 : 1;
}
-/* adds all files from a directory to the zipped bugreport file */
void add_dir(const char *dir, bool recursive) {
if (!zip_writer) {
MYLOGD("Not adding dir %s because zip_writer is not set\n", dir);
@@ -824,7 +822,7 @@
#endif
dump_file("INTERRUPTS (1)", "/proc/interrupts");
- run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "connectivity", "--diag", NULL);
+ run_command("NETWORK DIAGNOSTICS", 10, "dumpsys", "-t", "10", "connectivity", "--diag", NULL);
#ifdef FWDUMP_bcmdhd
run_command("DUMP WIFI STATUS", 20,
@@ -900,30 +898,30 @@
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);
+ run_command("CHECKIN BATTERYSTATS", 30, "dumpsys", "-t", "30", "batterystats", "-c", NULL);
+ run_command("CHECKIN MEMINFO", 30, "dumpsys", "-t", "30", "meminfo", "--checkin", NULL);
+ run_command("CHECKIN NETSTATS", 30, "dumpsys", "-t", "30", "netstats", "--checkin", NULL);
+ run_command("CHECKIN PROCSTATS", 30, "dumpsys", "-t", "30", "procstats", "-c", NULL);
+ run_command("CHECKIN USAGESTATS", 30, "dumpsys", "-t", "30", "usagestats", "-c", NULL);
+ run_command("CHECKIN PACKAGE", 30, "dumpsys", "-t", "30", "package", "--checkin", NULL);
printf("========================================================\n");
printf("== Running Application Activities\n");
printf("========================================================\n");
- run_command("APP ACTIVITIES", 30, "dumpsys", "activity", "all", NULL);
+ run_command("APP ACTIVITIES", 30, "dumpsys", "-t", "30", "activity", "all", NULL);
printf("========================================================\n");
printf("== Running Application Services\n");
printf("========================================================\n");
- run_command("APP SERVICES", 30, "dumpsys", "activity", "service", "all", NULL);
+ run_command("APP SERVICES", 30, "dumpsys", "-t", "30", "activity", "service", "all", NULL);
printf("========================================================\n");
printf("== Running Application Providers\n");
printf("========================================================\n");
- run_command("APP SERVICES", 30, "dumpsys", "activity", "provider", "all", NULL);
+ run_command("APP SERVICES", 30, "dumpsys", "-t", "30", "activity", "provider", "all", NULL);
printf("========================================================\n");
@@ -1278,7 +1276,7 @@
// Invoking the following dumpsys calls before dump_traces() to try and
// keep the system stats as close to its initial state as possible.
run_command_as_shell("DUMPSYS MEMINFO", 30, "dumpsys", "-t", "30", "meminfo", "-a", NULL);
- run_command_as_shell("DUMPSYS CPUINFO", 10, "dumpsys", "cpuinfo", "-a", NULL);
+ run_command_as_shell("DUMPSYS CPUINFO", 10, "dumpsys", "-t", "10", "cpuinfo", "-a", NULL);
/* collect stack traces from Dalvik and native processes (needs root) */
dump_traces_path = dump_traces();
diff --git a/cmds/dumpstate/dumpstate.h b/cmds/dumpstate/dumpstate.h
index 94bfc5a..4769974 100644
--- a/cmds/dumpstate/dumpstate.h
+++ b/cmds/dumpstate/dumpstate.h
@@ -93,6 +93,9 @@
/* adds a new entry to the existing zip file. */
bool add_zip_entry_from_fd(const std::string& entry_name, int fd);
+/* adds all files from a directory to the zipped bugreport file */
+void add_dir(const char *dir, bool recursive);
+
/* prints the contents of a file */
int dump_file(const char *title, const char *path);
@@ -196,12 +199,15 @@
/** Gets the last modification time of a file, or default time if file is not found. */
time_t get_mtime(int fd, time_t default_mtime);
-/* dump eMMC Extended CSD data */
+/* Dumps eMMC Extended CSD data. */
void dump_emmc_ecsd(const char *ext_csd_path);
-/** gets command-line arguments */
+/** Gets command-line arguments. */
void format_args(int argc, const char *argv[], std::string *args);
+/** Tells if the device is running a user build. */
+bool is_user_build();
+
/*
* Helper class used to report how long it takes for a section to finish.
*
diff --git a/include/binder/Parcel.h b/include/binder/Parcel.h
index 2685bcc..1c355c4 100644
--- a/include/binder/Parcel.h
+++ b/include/binder/Parcel.h
@@ -705,9 +705,9 @@
}
setDataPosition(start);
- val->reset(new std::vector<T>());
+ val->reset(new std::vector<std::unique_ptr<T>>());
- status = unsafeReadTypedVector(val->get(), &Parcel::readParcelable);
+ status = unsafeReadTypedVector(val->get(), &Parcel::readParcelable<T>);
if (status != OK) {
val->reset();
diff --git a/include/gui/SurfaceComposerClient.h b/include/gui/SurfaceComposerClient.h
index 73f923c..312e02f 100644
--- a/include/gui/SurfaceComposerClient.h
+++ b/include/gui/SurfaceComposerClient.h
@@ -140,6 +140,8 @@
const sp<IBinder>& handle, uint64_t frameNumber);
status_t setOverrideScalingMode(const sp<IBinder>& id,
int32_t overrideScalingMode);
+ status_t setPositionAppliesWithResize(const sp<IBinder>& id);
+
status_t destroySurface(const sp<IBinder>& id);
status_t clearLayerFrameStats(const sp<IBinder>& token) const;
diff --git a/include/gui/SurfaceControl.h b/include/gui/SurfaceControl.h
index bedebb6..fafd194 100644
--- a/include/gui/SurfaceControl.h
+++ b/include/gui/SurfaceControl.h
@@ -73,6 +73,11 @@
status_t setCrop(const Rect& crop);
status_t setFinalCrop(const Rect& crop);
+ // If the size changes in this transaction, position updates specified
+ // in this transaction will not complete until a buffer of the new size
+ // arrives.
+ status_t setPositionAppliesWithResize();
+
// Defers applying any changes made in this transaction until the Layer
// identified by handle reaches the given frameNumber
status_t deferTransactionUntil(sp<IBinder> handle, uint64_t frameNumber);
diff --git a/include/private/gui/LayerState.h b/include/private/gui/LayerState.h
index 92d31d1..4885e05 100644
--- a/include/private/gui/LayerState.h
+++ b/include/private/gui/LayerState.h
@@ -54,7 +54,8 @@
eCropChanged = 0x00000100,
eDeferTransaction = 0x00000200,
eFinalCropChanged = 0x00000400,
- eOverrideScalingModeChanged = 0x00000800
+ eOverrideScalingModeChanged = 0x00000800,
+ ePositionAppliesWithResize = 0x00001000,
};
layer_state_t()
diff --git a/include/ui/FrameStats.h b/include/ui/FrameStats.h
index 5fdf94d..6bfe635 100644
--- a/include/ui/FrameStats.h
+++ b/include/ui/FrameStats.h
@@ -25,6 +25,7 @@
class FrameStats : public LightFlattenable<FrameStats> {
public:
+ FrameStats() : refreshPeriodNano(0) {};
/*
* Approximate refresh time, in nanoseconds.
diff --git a/libs/binder/IMemory.cpp b/libs/binder/IMemory.cpp
index fb8d620..5f345cf 100644
--- a/libs/binder/IMemory.cpp
+++ b/libs/binder/IMemory.cpp
@@ -312,17 +312,17 @@
IInterface::asBinder(this).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)",
- parcel_fd, size, err, strerror(errno));
-
- int access = PROT_READ;
- if (!(flags & READ_ONLY)) {
- access |= PROT_WRITE;
- }
-
Mutex::Autolock _l(mLock);
if (mHeapId == -1) {
+ int fd = dup( parcel_fd );
+ ALOGE_IF(fd==-1, "cannot dup fd=%d, size=%zd, err=%d (%s)",
+ parcel_fd, size, err, strerror(errno));
+
+ int access = PROT_READ;
+ if (!(flags & READ_ONLY)) {
+ access |= PROT_WRITE;
+ }
+
mRealHeap = true;
mBase = mmap(0, size, access, MAP_SHARED, fd, offset);
if (mBase == MAP_FAILED) {
diff --git a/libs/gui/Android.mk b/libs/gui/Android.mk
index 6e92a47..635020e 100644
--- a/libs/gui/Android.mk
+++ b/libs/gui/Android.mk
@@ -93,12 +93,6 @@
LOCAL_CFLAGS += -DDONT_USE_FENCE_SYNC
endif
-ifeq ($(BOARD_ENABLE_GPU_PROTECTED_CONTENT),true)
- LOCAL_CFLAGS += -DENABLE_GPU_PROTECTED_CONTENT=true
-else
- LOCAL_CFLAGS += -DENABLE_GPU_PROTECTED_CONTENT=false
-endif
-
include $(BUILD_SHARED_LIBRARY)
ifeq (,$(ONE_SHOT_MAKEFILE))
diff --git a/libs/gui/GLConsumer.cpp b/libs/gui/GLConsumer.cpp
index a06c7b5..553b65c 100644
--- a/libs/gui/GLConsumer.cpp
+++ b/libs/gui/GLConsumer.cpp
@@ -135,8 +135,7 @@
bool atEnd = (cropExtLen+1) < extsLen &&
!strcmp(" " PROT_CONTENT_EXT_STR, exts + extsLen - (cropExtLen+1));
bool inMiddle = strstr(exts, " " PROT_CONTENT_EXT_STR " ");
- return ENABLE_GPU_PROTECTED_CONTENT &&
- (equal || atStart || atEnd || inMiddle);
+ return equal || atStart || atEnd || inMiddle;
}
static bool hasEglProtectedContent() {
diff --git a/libs/gui/SurfaceComposerClient.cpp b/libs/gui/SurfaceComposerClient.cpp
index e33cc37..92ae41e 100644
--- a/libs/gui/SurfaceComposerClient.cpp
+++ b/libs/gui/SurfaceComposerClient.cpp
@@ -165,6 +165,8 @@
uint64_t frameNumber);
status_t setOverrideScalingMode(const sp<SurfaceComposerClient>& client,
const sp<IBinder>& id, int32_t overrideScalingMode);
+ status_t setPositionAppliesWithResize(const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id);
void setDisplaySurface(const sp<IBinder>& token,
const sp<IGraphicBufferProducer>& bufferProducer);
@@ -443,6 +445,18 @@
return NO_ERROR;
}
+status_t Composer::setPositionAppliesWithResize(
+ const sp<SurfaceComposerClient>& client,
+ const sp<IBinder>& id) {
+ Mutex::Autolock lock(mLock);
+ layer_state_t* s = getLayerStateLocked(client, id);
+ if (!s) {
+ return BAD_INDEX;
+ }
+ s->what |= layer_state_t::ePositionAppliesWithResize;
+ return NO_ERROR;
+}
+
// ---------------------------------------------------------------------------
DisplayState& Composer::getDisplayStateLocked(const sp<IBinder>& token) {
@@ -685,6 +699,11 @@
this, id, overrideScalingMode);
}
+status_t SurfaceComposerClient::setPositionAppliesWithResize(
+ const sp<IBinder>& id) {
+ return getComposer().setPositionAppliesWithResize(this, id);
+}
+
// ----------------------------------------------------------------------------
void SurfaceComposerClient::setDisplaySurface(const sp<IBinder>& token,
diff --git a/libs/gui/SurfaceControl.cpp b/libs/gui/SurfaceControl.cpp
index 314d83a..4671e50 100644
--- a/libs/gui/SurfaceControl.cpp
+++ b/libs/gui/SurfaceControl.cpp
@@ -112,6 +112,11 @@
if (err < 0) return err;
return mClient->setPosition(mHandle, x, y);
}
+status_t SurfaceControl::setPositionAppliesWithResize() {
+ status_t err = validate();
+ if (err < 0) return err;
+ return mClient->setPositionAppliesWithResize(mHandle);
+}
status_t SurfaceControl::setSize(uint32_t w, uint32_t h) {
status_t err = validate();
if (err < 0) return err;
diff --git a/opengl/libs/EGL/eglApi.cpp b/opengl/libs/EGL/eglApi.cpp
index 24394a9..e793852 100644
--- a/opengl/libs/EGL/eglApi.cpp
+++ b/opengl/libs/EGL/eglApi.cpp
@@ -1847,7 +1847,7 @@
}
} else if (red_size == 5 && green_size == 6 && blue_size == 5 &&
alpha_size == 0) {
- format == HAL_PIXEL_FORMAT_RGB_565;
+ format = HAL_PIXEL_FORMAT_RGB_565;
} else {
ALOGE("Invalid native pixel format { r=%d, g=%d, b=%d, a=%d }",
red_size, green_size, blue_size, alpha_size);
diff --git a/services/surfaceflinger/Layer.cpp b/services/surfaceflinger/Layer.cpp
index b5d3262..0247723 100644
--- a/services/surfaceflinger/Layer.cpp
+++ b/services/surfaceflinger/Layer.cpp
@@ -95,7 +95,8 @@
mQueueItems(),
mLastFrameNumberReceived(0),
mUpdateTexImageFailed(false),
- mAutoRefresh(false)
+ mAutoRefresh(false),
+ mFreezePositionUpdates(false)
{
#ifdef USE_HWC2
ALOGV("Creating Layer %s", name.string());
@@ -1415,11 +1416,9 @@
c.requested.w, c.requested.h);
}
+ const bool resizePending = (c.requested.w != c.active.w) ||
+ (c.requested.h != c.active.h);
if (!isFixedSize()) {
-
- const bool resizePending = (c.requested.w != c.active.w) ||
- (c.requested.h != c.active.h);
-
if (resizePending && mSidebandStream == NULL) {
// don't let Layer::doTransaction update the drawing state
// if we have a pending resize, unless we are in fixed-size mode.
@@ -1443,8 +1442,16 @@
if (flags & eDontUpdateGeometryState) {
} else {
Layer::State& editCurrentState(getCurrentState());
- editCurrentState.active = editCurrentState.requested;
- c.active = c.requested;
+ if (mFreezePositionUpdates) {
+ float tx = c.active.transform.tx();
+ float ty = c.active.transform.ty();
+ c.active = c.requested;
+ c.active.transform.set(tx, ty);
+ editCurrentState.active = c.active;
+ } else {
+ editCurrentState.active = editCurrentState.requested;
+ c.active = c.requested;
+ }
}
if (s.active != c.active) {
@@ -1491,7 +1498,7 @@
return android_atomic_or(flags, &mTransactionFlags);
}
-bool Layer::setPosition(float x, float y) {
+bool Layer::setPosition(float x, float y, bool immediate) {
if (mCurrentState.requested.transform.tx() == x && mCurrentState.requested.transform.ty() == y)
return false;
mCurrentState.sequence++;
@@ -1500,12 +1507,16 @@
// we want to apply the position portion of the transform matrix immediately,
// but still delay scaling when resizing a SCALING_MODE_FREEZE layer.
mCurrentState.requested.transform.set(x, y);
- mCurrentState.active.transform.set(x, y);
+ if (immediate && !mFreezePositionUpdates) {
+ mCurrentState.active.transform.set(x, y);
+ }
+ mFreezePositionUpdates = mFreezePositionUpdates || !immediate;
mCurrentState.modified = true;
setTransactionFlags(eTransactionNeeded);
return true;
}
+
bool Layer::setLayer(uint32_t z) {
if (mCurrentState.z == z)
return false;
@@ -1585,6 +1596,7 @@
if (scalingMode == mOverrideScalingMode)
return false;
mOverrideScalingMode = scalingMode;
+ setTransactionFlags(eTransactionNeeded);
return true;
}
@@ -2004,6 +2016,7 @@
if (bufWidth != uint32_t(oldActiveBuffer->width) ||
bufHeight != uint32_t(oldActiveBuffer->height)) {
recomputeVisibleRegions = true;
+ mFreezePositionUpdates = false;
}
}
diff --git a/services/surfaceflinger/Layer.h b/services/surfaceflinger/Layer.h
index 7d085a4..ba7184f 100644
--- a/services/surfaceflinger/Layer.h
+++ b/services/surfaceflinger/Layer.h
@@ -145,7 +145,7 @@
status_t setBuffers(uint32_t w, uint32_t h, PixelFormat format, uint32_t flags);
// modify current state
- bool setPosition(float x, float y);
+ bool setPosition(float x, float y, bool immediate);
bool setLayer(uint32_t z);
bool setSize(uint32_t w, uint32_t h);
#ifdef USE_HWC2
@@ -596,6 +596,7 @@
bool mUpdateTexImageFailed; // This is only modified from the main thread
bool mAutoRefresh;
+ bool mFreezePositionUpdates;
};
// ---------------------------------------------------------------------------
diff --git a/services/surfaceflinger/SurfaceFlinger.cpp b/services/surfaceflinger/SurfaceFlinger.cpp
index 80b4d75..a10a813 100644
--- a/services/surfaceflinger/SurfaceFlinger.cpp
+++ b/services/surfaceflinger/SurfaceFlinger.cpp
@@ -2251,9 +2251,12 @@
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer != 0) {
const uint32_t what = s.what;
+ bool positionAppliesWithResize =
+ what & layer_state_t::ePositionAppliesWithResize;
if (what & layer_state_t::ePositionChanged) {
- if (layer->setPosition(s.x, s.y))
+ if (layer->setPosition(s.x, s.y, !positionAppliesWithResize)) {
flags |= eTraversalNeeded;
+ }
}
if (what & layer_state_t::eLayerChanged) {
// NOTE: index needs to be calculated before we update the state
diff --git a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
index 5721db7..7f3b269 100644
--- a/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
+++ b/services/surfaceflinger/SurfaceFlinger_hwc1.cpp
@@ -2267,9 +2267,12 @@
sp<Layer> layer(client->getLayerUser(s.surface));
if (layer != 0) {
const uint32_t what = s.what;
+ bool positionAppliesWithResize =
+ what & layer_state_t::ePositionAppliesWithResize;
if (what & layer_state_t::ePositionChanged) {
- if (layer->setPosition(s.x, s.y))
+ if (layer->setPosition(s.x, s.y, !positionAppliesWithResize)) {
flags |= eTraversalNeeded;
+ }
}
if (what & layer_state_t::eLayerChanged) {
// NOTE: index needs to be calculated before we update the state
diff --git a/vulkan/doc/DevelopersGuide.pdf b/vulkan/doc/DevelopersGuide.pdf
deleted file mode 100644
index cf009c5..0000000
--- a/vulkan/doc/DevelopersGuide.pdf
+++ /dev/null
Binary files differ
diff --git a/vulkan/doc/implementors_guide/implementors_guide.adoc b/vulkan/doc/implementors_guide/implementors_guide.adoc
index ae46f43..7ace777 100644
--- a/vulkan/doc/implementors_guide/implementors_guide.adoc
+++ b/vulkan/doc/implementors_guide/implementors_guide.adoc
@@ -6,8 +6,6 @@
This document is intended for GPU IHVs writing Vulkan drivers for Android, and OEMs integrating them for specific devices. It describes how a Vulkan driver interacts with the system, how GPU-specific tools should be installed, and Android-specific requirements.
-This is still a fairly rough draft; details will be filled in over time.
-
== Architecture ==
The primary interface between Vulkan applications and a device's Vulkan driver is the loader, which is part of AOSP and installed at +/system/lib[64]/libvulkan.so+. The loader provides the core Vulkan API entry points, as well as entry points of a few extensions that are required on Android and always present. In particular, the window system integration (WSI) extensions are exported by the loader and primarily implemented in it rather than the driver. The loader also supports enumerating and loading layers which can expose additional extensions and/or intercept core API calls on their way to the driver.
@@ -16,16 +14,16 @@
=== Driver Enumeration and Loading ===
-Android expects the GPUs available to the system to be known when the system image is built, so its driver enumeration process isn't as elaborate as other platforms. The loader will use the existing HAL mechanism (see https://android.googlesource.com/platform/hardware/libhardware/+/lollipop-mr1-release/include/hardware/hardware.h[hardware.h]) for discovering and loading the driver. As of this writing, the preferred paths for 32-bit and 64-bit Vulkan drivers are:
+Android expects the GPUs available to the system to be known when the system image is built, so its driver enumeration process isn't as elaborate as on other platforms. The loader will use the existing HAL mechanism for discovering and loading the driver. As of this writing, the preferred paths for 32-bit and 64-bit Vulkan drivers are:
/vendor/lib/hw/vulkan.<ro.product.platform>.so
/vendor/lib64/hw/vulkan.<ro.product.platform>.so
-where +<ro.product.platform>+ is replaced by the value of the system property of that name. See https://android.googlesource.com/platform/hardware/libhardware/+/lollipop-mr1-release/hardware.c[libhardware/hardware.c] for details and supported alternative locations.
+where +<ro.product.platform>+ is replaced by the value of the system property of that name. See https://android.googlesource.com/platform/hardware/libhardware/+/master/hardware.c[libhardware/hardware.c] for details and supported alternative locations.
The Vulkan +hw_module_t+ derivative is currently trivial. If support for multiple drivers is ever added, the HAL module will export a list of strings that can be passed to the module +open+ call. For the time being, only one driver is supported, and the constant string +HWVULKAN_DEVICE_0+ is passed to +open+.
-The Vulkan +hw_device_t+ derivative corresponds to a single driver, though that driver can support multiple physical devices. The +hw_device_t+ structure will be extended to export +vkGetGlobalExtensionProperties+, +vkCreateInstance+, and +vkGetInstanceProcAddr+ functions. The loader will find all other +VkInstance+, +VkPhysicalDevice+, and +vkGetDeviceProcAddr+ functions by calling +vkGetInstanceProcAddr+.
+The Vulkan +hw_device_t+ derivative corresponds to a single driver, though that driver can support multiple Vulkan physical devices. The +hw_device_t+ structure contains a function pointer for the +vkGetInstanceProcAddr+ function. The loader finds all other driver Vulkan functions by calling that +vkGetInstanceProcAddr+ function.
=== Layer Discovery and Loading ===
@@ -39,17 +37,15 @@
3. Injected layers, like framerate, social network, or game launcher overlays, which are provided by the user or some other application without the application's knowledge or consent. These violate Android's security policies and will not be supported.
-In the normal state the loader will only search in the application's native library directory for layers; details are TBD but it will probably just try to load any library with a name matching a particular pattern(e.g. +libvklayer_foo.so+). It will probably not need a separate manifest file; the developer deliberately included these layers, so the reasons to avoid loading libraries before enabling them don't apply.
+In the normal state the loader will only search in the application's normal library search path (as defined by the system ClassLoader) for layers. It will attempt to load any shared library named +libVkLayer_*.so+ as a layer library. Android does not use manifests to describe layers: because layers must have been deliberately included in the application by the developer, the motivation for manifests on other platforms don't apply.
-On debuggable devices (+ro.debuggable+ property exists and is non-zero, generally rooted or engineering builds) or debuggable processes (+prctl(PR_GET_DUMPABLE)==1+, based on the application's manifest), the loader may also search an adb-writeable location on /data for layers. It's not clear whether this is useful; in all the cases it could be used, the layer could be just as easily be put in the application's native library directory.
+On debuggable devices (+ro.debuggable+ property exists and is non-zero, generally rooted or engineering builds) the loader will also search the directory +/data/local/debug/vulkan+ and attempt to load layer libraries it finds there. This directory doesn't exist by default. On Android N and later, because this location is writable by adb, SELinux policies prevent mapping code located here as executable. So to use layers from here, SELinux enforcement must be disabled: +adb shell setenforce 0+. This mechanism is not intended for application developers, only for IHV and OEM engineers working on test devices that don't have private or sensitive data.
-Finally, the loader may include a built-in validation layer that it will enable based on settings in the Developer Options menu, which would send validation errors or warnings to the system log. Drivers may be able to emit additional hardware-specific errors/warnings through this mechanism. This layer would not be enumerated through the API. This is intended to allow cooperative end-users to collect extra information about failures from unmodified applications on unmodified devices to aid triage/diagnosis of difficult-to-reproduce problems. The functionality would be intentionally limited to minimize security and privacy risk.
-
-Our goal is to allow layers to be ported with only build-environment changes between Android and other platforms. This means the interface between layers and the loader must match the interface used by the LunarG loader. Currently, the LunarG interface has a few deficiencies and is largely unspecified. We intend to work with LunarG to correct as many deficiencies as we can and to specify the interface in detail so that layers can be implemented without referring to the loader source code.
+Our goal is to allow layers to be ported with only build-environment changes between Android and other platforms. For this to work, layers must properly implement things like +vkGetInstanceLayerProperties+ and +vkGetInstanceExtensionProperties+, even though the LunarG loader doesn't use them (it gets the information from manifests instead).
== Window System Integration ==
-The +vk_wsi_swapchin+ and +vk_wsi_device_swapchain+ extensions will primarily be implemented by the platform and live in +libvulkan.so+. The +VkSwapchain+ object and all interaction with +ANativeWindow+ will be handled by the platform and not exposed to drivers. The WSI implementation will rely on a few private interfaces to the driver for this implementation. These will be loaded through the driver's +vkGetDeviceProcAddr+ functions, after passing through any enabled layers.
+The +vk_wsi_swapchin+ and +vk_wsi_device_swapchain+ extensions are primarily be implemented by the platform and live in +libvulkan.so+. The +VkSwapchain+ object and all interaction with +ANativeWindow+ will be handled by the platform and not exposed to drivers. The WSI implementation will rely on a few private interfaces to the driver for this implementation. These will be loaded through the driver's +vkGetDeviceProcAddr+ functions, after passing through any enabled layers.
Implementations may need swapchain buffers to be allocated with implementation-defined private gralloc usage flags. When creating a swapchain, the platform will ask the driver to translate the requested format and image usage flags into gralloc usage flags by calling
[source,c]
@@ -81,8 +77,6 @@
} VkNativeBufferANDROID;
----
-TBD: During swapchain re-creation (using +oldSwapChain+), we may have to defer allocation of new gralloc buffers until old buffers have been released. If so, the +vkCreateImage+ calls will be deferred until the first +vkAcquireNextImageWSI+ that would return the new image.
-
When creating a gralloc-backed image, the +VkImageCreateInfo+ will have:
----
.imageType = VK_IMAGE_TYPE_2D
@@ -162,4 +156,6 @@
* Added a VkFence parameter to vkAcquireImageANDROID corresponding to the
parameter added to vkAcquireNextImageKHR.
. *2016-01-08*
- * Added waitSemaphoreCount and pWaitSemaphores parameters to vkQueueSignalReleaseImageANDROID.
\ No newline at end of file
+ * Added waitSemaphoreCount and pWaitSemaphores parameters to vkQueueSignalReleaseImageANDROID.
+. *2016-06-17*
+ * Updates to reflect final behavior, closed some TBDs now that they've BDed.
\ No newline at end of file
diff --git a/vulkan/doc/implementors_guide/implementors_guide.html b/vulkan/doc/implementors_guide/implementors_guide.html
index 58ce0dc..0bfeb81 100644
--- a/vulkan/doc/implementors_guide/implementors_guide.html
+++ b/vulkan/doc/implementors_guide/implementors_guide.html
@@ -743,7 +743,6 @@
<div id="preamble">
<div class="sectionbody">
<div class="paragraph"><p>This document is intended for GPU IHVs writing Vulkan drivers for Android, and OEMs integrating them for specific devices. It describes how a Vulkan driver interacts with the system, how GPU-specific tools should be installed, and Android-specific requirements.</p></div>
-<div class="paragraph"><p>This is still a fairly rough draft; details will be filled in over time.</p></div>
</div>
</div>
<div class="sect1">
@@ -753,15 +752,15 @@
<div class="paragraph"><p>The NDK will include a stub <span class="monospaced">libvulkan.so</span> exporting the same symbols as the loader. Calling the Vulkan functions exported from <span class="monospaced">libvulkan.so</span> will enter trampoline functions in the loader which will dispatch to the appropriate layer or driver based on their first argument. The <span class="monospaced">vkGet*ProcAddr</span> calls will return the function pointers that the trampolines would dispatch to, so calling through these function pointers rather than the exported symbols will be slightly more efficient since it skips the trampoline and dispatch.</p></div>
<div class="sect2">
<h3 id="_driver_enumeration_and_loading">1.1. Driver Enumeration and Loading</h3>
-<div class="paragraph"><p>Android expects the GPUs available to the system to be known when the system image is built, so its driver enumeration process isn’t as elaborate as other platforms. The loader will use the existing HAL mechanism (see <a href="https://android.googlesource.com/platform/hardware/libhardware/+/lollipop-mr1-release/include/hardware/hardware.h">hardware.h</a>) for discovering and loading the driver. As of this writing, the preferred paths for 32-bit and 64-bit Vulkan drivers are:</p></div>
+<div class="paragraph"><p>Android expects the GPUs available to the system to be known when the system image is built, so its driver enumeration process isn’t as elaborate as on other platforms. The loader will use the existing HAL mechanism for discovering and loading the driver. As of this writing, the preferred paths for 32-bit and 64-bit Vulkan drivers are:</p></div>
<div class="literalblock">
<div class="content monospaced">
<pre>/vendor/lib/hw/vulkan.<ro.product.platform>.so
/vendor/lib64/hw/vulkan.<ro.product.platform>.so</pre>
</div></div>
-<div class="paragraph"><p>where <span class="monospaced"><ro.product.platform></span> is replaced by the value of the system property of that name. See <a href="https://android.googlesource.com/platform/hardware/libhardware/+/lollipop-mr1-release/hardware.c">libhardware/hardware.c</a> for details and supported alternative locations.</p></div>
+<div class="paragraph"><p>where <span class="monospaced"><ro.product.platform></span> is replaced by the value of the system property of that name. See <a href="https://android.googlesource.com/platform/hardware/libhardware/+/master/hardware.c">libhardware/hardware.c</a> for details and supported alternative locations.</p></div>
<div class="paragraph"><p>The Vulkan <span class="monospaced">hw_module_t</span> derivative is currently trivial. If support for multiple drivers is ever added, the HAL module will export a list of strings that can be passed to the module <span class="monospaced">open</span> call. For the time being, only one driver is supported, and the constant string <span class="monospaced">HWVULKAN_DEVICE_0</span> is passed to <span class="monospaced">open</span>.</p></div>
-<div class="paragraph"><p>The Vulkan <span class="monospaced">hw_device_t</span> derivative corresponds to a single driver, though that driver can support multiple physical devices. The <span class="monospaced">hw_device_t</span> structure will be extended to export <span class="monospaced">vkGetGlobalExtensionProperties</span>, <span class="monospaced">vkCreateInstance</span>, and <span class="monospaced">vkGetInstanceProcAddr</span> functions. The loader will find all other <span class="monospaced">VkInstance</span>, <span class="monospaced">VkPhysicalDevice</span>, and <span class="monospaced">vkGetDeviceProcAddr</span> functions by calling <span class="monospaced">vkGetInstanceProcAddr</span>.</p></div>
+<div class="paragraph"><p>The Vulkan <span class="monospaced">hw_device_t</span> derivative corresponds to a single driver, though that driver can support multiple Vulkan physical devices. The <span class="monospaced">hw_device_t</span> structure contains a function pointer for the <span class="monospaced">vkGetInstanceProcAddr</span> function. The loader finds all other driver Vulkan functions by calling that <span class="monospaced">vkGetInstanceProcAddr</span> function.</p></div>
</div>
<div class="sect2">
<h3 id="_layer_discovery_and_loading">1.2. Layer Discovery and Loading</h3>
@@ -784,17 +783,16 @@
</p>
</li>
</ol></div>
-<div class="paragraph"><p>In the normal state the loader will only search in the application’s native library directory for layers; details are TBD but it will probably just try to load any library with a name matching a particular pattern(e.g. <span class="monospaced">libvklayer_foo.so</span>). It will probably not need a separate manifest file; the developer deliberately included these layers, so the reasons to avoid loading libraries before enabling them don’t apply.</p></div>
-<div class="paragraph"><p>On debuggable devices (<span class="monospaced">ro.debuggable</span> property exists and is non-zero, generally rooted or engineering builds) or debuggable processes (<span class="monospaced">prctl(PR_GET_DUMPABLE)==1</span>, based on the application’s manifest), the loader may also search an adb-writeable location on /data for layers. It’s not clear whether this is useful; in all the cases it could be used, the layer could be just as easily be put in the application’s native library directory.</p></div>
-<div class="paragraph"><p>Finally, the loader may include a built-in validation layer that it will enable based on settings in the Developer Options menu, which would send validation errors or warnings to the system log. Drivers may be able to emit additional hardware-specific errors/warnings through this mechanism. This layer would not be enumerated through the API. This is intended to allow cooperative end-users to collect extra information about failures from unmodified applications on unmodified devices to aid triage/diagnosis of difficult-to-reproduce problems. The functionality would be intentionally limited to minimize security and privacy risk.</p></div>
-<div class="paragraph"><p>Our goal is to allow layers to be ported with only build-environment changes between Android and other platforms. This means the interface between layers and the loader must match the interface used by the LunarG loader. Currently, the LunarG interface has a few deficiencies and is largely unspecified. We intend to work with LunarG to correct as many deficiencies as we can and to specify the interface in detail so that layers can be implemented without referring to the loader source code.</p></div>
+<div class="paragraph"><p>In the normal state the loader will only search in the application’s normal library search path (as defined by the system ClassLoader) for layers. It will attempt to load any shared library named <span class="monospaced">libVkLayer_*.so</span> as a layer library. Android does not use manifests to describe layers: because layers must have been deliberately included in the application by the developer, the motivation for manifests on other platforms don’t apply.</p></div>
+<div class="paragraph"><p>On debuggable devices (<span class="monospaced">ro.debuggable</span> property exists and is non-zero, generally rooted or engineering builds) the loader will also search the directory <span class="monospaced">/data/local/debug/vulkan</span> and attempt to load layer libraries it finds there. This directory doesn’t exist by default. On Android N and later, because this location is writable by adb, SELinux policies prevent mapping code located here as executable. So to use layers from here, SELinux enforcement must be disabled: <span class="monospaced">adb shell setenforce 0</span>. This mechanism is not intended for application developers, only for IHV and OEM engineers working on test devices that don’t have private or sensitive data.</p></div>
+<div class="paragraph"><p>Our goal is to allow layers to be ported with only build-environment changes between Android and other platforms. For this to work, layers must properly implement things like <span class="monospaced">vkGetInstanceLayerProperties</span> and <span class="monospaced">vkGetInstanceExtensionProperties</span>, even though the LunarG loader doesn’t use them (it gets the information from manifests instead).</p></div>
</div>
</div>
</div>
<div class="sect1">
<h2 id="_window_system_integration">2. Window System Integration</h2>
<div class="sectionbody">
-<div class="paragraph"><p>The <span class="monospaced">vk_wsi_swapchin</span> and <span class="monospaced">vk_wsi_device_swapchain</span> extensions will primarily be implemented by the platform and live in <span class="monospaced">libvulkan.so</span>. The <span class="monospaced">VkSwapchain</span> object and all interaction with <span class="monospaced">ANativeWindow</span> will be handled by the platform and not exposed to drivers. The WSI implementation will rely on a few private interfaces to the driver for this implementation. These will be loaded through the driver’s <span class="monospaced">vkGetDeviceProcAddr</span> functions, after passing through any enabled layers.</p></div>
+<div class="paragraph"><p>The <span class="monospaced">vk_wsi_swapchin</span> and <span class="monospaced">vk_wsi_device_swapchain</span> extensions are primarily be implemented by the platform and live in <span class="monospaced">libvulkan.so</span>. The <span class="monospaced">VkSwapchain</span> object and all interaction with <span class="monospaced">ANativeWindow</span> will be handled by the platform and not exposed to drivers. The WSI implementation will rely on a few private interfaces to the driver for this implementation. These will be loaded through the driver’s <span class="monospaced">vkGetDeviceProcAddr</span> functions, after passing through any enabled layers.</p></div>
<div class="paragraph"><p>Implementations may need swapchain buffers to be allocated with implementation-defined private gralloc usage flags. When creating a swapchain, the platform will ask the driver to translate the requested format and image usage flags into gralloc usage flags by calling</p></div>
<div class="listingblock">
<div class="content"><!-- Generator: GNU source-highlight 3.1.8
@@ -826,7 +824,6 @@
<span style="color: #009900">int</span> format<span style="color: #990000">;</span>
<span style="color: #009900">int</span> usage<span style="color: #990000">;</span>
<span style="color: #FF0000">}</span> VkNativeBufferANDROID<span style="color: #990000">;</span></tt></pre></div></div>
-<div class="paragraph"><p>TBD: During swapchain re-creation (using <span class="monospaced">oldSwapChain</span>), we may have to defer allocation of new gralloc buffers until old buffers have been released. If so, the <span class="monospaced">vkCreateImage</span> calls will be deferred until the first <span class="monospaced">vkAcquireNextImageWSI</span> that would return the new image.</p></div>
<div class="paragraph"><p>When creating a gralloc-backed image, the <span class="monospaced">VkImageCreateInfo</span> will have:</p></div>
<div class="listingblock">
<div class="content monospaced">
@@ -969,6 +966,18 @@
</li>
</ul></div>
</li>
+<li>
+<p>
+<strong>2016-06-17</strong>
+</p>
+<div class="ulist"><ul>
+<li>
+<p>
+Updates to reflect final behavior, closed some TBDs now that they’ve BDed.
+</p>
+</li>
+</ul></div>
+</li>
</ol></div>
</div>
</div>
@@ -977,7 +986,7 @@
<div id="footer">
<div id="footer-text">
Version 5<br>
-Last updated 2016-01-08 22:43:07 PST
+Last updated 2016-06-17 13:54:25 PDT
</div>
</div>
</body>