From 8c2e5a898dbba13461f4425ae49bfbed8acd539d Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sat, 19 May 2018 13:33:32 -0700 Subject: [PATCH 1/4] config/graphic: reset variables when calling get_graphicsdrivers() --- config/graphic | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/config/graphic b/config/graphic index 2cce84534a..adbb3af3a7 100644 --- a/config/graphic +++ b/config/graphic @@ -11,6 +11,16 @@ else fi get_graphicdrivers() { + + # set defaults + GALLIUM_DRIVERS="" + DRI_DRIVERS="" + XORG_DRIVERS="" + LLVM_SUPPORT="no" + COMPOSITE_SUPPORT="no" + VDPAU_SUPPORT="no" + VAAPI_SUPPORT="no" + if [ "$GRAPHIC_DRIVERS" = "all" ]; then GRAPHIC_DRIVERS="i915 i965 r200 r300 r600 radeonsi nvidia nvidia-legacy vmware virtio vc4" fi From b93b40f09264a6ebd9de04519e3e3e6719e6c6c3 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sun, 20 May 2018 20:10:27 -0700 Subject: [PATCH 2/4] config/graphic: remove leading comma in variables --- config/graphic | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/config/graphic b/config/graphic index adbb3af3a7..4d7b999aba 100644 --- a/config/graphic +++ b/config/graphic @@ -98,5 +98,9 @@ get_graphicdrivers() { VDPAU_SUPPORT="no" fi + # remove leading comma if present + [[ $GALLIUM_DRIVERS =~ ^, ]] && GALLIUM_DRIVERS="${GALLIUM_DRIVERS:1}" + [[ $DRI_DRIVERS =~ ^, ]] && DRI_DRIVERS="${DRI_DRIVERS:1}" + done } From 32a7930b9aa6fc54ab588dbdf6b7fd3e1bd5db83 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sun, 20 May 2018 20:11:55 -0700 Subject: [PATCH 3/4] config/graphic: optimize get_graphicsdrivers by removing for loop --- config/graphic | 127 ++++++++++++++++++++++++------------------------- 1 file changed, 62 insertions(+), 65 deletions(-) diff --git a/config/graphic b/config/graphic index 4d7b999aba..69c0149a14 100644 --- a/config/graphic +++ b/config/graphic @@ -25,82 +25,79 @@ get_graphicdrivers() { GRAPHIC_DRIVERS="i915 i965 r200 r300 r600 radeonsi nvidia nvidia-legacy vmware virtio vc4" fi - for drv in $GRAPHIC_DRIVERS; do - if [ "$drv" = "i915" ]; then - DRI_DRIVERS="$DRI_DRIVERS,i915" - XORG_DRIVERS="$XORG_DRIVERS intel" - COMPOSITE_SUPPORT="yes" - VAAPI_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "i915"; then + DRI_DRIVERS="$DRI_DRIVERS,i915" + XORG_DRIVERS="$XORG_DRIVERS intel" + COMPOSITE_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi - if [ "$drv" = "i965" ]; then - DRI_DRIVERS="$DRI_DRIVERS,i965" - XORG_DRIVERS="$XORG_DRIVERS intel" - COMPOSITE_SUPPORT="yes" - VAAPI_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "i965"; then + DRI_DRIVERS="$DRI_DRIVERS,i965" + XORG_DRIVERS="$XORG_DRIVERS intel" + COMPOSITE_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi - if [ "$drv" = "nvidia" ]; then - XORG_DRIVERS="$XORG_DRIVERS nvidia" - VDPAU_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "nvidia"; then + XORG_DRIVERS="$XORG_DRIVERS nvidia" + VDPAU_SUPPORT="yes" + fi - if [ "$drv" = "nvidia-legacy" ]; then - XORG_DRIVERS="$XORG_DRIVERS nvidia-legacy" - VDPAU_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "nvidia-legacy"; then + XORG_DRIVERS="$XORG_DRIVERS nvidia-legacy" + VDPAU_SUPPORT="yes" + fi - if [ "$drv" = "r200" ]; then - DRI_DRIVERS="$DRI_DRIVERS,r200" - XORG_DRIVERS="$XORG_DRIVERS ati" - COMPOSITE_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "r200"; then + DRI_DRIVERS="$DRI_DRIVERS,r200" + XORG_DRIVERS="$XORG_DRIVERS ati" + COMPOSITE_SUPPORT="yes" + fi - if [ "$drv" = "r300" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r300" - XORG_DRIVERS="$XORG_DRIVERS ati" - LLVM_SUPPORT="yes" - COMPOSITE_SUPPORT="yes" - VDPAU_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "r300"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r300" + XORG_DRIVERS="$XORG_DRIVERS ati" + LLVM_SUPPORT="yes" + COMPOSITE_SUPPORT="yes" + VDPAU_SUPPORT="yes" + fi - if [ "$drv" = "r600" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r600" - XORG_DRIVERS="$XORG_DRIVERS ati" - LLVM_SUPPORT="yes" - COMPOSITE_SUPPORT="yes" - VDPAU_SUPPORT="yes" - VAAPI_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "r600"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,r600" + XORG_DRIVERS="$XORG_DRIVERS ati" + LLVM_SUPPORT="yes" + COMPOSITE_SUPPORT="yes" + VDPAU_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi - if [ "$drv" = "radeonsi" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,radeonsi" - XORG_DRIVERS="$XORG_DRIVERS ati amdgpu" - LLVM_SUPPORT="yes" - COMPOSITE_SUPPORT="yes" - VDPAU_SUPPORT="yes" - VAAPI_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "radeonsi"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,radeonsi" + XORG_DRIVERS="$XORG_DRIVERS ati amdgpu" + LLVM_SUPPORT="yes" + COMPOSITE_SUPPORT="yes" + VDPAU_SUPPORT="yes" + VAAPI_SUPPORT="yes" + fi - if [ "$drv" = "vmware" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,svga" - XORG_DRIVERS="$XORG_DRIVERS vmware" - COMPOSITE_SUPPORT="yes" - fi + if listcontains "$GRAPHIC_DRIVERS" "vmware"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,svga" + XORG_DRIVERS="$XORG_DRIVERS vmware" + COMPOSITE_SUPPORT="yes" + fi - if [ "$drv" = "virtio" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,virgl" - fi + if listcontains "$GRAPHIC_DRIVERS" "virtio"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,virgl" + fi - if [ "$drv" = "vc4" ]; then - GALLIUM_DRIVERS="$GALLIUM_DRIVERS,vc4" - VAAPI_SUPPORT="no" - VDPAU_SUPPORT="no" - fi + if listcontains "$GRAPHIC_DRIVERS" "vc4"; then + GALLIUM_DRIVERS="$GALLIUM_DRIVERS,vc4" + VAAPI_SUPPORT="no" + VDPAU_SUPPORT="no" + fi - # remove leading comma if present + # remove leading comma if present [[ $GALLIUM_DRIVERS =~ ^, ]] && GALLIUM_DRIVERS="${GALLIUM_DRIVERS:1}" [[ $DRI_DRIVERS =~ ^, ]] && DRI_DRIVERS="${DRI_DRIVERS:1}" - - done } From e23f0cb5f21f8308801520bd519455494ec62ee7 Mon Sep 17 00:00:00 2001 From: Lukas Rusak Date: Sun, 20 May 2018 21:15:42 -0700 Subject: [PATCH 4/4] config/graphic: remove duplicate entries in XORG_DRIVERS variable --- config/graphic | 3 +++ 1 file changed, 3 insertions(+) diff --git a/config/graphic b/config/graphic index 69c0149a14..4af039f6e4 100644 --- a/config/graphic +++ b/config/graphic @@ -100,4 +100,7 @@ get_graphicdrivers() { # remove leading comma if present [[ $GALLIUM_DRIVERS =~ ^, ]] && GALLIUM_DRIVERS="${GALLIUM_DRIVERS:1}" [[ $DRI_DRIVERS =~ ^, ]] && DRI_DRIVERS="${DRI_DRIVERS:1}" + + # remove duplicate entries + XORG_DRIVERS="$(echo $XORG_DRIVERS | xargs -n1 | sort -u | xargs)" }