mirror of
https://github.com/Droid-Deck/DroidDeck.git
synced 2026-11-12 11:31:08 +00:00
fix(quest): check a caught-up KGSL context at timestamp zero too
A context with no submissions skipped the ownership check. Check whenever nothing is pending, since a pending timestamp's wait already checks it.
This commit is contained in:
1 parent
6d7732710c
commit
1259abed5f
2 files changed
+10
-5
No files matched your search
@@ -50,7 +50,7 @@ static int read_retired(int (*real)(int, unsigned long, void *), int fd,
|
||||
timestamp = __atomic_load_n(&contexts[id].retired, __ATOMIC_RELAXED);
|
||||
submitted = __atomic_load_n(&contexts[id].submitted, __ATOMIC_RELAXED);
|
||||
/* KGSL checks a context's owner on every wait, which catches one that died with a reused descriptor. */
|
||||
if (timestamp != 0 && wait_retired(real, fd, id, timestamp) < 0) return -1;
|
||||
if (timestamp == submitted && wait_retired(real, fd, id, timestamp) < 0) return -1;
|
||||
while (timestamp != submitted) {
|
||||
result = wait_retired(real, fd, id, timestamp + 1);
|
||||
if (result < 0) return -1;
|
||||
|
||||
@@ -74,8 +74,13 @@ int main(void) {
|
||||
assert(read_timestamp(3, ×tamp) == -1 && errno == EACCES && waits == 0);
|
||||
|
||||
create_context(3);
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 0 && waits == 0);
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 0 && waits == 1);
|
||||
|
||||
wait_error = EINVAL;
|
||||
assert(read_timestamp(3, ×tamp) == -1 && errno == EINVAL);
|
||||
wait_error = 0;
|
||||
|
||||
waits = 0;
|
||||
read_error = EBADF;
|
||||
assert(read_timestamp(3, ×tamp) == -1 && errno == EBADF && waits == 0);
|
||||
read_error = EACCES;
|
||||
@@ -95,11 +100,11 @@ int main(void) {
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 2 && waits == 3);
|
||||
|
||||
waits = 0;
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 2 && waits == 2);
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 2 && waits == 1);
|
||||
|
||||
retired = 3;
|
||||
waits = 0;
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 3 && waits == 2);
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 3 && waits == 1);
|
||||
|
||||
waits = 0;
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 3 && waits == 1);
|
||||
@@ -123,7 +128,7 @@ int main(void) {
|
||||
create_context(3);
|
||||
retired = 0;
|
||||
waits = 0;
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 0 && waits == 0);
|
||||
assert(read_timestamp(3, ×tamp) == 0 && timestamp == 0 && waits == 1);
|
||||
|
||||
struct kgsl_drawctxt_destroy destroy = {.drawctxt_id = 3};
|
||||
bl_kgsl_track(mock, 42, IOCTL_KGSL_DRAWCTXT_DESTROY, &destroy, &rc);
|
||||
|
||||
Reference in new issue
Block a user