summaryrefslogtreecommitdiff
path: root/helpers.c
diff options
context:
space:
mode:
Diffstat (limited to 'helpers.c')
-rw-r--r--helpers.c20
1 files changed, 20 insertions, 0 deletions
diff --git a/helpers.c b/helpers.c
index 07044da..bdae73d 100644
--- a/helpers.c
+++ b/helpers.c
@@ -605,3 +605,23 @@ int drv_modify_linear_combinations(struct driver *drv)
free(items);
return 0;
}
+
+/*
+ * Pick the best modifier from modifiers, according to the ordering
+ * given by modifier_order.
+ */
+uint64_t drv_pick_modifier(const uint64_t *modifiers, uint32_t count,
+ const uint64_t *modifier_order, uint32_t order_count)
+{
+ uint32_t i, j;
+
+ for (i = 0; i < order_count; i++) {
+ for (j = 0; j < count; j++) {
+ if (modifiers[j] == modifier_order[i]) {
+ return modifiers[j];
+ }
+ }
+ }
+
+ return DRM_FORMAT_MOD_LINEAR;
+}