nixos: Move castle to home
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 42m12s
All checks were successful
CI / Check, build and cache Nix flake (push) Successful in 42m12s
This commit is contained in:
@@ -0,0 +1,83 @@
|
||||
From 7de73e0bb036ab1c0aa69170eec99fdddca92634 Mon Sep 17 00:00:00 2001
|
||||
From: Hamza Mahfooz <hamza.mahfooz@amd.com>
|
||||
Date: Thu, 6 Apr 2023 12:31:06 -0400
|
||||
Subject: [PATCH] drm/amd/display: fix flickering caused by S/G mode
|
||||
|
||||
Currently, we allow the framebuffer for a given plane to move between
|
||||
memory domains, however when that happens it causes the screen to
|
||||
flicker, it is even possible for the framebuffer to change memory
|
||||
domains on every plane update (causing a continuous flicker effect). So,
|
||||
to fix this, make it so that we always pin a plane's framebuffer to the
|
||||
same memory domain in dm_plane_helper_prepare_fb().
|
||||
|
||||
Fixes: 81d0bcf99009 ("drm/amdgpu: make display pinning more flexible (v2)")
|
||||
Signed-off-by: Hamza Mahfooz <hamza.mahfooz@amd.com>
|
||||
---
|
||||
.../amd/display/amdgpu_dm/amdgpu_dm_plane.c | 31 ++++++++++++++-----
|
||||
1 file changed, 23 insertions(+), 8 deletions(-)
|
||||
|
||||
diff --git a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
|
||||
index 322668973747..921b028d5b34 100644
|
||||
--- a/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
|
||||
+++ b/drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_plane.c
|
||||
@@ -826,9 +826,8 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
|
||||
struct drm_plane_state *new_state)
|
||||
{
|
||||
struct amdgpu_framebuffer *afb;
|
||||
- struct drm_gem_object *obj;
|
||||
struct amdgpu_device *adev;
|
||||
- struct amdgpu_bo *rbo;
|
||||
+ struct amdgpu_bo *abo, *rbo;
|
||||
struct dm_plane_state *dm_plane_state_new, *dm_plane_state_old;
|
||||
uint32_t domain;
|
||||
int r;
|
||||
@@ -839,8 +838,7 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
|
||||
}
|
||||
|
||||
afb = to_amdgpu_framebuffer(new_state->fb);
|
||||
- obj = new_state->fb->obj[0];
|
||||
- rbo = gem_to_amdgpu_bo(obj);
|
||||
+ rbo = gem_to_amdgpu_bo(new_state->fb->obj[0]);
|
||||
adev = amdgpu_ttm_adev(rbo->tbo.bdev);
|
||||
|
||||
r = amdgpu_bo_reserve(rbo, true);
|
||||
@@ -855,15 +853,32 @@ static int dm_plane_helper_prepare_fb(struct drm_plane *plane,
|
||||
goto error_unlock;
|
||||
}
|
||||
|
||||
- if (plane->type != DRM_PLANE_TYPE_CURSOR)
|
||||
- domain = amdgpu_display_supported_domains(adev, rbo->flags);
|
||||
- else
|
||||
+ if (plane->type == DRM_PLANE_TYPE_CURSOR)
|
||||
domain = AMDGPU_GEM_DOMAIN_VRAM;
|
||||
+ else {
|
||||
+ domain = amdgpu_display_supported_domains(adev, rbo->flags);
|
||||
+
|
||||
+ if (!plane->state->fb || rbo->tbo.pin_count ||
|
||||
+ !(domain & AMDGPU_GEM_DOMAIN_GTT))
|
||||
+ goto skip;
|
||||
+
|
||||
+ abo = gem_to_amdgpu_bo(plane->state->fb->obj[0]);
|
||||
+
|
||||
+ if (amdgpu_bo_reserve(abo, true) ||
|
||||
+ dma_resv_reserve_fences(abo->tbo.base.resv, 1))
|
||||
+ goto err;
|
||||
+
|
||||
+ domain = amdgpu_mem_type_to_domain(abo->tbo.resource->mem_type);
|
||||
+err:
|
||||
+ amdgpu_bo_unreserve(abo);
|
||||
+ }
|
||||
|
||||
+skip:
|
||||
r = amdgpu_bo_pin(rbo, domain);
|
||||
if (unlikely(r != 0)) {
|
||||
if (r != -ERESTARTSYS)
|
||||
- DRM_ERROR("Failed to pin framebuffer with error %d\n", r);
|
||||
+ drm_err(plane->dev,
|
||||
+ "failed to pin framebuffer with error %d\n", r);
|
||||
goto error_unlock;
|
||||
}
|
||||
|
||||
--
|
||||
2.40.0
|
||||
|
265
nixos/boxes/home/castle/default.nix
Normal file
265
nixos/boxes/home/castle/default.nix
Normal file
@@ -0,0 +1,265 @@
|
||||
{ lib, ... }:
|
||||
let
|
||||
inherit (lib.my) net;
|
||||
inherit (lib.my.c) networkd;
|
||||
inherit (lib.my.c.home) domain vlans prefixes vips roceBootModules;
|
||||
in
|
||||
{
|
||||
nixos.systems.castle = {
|
||||
system = "x86_64-linux";
|
||||
nixpkgs = "mine";
|
||||
home-manager = "mine";
|
||||
|
||||
assignments = {
|
||||
hi = {
|
||||
inherit domain;
|
||||
ipv4 = {
|
||||
address = net.cidr.host 40 prefixes.hi.v4;
|
||||
mask = 22;
|
||||
gateway = vips.hi.v4;
|
||||
};
|
||||
ipv6 = {
|
||||
iid = "::3:1";
|
||||
address = net.cidr.host (65536*3+1) prefixes.hi.v6;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
configuration = { lib, pkgs, modulesPath, config, systems, assignments, allAssignments, ... }:
|
||||
let
|
||||
inherit (lib) mkIf mkMerge mkForce;
|
||||
inherit (lib.my) mkVLAN networkdAssignment;
|
||||
in
|
||||
{
|
||||
hardware = {
|
||||
enableRedistributableFirmware = true;
|
||||
cpu = {
|
||||
amd.updateMicrocode = true;
|
||||
};
|
||||
opengl.extraPackages = with pkgs; [
|
||||
intel-media-driver
|
||||
];
|
||||
bluetooth.enable = true;
|
||||
};
|
||||
|
||||
boot = {
|
||||
loader = {
|
||||
efi.canTouchEfiVariables = false;
|
||||
timeout = 10;
|
||||
};
|
||||
kernelPackages = lib.my.c.kernel.latest pkgs;
|
||||
kernelModules = [ "kvm-amd" "dm-snapshot" ];
|
||||
kernelParams = [ "amd_iommu=on" "amd_pstate=passive" ];
|
||||
kernelPatches = [
|
||||
# {
|
||||
# # https://gitlab.freedesktop.org/drm/amd/-/issues/2354
|
||||
# name = "drm-amd-display-fix-flickering-caused-by-S-G-mode";
|
||||
# patch = ./0001-drm-amd-display-fix-flickering-caused-by-S-G-mode.patch;
|
||||
# }
|
||||
];
|
||||
initrd = {
|
||||
availableKernelModules = [
|
||||
"thunderbolt" "xhci_pci" "nvme" "ahci" "usbhid" "usb_storage" "sd_mod"
|
||||
"8021q"
|
||||
] ++ roceBootModules;
|
||||
systemd.network = {
|
||||
netdevs = mkVLAN "lan-hi" vlans.hi;
|
||||
networks = {
|
||||
"10-et100g" = {
|
||||
matchConfig.Name = "et100g";
|
||||
vlan = [ "lan-hi" ];
|
||||
linkConfig.RequiredForOnline = "no";
|
||||
networkConfig = networkd.noL3;
|
||||
};
|
||||
"20-lan-hi" = networkdAssignment "lan-hi" assignments.hi;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
fileSystems = {
|
||||
"/nix" = {
|
||||
device = "/dev/nvmeof/nix";
|
||||
fsType = "ext4";
|
||||
};
|
||||
"/persist" = {
|
||||
device = "/dev/nvmeof/persist";
|
||||
fsType = "ext4";
|
||||
neededForBoot = true;
|
||||
};
|
||||
|
||||
"/home" = {
|
||||
device = "/dev/nvmeof/home";
|
||||
fsType = "ext4";
|
||||
};
|
||||
};
|
||||
|
||||
security = { };
|
||||
|
||||
services = {
|
||||
hardware = {
|
||||
bolt.enable = true;
|
||||
};
|
||||
|
||||
lvm = {
|
||||
boot.thin.enable = true;
|
||||
dmeventd.enable = true;
|
||||
};
|
||||
fstrim.enable = true;
|
||||
|
||||
resolved = {
|
||||
enable = true;
|
||||
extraConfig = mkForce "";
|
||||
dnssec = "false";
|
||||
};
|
||||
|
||||
pipewire.extraConfig.pipewire = {
|
||||
"10-buffer"."context.properties" = {
|
||||
"default.clock.quantum" = 128;
|
||||
"default.clock.max-quantum" = 128;
|
||||
};
|
||||
};
|
||||
blueman.enable = true;
|
||||
};
|
||||
|
||||
programs = {
|
||||
virt-manager.enable = true;
|
||||
wireshark = {
|
||||
enable = true;
|
||||
package = pkgs.wireshark-qt;
|
||||
};
|
||||
};
|
||||
virtualisation.libvirtd.enable = true;
|
||||
|
||||
networking = {
|
||||
inherit domain;
|
||||
firewall.enable = false;
|
||||
};
|
||||
|
||||
environment.systemPackages = with pkgs; [
|
||||
dhcpcd
|
||||
pciutils
|
||||
usbutils
|
||||
lm_sensors
|
||||
linuxPackages.cpupower
|
||||
cifs-utils
|
||||
rpiboot
|
||||
rdma-core
|
||||
mstflint
|
||||
qperf
|
||||
ethtool
|
||||
];
|
||||
|
||||
nix = {
|
||||
gc.automatic = false;
|
||||
};
|
||||
|
||||
systemd = {
|
||||
network = {
|
||||
netdevs = mkMerge [
|
||||
(mkVLAN "lan-hi" vlans.hi)
|
||||
];
|
||||
links = {
|
||||
"10-et2.5g" = {
|
||||
matchConfig.MACAddress = "c8:7f:54:6e:17:0f";
|
||||
linkConfig.Name = "et2.5g";
|
||||
};
|
||||
"11-et10g" = {
|
||||
matchConfig.MACAddress = "c8:7f:54:6e:15:af";
|
||||
linkConfig.Name = "et10g";
|
||||
};
|
||||
"12-et100g" = {
|
||||
matchConfig.PermanentMACAddress = "24:8a:07:a8:fe:3a";
|
||||
linkConfig = {
|
||||
Name = "et100g";
|
||||
MTUBytes = toString lib.my.c.home.hiMTU;
|
||||
};
|
||||
};
|
||||
};
|
||||
networks = {
|
||||
"30-et100g" = {
|
||||
matchConfig.Name = "et100g";
|
||||
vlan = [ "lan-hi" ];
|
||||
networkConfig.IPv6AcceptRA = false;
|
||||
};
|
||||
"40-lan-hi" = mkMerge [
|
||||
(networkdAssignment "lan-hi" assignments.hi)
|
||||
# So we don't drop the IP we use to connect to NVMe-oF!
|
||||
{ networkConfig.KeepConfiguration = "static"; }
|
||||
];
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
my = {
|
||||
tmproot.size = "24G";
|
||||
|
||||
user = {
|
||||
config.extraGroups = [ "input" ];
|
||||
|
||||
tmphome = false;
|
||||
homeConfig = {
|
||||
services = { };
|
||||
|
||||
home = {
|
||||
packages = with pkgs; [
|
||||
jacktrip
|
||||
qpwgraph
|
||||
boardie
|
||||
];
|
||||
};
|
||||
|
||||
services = {
|
||||
blueman-applet.enable = true;
|
||||
};
|
||||
|
||||
wayland.windowManager.sway = {
|
||||
config = {
|
||||
output = {
|
||||
HDMI-A-1 = {
|
||||
transform = "270";
|
||||
position = "0 0";
|
||||
};
|
||||
DP-1 = {
|
||||
mode = "2560x1440@170Hz";
|
||||
subpixel = "bgr";
|
||||
position = "1440 560";
|
||||
};
|
||||
DP-2.position = "4000 560";
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
my = {
|
||||
gui = {
|
||||
standalone = true;
|
||||
manageGraphical = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
#deploy.generate.system.mode = "boot";
|
||||
secrets = {
|
||||
key = "ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIMlVuTzKObeaUuPocCF41IO/8X+443lzUJLuCIclt2vr";
|
||||
};
|
||||
netboot.client = {
|
||||
enable = true;
|
||||
};
|
||||
nvme = {
|
||||
uuid = "2230b066-a674-4f45-a1dc-f7727b3a9e7b";
|
||||
boot = {
|
||||
nqn = "nqn.2016-06.io.spdk:castle";
|
||||
address = "192.168.68.80";
|
||||
};
|
||||
};
|
||||
|
||||
firewall = {
|
||||
enable = false;
|
||||
};
|
||||
|
||||
gui.enable = true;
|
||||
};
|
||||
};
|
||||
};
|
||||
}
|
Reference in New Issue
Block a user