mirror of
https://github.com/followmsi/android_kernel_google_msm.git
synced 2024-11-06 23:17:41 +00:00
1aa4bfe39e
In order to support synchronization in a process with a single gralloc handle we require the ability to write lock a buffer while it is already read locked by the same handle. This change extends the concept of an exclusive write lock or recursive read locks to a genlock handle (rather than the genlock lock). Genlock cannot provide deadlock protection because the same handle can be used simultaneously by a producer and consumer. In practice an error will still be generated when the timeout expires. CRs-fixed: 356263 Change-Id: I322e7fadc8b43287f53b211242b176d3de731db2 Signed-off-by: Jeff Boody <jboody@codeaurora.org> Signed-off-by: Stephen Boyd <sboyd@codeaurora.org>
52 lines
1.3 KiB
C
52 lines
1.3 KiB
C
#ifndef _GENLOCK_H_
|
|
#define _GENLOCK_H_
|
|
|
|
#ifdef __KERNEL__
|
|
|
|
struct genlock;
|
|
struct genlock_handle;
|
|
|
|
struct genlock_handle *genlock_get_handle(void);
|
|
struct genlock_handle *genlock_get_handle_fd(int fd);
|
|
void genlock_put_handle(struct genlock_handle *handle);
|
|
struct genlock *genlock_create_lock(struct genlock_handle *);
|
|
struct genlock *genlock_attach_lock(struct genlock_handle *, int fd);
|
|
int genlock_wait(struct genlock_handle *handle, u32 timeout);
|
|
/* genlock_release_lock was deprecated */
|
|
int genlock_lock(struct genlock_handle *handle, int op, int flags,
|
|
u32 timeout);
|
|
#endif
|
|
|
|
#define GENLOCK_UNLOCK 0
|
|
#define GENLOCK_WRLOCK 1
|
|
#define GENLOCK_RDLOCK 2
|
|
|
|
#define GENLOCK_NOBLOCK (1 << 0)
|
|
#define GENLOCK_WRITE_TO_READ (1 << 1)
|
|
|
|
struct genlock_lock {
|
|
int fd;
|
|
int op;
|
|
int flags;
|
|
int timeout;
|
|
};
|
|
|
|
#define GENLOCK_IOC_MAGIC 'G'
|
|
|
|
#define GENLOCK_IOC_NEW _IO(GENLOCK_IOC_MAGIC, 0)
|
|
#define GENLOCK_IOC_EXPORT _IOR(GENLOCK_IOC_MAGIC, 1, \
|
|
struct genlock_lock)
|
|
#define GENLOCK_IOC_ATTACH _IOW(GENLOCK_IOC_MAGIC, 2, \
|
|
struct genlock_lock)
|
|
|
|
/* Deprecated */
|
|
#define GENLOCK_IOC_LOCK _IOW(GENLOCK_IOC_MAGIC, 3, \
|
|
struct genlock_lock)
|
|
|
|
/* Deprecated */
|
|
#define GENLOCK_IOC_RELEASE _IO(GENLOCK_IOC_MAGIC, 4)
|
|
#define GENLOCK_IOC_WAIT _IOW(GENLOCK_IOC_MAGIC, 5, \
|
|
struct genlock_lock)
|
|
#define GENLOCK_IOC_DREADLOCK _IOW(GENLOCK_IOC_MAGIC, 6, \
|
|
struct genlock_lock)
|
|
#endif
|