Revert "[nvnflinger] add GetBufferHistory from sudachi (#82)"
All checks were successful
eden-license / license-header (pull_request) Successful in 36s

This reverts commit be97bf3c1b.
This commit is contained in:
crueter 2025-07-26 21:48:08 -04:00
parent 40357169d0
commit 59240cf5d9
Signed by: crueter
GPG key ID: 425ACD2D4830EBC6
6 changed files with 8 additions and 79 deletions

View file

@ -101,14 +101,6 @@ Status BufferQueueConsumer::AcquireBuffer(BufferItem* out_buffer,
// slot to the producer, it will wait for the fence to pass. We should fix this // slot to the producer, it will wait for the fence to pass. We should fix this
// by properly waiting for the fence in the BufferItemConsumer. // by properly waiting for the fence in the BufferItemConsumer.
// slots[slot].fence = Fence::NoFence(); // slots[slot].fence = Fence::NoFence();
const auto target_frame_number = slots[slot].frame_number;
for (size_t i = 0; i < core->history.size(); i++) {
if (core->history[i].frame_number == target_frame_number) {
core->history[i].state = BufferState::Acquired;
break;
}
}
} }
// If the buffer has previously been acquired by the consumer, set graphic_buffer to nullptr to // If the buffer has previously been acquired by the consumer, set graphic_buffer to nullptr to

View file

@ -10,9 +10,7 @@
namespace Service::android { namespace Service::android {
BufferQueueCore::BufferQueueCore() { BufferQueueCore::BufferQueueCore() = default;
history.resize(8);
};
BufferQueueCore::~BufferQueueCore() = default; BufferQueueCore::~BufferQueueCore() = default;

View file

@ -21,25 +21,6 @@
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
static_assert(sizeof(BufferInfo) == 0x1C,
"BufferInfo is an invalid size");
class IConsumerListener; class IConsumerListener;
class IProducerListener; class IProducerListener;
@ -91,8 +72,6 @@ private:
u32 transform_hint{}; u32 transform_hint{};
bool is_allocating{}; bool is_allocating{};
mutable std::condition_variable_any is_allocating_condition; mutable std::condition_variable_any is_allocating_condition;
std::vector<BufferInfo> history{8};
}; };
} // namespace Service::android } // namespace Service::android

View file

@ -512,8 +512,6 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
slots[slot].buffer_state = BufferState::Queued; slots[slot].buffer_state = BufferState::Queued;
++core->frame_counter; ++core->frame_counter;
slots[slot].frame_number = core->frame_counter; slots[slot].frame_number = core->frame_counter;
slots[slot].queue_time = timestamp;
slots[slot].presentation_time = 0;
item.acquire_called = slots[slot].acquire_called; item.acquire_called = slots[slot].acquire_called;
item.graphic_buffer = slots[slot].graphic_buffer; item.graphic_buffer = slots[slot].graphic_buffer;
@ -530,11 +528,6 @@ Status BufferQueueProducer::QueueBuffer(s32 slot, const QueueBufferInput& input,
item.is_droppable = core->dequeue_buffer_cannot_block || async; item.is_droppable = core->dequeue_buffer_cannot_block || async;
item.swap_interval = swap_interval; item.swap_interval = swap_interval;
position = (position + 1) % 8;
core->history[position] = {.frame_number = core->frame_counter,
.queue_time = slots[slot].queue_time,
.state = BufferState::Queued};
sticky_transform = sticky_transform_; sticky_transform = sticky_transform_;
if (core->queue.empty()) { if (core->queue.empty()) {
@ -814,10 +807,6 @@ Status BufferQueueProducer::SetPreallocatedBuffer(s32 slot,
return Status::NoError; return Status::NoError;
} }
Kernel::KReadableEvent* BufferQueueProducer::GetNativeHandle(u32 type_id) {
return &buffer_wait_event->GetReadableEvent();
}
void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data, void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
std::span<u8> parcel_reply, u32 flags) { std::span<u8> parcel_reply, u32 flags) {
// Values used by BnGraphicBufferProducer onTransact // Values used by BnGraphicBufferProducer onTransact
@ -937,49 +926,23 @@ void BufferQueueProducer::Transact(u32 code, std::span<const u8> parcel_data,
status = SetBufferCount(buffer_count); status = SetBufferCount(buffer_count);
break; break;
} }
case TransactionId::GetBufferHistory: { case TransactionId::GetBufferHistory:
LOG_WARNING(Service_Nvnflinger, "called, transaction=GetBufferHistory"); LOG_WARNING(Service_Nvnflinger, "(STUBBED) called, transaction=GetBufferHistory");
std::scoped_lock lock{core->mutex};
auto buffer_history_count = std::min(parcel_in.Read<s32>(), (s32)core->history.size());
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()];
LOG_WARNING(Service_Nvnflinger, "frame_number={}, state={}",
core->history[(pos - i) % core->history.size()].frame_number,
(u32)core->history[(pos - i) % core->history.size()].state);
pos--;
}
parcel_out.Write(Status::NoError);
parcel_out.Write(buffer_history_count);
parcel_out.WriteFlattenedObject<BufferInfo>(info);
status = Status::None;
break; break;
}
default: default:
ASSERT_MSG(false, "Unimplemented TransactionId {}", code); ASSERT_MSG(false, "Unimplemented TransactionId {}", code);
break; break;
} }
if (status != Status::None) { parcel_out.Write(status);
parcel_out.Write(status);
}
const auto serialized = parcel_out.Serialize(); const auto serialized = parcel_out.Serialize();
std::memcpy(parcel_reply.data(), serialized.data(), std::memcpy(parcel_reply.data(), serialized.data(),
std::min(parcel_reply.size(), serialized.size())); std::min(parcel_reply.size(), serialized.size()));
} }
Kernel::KReadableEvent* BufferQueueProducer::GetNativeHandle(u32 type_id) {
return &buffer_wait_event->GetReadableEvent();
}
} // namespace Service::android } // namespace Service::android

View file

@ -86,8 +86,6 @@ private:
s32 current_callback_ticket{}; s32 current_callback_ticket{};
std::condition_variable_any callback_condition; std::condition_variable_any callback_condition;
u64 position;
Service::Nvidia::NvCore::NvMap& nvmap; Service::Nvidia::NvCore::NvMap& nvmap;
}; };

View file

@ -15,7 +15,7 @@ namespace Service::android {
class GraphicBuffer; class GraphicBuffer;
enum class BufferState : s32 { enum class BufferState : u32 {
Free = 0, Free = 0,
Dequeued = 1, Dequeued = 1,
Queued = 2, Queued = 2,
@ -34,7 +34,6 @@ struct BufferSlot final {
bool needs_cleanup_on_release{}; bool needs_cleanup_on_release{};
bool attached_by_consumer{}; bool attached_by_consumer{};
bool is_preallocated{}; bool is_preallocated{};
s64 queue_time{}, presentation_time{};
}; };
} // namespace Service::android } // namespace Service::android