mirror of
https://github.com/gnif/LookingGlass.git
synced 2026-08-09 08:41:31 +00:00
[client/idd/obs] scheduler: isolate timing owner delivery
This commit is contained in:
@@ -171,10 +171,13 @@ bool egl_texBufferStreamInit(EGL_Texture ** texture, EGL_TexType type,
|
||||
{
|
||||
case EGL_TEXTYPE_BUFFER_STREAM:
|
||||
case EGL_TEXTYPE_FRAMEBUFFER:
|
||||
case EGL_TEXTYPE_DMABUF:
|
||||
this->texCount = 2;
|
||||
break;
|
||||
|
||||
case EGL_TEXTYPE_DMABUF:
|
||||
this->texCount = LGMP_Q_FRAME_BUFFER_LEN;
|
||||
break;
|
||||
|
||||
case EGL_TEXTYPE_BUFFER_MAP:
|
||||
this->texCount = 1;
|
||||
break;
|
||||
|
||||
@@ -22,9 +22,10 @@
|
||||
|
||||
#include "texture.h"
|
||||
#include "texture_util.h"
|
||||
#include "common/LGMPConfig.h"
|
||||
#include "common/locking.h"
|
||||
|
||||
#define EGL_TEX_BUFFER_MAX 2
|
||||
#define EGL_TEX_BUFFER_MAX LGMP_Q_FRAME_BUFFER_LEN
|
||||
|
||||
typedef struct TextureBuffer
|
||||
{
|
||||
|
||||
@@ -42,7 +42,7 @@ typedef struct TexDMABUF
|
||||
|
||||
EGLDisplay display;
|
||||
|
||||
struct FdImage images[2];
|
||||
struct FdImage images[EGL_TEX_BUFFER_MAX];
|
||||
int lastIndex;
|
||||
int renderIndex;
|
||||
|
||||
@@ -220,11 +220,28 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
||||
|
||||
DEBUG_ASSERT(update->type == EGL_TEXTYPE_DMABUF);
|
||||
|
||||
struct FdImage *fdImage =
|
||||
(this->images[0].fd == update->dmaFD) ? &this->images[0] :
|
||||
(this->images[1].fd == update->dmaFD) ? &this->images[1] :
|
||||
(this->images[0].fd == -1) ? &this->images[0] :
|
||||
&this->images[1];
|
||||
struct FdImage *fdImage = NULL;
|
||||
for (int i = 0; i < ARRAY_LENGTH(this->images); ++i)
|
||||
if (this->images[i].fd == update->dmaFD)
|
||||
{
|
||||
fdImage = &this->images[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fdImage)
|
||||
for (int i = 0; i < ARRAY_LENGTH(this->images); ++i)
|
||||
if (this->images[i].fd == -1)
|
||||
{
|
||||
fdImage = &this->images[i];
|
||||
break;
|
||||
}
|
||||
|
||||
if (!fdImage)
|
||||
{
|
||||
DEBUG_ERROR("No free DMABUF image slot");
|
||||
return false;
|
||||
}
|
||||
|
||||
EGLImage image = fdImage->image;
|
||||
if (unlikely(image == EGL_NO_IMAGE))
|
||||
{
|
||||
@@ -255,7 +272,7 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
||||
fdImage->fd = update->dmaFD;
|
||||
fdImage->image = image;
|
||||
|
||||
int slot = (fdImage == &this->images[0]) ? 0 : 1;
|
||||
const int slot = (int)(fdImage - this->images);
|
||||
fdImage->texIndex = slot;
|
||||
GLsync sync = 0;
|
||||
INTERLOCKED_SECTION(parent->copyLock,
|
||||
@@ -287,7 +304,7 @@ static bool egl_texDMABUFUpdate(EGL_Texture * texture,
|
||||
INTERLOCKED_SECTION(parent->copyLock,
|
||||
{
|
||||
fdImage->frameToken = update->frameToken;
|
||||
this->lastIndex = (fdImage == &this->images[0]) ? 0 : 1;
|
||||
this->lastIndex = (int)(fdImage - this->images);
|
||||
});
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user