2015-05-22 04:27:48 +02:00
|
|
|
// Copyright 2015 Citra Emulator Project
|
2015-01-02 19:03:40 +01:00
|
|
|
// Licensed under GPLv2 or any later version
|
|
|
|
// Refer to the license.txt file included.
|
|
|
|
|
2015-05-22 04:27:48 +02:00
|
|
|
#include <cstring>
|
2016-04-20 12:38:01 +02:00
|
|
|
#include "common/common_funcs.h"
|
2015-05-06 09:06:12 +02:00
|
|
|
#include "common/logging/log.h"
|
2017-06-06 10:29:46 +02:00
|
|
|
#include "core/hle/ipc_helpers.h"
|
2015-01-02 19:03:40 +01:00
|
|
|
#include "core/hle/kernel/event.h"
|
2018-01-11 23:45:03 +01:00
|
|
|
#include "core/hle/kernel/process.h"
|
2016-09-21 08:52:38 +02:00
|
|
|
#include "core/hle/service/y2r_u.h"
|
2015-06-08 03:24:03 +02:00
|
|
|
#include "core/hw/y2r.h"
|
2015-05-22 23:49:42 +02:00
|
|
|
|
2016-12-10 13:51:50 +01:00
|
|
|
namespace Service {
|
|
|
|
namespace Y2R {
|
2015-01-02 19:03:40 +01:00
|
|
|
|
2015-06-08 03:24:03 +02:00
|
|
|
static const CoefficientSet standard_coefficients[4] = {
|
2016-09-18 02:38:01 +02:00
|
|
|
{{0x100, 0x166, 0xB6, 0x58, 0x1C5, -0x166F, 0x10EE, -0x1C5B}}, // ITU_Rec601
|
|
|
|
{{0x100, 0x193, 0x77, 0x2F, 0x1DB, -0x1933, 0xA7C, -0x1D51}}, // ITU_Rec709
|
|
|
|
{{0x12A, 0x198, 0xD0, 0x64, 0x204, -0x1BDE, 0x10F2, -0x229B}}, // ITU_Rec601_Scaling
|
|
|
|
{{0x12A, 0x1CA, 0x88, 0x36, 0x21C, -0x1F04, 0x99C, -0x2421}}, // ITU_Rec709_Scaling
|
2015-05-22 04:27:48 +02:00
|
|
|
};
|
|
|
|
|
2015-06-08 03:24:03 +02:00
|
|
|
ResultCode ConversionConfiguration::SetInputLineWidth(u16 width) {
|
|
|
|
if (width == 0 || width > 1024 || width % 8 != 0) {
|
|
|
|
return ResultCode(ErrorDescription::OutOfRange, ErrorModule::CAM,
|
2016-09-18 02:38:01 +02:00
|
|
|
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053FD
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Note: The hardware uses the register value 0 to represent a width of 1024, so for a width of
|
|
|
|
// 1024 the `camera` module would set the value 0 here, but we don't need to emulate this
|
|
|
|
// internal detail.
|
|
|
|
this->input_line_width = width;
|
|
|
|
return RESULT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
|
|
|
ResultCode ConversionConfiguration::SetInputLines(u16 lines) {
|
|
|
|
if (lines == 0 || lines > 1024) {
|
|
|
|
return ResultCode(ErrorDescription::OutOfRange, ErrorModule::CAM,
|
2016-09-18 02:38:01 +02:00
|
|
|
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053FD
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
// Note: In what appears to be a bug, the `camera` module does not set the hardware register at
|
|
|
|
// all if `lines` is 1024, so the conversion uses the last value that was set. The intention
|
|
|
|
// was probably to set it to 0 like in SetInputLineWidth.
|
|
|
|
if (lines != 1024) {
|
|
|
|
this->input_lines = lines;
|
|
|
|
}
|
|
|
|
return RESULT_SUCCESS;
|
|
|
|
}
|
|
|
|
|
2016-09-19 03:01:46 +02:00
|
|
|
ResultCode ConversionConfiguration::SetStandardCoefficient(
|
|
|
|
StandardCoefficient standard_coefficient) {
|
2015-06-08 03:24:03 +02:00
|
|
|
size_t index = static_cast<size_t>(standard_coefficient);
|
2016-04-20 12:38:01 +02:00
|
|
|
if (index >= ARRAY_SIZE(standard_coefficients)) {
|
2015-06-08 03:24:03 +02:00
|
|
|
return ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
|
2016-09-18 02:38:01 +02:00
|
|
|
ErrorSummary::InvalidArgument, ErrorLevel::Usage); // 0xE0E053ED
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
std::memcpy(coefficients.data(), standard_coefficients[index].data(), sizeof(coefficients));
|
|
|
|
return RESULT_SUCCESS;
|
|
|
|
}
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetInputFormat(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1, 1, 0);
|
2015-01-11 07:46:44 +01:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.input_format = rp.PopEnum<InputFormat>();
|
2015-01-11 07:46:44 +01:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called input_format={}", static_cast<u8>(conversion.input_format));
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetInputFormat(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x2, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushEnum(conversion.input_format);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called input_format={}", static_cast<u8>(conversion.input_format));
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetOutputFormat(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x3, 1, 0);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.output_format = rp.PopEnum<OutputFormat>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called output_format={}", static_cast<u8>(conversion.output_format));
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetOutputFormat(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x4, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushEnum(conversion.output_format);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called output_format={}", static_cast<u8>(conversion.output_format));
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetRotation(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x5, 1, 0);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.rotation = rp.PopEnum<Rotation>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called rotation={}", static_cast<u8>(conversion.rotation));
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetRotation(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x6, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushEnum(conversion.rotation);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called rotation={}", static_cast<u8>(conversion.rotation));
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetBlockAlignment(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x7, 1, 0);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.block_alignment = rp.PopEnum<BlockAlignment>();
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called block_alignment={}",
|
2018-06-29 15:56:12 +02:00
|
|
|
static_cast<u8>(conversion.block_alignment));
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetBlockAlignment(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x8, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushEnum(conversion.block_alignment);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called block_alignment={}",
|
2018-06-29 15:56:12 +02:00
|
|
|
static_cast<u8>(conversion.block_alignment));
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetSpacialDithering(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x9, 1, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
spacial_dithering_enabled = rp.Pop<bool>();
|
2017-12-10 04:25:42 +01:00
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetSpacialDithering(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0xA, 0, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
2016-12-30 15:54:40 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-11 23:45:03 +01:00
|
|
|
rb.Push(spacial_dithering_enabled);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetTemporalDithering(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0xB, 1, 0);
|
|
|
|
temporal_dithering_enabled = rp.Pop<bool>();
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetTemporalDithering(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0xC, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(temporal_dithering_enabled);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetTransferEndInterrupt(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0xD, 1, 0);
|
|
|
|
transfer_end_interrupt_enabled = rp.Pop<bool>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetTransferEndInterrupt(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0xE, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(transfer_end_interrupt_enabled);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2015-01-11 07:46:44 +01:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetTransferEndEvent(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0xF, 0, 0);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 2);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2018-01-11 23:45:03 +01:00
|
|
|
rb.PushCopyObjects(completion_event);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetSendingY(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x10, 4, 2);
|
2016-12-26 13:58:50 +01:00
|
|
|
conversion.src_Y.address = rp.Pop<u32>();
|
|
|
|
conversion.src_Y.image_size = rp.Pop<u32>();
|
|
|
|
conversion.src_Y.transfer_unit = rp.Pop<u32>();
|
|
|
|
conversion.src_Y.gap = rp.Pop<u32>();
|
2018-01-11 23:45:03 +01:00
|
|
|
auto process = rp.PopObject<Kernel::Process>();
|
|
|
|
// TODO (wwylele): pass process handle to y2r engine or convert VAddr to PAddr
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2016-12-26 13:58:50 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R,
|
2018-06-29 15:56:12 +02:00
|
|
|
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
|
|
|
"src_process_id={}",
|
|
|
|
conversion.src_Y.image_size, conversion.src_Y.transfer_unit, conversion.src_Y.gap,
|
|
|
|
process->process_id);
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetSendingU(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x11, 4, 2);
|
2016-12-26 13:58:50 +01:00
|
|
|
conversion.src_U.address = rp.Pop<u32>();
|
|
|
|
conversion.src_U.image_size = rp.Pop<u32>();
|
|
|
|
conversion.src_U.transfer_unit = rp.Pop<u32>();
|
|
|
|
conversion.src_U.gap = rp.Pop<u32>();
|
2018-01-11 23:45:03 +01:00
|
|
|
auto process = rp.PopObject<Kernel::Process>();
|
|
|
|
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2016-12-26 13:58:50 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R,
|
2018-06-29 15:56:12 +02:00
|
|
|
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
|
|
|
"src_process_id={}",
|
|
|
|
conversion.src_U.image_size, conversion.src_U.transfer_unit, conversion.src_U.gap,
|
|
|
|
process->process_id);
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetSendingV(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x12, 4, 2);
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.src_V.address = rp.Pop<u32>();
|
|
|
|
conversion.src_V.image_size = rp.Pop<u32>();
|
|
|
|
conversion.src_V.transfer_unit = rp.Pop<u32>();
|
|
|
|
conversion.src_V.gap = rp.Pop<u32>();
|
2018-01-11 23:45:03 +01:00
|
|
|
auto process = rp.PopObject<Kernel::Process>();
|
|
|
|
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R,
|
2018-06-29 15:56:12 +02:00
|
|
|
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
|
|
|
"src_process_id={}",
|
|
|
|
conversion.src_V.image_size, conversion.src_V.transfer_unit, conversion.src_V.gap,
|
|
|
|
process->process_id);
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetSendingYUYV(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x13, 4, 2);
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.src_YUYV.address = rp.Pop<u32>();
|
|
|
|
conversion.src_YUYV.image_size = rp.Pop<u32>();
|
|
|
|
conversion.src_YUYV.transfer_unit = rp.Pop<u32>();
|
|
|
|
conversion.src_YUYV.gap = rp.Pop<u32>();
|
2018-01-11 23:45:03 +01:00
|
|
|
auto process = rp.PopObject<Kernel::Process>();
|
|
|
|
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R,
|
2018-06-29 15:56:12 +02:00
|
|
|
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
|
|
|
"src_process_id={}",
|
|
|
|
conversion.src_YUYV.image_size, conversion.src_YUYV.transfer_unit,
|
|
|
|
conversion.src_YUYV.gap, process->process_id);
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::IsFinishedSendingYuv(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x14, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(1);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::IsFinishedSendingY(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x15, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(1);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::IsFinishedSendingU(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x16, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(1);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::IsFinishedSendingV(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x17, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(1);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetReceiving(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x18, 4, 2);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.dst.address = rp.Pop<u32>();
|
|
|
|
conversion.dst.image_size = rp.Pop<u32>();
|
|
|
|
conversion.dst.transfer_unit = rp.Pop<u32>();
|
|
|
|
conversion.dst.gap = rp.Pop<u32>();
|
2018-01-11 23:45:03 +01:00
|
|
|
auto dst_process = rp.PopObject<Kernel::Process>();
|
|
|
|
// TODO (wwylele): pass the process handle to y2r engine or convert VAddr to PAddr
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R,
|
2018-06-29 15:56:12 +02:00
|
|
|
"called image_size=0x{:08X}, transfer_unit={}, transfer_stride={}, "
|
|
|
|
"dst_process_id={}",
|
|
|
|
conversion.dst.image_size, conversion.dst.transfer_unit, conversion.dst.gap,
|
|
|
|
static_cast<u32>(dst_process->process_id));
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::IsFinishedReceiving(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x19, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(1);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetInputLineWidth(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1A, 1, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
u32 input_line_width = rp.Pop<u32>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(conversion.SetInputLineWidth(input_line_width));
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called input_line_width={}", input_line_width);
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetInputLineWidth(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1B, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(conversion.input_line_width);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called input_line_width={}", conversion.input_line_width);
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetInputLines(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1C, 1, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
u32 input_lines = rp.Pop<u32>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(conversion.SetInputLines(input_lines));
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called input_lines={}", input_lines);
|
2015-02-24 14:28:36 +01:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetInputLines(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1D, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(static_cast<u32>(conversion.input_lines));
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called input_lines={}", conversion.input_lines);
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetCoefficient(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1E, 4, 0);
|
2015-05-20 03:11:32 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
rp.PopRaw<CoefficientSet>(conversion.coefficients);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called coefficients=[{:X}, {:X}, {:X}, {:X}, {:X}, {:X}, {:X}, {:X}]",
|
2018-06-29 15:56:12 +02:00
|
|
|
conversion.coefficients[0], conversion.coefficients[1], conversion.coefficients[2],
|
|
|
|
conversion.coefficients[3], conversion.coefficients[4], conversion.coefficients[5],
|
|
|
|
conversion.coefficients[6], conversion.coefficients[7]);
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetCoefficient(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x1F, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushRaw(conversion.coefficients);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x20, 1, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
u32 index = rp.Pop<u32>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(conversion.SetStandardCoefficient(static_cast<StandardCoefficient>(index)));
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called standard_coefficient={}", index);
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetStandardCoefficient(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x21, 1, 0);
|
|
|
|
u32 index = rp.Pop<u32>();
|
2016-04-20 12:38:01 +02:00
|
|
|
|
|
|
|
if (index < ARRAY_SIZE(standard_coefficients)) {
|
2018-01-11 23:45:03 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(5, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushRaw(standard_coefficients[index]);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called standard_coefficient={} ", index);
|
2016-04-27 01:49:19 +02:00
|
|
|
} else {
|
2018-01-11 23:45:03 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(ResultCode(ErrorDescription::InvalidEnumValue, ErrorModule::CAM,
|
|
|
|
ErrorSummary::InvalidArgument, ErrorLevel::Usage));
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_ERROR(Service_Y2R, "called standard_coefficient={} The argument is invalid!", index);
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetAlpha(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x22, 1, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.alpha = rp.Pop<u32>();
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha);
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetAlpha(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x23, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push(conversion.alpha);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called alpha={}", conversion.alpha);
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetDitheringWeightParams(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x24, 8, 0); // 0x240200
|
2016-12-26 13:58:50 +01:00
|
|
|
rp.PopRaw(dithering_weight_params);
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetDitheringWeightParams(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x25, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(9, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushRaw(dithering_weight_params);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::StartConversion(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x26, 0, 0);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2015-06-08 03:24:03 +02:00
|
|
|
// dst_image_size would seem to be perfect for this, but it doesn't include the gap :(
|
2016-09-18 02:38:01 +02:00
|
|
|
u32 total_output_size =
|
|
|
|
conversion.input_lines * (conversion.dst.transfer_unit + conversion.dst.gap);
|
2017-06-22 07:48:00 +02:00
|
|
|
Memory::RasterizerFlushVirtualRegion(conversion.dst.address, total_output_size,
|
|
|
|
Memory::FlushMode::FlushAndInvalidate);
|
2016-04-17 00:57:57 +02:00
|
|
|
|
|
|
|
HW::Y2R::PerformConversion(conversion);
|
2015-05-22 23:49:42 +02:00
|
|
|
|
2015-05-20 03:11:32 +02:00
|
|
|
completion_event->Signal();
|
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::StopConversion(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x27, 0, 0);
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::IsBusyConversion(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x28, 0, 0);
|
2015-05-20 03:11:32 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(0); // StartConversion always finishes immediately
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-05-22 04:27:48 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::SetPackageParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x29, 7, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
auto params = rp.PopRaw<ConversionParameters>();
|
2015-06-03 22:54:24 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.input_format = params.input_format;
|
|
|
|
conversion.output_format = params.output_format;
|
|
|
|
conversion.rotation = params.rotation;
|
|
|
|
conversion.block_alignment = params.block_alignment;
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
ResultCode result = conversion.SetInputLineWidth(params.input_line_width);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
|
|
|
if (result.IsError())
|
|
|
|
goto cleanup;
|
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
result = conversion.SetInputLines(params.input_lines);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
|
|
|
if (result.IsError())
|
|
|
|
goto cleanup;
|
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
result = conversion.SetStandardCoefficient(params.standard_coefficient);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
|
|
|
if (result.IsError())
|
|
|
|
goto cleanup;
|
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
conversion.padding = params.padding;
|
|
|
|
conversion.alpha = params.alpha;
|
2015-06-08 03:24:03 +02:00
|
|
|
|
|
|
|
cleanup:
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(result);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R,
|
2018-06-29 15:56:12 +02:00
|
|
|
"called input_format={} output_format={} rotation={} block_alignment={} "
|
|
|
|
"input_line_width={} input_lines={} standard_coefficient={} reserved={} alpha={:X}",
|
|
|
|
static_cast<u8>(params.input_format), static_cast<u8>(params.output_format),
|
|
|
|
static_cast<u8>(params.rotation), static_cast<u8>(params.block_alignment),
|
|
|
|
params.input_line_width, params.input_lines,
|
|
|
|
static_cast<u8>(params.standard_coefficient), params.padding, params.alpha);
|
2015-06-03 22:54:24 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::PingProcess(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x2A, 0, 0);
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(2, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.Push<u8>(0);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_WARNING(Service_Y2R, "(STUBBED) called");
|
2015-05-20 03:11:32 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::DriverInitialize(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x2B, 0, 0);
|
2017-12-10 04:25:42 +01:00
|
|
|
|
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
2015-06-08 03:24:03 +02:00
|
|
|
|
|
|
|
conversion.input_format = InputFormat::YUV422_Indiv8;
|
|
|
|
conversion.output_format = OutputFormat::RGBA8;
|
|
|
|
conversion.rotation = Rotation::None;
|
|
|
|
conversion.block_alignment = BlockAlignment::Linear;
|
|
|
|
conversion.coefficients.fill(0);
|
|
|
|
conversion.SetInputLineWidth(1024);
|
|
|
|
conversion.SetInputLines(1024);
|
|
|
|
conversion.alpha = 0;
|
|
|
|
|
|
|
|
ConversionBuffer zero_buffer = {};
|
|
|
|
conversion.src_Y = zero_buffer;
|
|
|
|
conversion.src_U = zero_buffer;
|
|
|
|
conversion.src_V = zero_buffer;
|
|
|
|
conversion.dst = zero_buffer;
|
|
|
|
|
|
|
|
completion_event->Clear();
|
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::DriverFinalize(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x2C, 0, 0);
|
2015-06-08 03:24:03 +02:00
|
|
|
|
2017-12-10 04:25:42 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(1, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
2016-04-27 01:49:19 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2015-06-08 03:24:03 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
void Y2R_U::GetPackageParameter(Kernel::HLERequestContext& ctx) {
|
|
|
|
IPC::RequestParser rp(ctx, 0x2D, 0, 0);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
IPC::RequestBuilder rb = rp.MakeBuilder(4, 0);
|
|
|
|
rb.Push(RESULT_SUCCESS);
|
|
|
|
rb.PushRaw(conversion);
|
2016-04-20 12:38:01 +02:00
|
|
|
|
2018-06-29 13:18:07 +02:00
|
|
|
LOG_DEBUG(Service_Y2R, "called");
|
2016-04-20 12:38:01 +02:00
|
|
|
}
|
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
Y2R_U::Y2R_U() : ServiceFramework("y2r:u", 1) {
|
|
|
|
static const FunctionInfo functions[] = {
|
|
|
|
{0x00010040, &Y2R_U::SetInputFormat, "SetInputFormat"},
|
|
|
|
{0x00020000, &Y2R_U::GetInputFormat, "GetInputFormat"},
|
|
|
|
{0x00030040, &Y2R_U::SetOutputFormat, "SetOutputFormat"},
|
|
|
|
{0x00040000, &Y2R_U::GetOutputFormat, "GetOutputFormat"},
|
|
|
|
{0x00050040, &Y2R_U::SetRotation, "SetRotation"},
|
|
|
|
{0x00060000, &Y2R_U::GetRotation, "GetRotation"},
|
|
|
|
{0x00070040, &Y2R_U::SetBlockAlignment, "SetBlockAlignment"},
|
|
|
|
{0x00080000, &Y2R_U::GetBlockAlignment, "GetBlockAlignment"},
|
|
|
|
{0x00090040, &Y2R_U::SetSpacialDithering, "SetSpacialDithering"},
|
|
|
|
{0x000A0000, &Y2R_U::GetSpacialDithering, "GetSpacialDithering"},
|
|
|
|
{0x000B0040, &Y2R_U::SetTemporalDithering, "SetTemporalDithering"},
|
|
|
|
{0x000C0000, &Y2R_U::GetTemporalDithering, "GetTemporalDithering"},
|
|
|
|
{0x000D0040, &Y2R_U::SetTransferEndInterrupt, "SetTransferEndInterrupt"},
|
|
|
|
{0x000E0000, &Y2R_U::GetTransferEndInterrupt, "GetTransferEndInterrupt"},
|
|
|
|
{0x000F0000, &Y2R_U::GetTransferEndEvent, "GetTransferEndEvent"},
|
|
|
|
{0x00100102, &Y2R_U::SetSendingY, "SetSendingY"},
|
|
|
|
{0x00110102, &Y2R_U::SetSendingU, "SetSendingU"},
|
|
|
|
{0x00120102, &Y2R_U::SetSendingV, "SetSendingV"},
|
|
|
|
{0x00130102, &Y2R_U::SetSendingYUYV, "SetSendingYUYV"},
|
|
|
|
{0x00140000, &Y2R_U::IsFinishedSendingYuv, "IsFinishedSendingYuv"},
|
|
|
|
{0x00150000, &Y2R_U::IsFinishedSendingY, "IsFinishedSendingY"},
|
|
|
|
{0x00160000, &Y2R_U::IsFinishedSendingU, "IsFinishedSendingU"},
|
|
|
|
{0x00170000, &Y2R_U::IsFinishedSendingV, "IsFinishedSendingV"},
|
|
|
|
{0x00180102, &Y2R_U::SetReceiving, "SetReceiving"},
|
|
|
|
{0x00190000, &Y2R_U::IsFinishedReceiving, "IsFinishedReceiving"},
|
|
|
|
{0x001A0040, &Y2R_U::SetInputLineWidth, "SetInputLineWidth"},
|
|
|
|
{0x001B0000, &Y2R_U::GetInputLineWidth, "GetInputLineWidth"},
|
|
|
|
{0x001C0040, &Y2R_U::SetInputLines, "SetInputLines"},
|
|
|
|
{0x001D0000, &Y2R_U::GetInputLines, "GetInputLines"},
|
|
|
|
{0x001E0100, &Y2R_U::SetCoefficient, "SetCoefficient"},
|
|
|
|
{0x001F0000, &Y2R_U::GetCoefficient, "GetCoefficient"},
|
|
|
|
{0x00200040, &Y2R_U::SetStandardCoefficient, "SetStandardCoefficient"},
|
|
|
|
{0x00210040, &Y2R_U::GetStandardCoefficient, "GetStandardCoefficient"},
|
|
|
|
{0x00220040, &Y2R_U::SetAlpha, "SetAlpha"},
|
|
|
|
{0x00230000, &Y2R_U::GetAlpha, "GetAlpha"},
|
|
|
|
{0x00240200, &Y2R_U::SetDitheringWeightParams, "SetDitheringWeightParams"},
|
|
|
|
{0x00250000, &Y2R_U::GetDitheringWeightParams, "GetDitheringWeightParams"},
|
|
|
|
{0x00260000, &Y2R_U::StartConversion, "StartConversion"},
|
|
|
|
{0x00270000, &Y2R_U::StopConversion, "StopConversion"},
|
|
|
|
{0x00280000, &Y2R_U::IsBusyConversion, "IsBusyConversion"},
|
|
|
|
{0x002901C0, &Y2R_U::SetPackageParameter, "SetPackageParameter"},
|
|
|
|
{0x002A0000, &Y2R_U::PingProcess, "PingProcess"},
|
|
|
|
{0x002B0000, &Y2R_U::DriverInitialize, "DriverInitialize"},
|
|
|
|
{0x002C0000, &Y2R_U::DriverFinalize, "DriverFinalize"},
|
|
|
|
{0x002D0000, &Y2R_U::GetPackageParameter, "GetPackageParameter"},
|
|
|
|
};
|
|
|
|
RegisterHandlers(functions);
|
2015-01-02 19:03:40 +01:00
|
|
|
|
2016-03-13 03:47:41 +01:00
|
|
|
completion_event = Kernel::Event::Create(Kernel::ResetType::OneShot, "Y2R:Completed");
|
2015-01-02 19:03:40 +01:00
|
|
|
}
|
2015-05-22 04:27:48 +02:00
|
|
|
|
2018-01-11 23:45:03 +01:00
|
|
|
Y2R_U::~Y2R_U() = default;
|
|
|
|
|
|
|
|
void InstallInterfaces(SM::ServiceManager& service_manager) {
|
|
|
|
std::make_shared<Y2R_U>()->InstallAsService(service_manager);
|
2015-07-17 07:24:13 +02:00
|
|
|
}
|
|
|
|
|
2016-12-10 13:51:50 +01:00
|
|
|
} // namespace Y2R
|
2017-12-10 04:25:42 +01:00
|
|
|
} // namespace Service
|