From: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
To: igt-dev@lists.freedesktop.org
Cc: Lowry Li <lowry.li@arm.com>, dri-devel@lists.freedesktop.org
Subject: [PATCH i-g-t 1/2] lib/igt_kms: Add set_prop_enum for mode objects
Date: Mon, 4 Jun 2018 15:49:50 +0200 [thread overview]
Message-ID: <20180604134951.14079-1-maarten.lankhorst@linux.intel.com> (raw)
In-Reply-To: <1527856871-3007-2-git-send-email-lowry.li@arm.com>
Signed-off-by: Maarten Lankhorst <maarten.lankhorst@linux.intel.com>
---
lib/igt_kms.c | 56 +++++++++++++++++++++++++++++++++++++++++++++++++++
lib/igt_kms.h | 16 ++++++++++++++-
2 files changed, 71 insertions(+), 1 deletion(-)
diff --git a/lib/igt_kms.c b/lib/igt_kms.c
index cb382c893c6c..9ac7ce73542a 100644
--- a/lib/igt_kms.c
+++ b/lib/igt_kms.c
@@ -2893,6 +2893,37 @@ uint64_t igt_plane_get_prop(igt_plane_t *plane, enum igt_atomic_plane_properties
plane->drm_plane->plane_id, plane->props[prop]);
}
+static uint64_t igt_mode_object_get_prop_enum_value(int drm_fd, uint32_t id, const char *str)
+{
+ drmModePropertyPtr prop = drmModeGetProperty(drm_fd, id);
+ int i;
+
+ igt_assert(id);
+ igt_assert(prop);
+
+ for (i = 0; i < prop->count_enums; i++)
+ if (!strcmp(str, prop->enums[i].name)) {
+ uint64_t ret = prop->enums[i].value;
+ drmModeFreeProperty(prop);
+ return ret;
+ }
+
+ igt_assert_f(0, "Could not find property value for %s\n", str);
+ return 0;
+}
+
+void igt_plane_set_prop_enum(igt_plane_t *plane,
+ enum igt_atomic_plane_properties prop,
+ const char *val)
+{
+ igt_display_t *display = plane->display;
+ uint64_t uval =
+ igt_mode_object_get_prop_enum_value(display->drm_fd,
+ plane->props[prop], val);
+
+ igt_plane_set_prop_value(plane, prop, uval);
+}
+
/**
* igt_plane_replace_prop_blob:
* @plane: plane to set property on.
@@ -2944,6 +2975,18 @@ uint64_t igt_output_get_prop(igt_output_t *output, enum igt_atomic_connector_pro
output->id, output->props[prop]);
}
+void igt_output_set_prop_enum(igt_output_t *output,
+ enum igt_atomic_connector_properties prop,
+ const char *val)
+{
+ igt_display_t *display = output->display;
+ uint64_t uval =
+ igt_mode_object_get_prop_enum_value(display->drm_fd,
+ output->props[prop], val);
+
+ igt_output_set_prop_value(output, prop, uval);
+}
+
/**
* igt_output_replace_prop_blob:
* @output: output to set property on.
@@ -2995,6 +3038,19 @@ uint64_t igt_pipe_obj_get_prop(igt_pipe_t *pipe, enum igt_atomic_crtc_properties
pipe->crtc_id, pipe->props[prop]);
}
+void igt_pipe_obj_set_prop_enum(igt_pipe_t *pipe_obj,
+ enum igt_atomic_crtc_properties prop,
+ const char *val)
+{
+ igt_display_t *display = pipe_obj->display;
+ uint64_t uval =
+ igt_mode_object_get_prop_enum_value(display->drm_fd,
+ pipe_obj->props[prop], val);
+
+ igt_pipe_obj_set_prop_value(pipe_obj, prop, uval);
+}
+
+
/**
* igt_pipe_obj_replace_prop_blob:
* @pipe: pipe to set property on.
diff --git a/lib/igt_kms.h b/lib/igt_kms.h
index 8990a6fd6d12..b55881885b11 100644
--- a/lib/igt_kms.h
+++ b/lib/igt_kms.h
@@ -569,6 +569,10 @@ uint64_t igt_plane_get_prop(igt_plane_t *plane, enum igt_atomic_plane_properties
igt_plane_set_prop_changed(plane, prop); \
} while (0)
+extern void igt_plane_set_prop_enum(igt_plane_t *plane,
+ enum igt_atomic_plane_properties prop,
+ const char *val);
+
extern void igt_plane_replace_prop_blob(igt_plane_t *plane,
enum igt_atomic_plane_properties prop,
const void *ptr, size_t length);
@@ -604,10 +608,13 @@ uint64_t igt_output_get_prop(igt_output_t *output, enum igt_atomic_connector_pro
igt_output_set_prop_changed(output, prop); \
} while (0)
+extern void igt_output_set_prop_enum(igt_output_t *output,
+ enum igt_atomic_connector_properties prop,
+ const char *val);
+
extern void igt_output_replace_prop_blob(igt_output_t *output,
enum igt_atomic_connector_properties prop,
const void *ptr, size_t length);
-
/**
* igt_pipe_obj_has_prop:
* @pipe: Pipe to check.
@@ -688,6 +695,13 @@ igt_pipe_has_prop(igt_display_t *display, enum pipe pipe,
#define igt_pipe_set_prop_value(display, pipe, prop, value) \
igt_pipe_obj_set_prop_value(&(display)->pipes[(pipe)], prop, value)
+extern void igt_pipe_obj_set_prop_enum(igt_pipe_t *pipe,
+ enum igt_atomic_crtc_properties prop,
+ const char *val);
+
+#define igt_pipe_set_prop_enum(display, pipe, prop, val) \
+ igt_pipe_obj_set_prop_enum(&(display)->pipes[(pipe)], prop, val)
+
extern void igt_pipe_obj_replace_prop_blob(igt_pipe_t *pipe,
enum igt_atomic_crtc_properties prop,
const void *ptr, size_t length);
--
2.17.1
_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/dri-devel
next prev parent reply other threads:[~2018-06-04 13:49 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-01 12:41 [PATCH v3 0/2] drm/blend: Add per-plane pixel blend mode property Lowry Li
2018-06-01 12:41 ` [PATCH v3 1/2] drm: " Lowry Li
2018-06-04 13:49 ` Emil Velikov
2018-06-05 9:07 ` Lowry Li
[not found] ` <20180605090729.GA2686@lowry.li@arm.com>
2018-08-13 10:49 ` Maarten Lankhorst
2018-08-14 3:11 ` Lowry Li
[not found] ` <20180814031102.GA8541@lowry.li@arm.com>
2018-08-14 9:15 ` Maarten Lankhorst
2018-08-14 9:22 ` Lowry Li
2018-08-14 9:28 ` Daniel Vetter
2018-08-14 11:38 ` Lowry Li
2018-06-04 13:49 ` Maarten Lankhorst [this message]
2018-06-04 13:49 ` [PATCH i-g-t 2/2] tests: Add kms plane alpha blending test Maarten Lankhorst
2018-06-04 13:50 ` [PATCH] drm/i915: Add plane alpha blending support based on RFC Maarten Lankhorst
2018-06-04 14:29 ` [igt-dev] " Ville Syrjälä
2018-06-04 16:27 ` Maarten Lankhorst
2018-06-04 16:47 ` Ville Syrjälä
2018-06-01 12:41 ` [PATCH v3 2/2] drm/mali-dp: Implement plane alpha and pixel blend on malidp Lowry Li
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20180604134951.14079-1-maarten.lankhorst@linux.intel.com \
--to=maarten.lankhorst@linux.intel.com \
--cc=dri-devel@lists.freedesktop.org \
--cc=igt-dev@lists.freedesktop.org \
--cc=lowry.li@arm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).