1
0
Эх сурвалжийг харах

libobs/graphics: Enable DMABUF on FreeBSD and DragonFly

Required under Wayland (wlrobs) on FreeBSD and DragonFly. DMABUF was
already partially exposed after c50c62555516.
Jan Beich 2 жил өмнө
parent
commit
c082c4a74d

+ 3 - 3
docs/sphinx/reference-libobs-graphics-graphics.rst

@@ -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.

+ 1 - 1
libobs/graphics/device-exports.h

@@ -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,

+ 1 - 1
libobs/graphics/graphics-imports.c

@@ -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);

+ 1 - 1
libobs/graphics/graphics-internal.h

@@ -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,

+ 1 - 1
libobs/graphics/graphics.c

@@ -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,

+ 1 - 1
libobs/graphics/graphics.h

@@ -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,