diff options
Diffstat (limited to 'src')
| -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 | ||||
| -rw-r--r-- | src/video_core/framebuffer_config.h | 10 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/renderer_opengl/renderer_opengl.h | 4 | ||||
| -rw-r--r-- | src/video_core/renderer_vulkan/vk_blit_screen.cpp | 10 | ||||
| -rw-r--r-- | src/video_core/surface.cpp | 8 | ||||
| -rw-r--r-- | src/video_core/surface.h | 2 |
11 files changed, 50 insertions, 33 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{}; |
diff --git a/src/video_core/framebuffer_config.h b/src/video_core/framebuffer_config.h index b1d455e30..5921d830e 100644 --- a/src/video_core/framebuffer_config.h +++ b/src/video_core/framebuffer_config.h | |||
| @@ -6,18 +6,14 @@ | |||
| 6 | 6 | ||
| 7 | #include "common/common_types.h" | 7 | #include "common/common_types.h" |
| 8 | #include "common/math_util.h" | 8 | #include "common/math_util.h" |
| 9 | #include "core/hle/service/nvflinger/pixel_format.h" | ||
| 9 | 10 | ||
| 10 | namespace Tegra { | 11 | namespace Tegra { |
| 12 | |||
| 11 | /** | 13 | /** |
| 12 | * Struct describing framebuffer configuration | 14 | * Struct describing framebuffer configuration |
| 13 | */ | 15 | */ |
| 14 | struct FramebufferConfig { | 16 | struct FramebufferConfig { |
| 15 | enum class PixelFormat : u32 { | ||
| 16 | A8B8G8R8_UNORM = 1, | ||
| 17 | RGB565_UNORM = 4, | ||
| 18 | B8G8R8A8_UNORM = 5, | ||
| 19 | }; | ||
| 20 | |||
| 21 | enum class TransformFlags : u32 { | 17 | enum class TransformFlags : u32 { |
| 22 | /// No transform flags are set | 18 | /// No transform flags are set |
| 23 | Unset = 0x00, | 19 | Unset = 0x00, |
| @@ -38,9 +34,9 @@ struct FramebufferConfig { | |||
| 38 | u32 width{}; | 34 | u32 width{}; |
| 39 | u32 height{}; | 35 | u32 height{}; |
| 40 | u32 stride{}; | 36 | u32 stride{}; |
| 41 | PixelFormat pixel_format{}; | ||
| 42 | 37 | ||
| 43 | TransformFlags transform_flags{}; | 38 | TransformFlags transform_flags{}; |
| 39 | android::PixelFormat pixel_format{}; | ||
| 44 | Common::Rectangle<int> crop_rect; | 40 | Common::Rectangle<int> crop_rect; |
| 45 | }; | 41 | }; |
| 46 | 42 | ||
diff --git a/src/video_core/renderer_opengl/renderer_opengl.cpp b/src/video_core/renderer_opengl/renderer_opengl.cpp index 795c97831..279421962 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.cpp +++ b/src/video_core/renderer_opengl/renderer_opengl.cpp | |||
| @@ -323,12 +323,12 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture, | |||
| 323 | 323 | ||
| 324 | GLint internal_format; | 324 | GLint internal_format; |
| 325 | switch (framebuffer.pixel_format) { | 325 | switch (framebuffer.pixel_format) { |
| 326 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: | 326 | case android::PixelFormat::Rgba8888: |
| 327 | internal_format = GL_RGBA8; | 327 | internal_format = GL_RGBA8; |
| 328 | texture.gl_format = GL_RGBA; | 328 | texture.gl_format = GL_RGBA; |
| 329 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; | 329 | texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; |
| 330 | break; | 330 | break; |
| 331 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: | 331 | case android::PixelFormat::Rgb565: |
| 332 | internal_format = GL_RGB565; | 332 | internal_format = GL_RGB565; |
| 333 | texture.gl_format = GL_RGB; | 333 | texture.gl_format = GL_RGB; |
| 334 | texture.gl_type = GL_UNSIGNED_SHORT_5_6_5; | 334 | texture.gl_type = GL_UNSIGNED_SHORT_5_6_5; |
| @@ -464,8 +464,8 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) { | |||
| 464 | const auto& texcoords = screen_info.display_texcoords; | 464 | const auto& texcoords = screen_info.display_texcoords; |
| 465 | auto left = texcoords.left; | 465 | auto left = texcoords.left; |
| 466 | auto right = texcoords.right; | 466 | auto right = texcoords.right; |
| 467 | if (framebuffer_transform_flags != Tegra::FramebufferConfig::TransformFlags::Unset) { | 467 | if (framebuffer_transform_flags != android::BufferTransformFlags::Unset) { |
| 468 | if (framebuffer_transform_flags == Tegra::FramebufferConfig::TransformFlags::FlipV) { | 468 | if (framebuffer_transform_flags == android::BufferTransformFlags::FlipV) { |
| 469 | // Flip the framebuffer vertically | 469 | // Flip the framebuffer vertically |
| 470 | left = texcoords.right; | 470 | left = texcoords.right; |
| 471 | right = texcoords.left; | 471 | right = texcoords.left; |
diff --git a/src/video_core/renderer_opengl/renderer_opengl.h b/src/video_core/renderer_opengl/renderer_opengl.h index 35706cf05..e6395b900 100644 --- a/src/video_core/renderer_opengl/renderer_opengl.h +++ b/src/video_core/renderer_opengl/renderer_opengl.h | |||
| @@ -46,7 +46,7 @@ struct TextureInfo { | |||
| 46 | GLsizei height; | 46 | GLsizei height; |
| 47 | GLenum gl_format; | 47 | GLenum gl_format; |
| 48 | GLenum gl_type; | 48 | GLenum gl_type; |
| 49 | Tegra::FramebufferConfig::PixelFormat pixel_format; | 49 | android::PixelFormat pixel_format; |
| 50 | }; | 50 | }; |
| 51 | 51 | ||
| 52 | /// Structure used for storing information about the display target for the Switch screen | 52 | /// Structure used for storing information about the display target for the Switch screen |
| @@ -135,7 +135,7 @@ private: | |||
| 135 | std::vector<u8> gl_framebuffer_data; | 135 | std::vector<u8> gl_framebuffer_data; |
| 136 | 136 | ||
| 137 | /// Used for transforming the framebuffer orientation | 137 | /// Used for transforming the framebuffer orientation |
| 138 | Tegra::FramebufferConfig::TransformFlags framebuffer_transform_flags{}; | 138 | android::BufferTransformFlags framebuffer_transform_flags{}; |
| 139 | Common::Rectangle<int> framebuffer_crop_rect; | 139 | Common::Rectangle<int> framebuffer_crop_rect; |
| 140 | }; | 140 | }; |
| 141 | 141 | ||
diff --git a/src/video_core/renderer_vulkan/vk_blit_screen.cpp b/src/video_core/renderer_vulkan/vk_blit_screen.cpp index 0ec85682b..3da16c422 100644 --- a/src/video_core/renderer_vulkan/vk_blit_screen.cpp +++ b/src/video_core/renderer_vulkan/vk_blit_screen.cpp | |||
| @@ -94,11 +94,11 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) { | |||
| 94 | 94 | ||
| 95 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { | 95 | VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { |
| 96 | switch (framebuffer.pixel_format) { | 96 | switch (framebuffer.pixel_format) { |
| 97 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: | 97 | case android::PixelFormat::Rgba8888: |
| 98 | return VK_FORMAT_A8B8G8R8_UNORM_PACK32; | 98 | return VK_FORMAT_A8B8G8R8_UNORM_PACK32; |
| 99 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: | 99 | case android::PixelFormat::Rgb565: |
| 100 | return VK_FORMAT_R5G6B5_UNORM_PACK16; | 100 | return VK_FORMAT_R5G6B5_UNORM_PACK16; |
| 101 | case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: | 101 | case android::PixelFormat::Bgra8888: |
| 102 | return VK_FORMAT_B8G8R8A8_UNORM; | 102 | return VK_FORMAT_B8G8R8A8_UNORM; |
| 103 | default: | 103 | default: |
| 104 | UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", | 104 | UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", |
| @@ -1390,9 +1390,9 @@ void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfi | |||
| 1390 | auto right = texcoords.right; | 1390 | auto right = texcoords.right; |
| 1391 | 1391 | ||
| 1392 | switch (framebuffer_transform_flags) { | 1392 | switch (framebuffer_transform_flags) { |
| 1393 | case Tegra::FramebufferConfig::TransformFlags::Unset: | 1393 | case android::BufferTransformFlags::Unset: |
| 1394 | break; | 1394 | break; |
| 1395 | case Tegra::FramebufferConfig::TransformFlags::FlipV: | 1395 | case android::BufferTransformFlags::FlipV: |
| 1396 | // Flip the framebuffer vertically | 1396 | // Flip the framebuffer vertically |
| 1397 | left = texcoords.right; | 1397 | left = texcoords.right; |
| 1398 | right = texcoords.left; | 1398 | right = texcoords.left; |
diff --git a/src/video_core/surface.cpp b/src/video_core/surface.cpp index a36015c8c..f7d29534e 100644 --- a/src/video_core/surface.cpp +++ b/src/video_core/surface.cpp | |||
| @@ -190,13 +190,13 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format) | |||
| 190 | } | 190 | } |
| 191 | } | 191 | } |
| 192 | 192 | ||
| 193 | PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format) { | 193 | PixelFormat PixelFormatFromGPUPixelFormat(android::PixelFormat format) { |
| 194 | switch (format) { | 194 | switch (format) { |
| 195 | case Tegra::FramebufferConfig::PixelFormat::A8B8G8R8_UNORM: | 195 | case android::PixelFormat::Rgba8888: |
| 196 | return PixelFormat::A8B8G8R8_UNORM; | 196 | return PixelFormat::A8B8G8R8_UNORM; |
| 197 | case Tegra::FramebufferConfig::PixelFormat::RGB565_UNORM: | 197 | case android::PixelFormat::Rgb565: |
| 198 | return PixelFormat::R5G6B5_UNORM; | 198 | return PixelFormat::R5G6B5_UNORM; |
| 199 | case Tegra::FramebufferConfig::PixelFormat::B8G8R8A8_UNORM: | 199 | case android::PixelFormat::Bgra8888: |
| 200 | return PixelFormat::B8G8R8A8_UNORM; | 200 | return PixelFormat::B8G8R8A8_UNORM; |
| 201 | default: | 201 | default: |
| 202 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); | 202 | UNIMPLEMENTED_MSG("Unimplemented format={}", format); |
diff --git a/src/video_core/surface.h b/src/video_core/surface.h index 33e8d24ab..1061b2fa7 100644 --- a/src/video_core/surface.h +++ b/src/video_core/surface.h | |||
| @@ -460,7 +460,7 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format); | |||
| 460 | 460 | ||
| 461 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format); | 461 | PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format); |
| 462 | 462 | ||
| 463 | PixelFormat PixelFormatFromGPUPixelFormat(Tegra::FramebufferConfig::PixelFormat format); | 463 | PixelFormat PixelFormatFromGPUPixelFormat(android::PixelFormat format); |
| 464 | 464 | ||
| 465 | SurfaceType GetFormatType(PixelFormat pixel_format); | 465 | SurfaceType GetFormatType(PixelFormat pixel_format); |
| 466 | 466 | ||