Skip to content

Replace "void* fence_cookie" with "uint64_t fence_id"

Ryan Neph requested to merge ryanneph/virglrenderer:context-fence-api into master

Historically virgl contexts would stash a void *fence_cookie passed by the library's users within their own fence types, and pass these back when retiring them. Internally, the only operations taken on these cookies are copying and testing equality.

For 32-bit systems running crosvm, the 64-bit fence issued by the guest kernel's virtio-gpu is truncated to 32-bits in order to fit within the pointer type. There's no real reason to keep using pointers for the fence_cookie, so this PR switches to storing the cookie explicitly as a uint64_t and adopts the fence_id naming convention. For library users that still wish to stash complex data within a fence, they can continue to do so by casting their own void *fence_cookie to a uint64_t before handing it to virglrenderer without losing any information in the process.

  • commit 1 is unrelated to the api change - to silence compiler warnings in fuzzer/
  • commits 2-5 changes the external API and pushes the uint64_t/void* cast down into each context
  • commits 6-9 change each context's internals to avoid the potentially lossy downcast (on 32-bit systems). There is one commit for each context type.

/cc @olv @zzyiwei @robclark

Merge request reports

Loading