Add support for generic object properties IOCTLs
Subsystems (2)
PATCH 1/3 Add support for generic object properties IOCTLs
From: Paulo Zanoni <[email protected]>
New library calls:
- drmModeObjectGetProperties
- drmModeFreeObjectProperties
- drmModeObjectSetProperties
Reviewed-by Eugeni Dodonov <[email protected]>
Signed-off-by Paulo Zanoni <[email protected]>
--- include/drm/drm.h | 2 ++ include/drm/drm_mode.h | 24 ++++++++++++++ xf86drmMode.c | 83 ++++++++++++++++++++++++++++++++++++++++++++++++ xf86drmMode.h | 14 ++++++++ 4 files changed, 123 insertions(+)
include/drm/drm.h +2 -0
@@ -731,6 +731,8 @@ struct drm_prime_handle {#define DRM_IOCTL_MODE_GETPLANE DRM_IOWR(0xB6, struct drm_mode_get_plane)#define DRM_IOCTL_MODE_SETPLANE DRM_IOWR(0xB7, struct drm_mode_set_plane)#define DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, struct drm_mode_fb_cmd2) +#define DRM_IOCTL_MODE_OBJ_GETPROPERTIES DRM_IOWR(0xB9, struct drm_mode_obj_get_properties) +#define DRM_IOCTL_MODE_OBJ_SETPROPERTY DRM_IOWR(0xBA, struct drm_mode_obj_set_property)/** * Device specific ioctls should only be in their respective headers
include/drm/drm_mode.h +24 -0
@@ -250,6 +250,30 @@ struct drm_mode_connector_set_property {__u32 connector_id; }; +#define DRM_MODE_OBJECT_CRTC 0xcccccccc +#define DRM_MODE_OBJECT_CONNECTOR 0xc0c0c0c0 +#define DRM_MODE_OBJECT_ENCODER 0xe0e0e0e0 +#define DRM_MODE_OBJECT_MODE 0xdededede +#define DRM_MODE_OBJECT_PROPERTY 0xb0b0b0b0 +#define DRM_MODE_OBJECT_FB 0xfbfbfbfb +#define DRM_MODE_OBJECT_BLOB 0xbbbbbbbb +#define DRM_MODE_OBJECT_PLANE 0xeeeeeeee + +struct drm_mode_obj_get_properties { +__u64 props_ptr; +__u64 prop_values_ptr; +__u32 count_props; +__u32 obj_id; +__u32 obj_type; +}; + +struct drm_mode_obj_set_property { +__u64 value; +__u32 prop_id; +__u32 obj_id; +__u32 obj_type; +}; +struct drm_mode_get_blob {__u32 blob_id;__u32 length;
xf86drmMode.c +83 -0
86 lines not on this page · raw message
xf86drmMode.h +14 -0
@@ -281,6 +281,12 @@ typedef struct _drmModeConnector {uint32_t *encoders;/**< List of encoder ids */ } drmModeConnector, *drmModeConnectorPtr; +typedef struct _drmModeObjectProperties { +uint32_t count_props; +uint32_t *props; +uint64_t *prop_values; +}drmModeObjectProperties , *drmModeObjectPropertiesPtr ; + typedef struct _drmModePlane { uint32_t count_formats; uint32_t *formats;
@@ -428,6 +434,14 @@ extern int drmModeSetPlane(int fd, uint32_t plane_id, uint32_t crtc_id, uint32_t src_x, uint32_t src_y, uint32_t src_w, uint32_t src_h); +extern drmModeObjectPropertiesPtr drmModeObjectGetProperties (int fd, +uint32_t object_id, +uint32_t object_type); +extern void drmModeFreeObjectProperties (drmModeObjectPropertiesPtr ptr); +extern int drmModeObjectSetProperty (int fd,uint32_t object_id, +uint32_t object_type,uint32_t property_id, +uint64_t value); +#if defined(__cplusplus) || defined(c_plusplus) }#endif
Signature · 1 line
1.7.10
PATCH 2/3 modetest: print CRTC properties
From: Paulo Zanoni <[email protected]>
Reviewed-by Eugeni Dodonov <[email protected]>
Signed-off-by Paulo Zanoni <[email protected]>
--- tests/modetest/modetest.c | 15 +++++++++++++++ 1 file changed, 15 insertions(+)
tests/modetest/modetest.c +15 -0
@@ -295,7 +295,9 @@ void dump_connectors(void)void dump_crtcs (void ) {drmModeCrtc *crtc; +drmModeObjectPropertiesPtr props;int i; +uint32_t j;printf ("CRTCs:\n" );printf ("id\tfb\tpos\tsize\n" );
@@ -314,6 +316,19 @@ void dump_crtcs(void) crtc->width, crtc->height);dump_mode (&crtc->mode); +printf (" props:\n" ); + props =drmModeObjectGetProperties (fd, crtc->crtc_id, +DRM_MODE_OBJECT_CRTC ); +if (props) { +for (j =0 ; j < props->count_props; j++) +dump_prop (props->props[j], + props->prop_values[j]); +drmModeFreeObjectProperties (props); + }else { +printf ("\tcould not get crtc properties: %s\n" , +strerror (errno)); + } +drmModeFreeCrtc (crtc); }printf ("\n" );
Signature · 1 line
1.7.10
PATCH 3/3 tests: add proptest
In reply to Paulo ZanoniFrom: Paulo Zanoni <[email protected]>
A small program that allows us to see and modify properties.
Signed-off-by Paulo Zanoni <[email protected]>
--- configure.ac | 1 + tests/Makefile.am | 2 +- tests/proptest/Makefile.am | 11 ++ tests/proptest/proptest.c | 317 ++++++++++++++++++++++++++++++++++++++++++++ 4 files changed, 330 insertions(+), 1 deletion(-) create mode 100644 tests/proptest/Makefile.am create mode 100644 tests/proptest/proptest.c
configure.ac +1 -0
@@ -329,6 +329,7 @@ AC_CONFIG_FILES([ tests/modeprint/Makefile tests/modetest/Makefile tests/kmstest/Makefile + tests/proptest/Makefile tests/radeon/Makefile tests/vbltest/Makefile include/Makefile
tests/Makefile.am +1 -1
@@ -10,7 +10,7 @@ check_PROGRAMS = \ dristat \ drmstat -SUBDIRS = modeprint +SUBDIRS = modeprint proptest if HAVE_LIBKMS SUBDIRS += kmstest modetest
tests/proptest/Makefile.am new file +11 -0
@@ -0,0 +1,11 @@ +AM_CFLAGS = \ + -I$(top_srcdir)/include/drm \ + -I$(top_srcdir) + +noinst_PROGRAMS = \ + proptest + +proptest_SOURCES = \ + proptest.c +proptest_LDADD = \ + $(top_builddir)/libdrm.la
tests/proptest/proptest.c new file +317 -0
317 lines not on this page · raw message
Signature · 6 lines
1.7.10 _______________________________________________ dri-devel mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/dri-devel