yuzu-emu
/
yuzu
Archived
1
0
Fork 0

hle: nvflinger: Migrate android namespace -> Service::android.

This commit is contained in:
bunnei 2022-03-19 21:51:16 -07:00
parent 5849c9a4cd
commit ca12a77670
35 changed files with 76 additions and 79 deletions

View File

@ -13,7 +13,7 @@ class HLERequestContext;
class KReadableEvent; class KReadableEvent;
} // namespace Kernel } // namespace Kernel
namespace android { namespace Service::android {
enum class TransactionId { enum class TransactionId {
RequestBuffer = 1, RequestBuffer = 1,
@ -39,4 +39,4 @@ public:
virtual Kernel::KReadableEvent& GetNativeHandle() = 0; virtual Kernel::KReadableEvent& GetNativeHandle() = 0;
}; };
} // namespace android } // namespace Service::android

View File

@ -13,7 +13,7 @@
#include "core/hle/service/nvflinger/ui/rect.h" #include "core/hle/service/nvflinger/ui/rect.h"
#include "core/hle/service/nvflinger/window.h" #include "core/hle/service/nvflinger/window.h"
namespace android { namespace Service::android {
class GraphicBuffer; class GraphicBuffer;
@ -43,4 +43,4 @@ public:
s32 swap_interval{}; s32 swap_interval{};
}; };
} // namespace android } // namespace Service::android

View File

@ -10,7 +10,7 @@
#include "core/hle/service/nvflinger/buffer_item_consumer.h" #include "core/hle/service/nvflinger/buffer_item_consumer.h"
#include "core/hle/service/nvflinger/buffer_queue_consumer.h" #include "core/hle/service/nvflinger/buffer_queue_consumer.h"
namespace android { namespace Service::android {
BufferItemConsumer::BufferItemConsumer(std::unique_ptr<BufferQueueConsumer> consumer_) BufferItemConsumer::BufferItemConsumer(std::unique_ptr<BufferQueueConsumer> consumer_)
: ConsumerBase{std::move(consumer_)} {} : ConsumerBase{std::move(consumer_)} {}
@ -56,4 +56,4 @@ Status BufferItemConsumer::ReleaseBuffer(const BufferItem& item, Fence& release_
return Status::NoError; return Status::NoError;
} }
} // namespace android } // namespace Service::android

View File

@ -12,7 +12,7 @@
#include "core/hle/service/nvflinger/consumer_base.h" #include "core/hle/service/nvflinger/consumer_base.h"
#include "core/hle/service/nvflinger/status.h" #include "core/hle/service/nvflinger/status.h"
namespace android { namespace Service::android {
class BufferItem; class BufferItem;
@ -23,4 +23,4 @@ public:
Status ReleaseBuffer(const BufferItem& item, Fence& release_fence); Status ReleaseBuffer(const BufferItem& item, Fence& release_fence);
}; };
} // namespace android } // namespace Service::android

View File

@ -10,7 +10,7 @@
#include "core/hle/service/nvflinger/buffer_queue_core.h" #include "core/hle/service/nvflinger/buffer_queue_core.h"
#include "core/hle/service/nvflinger/producer_listener.h" #include "core/hle/service/nvflinger/producer_listener.h"
namespace android { namespace Service::android {
BufferQueueConsumer::BufferQueueConsumer(std::shared_ptr<BufferQueueCore> core_) BufferQueueConsumer::BufferQueueConsumer(std::shared_ptr<BufferQueueCore> core_)
: core{std::move(core_)}, slots{core->slots} {} : core{std::move(core_)}, slots{core->slots} {}
@ -222,4 +222,4 @@ Status BufferQueueConsumer::Connect(std::shared_ptr<IConsumerListener> consumer_
return Status::NoError; return Status::NoError;
} }
} // namespace android } // namespace Service::android

View File

@ -12,7 +12,7 @@
#include "core/hle/service/nvflinger/buffer_queue_defs.h" #include "core/hle/service/nvflinger/buffer_queue_defs.h"
#include "core/hle/service/nvflinger/status.h" #include "core/hle/service/nvflinger/status.h"
namespace android { namespace Service::android {
class BufferItem; class BufferItem;
class BufferQueueCore; class BufferQueueCore;
@ -33,4 +33,4 @@ private:
BufferQueueDefs::SlotsType& slots; BufferQueueDefs::SlotsType& slots;
}; };
} // namespace android } // namespace Service::android

View File

