From da9180838fdc1e426b7f7b4683f87e68b92b7f5a Mon Sep 17 00:00:00 2001 From: Anton Midyukov Date: Tue, 8 Sep 2020 16:04:55 +0700 Subject: [PATCH] drm, plymouth, stage2, x11: initial feature drm The drm feature solves the problem of creating a common entry point for adding kernel drm modules for different package lists. The need for allocation into a separate feature arose from one parties to the need to make a switch between free and proprietary NVIDIA driver, on the other, because of the need to add only drm modules kernels for purposes such as use/stage2/kms and use/plymouth. Also no more switch needed for RADEON, as only the free video driver remains. --- features.in/drm/README | 7 +++ features.in/drm/config.mk | 50 +++++++++++++++++++ features.in/plymouth/config.mk | 4 +- features.in/stage2/config.mk | 8 +-- .../stage2/stage1/modules.d/50-stage2-nvidia | 1 + features.in/x11/config.mk | 36 ++++++------- 6 files changed, 83 insertions(+), 23 deletions(-) create mode 100644 features.in/drm/README create mode 100644 features.in/drm/config.mk create mode 100644 features.in/stage2/stage1/modules.d/50-stage2-nvidia diff --git a/features.in/drm/README b/features.in/drm/README new file mode 100644 index 00000000..e365536f --- /dev/null +++ b/features.in/drm/README @@ -0,0 +1,7 @@ +Фича drm решает задачу создания общей точки входа для +добавления drm-модулей ядра для разных списков пакетов. +Потребность выделения в отдельную фичу возникла с одной +стороны в связи с необходимостью сделать переключатель +между свободным и проприетарным драйвером NVIDIA, +с другой из-за необходимости добавлять только drm-модули +ядра в таких целях, как use/stage2/kms и use/plymouth. diff --git a/features.in/drm/config.mk b/features.in/drm/config.mk new file mode 100644 index 00000000..60228c92 --- /dev/null +++ b/features.in/drm/config.mk @@ -0,0 +1,50 @@ +use/drm: + @$(call add_feature) + @$(call add,DRM_KMODULES,drm) + @$(call add,THE_KMODULES,$$(DRM_KMODULES)) + +use/drm/ancient: use/drm + @$(call add,DRM_KMODULES,drm-ancient) + +use/drm/radeon: use/drm + @$(call add,DRM_KMODULES,drm-radeon) + +use/drm/nouveau: use/drm + @$(call try,NVIDIA_KMODULES,drm-nouveau) + @$(call add,DRM_KMODULES,$$(NVIDIA_KMODULES)) + +use/drm/nvidia:: use/drm/nouveau; @: +use/drm/nvidia/optimus:: use/drm/nvidia; @: + +ifeq (,$(filter-out i586 x86_64 aarch64,$(ARCH))) +use/drm/nvidia:: + @$(call set,NVIDIA_KMODULES,nvidia) + +use/drm/nvidia/optimus:: + @$(call add,NVIDIA_KMODULES,bbswitch) +endif + +use/drm/full: use/drm/ancient use/drm/radeon \ + use/drm/nouveau; @: + +use/drm/stage2: + @$(call add,STAGE1_DRM_KMODULES,drm) + @$(call add,STAGE1_KMODULES,$$(STAGE1_DRM_KMODULES)) + +use/drm/stage2/ancient: use/drm/stage2 + @$(call add,STAGE1_DRM_KMODULES,drm-ancient) + +use/drm/stage2/radeon: use/drm/stage2 + @$(call add,STAGE1_DRM_KMODULES,drm-radeon) + +use/drm/stage2/nouveau: use/drm/stage2 + @$(call try,STAGE1_NVIDIA_KMODULES,drm-nouveau) + @$(call add,STAGE1_DRM_KMODULES,$$(STAGE1_NVIDIA_KMODULES)) + +use/drm/stage2/nvidia: use/drm/stage2/nouveau; @: +ifeq (,$(filter-out i586 x86_64 aarch64,$(ARCH))) + @$(call set,STAGE1_NVIDIA_KMODULES,nvidia) +endif + +use/drm/stage2/full: use/drm/stage2/ancient use/drm/stage2/radeon \ + use/drm/stage2/nouveau; @: diff --git a/features.in/plymouth/config.mk b/features.in/plymouth/config.mk index ea6e541b..8d71f7f6 100644 --- a/features.in/plymouth/config.mk +++ b/features.in/plymouth/config.mk @@ -36,12 +36,12 @@ else use/plymouth/vm: use/plymouth; @: endif -use/plymouth/base: use/plymouth/stage2 use/plymouth/vm +use/plymouth/base: use/plymouth/stage2 use/plymouth/vm \ + use/drm/full; @: ifeq (distro,$(IMAGE_CLASS)) @$(call add,INSTALL2_PACKAGES,installer-feature-setup-plymouth) endif @$(call add,BASE_PACKAGES_REGEXP,make-initrd-plymouth cpio) - @$(call add,BASE_KMODULES_REGEXP,drm.*) @$(call add,THE_BRANDING,bootsplash) @$(call add,THE_PACKAGES,make-initrd-plymouth) diff --git a/features.in/stage2/config.mk b/features.in/stage2/config.mk index e5d958e6..b28c7a26 100644 --- a/features.in/stage2/config.mk +++ b/features.in/stage2/config.mk @@ -11,7 +11,7 @@ use/stage2: sub/stage1 use/stage2/ata use/stage2/drm use/stage2/fs use/stage2/hid use/stage2/md \ use/stage2/mmc use/stage2/net use/stage2/net-cifs use/stage2/net-nfs \ use/stage2/pcmcia use/stage2/rtc use/stage2/scsi use/stage2/usb \ - use/stage2/virtio: \ + use/stage2/virtio use/stage2/nvidia: \ use/stage2/%: use/stage2 @$(call add,STAGE1_MODLISTS,stage2-$*) @@ -21,8 +21,10 @@ ifeq (,$(filter-out aarch64,$(ARCH))) endif @: -use/stage2/kms: use/stage2/drm - @$(call add,STAGE1_KMODULES_REGEXP,drm.*) +use/stage2/kms: use/stage2/drm use/drm/stage2/full; @: + +use/stage2/kms/nvidia: use/stage2/kms use/stage2/nvidia \ + use/drm/stage2/nvidia; @: # install mount.cifs to stage1 # NB: there's builtin nfsmount there, no reason for nfs-utils diff --git a/features.in/stage2/stage1/modules.d/50-stage2-nvidia b/features.in/stage2/stage1/modules.d/50-stage2-nvidia new file mode 100644 index 00000000..c06a2d90 --- /dev/null +++ b/features.in/stage2/stage1/modules.d/50-stage2-nvidia @@ -0,0 +1 @@ +nVidia diff --git a/features.in/x11/config.mk b/features.in/x11/config.mk index 379121e0..357fd897 100644 --- a/features.in/x11/config.mk +++ b/features.in/x11/config.mk @@ -5,19 +5,16 @@ ## hardware support # the very minimal driver set -use/x11: +use/x11: use/drm @$(call add_feature) @$(call add,THE_LISTS,$(call tags,base xorg)) - @$(call add,THE_KMODULES,drm) # required by recent nvidia.ko as well - @$(call add,THE_KMODULES,$$(NVIDIA_KMODULES) $$(RADEON_KMODULES)) - @$(call add,THE_PACKAGES,$$(NVIDIA_PACKAGES) $$(RADEON_PACKAGES)) use/x11/xorg:: use/x11 use/x11/armsoc; @: # x86: free drivers for various hardware (might lack acceleration) ifeq (,$(filter-out i586 x86_64 aarch64,$(ARCH))) use/x11/xorg:: use/x11/intel use/x11/nouveau use/x11/radeon use/x11/amdgpu \ - use/x11/armsoc + use/drm/full @$(call add,THE_LISTS,$(call tags,desktop xorg)) endif @@ -38,7 +35,7 @@ endif ifeq (,$(filter-out e2k%,$(ARCH))) # e2k: mostly radeon, 101 got mga2/vivante -use/x11/xorg:: use/x11/radeon use/x11/amdgpu use/x11/nouveau +use/x11/xorg:: use/x11/radeon use/x11/amdgpu use/x11/nouveau use/drm/full ifeq (,$(filter-out e2kv4,$(ARCH))) use/x11/mga2: use/x11 @@ -59,18 +56,18 @@ endif use/x11/3d: use/x11/intel use/x11/nvidia/optimus use/x11/radeon; @: # somewhat lacking compared to radeon but still -use/x11/nouveau: use/x11 use/firmware - @$(call set,NVIDIA_KMODULES,drm-nouveau) - @$(call set,NVIDIA_PACKAGES,xorg-drv-nouveau) +use/x11/nouveau: use/x11 use/firmware use/drm/nouveau + @$(call try,NVIDIA_PACKAGES,xorg-drv-nouveau) + @$(call add,THE_PACKAGES,$$(NVIDIA_PACKAGES)) # has performance problems but is getting better, just not there yet -use/x11/radeon: use/x11 use/firmware - @$(call set,RADEON_KMODULES,drm-radeon) - @$(call add,RADEON_PACKAGES,xorg-drv-ati xorg-drv-radeon) +use/x11/radeon: use/x11 use/firmware use/drm/radeon + @$(call try,RADEON_PACKAGES,xorg-drv-ati xorg-drv-radeon) + @$(call add,THE_PACKAGES,$$(RADEON_PACKAGES)) # here's the future use/x11/amdgpu: use/x11 use/firmware - @$(call add,RADEON_PACKAGES,xorg-drv-amdgpu) + @$(call add,THE_PACKAGES,xorg-drv-amdgpu) # Vulkan is new and bleeding edge, only intel and amgpu(pro?) use/x11/vulkan: use/x11/intel use/x11/amdgpu @@ -82,13 +79,16 @@ use/x11/glvnd: use/x11 @$(call add,THE_PACKAGES,libglvnd-glx,libglvnd-egl) # sometimes broken with current xorg-server -use/x11/nvidia: use/x11 - @$(call set,NVIDIA_KMODULES,nvidia) +use/x11/nvidia:: use/x11/nouveau; @: +use/x11/nvidia/optimus:: use/x11/nvidia; @: + +ifeq (,$(filter-out i586 x86_64 aarch64,$(ARCH))) +use/x11/nvidia:: use/drm/nvidia @$(call set,NVIDIA_PACKAGES,nvidia-settings nvidia-xconfig) -use/x11/nvidia/optimus: use/x11/nvidia - @$(call add,THE_KMODULES,bbswitch) - @$(call add,THE_PACKAGES,bumblebee primus) +use/x11/nvidia/optimus:: use/drm/nvidia/optimus + @$(call add,NVIDIA_PACKAGES,bumblebee primus) +endif use/x11/wacom: use/x11 @$(call add,THE_PACKAGES,xorg-drv-wacom)