summaryrefslogtreecommitdiff
path: root/src/core/hle/service/nvflinger
diff options
context:
space:
mode:
authorGravatar Fernando Sahmkow2021-11-05 01:44:11 +0100
committerGravatar Fernando Sahmkow2022-10-06 21:00:51 +0200
commitaf35dbcf633d35450b333eb33334b3dd1bc050a1 (patch)
tree94e721b8a23f9659d616f70157574d6826263070 /src/core/hle/service/nvflinger
parentNVDRV: Implement new NvMap (diff)
downloadyuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.gz
yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.tar.xz
yuzu-af35dbcf633d35450b333eb33334b3dd1bc050a1.zip
NVDRV: Fix Open/Close and make sure each device is correctly created.
Diffstat (limited to 'src/core/hle/service/nvflinger')
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp7
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.h1
2 files changed, 7 insertions, 1 deletions
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 4246e5e25..8c3013f83 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -105,10 +105,15 @@ NVFlinger::~NVFlinger() {
105 display.GetLayer(layer).Core().NotifyShutdown(); 105 display.GetLayer(layer).Core().NotifyShutdown();
106 } 106 }
107 } 107 }
108
109 if (nvdrv) {
110 nvdrv->Close(disp_fd);
111 }
108} 112}
109 113
110void NVFlinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) { 114void NVFlinger::SetNVDrvInstance(std::shared_ptr<Nvidia::Module> instance) {
111 nvdrv = std::move(instance); 115 nvdrv = std::move(instance);
116 disp_fd = nvdrv->Open("/dev/nvdisp_disp0");
112} 117}
113 118
114std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) { 119std::optional<u64> NVFlinger::OpenDisplay(std::string_view name) {
@@ -276,7 +281,7 @@ void NVFlinger::Compose() {
276 // Now send the buffer to the GPU for drawing. 281 // Now send the buffer to the GPU for drawing.
277 // TODO(Subv): Support more than just disp0. The display device selection is probably based 282 // TODO(Subv): Support more than just disp0. The display device selection is probably based
278 // on which display we're drawing (Default, Internal, External, etc) 283 // on which display we're drawing (Default, Internal, External, etc)
279 auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>("/dev/nvdisp_disp0"); 284 auto nvdisp = nvdrv->GetDevice<Nvidia::Devices::nvdisp_disp0>(disp_fd);
280 ASSERT(nvdisp); 285 ASSERT(nvdisp);
281 286
282 Common::Rectangle<int> crop_rect{ 287 Common::Rectangle<int> crop_rect{
diff --git a/src/core/hle/service/nvflinger/nvflinger.h b/src/core/hle/service/nvflinger/nvflinger.h
index 3bbe5d92b..b62615de2 100644
--- a/src/core/hle/service/nvflinger/nvflinger.h
+++ b/src/core/hle/service/nvflinger/nvflinger.h
@@ -116,6 +116,7 @@ private:
116 void SplitVSync(std::stop_token stop_token); 116 void SplitVSync(std::stop_token stop_token);
117 117
118 std::shared_ptr<Nvidia::Module> nvdrv; 118 std::shared_ptr<Nvidia::Module> nvdrv;
119 s32 disp_fd;
119 120
120 std::list<VI::Display> displays; 121 std::list<VI::Display> displays;
121 122