summarylogtreecommitdiffstats
diff options
context:
space:
mode:
authortytan6522024-12-15 15:01:18 +0100
committertytan6522024-12-15 15:01:18 +0100
commit0cdc0fb6a6e9af7397f188b8f94af3492bd15871 (patch)
tree39752c8a92817b240a91b734c5aac339b1129ae5
parentaf190cb8fa223b703719bdcecb7e57ed0bf51610 (diff)
downloadaur-0cdc0fb6a6e9af7397f188b8f94af3492bd15871.tar.gz
build: "backport" alloc 0 fix before hotfix is release
-rw-r--r--.SRCINFO4
-rw-r--r--001-opengl-avoid-allocate-0-byte.patch90
-rw-r--r--PKGBUILD7
3 files changed, 99 insertions, 2 deletions
diff --git a/.SRCINFO b/.SRCINFO
index 0351b790cb5d..486f3a772bff 100644
--- a/.SRCINFO
+++ b/.SRCINFO
@@ -1,7 +1,7 @@
pkgbase = obs-studio-tytan652
pkgdesc = Free and open source software for video recording and live streaming. With everything except service integrations. Plus my bind interface PR, and sometimes backported fixes
pkgver = 31.0.0
- pkgrel = 2
+ pkgrel = 3
url = https://github.com/obsproject/obs-studio
arch = x86_64
arch = aarch64
@@ -102,11 +102,13 @@ pkgbase = obs-studio-tytan652
source = obs-studio::git+https://github.com/obsproject/obs-studio.git#tag=31.0.0
source = obs-browser::git+https://github.com/obsproject/obs-browser.git
source = obs-websocket::git+https://github.com/obsproject/obs-websocket.git
+ source = 001-opengl-avoid-allocate-0-byte.patch
source = bind_iface_eyeballed.patch
source = v4l2_by-path.patch
sha256sums = SKIP
sha256sums = SKIP
sha256sums = SKIP
+ sha256sums = 81680e20c3b517d051f738043079a58c8e8be516afaa7f4c5f9c5ec5f80bf026
sha256sums = 115d126c2a80b25beab359ee5cd753bde418836ff239a20c5d8a376a85373912
sha256sums = ee54b9c6f7e17fcc62c6afc094e65f18b2e97963c2fe92289b2b91972ac206e5
source_x86_64 = https://cdn-fastly.obsproject.com/downloads/cef_binary_6533_linux_x86_64.tar.xz
diff --git a/001-opengl-avoid-allocate-0-byte.patch b/001-opengl-avoid-allocate-0-byte.patch
new file mode 100644
index 000000000000..da66ced17253
--- /dev/null
+++ b/001-opengl-avoid-allocate-0-byte.patch
@@ -0,0 +1,90 @@
+From c3105a9ca5957b58da17e4d86ad82943c4ec3b12 Mon Sep 17 00:00:00 2001
+From: tytan652 <tytan652@tytanium.xyz>
+Date: Wed, 11 Dec 2024 08:45:40 +0100
+Subject: [PATCH] libobs-opengl: Avoid trying to allocate 0 byte on Linux
+
+---
+ libobs-opengl/gl-egl-common.c | 51 +++++++++++++++++++----------------
+ 1 file changed, 28 insertions(+), 23 deletions(-)
+
+diff --git a/libobs-opengl/gl-egl-common.c b/libobs-opengl/gl-egl-common.c
+index 8854e9d0c673a7..f6f696f698ca12 100644
+--- a/libobs-opengl/gl-egl-common.c
++++ b/libobs-opengl/gl-egl-common.c
+@@ -297,26 +297,28 @@ static inline bool is_implicit_dmabuf_modifiers_supported(void)
+ static inline bool query_dmabuf_formats(EGLDisplay egl_display, EGLint **formats, EGLint *num_formats)
+ {
+ EGLint max_formats = 0;
+- EGLint *format_list = NULL;
+
+ if (!glad_eglQueryDmaBufFormatsEXT(egl_display, 0, NULL, &max_formats)) {
+ blog(LOG_ERROR, "Cannot query the number of formats: %s", gl_egl_error_to_string(eglGetError()));
+ return false;
+ }
+
+- format_list = bzalloc(max_formats * sizeof(EGLint));
+- if (!format_list) {
+- blog(LOG_ERROR, "Unable to allocate memory");
+- return false;
+- }
++ if (max_formats != 0) {
++ EGLint *format_list = bzalloc(max_formats * sizeof(EGLint));
++ if (!format_list) {
++ blog(LOG_ERROR, "Unable to allocate memory");
++ return false;
++ }
+
+- if (!glad_eglQueryDmaBufFormatsEXT(egl_display, max_formats, format_list, &max_formats)) {
+- blog(LOG_ERROR, "Cannot query a list of formats: %s", gl_egl_error_to_string(eglGetError()));
+- bfree(format_list);
+- return false;
++ if (!glad_eglQueryDmaBufFormatsEXT(egl_display, max_formats, format_list, &max_formats)) {
++ blog(LOG_ERROR, "Cannot query a list of formats: %s", gl_egl_error_to_string(eglGetError()));
++ bfree(format_list);
++ return false;
++ }
++
++ *formats = format_list;
+ }
+
+- *formats = format_list;
+ *num_formats = max_formats;
+ return true;
+ }
+@@ -353,21 +355,24 @@ static inline bool query_dmabuf_modifiers(EGLDisplay egl_display, EGLint drm_for
+ return false;
+ }
+
+- EGLuint64KHR *modifier_list = bzalloc(max_modifiers * sizeof(EGLuint64KHR));
+- EGLBoolean *external_only = NULL;
+- if (!modifier_list) {
+- blog(LOG_ERROR, "Unable to allocate memory");
+- return false;
+- }
++ if (max_modifiers != 0) {
++ EGLuint64KHR *modifier_list = bzalloc(max_modifiers * sizeof(EGLuint64KHR));
++ EGLBoolean *external_only = NULL;
++ if (!modifier_list) {
++ blog(LOG_ERROR, "Unable to allocate memory");
++ return false;
++ }
+
+- if (!glad_eglQueryDmaBufModifiersEXT(egl_display, drm_format, max_modifiers, modifier_list, external_only,
+- &max_modifiers)) {
+- blog(LOG_ERROR, "Cannot query a list of modifiers: %s", gl_egl_error_to_string(eglGetError()));
+- bfree(modifier_list);
+- return false;
++ if (!glad_eglQueryDmaBufModifiersEXT(egl_display, drm_format, max_modifiers, modifier_list,
++ external_only, &max_modifiers)) {
++ blog(LOG_ERROR, "Cannot query a list of modifiers: %s", gl_egl_error_to_string(eglGetError()));
++ bfree(modifier_list);
++ return false;
++ }
++
++ *modifiers = modifier_list;
+ }
+
+- *modifiers = modifier_list;
+ *n_modifiers = (EGLuint64KHR)max_modifiers;
+ return true;
+ }
diff --git a/PKGBUILD b/PKGBUILD
index bdb50faa0ee6..64ae4e4a6948 100644
--- a/PKGBUILD
+++ b/PKGBUILD
@@ -4,7 +4,7 @@ _suffix=tytan652
pkgname="obs-studio-${_suffix}"
_pkgver=31.0.0
pkgver="${_pkgver//-/_}"
-pkgrel=2
+pkgrel=3
pkgdesc="Free and open source software for video recording and live streaming. With everything except service integrations. Plus my bind interface PR, and sometimes backported fixes"
arch=("x86_64" "aarch64")
url="https://github.com/obsproject/obs-studio"
@@ -112,6 +112,7 @@ source=(
"obs-studio::git+https://github.com/obsproject/obs-studio.git#tag=$_pkgver"
"obs-browser::git+https://github.com/obsproject/obs-browser.git"
"obs-websocket::git+https://github.com/obsproject/obs-websocket.git"
+ "001-opengl-avoid-allocate-0-byte.patch"
"bind_iface_eyeballed.patch" # Based on https://github.com/tytan652/obs-studio/commits/bind_iface_eyeballed2
"v4l2_by-path.patch" # https://patch-diff.githubusercontent.com/raw/obsproject/obs-studio/pull/3437.patch
)
@@ -121,6 +122,7 @@ sha256sums=(
"SKIP"
"SKIP"
"SKIP"
+ "81680e20c3b517d051f738043079a58c8e8be516afaa7f4c5f9c5ec5f80bf026"
"115d126c2a80b25beab359ee5cd753bde418836ff239a20c5d8a376a85373912"
"ee54b9c6f7e17fcc62c6afc094e65f18b2e97963c2fe92289b2b91972ac206e5"
)
@@ -140,6 +142,9 @@ prepare() {
## Mark log and titlebar version
sed -i "s|obs_get_version_string()|\"$_pkgver-$_suffix-$pkgrel\"|" UI/obs-app.cpp
+ ## libobs-opengl: Avoid trying to allocate 0 byte on Linux
+ patch -Np1 -i "$srcdir/001-opengl-avoid-allocate-0-byte.patch"
+
## Add network interface binding for RTMP on Linux (https://github.com/tytan652/obs-studio/commits/bind_iface_eyeballed)
patch -Np1 < "$srcdir/bind_iface_eyeballed.patch"
}