mirror of
https://github.com/jojo61/vdr-plugin-softhdcuvid.git
synced 2023-10-10 13:37:41 +02:00
reenable openglosd doublebuffer
This commit is contained in:
parent
4112cc8229
commit
4a28f3f99b
@ -512,17 +512,15 @@ cOglOutputFb::~cOglOutputFb(void) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cOglOutputFb::Init(void) {
|
bool cOglOutputFb::Init(void) {
|
||||||
#if 0
|
|
||||||
//fetching osd vdpau output surface from softhddevice
|
|
||||||
// void *vdpauOutputSurface = GetVDPAUOutputSurface();
|
|
||||||
glGenTextures(1, &texture);
|
glGenTextures(1, &texture);
|
||||||
//register surface for texture
|
|
||||||
// surface = glVDPAURegisterOutputSurfaceNV(vdpauOutputSurface, GL_TEXTURE_2D, 1, &texture);
|
|
||||||
//set write access to surface
|
|
||||||
// glVDPAUSurfaceAccessNV(surface, GL_WRITE_DISCARD_NV);
|
|
||||||
//create framebuffer
|
|
||||||
// glVDPAUMapSurfacesNV (1, &surface);
|
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, width, height, 0, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_BORDER);
|
||||||
|
glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_BORDER);
|
||||||
|
|
||||||
glGenFramebuffers(1, &fb);
|
glGenFramebuffers(1, &fb);
|
||||||
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
glBindFramebuffer(GL_FRAMEBUFFER, fb);
|
||||||
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
|
glFramebufferTexture2D(GL_FRAMEBUFFER, GL_COLOR_ATTACHMENT0, GL_TEXTURE_2D, texture, 0);
|
||||||
@ -530,18 +528,18 @@ bool cOglOutputFb::Init(void) {
|
|||||||
esyslog("[softhddev]ERROR::cOglOutputFb: Framebuffer is not complete!");
|
esyslog("[softhddev]ERROR::cOglOutputFb: Framebuffer is not complete!");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
void cOglOutputFb::BindWrite(void) {
|
void cOglOutputFb::BindWrite(void) {
|
||||||
// glVDPAUMapSurfacesNV(1, &surface);
|
// glVDPAUMapSurfacesNV(1, &surface);
|
||||||
// glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
|
glBindFramebuffer(GL_DRAW_FRAMEBUFFER, fb);
|
||||||
}
|
}
|
||||||
|
|
||||||
void cOglOutputFb::Unbind(void) {
|
void cOglOutputFb::Unbind(void) {
|
||||||
// glVDPAUUnmapSurfacesNV(1, &surface);
|
// glVDPAUUnmapSurfacesNV(1, &surface);
|
||||||
// glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
glBindFramebuffer(GL_FRAMEBUFFER, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
@ -671,7 +669,7 @@ void cOglVb::DrawArrays(int count) {
|
|||||||
glFlush();
|
glFlush();
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0
|
|
||||||
/****************************************************************************************
|
/****************************************************************************************
|
||||||
* cOpenGLCmd
|
* cOpenGLCmd
|
||||||
****************************************************************************************/
|
****************************************************************************************/
|
||||||
@ -685,7 +683,7 @@ bool cOglCmdInitOutputFb::Execute(void) {
|
|||||||
oFb->Unbind();
|
oFb->Unbind();
|
||||||
return ok;
|
return ok;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//------------------ cOglCmdInitFb --------------------
|
//------------------ cOglCmdInitFb --------------------
|
||||||
cOglCmdInitFb::cOglCmdInitFb(cOglFb *fb, cCondWait *wait) : cOglCmd(fb) {
|
cOglCmdInitFb::cOglCmdInitFb(cOglFb *fb, cCondWait *wait) : cOglCmd(fb) {
|
||||||
this->wait = wait;
|
this->wait = wait;
|
||||||
@ -761,7 +759,7 @@ bool cOglCmdRenderFbToBufferFb::Execute(void) {
|
|||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#if 0
|
|
||||||
//------------------ cOglCmdCopyBufferToOutputFb --------------------
|
//------------------ cOglCmdCopyBufferToOutputFb --------------------
|
||||||
cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y) : cOglCmd(fb) {
|
cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputFb *oFb, GLint x, GLint y) : cOglCmd(fb) {
|
||||||
this->oFb = oFb;
|
this->oFb = oFb;
|
||||||
@ -770,16 +768,19 @@ cOglCmdCopyBufferToOutputFb::cOglCmdCopyBufferToOutputFb(cOglFb *fb, cOglOutputF
|
|||||||
}
|
}
|
||||||
|
|
||||||
bool cOglCmdCopyBufferToOutputFb::Execute(void) {
|
bool cOglCmdCopyBufferToOutputFb::Execute(void) {
|
||||||
|
pthread_mutex_lock(&OSDMutex);
|
||||||
fb->BindRead();
|
fb->BindRead();
|
||||||
oFb->BindWrite();
|
oFb->BindWrite();
|
||||||
|
|
||||||
|
glClear(GL_COLOR_BUFFER_BIT);
|
||||||
fb->Blit(x, y + fb->Height(), x + fb->Width(), y);
|
fb->Blit(x, y + fb->Height(), x + fb->Width(), y);
|
||||||
oFb->Unbind();
|
oFb->Unbind();
|
||||||
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
|
ActivateOsd(oFb->texture,x, y ,fb->Width(), fb->Height());
|
||||||
|
|
||||||
// ActivateOsd(oFb->texture,oFb->fb,glXGetCurrentContext());
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
//------------------ cOglCmdFill --------------------
|
//------------------ cOglCmdFill --------------------
|
||||||
cOglCmdFill::cOglCmdFill(cOglFb *fb, GLint color) : cOglCmd(fb) {
|
cOglCmdFill::cOglCmdFill(cOglFb *fb, GLint color) : cOglCmd(fb) {
|
||||||
this->color = color;
|
this->color = color;
|
||||||
@ -1899,13 +1900,13 @@ cOglOsd::cOglOsd(int Left, int Top, uint Level, std::shared_ptr<cOglThread> oglT
|
|||||||
VideoGetOsdSize(&osdWidth, &osdHeight);
|
VideoGetOsdSize(&osdWidth, &osdHeight);
|
||||||
|
|
||||||
dsyslog("[softhddev]cOglOsd osdLeft %d osdTop %d screenWidth %d screenHeight %d", Left, Top, osdWidth, osdHeight);
|
dsyslog("[softhddev]cOglOsd osdLeft %d osdTop %d screenWidth %d screenHeight %d", Left, Top, osdWidth, osdHeight);
|
||||||
#if 0
|
|
||||||
//create vdpau output framebuffer
|
//create vdpau output framebuffer
|
||||||
if (!oFb) {
|
if (!oFb) {
|
||||||
oFb = new cOglOutputFb(osdWidth, osdHeight);
|
oFb = new cOglOutputFb(osdWidth, osdHeight);
|
||||||
oglThread->DoCmd(new cOglCmdInitOutputFb(oFb));
|
oglThread->DoCmd(new cOglCmdInitOutputFb(oFb));
|
||||||
}
|
}
|
||||||
#endif
|
|
||||||
}
|
}
|
||||||
|
|
||||||
cOglOsd::~cOglOsd() {
|
cOglOsd::~cOglOsd() {
|
||||||
@ -2000,7 +2001,7 @@ void cOglOsd::Flush(void) {
|
|||||||
//uint64_t start = cTimeMs::Now();
|
//uint64_t start = cTimeMs::Now();
|
||||||
//dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now());
|
//dsyslog("[softhddev]Start Flush at %" PRIu64 "", cTimeMs::Now());
|
||||||
|
|
||||||
pthread_mutex_lock(&OSDMutex);
|
|
||||||
oglThread->DoCmd(new cOglCmdFill(bFb, clrTransparent));
|
oglThread->DoCmd(new cOglCmdFill(bFb, clrTransparent));
|
||||||
|
|
||||||
//render pixmap textures blended to buffer
|
//render pixmap textures blended to buffer
|
||||||
@ -2020,9 +2021,7 @@ void cOglOsd::Flush(void) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ActivateOsd(bFb->texture,Left(), Top() , bFb->Width(), bFb->Height());
|
oglThread->DoCmd(new cOglCmdCopyBufferToOutputFb(bFb, oFb, Left(), Top()));
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
|
||||||
// oglThread->DoCmd(new cOglCmdCopyBufferToOutputFb(bFb, oFb, Left(), Top()));
|
|
||||||
//dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start));
|
//dsyslog("[softhddev]End Flush at %" PRIu64 ", duration %d", cTimeMs::Now(), (int)(cTimeMs::Now()-start));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
20
video.c
20
video.c
@ -798,15 +798,14 @@ static void GlxSetupDecoder(int width, int height, GLuint * textures)
|
|||||||
/// @param width window width
|
/// @param width window width
|
||||||
/// @param height window height
|
/// @param height window height
|
||||||
///
|
///
|
||||||
static inline void GlxRenderTexture(GLuint texture, int x, int y, int width,
|
static inline void GlxRenderTexture(GLuint texture, int x, int y, int width, int height)
|
||||||
int height)
|
|
||||||
{
|
{
|
||||||
|
|
||||||
glEnable(GL_TEXTURE_2D);
|
glEnable(GL_TEXTURE_2D);
|
||||||
glBindTexture(GL_TEXTURE_2D, texture);
|
glBindTexture(GL_TEXTURE_2D, texture);
|
||||||
|
|
||||||
// glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // no color
|
// glColor4f(1.0f, 1.0f, 1.0f, 1.0f); // no color
|
||||||
#ifndef USE_OPENGLOSD
|
|
||||||
glBegin(GL_QUADS); {
|
glBegin(GL_QUADS); {
|
||||||
glTexCoord2f(1.0f, 1.0f);
|
glTexCoord2f(1.0f, 1.0f);
|
||||||
glVertex2i(x + width, y + height);
|
glVertex2i(x + width, y + height);
|
||||||
@ -818,19 +817,6 @@ static inline void GlxRenderTexture(GLuint texture, int x, int y, int width,
|
|||||||
glVertex2i(x + width, y);
|
glVertex2i(x + width, y);
|
||||||
}
|
}
|
||||||
glEnd();
|
glEnd();
|
||||||
#else
|
|
||||||
glBegin(GL_QUADS); {
|
|
||||||
glTexCoord2f(1.0f, 1.0f);
|
|
||||||
glVertex2i(x+width , y );
|
|
||||||
glTexCoord2f(0.0f, 1.0f);
|
|
||||||
glVertex2i(x, y );
|
|
||||||
glTexCoord2f(0.0f, 0.0f);
|
|
||||||
glVertex2i(x, y+height);
|
|
||||||
glTexCoord2f(1.0f, 0.0f);
|
|
||||||
glVertex2i(x+width , y+height);
|
|
||||||
}
|
|
||||||
glEnd();
|
|
||||||
#endif
|
|
||||||
|
|
||||||
glBindTexture(GL_TEXTURE_2D, 0);
|
glBindTexture(GL_TEXTURE_2D, 0);
|
||||||
glDisable(GL_TEXTURE_2D);
|
glDisable(GL_TEXTURE_2D);
|
||||||
@ -3148,7 +3134,7 @@ static void CuvidDisplayFrame(void)
|
|||||||
#else
|
#else
|
||||||
pthread_mutex_lock(&OSDMutex);
|
pthread_mutex_lock(&OSDMutex);
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext );
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxContext );
|
||||||
GlxRenderTexture(OSDtexture, OSDx, OSDy, OSDxsize, OSDysize);
|
GlxRenderTexture(OSDtexture, 0,0, VideoWindowWidth, VideoWindowHeight);
|
||||||
pthread_mutex_unlock(&OSDMutex);
|
pthread_mutex_unlock(&OSDMutex);
|
||||||
#endif
|
#endif
|
||||||
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
glXMakeCurrent(XlibDisplay, VideoWindow, GlxSharedContext);
|
||||||
|
Loading…
Reference in New Issue
Block a user