Added binder_session param to nwindowCreate(), which is now used with the binderInitSession() call instead of a hard-coded Service. Moved the viGetSession_IHOSBinderDriverRelay() call into nwindowCreateFromLayer(), for this new param.

This commit is contained in:
yellows8 2019-08-25 20:05:44 -04:00
parent 5e535bc2eb
commit bde3ae5a77
No known key found for this signature in database
GPG Key ID: 0AF90DA3F1E60E43
2 changed files with 5 additions and 4 deletions

View File

@ -58,10 +58,11 @@ NWindow* nwindowGetDefault(void);
/** /**
* @brief Creates a \ref NWindow. * @brief Creates a \ref NWindow.
* @param[out] nw Output \ref NWindow structure. * @param[out] nw Output \ref NWindow structure.
* @param[in] binder_session Service object for the Android IGraphicBufferProducer binder session.
* @param[in] binder_id Android IGraphicBufferProducer binder session ID. * @param[in] binder_id Android IGraphicBufferProducer binder session ID.
* @param[in] producer_controlled_by_app Specifies whether the producer is controlled by the application. * @param[in] producer_controlled_by_app Specifies whether the producer is controlled by the application.
*/ */
Result nwindowCreate(NWindow* nw, s32 binder_id, bool producer_controlled_by_app); Result nwindowCreate(NWindow* nw, Service* binder_session, s32 binder_id, bool producer_controlled_by_app);
/** /**
* @brief Creates a \ref NWindow operating on a \ref ViLayer. * @brief Creates a \ref NWindow operating on a \ref ViLayer.

View File

@ -48,7 +48,7 @@ bool nwindowIsValid(NWindow* nw)
return nw && nw->magic == NWINDOW_MAGIC; return nw && nw->magic == NWINDOW_MAGIC;
} }
Result nwindowCreate(NWindow* nw, s32 binder_id, bool producer_controlled_by_app) Result nwindowCreate(NWindow* nw, Service* binder_session, s32 binder_id, bool producer_controlled_by_app)
{ {
Result rc; Result rc;
@ -60,7 +60,7 @@ Result nwindowCreate(NWindow* nw, s32 binder_id, bool producer_controlled_by_app
nw->producer_controlled_by_app = producer_controlled_by_app; nw->producer_controlled_by_app = producer_controlled_by_app;
binderCreate(&nw->bq, binder_id); binderCreate(&nw->bq, binder_id);
rc = binderInitSession(&nw->bq, viGetSession_IHOSBinderDriverRelay()); rc = binderInitSession(&nw->bq, binder_session);
if (R_SUCCEEDED(rc)) if (R_SUCCEEDED(rc))
binderGetNativeHandle(&nw->bq, 0x0f, &nw->event); binderGetNativeHandle(&nw->bq, 0x0f, &nw->event);
@ -76,7 +76,7 @@ Result nwindowCreate(NWindow* nw, s32 binder_id, bool producer_controlled_by_app
Result nwindowCreateFromLayer(NWindow* nw, const ViLayer* layer) Result nwindowCreateFromLayer(NWindow* nw, const ViLayer* layer)
{ {
return nwindowCreate(nw, layer->igbp_binder_obj_id, false); return nwindowCreate(nw, viGetSession_IHOSBinderDriverRelay(), layer->igbp_binder_obj_id, false);
} }
void nwindowClose(NWindow* nw) void nwindowClose(NWindow* nw)