@ -8,12 +8,9 @@
#include "core/hle/service/nvflinger/buffer_queue_core.h" #include "core/hle/service/nvflinger/buffer_queue_core.h"
namespace android { namespace Service::android {
BufferQueueCore::BufferQueueCore() : lock{mutex} {
// This is locked on creation, so unlock.
lock.unlock();
BufferQueueCore::BufferQueueCore() : lock{mutex, std::defer_lock} {
for (s32 slot = 0; slot < BufferQueueDefs::NUM_BUFFER_SLOTS; ++slot) { for (s32 slot = 0; slot < BufferQueueDefs::NUM_BUFFER_SLOTS; ++slot) {
free_slots.insert(slot); free_slots.insert(slot);
} }
@ -132,4 +129,4 @@ void BufferQueueCore::WaitWhileAllocatingLocked() const {
} }
} }
} // namespace android } // namespace Service::android

View File

@ -19,7 +19,7 @@
#include "core/hle/service/nvflinger/status.h" #include "core/hle/service/nvflinger/status.h"
#include "core/hle/service/nvflinger/window.h" #include "core/hle/service/nvflinger/window.h"
namespace android { namespace Service::android {
class IConsumerListener; class IConsumerListener;
class IProducerListener; class IProducerListener;
@ -95,4 +95,4 @@ private:
bool is_shutting_down{}; bool is_shutting_down{};
}; };
} // namespace android } // namespace Service::android

View File

@ -11,11 +11,11 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/nvflinger/buffer_slot.h" #include "core/hle/service/nvflinger/buffer_slot.h"
namespace android::BufferQueueDefs { namespace Service::android::BufferQueueDefs {
// BufferQueue will keep track of at most this value of buffers. // BufferQueue will keep track of at most this value of buffers.
constexpr s32 NUM_BUFFER_SLOTS = 64; constexpr s32 NUM_BUFFER_SLOTS = 64;
using SlotsType = std::array<BufferSlot, NUM_BUFFER_SLOTS>; using SlotsType = std::array<BufferSlot, NUM_BUFFER_SLOTS>;
} // namespace android::BufferQueueDefs } // namespace Service::android::BufferQueueDefs

View File

@ -23,7 +23,7 @@
#include "core/hle/service/nvflinger/window.h" #include "core/hle/service/nvflinger/window.h"
#include "core/hle/service/vi/vi.h" #include "core/hle/service/vi/vi.h"
namespace android { namespace Service::android {
BufferQueueProducer::BufferQueueProducer(Service::KernelHelpers::ServiceContext& service_context_, BufferQueueProducer::BufferQueueProducer(Service::KernelHelpers::ServiceContext& service_context_,
std::shared_ptr<BufferQueueCore> buffer_queue_core_) std::shared_ptr<BufferQueueCore> buffer_queue_core_)
@ -936,4 +936,4 @@ Kernel::KReadableEvent& BufferQueueProducer::GetNativeHandle() {
return buffer_wait_event->GetReadableEvent(); return buffer_wait_event->GetReadableEvent();
} }
} // namespace android } // namespace Service::android

View File

@ -31,7 +31,7 @@ namespace Service::KernelHelpers {
class ServiceContext; class ServiceContext;
} // namespace Service::KernelHelpers } // namespace Service::KernelHelpers
namespace android { namespace Service::android {
class BufferQueueCore; class BufferQueueCore;
class IProducerListener; class IProducerListener;
@ -80,4 +80,4 @@ private:
std::condition_variable callback_condition; std::condition_variable callback_condition;
}; };
} // namespace android } // namespace Service::android

View File

@ -11,7 +11,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/nvflinger/ui/fence.h" #include "core/hle/service/nvflinger/ui/fence.h"
namespace android { namespace Service::android {
class GraphicBuffer; class GraphicBuffer;
@ -36,4 +36,4 @@ struct BufferSlot final {
bool is_preallocated{}; bool is_preallocated{};
}; };
} // namespace android } // namespace Service::android

View File

@ -5,7 +5,7 @@
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
enum class BufferTransformFlags : u32 { enum class BufferTransformFlags : u32 {
/// No transform flags are set /// No transform flags are set
@ -22,4 +22,4 @@ enum class BufferTransformFlags : u32 {
Rotate270 = 0x07, Rotate270 = 0x07,
}; };
} // namespace android } // namespace Service::android

View File

