From 33b7e8f777727b2e53365b2dbd355a665c51501e Mon Sep 17 00:00:00 2001 From: Mattias Andrée Date: Wed, 12 Mar 2014 02:07:48 +0100 Subject: begin on drm support MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Mattias Andrée --- .gitignore | 1 + DEPENDENCIES | 2 ++ Makefile | 8 +++++++- dist/archlinux/stable/PKGBUILD | 4 ++-- src/blueshift_drm_c.c | 44 ++++++++++++++++++++++++++++++++++++++++++ 5 files changed, 56 insertions(+), 3 deletions(-) create mode 100644 src/blueshift_drm_c.c diff --git a/.gitignore b/.gitignore index 1b54c21..1c47f6c 100644 --- a/.gitignore +++ b/.gitignore @@ -18,6 +18,7 @@ obj/ __pycache__/ /src/blueshift_randr.c /src/blueshift_vidmode.c +/src/blueshift_drm.c *.info *.pdf *.dvi diff --git a/DEPENDENCIES b/DEPENDENCIES index cffcbe9..bbddafb 100644 --- a/DEPENDENCIES +++ b/DEPENDENCIES @@ -4,6 +4,7 @@ RUNTIME DEPENDENCIES: libxcb (opt-out, for randr, crtc identification and icc profile listing) libx11 (opt-out, for vidmode) libxxf86vm (opt-out, for vidmode) + libdrm (opt-out, for drm) adjbacklight (optional, for permission-hasslefree backlight adjustments) linux (optional, for backlight support) argparser-python (https://github.com/maandree/argparser) @@ -17,6 +18,7 @@ MAKE DEPENDENCIES: libxcb (opt-out, for randr, crtc identification and icc profile listing) libx11 (opt-out, for vidmode) libxxf86vm (opt-out, for vidmode) + libdrm (opt-out, for drm) make coreutils sed diff --git a/Makefile b/Makefile index 0536c74..bdc5bdd 100644 --- a/Makefile +++ b/Makefile @@ -39,7 +39,7 @@ PKGNAME ?= blueshift # Bindings for display server access SERVER_BINDINGS ?= randr vidmode # Executable bindings for display server access -EXECS ?= idcrtc iccprofile +EXECS ?= idcrtc iccprofile drm # Executable library files EXECLIBS = $(foreach E,$(EXECS),blueshift_$(E)) @@ -55,6 +55,7 @@ LIBS_idcrtc = xcb-randr LIBS_iccprofile = xcb LIBS_randr = xcb-randr LIBS_vidmode = x11 xxf86vm +LIBS_drm = libdrm LIBS = python3 $(foreach B,$(SERVER_BINDINGS) $(EXECS),$(LIBS_$(B))) FLAGS = $$($(PKGCONFIG) --cflags $(LIBS)) -std=$(STD) $(WARN) $(OPTIMISE) -fPIC $(CFLAGS) $(LDFLAGS) $(CPPFLAGS) @@ -94,6 +95,11 @@ bin/blueshift_iccprofile: obj/blueshift_iccprofile.o @mkdir -p bin $(CC) $(FLAGS) $$($(PKGCONFIG) --libs $($(LIBS_))) -o $@ $^ +bin/blueshift_drm: LIBS_=LIBS_drm +bin/blueshift_drm: obj/blueshift_drm_c.o + @mkdir -p bin + $(CC) $(FLAGS) $$($(PKGCONFIG) --libs $($(LIBS_))) -o $@ $^ + bin/blueshift_randr.so: LIBS_=LIBS_randr bin/blueshift_vidmode.so: LIBS_=LIBS_vidmode bin/%.so: obj/%.o obj/%_c.o diff --git a/dist/archlinux/stable/PKGBUILD b/dist/archlinux/stable/PKGBUILD index f51a19f..be80463 100644 --- a/dist/archlinux/stable/PKGBUILD +++ b/dist/archlinux/stable/PKGBUILD @@ -7,10 +7,10 @@ pkgdesc="An extensible and highly configurable alternative to redshift" arch=(i686 x86_64) url="https://github.com/maandree/blueshift" license=('AGPL3' 'GPL3' 'custom:GFDL1.3') -depends=(python3 argparser libxcb libxxf86vm libx11) +depends=(python3 argparser libxcb libxxf86vm libx11 libdrm) optdepends=('adjbacklight: for backlight adjustments without root requirements' 'linux: for backlight support') -makedepends=(cython gcc python3 libxcb libxxf86vm libx11 make coreutils sed zip texinfo auto-auto-complete) +makedepends=(cython gcc python3 libxcb libxxf86vm libx11 libdrm make coreutils sed zip texinfo auto-auto-complete) install=blueshift.install source=($url/archive/$pkgver.tar.gz) sha256sums=(NOT_YET_TAGGED) diff --git a/src/blueshift_drm_c.c b/src/blueshift_drm_c.c new file mode 100644 index 0000000..5007a24 --- /dev/null +++ b/src/blueshift_drm_c.c @@ -0,0 +1,44 @@ +/** + * Copyright © 2014 Mattias Andrée (maandree@member.fsf.org) + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ +#include +#include +#include +#include + +#include +#include + +/* Requires video group */ + + +int main(int argc, char** argv) +{ + DIR* dir; + + (void) argc; + (void) argv; + + if ((dir = opendir("/dev/dri")) == NULL) + { + perror("opendir"); + return 1; + } + + free(dir); + return 0; +} + -- cgit v1.2.3-70-g09d2