[Intel-gfx] [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-29 Thread Daniel Vetter
On Tue, Oct 28, 2014 at 04:56:03PM +, Daniel Stone wrote:
> Hi,
> 
> On 17 October 2014 01:36, Jiang, Fei  wrote:
> 
> > Thanks for Emil's suggestion. You are right, we need make sure structure
> > size aligned on 8 bytes, which is important for 32bit-64bit compatible case.
> 
> 
> While you're at it, please don't use enum as a type inside ioctls, since
> the size can vary by compiler. Please use a uint32_t or whatever instead,
> assigning enum values to that.

Quick correction: You must use __u32 and friends, since using the standard
C typesdef might collide with some program which defines them a different
way. The double underscore ones are explicit ok per the C standard as
private types for the system library. So they're the only ones we can use
in userspace headers.

I've thought checkpatch would bitch about this if you get it wrong, now
that we have the uapi split ...
-Daniel
-- 
Daniel Vetter
Software Engineer, Intel Corporation
+41 (0) 79 365 57 48 - http://blog.ffwll.ch


[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-29 Thread Cheng, Yao
Hi Daniel, we’ve resolved this in patch v2.

From: Daniel Stone [mailto:dan...@fooishbar.org]
Sent: Wednesday, October 29, 2014 0:56
To: Jiang, Fei
Cc: Emil Velikov; Cheng, Yao; intel-gfx at lists.freedesktop.org; Vetter, 
Daniel; dri-devel at lists.freedesktop.org
Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

Hi,

On 17 October 2014 01:36, Jiang, Fei mailto:fei.jiang 
at intel.com>> wrote:
Thanks for Emil's suggestion. You are right, we need make sure structure size 
aligned on 8 bytes, which is important for 32bit-64bit compatible case.

While you're at it, please don't use enum as a type inside ioctls, since the 
size can vary by compiler. Please use a uint32_t or whatever instead, assigning 
enum values to that.


Cheers,
Daniel

Fei
-Original Message-
From: Emil Velikov [mailto:emil.l.velikov at 
gmail.com<mailto:emil.l.veli...@gmail.com>]
Sent: Thursday, October 16, 2014 11:20 PM
To: Cheng, Yao; intel-gfx at lists.freedesktop.org<mailto:intel-gfx at 
lists.freedesktop.org>
Cc: emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>; Jiang, 
Fei; dri-devel at lists.freedesktop.org<mailto:dri-devel at 
lists.freedesktop.org>; Vetter, Daniel
Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

On 16/10/14 15:33, Cheng, Yao wrote:
> Hi Emil,
> Sorry, what do you mean by "correctly aligned"? does it mean the paddings in 
> this data structure?
>
Afaict for compatibility reasons the struct size have to be "aligned"
(multiple of 8 bytes), or if you prefer - the struct is missing the required 
padding :) I've only skimmed through the patch so it may be that other structs 
are having this issue.

Cheers,
Emil

>> -Original Message-
>> From: Emil Velikov [mailto:emil.l.velikov at gmail.com<mailto:emil.l.velikov 
>> at gmail.com>]
>> Sent: Wednesday, October 15, 2014 5:24 PM
>> To: Cheng, Yao; intel-gfx at lists.freedesktop.org<mailto:intel-gfx at 
>> lists.freedesktop.org>
>> Cc: emil.l.velikov at gmail.com<mailto:emil.l.velikov at gmail.com>; Jiang, 
>> Fei;
>> dri-devel at lists.freedesktop.org<mailto:dri-devel at 
>> lists.freedesktop.org>; Vetter, Daniel
>> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm
>> driver
>>
>> Hi Yao,
>>
>> struct drm_ipvr_gem_userptr does not seem to be correctly aligned -
>> is that intentional ? Might be worth checking if anything else in
>> ipvr_drm.h and ipvr_bufmgr.h is in the same boat.
>>
>> Cheers,
>> Emil
>>

___
dri-devel mailing list
dri-devel at lists.freedesktop.org<mailto:dri-devel at lists.freedesktop.org>
http://lists.freedesktop.org/mailman/listinfo/dri-devel

-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20141029/abc06763/attachment.html>


[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-28 Thread Daniel Stone
Hi,

On 17 October 2014 01:36, Jiang, Fei  wrote:

> Thanks for Emil's suggestion. You are right, we need make sure structure
> size aligned on 8 bytes, which is important for 32bit-64bit compatible case.


While you're at it, please don't use enum as a type inside ioctls, since
the size can vary by compiler. Please use a uint32_t or whatever instead,
assigning enum values to that.

Cheers,
Daniel

Fei
> -Original Message-
> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
> Sent: Thursday, October 16, 2014 11:20 PM
> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
> Cc: emil.l.velikov at gmail.com; Jiang, Fei; dri-devel at 
> lists.freedesktop.org;
> Vetter, Daniel
> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver
>
> On 16/10/14 15:33, Cheng, Yao wrote:
> > Hi Emil,
> > Sorry, what do you mean by "correctly aligned"? does it mean the
> paddings in this data structure?
> >
> Afaict for compatibility reasons the struct size have to be "aligned"
> (multiple of 8 bytes), or if you prefer - the struct is missing the
> required padding :) I've only skimmed through the patch so it may be that
> other structs are having this issue.
>
> Cheers,
> Emil
>
> >> -Original Message-
> >> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
> >> Sent: Wednesday, October 15, 2014 5:24 PM
> >> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
> >> Cc: emil.l.velikov at gmail.com; Jiang, Fei;
> >> dri-devel at lists.freedesktop.org; Vetter, Daniel
> >> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm
> >> driver
> >>
> >> Hi Yao,
> >>
> >> struct drm_ipvr_gem_userptr does not seem to be correctly aligned -
> >> is that intentional ? Might be worth checking if anything else in
> >> ipvr_drm.h and ipvr_bufmgr.h is in the same boat.
> >>
> >> Cheers,
> >> Emil
> >>
>
> ___
> dri-devel mailing list
> dri-devel at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/dri-devel
>
-- next part --
An HTML attachment was scrubbed...
URL: 
<http://lists.freedesktop.org/archives/dri-devel/attachments/20141028/59aeb816/attachment.html>


[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-17 Thread Jiang, Fei
Thanks for Emil's suggestion. You are right, we need make sure structure size 
aligned on 8 bytes, which is important for 32bit-64bit compatible case.

Fei
-Original Message-
From: Emil Velikov [mailto:emil.l.veli...@gmail.com] 
Sent: Thursday, October 16, 2014 11:20 PM
To: Cheng, Yao; intel-gfx at lists.freedesktop.org
Cc: emil.l.velikov at gmail.com; Jiang, Fei; dri-devel at 
lists.freedesktop.org; Vetter, Daniel
Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

On 16/10/14 15:33, Cheng, Yao wrote:
> Hi Emil,
> Sorry, what do you mean by "correctly aligned"? does it mean the paddings in 
> this data structure?
> 
Afaict for compatibility reasons the struct size have to be "aligned"
(multiple of 8 bytes), or if you prefer - the struct is missing the required 
padding :) I've only skimmed through the patch so it may be that other structs 
are having this issue.

Cheers,
Emil

>> -Original Message-
>> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
>> Sent: Wednesday, October 15, 2014 5:24 PM
>> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
>> Cc: emil.l.velikov at gmail.com; Jiang, Fei; 
>> dri-devel at lists.freedesktop.org; Vetter, Daniel
>> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm 
>> driver
>>
>> Hi Yao,
>>
>> struct drm_ipvr_gem_userptr does not seem to be correctly aligned - 
>> is that intentional ? Might be worth checking if anything else in 
>> ipvr_drm.h and ipvr_bufmgr.h is in the same boat.
>>
>> Cheers,
>> Emil
>>



[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-17 Thread Cheng, Yao
Thx Emil. Understood now. Will re-scan the data structures and update.

> -Original Message-
> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
> Sent: Thursday, October 16, 2014 11:20 PM
> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
> Cc: emil.l.velikov at gmail.com; Jiang, Fei; dri-devel at 
> lists.freedesktop.org;
> Vetter, Daniel
> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver
> 
> On 16/10/14 15:33, Cheng, Yao wrote:
> > Hi Emil,
> > Sorry, what do you mean by "correctly aligned"? does it mean the paddings
> in this data structure?
> >
> Afaict for compatibility reasons the struct size have to be "aligned"
> (multiple of 8 bytes), or if you prefer - the struct is missing the required
> padding :) I've only skimmed through the patch so it may be that other
> structs are having this issue.
> 
> Cheers,
> Emil
> 
> >> -Original Message-
> >> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
> >> Sent: Wednesday, October 15, 2014 5:24 PM
> >> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
> >> Cc: emil.l.velikov at gmail.com; Jiang, Fei;
> >> dri-devel at lists.freedesktop.org; Vetter, Daniel
> >> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm
> >> driver
> >>
> >> Hi Yao,
> >>
> >> struct drm_ipvr_gem_userptr does not seem to be correctly aligned -
> >> is that intentional ? Might be worth checking if anything else in
> >> ipvr_drm.h and ipvr_bufmgr.h is in the same boat.
> >>
> >> Cheers,
> >> Emil
> >>



[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-16 Thread Emil Velikov
On 16/10/14 15:33, Cheng, Yao wrote:
> Hi Emil,
> Sorry, what do you mean by "correctly aligned"? does it mean the paddings in 
> this data structure?
> 
Afaict for compatibility reasons the struct size have to be "aligned"
(multiple of 8 bytes), or if you prefer - the struct is missing the
required padding :) I've only skimmed through the patch so it may be
that other structs are having this issue.

Cheers,
Emil

>> -Original Message-
>> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
>> Sent: Wednesday, October 15, 2014 5:24 PM
>> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
>> Cc: emil.l.velikov at gmail.com; Jiang, Fei; dri-devel at 
>> lists.freedesktop.org;
>> Vetter, Daniel
>> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver
>>
>> Hi Yao,
>>
>> struct drm_ipvr_gem_userptr does not seem to be correctly aligned - is
>> that intentional ? Might be worth checking if anything else in
>> ipvr_drm.h and ipvr_bufmgr.h is in the same boat.
>>
>> Cheers,
>> Emil
>>



[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-16 Thread Cheng, Yao
Hi Emil,
Sorry, what do you mean by "correctly aligned"? does it mean the paddings in 
this data structure?

> -Original Message-
> From: Emil Velikov [mailto:emil.l.velikov at gmail.com]
> Sent: Wednesday, October 15, 2014 5:24 PM
> To: Cheng, Yao; intel-gfx at lists.freedesktop.org
> Cc: emil.l.velikov at gmail.com; Jiang, Fei; dri-devel at 
> lists.freedesktop.org;
> Vetter, Daniel
> Subject: Re: [RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver
> 
> Hi Yao,
> 
> struct drm_ipvr_gem_userptr does not seem to be correctly aligned - is
> that intentional ? Might be worth checking if anything else in
> ipvr_drm.h and ipvr_bufmgr.h is in the same boat.
> 
> Cheers,
> Emil
> 


[RFC PATCH 3/3] libdrm: user mode helper for ipvr drm driver

2014-10-13 Thread Yao Cheng
usermode helper of ipvr drm driver.
test tools:
1. test_ioctl: test kernel driver by directly ioctl
2. test_decode: test decode functionality by calling libdrm_ipvr

Signed-off-by: Yao Cheng 
---
 Makefile.am|6 +-
 Makefile.sources   |1 +
 configure.ac   |   26 +-
 include/drm/ipvr_drm.h |  268 ++
 ipvr/Makefile.am   |   58 +
 ipvr/Makefile.sources  |5 +
 ipvr/ipvr_bufmgr.h |  156 ++
 ipvr/ipvr_bufmgr_gem.c | 1857 +
 ipvr/libdrm_ipvr.pc.in |   11 +
 ipvr/test_decode.c | 6807 
 ipvr/test_ioctl.c  |  323 +++
 11 files changed, 9516 insertions(+), 2 deletions(-)
 create mode 100644 include/drm/ipvr_drm.h
 create mode 100644 ipvr/Makefile.am
 create mode 100644 ipvr/Makefile.sources
 create mode 100644 ipvr/ipvr_bufmgr.h
 create mode 100644 ipvr/ipvr_bufmgr_gem.c
 create mode 100644 ipvr/libdrm_ipvr.pc.in
 create mode 100644 ipvr/test_decode.c
 create mode 100644 ipvr/test_ioctl.c

diff --git a/Makefile.am b/Makefile.am
index 3952a88..2227add 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -33,6 +33,10 @@ if HAVE_INTEL
 INTEL_SUBDIR = intel
 endif

+if HAVE_IPVR
+IPVR_SUBDIR = ipvr
+endif
+
 if HAVE_NOUVEAU
 NOUVEAU_SUBDIR = nouveau
 endif
@@ -53,7 +57,7 @@ if HAVE_FREEDRENO
 FREEDRENO_SUBDIR = freedreno
 endif

-SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(NOUVEAU_SUBDIR) 
$(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests man
+SUBDIRS = . $(LIBKMS_SUBDIR) $(INTEL_SUBDIR) $(IPVR_SUBDIR) $(NOUVEAU_SUBDIR) 
$(RADEON_SUBDIR) $(OMAP_SUBDIR) $(EXYNOS_SUBDIR) $(FREEDRENO_SUBDIR) tests man

 libdrm_la_LTLIBRARIES = libdrm.la
 libdrm_ladir = $(libdir)
diff --git a/Makefile.sources b/Makefile.sources
index d86fb2a..96f8c60 100644
--- a/Makefile.sources
+++ b/Makefile.sources
@@ -18,6 +18,7 @@ LIBDRM_INCLUDE_H_FILES := \
include/drm/drm_mode.h \
include/drm/drm_sarea.h \
include/drm/i915_drm.h \
+   include/drm/ipvr_drm.h \
include/drm/mach64_drm.h \
include/drm/mga_drm.h \
include/drm/nouveau_drm.h \
diff --git a/configure.ac b/configure.ac
index ee59b03..6dcf1b2 100644
--- a/configure.ac
+++ b/configure.ac
@@ -68,6 +68,11 @@ AC_ARG_ENABLE(intel,
  [Enable support for intel's KMS API (default: auto)]),
  [INTEL=$enableval], [INTEL=auto])

+AC_ARG_ENABLE(ipvr,
+ AS_HELP_STRING([--disable-ipvr],
+ [Enable support for baytrail's hardware VP8 decode (default: 
auto)]),
+ [IPVR=$enableval], [IPVR=auto])
+
 AC_ARG_ENABLE(radeon,
  AS_HELP_STRING([--disable-radeon],
  [Enable support for radeon's KMS API (default: auto)]),
@@ -204,7 +209,7 @@ if test "x$drm_cv_atomic_primitives" = "xlibatomic-ops"; 
then
AC_DEFINE(HAVE_LIB_ATOMIC_OPS, 1, [Enable if you have libatomic-ops-dev 
installed])
 fi

-if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o "x$NOUVEAU" != "xno"; then
+if test "x$INTEL" != "xno" -o "x$IPVR" != "xno" -o "x$RADEON" != "xno" -o 
"x$NOUVEAU" != "xno"; then
if test "x$drm_cv_atomic_primitives" = "xnone"; then
if test "x$INTEL" != "xauto"; then
if test "x$INTEL" != "xno"; then
@@ -214,6 +219,14 @@ if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o 
"x$NOUVEAU" != "xno"; then
AC_MSG_WARN([Disabling libdrm_intel. It depends on 
atomic operations, which were not found for your compiler/cpu. Try compiling 
with -march=native, or install the libatomics-op-dev package.])
INTEL=no
fi
+   if test "x$IPVR" != "xauto"; then
+   if test "x$IPVR" != "xno"; then
+   AC_MSG_ERROR([libdrm_ipvr depends upon atomic 
operations, which were not found for your compiler/cpu. Try compiling with 
-march=native, or install the libatomics-op-dev package, or, failing both of 
those, disable support for Baytrail VP8 by passing --disable-ipvr to 
./configure])
+   fi
+   else
+   AC_MSG_WARN([Disabling libdrm_ipvr. It depends on 
atomic operations, which were not found for your compiler/cpu. Try compiling 
with -march=native, or install the libatomics-op-dev package.])
+   INTEL=no
+   fi
if test "x$RADEON" != "xauto"; then
if test "x$RADEON" != "xno"; then
AC_MSG_ERROR([libdrm_radeon depends upon atomic 
operations, which were not found for your compiler/cpu. Try compiling with 
-march=native, or install the libatomics-op-dev package, or, failing both of 
those, disable support for Radeon GPUs by passing --disable-radeon to 
./configure])
@@ -237,6 +250,9 @@ if test "x$INTEL" != "xno" -o "x$RADEON" != "xno" -o 
"x$NOUVEAU" != "xno"; then
*) INTEL=no ;;
esac
fi
+