mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-27 19:10:14 +01:00
Debugging fd mix-ups (ie. where, possibly via close()ing the original fd, etc, you end up with something that is a valid fd but not a valid *fence* fd) can be difficult. Fortunately we can use the FILE_INFO ioctl, which will return an error if the fd is not a fence fd. For android, we instead use the libsync API, which does a similar thing on modern kernels, but has a fallback path for older android kernels. Note that the FILE_INFO ioctl has existed upstream since at least prior to destaging of sync_file. Signed-off-by: Rob Clark <robdclark@chromium.org> Reviewed-by: Emma Anholt <emma@anholt.net> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/11202>
29 lines
434 B
C++
29 lines
434 B
C++
#include <cutils/properties.h>
|
|
#include <sync/sync.h>
|
|
#include <hardware/hardware.h>
|
|
#include <android/log.h>
|
|
#include <backtrace/Backtrace.h>
|
|
|
|
extern "C" {
|
|
|
|
/* timeout in msecs */
|
|
int sync_wait(int fd, int timeout)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
int sync_merge(const char *name, int fd, int fd2)
|
|
{
|
|
return 0;
|
|
}
|
|
|
|
struct sync_file_info* sync_file_info(int32_t fd)
|
|
{
|
|
return NULL;
|
|
}
|
|
|
|
void sync_file_info_free(struct sync_file_info* info)
|
|
{
|
|
}
|
|
|
|
}
|