Allow re-import, still consume FDs that fall through the crack.
Lets glxgears animate at 60fps and doesn't leak FDs anymore. steamcompmgr still goes down when glxgears exits.
This commit is contained in:
parent
6dc724b2cd
commit
6c04eba8c6
2 changed files with 21 additions and 3 deletions
|
@ -333,7 +333,7 @@ teardown_win_resources (Display *dpy, win *w)
|
|||
if (!w)
|
||||
return;
|
||||
|
||||
if (w->eglImage)
|
||||
if (w->eglImage != EGL_NO_IMAGE_KHR)
|
||||
{
|
||||
glBindTexture( GL_TEXTURE_2D, 0 );
|
||||
glDeleteTextures( 1, &w->texName );
|
||||
|
@ -353,7 +353,7 @@ ensure_win_resources (Display *dpy, win *w)
|
|||
if (!w)
|
||||
return;
|
||||
|
||||
if (!w->eglImage && w->dmabuf_attribs_valid == True)
|
||||
if (w->dmabuf_attribs_valid == True)
|
||||
{
|
||||
teardown_win_resources( dpy, w );
|
||||
|
||||
|
@ -370,10 +370,15 @@ ensure_win_resources (Display *dpy, win *w)
|
|||
w->eglImage = __pointer_to_eglCreateImageKHR(eglGetCurrentDisplay(), EGL_NO_CONTEXT,
|
||||
EGL_LINUX_DMA_BUF_EXT, (EGLClientBuffer)0, attr);
|
||||
|
||||
close(w->dmabuf_attribs.fd[0]);
|
||||
|
||||
glGenTextures( 1, &w->texName );
|
||||
glBindTexture (GL_TEXTURE_2D, w->texName);
|
||||
glEGLImageTargetTexture2DOES(GL_TEXTURE_2D, w->eglImage);
|
||||
|
||||
// Only consume once
|
||||
w->dmabuf_attribs_valid = False;
|
||||
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_LINEAR);
|
||||
glTexParameteri (GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
|
||||
|
||||
|
@ -1677,6 +1682,11 @@ void check_new_wayland_res(void)
|
|||
{
|
||||
if (w->xwl_surface == newEntry.surf)
|
||||
{
|
||||
if ( w->dmabuf_attribs_valid == True )
|
||||
{
|
||||
// Existing data here hasn't been consumed - need to consume the dma-buf fd
|
||||
close(w->dmabuf_attribs.fd[0]);
|
||||
}
|
||||
w->dmabuf_attribs = newEntry.attribs;
|
||||
w->dmabuf_attribs_valid = True;
|
||||
bFound = True;
|
||||
|
|
|
@ -370,10 +370,18 @@ static void xwayland_surface_role_commit(struct wlr_surface *wlr_surface) {
|
|||
surface->mapped = true;
|
||||
}
|
||||
|
||||
// wlr_buffer_ref( surface->surface->buffer );
|
||||
|
||||
struct wlr_texture *tex = wlr_surface_get_texture( wlr_surface );
|
||||
|
||||
struct wlr_dmabuf_attributes dmabuf_attribs = {};
|
||||
wlr_texture_to_dmabuf( tex, &dmabuf_attribs );
|
||||
bool result = False;
|
||||
result = wlr_texture_to_dmabuf( tex, &dmabuf_attribs );
|
||||
|
||||
if (result == False)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
wayland_PushSurface( surface, &dmabuf_attribs );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue