mirror of
https://github.com/gnif/LookingGlass.git
synced 2024-11-10 08:38:20 +00:00
[client] egl: remove texture copy in DMABUF path
With more efficient rendering due to buffer age support, we no longer need to copy the texture to avoid excessive dmabuf copies.
This commit is contained in:
parent
8545d15c85
commit
55703b61b7
@ -32,9 +32,6 @@ typedef struct TexDMABUF
|
|||||||
|
|
||||||
EGLDisplay display;
|
EGLDisplay display;
|
||||||
|
|
||||||
GLuint fbo;
|
|
||||||
GLuint tex;
|
|
||||||
|
|
||||||
size_t imageCount;
|
size_t imageCount;
|
||||||
size_t imageUsed;
|
size_t imageUsed;
|
||||||
struct
|
struct
|
||||||
@ -52,18 +49,6 @@ EGL_TextureOps EGL_TextureDMABUF;
|
|||||||
|
|
||||||
static void eglTexDMABUF_cleanup(TexDMABUF * this)
|
static void eglTexDMABUF_cleanup(TexDMABUF * this)
|
||||||
{
|
{
|
||||||
if (this->fbo)
|
|
||||||
{
|
|
||||||
glDeleteFramebuffers(1, &this->fbo);
|
|
||||||
this->fbo = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (this->tex)
|
|
||||||
{
|
|
||||||
glDeleteTextures(1, &this->tex);
|
|
||||||
this->tex = 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
for (size_t i = 0; i < this->imageUsed; ++i)
|
for (size_t i = 0; i < this->imageUsed; ++i)
|
||||||
eglDestroyImage(this->display, this->images[i].image);
|
eglDestroyImage(this->display, this->images[i].image);
|
||||||
|
|
||||||
@ -111,9 +96,6 @@ static bool eglTexDMABUF_setup(EGL_Texture * texture, const EGL_TexSetup * setup
|
|||||||
if (!eglTexBuffer_setup(&parent->base, setup))
|
if (!eglTexBuffer_setup(&parent->base, setup))
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
glGenFramebuffers(1, &this->fbo);
|
|
||||||
glGenTextures (1, &this->tex);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, parent->tex[0]);
|
glBindTexture(GL_TEXTURE_2D, parent->tex[0]);
|
||||||
glTexImage2D(GL_TEXTURE_2D,
|
glTexImage2D(GL_TEXTURE_2D,
|
||||||
0,
|
0,
|
||||||
@ -190,53 +172,19 @@ static bool eglTexDMABUF_update(EGL_Texture * texture,
|
|||||||
this->images[index].image = image;
|
this->images[index].image = image;
|
||||||
}
|
}
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, this->tex);
|
|
||||||
g_egl_dynProcs.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
|
|
||||||
|
|
||||||
/* should any of the following even be here? move to process? - gnif */
|
|
||||||
|
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, this->fbo);
|
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D,
|
|
||||||
this->tex, 0);
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, parent->tex[0]);
|
glBindTexture(GL_TEXTURE_2D, parent->tex[0]);
|
||||||
glCopyTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, 0, 0, parent->format.width,
|
g_egl_dynProcs.glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, image);
|
||||||
parent->format.height);
|
|
||||||
|
|
||||||
GLsync fence = glFenceSync(GL_SYNC_GPU_COMMANDS_COMPLETE, 0);
|
|
||||||
glFlush();
|
|
||||||
|
|
||||||
switch(glClientWaitSync(fence, 0, 20000000)) //20ms
|
|
||||||
{
|
|
||||||
case GL_ALREADY_SIGNALED:
|
|
||||||
case GL_CONDITION_SATISFIED:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_TIMEOUT_EXPIRED:
|
|
||||||
break;
|
|
||||||
|
|
||||||
case GL_WAIT_FAILED:
|
|
||||||
case GL_INVALID_VALUE:
|
|
||||||
DEBUG_GL_ERROR("glClientWaitSync failed");
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
glDeleteSync(fence);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EGL_TexStatus eglTexDMABUF_process(EGL_Texture * texture)
|
static EGL_TexStatus eglTexDMABUF_process(EGL_Texture * texture)
|
||||||
{
|
{
|
||||||
// TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
|
||||||
// TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
|
||||||
|
|
||||||
return EGL_TEX_STATUS_OK;
|
return EGL_TEX_STATUS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
static EGL_TexStatus eglTexDMABUF_bind(EGL_Texture * texture)
|
static EGL_TexStatus eglTexDMABUF_bind(EGL_Texture * texture)
|
||||||
{
|
{
|
||||||
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
TextureBuffer * parent = UPCAST(TextureBuffer, texture);
|
||||||
// TexDMABUF * this = UPCAST(TexDMABUF , parent);
|
|
||||||
|
|
||||||
glActiveTexture(GL_TEXTURE0);
|
glActiveTexture(GL_TEXTURE0);
|
||||||
glBindTexture(GL_TEXTURE_2D, parent->tex[0]);
|
glBindTexture(GL_TEXTURE_2D, parent->tex[0]);
|
||||||
|
Loading…
Reference in New Issue
Block a user