mirror of
https://git.suyu.dev/suyu/suyu.git
synced 2024-11-29 18:22:47 +01:00
hle: service: nvflinger: consumer_base: Cleanup & fixes.
This commit is contained in:
parent
30b07878ba
commit
4036e37bbe
2 changed files with 17 additions and 15 deletions
|
@ -36,38 +36,41 @@ void ConsumerBase::FreeBufferLocked(s32 slot_index) {
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::OnFrameAvailable(const BufferItem& item) {
|
void ConsumerBase::OnFrameAvailable(const BufferItem& item) {
|
||||||
std::scoped_lock lock(mutex);
|
|
||||||
LOG_DEBUG(Service_NVFlinger, "called");
|
LOG_DEBUG(Service_NVFlinger, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::OnFrameReplaced(const BufferItem& item) {
|
void ConsumerBase::OnFrameReplaced(const BufferItem& item) {
|
||||||
std::scoped_lock lock(mutex);
|
|
||||||
LOG_DEBUG(Service_NVFlinger, "called");
|
LOG_DEBUG(Service_NVFlinger, "called");
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::OnBuffersReleased() {
|
void ConsumerBase::OnBuffersReleased() {
|
||||||
std::scoped_lock lock(mutex);
|
std::scoped_lock lock(mutex);
|
||||||
|
|
||||||
LOG_DEBUG(Service_NVFlinger, "called");
|
LOG_DEBUG(Service_NVFlinger, "called");
|
||||||
|
|
||||||
|
if (is_abandoned) {
|
||||||
|
// Nothing to do if we're already abandoned.
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
u64 mask = 0;
|
||||||
|
consumer->GetReleasedBuffers(&mask);
|
||||||
|
for (int i = 0; i < BufferQueueDefs::NUM_BUFFER_SLOTS; i++) {
|
||||||
|
if (mask & (1ULL << i)) {
|
||||||
|
FreeBufferLocked(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ConsumerBase::OnSidebandStreamChanged() {}
|
void ConsumerBase::OnSidebandStreamChanged() {}
|
||||||
|
|
||||||
Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when,
|
Status ConsumerBase::AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when) {
|
||||||
u64 max_frame_number) {
|
Status err = consumer->AcquireBuffer(item, present_when);
|
||||||
if (is_abandoned) {
|
|
||||||
LOG_ERROR(Service_NVFlinger, "consumer is abandoned!");
|
|
||||||
return Status::NoInit;
|
|
||||||
}
|
|
||||||
|
|
||||||
Status err = consumer->AcquireBuffer(item, present_when, max_frame_number);
|
|
||||||
if (err != Status::NoError) {
|
if (err != Status::NoError) {
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item->graphic_buffer != nullptr) {
|
if (item->graphic_buffer != nullptr) {
|
||||||
if (slots[item->slot].graphic_buffer != nullptr) {
|
|
||||||
FreeBufferLocked(item->slot);
|
|
||||||
}
|
|
||||||
slots[item->slot].graphic_buffer = item->graphic_buffer;
|
slots[item->slot].graphic_buffer = item->graphic_buffer;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -35,8 +35,7 @@ protected:
|
||||||
virtual void OnSidebandStreamChanged() override;
|
virtual void OnSidebandStreamChanged() override;
|
||||||
|
|
||||||
void FreeBufferLocked(s32 slot_index);
|
void FreeBufferLocked(s32 slot_index);
|
||||||
Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when,
|
Status AcquireBufferLocked(BufferItem* item, std::chrono::nanoseconds present_when);
|
||||||
u64 max_frame_number = 0);
|
|
||||||
Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer);
|
Status ReleaseBufferLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer);
|
||||||
bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const;
|
bool StillTracking(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer) const;
|
||||||
Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer,
|
Status AddReleaseFenceLocked(s32 slot, const std::shared_ptr<GraphicBuffer> graphic_buffer,
|
||||||
|
|
Loading…
Reference in a new issue