@ -12,7 +12,7 @@
#include "core/hle/service/nvflinger/consumer_base.h" #include "core/hle/service/nvflinger/consumer_base.h"
#include "core/hle/service/nvflinger/ui/graphic_buffer.h" #include "core/hle/service/nvflinger/ui/graphic_buffer.h"
namespace android { namespace Service::android {
ConsumerBase::ConsumerBase(std::unique_ptr<BufferQueueConsumer> consumer_) ConsumerBase::ConsumerBase(std::unique_ptr<BufferQueueConsumer> consumer_)
: consumer{std::move(consumer_)} {} : consumer{std::move(consumer_)} {}
@ -126,4 +126,4 @@ bool ConsumerBase::StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer>
slots[slot].graphic_buffer->Handle() == graphic_buffer->Handle()); slots[slot].graphic_buffer->Handle() == graphic_buffer->Handle());
} }
} // namespace android } // namespace Service::android

View File

@ -15,7 +15,7 @@
#include "core/hle/service/nvflinger/consumer_listener.h" #include "core/hle/service/nvflinger/consumer_listener.h"
#include "core/hle/service/nvflinger/status.h" #include "core/hle/service/nvflinger/status.h"
namespace android { namespace Service::android {
class BufferItem; class BufferItem;
class BufferQueueConsumer; class BufferQueueConsumer;
@ -56,4 +56,4 @@ protected:
mutable std::mutex mutex; mutable std::mutex mutex;
}; };
} // namespace android } // namespace Service::android

View File

@ -6,7 +6,7 @@
#pragma once #pragma once
namespace android { namespace Service::android {
class BufferItem; class BufferItem;
@ -23,4 +23,4 @@ public:
virtual void OnSidebandStreamChanged() = 0; virtual void OnSidebandStreamChanged() = 0;
}; };
}; // namespace android }; // namespace Service::android

View File

