libnx/nx/include/switch/display/binder.h
fincs 819a6f0d89 display/binder.h: refactoring and other changes:
- Removed session_handle/native_handle state
- Consequence of the above: simplified binderCreate/binderInitSession
- Now using viGetSession_IHOSBinderDriverRelay internally
- Changed binderGetNativeHandle to return an Event
- Added readable aliases for binderAdjustRefcount
- gfx: now using async bqDequeueBuffer when the binder event is available
2018-08-31 13:05:23 +02:00

49 lines
1.2 KiB
C

#pragma once
#include "../types.h"
#include "../kernel/event.h"
#define BINDER_FIRST_CALL_TRANSACTION 0x1
typedef struct {
bool created : 1;
bool initialized : 1;
bool has_transact_auto : 1;
s32 id;
size_t ipc_buffer_size;
} Binder;
// Note: binderClose will not close the session_handle provided to binderCreate.
void binderCreate(Binder* b, s32 id);
void binderClose(Binder* b);
Result binderInitSession(Binder* b);
Result binderTransactParcel(
Binder* b, u32 code,
void* parcel_data, size_t parcel_data_size,
void* parcel_reply, size_t parcel_reply_size,
u32 flags);
Result binderAdjustRefcount(Binder* b, s32 addval, s32 type);
Result binderGetNativeHandle(Binder* b, u32 unk0, Event *event_out);
static inline Result binderIncreaseWeakRef(Binder* b)
{
return binderAdjustRefcount(b, 1, 0);
}
static inline Result binderDecreaseWeakRef(Binder* b)
{
return binderAdjustRefcount(b, -1, 0);
}
static inline Result binderIncreaseStrongRef(Binder* b)
{
return binderAdjustRefcount(b, 1, 1);
}
static inline Result binderDecreaseStrongRef(Binder* b)
{
return binderAdjustRefcount(b, -1, 1);
}