mirror of
https://git.eden-emu.dev/eden-emu/eden.git
synced 2025-07-20 08:15:46 +00:00
change BufferInfo to struct and pack it + use timestamp in queue_time
This commit is contained in:
parent
0c6ed79398
commit
6ccca5a0cf
2 changed files with 20 additions and 10 deletions
|
@ -21,6 +21,23 @@
|
||||||
|
|
||||||
namespace Service::android {
|
namespace Service::android {
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma pack(push, 1)
|
||||||
|
#endif
|
||||||
|
struct BufferInfo {
|
||||||
|
u64 frame_number;
|
||||||
|
s64 queue_time;
|
||||||
|
s64 presentation_time{};
|
||||||
|
BufferState state{BufferState::Free};
|
||||||
|
}
|
||||||
|
#if defined(__GNUC__) || defined(__clang__)
|
||||||
|
__attribute__((packed))
|
||||||
|
#endif
|
||||||
|
;
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#pragma pack(pop)
|
||||||
|
#endif
|
||||||
|
|
||||||
class IConsumerListener;
|
class IConsumerListener;
|
||||||
class IProducerListener;
|
class IProducerListener;
|
||||||
|
|
||||||
|
@ -73,13 +90,6 @@ private:
|
||||||
bool is_allocating{};
|
bool is_allocating{};
|
||||||
mutable std::condition_variable_any is_allocating_condition;
|
mutable std::condition_variable_any is_allocating_condition;
|
||||||
|
|
||||||
class BufferInfo final {
|
|
||||||
public:
|
|
||||||
u64 frame_number{};
|
|
||||||
s64 queue_time{}, presentation_time{};
|
|
||||||
BufferState state{BufferState::Free};
|
|
||||||
};
|
|
||||||
|
|
||||||
std::vector<BufferInfo> history;
|
std::vector<BufferInfo> history;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
|
@ -534,7 +534,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
|
||||||
position = (position + 1) % 8;
|
position = (position + 1) % 8;
|
||||||
LOG_WARNING(Service_Nvnflinger, "position={}", position);
|
LOG_WARNING(Service_Nvnflinger, "position={}", position);
|
||||||
core->history[position] = {.frame_number = core->frame_counter,
|
core->history[position] = {.frame_number = core->frame_counter,
|
||||||
.queue_time = slots[slot].queue_time,
|
.queue_time = timestamp,
|
||||||
.state = BufferState::Queued};
|
.state = BufferState::Queued};
|
||||||
|
|
||||||
sticky_transform = sticky_transform_;
|
sticky_transform = sticky_transform_;
|
||||||
|
@ -942,7 +942,7 @@ void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
|
||||||
|
|
||||||
auto buffer_history_count = std::min(parcel_in.Read<s32>(), (s32)core->history.size());
|
auto buffer_history_count = std::min(parcel_in.Read<s32>(), (s32)core->history.size());
|
||||||
|
|
||||||
BufferQueueCore::BufferInfo* info = new BufferQueueCore::BufferInfo[buffer_history_count];
|
BufferInfo* info = new BufferInfo[buffer_history_count];
|
||||||
auto pos = position;
|
auto pos = position;
|
||||||
for (int i = 0; i < buffer_history_count; i++) {
|
for (int i = 0; i < buffer_history_count; i++) {
|
||||||
info[i] = core->history[(pos - i) % core->history.size()];
|
info[i] = core->history[(pos - i) % core->history.size()];
|
||||||
|
@ -952,7 +952,7 @@ void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
|
||||||
pos--;
|
pos--;
|
||||||
}
|
}
|
||||||
|
|
||||||
parcel_out.WriteFlattenedObject<BufferQueueCore::BufferInfo>(info);
|
parcel_out.WriteFlattenedObject<BufferInfo>(info);
|
||||||
status = Status::NoError;
|
status = Status::NoError;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue