linux-capture: Omit implicit modifier token when creating texture
DRM_FORMAT_MOD_INVALID is a token for implicit modifier. When importing a DMA-BUF with implicit modifier we should call gs_texture_create_from_dmabuf() without modifier.
This commit is contained in:
parent
e071b5e300
commit
7bc06e0db6
@ -30,6 +30,7 @@
|
||||
#include <fcntl.h>
|
||||
#include <glad/glad.h>
|
||||
#include <linux/dma-buf.h>
|
||||
#include <libdrm/drm_fourcc.h>
|
||||
#include <spa/param/video/format-utils.h>
|
||||
#include <spa/debug/format.h>
|
||||
#include <spa/debug/types.h>
|
||||
@ -386,6 +387,7 @@ static void on_process_cb(void *user_data)
|
||||
uint32_t strides[planes];
|
||||
uint64_t modifiers[planes];
|
||||
int fds[planes];
|
||||
bool modifierless; // DMA-BUF without explicit modifier
|
||||
|
||||
blog(LOG_DEBUG,
|
||||
"[pipewire] DMA-BUF info: fd:%ld, stride:%d, offset:%u, size:%dx%d",
|
||||
@ -410,10 +412,14 @@ static void on_process_cb(void *user_data)
|
||||
}
|
||||
|
||||
g_clear_pointer(&obs_pw->texture, gs_texture_destroy);
|
||||
|
||||
modifierless = obs_pw->format.info.raw.modifier ==
|
||||
DRM_FORMAT_MOD_INVALID;
|
||||
obs_pw->texture = gs_texture_create_from_dmabuf(
|
||||
obs_pw->format.info.raw.size.width,
|
||||
obs_pw->format.info.raw.size.height, drm_format,
|
||||
GS_BGRX, planes, fds, strides, offsets, modifiers);
|
||||
GS_BGRX, planes, fds, strides, offsets,
|
||||
modifierless ? NULL : modifiers);
|
||||
} else {
|
||||
blog(LOG_DEBUG, "[pipewire] Buffer has memory texture");
|
||||
enum gs_color_format obs_format;
|
||||
|
Loading…
x
Reference in New Issue
Block a user