aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMattias Andrée <maandree@operamail.com>2014-05-22 21:36:04 +0200
committerMattias Andrée <maandree@operamail.com>2014-05-22 21:36:21 +0200
commitd783cc81db44cf09c635d5a4155fbba7fe64eae3 (patch)
tree78fe8ec2ac4c79050f61050307eda77c04fb1725 /src
parentm (diff)
downloadlibgamma-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 'src')
-rw-r--r--src/gamma-linux-drm.c44
1 files changed, 33 insertions, 11 deletions
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;
}