mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-12-01 02:25:40 +00:00
Compare commits
1
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
75d79fc14d |
No files matched your search
@@ -740,8 +740,7 @@ jobs:
|
||||
echo "version=$(grep -o "org.robolectric:robolectric:[0-9.]*" app/build.gradle | cut -d: -f3)" >> "$GITHUB_OUTPUT"
|
||||
# Robolectric downloads these from Maven Central on first use without retrying, and 429s fail whole test classes.
|
||||
# The cache path sits beside the workspace because runner homes are at different depths from it, and
|
||||
# actions/cache stores paths relative to the workspace. It is passed as an absolute path: the save action rejects
|
||||
# "..". Runners that keep their own ~/.m2 skip the cache.
|
||||
# actions/cache stores paths relative to the workspace. Runners that keep their own ~/.m2 skip the cache.
|
||||
- name: Place Robolectric's Android jars beside the workspace
|
||||
id: robolectric-jars
|
||||
run: |
|
||||
@@ -752,9 +751,7 @@ jobs:
|
||||
echo "cache=false" >> "$GITHUB_OUTPUT"
|
||||
else
|
||||
mkdir -p "$jars" "$(dirname "$m2")"
|
||||
jars=$(cd "$jars" && pwd)
|
||||
ln -sfn "$jars" "$m2"
|
||||
echo "path=$jars" >> "$GITHUB_OUTPUT"
|
||||
ln -sfn "$(cd "$jars" && pwd)" "$m2"
|
||||
echo "cache=true" >> "$GITHUB_OUTPUT"
|
||||
fi
|
||||
- name: Restore Robolectric's Android jars
|
||||
@@ -762,7 +759,7 @@ jobs:
|
||||
if: steps.robolectric-jars.outputs.cache == 'true'
|
||||
uses: actions/cache/restore@v4
|
||||
with:
|
||||
path: ${{ steps.robolectric-jars.outputs.path }}
|
||||
path: ../robolectric-jars
|
||||
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
|
||||
restore-keys: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-
|
||||
- name: Count the restored Robolectric jars
|
||||
@@ -776,16 +773,7 @@ jobs:
|
||||
run: |
|
||||
set -o pipefail
|
||||
mkdir -p app/build
|
||||
# A Maven 429 fails every test class that needs the missing jar. The jars an attempt did get stay for the next.
|
||||
for wait in 60 180 0; do
|
||||
status=0
|
||||
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log || status=$?
|
||||
if [ "$status" = 0 ] || [ "$wait" = 0 ] || ! grep -Eq '^[[:space:]]*(Caused by: org\.gradle\.internal\.resource\.transport\.http\.HttpErrorStatusCodeException: Could not GET .*https://repo\.maven\.apache\.org/.*Received status code 429 from server|Caused by: java\.io\.IOException: Server returned HTTP response code: 429 for URL: https://repo\.maven\.apache\.org/)' app/build/unit-tests.log; then
|
||||
exit "$status"
|
||||
fi
|
||||
echo "::warning::Maven Central answered 429; running the unit tests again in ${wait}s"
|
||||
sleep "$wait"
|
||||
done
|
||||
./gradlew testReleaseUnitTest --console=plain --info --stacktrace -Drobolectric.logging=stderr -PndkVersion="$NDK_VERSION" 2>&1 | tee app/build/unit-tests.log
|
||||
|
||||
# actions/cache only saves when the job succeeds, so a run whose tests died on a Maven 429 never filled the cache.
|
||||
# Save the complete jars even after a failed test step, when this run added some; a partial download is dropped first.
|
||||
@@ -812,7 +800,7 @@ jobs:
|
||||
if: always() && steps.robolectric-jars-final.outputs.save == 'true'
|
||||
uses: actions/cache/save@v4
|
||||
with:
|
||||
path: ${{ steps.robolectric-jars.outputs.path }}
|
||||
path: ../robolectric-jars
|
||||
key: robolectric-android-all-v3-${{ steps.robolectric.outputs.version }}-${{ github.run_id }}
|
||||
|
||||
- name: Upload unit test diagnostics
|
||||
|
||||
@@ -33,9 +33,6 @@
|
||||
<uses-permission android:name="android.permission.REORDER_TASKS" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
<uses-permission android:name="android.permission.CHANGE_WIFI_MULTICAST_STATE" />
|
||||
<!-- Granted only with adb shell pm grant; lets the agent turn Wireless debugging on where Settings hides it (Quest). -->
|
||||
<uses-permission android:name="android.permission.WRITE_SECURE_SETTINGS"
|
||||
tools:ignore="ProtectedPermissions" />
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" />
|
||||
@@ -417,69 +414,5 @@
|
||||
android:name="backend:com.google.android.datatransport.cct.CctBackendFactory"
|
||||
tools:node="remove" />
|
||||
</service>
|
||||
<service android:name=".runtime.GuestWorker0" android:exported="false" android:process=":g0" />
|
||||
<service android:name=".runtime.GuestWorker1" android:exported="false" android:process=":g1" />
|
||||
<service android:name=".runtime.GuestWorker2" android:exported="false" android:process=":g2" />
|
||||
<service android:name=".runtime.GuestWorker3" android:exported="false" android:process=":g3" />
|
||||
<service android:name=".runtime.GuestWorker4" android:exported="false" android:process=":g4" />
|
||||
<service android:name=".runtime.GuestWorker5" android:exported="false" android:process=":g5" />
|
||||
<service android:name=".runtime.GuestWorker6" android:exported="false" android:process=":g6" />
|
||||
<service android:name=".runtime.GuestWorker7" android:exported="false" android:process=":g7" />
|
||||
<service android:name=".runtime.GuestWorker8" android:exported="false" android:process=":g8" />
|
||||
<service android:name=".runtime.GuestWorker9" android:exported="false" android:process=":g9" />
|
||||
<service android:name=".runtime.GuestWorker10" android:exported="false" android:process=":g10" />
|
||||
<service android:name=".runtime.GuestWorker11" android:exported="false" android:process=":g11" />
|
||||
<service android:name=".runtime.GuestWorker12" android:exported="false" android:process=":g12" />
|
||||
<service android:name=".runtime.GuestWorker13" android:exported="false" android:process=":g13" />
|
||||
<service android:name=".runtime.GuestWorker14" android:exported="false" android:process=":g14" />
|
||||
<service android:name=".runtime.GuestWorker15" android:exported="false" android:process=":g15" />
|
||||
<service android:name=".runtime.GuestWorker16" android:exported="false" android:process=":g16" />
|
||||
<service android:name=".runtime.GuestWorker17" android:exported="false" android:process=":g17" />
|
||||
<service android:name=".runtime.GuestWorker18" android:exported="false" android:process=":g18" />
|
||||
<service android:name=".runtime.GuestWorker19" android:exported="false" android:process=":g19" />
|
||||
<service android:name=".runtime.GuestWorker20" android:exported="false" android:process=":g20" />
|
||||
<service android:name=".runtime.GuestWorker21" android:exported="false" android:process=":g21" />
|
||||
<service android:name=".runtime.GuestWorker22" android:exported="false" android:process=":g22" />
|
||||
<service android:name=".runtime.GuestWorker23" android:exported="false" android:process=":g23" />
|
||||
<service android:name=".runtime.GuestWorker24" android:exported="false" android:process=":g24" />
|
||||
<service android:name=".runtime.GuestWorker25" android:exported="false" android:process=":g25" />
|
||||
<service android:name=".runtime.GuestWorker26" android:exported="false" android:process=":g26" />
|
||||
<service android:name=".runtime.GuestWorker27" android:exported="false" android:process=":g27" />
|
||||
<service android:name=".runtime.GuestWorker28" android:exported="false" android:process=":g28" />
|
||||
<service android:name=".runtime.GuestWorker29" android:exported="false" android:process=":g29" />
|
||||
<service android:name=".runtime.GuestWorker30" android:exported="false" android:process=":g30" />
|
||||
<service android:name=".runtime.GuestWorker31" android:exported="false" android:process=":g31" />
|
||||
<service android:name=".runtime.GuestWorker32" android:exported="false" android:process=":g32" />
|
||||
<service android:name=".runtime.GuestWorker33" android:exported="false" android:process=":g33" />
|
||||
<service android:name=".runtime.GuestWorker34" android:exported="false" android:process=":g34" />
|
||||
<service android:name=".runtime.GuestWorker35" android:exported="false" android:process=":g35" />
|
||||
<service android:name=".runtime.GuestWorker36" android:exported="false" android:process=":g36" />
|
||||
<service android:name=".runtime.GuestWorker37" android:exported="false" android:process=":g37" />
|
||||
<service android:name=".runtime.GuestWorker38" android:exported="false" android:process=":g38" />
|
||||
<service android:name=".runtime.GuestWorker39" android:exported="false" android:process=":g39" />
|
||||
<service android:name=".runtime.GuestWorker40" android:exported="false" android:process=":g40" />
|
||||
<service android:name=".runtime.GuestWorker41" android:exported="false" android:process=":g41" />
|
||||
<service android:name=".runtime.GuestWorker42" android:exported="false" android:process=":g42" />
|
||||
<service android:name=".runtime.GuestWorker43" android:exported="false" android:process=":g43" />
|
||||
<service android:name=".runtime.GuestWorker44" android:exported="false" android:process=":g44" />
|
||||
<service android:name=".runtime.GuestWorker45" android:exported="false" android:process=":g45" />
|
||||
<service android:name=".runtime.GuestWorker46" android:exported="false" android:process=":g46" />
|
||||
<service android:name=".runtime.GuestWorker47" android:exported="false" android:process=":g47" />
|
||||
<service android:name=".runtime.GuestWorker48" android:exported="false" android:process=":g48" />
|
||||
<service android:name=".runtime.GuestWorker49" android:exported="false" android:process=":g49" />
|
||||
<service android:name=".runtime.GuestWorker50" android:exported="false" android:process=":g50" />
|
||||
<service android:name=".runtime.GuestWorker51" android:exported="false" android:process=":g51" />
|
||||
<service android:name=".runtime.GuestWorker52" android:exported="false" android:process=":g52" />
|
||||
<service android:name=".runtime.GuestWorker53" android:exported="false" android:process=":g53" />
|
||||
<service android:name=".runtime.GuestWorker54" android:exported="false" android:process=":g54" />
|
||||
<service android:name=".runtime.GuestWorker55" android:exported="false" android:process=":g55" />
|
||||
<service android:name=".runtime.GuestWorker56" android:exported="false" android:process=":g56" />
|
||||
<service android:name=".runtime.GuestWorker57" android:exported="false" android:process=":g57" />
|
||||
<service android:name=".runtime.GuestWorker58" android:exported="false" android:process=":g58" />
|
||||
<service android:name=".runtime.GuestWorker59" android:exported="false" android:process=":g59" />
|
||||
<service android:name=".runtime.GuestWorker60" android:exported="false" android:process=":g60" />
|
||||
<service android:name=".runtime.GuestWorker61" android:exported="false" android:process=":g61" />
|
||||
<service android:name=".runtime.GuestWorker62" android:exported="false" android:process=":g62" />
|
||||
<service android:name=".runtime.GuestWorker63" android:exported="false" android:process=":g63" />
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -4130,24 +4130,6 @@ EXPORT ssize_t read(int fd, void *buf, size_t count) {
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
// glibc's fortify failure; bionic (DroidDeck-Bionic preloads this library into its Wine processes) has no
|
||||
// __chk_fail, and a library naming it there cannot be loaded, which stops every Wine program from starting.
|
||||
#if defined(__BIONIC__)
|
||||
[[noreturn]] static void fakeinput_chk_fail(void) { abort(); }
|
||||
#else
|
||||
extern "C" [[noreturn]] void __chk_fail(void);
|
||||
[[noreturn]] static void fakeinput_chk_fail(void) { __chk_fail(); }
|
||||
#endif
|
||||
|
||||
/* Programs built with _FORTIFY_SOURCE (Flatpak runtimes among them) call these instead of read, poll
|
||||
* and ppoll, and glibc's versions go straight to the kernel. */
|
||||
EXPORT ssize_t __read_chk(int fd, void *buf, size_t count, size_t buflen) {
|
||||
static auto next_read_chk = reinterpret_cast<ssize_t (*)(int, void *, size_t, size_t)>(dlsym(RTLD_NEXT, "__read_chk"));
|
||||
if (count > buflen) fakeinput_chk_fail();
|
||||
if (next_read_chk && !is_fake_input_fd(fd)) return next_read_chk(fd, buf, count, buflen);
|
||||
return read_input(fd, buf, count);
|
||||
}
|
||||
|
||||
EXPORT ssize_t readv(int fd, const struct iovec *iov, int iovcnt) {
|
||||
if (!is_fake_input_fd(fd)) return syscall(SYS_readv, fd, iov, iovcnt);
|
||||
if (iovcnt < 0 || iovcnt > IOV_MAX) {
|
||||
@@ -4396,17 +4378,6 @@ EXPORT int ppoll(struct pollfd *fds, nfds_t nfds,
|
||||
return my_ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
EXPORT int __poll_chk(struct pollfd *fds, nfds_t nfds, int timeout, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) fakeinput_chk_fail();
|
||||
return poll(fds, nfds, timeout);
|
||||
}
|
||||
|
||||
EXPORT int __ppoll_chk(struct pollfd *fds, nfds_t nfds, const struct timespec *timeout,
|
||||
const sigset_t *sigmask, size_t fdslen) {
|
||||
if (fdslen / sizeof(*fds) < nfds) fakeinput_chk_fail();
|
||||
return ppoll(fds, nfds, timeout, sigmask);
|
||||
}
|
||||
|
||||
EXPORT int select(int nfds, fd_set *readfds, fd_set *writefds,
|
||||
fd_set *exceptfds, struct timeval *timeout) {
|
||||
const auto my_select = next_symbol<decltype(&::select)>(Next::select);
|
||||
|
||||
@@ -27,31 +27,7 @@ VkImageMemoryBarrier bar(VkImage img, VkImageLayout from, VkImageLayout to,
|
||||
}
|
||||
|
||||
Engine::Engine() = default;
|
||||
Engine::~Engine() { (void)destroy(); }
|
||||
|
||||
bool Engine::destroy() {
|
||||
if (!fg_.destroy()) {
|
||||
DDFG_LOGE("native: retaining the input ring because GPU completion is unknown");
|
||||
return false;
|
||||
}
|
||||
if (!destroyRing(true)) {
|
||||
DDFG_LOGE("native: could not release the input ring during teardown");
|
||||
return false;
|
||||
}
|
||||
dev_ = VK_NULL_HANDLE;
|
||||
unavailable_ = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Engine::abandon() {
|
||||
fg_.abandon();
|
||||
ring_[0] = Slot{};
|
||||
ring_[1] = Slot{};
|
||||
dev_ = VK_NULL_HANDLE;
|
||||
queue_ = VK_NULL_HANDLE;
|
||||
phys_ = VK_NULL_HANDLE;
|
||||
unavailable_ = true;
|
||||
}
|
||||
Engine::~Engine() { destroyRing(); fg_.destroy(); }
|
||||
|
||||
bool Engine::init(const VkTable& table, VkPhysicalDevice phys, VkDevice dev,
|
||||
uint32_t queueFamily, VkQueue queue) {
|
||||
@@ -83,29 +59,15 @@ bool Engine::prepare(uint32_t w, uint32_t h, VkFormat fmt) {
|
||||
if (unavailable_ || w == 0 || h == 0 || fmt == VK_FORMAT_UNDEFINED) return false;
|
||||
if (builtW_ == w && builtH_ == h && builtFmt_ == fmt && fg_.valid()) return true;
|
||||
|
||||
const bool formatChanged = fmt != builtFmt_;
|
||||
if (!fg_.onResize(VkExtent2D{w, h}, fmt, formatChanged)) {
|
||||
|
||||
if (!fg_.onResize(VkExtent2D{w, h}, fmt, false)) {
|
||||
DDFG_LOGE("native: onResize %ux%u failed; frame generation unavailable", w, h);
|
||||
unavailable_ = true;
|
||||
return false;
|
||||
}
|
||||
bool deviceLost = false;
|
||||
if (!destroyRing(false, &deviceLost)) {
|
||||
DDFG_LOGE("native: could not safely release the previous input ring");
|
||||
unavailable_ = true;
|
||||
return false;
|
||||
}
|
||||
if (deviceLost) {
|
||||
DDFG_LOGE("native: device lost while releasing the input ring");
|
||||
unavailable_ = true;
|
||||
return false;
|
||||
}
|
||||
destroyRing();
|
||||
for (Slot& s : ring_) {
|
||||
if (!makeSlot(s, w, h, fmt)) {
|
||||
destroyRing(true);
|
||||
unavailable_ = true;
|
||||
return false;
|
||||
}
|
||||
if (!makeSlot(s, w, h, fmt)) { destroyRing(); unavailable_ = true; return false; }
|
||||
}
|
||||
builtW_ = w; builtH_ = h; builtFmt_ = fmt;
|
||||
history_ = 0; curr_ = 0; frames_ = 0;
|
||||
@@ -216,37 +178,11 @@ void Engine::destroySlot(Slot& s) {
|
||||
s = Slot{};
|
||||
}
|
||||
|
||||
bool Engine::destroyRing(bool deviceIdleConfirmed, bool* deviceLost) {
|
||||
if (deviceLost) *deviceLost = false;
|
||||
const bool hasResources = ring_[0].img || ring_[0].mem || ring_[0].view ||
|
||||
ring_[1].img || ring_[1].mem || ring_[1].view;
|
||||
if (!hasResources) {
|
||||
history_ = 0;
|
||||
return true;
|
||||
}
|
||||
if (dev_ == VK_NULL_HANDLE) {
|
||||
DDFG_LOGE("native: cannot release the input ring without a valid device");
|
||||
return false;
|
||||
}
|
||||
if (!deviceIdleConfirmed) {
|
||||
if (!dd_.DeviceWaitIdle) {
|
||||
DDFG_LOGE("native: cannot release the input ring without vkDeviceWaitIdle");
|
||||
return false;
|
||||
}
|
||||
const VkResult result = dd_.DeviceWaitIdle(dev_);
|
||||
if (result == VK_ERROR_DEVICE_LOST) {
|
||||
if (deviceLost) *deviceLost = true;
|
||||
unavailable_ = true;
|
||||
} else if (result != VK_SUCCESS) {
|
||||
DDFG_LOGE("native: DeviceWaitIdle failed (%d); retaining the input ring", (int)result);
|
||||
unavailable_ = true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
destroySlot(ring_[0]);
|
||||
destroySlot(ring_[1]);
|
||||
void Engine::destroyRing() {
|
||||
if (dev_ == VK_NULL_HANDLE || !dd_.DeviceWaitIdle) return;
|
||||
if (ring_[0].img || ring_[1].img) dd_.DeviceWaitIdle(dev_);
|
||||
destroySlot(ring_[0]); destroySlot(ring_[1]);
|
||||
history_ = 0;
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -36,15 +36,13 @@ public:
|
||||
uint32_t width, uint32_t height);
|
||||
|
||||
void reset();
|
||||
bool destroy();
|
||||
void abandon();
|
||||
|
||||
private:
|
||||
struct Slot { VkImage img = VK_NULL_HANDLE; VkDeviceMemory mem = VK_NULL_HANDLE;
|
||||
VkImageView view = VK_NULL_HANDLE; bool valid = false; };
|
||||
bool makeSlot(Slot& s, uint32_t w, uint32_t h, VkFormat fmt);
|
||||
void destroySlot(Slot& s);
|
||||
bool destroyRing(bool deviceIdleConfirmed = false, bool* deviceLost = nullptr);
|
||||
void destroyRing();
|
||||
uint32_t memType(uint32_t bits, VkMemoryPropertyFlags props) const;
|
||||
|
||||
DeviceDispatch dd_{};
|
||||
|
||||
@@ -7,31 +7,6 @@
|
||||
|
||||
namespace ddfg {
|
||||
|
||||
struct ScratchState {
|
||||
VkDevice ownerDevice = VK_NULL_HANDLE;
|
||||
VkBuffer synthUbo[ddfg::FrameGen::kSynthSlots]{};
|
||||
VkDeviceMemory synthUboMem[ddfg::FrameGen::kSynthSlots]{};
|
||||
void* synthUboPtr[ddfg::FrameGen::kSynthSlots]{};
|
||||
std::vector<VkBuffer> flowUbo; std::vector<VkDeviceMemory> flowUboMem; std::vector<void*> flowUboPtr;
|
||||
VkBuffer expandUbo = VK_NULL_HANDLE; VkDeviceMemory expandUboMem = VK_NULL_HANDLE; void* expandUboPtr = nullptr;
|
||||
VkBuffer flowRegUbo = VK_NULL_HANDLE; VkDeviceMemory flowRegUboMem = VK_NULL_HANDLE; void* flowRegUboPtr = nullptr;
|
||||
VkBuffer gmUbo[ddfg::FrameGen::kGmSlots]{};
|
||||
VkDeviceMemory gmUboMem[ddfg::FrameGen::kGmSlots]{};
|
||||
void* gmUboPtr[ddfg::FrameGen::kGmSlots]{};
|
||||
VkDescriptorSet sLumaCurr = VK_NULL_HANDLE, sLumaPrev = VK_NULL_HANDLE;
|
||||
std::vector<VkDescriptorSet> sDownA, sDownB, sFlow;
|
||||
VkDescriptorSet sExpand[ddfg::FrameGen::kGmSlots]{};
|
||||
VkDescriptorSet sFlowReg0 = VK_NULL_HANDLE, sFlowRegAB = VK_NULL_HANDLE, sFlowRegBA = VK_NULL_HANDLE;
|
||||
VkDescriptorSet sSynth[ddfg::FrameGen::kSynthSlots]{};
|
||||
VkDescriptorSet sGmReduce[ddfg::FrameGen::kGmSlots]{};
|
||||
std::vector<VkDescriptorSet> sGmPrewarp[ddfg::FrameGen::kGmSlots];
|
||||
VkExtent2D builtFor{0,0};
|
||||
uint64_t builtGeneration = 0;
|
||||
bool built = false;
|
||||
bool flowInited = false;
|
||||
bool flowReady = false;
|
||||
};
|
||||
|
||||
#define VKOK(x) do { if ((x) != VK_SUCCESS) { DDFG_LOGE("vk fail: %s", #x); return false; } } while (0)
|
||||
|
||||
uint32_t FrameGen::findMemType(uint32_t bits, VkMemoryPropertyFlags props) const {
|
||||
@@ -133,10 +108,6 @@ static bool buildSetLayout(const DeviceDispatch* dd, VkDevice dev,
|
||||
|
||||
bool FrameGen::init(const DeviceDispatch* dd, const InstanceDispatch* id,
|
||||
VkPhysicalDevice phys, VkDevice dev, uint32_t queueFamily, VkQueue queue) {
|
||||
if (device_ || completionUnknown_ || deviceLost_) {
|
||||
DDFG_LOGE("framegen: refusing to initialize an instance that still owns device resources");
|
||||
return false;
|
||||
}
|
||||
dd_ = dd; id_ = id; phys_ = phys; device_ = dev; queueFamily_ = queueFamily; queue_ = queue;
|
||||
id_->GetPhysicalDeviceMemoryProperties(phys_, &memProps_);
|
||||
|
||||
@@ -195,19 +166,16 @@ static VkExtent2D levelExtent(VkExtent2D e, int l) {
|
||||
}
|
||||
|
||||
bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) {
|
||||
if (completionUnknown_ || deviceLost_) return false;
|
||||
if (!device_) {
|
||||
DDFG_LOGE("framegen: cannot resize before device initialization");
|
||||
return false;
|
||||
}
|
||||
if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true;
|
||||
if (ready_ && !waitIdle("resize")) return false;
|
||||
if (scratch_ && scratch_->ownerDevice != VK_NULL_HANDLE && !destroyScratchResources()) {
|
||||
DDFG_LOGE("framegen resize: scratch cleanup failed; retaining the previous image set");
|
||||
return false;
|
||||
}
|
||||
|
||||
ready_ = false;
|
||||
|
||||
if (!force && ready_ && extent.width == extent_.width && extent.height == extent_.height) return true;
|
||||
if (ready_) {
|
||||
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
|
||||
if (idleResult != VK_SUCCESS) {
|
||||
DDFG_LOGE("framegen resize: DeviceWaitIdle failed (%d); keeping existing images", (int)idleResult);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
++imageGeneration_;
|
||||
for (auto& i : pyrA_) destroyImage(i); pyrA_.clear();
|
||||
for (auto& i : pyrB_) destroyImage(i); pyrB_.clear();
|
||||
@@ -215,17 +183,7 @@ bool FrameGen::onResize(VkExtent2D extent, VkFormat , bool force) {
|
||||
for (auto& i : flowLvl_) destroyImage(i); flowLvl_.clear();
|
||||
destroyImage(flowExpA_); destroyImage(flowExpB_);
|
||||
destroyImage(flowRegA_); destroyImage(flowRegB_);
|
||||
extent_ = extent;
|
||||
|
||||
for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0;
|
||||
for (int s = 0; s < kGmSlots; ++s) {
|
||||
gmSlotValid_[s] = false;
|
||||
for (int i = 0; i < 6; ++i) gmLinAt_[s][i] = 0.0;
|
||||
}
|
||||
gmHaveEst_ = false;
|
||||
gmEngaged_ = false;
|
||||
gmStableCount_ = 0;
|
||||
gmLastTransPx_ = 0.0f;
|
||||
extent_ = extent; ready_ = false;
|
||||
|
||||
const VkImageUsageFlags lumaUsage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT;
|
||||
const VkImageUsageFlags flowUsage = VK_IMAGE_USAGE_SAMPLED_BIT | VK_IMAGE_USAGE_STORAGE_BIT | VK_IMAGE_USAGE_TRANSFER_DST_BIT;
|
||||
@@ -276,37 +234,21 @@ void FrameGen::initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout t
|
||||
}
|
||||
|
||||
|
||||
bool FrameGen::destroy() {
|
||||
if (!device_) return true;
|
||||
if (!deviceLost_) {
|
||||
// A previous wait failure leaves completion unknown, but a later
|
||||
// teardown attempt may safely retry the wait before releasing resources.
|
||||
if (!dd_ || !dd_->DeviceWaitIdle) {
|
||||
ready_ = false;
|
||||
completionUnknown_ = true;
|
||||
DDFG_LOGE("framegen destroy: vkDeviceWaitIdle is unavailable; preserving GPU resources");
|
||||
return false;
|
||||
}
|
||||
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
|
||||
if (idleResult == VK_SUCCESS) completionUnknown_ = false;
|
||||
if (idleResult != VK_SUCCESS) {
|
||||
ready_ = false;
|
||||
if (idleResult == VK_ERROR_DEVICE_LOST) {
|
||||
deviceLost_ = true;
|
||||
DDFG_LOGE("framegen destroy: device lost; releasing owned resources without waiting");
|
||||
} else {
|
||||
completionUnknown_ = true;
|
||||
DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources because GPU completion is unknown",
|
||||
(int)idleResult);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
void FrameGen::destroy() {
|
||||
if (!device_) return;
|
||||
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
|
||||
if (idleResult != VK_SUCCESS && idleResult != VK_ERROR_DEVICE_LOST) {
|
||||
DDFG_LOGE("framegen destroy: DeviceWaitIdle failed (%d); preserving resources for safe retry", (int)idleResult);
|
||||
return;
|
||||
}
|
||||
if (idleResult == VK_ERROR_DEVICE_LOST) {
|
||||
// A lost device cannot become idle again. Still explicitly destroy its
|
||||
// child objects; skip descriptor-pool reset and release scratch ownership.
|
||||
DDFG_LOGE("framegen destroy: device lost; releasing owned resources without waiting");
|
||||
destroyScratchResources(false);
|
||||
} else {
|
||||
destroyScratchResources();
|
||||
}
|
||||
|
||||
ready_ = false;
|
||||
if (descPool_) dd_->DestroyDescriptorPool(device_, descPool_, nullptr);
|
||||
descPool_ = VK_NULL_HANDLE;
|
||||
releaseScratch();
|
||||
for (auto& i : pyrA_) destroyImage(i); pyrA_.clear();
|
||||
for (auto& i : pyrB_) destroyImage(i); pyrB_.clear();
|
||||
for (auto& i : pyrAs_) destroyImage(i); pyrAs_.clear();
|
||||
@@ -318,45 +260,15 @@ bool FrameGen::destroy() {
|
||||
destroyPipe(pGmReduce_); destroyPipe(pGmPrewarp_);
|
||||
destroyPipe(pFlowReg_);
|
||||
for (int s = 0; s < kGmSlots; ++s) {
|
||||
if (gmSsboPtr_[s] && gmSsboMem_[s]) dd_->UnmapMemory(device_, gmSsboMem_[s]);
|
||||
if (gmSsboMem_[s]) dd_->UnmapMemory(device_, gmSsboMem_[s]);
|
||||
if (gmSsbo_[s]) dd_->DestroyBuffer(device_, gmSsbo_[s], nullptr);
|
||||
if (gmSsboMem_[s]) dd_->FreeMemory(device_, gmSsboMem_[s], nullptr);
|
||||
gmSsbo_[s] = VK_NULL_HANDLE; gmSsboMem_[s] = VK_NULL_HANDLE; gmSsboPtr_[s] = nullptr;
|
||||
}
|
||||
gmBuffersReady_ = false;
|
||||
if (descPool_) dd_->DestroyDescriptorPool(device_, descPool_, nullptr);
|
||||
if (linear_) dd_->DestroySampler(device_, linear_, nullptr);
|
||||
linear_ = VK_NULL_HANDLE;
|
||||
device_ = VK_NULL_HANDLE;
|
||||
ready_ = false;
|
||||
deviceLost_ = false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameGen::abandon() {
|
||||
device_ = VK_NULL_HANDLE;
|
||||
dd_ = nullptr;
|
||||
id_ = nullptr;
|
||||
phys_ = VK_NULL_HANDLE;
|
||||
queue_ = VK_NULL_HANDLE;
|
||||
linear_ = VK_NULL_HANDLE;
|
||||
descPool_ = VK_NULL_HANDLE;
|
||||
scratch_.reset();
|
||||
pyrA_.clear(); pyrB_.clear(); pyrAs_.clear(); flowLvl_.clear();
|
||||
flowExpA_ = Img{}; flowExpB_ = Img{};
|
||||
flowRegA_ = Img{}; flowRegB_ = Img{};
|
||||
pLuma_ = Pipe{}; pDown_ = Pipe{}; pFlow_ = Pipe{}; pFlowM4_ = Pipe{};
|
||||
pExpand_ = Pipe{}; pExpandM4_ = Pipe{}; pSynth_ = Pipe{};
|
||||
pGmReduce_ = Pipe{}; pGmPrewarp_ = Pipe{}; pFlowReg_ = Pipe{};
|
||||
for (int s = 0; s < kGmSlots; ++s) {
|
||||
gmSsbo_[s] = VK_NULL_HANDLE;
|
||||
gmSsboMem_[s] = VK_NULL_HANDLE;
|
||||
gmSsboPtr_[s] = nullptr;
|
||||
gmSlotValid_[s] = false;
|
||||
}
|
||||
gmBuffersReady_ = false;
|
||||
ready_ = false;
|
||||
completionUnknown_ = false;
|
||||
deviceLost_ = false;
|
||||
descPool_ = VK_NULL_HANDLE; linear_ = VK_NULL_HANDLE; device_ = VK_NULL_HANDLE; ready_ = false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,20 +1,12 @@
|
||||
#pragma once
|
||||
#include "vk_dispatch.hpp"
|
||||
#include "config.hpp"
|
||||
#include <memory>
|
||||
#include <vector>
|
||||
|
||||
namespace ddfg {
|
||||
|
||||
struct ScratchState;
|
||||
|
||||
class FrameGen {
|
||||
public:
|
||||
FrameGen();
|
||||
~FrameGen();
|
||||
FrameGen(const FrameGen&) = delete;
|
||||
FrameGen& operator=(const FrameGen&) = delete;
|
||||
|
||||
bool init(const DeviceDispatch* dd, const InstanceDispatch* id,
|
||||
VkPhysicalDevice phys, VkDevice dev, uint32_t queueFamily, VkQueue queue);
|
||||
void configure(const Config& c);
|
||||
@@ -22,8 +14,7 @@ public:
|
||||
void record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView,
|
||||
VkImageView outView, float alpha, uint32_t gmSlot = 0,
|
||||
uint32_t synthSlot = 0, bool reuseFlow = false);
|
||||
bool destroy();
|
||||
void abandon();
|
||||
void destroy();
|
||||
bool valid() const { return device_ != VK_NULL_HANDLE && ready_; }
|
||||
const Config& config() const { return cfg_; }
|
||||
|
||||
@@ -73,9 +64,7 @@ private:
|
||||
void destroyPipe(Pipe& p);
|
||||
void barrier(VkCommandBuffer cmd, VkImage img, VkImageLayout from, VkImageLayout to);
|
||||
void initializeImage(VkCommandBuffer cmd, VkImage img, VkImageLayout to);
|
||||
bool waitIdle(const char* operation);
|
||||
bool destroyScratchResources(bool resetPool = true);
|
||||
void releaseScratch();
|
||||
void destroyScratchResources(bool resetPool = true);
|
||||
|
||||
const DeviceDispatch* dd_ = nullptr;
|
||||
const InstanceDispatch* id_ = nullptr;
|
||||
@@ -91,10 +80,7 @@ private:
|
||||
VkExtent2D extent_{};
|
||||
uint64_t imageGeneration_ = 0;
|
||||
bool ready_ = false;
|
||||
bool completionUnknown_ = false;
|
||||
bool deviceLost_ = false;
|
||||
int flowFinest_ = kFlowFinestDefault;
|
||||
std::unique_ptr<ScratchState> scratch_;
|
||||
|
||||
Pipe pLuma_, pDown_, pFlow_, pFlowM4_, pExpand_, pExpandM4_, pSynth_;
|
||||
Pipe pGmReduce_, pGmPrewarp_;
|
||||
|
||||
@@ -1,7 +1,33 @@
|
||||
|
||||
namespace ddfg {
|
||||
FrameGen::FrameGen() : scratch_(std::make_unique<ScratchState>()) {}
|
||||
FrameGen::~FrameGen() { (void)destroy(); }
|
||||
namespace {
|
||||
struct ScratchState {
|
||||
VkDevice ownerDevice = VK_NULL_HANDLE;
|
||||
VkBuffer synthUbo[ddfg::FrameGen::kSynthSlots]{};
|
||||
VkDeviceMemory synthUboMem[ddfg::FrameGen::kSynthSlots]{};
|
||||
void* synthUboPtr[ddfg::FrameGen::kSynthSlots]{};
|
||||
std::vector<VkBuffer> flowUbo; std::vector<VkDeviceMemory> flowUboMem; std::vector<void*> flowUboPtr;
|
||||
VkBuffer expandUbo = VK_NULL_HANDLE; VkDeviceMemory expandUboMem = VK_NULL_HANDLE; void* expandUboPtr = nullptr;
|
||||
VkBuffer flowRegUbo = VK_NULL_HANDLE; VkDeviceMemory flowRegUboMem = VK_NULL_HANDLE; void* flowRegUboPtr = nullptr;
|
||||
VkBuffer gmUbo[ddfg::FrameGen::kGmSlots]{};
|
||||
VkDeviceMemory gmUboMem[ddfg::FrameGen::kGmSlots]{};
|
||||
void* gmUboPtr[ddfg::FrameGen::kGmSlots]{};
|
||||
VkDescriptorSet sLumaCurr = VK_NULL_HANDLE, sLumaPrev = VK_NULL_HANDLE;
|
||||
std::vector<VkDescriptorSet> sDownA, sDownB, sFlow;
|
||||
VkDescriptorSet sExpand[ddfg::FrameGen::kGmSlots]{};
|
||||
|
||||
|
||||
|
||||
VkDescriptorSet sFlowReg0 = VK_NULL_HANDLE, sFlowRegAB = VK_NULL_HANDLE, sFlowRegBA = VK_NULL_HANDLE;
|
||||
VkDescriptorSet sSynth[ddfg::FrameGen::kSynthSlots]{};
|
||||
VkDescriptorSet sGmReduce[ddfg::FrameGen::kGmSlots]{};
|
||||
std::vector<VkDescriptorSet> sGmPrewarp[ddfg::FrameGen::kGmSlots];
|
||||
VkExtent2D builtFor{0,0};
|
||||
uint64_t builtGeneration = 0;
|
||||
bool built = false;
|
||||
bool flowInited = false;
|
||||
bool flowReady = false;
|
||||
};
|
||||
ScratchState g_scratch;
|
||||
}
|
||||
|
||||
static bool makeUbo(const ddfg::DeviceDispatch* dd, VkDevice dev,
|
||||
@@ -118,7 +144,7 @@ static void mulAff(const double A[3][3], const double B[3][3], double out[3][3])
|
||||
|
||||
namespace ddfg {
|
||||
|
||||
static bool ensureScratch(ScratchState& S, FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
||||
static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
||||
const VkPhysicalDeviceMemoryProperties& mp, VkDescriptorPool pool,
|
||||
VkSampler samp, VkExtent2D ext,
|
||||
std::vector<FrameGen::Img>& pyrA, std::vector<FrameGen::Img>& pyrB,
|
||||
@@ -131,72 +157,30 @@ static bool ensureScratch(ScratchState& S, FrameGen* fg, const DeviceDispatch* d
|
||||
FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo,
|
||||
int kLevels, const Config& cfg, uint64_t imageGeneration);
|
||||
|
||||
bool FrameGen::waitIdle(const char* operation) {
|
||||
if (completionUnknown_ || deviceLost_ || !device_) return false;
|
||||
if (!dd_ || !dd_->DeviceWaitIdle) {
|
||||
completionUnknown_ = true;
|
||||
ready_ = false;
|
||||
DDFG_LOGE("framegen: %s cannot confirm GPU completion; this instance is stopped and its resources are retained",
|
||||
operation);
|
||||
return false;
|
||||
}
|
||||
const VkResult result = dd_->DeviceWaitIdle(device_);
|
||||
if (result == VK_SUCCESS) return true;
|
||||
ready_ = false;
|
||||
if (result == VK_ERROR_DEVICE_LOST) {
|
||||
deviceLost_ = true;
|
||||
DDFG_LOGE("framegen: %s reported device loss; cleanup will skip further waits", operation);
|
||||
} else {
|
||||
completionUnknown_ = true;
|
||||
DDFG_LOGE("framegen: %s vkDeviceWaitIdle failed (%d); this instance is stopped and its GPU resources retained",
|
||||
operation, (int)result);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
bool FrameGen::destroyScratchResources(bool resetPool) {
|
||||
if (!scratch_) return true;
|
||||
if (resetPool && descPool_ && !deviceLost_) {
|
||||
if (!dd_ || !dd_->ResetDescriptorPool) {
|
||||
ready_ = false;
|
||||
DDFG_LOGE("framegen: descriptor-pool reset is unavailable; retaining scratch resources");
|
||||
return false;
|
||||
}
|
||||
const VkResult result = dd_->ResetDescriptorPool(device_, descPool_, 0);
|
||||
if (result != VK_SUCCESS) {
|
||||
ready_ = false;
|
||||
if (result == VK_ERROR_DEVICE_LOST) deviceLost_ = true;
|
||||
DDFG_LOGE("framegen: descriptor-pool reset failed (%d); retaining scratch resources",
|
||||
(int)result);
|
||||
return false;
|
||||
}
|
||||
}
|
||||
releaseScratch();
|
||||
return true;
|
||||
}
|
||||
|
||||
void FrameGen::releaseScratch() {
|
||||
if (!scratch_) return;
|
||||
auto& S = *scratch_;
|
||||
static void destroyScratch(const DeviceDispatch* dd, VkDevice dev, VkDescriptorPool pool,
|
||||
bool resetPool = true) {
|
||||
if (g_scratch.ownerDevice != VK_NULL_HANDLE && g_scratch.ownerDevice != dev) return;
|
||||
auto freeUbo = [&](VkBuffer& b, VkDeviceMemory& m, void*& p) {
|
||||
if (p && m) dd_->UnmapMemory(device_, m);
|
||||
if (b) dd_->DestroyBuffer(device_, b, nullptr);
|
||||
if (m) dd_->FreeMemory(device_, m, nullptr);
|
||||
b = VK_NULL_HANDLE;
|
||||
m = VK_NULL_HANDLE;
|
||||
p = nullptr;
|
||||
if (m) dd->UnmapMemory(dev, m);
|
||||
if (b) dd->DestroyBuffer(dev, b, nullptr);
|
||||
if (m) dd->FreeMemory(dev, m, nullptr);
|
||||
b = VK_NULL_HANDLE; m = VK_NULL_HANDLE; p = nullptr;
|
||||
};
|
||||
auto& S = g_scratch;
|
||||
for (int s = 0; s < FrameGen::kSynthSlots; ++s) freeUbo(S.synthUbo[s], S.synthUboMem[s], S.synthUboPtr[s]);
|
||||
freeUbo(S.expandUbo, S.expandUboMem, S.expandUboPtr);
|
||||
freeUbo(S.expandUbo, S.expandUboMem, S.expandUboPtr);
|
||||
freeUbo(S.flowRegUbo, S.flowRegUboMem, S.flowRegUboPtr);
|
||||
for (size_t i = 0; i < S.flowUbo.size(); ++i) freeUbo(S.flowUbo[i], S.flowUboMem[i], S.flowUboPtr[i]);
|
||||
for (int s = 0; s < FrameGen::kGmSlots; ++s) freeUbo(S.gmUbo[s], S.gmUboMem[s], S.gmUboPtr[s]);
|
||||
if (resetPool && pool && dd->ResetDescriptorPool) dd->ResetDescriptorPool(dev, pool, 0);
|
||||
S = ScratchState{};
|
||||
}
|
||||
|
||||
void FrameGen::destroyScratchResources(bool resetPool) {
|
||||
destroyScratch(dd_, device_, descPool_, resetPool);
|
||||
}
|
||||
|
||||
void FrameGen::configure(const Config& c) {
|
||||
if (completionUnknown_ || deviceLost_) return;
|
||||
Config nextCfg = c;
|
||||
nextCfg.sanitize();
|
||||
int want = flowFinestForPreset(nextCfg.perfPreset);
|
||||
@@ -219,12 +203,16 @@ void FrameGen::configure(const Config& c) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!waitIdle("live preset rebuild")) return;
|
||||
if (scratch_ && scratch_->ownerDevice != VK_NULL_HANDLE && !destroyScratchResources()) {
|
||||
DDFG_LOGE("perf-preset live rebuild: scratch cleanup failed; keeping the previous configuration");
|
||||
// Keep the previous configuration and image set if the device cannot idle.
|
||||
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
|
||||
if (idleResult != VK_SUCCESS) {
|
||||
DDFG_LOGE("framegen configure: DeviceWaitIdle failed (%d); keeping previous configuration and images",
|
||||
(int)idleResult);
|
||||
return;
|
||||
}
|
||||
|
||||
// The device is idle, so reset motion history before rebuilding. This
|
||||
// also leaves the predictor reset if onResize fails.
|
||||
for (int i = 0; i < 6; ++i) gmRun_[i] = 0.0;
|
||||
for (int s = 0; s < kGmSlots; ++s) {
|
||||
gmSlotValid_[s] = false;
|
||||
@@ -235,17 +223,20 @@ void FrameGen::configure(const Config& c) {
|
||||
gmStableCount_ = 0;
|
||||
gmLastTransPx_ = 0.0f;
|
||||
|
||||
// Prevent onResize from issuing a second wait.
|
||||
destroyScratch(dd_, device_, descPool_);
|
||||
cfg_ = nextCfg;
|
||||
flowFinest_ = want;
|
||||
ready_ = false;
|
||||
if (!onResize(extent_, VK_FORMAT_UNDEFINED, true)) {
|
||||
ready_ = false;
|
||||
DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - frame generation unavailable",
|
||||
DDFG_LOGE("perf-preset live rebuild: onResize FAILED at %ux%u - FG disabled until next resize",
|
||||
extent_.width, extent_.height);
|
||||
return;
|
||||
}
|
||||
DDFG_LOGI("perf-preset live rebuild DONE (kFlowFinest=%d, flow predictor reset)", flowFinest_);
|
||||
}
|
||||
|
||||
bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) {
|
||||
++gmFrames_;
|
||||
if (!gmBuffersReady_ || cfg_.gmMode == 2 ) {
|
||||
@@ -315,33 +306,35 @@ bool FrameGen::updateGlobalMotion(uint32_t gmSlot, VkExtent2D fullExtent) {
|
||||
void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView currView,
|
||||
VkImageView outView, float alpha, uint32_t gmSlot, uint32_t synthSlot, bool reuseFlow) {
|
||||
if (!valid()) return;
|
||||
auto& S = *scratch_;
|
||||
if (gmSlot >= (uint32_t)kGmSlots) gmSlot = 0;
|
||||
if (synthSlot >= (uint32_t)kSynthSlots) synthSlot = 0;
|
||||
const bool m4 = (cfg_.model == 4);
|
||||
const Pipe& flowP = m4 ? pFlowM4_ : pFlow_;
|
||||
const Pipe& expandP = m4 ? pExpandM4_ : pExpand_;
|
||||
|
||||
if (!S.built || S.builtFor.width != extent_.width ||
|
||||
S.builtFor.height != extent_.height ||
|
||||
S.builtGeneration != imageGeneration_) {
|
||||
if (S.built && !waitIdle("scratch rebuild")) return;
|
||||
if (S.ownerDevice != VK_NULL_HANDLE && !destroyScratchResources()) {
|
||||
DDFG_LOGE("framegen record: scratch cleanup failed; skipping this frame");
|
||||
return;
|
||||
if (!g_scratch.built || g_scratch.builtFor.width != extent_.width ||
|
||||
g_scratch.builtFor.height != extent_.height ||
|
||||
g_scratch.builtGeneration != imageGeneration_) {
|
||||
if (g_scratch.built) {
|
||||
const VkResult idleResult = dd_->DeviceWaitIdle(device_);
|
||||
if (idleResult != VK_SUCCESS) {
|
||||
DDFG_LOGE("framegen record: DeviceWaitIdle failed (%d); skipping scratch rebuild", (int)idleResult);
|
||||
return;
|
||||
}
|
||||
destroyScratch(dd_, device_, descPool_);
|
||||
}
|
||||
if (!ensureScratch(S, this, dd_, device_, memProps_, descPool_, linear_, extent_,
|
||||
if (!ensureScratch(this, dd_, device_, memProps_, descPool_, linear_, extent_,
|
||||
pyrA_, pyrB_, pyrAs_, flowLvl_, flowExpA_, flowExpB_,
|
||||
pLuma_, pDown_, flowP, expandP, pSynth_, pGmReduce_, pGmPrewarp_,
|
||||
pFlowReg_, flowRegA_, flowRegB_, gmSsbo_, kLevels, cfg_, imageGeneration_))
|
||||
return;
|
||||
}
|
||||
|
||||
if (S.ownerDevice != device_) return;
|
||||
if (reuseFlow && !S.flowReady) return;
|
||||
if (g_scratch.ownerDevice != device_) return;
|
||||
if (reuseFlow && !g_scratch.flowReady) return;
|
||||
if (!reuseFlow) {
|
||||
bool gmEngaged = updateGlobalMotion(gmSlot, extent_);
|
||||
if (S.gmUboPtr[gmSlot]) {
|
||||
if (g_scratch.gmUboPtr[gmSlot]) {
|
||||
GMUBO g{};
|
||||
g.lin[0]=(float)gmRun_[0]; g.lin[1]=(float)gmRun_[1]; g.lin[2]=(float)gmRun_[2]; g.lin[3]=(float)gmRun_[3];
|
||||
g.linT[0]=(float)gmRun_[4]; g.linT[1]=(float)gmRun_[5]; g.linT[2]=gmEngaged?1.0f:0.0f; g.linT[3]=0.0f;
|
||||
@@ -349,7 +342,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
||||
g.app[0]=(float)gmRun_[0]; g.app[1]=(float)gmRun_[1]; g.app[2]=(float)gmRun_[2]; g.app[3]=(float)gmRun_[3];
|
||||
g.appT[0]=(float)gmRun_[4]; g.appT[1]=(float)gmRun_[5];
|
||||
}
|
||||
std::memcpy(S.gmUboPtr[gmSlot], &g, sizeof(g));
|
||||
std::memcpy(g_scratch.gmUboPtr[gmSlot], &g, sizeof(g));
|
||||
}
|
||||
{
|
||||
static int lastEng = -1;
|
||||
@@ -360,7 +353,7 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
||||
}
|
||||
}
|
||||
|
||||
const VkDescriptorSet lumaSets[] = {S.sLumaCurr, S.sLumaPrev};
|
||||
const VkDescriptorSet lumaSets[] = {g_scratch.sLumaCurr, g_scratch.sLumaPrev};
|
||||
const uint32_t lumaBindings[] = {32, 32};
|
||||
const VkDescriptorType lumaTypes[] = {
|
||||
VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER};
|
||||
@@ -374,9 +367,9 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
||||
|
||||
SynthUBO su{cfg_.flowScale, alpha, cfg_.beta, cfg_.lambda, cfg_.epsilon, cfg_.photoScale, 0, 0,
|
||||
cfg_.hudX0, cfg_.hudY0, cfg_.hudX1, cfg_.hudY1};
|
||||
if (S.synthUboPtr[synthSlot]) std::memcpy(S.synthUboPtr[synthSlot], &su, sizeof(su));
|
||||
if (g_scratch.synthUboPtr[synthSlot]) std::memcpy(g_scratch.synthUboPtr[synthSlot], &su, sizeof(su));
|
||||
|
||||
const VkDescriptorSet synthSet = S.sSynth[synthSlot];
|
||||
const VkDescriptorSet synthSet = g_scratch.sSynth[synthSlot];
|
||||
const VkDescriptorSet synthSets[] = {synthSet, synthSet, synthSet};
|
||||
const uint32_t synthBindings[] = {32, 33, 48};
|
||||
const VkDescriptorType synthTypes[] = {
|
||||
@@ -475,17 +468,17 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
||||
VK_PIPELINE_STAGE_COMPUTE_SHADER_BIT, 0, 0, nullptr, 0, nullptr, 1, &b);
|
||||
}
|
||||
|
||||
disp(pLuma_, S.sLumaCurr, levelExtent(extent_, 0));
|
||||
disp(pLuma_, S.sLumaPrev, levelExtent(extent_, 0));
|
||||
disp(pLuma_, g_scratch.sLumaCurr, levelExtent(extent_, 0));
|
||||
disp(pLuma_, g_scratch.sLumaPrev, levelExtent(extent_, 0));
|
||||
barPair(pyrA_[0], pyrB_[0]);
|
||||
for (int l = 1; l < kLevels; ++l) {
|
||||
disp(pDown_, S.sDownA[l - 1], levelExtent(extent_, l));
|
||||
disp(pDown_, S.sDownB[l - 1], levelExtent(extent_, l));
|
||||
disp(pDown_, g_scratch.sDownA[l - 1], levelExtent(extent_, l));
|
||||
disp(pDown_, g_scratch.sDownB[l - 1], levelExtent(extent_, l));
|
||||
barPair(pyrA_[l], pyrB_[l]);
|
||||
}
|
||||
if (gmBuffersReady_ && S.sGmReduce[gmSlot]) {
|
||||
if (gmBuffersReady_ && g_scratch.sGmReduce[gmSlot]) {
|
||||
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.pipeline);
|
||||
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.layout, 0, 1, &S.sGmReduce[gmSlot], 0, nullptr);
|
||||
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pGmReduce_.layout, 0, 1, &g_scratch.sGmReduce[gmSlot], 0, nullptr);
|
||||
dd_->CmdDispatch(cmd, (uint32_t)(kGmThreads / 64), 1, 1);
|
||||
VkMemoryBarrier mb{VK_STRUCTURE_TYPE_MEMORY_BARRIER};
|
||||
mb.srcAccessMask = VK_ACCESS_SHADER_WRITE_BIT; mb.dstAccessMask = VK_ACCESS_HOST_READ_BIT;
|
||||
@@ -493,27 +486,27 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
||||
0, 1, &mb, 0, nullptr, 0, nullptr);
|
||||
}
|
||||
for (int l = flowFinest_; l < kLevels; ++l) {
|
||||
disp(pGmPrewarp_, S.sGmPrewarp[gmSlot][l], levelExtent(extent_, l));
|
||||
disp(pGmPrewarp_, g_scratch.sGmPrewarp[gmSlot][l], levelExtent(extent_, l));
|
||||
bar(pyrAs_[l]);
|
||||
}
|
||||
for (int l = kLevels - 1; l >= flowFinest_; --l) {
|
||||
disp(flowP, S.sFlow[l], levelExtent(extent_, l));
|
||||
disp(flowP, g_scratch.sFlow[l], levelExtent(extent_, l));
|
||||
bar(flowLvl_[l]);
|
||||
}
|
||||
|
||||
if (frEngaged) {
|
||||
const int F = flowFinest_;
|
||||
const VkExtent2D fe = levelExtent(extent_, F);
|
||||
if (S.flowRegUboPtr) {
|
||||
if (g_scratch.flowRegUboPtr) {
|
||||
FlowRegUBO fu{cfg_.frDt, cfg_.frLambda, cfg_.frEdge, cfg_.frEps};
|
||||
std::memcpy(S.flowRegUboPtr, &fu, sizeof(fu));
|
||||
std::memcpy(g_scratch.flowRegUboPtr, &fu, sizeof(fu));
|
||||
}
|
||||
FrameGen::Img* last = nullptr;
|
||||
for (int it = 0; it < cfg_.frIters; ++it) {
|
||||
VkDescriptorSet set; FrameGen::Img* outImg;
|
||||
if (it == 0) { set = S.sFlowReg0; outImg = &flowRegA_; }
|
||||
else if (it % 2 == 1) { set = S.sFlowRegAB; outImg = &flowRegB_; }
|
||||
else { set = S.sFlowRegBA; outImg = &flowRegA_; }
|
||||
if (it == 0) { set = g_scratch.sFlowReg0; outImg = &flowRegA_; }
|
||||
else if (it % 2 == 1) { set = g_scratch.sFlowRegAB; outImg = &flowRegB_; }
|
||||
else { set = g_scratch.sFlowRegBA; outImg = &flowRegA_; }
|
||||
dd_->CmdBindPipeline(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.pipeline);
|
||||
dd_->CmdBindDescriptorSets(cmd, VK_PIPELINE_BIND_POINT_COMPUTE, pFlowReg_.layout, 0, 1, &set, 0, nullptr);
|
||||
dd_->CmdDispatch(cmd, (fe.width + 15) / 16, (fe.height + 15) / 16, 1);
|
||||
@@ -547,14 +540,14 @@ void FrameGen::record(VkCommandBuffer cmd, VkImageView prevView, VkImageView cur
|
||||
}
|
||||
}
|
||||
|
||||
disp(expandP, S.sExpand[gmSlot], levelExtent(extent_, 0));
|
||||
disp(expandP, g_scratch.sExpand[gmSlot], levelExtent(extent_, 0));
|
||||
barPair(flowExpA_, flowExpB_);
|
||||
S.flowReady = true;
|
||||
g_scratch.flowReady = true;
|
||||
}
|
||||
disp(pSynth_, synthSet, levelExtent(extent_, 0));
|
||||
}
|
||||
|
||||
static bool ensureScratch(ScratchState& S, FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
||||
static bool ensureScratch(FrameGen* fg, const DeviceDispatch* dd, VkDevice dev,
|
||||
const VkPhysicalDeviceMemoryProperties& mp, VkDescriptorPool pool,
|
||||
VkSampler samp, VkExtent2D ext,
|
||||
std::vector<FrameGen::Img>& pyrA, std::vector<FrameGen::Img>& pyrB,
|
||||
@@ -566,6 +559,7 @@ static bool ensureScratch(ScratchState& S, FrameGen* fg, const DeviceDispatch* d
|
||||
const FrameGen::Pipe& pGmPrewarp, const FrameGen::Pipe& pFlowReg,
|
||||
FrameGen::Img& flowRegA, FrameGen::Img& flowRegB, VkBuffer* gmSsbo,
|
||||
int kLevels, const Config& cfg, uint64_t imageGeneration) {
|
||||
auto& S = g_scratch;
|
||||
if (S.ownerDevice != VK_NULL_HANDLE && S.ownerDevice != dev) return false;
|
||||
S = ScratchState{};
|
||||
S.ownerDevice = dev;
|
||||
|
||||
@@ -242,10 +242,6 @@ struct surface {
|
||||
enum surface_role role;
|
||||
struct wl_resource *idle_buffer;
|
||||
struct wl_listener idle_buffer_destroy;
|
||||
struct surface_state *waiting;
|
||||
struct wl_event_source *waiting_source, *waiting_timer;
|
||||
int waiting_fd;
|
||||
int64_t waiting_since_ns;
|
||||
uint32_t *idle_px;
|
||||
int idle_w, idle_h;
|
||||
struct wl_resource *xdg_surface, *xdg_toplevel;
|
||||
@@ -377,8 +373,6 @@ static struct {
|
||||
unsigned copy_scenes;
|
||||
unsigned releases, releases_held;
|
||||
int64_t release_ns, release_max_ns;
|
||||
unsigned commit_waits, commit_wait_limits;
|
||||
int64_t commit_wait_ns, commit_wait_max_ns;
|
||||
} g_perf;
|
||||
|
||||
static void schedule_render(void);
|
||||
@@ -852,55 +846,6 @@ static void on_pending_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
s->pending_buffer = NULL;
|
||||
}
|
||||
|
||||
struct surface_state {
|
||||
struct wl_resource *buffer;
|
||||
struct wl_listener buffer_destroy;
|
||||
int attach;
|
||||
int src_set, dst_set, opaque_set;
|
||||
float src[4];
|
||||
int dst[2], opaque[4];
|
||||
struct damage_list damage_buf, damage_local;
|
||||
struct wl_list frames, feedback;
|
||||
};
|
||||
|
||||
static void on_state_buffer_destroyed(struct wl_listener *l, void *data) {
|
||||
struct surface_state *st = wl_container_of(l, st, buffer_destroy);
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
st->attach = 0;
|
||||
}
|
||||
|
||||
static void surface_state_take(struct surface *s, struct surface_state *st) {
|
||||
st->attach = s->pending_attach;
|
||||
st->buffer = s->pending_buffer;
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
if (st->buffer) {
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
st->buffer_destroy.notify = on_state_buffer_destroyed;
|
||||
wl_resource_add_destroy_listener(st->buffer, &st->buffer_destroy);
|
||||
}
|
||||
s->pending_buffer = NULL;
|
||||
s->pending_attach = 0;
|
||||
st->src_set = s->pending_src_set;
|
||||
memcpy(st->src, s->pending_src, sizeof(st->src));
|
||||
st->dst_set = s->pending_dst_set;
|
||||
memcpy(st->dst, s->pending_dst, sizeof(st->dst));
|
||||
st->opaque_set = s->pending_opaque_set;
|
||||
memcpy(st->opaque, s->pending_opaque, sizeof(st->opaque));
|
||||
s->pending_src_set = s->pending_dst_set = s->pending_opaque_set = 0;
|
||||
st->damage_buf = s->pending_damage_buf;
|
||||
st->damage_local = s->pending_damage_local;
|
||||
s->pending_damage_buf.n = s->pending_damage_local.n = 0;
|
||||
wl_list_init(&st->frames);
|
||||
wl_list_insert_list(&st->frames, &s->pending_frames);
|
||||
wl_list_init(&s->pending_frames);
|
||||
wl_list_init(&st->feedback);
|
||||
wl_list_insert_list(&st->feedback, &s->pending_feedback);
|
||||
wl_list_init(&s->pending_feedback);
|
||||
}
|
||||
|
||||
static void fire_frames(struct wl_list *frames) {
|
||||
struct wl_resource *cb, *tmp;
|
||||
uint32_t t;
|
||||
@@ -1418,23 +1363,35 @@ static void surface_drop_idle(struct surface *s) {
|
||||
if (buffer) send_buffer_release(buffer);
|
||||
}
|
||||
|
||||
static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
struct surface *child;
|
||||
|
||||
if (st->src_set) {
|
||||
s->src_set = st->src[2] > 0;
|
||||
memcpy(s->src, st->src, sizeof(s->src));
|
||||
if (s->xdg_toplevel && !s->toplevel_committed) {
|
||||
s->toplevel_committed = 1;
|
||||
send_toplevel_configure(s);
|
||||
}
|
||||
if (st->dst_set) {
|
||||
s->dst_set = st->dst[0] > 0;
|
||||
memcpy(s->dst, st->dst, sizeof(s->dst));
|
||||
}
|
||||
if (st->opaque_set) memcpy(s->opaque, st->opaque, sizeof(s->opaque));
|
||||
|
||||
s->damage_buf = st->damage_buf;
|
||||
s->damage_local = st->damage_local;
|
||||
if (st->attach) {
|
||||
struct wl_resource *buffer = st->buffer;
|
||||
if (s->pending_src_set) {
|
||||
s->src_set = s->pending_src[2] > 0;
|
||||
memcpy(s->src, s->pending_src, sizeof(s->src));
|
||||
s->pending_src_set = 0;
|
||||
}
|
||||
if (s->pending_dst_set) {
|
||||
s->dst_set = s->pending_dst[0] > 0;
|
||||
memcpy(s->dst, s->pending_dst, sizeof(s->dst));
|
||||
s->pending_dst_set = 0;
|
||||
}
|
||||
if (s->pending_opaque_set) {
|
||||
memcpy(s->opaque, s->pending_opaque, sizeof(s->opaque));
|
||||
s->pending_opaque_set = 0;
|
||||
}
|
||||
|
||||
s->damage_buf = s->pending_damage_buf;
|
||||
s->damage_local = s->pending_damage_local;
|
||||
s->pending_damage_buf.n = s->pending_damage_local.n = 0;
|
||||
if (s->pending_attach) {
|
||||
struct wl_resource *buffer = s->pending_buffer;
|
||||
struct dmabuf_buffer *db = get_dmabuf(buffer);
|
||||
struct wl_shm_buffer *shm = buffer && !db ? wl_shm_buffer_get(buffer) : NULL;
|
||||
uint8_t pixel[4];
|
||||
@@ -1443,10 +1400,12 @@ static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
if (!buffer) g_pace.null_attaches++;
|
||||
else if (!db) s->last_dmabuf = NULL;
|
||||
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_list_init(&st->buffer_destroy.link);
|
||||
st->buffer = NULL;
|
||||
st->attach = 0;
|
||||
if (buffer) {
|
||||
wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
}
|
||||
s->pending_buffer = NULL;
|
||||
s->pending_attach = 0;
|
||||
|
||||
surface_drop_idle(s);
|
||||
buf_trace_attach(buffer);
|
||||
@@ -1483,10 +1442,10 @@ static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
}
|
||||
}
|
||||
|
||||
wl_list_insert_list(s->frames.prev, &st->frames);
|
||||
wl_list_init(&st->frames);
|
||||
wl_list_insert_list(s->feedback.prev, &st->feedback);
|
||||
wl_list_init(&st->feedback);
|
||||
wl_list_insert_list(s->frames.prev, &s->pending_frames);
|
||||
wl_list_init(&s->pending_frames);
|
||||
wl_list_insert_list(s->feedback.prev, &s->pending_feedback);
|
||||
wl_list_init(&s->pending_feedback);
|
||||
constraints_surface_commit(s);
|
||||
droiddeck_color_commit(s->resource);
|
||||
|
||||
@@ -1496,186 +1455,6 @@ static void surface_state_apply(struct surface *s, struct surface_state *st) {
|
||||
}
|
||||
schedule_render();
|
||||
}
|
||||
|
||||
#define COMMIT_WAIT_LIMIT_MS 1000
|
||||
|
||||
static struct surface *g_zero_copy_shown, *g_unwaited;
|
||||
|
||||
static int state_unfinished_fd(const struct surface *s, const struct surface_state *st, int *unwaited) {
|
||||
struct dmabuf_buffer *db = st->attach ? get_dmabuf(st->buffer) : NULL;
|
||||
int fd = -1;
|
||||
*unwaited = 0;
|
||||
for (int i = 0; db && fd < 0 && i < db->n_planes; i++) {
|
||||
if (db->fd[i] < 0) continue;
|
||||
struct pollfd p = {.fd = db->fd[i], .events = POLLIN};
|
||||
int r;
|
||||
do { r = poll(&p, 1, 0); } while (r < 0 && errno == EINTR);
|
||||
if (r == 0) fd = db->fd[i];
|
||||
}
|
||||
if (fd >= 0 && s == g_zero_copy_shown && ahb_swapchain_has_ahb(db)) {
|
||||
*unwaited = 1;
|
||||
return -1;
|
||||
}
|
||||
return fd;
|
||||
}
|
||||
|
||||
static void settle_unwaited(void) {
|
||||
struct surface *s = g_unwaited;
|
||||
if (!s) return;
|
||||
g_unwaited = NULL;
|
||||
struct dmabuf_buffer *db = s->dmabuf_buf;
|
||||
const int64_t deadline = now_ns() + 100000000LL;
|
||||
for (int i = 0; db && i < db->n_planes; i++) {
|
||||
if (db->fd[i] < 0) continue;
|
||||
struct pollfd p = {.fd = db->fd[i], .events = POLLIN};
|
||||
for (;;) {
|
||||
const int64_t left = deadline - now_ns();
|
||||
const int r = poll(&p, 1, left > 0 ? (int)((left + 999999) / 1000000) : 0);
|
||||
if (r >= 0 || errno != EINTR || left <= 0) break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void surface_state_discard(struct surface_state *st) {
|
||||
struct wl_resource *cb, *tmp;
|
||||
wl_list_remove(&st->buffer_destroy.link);
|
||||
wl_resource_for_each_safe(cb, tmp, &st->frames) wl_resource_destroy(cb);
|
||||
feedback_discard_all(&st->feedback);
|
||||
free(st);
|
||||
}
|
||||
|
||||
static void surface_state_merge(struct surface_state *older, struct surface_state *newer) {
|
||||
if (older->attach && !newer->attach) {
|
||||
newer->attach = 1;
|
||||
newer->buffer = older->buffer;
|
||||
wl_list_remove(&older->buffer_destroy.link);
|
||||
wl_list_init(&older->buffer_destroy.link);
|
||||
if (newer->buffer) {
|
||||
newer->buffer_destroy.notify = on_state_buffer_destroyed;
|
||||
wl_resource_add_destroy_listener(newer->buffer, &newer->buffer_destroy);
|
||||
}
|
||||
wl_list_insert_list(&newer->feedback, &older->feedback);
|
||||
wl_list_init(&older->feedback);
|
||||
} else if (older->attach) {
|
||||
if (older->buffer && older->buffer != newer->buffer) send_buffer_release(older->buffer);
|
||||
g_pace.replaced += feedback_discard_all(&older->feedback);
|
||||
}
|
||||
if (older->src_set && !newer->src_set) {
|
||||
newer->src_set = 1;
|
||||
memcpy(newer->src, older->src, sizeof(newer->src));
|
||||
}
|
||||
if (older->dst_set && !newer->dst_set) {
|
||||
newer->dst_set = 1;
|
||||
memcpy(newer->dst, older->dst, sizeof(newer->dst));
|
||||
}
|
||||
if (older->opaque_set && !newer->opaque_set) {
|
||||
newer->opaque_set = 1;
|
||||
memcpy(newer->opaque, older->opaque, sizeof(newer->opaque));
|
||||
}
|
||||
for (int i = 0; i < older->damage_buf.n; i++)
|
||||
note_damage(&newer->damage_buf, older->damage_buf.r[i][0], older->damage_buf.r[i][1],
|
||||
older->damage_buf.r[i][2], older->damage_buf.r[i][3]);
|
||||
for (int i = 0; i < older->damage_local.n; i++)
|
||||
note_damage(&newer->damage_local, older->damage_local.r[i][0], older->damage_local.r[i][1],
|
||||
older->damage_local.r[i][2], older->damage_local.r[i][3]);
|
||||
wl_list_insert_list(&newer->frames, &older->frames);
|
||||
wl_list_init(&older->frames);
|
||||
surface_state_discard(older);
|
||||
}
|
||||
|
||||
static void surface_wait_stop(struct surface *s) {
|
||||
if (s->waiting_source) wl_event_source_remove(s->waiting_source);
|
||||
if (s->waiting_timer) wl_event_source_remove(s->waiting_timer);
|
||||
if (s->waiting_fd >= 0) close(s->waiting_fd);
|
||||
s->waiting_source = s->waiting_timer = NULL;
|
||||
s->waiting_fd = -1;
|
||||
}
|
||||
|
||||
static void surface_wait_end(struct surface *s, int over_limit) {
|
||||
struct surface_state *st = s->waiting;
|
||||
if (!st) return;
|
||||
surface_wait_stop(s);
|
||||
s->waiting = NULL;
|
||||
const int64_t waited = now_ns() - s->waiting_since_ns;
|
||||
g_perf.commit_waits++;
|
||||
g_perf.commit_wait_ns += waited;
|
||||
if (waited > g_perf.commit_wait_max_ns) g_perf.commit_wait_max_ns = waited;
|
||||
if (over_limit) g_perf.commit_wait_limits++;
|
||||
if (st->attach && g_unwaited == s) g_unwaited = NULL;
|
||||
surface_state_apply(s, st);
|
||||
free(st);
|
||||
}
|
||||
|
||||
static int on_commit_ready(int fd, uint32_t mask, void *data) {
|
||||
surface_wait_end(data, 0);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int on_commit_wait_limit(void *data) {
|
||||
static int said;
|
||||
if (!said) {
|
||||
said = 1;
|
||||
droiddeck_log("compositor", "a client's GPU writes ran past %d ms; its frame is shown as it is", COMMIT_WAIT_LIMIT_MS);
|
||||
}
|
||||
surface_wait_end(data, 1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int surface_wait_start(struct surface *s, int fd, int timeout_ms) {
|
||||
struct wl_event_loop *loop = wl_display_get_event_loop(g_display);
|
||||
s->waiting_fd = fcntl(fd, F_DUPFD_CLOEXEC, 0);
|
||||
if (s->waiting_fd >= 0) {
|
||||
s->waiting_source = wl_event_loop_add_fd(loop, s->waiting_fd, WL_EVENT_READABLE, on_commit_ready, s);
|
||||
s->waiting_timer = wl_event_loop_add_timer(loop, on_commit_wait_limit, s);
|
||||
}
|
||||
if (!s->waiting_source || !s->waiting_timer ||
|
||||
wl_event_source_timer_update(s->waiting_timer, timeout_ms) != 0) {
|
||||
surface_wait_stop(s);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static void surface_commit(struct wl_client *c, struct wl_resource *r) {
|
||||
struct surface *s = wl_resource_get_user_data(r);
|
||||
|
||||
if (s->xdg_toplevel && !s->toplevel_committed) {
|
||||
s->toplevel_committed = 1;
|
||||
send_toplevel_configure(s);
|
||||
}
|
||||
struct surface_state *st = calloc(1, sizeof(*st));
|
||||
if (!st) {
|
||||
struct surface_state now;
|
||||
surface_state_take(s, &now);
|
||||
surface_state_apply(s, &now);
|
||||
return;
|
||||
}
|
||||
surface_state_take(s, st);
|
||||
const int was_waiting = s->waiting != NULL;
|
||||
if (was_waiting) {
|
||||
surface_wait_stop(s);
|
||||
surface_state_merge(s->waiting, st);
|
||||
s->waiting = NULL;
|
||||
}
|
||||
int unwaited;
|
||||
const int fd = state_unfinished_fd(s, st, &unwaited);
|
||||
if (!was_waiting) s->waiting_since_ns = now_ns();
|
||||
const int64_t left_ms = COMMIT_WAIT_LIMIT_MS - (now_ns() - s->waiting_since_ns) / 1000000;
|
||||
if (fd >= 0 && left_ms > 0 && surface_wait_start(s, fd, (int)left_ms) == 0) {
|
||||
s->waiting = st;
|
||||
return;
|
||||
}
|
||||
const int attaches = st->attach;
|
||||
if (was_waiting) {
|
||||
s->waiting = st;
|
||||
surface_wait_end(s, fd >= 0 && left_ms <= 0);
|
||||
} else {
|
||||
surface_state_apply(s, st);
|
||||
free(st);
|
||||
}
|
||||
if (unwaited) g_unwaited = s;
|
||||
else if (attaches && g_unwaited == s) g_unwaited = NULL;
|
||||
}
|
||||
static void surface_set_buffer_transform(struct wl_client *c, struct wl_resource *r, int32_t t) {}
|
||||
static void surface_set_buffer_scale(struct wl_client *c, struct wl_resource *r, int32_t s) {}
|
||||
static void surface_damage_buffer(struct wl_client *c, struct wl_resource *r,
|
||||
@@ -1737,13 +1516,6 @@ static void surface_resource_destroy(struct wl_resource *r) {
|
||||
child->parent = NULL;
|
||||
}
|
||||
if (s->pending_buffer) wl_list_remove(&s->pending_buffer_destroy.link);
|
||||
if (s->waiting) {
|
||||
surface_wait_stop(s);
|
||||
surface_state_discard(s->waiting);
|
||||
s->waiting = NULL;
|
||||
}
|
||||
if (g_zero_copy_shown == s) g_zero_copy_shown = NULL;
|
||||
if (g_unwaited == s) g_unwaited = NULL;
|
||||
pending_releases_forget_surface(s);
|
||||
drop_dmabuf(s, 0);
|
||||
ahb_swapchain_surface_gone(s);
|
||||
@@ -1807,7 +1579,6 @@ static void compositor_create_surface(struct wl_client *c, struct wl_resource *r
|
||||
wl_list_init(&s->child_link);
|
||||
wl_list_init(&s->toplevel_link);
|
||||
wl_list_init(&s->pending_buffer_destroy.link);
|
||||
s->waiting_fd = -1;
|
||||
wl_list_init(&s->idle_buffer_destroy.link);
|
||||
wl_list_insert(&g_surfaces, &s->link);
|
||||
wl_resource_set_implementation(s->resource, &surface_impl, s, surface_resource_destroy);
|
||||
@@ -2731,13 +2502,7 @@ static int64_t scene_next_due(int64_t now, int64_t due, int limit) {
|
||||
|
||||
static void render_scene(void) {
|
||||
g_scene_due_ns = scene_next_due(now_ns(), g_scene_due_ns, g_fps_limit);
|
||||
if (atomic_load(&g_stream_on)) {
|
||||
g_dirty_since_ns = 0;
|
||||
g_zero_copy_shown = NULL;
|
||||
settle_unwaited();
|
||||
render_stream();
|
||||
return;
|
||||
}
|
||||
if (atomic_load(&g_stream_on)) { g_dirty_since_ns = 0; render_stream(); return; }
|
||||
struct draw_list dl = {0};
|
||||
struct surface *s;
|
||||
int w, h;
|
||||
@@ -2811,8 +2576,6 @@ static void render_scene(void) {
|
||||
} else {
|
||||
cursor_hdr_said = 0;
|
||||
}
|
||||
g_zero_copy_shown = NULL;
|
||||
if (hdr_route == 1 || hdr_route == 2) settle_unwaited();
|
||||
if (hdr_route == 1) {
|
||||
static int fell_back;
|
||||
vkp_apply_window_request();
|
||||
@@ -2846,7 +2609,6 @@ static void render_scene(void) {
|
||||
}
|
||||
if (hdr_route == 0 && vkp_quest_layer_presentation() && !framegen && !cardboard && !cursor_on &&
|
||||
!ahb_only) {
|
||||
settle_unwaited();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
} else if (hdr_route == 0 || hdr_route == 3) {
|
||||
const int pass_on = fx_on || framegen;
|
||||
@@ -2896,7 +2658,6 @@ static void render_scene(void) {
|
||||
vkp_apply_window_request();
|
||||
int r = -1;
|
||||
const int fg_pass = framegen && fx_on && li >= 0;
|
||||
if (framegen && li >= 0) settle_unwaited();
|
||||
const int generated = (framegen && li >= 0)
|
||||
? sc_layer_present_generated(&dl.d[li], 1, NULL, w, h, fg_pass,
|
||||
ls ? droiddeck_surface_color(ls) : NULL) : 0;
|
||||
@@ -2910,8 +2671,6 @@ static void render_scene(void) {
|
||||
r = generated >= 0 ? 0 : -1;
|
||||
else if (generated >= 0 && !(fx_on && li >= 0) && ls && ls->dmabuf_buf && ahb_swapchain_has_ahb(ls->dmabuf_buf))
|
||||
r = ahb_swapchain_present(ls->dmabuf_buf, ls, w, h, ld);
|
||||
if (r == 0 && !fg_pass) g_zero_copy_shown = ls;
|
||||
else settle_unwaited();
|
||||
if (!fg_pass && generated >= 0 && r != 0 && li >= 0)
|
||||
r = fx_on ? sc_layer_present_pass(&dl.d[li], 1, w, h)
|
||||
: sc_layer_present(dl.d[li].img, w, h, ld, ls ? droiddeck_surface_color(ls) : NULL);
|
||||
@@ -2922,7 +2681,6 @@ static void render_scene(void) {
|
||||
ov = sc_layer_present_overlay(dl.d[li + 1].img, go, dl.d[li + 1].blend) == 0 ? 1 : -1;
|
||||
if (ov <= 0) sc_layer_hide_overlay();
|
||||
if (ov < 0) {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
@@ -2932,14 +2690,12 @@ static void render_scene(void) {
|
||||
g_scene_queues = sc_layer_queues();
|
||||
}
|
||||
} else {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
hdr_copy = "its display layer was unavailable this frame";
|
||||
}
|
||||
} else {
|
||||
settle_unwaited();
|
||||
sc_layer_hide();
|
||||
rendered = vkp_render(w, h, dl.d, dl.n) == 0;
|
||||
copy = 1;
|
||||
@@ -4588,12 +4344,11 @@ static int on_stats_timer(void *data) {
|
||||
unsigned aimed_next, aimed_later, aimed_even;
|
||||
sc_layer_aim_take(&aimed_next, &aimed_later, &aimed_even);
|
||||
#define PERF_MS(sum, n) ((n) ? (double)(sum) / 1e6 / (double)(n) : 0.0)
|
||||
if (g_perf.scenes || vp.presents || g_perf.releases || drops || g_perf.commit_waits)
|
||||
if (g_perf.scenes || vp.presents || g_perf.releases || drops)
|
||||
droiddeck_log("perf", "last 10 s: %u ticks, %u scenes, %u on screen (copy %u, zero-copy %u, layer copy %u) | "
|
||||
"render_scene %.2f/%.2f ms | base %u black kept, %u presented | acquire %.2f/%.2f ms | "
|
||||
"present %.2f/%.2f ms (%u) | fence wait %.2f/%.2f ms (%u, %u GPU release waits) | "
|
||||
"release %.2f/%.2f ms (%u, %u held) | commits held for client writes %.2f/%.2f ms (%u, %u past the limit) | "
|
||||
"%u pool drops | layer frames timed for the next refresh %u, "
|
||||
"release %.2f/%.2f ms (%u, %u held) | %u pool drops | layer frames timed for the next refresh %u, "
|
||||
"the one after %u, held to an even step %u",
|
||||
g_perf.ticks, g_perf.scenes, g_stat_frames, g_perf.copy_scenes, zero_copy, layer_frames,
|
||||
PERF_MS(g_perf.scene_ns, g_perf.scenes), (double)g_perf.scene_max_ns / 1e6,
|
||||
@@ -4602,9 +4357,7 @@ static int on_stats_timer(void *data) {
|
||||
PERF_MS(vp.present_ns, vp.presents), (double)vp.present_max_ns / 1e6, vp.presents,
|
||||
PERF_MS(vp.wait_ns, vp.waits), (double)vp.wait_max_ns / 1e6, vp.waits, vp.gpu_release_waits,
|
||||
PERF_MS(g_perf.release_ns, g_perf.releases), (double)g_perf.release_max_ns / 1e6,
|
||||
g_perf.releases, g_perf.releases_held,
|
||||
PERF_MS(g_perf.commit_wait_ns, g_perf.commit_waits), (double)g_perf.commit_wait_max_ns / 1e6,
|
||||
g_perf.commit_waits, g_perf.commit_wait_limits, drops, aimed_next, aimed_later, aimed_even);
|
||||
g_perf.releases, g_perf.releases_held, drops, aimed_next, aimed_later, aimed_even);
|
||||
#undef PERF_MS
|
||||
memset(&g_perf, 0, sizeof(g_perf));
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
#include "blend_pass.h"
|
||||
#include "vk_loader.h"
|
||||
#include "vk_present.h"
|
||||
#include "framegen_bridge.h"
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
@@ -70,7 +69,6 @@ static struct fx_settings g_set = {
|
||||
.gamma = 1.0f, .saturation = 1.0f, .s_raw = 100.0f, .look = "Off"};
|
||||
static volatile int g_changed;
|
||||
static struct fx_settings g_cur;
|
||||
static struct fx_settings g_generated_settings;
|
||||
static int g_cur_valid;
|
||||
|
||||
static void set_begin(void) { pthread_mutex_lock(&g_lock); }
|
||||
@@ -237,24 +235,13 @@ static VkDescriptorPool g_dpool;
|
||||
static VkSampler g_sampler;
|
||||
enum { P_SGSR, P_SGSR_HQ, P_NIS, P_EASU, P_RCAS, P_CAS, P_COLOR, P_FXAA, P_FXAA_TOON, P_SMAA_EDGE, P_SMAA_WEIGHTS, P_SMAA_BLEND, P_TOON, P_TOON_COLOR, P_HDR, P_NTSC, P_CRT, P_DEBAND, P_NIS_LUMA, P_COUNT };
|
||||
static VkPipeline g_pipe[P_COUNT];
|
||||
struct fx_context {
|
||||
struct fx_target targets[2], mid, nissrc;
|
||||
struct { VkImage img; VkImageView view; VkDescriptorSet ds; int w, h; } scene;
|
||||
};
|
||||
#define FX_CONTEXTS (VKP_FG_MAX_GENERATIONS + 2)
|
||||
static struct fx_context g_contexts[FX_CONTEXTS];
|
||||
static int g_context;
|
||||
#define g_t (g_contexts[g_context].targets)
|
||||
#define g_mid (g_contexts[g_context].mid)
|
||||
#define g_nissrc (g_contexts[g_context].nissrc)
|
||||
static struct fx_target g_smaa_edges, g_smaa_weights;
|
||||
static struct fx_target g_t[2], g_mid, g_smaa_edges, g_smaa_weights;
|
||||
/* Half set: NIS = nis_luma prepass (scene rgb + luma in alpha, scene size) into g_nissrc, then
|
||||
* nis3 gathers its luma from that alpha, its coefficient banks (nis_coef.h) in a uniform buffer
|
||||
* at descriptor set 1 (g_pl_nis = {g_dsl, g_coef_dsl}, same push-constant range as g_pl).
|
||||
* Old set (or no buffer): nis.frag on the scene, P_NIS_LUMA unused. */
|
||||
static struct fx_target g_nissrc;
|
||||
static int g_nis_fast;
|
||||
static int g_nis_attempted;
|
||||
static int g_upscale_half;
|
||||
static VkDescriptorSetLayout g_coef_dsl;
|
||||
static VkPipelineLayout g_pl_nis;
|
||||
static VkDescriptorPool g_coef_pool;
|
||||
@@ -262,7 +249,7 @@ static VkDescriptorSet g_coef_ds;
|
||||
static VkBuffer g_coef_buf;
|
||||
static VkDeviceMemory g_coef_mem;
|
||||
|
||||
#define g_scene (g_contexts[g_context].scene)
|
||||
static struct { VkImage img; VkImageView view; VkDescriptorSet ds; int w, h; } g_scene;
|
||||
|
||||
void vkp_effects_bind_device(VkDevice dev, VkPhysicalDevice pd,
|
||||
const VkPhysicalDeviceMemoryProperties *memprops) {
|
||||
@@ -360,15 +347,7 @@ static void scene_release(void) {
|
||||
}
|
||||
|
||||
void vkp_effects_forget_image(VkImage img) {
|
||||
int saved = g_context;
|
||||
for (g_context = 0; g_context < FX_CONTEXTS; g_context++)
|
||||
if (img && g_scene.img == img) scene_release();
|
||||
g_context = saved;
|
||||
}
|
||||
|
||||
void vkp_effects_release_generated_sources(void) {
|
||||
for (g_context = 1; g_context < FX_CONTEXTS; g_context++) scene_release();
|
||||
g_context = 0;
|
||||
if (img && g_scene.img == img) scene_release();
|
||||
}
|
||||
|
||||
static int scene_ensure(VkImage img, int w, int h) {
|
||||
@@ -494,14 +473,9 @@ static int upscale_half_set(void) {
|
||||
|
||||
static void objects_destroy(void) {
|
||||
if (!g_dev) return;
|
||||
int saved = g_context;
|
||||
for (g_context = 0; g_context < FX_CONTEXTS; g_context++) {
|
||||
scene_release();
|
||||
target_destroy(&g_t[0]); target_destroy(&g_t[1]); target_destroy(&g_mid);
|
||||
target_destroy(&g_nissrc);
|
||||
}
|
||||
g_context = saved;
|
||||
target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights);
|
||||
scene_release();
|
||||
target_destroy(&g_t[0]); target_destroy(&g_t[1]); target_destroy(&g_mid);
|
||||
target_destroy(&g_smaa_edges); target_destroy(&g_smaa_weights); target_destroy(&g_nissrc);
|
||||
for (int i = 0; i < P_COUNT; i++) { if (g_pipe[i]) g_vk.DestroyPipeline(g_dev, g_pipe[i], NULL); g_pipe[i] = VK_NULL_HANDLE; }
|
||||
if (g_dpool) g_vk.DestroyDescriptorPool(g_dev, g_dpool, NULL);
|
||||
if (g_pl) g_vk.DestroyPipelineLayout(g_dev, g_pl, NULL);
|
||||
@@ -512,7 +486,6 @@ static void objects_destroy(void) {
|
||||
if (g_rp) g_vk.DestroyRenderPass(g_dev, g_rp, NULL);
|
||||
g_dpool = VK_NULL_HANDLE; g_pl = VK_NULL_HANDLE; g_dsl = VK_NULL_HANDLE;
|
||||
g_sampler = VK_NULL_HANDLE; g_rp = VK_NULL_HANDLE; g_smaa_rp = VK_NULL_HANDLE;
|
||||
g_nis_fast = 0; g_nis_attempted = 0; g_upscale_half = 0;
|
||||
g_ready = 0;
|
||||
}
|
||||
|
||||
@@ -532,9 +505,7 @@ void vkp_effects_set_formats(VkFormat scene_fmt, VkFormat target_fmt, int scene_
|
||||
: target_fmt == VK_FORMAT_R16G16B16A16_SFLOAT ? "the HDR picture for frame generation"
|
||||
: "the HDR composition's picture: PQ, or tone-mapped SDR with HDR output off");
|
||||
} else if (scene_fmt != g_scene_fmt) {
|
||||
int saved = g_context;
|
||||
for (g_context = 0; g_context < FX_CONTEXTS; g_context++) scene_release();
|
||||
g_context = saved;
|
||||
scene_release();
|
||||
g_scene_fmt = scene_fmt;
|
||||
}
|
||||
}
|
||||
@@ -585,112 +556,81 @@ static int objects_ensure(void) {
|
||||
VkPipelineLayoutCreateInfo pli = {.sType = VK_STRUCTURE_TYPE_PIPELINE_LAYOUT_CREATE_INFO, .setLayoutCount = 2, .pSetLayouts = set_layouts,
|
||||
.pushConstantRangeCount = 1, .pPushConstantRanges = &pcr};
|
||||
if (g_vk.CreatePipelineLayout(g_dev, &pli, NULL, &g_pl) != VK_SUCCESS) goto fail;
|
||||
VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, FX_CONTEXTS * 5 + 2};
|
||||
VkDescriptorPoolSize ps = {VK_DESCRIPTOR_TYPE_COMBINED_IMAGE_SAMPLER, 10};
|
||||
VkDescriptorPoolCreateInfo dpi = {.sType = VK_STRUCTURE_TYPE_DESCRIPTOR_POOL_CREATE_INFO,
|
||||
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = FX_CONTEXTS * 5 + 2,
|
||||
.flags = VK_DESCRIPTOR_POOL_CREATE_FREE_DESCRIPTOR_SET_BIT, .maxSets = 10,
|
||||
.poolSizeCount = 1, .pPoolSizes = &ps};
|
||||
if (g_vk.CreateDescriptorPool(g_dev, &dpi, NULL, &g_dpool) != VK_SUCCESS) goto fail;
|
||||
|
||||
g_upscale_half = upscale_half_set();
|
||||
VkShaderModule vert = shader(upscale_vert_code, sizeof(upscale_vert_code));
|
||||
if (!vert) goto fail;
|
||||
#define MKL(slot, code, name, layout) do { g_pipe[slot] = post_pipeline_for_renderpass(vert, code, sizeof(code), g_rp, name, layout); if (!g_pipe[slot]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; } } while (0)
|
||||
#define MK(slot, code, name) MKL(slot, code, name, g_pl)
|
||||
const int half = upscale_half_set();
|
||||
g_nis_fast = 0;
|
||||
g_nis_attempted = 0;
|
||||
g_ready = 1;
|
||||
droiddeck_log("effects", "shared resources ready on %s; effect pipelines are created when needed", vkp_gpu_name());
|
||||
return 0;
|
||||
fail:
|
||||
objects_destroy();
|
||||
g_ready = -1;
|
||||
droiddeck_log("error", "effects: the screen-effect chain could not be built on this driver; effects are off for this session");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int chain_failed(void) {
|
||||
objects_destroy();
|
||||
g_ready = -1;
|
||||
droiddeck_log("error", "effects: the screen-effect chain could not be built on this driver; effects are off for this session");
|
||||
return -1;
|
||||
}
|
||||
|
||||
static int pipelines_ensure(int spatial, const struct fx_settings *s) {
|
||||
VkShaderModule vert = VK_NULL_HANDLE;
|
||||
#define MKL(needed, slot, code, name, render_pass, layout) do { \
|
||||
if ((needed) && !g_pipe[slot]) { \
|
||||
if (!vert && !(vert = shader(upscale_vert_code, sizeof(upscale_vert_code)))) goto fail; \
|
||||
g_pipe[slot] = post_pipeline_for_renderpass(vert, code, sizeof(code), render_pass, name, layout); \
|
||||
if (!g_pipe[slot]) goto fail; \
|
||||
} \
|
||||
} while (0)
|
||||
#define MK(needed, slot, code, name) MKL(needed, slot, code, name, g_rp, g_pl)
|
||||
if (spatial == 3) {
|
||||
if (g_upscale_half) MK(1, P_SGSR, sgsr_half_code, "sgsr_half");
|
||||
else MK(1, P_SGSR, sgsr_code, "sgsr");
|
||||
}
|
||||
if (spatial == 8) {
|
||||
if (g_upscale_half) MK(1, P_SGSR_HQ, sgsr_quality_half_code, "sgsr_quality_half");
|
||||
else MK(1, P_SGSR_HQ, sgsr_quality_code, "sgsr_quality");
|
||||
}
|
||||
if (spatial == 4 || spatial == 5) {
|
||||
if (g_upscale_half) MK(1, P_EASU, fsr_easu_half_code, "fsr_easu_half");
|
||||
else MK(1, P_EASU, fsr_easu_code, "fsr_easu");
|
||||
if (s->sharp_pct != 0) {
|
||||
if (g_upscale_half) MK(1, P_RCAS, fsr_rcas_half_code, "fsr_rcas_half");
|
||||
else MK(1, P_RCAS, fsr_rcas_code, "fsr_rcas");
|
||||
}
|
||||
}
|
||||
if (spatial == 6) {
|
||||
if (g_upscale_half) MK(1, P_RCAS, fsr_rcas_half_code, "fsr_rcas_half");
|
||||
else MK(1, P_RCAS, fsr_rcas_code, "fsr_rcas");
|
||||
}
|
||||
if (spatial == 7) {
|
||||
if (g_upscale_half && !g_nis_attempted) {
|
||||
g_nis_attempted = 1;
|
||||
if (!fx_alpha_holds_luma(g_fx_fmt))
|
||||
droiddeck_log("effects", "NIS uses nis.frag: the chain format has no 8-bit alpha for the luma prepass");
|
||||
else if (coef_create() != 0)
|
||||
droiddeck_log("effects", "NIS coefficient buffer unavailable; NIS uses nis.frag");
|
||||
else {
|
||||
if (!vert && !(vert = shader(upscale_vert_code, sizeof(upscale_vert_code)))) goto fail;
|
||||
g_pipe[P_NIS] = post_pipeline_for_renderpass(vert, nis3_half_code, sizeof(nis3_half_code), g_rp, "nis3_half", g_pl_nis);
|
||||
if (g_pipe[P_NIS])
|
||||
g_pipe[P_NIS_LUMA] = post_pipeline_for_renderpass(vert, nis_luma_half_code, sizeof(nis_luma_half_code), g_rp, "nis_luma_half", g_pl);
|
||||
if (g_pipe[P_NIS] && g_pipe[P_NIS_LUMA]) g_nis_fast = 1;
|
||||
else {
|
||||
if (g_pipe[P_NIS]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS], NULL);
|
||||
if (g_pipe[P_NIS_LUMA]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS_LUMA], NULL);
|
||||
g_pipe[P_NIS] = VK_NULL_HANDLE;
|
||||
g_pipe[P_NIS_LUMA] = VK_NULL_HANDLE;
|
||||
coef_destroy();
|
||||
droiddeck_log("effects", "fast NIS pipelines failed to build; NIS uses nis.frag");
|
||||
}
|
||||
if (half && !fx_alpha_holds_luma(g_fx_fmt))
|
||||
droiddeck_log("effects", "NIS uses nis.frag: the chain format has no 8-bit alpha for the luma prepass");
|
||||
else if (half && coef_create() != 0)
|
||||
droiddeck_log("effects", "NIS coefficient buffer unavailable; NIS uses nis.frag");
|
||||
else if (half)
|
||||
g_nis_fast = 1;
|
||||
if (half) {
|
||||
MK(P_SGSR, sgsr_half_code, "sgsr_half");
|
||||
MK(P_SGSR_HQ, sgsr_quality_half_code, "sgsr_quality_half");
|
||||
if (g_nis_fast) {
|
||||
/* optional: a driver that rejects either fast NIS pipeline gets nis.frag, not a dead chain */
|
||||
g_pipe[P_NIS] = post_pipeline_for_renderpass(vert, nis3_half_code, sizeof(nis3_half_code), g_rp, "nis3_half", g_pl_nis);
|
||||
g_pipe[P_NIS_LUMA] = g_pipe[P_NIS]
|
||||
? post_pipeline_for_renderpass(vert, nis_luma_half_code, sizeof(nis_luma_half_code), g_rp, "nis_luma_half", g_pl)
|
||||
: VK_NULL_HANDLE;
|
||||
if (!g_pipe[P_NIS] || !g_pipe[P_NIS_LUMA]) {
|
||||
if (g_pipe[P_NIS]) g_vk.DestroyPipeline(g_dev, g_pipe[P_NIS], NULL);
|
||||
g_pipe[P_NIS] = VK_NULL_HANDLE;
|
||||
coef_destroy();
|
||||
g_nis_fast = 0;
|
||||
droiddeck_log("effects", "fast NIS pipelines failed to build; NIS uses nis.frag");
|
||||
}
|
||||
}
|
||||
if (!g_nis_fast) MK(1, P_NIS, nis_code, "nis");
|
||||
else if (g_upscale_half) MK(1, P_SGSR, sgsr_half_code, "sgsr_half");
|
||||
if (!g_nis_fast) MK(P_NIS, nis_code, "nis");
|
||||
MK(P_EASU, fsr_easu_half_code, "fsr_easu_half");
|
||||
MK(P_RCAS, fsr_rcas_half_code, "fsr_rcas_half");
|
||||
MK(P_CAS, cas_ffx_half_code, "cas_ffx_half");
|
||||
} else {
|
||||
MK(P_SGSR, sgsr_code, "sgsr");
|
||||
MK(P_SGSR_HQ, sgsr_quality_code, "sgsr_quality");
|
||||
MK(P_NIS, nis_code, "nis");
|
||||
MK(P_EASU, fsr_easu_code, "fsr_easu");
|
||||
MK(P_RCAS, fsr_rcas_code, "fsr_rcas");
|
||||
MK(P_CAS, cas_code, "cas");
|
||||
}
|
||||
if (cas_active(s)) {
|
||||
if (g_upscale_half) MK(1, P_CAS, cas_ffx_half_code, "cas_ffx_half");
|
||||
else MK(1, P_CAS, cas_code, "cas");
|
||||
}
|
||||
if (s->color_on && !(s->toon && g_fx_fmt == FX_FORMAT)) MK(1, P_COLOR, color_code, "color");
|
||||
if (s->aa_mode == 1 || s->aa_mode == 2) MK(1, P_FXAA, fxaa_code, "fxaa");
|
||||
if (s->aa_mode == 2) {
|
||||
MKL(1, P_SMAA_EDGE, smaa_edge_code, "smaa_edge", g_smaa_rp, g_pl);
|
||||
MKL(1, P_SMAA_WEIGHTS, smaa_weights_code, "smaa_weights", g_smaa_rp, g_pl);
|
||||
MK(1, P_SMAA_BLEND, smaa_blend_code, "smaa_blend");
|
||||
}
|
||||
if (s->toon && s->color_on && g_fx_fmt == FX_FORMAT) MK(1, P_TOON_COLOR, toon_color_code, "toon_color");
|
||||
else if (s->toon) MK(1, P_TOON, toon_code, "toon");
|
||||
if (s->hdr_on) MK(1, P_HDR, hdr_code, "hdr");
|
||||
if (s->ntsc) MK(1, P_NTSC, ntsc_code, "ntsc");
|
||||
if (s->crt) MK(1, P_CRT, crt_code, "crt");
|
||||
if (deband_active(s)) MK(1, P_DEBAND, deband_code, "deband");
|
||||
MK(P_COLOR, color_code, "color");
|
||||
MK(P_FXAA, fxaa_code, "fxaa");
|
||||
MK(P_FXAA_TOON, fxaa_toon_code, "fxaa_toon");
|
||||
g_pipe[P_SMAA_EDGE] = post_pipeline_for_renderpass(
|
||||
vert, smaa_edge_code, sizeof(smaa_edge_code), g_smaa_rp, "smaa_edge", g_pl);
|
||||
if (!g_pipe[P_SMAA_EDGE]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; }
|
||||
g_pipe[P_SMAA_WEIGHTS] = post_pipeline_for_renderpass(
|
||||
vert, smaa_weights_code, sizeof(smaa_weights_code), g_smaa_rp, "smaa_weights", g_pl);
|
||||
if (!g_pipe[P_SMAA_WEIGHTS]) { g_vk.DestroyShaderModule(g_dev, vert, NULL); goto fail; }
|
||||
MK(P_SMAA_BLEND, smaa_blend_code, "smaa_blend");
|
||||
MK(P_TOON, toon_code, "toon");
|
||||
MK(P_TOON_COLOR, toon_color_code, "toon_color");
|
||||
MK(P_HDR, hdr_code, "hdr");
|
||||
MK(P_NTSC, ntsc_code, "ntsc");
|
||||
MK(P_CRT, crt_code, "crt");
|
||||
MK(P_DEBAND, deband_code, "deband");
|
||||
#undef MK
|
||||
#undef MKL
|
||||
if (vert) g_vk.DestroyShaderModule(g_dev, vert, NULL);
|
||||
g_vk.DestroyShaderModule(g_dev, vert, NULL);
|
||||
g_ready = 1;
|
||||
droiddeck_log("effects", "chain ready: 16 pipelines (SGSR, SGSR HQ, NIS, FSR EASU+RCAS, CAS, colour, FXAA, SMAA edge/weights/blend, Toon, HDR, NTSC, CRT, deband), %s upscalers%s, on %s",
|
||||
half ? "half-precision" : "old fp32", g_nis_fast ? " + NIS luma prepass" : "", vkp_gpu_name());
|
||||
return 0;
|
||||
fail:
|
||||
if (vert) g_vk.DestroyShaderModule(g_dev, vert, NULL);
|
||||
return chain_failed();
|
||||
objects_destroy();
|
||||
g_ready = -1;
|
||||
droiddeck_log("error", "effects: the screen-effect chain could not be built on this driver; effects are off for this session");
|
||||
return -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -741,26 +681,14 @@ static void pass_dual(VkCommandBuffer cmd, VkPipeline p, struct fx_target *dst,
|
||||
static const float FULL_NDC[4] = {-1.0f, -1.0f, 1.0f, 1.0f};
|
||||
#define SET_NDC(pc) memcpy((pc).ndc, FULL_NDC, sizeof(FULL_NDC))
|
||||
|
||||
struct fx_source_state {
|
||||
VkImageLayout layout;
|
||||
VkPipelineStageFlags stage;
|
||||
VkAccessFlags access;
|
||||
};
|
||||
|
||||
static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int *res_w, int *res_h,
|
||||
VkImageLayout input_layout, const struct fx_settings *frozen,
|
||||
struct fx_source_state *source_state) {
|
||||
VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int *res_w, int *res_h) {
|
||||
struct fx_settings snapshot;
|
||||
const struct fx_settings *s;
|
||||
if (frozen) {
|
||||
snapshot = *frozen;
|
||||
} else {
|
||||
vkp_effects_sync();
|
||||
pthread_mutex_lock(&g_lock);
|
||||
snapshot = g_cur;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
}
|
||||
vkp_effects_sync();
|
||||
pthread_mutex_lock(&g_lock);
|
||||
snapshot = g_cur;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
s = &snapshot;
|
||||
*res_w = scene_w; *res_h = scene_h;
|
||||
|
||||
@@ -795,7 +723,7 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
effect_count(s) - (fuse_toon_color ? 1 : 0) -
|
||||
(fuse_fxaa_toon ? 1 : 0);
|
||||
|
||||
if ((spatial || nfx) && objects_ensure() == 0 && pipelines_ensure(spatial, s) == 0 && scene_ensure(scene, scene_w, scene_h) == 0 &&
|
||||
if ((spatial || nfx) && objects_ensure() == 0 && scene_ensure(scene, scene_w, scene_h) == 0 &&
|
||||
target_ensure(&g_t[0], cw, ch, FX_TARGET_USAGE, "chain") == 0 && (chain_passes < 2 || target_ensure(&g_t[1], cw, ch, FX_TARGET_USAGE, "chain") == 0) &&
|
||||
(!(spatial == 4 || spatial == 5) || s->sharp_pct == 0 ||
|
||||
target_ensure(&g_mid, cw, ch, FX_SCRATCH_USAGE, "EASU") == 0)) {
|
||||
@@ -820,10 +748,8 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
g_vk.CmdSetScissor(cmd, 0, 1, &chain_sc);
|
||||
|
||||
if (spatial) {
|
||||
if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT};
|
||||
barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT,
|
||||
barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT);
|
||||
struct fx_target *dst = FREE_TARGET();
|
||||
if (spatial == 3 || spatial == 8 || spatial == 7) {
|
||||
@@ -883,10 +809,8 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
cur = dst; cur_ds = dst->ds;
|
||||
} else if (resize) {
|
||||
struct fx_target *dst = FREE_TARGET();
|
||||
if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT};
|
||||
barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT,
|
||||
barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT);
|
||||
barrier(cmd, dst->img, VK_IMAGE_LAYOUT_UNDEFINED, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TOP_OF_PIPE_BIT, 0, VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT);
|
||||
@@ -899,10 +823,8 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT);
|
||||
cur = dst; cur_ds = dst->ds;
|
||||
} else {
|
||||
if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT};
|
||||
barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT,
|
||||
barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_SHADER_READ_ONLY_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_FRAGMENT_SHADER_BIT, VK_ACCESS_SHADER_READ_BIT);
|
||||
cur = NULL; cur_ds = g_scene.ds;
|
||||
}
|
||||
@@ -985,54 +907,8 @@ static VkImage effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int
|
||||
return scene;
|
||||
}
|
||||
|
||||
if (source_state) *source_state = (struct fx_source_state){VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT};
|
||||
barrier(cmd, scene, input_layout, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_WRITE_BIT,
|
||||
barrier(cmd, scene, VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT);
|
||||
return scene;
|
||||
}
|
||||
|
||||
VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int *res_w, int *res_h) {
|
||||
return effects_run(cmd, scene, scene_w, scene_h, out_w, out_h, res_w, res_h,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, NULL, NULL);
|
||||
}
|
||||
|
||||
int vkp_effects_prepare_generated(void) {
|
||||
vkp_effects_sync();
|
||||
pthread_mutex_lock(&g_lock);
|
||||
g_generated_settings = g_cur;
|
||||
pthread_mutex_unlock(&g_lock);
|
||||
return spatial_mode(g_generated_settings.scaling) && g_generated_settings.scaling != 6 &&
|
||||
effect_count(&g_generated_settings) == 0;
|
||||
}
|
||||
|
||||
VkImage vkp_effects_run_before_generated(VkCommandBuffer cmd, VkImage scene, int w, int h,
|
||||
int *res_w, int *res_h) {
|
||||
struct fx_settings settings = g_generated_settings;
|
||||
settings.scaling = 0;
|
||||
return effects_run(cmd, scene, w, h, w, h, res_w, res_h,
|
||||
VK_IMAGE_LAYOUT_TRANSFER_DST_OPTIMAL, &settings, NULL);
|
||||
}
|
||||
|
||||
VkImage vkp_effects_run_generated(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int slot, int *res_w, int *res_h) {
|
||||
if (slot < 0 || slot > VKP_FG_MAX_GENERATIONS) {
|
||||
*res_w = scene_w; *res_h = scene_h;
|
||||
return scene;
|
||||
}
|
||||
g_context = slot + 1;
|
||||
struct fx_source_state source_state = {0};
|
||||
VkImage result = effects_run(cmd, scene, scene_w, scene_h, out_w, out_h, res_w, res_h,
|
||||
VK_IMAGE_LAYOUT_GENERAL, &g_generated_settings, &source_state);
|
||||
barrier(cmd, result, VK_IMAGE_LAYOUT_TRANSFER_SRC_OPTIMAL, VK_IMAGE_LAYOUT_GENERAL,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT,
|
||||
VK_PIPELINE_STAGE_TRANSFER_BIT, VK_ACCESS_TRANSFER_READ_BIT);
|
||||
if (result != scene)
|
||||
barrier(cmd, scene, source_state.layout, VK_IMAGE_LAYOUT_GENERAL,
|
||||
source_state.stage, source_state.access,
|
||||
VK_PIPELINE_STAGE_ALL_COMMANDS_BIT, VK_ACCESS_MEMORY_READ_BIT | VK_ACCESS_MEMORY_WRITE_BIT);
|
||||
g_context = 0;
|
||||
return result;
|
||||
}
|
||||
@@ -18,12 +18,6 @@ VkFilter vkp_effects_blit_filter(void);
|
||||
|
||||
VkImage vkp_effects_run(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int *res_w, int *res_h);
|
||||
int vkp_effects_prepare_generated(void);
|
||||
void vkp_effects_release_generated_sources(void);
|
||||
VkImage vkp_effects_run_before_generated(VkCommandBuffer cmd, VkImage scene, int w, int h,
|
||||
int *res_w, int *res_h);
|
||||
VkImage vkp_effects_run_generated(VkCommandBuffer cmd, VkImage scene, int scene_w, int scene_h,
|
||||
int out_w, int out_h, int slot, int *res_w, int *res_h);
|
||||
|
||||
void vkp_effects_destroy(void);
|
||||
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
#define _POSIX_C_SOURCE 200809L
|
||||
#include "framegen_bridge.h"
|
||||
#include "framegen_engine.h"
|
||||
#include "effects_chain.h"
|
||||
#include "vk_loader.h"
|
||||
#include <pthread.h>
|
||||
#include <stdatomic.h>
|
||||
@@ -227,10 +226,7 @@ static void destroy_ring(void) {
|
||||
if (vk.DeviceWaitIdle) vk.DeviceWaitIdle(g_dev);
|
||||
for (uint32_t i = 0; i < g_ring_n; i++) {
|
||||
if (g_ring[i].view) vk.DestroyImageView(g_dev, g_ring[i].view, NULL);
|
||||
if (g_ring[i].img) {
|
||||
vkp_effects_forget_image(g_ring[i].img);
|
||||
vk.DestroyImage(g_dev, g_ring[i].img, NULL);
|
||||
}
|
||||
if (g_ring[i].img) vk.DestroyImage(g_dev, g_ring[i].img, NULL);
|
||||
if (g_ring[i].mem) vk.FreeMemory(g_dev, g_ring[i].mem, NULL);
|
||||
memset(&g_ring[i], 0, sizeof(g_ring[i]));
|
||||
}
|
||||
|
||||
@@ -31,7 +31,6 @@ bool g_probed = false, g_ready = false;
|
||||
|
||||
std::unique_ptr<lsfg::Engine> g_lsfg;
|
||||
std::unique_ptr<ddfg::Engine> g_ddfg;
|
||||
std::vector<std::unique_ptr<ddfg::Engine>> g_retained_ddfg;
|
||||
int g_kind = -1;
|
||||
char g_build[96] = "";
|
||||
|
||||
@@ -129,14 +128,7 @@ void fge_device_ready(PFN_vkGetInstanceProcAddr gipa, VkInstance inst, VkPhysica
|
||||
|
||||
void fge_device_lost(void) {
|
||||
g_lsfg.reset();
|
||||
if (g_ddfg) {
|
||||
if (g_ddfg->destroy()) g_ddfg.reset();
|
||||
else g_retained_ddfg.push_back(std::move(g_ddfg));
|
||||
}
|
||||
// The device is being torn down. Unknown-completion resources must not be
|
||||
// passed to Vulkan destruction calls; the VkDevice teardown reclaims them.
|
||||
for (auto& engine : g_retained_ddfg) engine->abandon();
|
||||
g_retained_ddfg.clear();
|
||||
g_ddfg.reset();
|
||||
g_kind = -1;
|
||||
g_dev = VK_NULL_HANDLE;
|
||||
g_queue = VK_NULL_HANDLE;
|
||||
@@ -201,21 +193,9 @@ int fge_start(int kind, const char *cache_path) {
|
||||
}
|
||||
|
||||
void fge_stop(void) {
|
||||
if (g_lsfg) {
|
||||
if (g_table.DeviceWaitIdle && g_dev) g_table.DeviceWaitIdle(g_dev);
|
||||
g_lsfg.reset();
|
||||
}
|
||||
for (auto it = g_retained_ddfg.begin(); it != g_retained_ddfg.end();) {
|
||||
if ((*it)->destroy()) it = g_retained_ddfg.erase(it);
|
||||
else ++it;
|
||||
}
|
||||
if (g_ddfg) {
|
||||
if (g_ddfg->destroy()) g_ddfg.reset();
|
||||
else {
|
||||
ELOGE("ddfg-native: retaining engine until GPU completion is known or device teardown");
|
||||
g_retained_ddfg.push_back(std::move(g_ddfg));
|
||||
}
|
||||
}
|
||||
if ((g_lsfg || g_ddfg) && g_table.DeviceWaitIdle && g_dev) g_table.DeviceWaitIdle(g_dev);
|
||||
g_lsfg.reset();
|
||||
g_ddfg.reset();
|
||||
g_kind = -1;
|
||||
}
|
||||
|
||||
|
||||
@@ -2759,21 +2759,6 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
pass_n = 1;
|
||||
overlay_start = source_end;
|
||||
}
|
||||
const int upscale_w = (int)(scene_w * g_map.kx + 0.5f);
|
||||
const int upscale_h = (int)(scene_h * g_map.ky + 0.5f);
|
||||
const int post_upscale = fx && fg && !hf && !cb && vkp_effects_upscaling() &&
|
||||
vkp_effects_prepare_generated() &&
|
||||
(upscale_w > input_w || upscale_h > input_h);
|
||||
if (post_upscale) {
|
||||
static int last_input_w, last_input_h, last_output_w, last_output_h;
|
||||
if (input_w != last_input_w || input_h != last_input_h ||
|
||||
upscale_w != last_output_w || upscale_h != last_output_h) {
|
||||
droiddeck_log("framegen", "post-upscale: interpolate %dx%d, spatial filter each present to %dx%d",
|
||||
input_w, input_h, upscale_w, upscale_h);
|
||||
last_input_w = input_w; last_input_h = input_h;
|
||||
last_output_w = upscale_w; last_output_h = upscale_h;
|
||||
}
|
||||
}
|
||||
const int deep = hf && n > 0 && fg && g_swap_is_hdr && !hf->tonemap && vkp_framegen_format_ok(FG_HDR_FMT) &&
|
||||
ensure_img(&g_fgscene, scene_w, scene_h, FG_HDR_FMT,
|
||||
VK_IMAGE_USAGE_COLOR_ATTACHMENT_BIT | VK_IMAGE_USAGE_SAMPLED_BIT |
|
||||
@@ -2909,11 +2894,8 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
if (fx) {
|
||||
int mapped_w = (int)(scene_w * g_map.kx + 0.5f), mapped_h = (int)(scene_h * g_map.ky + 0.5f);
|
||||
if (fg && !vkp_effects_sharpening()) { mapped_w = scene_w; mapped_h = scene_h; }
|
||||
if (post_upscale) { mapped_w = input_w; mapped_h = input_h; }
|
||||
vkp_effects_set_formats(scene_fmt, scene_fmt, hdr_how == 1 || hdr_unconverted);
|
||||
result = post_upscale
|
||||
? vkp_effects_run_before_generated(cmd, scene_img, input_w, input_h, &rw, &rh)
|
||||
: vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh);
|
||||
result = vkp_effects_run(cmd, scene_img, input_w, input_h, mapped_w, mapped_h, &rw, &rh);
|
||||
effects_overlay_draws(cmd, result, rw, rh, scene_w, scene_h,
|
||||
draws ? draws + overlay_start : NULL, n - overlay_start);
|
||||
release_external_client_draws(cmd, draws, n);
|
||||
@@ -2936,12 +2918,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
if (ngen > VKP_FG_MAX_GENERATIONS) ngen = VKP_FG_MAX_GENERATIONS;
|
||||
}
|
||||
|
||||
VkImage screen = ngen ? gens[0] : result;
|
||||
int screen_w = rw, screen_h = rh;
|
||||
if (post_upscale)
|
||||
screen = vkp_effects_run_generated(cmd, screen, rw, rh, upscale_w, upscale_h,
|
||||
0, &screen_w, &screen_h);
|
||||
record_screen_blit(cmd, screen, screen_w, screen_h, scene_w, scene_h, img, blit_filter, cb);
|
||||
record_screen_blit(cmd, ngen ? gens[0] : result, rw, rh, scene_w, scene_h, img, blit_filter, cb);
|
||||
}
|
||||
g_vk.EndCommandBuffer(cmd);
|
||||
|
||||
@@ -2965,12 +2942,7 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
VkCommandBuffer ck = g_cmds[k];
|
||||
g_vk.ResetCommandBuffer(ck, 0);
|
||||
g_vk.BeginCommandBuffer(ck, &bi);
|
||||
VkImage screen = k < ngen ? gens[k] : result;
|
||||
int screen_w = rw, screen_h = rh;
|
||||
if (post_upscale)
|
||||
screen = vkp_effects_run_generated(ck, screen, rw, rh, upscale_w, upscale_h,
|
||||
k, &screen_w, &screen_h);
|
||||
record_screen_blit(ck, screen, screen_w, screen_h, scene_w, scene_h, img, blit_filter, cb);
|
||||
record_screen_blit(ck, k < ngen ? gens[k] : result, rw, rh, scene_w, scene_h, img, blit_filter, cb);
|
||||
g_vk.EndCommandBuffer(ck);
|
||||
}
|
||||
const int last = (k + 1 == presents);
|
||||
@@ -3016,7 +2988,6 @@ static int render_impl(int scene_w, int scene_h, const struct vkp_draw *draws, i
|
||||
VkResult fr = timed_wait(g_fence, UINT64_MAX);
|
||||
if (fr == VK_ERROR_DEVICE_LOST || pr == VK_ERROR_DEVICE_LOST) { device_lost("present"); return -1; }
|
||||
if (fr != VK_SUCCESS) return -1;
|
||||
vkp_effects_release_generated_sources();
|
||||
if (fg) vkp_framegen_presented(presented_gen);
|
||||
if (pr == VK_ERROR_OUT_OF_DATE_KHR || pr == VK_ERROR_SURFACE_LOST_KHR) {
|
||||
droiddeck_log("gpu", "screen surface %s on present: rebuilding the swapchain", vk_result_name(pr));
|
||||
|
||||
@@ -20,10 +20,6 @@ class App : Application() {
|
||||
|
||||
override fun onCreate() {
|
||||
super.onCreate()
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28 &&
|
||||
com.droiddeck.launcher.runtime.GuestWorker.isWorkerProcess(this, Application.getProcessName())) return
|
||||
if (android.os.Build.VERSION.SDK_INT >= 28 && Application.getProcessName() == packageName)
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.attach(this)
|
||||
com.droiddeck.launcher.runtime.NativeGuest.init(this)
|
||||
com.droiddeck.launcher.session.Onboarding.attach(this)
|
||||
Thread({ runCatching { EnhancedSessionLogShare.cleanupAbandonedStages(this) } }, "diagnostic-stage-cleanup").start()
|
||||
|
||||
@@ -1038,14 +1038,18 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
onHandled()
|
||||
return
|
||||
}
|
||||
val files = game.gameFiles
|
||||
if (game.source != com.droiddeck.launcher.stores.Store.XBOX.id || files == null) {
|
||||
val files = game.gameFiles?.takeIf { game.source == com.droiddeck.launcher.stores.Store.XBOX.id }
|
||||
val steamClient = Library.fromSteamClient(game)
|
||||
if (files == null && !steamClient) {
|
||||
if (startGame(game, returnHome, onHandled, request)) onSettled()
|
||||
else launchCoordinator.releaseHandling(request)
|
||||
return
|
||||
}
|
||||
val app = applicationContext
|
||||
Thread({
|
||||
val refused = com.droiddeck.launcher.stores.xbox.XboxManifest.needsAppModel(files)
|
||||
val refused = files != null && com.droiddeck.launcher.stores.xbox.XboxManifest.needsAppModel(files)
|
||||
val uncached = steamClient && !com.droiddeck.launcher.session.NoSteamLaunch.enabled(app, game) &&
|
||||
com.droiddeck.launcher.session.OfflineMode.lacksAppInfo(app, game.appId)
|
||||
ui.post {
|
||||
when {
|
||||
!launchCoordinator.isCurrent(request) || isFinishing || isDestroyed -> {
|
||||
@@ -1057,11 +1061,14 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
android.widget.Toast.makeText(this, getString(R.string.game_needs_app_model, game.name), android.widget.Toast.LENGTH_LONG).show()
|
||||
onSettled()
|
||||
}
|
||||
startGame(game, returnHome, onHandled, request) -> onSettled()
|
||||
else -> launchCoordinator.releaseHandling(request)
|
||||
else -> {
|
||||
if (uncached) android.widget.Toast.makeText(this, getString(R.string.game_steam_offline_uncached, game.name), android.widget.Toast.LENGTH_LONG).show()
|
||||
if (startGame(game, returnHome, onHandled, request)) onSettled()
|
||||
else launchCoordinator.releaseHandling(request)
|
||||
}
|
||||
}
|
||||
}
|
||||
}, "xbox-app-model").start()
|
||||
}, "game-launch-check").start()
|
||||
}
|
||||
|
||||
private fun startGame(game: Library.SteamGame, returnHome: Boolean, onHandled: () -> Unit, ticket: LaunchTicket): Boolean {
|
||||
@@ -2264,10 +2271,7 @@ class FrontEndActivity : ComponentActivity(), com.droiddeck.launcher.ui.AgentPet
|
||||
!com.droiddeck.launcher.input.PadBridge.isControllerMotionEvent(event)) return
|
||||
val device = event.device ?: return
|
||||
val rxRy = com.droiddeck.launcher.input.PadBridge.rightStickUsesRxRy(event, device, rightStickLayouts)
|
||||
?: run {
|
||||
if (rightStickScrollDeviceId == event.deviceId) stopRightStickScroll()
|
||||
return
|
||||
}
|
||||
?: return
|
||||
val axis = if (rxRy) android.view.MotionEvent.AXIS_RY else android.view.MotionEvent.AXIS_RZ
|
||||
val value = event.getAxisValue(axis)
|
||||
if (kotlin.math.abs(value) < 0.55f) {
|
||||
|
||||
@@ -8,11 +8,8 @@ import androidx.compose.runtime.mutableStateListOf
|
||||
import androidx.compose.runtime.mutableStateMapOf
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.core.WirelessAdbFix
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.OrphanReaper
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
import java.io.File
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
@@ -91,8 +88,6 @@ object AgentSetup {
|
||||
private fun completedKey(harness: AgentHarness) = "setup_completed_${harness.id}"
|
||||
|
||||
private val main = Handler(Looper.getMainLooper())
|
||||
/** Advanced by every Allow, so a connection check started before it cannot overwrite what it found. */
|
||||
private var connectionGeneration = 0
|
||||
private const val REPO = "https://github.com/Droid-Deck/DroidDeck.git"
|
||||
private const val CHECKOUT = "/root/DroidDeck"
|
||||
private val HELPERS = listOf("android-open", "dd-gh-login", "droiddeckctl", "droiddeck-scenario")
|
||||
@@ -109,7 +104,6 @@ object AgentSetup {
|
||||
val harness = AgentHost.harness
|
||||
keys = harness.keys(LinuxRuntime.rootDir(app))
|
||||
val probes = mutableListOf<Pair<Step, List<String>>>()
|
||||
val generation = connectionGeneration
|
||||
for (step in Step.entries) if (status[step] != Status.WORKING) {
|
||||
when (step) {
|
||||
Step.INSTALL -> set(step, if (harness.files.all { AgentHost.guestFileExists(app, it) }) Status.DONE else Status.TODO)
|
||||
@@ -120,9 +114,7 @@ object AgentSetup {
|
||||
detail.remove(step)
|
||||
Thread({
|
||||
val live = com.droiddeck.launcher.core.WirelessAdbFix.liveConnectAddress(app) != null
|
||||
main.post {
|
||||
if (generation == connectionGeneration && status[step] != Status.WORKING) status[step] = if (live) Status.DONE else Status.TODO
|
||||
}
|
||||
set(step, if (live) Status.DONE else Status.TODO)
|
||||
}, "agent-connection").start()
|
||||
} else probes += step to listOf("sh", "-c",
|
||||
"for i in 1 2 3; do adb connect \"\$ADB_SERIAL\" >/dev/null 2>&1; " +
|
||||
@@ -131,7 +123,7 @@ object AgentSetup {
|
||||
Step.GITHUB -> probes += step to listOf("gh", "auth", "status")
|
||||
}
|
||||
}
|
||||
Thread({ for ((step, command) in probes) probe(app, harness, step, command, generation) }, "agent-checks").start()
|
||||
Thread({ for ((step, command) in probes) probe(app, harness, step, command) }, "agent-checks").start()
|
||||
}
|
||||
|
||||
/** The last failed refresh ends the script: the installs after it would run from stale indexes and could report success. */
|
||||
@@ -149,22 +141,6 @@ object AgentSetup {
|
||||
/** Runs [step]'s action. [CONNECTION] is the app's own pairing flow, so the caller opens it. */
|
||||
fun run(context: Context, step: Step) = run(context, step, null)
|
||||
|
||||
/** The [Step.CONNECTION] action on a Quest, which has no pairing screen; see [WirelessAdbFix.trustOnDevice]. */
|
||||
fun trustOnDevice(context: Context) {
|
||||
val app = context.applicationContext
|
||||
connectionGeneration++
|
||||
status[Step.CONNECTION] = Status.WORKING
|
||||
detail[Step.CONNECTION] = app.getString(R.string.agent_connection_quest_waiting)
|
||||
Thread({
|
||||
val ok = runCatching { WirelessAdbFix.trustOnDevice(app) }.isSuccess
|
||||
main.post {
|
||||
status[Step.CONNECTION] = if (ok) Status.DONE else Status.FAILED
|
||||
if (ok) detail.remove(Step.CONNECTION) else detail[Step.CONNECTION] = app.getString(R.string.agent_connection_quest_failed)
|
||||
if (ok) check(app)
|
||||
}
|
||||
}, "agent-quest-trust").start()
|
||||
}
|
||||
|
||||
/** Opens the page where a provider's key is made, as the sign-in of a harness that takes pasted keys. */
|
||||
fun openKeyPage(context: Context, page: String) = run(context, Step.SIGN_IN, listOf("/root/.local/bin/android-open", page))
|
||||
|
||||
@@ -240,7 +216,7 @@ object AgentSetup {
|
||||
detail.clear()
|
||||
}
|
||||
|
||||
private fun probe(app: Context, harness: AgentHarness, step: Step, command: List<String>, generation: Int) {
|
||||
private fun probe(app: Context, harness: AgentHarness, step: Step, command: List<String>) {
|
||||
var output = ""
|
||||
val ok = runCatching {
|
||||
val child = AgentHost.guest(app, command, connectAdb = step == Step.CONNECTION).start()
|
||||
@@ -256,14 +232,11 @@ object AgentSetup {
|
||||
}.onFailure { output = it.message.orEmpty() }.getOrDefault(false)
|
||||
main.post {
|
||||
if (AgentHost.harness != harness) return@post
|
||||
// A running or newer Allow owns the row, including the instructions it shows while it waits.
|
||||
if (step == Step.CONNECTION && (generation != connectionGeneration || status[step] == Status.WORKING)) return@post
|
||||
if (status[step] != Status.WORKING) status[step] = if (ok) Status.DONE else Status.TODO
|
||||
val last = output.lines().lastOrNull { it.isNotBlank() && !noise(it.trim()) }?.trim()?.take(160)
|
||||
when {
|
||||
ok -> detail.remove(step)
|
||||
step == Step.CONNECTION -> detail[step] = app.getString(
|
||||
if (QuestExperimental.isSupported()) R.string.agent_connection_quest_off else R.string.agent_connection_off)
|
||||
step == Step.CONNECTION -> detail[step] = app.getString(com.droiddeck.launcher.R.string.agent_connection_off)
|
||||
step.required && last != null -> detail[step] = last
|
||||
}
|
||||
if (ready) AgentHost.prefs(app).edit().putBoolean(completedKey(harness), true).apply()
|
||||
|
||||
@@ -89,7 +89,7 @@ public class DirectAudioRelayComponent extends SessionPart {
|
||||
}
|
||||
}
|
||||
final java.io.PrintWriter log = out;
|
||||
pid = HostProcess.startUncounted(command.toString(), env.toArray(new String[0]),
|
||||
pid = HostProcess.start(command.toString(), env.toArray(new String[0]),
|
||||
app().getFilesDir(), null,
|
||||
line -> {
|
||||
Log.i(TAG, line);
|
||||
|
||||
@@ -186,16 +186,13 @@ public class PulseAudioComponent extends SessionPart {
|
||||
env.add("LD_LIBRARY_PATH=/system/lib64:" + modules + ":" + workingDir.getAbsolutePath());
|
||||
env.add("HOME=" + workingDir);
|
||||
env.add("TMPDIR=" + workingDir);
|
||||
// The daemon closes every fd at start but this one; in a worker process it is the binder
|
||||
// fd whose closing Android takes for the process's death.
|
||||
env.add("PULSE_PASSED_FD=" + com.droiddeck.launcher.runtime.GuestWorker.BINDER_FD_TOKEN);
|
||||
|
||||
String command = String.join(" ", HostProcess.dataExecutable(workingDir.getAbsolutePath() + "/libpulseaudio.so"))
|
||||
+ " --system=false --disable-shm=true --fail=false"
|
||||
+ " -n --file=default.pa --daemonize=false --use-pid-file=false --exit-idle-time=-1"
|
||||
+ " --log-level=info";
|
||||
final java.io.PrintWriter out = openLog();
|
||||
if (!host.launch(generation, () -> HostProcess.startUncounted(command, env.toArray(new String[0]), workingDir, status -> {
|
||||
if (!host.launch(generation, () -> HostProcess.start(command, env.toArray(new String[0]), workingDir, status -> {
|
||||
if (host.exited(generation)) {
|
||||
Log.w(TAG, "audio host exited with status " + status + "; restarting");
|
||||
start(generation);
|
||||
|
||||
@@ -61,19 +61,7 @@ object GameEnvironment {
|
||||
}
|
||||
|
||||
fun effective(config: Config, preset: String, scope: String, forceSsbs: Boolean = false): Map<String, String?> =
|
||||
defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else knownGames[scope].orEmpty() + config.games[scope].orEmpty()
|
||||
|
||||
/**
|
||||
* What some Steam games need here whatever the shared settings say; the game's own settings still win.
|
||||
* GTA III dies at 0042A703 when a new game starts with FEX's reduced x87 precision, as the Rockstar store copy does.
|
||||
*/
|
||||
val knownGames: Map<String, Map<String, String?>> = mapOf(
|
||||
"12100" to mapOf("FEX_X87REDUCEDPRECISION" to "0"),
|
||||
)
|
||||
|
||||
/** [config] with [knownGames] folded under each game's own settings, for the guest to read. */
|
||||
fun withKnownGames(config: Config): Config =
|
||||
config.copy(games = config.games + knownGames.mapValues { (scope, known) -> known + config.games[scope].orEmpty() })
|
||||
defaults(preset, forceSsbs) + config.shared + if (scope.isEmpty()) emptyMap() else config.games[scope].orEmpty()
|
||||
|
||||
fun hasOverride(config: Config, scope: String, name: String): Boolean =
|
||||
scope.isNotEmpty() && config.entries(scope).containsKey(name)
|
||||
@@ -90,7 +78,7 @@ object GameEnvironment {
|
||||
val entries = config.games[scope].orEmpty()
|
||||
if (FexPreset.environmentKeys.none(entries::containsKey)) return null
|
||||
return FexPreset.all.firstOrNull { preset ->
|
||||
val expected = presetFor(scope, preset.id)
|
||||
val expected = FexPreset.environment(preset.id)
|
||||
FexPreset.environmentKeys.all { key -> entries.containsKey(key) && entries[key] == expected[key] }
|
||||
}?.id ?: CUSTOM_FEX_PRESET
|
||||
}
|
||||
@@ -100,16 +88,12 @@ object GameEnvironment {
|
||||
require(preset == null || FexPreset.all.any { it.id == preset })
|
||||
val entries = config.entries(scope).filterKeys { it !in FexPreset.environmentKeys }.toMutableMap()
|
||||
if (preset != null) {
|
||||
val values = presetFor(scope, preset)
|
||||
val values = FexPreset.environment(preset)
|
||||
FexPreset.environmentKeys.forEach { key -> entries[key] = values[key] }
|
||||
}
|
||||
return config.withEntries(scope, entries)
|
||||
}
|
||||
|
||||
/** A FEX preset as a game gets it: picking one never undoes a fix the game is known to need. */
|
||||
private fun presetFor(scope: String, preset: String): Map<String, String?> =
|
||||
FexPreset.environment(preset) + knownGames[scope].orEmpty().filterKeys { it in FexPreset.environmentKeys }
|
||||
|
||||
const val CUSTOM_FEX_PRESET = "__custom__"
|
||||
|
||||
val syncBackends = listOf(SessionPrefs.SYNC_NTSYNC, SessionPrefs.SYNC_FSYNC, SessionPrefs.SYNC_ESYNC, SessionPrefs.SYNC_WINESERVER)
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.content.Context
|
||||
import android.content.pm.PackageManager
|
||||
import android.net.Uri
|
||||
import android.provider.Settings
|
||||
|
||||
@@ -20,14 +19,4 @@ object GlobalSettings {
|
||||
fun developerOptionsOn(context: Context): Boolean = isOn(context, Settings.Global.DEVELOPMENT_SETTINGS_ENABLED)
|
||||
|
||||
fun wirelessDebuggingOn(context: Context): Boolean = isOn(context, "adb_wifi_enabled")
|
||||
|
||||
/**
|
||||
* True when it was off and is now on. Quest only, where Settings has no switch for it; it needs
|
||||
* WRITE_SECURE_SETTINGS granted over adb.
|
||||
*/
|
||||
fun turnOnWirelessDebugging(context: Context): Boolean {
|
||||
if (!com.droiddeck.launcher.session.QuestExperimental.isSupported() || wirelessDebuggingOn(context)) return false
|
||||
if (context.checkSelfPermission(android.Manifest.permission.WRITE_SECURE_SETTINGS) != PackageManager.PERMISSION_GRANTED) return false
|
||||
return runCatching { Settings.Global.putInt(context.contentResolver, "adb_wifi_enabled", 1) }.getOrDefault(false)
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.droiddeck.launcher.core
|
||||
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.util.Log
|
||||
import java.io.File
|
||||
import java.util.function.Consumer
|
||||
@@ -8,9 +7,6 @@ import java.util.function.Consumer
|
||||
object HostProcess {
|
||||
private const val TAG = "HostProcess"
|
||||
private const val LINKER = "/system/bin/linker64"
|
||||
// sh -c WORKER_CD sh DIR NAME=VALUE... -- PROGRAM ARGS...
|
||||
private const val WORKER_CD = "cd \"\$1\" || exit 126; shift; " +
|
||||
"while [ \$# -gt 0 ] && [ \"\$1\" != -- ]; do export \"\$1\"; shift; done; shift; exec \"\$@\""
|
||||
|
||||
/** Android 10+ refuses to execute app data files for targetSdk 29+; its linker still loads them. */
|
||||
@JvmStatic
|
||||
@@ -69,77 +65,6 @@ object HostProcess {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* As [start], but the program runs as the main process of one of the app's worker processes,
|
||||
* which Android does not count against the app's child processes (docs/phantom-processes.md).
|
||||
* Falls back to [start] when no worker is available. The exit status is the program's exit
|
||||
* code, or 128 plus the signal that ended it, as Process.waitFor() reports it.
|
||||
*/
|
||||
@JvmStatic
|
||||
@JvmOverloads
|
||||
fun startUncounted(command: String, env: Array<String>?, dir: File?, onExit: Consumer<Int>?, onLine: Consumer<String>?,
|
||||
outputFile: File? = null, onOutputComplete: Runnable? = null): Int {
|
||||
val context = com.droiddeck.launcher.runtime.GuestWorkers.context
|
||||
val argv = split(command)
|
||||
// A missing working directory fails the launch (start() returns -1 for it), not the program
|
||||
if (context == null || argv.isEmpty() || !com.droiddeck.launcher.runtime.GuestWorkers.enabled(context) ||
|
||||
(dir != null && !dir.isDirectory)) {
|
||||
return start(command, env, dir, onExit, onLine, outputFile, onOutputComplete)
|
||||
}
|
||||
val environment = LinkedHashMap(System.getenv())
|
||||
env?.forEach { line ->
|
||||
val eq = line.indexOf('=')
|
||||
if (eq > 0) environment[line.substring(0, eq)] = line.substring(eq + 1)
|
||||
}
|
||||
val assignments = environment.map { (k, v) -> "$k=$v" }
|
||||
// A worker cannot chdir before its exec, so Android's shell does it. The shell starts with an
|
||||
// environment of its own (the program's LD_PRELOAD of glibc libraries would stop it loading)
|
||||
// and exports the program's before the exec.
|
||||
val launch = if (dir != null) {
|
||||
listOf("/system/bin/sh", "-c", WORKER_CD, "sh", dir.path) + assignments + listOf("--") + argv
|
||||
} else argv
|
||||
val workerEnv = if (dir != null) listOf("PATH=/system/bin") else assignments
|
||||
var input: ParcelFileDescriptor? = null
|
||||
var reader: ParcelFileDescriptor? = null
|
||||
var output: ParcelFileDescriptor? = null
|
||||
val pid = try {
|
||||
input = ParcelFileDescriptor.open(File("/dev/null"), ParcelFileDescriptor.MODE_READ_ONLY)
|
||||
output = when {
|
||||
onLine != null -> ParcelFileDescriptor.createPipe().let { reader = it[0]; it[1] }
|
||||
outputFile != null -> ParcelFileDescriptor.open(outputFile,
|
||||
ParcelFileDescriptor.MODE_WRITE_ONLY or ParcelFileDescriptor.MODE_CREATE or ParcelFileDescriptor.MODE_APPEND)
|
||||
else -> ParcelFileDescriptor.open(File("/dev/null"), ParcelFileDescriptor.MODE_WRITE_ONLY)
|
||||
}
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.start(context, launch, workerEnv, listOf(input, output, output)) { status ->
|
||||
onExit?.accept(if (status < 0) -1 else if (status and 0x7f == 0) (status shr 8) and 0xff else 128 + (status and 0x7f))
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "no worker for ${argv.first()}", e)
|
||||
-1
|
||||
} finally {
|
||||
runCatching { input?.close() }
|
||||
runCatching { output?.close() }
|
||||
}
|
||||
if (pid <= 0) {
|
||||
reader?.close()
|
||||
return start(command, env, dir, onExit, onLine, outputFile, onOutputComplete)
|
||||
}
|
||||
Log.i(TAG, "started pid $pid outside the child-process count: ${argv.first()} (${argv.size - 1} arguments)")
|
||||
reader?.let { pipe ->
|
||||
Thread({
|
||||
try {
|
||||
ParcelFileDescriptor.AutoCloseInputStream(pipe).bufferedReader().useLines { lines ->
|
||||
lines.forEach { onLine?.accept(it) }
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
} finally {
|
||||
onOutputComplete?.run()
|
||||
}
|
||||
}, "proc-out-$pid").apply { priority = Thread.NORM_PRIORITY - 1; isDaemon = true; start() }
|
||||
}
|
||||
return pid
|
||||
}
|
||||
|
||||
@JvmStatic
|
||||
fun pidOf(process: Process): Int = try {
|
||||
val field = process.javaClass.getDeclaredField("pid")
|
||||
|
||||
@@ -7,8 +7,6 @@ import com.droiddeck.launcher.R
|
||||
|
||||
enum class PhantomProcessStatus {
|
||||
NOT_APPLICABLE,
|
||||
/** The limit is on, but the session keeps its programs out of Android's count (GuestWorkers). */
|
||||
UNCOUNTED,
|
||||
DISABLED,
|
||||
ENABLED,
|
||||
UNSET,
|
||||
@@ -59,12 +57,6 @@ object PhantomProcessLimit {
|
||||
|
||||
fun read(context: Context, sdk: Int = Build.VERSION.SDK_INT): PhantomProcessStatus {
|
||||
if (sdk < Build.VERSION_CODES.S) return PhantomProcessStatus.NOT_APPLICABLE
|
||||
val status = readSetting(context, sdk)
|
||||
return if (status != PhantomProcessStatus.DISABLED && com.droiddeck.launcher.runtime.GuestWorkers.limitHandled(context))
|
||||
PhantomProcessStatus.UNCOUNTED else status
|
||||
}
|
||||
|
||||
private fun readSetting(context: Context, sdk: Int): PhantomProcessStatus {
|
||||
if (usesDeviceConfig(sdk)) {
|
||||
val off = context.getSharedPreferences(PREFS, Context.MODE_PRIVATE).getBoolean(PREF_ANDROID_12_OFF, false)
|
||||
val global = try {
|
||||
@@ -109,8 +101,7 @@ object PhantomProcessLimit {
|
||||
fun hasDeveloperToggle(sdk: Int = Build.VERSION.SDK_INT): Boolean = sdk >= Build.VERSION_CODES.UPSIDE_DOWN_CAKE
|
||||
|
||||
fun blocksSteam(status: PhantomProcessStatus): Boolean =
|
||||
status != PhantomProcessStatus.NOT_APPLICABLE && status != PhantomProcessStatus.DISABLED &&
|
||||
status != PhantomProcessStatus.UNCOUNTED
|
||||
status != PhantomProcessStatus.NOT_APPLICABLE && status != PhantomProcessStatus.DISABLED
|
||||
|
||||
fun title(context: Context, status: PhantomProcessStatus): String = context.getString(when (status) {
|
||||
PhantomProcessStatus.ENABLED -> R.string.phantom_title_on
|
||||
@@ -118,7 +109,6 @@ object PhantomProcessLimit {
|
||||
PhantomProcessStatus.UNREADABLE -> R.string.phantom_title_unreadable
|
||||
PhantomProcessStatus.DISABLED -> R.string.phantom_title_off
|
||||
PhantomProcessStatus.NOT_APPLICABLE -> R.string.phantom_title_not_required
|
||||
PhantomProcessStatus.UNCOUNTED -> R.string.phantom_title_uncounted
|
||||
})
|
||||
|
||||
fun instructions(context: Context, status: PhantomProcessStatus): String = when (status) {
|
||||
@@ -126,7 +116,6 @@ object PhantomProcessLimit {
|
||||
context.getString(R.string.phantom_instructions_fix, fixSentence(context))
|
||||
PhantomProcessStatus.DISABLED -> context.getString(R.string.phantom_instructions_off)
|
||||
PhantomProcessStatus.NOT_APPLICABLE -> context.getString(R.string.phantom_instructions_not_applicable)
|
||||
PhantomProcessStatus.UNCOUNTED -> context.getString(R.string.phantom_instructions_uncounted)
|
||||
}
|
||||
|
||||
fun gateInstructions(context: Context, status: PhantomProcessStatus): String = when (status) {
|
||||
@@ -143,6 +132,5 @@ object PhantomProcessLimit {
|
||||
PhantomProcessStatus.UNSET -> "not set (ROM default applies; DroidDeck requires an explicit disabled value)"
|
||||
PhantomProcessStatus.UNREADABLE -> "unreadable (DroidDeck could not verify the setting)"
|
||||
PhantomProcessStatus.NOT_APPLICABLE -> "not applicable before Android 12"
|
||||
PhantomProcessStatus.UNCOUNTED -> "on, not needed (most of the session's programs run in uncounted worker processes)"
|
||||
}
|
||||
}
|
||||
@@ -28,18 +28,17 @@ object SessionLogCapture {
|
||||
out.flush()
|
||||
writer = out
|
||||
this.target = target
|
||||
pid = HostProcess.startUncounted(
|
||||
pid = HostProcess.start(
|
||||
command(Process.myPid(), sinceMillis),
|
||||
null, target.parentFile, null,
|
||||
onLine = { line ->
|
||||
synchronized(this) {
|
||||
try {
|
||||
writer?.apply { write(line); newLine(); flush() }
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
) { line ->
|
||||
synchronized(this) {
|
||||
try {
|
||||
writer?.apply { write(line); newLine(); flush() }
|
||||
} catch (e: Exception) {
|
||||
}
|
||||
},
|
||||
)
|
||||
}
|
||||
}
|
||||
if (pid == -1) {
|
||||
out.write("logcat could not be started; this ROM may not hand an app its own entries.\n")
|
||||
out.flush()
|
||||
|
||||
@@ -22,9 +22,6 @@ object WirelessAdbFix {
|
||||
private const val HOST_FILE = "wireless-adb-host.txt"
|
||||
private const val CONNECTION_FILE = "wireless-adb-connection.txt"
|
||||
const val LOOPBACK = "127.0.0.1"
|
||||
private const val TCP_PORT = 5555
|
||||
private const val WIRELESS_START_MS = 2_000L
|
||||
private const val NETWORK_PROMPT_MS = 30_000L
|
||||
|
||||
private data class SavedConnection(val host: String, val port: Int?)
|
||||
|
||||
@@ -58,23 +55,6 @@ object WirelessAdbFix {
|
||||
writeAtomically(context, File(context.noBackupFilesDir, CONNECTION_FILE), ByteArray(0))
|
||||
}
|
||||
|
||||
/**
|
||||
* Quest has no pairing screen. adbd in TCP mode (`adb tcpip 5555`) asks "Allow debugging?" for an
|
||||
* unknown key, and Wireless debugging accepts a key allowed there, so this stands in for pairing.
|
||||
* Blocks until the prompt is answered or times out.
|
||||
*/
|
||||
fun trustOnDevice(context: Context) {
|
||||
val app = context.applicationContext
|
||||
// Already trusted, as after a reboot: Wireless debugging takes the key, and port 5555 is closed by then.
|
||||
val live = if (savedConnection(app) != null) liveConnectAddress(app) else null
|
||||
if (live != null && acceptsKey(app, live.substringBeforeLast(':').trim('[', ']'), live.substringAfterLast(':').toInt())) return
|
||||
GlobalSettings.turnOnWirelessDebugging(app)
|
||||
loadOrCreateIdentity(app)
|
||||
Kadb.create(LOOPBACK, TCP_PORT, 2_000, 120_000).use { check(it.shell("true").exitCode == 0) }
|
||||
writeAtomically(app, File(app.noBackupFilesDir, HOST_FILE), LOOPBACK.toByteArray())
|
||||
writeAtomically(app, File(app.noBackupFilesDir, CONNECTION_FILE), ByteArray(0))
|
||||
}
|
||||
|
||||
private fun savedConnection(context: Context): SavedConnection? {
|
||||
val directory = context.applicationContext.noBackupFilesDir
|
||||
if (!File(directory, CERT_FILE).isFile || !File(directory, KEY_FILE).isFile) return null
|
||||
@@ -98,17 +78,10 @@ object WirelessAdbFix {
|
||||
fun liveConnectAddress(context: Context): String? {
|
||||
val app = context.applicationContext
|
||||
val saved = savedConnection(app) ?: return null
|
||||
val turnedOn = GlobalSettings.turnOnWirelessDebugging(app)
|
||||
val host = if (':' in saved.host) "[${saved.host}]" else saved.host
|
||||
if (!turnedOn) saved.port?.takeIf { answers(saved.host, it) }?.let { return "$host:$it" }
|
||||
saved.port?.takeIf { answers(saved.host, it) }?.let { return "$host:$it" }
|
||||
val loopback = runCatching { InetAddress.getByName(saved.host).isLoopbackAddress }.getOrDefault(false)
|
||||
// Turning it on can first ask "Allow wireless debugging on this network?", so keep looking while that is answered.
|
||||
val deadline = android.os.SystemClock.elapsedRealtime() + if (turnedOn) NETWORK_PROMPT_MS else 0L
|
||||
var port: Int?
|
||||
do {
|
||||
if (turnedOn) Thread.sleep(WIRELESS_START_MS)
|
||||
port = if (loopback) loopbackAdbPort(app) else findConnectPort(app, saved.host, accept = { answers(saved.host, it) })
|
||||
} while (port == null && android.os.SystemClock.elapsedRealtime() < deadline)
|
||||
val port = if (loopback) loopbackAdbPort(app) else findConnectPort(app, saved.host, accept = { answers(saved.host, it) })
|
||||
port ?: return null
|
||||
saveConnection(app, saved.host, port)
|
||||
return "$host:$port"
|
||||
@@ -132,12 +105,10 @@ object WirelessAdbFix {
|
||||
}
|
||||
}.apply { start() }
|
||||
}.forEach { it.join() }
|
||||
return open.sorted().firstOrNull { port -> acceptsKey(app, LOOPBACK, port) }
|
||||
}
|
||||
|
||||
private fun acceptsKey(app: Context, host: String, port: Int): Boolean {
|
||||
loadOrCreateIdentity(app)
|
||||
return runCatching { Kadb.create(host, port, 1_000, 3_000).use { it.shell("true").exitCode == 0 } }.getOrDefault(false)
|
||||
return open.sorted().firstOrNull { port ->
|
||||
runCatching { Kadb.create(LOOPBACK, port, 1_000, 3_000).use { it.shell("true").exitCode == 0 } }.getOrDefault(false)
|
||||
}
|
||||
}
|
||||
|
||||
private val EPHEMERAL_PORTS = 32768..60999
|
||||
|
||||
@@ -80,20 +80,38 @@ object SteamAppInfo {
|
||||
|
||||
private fun JSONArray?.strings(): List<String> = if (this == null) emptyList() else (0 until length()).map { optString(it) }
|
||||
|
||||
internal fun read(file: File, appId: Int): Info? {
|
||||
if (!file.isFile) return null
|
||||
internal fun read(file: File, appId: Int): Info? = scan(file, appId, unreadable = null, missing = null) { raf, entry ->
|
||||
if (entry.size > 64L * 1024 * 1024) return@scan null
|
||||
val body = ByteArray(entry.size.toInt())
|
||||
raf.readFully(body)
|
||||
val strings = entry.tableAt?.let { readStrings(raf, it) }
|
||||
val kv = ByteBuffer.wrap(body, entry.fixed, body.size - entry.fixed).order(ByteOrder.LITTLE_ENDIAN)
|
||||
val tree = readMap(kv, strings)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val app = (tree["appinfo"] as? Map<String, Any>) ?: tree
|
||||
infoOf(app)
|
||||
}
|
||||
|
||||
fun cached(file: File, appId: Int): Boolean? =
|
||||
runCatching { scan(file, appId, unreadable = null, missing = false) { _, _ -> true } }
|
||||
.onFailure { Log.w(TAG, "appinfo: ${it.javaClass.simpleName}") }
|
||||
.getOrNull()
|
||||
|
||||
private class Entry(val fixed: Int, val tableAt: Long?, val size: Long)
|
||||
|
||||
private fun <T> scan(file: File, appId: Int, unreadable: T, missing: T, found: (RandomAccessFile, Entry) -> T): T {
|
||||
if (!file.isFile) return unreadable
|
||||
RandomAccessFile(file, "r").use { raf ->
|
||||
val head = ByteBuffer.allocate(16).order(ByteOrder.LITTLE_ENDIAN)
|
||||
raf.readFully(head.array(), 0, 8)
|
||||
val magic = head.getInt(0)
|
||||
val version = magic and 0xFF
|
||||
if (magic ushr 8 != 0x075644 || version !in 0x27..0x29) return null
|
||||
var strings: List<String>? = null
|
||||
if (magic ushr 8 != 0x075644 || version !in 0x27..0x29) return unreadable
|
||||
var tableAt: Long? = null
|
||||
var pos = 8L
|
||||
if (version >= 0x29) {
|
||||
raf.readFully(head.array(), 8, 8)
|
||||
val tableAt = head.getLong(8)
|
||||
strings = readStrings(raf, tableAt)
|
||||
tableAt = head.getLong(8)
|
||||
pos = 16L
|
||||
}
|
||||
val fixed = if (version >= 0x28) 4 + 4 + 8 + 20 + 4 + 20 else 4 + 4 + 8 + 20 + 4
|
||||
@@ -103,20 +121,11 @@ object SteamAppInfo {
|
||||
raf.readFully(entry.array(), 0, 8)
|
||||
val id = entry.getInt(0)
|
||||
val size = entry.getInt(4).toLong() and 0xFFFFFFFFL
|
||||
if (id == 0) return null
|
||||
if (id == appId) {
|
||||
if (size > 64L * 1024 * 1024) return null
|
||||
val body = ByteArray(size.toInt())
|
||||
raf.readFully(body)
|
||||
val kv = ByteBuffer.wrap(body, fixed, body.size - fixed).order(ByteOrder.LITTLE_ENDIAN)
|
||||
val tree = readMap(kv, strings)
|
||||
@Suppress("UNCHECKED_CAST")
|
||||
val app = (tree["appinfo"] as? Map<String, Any>) ?: tree
|
||||
return infoOf(app)
|
||||
}
|
||||
if (id == 0) return missing
|
||||
if (id == appId) return found(raf, Entry(fixed, tableAt, size))
|
||||
pos += 8 + size
|
||||
}
|
||||
return null
|
||||
return missing
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,820 +0,0 @@
|
||||
package com.droiddeck.launcher.runtime
|
||||
|
||||
import android.app.ActivityManager
|
||||
import android.app.Service
|
||||
import android.content.ComponentName
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.content.ServiceConnection
|
||||
import android.net.LocalServerSocket
|
||||
import android.net.LocalSocket
|
||||
import android.os.Binder
|
||||
import android.os.Handler
|
||||
import android.os.IBinder
|
||||
import android.os.Looper
|
||||
import android.os.Parcel
|
||||
import android.os.ParcelFileDescriptor
|
||||
import android.os.Process
|
||||
import android.system.ErrnoException
|
||||
import android.system.Os
|
||||
import android.system.OsConstants
|
||||
import android.system.StructPollfd
|
||||
import android.util.Log
|
||||
import org.json.JSONObject
|
||||
import java.io.DataInputStream
|
||||
import java.io.File
|
||||
import java.util.concurrent.CountDownLatch
|
||||
import java.util.concurrent.TimeUnit
|
||||
|
||||
/**
|
||||
* A guest program run as the main process of its own Android process.
|
||||
*
|
||||
* Android counts the processes in an app process's cgroup against its child-process limit, but not
|
||||
* the app processes themselves. The worker execs the program in place; its binder fd stays open
|
||||
* across the exec, so the system keeps the process as a live service process. The program's own
|
||||
* children are still counted. See docs/phantom-processes.md.
|
||||
*/
|
||||
open class GuestWorker : Service() {
|
||||
private val binder = object : Binder() {
|
||||
override fun onTransact(code: Int, data: Parcel, reply: Parcel?, flags: Int): Boolean {
|
||||
if (code != RUN) return super.onTransact(code, data, reply, flags)
|
||||
val argv = data.createStringArray() ?: return false
|
||||
val env = data.createStringArray() ?: return false
|
||||
val fds = List(data.readInt()) { data.readFileDescriptor() }
|
||||
val targets = data.createIntArray() ?: IntArray(fds.size) { it }
|
||||
val fillBinderFd = data.readInt() != 0
|
||||
val go = data.readFileDescriptor()
|
||||
reply?.writeInt(Process.myPid())
|
||||
Handler(Looper.getMainLooper()).post {
|
||||
// The app writes a byte once it has the reply and has taken the launch on: an exec
|
||||
// before then would end this process with the reply undelivered, and with none (the
|
||||
// app gave up and starts the program another way) the program must not run here.
|
||||
var why = ""
|
||||
// poll() with a timeout counts as network I/O to StrictMode on the main thread
|
||||
android.os.StrictMode.setThreadPolicy(android.os.StrictMode.ThreadPolicy.LAX)
|
||||
val committed = runCatching {
|
||||
fun byte(timeout: Int): Int {
|
||||
val poll = StructPollfd().apply { fd = go.fileDescriptor; events = OsConstants.POLLIN.toShort() }
|
||||
val ready = Os.poll(arrayOf(poll), timeout)
|
||||
return (if (ready > 0) Os.read(go.fileDescriptor, ByteArray(1), 0, 1) else -1)
|
||||
.also { why = "poll $ready revents ${poll.revents} read $it" }
|
||||
}
|
||||
// The commit, an answer, and the app's word that it has the answer: the app may
|
||||
// have stopped waiting for it (and started the program another way) meanwhile.
|
||||
// That last word comes, or the app closes its end (a byte or EOF): no timeout,
|
||||
// which could drop a launch the app has already reported as started.
|
||||
byte(GO_TIMEOUT_MS) == 1 && Os.write(go.fileDescriptor, byteArrayOf(1), 0, 1) == 1 && byte(-1) == 1
|
||||
}.getOrElse { why = it.toString(); false }
|
||||
go.close()
|
||||
if (committed) exec(argv, env, fds, targets, fillBinderFd)
|
||||
else {
|
||||
Log.w(TAG, "launch not committed ($why): not running ${argv.firstOrNull()}")
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
}
|
||||
return true
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBind(intent: Intent): IBinder = binder
|
||||
|
||||
private fun exec(argv: Array<String>, env: Array<String>, fds: List<ParcelFileDescriptor?>, targets: IntArray, fillBinderFd: Boolean) {
|
||||
try {
|
||||
val top = targets.maxOrNull() ?: 2
|
||||
val (binderTop, binderFd) = keepBinderOpen(maxOf(BINDER_FDS, top + 1))
|
||||
// Out of the way first, so that placing one fd cannot overwrite another not yet placed.
|
||||
val above = maxOf(MOVED_FDS, top + 1, binderTop + 1)
|
||||
val moved = fds.map { pfd -> pfd?.let { Os.fcntlInt(it.fileDescriptor, OsConstants.F_DUPFD, above) } }
|
||||
moved.forEachIndexed { i, fd ->
|
||||
if (fd == null || i >= targets.size) return@forEachIndexed
|
||||
val source = ParcelFileDescriptor.adoptFd(fd).also { kept.add(it) }.fileDescriptor
|
||||
Os.dup2(source, targets[i])
|
||||
Os.fcntlInt(source, OsConstants.F_SETFD, OsConstants.FD_CLOEXEC)
|
||||
}
|
||||
// A session of its own: in zygote's process group, a program signalling its group
|
||||
// (kill(0, sig)) would reach every process of the app.
|
||||
runCatching { Os.setsid() }
|
||||
// The native hook closes the binder fds in every other process (hook/handoff.c). Only an
|
||||
// app launch asks for the number (a whole argument or variable value), never a guest's.
|
||||
val fill = { arg: String ->
|
||||
if (!fillBinderFd) arg
|
||||
else if (arg == BINDER_FD_TOKEN) binderFd.toString()
|
||||
else if (arg.endsWith("=$BINDER_FD_TOKEN")) arg.removeSuffix(BINDER_FD_TOKEN) + binderFd
|
||||
else arg
|
||||
}
|
||||
// This thread blocks SIGQUIT, SIGUSR1 and SIGPIPE (Android's runtime), and an exec keeps
|
||||
// that: the program's hook sets DDH_SIGMASK instead (none blocked, unless the request says).
|
||||
val mask = if (env.any { it.startsWith("DDH_SIGMASK=") }) emptyList() else listOf("DDH_SIGMASK=0")
|
||||
Os.execve(argv[0], argv.map(fill).toTypedArray(),
|
||||
env.filterNot { it.startsWith("DDH_WORKER_PID=") }.map(fill).toTypedArray() + mask +
|
||||
"DDH_WORKER_PID=${Process.myPid()}")
|
||||
} catch (e: ErrnoException) {
|
||||
Log.e(TAG, "could not exec ${argv.firstOrNull()}", e)
|
||||
}
|
||||
Process.killProcess(Process.myPid())
|
||||
}
|
||||
|
||||
/**
|
||||
* Binder fds stay open across the exec, at [from] or above, where no fd of the program goes.
|
||||
* Returns the highest fd used and the one on /dev/binder, whose closing Android takes for
|
||||
* the death of this process.
|
||||
*/
|
||||
private fun keepBinderOpen(from: Int): Pair<Int, Int> {
|
||||
var highest = from - 1
|
||||
var binder = -1
|
||||
File("/proc/self/fd").listFiles()?.forEach { link ->
|
||||
val target = runCatching { Os.readlink(link.path) }.getOrNull() ?: return@forEach
|
||||
if (target !in BINDER_DEVICES && !target.startsWith("/dev/binderfs/")) return@forEach
|
||||
// A copy, not adoptFd(): some of these fds are owned (fdsan) by a ParcelFileDescriptor.
|
||||
val copy = runCatching { ParcelFileDescriptor.fromFd(link.name.toIntOrNull() ?: return@forEach) }.getOrNull()
|
||||
?: return@forEach
|
||||
val kept = Os.fcntlInt(copy.fileDescriptor, OsConstants.F_DUPFD, from)
|
||||
highest = maxOf(highest, kept)
|
||||
if (target.substringAfterLast('/') == "binder") binder = kept
|
||||
copy.close()
|
||||
}
|
||||
return highest to binder
|
||||
}
|
||||
|
||||
companion object {
|
||||
const val RUN = IBinder.FIRST_CALL_TRANSACTION
|
||||
/** An argument, or a variable's whole value, in an app launch: replaced by the number of its kept binder fd. */
|
||||
const val BINDER_FD_TOKEN = "@DDH_WORKER_BINDER_FD@"
|
||||
// Longer than the app may wait for the hook's "go" (GuestWorkers.ACK_TIMEOUT_MS) before it commits
|
||||
private const val GO_TIMEOUT_MS = 15000
|
||||
private val BINDER_DEVICES = setOf("/dev/binder", "/dev/hwbinder", "/dev/vndbinder")
|
||||
private const val BINDER_FDS = 900
|
||||
private const val MOVED_FDS = 1200
|
||||
private const val TAG = "GuestWorker"
|
||||
private val kept = ArrayList<ParcelFileDescriptor>()
|
||||
|
||||
fun isWorkerProcess(context: Context, process: String?): Boolean =
|
||||
process != null && process.startsWith(context.packageName + ":g") &&
|
||||
process.substring(context.packageName.length + 2).all { it.isDigit() }
|
||||
}
|
||||
}
|
||||
|
||||
class GuestWorker0 : GuestWorker()
|
||||
class GuestWorker1 : GuestWorker()
|
||||
class GuestWorker2 : GuestWorker()
|
||||
class GuestWorker3 : GuestWorker()
|
||||
class GuestWorker4 : GuestWorker()
|
||||
class GuestWorker5 : GuestWorker()
|
||||
class GuestWorker6 : GuestWorker()
|
||||
class GuestWorker7 : GuestWorker()
|
||||
class GuestWorker8 : GuestWorker()
|
||||
class GuestWorker9 : GuestWorker()
|
||||
class GuestWorker10 : GuestWorker()
|
||||
class GuestWorker11 : GuestWorker()
|
||||
class GuestWorker12 : GuestWorker()
|
||||
class GuestWorker13 : GuestWorker()
|
||||
class GuestWorker14 : GuestWorker()
|
||||
class GuestWorker15 : GuestWorker()
|
||||
class GuestWorker16 : GuestWorker()
|
||||
class GuestWorker17 : GuestWorker()
|
||||
class GuestWorker18 : GuestWorker()
|
||||
class GuestWorker19 : GuestWorker()
|
||||
class GuestWorker20 : GuestWorker()
|
||||
class GuestWorker21 : GuestWorker()
|
||||
class GuestWorker22 : GuestWorker()
|
||||
class GuestWorker23 : GuestWorker()
|
||||
class GuestWorker24 : GuestWorker()
|
||||
class GuestWorker25 : GuestWorker()
|
||||
class GuestWorker26 : GuestWorker()
|
||||
class GuestWorker27 : GuestWorker()
|
||||
class GuestWorker28 : GuestWorker()
|
||||
class GuestWorker29 : GuestWorker()
|
||||
class GuestWorker30 : GuestWorker()
|
||||
class GuestWorker31 : GuestWorker()
|
||||
class GuestWorker32 : GuestWorker()
|
||||
class GuestWorker33 : GuestWorker()
|
||||
class GuestWorker34 : GuestWorker()
|
||||
class GuestWorker35 : GuestWorker()
|
||||
class GuestWorker36 : GuestWorker()
|
||||
class GuestWorker37 : GuestWorker()
|
||||
class GuestWorker38 : GuestWorker()
|
||||
class GuestWorker39 : GuestWorker()
|
||||
class GuestWorker40 : GuestWorker()
|
||||
class GuestWorker41 : GuestWorker()
|
||||
class GuestWorker42 : GuestWorker()
|
||||
class GuestWorker43 : GuestWorker()
|
||||
class GuestWorker44 : GuestWorker()
|
||||
class GuestWorker45 : GuestWorker()
|
||||
class GuestWorker46 : GuestWorker()
|
||||
class GuestWorker47 : GuestWorker()
|
||||
class GuestWorker48 : GuestWorker()
|
||||
class GuestWorker49 : GuestWorker()
|
||||
class GuestWorker50 : GuestWorker()
|
||||
class GuestWorker51 : GuestWorker()
|
||||
class GuestWorker52 : GuestWorker()
|
||||
class GuestWorker53 : GuestWorker()
|
||||
class GuestWorker54 : GuestWorker()
|
||||
class GuestWorker55 : GuestWorker()
|
||||
class GuestWorker56 : GuestWorker()
|
||||
class GuestWorker57 : GuestWorker()
|
||||
class GuestWorker58 : GuestWorker()
|
||||
class GuestWorker59 : GuestWorker()
|
||||
class GuestWorker60 : GuestWorker()
|
||||
class GuestWorker61 : GuestWorker()
|
||||
class GuestWorker62 : GuestWorker()
|
||||
class GuestWorker63 : GuestWorker()
|
||||
|
||||
/** The pool of [GuestWorker] processes, and the socket guests ask it through (`droiddeck-spawn`). */
|
||||
object GuestWorkers {
|
||||
private const val TAG = "GuestWorkers"
|
||||
private val classes: List<Class<out GuestWorker>> = listOf(
|
||||
GuestWorker0::class.java, GuestWorker1::class.java, GuestWorker2::class.java,
|
||||
GuestWorker3::class.java, GuestWorker4::class.java, GuestWorker5::class.java,
|
||||
GuestWorker6::class.java, GuestWorker7::class.java, GuestWorker8::class.java,
|
||||
GuestWorker9::class.java, GuestWorker10::class.java, GuestWorker11::class.java,
|
||||
GuestWorker12::class.java, GuestWorker13::class.java, GuestWorker14::class.java,
|
||||
GuestWorker15::class.java, GuestWorker16::class.java, GuestWorker17::class.java,
|
||||
GuestWorker18::class.java, GuestWorker19::class.java, GuestWorker20::class.java,
|
||||
GuestWorker21::class.java, GuestWorker22::class.java, GuestWorker23::class.java,
|
||||
GuestWorker24::class.java, GuestWorker25::class.java, GuestWorker26::class.java,
|
||||
GuestWorker27::class.java, GuestWorker28::class.java, GuestWorker29::class.java,
|
||||
GuestWorker30::class.java, GuestWorker31::class.java, GuestWorker32::class.java,
|
||||
GuestWorker33::class.java, GuestWorker34::class.java, GuestWorker35::class.java,
|
||||
GuestWorker36::class.java, GuestWorker37::class.java, GuestWorker38::class.java,
|
||||
GuestWorker39::class.java, GuestWorker40::class.java, GuestWorker41::class.java,
|
||||
GuestWorker42::class.java, GuestWorker43::class.java, GuestWorker44::class.java,
|
||||
GuestWorker45::class.java, GuestWorker46::class.java, GuestWorker47::class.java,
|
||||
GuestWorker48::class.java, GuestWorker49::class.java, GuestWorker50::class.java,
|
||||
GuestWorker51::class.java, GuestWorker52::class.java, GuestWorker53::class.java,
|
||||
GuestWorker54::class.java, GuestWorker55::class.java, GuestWorker56::class.java,
|
||||
GuestWorker57::class.java, GuestWorker58::class.java, GuestWorker59::class.java,
|
||||
GuestWorker60::class.java, GuestWorker61::class.java, GuestWorker62::class.java,
|
||||
GuestWorker63::class.java,
|
||||
)
|
||||
|
||||
private class Slot(val index: Int) {
|
||||
lateinit var connection: ServiceConnection
|
||||
val connected = CountDownLatch(1)
|
||||
@Volatile var service: IBinder? = null
|
||||
@Volatile var pid = -1
|
||||
@Volatile var guest = false
|
||||
/** The session it runs a program for ([serve]'s number). */
|
||||
@Volatile var session = 0
|
||||
@Volatile var onExit: ((Int) -> Unit)? = null
|
||||
/** Set once its program was handed over: only then does its end count as the program's. */
|
||||
@Volatile var started = false
|
||||
/** Between the pid and the last word of a launch (under the slots lock): its end is held back. */
|
||||
var launching = false
|
||||
/** It ended while launching: reported once the launch turns out to have run, never otherwise. */
|
||||
var endedLaunching = false
|
||||
}
|
||||
|
||||
private val slots = arrayOfNulls<Slot>(classes.size)
|
||||
// Workers bound ahead of need while a session runs: a zygote fork and the bind take about
|
||||
// 60-100 ms, which every program the session starts would otherwise wait for.
|
||||
private val warm = ArrayDeque<Slot>()
|
||||
@Volatile private var warmTarget = 0
|
||||
// Numbers the sessions: an old session's teardown can still be running when the next one starts.
|
||||
@Volatile private var session = 0
|
||||
// The latest session whose teardown has begun
|
||||
@Volatile private var stopped = 0
|
||||
// Held for a launch's last word and for marking a session stopped
|
||||
private val authorizing = Any()
|
||||
private val warming = java.util.concurrent.atomic.AtomicBoolean(false)
|
||||
private const val WARM_WORKERS = 2
|
||||
private const val ACK_TIMEOUT_MS = 5000
|
||||
private const val ANSWER_TIMEOUT_MS = 5000
|
||||
private const val RECEIVE_TIMEOUT_MS = 10000
|
||||
// argv and the environment of one exec, with room: Linux caps them at a quarter of the stack
|
||||
private const val MAX_REQUEST_BYTES = 8 shl 20
|
||||
private const val MAX_RECEIVING = 32
|
||||
private val receiving = java.util.concurrent.atomic.AtomicInteger()
|
||||
private val connections = java.util.concurrent.Executors.newSingleThreadExecutor { Thread(it, "guest-worker-binder").apply { isDaemon = true } }
|
||||
@Volatile private var server: Thread? = null
|
||||
|
||||
/** The app, once [attach] or [serve] ran in its main process; null before. */
|
||||
@Volatile var context: Context? = null
|
||||
private set
|
||||
|
||||
/** Whether the session runs its programs in workers: the native userland, and not turned off. */
|
||||
fun enabled(context: Context): Boolean =
|
||||
android.os.Build.VERSION.SDK_INT >= 30 && com.droiddeck.launcher.session.SessionPrefs.childProcessHandoff(context) &&
|
||||
NativeGuest.enabled(context)
|
||||
|
||||
/** How the running session's root was started: in a worker (true) or counted (false); null with none running. */
|
||||
@Volatile var sessionRootUncounted: Boolean? = null
|
||||
|
||||
/**
|
||||
* Whether Android's child-process limit is out of the session's way: as the running session
|
||||
* started (a proot session, or one whose root fell back to a counted start, is not), else as
|
||||
* the next one would start.
|
||||
*/
|
||||
fun limitHandled(context: Context): Boolean =
|
||||
sessionRootUncounted ?: (NativeGuest.sessionMode != false && enabled(context))
|
||||
|
||||
/** Whether pid is a program running in one of the workers. */
|
||||
fun runsInWorker(pid: Int): Boolean = pid > 0 && synchronized(slots) { slots.any { it != null && it.started && it.pid == pid } }
|
||||
|
||||
fun socketName(context: Context): String = "droiddeck-spawn." + context.packageName + "." + Process.myUid()
|
||||
|
||||
/**
|
||||
* Runs [argv] (a host command line) as the main process of a free worker with [env] and the
|
||||
* fds in [stdio] as its 0, 1 and 2. Returns its pid, or -1. Blocks: not for the main thread.
|
||||
* [onExit] runs once the process is gone.
|
||||
*/
|
||||
fun start(context: Context, argv: List<String>, env: List<String>, stdio: List<ParcelFileDescriptor>, onExit: (Int) -> Unit): Int =
|
||||
start(context, argv, env, stdio, IntArray(stdio.size) { it }, onExit)
|
||||
|
||||
/** As [start], with the fds in [fds] placed at the numbers in [targets]. */
|
||||
fun start(context: Context, argv: List<String>, env: List<String>, fds: List<ParcelFileDescriptor>, targets: IntArray,
|
||||
onExit: (Int) -> Unit): Int = start(context, argv, env, fds, targets, false, onExit)
|
||||
|
||||
/**
|
||||
* [guest]: one of the session's guest programs, which [guestPids] lists and [stopGuests] ends.
|
||||
* [commit] runs with the pid before the worker may run the program; false, and it does not.
|
||||
* [confirmed] runs once the worker has taken it on, just before it is told to run it; false, and it does not.
|
||||
* [owner]: the session asking (the one a guest's request names), else the latest.
|
||||
*/
|
||||
private fun start(context: Context, argv: List<String>, env: List<String>, fds: List<ParcelFileDescriptor>, targets: IntArray,
|
||||
guest: Boolean, onExit: (Int) -> Unit, commit: (Int) -> Boolean = { true },
|
||||
confirmed: () -> Boolean = { true }, owner: Int = session): Int {
|
||||
val app = context.applicationContext
|
||||
if (guest && owner <= stopped) {
|
||||
Log.w(TAG, (if (owner == 0) "a request naming no session" else "session $owner is stopping") +
|
||||
": not starting ${argv.firstOrNull()}")
|
||||
return -1
|
||||
}
|
||||
val slot = takeWarm() ?: bind(app)?.takeIf { fresh ->
|
||||
fresh.connected.await(10, TimeUnit.SECONDS).also { if (!it) release(app, fresh) }
|
||||
} ?: run {
|
||||
Log.w(TAG, "no worker started for ${argv.firstOrNull()}")
|
||||
return -1
|
||||
}
|
||||
slot.guest = guest
|
||||
slot.session = owner
|
||||
slot.onExit = onExit
|
||||
refill(app)
|
||||
// The worker execs once a byte comes through this socket: after the reply has reached us, so
|
||||
// that its exec does not cut the reply off, and after the slot is marked started. Closed
|
||||
// without one, the worker ends without running the program (the caller starts it another way).
|
||||
// It answers with a byte of its own: without that it gave up waiting, and nothing runs.
|
||||
var go: Array<ParcelFileDescriptor>? = null
|
||||
var data: Parcel? = Parcel.obtain()
|
||||
val reply = Parcel.obtain()
|
||||
try {
|
||||
go = ParcelFileDescriptor.createSocketPair()
|
||||
data!!.writeStringArray(argv.toTypedArray())
|
||||
data.writeStringArray(env.toTypedArray())
|
||||
data.writeInt(fds.size)
|
||||
fds.forEach { data.writeFileDescriptor(it.fileDescriptor) }
|
||||
data.writeIntArray(targets)
|
||||
data.writeInt(if (guest) 0 else 1)
|
||||
data.writeFileDescriptor(go[0].fileDescriptor)
|
||||
slot.service!!.transact(GuestWorker.RUN, data, reply, 0)
|
||||
// The worker has its own copy: with ours closed (and the request's, which holds one too),
|
||||
// a worker that gave up leaves no reader
|
||||
data.recycle()
|
||||
data = null
|
||||
go[0].close()
|
||||
val pid = reply.readInt()
|
||||
// Once a session's teardown has begun (stopGuests), none of its programs may start: it
|
||||
// would not find them.
|
||||
val stopping = { guest && owner <= stopped }
|
||||
if (stopping() || !commit(pid)) {
|
||||
Log.w(TAG, "worker ${slot.index}: ${argv.firstOrNull()} was not taken on")
|
||||
release(app, slot)
|
||||
return -1
|
||||
}
|
||||
// launching, not started yet: an end before the last word is reported only if the launch ran
|
||||
val live = synchronized(slots) {
|
||||
(slots[slot.index] === slot && !stopping()).also { if (it) { slot.pid = pid; slot.launching = true } }
|
||||
}
|
||||
if (!live) {
|
||||
Log.w(TAG, "worker ${slot.index} ended, or its session is stopping, before running ${argv.firstOrNull()}")
|
||||
release(app, slot)
|
||||
return -1
|
||||
}
|
||||
Os.write(go[1].fileDescriptor, byteArrayOf(1), 0, 1)
|
||||
val answer = StructPollfd().apply { fd = go[1].fileDescriptor; events = OsConstants.POLLIN.toShort() }
|
||||
// then the word to run it: given only here, once its answer is in, so that a worker whose
|
||||
// answer came too late never runs a program this call reports as not started. [confirmed]
|
||||
// goes first: a caller that hears nothing runs the program itself, so it must have heard
|
||||
// before the worker may run it (an app dying in between loses the program, not doubles it).
|
||||
// The word and a teardown's start exclude each other: a launch is authorized before stopGuests()
|
||||
// marks the session stopped, and is then stopped with the pids it takes (guestPids lists a
|
||||
// launching slot), or never.
|
||||
val answered = Os.poll(arrayOf(answer), ANSWER_TIMEOUT_MS) > 0 && Os.read(go[1].fileDescriptor, ByteArray(1), 0, 1) == 1
|
||||
val accepted = answered && synchronized(authorizing) {
|
||||
!stopping() && confirmed() && Os.write(go[1].fileDescriptor, byteArrayOf(1), 0, 1) == 1
|
||||
}
|
||||
val endedRunning = synchronized(slots) {
|
||||
slot.launching = false
|
||||
if (accepted && !slot.endedLaunching) slot.started = true
|
||||
accepted && slot.endedLaunching
|
||||
}
|
||||
if (!accepted) {
|
||||
Log.w(TAG, "worker ${slot.index} did not take ${argv.firstOrNull()} on")
|
||||
release(app, slot)
|
||||
return -1
|
||||
}
|
||||
// it ran and was already gone by now: its end, once
|
||||
if (endedRunning) reportEnd(app, slot)
|
||||
} catch (e: Exception) {
|
||||
Log.w(TAG, "worker ${slot.index} refused ${argv.firstOrNull()}", e)
|
||||
synchronized(slots) { slot.launching = false }
|
||||
release(app, slot)
|
||||
return -1
|
||||
} finally {
|
||||
data?.recycle()
|
||||
reply.recycle()
|
||||
go?.forEach { runCatching { it.close() } }
|
||||
}
|
||||
Log.i(TAG, "worker ${slot.index} (pid ${slot.pid}) runs ${argv.lastOrNull { !it.startsWith("-") }}")
|
||||
return slot.pid
|
||||
}
|
||||
|
||||
/** Binds a free worker; its [Slot.connected] opens once it is up. Null when all are in use. */
|
||||
private fun bind(app: Context): Slot? {
|
||||
val slot = synchronized(slots) {
|
||||
val index = slots.indexOfFirst { it == null }
|
||||
if (index < 0) {
|
||||
Log.w(TAG, "all ${slots.size} workers are busy")
|
||||
return null
|
||||
}
|
||||
Slot(index).also { slots[index] = it }
|
||||
}
|
||||
slot.connection = object : ServiceConnection {
|
||||
override fun onServiceConnected(name: ComponentName, binder: IBinder) {
|
||||
slot.service = binder
|
||||
slot.connected.countDown()
|
||||
}
|
||||
|
||||
override fun onServiceDisconnected(name: ComponentName) = release(app, slot)
|
||||
|
||||
override fun onBindingDied(name: ComponentName) = release(app, slot)
|
||||
}
|
||||
// Callbacks off the main thread: start() waits for onServiceConnected, and a caller holding a
|
||||
// lock the main thread is waiting for (PulseAudio's launch) would otherwise wait out the timeout.
|
||||
val bound = runCatching {
|
||||
app.bindService(Intent(app, classes[slot.index]), Context.BIND_AUTO_CREATE or Context.BIND_IMPORTANT,
|
||||
connections, slot.connection)
|
||||
}.onFailure { Log.w(TAG, "worker ${slot.index} could not be bound", it) }.getOrDefault(false)
|
||||
if (!bound) {
|
||||
release(app, slot)
|
||||
return null
|
||||
}
|
||||
return slot
|
||||
}
|
||||
|
||||
private fun takeWarm(): Slot? = synchronized(slots) {
|
||||
while (warm.isNotEmpty()) {
|
||||
val slot = warm.removeFirst()
|
||||
if (slots[slot.index] === slot && slot.service?.isBinderAlive == true) return slot
|
||||
}
|
||||
null
|
||||
}
|
||||
|
||||
/** Brings the warm workers back up to [warmTarget], one at a time, off the caller's thread. */
|
||||
private fun refill(app: Context) {
|
||||
if (warmTarget == 0 || !warming.compareAndSet(false, true)) return
|
||||
Thread({
|
||||
try {
|
||||
while (true) {
|
||||
val missing = warmTarget - synchronized(slots) { warm.size }
|
||||
if (missing <= 0) break
|
||||
// all at once: the zygote forks them in parallel
|
||||
val fresh = (1..missing).mapNotNull { bind(app) }
|
||||
if (fresh.isEmpty()) break
|
||||
for (slot in fresh) {
|
||||
if (!slot.connected.await(10, TimeUnit.SECONDS)) {
|
||||
release(app, slot)
|
||||
continue
|
||||
}
|
||||
// decided once, under the lock: kept warm, or released
|
||||
val kept = synchronized(slots) {
|
||||
(slots[slot.index] === slot && warmTarget > 0).also { if (it) warm.addLast(slot) }
|
||||
}
|
||||
if (!kept) release(app, slot)
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
warming.set(false)
|
||||
}
|
||||
}, "guest-worker-warm").apply { isDaemon = true; start() }
|
||||
}
|
||||
|
||||
private fun release(app: Context, slot: Slot) {
|
||||
var report = false
|
||||
val removed = synchronized(slots) {
|
||||
warm.remove(slot)
|
||||
if (slot.launching) slot.endedLaunching = true else report = slot.started
|
||||
(slots[slot.index] === slot).also { if (it) slots[slot.index] = null }
|
||||
}
|
||||
if (!removed) return
|
||||
runCatching { app.unbindService(slot.connection) }
|
||||
if (report) reportEnd(app, slot)
|
||||
}
|
||||
|
||||
private fun reportEnd(app: Context, slot: Slot) {
|
||||
val onExit = slot.onExit ?: return
|
||||
Thread({ onExit(exitStatus(app, slot.pid)) }, "guest-worker-exit").start()
|
||||
}
|
||||
|
||||
/** The worker's exit as a wait status (exit code << 8, or the signal), -1 when unknown. */
|
||||
private fun exitStatus(app: Context, pid: Int): Int {
|
||||
if (pid <= 0 || android.os.Build.VERSION.SDK_INT < 30) return -1
|
||||
val am = app.getSystemService(ActivityManager::class.java)
|
||||
var recorded = false
|
||||
repeat(20) {
|
||||
am.getHistoricalProcessExitReasons(app.packageName, pid, 1).firstOrNull()?.let {
|
||||
recorded = true
|
||||
// an exit code only when the process exited itself; a signal number otherwise (a native crash)
|
||||
if (it.reason == android.app.ApplicationExitInfo.REASON_EXIT_SELF) return (it.status and 0xff) shl 8
|
||||
if (it.status in 1..64) return it.status and 0x7f
|
||||
// Android records the death first and the zygote's status later (as UNKNOWN, 0, then
|
||||
// EXIT_SELF): a reason without a status may still be completed
|
||||
if (it.reason != android.app.ApplicationExitInfo.REASON_UNKNOWN) return OsConstants.SIGKILL
|
||||
}
|
||||
Thread.sleep(50)
|
||||
}
|
||||
// killed by Android with no signal recorded, not a clean exit
|
||||
return if (recorded) OsConstants.SIGKILL else -1
|
||||
}
|
||||
|
||||
/** The pids of session [of]'s guest programs running in workers. */
|
||||
fun guestPids(of: Int = session): List<Int> =
|
||||
synchronized(slots) { slots.mapNotNull { s -> s?.takeIf { it.guest && it.session == of }?.pid?.takeIf { it > 0 } } }
|
||||
|
||||
/** Ends session [of]'s guest programs that are still running, and, for the latest session, the warm workers. */
|
||||
fun stopGuests(of: Int = session) {
|
||||
// the check and the reset together: a new session's serve() may be under way
|
||||
val drained = synchronized(authorizing) {
|
||||
synchronized(slots) {
|
||||
stopped = maxOf(stopped, of)
|
||||
if (of != session) emptyList() else { warmTarget = 0; warm.toList().also { warm.clear() } }
|
||||
}
|
||||
}
|
||||
context?.let { app -> drained.forEach { release(app, it) } }
|
||||
val pids = guestPids(of)
|
||||
if (pids.isEmpty()) return
|
||||
pids.forEach { Process.sendSignal(it, OsConstants.SIGTERM) }
|
||||
Thread.sleep(500)
|
||||
pids.forEach { Process.killProcess(it) }
|
||||
}
|
||||
|
||||
/** Listens for `droiddeck-spawn` requests from the session's guests. */
|
||||
fun attach(context: Context) {
|
||||
this.context = context.applicationContext
|
||||
}
|
||||
|
||||
/** Starts a session's use of the workers (and the spawn socket, once); returns its number. */
|
||||
fun serve(context: Context): Int {
|
||||
val app = context.applicationContext
|
||||
this.context = app
|
||||
val number = synchronized(slots) { warmTarget = WARM_WORKERS; ++session }
|
||||
refill(app)
|
||||
synchronized(this) {
|
||||
if (server != null) return number
|
||||
server = Thread({
|
||||
val socket = try {
|
||||
LocalServerSocket(socketName(app))
|
||||
} catch (e: Exception) {
|
||||
Log.e(TAG, "no spawn socket", e)
|
||||
synchronized(this) { server = null }
|
||||
return@Thread
|
||||
}
|
||||
while (true) {
|
||||
val client = runCatching { socket.accept() }.getOrNull()
|
||||
if (client == null) {
|
||||
Thread.sleep(100) // out of fds, for one: do not spin
|
||||
continue
|
||||
}
|
||||
// A bounded number of requests still coming in: a stalled sender holds a thread
|
||||
if (receiving.incrementAndGet() > MAX_RECEIVING) {
|
||||
receiving.decrementAndGet()
|
||||
Log.w(TAG, "$MAX_RECEIVING spawn requests are still coming in: refusing another")
|
||||
runCatching { client.close() }
|
||||
continue
|
||||
}
|
||||
Thread({
|
||||
try {
|
||||
handle(app, client) { receiving.decrementAndGet() }
|
||||
} catch (e: Throwable) {
|
||||
Log.w(TAG, "spawn request failed", e)
|
||||
}
|
||||
}, "guest-spawn").start()
|
||||
}
|
||||
}, "guest-spawn-server").apply { isDaemon = true; start() }
|
||||
}
|
||||
return number
|
||||
}
|
||||
|
||||
private fun handle(app: Context, client: LocalSocket, received: () -> Unit) {
|
||||
var receiving = true
|
||||
val done = { if (receiving) { receiving = false; received() } }
|
||||
try {
|
||||
handleRequest(app, client, done)
|
||||
} finally {
|
||||
done()
|
||||
}
|
||||
}
|
||||
|
||||
private fun handleRequest(app: Context, client: LocalSocket, received: () -> Unit) {
|
||||
client.use {
|
||||
if (client.peerCredentials.uid != Process.myUid()) return
|
||||
// The whole request and its fds within this, however slowly they come (the wait for a
|
||||
// program's exit is not): each read gets what is left of it
|
||||
val deadline = android.os.SystemClock.elapsedRealtime() + RECEIVE_TIMEOUT_MS
|
||||
fun left() {
|
||||
val ms = deadline - android.os.SystemClock.elapsedRealtime()
|
||||
if (ms <= 0) throw java.net.SocketTimeoutException("spawn request not received in time")
|
||||
client.soTimeout = ms.toInt()
|
||||
}
|
||||
val input = DataInputStream(client.inputStream)
|
||||
val fds = ArrayList<ParcelFileDescriptor>()
|
||||
fun take() {
|
||||
val received = client.ancillaryFileDescriptors.orEmpty()
|
||||
try {
|
||||
received.forEach { fds.add(ParcelFileDescriptor.dup(it)) }
|
||||
} finally {
|
||||
received.forEach { runCatching { Os.close(it) } }
|
||||
}
|
||||
}
|
||||
// fds can come with any read, the request's own bytes too: each read's are taken at once
|
||||
fun fill(bytes: ByteArray) {
|
||||
var got = 0
|
||||
while (got < bytes.size) {
|
||||
left()
|
||||
val n = input.read(bytes, got, bytes.size - got)
|
||||
take()
|
||||
if (n < 0) throw java.io.EOFException("spawn request ended at $got of ${bytes.size} bytes")
|
||||
got += n
|
||||
}
|
||||
}
|
||||
// Until start() has them: closed on every way out before that, from the first byte on
|
||||
var handedOver = false
|
||||
try {
|
||||
val length = ByteArray(4).also { fill(it) }.let { java.nio.ByteBuffer.wrap(it).int }
|
||||
if (length !in 1..MAX_REQUEST_BYTES) {
|
||||
Log.w(TAG, "spawn request of $length bytes refused")
|
||||
return
|
||||
}
|
||||
val payload = ByteArray(length).also { fill(it) }
|
||||
val request = JSONObject(String(payload))
|
||||
if (request.has("fdchunks")) {
|
||||
// The hook sends its fds after the request, a chunk with each byte (hook/handoff.c)
|
||||
val total = (request.optJSONArray("fds")?.length() ?: 0) + (if (request.has("table")) 1 else 0)
|
||||
while (fds.size < total) {
|
||||
left()
|
||||
if (input.read() < 0) throw java.io.EOFException("fds ended at ${fds.size} of $total")
|
||||
take()
|
||||
}
|
||||
} else {
|
||||
take()
|
||||
}
|
||||
received()
|
||||
val argv = request.getJSONArray("argv").let { a -> List(a.length()) { a.getString(it) } }
|
||||
val env = LinkedHashMap<String, String>()
|
||||
request.optJSONObject("env")?.let { o -> o.keys().forEach { env[it] = o.getString(it) } }
|
||||
request.optJSONArray("envlist")?.let { a ->
|
||||
for (i in 0 until a.length()) a.getString(i).split('=', limit = 2).let { if (it.size == 2) env[it[0]] = it[1] }
|
||||
}
|
||||
// What the hook told the program that asked (it may run in a worker itself) is not this one's
|
||||
env.keys.removeAll { it.startsWith("DDH_") }
|
||||
val cwd = request.optString("cwd", "/")
|
||||
val wait = request.optBoolean("wait", false)
|
||||
// A path without a slash names a file in the cwd, as execve() takes it, not one on PATH
|
||||
val file = request.optString("file", "").let { if (it.isNotEmpty() && '/' !in it) "./$it" else it }
|
||||
// The handoff table (the hook's) comes last among the fds; the rest go to these numbers.
|
||||
val tableIndex = request.optInt("table", -1)
|
||||
val numbers = request.optJSONArray("fds")?.let { a -> IntArray(a.length()) { a.getInt(it) } } ?: IntArray(3) { it }
|
||||
val table = fds.getOrNull(tableIndex)?.takeIf { pfd ->
|
||||
runCatching { Os.readlink("/proc/self/fd/${pfd.fd}") }.getOrNull()?.contains("ddnatv-handoff") == true
|
||||
}
|
||||
val slot = request.optInt("slot", -1)
|
||||
val parent = request.optInt("parent", -1)
|
||||
var programFds = fds.filterIndexed { i, _ -> i != tableIndex }
|
||||
var targets = numbers
|
||||
if (table != null && slot >= 0) {
|
||||
// The program reports its own exit status into the table (hook/handoff.c)
|
||||
val tableFd = (numbers.maxOrNull() ?: 2) + 1
|
||||
programFds = programFds + table
|
||||
targets = numbers + tableFd
|
||||
env["DDH_TABLE"] = "$tableFd:$slot:$parent:${request.optInt("child", -1)}"
|
||||
}
|
||||
val root = env["DDNATV_ROOT"]?.let(::File)
|
||||
val out = client.outputStream
|
||||
if (root == null || argv.isEmpty()) {
|
||||
out.write("error no guest root or program\n".toByteArray())
|
||||
return
|
||||
}
|
||||
val shell = listOf("/usr/bin/bash", "/bin/bash").first { File(root, it.removePrefix("/")).isFile }
|
||||
val args = if (file.isNotEmpty()) {
|
||||
listOf("-c", "unset DDH_WRAPPER; cd -- \"\$1\" 2>/dev/null; a=\$2; f=\$3; shift 3; exec -a \"\$a\" \"\$f\" \"\$@\"",
|
||||
"droiddeck-spawn", cwd, argv[0], file) + argv.drop(1)
|
||||
} else {
|
||||
listOf("-c", "unset DDH_WRAPPER; cd -- \"\$1\" 2>/dev/null; shift; exec \"\$@\"", "droiddeck-spawn", cwd) + argv
|
||||
}
|
||||
val command = NativeGuest.command(root, shell, args)
|
||||
env["DDNATV_REAL_EXE"] = File(root, shell.removePrefix("/")).path
|
||||
// The hook restores these in the program (tools/nativeguest/hook/handoff.c).
|
||||
if (request.has("sigign")) env["DDH_SIGIGN"] = request.getLong("sigign").toString()
|
||||
if (request.has("nofile")) {
|
||||
env["DDH_NOFILE"] = request.getLong("nofile").toString() +
|
||||
(if (request.has("nofilemax")) ":" + request.getLong("nofilemax") else "")
|
||||
}
|
||||
if (request.has("umask")) env["DDH_UMASK"] = request.getLong("umask").toString()
|
||||
if (request.has("pgid")) env["DDH_PGID"] = request.getLong("pgid").toString()
|
||||
if (request.has("anchor")) env["DDH_ANCHOR"] = request.getLong("anchor").toString()
|
||||
if (request.has("pstart")) env["DDH_PSTART"] = request.getLong("pstart").toString()
|
||||
if (request.has("astart")) env["DDH_ASTART"] = request.getLong("astart").toString()
|
||||
env["DDH_SIGMASK"] = request.optLong("sigmask", 0L).toString()
|
||||
// The shell above: the hook restores nothing there (bash changes its own signal mask),
|
||||
// only in the program it execs, which no longer has this.
|
||||
env["DDH_WRAPPER"] = "1"
|
||||
val child = request.optInt("child", -1)
|
||||
val exited = CountDownLatch(1)
|
||||
var status = -1
|
||||
var worker = -1
|
||||
// The hook answers the pid with "go" (ack): without it (it died, or gave up and runs the
|
||||
// program itself) the worker must not run it too.
|
||||
val ack = request.optBoolean("ack", false)
|
||||
var answered = false
|
||||
// the hook's last word, sent once the worker has taken the program on and before it runs it
|
||||
var confirmedToHook = false
|
||||
// The session whose guest asks, not the latest: a new session can start (serve()) while an
|
||||
// older one's guests are still sending, and that older one's teardown must find its programs.
|
||||
// A request that names none is refused (start() runs nothing for session 0): the hook and
|
||||
// droiddeck-spawn always name it, and which session's it is cannot be told otherwise.
|
||||
val owner = request.optInt("session", 0).coerceAtLeast(0)
|
||||
val pid = start(app, command, env.map { (k, v) -> "$k=$v" }, programFds, targets, true, owner = owner, onExit = { code ->
|
||||
status = code
|
||||
if (table != null && slot >= 0) reportExit(table, slot, code, parent, child, worker)
|
||||
exited.countDown()
|
||||
}, confirmed = {
|
||||
!ack || runCatching {
|
||||
out.write("ok\n".toByteArray())
|
||||
out.flush()
|
||||
confirmedToHook = true
|
||||
}.isSuccess
|
||||
}, commit = { started ->
|
||||
worker = started
|
||||
if (!ack) return@start true
|
||||
runCatching {
|
||||
out.write("pid $started\n".toByteArray())
|
||||
out.flush()
|
||||
answered = true
|
||||
client.soTimeout = ACK_TIMEOUT_MS
|
||||
// the whole line: a hook whose write stopped short treats it as failed and runs the program itself
|
||||
val line = StringBuilder()
|
||||
var ended = false
|
||||
while (!ended) {
|
||||
val c = input.read()
|
||||
if (c < 0) break
|
||||
if (c == '\n'.code) ended = true else line.append(c.toChar())
|
||||
}
|
||||
ended && line.toString() == "go"
|
||||
}.getOrDefault(false)
|
||||
})
|
||||
handedOver = true
|
||||
programFds.filter { it !== table }.forEach { runCatching { it.close() } }
|
||||
if (pid <= 0) table?.let { runCatching { it.close() } }
|
||||
if (!answered) {
|
||||
out.write(if (pid > 0) "pid $pid\n".toByteArray() else "error no worker\n".toByteArray())
|
||||
out.flush()
|
||||
} else if (!confirmedToHook) {
|
||||
// nothing runs it in a worker: the hook runs it itself
|
||||
runCatching { out.write("error not started\n".toByteArray()); out.flush() }
|
||||
}
|
||||
if (pid > 0 && wait) {
|
||||
exited.await()
|
||||
// droiddeck-spawn exits with this: an exit code, or 128 plus the signal
|
||||
val code = if (status < 0) 1 else if (status and 0x7f == 0) (status shr 8) and 0xff else 128 + (status and 0x7f)
|
||||
out.write("exit $code\n".toByteArray())
|
||||
out.flush()
|
||||
}
|
||||
} finally {
|
||||
if (!handedOver) fds.forEach { runCatching { it.close() } }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Layout of the hook's table (tools/nativeguest/hook/handoff.c): a 64-byte header, then 64-byte
|
||||
// entries of int32 child, real, parent, state, ..., and at 32 the app's report: int32 status, child.
|
||||
// The report is one 8-byte write tagged with the child it is for; only the hook changes an
|
||||
// entry's state, so a report that lands after the entry went to another child is ignored there.
|
||||
private fun reportExit(table: ParcelFileDescriptor, slot: Int, status: Int, parent: Int, child: Int, worker: Int) {
|
||||
runCatching {
|
||||
val entry = 64L + slot * 64L
|
||||
val head = java.nio.ByteBuffer.allocate(16).order(java.nio.ByteOrder.nativeOrder())
|
||||
Os.pread(table.fileDescriptor, head, entry)
|
||||
val real = head.getInt(4)
|
||||
val state = head.getInt(12)
|
||||
// Also while the hook holds the entry (TAKEN) or has already guessed its end (EXITED):
|
||||
// the report is for this child only, and wins over the timeout's guess (ddh_status)
|
||||
if (head.getInt(0) != child || head.getInt(8) != parent || (real != 0 && real != worker) || state !in 1..4)
|
||||
return@runCatching
|
||||
// An exit Android has no record of is reported as a failure, not as a signal.
|
||||
val report = java.nio.ByteBuffer.allocate(8).order(java.nio.ByteOrder.nativeOrder())
|
||||
.putInt(0, if (status < 0) 1 shl 8 else status).putInt(4, child)
|
||||
Os.pwrite(table.fileDescriptor, report, entry + 32)
|
||||
if (parent > 0) Process.sendSignal(parent, OsConstants.SIGCHLD)
|
||||
}.onFailure { Log.w(TAG, "could not report an exit to the guest's parent", it) }
|
||||
runCatching { table.close() }
|
||||
}
|
||||
}
|
||||
@@ -114,7 +114,7 @@ object GameEnvironmentStore {
|
||||
) {
|
||||
publishGameCores(context)
|
||||
val stored = config ?: read(context)
|
||||
val resolved = GameEnvironment.withKnownGames(stored).copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared)
|
||||
val resolved = stored.copy(shared = GameEnvironment.defaults(SessionPrefs.fexPreset(context), SessionPrefs.forceSsbs(context)) + stored.shared)
|
||||
val json = encode(resolved)
|
||||
val dxvk = TextureFiltering.dxvkOptions(
|
||||
SessionPrefs.textureAnisotropy(context), SessionPrefs.textureLodBias(context),
|
||||
|
||||
@@ -59,18 +59,13 @@ object GameStorage {
|
||||
return when {
|
||||
pref == SessionPrefs.GAME_STORAGE_OFF -> null
|
||||
pref.isEmpty() -> options(context).firstOrNull()?.let { Option(it.name, it.path) }
|
||||
else -> reachable(pref).let { path -> Option(SessionPrefs.gameStorageLabel(context), path).takeIf { attached(File(path)) } }
|
||||
else -> Option(SessionPrefs.gameStorageLabel(context), pref).takeIf { attached(File(pref)) }
|
||||
}
|
||||
}
|
||||
|
||||
fun disconnected(context: Context): Boolean {
|
||||
val pref = SessionPrefs.gameStorage(context)
|
||||
return pref.isNotEmpty() && pref != SessionPrefs.GAME_STORAGE_OFF && !attached(File(reachable(pref)))
|
||||
}
|
||||
|
||||
internal fun reachable(path: String, usable: (File) -> Boolean = { it.isDirectory && it.canWrite() }): String {
|
||||
val alias = UsbLink.storagePath(path)
|
||||
return if (alias != path && !usable(File(path)) && usable(File(alias))) alias else path
|
||||
return pref.isNotEmpty() && pref != SessionPrefs.GAME_STORAGE_OFF && !attached(File(pref))
|
||||
}
|
||||
|
||||
internal fun attached(
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.droiddeck.launcher.session
|
||||
import android.content.Context
|
||||
import android.util.Log
|
||||
import com.droiddeck.launcher.agent.AgentGuest
|
||||
import com.droiddeck.launcher.frontend.SteamAppInfo
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import java.io.File
|
||||
|
||||
@@ -63,6 +64,9 @@ object OfflineMode {
|
||||
fun active(context: Context): Boolean =
|
||||
offline(enabled(context), isOnline(context), auto(context))
|
||||
|
||||
fun lacksAppInfo(context: Context, appId: Int): Boolean =
|
||||
active(context) && SteamAppInfo.cached(SteamAppInfo.appinfoFile(context), appId) == false
|
||||
|
||||
@Synchronized
|
||||
fun setEnabled(context: Context, on: Boolean) {
|
||||
write(context, LinuxRuntime.rootDir(context), on)
|
||||
|
||||
@@ -46,16 +46,7 @@ object SecondaryLibrary {
|
||||
}
|
||||
|
||||
fun privateRoot(files: File, library: File): File {
|
||||
val own = privateDir(files, library.canonicalPath)
|
||||
if (own.exists()) return own
|
||||
val raw = UsbLink.rawPath(library.absolutePath)
|
||||
val alias = if (raw != library.absolutePath) raw else UsbLink.storagePath(library.absolutePath)
|
||||
if (alias == library.absolutePath) return own
|
||||
return privateDir(files, runCatching { File(alias).canonicalPath }.getOrDefault(alias)).takeIf { it.exists() } ?: own
|
||||
}
|
||||
|
||||
private fun privateDir(files: File, path: String): File {
|
||||
val digest = MessageDigest.getInstance("SHA-256").digest(path.toByteArray())
|
||||
val digest = MessageDigest.getInstance("SHA-256").digest(library.canonicalPath.toByteArray())
|
||||
.joinToString("") { "%02x".format(it.toInt() and 255) }
|
||||
return File(files, "steam-libraries/$digest")
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ object SessionFiles {
|
||||
"usr/local/bin/kwin_wayland_wrapper" to "usr/local/bin/kwin_wayland_wrapper",
|
||||
"usr/lib/firefox/defaults/pref/droiddeck.js" to "usr/lib/firefox/defaults/pref/droiddeck.js",
|
||||
"etc/xdg/autostart/droiddeck-clipboard.desktop" to "etc/xdg/autostart/droiddeck-clipboard.desktop",
|
||||
"usr/share/applications/droiddeck-return-gaming.desktop" to "usr/share/applications/droiddeck-return-gaming.desktop",
|
||||
"etc/xdg/fastfetch/config.jsonc" to "etc/xdg/fastfetch/config.jsonc",
|
||||
)
|
||||
|
||||
@@ -130,8 +129,6 @@ object SessionFiles {
|
||||
"usr/local/bin/droiddeck-agent" to "usr/local/bin/droiddeck-agent",
|
||||
"usr/local/bin/steam-compatibility" to "usr/local/bin/steam-compatibility",
|
||||
"usr/local/bin/droiddeck-clipboard" to "usr/local/bin/droiddeck-clipboard",
|
||||
"usr/local/bin/droiddeck-spawn" to "usr/local/bin/droiddeck-spawn",
|
||||
"usr/local/bin/droiddeck-log-writer" to "usr/local/bin/droiddeck-log-writer",
|
||||
"usr/local/bin/droiddeck-desktop-clipboard" to "usr/local/bin/droiddeck-desktop-clipboard",
|
||||
"usr/local/bin/droiddeck-gpu-window" to "usr/local/bin/droiddeck-gpu-window",
|
||||
"usr/local/bin/droiddeck-steam-install" to "usr/local/bin/droiddeck-steam-install",
|
||||
|
||||
@@ -1100,9 +1100,6 @@ object SessionPrefs {
|
||||
|
||||
fun nativeUserland(context: Context): Boolean = prefs(context).getBoolean("nativeUserland", true)
|
||||
|
||||
/** The session's long-lived programs run in worker processes Android does not count (GuestWorkers). */
|
||||
fun childProcessHandoff(context: Context): Boolean = prefs(context).getBoolean("childProcessHandoff", true)
|
||||
|
||||
fun setNativeUserland(context: Context, on: Boolean) {
|
||||
prefs(context).edit().putBoolean("nativeUserland", on).apply()
|
||||
}
|
||||
|
||||
@@ -705,20 +705,6 @@ class SessionService : Service() {
|
||||
if (com.droiddeck.launcher.gpu.Lossless.owned(this)) guest.add("DD_LOSSLESS_OWNED=1")
|
||||
}
|
||||
guest.add("DD_LAUNCH_DIR=" + sessionRoot.path)
|
||||
// this session's worker number: the shared field may be a newer session's by the time it is used
|
||||
var ownWorkers = 0
|
||||
if (com.droiddeck.launcher.runtime.GuestWorkers.enabled(this)) {
|
||||
// Under the lock a stop takes its number with: a stop either comes first (and this session
|
||||
// starts no workers) or owns them
|
||||
ownWorkers = synchronized(stopLock) {
|
||||
if (gen != sessionGen || !SessionState.running) 0
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.serve(this).also { guestWorkerSession = it }
|
||||
}
|
||||
if (ownWorkers > 0) {
|
||||
guest.add("DD_SPAWN=" + com.droiddeck.launcher.runtime.GuestWorkers.socketName(this))
|
||||
guest.add("DD_SPAWN_SESSION=$ownWorkers")
|
||||
}
|
||||
}
|
||||
// Proton builds up to 11.12 report X11 text fields under this name.
|
||||
guest.add("BL_LAUNCH_DIR=" + sessionRoot.path)
|
||||
GameStorage.effective(this)?.let { guest.add("DD_LIBRARY_LABEL=" + it.label.replace('"', ' ')) }
|
||||
@@ -877,10 +863,10 @@ class SessionService : Service() {
|
||||
watchLaunchRequests(sessionRoot)
|
||||
watchSyncWanted(root)
|
||||
EsyncPacks.fetchInBackground(this, root)
|
||||
val pid = SessionEvents.step("guest-launch") { HostProcess.startUncounted(line, hostEnv.asArray(), root, { status ->
|
||||
val pid = SessionEvents.step("guest-launch") { HostProcess.start(line, hostEnv.asArray(), root, { status ->
|
||||
if (gen != sessionGen) {
|
||||
Log.i(TAG, "an earlier session's process ended ($status); the current one carries on")
|
||||
return@startUncounted
|
||||
return@start
|
||||
}
|
||||
val program = programStatus(sessionRoot)
|
||||
Log.i(TAG, "session ended: $status" + if (program != null) " (program $program)" else "")
|
||||
@@ -896,13 +882,10 @@ class SessionService : Service() {
|
||||
syncWatcher = null
|
||||
}
|
||||
abandonStart(gen, sessionDir, started)
|
||||
val workers = ownWorkers
|
||||
if (pid > 1) Thread({ teardown(pid, workerSession = workers) }, "session-teardown").start()
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workers)
|
||||
if (pid > 1) Thread({ teardown(pid) }, "session-teardown").start()
|
||||
return
|
||||
}
|
||||
sessionPid = pid
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.sessionRootUncounted = com.droiddeck.launcher.runtime.GuestWorkers.runsInWorker(pid)
|
||||
if (pid > 1) {
|
||||
raiseTracer(pid, gen)
|
||||
SessionEvents.guestStarted(pid)
|
||||
@@ -1552,15 +1535,10 @@ class SessionService : Service() {
|
||||
return binds
|
||||
}
|
||||
|
||||
// The workers' session number of the session running now (GuestWorkers.serve)
|
||||
@Volatile private var guestWorkerSession = 0
|
||||
|
||||
private fun teardown(prootPid: Int, expectedStartTime: Long? = null, workerSession: Int = guestWorkerSession) {
|
||||
private fun teardown(prootPid: Int, expectedStartTime: Long? = null) {
|
||||
fun stillSameProcess(): Boolean = expectedStartTime == null || readStat(prootPid)?.second == expectedStartTime
|
||||
if (!stillSameProcess()) return
|
||||
// The session's programs that run in worker processes are not descendants of its root.
|
||||
val workers = if (expectedStartTime == null) com.droiddeck.launcher.runtime.GuestWorkers.guestPids(workerSession) else emptyList()
|
||||
val tree = descendants(prootPid) + workers.flatMap { pid -> listOfNotNull(readStat(pid)?.let { Pair(pid, it.second) }) + descendants(pid) }
|
||||
val tree = descendants(prootPid)
|
||||
if (!stillSameProcess()) return
|
||||
saveWineRegistries(tree)
|
||||
android.os.Process.sendSignal(prootPid, 15)
|
||||
@@ -1577,7 +1555,6 @@ class SessionService : Service() {
|
||||
killed++
|
||||
}
|
||||
if (killed > 0) Log.i(TAG, "swept $killed process(es) proot left behind")
|
||||
if (expectedStartTime == null) com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workerSession)
|
||||
}
|
||||
|
||||
private fun clearCachedApps() {
|
||||
@@ -2348,16 +2325,12 @@ class SessionService : Service() {
|
||||
return
|
||||
}
|
||||
completeNativeSleep()
|
||||
var workers = 0
|
||||
val (ended, endedArch) = synchronized(stopLock) {
|
||||
if (gen != null && gen != sessionGen) return
|
||||
// as it is when running is cleared: startup registers its workers under this lock too
|
||||
workers = guestWorkerSession
|
||||
cancelQueuedSteamGame()
|
||||
gameExitWatchToken++
|
||||
// also when startup stopped before the guest ran
|
||||
com.droiddeck.launcher.runtime.NativeGuest.sessionMode = null
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.sessionRootUncounted = null
|
||||
if (!SessionState.running) return
|
||||
if (relaunch) SessionState.confirmRelaunchStop()
|
||||
SessionEvents.record("guest.exited", mapOf("status" to status))
|
||||
@@ -2418,8 +2391,7 @@ class SessionService : Service() {
|
||||
if (prootPid > 1 && steamClientMayRun) askSteamToExit(prootPid)
|
||||
com.droiddeck.launcher.stores.gog.GogComet.end(stoppedSession)
|
||||
auxiliary.forEach { (pid, started) -> teardown(pid, started) }
|
||||
if (prootPid > 1) teardown(prootPid, workerSession = workers)
|
||||
else com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workers)
|
||||
if (prootPid > 1) teardown(prootPid)
|
||||
killGuestLeftovers(ended)
|
||||
pruneSystemVulkanRuntime()
|
||||
finishSessionStop(status, stoppedGen, collectEnded)
|
||||
@@ -2428,7 +2400,6 @@ class SessionService : Service() {
|
||||
} else {
|
||||
Thread({ pruneSystemVulkanRuntime() }, "system-vulkan-prune").start()
|
||||
Thread({
|
||||
com.droiddeck.launcher.runtime.GuestWorkers.stopGuests(workers)
|
||||
com.droiddeck.launcher.stores.gog.GogComet.end(stoppedSession)
|
||||
finishSessionStop(status, stoppedGen, collectEnded)
|
||||
if (launcherEnded) importLauncherGames()
|
||||
|
||||
@@ -121,8 +121,6 @@ object StoresState {
|
||||
var unfinished by mutableStateOf<List<StoreInstallRoot.Unfinished>>(emptyList())
|
||||
internal set
|
||||
|
||||
var steamPicking by mutableStateOf<CatalogItem?>(null)
|
||||
|
||||
fun isUnfinished(item: CatalogItem): Boolean = unfinished.any {
|
||||
it.store == item.store && (it.id == item.id || (it.id == null && it.folder.name == StoreInstallRoot.folderName(item.title, item.id)))
|
||||
}
|
||||
|
||||
@@ -7,7 +7,6 @@ import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.AddedGames
|
||||
import com.droiddeck.launcher.runtime.BattleNet
|
||||
import com.droiddeck.launcher.runtime.LinuxRuntime
|
||||
import com.droiddeck.launcher.session.GameStorage
|
||||
import com.droiddeck.launcher.stores.CatalogItem
|
||||
import com.droiddeck.launcher.stores.InstalledStoreGame
|
||||
import com.droiddeck.launcher.stores.Store
|
||||
@@ -131,13 +130,13 @@ object BattleNetClient {
|
||||
StoresState.post { opener?.invoke(args) }
|
||||
}
|
||||
|
||||
fun library(context: Context, root: File? = preferred(context)): List<String> =
|
||||
root?.let { AddedGames.guestPath(context, StoreInstallRoot.storeDir(it, Store.BATTLENET)) }?.let { listOf("--library", it) }.orEmpty()
|
||||
fun library(context: Context, root: File = preferred(context)): List<String> =
|
||||
AddedGames.guestPath(context, StoreInstallRoot.storeDir(root, Store.BATTLENET))?.let { listOf("--library", it) }.orEmpty()
|
||||
|
||||
internal fun preferred(context: Context): File? {
|
||||
internal fun preferred(context: Context): File {
|
||||
val second = StoreInstallRoot.libraryRoot(context)?.absolutePath
|
||||
return StoreInstallRoot.targets(context).firstOrNull { it.root.absolutePath == second && (it.root.isDirectory || it.root.mkdirs()) }?.root
|
||||
?: StoreInstallRoot.internalRoot(context).takeIf { second == null && !GameStorage.disconnected(context) }
|
||||
?: StoreInstallRoot.internalRoot(context)
|
||||
}
|
||||
|
||||
fun installGame(context: Context, uid: String, root: File) {
|
||||
|
||||
@@ -6,6 +6,9 @@ import android.net.Uri
|
||||
import android.util.Log
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.StringRes
|
||||
import androidx.compose.runtime.getValue
|
||||
import androidx.compose.runtime.mutableStateOf
|
||||
import androidx.compose.runtime.setValue
|
||||
import com.droiddeck.launcher.R
|
||||
import com.droiddeck.launcher.frontend.Library
|
||||
import com.droiddeck.launcher.session.SessionService
|
||||
@@ -43,6 +46,8 @@ internal object SteamStore {
|
||||
/** InvalidPassword, AccessDenied, AccountNotFound, Revoked, Expired, AccountLogonDenied. */
|
||||
private val REFUSALS = setOf(5, 15, 18, 26, 27, 63)
|
||||
|
||||
var picking by mutableStateOf<CatalogItem?>(null)
|
||||
|
||||
class Plan(val installDir: String, val downloadBytes: Long, val installBytes: Long, val buildId: String, val linuxBuild: Boolean) {
|
||||
companion object {
|
||||
fun of(json: JSONObject): Plan? {
|
||||
@@ -217,7 +222,7 @@ internal object SteamStore {
|
||||
toast(context, R.string.steam_store_close_steam)
|
||||
return
|
||||
}
|
||||
StoresState.steamPicking = item
|
||||
picking = item
|
||||
}
|
||||
|
||||
fun install(context: Context, item: CatalogItem, target: SteamClient.Target) {
|
||||
|
||||
@@ -46,7 +46,6 @@ import androidx.compose.ui.platform.testTag
|
||||
import com.droiddeck.launcher.agent.AgentSetup.Status
|
||||
import com.droiddeck.launcher.agent.AgentSetup.Step
|
||||
import com.droiddeck.launcher.core.WirelessAdbPairingService
|
||||
import com.droiddeck.launcher.session.QuestExperimental
|
||||
|
||||
@Composable
|
||||
internal fun AgentSetupView(modifier: Modifier, firstControl: Modifier = Modifier, onDone: () -> Unit = {}) {
|
||||
@@ -105,16 +104,11 @@ internal fun AgentSetupView(modifier: Modifier, firstControl: Modifier = Modifie
|
||||
var keyOpen by rememberSaveable(harness.id) { mutableStateOf(false) }
|
||||
val (title, hint) = labels(step, harness.name, keyed)
|
||||
val lab = AgentHost.lab?.takeIf { it.prepare && it.running }
|
||||
val questConnection = step == Step.CONNECTION && status != Status.DONE && QuestExperimental.isSupported()
|
||||
val detail = when {
|
||||
step == Step.PREPARE && lab != null ->
|
||||
stringResource(R.string.agent_prepare_progress, lab.permille / 10, clock(lab.etaSeconds.toLong().coerceAtLeast(0)))
|
||||
keyed && status == Status.DONE && AgentSetup.detail[step] == null ->
|
||||
harness.providers.filter { it.id in AgentSetup.keys }.joinToString(" · ") { it.name }.ifEmpty { stringResource(R.string.agent_step_free_models) }
|
||||
// The Quest hint holds the one-time commands, so it stays under the status until the step passes.
|
||||
questConnection -> AgentSetup.detail[step]?.let { "$it\n$hint" } ?: hint
|
||||
// The Quest hint is setup instructions; once connected, the row says what it is for.
|
||||
step == Step.CONNECTION && QuestExperimental.isSupported() -> AgentSetup.detail[step] ?: stringResource(R.string.agent_step_connection_hint)
|
||||
else -> AgentSetup.detail[step] ?: hint
|
||||
}
|
||||
// Shown while the sign-in is pending, so it is still there after a trip to the browser for the key.
|
||||
@@ -127,7 +121,6 @@ internal fun AgentSetupView(modifier: Modifier, firstControl: Modifier = Modifie
|
||||
Status.TODO, Status.FAILED -> CheckState.WARN
|
||||
},
|
||||
title, detail, divider = index < steps.lastIndex && !showKey,
|
||||
detailLines = if (questConnection) Int.MAX_VALUE else 2,
|
||||
) {
|
||||
val blocked = (step in setOf(Step.SIGN_IN, Step.GITHUB, Step.BUILD_TOOLS) && AgentSetup.status[Step.INSTALL] != Status.DONE) ||
|
||||
(step == Step.PREPARE && AgentSetup.status[Step.BUILD_TOOLS] != Status.DONE)
|
||||
@@ -265,9 +258,7 @@ internal fun agentStorageWarning(item: AgentStorage.Item) = when (item) {
|
||||
|
||||
@Composable
|
||||
private fun labels(step: Step, harness: String, keyed: Boolean = false): Pair<String, String> = when (step) {
|
||||
Step.CONNECTION -> stringResource(R.string.agent_step_connection) to
|
||||
if (QuestExperimental.isSupported()) stringResource(R.string.agent_step_connection_quest_hint, LocalContext.current.packageName)
|
||||
else stringResource(R.string.agent_step_connection_hint)
|
||||
Step.CONNECTION -> stringResource(R.string.agent_step_connection) to stringResource(R.string.agent_step_connection_hint)
|
||||
Step.INSTALL -> stringResource(R.string.agent_step_install, harness) to stringResource(R.string.agent_step_install_hint)
|
||||
Step.SIGN_IN -> stringResource(R.string.agent_step_sign_in, harness) to stringResource(if (keyed) R.string.agent_step_sign_in_key_hint else R.string.agent_step_sign_in_hint)
|
||||
Step.GITHUB -> stringResource(R.string.agent_step_github) to stringResource(R.string.agent_step_github_hint)
|
||||
@@ -276,7 +267,7 @@ private fun labels(step: Step, harness: String, keyed: Boolean = false): Pair<St
|
||||
}
|
||||
|
||||
private fun action(step: Step): Int = when (step) {
|
||||
Step.CONNECTION -> if (QuestExperimental.isSupported()) R.string.agent_action_allow else R.string.agent_action_pair
|
||||
Step.CONNECTION -> R.string.agent_action_pair
|
||||
Step.INSTALL -> R.string.agent_action_install
|
||||
Step.SIGN_IN, Step.GITHUB -> R.string.agent_action_sign_in
|
||||
Step.BUILD_TOOLS -> R.string.agent_action_install
|
||||
@@ -285,7 +276,6 @@ private fun action(step: Step): Int = when (step) {
|
||||
|
||||
/** The pairing DroidDeck already uses for the phantom process fix; the agent reuses its key. */
|
||||
private fun pair(context: android.content.Context) {
|
||||
if (QuestExperimental.isSupported()) return AgentSetup.trustOnDevice(context)
|
||||
if (!WirelessAdbPairingService.notificationsEnabled(context)) {
|
||||
context.startActivity(android.content.Intent(android.provider.Settings.ACTION_APP_NOTIFICATION_SETTINGS)
|
||||
.putExtra(android.provider.Settings.EXTRA_APP_PACKAGE, context.packageName)
|
||||
|
||||
@@ -847,7 +847,7 @@ private fun FrontEndScreenBody(s: FrontEndState, a: FrontEndActions, page: (@Com
|
||||
com.droiddeck.launcher.stores.StoresState.pendingInstall?.let { item -> StoreTheme(item.store) { InstallWhere(item) } }
|
||||
com.droiddeck.launcher.stores.StoresState.itchPicking?.let { item -> StoreTheme(item.store) { ItchBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.itchPicking = null } } }
|
||||
com.droiddeck.launcher.stores.StoresState.gameJoltPicking?.let { item -> StoreTheme(item.store) { GameJoltBuildPicker(item) { com.droiddeck.launcher.stores.StoresState.gameJoltPicking = null } } }
|
||||
com.droiddeck.launcher.stores.StoresState.steamPicking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.StoresState.steamPicking = null } } }
|
||||
com.droiddeck.launcher.stores.steam.SteamStore.picking?.let { item -> StoreTheme(item.store) { SteamInstallWhereDialog(item) { com.droiddeck.launcher.stores.steam.SteamStore.picking = null } } }
|
||||
StepsLayer(screenAt)
|
||||
UiZooSheet()
|
||||
SessionDrawerPreview(s.secondScreenDisplays)
|
||||
|
||||
@@ -103,7 +103,7 @@ internal object SetupTabs {
|
||||
}
|
||||
|
||||
@Composable
|
||||
internal fun CheckRow(state: CheckState, title: String, detail: String?, divider: Boolean = true, detailLines: Int = 2, action: (@Composable () -> Unit)? = null) {
|
||||
internal fun CheckRow(state: CheckState, title: String, detail: String?, divider: Boolean = true, action: (@Composable () -> Unit)? = null) {
|
||||
val colors = MaterialTheme.colorScheme
|
||||
val pal = LocalPalette.current
|
||||
val tint = when (state) {
|
||||
@@ -135,7 +135,7 @@ internal fun CheckRow(state: CheckState, title: String, detail: String?, divider
|
||||
}
|
||||
Column(modifier = Modifier.weight(1f)) {
|
||||
Text(title, fontSize = 15.sp, fontWeight = FontWeight.SemiBold, color = colors.onBackground)
|
||||
if (detail != null) Text(detail, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = detailLines, overflow = TextOverflow.Ellipsis)
|
||||
if (detail != null) Text(detail, fontSize = 13.sp, color = colors.onSurfaceVariant, maxLines = 2, overflow = TextOverflow.Ellipsis)
|
||||
}
|
||||
if (action != null) action()
|
||||
}
|
||||
@@ -398,8 +398,7 @@ internal fun SetupPanel(
|
||||
listOfNotNull(
|
||||
gpu.displayName(ctx),
|
||||
s.installed?.let { stringResource(R.string.setup_ready_runtime, it) },
|
||||
stringResource(R.string.setup_ready_limit_off)
|
||||
.takeIf { !limitBlocks && s.phantomProcessStatus != PhantomProcessStatus.UNCOUNTED },
|
||||
stringResource(R.string.setup_ready_limit_off).takeIf { !limitBlocks },
|
||||
s.offlineAccount?.takeIf { it.isNotEmpty() }?.let { stringResource(R.string.setup_ready_signed_in, it) },
|
||||
).joinToString(" · "),
|
||||
open = showChecks, onDetails = { showChecks = !showChecks },
|
||||
|
||||
@@ -174,15 +174,14 @@ private fun InputSettingsContent(onBack: () -> Unit, onChanged: () -> Unit, embe
|
||||
detail = if (library.usersOfBindings(b.id).size > 1) stringResource(R.string.input_shared_detail, b.name, library.usersOfBindings(b.id).size)
|
||||
else "${profile.name} · ${roleLabel(role)}", onSave = { action ->
|
||||
if (update { l ->
|
||||
val currentPreset = l.preset(editing.preset)
|
||||
val geometry = if (!editing.click && elementProperties != null && layout != null) l.withLayout(layout.copy(elements = layout.elements.map {
|
||||
if (it.id == elementProperties!!.id) elementProperties!!.copy(name = elementProperties!!.name.trim().ifBlank { it.name }) else it
|
||||
})) else l
|
||||
geometry.withPreset(when {
|
||||
editing.element != null && editing.click -> currentPreset.copy(clicks = currentPreset.clicks + (editing.element.id to action))
|
||||
editing.element != null -> currentPreset.copy(elements = currentPreset.elements + (editing.element.id to action))
|
||||
editing.key != null -> currentPreset.copy(keys = currentPreset.keys.filterNot { it.key == editing.key } + PhysicalInputBinding(editing.key, action))
|
||||
else -> currentPreset.copy(controls = currentPreset.controls + (editing.control to action))
|
||||
editing.element != null && editing.click -> b.copy(clicks = b.clicks + (editing.element.id to action))
|
||||
editing.element != null -> b.copy(elements = b.elements + (editing.element.id to action))
|
||||
editing.key != null -> b.copy(keys = b.keys.filterNot { it.key == editing.key } + PhysicalInputBinding(editing.key, action))
|
||||
else -> b.copy(controls = b.controls + (editing.control to action))
|
||||
}) }) edit = null
|
||||
})
|
||||
} else if (!surface) key(page, profileId, role) {
|
||||
|
||||
@@ -1265,11 +1265,6 @@
|
||||
<string name="agent_action_prepare">تحضير</string>
|
||||
<string name="agent_connection_off">تعذّر الوصول إلى تصحيح الأخطاء اللاسلكي؛ زر الاقتران يشغّله</string>
|
||||
<string name="agent_action_pair">اقتران</string>
|
||||
<string name="agent_step_connection_quest_hint">لا يحتوي Quest على شاشة اقتران. من حاسوب، شغّل مرة واحدة: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS و adb tcpip 5555. ثم اضغط «السماح» واقبل الطلب في النظارة</string>
|
||||
<string name="agent_action_allow">السماح</string>
|
||||
<string name="agent_connection_quest_waiting">اقبل «السماح بتصحيح الأخطاء؟» في النظارة مع تحديد «السماح دائمًا»</string>
|
||||
<string name="agent_connection_quest_failed">تعذّر الاتصال. اقبل طلب تصحيح الأخطاء في النظارة، وإن لم يظهر، شغّل adb tcpip 5555 من حاسوب ثم حاول مجددًا</string>
|
||||
<string name="agent_connection_quest_off">تعذّر الوصول إلى تصحيح الأخطاء اللاسلكي. اضغط «السماح» لإعداده من جديد</string>
|
||||
<string name="agent_action_install">تثبيت</string>
|
||||
<string name="agent_action_sign_in">تسجيل الدخول</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2550,8 +2545,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s إذا لم يكن ذلك ممكنًا، وصِّل هذا الجهاز بكمبيوتر يستخدم ADB ونفِّذ الأمر أدناه. عُد إلى هنا وتحقَّق مرة أخرى.</string>
|
||||
<string name="phantom_instructions_off">يمكن بدء جلسات Steam.</string>
|
||||
<string name="phantom_instructions_not_applicable">لا يستخدم إصدار Android هذا هذا الحدّ.</string>
|
||||
<string name="phantom_title_uncounted">يتولى DroidDeck حد العمليات الفرعية</string>
|
||||
<string name="phantom_instructions_uncounted">يشغّل DroidDeck برامج الجلسة في عمليات لا يحتسبها Android، لذا يمكن إبقاء خيارات المطوّرين متوقفة.</string>
|
||||
<string name="phantom_fix_toggle">فعِّل «إيقاف القيود المفروضة على العمليات الثانوية» في خيارات المطوّرين، واترك خيارات المطوّرين مفعَّلة بعد ذلك.</string>
|
||||
<string name="phantom_fix_no_toggle">لا يحتوي إصدار Android هذا على مفتاح لذلك. استخدِم تصحيح الأخطاء اللاسلكي لتغييره من هذا الجهاز.</string>
|
||||
<string name="upd_block_no_apk">لا يتوفّر تنزيل لهذا الإصدار الخاص بهذه النسخة من DroidDeck.</string>
|
||||
@@ -4317,4 +4310,5 @@
|
||||
<string name="steam_store_linux_build">تثبّت هذه اللعبة إصدار Linux الخاص بها. ثبّتها من Steam.</string>
|
||||
<string name="game_zoom_title">تكبير اللعبة</string>
|
||||
<string name="game_zoom_hint">اضبط تكبير اللعبة من 100% إلى 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam في وضع عدم الاتصال ولم يحمّل %1$s بعد. اتصل بالإنترنت في Steam مرة واحدة لتشغيلها.</string>
|
||||
</resources>
|
||||
@@ -1280,11 +1280,6 @@
|
||||
<string name="agent_action_prepare">Preparar</string>
|
||||
<string name="agent_connection_off">No se puede acceder a la depuración inalámbrica; Vincular la activa</string>
|
||||
<string name="agent_action_pair">Vincular</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest no tiene pantalla de vinculación. Desde una computadora, ejecuta una vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS y adb tcpip 5555. Luego toca Permitir y acepta el aviso en el visor</string>
|
||||
<string name="agent_action_allow">Permitir</string>
|
||||
<string name="agent_connection_quest_waiting">Acepta «¿Permitir depuración?» en el visor, con Permitir siempre marcado</string>
|
||||
<string name="agent_connection_quest_failed">No se pudo conectar. Acepta el aviso de depuración en el visor o, si no apareció, ejecuta adb tcpip 5555 desde una computadora y vuelve a intentarlo</string>
|
||||
<string name="agent_connection_quest_off">No se puede acceder a la depuración inalámbrica. Toca Permitir para configurarla de nuevo</string>
|
||||
<string name="agent_action_install">Instalar</string>
|
||||
<string name="agent_action_sign_in">Iniciar sesión</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2542,8 +2537,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Si no es posible, conecta este dispositivo a una computadora con ADB y ejecuta el comando de abajo. Después vuelve aquí y comprueba de nuevo.</string>
|
||||
<string name="phantom_instructions_off">Ya se pueden iniciar sesiones de Steam.</string>
|
||||
<string name="phantom_instructions_not_applicable">Esta versión de Android no usa este límite.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck gestiona el límite de procesos secundarios</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck ejecuta los programas de la sesión en procesos que Android no cuenta, así que las Opciones de desarrollador pueden quedar desactivadas.</string>
|
||||
<string name="phantom_fix_toggle">Activa “Inhabilitar restricciones de procesos secundarios” en Opciones de desarrollador y deja activadas las Opciones de desarrollador después.</string>
|
||||
<string name="phantom_fix_no_toggle">Esta versión de Android no tiene un interruptor para ello. Usa la Depuración inalámbrica para cambiarlo desde este dispositivo.</string>
|
||||
<string name="upd_block_no_apk">Esta versión no tiene descarga para esta copia de DroidDeck.</string>
|
||||
@@ -4195,4 +4188,5 @@
|
||||
<string name="steam_store_close_steam">Cierra Steam primero</string>
|
||||
<string name="steam_store_session_wait">Pausa primero la descarga de Steam</string>
|
||||
<string name="steam_store_linux_build">Este juego instala su versión para Linux. Instálalo desde Steam.</string>
|
||||
<string name="game_steam_offline_uncached">Steam está en modo sin conexión y todavía no cargó %1$s. Conéctate en Steam una vez para jugarlo.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Подготви</string>
|
||||
<string name="agent_connection_off">Безжичното отстраняване на грешки не е достъпно; сдвояването го включва</string>
|
||||
<string name="agent_action_pair">Сдвой</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest няма екран за сдвояване. От компютър изпълнете веднъж: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS и adb tcpip 5555. След това докоснете „Разреши“ и приемете запитването в шлема</string>
|
||||
<string name="agent_action_allow">Разреши</string>
|
||||
<string name="agent_connection_quest_waiting">Приемете „Разрешаване на отстраняването на грешки?“ в шлема с отметка „Винаги разрешавай“</string>
|
||||
<string name="agent_connection_quest_failed">Неуспешно свързване. Приемете запитването за отстраняване на грешки в шлема, а ако не се е появило, изпълнете adb tcpip 5555 от компютър и опитайте отново</string>
|
||||
<string name="agent_connection_quest_off">Безжичното отстраняване на грешки не е достъпно. Докоснете „Разреши“, за да го настроите отново</string>
|
||||
<string name="agent_action_install">Инсталирай</string>
|
||||
<string name="agent_action_sign_in">Влез</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Ако това не е възможно, свържи устройството с компютър с ADB и изпълни командата отдолу. Върни се тук и провери отново.</string>
|
||||
<string name="phantom_instructions_off">Сесиите на Steam могат да стартират.</string>
|
||||
<string name="phantom_instructions_not_applicable">Тази версия на Android не използва това ограничение.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck се справя с ограничението за дъщерни процеси</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck изпълнява програмите на сесията в процеси, които Android не отчита, така че опциите за програмисти могат да останат изключени.</string>
|
||||
<string name="phantom_fix_toggle">Включи „Деактивиране на ограниченията за дъщерните процеси“ в Опции за програмисти и остави Опции за програмисти включени след това.</string>
|
||||
<string name="phantom_fix_no_toggle">Тази версия на Android няма превключвател за това. Използвай безжично отстраняване на грешки, за да го промениш от това устройство.</string>
|
||||
<string name="upd_block_no_apk">Тази версия няма изтегляне за това копие на DroidDeck.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Тази игра инсталира версията си за Linux. Инсталирайте я от Steam.</string>
|
||||
<string name="game_zoom_title">Мащабиране на играта</string>
|
||||
<string name="game_zoom_hint">Регулирайте увеличението на играта от 100% до 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam е в офлайн режим и още не е заредил %1$s. Свържете Steam онлайн веднъж, за да я играете.</string>
|
||||
</resources>
|
||||
@@ -1257,11 +1257,6 @@
|
||||
<string name="agent_action_prepare">Připravit</string>
|
||||
<string name="agent_connection_off">Bezdrátové ladění není dostupné; Spárovat ho zapne</string>
|
||||
<string name="agent_action_pair">Spárovat</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest nemá obrazovku párování. Z počítače jednou spusťte: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS a adb tcpip 5555. Pak klepněte na Povolit a potvrďte výzvu v headsetu</string>
|
||||
<string name="agent_action_allow">Povolit</string>
|
||||
<string name="agent_connection_quest_waiting">V headsetu potvrďte „Povolit ladění?“ se zaškrtnutým Vždy povolit</string>
|
||||
<string name="agent_connection_quest_failed">Nepodařilo se připojit. Potvrďte výzvu k ladění v headsetu, a pokud se neobjevila, spusťte z počítače adb tcpip 5555 a zkuste to znovu</string>
|
||||
<string name="agent_connection_quest_off">Bezdrátové ladění není dostupné. Klepnutím na Povolit ho nastavíte znovu</string>
|
||||
<string name="agent_action_install">Instalovat</string>
|
||||
<string name="agent_action_sign_in">Přihlásit se</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2498,8 +2493,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Pokud to není možné, připojte toto zařízení k počítači s ADB a spusťte příkaz níže. Vraťte se sem a zkontrolujte to znovu.</string>
|
||||
<string name="phantom_instructions_off">Relace Steamu se mohou spouštět.</string>
|
||||
<string name="phantom_instructions_not_applicable">Tato verze Androidu tento limit nepoužívá.</string>
|
||||
<string name="phantom_title_uncounted">Limit podřízených procesů řeší DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck spouští programy relace v procesech, které Android nezapočítává, takže možnosti pro vývojáře mohou zůstat vypnuté.</string>
|
||||
<string name="phantom_fix_toggle">Zapněte „Deaktivace omezení podřízených procesů“ v Možnostech pro vývojáře a pak je nechte zapnuté.</string>
|
||||
<string name="phantom_fix_no_toggle">Tato verze Androidu pro to nemá přepínač. Použijte bezdrátové ladění a změňte to z tohoto zařízení.</string>
|
||||
<string name="upd_block_no_apk">Toto sestavení nemá stažení pro tuto kopii DroidDecku.</string>
|
||||
@@ -4237,4 +4230,5 @@
|
||||
<string name="steam_store_linux_build">Tato hra instaluje svou verzi pro Linux. Nainstalujte ji ze Steamu.</string>
|
||||
<string name="game_zoom_title">Přiblížení hry</string>
|
||||
<string name="game_zoom_hint">Nastavte zvětšení hry od 100 % do 300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam je v režimu offline a %1$s ještě nenačetl. Jednou se ve Steamu připojte online, abyste ji mohli hrát.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Forbered</string>
|
||||
<string name="agent_connection_off">Trådløs fejlfinding kan ikke nås; Par slår den til</string>
|
||||
<string name="agent_action_pair">Par</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest har ingen parringsskærm. Kør én gang fra en computer: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS og adb tcpip 5555. Tryk derefter på Tillad, og godkend prompten i headsettet</string>
|
||||
<string name="agent_action_allow">Tillad</string>
|
||||
<string name="agent_connection_quest_waiting">Godkend “Tillad fejlretning?” i headsettet med Tillad altid markeret</string>
|
||||
<string name="agent_connection_quest_failed">Kunne ikke oprette forbindelse. Godkend fejlretningsprompten i headsettet, eller kør adb tcpip 5555 fra en computer og prøv igen, hvis den ikke dukkede op</string>
|
||||
<string name="agent_connection_quest_off">Trådløs fejlretning kan ikke nås. Tryk på Tillad for at konfigurere den igen</string>
|
||||
<string name="agent_action_install">Installer</string>
|
||||
<string name="agent_action_sign_in">Log ind</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Hvis det ikke er muligt, så forbind enheden til en computer med ADB, og køre kommandoen nedenfor. Kom tilbage hertil, og tjek igen.</string>
|
||||
<string name="phantom_instructions_off">Steam-sessioner kan starte.</string>
|
||||
<string name="phantom_instructions_not_applicable">Denne Android-version bruger ikke denne grænse.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck håndterer grænsen for underprocesser</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck kører sessionens programmer i processer, som Android ikke tæller med, så Indstillinger for udviklere kan forblive slået fra.</string>
|
||||
<string name="phantom_fix_toggle">Tænd „Deaktiver begrænsningerne for underprocesser“ i Udvikleremuligheder, og lad Udvikleremuligheder være tændt bagefter.</string>
|
||||
<string name="phantom_fix_no_toggle">Denne Android-version har ingen kontakt til det. Brug Trådløs fejlretning til at ændre det fra denne enhed.</string>
|
||||
<string name="upd_block_no_apk">Denne version har ingen download til denne kopi af DroidDeck.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Dette spil installerer sin Linux-version. Installer det fra Steam.</string>
|
||||
<string name="game_zoom_title">Spilzoom</string>
|
||||
<string name="game_zoom_hint">Juster spillets forstørrelse fra 100 % til 300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam er i offlinetilstand og har ikke indlæst %1$s endnu. Gå online i Steam én gang for at spille det.</string>
|
||||
</resources>
|
||||
@@ -1241,11 +1241,6 @@
|
||||
<string name="agent_action_prepare">Vorbereiten</string>
|
||||
<string name="agent_connection_off">Wireless-Debugging ist nicht erreichbar; Koppeln schaltet es ein</string>
|
||||
<string name="agent_action_pair">Koppeln</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest hat keinen Kopplungsbildschirm. Führe einmal an einem Computer aus: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS und adb tcpip 5555. Tippe dann auf Zulassen und bestätige die Abfrage im Headset</string>
|
||||
<string name="agent_action_allow">Zulassen</string>
|
||||
<string name="agent_connection_quest_waiting">Bestätige „Debugging zulassen?“ im Headset mit aktiviertem „Immer zulassen“</string>
|
||||
<string name="agent_connection_quest_failed">Verbindung fehlgeschlagen. Bestätige die Debugging-Abfrage im Headset. Falls keine erschienen ist, führe adb tcpip 5555 an einem Computer aus und versuche es erneut</string>
|
||||
<string name="agent_connection_quest_off">Kabelloses Debugging ist nicht erreichbar. Tippe auf Zulassen, um es neu einzurichten</string>
|
||||
<string name="agent_action_install">Installieren</string>
|
||||
<string name="agent_action_sign_in">Anmelden</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2438,8 +2433,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Falls das nicht möglich ist, verbinde dieses Gerät per ADB mit einem Computer und führe den Befehl unten aus. Kehre dann hierher zurück und prüfe erneut.</string>
|
||||
<string name="phantom_instructions_off">Steam-Sitzungen können starten.</string>
|
||||
<string name="phantom_instructions_not_applicable">Diese Android-Version nutzt dieses Limit nicht.</string>
|
||||
<string name="phantom_title_uncounted">Limit für untergeordnete Prozesse übernimmt DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck führt die Programme der Sitzung in Prozessen aus, die Android nicht mitzählt, daher können die Entwickleroptionen ausgeschaltet bleiben.</string>
|
||||
<string name="phantom_fix_toggle">Aktiviere „Beschränkungen für Unterprozesse deaktivieren“ in den Entwickleroptionen und lass die Entwickleroptionen danach aktiviert.</string>
|
||||
<string name="phantom_fix_no_toggle">Diese Android-Version hat dafür keinen Schalter. Nutze Debugging über WLAN, um es auf diesem Gerät zu ändern.</string>
|
||||
<string name="upd_block_no_apk">Dieser Build hat keinen Download für diese DroidDeck-Installation.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Dieses Spiel installiert seine Linux-Version. Installiere es über Steam.</string>
|
||||
<string name="game_zoom_title">Spielzoom</string>
|
||||
<string name="game_zoom_hint">Spielvergrößerung von 100 % bis 300 % anpassen</string>
|
||||
<string name="game_steam_offline_uncached">Steam ist im Offlinemodus und hat %1$s noch nicht geladen. Gehe einmal in Steam online, um es zu spielen.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Προετοιμασία</string>
|
||||
<string name="agent_connection_off">Η ασύρματη αποσφαλμάτωση δεν είναι προσβάσιμη · η Σύζευξη την ενεργοποιεί</string>
|
||||
<string name="agent_action_pair">Σύζευξη</string>
|
||||
<string name="agent_step_connection_quest_hint">Το Quest δεν έχει οθόνη σύζευξης. Από έναν υπολογιστή, εκτελέστε μία φορά: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS και adb tcpip 5555. Μετά πατήστε «Να επιτραπεί» και αποδεχτείτε το μήνυμα στο headset</string>
|
||||
<string name="agent_action_allow">Να επιτραπεί</string>
|
||||
<string name="agent_connection_quest_waiting">Αποδεχτείτε το «Να επιτραπεί ο εντοπισμός σφαλμάτων;» στο headset, με επιλεγμένο το «Να επιτρέπεται πάντα»</string>
|
||||
<string name="agent_connection_quest_failed">Δεν ήταν δυνατή η σύνδεση. Αποδεχτείτε το μήνυμα εντοπισμού σφαλμάτων στο headset ή, αν δεν εμφανίστηκε, εκτελέστε adb tcpip 5555 από υπολογιστή και δοκιμάστε ξανά</string>
|
||||
<string name="agent_connection_quest_off">Ο ασύρματος εντοπισμός σφαλμάτων δεν είναι προσβάσιμος. Πατήστε «Να επιτραπεί» για να τον ρυθμίσετε ξανά</string>
|
||||
<string name="agent_action_install">Εγκατάσταση</string>
|
||||
<string name="agent_action_sign_in">Σύνδεση</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Αν αυτό δεν είναι δυνατό, συνδέστε αυτή τη συσκευή σε έναν υπολογιστή με ADB και εκτελέστε την παρακάτω εντολή. Επιστρέψτε εδώ και ελέγξτε ξανά.</string>
|
||||
<string name="phantom_instructions_off">Οι συνεδρίες Steam μπορούν να ξεκινήσουν.</string>
|
||||
<string name="phantom_instructions_not_applicable">Αυτή η έκδοση Android δεν χρησιμοποιεί αυτό το όριο.</string>
|
||||
<string name="phantom_title_uncounted">Το DroidDeck χειρίζεται το όριο θυγατρικών διεργασιών</string>
|
||||
<string name="phantom_instructions_uncounted">Το DroidDeck εκτελεί τα προγράμματα της συνεδρίας σε διεργασίες που το Android δεν μετράει, οπότε οι Επιλογές για προγραμματιστές μπορούν να μείνουν απενεργοποιημένες.</string>
|
||||
<string name="phantom_fix_toggle">Ενεργοποιήστε την «Απενεργοπ. περιορισμών σε θυγατρικές διεργασίες» στις Επιλογές προγραμματιστή και αφήστε τις Επιλογές προγραμματιστή ενεργές μετά.</string>
|
||||
<string name="phantom_fix_no_toggle">Αυτή η έκδοση Android δεν έχει διακόπτη για αυτό. Χρησιμοποιήστε τον ασύρματο εντοπισμό σφαλμάτων για να το αλλάξετε από αυτή τη συσκευή.</string>
|
||||
<string name="upd_block_no_apk">Αυτή η έκδοση δεν έχει λήψη για αυτό το αντίγραφο του DroidDeck.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Αυτό το παιχνίδι εγκαθιστά την έκδοσή του για Linux. Εγκαταστήστε το από το Steam.</string>
|
||||
<string name="game_zoom_title">Ζουμ παιχνιδιού</string>
|
||||
<string name="game_zoom_hint">Ρυθμίστε τη μεγέθυνση του παιχνιδιού από 100% έως 300%</string>
|
||||
<string name="game_steam_offline_uncached">Το Steam είναι σε λειτουργία εκτός σύνδεσης και δεν έχει φορτώσει ακόμη το %1$s. Συνδεθείτε μία φορά στο Steam για να το παίξετε.</string>
|
||||
</resources>
|
||||
@@ -1253,11 +1253,6 @@
|
||||
<string name="agent_action_prepare">Preparar</string>
|
||||
<string name="agent_connection_off">No se puede acceder a la depuración inalámbrica; Emparejar la activa</string>
|
||||
<string name="agent_action_pair">Emparejar</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest no tiene pantalla de vinculación. Desde un ordenador, ejecuta una vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS y adb tcpip 5555. Después toca Permitir y acepta el aviso en el visor</string>
|
||||
<string name="agent_action_allow">Permitir</string>
|
||||
<string name="agent_connection_quest_waiting">Acepta «¿Permitir depuración?» en el visor, con Permitir siempre marcado</string>
|
||||
<string name="agent_connection_quest_failed">No se pudo conectar. Acepta el aviso de depuración en el visor o, si no apareció, ejecuta adb tcpip 5555 desde un ordenador y vuelve a intentarlo</string>
|
||||
<string name="agent_connection_quest_off">No se puede acceder a la depuración inalámbrica. Toca Permitir para configurarla de nuevo</string>
|
||||
<string name="agent_action_install">Instalar</string>
|
||||
<string name="agent_action_sign_in">Iniciar sesión</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2472,8 +2467,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Si no es posible, conecta este dispositivo a un ordenador con ADB y ejecuta el comando de abajo. Después vuelve aquí y comprueba de nuevo.</string>
|
||||
<string name="phantom_instructions_off">Ya se pueden iniciar sesiones de Steam.</string>
|
||||
<string name="phantom_instructions_not_applicable">Esta versión de Android no usa este límite.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck gestiona el límite de procesos secundarios</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck ejecuta los programas de la sesión en procesos que Android no cuenta, así que las Opciones para desarrolladores pueden seguir desactivadas.</string>
|
||||
<string name="phantom_fix_toggle">Activa “Inhabilitar restricciones de procesos secundarios” en Opciones de desarrollador y deja activadas las Opciones de desarrollador después.</string>
|
||||
<string name="phantom_fix_no_toggle">Esta versión de Android no tiene un interruptor para ello. Usa la Depuración inalámbrica para cambiarlo desde este dispositivo.</string>
|
||||
<string name="upd_block_no_apk">Esta versión no tiene descarga para esta copia de DroidDeck.</string>
|
||||
@@ -4197,4 +4190,5 @@
|
||||
<string name="steam_store_linux_build">Este juego instala su versión para Linux. Instálalo desde Steam.</string>
|
||||
<string name="game_zoom_title">Zoom del juego</string>
|
||||
<string name="game_zoom_hint">Ajusta la ampliación del juego del 100 % al 300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam está en modo sin conexión y aún no ha cargado %1$s. Conéctate en Steam una vez para jugarlo.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Valmistele</string>
|
||||
<string name="agent_connection_off">Langaton virheenkorjaus ei ole tavoitettavissa; Parita ottaa sen käyttöön</string>
|
||||
<string name="agent_action_pair">Parita</string>
|
||||
<string name="agent_step_connection_quest_hint">Questissa ei ole laiteparinäkymää. Suorita kerran tietokoneelta: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS ja adb tcpip 5555. Napauta sitten Salli ja hyväksy kehote laseissa</string>
|
||||
<string name="agent_action_allow">Salli</string>
|
||||
<string name="agent_connection_quest_waiting">Hyväksy ”Sallitaanko virheenkorjaus?” laseissa, kun Salli aina on valittuna</string>
|
||||
<string name="agent_connection_quest_failed">Yhteyttä ei saatu. Hyväksy virheenkorjauskehote laseissa, tai jos sitä ei näkynyt, suorita adb tcpip 5555 tietokoneelta ja yritä uudelleen</string>
|
||||
<string name="agent_connection_quest_off">Langatonta virheenkorjausta ei tavoiteta. Määritä se uudelleen napauttamalla Salli</string>
|
||||
<string name="agent_action_install">Asenna</string>
|
||||
<string name="agent_action_sign_in">Kirjaudu sisään</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Jos se ei ole mahdollista, yhdistä tämä laite tietokoneeseen ADB:llä ja suorita alla oleva komento. Palaa tähän ja tarkista uudelleen.</string>
|
||||
<string name="phantom_instructions_off">Steam-istunnot voivat käynnistyä.</string>
|
||||
<string name="phantom_instructions_not_applicable">Tämä Android-versio ei käytä tätä rajaa.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck hoitaa aliprosessirajoituksen</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck ajaa istunnon ohjelmat prosesseissa, joita Android ei laske, joten kehittäjäasetukset voivat pysyä pois päältä.</string>
|
||||
<string name="phantom_fix_toggle">Ota käyttöön ”Poista käytöstä alatason prosessirajoitukset” Kehittäjäasetuksissa, ja pidä Kehittäjäasetukset päällä sen jälkeen.</string>
|
||||
<string name="phantom_fix_no_toggle">Tässä Android-versiossa ei ole kytkintä sille. Käytä langatonta virheenkorjausta muuttaaksesi sitä tältä laitteelta.</string>
|
||||
<string name="upd_block_no_apk">Tälle versiolle ei ole latausta tähän DroidDeck-kopioon.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Tämä peli asentaa Linux-versionsa. Asenna se Steamista.</string>
|
||||
<string name="game_zoom_title">Pelin zoomaus</string>
|
||||
<string name="game_zoom_hint">Säädä pelin suurennusta välillä 100–300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam on offline-tilassa eikä ole vielä ladannut peliä %1$s. Siirry Steamissa kerran online-tilaan pelataksesi sitä.</string>
|
||||
</resources>
|
||||
@@ -1252,11 +1252,6 @@
|
||||
<string name="agent_action_prepare">Préparer</string>
|
||||
<string name="agent_connection_off">Le débogage sans fil n\'est pas accessible ; « Associer » l\'active</string>
|
||||
<string name="agent_action_pair">Associer</string>
|
||||
<string name="agent_step_connection_quest_hint">Le Quest n\'a pas d\'écran d\'association. Depuis un ordinateur, exécutez une fois : adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS et adb tcpip 5555. Touchez ensuite Autoriser et acceptez la demande dans le casque</string>
|
||||
<string name="agent_action_allow">Autoriser</string>
|
||||
<string name="agent_connection_quest_waiting">Acceptez « Autoriser le débogage ? » dans le casque, avec Toujours autoriser coché</string>
|
||||
<string name="agent_connection_quest_failed">Connexion impossible. Acceptez la demande de débogage dans le casque ou, si elle n\'est pas apparue, exécutez adb tcpip 5555 depuis un ordinateur et réessayez</string>
|
||||
<string name="agent_connection_quest_off">Le débogage sans fil est injoignable. Touchez Autoriser pour le configurer à nouveau</string>
|
||||
<string name="agent_action_install">Installer</string>
|
||||
<string name="agent_action_sign_in">Se connecter</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2471,8 +2466,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Si ce n\'est pas possible, connectez cet appareil à un ordinateur avec ADB et exécutez la commande ci-dessous. Revenez ensuite ici et vérifiez à nouveau.</string>
|
||||
<string name="phantom_instructions_off">Les sessions Steam peuvent démarrer.</string>
|
||||
<string name="phantom_instructions_not_applicable">Cette version d\'Android n\'utilise pas cette limite.</string>
|
||||
<string name="phantom_title_uncounted">Limite de processus enfants gérée par DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck exécute les programmes de la session dans des processus qu’Android ne compte pas : les options pour les développeurs peuvent rester désactivées.</string>
|
||||
<string name="phantom_fix_toggle">Activez « Désactiver les limites pour les processus enfant » dans les options pour les développeurs, puis laissez les options pour les développeurs activées.</string>
|
||||
<string name="phantom_fix_no_toggle">Cette version d\'Android ne dispose pas de cet interrupteur. Utilisez le débogage sans fil pour le modifier depuis cet appareil.</string>
|
||||
<string name="upd_block_no_apk">Cette version ne propose aucun téléchargement pour cette copie de DroidDeck.</string>
|
||||
@@ -4196,4 +4189,5 @@
|
||||
<string name="steam_store_linux_build">Ce jeu installe sa version Linux. Installez-le depuis Steam.</string>
|
||||
<string name="game_zoom_title">Zoom du jeu</string>
|
||||
<string name="game_zoom_hint">Réglez le grossissement du jeu de 100 % à 300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam est en mode hors ligne et n\'a pas encore chargé %1$s. Passez en ligne une fois dans Steam pour y jouer.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">तैयार करें</string>
|
||||
<string name="agent_connection_off">वायरलेस डिबगिंग से कनेक्ट नहीं हो पा रहा; पेयर करने से यह चालू हो जाता है</string>
|
||||
<string name="agent_action_pair">पेयर करें</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest में पेयरिंग स्क्रीन नहीं है। किसी कंप्यूटर से एक बार चलाएँ: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS और adb tcpip 5555। फिर अनुमति दें पर टैप करें और हेडसेट में संकेत स्वीकार करें</string>
|
||||
<string name="agent_action_allow">अनुमति दें</string>
|
||||
<string name="agent_connection_quest_waiting">हेडसेट में “डीबगिंग की अनुमति दें?” स्वीकार करें, हमेशा अनुमति दें चुना हुआ रखें</string>
|
||||
<string name="agent_connection_quest_failed">कनेक्ट नहीं हो सका। हेडसेट में डीबगिंग संकेत स्वीकार करें, या अगर वह नहीं दिखा, तो कंप्यूटर से adb tcpip 5555 चलाएँ और दोबारा कोशिश करें</string>
|
||||
<string name="agent_connection_quest_off">वायरलेस डीबगिंग तक नहीं पहुँचा जा सकता। इसे फिर से सेट करने के लिए अनुमति दें पर टैप करें</string>
|
||||
<string name="agent_action_install">इंस्टॉल करें</string>
|
||||
<string name="agent_action_sign_in">साइन इन करें</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s अगर यह संभव नहीं है, तो इस डिवाइस को ADB वाले कंप्यूटर से कनेक्ट करें और नीचे दिया कमांड चलाएं। यहां वापस आएं और फिर से जांचें।</string>
|
||||
<string name="phantom_instructions_off">Steam सेशन शुरू हो सकते हैं।</string>
|
||||
<string name="phantom_instructions_not_applicable">यह Android वर्शन इस सीमा का उपयोग नहीं करता।</string>
|
||||
<string name="phantom_title_uncounted">चाइल्ड-प्रोसेस सीमा DroidDeck संभालता है</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck सत्र के प्रोग्राम उन प्रोसेस में चलाता है जिन्हें Android नहीं गिनता, इसलिए डेवलपर विकल्प बंद रह सकते हैं।</string>
|
||||
<string name="phantom_fix_toggle">डेवलपर विकल्प में “चाइल्ड प्रोसेस से जुड़ी पाबंदियां हटाएं” चालू करें, और बाद में डेवलपर विकल्प चालू रहने दें।</string>
|
||||
<string name="phantom_fix_no_toggle">इस Android वर्शन में इसके लिए कोई स्विच नहीं है। इसे इस डिवाइस से बदलने के लिए वायरलेस डीबगिंग इस्तेमाल करें।</string>
|
||||
<string name="upd_block_no_apk">इस बिल्ड में DroidDeck की इस कॉपी के लिए कोई डाउनलोड नहीं है।</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">यह गेम अपना Linux संस्करण इंस्टॉल करता है। इसे Steam से इंस्टॉल करें।</string>
|
||||
<string name="game_zoom_title">गेम ज़ूम</string>
|
||||
<string name="game_zoom_hint">गेम का ज़ूम 100% से 300% तक समायोजित करें</string>
|
||||
<string name="game_steam_offline_uncached">Steam ऑफ़लाइन मोड में है और उसने अभी तक %1$s लोड नहीं किया है। इसे खेलने के लिए Steam में एक बार ऑनलाइन जाएँ।</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Előkészítés</string>
|
||||
<string name="agent_connection_off">A vezeték nélküli hibakeresés nem érhető el; a Párosítás bekapcsolja</string>
|
||||
<string name="agent_action_pair">Párosítás</string>
|
||||
<string name="agent_step_connection_quest_hint">A Quest nem rendelkezik párosítási képernyővel. Egy számítógépről futtasd egyszer: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS és adb tcpip 5555. Ezután koppints az Engedélyezés gombra, és fogadd el a kérdést a headsetben</string>
|
||||
<string name="agent_action_allow">Engedélyezés</string>
|
||||
<string name="agent_connection_quest_waiting">Fogadd el az „Engedélyezed a hibakeresést?” kérdést a headsetben, a Mindig engedélyez bejelölésével</string>
|
||||
<string name="agent_connection_quest_failed">Nem sikerült csatlakozni. Fogadd el a hibakeresési kérdést a headsetben, vagy ha nem jelent meg, futtasd az adb tcpip 5555 parancsot egy számítógépről, és próbáld újra</string>
|
||||
<string name="agent_connection_quest_off">A vezeték nélküli hibakeresés nem érhető el. Koppints az Engedélyezés gombra az újbóli beállításhoz</string>
|
||||
<string name="agent_action_install">Telepítés</string>
|
||||
<string name="agent_action_sign_in">Bejelentkezés</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Ha ez nem lehetséges, csatlakoztassa ezt az eszközt egy ADB-vel rendelkező számítógéphez, és futtassa az alábbi parancsot. Térjen vissza ide, és ellenőrizze újra.</string>
|
||||
<string name="phantom_instructions_off">A Steam-munkamenetek elindulhatnak.</string>
|
||||
<string name="phantom_instructions_not_applicable">Ez az Android-verzió nem használja ezt a korlátot.</string>
|
||||
<string name="phantom_title_uncounted">A gyermekfolyamat-korlátot a DroidDeck kezeli</string>
|
||||
<string name="phantom_instructions_uncounted">A DroidDeck a munkamenet programjait olyan folyamatokban futtatja, amelyeket az Android nem számol bele, így a fejlesztői beállítások kikapcsolva maradhatnak.</string>
|
||||
<string name="phantom_fix_toggle">Kapcsolja be az „Alárendelt folyamatok korlátozásának kikapcsolása” lehetőséget a Fejlesztői beállításokban, és utána hagyja bekapcsolva a Fejlesztői beállításokat.</string>
|
||||
<string name="phantom_fix_no_toggle">Ehhez az Android-verzióhoz nincs kapcsoló. Használja a vezeték nélküli hibakeresést a módosításához erről az eszközről.</string>
|
||||
<string name="upd_block_no_apk">Ehhez a buildhez nincs letöltés a DroidDeck ezen másolatához.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Ez a játék a Linux-verzióját telepíti. Telepítsd a Steamből.</string>
|
||||
<string name="game_zoom_title">Játék nagyítása</string>
|
||||
<string name="game_zoom_hint">A játék nagyításának beállítása 100% és 300% között</string>
|
||||
<string name="game_steam_offline_uncached">A Steam offline módban van, és még nem töltötte be ezt: %1$s. A játékhoz egyszer lépj online módba a Steamben.</string>
|
||||
</resources>
|
||||
@@ -1246,11 +1246,6 @@
|
||||
<string name="agent_action_prepare">Siapkan</string>
|
||||
<string name="agent_connection_off">Debug nirkabel tidak dapat dijangkau; Pasangkan menyalakannya</string>
|
||||
<string name="agent_action_pair">Pasangkan</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest tidak memiliki layar penyambungan. Dari komputer, jalankan sekali: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS dan adb tcpip 5555. Lalu ketuk Izinkan dan terima permintaan di headset</string>
|
||||
<string name="agent_action_allow">Izinkan</string>
|
||||
<string name="agent_connection_quest_waiting">Terima “Izinkan debugging?” di headset, dengan Selalu izinkan dicentang</string>
|
||||
<string name="agent_connection_quest_failed">Tidak dapat terhubung. Terima permintaan debugging di headset, atau jika tidak muncul, jalankan adb tcpip 5555 dari komputer lalu coba lagi</string>
|
||||
<string name="agent_connection_quest_off">Debugging nirkabel tidak dapat dijangkau. Ketuk Izinkan untuk menyiapkannya lagi</string>
|
||||
<string name="agent_action_install">Pasang</string>
|
||||
<string name="agent_action_sign_in">Masuk</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2421,8 +2416,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Jika itu tidak memungkinkan, sambungkan perangkat ini ke komputer dengan ADB dan jalankan perintah di bawah. Kembali ke sini dan periksa lagi.</string>
|
||||
<string name="phantom_instructions_off">Sesi Steam dapat dimulai.</string>
|
||||
<string name="phantom_instructions_not_applicable">Versi Android ini tidak menggunakan batas ini.</string>
|
||||
<string name="phantom_title_uncounted">Batas proses anak ditangani DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck menjalankan program sesi dalam proses yang tidak dihitung Android, jadi Opsi developer bisa tetap nonaktif.</string>
|
||||
<string name="phantom_fix_toggle">Aktifkan “Nonaktifkan batasan proses turunan” di Opsi developer, dan biarkan Opsi developer tetap aktif setelahnya.</string>
|
||||
<string name="phantom_fix_no_toggle">Versi Android ini tidak memiliki sakelar untuk itu. Gunakan Debugging nirkabel untuk mengubahnya dari perangkat ini.</string>
|
||||
<string name="upd_block_no_apk">Build ini tidak memiliki unduhan untuk salinan DroidDeck ini.</string>
|
||||
@@ -4127,4 +4120,5 @@
|
||||
<string name="steam_store_linux_build">Game ini memasang versi Linux-nya. Pasang dari Steam.</string>
|
||||
<string name="game_zoom_title">Zoom game</string>
|
||||
<string name="game_zoom_hint">Sesuaikan pembesaran game dari 100% hingga 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam dalam mode luring dan belum memuat %1$s. Hubungkan Steam secara daring sekali untuk memainkannya.</string>
|
||||
</resources>
|
||||
@@ -1244,11 +1244,6 @@
|
||||
<string name="agent_action_prepare">Prepara</string>
|
||||
<string name="agent_connection_off">Il debug wireless non è raggiungibile; Associa lo attiva</string>
|
||||
<string name="agent_action_pair">Associa</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest non ha una schermata di accoppiamento. Da un computer, esegui una volta: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS e adb tcpip 5555. Poi tocca Consenti e accetta la richiesta nel visore</string>
|
||||
<string name="agent_action_allow">Consenti</string>
|
||||
<string name="agent_connection_quest_waiting">Accetta «Consentire il debug?» nel visore, con Consenti sempre selezionato</string>
|
||||
<string name="agent_connection_quest_failed">Impossibile connettersi. Accetta la richiesta di debug nel visore oppure, se non è comparsa, esegui adb tcpip 5555 da un computer e riprova</string>
|
||||
<string name="agent_connection_quest_off">Il debug wireless non è raggiungibile. Tocca Consenti per configurarlo di nuovo</string>
|
||||
<string name="agent_action_install">Installa</string>
|
||||
<string name="agent_action_sign_in">Accedi</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2463,8 +2458,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Se non è possibile, collega questo dispositivo a un computer con ADB ed esegui il comando qui sotto. Poi torna qui e ricontrolla.</string>
|
||||
<string name="phantom_instructions_off">Le sessioni Steam possono avviarsi.</string>
|
||||
<string name="phantom_instructions_not_applicable">Questa versione di Android non usa questo limite.</string>
|
||||
<string name="phantom_title_uncounted">Limite dei processi figli gestito da DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck esegue i programmi della sessione in processi che Android non conteggia, quindi le Opzioni sviluppatore possono restare disattivate.</string>
|
||||
<string name="phantom_fix_toggle">Attiva “Disattiva limitazioni per i processi secondari” in Opzioni sviluppatore e poi lascia attive le Opzioni sviluppatore.</string>
|
||||
<string name="phantom_fix_no_toggle">Questa versione di Android non ha un interruttore per farlo. Usa il debug wireless per cambiarlo da questo dispositivo.</string>
|
||||
<string name="upd_block_no_apk">Questa build non ha un download per questa copia di DroidDeck.</string>
|
||||
@@ -4196,4 +4189,5 @@
|
||||
<string name="steam_store_linux_build">Questo gioco installa la sua versione Linux. Installalo da Steam.</string>
|
||||
<string name="game_zoom_title">Zoom del gioco</string>
|
||||
<string name="game_zoom_hint">Regola l\'ingrandimento del gioco dal 100% al 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam è in modalità offline e non ha ancora caricato %1$s. Vai online in Steam una volta per giocarci.</string>
|
||||
</resources>
|
||||
@@ -1246,11 +1246,6 @@
|
||||
<string name="agent_action_prepare">準備</string>
|
||||
<string name="agent_connection_off">ワイヤレスデバッグに接続できません。ペアリングで有効になります</string>
|
||||
<string name="agent_action_pair">ペアリング</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest にはペア設定画面がありません。パソコンから一度だけ adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS と adb tcpip 5555 を実行し、[許可] をタップしてヘッドセットの確認を承認してください</string>
|
||||
<string name="agent_action_allow">許可</string>
|
||||
<string name="agent_connection_quest_waiting">ヘッドセットで「デバッグを許可しますか?」を、[常に許可] にチェックを入れて承認してください</string>
|
||||
<string name="agent_connection_quest_failed">接続できませんでした。ヘッドセットでデバッグの確認を承認してください。表示されなかった場合は、パソコンから adb tcpip 5555 を実行してもう一度お試しください</string>
|
||||
<string name="agent_connection_quest_off">ワイヤレス デバッグに接続できません。[許可] をタップして設定し直してください</string>
|
||||
<string name="agent_action_install">インストール</string>
|
||||
<string name="agent_action_sign_in">サインイン</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2421,8 +2416,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s それができない場合は、このデバイスをADBが使えるPCに接続し、以下のコマンドを実行してください。その後ここに戻って再確認してください。</string>
|
||||
<string name="phantom_instructions_off">Steamセッションを開始できます。</string>
|
||||
<string name="phantom_instructions_not_applicable">このAndroidバージョンではこの制限は使用されません。</string>
|
||||
<string name="phantom_title_uncounted">子プロセスの制限は DroidDeck が対処します</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck はセッションのプログラムを Android が数えないプロセスで実行するため、開発者向けオプションはオフのままでかまいません。</string>
|
||||
<string name="phantom_fix_toggle">開発者向けオプションで「子プロセスの制限を無効化」をオンにし、その後も開発者向けオプションをオンのままにしてください。</string>
|
||||
<string name="phantom_fix_no_toggle">このAndroidバージョンにはこのスイッチがありません。ワイヤレスデバッグを使って、このデバイスから変更してください。</string>
|
||||
<string name="upd_block_no_apk">このビルドには、このDroidDeckコピー用のダウンロードがありません。</string>
|
||||
@@ -4127,4 +4120,5 @@
|
||||
<string name="steam_store_linux_build">このゲームは Linux 版をインストールします。Steam からインストールしてください。</string>
|
||||
<string name="game_zoom_title">ゲームズーム</string>
|
||||
<string name="game_zoom_hint">ゲームの拡大率を100%から300%の間で調整します</string>
|
||||
<string name="game_steam_offline_uncached">Steam はオフラインモードのため、%1$s をまだ読み込んでいません。プレイするには Steam で一度オンラインにしてください。</string>
|
||||
</resources>
|
||||
@@ -1246,11 +1246,6 @@
|
||||
<string name="agent_action_prepare">준비</string>
|
||||
<string name="agent_connection_off">무선 디버깅에 연결할 수 없습니다. 페어링하면 켜집니다</string>
|
||||
<string name="agent_action_pair">페어링</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest에는 페어링 화면이 없습니다. 컴퓨터에서 한 번 실행하세요: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 및 adb tcpip 5555. 그런 다음 허용을 탭하고 헤드셋에서 요청을 수락하세요</string>
|
||||
<string name="agent_action_allow">허용</string>
|
||||
<string name="agent_connection_quest_waiting">헤드셋에서 \'디버깅을 허용하시겠습니까?\'를 항상 허용을 선택한 채로 수락하세요</string>
|
||||
<string name="agent_connection_quest_failed">연결하지 못했습니다. 헤드셋에서 디버깅 요청을 수락하거나, 요청이 나타나지 않았다면 컴퓨터에서 adb tcpip 5555를 실행한 뒤 다시 시도하세요</string>
|
||||
<string name="agent_connection_quest_off">무선 디버깅에 연결할 수 없습니다. 허용을 탭해 다시 설정하세요</string>
|
||||
<string name="agent_action_install">설치</string>
|
||||
<string name="agent_action_sign_in">로그인</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2421,8 +2416,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s 이 방법을 사용할 수 없으면 이 기기를 ADB가 설치된 PC에 연결하고 아래 명령을 실행하세요. 그런 다음 여기로 돌아와 다시 확인하세요.</string>
|
||||
<string name="phantom_instructions_off">Steam 세션을 시작할 수 있습니다.</string>
|
||||
<string name="phantom_instructions_not_applicable">이 Android 버전에서는 이 제한을 사용하지 않습니다.</string>
|
||||
<string name="phantom_title_uncounted">하위 프로세스 제한은 DroidDeck이 처리합니다</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck은 세션의 프로그램을 Android가 세지 않는 프로세스에서 실행하므로 개발자 옵션을 꺼 둔 채로 두어도 됩니다.</string>
|
||||
<string name="phantom_fix_toggle">개발자 옵션에서 “하위 프로세스 제한 사용 중지”를 켜고, 이후에도 개발자 옵션을 켜 둔 상태로 유지하세요.</string>
|
||||
<string name="phantom_fix_no_toggle">이 Android 버전에는 해당 스위치가 없습니다. 무선 디버깅을 사용하여 이 기기에서 변경하세요.</string>
|
||||
<string name="upd_block_no_apk">이 빌드에는 이 DroidDeck 복사본용 다운로드가 없습니다.</string>
|
||||
@@ -4127,4 +4120,5 @@
|
||||
<string name="steam_store_linux_build">이 게임은 Linux 버전을 설치합니다. Steam에서 설치하세요.</string>
|
||||
<string name="game_zoom_title">게임 확대</string>
|
||||
<string name="game_zoom_hint">게임 확대율을 100%에서 300%까지 조정합니다</string>
|
||||
<string name="game_steam_offline_uncached">Steam이 오프라인 모드이며 아직 %1$s을(를) 불러오지 않았습니다. 플레이하려면 Steam에서 한 번 온라인으로 전환하세요.</string>
|
||||
</resources>
|
||||
@@ -1246,11 +1246,6 @@
|
||||
<string name="agent_action_prepare">Sediakan</string>
|
||||
<string name="agent_connection_off">Penyahpepijatan wayarles tidak dapat dicapai; Pasangkan menghidupkannya</string>
|
||||
<string name="agent_action_pair">Pasangkan</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest tiada skrin pasangan. Dari komputer, jalankan sekali: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS dan adb tcpip 5555. Kemudian ketik Benarkan dan terima gesaan dalam set kepala</string>
|
||||
<string name="agent_action_allow">Benarkan</string>
|
||||
<string name="agent_connection_quest_waiting">Terima “Benarkan penyahpepijatan?” dalam set kepala, dengan Sentiasa benarkan ditanda</string>
|
||||
<string name="agent_connection_quest_failed">Tidak dapat bersambung. Terima gesaan penyahpepijatan dalam set kepala, atau jika tiada, jalankan adb tcpip 5555 dari komputer dan cuba lagi</string>
|
||||
<string name="agent_connection_quest_off">Penyahpepijatan wayarles tidak dapat dicapai. Ketik Benarkan untuk menyediakannya semula</string>
|
||||
<string name="agent_action_install">Pasang</string>
|
||||
<string name="agent_action_sign_in">Log masuk</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2421,8 +2416,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Jika itu tidak boleh, sambungkan peranti ini ke komputer dengan ADB dan jalankan arahan di bawah. Kembali ke sini dan semak semula.</string>
|
||||
<string name="phantom_instructions_off">Sesi Steam boleh dimulakan.</string>
|
||||
<string name="phantom_instructions_not_applicable">Versi Android ini tidak menggunakan had ini.</string>
|
||||
<string name="phantom_title_uncounted">Had proses anak dikendalikan oleh DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck menjalankan program sesi dalam proses yang tidak dikira oleh Android, jadi Pilihan pembangun boleh kekal dimatikan.</string>
|
||||
<string name="phantom_fix_toggle">Hidupkan “Lumpuhkan sekatan proses anak” dalam Pilihan pembangun, dan biarkan Pilihan pembangun hidup selepas itu.</string>
|
||||
<string name="phantom_fix_no_toggle">Versi Android ini tidak mempunyai suis untuknya. Gunakan Debugging Wayarles untuk menukarnya daripada peranti ini.</string>
|
||||
<string name="upd_block_no_apk">Binaan ini tidak mempunyai muat turun untuk salinan DroidDeck ini.</string>
|
||||
@@ -4127,4 +4120,5 @@
|
||||
<string name="steam_store_linux_build">Permainan ini memasang versi Linuxnya. Pasang daripada Steam.</string>
|
||||
<string name="game_zoom_title">Zum permainan</string>
|
||||
<string name="game_zoom_hint">Laraskan pembesaran permainan daripada 100% hingga 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam dalam mod luar talian dan belum memuatkan %1$s. Pergi dalam talian dalam Steam sekali untuk memainkannya.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Forbered</string>
|
||||
<string name="agent_connection_off">Trådløs feilsøking er ikke tilgjengelig; Par slår den på</string>
|
||||
<string name="agent_action_pair">Par</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest har ingen sammenkoblingsskjerm. Kjør én gang fra en datamaskin: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS og adb tcpip 5555. Trykk deretter på Tillat og godta spørsmålet i hodesettet</string>
|
||||
<string name="agent_action_allow">Tillat</string>
|
||||
<string name="agent_connection_quest_waiting">Godta «Vil du tillate feilsøking?» i hodesettet med Tillat alltid avkrysset</string>
|
||||
<string name="agent_connection_quest_failed">Kunne ikke koble til. Godta feilsøkingsspørsmålet i hodesettet, eller kjør adb tcpip 5555 fra en datamaskin og prøv igjen hvis det ikke dukket opp</string>
|
||||
<string name="agent_connection_quest_off">Trådløs feilsøking kan ikke nås. Trykk på Tillat for å sette den opp på nytt</string>
|
||||
<string name="agent_action_install">Installer</string>
|
||||
<string name="agent_action_sign_in">Logg inn</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Hvis det ikke er mulig, koble denne enheten til en datamaskin med ADB og kjør kommandoen under. Kom tilbake hit og kontroller igjen.</string>
|
||||
<string name="phantom_instructions_off">Steam-sesjoner kan starte.</string>
|
||||
<string name="phantom_instructions_not_applicable">Denne Android-versjonen bruker ikke denne grensen.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck håndterer grensen for underprosesser</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck kjører programmene i økten i prosesser som Android ikke teller med, så utvikleralternativer kan forbli av.</string>
|
||||
<string name="phantom_fix_toggle">Slå på «Slå av begrensninger for underordnede prosesser» i Utvikleralternativer, og la Utvikleralternativer stå på etterpå.</string>
|
||||
<string name="phantom_fix_no_toggle">Denne Android-versjonen har ingen bryter for det. Bruk trådløs feilsøking for å endre det fra denne enheten.</string>
|
||||
<string name="upd_block_no_apk">Denne builden har ingen nedlasting for denne kopien av DroidDeck.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Dette spillet installerer Linux-versjonen sin. Installer det fra Steam.</string>
|
||||
<string name="game_zoom_title">Spillzoom</string>
|
||||
<string name="game_zoom_hint">Juster spillforstørrelsen fra 100 % til 300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam er i frakoblet modus og har ikke lastet inn %1$s ennå. Gå tilkoblet i Steam én gang for å spille det.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Voorbereiden</string>
|
||||
<string name="agent_connection_off">Draadloze foutopsporing is niet bereikbaar; Koppelen schakelt dit in</string>
|
||||
<string name="agent_action_pair">Koppelen</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest heeft geen koppelscherm. Voer vanaf een computer één keer uit: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS en adb tcpip 5555. Tik daarna op Toestaan en accepteer de melding in de headset</string>
|
||||
<string name="agent_action_allow">Toestaan</string>
|
||||
<string name="agent_connection_quest_waiting">Accepteer ‘Foutopsporing toestaan?’ in de headset, met Altijd toestaan aangevinkt</string>
|
||||
<string name="agent_connection_quest_failed">Verbinden mislukt. Accepteer de foutopsporingsmelding in de headset, of voer adb tcpip 5555 uit vanaf een computer en probeer het opnieuw als er geen verscheen</string>
|
||||
<string name="agent_connection_quest_off">Draadloze foutopsporing is niet bereikbaar. Tik op Toestaan om het opnieuw in te stellen</string>
|
||||
<string name="agent_action_install">Installeren</string>
|
||||
<string name="agent_action_sign_in">Inloggen</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Als dat niet mogelijk is, sluit dit apparaat aan op een computer met ADB en voer de onderstaande opdracht uit. Kom hierna terug en controleer opnieuw.</string>
|
||||
<string name="phantom_instructions_off">Steam-sessies kunnen starten.</string>
|
||||
<string name="phantom_instructions_not_applicable">Deze Android-versie gebruikt deze limiet niet.</string>
|
||||
<string name="phantom_title_uncounted">Limiet voor onderliggende processen geregeld door DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck voert de programma\'s van de sessie uit in processen die Android niet meetelt, dus Ontwikkelaarsopties kunnen uit blijven.</string>
|
||||
<string name="phantom_fix_toggle">Schakel “Beperkingen voor onderliggende processen uitzetten” in bij Ontwikkelaarsopties en laat Ontwikkelaarsopties daarna aan staan.</string>
|
||||
<string name="phantom_fix_no_toggle">Deze Android-versie heeft hier geen schakelaar voor. Gebruik draadloze foutopsporing om dit vanaf dit apparaat te wijzigen.</string>
|
||||
<string name="upd_block_no_apk">Deze build heeft geen download voor dit exemplaar van DroidDeck.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Deze game installeert zijn Linux-versie. Installeer hem via Steam.</string>
|
||||
<string name="game_zoom_title">Gamezoom</string>
|
||||
<string name="game_zoom_hint">Pas de spelvergroting aan van 100% tot 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam staat in offlinemodus en heeft %1$s nog niet geladen. Ga één keer online in Steam om het te spelen.</string>
|
||||
</resources>
|
||||
@@ -1257,11 +1257,6 @@
|
||||
<string name="agent_action_prepare">Przygotuj</string>
|
||||
<string name="agent_connection_off">Debugowanie bezprzewodowe jest niedostępne; Paruj, aby je włączyć</string>
|
||||
<string name="agent_action_pair">Paruj</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest nie ma ekranu parowania. Na komputerze uruchom raz: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS oraz adb tcpip 5555. Następnie dotknij Zezwól i zaakceptuj monit w goglach</string>
|
||||
<string name="agent_action_allow">Zezwól</string>
|
||||
<string name="agent_connection_quest_waiting">Zaakceptuj „Zezwolić na debugowanie?” w goglach z zaznaczonym Zawsze zezwalaj</string>
|
||||
<string name="agent_connection_quest_failed">Nie udało się połączyć. Zaakceptuj monit debugowania w goglach, a jeśli się nie pojawił, uruchom adb tcpip 5555 na komputerze i spróbuj ponownie</string>
|
||||
<string name="agent_connection_quest_off">Debugowanie bezprzewodowe jest nieosiągalne. Dotknij Zezwól, aby skonfigurować je ponownie</string>
|
||||
<string name="agent_action_install">Zainstaluj</string>
|
||||
<string name="agent_action_sign_in">Zaloguj się</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2498,8 +2493,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Jeśli to niemożliwe, podłącz to urządzenie do komputera z ADB i uruchom poniższe polecenie. Wróć tutaj i sprawdź ponownie.</string>
|
||||
<string name="phantom_instructions_off">Sesje Steam mogą się uruchamiać.</string>
|
||||
<string name="phantom_instructions_not_applicable">Ta wersja systemu Android nie używa tego limitu.</string>
|
||||
<string name="phantom_title_uncounted">Limitem procesów podrzędnych zajmuje się DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck uruchamia programy sesji w procesach, których Android nie liczy, więc Opcje programisty mogą pozostać wyłączone.</string>
|
||||
<string name="phantom_fix_toggle">Włącz „Wyłącz ograniczenia procesów podrzędnych aplikacji” w Opcjach programisty i nie wyłączaj potem Opcji programisty.</string>
|
||||
<string name="phantom_fix_no_toggle">Ta wersja systemu Android nie ma dla niego przełącznika. Użyj debugowania bezprzewodowego, aby zmienić go z tego urządzenia.</string>
|
||||
<string name="upd_block_no_apk">Ta wersja nie ma pliku do pobrania dla tej kopii DroidDeck.</string>
|
||||
@@ -4237,4 +4230,5 @@
|
||||
<string name="steam_store_linux_build">Ta gra instaluje swoją wersję dla Linuksa. Zainstaluj ją ze Steama.</string>
|
||||
<string name="game_zoom_title">Powiększenie gry</string>
|
||||
<string name="game_zoom_hint">Dostosuj powiększenie gry w zakresie od 100% do 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam jest w trybie offline i nie wczytał jeszcze %1$s. Przejdź raz do trybu online w Steamie, aby w to zagrać.</string>
|
||||
</resources>
|
||||
@@ -1244,11 +1244,6 @@
|
||||
<string name="agent_action_prepare">Preparar</string>
|
||||
<string name="agent_connection_off">A depuração sem fios não está acessível; Emparelhar ativa-a</string>
|
||||
<string name="agent_action_pair">Emparelhar</string>
|
||||
<string name="agent_step_connection_quest_hint">O Quest não tem ecrã de emparelhamento. Num computador, execute uma vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS e adb tcpip 5555. Depois toque em Permitir e aceite o pedido no headset</string>
|
||||
<string name="agent_action_allow">Permitir</string>
|
||||
<string name="agent_connection_quest_waiting">Aceite “Permitir depuração?” no headset, com Permitir sempre assinalado</string>
|
||||
<string name="agent_connection_quest_failed">Não foi possível ligar. Aceite o pedido de depuração no headset ou, se não apareceu, execute adb tcpip 5555 num computador e tente novamente</string>
|
||||
<string name="agent_connection_quest_off">A depuração sem fios não está acessível. Toque em Permitir para a configurar de novo</string>
|
||||
<string name="agent_action_install">Instalar</string>
|
||||
<string name="agent_action_sign_in">Iniciar sessão</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2478,8 +2473,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Se não for possível, ligue este dispositivo a um computador com ADB e execute o comando abaixo. Volte aqui e verifique novamente.</string>
|
||||
<string name="phantom_instructions_off">As sessões Steam podem ser iniciadas.</string>
|
||||
<string name="phantom_instructions_not_applicable">Esta versão do Android não usa este limite.</string>
|
||||
<string name="phantom_title_uncounted">Limite de processos filhos gerido pelo DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">O DroidDeck executa os programas da sessão em processos que o Android não conta, por isso as Opções de programador podem continuar desativadas.</string>
|
||||
<string name="phantom_fix_toggle">Ative «Desativar restrições de processos secundários» nas Opções de programador e mantenha as Opções de programador ativadas depois.</string>
|
||||
<string name="phantom_fix_no_toggle">Esta versão do Android não tem um interruptor para isto. Use a depuração sem fios para o alterar a partir deste dispositivo.</string>
|
||||
<string name="upd_block_no_apk">Esta versão não tem transferência para esta cópia do DroidDeck.</string>
|
||||
@@ -4196,4 +4189,5 @@
|
||||
<string name="steam_store_linux_build">Este jogo instala a sua versão para Linux. Instale-o a partir do Steam.</string>
|
||||
<string name="game_zoom_title">Zoom do jogo</string>
|
||||
<string name="game_zoom_hint">Ajuste a ampliação do jogo de 100% a 300%</string>
|
||||
<string name="game_steam_offline_uncached">O Steam está no modo offline e ainda não carregou %1$s. Fique online no Steam uma vez para jogar.</string>
|
||||
</resources>
|
||||
@@ -1252,11 +1252,6 @@
|
||||
<string name="agent_action_prepare">Preparar</string>
|
||||
<string name="agent_connection_off">A depuração sem fio não está acessível; Parear a ativa</string>
|
||||
<string name="agent_action_pair">Parear</string>
|
||||
<string name="agent_step_connection_quest_hint">O Quest não tem tela de pareamento. Em um computador, execute uma vez: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS e adb tcpip 5555. Depois toque em Permitir e aceite o aviso no headset</string>
|
||||
<string name="agent_action_allow">Permitir</string>
|
||||
<string name="agent_connection_quest_waiting">Aceite “Permitir depuração?” no headset, com Sempre permitir marcado</string>
|
||||
<string name="agent_connection_quest_failed">Não foi possível conectar. Aceite o aviso de depuração no headset ou, se ele não apareceu, execute adb tcpip 5555 em um computador e tente novamente</string>
|
||||
<string name="agent_connection_quest_off">A depuração sem fio não está acessível. Toque em Permitir para configurá-la de novo</string>
|
||||
<string name="agent_action_install">Instalar</string>
|
||||
<string name="agent_action_sign_in">Entrar</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2486,8 +2481,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Se não for possível, conecte este dispositivo a um computador com ADB e execute o comando abaixo. Depois volte aqui e verifique de novo.</string>
|
||||
<string name="phantom_instructions_off">As sessões do Steam podem ser iniciadas.</string>
|
||||
<string name="phantom_instructions_not_applicable">Esta versão do Android não usa esse limite.</string>
|
||||
<string name="phantom_title_uncounted">Limite de processos filhos gerenciado pelo DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">O DroidDeck executa os programas da sessão em processos que o Android não conta, então as Opções do desenvolvedor podem continuar desativadas.</string>
|
||||
<string name="phantom_fix_toggle">Ative “Desativar restrições de processos filhos” nas Opções do desenvolvedor e mantenha as Opções do desenvolvedor ativadas depois.</string>
|
||||
<string name="phantom_fix_no_toggle">Esta versão do Android não tem uma chave para isso. Use a depuração por Wi-Fi para alterar pelo próprio dispositivo.</string>
|
||||
<string name="upd_block_no_apk">Esta versão não tem download para esta cópia do DroidDeck.</string>
|
||||
@@ -4204,4 +4197,5 @@
|
||||
<string name="steam_store_close_steam">Feche o Steam primeiro</string>
|
||||
<string name="steam_store_session_wait">Pause o download do Steam primeiro</string>
|
||||
<string name="steam_store_linux_build">Este jogo instala sua versão para Linux. Instale-o pelo Steam.</string>
|
||||
<string name="game_steam_offline_uncached">O Steam está no modo offline e ainda não carregou %1$s. Fique online no Steam uma vez para jogar.</string>
|
||||
</resources>
|
||||
@@ -1253,11 +1253,6 @@
|
||||
<string name="agent_action_prepare">Pregătește</string>
|
||||
<string name="agent_connection_off">Depanarea fără fir nu este accesibilă; „Asociază” o activează</string>
|
||||
<string name="agent_action_pair">Asociază</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest nu are ecran de asociere. De pe un computer, rulează o dată: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS și adb tcpip 5555. Apoi atinge Permite și acceptă solicitarea în cască</string>
|
||||
<string name="agent_action_allow">Permite</string>
|
||||
<string name="agent_connection_quest_waiting">Acceptă „Permiți remedierea erorilor?” în cască, cu Permite întotdeauna bifat</string>
|
||||
<string name="agent_connection_quest_failed">Conectarea a eșuat. Acceptă solicitarea de remediere a erorilor în cască sau, dacă nu a apărut, rulează adb tcpip 5555 de pe un computer și încearcă din nou</string>
|
||||
<string name="agent_connection_quest_off">Remedierea wireless a erorilor nu este accesibilă. Atinge Permite pentru a o configura din nou</string>
|
||||
<string name="agent_action_install">Instalează</string>
|
||||
<string name="agent_action_sign_in">Conectați-vă</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2472,8 +2467,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Dacă nu este posibil, conectează acest dispozitiv la un computer cu ADB și rulează comanda de mai jos. Revino aici și verifică din nou.</string>
|
||||
<string name="phantom_instructions_off">Sesiunile Steam pot porni.</string>
|
||||
<string name="phantom_instructions_not_applicable">Această versiune de Android nu folosește această limită.</string>
|
||||
<string name="phantom_title_uncounted">Limita proceselor copil este gestionată de DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck rulează programele sesiunii în procese pe care Android nu le numără, așa că Opțiunile pentru dezvoltatori pot rămâne dezactivate.</string>
|
||||
<string name="phantom_fix_toggle">Activează „Dezactivează restricțiile pentru procese secundare” în Opțiunile pentru dezvoltatori, și lasă Opțiunile pentru dezvoltatori activate după aceea.</string>
|
||||
<string name="phantom_fix_no_toggle">Această versiune de Android nu are un comutator pentru asta. Folosește Depanarea wireless pentru a o schimba de pe acest dispozitiv.</string>
|
||||
<string name="upd_block_no_apk">Această versiune nu are o descărcare pentru această copie de DroidDeck.</string>
|
||||
@@ -4197,4 +4190,5 @@
|
||||
<string name="steam_store_linux_build">Acest joc își instalează versiunea pentru Linux. Instalează-l din Steam.</string>
|
||||
<string name="game_zoom_title">Zoom joc</string>
|
||||
<string name="game_zoom_hint">Reglați mărirea jocului între 100% și 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam este în modul offline și nu a încărcat încă %1$s. Treci o dată online în Steam ca să îl joci.</string>
|
||||
</resources>
|
||||
@@ -1257,11 +1257,6 @@
|
||||
<string name="agent_action_prepare">Подготовить</string>
|
||||
<string name="agent_connection_off">Беспроводная отладка недоступна; «Сопряжение» включит её</string>
|
||||
<string name="agent_action_pair">Сопряжение</string>
|
||||
<string name="agent_step_connection_quest_hint">В Quest нет экрана сопряжения. Один раз выполните на компьютере: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS и adb tcpip 5555. Затем нажмите «Разрешить» и подтвердите запрос в шлеме</string>
|
||||
<string name="agent_action_allow">Разрешить</string>
|
||||
<string name="agent_connection_quest_waiting">Подтвердите «Разрешить отладку?» в шлеме, отметив «Всегда разрешать»</string>
|
||||
<string name="agent_connection_quest_failed">Не удалось подключиться. Подтвердите запрос на отладку в шлеме, а если он не появился, выполните adb tcpip 5555 на компьютере и повторите попытку</string>
|
||||
<string name="agent_connection_quest_off">Беспроводная отладка недоступна. Нажмите «Разрешить», чтобы настроить её заново</string>
|
||||
<string name="agent_action_install">Установить</string>
|
||||
<string name="agent_action_sign_in">Войти</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2499,8 +2494,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Если это невозможно, подключите устройство к компьютеру с ADB и выполните команду ниже. Затем вернитесь сюда и проверьте снова.</string>
|
||||
<string name="phantom_instructions_off">Сессии Steam могут запускаться.</string>
|
||||
<string name="phantom_instructions_not_applicable">Эта версия Android не использует это ограничение.</string>
|
||||
<string name="phantom_title_uncounted">Ограничение дочерних процессов обходит DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck запускает программы сеанса в процессах, которые Android не учитывает, поэтому параметры разработчика можно не включать.</string>
|
||||
<string name="phantom_fix_toggle">Включите «Отключить ограничения для дочерних процессов» в разделе «Для разработчиков» и оставьте этот раздел включенным.</string>
|
||||
<string name="phantom_fix_no_toggle">В этой версии Android нет такого переключателя. Измените настройку с этого устройства через отладку по Wi-Fi.</string>
|
||||
<string name="upd_block_no_apk">В этой сборке нет загрузки для этой копии DroidDeck.</string>
|
||||
@@ -4238,4 +4231,5 @@
|
||||
<string name="steam_store_linux_build">Эта игра устанавливает свою версию для Linux. Установите её из Steam.</string>
|
||||
<string name="game_zoom_title">Масштаб игры</string>
|
||||
<string name="game_zoom_hint">Настройте увеличение игры от 100% до 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam в автономном режиме и ещё не загрузил %1$s. Чтобы играть, один раз переведите Steam в сеть.</string>
|
||||
</resources>
|
||||
@@ -1249,11 +1249,6 @@
|
||||
<string name="agent_action_prepare">Förbered</string>
|
||||
<string name="agent_connection_off">Trådlös felsökning kan inte nås; Para slår på den</string>
|
||||
<string name="agent_action_pair">Para</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest har ingen parkopplingsskärm. Kör en gång från en dator: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS och adb tcpip 5555. Tryck sedan på Tillåt och godkänn frågan i headsetet</string>
|
||||
<string name="agent_action_allow">Tillåt</string>
|
||||
<string name="agent_connection_quest_waiting">Godkänn ”Tillåt felsökning?” i headsetet med Tillåt alltid markerat</string>
|
||||
<string name="agent_connection_quest_failed">Det gick inte att ansluta. Godkänn felsökningsfrågan i headsetet, eller kör adb tcpip 5555 från en dator och försök igen om ingen visades</string>
|
||||
<string name="agent_connection_quest_off">Trådlös felsökning går inte att nå. Tryck på Tillåt för att konfigurera den igen</string>
|
||||
<string name="agent_action_install">Installera</string>
|
||||
<string name="agent_action_sign_in">Logga in</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2446,8 +2441,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Om det inte är möjligt ansluter du den här enheten till en dator med ADB och kör kommandot nedan. Kom tillbaka hit och kontrollera igen.</string>
|
||||
<string name="phantom_instructions_off">Steam-sessioner kan starta.</string>
|
||||
<string name="phantom_instructions_not_applicable">Den här Android-versionen använder inte den här gränsen.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck hanterar gränsen för underprocesser</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck kör sessionens program i processer som Android inte räknar, så Utvecklaralternativ kan vara avstängda.</string>
|
||||
<string name="phantom_fix_toggle">Slå på ”Inaktivera begränsningar på underordnade processer” i Utvecklaralternativ, och låt Utvecklaralternativ vara kvar på efteråt.</string>
|
||||
<string name="phantom_fix_no_toggle">Den här Android-versionen har ingen växel för det. Använd trådlös felsökning för att ändra det från den här enheten.</string>
|
||||
<string name="upd_block_no_apk">Den här versionen har ingen nedladdning för den här kopian av DroidDeck.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Det här spelet installerar sin Linux-version. Installera det från Steam.</string>
|
||||
<string name="game_zoom_title">Spelzoom</string>
|
||||
<string name="game_zoom_hint">Justera spelförstoringen från 100 % till 300 %</string>
|
||||
<string name="game_steam_offline_uncached">Steam är i offlineläge och har inte läst in %1$s än. Gå online i Steam en gång för att spela det.</string>
|
||||
</resources>
|
||||
@@ -1246,11 +1246,6 @@
|
||||
<string name="agent_action_prepare">เตรียม</string>
|
||||
<string name="agent_connection_off">เชื่อมต่อการดีบักแบบไร้สายไม่ได้; จับคู่จะเปิดใช้งาน</string>
|
||||
<string name="agent_action_pair">จับคู่</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest ไม่มีหน้าจอจับคู่ จากคอมพิวเตอร์ ให้รันหนึ่งครั้ง: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS และ adb tcpip 5555 จากนั้นแตะอนุญาตและยอมรับข้อความในเฮดเซ็ต</string>
|
||||
<string name="agent_action_allow">อนุญาต</string>
|
||||
<string name="agent_connection_quest_waiting">ยอมรับ “อนุญาตการแก้ไขข้อบกพร่องไหม” ในเฮดเซ็ต โดยเลือกอนุญาตเสมอ</string>
|
||||
<string name="agent_connection_quest_failed">เชื่อมต่อไม่ได้ ยอมรับข้อความแก้ไขข้อบกพร่องในเฮดเซ็ต หรือหากไม่มีข้อความขึ้น ให้รัน adb tcpip 5555 จากคอมพิวเตอร์แล้วลองอีกครั้ง</string>
|
||||
<string name="agent_connection_quest_off">เข้าถึงการแก้ไขข้อบกพร่องแบบไร้สายไม่ได้ แตะอนุญาตเพื่อตั้งค่าใหม่</string>
|
||||
<string name="agent_action_install">ติดตั้ง</string>
|
||||
<string name="agent_action_sign_in">ลงชื่อเข้าใช้</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2421,8 +2416,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s หากทำไม่ได้ ให้เชื่อมต่ออุปกรณ์นี้กับคอมพิวเตอร์ที่มี ADB แล้วรันคำสั่งด้านล่าง กลับมาที่นี่แล้วตรวจสอบอีกครั้ง</string>
|
||||
<string name="phantom_instructions_off">เซสชัน Steam สามารถเริ่มได้</string>
|
||||
<string name="phantom_instructions_not_applicable">Android รุ่นนี้ไม่ใช้ขีดจำกัดนี้</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck จัดการขีดจำกัดโปรเซสลูกให้</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck เรียกใช้โปรแกรมของเซสชันในโปรเซสที่ Android ไม่นับ จึงปิดตัวเลือกสำหรับนักพัฒนาซอฟต์แวร์ไว้ได้</string>
|
||||
<string name="phantom_fix_toggle">เปิด “ปิดการจำกัดการประมวลผลข้อมูลย่อย” ในตัวเลือกสำหรับนักพัฒนา และเปิดตัวเลือกสำหรับนักพัฒนาไว้ต่อไปหลังจากนั้น</string>
|
||||
<string name="phantom_fix_no_toggle">Android รุ่นนี้ไม่มีสวิตช์สำหรับสิ่งนี้ ใช้ Wireless debugging เพื่อเปลี่ยนค่าจากอุปกรณ์นี้</string>
|
||||
<string name="upd_block_no_apk">บิลด์นี้ไม่มีให้ดาวน์โหลดสำหรับสำเนานี้ของ DroidDeck</string>
|
||||
@@ -4127,4 +4120,5 @@
|
||||
<string name="steam_store_linux_build">เกมนี้ติดตั้งเวอร์ชัน Linux ของตัวเอง ให้ติดตั้งจาก Steam</string>
|
||||
<string name="game_zoom_title">ซูมเกม</string>
|
||||
<string name="game_zoom_hint">ปรับการขยายเกมตั้งแต่ 100% ถึง 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam อยู่ในโหมดออฟไลน์และยังไม่ได้โหลด %1$s ออนไลน์ใน Steam หนึ่งครั้งเพื่อเล่นเกมนี้</string>
|
||||
</resources>
|
||||
@@ -1241,11 +1241,6 @@
|
||||
<string name="agent_action_prepare">Hazırla</string>
|
||||
<string name="agent_connection_off">Kablosuz hata ayıklamaya ulaşılamıyor; Eşleştir ile açılır</string>
|
||||
<string name="agent_action_pair">Eşleştir</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest\'te eşleme ekranı yok. Bir bilgisayardan bir kez çalıştırın: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS ve adb tcpip 5555. Ardından İzin ver\'e dokunun ve kulaklıktaki istemi kabul edin</string>
|
||||
<string name="agent_action_allow">İzin ver</string>
|
||||
<string name="agent_connection_quest_waiting">Kulaklıkta “Hata ayıklamaya izin verilsin mi?” istemini Her zaman izin ver işaretliyken kabul edin</string>
|
||||
<string name="agent_connection_quest_failed">Bağlanılamadı. Kulaklıktaki hata ayıklama istemini kabul edin veya istem görünmediyse bir bilgisayardan adb tcpip 5555 çalıştırıp tekrar deneyin</string>
|
||||
<string name="agent_connection_quest_off">Kablosuz hata ayıklamaya ulaşılamıyor. Yeniden ayarlamak için İzin ver\'e dokunun</string>
|
||||
<string name="agent_action_install">Yükle</string>
|
||||
<string name="agent_action_sign_in">Giriş yap</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2438,8 +2433,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Bu mümkün değilse bu cihazı ADB\'li bir bilgisayara bağlayıp aşağıdaki komutu çalıştırın. Buraya dönüp yeniden kontrol edin.</string>
|
||||
<string name="phantom_instructions_off">Steam oturumları başlayabilir.</string>
|
||||
<string name="phantom_instructions_not_applicable">Bu Android sürümü bu sınırı kullanmaz.</string>
|
||||
<string name="phantom_title_uncounted">Alt işlem sınırını DroidDeck yönetiyor</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck oturumun programlarını Android\'in saymadığı işlemlerde çalıştırır; bu yüzden Geliştirici seçenekleri kapalı kalabilir.</string>
|
||||
<string name="phantom_fix_toggle">Geliştirici seçenekleri\'nde “Alt işlem kısıtlamalarını devre dışı bırak” seçeneğini açın ve sonrasında Geliştirici seçeneklerini açık tutun.</string>
|
||||
<string name="phantom_fix_no_toggle">Bu Android sürümünde bunun için bir anahtar yok. Bu cihazdan değiştirmek için Kablosuz hata ayıklamayı kullanın.</string>
|
||||
<string name="upd_block_no_apk">Bu derlemede bu DroidDeck kopyası için bir indirme yok.</string>
|
||||
@@ -4157,4 +4150,5 @@
|
||||
<string name="steam_store_linux_build">Bu oyun Linux sürümünü yükler. Steam\'den yükleyin.</string>
|
||||
<string name="game_zoom_title">Oyun yakınlaştırma</string>
|
||||
<string name="game_zoom_hint">Oyun yakınlaştırmasını %100 ile %300 arasında ayarlayın</string>
|
||||
<string name="game_steam_offline_uncached">Steam çevrimdışı modda ve %1$s henüz yüklenmedi. Oynamak için Steam\'de bir kez çevrimiçi olun.</string>
|
||||
</resources>
|
||||
@@ -1257,11 +1257,6 @@
|
||||
<string name="agent_action_prepare">Підготувати</string>
|
||||
<string name="agent_connection_off">Бездротове налагодження недоступне; «Сполучити» увімкне його</string>
|
||||
<string name="agent_action_pair">Сполучити</string>
|
||||
<string name="agent_step_connection_quest_hint">У Quest немає екрана підключення. Один раз виконайте на комп’ютері: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS і adb tcpip 5555. Потім торкніться «Дозволити» й підтвердьте запит у шоломі</string>
|
||||
<string name="agent_action_allow">Дозволити</string>
|
||||
<string name="agent_connection_quest_waiting">Підтвердьте «Дозволити налагодження?» у шоломі, позначивши «Завжди дозволяти»</string>
|
||||
<string name="agent_connection_quest_failed">Не вдалося підключитися. Підтвердьте запит на налагодження в шоломі, а якщо його не було, виконайте adb tcpip 5555 на комп’ютері й спробуйте ще раз</string>
|
||||
<string name="agent_connection_quest_off">Бездротове налагодження недоступне. Торкніться «Дозволити», щоб налаштувати його знову</string>
|
||||
<string name="agent_action_install">Установити</string>
|
||||
<string name="agent_action_sign_in">Увійти</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2498,8 +2493,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Якщо це неможливо, підключіть цей пристрій до комп’ютера з ADB і виконайте команду нижче. Потім поверніться сюди і перевірте ще раз.</string>
|
||||
<string name="phantom_instructions_off">Сеанси Steam можуть запускатися.</string>
|
||||
<string name="phantom_instructions_not_applicable">Ця версія Android не використовує це обмеження.</string>
|
||||
<string name="phantom_title_uncounted">Обмеження дочірніх процесів обходить DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck запускає програми сеансу в процесах, які Android не враховує, тож параметри розробника можна не вмикати.</string>
|
||||
<string name="phantom_fix_toggle">Увімкніть «Вимкнути обмеження для дочірніх процесів» у розділі «Параметри розробника» і залишіть «Параметри розробника» увімкненими після цього.</string>
|
||||
<string name="phantom_fix_no_toggle">У цій версії Android немає перемикача для цього. Змініть це з цього пристрою за допомогою бездротового налагодження.</string>
|
||||
<string name="upd_block_no_apk">У цій збірці немає завантаження для цієї копії DroidDeck.</string>
|
||||
@@ -4237,4 +4230,5 @@
|
||||
<string name="steam_store_linux_build">Ця гра встановлює свою версію для Linux. Установіть її зі Steam.</string>
|
||||
<string name="game_zoom_title">Масштаб гри</string>
|
||||
<string name="game_zoom_hint">Налаштуйте збільшення гри від 100% до 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam в офлайн-режимі й ще не завантажив %1$s. Щоб грати, один раз перейдіть у Steam онлайн.</string>
|
||||
</resources>
|
||||
@@ -1246,11 +1246,6 @@
|
||||
<string name="agent_action_prepare">Chuẩn bị</string>
|
||||
<string name="agent_connection_off">Không truy cập được gỡ lỗi không dây; Ghép đôi sẽ bật tính năng này</string>
|
||||
<string name="agent_action_pair">Ghép đôi</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest không có màn hình ghép nối. Từ máy tính, chạy một lần: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS và adb tcpip 5555. Sau đó nhấn Cho phép và chấp nhận lời nhắc trong kính</string>
|
||||
<string name="agent_action_allow">Cho phép</string>
|
||||
<string name="agent_connection_quest_waiting">Chấp nhận “Cho phép gỡ lỗi?” trong kính, với Luôn cho phép được chọn</string>
|
||||
<string name="agent_connection_quest_failed">Không thể kết nối. Chấp nhận lời nhắc gỡ lỗi trong kính, hoặc nếu không thấy lời nhắc, hãy chạy adb tcpip 5555 từ máy tính rồi thử lại</string>
|
||||
<string name="agent_connection_quest_off">Không thể kết nối gỡ lỗi không dây. Nhấn Cho phép để thiết lập lại</string>
|
||||
<string name="agent_action_install">Cài đặt</string>
|
||||
<string name="agent_action_sign_in">Đăng nhập</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2421,8 +2416,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s Nếu không thể, hãy kết nối thiết bị này với một máy tính có ADB và chạy lệnh dưới đây. Quay lại đây và kiểm tra lại.</string>
|
||||
<string name="phantom_instructions_off">Phiên Steam có thể khởi động.</string>
|
||||
<string name="phantom_instructions_not_applicable">Phiên bản Android này không dùng giới hạn này.</string>
|
||||
<string name="phantom_title_uncounted">DroidDeck xử lý giới hạn tiến trình con</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck chạy các chương trình của phiên trong những tiến trình mà Android không tính, nên có thể để tắt Tùy chọn cho nhà phát triển.</string>
|
||||
<string name="phantom_fix_toggle">Bật “Tắt các mục hạn chế đối với tiến trình con” trong Developer options, và giữ Developer options luôn mở sau đó.</string>
|
||||
<string name="phantom_fix_no_toggle">Phiên bản Android này không có công tắc cho việc đó. Dùng Gỡ lỗi qua mạng không dây để đổi nó từ thiết bị này.</string>
|
||||
<string name="upd_block_no_apk">Bản build này không có tệp tải cho bản DroidDeck này.</string>
|
||||
@@ -4127,4 +4120,5 @@
|
||||
<string name="steam_store_linux_build">Trò chơi này cài bản dành cho Linux. Hãy cài từ Steam.</string>
|
||||
<string name="game_zoom_title">Thu phóng trò chơi</string>
|
||||
<string name="game_zoom_hint">Điều chỉnh độ phóng đại trò chơi từ 100% đến 300%</string>
|
||||
<string name="game_steam_offline_uncached">Steam đang ở chế độ ngoại tuyến và chưa tải %1$s. Hãy trực tuyến trong Steam một lần để chơi.</string>
|
||||
</resources>
|
||||
@@ -1329,11 +1329,6 @@
|
||||
<string name="agent_action_prepare">准备</string>
|
||||
<string name="agent_connection_off">无线调试无法连接;配对即可开启</string>
|
||||
<string name="agent_action_pair">配对</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest 没有配对界面。请在电脑上运行一次:adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 和 adb tcpip 5555。然后点按“允许”,并在头显中接受提示</string>
|
||||
<string name="agent_action_allow">允许</string>
|
||||
<string name="agent_connection_quest_waiting">在头显中接受“允许调试吗?”,并勾选“始终允许”</string>
|
||||
<string name="agent_connection_quest_failed">无法连接。请在头显中接受调试提示;如果没有出现提示,请在电脑上运行 adb tcpip 5555 后重试</string>
|
||||
<string name="agent_connection_quest_off">无法连接无线调试。点按“允许”重新设置</string>
|
||||
<string name="agent_action_install">安装</string>
|
||||
<string name="agent_action_sign_in">登录</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2498,8 +2493,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s 如果无法做到,请将此设备连接到装有 ADB 的电脑并运行下方命令,然后返回此处重新检查。</string>
|
||||
<string name="phantom_instructions_off">可以启动 Steam 会话了。</string>
|
||||
<string name="phantom_instructions_not_applicable">此 Android 版本不使用该限制。</string>
|
||||
<string name="phantom_title_uncounted">子进程限制由 DroidDeck 处理</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck 在 Android 不计数的进程中运行会话程序,因此开发者选项可以保持关闭。</string>
|
||||
<string name="phantom_fix_toggle">在开发者选项中打开“停止限制子进程”,之后请保持开发者选项开启。</string>
|
||||
<string name="phantom_fix_no_toggle">此 Android 版本没有该开关。请使用无线调试在此设备上更改。</string>
|
||||
<string name="upd_block_no_apk">此构建没有适用于此 DroidDeck 副本的下载。</string>
|
||||
@@ -4125,4 +4118,5 @@
|
||||
<string name="steam_store_close_steam">请先关闭 Steam</string>
|
||||
<string name="steam_store_session_wait">请先暂停 Steam 下载</string>
|
||||
<string name="steam_store_linux_build">此游戏会安装其 Linux 版本。请通过 Steam 安装。</string>
|
||||
<string name="game_steam_offline_uncached">Steam 处于离线模式,尚未加载 %1$s。请在 Steam 中联网一次后再玩。</string>
|
||||
</resources>
|
||||
@@ -1245,11 +1245,6 @@
|
||||
<string name="agent_action_prepare">準備</string>
|
||||
<string name="agent_connection_off">無線偵錯無法連線;按「配對」即可開啟</string>
|
||||
<string name="agent_action_pair">配對</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest 沒有配對畫面。請在電腦上執行一次:adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 及 adb tcpip 5555。然後輕按「允許」,並在頭戴裝置中接受提示</string>
|
||||
<string name="agent_action_allow">允許</string>
|
||||
<string name="agent_connection_quest_waiting">在頭戴裝置中接受「要允許偵錯嗎?」,並剔選「一律允許」</string>
|
||||
<string name="agent_connection_quest_failed">無法連接。請在頭戴裝置中接受偵錯提示;如果沒有出現提示,請在電腦上執行 adb tcpip 5555 後再試一次</string>
|
||||
<string name="agent_connection_quest_off">無法連接無線偵錯。輕按「允許」重新設定</string>
|
||||
<string name="agent_action_install">安裝</string>
|
||||
<string name="agent_action_sign_in">登入</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2418,8 +2413,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s 如無法這樣做,請將此裝置連接到已安裝 ADB 的電腦,並執行以下指令,然後返回這裡再檢查一次。</string>
|
||||
<string name="phantom_instructions_off">可以啟動 Steam 會話。</string>
|
||||
<string name="phantom_instructions_not_applicable">此 Android 版本不使用此限制。</string>
|
||||
<string name="phantom_title_uncounted">子程序限制由 DroidDeck 處理</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck 在 Android 不計算的程序中執行工作階段的程式,因此開發人員選項可以保持關閉。</string>
|
||||
<string name="phantom_fix_toggle">在開發人員選項中開啟「停用對子處理過程的限制」,之後請保持開發人員選項開啟。</string>
|
||||
<string name="phantom_fix_no_toggle">此 Android 版本沒有此開關。請使用無線偵錯,直接在此裝置上更改。</string>
|
||||
<string name="upd_block_no_apk">此版本沒有適用於此 DroidDeck 版本的下載。</string>
|
||||
@@ -4125,4 +4118,5 @@
|
||||
<string name="steam_store_close_steam">請先關閉 Steam</string>
|
||||
<string name="steam_store_session_wait">請先暫停 Steam 下載</string>
|
||||
<string name="steam_store_linux_build">此遊戲會安裝其 Linux 版本。請透過 Steam 安裝。</string>
|
||||
<string name="game_steam_offline_uncached">Steam 處於離線模式,尚未載入 %1$s。請在 Steam 中連線一次後再玩。</string>
|
||||
</resources>
|
||||
@@ -1245,11 +1245,6 @@
|
||||
<string name="agent_action_prepare">準備</string>
|
||||
<string name="agent_connection_off">無線偵錯無法連線;配對即可開啟</string>
|
||||
<string name="agent_action_pair">配對</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest 沒有配對畫面。請在電腦上執行一次:adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS 和 adb tcpip 5555。接著輕觸「允許」,並在頭戴式裝置中接受提示</string>
|
||||
<string name="agent_action_allow">允許</string>
|
||||
<string name="agent_connection_quest_waiting">在頭戴式裝置中接受「要允許偵錯嗎?」,並勾選「一律允許」</string>
|
||||
<string name="agent_connection_quest_failed">無法連線。請在頭戴式裝置中接受偵錯提示;如果沒有出現提示,請在電腦上執行 adb tcpip 5555 後再試一次</string>
|
||||
<string name="agent_connection_quest_off">無法連上無線偵錯。輕觸「允許」重新設定</string>
|
||||
<string name="agent_action_install">安裝</string>
|
||||
<string name="agent_action_sign_in">登入</string>
|
||||
<string name="upd_pr">PR #%1$d</string>
|
||||
@@ -2418,8 +2413,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s 如果無法這麼做,請將此裝置連接到裝有 ADB 的電腦並執行下方指令,然後返回這裡重新檢查。</string>
|
||||
<string name="phantom_instructions_off">可以啟動 Steam 工作階段。</string>
|
||||
<string name="phantom_instructions_not_applicable">此 Android 版本不使用這項限制。</string>
|
||||
<string name="phantom_title_uncounted">子程序限制由 DroidDeck 處理</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck 在 Android 不計算的程序中執行工作階段的程式,因此開發人員選項可以保持關閉。</string>
|
||||
<string name="phantom_fix_toggle">在開發人員選項中開啟「停止限制子程序」,之後請保持開發人員選項開啟。</string>
|
||||
<string name="phantom_fix_no_toggle">此 Android 版本沒有這個開關。請使用無線偵錯,直接在此裝置上變更。</string>
|
||||
<string name="upd_block_no_apk">此組建版本沒有適用於此 DroidDeck 複本的下載檔案。</string>
|
||||
@@ -4125,4 +4118,5 @@
|
||||
<string name="steam_store_close_steam">請先關閉 Steam</string>
|
||||
<string name="steam_store_session_wait">請先暫停 Steam 下載</string>
|
||||
<string name="steam_store_linux_build">此遊戲會安裝其 Linux 版本。請透過 Steam 安裝。</string>
|
||||
<string name="game_steam_offline_uncached">Steam 處於離線模式,尚未載入 %1$s。請在 Steam 中連線一次後再玩。</string>
|
||||
</resources>
|
||||
@@ -1392,11 +1392,6 @@
|
||||
<string name="agent_action_prepare">Prepare</string>
|
||||
<string name="agent_connection_off">Wireless debugging isn\'t reachable; Pair turns it on</string>
|
||||
<string name="agent_action_pair">Pair</string>
|
||||
<string name="agent_step_connection_quest_hint">Quest has no pairing screen. From a computer, run once: adb shell pm grant %1$s android.permission.WRITE_SECURE_SETTINGS and adb tcpip 5555. Then tap Allow and accept the prompt in the headset</string>
|
||||
<string name="agent_action_allow">Allow</string>
|
||||
<string name="agent_connection_quest_waiting">Accept “Allow debugging?” in the headset, with Always allow ticked</string>
|
||||
<string name="agent_connection_quest_failed">Couldn\'t connect. Accept the debugging prompt in the headset, or if none appeared, run adb tcpip 5555 from a computer and try again</string>
|
||||
<string name="agent_connection_quest_off">Wireless debugging isn\'t reachable. Tap Allow to set it up again</string>
|
||||
<string name="agent_action_install">Install</string>
|
||||
<string name="agent_action_sign_in">Sign in</string>
|
||||
<string name="agent_action_free">Free models</string>
|
||||
@@ -1760,6 +1755,7 @@
|
||||
<string name="game_link_session_busy">Stop the current session before launching a Steam game.</string>
|
||||
<string name="game_link_failed">Could not send the game to Steam. Try launching it again.</string>
|
||||
<string name="game_needs_app_model">%1$s is a UWP app. This runtime has no Windows app-model host to start it.</string>
|
||||
<string name="game_steam_offline_uncached">Steam is in offline mode and has not loaded %1$s yet. Go online in Steam once to play it.</string>
|
||||
<string name="setup_retry_removal">Retry removal</string>
|
||||
<string name="runtime_removing">Removing</string>
|
||||
<string name="runtime_removal_incomplete">Removal incomplete</string>
|
||||
@@ -2749,8 +2745,6 @@
|
||||
<string name="phantom_instructions_fix">%1$s If that is not possible, connect this device to a computer with ADB and run the command below. Return here and check again.</string>
|
||||
<string name="phantom_instructions_off">Steam sessions can start.</string>
|
||||
<string name="phantom_instructions_not_applicable">This Android version does not use this limit.</string>
|
||||
<string name="phantom_title_uncounted">Child-process limit handled by DroidDeck</string>
|
||||
<string name="phantom_instructions_uncounted">DroidDeck runs most of the session\'s programs in processes Android does not count, which keeps the session well under the limit, so Developer options can stay off. Steam and some of its helpers still count.</string>
|
||||
<string name="phantom_fix_toggle">Turn on “Disable child process restrictions” in Developer options, and keep Developer options on afterwards.</string>
|
||||
<string name="phantom_fix_no_toggle">This Android version has no switch for it. Use Wireless debugging to change it from this device.</string>
|
||||
<string name="upd_block_no_apk">This build has no download for this copy of DroidDeck.</string>
|
||||
|
||||
@@ -20,24 +20,6 @@ class GameEnvironmentTest {
|
||||
assertEquals("1", GameEnvironment.effective(config, "", "43", forceSsbs = true)[GameEnvironment.FORCE_SSBS])
|
||||
}
|
||||
|
||||
@Test fun knownGameFixesBeatSharedSettingsButNotTheGamesOwn() {
|
||||
val shared = GameEnvironment.Config(shared = mapOf("FEX_X87REDUCEDPRECISION" to "1"))
|
||||
assertEquals("0", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("1", GameEnvironment.effective(shared, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"])
|
||||
val own = shared.withEntries("12100", mapOf("FEX_X87REDUCEDPRECISION" to "1"))
|
||||
assertEquals("1", GameEnvironment.effective(own, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("1", GameEnvironment.withKnownGames(own).games["12100"]?.get("FEX_X87REDUCEDPRECISION"))
|
||||
assertEquals("0", GameEnvironment.withKnownGames(shared).games["12100"]?.get("FEX_X87REDUCEDPRECISION"))
|
||||
}
|
||||
|
||||
@Test fun aGamePresetKeepsTheGamesKnownFix() {
|
||||
val picked = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12100", "PERFORMANCE")
|
||||
assertEquals("0", GameEnvironment.effective(picked, "PERFORMANCE_TSO", "12100")["FEX_X87REDUCEDPRECISION"])
|
||||
assertEquals("PERFORMANCE", GameEnvironment.gameFexPreset(picked, "12100"))
|
||||
val other = GameEnvironment.withGameFexPreset(GameEnvironment.Config(), "12110", "PERFORMANCE")
|
||||
assertEquals("1", GameEnvironment.effective(other, "PERFORMANCE_TSO", "12110")["FEX_X87REDUCEDPRECISION"])
|
||||
}
|
||||
|
||||
@Test fun gameOverridesSharedAndPresetWithoutLeakingToOtherGames() {
|
||||
val config = GameEnvironment.Config(
|
||||
shared = mapOf("FEX_MULTIBLOCK" to "0", "VKD3D_FEATURE_LEVEL" to "12_2"),
|
||||
|
||||
@@ -81,10 +81,4 @@ class PhantomProcessLimitTest {
|
||||
assertFalse(PhantomProcessLimit.hasDeveloperToggle(33))
|
||||
assertTrue(PhantomProcessLimit.hasDeveloperToggle(34))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theLimitOnDoesNotBlockSteamWhenTheSessionStaysOutOfItsCount() {
|
||||
assertFalse(PhantomProcessLimit.blocksSteam(PhantomProcessStatus.UNCOUNTED))
|
||||
assertTrue(PhantomProcessLimit.blocksSteam(PhantomProcessStatus.ENABLED))
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.droiddeck.launcher.frontend
|
||||
|
||||
import java.io.ByteArrayOutputStream
|
||||
import java.io.File
|
||||
import java.nio.ByteBuffer
|
||||
import java.nio.ByteOrder
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertFalse
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class SteamAppInfoTest {
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
private fun file() = File(tmp.newFolder(), "appinfo.vdf")
|
||||
|
||||
private fun le(size: Int) = ByteBuffer.allocate(size).order(ByteOrder.LITTLE_ENDIAN)
|
||||
|
||||
private fun writeV28(file: File, appId: Int, name: String) {
|
||||
val kv = ByteArrayOutputStream().apply {
|
||||
fun cstring(s: String) { write(s.toByteArray()); write(0) }
|
||||
write(0x00); cstring("appinfo")
|
||||
write(0x00); cstring("common")
|
||||
write(0x01); cstring("name"); cstring(name)
|
||||
write(0x08); write(0x08); write(0x08)
|
||||
}.toByteArray()
|
||||
val body = ByteArray(60) + kv
|
||||
val out = le(8 + 8 + body.size + 4).putInt(0x07564428).putInt(1).putInt(appId).putInt(body.size).put(body).putInt(0)
|
||||
file.writeBytes(out.array())
|
||||
}
|
||||
|
||||
@Test fun anAppInTheClientsCacheIsToldApartFromOneMissingFromIt() {
|
||||
val file = file()
|
||||
WinCompSourcesTest.writeAppinfo(file, 17470)
|
||||
assertEquals(true, SteamAppInfo.cached(file, 17470))
|
||||
assertEquals(false, SteamAppInfo.cached(file, 1145360))
|
||||
}
|
||||
|
||||
@Test fun theOlderFormatWithoutAStringTableIsReadToo() {
|
||||
val file = file()
|
||||
writeV28(file, 17470, "Some Game")
|
||||
assertTrue(SteamAppInfo.cached(file, 17470)!!)
|
||||
assertFalse(SteamAppInfo.cached(file, 22330)!!)
|
||||
assertEquals("Some Game", SteamAppInfo.read(file, 17470)!!.name)
|
||||
assertNull(SteamAppInfo.read(file, 22330))
|
||||
}
|
||||
|
||||
@Test fun aMissingOrUnknownCacheIsNotTakenAsMissingTheApp() {
|
||||
val missing = file()
|
||||
assertNull(SteamAppInfo.cached(missing, 17470))
|
||||
val newer = file().apply { writeBytes(le(16).putInt(0x0756442A).putInt(1).array()) }
|
||||
assertNull(SteamAppInfo.cached(newer, 17470))
|
||||
val garbage = file().apply { writeBytes(byteArrayOf(1, 2, 3)) }
|
||||
assertNull(SteamAppInfo.cached(garbage, 17470))
|
||||
}
|
||||
}
|
||||
@@ -202,19 +202,11 @@ class GameEnvironmentStoreTest {
|
||||
assertEquals("false", published.shared["MESA_SHADER_CACHE_DISABLE"])
|
||||
assertFalse(published.shared.containsKey("VKD3D_FEATURE_LEVEL"))
|
||||
assertFalse(published.shared.containsKey("VKD3D_SHADER_MODEL"))
|
||||
assertEquals(config.games + GameEnvironment.knownGames, published.games)
|
||||
assertEquals(config.games, published.games)
|
||||
assertEquals(config.shared["LITERAL"], published.shared["LITERAL"])
|
||||
assertEquals("", published.shared["EMPTY"])
|
||||
}
|
||||
|
||||
@Test fun aKnownGamesFixReachesTheGuestWithoutBeingSavedAsTheUsersSetting() {
|
||||
GameEnvironmentStore.save(context, GameEnvironment.Config())
|
||||
assertEquals(emptyMap<String, Map<String, String?>>(), GameEnvironmentStore.read(context).games)
|
||||
val published = GameEnvironmentStore.decode(JSONObject(guest.readText()))
|
||||
assertEquals(GameEnvironment.knownGames, published.games)
|
||||
assertEquals("0", published.entries("12100")["FEX_X87REDUCEDPRECISION"])
|
||||
}
|
||||
|
||||
@Test fun publishingPreservesExplicitSharedGraphicsCapabilities() {
|
||||
val config = GameEnvironment.Config(shared = mapOf(
|
||||
"VKD3D_FEATURE_LEVEL" to "12_1", "VKD3D_SHADER_MODEL" to "6_6",
|
||||
@@ -274,7 +266,7 @@ class GameEnvironmentStoreTest {
|
||||
assertEquals(original.entries("43"), saved.entries("43"))
|
||||
assertEquals("PERFORMANCE_TSO", SessionPrefs.fexPreset(context))
|
||||
val published = GameEnvironmentStore.decode(JSONObject(guest.readText()))
|
||||
assertEquals(saved.games + GameEnvironment.knownGames, published.games)
|
||||
assertEquals(saved.games, published.games)
|
||||
assertEquals("0", published.shared["FEX_HALFBARRIERTSOENABLED"])
|
||||
assertEquals("1", published.entries("42")["FEX_HALFBARRIERTSOENABLED"])
|
||||
}
|
||||
|
||||
@@ -114,19 +114,6 @@ class GameStorageTest {
|
||||
assertFalse(GameStorage.disconnected(app))
|
||||
}
|
||||
|
||||
@Test fun aRawCardPathTheProcessCannotUseFallsBackToItsStoragePath() {
|
||||
val usable = setOf("/storage/A042-9B16/Games")
|
||||
assertEquals("/storage/A042-9B16/Games", GameStorage.reachable("/mnt/media_rw/A042-9B16/Games") { it.path in usable })
|
||||
}
|
||||
|
||||
@Test fun aUsableRawPathAndOtherPathsAreKept() {
|
||||
assertEquals("/mnt/media_rw/A042-9B16/Games", GameStorage.reachable("/mnt/media_rw/A042-9B16/Games") { true })
|
||||
assertEquals("/mnt/media_rw/0000-0000/Games", GameStorage.reachable("/mnt/media_rw/0000-0000/Games") { false })
|
||||
assertEquals("/storage/A042-9B16/Games", GameStorage.reachable("/storage/A042-9B16/Games") { false })
|
||||
val folder = tmp.newFolder("library").path
|
||||
assertEquals(folder, GameStorage.reachable(folder) { false })
|
||||
}
|
||||
|
||||
@Test fun onlyAVfatMountCountsAsFat32() {
|
||||
val mounts = """
|
||||
/dev/fuse /storage/emulated fuse rw 0 0
|
||||
|
||||
@@ -54,6 +54,32 @@ class OfflineModeTest {
|
||||
shadowOf(cm).setNetworkCapabilities(cm.activeNetwork, caps)
|
||||
}
|
||||
|
||||
private fun clientCache(appId: Int) =
|
||||
com.droiddeck.launcher.frontend.WinCompSourcesTest.writeAppinfo(com.droiddeck.launcher.frontend.SteamAppInfo.appinfoFile(context), appId)
|
||||
|
||||
@Test
|
||||
fun offlineSteamReportsAGameMissingFromItsCache() {
|
||||
writeSteam("1")
|
||||
clientCache(220)
|
||||
assertTrue(OfflineMode.active(context))
|
||||
assertTrue(OfflineMode.lacksAppInfo(context, 17470))
|
||||
assertFalse(OfflineMode.lacksAppInfo(context, 220))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun onlineSteamNeverReportsAMissingGame() {
|
||||
clientCache(220)
|
||||
assertFalse(OfflineMode.active(context))
|
||||
assertFalse(OfflineMode.lacksAppInfo(context, 17470))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun offlineSteamWithoutAReadableCacheReportsNothing() {
|
||||
writeSteam("1")
|
||||
com.droiddeck.launcher.frontend.SteamAppInfo.appinfoFile(context).delete()
|
||||
assertFalse(OfflineMode.lacksAppInfo(context, 17470))
|
||||
}
|
||||
|
||||
@Test
|
||||
fun offlineWhenChosenOrWithoutInternet() {
|
||||
assertFalse(OfflineMode.offline(manual = false, online = true))
|
||||
|
||||
@@ -21,24 +21,6 @@ class SecondaryLibraryTest {
|
||||
assertFalse(SecondaryLibrary.privateRoot(files, content).exists())
|
||||
}
|
||||
|
||||
@Test fun aCardReachedThroughItsOtherPathKeepsItsPrivateDirectories() {
|
||||
val files = tmp.newFolder("files")
|
||||
val raw = SecondaryLibrary.privateRoot(files, File("/mnt/media_rw/A042-9B16/Games")).apply { mkdirs() }
|
||||
assertEquals(raw, SecondaryLibrary.privateRoot(files, File("/storage/A042-9B16/Games")))
|
||||
val storage = SecondaryLibrary.privateRoot(files, File("/storage/B2BD-BCFC/Games")).apply { mkdirs() }
|
||||
assertEquals(storage, SecondaryLibrary.privateRoot(files, File("/mnt/media_rw/B2BD-BCFC/Games")))
|
||||
}
|
||||
|
||||
@Test fun aLibraryWithItsOwnPrivateDirectoriesKeepsThem() {
|
||||
val files = tmp.newFolder("files")
|
||||
val own = SecondaryLibrary.privateRoot(files, File("/storage/A042-9B16/Games")).apply { mkdirs() }
|
||||
val raw = File(own.parentFile, SecondaryLibrary.privateRoot(tmp.newFolder("other"), File("/mnt/media_rw/A042-9B16/Games")).name)
|
||||
raw.mkdirs()
|
||||
assertEquals(own, SecondaryLibrary.privateRoot(files, File("/storage/A042-9B16/Games")))
|
||||
assertEquals(raw, SecondaryLibrary.privateRoot(files, File("/mnt/media_rw/A042-9B16/Games")))
|
||||
assertFalse(SecondaryLibrary.privateRoot(files, File("/storage/emulated/0/Games")).exists())
|
||||
}
|
||||
|
||||
@Test fun aWritableAliasIsSelectedAndItsProbeIsRemoved() {
|
||||
val library = tmp.newFolder("shared")
|
||||
val candidate = File(tmp.root, "direct")
|
||||
|
||||
@@ -1,34 +0,0 @@
|
||||
package com.droiddeck.launcher.stores.battlenet
|
||||
|
||||
import com.droiddeck.launcher.session.SessionPrefs
|
||||
import org.junit.Assert.assertEquals
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Rule
|
||||
import org.junit.Test
|
||||
import org.junit.rules.TemporaryFolder
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.RuntimeEnvironment
|
||||
import org.robolectric.annotation.Config
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33])
|
||||
class BattleNetLibraryTest {
|
||||
private val app get() = RuntimeEnvironment.getApplication()
|
||||
@get:Rule val tmp = TemporaryFolder()
|
||||
|
||||
@Test fun aMissingLibraryLeavesBattleNetsInstallFolderAlone() {
|
||||
SessionPrefs.setGameStorage(app, "/storage/0000-0000/Games", "SD card")
|
||||
assertTrue(BattleNetClient.library(app).isEmpty())
|
||||
}
|
||||
|
||||
@Test fun anAttachedLibraryIsHandedToBattleNet() {
|
||||
SessionPrefs.setGameStorage(app, tmp.newFolder("card").path, "SD card")
|
||||
assertEquals("--library", BattleNetClient.library(app).firstOrNull())
|
||||
}
|
||||
|
||||
@Test fun internalStorageIsHandedToBattleNetWhenItIsTheChoice() {
|
||||
SessionPrefs.setGameStorage(app, SessionPrefs.GAME_STORAGE_OFF, "")
|
||||
assertEquals("--library", BattleNetClient.library(app).firstOrNull())
|
||||
}
|
||||
}
|
||||
@@ -1,37 +0,0 @@
|
||||
package com.droiddeck.launcher.stores.steam
|
||||
|
||||
import androidx.compose.runtime.State
|
||||
import androidx.compose.runtime.snapshots.Snapshot
|
||||
import androidx.compose.runtime.snapshots.StateObject
|
||||
import com.droiddeck.launcher.stores.StoresState
|
||||
import org.junit.Assert.assertNull
|
||||
import org.junit.Assert.assertTrue
|
||||
import org.junit.Test
|
||||
import org.junit.runner.RunWith
|
||||
import org.robolectric.RobolectricTestRunner
|
||||
import org.robolectric.annotation.Config
|
||||
import kotlin.concurrent.thread
|
||||
|
||||
@RunWith(RobolectricTestRunner::class)
|
||||
@Config(sdk = [33], manifest = Config.NONE)
|
||||
class SteamPickingSnapshotTest {
|
||||
@Test
|
||||
fun theInstallPickerIsReadableInASnapshotOpenedBeforeTheSteamEngineStarts() {
|
||||
StoresState.steamPicking = null
|
||||
val snapshot = Snapshot.takeMutableSnapshot()
|
||||
try {
|
||||
thread { SteamStore.hashCode() }.join()
|
||||
assertNull(snapshot.enter { StoresState.steamPicking })
|
||||
} finally {
|
||||
snapshot.dispose()
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
fun theSteamEngineHoldsNoComposeState() {
|
||||
val stateFields = SteamStore::class.java.declaredFields.filter {
|
||||
StateObject::class.java.isAssignableFrom(it.type) || State::class.java.isAssignableFrom(it.type)
|
||||
}
|
||||
assertTrue(stateFields.joinToString { it.name }, stateFields.isEmpty())
|
||||
}
|
||||
}
|
||||
@@ -9,25 +9,6 @@ import org.junit.Test
|
||||
class XodusDiagnosticsTest {
|
||||
private val rejected = Regex(Xodus.SIGN_IN_REJECTED)
|
||||
|
||||
@Test fun aDeviceLimitReachesTheInstallerWithoutBecomingASignInFailure() {
|
||||
val line = "NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200"
|
||||
val tail = listOf(line).filter { it.matches(Xodus.reportable) }
|
||||
assertEquals(listOf(line), tail)
|
||||
assertFalse(line.matches(rejected))
|
||||
assertEquals(com.droiddeck.launcher.R.string.stores_xbox_device_group_full, XboxInstaller.licenseRefusal(tail))
|
||||
}
|
||||
|
||||
@Test fun aLaterLicenseSuccessClearsTheDeviceLimitThroughTheDiagnosticFilter() {
|
||||
val stderr = listOf(
|
||||
"NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-device-limit 200",
|
||||
"NEXUS_CONTENT_LICENSE_DIAGNOSTIC_V1 content-parsed 200",
|
||||
"NEXUS_EXTRACT_DIAGNOSTIC_V1 extract-failed"
|
||||
)
|
||||
val tail = stderr.filter { it.matches(Xodus.reportable) }
|
||||
assertEquals(stderr, tail)
|
||||
assertNull(XboxInstaller.licenseRefusal(tail))
|
||||
}
|
||||
|
||||
@Test fun aContentLicenseRejectionIsRecognised() {
|
||||
assertTrue("Microsoft content licensing rejected sign-in (HTTP 401). Sign in again in Settings.".matches(rejected))
|
||||
}
|
||||
|
||||
@@ -27,28 +27,6 @@ bytes for dimensions at least four pixels:
|
||||
|
||||
These are pixel payloads, not driver allocation sizes or measured FPS gains.
|
||||
|
||||
## Scratch ownership and rebuilds
|
||||
|
||||
Each `FrameGen` instance owns its scratch buffers, mappings and descriptor sets.
|
||||
A size or live-preset rebuild first confirms GPU completion and resets that
|
||||
instance's descriptor pool, then releases the old scratch and image resources.
|
||||
Motion/history validity is reset with the rebuilt images. Repeated preparation
|
||||
at the same size and ordinary frame recording do not add device-idle waits.
|
||||
|
||||
Healthy destruction releases the descriptor pool, mapped scratch buffers and
|
||||
images. The native engine releases its input ring only after the chain confirms
|
||||
completion, so an input image is not destroyed before the wait.
|
||||
|
||||
If `vkDeviceWaitIdle` fails with an error other than
|
||||
`VK_ERROR_DEVICE_LOST`, the affected instance becomes unusable: further
|
||||
recording and rebuilding stop, and its Vulkan resources and input ring are
|
||||
intentionally retained because GPU completion is unknown. Device loss follows
|
||||
a separate teardown path: `FrameGen::destroy()` releases its owned resources
|
||||
without another wait and returns true, allowing the Engine to release the
|
||||
input ring. This is local DD-FG containment, not compositor-wide GPU recovery.
|
||||
A descriptor-pool reset failure also stops that resize without releasing the
|
||||
resources, but healthy teardown can still release them.
|
||||
|
||||
## Validation
|
||||
|
||||
Run `python3 -m unittest discover -s tools/tests -p 'test_ddfg_flow_levels.py'`.
|
||||
@@ -57,10 +35,4 @@ selected through the usual SDK/NDK environment variables. It compiles the actual
|
||||
DD-FG chain against a mock Vulkan dispatch table and checks resource counts,
|
||||
dispatch order and sizes, valid descriptor bindings, both models, every preset,
|
||||
2x/3x/4x generation, small/odd extents, resize and live preset changes.
|
||||
The same harness enforces descriptor-pool capacity, accounts for all live
|
||||
resources, and models pending GPU work to reject early cleanup. Lifecycle cases
|
||||
cover repeated rebuilds, same-size restarts, two simultaneous instances,
|
||||
automatic/idempotent destruction, partial resize allocation, failed GPU waits,
|
||||
and failed descriptor-pool resets. The actual native `Engine` is included to
|
||||
check the input-ring destruction order.
|
||||
It does not execute shaders on a GPU or replace on-device validation.
|
||||
@@ -1,68 +0,0 @@
|
||||
# Experimental spatial upscaling after frame generation
|
||||
|
||||
The compositor limits effects output to the logical scene size while frame
|
||||
generation is active. This avoids running interpolation over the full phone
|
||||
panel, but can make FSR/GSR/NIS see equal input and output sizes and skip their
|
||||
spatial pass. Version 0.5.0 instead upscaled before interpolation, which made
|
||||
the interpolation workload scale with panel resolution.
|
||||
|
||||
This experiment keeps the existing source-resolution selection and runs frame
|
||||
generation at the effects input size. Each generated frame and the final real
|
||||
frame then uses the selected spatial filter at the mapped display size.
|
||||
It introduces no extra frame queue or CPU fence wait. Performance and latency
|
||||
improvements are hypotheses, not measured results.
|
||||
|
||||
## Scope and activation
|
||||
|
||||
Use an SDR game with a real input buffer smaller than the mapped output.
|
||||
Enable frame generation and select AMD FSR 1, FSR Fit, Snapdragon GSR/GSR HQ,
|
||||
or NIS in the scaling filter setting. Keep additional effects (CAS, color,
|
||||
FXAA, CRT, etc.) off for this experiment. Sharpen-only, linear, nearest,
|
||||
frame-generation-off, HDR and cardboard paths retain their existing behavior.
|
||||
Combining a spatial filter with additional effects also retains the old path;
|
||||
this experiment does not claim to fix that combination.
|
||||
|
||||
Source selection remains conservative. A game already rendering a native-size
|
||||
backbuffer cannot recover its lower internal rendering resolution here.
|
||||
Overlays included in the low-resolution input are interpolated/upscaled with
|
||||
that input; this is not a separate native-resolution HUD reconstruction.
|
||||
|
||||
GPU targets and source descriptors are separate for each presentation slot so
|
||||
recording one generated frame cannot replace another frame's bindings.
|
||||
Source views are released after the existing frame-completion fence; targets
|
||||
are cached and destroyed with the effects device. This increases GPU memory
|
||||
use with interpolation multiplier and panel resolution. Allocation failures
|
||||
retain the input-sized image and the existing screen blit fallback.
|
||||
|
||||
## Applying and reverting
|
||||
|
||||
Install the test APK produced for this PR. Check its signing/package identity
|
||||
before replacing an installed release: an Actions test-key APK is not a
|
||||
release-signed update. An official signed test build requires the repository's
|
||||
normal publication authorization. Back up session logs and record the exact
|
||||
APK commit, GPU driver, engine and game settings for comparisons.
|
||||
|
||||
No setting migration is required. Disable frame generation or select Linear
|
||||
to return to the previous presentation path. Do not mix this test with Vulkan
|
||||
feature-level or game compatibility changes.
|
||||
|
||||
## Device validation required before merge
|
||||
|
||||
- Compare the same scene on baseline main and this branch: FG off/on, Linear,
|
||||
FSR, GSR, GSR HQ, NIS, FSR Fit, sharpen-only and nearest.
|
||||
- Test each supported interpolation multiplier, both engines, warm-up/no
|
||||
generated frames, 720p-to-1080p and 1080p-to-panel scaling, and no upscale.
|
||||
- Check real and generated frames for consistent sharpness, halos, ghosting,
|
||||
text/cursor artifacts, black bars, stretching and frame-order errors.
|
||||
- Change resolution/filter/engine/multiplier live; open Steam/QAM, rotate,
|
||||
suspend/resume and stop/restart. Verify no stale image, GPU loss or crash.
|
||||
- Confirm HDR, cardboard, FG-off and additional-effects fallback behavior.
|
||||
- Compare sustained frame pacing, generated vs real FPS, GPU load, memory,
|
||||
temperature and battery use after warm-up; do not treat output FPS alone as
|
||||
lower input latency. Measure input-to-display latency if equipment permits.
|
||||
- Test memory pressure and allocation failure fallback; inspect Vulkan
|
||||
validation for descriptor lifetime, image layouts and synchronization.
|
||||
|
||||
Host harnesses exercise resolution routing, generated/real frame counts,
|
||||
filter gates, fallback and source descriptor lifetime. They do not validate
|
||||
shader output, mobile-driver behavior, performance or physical input latency.
|
||||
@@ -1,28 +0,0 @@
|
||||
# Screen-effect pipeline creation
|
||||
|
||||
The screen-effect chain creates its shared render passes, sampler, descriptor
|
||||
layout/pool and pipeline layout when first used. Graphics pipelines are created
|
||||
only when the frame's settings require them, then reused until output-format
|
||||
reset or explicit chain teardown. Source-image and size changes keep the cache.
|
||||
|
||||
Pipeline preparation happens before any effect draw is recorded. If a required
|
||||
pipeline fails to initialize, the chain follows its existing whole-chain
|
||||
fallback and returns the unprocessed scene; it does not record a partial stack.
|
||||
Settings are snapshotted at frame entry, so changes during recording apply to
|
||||
the next invocation.
|
||||
|
||||
Spatial upscalers are prepared only when their dispatch path is active. FSR
|
||||
creates EASU and creates RCAS only when sharpening is enabled; sharpen-only
|
||||
mode creates RCAS. SMAA prepares its three passes only when selected, while
|
||||
keeping FXAA available for the existing SMAA scratch-allocation fallback.
|
||||
Half-precision shaders remain selected by the existing debug property. The
|
||||
optional fast NIS path and its coefficient resources are deferred until NIS is
|
||||
actually used; the existing fragment-shader fallback is retained.
|
||||
|
||||
This reduces unused pipeline creation and first-use setup work. It does not
|
||||
reduce the shader work performed each frame, and first use of a newly selected
|
||||
effect may still compile its pipelines. No background precompilation is added.
|
||||
Pipeline-count reductions are not measurements of startup latency or FPS.
|
||||
|
||||
Validation still requires the native effect-chain tests and on-device visual
|
||||
testing. Static source checks alone do not establish Vulkan runtime correctness.
|
||||
@@ -1,569 +0,0 @@
|
||||
# Android's child-process limit without developer options
|
||||
|
||||
Research log for removing DroidDeck's requirement to turn off "Restrict child processes" (or run
|
||||
`settings put global settings_enable_monitor_phantom_procs false` over wireless ADB). The goal:
|
||||
Android must not kill a Steam session for having too many Linux processes, and the user must not
|
||||
need developer options.
|
||||
|
||||
Status: **working on the AYN Thor (Android 13).** With Android's limit on and no developer option,
|
||||
a Steam session with a game running keeps 12 processes in the app's counted cgroups (63 without
|
||||
this work), and Android killed nothing in minutes of forced scans. DroidDeck's Setup reports the
|
||||
limit as handled and no longer blocks Steam. Both counting gaps below are in identical code on
|
||||
Android 12 through 16; a stock Android 14+ phone is still to be tested. The experiments are in
|
||||
`tools/phantomlab` (see the end).
|
||||
|
||||
## How Android counts and kills
|
||||
|
||||
Source: `frameworks/base/services/core/java/com/android/server/am/PhantomProcessList.java`
|
||||
(android12-release to android16-release and main; the parts below are unchanged across them).
|
||||
|
||||
1. **What is counted.** For every app process AMS knows (`mPidsSelfLocked`),
|
||||
`lookForPhantomProcessesLocked(app)` reads
|
||||
`/sys/fs/cgroup/uid_<app.info.uid>/pid_<pid>/cgroup.procs` (`/acct/...` on cgroup v1). Every
|
||||
pid listed there other than the app process itself is a "phantom process". `cgroup.procs`
|
||||
lists thread-group ids, so threads never count.
|
||||
2. **What is skipped.**
|
||||
- `if (app.appZygote || app.isKilled() || app.isKilledByAm()) return;`. `appZygote` is true
|
||||
for uids in `FIRST_APP_ZYGOTE_ISOLATED_UID..LAST_APP_ZYGOTE_ISOLATED_UID` (90000–98999),
|
||||
i.e. every process forked from an app zygote (`ProcessRecord` constructor).
|
||||
- A pid that is itself an app process (`mPidsSelfLocked.get(pid) != null`).
|
||||
- A pid whose `/proc/<pid>/cmdline` cannot be opened, whose uid cannot be read, or for which
|
||||
`pidfd_open` fails. These only happen once the process is gone (an empty cmdline reads as
|
||||
`""`, not `null`, so it is still counted).
|
||||
3. **When.** Only after AMS refreshes CPU stats (`AppProfiler.updateCpuStatsNow` →
|
||||
`updateProcessCpuStatesLocked`), at most every 5 s (`MONITOR_CPU_MIN_TIME`), and only when
|
||||
something asks for it: activity and process lifecycle events, mostly. Also from
|
||||
`setProcessGroupForPhantomProcessOfApp` when an app changes scheduling group. A new phantom
|
||||
schedules `trimPhantomProcessesIfNecessary`.
|
||||
4. **The kill.** When the device-wide total exceeds `max_phantom_processes` (32), phantoms are
|
||||
sorted by their app's oom adj (most important first), then youngest first, and the surplus is
|
||||
killed from the end of that list (`SIGKILL` and `killProcessGroup`): the least important app's
|
||||
oldest processes go first. As the foreground app, other apps' phantoms go first, so the
|
||||
practical budget is our own 32, and of ours the **oldest** die first: the session's PipeWire,
|
||||
D-Bus and Steam itself, not the game that pushed the count over.
|
||||
5. **The second killer.** `ActivityManagerService.updatePhantomProcessCpuTimeLPr`: when the app is
|
||||
at `PROCESS_STATE_HOME` or below (backgrounded, no foreground service) and a phantom used
|
||||
"excessive" CPU, `killPhantomProcessGroupLocked` kills every phantom of that app **and the app**.
|
||||
|
||||
`settings_enable_monitor_phantom_procs=false` (the developer option) switches off both on Android
|
||||
12L and later; Android 12 does not have the setting, and there only the `device_config` limit below
|
||||
applies. Raising
|
||||
`max_phantom_processes` through `device_config` (shell only) avoids only the first: the
|
||||
excessive-CPU check still runs while monitoring is on.
|
||||
|
||||
Today an idle Steam session is about 30 processes and a session with a game about 45 (#566, #575).
|
||||
|
||||
## Gap 1: an isolated process's children are never counted
|
||||
|
||||
Two independent reasons, either of which is enough:
|
||||
|
||||
- **Wrong cgroup path.** The path is built from `app.info.uid`, the *package's* uid (10148 here),
|
||||
but an isolated process runs as its own uid (99000+ for `android:isolatedProcess`, 90000+ from an
|
||||
app zygote) and its cgroup is `uid_<isolated uid>/pid_<pid>`. The lookup finds nothing
|
||||
(`FileNotFoundException`, logged only with `DEBUG_PROCESSES`) and the process is skipped.
|
||||
- **App zygote skip.** Processes forked from an app zygote (`android:useAppZygote="true"`) are
|
||||
skipped outright by the `app.appZygote` check, by design ("doesn't have its own acct entry").
|
||||
This one survives even if Google fixes the path.
|
||||
|
||||
Measured with `max_phantom_processes=4` and monitoring on, children killed by Android:
|
||||
|
||||
| Where the children were forked | Children | Thor (Android 13) | Emulator (Android 15) |
|
||||
|---|---|---|---|
|
||||
| Main app process (control) | 10 | 6 ("Trimming phantom processes") | 6 |
|
||||
| plain `isolatedProcess` service (uid 99000+) | 10 | 0 | 0 |
|
||||
| `isolatedProcess` + `useAppZygote` service (uid 90000) | 40 | 0 | 0 |
|
||||
|
||||
`cgroup.procs` of `/sys/fs/cgroup/uid_90000/pid_<service>` held all 41 pids the whole time; the
|
||||
phantom list (`dumpsys activity processes`, "All Active App Child Processes") only ever showed the
|
||||
main process's children. With the limit at 4, the Thor also trimmed another app's `logcat` child,
|
||||
as expected for the device-wide count.
|
||||
|
||||
## Gap 2: a process that execs in place is an app process, not a phantom
|
||||
|
||||
An `android:process` service process can `execve()` a Linux program in place. If it first clears
|
||||
`FD_CLOEXEC` on its binder fd, the binder node stays alive, so AMS never sees the process die. The
|
||||
pid stays in `mPidsSelfLocked` and is never counted. Its own children are counted as usual.
|
||||
|
||||
Same results on the Thor and the emulator:
|
||||
|
||||
| Worker `:wN` | Result |
|
||||
|---|---|
|
||||
| exec `/system/bin/sleep`, binder fd closed by exec (control) | "has died" at once; AMS restarts the service |
|
||||
| exec `/system/bin/sleep`, binder fd kept | stays `fg`/`(service)` while bound; survives a density change, `am send-trim-memory`, Home/back cycles |
|
||||
| exec `sh` forking 6 `sleep`s, binder fd kept | `sh` not counted; its 6 children counted (2 trimmed at limit 4) |
|
||||
| guest exits (killed) | AMS logs "has died" and removes the cgroup, as for any app process |
|
||||
|
||||
Calls AMS makes into the process after the exec fail cleanly: the kernel logs
|
||||
`binder_alloc_buf, no vma` and AMS gets `DeadObjectException` ("Failed for dead process.
|
||||
ClientTransactionItem=ConfigurationChangeItem", "Remote exception" for trim). Nothing kills the
|
||||
process for it. It is frozen like any cached process when the app goes to the background without a
|
||||
foreground service.
|
||||
|
||||
## What else was tried
|
||||
|
||||
| Idea | Result |
|
||||
|---|---|
|
||||
| Move a process to another cgroup (`cgroup.procs` of root, of `uid_N`) | `EACCES`: dirs are `system:system 0775` and SELinux denies `cgroup_v2` writes to apps |
|
||||
| Make a sub-cgroup under our `pid_N` (children of a sub-cgroup are not in its `cgroup.procs`) | `EACCES` |
|
||||
| `clone3(CLONE_INTO_CGROUP)` | apps cannot open `/sys/fs/cgroup` (SELinux `read` denied) |
|
||||
| `unshare(CLONE_NEWUSER)` / `CLONE_NEWCGROUP` | `EINVAL` (no user namespaces in GKI) / `EPERM` |
|
||||
| Empty `/proc/<pid>/cmdline` | read as `""`, still counted; changing it needs `PR_SET_MM` (`CAP_SYS_RESOURCE`) |
|
||||
| Run "processes" as threads (`CLONE_THREAD`) | only with a shared address space; Steam, Chromium and Wine rely on real processes |
|
||||
| More `android:process` services hosting the tree | each process's children are still phantoms; only the process itself is free (Gap 2) |
|
||||
| Rely on kill order | we are the foreground app, so our own newest processes die first |
|
||||
|
||||
## What an isolated process can do
|
||||
|
||||
Measured from both isolated variants (domain `isolated_app`) against the normal app
|
||||
(`untrusted_app`), with fds created by the app and passed over binder:
|
||||
|
||||
| | app | isolated |
|
||||
|---|---|---|
|
||||
| `fork` | ✅ | ✅ (children uncounted) |
|
||||
| `execve` of an executable in the APK's lib dir (as `libddexec.so`) | ✅ | ✅ |
|
||||
| `execve` of `/system/bin/*` | ✅ | ✅ |
|
||||
| create `AF_INET` socket | ✅ | ❌ `EACCES` |
|
||||
| `connect`/`send`/`recv` on a TCP or UDP socket the app created | ✅ | ✅ (policy: "network sockets received over IPC") |
|
||||
| read/write a passed unix stream socket / pipe | ✅ | ✅ |
|
||||
| `open()` an app data file by path | ✅ | ❌ `ENOENT` (not mounted) |
|
||||
| read/write/`mmap` a passed app data file | ✅ | ✅ |
|
||||
| `mmap(PROT_EXEC)` of a passed app data file | ✅ | ❌ `EACCES` |
|
||||
| receive a passed directory fd | ✅ | ❌ (binder refuses the transaction) |
|
||||
| `mmap(PROT_EXEC)` of a memfd, anonymous RWX (JIT) | ✅ | ✅ |
|
||||
| GPU device (`/dev/kgsl-3d0`, `/dev/mali0`) | ✅ | ❌ (`neverallow`, also for passed fds) |
|
||||
| signal or read `/proc` of the app's processes | ✅ | ❌ (`EPERM`, `EACCES`) |
|
||||
|
||||
This table is the emulator (stock, enforcing policy). **The Thor's ROM runs `isolated_app`
|
||||
permissive** (every isolated denial logs `permissive=1`; `untrusted_app` is enforcing): there an
|
||||
isolated process could also create inet sockets and open `/dev/kgsl-3d0`. That is an AYN quirk and
|
||||
must not be relied on; design for the enforcing column.
|
||||
|
||||
Isolated processes can talk to each other through abstract unix sockets. Everything else in the
|
||||
app's world (files, sockets to the app's servers, the GPU) has to be brokered through fds.
|
||||
|
||||
## Routes
|
||||
|
||||
### A. An isolated tier for everything that does not touch the GPU
|
||||
|
||||
Run a session's GPU-free processes inside one app-zygote isolated service; their whole fork tree is
|
||||
invisible. Needed:
|
||||
|
||||
- **Loader:** `libddexec.so` already starts programs without the kernel loading them; it would take
|
||||
its ELF from an inherited fd and copy segments into anonymous or memfd memory, since isolated
|
||||
processes cannot map app files executable. A broker can hand out one sealed memfd per library so
|
||||
pages stay shared.
|
||||
- **File broker:** the native hook already funnels path calls through `rewrite_path`; in the
|
||||
isolated tier those calls become requests to a broker in the app, which opens the file and returns
|
||||
the fd. Directories cannot be passed, so `opendir`/`getdents` are served from listings.
|
||||
Raw syscalls (Wine's preloader, FEX internals) need a seccomp `SIGSYS` trap, which the hook
|
||||
already uses for Android's own filter.
|
||||
- **Sockets:** `socket(AF_INET*)` → broker-created socket; then the process connects itself.
|
||||
Unix sockets between isolated processes become abstract sockets; connections to servers in the
|
||||
app (compositor, PipeWire, VkBridge) are connected by the broker.
|
||||
- **No signals across the boundary:** a process and everything it signals or ptraces must be on the
|
||||
same side. Wine's processes all depend on `wineserver` signalling them, so Wine stays with the game.
|
||||
- **GPU:** only through a remoting layer such as VkBridge (already used on Mali), never directly.
|
||||
|
||||
Candidates for the tier: the Steam client and its web helper's renderer/utility processes (with
|
||||
the web helper's GPU work remoted or in software), the session scripts, D-Bus services, PipeWire
|
||||
helpers, Python daemons. A cross-tier launch (Steam starting the game's `reaper`) runs through the
|
||||
broker, with a small stand-in process left in the tier for Steam to wait on. Stand-ins are free
|
||||
there.
|
||||
|
||||
### B. Exec-in-place workers for long-lived processes
|
||||
|
||||
Declare a pool of `android:process` services (`:g0`…`:g95`). Each long-lived program runs as the
|
||||
main process of one worker (Gap 2): full app privileges, direct GPU, normal signals and `/proc`
|
||||
(same uid and SELinux domain), and the app hears its exit through binder death. Costs and limits:
|
||||
|
||||
- A worker is a zygote fork (~100 ms); a pre-started pool removes the wait.
|
||||
- Only the worker's main process is free; its children count. So each long-lived program must be
|
||||
started in its own worker, not forked by its parent.
|
||||
- Programs the app or the session script start and do not wait on (Xwayland, D-Bus, PipeWire,
|
||||
helpers, `wineserver -p`) can move with a `droiddeck-spawn` client and no other change.
|
||||
- A program another guest forks and waits on (Wine's processes, Steam's children) needs the hook to
|
||||
hand the exec to a worker and translate the pid for the parent: `wait4`, `kill`, `/proc/<pid>`,
|
||||
`SIGCHLD`. All app processes share zygote's session (sid 0, pgid of zygote), so `setpgid` and
|
||||
process-group signals across workers are possible.
|
||||
- Relies on AMS never pinging a process; today it only sends oneway calls that fail harmlessly.
|
||||
|
||||
### Measured on the Thor: a real session
|
||||
|
||||
An idle Steam session (Big Picture at the library, Decky on, 0.7.11 / main `b08d8e8e1`) holds
|
||||
**48 counted processes** in the app's cgroup, well past 32 before any game starts:
|
||||
9 bash, 6 python3, 5 dbus-daemon (with the portals and at-spi under the session bus), 4 Decky
|
||||
PluginLoader, 4 steamwebhelper, 2 Xwayland, gamescope and its reaper, PipeWire and WirePlumber,
|
||||
Steam, the clipboard bridge, and the app's own logcat, PulseAudio and audio relay.
|
||||
|
||||
Prototype of B on this branch (`runtime/GuestWorkers.kt`, `droiddeck-spawn`, `dd_spawn` in the
|
||||
session script; `DD_SPAWN_DAEMONS=0` turns it off): 24 `:gN` worker services, a spawn socket in the
|
||||
app, and the session script starting the clipboard bridge, the system bus, login1 and the session
|
||||
bus through it. Result:
|
||||
|
||||
- Each of the four runs as its own app process (`/sys/fs/cgroup/uid_<app>/pid_<worker>` with one
|
||||
process). login1's sleep handshake, NetworkManager (state 70, full connectivity) and the Steam
|
||||
library all work.
|
||||
- Counted processes: **45** instead of 48. The session bus took its 9 activated children with it, so
|
||||
they are still counted, under its worker.
|
||||
|
||||
So starting top-level daemons in workers is not enough. What is left is the processes other
|
||||
programs start. Of the 47 counted processes in that session, **40 are exec'd programs** and only 7
|
||||
are forks without an exec (the session script's `( … ) &` subshells). A handoff inside the native
|
||||
hook, at `execve()` in a forked child, could move all 40, leaving about 7 counted at idle. That needs
|
||||
the pid translation described in B (the parent keeps the forked pid; `wait4`, `kill`, `SIGCHLD` and
|
||||
`/proc/<pid>` go to the worker's process).
|
||||
|
||||
### Handoff in the native hook (prototype, on this branch)
|
||||
|
||||
`tools/nativeguest/hook/handoff.c`. At `execve()` in a forked child, a program named in
|
||||
`DD_HANDOFF` is sent to the app's spawn socket instead of exec'd: the request carries argv, the
|
||||
environment, the working directory and every inheritable fd with its number, and a worker execs
|
||||
the program with those fds in place. The child records "my pid is now worker pid P" in a memfd
|
||||
table its parent created, and exits. In the parent, `wait4`/`waitpid`/`wait`/`wait3`/`waitid` and
|
||||
`kill` treat the forked pid as P until P exits. P's hook writes its exit status into the table; for
|
||||
a program that ends without `exit()` (a signal) the app writes a report tagged with the child it is
|
||||
for (from `ApplicationExitInfo`), which the parent's hook takes once P is gone, and sends the parent
|
||||
`SIGCHLD`. Only the hook moves an entry to "exited", by compare-and-swap. A launch takes three
|
||||
answers: the hook's "go" once it has P's pid, the worker's answer to the app's commit, and the
|
||||
app's "ok" once the worker runs the program; without any of them the program runs locally instead,
|
||||
never twice. The child's side is
|
||||
vfork-safe (Python's subprocess execs under `vfork`). Details that mattered:
|
||||
|
||||
- **Scripts:** the list also matches the `#!` interpreter (`python3` for `droiddeck-agent`).
|
||||
- **Exec chains:** a forked child that first execs a wrapper (`env`, `taskset`, a shell script,
|
||||
Wine re-executing itself through `wine-preloader`) keeps its parent's table fd across the exec,
|
||||
so the wrapper's own exec can still be handed off.
|
||||
- **Not handed off:** Steam and the web helper's browser process (gamescope finds a window's app by
|
||||
walking its process's parents) and its utility processes (the client refuses its transport —
|
||||
"no transport is available" — from processes that are not its children). The web helper's
|
||||
renderers hand off fine.
|
||||
- **Game windows outside the reaper:** gamescope finds a window's app by walking its process up to
|
||||
Steam's `reaper`, which a handed-off Wine process is not under. Proton sets `STEAM_GAME` itself
|
||||
from `SteamGameId`, but a store game's is a 64-bit id and is not set: Splinter Cell (Ubisoft)
|
||||
ran without ever taking focus. The agent now tags such a window from its process's `SteamAppId`
|
||||
also on the arm64 client.
|
||||
- One-shot programs cost a worker start (~100 ms) each, so the list names long-lived programs only
|
||||
(`xprop+-spy`: `name+prefix` matches only when an argument starts with prefix).
|
||||
- **Near the limit, a shell's children too.** Once 20 of the app's processes are counted (the hook
|
||||
counts them in `/proc`: this uid's processes in an app process's cgroup other than that process),
|
||||
a child of `bash`, `sh`, `dash`, `zsh`, `ksh`, `fish`, `make` or `xargs` is handed off even when
|
||||
it is not listed. Those parents wait with `wait()`, which the hook answers; Qt's `QProcess` and
|
||||
other parents that watch a child by pidfd or `/proc` would see the forked child end at once, so
|
||||
their children stay. A job in the foreground of its controlling terminal (`TIOCGPGRP` on
|
||||
`/dev/tty`, whatever its standard fds are: `cmd | less`, `less < file`) stays too: a handed-off
|
||||
program has no controlling terminal, so `/dev/tty`, ^C and job control would miss it. A job a
|
||||
shell with job control runs (any process group other than the shell's, `cmd &` in an interactive
|
||||
terminal, each member of its pipeline) stays as well: the shell waits for its stops and continues,
|
||||
which happen to a handed-off program's worker and never reach that wait. A job started with `&`
|
||||
from a shell without job control (a script, `bash -c`) runs in the shell's group reading
|
||||
`/dev/null`, and goes. Steam's client and launch chain (`steam`, its
|
||||
web helper, `droiddeck-steam-x64`, `reaper`, `steam-launch-wrapper`, `pw-audio-namespace`,
|
||||
gamescope, anything under `Steam/`) never go this way. In the desktop
|
||||
session (KDE Plasma, 17–19 counted at rest), a Konsole running 40 `sleep 600 &` jobs peaked at
|
||||
61 counted and lost 27 processes to Android's limit (Konsole, D-Bus, the portal) before this, and
|
||||
at 20 with no kills after. Still counted, and not handed off: a terminal's foreground jobs (a
|
||||
`make -j` and its compilers), the D-Bus daemon's activation helpers (forks that never exec) and
|
||||
the desktop's own programs started by KDE's launchers.
|
||||
|
||||
Default list: the portals, at-spi, `python3`, PipeWire, WirePlumber, Decky's PluginLoader, the log's
|
||||
`gnudd`, `xprop -spy`, the web helper's renderers, `wine`, `wine-preloader`, `wineserver`.
|
||||
|
||||
Measured on the Thor, same session and game as above:
|
||||
|
||||
| | counted children, idle | counted, Bully (Proton) running |
|
||||
|---|---|---|
|
||||
| main, no handoff | 48 | 63 |
|
||||
| handoff | **26** | **29** |
|
||||
|
||||
With the handoff on, Bully reached its menu at 30 fps, kept focus, and Steam's library, Decky, the
|
||||
portals, NetworkManager/login1 and the agent all worked.
|
||||
|
||||
Then Android's own limit was switched back on (`settings_enable_monitor_phantom_procs=true`,
|
||||
default limit 32) with the game running, and a scan was forced every 20 s for 3 minutes
|
||||
(`dumpsys meminfo` refreshes the CPU stats the scan runs on; process starts and activity changes do
|
||||
too, irregularly):
|
||||
|
||||
| | Android listed | killed | session |
|
||||
|---|---|---|---|
|
||||
| no handoff (`DD_SPAWN_DAEMONS=0`, same build) | 63 | **33**, oldest first: the session's bash, Python daemons, D-Bus, Xwayland, Steam, PipeWire, gamescope's reaper | FAILED |
|
||||
| handoff | 27–29 (device-wide) | **0** in 9 scans | game running throughout |
|
||||
|
||||
### Taken further: the session itself in workers
|
||||
|
||||
A second round moved most of what was still counted:
|
||||
|
||||
- **The app's own processes:** `HostProcess.startUncounted` runs a host command in a worker with the
|
||||
same contract as `HostProcess.start` (output lines, exit code, working directory). The session
|
||||
root, the app log's logcat, PulseAudio and the DirectAudio relay use it. A worker cannot `chdir`
|
||||
before its exec, so Android's `sh` does it from an environment of its own and exports the
|
||||
program's (`env -i` cannot be used: the APK's library path contains `==`).
|
||||
- **PulseAudio** closes every inherited fd at start, the worker's binder fd included, and Android
|
||||
then killed the worker as dead (the SIGKILL came from system_server's `ActivityManager` thread,
|
||||
seen with the `signal_generate` ftrace event, which shell can enable on the Thor). The daemon
|
||||
spares the fd named in `PULSE_PASSED_FD`; the worker replaces `@DDH_WORKER_BINDER_FD@` in a
|
||||
program's arguments and environment with its `/dev/binder` fd number, so PulseAudio is given it.
|
||||
Started as a normal child the token reads as fd 0, which the daemon ignores.
|
||||
- **The script's long-lived subshells:** `dd_job FUNCTION` runs a function in a new `bash` that first
|
||||
loads the shell's variables, functions and options from a state file, so it is an exec'd program
|
||||
the hook can hand off (`bash+dd-job`). `$!`, `kill` and `wait` keep working. The zRAM scanner,
|
||||
the property watcher, Decky's supervisor and the request/timer loop use it.
|
||||
- **The log pipeline** is `droiddeck-log-writer`, a script of its own instead of a `{ gnudd; cat; }`
|
||||
subshell.
|
||||
- **gamescope, its reaper and the inner `droiddeck-session steam`** are handed off. Steam, its web
|
||||
helper's browser process and its utility processes still are not (see above).
|
||||
|
||||
Things this needed, found the hard way:
|
||||
|
||||
- **The binder fd is the worker's life.** It sits above every fd number the program gets; programs
|
||||
that close all inherited fds (gamescope) are kept from closing it (the hook's kept fds, also
|
||||
against `CLOSE_RANGE_CLOEXEC`); children never send it along with a handoff; and the hook closes
|
||||
copies in every other process (`DDH_WORKER_PID`), so a worker's exit is seen when its program
|
||||
exits. A worker that lost its binder fd was killed by Android within milliseconds.
|
||||
- **A session of its own (`setsid`) for every worker.** All app processes are in zygote's process
|
||||
group, so a program signalling its group reached the app itself (the hook also refuses
|
||||
`kill(0)`/`kill(-pgid)` into zygote's group, and `kill(-1)`). `reap_orphans` in the session
|
||||
script stands down when its parent is zygote.
|
||||
- **Nested handoffs** (a program in a worker handing off its own child): inherited `DDH_*`
|
||||
variables are dropped from each request.
|
||||
- **Requests carry up to 240 fds,** in chunks of 60 (`LocalSocket` reads at most 64 per read), after
|
||||
the request itself; the spawn server catches everything per connection (an uncaught exception there
|
||||
took the whole app down once).
|
||||
- **The table is made at a process's first fork,** not only when `DD_SPAWN` is in its environment at
|
||||
start: a shell that exports it has no sign of it in its own environment.
|
||||
- **Exit status:** the program's hook records it with `on_exit` or in `_exit()` into the parent's
|
||||
table; the app's `ApplicationExitInfo` is only the fallback (signals). A program inherits its
|
||||
forked parent's ignored signals, open-files limit and umask (`DDH_SIGIGN`, `DDH_NOFILE`,
|
||||
`DDH_UMASK`).
|
||||
|
||||
Measured on the Thor, Bully under Proton, Android's limit on (default 32), a scan forced every 20 s:
|
||||
|
||||
| | counted, idle | counted, in game | killed in 3 min |
|
||||
|---|---|---|---|
|
||||
| main (no handoff) | 48 | 63 | 33, session failed |
|
||||
| first round | 26 | 29 | 0 |
|
||||
| second round | 9 | 14 | 0 |
|
||||
| **third round** | **7–9** | **12** | **0** in 2 min, game kept focus |
|
||||
|
||||
Still counted at idle: `run_gamescope`'s subshell, Steam, its web helper's browser and
|
||||
two or three utility processes, the session bus's activation babysitter and Decky's
|
||||
multiprocessing child (forks without an exec). In game, also Steam's launch chain (`sh`,
|
||||
`pw-audio-namespace`, `reaper`) and the `wineserver` daemon (a fork of its first process, which
|
||||
lingers in its worker; see below).
|
||||
|
||||
### Third round
|
||||
|
||||
- **PulseAudio in a worker** (above).
|
||||
- **`posix_spawn()`:** Python 3.13+ (`subprocess`, even with `close_fds`) and GLib's `g_spawn` start
|
||||
programs with `posix_spawn()`, whose child makes the exec system call itself, past the hook. A
|
||||
listed program is now spawned with `fork()` and the hook's `execve()`; the hook replays glibc's
|
||||
file actions and attributes in the child, and a close-on-exec pipe returns an exec error as
|
||||
`posix_spawn()`'s result. Proton's Wine and at-spi's bus came out of the count this way.
|
||||
- **The table fd survives a child that closes every inherited fd** (Python's `subprocess` before
|
||||
exec): it sits at fd 800 or above and is one of the hook's kept fds. Reopening it from
|
||||
`/proc/<owner>/fd` does not work on Android (EACCES). A nonce in the table's header tells it from
|
||||
a file a program put at that number (inode numbers are rewritten by the hardlink emulation).
|
||||
- **The exit status comes from the program itself.** The worker first runs a `bash` that `cd`s and
|
||||
execs the program; that `bash` closed the `DDH_TABLE` fd as someone else's table, so the
|
||||
program after it could never report, and statuses came from `ApplicationExitInfo`, late or
|
||||
unknown. The `DDH_TABLE` fd is now kept through that exec, and `_exit()` reports as `exit()` does.
|
||||
- **Daemons:** Android kills every process in a worker's cgroup when the worker's own process ends
|
||||
(`libprocessgroup: Successfully killed process cgroup`). `wineserver` forks the server and leaves
|
||||
with `_exit(0)`, so the server died with it and Wine stopped with "the wine server failed to run".
|
||||
A handed-off program's process now reports its status and then stays, with no fds but the
|
||||
binder's and all signals blocked, until no other process is left in its cgroup (found through
|
||||
`/proc/<pid>/cgroup`, as `cgroup.procs` is not readable). It does so only when it is
|
||||
single-threaded at exit, and never for the processes the app starts itself (the session root),
|
||||
whose exit the app waits for.
|
||||
- **`reap_orphans`** in the session script killed every process whose parent was zygote (all the
|
||||
app's workers, the session root among them) when the inner `droiddeck-session` ended in a
|
||||
worker: the guest cannot see zygote in `/proc`. It now stands down when `DDH_WORKER_PID` is
|
||||
its own pid.
|
||||
- **`DD_HANDOFF_DEBUG=/path`** appends the hook's trace to a file. On stderr it broke Steam's
|
||||
login, and the trace from a game's processes went to a pipe nobody read.
|
||||
- **Finding the sender of a SIGKILL:** shell can enable the `signal/signal_generate` ftrace event
|
||||
on the Thor (`/sys/kernel/tracing`), which names the sending thread; Perfetto recorded nothing
|
||||
there.
|
||||
- **Ending a game from Steam** (`SteamClient.Apps.TerminateApp`, the overlay's Exit game) left Wine
|
||||
running since the first round: Steam sends SIGINT to the launch's `reaper` and its parent, and the
|
||||
reaper ends what is under it, which handed-off programs are not. Each handed-off program now
|
||||
lists itself as `P<pid>` with the process that forked its child and, for when that process is
|
||||
gone (Wine starts a process through a fork that exits at once), the worker's program it descended
|
||||
from. A signal to `reaper SteamLaunch` from a hooked process also goes, as SIGTERM for SIGINT
|
||||
(Wine takes SIGINT for a console's Ctrl+C), to the groups of every listed program under that
|
||||
reaper, all found before any is signalled.
|
||||
- **Process groups:** a handed-off program runs in a session of its own, outside the group its
|
||||
forked parent's child was in. It lists itself as `GROUP.PID.START` for that group (`DDH_PGID`,
|
||||
also for the processes it forks), and the hook's `kill(-GROUP)`, `kill(0)` and `killpg()` also
|
||||
signal the groups those programs lead.
|
||||
- **Tried and dropped:** handing off Steam's launch chain (`sh`, `steam-launch-wrapper`, `reaper`):
|
||||
the client tracks the process it forked, which then exits at once, and called the game closed.
|
||||
Showing a handed-off program's forking process as its parent in `/proc/<pid>/stat` and `status`
|
||||
left Steam's UI at "Loading library data": the client checks the parents of the processes on its
|
||||
IPC connections with `lsof -F R`. Only the program's own `getppid()` answers with that process
|
||||
(while it lives, then 1): the GOG launch leases the game folder for as long as the launcher, its
|
||||
parent, runs, and took zygote, which the guest cannot see, for a launcher already gone. And
|
||||
`posix_spawn()` emulation must make only
|
||||
system calls in its child (no hook wrapper takes a lock there): one Steam fork hung on a lock
|
||||
another thread held.
|
||||
|
||||
Quitting the game (also from Steam), stopping the session (no worker is left) and starting
|
||||
again all work. Started from the front end with the limit on, Setup shows "Child-process limit
|
||||
handled by DroidDeck" and Steam starts.
|
||||
|
||||
### The bionic runtime
|
||||
|
||||
DroidDeck-Bionic runs Wine on Android's libc, outside the glibc root, so the native hook never sees
|
||||
its processes: with the handoff on, a bionic game's Wine programs (the game, `services.exe`,
|
||||
`winedevice.exe`, `plugplay.exe`, `svchost.exe`, `lsass.exe`, `explorer.exe`, `rpcss.exe`) all stayed
|
||||
under the worker that runs the tool's `launch.sh` and were counted. The same handoff is built into
|
||||
the runtime's exec shim (`tools/bionic-runtime/handoff.c`, part of `libexecshim.so`, which every Wine
|
||||
process preloads): it includes `hook/handoff.c` and `hook/kept.c` (the descriptors `close()` and
|
||||
`close_range()` leave open, moved out of `privileged.c` for this) and adds what the native hook's
|
||||
other parts do around them (`fork()`, `close()`, `close_range()`, `dup2()`, `dup3()`, and `exit()` for
|
||||
the `on_exit()` bionic lacks). What differs on bionic:
|
||||
|
||||
- **bionic's `execv()`, `execvp()` and `execl*()`** make the execve system call inside libc, past an
|
||||
interposed `execve()`. Wine starts its preloader with `execv()`, so the shim defines them on top
|
||||
of its `execve()`.
|
||||
- **A start through the system linker** (`/system/bin/linker64 PROGRAM ARGS`, which the shim makes
|
||||
of a dynamic program in app data, and which Wine sometimes makes itself) is listed by PROGRAM
|
||||
(`ddh_try_as()` matches one program and sends another).
|
||||
- **The app starts a handed-off program from the glibc root's `bash`** (GuestWorkers), which cannot
|
||||
load the runtime's `LD_PRELOAD` and `LD_LIBRARY_PATH` (bionic libraries: "libdl.so: cannot open
|
||||
shared object file"). The request carries those two as arguments of `/system/bin/env` instead,
|
||||
which `bash` execs and which puts them back for the program; the worker's main process is the
|
||||
program all the same.
|
||||
- `launch.sh` keeps `DD_SPAWN`, `DD_SPAWN_SESSION`, `DD_HANDOFF*`, `DDH_*` and `DDNATV_ROOT` (it drops
|
||||
the glibc guest's environment otherwise). The "can't open /proc/N/environ: Permission denied"
|
||||
lines its prefix checks printed came from idle workers (zygote forks, not dumpable), not from
|
||||
handed-off programs, which are readable; the redirect is now quiet.
|
||||
|
||||
Measured on an AYANEO Pocket FIT (Snapdragon G3 Gen 3, Adreno 750, Android 14), DroidDeck-Bionic 14.1-r67 with this shim and
|
||||
launcher, handoff on, max counted in the app's cgroups:
|
||||
|
||||
| | Brawlhalla | DiRT Showdown | whole run | other apps' processes trimmed (limit on) |
|
||||
|---|---|---|---|---|
|
||||
| bionic, before | 25 | 24–27 | 28 | yes (Discord, a logcat, BatteryLog's `su`) |
|
||||
| bionic, with the shim | 17 | 16 | 19–20 | none |
|
||||
| DroidDeck-Proton 11-14.2 | 12–13 | 12–15 | 15–17 | none |
|
||||
|
||||
DiRT's benchmark held 75 fps average either way; quit through Steam, stop and restart worked with
|
||||
Android's limit on, with no DroidDeck process killed. Still counted on bionic: what `launch.sh`
|
||||
itself starts (the game's first Wine process, `gstag`, the wait loop's `sleep`), since Android's
|
||||
`sh` has no hook, and `wineserver`'s daemon fork.
|
||||
|
||||
### Cost
|
||||
|
||||
Measured on the Thor, Bully under Proton, the handoff on (`childProcessHandoff`) against off, two
|
||||
sessions each:
|
||||
|
||||
| | off | on, first | on, now |
|
||||
|---|---|---|---|
|
||||
| one program started, `fork`+`exec` of `/usr/bin/true` | 37–39 ms | 197 ms | 80 ms |
|
||||
| `start steam` to READY | 14.0–14.2 s | 20.0–20.2 s | 18.2–18.5 s |
|
||||
| `launch` to the game's focus | 10.1 s | 14.7–14.8 s | 11.6–11.7 s |
|
||||
| in game: frames, CPU of the app's uid, `system_server` | 29.9 fps, 1.02–1.05 s/s, 21 ms/s | 29.8 fps, 1.11 s/s, 21–27 ms/s | 29.8–29.9 fps, 1.10–1.11 s/s, 22 ms/s |
|
||||
| memory of the app's processes (RSS) | 3.57–3.62 GB | 3.42–3.50 GB | 3.49–3.66 GB |
|
||||
|
||||
Running costs nothing measurable; starting things does. A handed-off program costs a worker: a
|
||||
zygote fork, its runtime (40–50 ms of CPU) and the bind, and the worker waited 100 ms before its
|
||||
exec so as not to cut off its reply. Now the app closes a pipe once it has the reply and the worker
|
||||
execs then, and two workers are kept bound ahead of need while a session runs (12 MB of PSS each);
|
||||
four did no better. Starting a session takes about 10 more CPU-seconds (51 s against 41 s for the
|
||||
app's uid), and the last 4 s come from the session script's own steps running beside the
|
||||
handed-off daemons. With only the hook's handoffs off (`DD_SPAWN_DAEMONS=0`), READY came at
|
||||
14.1 s: the app's own workers (the session root, PulseAudio, logcat) cost nothing there.
|
||||
|
||||
**In the app:** `PhantomProcessStatus.UNCOUNTED` is reported when the limit is on but the session
|
||||
runs in workers (`GuestWorkers.enabled`: the native userland, Android 11+, and the
|
||||
`childProcessHandoff` session preference, on by default). It does not block Steam. Turning the
|
||||
preference off (`droiddeckctl prefs set session childProcessHandoff false --type bool`, with
|
||||
Setup > Developer > Debugging tools on; see `docs/agent-control.md`) brings back
|
||||
the old behavior and the old requirement.
|
||||
|
||||
### C. Plan
|
||||
|
||||
1. ~~Verify both gaps on the Thor~~ done; still to do on a stock Android 14+ phone (enforcing
|
||||
SELinux, unlike the Thor) and on a Mali device.
|
||||
2. ~~B for the processes DroidDeck and the session script start themselves~~ done.
|
||||
3. ~~B inside the hook, with pid translation~~ done.
|
||||
4. ~~The session root, its jobs, the log pipeline, the gamescope chain~~ done: 9 idle, 14 in game.
|
||||
Third round (PulseAudio, `posix_spawn`, daemons): 7–9 idle, 12 in game.
|
||||
5. ~~Setup no longer requires the developer option while the session runs in workers~~ done.
|
||||
6. Open:
|
||||
- ~~PulseAudio in a worker~~ done;
|
||||
- ~~`posix_spawn()` and daemons in workers~~ done;
|
||||
- `/proc/<pid>/stat` showing the virtual parent, so that Steam and its web helper can be handed
|
||||
off too;
|
||||
- ~~pre-started workers, so that a handoff costs no zygote fork~~ done: two are kept bound;
|
||||
- ~~more games and configurations~~ done on the Thor with the stock limit on, no kills in any:
|
||||
Bully on GE-Proton, Proton Experimental ARM64 and DroidDeck-Proton 11 (11–14 counted), Bomb
|
||||
Rush Cyberfunk (14), MGSV Ground Zeroes (13), Sekiro (13), zero-copy off (11), the x86-64
|
||||
Steam client under FEX (14, against 55 without the handoff), Splinter Cell through Ubisoft
|
||||
Connect (14, against 65), Star Wars: Galaxy of Heroes (EA, 14), 9 Years of Shadows (GOG, 14),
|
||||
run mode with 40 background jobs (1), the desktop at rest (17–20) and
|
||||
with a terminal's 40 background jobs (20). PRoot sessions keep the old behavior and still need
|
||||
the developer option: with the limit on, Android killed 30 of their processes and the session
|
||||
failed;
|
||||
- Wine-heavy launchers and anti-cheat;
|
||||
- a settings switch for `childProcessHandoff`.
|
||||
7. A (the isolated tier) only if B stops working on a future Android; it needs a file and socket
|
||||
broker and keeps the GPU outside.
|
||||
|
||||
## Robustness
|
||||
|
||||
- Gap 1's path mismatch is a bug that could be fixed; the app-zygote skip is deliberate. Use app
|
||||
zygote isolated services so either one is enough.
|
||||
- Gap 2 depends on AMS not probing liveness. A future check (a ping, or watching a pidfd for the
|
||||
binder) would end it; the session would then fall back to counted processes, which is today's
|
||||
behavior.
|
||||
- OEM ROMs with their own process managers (MIUI/HyperOS, ColorOS) are outside this.
|
||||
- A listed program's stops and continues (`kill -STOP`, `SIGCONT`) reach its worker, not a wait in
|
||||
its parent: `waitpid(…, WUNTRACED)` and `WCONTINUED` report none for it. Listed programs are the
|
||||
session's own (Steam, Wine, game helpers), whose parents start them without job control; one a
|
||||
shell runs as a job-control job (`wine game.exe &` in an interactive terminal) stays counted, as
|
||||
any such job does, so its shell gets its stops. Reading
|
||||
the worker's state from `/proc` instead was tried and dropped: a stop and a continue can both
|
||||
fall between two reads.
|
||||
|
||||
## phantomlab
|
||||
|
||||
`tools/phantomlab` is a standalone test app (package `com.droiddeck.phantomlab`, no Gradle). It
|
||||
forks sleepers from the main process, a plain isolated service, an app-zygote isolated service and
|
||||
eight `:wN` workers, execs in place, and probes what a process may do.
|
||||
|
||||
The limit of 4 below is device-wide: a trim while it is set can kill other apps' child processes,
|
||||
which restoring the setting does not bring back. Use a test device or an emulator with nothing else
|
||||
running, and note the current values first, to put them back afterwards:
|
||||
|
||||
```
|
||||
adb shell settings get global settings_enable_monitor_phantom_procs
|
||||
adb shell device_config get activity_manager max_phantom_processes
|
||||
adb shell device_config get_sync_disabled_for_tests
|
||||
```
|
||||
|
||||
Android 12 and some Android 13 builds have no `get_sync_disabled_for_tests`; there `adb shell
|
||||
device_config is_sync_disabled_for_tests` answers only true or false, so it cannot tell `persistent`
|
||||
from `until_reboot`. Note `none` when it says false. When it says true, sync is already off: skip
|
||||
the `set_sync_disabled_for_tests persistent` step below, which keeps whichever mode it was, and
|
||||
leave the mode alone when you restore the rest.
|
||||
|
||||
```
|
||||
tools/phantomlab/build.sh # build/phantomlab.apk, debug-signed
|
||||
adb install -r tools/phantomlab/build/phantomlab.apk
|
||||
adb shell device_config set_sync_disabled_for_tests persistent
|
||||
adb shell device_config put activity_manager max_phantom_processes 4
|
||||
adb shell settings put global settings_enable_monitor_phantom_procs true
|
||||
adb shell am start -n com.droiddeck.phantomlab/.Main --es cmd spawn --es target iso:a --ei n 40
|
||||
adb shell "am start -n com.droiddeck.phantomlab/.Main --es cmd exec --es target w0 --ei keep 1 --es argv '/system/bin/sleep|100000'"
|
||||
adb shell am start -n com.droiddeck.phantomlab/.Main --es cmd probe --es target iso:a --es what self,memfd_exec,exec,fds,escape,libexec --es fds tcp,udp,unix,file:probe.txt
|
||||
adb logcat -s PLAB ActivityManager | grep -i 'PLAB\|Trimming'
|
||||
```
|
||||
|
||||
Targets: `main`, `proc` (`:proc`), `isoplain`, `iso:<name>` (one app-zygote instance per name),
|
||||
`w0`…`w7`. Android scans only on CPU-stat refreshes, so switch apps a few times (5 s apart) before
|
||||
reading the phantom list. Restore the noted values afterwards: `adb shell device_config put
|
||||
activity_manager max_phantom_processes <value>` (or `adb shell device_config delete activity_manager
|
||||
max_phantom_processes` if it was null), `adb shell device_config set_sync_disabled_for_tests <mode>`
|
||||
and `adb shell settings put global settings_enable_monitor_phantom_procs <value>`, and end the lab's
|
||||
sleepers with `adb shell am force-stop com.droiddeck.phantomlab`.
|
||||
@@ -184,7 +184,7 @@ echo "== DroidDeck fake input (app/src/main/cpp/fakeinput_steam.cpp), heap-taggi
|
||||
"$CXX" -shared -fPIC -O2 -Wall -Wno-attributes -pthread -std=c++17 "$ROOT/app/src/main/cpp/fakeinput_steam.cpp" \
|
||||
-ldl -static-libstdc++ -o "$PACK/preload/libfakeinput.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall "$HERE/notag.c" -ldl -o "$PACK/preload/libnotag.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall "$HERE/execshim.c" "$HERE/handoff.c" -ldl -o "$PACK/preload/libexecshim.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall "$HERE/execshim.c" -ldl -o "$PACK/preload/libexecshim.so"
|
||||
"$CC" -shared -fPIC -O2 -Wall -Wextra -fvisibility=hidden "$HERE/steamshm.c" -ldl -o "$PACK/preload/libsteamshm.so"
|
||||
"$CC" -O2 -Wall "$HERE/gstag.c" -o "$PACK/bin/gstag"
|
||||
"$STRIP" --strip-unneeded "$PACK/layer/"*.so "$PACK/preload/"*.so "$PACK/bin/gstag"
|
||||
|
||||
@@ -25,9 +25,6 @@ typedef struct __posix_spawn_file_actions *posix_spawn_file_actions_t;
|
||||
|
||||
#define LINKER "/system/bin/linker64"
|
||||
|
||||
// handoff.c: returns unless the exec was handed to one of the app's worker processes
|
||||
void ddh_bionic_exec(const char *file, char *const args[], char *const envp[], const char *path, char *const argv[]);
|
||||
|
||||
enum kind { PASS, VIA_LINKER, VIA_INTERP };
|
||||
|
||||
// What starting `path` needs; for scripts, the interpreter and its optional argument.
|
||||
@@ -208,8 +205,6 @@ int execve(const char *path, char *const argv[], char *const envp[]) {
|
||||
char storage[6 * PATH_MAX]; // stack only: this may run in posix_spawn's vfork-like child (where it passes)
|
||||
const char *file = path;
|
||||
char **args = rewrite(path, argv, &file, storage);
|
||||
// the app may run it in a worker instead (handoff.c): matched by the program, sent as the start below
|
||||
ddh_bionic_exec(file, args ? args : argv, envp, path, argv);
|
||||
int ret = real(file, args ? args : argv, envp);
|
||||
int saved = errno;
|
||||
free(args);
|
||||
|
||||
@@ -1,333 +0,0 @@
|
||||
// handoff: part of libexecshim.so, preloaded into the bionic Wine processes. The native hook's exec
|
||||
// handoff (tools/nativeguest/hook/handoff.c, docs/phantom-processes.md) built for bionic: a program a
|
||||
// Wine process forks and execs runs as the main process of one of the app's worker processes instead of
|
||||
// as a child Android counts against its limit. The glibc session's hook cannot reach these processes
|
||||
// (they run on Android's libc), so without this every Wine process of a bionic game was counted.
|
||||
//
|
||||
// What the native hook does around the handoff and this file does too: fork() records the child for
|
||||
// its parent's table, close(), close_range(), dup2() and dup3() leave the table and the worker's binder
|
||||
// fds alone (hook/kept.c), and execve() offers the exec to the app before it runs (execshim.c calls
|
||||
// ddh_bionic_exec() with the start it is about to make: "/system/bin/linker64 PROGRAM ARGS" for a
|
||||
// program in the app's data, matched against DD_HANDOFF by PROGRAM). wait*(), kill() and _exit() are
|
||||
// the handoff's own (hook/handoff.c). Nothing here acts without DD_SPAWN and DD_HANDOFF in the
|
||||
// environment (tools/bionic-runtime/tool/launch.sh keeps them).
|
||||
#define _GNU_SOURCE
|
||||
#include <dlfcn.h>
|
||||
#include <elf.h>
|
||||
#include <errno.h>
|
||||
#include <fcntl.h>
|
||||
#include <limits.h>
|
||||
#include <pthread.h>
|
||||
#include <sched.h>
|
||||
#include <signal.h>
|
||||
#include <stdarg.h>
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <unistd.h>
|
||||
#include <sys/mman.h>
|
||||
#include <sys/resource.h>
|
||||
#include <sys/socket.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/syscall.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/uio.h>
|
||||
#include <sys/un.h>
|
||||
#include <sys/wait.h>
|
||||
|
||||
// bionic has no thread cancellation: nothing can cancel the table's setup
|
||||
#ifndef PTHREAD_CANCEL_ENABLE
|
||||
#define PTHREAD_CANCEL_ENABLE 0
|
||||
#define PTHREAD_CANCEL_DISABLE 1
|
||||
static int pthread_setcancelstate(int state, int *old) {
|
||||
(void)state;
|
||||
if (old) *old = PTHREAD_CANCEL_ENABLE;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
#ifndef CLOSE_RANGE_UNSHARE
|
||||
#define CLOSE_RANGE_UNSHARE (1U << 1)
|
||||
#endif
|
||||
#ifndef CLOSE_RANGE_CLOEXEC
|
||||
#define CLOSE_RANGE_CLOEXEC (1U << 2)
|
||||
#endif
|
||||
#ifndef __NR_close_range
|
||||
#define __NR_close_range 436
|
||||
#endif
|
||||
|
||||
#include <sys/sysmacros.h>
|
||||
static void pthread_testcancel(void) {}
|
||||
int close_range(unsigned int first, unsigned int last, int flags);
|
||||
|
||||
// bionic has no on_exit(): the handoff reports a program's exit status from it (exit() runs it).
|
||||
// atexit() handlers get no status, so exit() below notes it first; a return from main() reaches
|
||||
// exit() inside libc and reports 0.
|
||||
static void (*g_on_exit_fn)(int, void *);
|
||||
static void *g_on_exit_arg;
|
||||
static int g_exit_status;
|
||||
static void run_on_exit(void) {
|
||||
if (g_on_exit_fn) g_on_exit_fn(g_exit_status, g_on_exit_arg);
|
||||
}
|
||||
static int on_exit(void (*fn)(int, void *), void *arg) {
|
||||
g_on_exit_fn = fn;
|
||||
g_on_exit_arg = arg;
|
||||
return atexit(run_on_exit);
|
||||
}
|
||||
|
||||
// The native hook's names for the plain system call and for a guest path: here there is no guest root.
|
||||
static long call_orig_syscall(long nr, unsigned long a, unsigned long b, unsigned long c, unsigned long d,
|
||||
unsigned long e, unsigned long f) {
|
||||
return syscall(nr, a, b, c, d, e, f);
|
||||
}
|
||||
static const char *rewrite_path(const char *path, char *out, size_t size) {
|
||||
(void)out;
|
||||
(void)size;
|
||||
return path;
|
||||
}
|
||||
|
||||
#include "../nativeguest/hook/kept.c"
|
||||
#include "../nativeguest/hook/handoff.c"
|
||||
|
||||
void exit(int status) {
|
||||
g_exit_status = status;
|
||||
void (*real)(int) = (void (*)(int))dlsym(RTLD_NEXT, "exit");
|
||||
if (real) real(status);
|
||||
syscall(SYS_exit_group, status);
|
||||
__builtin_unreachable();
|
||||
}
|
||||
|
||||
void ddh_bionic_exec(const char *file, char *const args[], char *const envp[], const char *path, char *const argv[]) {
|
||||
if (ddh_env(envp, "DD_HANDOFF_DEBUG")) {
|
||||
char why[200];
|
||||
struct ddh_table *own = __atomic_load_n(&g_ddh, __ATOMIC_ACQUIRE);
|
||||
snprintf(why, sizeof(why), "bionic exec (spawn %d list %d table %d owner %d up %d ppid %d) of", ddh_env(envp, "DD_SPAWN") != NULL,
|
||||
ddh_env(envp, "DD_HANDOFF") != NULL, own != NULL, (int)g_ddh_owner, g_ddh_up != NULL, (int)getppid());
|
||||
ddh_debug(envp, why, path ? path : "(null)");
|
||||
}
|
||||
// Wine's own starts through the system linker ("/system/bin/linker64 PROGRAM ARGS") are listed by PROGRAM
|
||||
const char *match = path;
|
||||
char *const *match_argv = argv;
|
||||
const char *base = path ? strrchr(path, '/') : NULL;
|
||||
if (base && strcmp(base + 1, "linker64") == 0 && argv && argv[0] && argv[1]) {
|
||||
match = argv[1];
|
||||
match_argv = argv + 1;
|
||||
}
|
||||
// The app starts a handed-off program from the glibc root's shell (GuestWorkers), which cannot load this
|
||||
// runtime's LD_PRELOAD and LD_LIBRARY_PATH (bionic libraries). The request carries them as arguments of
|
||||
// Android's env instead, which the shell execs and which puts them back for the program: the worker's main
|
||||
// process ends up as the program all the same. Stack only (this may run in a vfork child).
|
||||
int nargs = 0, nenv = 0;
|
||||
while (args && args[nargs]) nargs++;
|
||||
while (envp && envp[nenv]) nenv++;
|
||||
char *wrapped[nargs + 4];
|
||||
char *trimmed[nenv + 1];
|
||||
int w = 0, t = 0;
|
||||
wrapped[w++] = (char *)"/system/bin/env";
|
||||
for (int i = 0; i < nenv; i++) {
|
||||
if (strncmp(envp[i], "LD_PRELOAD=", 11) == 0 || strncmp(envp[i], "LD_LIBRARY_PATH=", 16) == 0) {
|
||||
if (w < 3) wrapped[w++] = envp[i];
|
||||
} else {
|
||||
trimmed[t++] = envp[i];
|
||||
}
|
||||
}
|
||||
trimmed[t] = NULL;
|
||||
// env runs the program by the path its first argument gives: the start's file, then the rest of its argv
|
||||
wrapped[w++] = (char *)file;
|
||||
for (int i = 1; i < nargs; i++) wrapped[w++] = args[i];
|
||||
wrapped[w] = NULL;
|
||||
ddh_try_as("/system/bin/env", wrapped, trimmed, match, match_argv);
|
||||
ddh_debug(envp, "bionic exec stays here:", path ? path : "(null)");
|
||||
}
|
||||
|
||||
// bionic's exec functions call the execve system call stub inside libc, past execshim.c's execve(): Wine
|
||||
// starts its programs with execv() (its preloader) and execvp(), so these go through execve() here.
|
||||
extern char **environ;
|
||||
|
||||
int execv(const char *path, char *const argv[]) { return execve(path, argv, environ); }
|
||||
|
||||
int execvpe(const char *file, char *const argv[], char *const envp[]) {
|
||||
if (!file || !*file) {
|
||||
errno = ENOENT;
|
||||
return -1;
|
||||
}
|
||||
if (strchr(file, '/')) return execve(file, argv, envp);
|
||||
const char *dirs = getenv("PATH");
|
||||
if (!dirs || !*dirs) dirs = "/system/bin:/system/xbin";
|
||||
int saw_eacces = 0;
|
||||
size_t flen = strlen(file);
|
||||
for (const char *p = dirs;;) {
|
||||
const char *end = strchr(p, ':');
|
||||
size_t len = end ? (size_t)(end - p) : strlen(p);
|
||||
char full[PATH_MAX];
|
||||
if (len + flen + 2 <= sizeof(full)) {
|
||||
if (len == 0) {
|
||||
memcpy(full, file, flen + 1); // an empty entry is the current directory
|
||||
} else {
|
||||
memcpy(full, p, len);
|
||||
full[len] = '/';
|
||||
memcpy(full + len + 1, file, flen + 1);
|
||||
}
|
||||
execve(full, argv, envp);
|
||||
if (errno == EACCES) saw_eacces = 1;
|
||||
else if (errno != ENOENT && errno != ENOTDIR) return -1;
|
||||
}
|
||||
if (!end) break;
|
||||
p = end + 1;
|
||||
}
|
||||
errno = saw_eacces ? EACCES : ENOENT;
|
||||
return -1;
|
||||
}
|
||||
|
||||
int execvp(const char *file, char *const argv[]) { return execvpe(file, argv, environ); }
|
||||
|
||||
// execl(), execlp(), execle(): the list as an argv on the stack
|
||||
#define EXECL_ARGV(first, ap, n) \
|
||||
do { \
|
||||
va_list count_ap; \
|
||||
va_copy(count_ap, ap); \
|
||||
n = first ? 1 : 0; \
|
||||
if (first) \
|
||||
while (va_arg(count_ap, const char *)) n++; \
|
||||
va_end(count_ap); \
|
||||
} while (0)
|
||||
|
||||
int execl(const char *path, const char *arg0, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, arg0);
|
||||
int n;
|
||||
EXECL_ARGV(arg0, ap, n);
|
||||
char *argv[n + 1];
|
||||
argv[0] = (char *)arg0;
|
||||
for (int i = 1; i < n; i++) argv[i] = va_arg(ap, char *);
|
||||
argv[n] = NULL;
|
||||
va_end(ap);
|
||||
return execve(path, argv, environ);
|
||||
}
|
||||
|
||||
int execlp(const char *file, const char *arg0, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, arg0);
|
||||
int n;
|
||||
EXECL_ARGV(arg0, ap, n);
|
||||
char *argv[n + 1];
|
||||
argv[0] = (char *)arg0;
|
||||
for (int i = 1; i < n; i++) argv[i] = va_arg(ap, char *);
|
||||
argv[n] = NULL;
|
||||
va_end(ap);
|
||||
return execvp(file, argv);
|
||||
}
|
||||
|
||||
int execle(const char *path, const char *arg0, ...) {
|
||||
va_list ap;
|
||||
va_start(ap, arg0);
|
||||
int n;
|
||||
EXECL_ARGV(arg0, ap, n);
|
||||
char *argv[n + 1];
|
||||
argv[0] = (char *)arg0;
|
||||
for (int i = 1; i < n; i++) argv[i] = va_arg(ap, char *);
|
||||
argv[n] = NULL;
|
||||
if (arg0) (void)va_arg(ap, char *); // the list's NULL
|
||||
char *const *envp = va_arg(ap, char *const *);
|
||||
va_end(ap);
|
||||
return execve(path, argv, envp);
|
||||
}
|
||||
|
||||
pid_t fork(void) {
|
||||
static pid_t (*orig_fork)(void) = NULL;
|
||||
if (!orig_fork) orig_fork = (pid_t (*)(void))dlsym(RTLD_NEXT, "fork");
|
||||
if (!orig_fork) {
|
||||
errno = ENOSYS;
|
||||
return -1;
|
||||
}
|
||||
ddh_prepare();
|
||||
pid_t forker = (pid_t)syscall(SYS_gettid);
|
||||
pid_t pid = orig_fork();
|
||||
if (pid == 0) {
|
||||
kept_close_forked();
|
||||
ddh_drop_worker_binder();
|
||||
ddh_forked(forker);
|
||||
} else if (pid > 0) {
|
||||
ddh_child_created(pid, 1);
|
||||
}
|
||||
return pid;
|
||||
}
|
||||
|
||||
int close(int fd) {
|
||||
static int (*orig_close)(int) = NULL;
|
||||
if (!orig_close) orig_close = (int (*)(int))dlsym(RTLD_NEXT, "close");
|
||||
uint64_t ticket = kept_close_begin();
|
||||
if (g_kept_fd_count > 0 && is_kept_fd(fd)) {
|
||||
kept_close_end(ticket);
|
||||
return 0;
|
||||
}
|
||||
int r = orig_close ? orig_close(fd) : (errno = ENOSYS, -1);
|
||||
int saved = errno;
|
||||
kept_close_end(ticket);
|
||||
errno = saved;
|
||||
return r;
|
||||
}
|
||||
|
||||
static int dup_moved(int (*dup_fn)(int, int, int), int oldfd, int newfd, int flags) {
|
||||
int pidfd_from = -1, locked = 0;
|
||||
if (oldfd != newfd) {
|
||||
locked = ddh_parent_pidfd_lock(newfd);
|
||||
pidfd_from = ddh_parent_pidfd_moves(newfd);
|
||||
}
|
||||
int ret = dup_fn(oldfd, newfd, flags);
|
||||
ddh_parent_pidfd_settle(pidfd_from, ret >= 0);
|
||||
int saved = errno;
|
||||
ddh_parent_pidfd_unlock(locked);
|
||||
errno = saved;
|
||||
return ret;
|
||||
}
|
||||
|
||||
static int (*g_orig_dup2)(int, int);
|
||||
static int (*g_orig_dup3)(int, int, int);
|
||||
static int call_dup2(int oldfd, int newfd, int flags) {
|
||||
(void)flags;
|
||||
return g_orig_dup2 ? g_orig_dup2(oldfd, newfd) : (errno = ENOSYS, -1);
|
||||
}
|
||||
static int call_dup3(int oldfd, int newfd, int flags) {
|
||||
return g_orig_dup3 ? g_orig_dup3(oldfd, newfd, flags) : (errno = ENOSYS, -1);
|
||||
}
|
||||
|
||||
int dup2(int oldfd, int newfd) {
|
||||
if (!g_orig_dup2) g_orig_dup2 = (int (*)(int, int))dlsym(RTLD_NEXT, "dup2");
|
||||
return dup_moved(call_dup2, oldfd, newfd, 0);
|
||||
}
|
||||
|
||||
int dup3(int oldfd, int newfd, int flags) {
|
||||
if (!g_orig_dup3) g_orig_dup3 = (int (*)(int, int, int))dlsym(RTLD_NEXT, "dup3");
|
||||
return dup_moved(call_dup3, oldfd, newfd, flags);
|
||||
}
|
||||
|
||||
static int close_range_part(unsigned int first, unsigned int last, void *flags) {
|
||||
return (int)syscall(__NR_close_range, first, last, *(int *)flags);
|
||||
}
|
||||
|
||||
int close_range(unsigned int first, unsigned int last, int flags) {
|
||||
uint64_t ticket = kept_close_begin();
|
||||
int snapshot[DDNATV_MAX_KEPT_FDS];
|
||||
const int *kept = (flags & CLOSE_RANGE_CLOEXEC) ? g_cloexec_kept_fds : snapshot;
|
||||
int count = (flags & CLOSE_RANGE_CLOEXEC) ? g_cloexec_kept_count : kept_snapshot(snapshot);
|
||||
int r;
|
||||
if (count == 0) {
|
||||
r = close_range_part(first, last, &flags);
|
||||
} else {
|
||||
r = 0;
|
||||
if (flags & CLOSE_RANGE_UNSHARE) {
|
||||
r = (int)syscall(__NR_close_range, ~0U, ~0U, CLOSE_RANGE_UNSHARE);
|
||||
flags &= ~(int)CLOSE_RANGE_UNSHARE;
|
||||
}
|
||||
if (r == 0) r = for_each_range_without(first, last, kept, count, close_range_part, &flags);
|
||||
}
|
||||
int saved = errno;
|
||||
kept_close_end(ticket);
|
||||
errno = saved;
|
||||
return r;
|
||||
}
|
||||
|
||||
// The native hook's own uses of these (exec.c) have no counterpart here
|
||||
__attribute__((unused)) static void *const glibc_only[] = {(void *)ddh_try, (void *)ddh_spawn_wanted};
|
||||
@@ -52,10 +52,6 @@ for v in $(env | sed -n 's/^\([A-Za-z_][A-Za-z0-9_]*\)=.*/\1/p'); do
|
||||
DROIDDECK_GPU_LOAD|DROIDDECK_GPU_LOAD_DIR|DROIDDECK_VRAM_CAP|DROIDDECK_VRAM_CAP_MB|DROIDDECK_DISPLAY_DRIVER) ;;
|
||||
DROIDDECK_GUEST_ROOT) ;;
|
||||
VKD3D_FEATURE_LEVEL|VKD3D_SHADER_MODEL|vk_x11_strict_image_count) ;;
|
||||
# The exec handoff (../handoff.c): the app's spawn socket and list (the app starts a handed-off program from the
|
||||
# glibc root's shell, so its path too), and what a worker hands the program it runs (this script, when it runs
|
||||
# in one): the first Wine process's hook knows the worker's binder fds are not its own.
|
||||
DD_SPAWN|DD_SPAWN_SESSION|DD_HANDOFF|DD_HANDOFF_DEBUG|DD_HANDOFF_PRESSURE|DDH_*|DDNATV_ROOT) ;;
|
||||
*) unset "$v" 2>/dev/null ;;
|
||||
esac
|
||||
done
|
||||
@@ -262,7 +258,7 @@ prepare_prefix() {
|
||||
prefix_busy() { # a process of this prefix is running
|
||||
for p in /proc/[0-9]*; do
|
||||
[ "${p#/proc/}" = "$$" ] && continue
|
||||
tr '\0' '\n' 2>/dev/null < "$p/environ" | grep -qx "WINEPREFIX=$COMPAT/pfx" && return 0
|
||||
tr '\0' '\n' < "$p/environ" 2>/dev/null | grep -qx "WINEPREFIX=$COMPAT/pfx" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -277,7 +273,7 @@ programs_left() { # a program of this prefix is still running, apart from Wine's
|
||||
""|wineserver|services.exe|winedevice.exe|plugplay.exe|explorer.exe|svchost.exe|rpcss.exe|conhost.exe|start.exe|\
|
||||
winemenubuilder|wineboot.exe|tabtip.exe) continue ;;
|
||||
esac
|
||||
tr '\0' '\n' 2>/dev/null < "$p/environ" | grep -qx "WINEPREFIX=$COMPAT/pfx" && return 0
|
||||
tr '\0' '\n' < "$p/environ" 2>/dev/null | grep -qx "WINEPREFIX=$COMPAT/pfx" && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
@@ -286,7 +282,7 @@ stop_wine() { # wineserver -k, then whatever of this prefix is left (e.g. a game
|
||||
wineserver_ -k 2>/dev/null
|
||||
sleep 1
|
||||
for p in /proc/[0-9]*; do
|
||||
tr '\0' '\n' 2>/dev/null < "$p/environ" | grep -qx "WINEPREFIX=$COMPAT/pfx" || continue
|
||||
tr '\0' '\n' < "$p/environ" 2>/dev/null | grep -qx "WINEPREFIX=$COMPAT/pfx" || continue
|
||||
[ "${p#/proc/}" = "$$" ] && continue
|
||||
echo "$(date +%H:%M:%S) left over: ${p#/proc/} $(cat "$p/comm" 2>/dev/null)"
|
||||
kill -9 "${p#/proc/}" 2>/dev/null
|
||||
@@ -430,7 +426,7 @@ comm=$(echo "$name" | cut -c1-15)
|
||||
game_pids() { # processes of this prefix with the game's name (two prefixes can run programs with the same name)
|
||||
for p in $(grep -lFx "$comm" /proc/[0-9]*/comm 2>/dev/null); do
|
||||
p=${p%/comm}
|
||||
tr '\0' '\n' 2>/dev/null < "$p/environ" | grep -qxF "WINEPREFIX=$COMPAT/pfx" && echo "${p#/proc/}"
|
||||
tr '\0' '\n' < "$p/environ" 2>/dev/null | grep -qxF "WINEPREFIX=$COMPAT/pfx" && echo "${p#/proc/}"
|
||||
done
|
||||
}
|
||||
# The game's windows go straight to gamescope's X server, as with DroidDeck-Proton (no Wine desktop): the game
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=dbus-send --session --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
@@ -229,16 +229,12 @@ fi
|
||||
if ! /usr/local/bin/droiddeck-pipewire start; then
|
||||
echo "== pipewire: not running; screen capture has no picture"
|
||||
fi
|
||||
return_gaming=/run/droiddeck/return-gaming
|
||||
mkdir -p /run/droiddeck
|
||||
rm -f "$return_gaming"
|
||||
echo "== droiddeck-desktop: Plasma on $WAYLAND_DISPLAY"
|
||||
dbus-run-session -- startplasma-wayland
|
||||
rc=$?
|
||||
/usr/local/bin/droiddeck-pipewire stop
|
||||
echo "== droiddeck-desktop: Plasma ended ($rc)"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ] && [ -e "$return_gaming" ]; then
|
||||
rm -f "$return_gaming"
|
||||
if [ "$rc" -eq 0 ] && [ -z "${DD_BOTTOM_DESKTOP:-}" ]; then
|
||||
/usr/local/bin/droiddeck-steam-launch bigpicture
|
||||
sleep 30
|
||||
fi
|
||||
|
||||
@@ -1,9 +0,0 @@
|
||||
[Desktop Entry]
|
||||
Name=Return to Gaming Mode
|
||||
Comment=Log out of the desktop and go back to Steam
|
||||
Exec=sh -c ": > /run/droiddeck/return-gaming; dbus-send --session --print-reply --type=method_call --dest=org.kde.Shutdown /Shutdown org.kde.Shutdown.logout >/dev/null || rm -f /run/droiddeck/return-gaming"
|
||||
Icon=steamdeck-gaming-return
|
||||
Terminal=false
|
||||
Type=Application
|
||||
StartupNotify=false
|
||||
NoDisplay=true
|
||||
@@ -284,10 +284,8 @@ def sandboxed_apps(proc=Path("/proc")):
|
||||
|
||||
def window_steam_app(win, flatpaks, proc=Path("/proc")):
|
||||
match = STEAM_APP_CLASS.match(win.get("class") or "")
|
||||
if match and os.environ.get("DD_STEAM_CLIENT_ARCH") == "x86_64":
|
||||
return match.group(1)
|
||||
# Gamescope finds the app of a window whose process runs under Steam's reaper. A game the
|
||||
# session runs in a worker process (GuestWorkers) is not under it, whatever its class.
|
||||
if match:
|
||||
return match.group(1) if os.environ.get("DD_STEAM_CLIENT_ARCH") == "x86_64" else None
|
||||
pid = win.get("pid")
|
||||
if pid:
|
||||
if under_reaper(pid, proc):
|
||||
|
||||
@@ -350,17 +350,6 @@ def keeps_open(root):
|
||||
return isinstance(client, dict) and LAUNCH_BEHAVIOR[0] in client and client[LAUNCH_BEHAVIOR[0]] != LAUNCH_BEHAVIOR[1]
|
||||
|
||||
|
||||
def chosen_folder(root, current, library):
|
||||
current = current.strip()
|
||||
folder = windows_path(root, current) if current else None
|
||||
if not folder or rootfs_drive(root, current) or not os.path.isdir(folder):
|
||||
return False
|
||||
try:
|
||||
return volume_root(os.path.realpath(folder)) == volume_root(os.path.realpath(library))
|
||||
except OSError:
|
||||
return False
|
||||
|
||||
|
||||
def write_config(root, library=None):
|
||||
path = os.path.join(drive_c(root), *CONFIG)
|
||||
key, value = LAUNCH_BEHAVIOR
|
||||
@@ -385,7 +374,6 @@ def write_config(root, library=None):
|
||||
client["HardwareAcceleration"] = "false"
|
||||
changes.append("acceleration")
|
||||
if library and isinstance(client.setdefault("Install", {}), dict) \
|
||||
and not chosen_folder(root, str(client["Install"].get("DefaultInstallPath", "")), library) \
|
||||
and str(client["Install"].get("DefaultInstallPath", "")).rstrip("/\\") != install_path(root, library).rstrip("\\"):
|
||||
client["Install"]["DefaultInstallPath"] = install_path(root, library)
|
||||
changes.append("library")
|
||||
|
||||
@@ -1,8 +0,0 @@
|
||||
#!/bin/bash
|
||||
# Appends stdin to a session log up to a byte cap, then reads and drops the rest, so that the session
|
||||
# writing into it never gets SIGPIPE. A program of its own, rather than a subshell of the session, so
|
||||
# that the native hook can start it outside the app's counted child processes.
|
||||
# usage: droiddeck-log-writer FILE CAP_BYTES
|
||||
dd=$(command -v gnudd || echo dd)
|
||||
"$dd" of="$1" oflag=append conv=notrunc iflag=count_bytes count="$2" bs=65536 status=none
|
||||
exec cat >/dev/null
|
||||
@@ -14,59 +14,6 @@ export HOME=${HOME:-/root}
|
||||
mode=${1:-desktop}
|
||||
shift || true
|
||||
step() { echo "== STEP $(date -u +%H:%M:%S.%3N) $*"; }
|
||||
# Starts a long-lived program in its own Android process, which Android does not count against
|
||||
# the session's child processes (docs/phantom-processes.md); a normal background job otherwise.
|
||||
# Its pid is in $dd_spawned either way, and the ones not started as jobs in $dd_daemons, which
|
||||
# the session stops as it ends.
|
||||
dd_daemons=
|
||||
dd_spawn() {
|
||||
dd_spawned=
|
||||
if [ "${DD_SPAWN_DAEMONS:-1}" = 1 ] && [ -n "${DD_SPAWN:-}" ] && [ -x /usr/local/bin/droiddeck-spawn ]; then
|
||||
local f=${XDG_RUNTIME_DIR:-/tmp}/.dd-spawn.$$ rc=0
|
||||
/usr/local/bin/droiddeck-spawn --pid-file "$f" -- "$@" || rc=$?
|
||||
dd_spawned=$(cat "$f" 2>/dev/null)
|
||||
rm -f "$f"
|
||||
if [ "$rc" = 0 ] && [ -n "$dd_spawned" ]; then
|
||||
dd_daemons="$dd_daemons $dd_spawned"
|
||||
return 0
|
||||
fi
|
||||
# started, but its pid is unknown: not a second time
|
||||
[ "$rc" = 3 ] && { dd_spawned=; return 0; }
|
||||
fi
|
||||
"$@" &
|
||||
dd_spawned=$!
|
||||
}
|
||||
dd_stop_daemons() {
|
||||
[ -n "$dd_daemons" ] && kill $dd_daemons 2>/dev/null
|
||||
dd_daemons=
|
||||
}
|
||||
dd_session_pid=$$
|
||||
# Runs function $1 (with its arguments) in the background in a new bash that first loads this shell's
|
||||
# variables, functions and options: a background subshell, but an exec'd program, which the native
|
||||
# hook can hand to its own process (DD_HANDOFF "bash+dd-job"). $! is its pid, as for ( ... ) &.
|
||||
dd_job() {
|
||||
local state
|
||||
if [ -n "${DD_HANDOFF:-}" ] && state=$(mktemp "${XDG_RUNTIME_DIR:-/tmp}/.dd-job.XXXXXX" 2>/dev/null); then
|
||||
{
|
||||
declare -p | grep -Ev '^declare -[a-zA-Z]*r|^declare -[-a-zA-Z]* (BASH[A-Z_]*|FUNCNAME|GROUPS|DIRSTACK|PIPESTATUS|COPROC|LINENO|_)='
|
||||
declare -f
|
||||
shopt -p
|
||||
set +o
|
||||
} > "$state" 2>/dev/null
|
||||
/bin/bash -c 'source "$1" 2>/dev/null; rm -f "$1"; shift; "$@"' dd-job "$state" "$@" &
|
||||
else
|
||||
"$@" &
|
||||
fi
|
||||
}
|
||||
# Long-lived programs the session's guests start run in their own processes too
|
||||
# (tools/nativeguest/hook/handoff.c). Not Steam, its web helper's browser process (gamescope finds a
|
||||
# window's app by walking its process's parents) or its utility processes (the client only accepts
|
||||
# its transport from its own children).
|
||||
if [ "${DD_SPAWN_DAEMONS:-1}" = 1 ] && [ -n "${DD_SPAWN:-}" ]; then
|
||||
export DD_HANDOFF=${DD_HANDOFF-xdg-desktop-portal:xdg-permission-store:xdg-desktop-portal-gtk:at-spi-bus-launcher:at-spi2-registryd:plasma_waitforname:bash+dd-job:droiddeck-log-writer:gamescope:gamescopereaper:droiddeck-session+steam:Xwayland:dbus-launch:droiddeck-agent:droiddeck-launcher-cores:droiddeck-pace-cores:droiddeck-documents:droiddeck-steam-games+watch:droiddeck-steam-compat:dbus-daemon+--nofork:proton:pipewire:wireplumber:PluginLoader:PluginLoader.real:xprop+-spy:gnudd:steamwebhelper+--type=renderer:wine:wine-preloader:wine64:wine64-preloader:wineserver}
|
||||
else
|
||||
unset DD_HANDOFF
|
||||
fi
|
||||
steam_setup_failed() {
|
||||
echo "== steam: the Steam client could not be set up (status $1)"
|
||||
[ -z "${DD_STEAM_EXIT_FILE:-}" ] || printf '%s\n' "$1" > "$DD_STEAM_EXIT_FILE"
|
||||
@@ -77,12 +24,8 @@ if [ -n "${DD_LOG:-}" ] && [ -z "${DD_INSIDE:-}" ]; then
|
||||
if [ "$(stat -c %s "$DD_LOG" 2>/dev/null || echo 0)" -gt 8388608 ]; then
|
||||
mv -f "$DD_LOG" "$DD_LOG.1"
|
||||
fi
|
||||
if [ -x /usr/local/bin/droiddeck-log-writer ]; then
|
||||
exec > >(exec /usr/local/bin/droiddeck-log-writer "$DD_LOG" "${DD_LOG_CAP:-268435456}") 2>&1
|
||||
else
|
||||
dd=$(command -v gnudd || echo dd)
|
||||
exec > >({ "$dd" of="$DD_LOG" oflag=append conv=notrunc iflag=count_bytes count="${DD_LOG_CAP:-268435456}" bs=65536 status=none; cat >/dev/null; }) 2>&1
|
||||
fi
|
||||
dd=$(command -v gnudd || echo dd)
|
||||
exec > >({ "$dd" of="$DD_LOG" oflag=append conv=notrunc iflag=count_bytes count="${DD_LOG_CAP:-268435456}" bs=65536 status=none; cat >/dev/null; }) 2>&1
|
||||
echo "== droiddeck-session $(date) mode=$mode $*"
|
||||
echo "== uid=$(id -u) size=${DD_WIDTH:-?}x${DD_HEIGHT:-?} icd=${VK_ICD_FILENAMES:-none}"
|
||||
echo "== gamescope: $(gamescope --version 2>&1 | head -1) at $(command -v gamescope)"
|
||||
@@ -675,11 +618,6 @@ dd_stretch_game_screen() {
|
||||
export GDK_BACKEND=x11 QT_QPA_PLATFORM=xcb SDL_VIDEODRIVER=x11
|
||||
reap_orphans() {
|
||||
local round p stat pid left
|
||||
# Started by the app as an Android process of its own: its parent is zygote, whose other
|
||||
# children are the app's processes. The guest may not see zygote in /proc; a worker's own
|
||||
# program has DDH_WORKER_PID.
|
||||
[ "${DDH_WORKER_PID:-}" = "$$" ] && return 0
|
||||
case "$(tr -d '\0' < "/proc/$PPID/cmdline" 2>/dev/null)" in ''|zygote*) return 0 ;; esac
|
||||
for round in 1 2 3 4 5; do
|
||||
left=
|
||||
for p in /proc/[0-9]*; do
|
||||
@@ -698,7 +636,7 @@ reap_orphans() {
|
||||
}
|
||||
|
||||
if [ "${DD_DESKTOP:-}" != 1 ] && [ -n "${DD_ANDROID_CLIPBOARD:-}" ] && [ -x /usr/local/bin/droiddeck-clipboard ]; then
|
||||
dd_spawn /usr/local/bin/droiddeck-clipboard "$DD_ANDROID_CLIPBOARD"
|
||||
/usr/local/bin/droiddeck-clipboard "$DD_ANDROID_CLIPBOARD" &
|
||||
fi
|
||||
|
||||
[ "${DD_DESKTOP:-}" = 1 ] || start_agent
|
||||
@@ -841,7 +779,7 @@ case $mode in
|
||||
fi
|
||||
if [ "${DD_ZRAM:-0}" = 1 ]; then
|
||||
step "zRAM compression: on"
|
||||
_dd_job_zram() {
|
||||
(
|
||||
dd_zram_scan() {
|
||||
_dd_game=0 _dd_pids=() _dd_others=() _dd_apps=
|
||||
local _d _c _args _name _a _id _fex _lower _bnet=() _bnet_game=0
|
||||
@@ -1186,7 +1124,7 @@ case $mode in
|
||||
_dd_sample_at= _dd_freed=0 _dd_client_out=0 _dd_note_client=0 _dd_note_session=0
|
||||
_dd_trim_at=-30 _dd_back_at=-30 _dd_forced_at=-10 _dd_full_at=-60 _dd_noted_at=-5
|
||||
_dd_rest=0 _dd_rest_until=0 _dd_rest_available=0
|
||||
while kill -0 "$dd_session_pid" 2>/dev/null; do
|
||||
while kill -0 $$ 2>/dev/null; do
|
||||
dd_memory_tick
|
||||
if [ "$_dd_available" -ge 0 ] &&
|
||||
{ [ "$_dd_available" -lt $((_dd_mem_total * 2 / 5)) ] || [ "$_dd_rate" -ge $((16 * 1024)) ]; }; then
|
||||
@@ -1195,8 +1133,7 @@ case $mode in
|
||||
nap 5
|
||||
fi
|
||||
done
|
||||
}
|
||||
dd_job _dd_job_zram
|
||||
) &
|
||||
fi
|
||||
if [ "${DD_LAUNCHER_CORES:-1}" != 0 ] && [ -n "${DD_LAUNCH_DIR:-}" ] && [ -z "${DD_DESKTOP:-}" ] \
|
||||
&& [ "${DD_STEAM_UI:-}" != desktop ] && [ -x /usr/local/bin/droiddeck-launcher-cores ]; then
|
||||
@@ -1212,7 +1149,6 @@ case $mode in
|
||||
droiddeck-steam-library "$steam_root" || true
|
||||
step "setting up the ARM64 Proton compatibility tool"
|
||||
steam-compatibility "$steam_root" || true
|
||||
steam-compatibility "$steam_root" --seed-arm64-tools || true
|
||||
if [ -z "${DD_DESKTOP:-}" ] && [ "${DD_STEAM_UI:-}" != desktop ]; then
|
||||
droiddeck-steam-ui-scale "$steam_root" "${DD_WIDTH:-1280}" "${DD_HEIGHT:-720}" || true
|
||||
fi
|
||||
@@ -1289,7 +1225,7 @@ case $mode in
|
||||
) &
|
||||
fi
|
||||
fi
|
||||
_dd_job_properties() {
|
||||
[ -z "${DD_DESKTOP:-}" ] && (
|
||||
stretch=0 restore=0
|
||||
[ "${DD_STRETCHED:-0}" = 1 ] && stretch=1
|
||||
[ "${DD_RESTORE_ON_RESUME:-1}" = 1 ] && restore=1
|
||||
@@ -1368,9 +1304,8 @@ case $mode in
|
||||
&& echo "== stretch 16:9 to panel: the client sized the game screen to the output ($DD_STRETCH_OUTPUT), set to $DD_STRETCH_GAME"
|
||||
;;
|
||||
esac
|
||||
done < <(exec xprop -spy -root "${atoms[@]}" 2>/dev/null)
|
||||
}
|
||||
[ -n "${DD_DESKTOP:-}" ] || dd_job _dd_job_properties
|
||||
done < <(xprop -spy -root "${atoms[@]}" 2>/dev/null)
|
||||
) &
|
||||
steam_hold_launch() {
|
||||
local game=$1 shortcut= waited=0 status=0
|
||||
_dd_focused() { xprop -root GAMESCOPE_FOCUSED_APP 2>/dev/null | sed -n 's/.*= *//p'; }
|
||||
@@ -1457,8 +1392,8 @@ case $mode in
|
||||
fi
|
||||
if command -v dbus-daemon >/dev/null 2>&1 && command -v droiddeck-netmanager >/dev/null 2>&1; then
|
||||
write_system_bus_config
|
||||
dd_spawn dbus-daemon --config-file=/usr/local/share/droiddeck/system-bus.conf --nofork --nopidfile
|
||||
system_bus=$dd_spawned
|
||||
dbus-daemon --config-file=/usr/local/share/droiddeck/system-bus.conf --nofork --nopidfile &
|
||||
system_bus=$!
|
||||
for _ in $(seq 1 50); do
|
||||
[ -S /run/dbus/system_bus_socket ] && break
|
||||
sleep 0.1
|
||||
@@ -1466,8 +1401,8 @@ case $mode in
|
||||
if [ -S /run/dbus/system_bus_socket ]; then
|
||||
echo "== network: system bus up, NetworkManager stand-in running"
|
||||
rm -f "$DD_LAUNCH_DIR/steam-sleep-ready"
|
||||
dd_spawn droiddeck-login1 --with-netmanager
|
||||
login_manager=$dd_spawned
|
||||
droiddeck-login1 --with-netmanager &
|
||||
login_manager=$!
|
||||
for ((_i = 0; _i < 50; _i++)); do
|
||||
[ -f "$DD_LAUNCH_DIR/steam-sleep-ready" ] && break
|
||||
kill -0 "$login_manager" 2>/dev/null || break
|
||||
@@ -1491,7 +1426,7 @@ case $mode in
|
||||
if [ -z "${DBUS_SESSION_BUS_ADDRESS:-}" ]; then
|
||||
_dd_bus=${XDG_RUNTIME_DIR:-/run/droiddeck}/bus
|
||||
rm -f "$_dd_bus"
|
||||
dd_spawn dbus-daemon --session --address="unix:path=$_dd_bus" --nofork --nopidfile
|
||||
dbus-daemon --session --address="unix:path=$_dd_bus" --nofork --nopidfile &
|
||||
for _ in $(seq 1 50); do
|
||||
[ -S "$_dd_bus" ] && break
|
||||
nap 0.1
|
||||
@@ -1529,7 +1464,7 @@ case $mode in
|
||||
if [ -f "$HOME/.droiddeck-decky-enabled" ] && [ -x "$decky_loader" ]; then
|
||||
decky_arch=$(cat "$HOME/homebrew/services/.droiddeck-decky-arch" 2>/dev/null || echo unknown)
|
||||
if [ "$decky_arch" = arm64 ] || { [ "$decky_arch" = x86_64 ] && /usr/local/bin/droiddeck-fex prepare >/dev/null; }; then
|
||||
_dd_job_decky() {
|
||||
(
|
||||
decky_child=
|
||||
decky_stop() { [ -z "$decky_child" ] || kill "$decky_child" 2>/dev/null; [ -z "$decky_child" ] || wait "$decky_child" 2>/dev/null; exit 0; }
|
||||
trap decky_stop TERM INT HUP
|
||||
@@ -1553,8 +1488,7 @@ case $mode in
|
||||
echo "== Decky: loader exited with status $decky_status; restart $((decky_exits + 1))/5 in ${decky_delay}s"
|
||||
sleep "$decky_delay"
|
||||
done
|
||||
}
|
||||
dd_job _dd_job_decky
|
||||
) &
|
||||
decky_supervisor=$!
|
||||
echo "== Decky: session supervisor started ($decky_arch)"
|
||||
else
|
||||
@@ -1755,7 +1689,7 @@ case $mode in
|
||||
rm -f "$DD_LAUNCH_DIR/steam-stop" "$DD_LAUNCH_DIR/steam-game" "$DD_LAUNCH_DIR/steam-game.tmp"
|
||||
requests=1
|
||||
fi
|
||||
_dd_job_requests() {
|
||||
(
|
||||
tick=0
|
||||
beat=0
|
||||
library_job=
|
||||
@@ -1933,8 +1867,7 @@ case $mode in
|
||||
fi
|
||||
fi
|
||||
done
|
||||
}
|
||||
dd_job _dd_job_requests
|
||||
) &
|
||||
stop_watcher=$!
|
||||
if [ "${DD_VENUS:-0}" = 1 ] && [ -x /usr/local/bin/droiddeck-glprobe ] && [ "${GALLIUM_DRIVER:-}" = zink ]; then
|
||||
LIBGL_DEBUG=verbose MESA_LOG_LEVEL=debug timeout 20 /usr/local/bin/droiddeck-glprobe 2>&1 | grep -v drirc | head -60 | sed 's/^/== glprobe: /'
|
||||
@@ -2088,7 +2021,6 @@ case $mode in
|
||||
wait "$decky_supervisor" 2>/dev/null || true
|
||||
echo "== Decky: session supervisor stopped"
|
||||
fi
|
||||
dd_stop_daemons
|
||||
_dd_jobs=$(jobs -p)
|
||||
[ -n "$_dd_jobs" ] && kill $_dd_jobs 2>/dev/null
|
||||
echo "== steam: the client on the desktop has exited"
|
||||
@@ -2098,7 +2030,6 @@ case $mode in
|
||||
wait "$decky_supervisor" 2>/dev/null || true
|
||||
echo "== Decky: session supervisor stopped"
|
||||
fi
|
||||
dd_stop_daemons
|
||||
_dd_jobs=$(jobs -p)
|
||||
[ -n "$_dd_jobs" ] && kill $_dd_jobs 2>/dev/null
|
||||
reap_orphans
|
||||
|
||||
@@ -1,103 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
"""Starts a program as the main process of its own Android process, outside the session's cgroup.
|
||||
|
||||
usage: droiddeck-spawn [--wait] [--pid-file FILE] [--] PROGRAM [ARGS...]
|
||||
|
||||
Android counts the session's processes against its child-process limit; a program started this
|
||||
way is not counted (its own children are). It gets this process's environment, working directory
|
||||
and stdin/stdout/stderr, and is not a child of the caller: the pid printed on stdout (or written to
|
||||
FILE) is the one to signal. Without --wait this returns once the program has started; with --wait
|
||||
it waits for it and exits with its status. Where the app offers no spawner, the program is started as a normal child.
|
||||
"""
|
||||
import array
|
||||
import json
|
||||
import os
|
||||
import re
|
||||
import socket
|
||||
import struct
|
||||
import sys
|
||||
|
||||
|
||||
# Exit status when the program started but its pid could not be reported: the caller must not
|
||||
# start it again.
|
||||
STARTED_UNREPORTED = 3
|
||||
|
||||
|
||||
def report(pid, pid_file):
|
||||
try:
|
||||
if pid_file:
|
||||
with open(pid_file, "w") as f:
|
||||
f.write("%s\n" % pid)
|
||||
else:
|
||||
print(pid, flush=True)
|
||||
return True
|
||||
except OSError as e:
|
||||
print("droiddeck-spawn: started pid %s but could not report it: %s" % (pid, e), file=sys.stderr)
|
||||
return False
|
||||
|
||||
|
||||
def fallback(argv, wait, pid_file):
|
||||
pid = os.fork()
|
||||
if pid == 0:
|
||||
try:
|
||||
os.execvp(argv[0], argv)
|
||||
except OSError as e:
|
||||
print("droiddeck-spawn: %s: %s" % (argv[0], e.strerror), file=sys.stderr)
|
||||
os._exit(127)
|
||||
reported = report(pid, pid_file)
|
||||
if wait:
|
||||
return os.waitstatus_to_exitcode(os.waitpid(pid, 0)[1])
|
||||
return 0 if reported else STARTED_UNREPORTED
|
||||
|
||||
|
||||
def main():
|
||||
args = sys.argv[1:]
|
||||
wait = False
|
||||
pid_file = None
|
||||
while args and args[0].startswith("--"):
|
||||
flag = args.pop(0)
|
||||
if flag == "--":
|
||||
break
|
||||
if flag == "--wait":
|
||||
wait = True
|
||||
elif flag == "--pid-file" and args:
|
||||
pid_file = args.pop(0)
|
||||
else:
|
||||
print(__doc__.strip(), file=sys.stderr)
|
||||
return 2
|
||||
if not args:
|
||||
print(__doc__.strip(), file=sys.stderr)
|
||||
return 2
|
||||
name = os.environ.get("DD_SPAWN")
|
||||
if not name:
|
||||
return fallback(args, wait, pid_file)
|
||||
s = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
|
||||
try:
|
||||
s.connect("\0" + name)
|
||||
except OSError:
|
||||
return fallback(args, wait, pid_file)
|
||||
request = {"argv": args, "env": dict(os.environ), "cwd": os.getcwd(), "wait": wait}
|
||||
# the session it belongs to, as SessionService writes it (a positive decimal); anything else is
|
||||
# left out, and the app then runs nothing for it
|
||||
session = os.environ.get("DD_SPAWN_SESSION", "")
|
||||
if re.fullmatch(r"[1-9][0-9]{0,8}", session):
|
||||
request["session"] = int(session)
|
||||
payload = json.dumps(request).encode()
|
||||
s.sendmsg([struct.pack(">I", len(payload)), payload],
|
||||
[(socket.SOL_SOCKET, socket.SCM_RIGHTS, array.array("i", [0, 1, 2]))])
|
||||
reply = s.makefile("r")
|
||||
first = reply.readline().split()
|
||||
if len(first) != 2 or first[0] != "pid":
|
||||
print("droiddeck-spawn: %s; starting %s as a child" % (" ".join(first[1:]) or "no answer", args[0]),
|
||||
file=sys.stderr)
|
||||
return fallback(args, wait, pid_file)
|
||||
reported = report(first[1], pid_file)
|
||||
if not wait:
|
||||
return 0 if reported else STARTED_UNREPORTED
|
||||
done = reply.readline().split()
|
||||
status = int(done[1]) if len(done) == 2 and done[0] == "exit" else 1
|
||||
return status if 0 <= status < 256 else 128 + (status & 0x7f)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
sys.exit(main())
|
||||
Loaded 100 of 157 files, more files were not shown because too many files have changed in this diff.
Show more
Reference in new issue
Block a user