From: Changyeon Lee Date: Fri, 13 Sep 2024 02:17:56 +0000 (+0900) Subject: tbm_sync: Inlucde linux/sync_file.h X-Git-Tag: accepted/tizen/unified/20240920.010757~2 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=4b2bff06774089f716959f635bdd17fa82827c9c;p=platform%2Fcore%2Fuifw%2Flibtbm.git tbm_sync: Inlucde linux/sync_file.h Change-Id: If4b24f2c9cc0f7906f6ce13e71b6d798648b8782 --- diff --git a/src/tbm_sync.c b/src/tbm_sync.c index 9421436..1501567 100644 --- a/src/tbm_sync.c +++ b/src/tbm_sync.c @@ -40,47 +40,51 @@ SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. #include #include #include +#include #include -/* IOCTLs for timeline file object. */ -#define TIMELINE_IOC_MAGIC 'W' -#define TIMELINE_IOC_CREATE_FENCE _IOWR(TIMELINE_IOC_MAGIC, 0, struct create_fence_data) -#define TIMELINE_IOC_INC _IOW(TIMELINE_IOC_MAGIC, 1, __u32) - -/* IOCTLs for fence file object. */ -#define FENCE_IOC_MAGIC '>' -#define FENCE_IOC_MERGE _IOWR(FENCE_IOC_MAGIC, 3, struct sync_merge_data) - -#define FENCE_IOC_LEGACY_WAIT _IOW(FENCE_IOC_MAGIC, 0, __s32) -#define FENCE_IOC_LEGACY_MERGE _IOWR(FENCE_IOC_MAGIC, 1, struct sync_legacy_merge_data) - /* Path to the sync device legacy file. */ -#define SYNC_DEVICE_PATH_LEGACY "/dev/sw_sync" +#define SYNC_DEVICE_PATH_LEGACY "/dev/sw_sync" /* Path to the sync device file. */ -#define SYNC_DEVICE_PATH "/sys/kernel/debug/sync/sw_sync" +#define SYNC_DEVICE_PATH "/sys/kernel/debug/sync/sw_sync" + +/* IOCTLs for timeline file object. */ +#define SW_SYNC_IOC_MAGIC 'W' +#define SW_SYNC_IOC_CREATE_FENCE _IOWR(SW_SYNC_IOC_MAGIC, 0, struct create_fence_data) +#define SW_SYNC_IOC_INC _IOW(SW_SYNC_IOC_MAGIC, 1, __u32) + +#define SYNC_IOC_LEGACY_MERGE _IOWR(SYNC_IOC_MAGIC, 1, struct sync_legacy_merge_data) +#define SYNC_IOC_LEGACY_FENCE_INFO _IOWR(SYNC_IOC_MAGIC, 2, struct sync_fence_info_data) /* Argument data structure for the timeline.create_fence ioctl. */ struct create_fence_data { - __u32 value; /* Pt value on the timeline for the fence (IN) */ - char name[32]; /* Name of the fence object (IN) */ - __s32 fence; /* File descriptor for the created fence (OUT) */ + uint32_t value; /* Pt value on the timeline for the fence (IN) */ + char name[32]; /* Name of the fence object (IN) */ + int32_t fence; /* File descriptor for the created fence (OUT) */ }; -/* Argument data structure for the fence.merge ioctl. */ -struct sync_merge_data { - char name[32]; /* Name of the new fence object (IN) */ - __s32 fd2; /* fence to merged with the fence (IN) */ - __s32 fence; /* File descriptor for the new fence (OUT) */ - __u32 flags; /* merge_data flags (IN) */ - __u32 pad; /* padding for 64-bit alignment, should always be zero */ +/* Argument data structure for the legacy fence.merge ioctl. */ +struct sync_fence_info_data { + uint32_t len; + char name[32]; + int32_t status; + uint8_t pt_info[0]; +}; + +struct sync_pt_info { + uint32_t len; + char obj_name[32]; + char driver_name[32]; + int32_t status; + uint64_t timestamp_ns; + uint8_t driver_data[0]; }; -/* Argument data structure for the legacy fence.merge ioctl. */ struct sync_legacy_merge_data { - __s32 fd2; /* fence to merged with the fence (IN) */ - char name[32]; /* Name of the new fence object (IN) */ - __s32 fence; /* File descriptor for the new fence (OUT) */ + int32_t fd2; /* fence to merged with the fence (IN) */ + char name[32]; /* Name of the new fence object (IN) */ + int32_t fence; /* File descriptor for the new fence (OUT) */ }; #define ERRNO_BUF_SIZE 256 @@ -140,7 +144,7 @@ tbm_sync_timeline_inc(tbm_fd timeline, unsigned int count) { __u32 arg = count; - if (ioctl(timeline, TIMELINE_IOC_INC, &arg) == -1) { + if (ioctl(timeline, SW_SYNC_IOC_INC, &arg) == -1) { _log_errno(); return 0; } @@ -155,7 +159,7 @@ tbm_sync_fence_create(tbm_fd timeline, const char *name, unsigned int value) _copy_string(data.name, name, 32); - if (ioctl(timeline, TIMELINE_IOC_CREATE_FENCE, &data) == -1) { + if (ioctl(timeline, SW_SYNC_IOC_CREATE_FENCE, &data) == -1) { _log_errno(); return -1; } @@ -201,13 +205,13 @@ tbm_sync_fence_merge(const char *name, tbm_fd fence1, tbm_fd fence2) _copy_string(data.name, name, 32); - ret = ioctl(fence1, FENCE_IOC_MERGE, &data); + ret = ioctl(fence1, SYNC_IOC_MERGE, &data); if (ret < 0 && errno == ENOTTY) { struct sync_legacy_merge_data legacy_data = {. fd2 = fence2 }; _copy_string(legacy_data.name, name, 32); - ret = ioctl(fence1, FENCE_IOC_LEGACY_MERGE, &legacy_data); + ret = ioctl(fence1, SYNC_IOC_LEGACY_MERGE, &legacy_data); if (ret < 0) { _log_errno(); return -1;