diff options
| author | 2021-11-11 18:13:35 -0800 | |
|---|---|---|
| committer | 2022-03-24 18:13:32 -0700 | |
| commit | d456b9d554da32e4353ba6e837e1cb8690782a9d (patch) | |
| tree | 75029812af06aabfcc83d29098db4ff85e929ea5 /src/core | |
| parent | hle: nvflinger: Add implementation for GraphicBuffer class. (diff) | |
| download | yuzu-d456b9d554da32e4353ba6e837e1cb8690782a9d.tar.gz yuzu-d456b9d554da32e4353ba6e837e1cb8690782a9d.tar.xz yuzu-d456b9d554da32e4353ba6e837e1cb8690782a9d.zip | |
hle: nvflinger: Move PixelFormat to its own header.
Diffstat (limited to 'src/core')
| -rw-r--r-- | src/core/CMakeLists.txt | 1 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | 10 | ||||
| -rw-r--r-- | src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | 5 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/pixel_format.h | 21 | ||||
| -rw-r--r-- | src/core/hle/service/nvflinger/ui/graphic_buffer.h | 4 |
5 files changed, 31 insertions, 10 deletions
diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 5e9b959a5..a7afc675d 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt | |||
| @@ -539,6 +539,7 @@ add_library(core STATIC | |||
| 539 | hle/service/nvflinger/buffer_queue.h | 539 | hle/service/nvflinger/buffer_queue.h |
| 540 | hle/service/nvflinger/nvflinger.cpp | 540 | hle/service/nvflinger/nvflinger.cpp |
| 541 | hle/service/nvflinger/nvflinger.h | 541 | hle/service/nvflinger/nvflinger.h |
| 542 | hle/service/nvflinger/pixel_format.h | ||
| 542 | hle/service/nvflinger/status.h | 543 | hle/service/nvflinger/status.h |
| 543 | hle/service/nvflinger/ui/fence.h | 544 | hle/service/nvflinger/ui/fence.h |
| 544 | hle/service/nvflinger/ui/graphic_buffer.h | 545 | hle/service/nvflinger/ui/graphic_buffer.h |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp index 68f1e9060..9fad45fe1 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp | |||
| @@ -38,18 +38,16 @@ NvResult nvdisp_disp0::Ioctl3(DeviceFD fd, Ioctl command, const std::vector<u8>& | |||
| 38 | void nvdisp_disp0::OnOpen(DeviceFD fd) {} | 38 | void nvdisp_disp0::OnOpen(DeviceFD fd) {} |
| 39 | void nvdisp_disp0::OnClose(DeviceFD fd) {} | 39 | void nvdisp_disp0::OnClose(DeviceFD fd) {} |
| 40 | 40 | ||
| 41 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, | 41 | void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width, |
| 42 | u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform, | 42 | u32 height, u32 stride, android::BufferTransformFlags transform, |
| 43 | const Common::Rectangle<int>& crop_rect) { | 43 | const Common::Rectangle<int>& crop_rect) { |
| 44 | const VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); | 44 | const VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); |
| 45 | LOG_TRACE(Service, | 45 | LOG_TRACE(Service, |
| 46 | "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", | 46 | "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", |
| 47 | addr, offset, width, height, stride, format); | 47 | addr, offset, width, height, stride, format); |
| 48 | 48 | ||
| 49 | const auto pixel_format = static_cast<Tegra::FramebufferConfig::PixelFormat>(format); | 49 | const Tegra::FramebufferConfig framebuffer{addr, offset, width, height, |
| 50 | const auto transform_flags = static_cast<Tegra::FramebufferConfig::TransformFlags>(transform); | 50 | stride, format, transform, crop_rect}; |
| 51 | const Tegra::FramebufferConfig framebuffer{addr, offset, width, height, | ||
| 52 | stride, pixel_format, transform_flags, crop_rect}; | ||
| 53 | 51 | ||
| 54 | system.GetPerfStats().EndSystemFrame(); | 52 | system.GetPerfStats().EndSystemFrame(); |
| 55 | system.GPU().SwapBuffers(&framebuffer); | 53 | system.GPU().SwapBuffers(&framebuffer); |
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h index de01e1d5f..53c539ce4 100644 --- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h +++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h | |||
| @@ -10,6 +10,7 @@ | |||
| 10 | #include "common/math_util.h" | 10 | #include "common/math_util.h" |
| 11 | #include "core/hle/service/nvdrv/devices/nvdevice.h" | 11 | #include "core/hle/service/nvdrv/devices/nvdevice.h" |
| 12 | #include "core/hle/service/nvflinger/buffer_queue.h" | 12 | #include "core/hle/service/nvflinger/buffer_queue.h" |
| 13 | #include "core/hle/service/nvflinger/pixel_format.h" | ||
| 13 | 14 | ||
| 14 | namespace Service::Nvidia::Devices { | 15 | namespace Service::Nvidia::Devices { |
| 15 | 16 | ||
| @@ -31,8 +32,8 @@ public: | |||
| 31 | void OnClose(DeviceFD fd) override; | 32 | void OnClose(DeviceFD fd) override; |
| 32 | 33 | ||
| 33 | /// Performs a screen flip, drawing the buffer pointed to by the handle. | 34 | /// Performs a screen flip, drawing the buffer pointed to by the handle. |
| 34 | void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, | 35 | void flip(u32 buffer_handle, u32 offset, android::PixelFormat format, u32 width, u32 height, |
| 35 | NVFlinger::BufferQueue::BufferTransformFlags transform, | 36 | u32 stride, android::BufferTransformFlags transform, |
| 36 | const Common::Rectangle<int>& crop_rect); | 37 | const Common::Rectangle<int>& crop_rect); |
| 37 | 38 | ||
| 38 | private: | 39 | private: |
diff --git a/src/core/hle/service/nvflinger/pixel_format.h b/src/core/hle/service/nvflinger/pixel_format.h new file mode 100644 index 000000000..966c84775 --- /dev/null +++ b/src/core/hle/service/nvflinger/pixel_format.h | |||
| @@ -0,0 +1,21 @@ | |||
| 1 | // SPDX-License-Identifier: GPL-3.0-or-later | ||
| 2 | // Copyright 2021 yuzu Emulator Project | ||
| 3 | |||
| 4 | #pragma once | ||
| 5 | |||
| 6 | #include "common/common_types.h" | ||
| 7 | |||
| 8 | namespace android { | ||
| 9 | |||
| 10 | enum class PixelFormat : u32 { | ||
| 11 | NoFormat = 0, | ||
| 12 | Rgba8888 = 1, | ||
| 13 | Rgbx8888 = 2, | ||
| 14 | Rgb888 = 3, | ||
| 15 | Rgb565 = 4, | ||
| 16 | Bgra8888 = 5, | ||
| 17 | Rgba5551 = 6, | ||
| 18 | Rgba4444 = 7, | ||
| 19 | }; | ||
| 20 | |||
| 21 | } // namespace android | ||
diff --git a/src/core/hle/service/nvflinger/ui/graphic_buffer.h b/src/core/hle/service/nvflinger/ui/graphic_buffer.h index c1e54d9ed..2e7f251ef 100644 --- a/src/core/hle/service/nvflinger/ui/graphic_buffer.h +++ b/src/core/hle/service/nvflinger/ui/graphic_buffer.h | |||
| @@ -44,7 +44,7 @@ public: | |||
| 44 | return buffer_id; | 44 | return buffer_id; |
| 45 | } | 45 | } |
| 46 | 46 | ||
| 47 | constexpr u32 ExternalFormat() const { | 47 | constexpr PixelFormat ExternalFormat() const { |
| 48 | return external_format; | 48 | return external_format; |
| 49 | } | 49 | } |
| 50 | 50 | ||
| @@ -89,7 +89,7 @@ private: | |||
| 89 | INSERT_PADDING_WORDS(3); | 89 | INSERT_PADDING_WORDS(3); |
| 90 | u32 buffer_id{}; | 90 | u32 buffer_id{}; |
| 91 | INSERT_PADDING_WORDS(6); | 91 | INSERT_PADDING_WORDS(6); |
| 92 | u32 external_format{}; | 92 | PixelFormat external_format{}; |
| 93 | INSERT_PADDING_WORDS(10); | 93 | INSERT_PADDING_WORDS(10); |
| 94 | u32 handle{}; | 94 | u32 handle{}; |
| 95 | u32 offset{}; | 95 | u32 offset{}; |