@ -9,7 +9,7 @@
#include "core/hle/service/nvflinger/graphic_buffer_producer.h" #include "core/hle/service/nvflinger/graphic_buffer_producer.h"
#include "core/hle/service/nvflinger/parcel.h" #include "core/hle/service/nvflinger/parcel.h"
namespace android { namespace Service::android {
QueueBufferInput::QueueBufferInput(Parcel& parcel) { QueueBufferInput::QueueBufferInput(Parcel& parcel) {
parcel.ReadFlattened(*this); parcel.ReadFlattened(*this);
@ -17,4 +17,4 @@ QueueBufferInput::QueueBufferInput(Parcel& parcel) {
QueueBufferOutput::QueueBufferOutput() = default; QueueBufferOutput::QueueBufferOutput() = default;
} // namespace android } // namespace Service::android

View File

@ -12,7 +12,7 @@
#include "core/hle/service/nvflinger/ui/rect.h" #include "core/hle/service/nvflinger/ui/rect.h"
#include "core/hle/service/nvflinger/window.h" #include "core/hle/service/nvflinger/window.h"
namespace android { namespace Service::android {
class Parcel; class Parcel;
@ -75,4 +75,4 @@ private:
#pragma pack(pop) #pragma pack(pop)
static_assert(sizeof(QueueBufferOutput) == 16, "QueueBufferOutput has wrong size"); static_assert(sizeof(QueueBufferOutput) == 16, "QueueBufferOutput has wrong size");
} // namespace android } // namespace Service::android

View File

@ -37,10 +37,10 @@ class Display;
class Layer; class Layer;
} // namespace Service::VI } // namespace Service::VI
namespace android { namespace Service::android {
class BufferQueueCore; class BufferQueueCore;
class BufferQueueProducer; class BufferQueueProducer;
} // namespace android } // namespace Service::android
namespace Service::NVFlinger { namespace Service::NVFlinger {

View File

@ -10,7 +10,7 @@
#include "common/assert.h" #include "common/assert.h"
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
class Parcel final { class Parcel final {
public: public:
@ -168,4 +168,4 @@ private:
std::size_t write_index = sizeof(Header); std::size_t write_index = sizeof(Header);
}; };
} // namespace android } // namespace Service::android

View File

@ -5,7 +5,7 @@
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
enum class PixelFormat : u32 { enum class PixelFormat : u32 {
NoFormat = 0, NoFormat = 0,
@ -18,4 +18,4 @@ enum class PixelFormat : u32 {
Rgba4444 = 7, Rgba4444 = 7,
}; };
} // namespace android } // namespace Service::android

View File

@ -6,11 +6,11 @@
#pragma once #pragma once
namespace android { namespace Service::android {
class IProducerListener { class IProducerListener {
public: public:
virtual void OnBufferReleased() = 0; virtual void OnBufferReleased() = 0;
}; };
} // namespace android } // namespace Service::android

View File

@ -6,7 +6,7 @@
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
enum class Status : s32 { enum class Status : s32 {
None = 0, None = 0,
@ -25,4 +25,4 @@ enum class Status : s32 {
}; };
DECLARE_ENUM_FLAG_OPERATORS(Status); DECLARE_ENUM_FLAG_OPERATORS(Status);
} // namespace android } // namespace Service::android

View File

@ -11,7 +11,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/nvdrv/nvdata.h" #include "core/hle/service/nvdrv/nvdata.h"
namespace android { namespace Service::android {
class Fence { class Fence {
public: public:
@ -29,4 +29,4 @@ public:
}; };
static_assert(sizeof(Fence) == 36, "Fence has wrong size"); static_assert(sizeof(Fence) == 36, "Fence has wrong size");
} // namespace android } // namespace Service::android

View File

@ -10,7 +10,7 @@
#include "common/common_types.h" #include "common/common_types.h"
#include "core/hle/service/nvflinger/pixel_format.h" #include "core/hle/service/nvflinger/pixel_format.h"
namespace android { namespace Service::android {
class GraphicBuffer final { class GraphicBuffer final {
public: public:
@ -97,4 +97,4 @@ private:
}; };
static_assert(sizeof(GraphicBuffer) == 0x16C, "GraphicBuffer has wrong size"); static_assert(sizeof(GraphicBuffer) == 0x16C, "GraphicBuffer has wrong size");
} // namespace android } // namespace Service::android

View File

@ -11,7 +11,7 @@
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
class Rect final { class Rect final {
public: public:
@ -72,4 +72,4 @@ private:
}; };
static_assert(sizeof(Rect) == 16, "Rect has wrong size"); static_assert(sizeof(Rect) == 16, "Rect has wrong size");
} // namespace android } // namespace Service::android

View File

@ -6,7 +6,7 @@
#include "common/common_funcs.h" #include "common/common_funcs.h"
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
/// Attributes queryable with Query /// Attributes queryable with Query
enum class NativeWindow : s32 { enum class NativeWindow : s32 {
@ -50,4 +50,4 @@ enum class NativeWindowTransform : u32 {
}; };
DECLARE_ENUM_FLAG_OPERATORS(NativeWindowTransform); DECLARE_ENUM_FLAG_OPERATORS(NativeWindowTransform);
} // namespace android } // namespace Service::android

View File

@ -15,7 +15,7 @@ namespace Kernel {
class KEvent; class KEvent;
} }
namespace android { namespace Service::android {
class BufferQueueProducer; class BufferQueueProducer;
} }

View File

@ -8,11 +8,11 @@
#include "common/common_types.h" #include "common/common_types.h"
namespace android { namespace Service::android {
class BufferItemConsumer; class BufferItemConsumer;
class BufferQueueCore; class BufferQueueCore;
class BufferQueueProducer; class BufferQueueProducer;
} // namespace android } // namespace Service::android
namespace Service::VI { namespace Service::VI {

View File

@ -20,8 +20,8 @@ struct FramebufferConfig {
u32 width{}; u32 width{};
u32 height{}; u32 height{};
u32 stride{}; u32 stride{};
android::PixelFormat pixel_format{}; Service::android::PixelFormat pixel_format{};
android::BufferTransformFlags transform_flags{}; Service::android::BufferTransformFlags transform_flags{};
Common::Rectangle<int> crop_rect; Common::Rectangle<int> crop_rect;
}; };

View File

@ -323,12 +323,12 @@ void RendererOpenGL::ConfigureFramebufferTexture(TextureInfo& texture,
GLint internal_format; GLint internal_format;
switch (framebuffer.pixel_format) { switch (framebuffer.pixel_format) {
case android::PixelFormat::Rgba8888: case Service::android::PixelFormat::Rgba8888:
internal_format = GL_RGBA8; internal_format = GL_RGBA8;
texture.gl_format = GL_RGBA; texture.gl_format = GL_RGBA;
texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV; texture.gl_type = GL_UNSIGNED_INT_8_8_8_8_REV;
break; break;
case android::PixelFormat::Rgb565: case Service::android::PixelFormat::Rgb565:
internal_format = GL_RGB565; internal_format = GL_RGB565;
texture.gl_format = GL_RGB; texture.gl_format = GL_RGB;
texture.gl_type = GL_UNSIGNED_SHORT_5_6_5; texture.gl_type = GL_UNSIGNED_SHORT_5_6_5;
@ -464,8 +464,8 @@ void RendererOpenGL::DrawScreen(const Layout::FramebufferLayout& layout) {
const auto& texcoords = screen_info.display_texcoords; const auto& texcoords = screen_info.display_texcoords;
auto left = texcoords.left; auto left = texcoords.left;
auto right = texcoords.right; auto right = texcoords.right;
if (framebuffer_transform_flags != android::BufferTransformFlags::Unset) { if (framebuffer_transform_flags != Service::android::BufferTransformFlags::Unset) {
if (framebuffer_transform_flags == android::BufferTransformFlags::FlipV) { if (framebuffer_transform_flags == Service::android::BufferTransformFlags::FlipV) {
// Flip the framebuffer vertically // Flip the framebuffer vertically
left = texcoords.right; left = texcoords.right;
right = texcoords.left; right = texcoords.left;

View File

@ -46,7 +46,7 @@ struct TextureInfo {
GLsizei height; GLsizei height;
GLenum gl_format; GLenum gl_format;
GLenum gl_type; GLenum gl_type;
android::PixelFormat pixel_format; Service::android::PixelFormat pixel_format;
}; };
/// Structure used for storing information about the display target for the Switch screen /// Structure used for storing information about the display target for the Switch screen
@ -135,7 +135,7 @@ private:
std::vector<u8> gl_framebuffer_data; std::vector<u8> gl_framebuffer_data;
/// Used for transforming the framebuffer orientation /// Used for transforming the framebuffer orientation
android::BufferTransformFlags framebuffer_transform_flags{}; Service::android::BufferTransformFlags framebuffer_transform_flags{};
Common::Rectangle<int> framebuffer_crop_rect; Common::Rectangle<int> framebuffer_crop_rect;
}; };

View File

@ -94,11 +94,11 @@ std::size_t GetSizeInBytes(const Tegra::FramebufferConfig& framebuffer) {
VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) { VkFormat GetFormat(const Tegra::FramebufferConfig& framebuffer) {
switch (framebuffer.pixel_format) { switch (framebuffer.pixel_format) {
case android::PixelFormat::Rgba8888: case Service::android::PixelFormat::Rgba8888:
return VK_FORMAT_A8B8G8R8_UNORM_PACK32; return VK_FORMAT_A8B8G8R8_UNORM_PACK32;
case android::PixelFormat::Rgb565: case Service::android::PixelFormat::Rgb565:
return VK_FORMAT_R5G6B5_UNORM_PACK16; return VK_FORMAT_R5G6B5_UNORM_PACK16;
case android::PixelFormat::Bgra8888: case Service::android::PixelFormat::Bgra8888:
return VK_FORMAT_B8G8R8A8_UNORM; return VK_FORMAT_B8G8R8A8_UNORM;
default: default:
UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}", UNIMPLEMENTED_MSG("Unknown framebuffer pixel format: {}",
@ -1390,9 +1390,9 @@ void VKBlitScreen::SetVertexData(BufferData& data, const Tegra::FramebufferConfi
auto right = texcoords.right; auto right = texcoords.right;
switch (framebuffer_transform_flags) { switch (framebuffer_transform_flags) {
case android::BufferTransformFlags::Unset: case Service::android::BufferTransformFlags::Unset:
break; break;
case android::BufferTransformFlags::FlipV: case Service::android::BufferTransformFlags::FlipV:
// Flip the framebuffer vertically // Flip the framebuffer vertically
left = texcoords.right; left = texcoords.right;
right = texcoords.left; right = texcoords.left;

View File

@ -190,13 +190,13 @@ PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format)
} }
} }
PixelFormat PixelFormatFromGPUPixelFormat(android::PixelFormat format) { PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format) {
switch (format) { switch (format) {
case android::PixelFormat::Rgba8888: case Service::android::PixelFormat::Rgba8888:
return PixelFormat::A8B8G8R8_UNORM; return PixelFormat::A8B8G8R8_UNORM;
case android::PixelFormat::Rgb565: case Service::android::PixelFormat::Rgb565:
return PixelFormat::R5G6B5_UNORM; return PixelFormat::R5G6B5_UNORM;
case android::PixelFormat::Bgra8888: case Service::android::PixelFormat::Bgra8888:
return PixelFormat::B8G8R8A8_UNORM; return PixelFormat::B8G8R8A8_UNORM;
default: default:
UNIMPLEMENTED_MSG("Unimplemented format={}", format); UNIMPLEMENTED_MSG("Unimplemented format={}", format);

View File

@ -460,7 +460,7 @@ PixelFormat PixelFormatFromDepthFormat(Tegra::DepthFormat format);
PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format); PixelFormat PixelFormatFromRenderTargetFormat(Tegra::RenderTargetFormat format);
PixelFormat PixelFormatFromGPUPixelFormat(android::PixelFormat format); PixelFormat PixelFormatFromGPUPixelFormat(Service::android::PixelFormat format);
SurfaceType GetFormatType(PixelFormat pixel_format); SurfaceType GetFormatType(PixelFormat pixel_format);