1
1
mirror of https://github.com/NixOS/mobile-nixos.git synced 2024-11-24 12:42:47 +03:00

msm-fb-handle: Adds quirk for msm_mdss_fb.

This commit is contained in:
Samuel Dionne-Riel 2018-07-06 19:53:57 -04:00
parent 931daa8404
commit 44ab8fe3ed
5 changed files with 75 additions and 10 deletions

View File

@ -23,6 +23,7 @@ in
{
mobile = mkIf cfg.qualcomm-msm8939.enable {
system.platform = "aarch64-linux";
quirks.qualcomm.msm-fb-handle.enable = true;
};
}
{

View File

@ -15,16 +15,37 @@ in
Use sparingly, it is better to patch software to flip buffers instead.
";
};
};
config.mobile.boot = mkIf cfg.msm-fb-refresher.enable {
stage-1 = {
extraUtils = with pkgs; [
msm-fb-refresher
];
initFramebuffer = ''
msm-fb-refresher --loop &
'';
quirks.qualcomm.msm-fb-handle.enable = mkOption {
type = types.bool;
default = false;
description = "
Enables use of `msm-fb-handle`.
This tool keeps a dummy handle open to the framebuffer, useful for msm_mdss
which clears and shuts display down when all handles are closed.
";
};
};
config.mobile.boot = mkMerge [
(mkIf cfg.msm-fb-handle.enable {
stage-1 = {
extraUtils = with pkgs; [
msm-fb-handle
];
initFramebuffer = ''
msm-fb-handle &
'';
};
})
(mkIf cfg.msm-fb-refresher.enable {
stage-1 = {
extraUtils = with pkgs; [
msm-fb-refresher
];
initFramebuffer = ''
msm-fb-refresher --loop &
'';
};
})
];
}

View File

@ -0,0 +1,24 @@
{stdenv}:
let
version = "0.1";
in
stdenv.mkDerivation {
inherit version;
name = "msm-fb-handle";
src = ./main.c;
unpackCmd = "mkdir -v src ; cp -v $curSrc src/main.c";
CC = "${stdenv.cc}/bin/gcc";
buildPhase = ''
$CC main.c -o msm-fb-handle
'';
installPhase = ''
mkdir -p $out/bin
cp -v msm-fb-handle $out/bin/
chmod +x $out/bin/*
'';
}

View File

@ -0,0 +1,18 @@
#include <fcntl.h>
#include <unistd.h>
#include <assert.h>
#include <sys/ioctl.h>
#include <sys/resource.h>
#include <linux/fb.h>
int main(int argc, char *argv[])
{
int fd = open("/dev/fb0", O_RDWR);
setpriority(PRIO_PROCESS, 0, 19);
assert(fd >= 0);
while(1) {
sleep(360000);
}
close(fd);
return 0;
}

View File

@ -10,6 +10,7 @@ in
hard-reboot = callPackage ./misc/hard-reboot.nix { };
mkbootimg = callPackage ./mkbootimg { };
msm-fb-refresher = callPackage ./msm-fb-refresher { };
msm-fb-handle = callPackage ./msm-fb-handle { };
ply-image = callPackage ./ply-image { };
# Extra "libs"