summaryrefslogtreecommitdiff
path: root/lib/igt_kms.h
diff options
context:
space:
mode:
authorDamien Lespiau <damien.lespiau@intel.com>2014-01-27 16:25:43 +0000
committerDamien Lespiau <damien.lespiau@intel.com>2014-02-11 13:50:16 +0000
commit3670d6dbff7b829d71ce84d6c9cb88cd5abdbc53 (patch)
treeea68a22f427d4cb4e4932569a6cede6b50b66750 /lib/igt_kms.h
parent01757d052c3427ee28b1a065652721877568a15f (diff)
lib: Introduce a modeset API
The goals here are: - Reduce duplicated code in each KMS test - Provide an API that looks more like what we want for atomic modesets. The hope is then that it'll be easy to switch, at run-time, between the "legacy" path and atomic modesets, keeping the same API for tests. Signed-off-by: Damien Lespiau <damien.lespiau@intel.com>
Diffstat (limited to 'lib/igt_kms.h')
-rw-r--r--lib/igt_kms.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 6f71165a..901fc1a6 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -25,8 +25,12 @@
#ifndef __IGT_KMS_H__
#define __IGT_KMS_H__
+#include <stdbool.h>
+
#include <cairo.h>
+#include <igt_display.h>
+
struct kmstest_connector_config {
drmModeCrtc *crtc;
drmModeConnector *connector;
@@ -99,5 +103,60 @@ const char *kmstest_connector_type_str(int type);
uint32_t drm_format_to_bpp(uint32_t drm_format);
+/*
+ * A small modeset API
+ */
+
+typedef struct igt_display igt_display_t;
+typedef struct igt_pipe igt_pipe_t;
+
+typedef struct {
+ igt_pipe_t *pipe;
+ int index;
+ unsigned int is_primary : 1;
+ struct kmstest_fb *fb;
+} igt_plane_t;
+
+struct igt_pipe {
+ igt_display_t *display;
+ enum pipe pipe;
+ unsigned int need_set_crtc : 1;
+#define IGT_MAX_PLANES 4
+ int n_planes;
+ igt_plane_t planes[IGT_MAX_PLANES];
+};
+
+typedef struct {
+ igt_display_t *display;
+ uint32_t id; /* KMS id */
+ struct kmstest_connector_config config;
+ char *name;
+ bool valid;
+ unsigned long pending_crtc_idx_mask;
+} igt_output_t;
+
+struct igt_display {
+ int drm_fd;
+ unsigned int verbose : 1;
+ int log_shift;
+ int n_pipes;
+ int n_outputs;
+ unsigned long pipes_in_use;
+ igt_output_t *outputs;
+ igt_pipe_t pipes[I915_MAX_PIPES];
+};
+
+void igt_display_init(igt_display_t *display, int drm_fd);
+void igt_display_fini(igt_display_t *display);
+int igt_display_commit(igt_display_t *display);
+void igt_display_set_verbose(igt_display_t *display, bool verbose);
+
+const char *igt_output_name(igt_output_t *output);
+drmModeModeInfo *igt_output_get_mode(igt_output_t *output);
+void igt_output_set_pipe(igt_output_t *output, enum pipe pipe);
+igt_plane_t *igt_ouput_get_plane(igt_output_t *output, int index);
+
+void igt_plane_set_fb(igt_plane_t *plane, struct kmstest_fb *fb);
+
#endif /* __IGT_KMS_H__ */