Add xorg.conf.d snippet for intel graphics

TODO: load edid early within initramfs
This commit is contained in:
Alexander Grothe 2019-01-07 21:38:30 +01:00
parent a4dcadabcf
commit 8b885221ae
3 changed files with 90 additions and 8 deletions

View File

@ -17,13 +17,21 @@
#+LATEX_HEADER: \usepackage[margin=3.0cm]{geometry}
#+LATEX_HEADER: \usepackage[ngerman]{babel}
#+LATEX_HEADER: \usepackage{palatino}
#+LATEX_HEADER: \renewcommand*\ttdefault{cmvtt}
#+LATEX_HEADER: \usepackage{inconsolata}
# #+LATEX_HEADER: \renewcommand*\ttdefault{pcr}
#+LATEX_HEADER: \usepackage{rotating}
#+LATEX_HEADER: \usepackage{paralist}
#+LATEX_HEADER: \usepackage{booktabs}
#+LATEX_HEADER: \usepackage{titlesec}
#+LATEX_HEADER: \usepackage[locale=DE,seperr,repeatunits=true,trapambigerr=false,tophrase={{ bis }}]{siunitx}
#+LATEX_HEADER: \usemintedstyle{lovelace}
#+LATEX_HEADER: \lstset{basicstyle=\ttfamily, columns=fullflexible, frame=single, breaklines=true, postbreak=\mbox{\textcolor{red}{$\hookrightarrow$}\space},
#+LATEX_HEADER: xleftmargin=17pt,
#+LATEX_HEADER: framexleftmargin=17pt,
#+LATEX_HEADER: framexrightmargin=5pt,
#+LATEX_HEADER: framexbottommargin=4pt,
#+LATEX_HEADER: breakatwhitespace=true,
#+LATEX_HEADER: }
#+LATEX: \defaultfontfeatures{Ligatures=TeX}
#+LATEX_HEADER: \usepackage{parskip}
# #+LATEX_HEADER_EXTRA:
@ -2562,12 +2570,19 @@ preferred_refreshrates:
when:
- nvidia_detected
- name: intel xorg config snippet
template:
src: templates/20-intel.conf.j2
dest: /etc/X11/xorg.conf.d/20-intel.conf
when:
- intel_detected
#+END_SRC
**** intel.yml
:PROPERTIES:
:ID: 0b27229f-3cb1-4b30-bd91-b173c40e7d0c
:END:
KMS drivers (like for intel (i915) and amd (radeon)) require additional configuration beneath a customized ~xorg.conf~ - for a "static" output configuration (which works if the TV or AV receiver is not turned on) we need to force loading the display(s) EDID early during the boot process.
KMS drivers (like for intel (i915) and amd (radeon)) require additional configuration besides a customized ~xorg.conf~ - for a "static" output configuration (which works if the TV or AV receiver is not turned on) we need to force loading the display(s) EDID early during the boot process.
This task therefore performs the following actions after the xrandr detection has been executed:
- create an initramfs-hook to copy the EDID(s) into the initramfs
@ -2576,6 +2591,8 @@ This task therefore performs the following actions after the xrandr detection ha
- recreate and update initramfs and grub config
Please note that rescanning the connected displays works only after removing the forced loading of EDID(s) during boot (call ~clean-edids~) and a reboot.
#+CAPTION: roles/yavdr-xorg/tasks/intel.yml
#+BEGIN_SRC yaml :tangle roles/yavdr-xorg/tasks/intel.yml :mkdirp yes :padline no
- name: "create initramfs hook to copy EDID files"
copy:
@ -2611,7 +2628,6 @@ template:
{{ ansible_managed | comment }}
{% set output_flag = 'D' if ("HDMI" in xorg.primary.connector or "DVI" in xorg.primary.connector or "DP" in xorg.primary.connector) else 'e' %}
GRUB_CMDLINE_LINUX+=" video={{ drm.primary.drm_connector }}:{{ xorg.primary.mode|replace('_', '@') }}{{ output_flag }} drm.edid_firmware={{ drm.primary.drm_connector }}:edid/{{ drm.primary.edid }} {% for ignored_c in drm.ignored_outputs %}video={{ ignored_c }}:d{% endfor %}"
# TODO: configure additional monitors (primary monitor on, all others off)
#+END_SRC
**** xorg
:PROPERTIES:
@ -2692,7 +2708,7 @@ Section "Device"
Option "TearFree" "true"
Option "UseEDID" "true"
Option "CustomEDID" "{{ output }}:/lib/firmware/edid/edid.{{ xorg.primary.connector }}.bin"
Option "CustomEDID" "{{ output }}:{{ xorg.primary.edid }}"
EndSection
Section "Screen"
Identifier "Screen0"
@ -2701,23 +2717,34 @@ Section "Screen"
DefaultDepth 24
SubSection "Display"
Depth 24
{% if xorg.primary.mode %}
Modes {{ xorg.primary.mode }}
{% else %}
Modes "1920x1080_50" "1920x1080_60" "1920x1080_24"
{% endif %}
EndSubSection
EndSection
Section "Monitor"
Identifier "{{ output }}"
{% if xorg.primary.modelines %}
{% for modeline in xorg.primary.modelines %}
{{ modeline }}
{% endfor %}
{% else %}
Modeline "1920x1080_24" 74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_50" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_60" 148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
{% endif %}
EndSection
{% for connector, data in xrandr["Screen 0"].iteritems() %}
{% if not data.is_connected %}
{% for connector, data in xrandr["Screen 0:"].iteritems() %}
{% if not data.is_connected or connector != xorg.primary.connector %}
Section "Monitor"
Identifier "{{ connector|replace("-","") }}"
Option "Ignore" "true"
EndSection
{% endif %}
{% endfor %}
#+END_SRC
***** xorg.conf
@ -3062,9 +3089,9 @@ EnvironmentFile=-/var/lib/vdr/.session-env
:PROPERTIES:
:ID: 41434b9a-1580-4214-ba40-0e11e00ca82a
:END:
#+BEGIN_SRC shell :tangle roles/yavdr-xorg/files/cp-edid-data.sh
#+BEGIN_SRC jinja2 :tangle roles/yavdr-xorg/files/cp-edid-data.sh
#!/bin/bash
# Created by yavdr-ansible.
{{ ansible_managed | comment }}
# This hook copies EDID files with the naming scheme "edid.${OUTPUT}.bin" to the initramfs.
[ "$1" = "prereqs" ] && { echo "udev"; exit 0; }

