From bde3ae5a77b96ba2bc61c9d4c3b26065b5fbbcd9 Mon Sep 17 00:00:00 2001 From: yellows8 Date: Sun, 25 Aug 2019 20:05:44 -0400 Subject: [PATCH] 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. --- nx/include/switch/display/native_window.h | 3 ++- nx/source/display/native_window.c | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/nx/include/switch/display/native_window.h b/nx/include/switch/display/native_window.h index 15fd7a19..396d0d87 100644 --- a/nx/include/switch/display/native_window.h +++ b/nx/include/switch/display/native_window.h @@ -58,10 +58,11 @@ NWindow* nwindowGetDefault(void); /** * @brief Creates a \ref NWindow. * @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] 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. diff --git a/nx/source/display/native_window.c b/nx/source/display/native_window.c index 78a72209..4703c97c 100644 --- a/nx/source/display/native_window.c +++ b/nx/source/display/native_window.c @@ -48,7 +48,7 @@ bool nwindowIsValid(NWindow* nw) 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; @@ -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; binderCreate(&nw->bq, binder_id); - rc = binderInitSession(&nw->bq, viGetSession_IHOSBinderDriverRelay()); + rc = binderInitSession(&nw->bq, binder_session); if (R_SUCCEEDED(rc)) 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) { - return nwindowCreate(nw, layer->igbp_binder_obj_id, false); + return nwindowCreate(nw, viGetSession_IHOSBinderDriverRelay(), layer->igbp_binder_obj_id, false); } void nwindowClose(NWindow* nw)