mirror of
https://gitlab.freedesktop.org/monado/monado.git
synced 2025-01-01 04:36:07 +00:00
c/client: Mark consumed FDs as invalid
This commit is contained in:
parent
9ec0b559d4
commit
5b0085f1c1
3
doc/changes/compositor/mr.359.3.md
Normal file
3
doc/changes/compositor/mr.359.3.md
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
client: When we give a image fd to the either OpenGL or Vulkan it is consumed
|
||||||
|
and can not be rused. So make sure that it is set to an invalid fd value on the
|
||||||
|
`xrt_image_fd` on the owning `xrt_swapchain_fd`.
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2019, Collabora, Ltd.
|
// Copyright 2019-2020, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
/*!
|
/*!
|
||||||
* @file
|
* @file
|
||||||
|
@ -296,6 +296,10 @@ client_gl_swapchain_create(struct xrt_compositor *xc,
|
||||||
glImportMemoryFdEXT(
|
glImportMemoryFdEXT(
|
||||||
sc->base.memory[i], sc->xscfd->images[i].size,
|
sc->base.memory[i], sc->xscfd->images[i].size,
|
||||||
GL_HANDLE_TYPE_OPAQUE_FD_EXT, sc->xscfd->images[i].fd);
|
GL_HANDLE_TYPE_OPAQUE_FD_EXT, sc->xscfd->images[i].fd);
|
||||||
|
|
||||||
|
// We have consumed this fd now, make sure it's not freed again.
|
||||||
|
sc->xscfd->images[i].fd = -1;
|
||||||
|
|
||||||
if (array_size == 1) {
|
if (array_size == 1) {
|
||||||
glTextureStorageMem2DEXT(sc->base.images[i], mip_count,
|
glTextureStorageMem2DEXT(sc->base.images[i], mip_count,
|
||||||
(GLuint)format, width, height,
|
(GLuint)format, width, height,
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
// Copyright 2019, Collabora, Ltd.
|
// Copyright 2019-2020, Collabora, Ltd.
|
||||||
// SPDX-License-Identifier: BSL-1.0
|
// SPDX-License-Identifier: BSL-1.0
|
||||||
/*!
|
/*!
|
||||||
* @file
|
* @file
|
||||||
|
@ -271,6 +271,10 @@ client_vk_swapchain_create(struct xrt_compositor *xc,
|
||||||
&c->vk, bits, format, width, height, array_size, mip_count,
|
&c->vk, bits, format, width, height, array_size, mip_count,
|
||||||
&sc->xscfd->images[i], &sc->base.images[i],
|
&sc->xscfd->images[i], &sc->base.images[i],
|
||||||
&sc->base.mems[i]);
|
&sc->base.mems[i]);
|
||||||
|
|
||||||
|
// We have consumed this fd now, make sure it's not freed again.
|
||||||
|
sc->xscfd->images[i].fd = -1;
|
||||||
|
|
||||||
if (ret != VK_SUCCESS) {
|
if (ret != VK_SUCCESS) {
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue