Re: [Libva] [PATCH 2/4] libva: fix for Android ICS

2012-08-21 Thread Huang, Haitao
On Mon, Aug 20, 2012 at 4:46 PM, Gwenole Beauchesne gb.de...@gmail.com wrote:
 Hi,

 2012/8/20 Haitao Huang haitao.hu...@intel.com:
 This fixes existing tests for Android ICS build.
 updated headers exported for new drm changes
 Removed dependencies on deprecated Android APIs.
 Added LIBVA_VERSION_S defines.
 Removed unsupported encoder test

 Could you please look at removing the dependency on
 x11/va_dricommon.h? This normally should not be needed anymore. Even
 the Bool/True/False definitions could go away.

Sure, I'll check.

 LIBVA_VERSION_S ideally needs to be generated like for VA_VERSION_*,
 but this is is not essential since this is only valid for tests.

This is only used by vainfo, which will generate the rest of string,
here is the output:
VA-API version: 0.34 (libva 1.2.0.pre1)

 The rest looks good at first sight.

 Thanks,
 Gwenole.
___
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [PATCH 2/4] libva: fix for Android ICS

2012-08-21 Thread Huang, Haitao
On Tue, Aug 21, 2012 at 8:06 AM, Huang, Haitao haitao.hu...@intel.com wrote:
 On Mon, Aug 20, 2012 at 4:46 PM, Gwenole Beauchesne gb.de...@gmail.com 
 wrote:
 Hi,

 2012/8/20 Haitao Huang haitao.hu...@intel.com:
 This fixes existing tests for Android ICS build.
 updated headers exported for new drm changes
 Removed dependencies on deprecated Android APIs.
 Added LIBVA_VERSION_S defines.
 Removed unsupported encoder test

 Could you please look at removing the dependency on
 x11/va_dricommon.h? This normally should not be needed anymore. Even
 the Bool/True/False definitions could go away.

 Sure, I'll check.

This is still needed to be exported to compile drivers that is
implementing dri back-end?
For example, in intel-driver, i965_output_dri.c includes this header.
We could force drivers to not implement, but that's extra steps and
probably not necessary?

 LIBVA_VERSION_S ideally needs to be generated like for VA_VERSION_*,
 but this is is not essential since this is only valid for tests.

 This is only used by vainfo, which will generate the rest of string,
 here is the output:
 VA-API version: 0.34 (libva 1.2.0.pre1)

 The rest looks good at first sight.

 Thanks,
 Gwenole.
___
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [android-build v2 3/3] android-test: compile tests for all android versions

2012-08-21 Thread Negreanu Marius
On Tue, Aug 21, 2012 at 12:33 AM, Gwenole Beauchesne gb.de...@gmail.com wrote:
 Hi,

 2012/8/17 Daniel Charles daniel.char...@intel.com:
 +#ifdef ANDROID_PRE_JB
  #include surfaceflinger/ISurfaceComposer.h
  #include surfaceflinger/Surface.h
  #include surfaceflinger/ISurface.h
  #include surfaceflinger/SurfaceComposerClient.h
 +#elif ANDROID_JB
 +#include gui/ISurfaceComposer.h
 +#include gui/Surface.h
 +#include gui/ISurface.h
 +#include gui/SurfaceComposerClient.h
 +#endif
  #include binder/MemoryHeapBase.h


An observation here is that only the directory names changed, not the
header names.
This means the #ifdefs can be dropped and handle the directory inside
the Android.mk by
setting the LOCAL_C_INCLUDES appropriately.



 I would prefer a more generic ANDROID_CHECK_VERSION() macro. e.g.
 #if ANDROID_CHECK_VERSION(4,1,0)
 ...
 #else
 ...
 #endif

 by probably decomposing PLATFORM_VERSION into major/minor/micro.

 Thanks,
 Gwenole.
 ___
 Libva mailing list
 Libva@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/libva



-- 
Regards!
http://groleo.wordpress.com
___
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [android-build v2 3/3] android-test: compile tests for all android versions

2012-08-21 Thread Charles, Daniel
On Tue, Aug 21, 2012 at 6:52 AM, Negreanu Marius gro...@gmail.com wrote:
 On Tue, Aug 21, 2012 at 12:33 AM, Gwenole Beauchesne gb.de...@gmail.com 
 wrote:
 Hi,

 2012/8/17 Daniel Charles daniel.char...@intel.com:
 +#ifdef ANDROID_PRE_JB
  #include surfaceflinger/ISurfaceComposer.h
  #include surfaceflinger/Surface.h
  #include surfaceflinger/ISurface.h
  #include surfaceflinger/SurfaceComposerClient.h
 +#elif ANDROID_JB
 +#include gui/ISurfaceComposer.h
 +#include gui/Surface.h
 +#include gui/ISurface.h
 +#include gui/SurfaceComposerClient.h
 +#endif
  #include binder/MemoryHeapBase.h


 An observation here is that only the directory names changed, not the
 header names.
 This means the #ifdefs can be dropped and handle the directory inside
 the Android.mk by
 setting the LOCAL_C_INCLUDES appropriately.


On Android ICS and before it seems that the convention was to use the
LOCAL_C_INCLUDES up to the include path and let the headers go deeper
on the directory tree as it is right now.  On JB this rule is not
followed on some other projects within Android.  This approach will
make the code look cleaner without so many #ifdefs.

I will keep the macros as currently defined and if the CHECK_VERSION
is still a concern I can address it.  I don't see much benefit on
changing the macro to CHECK_VERSION if it is not going to be used on
any cpp file.

I'll resubmit this patch.
-- 
Daniel.


 I would prefer a more generic ANDROID_CHECK_VERSION() macro. e.g.
 #if ANDROID_CHECK_VERSION(4,1,0)
 ...
 #else
 ...
 #endif

 by probably decomposing PLATFORM_VERSION into major/minor/micro.

 Thanks,
 Gwenole.
 ___
 Libva mailing list
 Libva@lists.freedesktop.org
 http://lists.freedesktop.org/mailman/listinfo/libva



 --
 Regards!
 http://groleo.wordpress.com
___
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva


Re: [Libva] [PATCH 2/4] libva: fix for Android ICS

2012-08-21 Thread Huang, Haitao
On Tue, Aug 21, 2012 at 8:20 AM, Huang, Haitao haitao.hu...@intel.com wrote:
 On Tue, Aug 21, 2012 at 8:06 AM, Huang, Haitao haitao.hu...@intel.com wrote:
 On Mon, Aug 20, 2012 at 4:46 PM, Gwenole Beauchesne gb.de...@gmail.com 
 wrote:
 Hi,

 2012/8/20 Haitao Huang haitao.hu...@intel.com:
 This fixes existing tests for Android ICS build.
 updated headers exported for new drm changes
 Removed dependencies on deprecated Android APIs.
 Added LIBVA_VERSION_S defines.
 Removed unsupported encoder test

 Could you please look at removing the dependency on
 x11/va_dricommon.h? This normally should not be needed anymore. Even
 the Bool/True/False definitions could go away.

 Sure, I'll check.

 This is still needed to be exported to compile drivers that is
 implementing dri back-end?
 For example, in intel-driver, i965_output_dri.c includes this header.
 We could force drivers to not implement, but that's extra steps and
 probably not necessary?


Sorry,  I just saw you removed dependency in driver as well. It's just
our branch is not rebased yet.
I'll remove it from Android.mk and resubmit

 LIBVA_VERSION_S ideally needs to be generated like for VA_VERSION_*,
 but this is is not essential since this is only valid for tests.

 This is only used by vainfo, which will generate the rest of string,
 here is the output:
 VA-API version: 0.34 (libva 1.2.0.pre1)

 The rest looks good at first sight.

 Thanks,
 Gwenole.
___
Libva mailing list
Libva@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/libva


[Libva] [PATCH v2 2/4] libva: fix for Android ICS

2012-08-21 Thread Haitao Huang
This fixes existing tests for Android ICS build.
updated headers exported for new drm changes
Removed dependencies on deprecated Android APIs.
Added LIBVA_VERSION_S defines.
Removed unsupported encoder test

Change-Id: I478063713883fbb5fb1fac372dbc418b19ff7d2b
Signed-off-by: Haitao Huang haitao.hu...@intel.com
---
 test/Android.mk|2 +-
 test/android_winsys.cpp|   19 +++
 test/decode/Android.mk |6 ++
 test/encode/Android.mk |   24 +---
 test/putsurface/Android.mk |2 +-
 test/vainfo/Android.mk |5 +++--
 test/vainfo/vainfo.c   |1 +
 va/Android.mk  |2 +-
 va/sysdeps.h   |3 +++
 9 files changed, 16 insertions(+), 48 deletions(-)

diff --git a/test/Android.mk b/test/Android.mk
index 7d60473..f3f122c 100644
--- a/test/Android.mk
+++ b/test/Android.mk
@@ -1,4 +1,4 @@
 # Recursive call sub-folder Android.mk
 #
-# include $(call all-subdir-makefiles)
+ include $(call all-subdir-makefiles)
 
diff --git a/test/android_winsys.cpp b/test/android_winsys.cpp
index 93489cd..3c6a245 100644
--- a/test/android_winsys.cpp
+++ b/test/android_winsys.cpp
@@ -24,12 +24,6 @@
 #include ui/DisplayInfo.h
 
 namespace android {
-class Test {
-public:
-static const spISurface getISurface(const spSurface s) {
-return s-getISurface();
-}
-};
 };
 
 #define min(a,b) (ab?a:b)
@@ -44,21 +38,14 @@ do {
\
 /*h = min(win_height, info.h);*/\
 w = win_width, h = win_height;  \
 \
-surface_ctrl = client-createSurface(getpid(), 0, w, h, 
PIXEL_FORMAT_RGB_565, ISurfaceComposer::ePushBuffers); \
+surface_ctrl = client-createSurface(getpid(), 0, w, h, 
PIXEL_FORMAT_RGB_565); \
 android_surface = surface_ctrl-getSurface();   \
-android_isurface = Test::getISurface(android_surface);  \
 \
-client-openTransaction();  \
+client-openGlobalTransaction();  \
 surface_ctrl-setPosition(x, y);\
-client-closeTransaction(); \
-\
-client-openTransaction();  \
 surface_ctrl-setSize(w, h);\
-client-closeTransaction(); \
-\
-client-openTransaction();  \
 surface_ctrl-setLayer(0x10);   \
-client-closeTransaction(); \
+client-closeGlobalTransaction(); \
 } while (0)
 
 
diff --git a/test/decode/Android.mk b/test/decode/Android.mk
index e94b5d9..5eca804 100755
--- a/test/decode/Android.mk
+++ b/test/decode/Android.mk
@@ -15,14 +15,12 @@ LOCAL_CFLAGS += \
 
 LOCAL_C_INCLUDES += \
   $(LOCAL_PATH)/../common \
-  $(TARGET_OUT_HEADERS)/libva  \
-  $(TOPDIR)/hardware/intel/libva/va/   \
-  $(TARGET_OUT_HEADERS)/X11
+  $(TARGET_OUT_HEADERS)/libva
 
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE :=mpeg2vldemo
 
-LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils libutils 
libui libsurfaceflinger_client
+LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils libutils 
libgui
 
 include $(BUILD_EXECUTABLE)
 
diff --git a/test/encode/Android.mk b/test/encode/Android.mk
index 8b58aa2..d2f4514 100755
--- a/test/encode/Android.mk
+++ b/test/encode/Android.mk
@@ -6,28 +6,6 @@ LOCAL_PATH:= $(call my-dir)
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
-  h264encode_android.cpp   \
-  #h264encode_x11.c\
-
-LOCAL_CFLAGS += \
--DANDROID
-
-LOCAL_C_INCLUDES += \
-  $(TARGET_OUT_HEADERS)/libva  \
-  $(TOPDIR)/hardware/intel/libva/va/   \
-  $(TARGET_OUT_HEADERS)/X11
-
-LOCAL_MODULE_TAGS := optional
-LOCAL_MODULE :=h264encode
-
-LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils libutils 
libui libsurfaceflinger_client
-
-include $(BUILD_EXECUTABLE)
-
-
-include $(CLEAR_VARS)
-
-LOCAL_SRC_FILES := \
../common/va_display.c  \
../common/va_display_android.cpp\
avcenc.c
@@ -42,7 +20,7 @@ LOCAL_C_INCLUDES += \
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE :=avcenc
 
-LOCAL_SHARED_LIBRARIES := libva-android libva libdl libdrm libcutils libutils 
libgui libsurfaceflinger_client
+LOCAL_SHARED_LIBRARIES := libva-android 

[Libva] [PATCH v2 4/4] va_android: use common drm driver detection

2012-08-21 Thread Haitao Huang
Change the driver used for android. Libva has to load the correct
driver and retain the vendor and device id's.

This change is to re-use common drm utils code for driver name
detection. Also removed non-android code in android specific files
and unneeded files in android directory.

