summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBen Widawsky <ben@bwidawsk.net>2017-04-13 14:29:26 -0700
committerBen Widawsky <ben@bwidawsk.net>2017-04-13 14:29:26 -0700
commitd63e3ce45b42cf252653dcd7bc8997d2436025dc (patch)
tree97497326919db67cedc49018a44d127a3729be27
parent3e8657f64a6094eda3f7e5e79b939372a9da9a67 (diff)
-rw-r--r--drm-atomic.c45
-rw-r--r--drm-common.c1
2 files changed, 46 insertions, 0 deletions
diff --git a/drm-atomic.c b/drm-atomic.c
index c06e52fb25..a659e3574c 100644
--- a/drm-atomic.c
+++ b/drm-atomic.c
@@ -331,6 +331,8 @@ const struct drm * init_drm_atomic(const char *device)
return NULL;
ret = drmSetClientCap(drm.fd, DRM_CLIENT_CAP_ATOMIC, 1);
+ ret = !ret &&
+ drmSetClientCap(drm.fd, DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
if (ret) {
printf("no atomic modesetting support: %s\n", strerror(errno));
return NULL;
@@ -387,6 +389,49 @@ const struct drm * init_drm_atomic(const char *device)
get_properties(crtc, CRTC, drm.crtc_id);
get_properties(connector, CONNECTOR, drm.connector_id);
+struct in_format_blob_v1 {
+ /* Version of this blob format */
+ uint32_t version;
+
+ /* Number of fourcc formats supported */
+ uint64_t count_formats;
+
+ /* Where in this blob the formats exist (in bytes) */
+ uint32_t formats_offset;
+
+ /* Array of fourcc formats supported */
+ uint32_t fourcc[0];
+
+ /* Number of drm_format_modifiers */
+ uint64_t modifier_count;
+
+ /* Where in this blob the modifiers exist (in bytes) */
+ uint32_t modifier_offset;
+
+ /* Per modifier supported formats - for each modifier supported by the
+ * plane to which this blob is attached, which formats can be used with
+ * that modifiers
+ */
+ struct drm_format_modifier {
+ uint64_t formats;
+ uint32_t offset;
+ uint32_t pad;
+ uint64_t modifier;
+ } modifiers[0];
+} __attribute__ ((__packed__));
+
+ for (int i = 0; i < (int)drm.plane->props->count_props; i++) {
+ if (!strcmp(drm.plane->props_info[i]->name, "IN_FORMATS")) {
+ drmModePropertyBlobPtr blob =
+ drmModeGetPropertyBlob(drm.fd, drm.plane->props->prop_values[i]);
+
+ struct in_format_blob_v1 *m = blob->data;
+ for (int j = 0; i < (int)m->count_formats; m++) {
+ printf("0x%x\n", m->fourcc[j]);
+ }
+ }
+ }
+
drm.run = atomic_run;
return &drm;
diff --git a/drm-common.c b/drm-common.c
index eb460df192..8d7fab13a5 100644
--- a/drm-common.c
+++ b/drm-common.c
@@ -26,6 +26,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+#include <assert.h>
#include "common.h"
#include "drm-common.h"