diff options
author | Mattias Andrée <maandree@operamail.com> | 2014-05-22 21:36:04 +0200 |
---|---|---|
committer | Mattias Andrée <maandree@operamail.com> | 2014-05-22 21:36:21 +0200 |
commit | d783cc81db44cf09c635d5a4155fbba7fe64eae3 (patch) | |
tree | 78fe8ec2ac4c79050f61050307eda77c04fb1725 | |
parent | m (diff) | |
download | libgamma-d783cc81db44cf09c635d5a4155fbba7fe64eae3.tar.gz libgamma-d783cc81db44cf09c635d5a4155fbba7fe64eae3.tar.bz2 libgamma-d783cc81db44cf09c635d5a4155fbba7fe64eae3.tar.xz |
library linking and some of gamma-linux-drm
Signed-off-by: Mattias Andrée <maandree@operamail.com>
Diffstat (limited to '')
-rw-r--r-- | Makefile | 8 | ||||
-rwxr-xr-x | configure | 11 | ||||
-rw-r--r-- | src/gamma-linux-drm.c | 44 |
3 files changed, 50 insertions, 13 deletions
@@ -60,6 +60,10 @@ C_FLAGS = $(OPTIMISE) $(WARN) -std=$(STD) $(CPPFLAGS) $(CFLAGS) $(LDFLAGS) \ -fstrict-overflow -funsafe-loop-optimizations -fno-builtin \ $(DEBUG_FLAGS) $(DEFINITIONS) -DLIBGAMMA_CONFIG_H +# Library linking flags for the linker. +LIBS_LD = +# Library linking flags for the C compiler. +LIBS_C = # Object files for the library. LIBOBJ = libgamma-facade libgamma-method gamma-helper @@ -78,11 +82,11 @@ all: bin/libgamma.so bin/libgamma.so: $(foreach O,$(LIBOBJ),obj/$(O).o) mkdir -p $(shell dirname $@) - $(CC) $(C_FLAGS) -shared -o $@ $^ + $(CC) $(C_FLAGS) $(LIBS_LD) -shared -o $@ $^ obj/%.o: src/%.c src/*.h mkdir -p $(shell dirname $@) - $(CC) $(C_FLAGS) -fPIC -c -o $@ $< + $(CC) $(C_FLAGS) $(LIBS_C) -fPIC -c -o $@ $< # Clean rules. @@ -110,18 +110,24 @@ fi if [ ${enable_randr} = 1 ]; then echo 'LIBOBJ += gamma-x-randr' >&3 echo 'DEFINITIONS += -DHAVE_GAMMA_METHOD_X_RANDR' >&3 + echo 'LIBS_LD += $$(pkg-config --cflags xcb xcb-randr)' >&3 + echo 'LIBS_C += $$(pkg-config --cflags xcb xcb-randr)' >&3 echo '#define HAVE_GAMMA_METHOD_X_RANDR' >&4 have_randr='Yes' fi if [ ${enable_vidmode} = 1 ]; then echo 'LIBOBJ += gamma-x-vidmode' >&3 echo 'DEFINITIONS += -DHAVE_GAMMA_METHOD_X_VIDMODE' >&3 + echo 'LIBS_LD += $$(pkg-config --cflags x11 xxf86vm)' >&3 + echo 'LIBS_C += $$(pkg-config --cflags x11 xxf86vm)' >&3 echo '#define HAVE_GAMMA_METHOD_X_VIDMODE' >&4 have_vidmode='Yes' fi if [ ${enable_drm} = 1 ]; then echo 'LIBOBJ += gamma-linux-drm' >&3 echo 'DEFINITIONS += -DHAVE_GAMMA_METHOD_LINUX_DRM' >&3 + echo 'LIBS_LD += $$(pkg-config --cflags libdrm)' >&3 + echo 'LIBS_C += $$(pkg-config --cflags libdrm)' >&3 echo '#define HAVE_GAMMA_METHOD_LINUX_DRM' >&4 have_drm='Yes' fi @@ -134,6 +140,11 @@ fi if [ ${enable_quartz} = 1 ]; then echo 'LIBOBJ += gamma-quartz-cg' >&3 echo 'DEFINITIONS += -DHAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS' >&3 + if [ ${fake_w32gdi} = 0 ]; then + F_ApplicationServices="/System/Library/Frameworks/ApplicationServices.framework" + I_ApplicationServices="${F_ApplicationServices}/Versions/A/Frameworks/CoreGraphics.framework/Versions/A/Headers" + echo "LIBS_LD += -I${I_ApplicationServices} -F${F_ApplicationServices} -framework ApplicationServices" >&3 + fi echo '#define HAVE_GAMMA_METHOD_QUARTZ_CORE_GRAPHICS' >&4 have_quartz='Yes' fi diff --git a/src/gamma-linux-drm.c b/src/gamma-linux-drm.c index dbe01b5..fa0b517 100644 --- a/src/gamma-linux-drm.c +++ b/src/gamma-linux-drm.c @@ -24,6 +24,18 @@ #include "libgamma-error.h" #include <errno.h> +#include <limits.h> +#include <sys/stat.h> + +#include <xf86drm.h> +#include <xf86drmMode.h> + +#ifndef O_CLOEXEC +# define O_CLOEXEC 02000000 +#endif +#ifndef PATH_MAX +# define PATH_MAX 4096 +#endif /** @@ -76,6 +88,25 @@ void libgamma_linux_drm_method_capabilities(libgamma_method_capabilities_t* rest int libgamma_linux_drm_site_initialise(libgamma_site_state_t* restrict this, char* restrict site) { + char pathname[PATH_MAX]; + struct stat _attr; + + if (site != NULL) + return LIBGAMMA_NO_SUCH_SITE; + + /* Count the number of available graphics cards by + * stat:ing there existence in an API filesystem. */ + this->partitions_available = 0; + for (;;) + { + snprintf(pathname, sizeof(pathname) / sizeof(char), + DRM_DEV_NAME, DRM_DIR_NAME, (int)(this->partitions_available)); + if (stat(pathname, &_attr)) + break; + if (this->partitions_available++ > INT_MAX) + return LIBGAMMA_IMPOSSIBLE_AMOUNT; + } + return 0; } @@ -86,6 +117,7 @@ int libgamma_linux_drm_site_initialise(libgamma_site_state_t* restrict this, */ void libgamma_linux_drm_site_destroy(libgamma_site_state_t* restrict this) { + (void) this; } @@ -166,17 +198,7 @@ int libgamma_linux_drm_crtc_initialise(libgamma_crtc_state_t* restrict this, */ void libgamma_linux_drm_crtc_destroy(libgamma_crtc_state_t* restrict this) { -} - - -/** - * Release all resources held by a CRTC state - * and free the CRTC state pointer - * - * @param this The CRTC state - */ -void libgamma_linux_drm_crtc_free(libgamma_crtc_state_t* restrict this) -{ + (void) this; } |