]> code.ossystems Code Review - openembedded-core.git/commitdiff
mesa.inc: enable texture float for gallium
authorTrevor Woerner <twoerner@gmail.com>
Sun, 11 Jun 2017 19:43:50 +0000 (15:43 -0400)
committerRichard Purdie <richard.purdie@linuxfoundation.org>
Mon, 12 Jun 2017 14:04:12 +0000 (15:04 +0100)
Following the lead from Fedora (as suggested by Rob Clark) always enable
--enable-texture-float for all gallium drivers, but then modify the code to
not enable it, at runtime, where the implementation isn't backed by hardware.

The patch comes from unpacking fedora-25's mesa-17.0.5-3.fc25.src.rpm from
https://dl.fedoraproject.org/pub/fedora/linux/updates/25/SRPMS/m/

Somewhere along the path from OpenGL ES 2.0 to OpenGL ES 3.0 are some
algorithms that are encumbered by patents. These algorithms are enabled
with mesa's --enable-texture-float configure flag. However, if hardware
acceleration is being used and the hardware supports --enable-texture-float,
it means the hardware vendor has paid for the patents.

Note that with this solution, non-hardware gallium drivers (e.g. swrast) can't
--enable-texture-float, which might cause issues with some piglit tests.

This solution was discussed and agreed-to on the mailing list:
http://lists.openembedded.org/pipermail/openembedded-core/2017-May/137233.html

Signed-off-by: Trevor Woerner <twoerner@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
meta/recipes-graphics/mesa/files/0002-hardware-gloat.patch [new file with mode: 0644]
meta/recipes-graphics/mesa/mesa.inc
meta/recipes-graphics/mesa/mesa_17.1.1.bb

diff --git a/meta/recipes-graphics/mesa/files/0002-hardware-gloat.patch b/meta/recipes-graphics/mesa/files/0002-hardware-gloat.patch
new file mode 100644 (file)
index 0000000..0e014dc
--- /dev/null
@@ -0,0 +1,51 @@
+From 00bcd599310dc7fce4fe336ffd85902429051a0c Mon Sep 17 00:00:00 2001
+From: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+Date: Sun, 20 Mar 2016 13:27:04 +0100
+Subject: [PATCH 2/4] hardware gloat
+
+Upstream-Status: Inappropriate [not author]
+Signed-off-by: Igor Gnatenko <i.gnatenko.brain@gmail.com>
+---
+ src/gallium/drivers/llvmpipe/lp_screen.c | 7 +++++++
+ src/gallium/drivers/softpipe/sp_screen.c | 7 +++++++
+ 2 files changed, 14 insertions(+)
+
+diff --git a/src/gallium/drivers/llvmpipe/lp_screen.c b/src/gallium/drivers/llvmpipe/lp_screen.c
+index 4f61de8..3b0ec77 100644
+--- a/src/gallium/drivers/llvmpipe/lp_screen.c
++++ b/src/gallium/drivers/llvmpipe/lp_screen.c
+@@ -411,6 +411,13 @@ llvmpipe_is_format_supported( struct pipe_screen *_screen,
+    if (!format_desc)
+       return FALSE;
++   if ((bind & PIPE_BIND_RENDER_TARGET) &&
++       format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
++       format != PIPE_FORMAT_R11G11B10_FLOAT &&
++       util_format_is_float(format)) {
++      return FALSE;
++   }
++
+    assert(target == PIPE_BUFFER ||
+           target == PIPE_TEXTURE_1D ||
+           target == PIPE_TEXTURE_1D_ARRAY ||
+diff --git a/src/gallium/drivers/softpipe/sp_screen.c b/src/gallium/drivers/softpipe/sp_screen.c
+index 031602b..c279120 100644
+--- a/src/gallium/drivers/softpipe/sp_screen.c
++++ b/src/gallium/drivers/softpipe/sp_screen.c
+@@ -358,6 +358,13 @@ softpipe_is_format_supported( struct pipe_screen *screen,
+    if (!format_desc)
+       return FALSE;
++   if ((bind & PIPE_BIND_RENDER_TARGET) &&
++       format != PIPE_FORMAT_R9G9B9E5_FLOAT &&
++       format != PIPE_FORMAT_R11G11B10_FLOAT &&
++       util_format_is_float(format)) {
++      return FALSE;
++   }
++
+    if (sample_count > 1)
+       return FALSE;
+-- 
+2.7.4
+
index 014044f381cb75f034aa37732e93d77ede23559f..04285f209a4cd34baeeeac91000e98826d8fd015 100644 (file)
@@ -64,7 +64,7 @@ GALLIUMDRIVERS_LLVM = "r300,svga,nouveau${@',${GALLIUMDRIVERS_LLVM33}' if ${GALL
 GALLIUMDRIVERS_append_x86 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
 GALLIUMDRIVERS_append_x86-64 = "${@bb.utils.contains('PACKAGECONFIG', 'gallium-llvm', ',${GALLIUMDRIVERS_LLVM}', '', d)}"
 # keep --with-gallium-drivers separate, because when only one of gallium versions is enabled, other 2 were adding --without-gallium-drivers
-PACKAGECONFIG[gallium]      = "--with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
+PACKAGECONFIG[gallium]      = "--enable-texture-float --with-gallium-drivers=${GALLIUMDRIVERS}, --without-gallium-drivers"
 MESA_LLVM_RELEASE ?= "3.3"
 PACKAGECONFIG[gallium-llvm] = "--enable-gallium-llvm --enable-llvm-shared-libs, --disable-gallium-llvm, llvm${MESA_LLVM_RELEASE} \
                                ${@'elfutils' if ${GALLIUMDRIVERS_LLVM33_ENABLED} else ''}"
index 060a2790158b750167b8bf6e979f73e927d9466e..ff84015aeeaf7aa8332592e1346809a2ce63a732 100644 (file)
@@ -5,6 +5,7 @@ SRC_URI = "ftp://ftp.freedesktop.org/pub/mesa/mesa-${PV}.tar.xz \
            file://disable-asm-on-non-gcc.patch \
            file://0001-Use-wayland-scanner-in-the-path.patch \
            file://0001-util-rand_xor-add-missing-include-statements.patch \
+           file://0002-hardware-gloat.patch \
 "
 
 SRC_URI[md5sum] = "a4844bc6052578574f9629458bcbb749"