View File

@ -160,3 +160,10 @@
backup: yes
when:
- nvidia_detected
- name: intel xorg config snippet
template:
src: templates/20-intel.conf.j2
dest: /etc/X11/xorg.conf.d/20-intel.conf
when:
- intel_detected

View File

@ -0,0 +1,48 @@
{{ ansible_managed | comment }}
{% set output = xorg.primary.connector|replace("-", "") %}
Section "Device"
Identifier "Device0"
Driver "intel"
Option "TearFree" "true"
Option "UseEDID" "true"
Option "CustomEDID" "{{ output }}:{{ xorg.primary.edid }}"
EndSection
Section "Screen"
Identifier "Screen0"
Device "Device0"
Monitor "{{ output }}"
DefaultDepth 24
SubSection "Display"
Depth 24
{% if xorg.primary.mode %}
Modes {{ xorg.primary.mode }}
{% else %}
Modes "1920x1080_50" "1920x1080_60" "1920x1080_24"
{% endif %}
EndSubSection
EndSection
Section "Monitor"
Identifier "{{ output }}"
{% if xorg.primary.modelines %}
{% for modeline in xorg.primary.modelines %}
{{ modeline }}
{% endfor %}
{% else %}
Modeline "1920x1080_24" 74.230 1920 2560 2604 2752 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_50" 148.500 1920 2448 2492 2640 1080 1084 1089 1125 +hsync +vsync
Modeline "1920x1080_60" 148.500 1920 2008 2056 2200 1080 1084 1089 1125 +hsync +vsync
{% endif %}
EndSection
{% for connector, data in xrandr["Screen 0:"].iteritems() %}
{% if not data.is_connected or connector != xorg.primary.connector %}
Section "Monitor"
Identifier "{{ connector|replace("-","") }}"
Option "Ignore" "true"
EndSection
{% endif %}
{% endfor %}