Compare commits

...

4 commits

Author SHA1 Message Date
Maufeat
843d6fcbfe little fix after amicuchu changes 2025-07-19 14:05:42 +02:00
Maufeat
dd11abfdbb add: amimi's changes 2025-07-19 14:03:57 +02:00
Maufeat
f248e6f721 add history vector initialization 2025-07-19 13:23:09 +02:00
Maufeat
83ec5869d7 structure changes 2025-07-19 03:59:04 +02:00
3 changed files with 19 additions and 10 deletions

View file

@ -92,7 +92,7 @@ private:
bool is_allocating{};
mutable std::condition_variable_any is_allocating_condition;
std::vector<BufferInfo> history;
std::vector<BufferInfo> history{8};
};
} // namespace Service::android

View file

@ -512,7 +512,7 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
slots[slot].buffer_state = BufferState::Queued;
++core->frame_counter;
slots[slot].frame_number = core->frame_counter;
slots[slot].queue_time = 0;
slots[slot].queue_time = timestamp;
slots[slot].presentation_time = 0;
item.acquire_called = slots[slot].acquire_called;
@ -530,11 +530,9 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
item.is_droppable = core->dequeue_buffer_cannot_block || async;
item.swap_interval = swap_interval;
// TODO: .queue_time should be changed to the correct value
position = (position + 1) % 8;
LOG_WARNING(Service_Nvnflinger, "position={}", position);
core->history[position] = {.frame_number = core->frame_counter,
.queue_time = timestamp,
.queue_time = slots[slot].queue_time,
.state = BufferState::Queued};
sticky_transform = sticky_transform_;
@ -936,13 +934,20 @@ void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
break;
}
case TransactionId::GetBufferHistory: {
LOG_WARNING(Service_Nvnflinger, "(STUBBED) called");
LOG_WARNING(Service_Nvnflinger, "called, transaction=GetBufferHistory");
std::scoped_lock lock{core->mutex};
auto buffer_history_count = std::min(parcel_in.Read<s32>(), (s32)core->history.size());
BufferInfo* info = new BufferInfo[buffer_history_count];
if (buffer_history_count <= 0) {
parcel_out.Write(Status::BadValue);
parcel_out.Write<s32>(0);
status = Status::None;
break;
}
auto info = new BufferInfo[buffer_history_count];
auto pos = position;
for (int i = 0; i < buffer_history_count; i++) {
info[i] = core->history[(pos - i) % core->history.size()];
@ -952,8 +957,10 @@ void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
pos--;
}
parcel_out.Write(Status::NoError);
parcel_out.Write(buffer_history_count);
parcel_out.WriteFlattenedObject<BufferInfo>(info);
status = Status::NoError;
status = Status::None;
break;
}
default:
@ -961,7 +968,9 @@ void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
break;
}
parcel_out.Write(status);
if (status != Status::None) {
parcel_out.Write(status);
}
const auto serialized = parcel_out.Serialize();
std::memcpy(parcel_reply.data(), serialized.data(),

View file

@ -15,7 +15,7 @@ namespace Service::android {
class GraphicBuffer;
enum class BufferState : u32 {
enum class BufferState : s32 {
Free = 0,
Dequeued = 1,
Queued = 2,