mirror of
https://github.com/MobileGL-Dev/MobileGL
synced 2026-11-18 07:23:24 +09:00
[Fix] (Espryt): query buffer age only after a damage region is declared
This commit is contained in:
@@ -514,17 +514,28 @@ namespace MobileGL::MG_Remote::Client {
|
||||
}
|
||||
|
||||
// In the stream, so the server answers for the buffer the records after it draw into.
|
||||
Bool BackendObject_Remote::QueryBufferAge(EGLint* age) {
|
||||
Bool BackendObject_Remote::QueryBufferAge(Bool damageRegionFollows, EGLint* age) {
|
||||
ClientSession* session = ClientSession::Active();
|
||||
if (session == nullptr || age == nullptr) return false;
|
||||
MG_Pipe::MGPSharedImageOp op{};
|
||||
op.Op = MG_Pipe::kMGPSharedImageQueryBufferAge;
|
||||
op.Format = damageRegionFollows ? MG_Pipe::kMGPBufferAgeDamageRegionFollows : 0u;
|
||||
MG_Pipe::MGPSharedImageReply reply{};
|
||||
if (!session->EmitSharedImage(op, -1, &reply, nullptr)) return false;
|
||||
*age = std::max<EGLint>(reply.BufferAge, 0);
|
||||
return true;
|
||||
}
|
||||
|
||||
// In the stream too: it has to reach the server before the frame's first draw.
|
||||
Bool BackendObject_Remote::SetDamageRegion(const MG_Util::Damage::Region& region) {
|
||||
ClientSession* session = ClientSession::Active();
|
||||
if (session == nullptr) return false;
|
||||
MG_Pipe::MGPSharedImageOp op{};
|
||||
op.Op = MG_Pipe::kMGPSharedImageSetDamageRegion;
|
||||
op.DamageCount = MG_Util::Damage::PackRects(region, op.Damage, MG_Pipe::kMGPMaxDamageRects);
|
||||
return session->EmitSharedImage(op, -1, nullptr, nullptr);
|
||||
}
|
||||
|
||||
Bool BackendObject_Remote::AttachSharedImageToTexture(Uint64 textureLifetimeId, Uint64 id) {
|
||||
ClientSession* session = ClientSession::Active();
|
||||
if (session == nullptr) return false;
|
||||
|
||||
@@ -88,7 +88,8 @@ namespace MobileGL::MG_Remote::Client {
|
||||
Bool ImportSharedImage(int fd, Uint32 width, Uint32 height, Uint32 fourcc, Uint64* outId) override;
|
||||
Bool ReleaseSharedImage(Uint64 id) override;
|
||||
Bool PresentToSharedImage(Uint64 id, const MG_Util::Damage::Region& region) override;
|
||||
Bool QueryBufferAge(EGLint* age) override;
|
||||
Bool QueryBufferAge(Bool damageRegionFollows, EGLint* age) override;
|
||||
Bool SetDamageRegion(const MG_Util::Damage::Region& region) override;
|
||||
Bool AttachSharedImageToTexture(Uint64 textureLifetimeId, Uint64 id) override;
|
||||
|
||||
// Copies the caps mirror's FormatCapabilityCache into the base class's
|
||||
|
||||
@@ -1578,9 +1578,14 @@ namespace MobileGL::MG_Remote::Server {
|
||||
case MG_Pipe::kMGPSharedImageQueryBufferAge: {
|
||||
MG_Backend::BackendObject* backend = ServerLoopInstance().Backend();
|
||||
if (backend == nullptr) return false;
|
||||
reply.BufferAge = backend->QueryCurrentBufferAge();
|
||||
reply.BufferAge = backend->QueryCurrentBufferAge((op.Format & MG_Pipe::kMGPBufferAgeDamageRegionFollows) != 0);
|
||||
return true;
|
||||
}
|
||||
case MG_Pipe::kMGPSharedImageSetDamageRegion: {
|
||||
MG_Backend::BackendObject* backend = ServerLoopInstance().Backend();
|
||||
if (backend == nullptr) return false;
|
||||
return backend->SetCurrentDamageRegion(DamageOfRecord(op.DamageCount, op.Damage));
|
||||
}
|
||||
case MG_Pipe::kMGPSharedImageAttach: {
|
||||
SI::ImageRef image = holder.Get(op.ImageId);
|
||||
if (image == nullptr) return false;
|
||||
|
||||
Reference in New Issue
Block a user