summaryrefslogtreecommitdiff
path: root/src/core
diff options
context:
space:
mode:
Diffstat (limited to 'src/core')
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp6
-rw-r--r--src/core/hle/service/nvdrv/devices/nvdisp_disp0.h4
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.cpp4
-rw-r--r--src/core/hle/service/nvflinger/buffer_queue.h5
-rw-r--r--src/core/hle/service/nvflinger/nvflinger.cpp3
-rw-r--r--src/core/hle/service/vi/vi.cpp20
6 files changed, 29 insertions, 13 deletions
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
index c39d5a164..ed69a4325 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.cpp
@@ -18,7 +18,8 @@ u32 nvdisp_disp0::ioctl(Ioctl command, const std::vector<u8>& input, std::vector
18} 18}
19 19
20void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, 20void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height,
21 u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform) { 21 u32 stride, NVFlinger::BufferQueue::BufferTransformFlags transform,
22 const MathUtil::Rectangle<int>& crop_rect) {
22 VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle); 23 VAddr addr = nvmap_dev->GetObjectAddress(buffer_handle);
23 LOG_WARNING(Service, 24 LOG_WARNING(Service,
24 "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}", 25 "Drawing from address {:X} offset {:08X} Width {} Height {} Stride {} Format {}",
@@ -26,7 +27,8 @@ void nvdisp_disp0::flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u3
26 27
27 using PixelFormat = Tegra::FramebufferConfig::PixelFormat; 28 using PixelFormat = Tegra::FramebufferConfig::PixelFormat;
28 const Tegra::FramebufferConfig framebuffer{ 29 const Tegra::FramebufferConfig framebuffer{
29 addr, offset, width, height, stride, static_cast<PixelFormat>(format), transform}; 30 addr, offset, width, height, stride, static_cast<PixelFormat>(format),
31 transform, crop_rect};
30 32
31 Core::System::GetInstance().perf_stats.EndGameFrame(); 33 Core::System::GetInstance().perf_stats.EndGameFrame();
32 34
diff --git a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
index 3d3979723..d4631a32b 100644
--- a/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
+++ b/src/core/hle/service/nvdrv/devices/nvdisp_disp0.h
@@ -7,6 +7,7 @@
7#include <memory> 7#include <memory>
8#include <vector> 8#include <vector>
9#include "common/common_types.h" 9#include "common/common_types.h"
10#include "common/math_util.h"
10#include "core/hle/service/nvdrv/devices/nvdevice.h" 11#include "core/hle/service/nvdrv/devices/nvdevice.h"
11#include "core/hle/service/nvflinger/buffer_queue.h" 12#include "core/hle/service/nvflinger/buffer_queue.h"
12 13
@@ -23,7 +24,8 @@ public:
23 24
24 /// Performs a screen flip, drawing the buffer pointed to by the handle. 25 /// Performs a screen flip, drawing the buffer pointed to by the handle.
25 void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride, 26 void flip(u32 buffer_handle, u32 offset, u32 format, u32 width, u32 height, u32 stride,
26 NVFlinger::BufferQueue::BufferTransformFlags transform); 27 NVFlinger::BufferQueue::BufferTransformFlags transform,
28 const MathUtil::Rectangle<int>& crop_rect);
27 29
28private: 30private:
29 std::shared_ptr<nvmap> nvmap_dev; 31 std::shared_ptr<nvmap> nvmap_dev;
diff --git a/src/core/hle/service/nvflinger/buffer_queue.cpp b/src/core/hle/service/nvflinger/buffer_queue.cpp
index a181cd2dc..7132b18ad 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.cpp
+++ b/src/core/hle/service/nvflinger/buffer_queue.cpp
@@ -57,13 +57,15 @@ const IGBPBuffer& BufferQueue::RequestBuffer(u32 slot) const {
57 return itr->igbp_buffer; 57 return itr->igbp_buffer;
58} 58}
59 59
60void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform) { 60void BufferQueue::QueueBuffer(u32 slot, BufferTransformFlags transform,
61 const MathUtil::Rectangle<int>& crop_rect) {
61 auto itr = std::find_if(queue.begin(), queue.end(), 62 auto itr = std::find_if(queue.begin(), queue.end(),
62 [&](const Buffer& buffer) { return buffer.slot == slot; }); 63 [&](const Buffer& buffer) { return buffer.slot == slot; });
63 ASSERT(itr != queue.end()); 64 ASSERT(itr != queue.end());
64 ASSERT(itr->status == Buffer::Status::Dequeued); 65 ASSERT(itr->status == Buffer::Status::Dequeued);
65 itr->status = Buffer::Status::Queued; 66 itr->status = Buffer::Status::Queued;
66 itr->transform = transform; 67 itr->transform = transform;
68 itr->crop_rect = crop_rect;
67} 69}
68 70
69boost::optional<const BufferQueue::Buffer&> BufferQueue::AcquireBuffer() { 71boost::optional<const BufferQueue::Buffer&> BufferQueue::AcquireBuffer() {
diff --git a/src/core/hle/service/nvflinger/buffer_queue.h b/src/core/hle/service/nvflinger/buffer_queue.h
index 1e55b487e..004170538 100644
--- a/src/core/hle/service/nvflinger/buffer_queue.h
+++ b/src/core/hle/service/nvflinger/buffer_queue.h
@@ -6,6 +6,7 @@
6 6
7#include <vector> 7#include <vector>
8#include <boost/optional.hpp> 8#include <boost/optional.hpp>
9#include "common/math_util.h"
9#include "common/swap.h" 10#include "common/swap.h"
10#include "core/hle/kernel/event.h" 11#include "core/hle/kernel/event.h"
11 12
@@ -68,12 +69,14 @@ public:
68 Status status = Status::Free; 69 Status status = Status::Free;
69 IGBPBuffer igbp_buffer; 70 IGBPBuffer igbp_buffer;
70 BufferTransformFlags transform; 71 BufferTransformFlags transform;
72 MathUtil::Rectangle<int> crop_rect;
71 }; 73 };
72 74
73 void SetPreallocatedBuffer(u32 slot, IGBPBuffer& buffer); 75 void SetPreallocatedBuffer(u32 slot, IGBPBuffer& buffer);
74 boost::optional<u32> DequeueBuffer(u32 width, u32 height); 76 boost::optional<u32> DequeueBuffer(u32 width, u32 height);
75 const IGBPBuffer& RequestBuffer(u32 slot) const; 77 const IGBPBuffer& RequestBuffer(u32 slot) const;
76 void QueueBuffer(u32 slot, BufferTransformFlags transform); 78 void QueueBuffer(u32 slot, BufferTransformFlags transform,
79 const MathUtil::Rectangle<int>& crop_rect);
77 boost::optional<const Buffer&> AcquireBuffer(); 80 boost::optional<const Buffer&> AcquireBuffer();
78 void ReleaseBuffer(u32 slot); 81 void ReleaseBuffer(u32 slot);
79 u32 Query(QueryType type); 82 u32 Query(QueryType type);
diff --git a/src/core/hle/service/nvflinger/nvflinger.cpp b/src/core/hle/service/nvflinger/nvflinger.cpp
index 826646b7d..d580f779e 100644
--- a/src/core/hle/service/nvflinger/nvflinger.cpp
+++ b/src/core/hle/service/nvflinger/nvflinger.cpp
@@ -149,7 +149,8 @@ void NVFlinger::Compose() {
149 ASSERT(nvdisp); 149 ASSERT(nvdisp);
150 150
151 nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.format, 151 nvdisp->flip(igbp_buffer.gpu_buffer_id, igbp_buffer.offset, igbp_buffer.format,
152 igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride, buffer->transform); 152 igbp_buffer.width, igbp_buffer.height, igbp_buffer.stride, buffer->transform,
153 buffer->crop_rect);
153 154
154 buffer_queue->ReleaseBuffer(buffer->slot); 155 buffer_queue->ReleaseBuffer(buffer->slot);
155 } 156 }
diff --git a/src/core/hle/service/vi/vi.cpp b/src/core/hle/service/vi/vi.cpp
index e094510bf..eccee6e33 100644
--- a/src/core/hle/service/vi/vi.cpp
+++ b/src/core/hle/service/vi/vi.cpp
@@ -7,6 +7,7 @@
7#include <memory> 7#include <memory>
8#include <boost/optional.hpp> 8#include <boost/optional.hpp>
9#include "common/alignment.h" 9#include "common/alignment.h"
10#include "common/math_util.h"
10#include "common/scope_exit.h" 11#include "common/scope_exit.h"
11#include "core/core_timing.h" 12#include "core/core_timing.h"
12#include "core/hle/ipc_helpers.h" 13#include "core/hle/ipc_helpers.h"
@@ -27,8 +28,8 @@ struct DisplayInfo {
27 char display_name[0x40]{"Default"}; 28 char display_name[0x40]{"Default"};
28 u64 unknown_1{1}; 29 u64 unknown_1{1};
29 u64 unknown_2{1}; 30 u64 unknown_2{1};
30 u64 width{1920}; 31 u64 width{1280};
31 u64 height{1080}; 32 u64 height{720};
32}; 33};
33static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size"); 34static_assert(sizeof(DisplayInfo) == 0x60, "DisplayInfo has wrong size");
34 35
@@ -327,8 +328,8 @@ public:
327 328
328protected: 329protected:
329 void SerializeData() override { 330 void SerializeData() override {
330 // TODO(Subv): Figure out what this value means, writing non-zero here will make libnx try 331 // TODO(Subv): Figure out what this value means, writing non-zero here will make libnx
331 // to read an IGBPBuffer object from the parcel. 332 // try to read an IGBPBuffer object from the parcel.
332 Write<u32_le>(1); 333 Write<u32_le>(1);
333 WriteObject(buffer); 334 WriteObject(buffer);
334 Write<u32_le>(0); 335 Write<u32_le>(0);
@@ -360,8 +361,8 @@ public:
360 INSERT_PADDING_WORDS(3); 361 INSERT_PADDING_WORDS(3);
361 u32_le timestamp; 362 u32_le timestamp;
362 s32_le is_auto_timestamp; 363 s32_le is_auto_timestamp;
363 s32_le crop_left;
364 s32_le crop_top; 364 s32_le crop_top;
365 s32_le crop_left;
365 s32_le crop_right; 366 s32_le crop_right;
366 s32_le crop_bottom; 367 s32_le crop_bottom;
367 s32_le scaling_mode; 368 s32_le scaling_mode;
@@ -370,6 +371,10 @@ public:
370 INSERT_PADDING_WORDS(2); 371 INSERT_PADDING_WORDS(2);
371 u32_le fence_is_valid; 372 u32_le fence_is_valid;
372 std::array<Fence, 2> fences; 373 std::array<Fence, 2> fences;
374
375 MathUtil::Rectangle<int> GetCropRect() const {
376 return {crop_left, crop_top, crop_right, crop_bottom};
377 }
373 }; 378 };
374 static_assert(sizeof(Data) == 80, "ParcelData has wrong size"); 379 static_assert(sizeof(Data) == 80, "ParcelData has wrong size");
375 380
@@ -519,7 +524,8 @@ private:
519 } else if (transaction == TransactionId::QueueBuffer) { 524 } else if (transaction == TransactionId::QueueBuffer) {
520 IGBPQueueBufferRequestParcel request{ctx.ReadBuffer()}; 525 IGBPQueueBufferRequestParcel request{ctx.ReadBuffer()};
521 526
522 buffer_queue->QueueBuffer(request.data.slot, request.data.transform); 527 buffer_queue->QueueBuffer(request.data.slot, request.data.transform,
528 request.data.GetCropRect());
523 529
524 IGBPQueueBufferResponseParcel response{1280, 720}; 530 IGBPQueueBufferResponseParcel response{1280, 720};
525 ctx.WriteBuffer(response.Serialize()); 531 ctx.WriteBuffer(response.Serialize());
@@ -532,7 +538,7 @@ private:
532 IGBPQueryResponseParcel response{value}; 538 IGBPQueryResponseParcel response{value};
533 ctx.WriteBuffer(response.Serialize()); 539 ctx.WriteBuffer(response.Serialize());
534 } else if (transaction == TransactionId::CancelBuffer) { 540 } else if (transaction == TransactionId::CancelBuffer) {
535 LOG_WARNING(Service_VI, "(STUBBED) called, transaction=CancelBuffer"); 541 LOG_CRITICAL(Service_VI, "(STUBBED) called, transaction=CancelBuffer");
536 } else { 542 } else {
537 ASSERT_MSG(false, "Unimplemented"); 543 ASSERT_MSG(false, "Unimplemented");
538 } 544 }