core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android
PATCH 1/1 core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android
Changes since #1b492e311 have broken the Android build. This patch fixes the build for Android.
core_prop_blob was using ioctls not in the android kernel. Added a igt_require_propblob() function and local defines/structures so the test will compile and skip on kernels where the feature is unsupported.
gem_blt - included igt.h
--- benchmarks/gem_blt.c | 4 +--- lib/ioctl_wrappers.c | 13 +++++++++++++ lib/ioctl_wrappers.h | 22 ++++++++++++++++++++++ tests/core_prop_blob.c | 37 ++++++++++++++++++------------------- 4 files changed, 54 insertions(+), 22 deletions(-)
benchmarks/gem_blt.c +1 -3
@@ -25,6 +25,7 @@* */ +#include "igt.h" #include <unistd.h> #include <stdlib.h> #include <stdint.h>
@@ -39,9 +40,6 @@#include <time.h> #include "drm.h" -#include "ioctl_wrappers.h" -#include "drmtest.h" -#include "intel_chipset.h" #define LOCAL_I915_EXEC_NO_RELOC (1<<11)#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)
lib/ioctl_wrappers.c +13 -0
@@ -1219,6 +1219,19 @@ void igt_require_fb_modifiers(int fd)igt_require (has_modifiers); } +void igt_require_propblob (int fd) +{ +struct local_drm_mode_create_blob c; +struct local_drm_mode_destroy_blob d; +uint32_t blob_data; + c.data = &blob_data; + c.length =sizeof (blob_data); + +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &c) ==0 ); + d.blob_id = c.blob_id; +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &d) ==0 ); +} +int __kms_addfb (int fd,uint32_t handle,uint32_t width,uint32_t height,uint32_t stride,uint32_t pixel_format,uint64_t modifier,uint32_t flags,uint32_t *buf_id)
lib/ioctl_wrappers.h +22 -0
@@ -149,6 +149,20 @@ struct local_drm_mode_fb_cmd2 {uint64_t modifier[4 ]; }; +struct local_drm_mode_get_blob { +uint32_t blob_id; +uint32_t length; +uint64_t data; +}; +struct local_drm_mode_create_blob { +uint64_t data; +uint32_t length; +uint32_t blob_id; +}; +struct local_drm_mode_destroy_blob { +uint32_t blob_id; +}; +#define LOCAL_DRM_MODE_FB_MODIFIERS (1<<1)#define LOCAL_DRM_FORMAT_MOD_VENDOR_INTEL 0x01
@@ -165,9 +179,17 @@ struct local_drm_mode_fb_cmd2 {#define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \ struct local_drm_mode_fb_cmd2) +#define LOCAL_DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, \ + struct local_drm_mode_get_blob) +#define LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, \ + struct local_drm_mode_create_blob) +#define LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, \ + struct local_drm_mode_destroy_blob) +#define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10void igt_require_fb_modifiers (int fd); +void igt_require_propblob (int fd);/** * __kms_addfb:
tests/core_prop_blob.c +18 -19
@@ -25,16 +25,12 @@* Daniel Stone <[email protected]> */ +#include "igt.h" #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <string.h> -#include "drmtest.h" -#include "igt_debugfs.h" -#include "igt_kms.h" -#include "igt_aux.h" -IGT_TEST_DESCRIPTION ("Tests behaviour of mass-data 'blob' properties." );static const struct drm_mode_modeinfo test_mode_valid = {
@@ -64,19 +60,19 @@ static const struct drm_mode_modeinfo test_mode_valid = {static int validate_prop (int fd,uint32_t prop_id) { -struct drm_mode_get_blob get; +struct local_drm_mode_get_blob get;struct drm_mode_modeinfo ret_mode; get.blob_id = prop_id; get.length =0 ; get.data = (uintptr_t )0 ; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);if (get.length !=sizeof (test_mode_valid))return ENOMEM ; get.data = (uintptr_t ) &ret_mode; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);if (memcmp (&ret_mode, &test_mode_valid,sizeof (test_mode_valid)) !=0 )return EINVAL ;
@@ -87,12 +83,12 @@ validate_prop(int fd, uint32_t prop_id)static uint32_t create_prop (int fd) { -struct drm_mode_create_blob create; +struct local_drm_mode_create_blob create; create.length =sizeof (test_mode_valid); create.data = (uintptr_t ) &test_mode_valid; -do_ioctl (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create); +do_ioctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create);igt_assert_neq_u32 (create.blob_id,0 );return create.blob_id;
@@ -101,10 +97,10 @@ create_prop(int fd)static int destroy_prop (int fd,uint32_t prop_id) { -struct drm_mode_destroy_blob destroy; +struct local_drm_mode_destroy_blob destroy; destroy.blob_id = prop_id; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy);return 0 ; }
@@ -112,8 +108,8 @@ destroy_prop(int fd, uint32_t prop_id)static void test_validate (int fd) { -struct drm_mode_create_blob create; -struct drm_mode_get_blob get; +struct local_drm_mode_create_blob create; +struct local_drm_mode_get_blob get;char too_small[32 ];uint32_t prop_id;
@@ -122,24 +118,24 @@ test_validate(int fd)/* Outlandish size. */ create.length =0x10000 ; create.data = (uintptr_t ) &too_small; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT );/* Outlandish address. */ create.length =sizeof (test_mode_valid); create.data = (uintptr_t )0xdeadbeee ; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT );/* When we pass an incorrect size, the kernel should correct us. */ prop_id =create_prop (fd); get.blob_id = prop_id; get.length =sizeof (too_small); get.data = (uintptr_t ) too_small; -do_ioctl (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +do_ioctl (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);igt_assert_eq_u32 (get.length,sizeof (test_mode_valid)); get.blob_id = prop_id; get.data = (uintptr_t )0xdeadbeee ; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); } static void
@@ -211,9 +207,12 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_ANY );igt_require (fd >=0 ); -test_basic (fd); +igt_require_propblob (fd); } + igt_subtest("basic") +test_basic (fd); + igt_subtest("blob-prop-core")test_core (fd);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 49 lines · Derek Morton
Changes since #1b492e311 have broken the Android build. This patch fixes the build for Android.
core_prop_blobwas using ioctls not in the android kernel. Added aigt_require_propblob()function and local defines/structures so the test will compile and skip on kernels where the feature is unsupported.
gem_blt- includedigt.hSigned-off-by Derek Morton <[email protected]>--- benchmarks/gem_blt.c | 4 +--- lib/ioctl_wrappers.c | 13 +++++++++++++ lib/ioctl_wrappers.h | 22 ++++++++++++++++++++++ tests/core_prop_blob.c | 37 ++++++++++++++++++------------------- 4 files changed, 54 insertions(+), 22 deletions(-)benchmarks/gem_blt.c +1
-3@@ -25,6 +25,7 @@* */ +#include "igt.h" #include <unistd.h> #include <stdlib.h> #include <stdint.h> @@ -39,9 +40,6 @@#include <time.h> #include "drm.h" -#include "ioctl_wrappers.h" -#include "drmtest.h" -#include "intel_chipset.h" #define LOCAL_I915_EXEC_NO_RELOC (1<<11)#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)lib/ioctl_wrappers.c +2
-0@@ -1219,6 +1219,19 @@ void igt_require_fb_modifiers(int fd)igt_require (has_modifiers); } +void igt_require_propblob (int fd) +{
lib/ioctl_wrappers.c void igt_require_fb_modifiers(int fd) · line 1233
Quoted 10 lines
lib/ioctl_wrappers.c +10
-0+struct local_drm_mode_create_blob c; +struct local_drm_mode_destroy_blob d; +uint32_t blob_data; + c.data = &blob_data; + c.length =sizeof (blob_data); + +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &c) ==0 ); + d.blob_id = c.blob_id; +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &d) ==0 ); +}
If you want to do this in the library the usual way is to wrap the ioctls as functions and put the relevant -ENOTTY check in there as an igt_require, followed by an igt_assert for anything else that might have gone wrong.
I'd just keep this in the test as a static function though, since then you don't have to write api docs ;-)
-Daniel
Quoted 181 lines
lib/ioctl_wrappers.c +1
-0+int __kms_addfb (int fd,uint32_t handle,uint32_t width,uint32_t height,uint32_t stride,uint32_t pixel_format,uint64_t modifier,uint32_t flags,uint32_t *buf_id)lib/ioctl_wrappers.h +22
-0@@ -149,6 +149,20 @@ struct local_drm_mode_fb_cmd2 {uint64_t modifier[4 ]; }; +struct local_drm_mode_get_blob { +uint32_t blob_id; +uint32_t length; +uint64_t data; +}; +struct local_drm_mode_create_blob { +uint64_t data; +uint32_t length; +uint32_t blob_id; +}; +struct local_drm_mode_destroy_blob { +uint32_t blob_id; +}; +#define LOCAL_DRM_MODE_FB_MODIFIERS (1<<1)#define LOCAL_DRM_FORMAT_MOD_VENDOR_INTEL 0x01@@ -165,9 +179,17 @@ struct local_drm_mode_fb_cmd2 {#define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \ struct local_drm_mode_fb_cmd2) +#define LOCAL_DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, \ + struct local_drm_mode_get_blob) +#define LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, \ + struct local_drm_mode_create_blob) +#define LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, \ + struct local_drm_mode_destroy_blob) +#define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10void igt_require_fb_modifiers (int fd); +void igt_require_propblob (int fd);/** * __kms_addfb: tests/core_prop_blob.c +18
-19@@ -25,16 +25,12 @@* Daniel Stone <[email protected]> */ +#include "igt.h" #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <string.h> -#include "drmtest.h" -#include "igt_debugfs.h" -#include "igt_kms.h" -#include "igt_aux.h" -IGT_TEST_DESCRIPTION ("Tests behaviour of mass-data 'blob' properties." );static const struct drm_mode_modeinfo test_mode_valid = {@@ -64,19 +60,19 @@ static const struct drm_mode_modeinfo test_mode_valid = {static int validate_prop (int fd,uint32_t prop_id) { -struct drm_mode_get_blob get; +struct local_drm_mode_get_blob get;struct drm_mode_modeinfo ret_mode; get.blob_id = prop_id; get.length =0 ; get.data = (uintptr_t )0 ; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);if (get.length !=sizeof (test_mode_valid))return ENOMEM ; get.data = (uintptr_t ) &ret_mode; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);if (memcmp (&ret_mode, &test_mode_valid,sizeof (test_mode_valid)) !=0 )return EINVAL ;@@ -87,12 +83,12 @@ validate_prop(int fd, uint32_t prop_id)static uint32_t create_prop (int fd) { -struct drm_mode_create_blob create; +struct local_drm_mode_create_blob create; create.length =sizeof (test_mode_valid); create.data = (uintptr_t ) &test_mode_valid; -do_ioctl (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create); +do_ioctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create);igt_assert_neq_u32 (create.blob_id,0 );return create.blob_id;@@ -101,10 +97,10 @@ create_prop(int fd)static int destroy_prop (int fd,uint32_t prop_id) { -struct drm_mode_destroy_blob destroy; +struct local_drm_mode_destroy_blob destroy; destroy.blob_id = prop_id; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy);return 0 ; }@@ -112,8 +108,8 @@ destroy_prop(int fd, uint32_t prop_id)static void test_validate (int fd) { -struct drm_mode_create_blob create; -struct drm_mode_get_blob get; +struct local_drm_mode_create_blob create; +struct local_drm_mode_get_blob get;char too_small[32 ];uint32_t prop_id;@@ -122,24 +118,24 @@ test_validate(int fd)/* Outlandish size. */ create.length =0x10000 ; create.data = (uintptr_t ) &too_small; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT );/* Outlandish address. */ create.length =sizeof (test_mode_valid); create.data = (uintptr_t )0xdeadbeee ; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT );/* When we pass an incorrect size, the kernel should correct us. */ prop_id =create_prop (fd); get.blob_id = prop_id; get.length =sizeof (too_small); get.data = (uintptr_t ) too_small; -do_ioctl (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +do_ioctl (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);igt_assert_eq_u32 (get.length,sizeof (test_mode_valid)); get.blob_id = prop_id; get.data = (uintptr_t )0xdeadbeee ; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); } static void@@ -211,9 +207,12 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_ANY );igt_require (fd >=0 ); -test_basic (fd); +igt_require_propblob (fd); } + igt_subtest("basic") +test_basic (fd); + igt_subtest("blob-prop-core")test_core (fd);Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 7 lines
Daniel Vetter Software Engineer, Intel Corporation http://blog.ffwll.ch _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Hi,
Quoted 18 lines · Daniel Vetter
lib/ioctl_wrappers.c void igt_require_fb_modifiers(int fd) · line 1233
Quoted 12 lines
lib/ioctl_wrappers.c +12
-0+void igt_require_propblob (int fd) +{ +struct local_drm_mode_create_blob c; +struct local_drm_mode_destroy_blob d; +uint32_t blob_data; + c.data = &blob_data; + c.length =sizeof (blob_data); + +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &c) ==0 ); + d.blob_id = c.blob_id; +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &d) ==0 ); +}If you want to do this in the library the usual way is to wrap the ioctls as functions and put the relevant
-ENOTTYcheck in there as anigt_require, followed by anigt_assertfor anything else that might have gone wrong.
Quoted 2 lines
I'd just keep this in the test as a static function though, since then you don't have to write api docs ;-)
I have no real opinion either way; apologies for breaking the build! Is Android up-to-date with libdrm, or? If it's not, I suspect kms_atomic.c should just be excluded from the Android build altogether.
Cheers,
Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 22 lines
Hi,
Quoted 18 lines · Daniel Vetter
lib/ioctl_wrappers.c void igt_require_fb_modifiers(int fd)
Quoted 12 lines
lib/ioctl_wrappers.c +12
-0+void igt_require_propblob (int fd) +{ +struct local_drm_mode_create_blob c; +struct local_drm_mode_destroy_blob d; +uint32_t blob_data; + c.data = &blob_data; + c.length =sizeof (blob_data); + +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &c) ==0 ); + d.blob_id = c.blob_id; +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , +&d) ==0 ); }If you want to do this in the library the usual way is to wrap the ioctls as functions and put the relevant
-ENOTTYcheck in there as anigt_require, followed by anigt_assertfor anything else that might have gone wrong.
Quoted 5 lines
Quoted 2 lines
I'd just keep this in the test as a static function though, since then you don't have to write api docs ;-)
I have no real opinion either way; apologies for breaking the build!
Is Android up-to-date with libdrm, or? If it's not, I suspectkms_atomic.cshould just be excluded from the Android build altogether.
Hi,
The kms_* tests are dependant on cairo which is not in the android build by default. Personally I have never tried getting cairo to run on android so have never built the kms_* tests for android.
The version of libdrm used in android will match the kernel version being used in the particular android project. (So it would not be the latest version that goes with drm-nightly)
You aren't the 1st person to break the android build (and won't be the last either) :-)
//Derek
Quoted 4 lines
Cheers,
Daniel
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 18 lines · Daniel Vetter
Quoted 17 lines · Derek Morton
Changes since #1b492e311 have broken the Android build. This patch fixes the build for Android.
core_prop_blobwas using ioctls not in the android kernel. Added aigt_require_propblob()function and local defines/structures so the test will compile and skip on kernels where the feature is unsupported.
gem_blt- includedigt.hSigned-off-by Derek Morton <[email protected]>--- benchmarks/gem_blt.c | 4 +--- lib/ioctl_wrappers.c | 13 +++++++++++++ lib/ioctl_wrappers.h | 22 ++++++++++++++++++++++ tests/core_prop_blob.c | 37 ++++++++++++++++++------------------- 4 files changed, 54 insertions(+), 22 deletions(-)
Quoted 4 lines
benchmarks/gem_blt.c
Quoted 4 lines
benchmarks/gem_blt.c +0
-0
The gem_blt changes are unrelated to the rest of the patch, so need to be applied separately.
Quoted 44 lines
Quoted 28 lines
benchmarks/gem_blt.c +1
-3@@ -25,6 +25,7 @@* */ +#include "igt.h" #include <unistd.h> #include <stdlib.h> #include <stdint.h> @@ -39,9 +40,6 @@#include <time.h> #include "drm.h" -#include "ioctl_wrappers.h" -#include "drmtest.h" -#include "intel_chipset.h" #define LOCAL_I915_EXEC_NO_RELOC (1<<11)#define LOCAL_I915_EXEC_HANDLE_LUT (1<<12)lib/ioctl_wrappers.c +2
-0@@ -1219,6 +1219,19 @@ void igt_require_fb_modifiers(int fd)igt_require (has_modifiers); } +void igt_require_propblob (int fd) +{lib/ioctl_wrappers.c void igt_require_fb_modifiers(int fd) · line 1233
Quoted 10 lines
lib/ioctl_wrappers.c +10
-0+struct local_drm_mode_create_blob c; +struct local_drm_mode_destroy_blob d; +uint32_t blob_data; + c.data = &blob_data; + c.length =sizeof (blob_data); + +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &c) ==0 ); + d.blob_id = c.blob_id; +igt_require (drmIoctl (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &d) ==0 ); +}If you want to do this in the library the usual way is to wrap the ioctls as functions and put the relevant
-ENOTTYcheck in there as anigt_require, followed by anigt_assertfor anything else that might have gone wrong.
Quoted 2 lines
I'd just keep this in the test as a static function though, since then you don't have to write api docs ;-)
It's also unlikely to be used elsewhere at the moment, so a local define and static function in the test is fine.
Quoted 179 lines
-Daniel
Quoted 177 lines
lib/ioctl_wrappers.c +1
-0+int __kms_addfb (int fd,uint32_t handle,uint32_t width,uint32_t height,uint32_t stride,uint32_t pixel_format,uint64_t modifier,uint32_t flags,uint32_t *buf_id)lib/ioctl_wrappers.h +22
-0@@ -149,6 +149,20 @@ struct local_drm_mode_fb_cmd2 {uint64_t modifier[4 ]; }; +struct local_drm_mode_get_blob { +uint32_t blob_id; +uint32_t length; +uint64_t data; +}; +struct local_drm_mode_create_blob { +uint64_t data; +uint32_t length; +uint32_t blob_id; +}; +struct local_drm_mode_destroy_blob { +uint32_t blob_id; +}; +#define LOCAL_DRM_MODE_FB_MODIFIERS (1<<1)#define LOCAL_DRM_FORMAT_MOD_VENDOR_INTEL 0x01@@ -165,9 +179,17 @@ struct local_drm_mode_fb_cmd2 {#define LOCAL_DRM_IOCTL_MODE_ADDFB2 DRM_IOWR(0xB8, \ struct local_drm_mode_fb_cmd2) +#define LOCAL_DRM_IOCTL_MODE_GETPROPBLOB DRM_IOWR(0xAC, \ + struct local_drm_mode_get_blob) +#define LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB DRM_IOWR(0xBD, \ + struct local_drm_mode_create_blob) +#define LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB DRM_IOWR(0xBE, \ + struct local_drm_mode_destroy_blob) +#define LOCAL_DRM_CAP_ADDFB2_MODIFIERS 0x10void igt_require_fb_modifiers (int fd); +void igt_require_propblob (int fd);/** * __kms_addfb: tests/core_prop_blob.c +18
-20@@ -25,16 +25,12 @@* Daniel Stone <[email protected]> */ +#include "igt.h" #include <errno.h> #include <stdbool.h> #include <stdio.h> #include <string.h> -#include "drmtest.h" -#include "igt_debugfs.h" -#include "igt_kms.h" -#include "igt_aux.h" -IGT_TEST_DESCRIPTION ("Tests behaviour of mass-data 'blob' properties." );static const struct drm_mode_modeinfo test_mode_valid = {@@ -64,19 +60,19 @@ static const struct drm_mode_modeinfo test_mode_valid = {static int validate_prop (int fd,uint32_t prop_id) { -struct drm_mode_get_blob get; +struct local_drm_mode_get_blob get;struct drm_mode_modeinfo ret_mode; get.blob_id = prop_id; get.length =0 ; get.data = (uintptr_t )0 ; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);if (get.length !=sizeof (test_mode_valid))return ENOMEM ; get.data = (uintptr_t ) &ret_mode; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);if (memcmp (&ret_mode, &test_mode_valid,sizeof (test_mode_valid)) !=0 )return EINVAL ;@@ -87,12 +83,12 @@ validate_prop(int fd, uint32_t prop_id)static uint32_t create_prop (int fd) { -struct drm_mode_create_blob create; +struct local_drm_mode_create_blob create; create.length =sizeof (test_mode_valid); create.data = (uintptr_t ) &test_mode_valid; -do_ioctl (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create); +do_ioctl (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create);igt_assert_neq_u32 (create.blob_id,0 );return create.blob_id;@@ -101,10 +97,10 @@ create_prop(int fd)static int destroy_prop (int fd,uint32_t prop_id) { -struct drm_mode_destroy_blob destroy; +struct local_drm_mode_destroy_blob destroy; destroy.blob_id = prop_id; -ioctl_or_ret_errno (fd,DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy); +ioctl_or_ret_errno (fd,LOCAL_DRM_IOCTL_MODE_DESTROYPROPBLOB , &destroy);return 0 ; }@@ -112,8 +108,8 @@ destroy_prop(int fd, uint32_t prop_id)static void test_validate (int fd) { -struct drm_mode_create_blob create; -struct drm_mode_get_blob get; +struct local_drm_mode_create_blob create; +struct local_drm_mode_get_blob get;char too_small[32 ];uint32_t prop_id;@@ -122,24 +118,24 @@ test_validate(int fd)/* Outlandish size. */ create.length =0x10000 ; create.data = (uintptr_t ) &too_small; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT );/* Outlandish address. */ create.length =sizeof (test_mode_valid); create.data = (uintptr_t )0xdeadbeee ; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT );/* When we pass an incorrect size, the kernel should correct us. */ prop_id =create_prop (fd); get.blob_id = prop_id; get.length =sizeof (too_small); get.data = (uintptr_t ) too_small; -do_ioctl (fd,DRM_IOCTL_MODE_GETPROPBLOB , &get); +do_ioctl (fd,LOCAL_DRM_IOCTL_MODE_GETPROPBLOB , &get);igt_assert_eq_u32 (get.length,sizeof (test_mode_valid)); get.blob_id = prop_id; get.data = (uintptr_t )0xdeadbeee ; -do_ioctl_err (fd,DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); +do_ioctl_err (fd,LOCAL_DRM_IOCTL_MODE_CREATEPROPBLOB , &create,EFAULT ); } static void@@ -211,9 +207,12 @@ igt_main igt_fixture { fd =drm_open_driver (DRIVER_ANY );igt_require (fd >=0 ); -test_basic (fd); +igt_require_propblob (fd); } + igt_subtest("basic") +test_basic (fd); + igt_subtest("blob-prop-core")test_core (fd); --1.9.1
Quoted 13 lines
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx--
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
http://lists.freedesktop.org/mailman/listinfo/intel-gfx