Change-Id: I2893d8fcadfbf911e7c0b421a4e90d5aeb0d619e
Signed-off-by: Daniel Charles daniel.char...@intel.com (change driver)
Signed-off-by: Haitao Huang haitao.hu...@intel.com (update using drm util)
---
 va/Android.mk |8 ++-
 va/android/drmtest.c  |  139 ---
 va/android/drmtest.h  |   40 
 va/android/va_android.cpp |  145 +++-
 4 files changed, 28 insertions(+), 304 deletions(-)
 delete mode 100644 va/android/drmtest.c
 delete mode 100644 va/android/drmtest.h

diff --git a/va/Android.mk b/va/Android.mk
index 0da4ec2..c94cf7f 100755
--- a/va/Android.mk
+++ b/va/Android.mk
@@ -92,14 +92,16 @@ LOCAL_GENERATED_SOURCES += $(GEN)
 include $(CLEAR_VARS)
 
 LOCAL_SRC_FILES := \
-   android/va_android.cpp
+   android/va_android.cpp \
+drm/va_drm_utils.c
 
 LOCAL_CFLAGS += \
-DANDROID 
 
 LOCAL_C_INCLUDES += \
$(TARGET_OUT_HEADERS)/libva \
-   $(LOCAL_PATH)/x11
+   $(TARGET_OUT_HEADERS)/libdrm \
+   $(LOCAL_PATH)/drm
 
 LOCAL_COPY_HEADERS_TO := libva/va
 
@@ -108,7 +110,7 @@ LOCAL_COPY_HEADERS := va_android.h
 LOCAL_MODULE_TAGS := optional
 LOCAL_MODULE := libva-android
 
-LOCAL_SHARED_LIBRARIES := libva
+LOCAL_SHARED_LIBRARIES := libva libdrm
 
 include $(BUILD_SHARED_LIBRARY)
 
diff --git a/va/android/drmtest.c b/va/android/drmtest.c
deleted file mode 100644
index 444ef47..000
--- a/va/android/drmtest.c
+++ /dev/null
@@ -1,139 +0,0 @@
-/*
- * Copyright © 2007 Intel Corporation
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the Software),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sublicense,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the next
- * paragraph) shall be included in all copies or substantial portions of the
- * Software.
- *
- * THE SOFTWARE IS PROVIDED AS IS, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
- * IN THE SOFTWARE.
- *
- * Authors:
- *Eric Anholt e...@anholt.net
- *
- */
-
-#include string.h
-#include fcntl.h
-#include fnmatch.h
-#include sys/stat.h
-#include sys/ioctl.h
-#include drmtest.h
-
-#define LIBUDEV_I_KNOW_THE_API_IS_SUBJECT_TO_CHANGE
-#include libudev.h
-
-static int is_master(int fd)
-{
-   drm_client_t client;
-   int ret;
-
-   /* Check that we're the only opener and authed. */
-   client.idx = 0;
-   ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, client);
-   assert (ret == 0);
-   if (!client.auth)
-   return 0;
-   client.idx = 1;
-   ret = ioctl(fd, DRM_IOCTL_GET_CLIENT, client);
-   if (ret != -1 || errno != EINVAL)
-   return 0;
-
-   return 1;
-}
-
-/** Open the first DRM device matching the criteria */
-int drm_open_matching(const char *pci_glob, int flags, int *vendor_id, int 
*device_id)
-{
-   struct udev *udev;
-   struct udev_enumerate *e;
-   struct udev_device *device, *parent;
-struct udev_list_entry *entry;
-   const char *pci_id, *path;
-char *tmp;
-   int fd;
-
-*vendor_id = 0;
-*device_id = 0;
-
-   udev = udev_new();
-   if (udev == NULL) {
-   fprintf(stderr, failed to initialize udev context\n);
-return -1;
-   //abort();
-   }
-
-   fd = -1;
-   e = udev_enumerate_new(udev);
-   udev_enumerate_add_match_subsystem(e, drm);
-udev_enumerate_scan_devices(e);
-udev_list_entry_foreach(entry, udev_enumerate_get_list_entry(e)) {
-   path = udev_list_entry_get_name(entry);
-   device = udev_device_new_from_syspath(udev, path);
-   parent = udev_device_get_parent(device);
-   /* Filter out KMS output devices. */
-   if (strcmp(udev_device_get_subsystem(parent), pci) != 0)
-   continue;
-   pci_id = udev_device_get_property_value(parent, PCI_ID);
-   if (fnmatch(pci_glob, pci_id,