0
0
mirror of https://github.com/obsproject/obs-studio.git synced 2024-09-20 04:42:18 +02:00

libobs/graphics: Enable DMABUF on FreeBSD and DragonFly

Required under Wayland (wlrobs) on FreeBSD and DragonFly. DMABUF was
already partially exposed after c50c625555.

(cherry picked from commit c082c4a74d)
This commit is contained in:
Jan Beich 2022-12-31 15:20:09 +00:00 committed by Jim
parent fb371a340b
commit c24c137fa6
6 changed files with 8 additions and 8 deletions

View File

@ -1009,7 +1009,7 @@ Texture Functions
.. function:: gs_texture_t *gs_texture_create_from_dmabuf(unsigned int width, unsigned int height, uint32_t drm_format, enum gs_color_format color_format, uint32_t n_planes, const int *fds, const uint32_t *strides, const uint32_t *offsets, const uint64_t *modifiers)
**Linux only:** Creates a texture from DMA-BUF metadata.
**only Linux, FreeBSD, DragonFly:** Creates a texture from DMA-BUF metadata.
Exchanging DMA-BUFs is a verbose process because of its multiplanar nature.
For example, YUV can have each plane as a color channel, or a monitor buffer
@ -1049,7 +1049,7 @@ Texture Functions
.. function:: bool *gs_query_dmabuf_capabilities(enum gs_dmabuf_flags *dmabuf_flags, uint32_t **drm_formats, size_t *n_formats)
**Linux only:** Queries the capabilities for DMA-BUFs.
**only Linux, FreeBSD, DragonFly:** Queries the capabilities for DMA-BUFs.
Graphics cards can optimize frame buffers by storing them in custom layouts,
depending on their hardware features. These layouts can make these frame
@ -1068,7 +1068,7 @@ Texture Functions
.. function:: bool *gs_query_dmabuf_modifiers_for_format(uint32_t drm_format, uint64_t **modifiers, size_t *n_modifiers)
**Linux only:** Queries the supported DMA-BUF modifiers for a given format.
**only Linux, FreeBSD, DragonFly:** Queries the supported DMA-BUF modifiers for a given format.
This function queries all supported explicit modifiers for a format,
stores them as an array and returns the number of supported modifiers.

View File

@ -178,7 +178,7 @@ EXPORT void device_debug_marker_begin(gs_device_t *device,
const float color[4]);
EXPORT void device_debug_marker_end(gs_device_t *device);
#if __linux__
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
EXPORT gs_texture_t *device_texture_create_from_dmabuf(
gs_device_t *device, unsigned int width, unsigned int height,

View File

@ -234,7 +234,7 @@ bool load_graphics_imports(struct gs_exports *exports, void *module,
GRAPHICS_IMPORT_OPTIONAL(device_stagesurface_create_p010);
GRAPHICS_IMPORT_OPTIONAL(device_register_loss_callbacks);
GRAPHICS_IMPORT_OPTIONAL(device_unregister_loss_callbacks);
#elif __linux__
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
GRAPHICS_IMPORT(device_texture_create_from_dmabuf);
GRAPHICS_IMPORT(device_query_dmabuf_capabilities);
GRAPHICS_IMPORT(device_query_dmabuf_modifiers_for_format);

View File

@ -348,7 +348,7 @@ struct gs_exports {
gs_device_t *device, const struct gs_device_loss *callbacks);
void (*device_unregister_loss_callbacks)(gs_device_t *device,
void *data);
#elif __linux__
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
struct gs_texture *(*device_texture_create_from_dmabuf)(
gs_device_t *device, unsigned int width, unsigned int height,
uint32_t drm_format, enum gs_color_format color_format,

View File

@ -1387,7 +1387,7 @@ gs_texture_t *gs_texture_create(uint32_t width, uint32_t height,
levels, data, flags);
}
#if __linux__
#if defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
gs_texture_t *gs_texture_create_from_dmabuf(
unsigned int width, unsigned int height, uint32_t drm_format,

View File

@ -967,7 +967,7 @@ EXPORT gs_stagesurf_t *gs_stagesurface_create_p010(uint32_t width,
EXPORT void gs_register_loss_callbacks(const struct gs_device_loss *callbacks);
EXPORT void gs_unregister_loss_callbacks(void *data);
#elif defined(__linux__) || defined(__FreeBSD__)
#elif defined(__linux__) || defined(__FreeBSD__) || defined(__DragonFly__)
EXPORT gs_texture_t *gs_texture_create_from_dmabuf(
unsigned int width, unsigned int height, uint32_t drm_format,