aboutsummaryrefslogtreecommitdiffstats
path: root/common/recipes-graphics/xorg-xserver/xserver-xf86-config_0.1.bbappend
blob: 57926ab066acc99dd786d873f7c56b80c76a5821 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
FILESEXTRAPATHS_prepend := "${THISDIR}/${PN}:"

# Additional options that you want
# to set in final xorg configuration.
# Convention is option,value. If there's
# no value requred simply skip just
# like DRI3.
AMDGPU_OPTS = "DRI3, TearFree,on"
RADEON_OPTS = ""

do_install_append_amdgpu () {
    if [ "${RT_KERNEL_AMD}" = "yes" ]; then
        sed -i -e 's/^\tDriver      "radeon"/\tDriver      "fbdev"/' ${D}/${sysconfdir}/X11/xorg.conf
        sed -i -e 's/^\tDriver      "amdgpu"/\tDriver      "fbdev"/' ${D}/${sysconfdir}/X11/xorg.conf
    else
        sed -i -e 's/^\tDriver      "radeon"/\tDriver      "amdgpu"/' ${D}/${sysconfdir}/X11/xorg.conf
        sed -i -e 's/^\tDriver      "fbdev"/\tDriver      "amdgpu"/' ${D}/${sysconfdir}/X11/xorg.conf
        set_xorg_opts "${AMDGPU_OPTS}"
    fi
}

do_install_append_radeon () {
    if [ "${RT_KERNEL_AMD}" = "yes" ]; then
        sed -i -e 's/^\tDriver      "radeon"/\tDriver      "fbdev"/' ${D}/${sysconfdir}/X11/xorg.conf
        sed -i -e 's/^\tDriver      "amdgpu"/\tDriver      "fbdev"/' ${D}/${sysconfdir}/X11/xorg.conf
    else
        sed -i -e 's/^\tDriver      "amdgpu"/\tDriver      "radeon"/' ${D}/${sysconfdir}/X11/xorg.conf
        sed -i -e 's/^\tDriver      "fbdev"/\tDriver      "radeon"/' ${D}/${sysconfdir}/X11/xorg.conf
        set_xorg_opts "${RADEON_OPTS}"
    fi
}

set_xorg_opts() {
    for opt_val in ${1}; do
        opt=$(echo ${opt_val} | cut -d',' -f1)
        val=$(echo ${opt_val} | cut -d',' -f2)
        if [ "${val}" = "" ]; then
            sed -i -e "/^\tIdentifier  \"Card0\"/i \\\tOption      \"${opt}\"" ${D}/${sysconfdir}/X11/xorg.conf
        else
            sed -i -e "/^\tIdentifier  \"Card0\"/i \\\tOption      \"${opt}\"     \"${val}\"" ${D}/${sysconfdir}/X11/xorg.conf
        fi
    done
}