mirror of
https://github.com/hardkernel/linux.git
synced 2026-06-09 04:10:18 +09:00
sync: new fence api [2/7]
PD#149525: sync: new fence api Change-Id: I3c957758a67fb6c0a0b3aa5031637b00d3d510e8 Signed-off-by: Jiyu Yang <Jiyu.Yang@amlogic.com>
This commit is contained in:
@@ -14052,6 +14052,10 @@ AMLOGIC multimedia
|
||||
M: Nanxin Qin <nanxin.qin@amlogic.com>
|
||||
F: drivers/amlogic/media/common/codec_mm/configs/*
|
||||
|
||||
AMLOGIC sync
|
||||
M: Sky Zhou <sky.zhou@amlogic.com>
|
||||
F: include/linux/amlogic/aml_sync_api.h
|
||||
|
||||
AMLOGIC ADD PARTITION NORMAL & AB DTS
|
||||
M: Xindong Xu <xindong.xu@amlogic.com>
|
||||
F: arch/arm64/boot/dts/amlogic/partition_mbox_ab.dtsi
|
||||
@@ -14061,4 +14065,4 @@ AMLOGIC multimedia
|
||||
M: JinTao Xu <jintao.xu@amlogic.com>
|
||||
F: drivers/amlogic/media/video_processor/ionvideo/ion_priv.h
|
||||
F: drivers/amlogic/media/video_processor/ionvideo/videobuf2-ion.c
|
||||
F: drivers/amlogic/media/video_processor/ionvideo/videobuf2-ion.h
|
||||
F: drivers/amlogic/media/video_processor/ionvideo/videobuf2-ion.h
|
||||
|
||||
@@ -442,6 +442,8 @@ CONFIG_LEDS_TRIGGER_TIMER=y
|
||||
CONFIG_LEDS_TRIGGER_ONESHOT=y
|
||||
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
|
||||
CONFIG_LEDS_TRIGGER_BACKLIGHT=y
|
||||
CONFIG_SYNC_FILE=y
|
||||
CONFIG_SW_SYNC=y
|
||||
CONFIG_UIO=y
|
||||
CONFIG_UIO_PDRV_GENIRQ=y
|
||||
CONFIG_VIRTIO_MMIO=y
|
||||
@@ -449,9 +451,6 @@ CONFIG_STAGING=y
|
||||
CONFIG_ASHMEM=y
|
||||
CONFIG_ANDROID_LOGGER=y
|
||||
CONFIG_ANDROID_LOW_MEMORY_KILLER=y
|
||||
CONFIG_SYNC=y
|
||||
CONFIG_SW_SYNC=y
|
||||
CONFIG_SW_SYNC_USER=y
|
||||
CONFIG_PM_DEVFREQ=y
|
||||
CONFIG_DEVFREQ_GOV_SIMPLE_ONDEMAND=y
|
||||
CONFIG_DEVFREQ_GOV_PERFORMANCE=y
|
||||
|
||||
@@ -381,3 +381,82 @@ const struct file_operations sw_sync_debugfs_fops = {
|
||||
.unlocked_ioctl = sw_sync_ioctl,
|
||||
.compat_ioctl = sw_sync_ioctl,
|
||||
};
|
||||
|
||||
|
||||
/*api for amlogic use.*/
|
||||
void *aml_sync_create_timeline(const char *tname)
|
||||
{
|
||||
struct sync_timeline *timeline;
|
||||
|
||||
timeline = sync_timeline_create(tname);
|
||||
return (void *)timeline;
|
||||
}
|
||||
EXPORT_SYMBOL(aml_sync_create_timeline);
|
||||
|
||||
int aml_sync_create_fence(void *timeline, unsigned int value)
|
||||
{
|
||||
struct sync_timeline *tl = (struct sync_timeline *)timeline;
|
||||
int fd;
|
||||
int err;
|
||||
struct sync_pt *pt;
|
||||
struct sync_file *sync_file;
|
||||
|
||||
if (tl == NULL)
|
||||
return -EPERM;
|
||||
|
||||
fd = get_unused_fd_flags(O_CLOEXEC);
|
||||
if (fd < 0)
|
||||
return -EBADF;
|
||||
|
||||
pt = sync_pt_create(tl, sizeof(*pt), value);
|
||||
if (!pt) {
|
||||
err = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
sync_file = sync_file_create(&pt->base);
|
||||
fence_put(&pt->base);
|
||||
if (!sync_file) {
|
||||
err = -ENOMEM;
|
||||
goto err;
|
||||
}
|
||||
|
||||
fd_install(fd, sync_file->file);
|
||||
return fd;
|
||||
|
||||
err:
|
||||
put_unused_fd(fd);
|
||||
return err;
|
||||
}
|
||||
EXPORT_SYMBOL(aml_sync_create_fence);
|
||||
|
||||
void aml_sync_inc_timeline(void *timeline, unsigned int value)
|
||||
{
|
||||
struct sync_timeline *tl = (struct sync_timeline *)timeline;
|
||||
|
||||
if (tl == NULL)
|
||||
return;
|
||||
sync_timeline_signal(tl, value);
|
||||
}
|
||||
EXPORT_SYMBOL(aml_sync_inc_timeline);
|
||||
|
||||
struct fence *aml_sync_get_fence(int syncfile_fd)
|
||||
{
|
||||
return sync_file_get_fence(syncfile_fd);
|
||||
}
|
||||
EXPORT_SYMBOL(aml_sync_get_fence);
|
||||
|
||||
int aml_sync_wait_fence(struct fence *fence, long timeout)
|
||||
{
|
||||
long ret;
|
||||
|
||||
ret = fence_wait_timeout(fence, false, timeout);
|
||||
return ret;
|
||||
}
|
||||
EXPORT_SYMBOL(aml_sync_wait_fence);
|
||||
|
||||
void aml_sync_put_fence(struct fence *fence)
|
||||
{
|
||||
fence_put(fence);
|
||||
}
|
||||
EXPORT_SYMBOL(aml_sync_put_fence);
|
||||
|
||||
26
include/linux/amlogic/aml_sync_api.h
Normal file
26
include/linux/amlogic/aml_sync_api.h
Normal file
@@ -0,0 +1,26 @@
|
||||
/*
|
||||
* include/linux/amlogic/aml_sync_api.h
|
||||
*
|
||||
* Copyright (C) 2017 Amlogic, Inc. All rights reserved.
|
||||
*
|
||||
* This program is free software; you can redistribute it and/or modify
|
||||
* it under the terms of the GNU General Public License as published by
|
||||
* the Free Software Foundation; either version 2 of the License, or
|
||||
* (at your option) any later version.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
*/
|
||||
|
||||
struct fence;
|
||||
|
||||
void *aml_sync_create_timeline(const char *tname);
|
||||
int aml_sync_create_fence(void *timeline, unsigned int value);
|
||||
int aml_sync_inc_timeline(void *timeline, unsigned int value);
|
||||
|
||||
struct fence *aml_sync_get_fence(int syncfile_fd);
|
||||
int aml_sync_wait_fence(struct fence *syncfile, long timeout);
|
||||
void aml_sync_put_fence(struct fence *syncfile);
|
||||
Reference in New Issue
Block a user