Re: [Intel-gfx] [PATCH i-g-t] core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android

2015-10-14 Thread Morton, Derek J

>Hi,
>
>On 13 October 2015 at 16:35, Daniel Vetter  wrote:
>>> +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 -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 ;-)
>
>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.

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

>
>Cheers,
>Daniel
>
___
Intel-gfx mailing list
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android

2015-10-14 Thread Thomas Wood
On 13 October 2015 at 16:35, Daniel Vetter  wrote:
> On Tue, Oct 13, 2015 at 04:16:18PM +0100, Derek Morton wrote:
>> 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
>>
>> Signed-off-by: Derek Morton 
>> ---
>>  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(-)
>>
>> diff --git a/benchmarks/gem_blt.c b/benchmarks/gem_blt.c
>> index 181a5f1..8ab5302 100644
>> --- a/benchmarks/gem_blt.c
>> +++ b/benchmarks/gem_blt.c

The gem_blt changes are unrelated to the rest of the patch, so need to
be applied separately.


>> @@ -25,6 +25,7 @@
>>   *
>>   */
>>
>> +#include "igt.h"
>>  #include 
>>  #include 
>>  #include 
>> @@ -39,9 +40,6 @@
>>  #include 
>>
>>  #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)
>> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
>> index 80e1ec6..cf34f25 100644
>> --- a/lib/ioctl_wrappers.c
>> +++ b/lib/ioctl_wrappers.c
>> @@ -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);
>> +}
>
> 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 ;-)

It's also unlikely to be used elsewhere at the moment, so a local
define and static function in the test is fine.


> -Daniel
>
>> +
>>  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)
>> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
>> index f4deca6..aeb224c 100644
>> --- a/lib/ioctl_wrappers.h
>> +++ b/lib/ioctl_wrappers.h
>> @@ -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_INTEL0x01
>> @@ -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   0x10
>>
>>  void igt_require_fb_modifiers(int fd);
>> +void igt_require_propblob(int fd);
>>
>>  /**
>>   * __kms_addfb:
>> diff --git a/tests/core_prop_blob.c b/tests/core_prop_blob.c
>> index d704158..ff56482 100644
>> --- a/tests/core_prop_blob.c
>> +++ b/tests/core_prop_blob.c
>> @@ -25,16 +25,12 @@
>>   *   Daniel Stone 
>>   */
>>
>> +#include "igt.h"
>>  #include 
>>  #include 
>>  #include 
>>  #include 
>>
>> -#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_ge

Re: [Intel-gfx] [PATCH i-g-t] core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android

2015-10-13 Thread Daniel Stone
Hi,

On 13 October 2015 at 16:35, Daniel Vetter  wrote:
>> +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 -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 ;-)

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
Intel-gfx@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/intel-gfx


Re: [Intel-gfx] [PATCH i-g-t] core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android

2015-10-13 Thread Daniel Vetter
On Tue, Oct 13, 2015 at 04:16:18PM +0100, Derek Morton wrote:
> 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
> 
> Signed-off-by: Derek Morton 
> ---
>  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(-)
> 
> diff --git a/benchmarks/gem_blt.c b/benchmarks/gem_blt.c
> index 181a5f1..8ab5302 100644
> --- a/benchmarks/gem_blt.c
> +++ b/benchmarks/gem_blt.c
> @@ -25,6 +25,7 @@
>   *
>   */
>  
> +#include "igt.h"
>  #include 
>  #include 
>  #include 
> @@ -39,9 +40,6 @@
>  #include 
>  
>  #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)
> diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
> index 80e1ec6..cf34f25 100644
> --- a/lib/ioctl_wrappers.c
> +++ b/lib/ioctl_wrappers.c
> @@ -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);
> +}

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

> +
>  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)
> diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
> index f4deca6..aeb224c 100644
> --- a/lib/ioctl_wrappers.h
> +++ b/lib/ioctl_wrappers.h
> @@ -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_INTEL0x01
> @@ -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   0x10
>  
>  void igt_require_fb_modifiers(int fd);
> +void igt_require_propblob(int fd);
>  
>  /**
>   * __kms_addfb:
> diff --git a/tests/core_prop_blob.c b/tests/core_prop_blob.c
> index d704158..ff56482 100644
> --- a/tests/core_prop_blob.c
> +++ b/tests/core_prop_blob.c
> @@ -25,16 +25,12 @@
>   *   Daniel Stone 
>   */
>  
> +#include "igt.h"
>  #include 
>  #include 
>  #include 
>  #include 
>  
> -#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))
>  

[Intel-gfx] [PATCH i-g-t] core_prop_blob ioctl_wrappers: Fix new tests/benchmarks for android

2015-10-13 Thread Derek Morton
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

Signed-off-by: Derek Morton 
---
 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(-)

diff --git a/benchmarks/gem_blt.c b/benchmarks/gem_blt.c
index 181a5f1..8ab5302 100644
--- a/benchmarks/gem_blt.c
+++ b/benchmarks/gem_blt.c
@@ -25,6 +25,7 @@
  *
  */
 
+#include "igt.h"
 #include 
 #include 
 #include 
@@ -39,9 +40,6 @@
 #include 
 
 #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)
diff --git a/lib/ioctl_wrappers.c b/lib/ioctl_wrappers.c
index 80e1ec6..cf34f25 100644
--- a/lib/ioctl_wrappers.c
+++ b/lib/ioctl_wrappers.c
@@ -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)
diff --git a/lib/ioctl_wrappers.h b/lib/ioctl_wrappers.h
index f4deca6..aeb224c 100644
--- a/lib/ioctl_wrappers.h
+++ b/lib/ioctl_wrappers.h
@@ -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_ADDFB2DRM_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_CREATEPROPBLOBDRM_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 0x10
 
 void igt_require_fb_modifiers(int fd);
+void igt_require_propblob(int fd);
 
 /**
  * __kms_addfb:
diff --git a/tests/core_prop_blob.c b/tests/core_prop_blob.c
index d704158..ff56482 100644
--- a/tests/core_prop_blob.c
+++ b/tests/core_prop_blob.c
@@ -25,16 +25,12 @@
  *   Daniel Stone 
  */
 
+#include "igt.h"
 #include 
 #include 
 #include 
 #include 
 
-#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_