Mesa (master): st/omx/tizonia: Add H.264 encoder

2018-03-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: b2f2236dc565dd1460f0c1d26af905955bf3a6a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b2f2236dc565dd1460f0c1d26af905955bf3a6a1

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sat Jan 20 07:40:33 2018 +0530

st/omx/tizonia: Add H.264 encoder

v2: Refactor out screen functions to st/omx

Example Gstreamer pipeline :
gst-launch-1.0 filesrc location=movie.mp4 ! qtdemux ! h264parse ! avdec_h264 ! 
videoconvert ! omxh264enc ! h264parse ! avdec_h264 ! videoconvert ! ximagesink

Acked-by: Leo Liu <leo@amd.com>
Reviewed-by: Julien Isorce <julien.iso...@gmail.com>

---

 src/gallium/state_trackers/omx/Makefile.sources|   4 +-
 src/gallium/state_trackers/omx/bellagio/vid_enc.c  | 355 +--
 src/gallium/state_trackers/omx/bellagio/vid_enc.h  |  48 --
 src/gallium/state_trackers/omx/meson.build |   7 +-
 .../state_trackers/omx/tizonia/Makefile.sources|  11 +
 .../state_trackers/omx/tizonia/entrypoint.c|  42 +-
 src/gallium/state_trackers/omx/tizonia/h264e.c | 184 ++
 src/gallium/state_trackers/omx/tizonia/h264e.h |  55 ++
 .../state_trackers/omx/tizonia/h264einport.c   | 216 +++
 .../state_trackers/omx/tizonia/h264einport.h   |  31 +
 .../state_trackers/omx/tizonia/h264einport_decls.h |  48 ++
 .../state_trackers/omx/tizonia/h264eoutport.c  | 143 +
 .../state_trackers/omx/tizonia/h264eoutport.h  |  31 +
 .../omx/tizonia/h264eoutport_decls.h   |  48 ++
 src/gallium/state_trackers/omx/tizonia/h264eprc.c  | 695 +
 src/gallium/state_trackers/omx/tizonia/h264eprc.h  |  31 +
 src/gallium/state_trackers/omx/vid_enc_common.c| 387 
 src/gallium/state_trackers/omx/vid_enc_common.h| 173 +
 18 files changed, 2106 insertions(+), 403 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=b2f2236dc565dd1460f0c1d26af905955bf3a6a1
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/omx/tizonia: Add H.264 decoder

2018-03-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 83d4a5d5aea5a8a05be2eb3116d2cf3acd201876
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=83d4a5d5aea5a8a05be2eb3116d2cf3acd201876

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sat Jan 20 06:32:17 2018 +0530

st/omx/tizonia: Add H.264 decoder

v2: Refactor out screen functions to st/omx

Example Gstreamer pipeline :
gst-launch-1.0 filesrc location=movie.mp4 ! qtdemux ! h264parse ! omxh264dec ! 
videoconvert ! ximagesink

Acked-by: Leo Liu <leo@amd.com>
Reviewed-by: Julien Isorce <julien.iso...@gmail.com>

---

 meson.build|2 +
 src/gallium/state_trackers/omx/Makefile.sources|8 +-
 .../state_trackers/omx/bellagio/entrypoint.c   |   83 --
 .../state_trackers/omx/bellagio/entrypoint.h   |3 -
 src/gallium/state_trackers/omx/bellagio/vid_dec.c  |  142 +--
 src/gallium/state_trackers/omx/bellagio/vid_dec.h  |   80 +-
 .../state_trackers/omx/bellagio/vid_dec_h264.c |  979 +
 src/gallium/state_trackers/omx/bellagio/vid_enc.c  |1 +
 src/gallium/state_trackers/omx/meson.build |   13 +-
 .../state_trackers/omx/tizonia/Makefile.sources|   10 +-
 .../state_trackers/omx/tizonia/entrypoint.c|   43 +
 src/gallium/state_trackers/omx/tizonia/h264d.c |  176 +++
 src/gallium/state_trackers/omx/tizonia/h264d.h |   40 +
 .../state_trackers/omx/tizonia/h264dinport.c   |  147 +++
 .../state_trackers/omx/tizonia/h264dinport.h   |   31 +
 .../state_trackers/omx/tizonia/h264dinport_decls.h |   48 +
 src/gallium/state_trackers/omx/tizonia/h264dprc.c  |  519 +
 src/gallium/state_trackers/omx/tizonia/h264dprc.h  |   31 +
 src/gallium/state_trackers/omx/tizonia/names.h |   30 +
 src/gallium/state_trackers/omx/vid_dec_common.c|  117 ++
 src/gallium/state_trackers/omx/vid_dec_common.h|  194 
 .../state_trackers/omx/vid_dec_h264_common.c   | 1138 
 .../state_trackers/omx/vid_dec_h264_common.h   |   99 ++
 src/gallium/state_trackers/omx/vid_omx_common.c|  111 ++
 src/gallium/state_trackers/omx/vid_omx_common.h|   36 +
 25 files changed, 2795 insertions(+), 1286 deletions(-)

Diff:   
http://cgit.freedesktop.org/mesa/mesa/diff/?id=83d4a5d5aea5a8a05be2eb3116d2cf3acd201876
___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/omx/tizonia: Add --enable-omx-tizonia flag and build files

2018-03-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: e2afa154e99071e8d51be88494cd1347ad113035
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e2afa154e99071e8d51be88494cd1347ad113035

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sat Jan 20 05:55:53 2018 +0530

st/omx/tizonia: Add --enable-omx-tizonia flag and build files

Allow only bellagio or tizonia to be used at the same time.
Detect tizonia package config file
Generate libomx_mesa.so and install it to libtizcore.pc::pluginsdir
Only compile empty source (target.c) for now.

GSoC Project link: 
https://summerofcode.withgoogle.com/projects/#4737166321123328

Acked-by: Leo Liu <leo@amd.com>
Reviewed-by: Julien Isorce <julien.iso...@gmail.com>

---

 configure.ac   | 46 +-
 meson.build|  7 
 meson_options.txt  |  4 +-
 src/gallium/Makefile.am|  4 ++
 src/gallium/state_trackers/omx/Makefile.am | 13 ++
 src/gallium/state_trackers/omx/meson.build |  4 +-
 src/gallium/state_trackers/omx/tizonia/Makefile.am | 36 +
 .../state_trackers/omx/tizonia/Makefile.sources|  1 +
 src/gallium/targets/omx/Makefile.am| 19 -
 src/gallium/targets/omx/omx.sym|  1 +
 10 files changed, 128 insertions(+), 7 deletions(-)

diff --git a/configure.ac b/configure.ac
index 241b3c0e58..a45d5c6b5e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -85,6 +85,7 @@ dnl Versions for external dependencies
 DRI2PROTO_REQUIRED=2.8
 GLPROTO_REQUIRED=1.4.14
 LIBOMXIL_BELLAGIO_REQUIRED=0.0
+LIBOMXIL_TIZONIA_REQUIRED=0.10.0
 LIBVA_REQUIRED=0.38.0
 VDPAU_REQUIRED=1.1
 WAYLAND_REQUIRED=1.11
@@ -1312,14 +1313,19 @@ AC_ARG_ENABLE([vdpau],
[enable_vdpau=auto])
 AC_ARG_ENABLE([omx],
[AS_HELP_STRING([--enable-omx],
- [DEPRECATED: Use --enable-omx-bellagio instead 
@<:@default=auto@:>@])],
-   [AC_MSG_ERROR([--enable-omx is deprecated. Use --enable-omx-bellagio 
instead.])],
+ [DEPRECATED: Use --enable-omx-bellagio or --enable-omx-tizonia 
instead @<:@default=auto@:>@])],
+   [AC_MSG_ERROR([--enable-omx is deprecated. Use --enable-omx-bellagio or 
--enable-omx-tizonia instead.])],
[])
 AC_ARG_ENABLE([omx-bellagio],
[AS_HELP_STRING([--enable-omx-bellagio],
  [enable OpenMAX Bellagio library @<:@default=disabled@:>@])],
[enable_omx_bellagio="$enableval"],
[enable_omx_bellagio=no])
+AC_ARG_ENABLE([omx-tizonia],
+   [AS_HELP_STRING([--enable-omx-tizonia],
+ [enable OpenMAX Tizonia library @<:@default=disabled@:>@])],
+   [enable_omx_tizonia="$enableval"],
+   [enable_omx_tizonia=no])
 AC_ARG_ENABLE([va],
[AS_HELP_STRING([--enable-va],
  [enable va library @<:@default=auto@:>@])],
@@ -1371,11 +1377,17 @@ if test "x$enable_opengl" = xno -a \
 "x$enable_xvmc" = xno -a \
 "x$enable_vdpau" = xno -a \
 "x$enable_omx_bellagio" = xno -a \
+"x$enable_omx_tizonia" = xno -a \
 "x$enable_va" = xno -a \
 "x$enable_opencl" = xno; then
 AC_MSG_ERROR([at least one API should be enabled])
 fi
 
+if test "x$enable_omx_bellagio" = xyes -a \
+"x$enable_omx_tizonia" = xyes; then
+   AC_MSG_ERROR([Can't enable both bellagio and tizonia at same time])
+fi
+
 # Building OpenGL ES1 and/or ES2 without OpenGL is not supported on mesa 9.0.x
 if test "x$enable_opengl" = xno -a \
 "x$enable_gles1" = xyes; then
@@ -2210,6 +,10 @@ if test -n "$with_gallium_drivers" -a 
"x$with_gallium_drivers" != xswrast; then
 PKG_CHECK_EXISTS([libomxil-bellagio >= $LIBOMXIL_BELLAGIO_REQUIRED], 
[enable_omx_bellagio=yes], [enable_omx_bellagio=no])
 fi
 
+if test "x$enable_omx_tizonia" = xauto -a "x$have_omx_platform" = xyes; 
then
+   PKG_CHECK_EXISTS([libtizonia >= $LIBOMXIL_TIZONIA_REQUIRED], 
[enable_omx_tizonia=yes], [enable_omx_tizonia=no])
+fi
+
 if test "x$enable_va" = xauto -a "x$have_va_platform" = xyes; then
 PKG_CHECK_EXISTS([libva >= $LIBVA_REQUIRED], [enable_va=yes], 
[enable_va=no])
 fi
@@ -2219,6 +2235,7 @@ if test "x$enable_dri" = xyes -o \
 "x$enable_xvmc" = xyes -o \
 "x$enable_vdpau" = xyes -o \
 "x$enable_omx_bellagio" = xyes -o \
+"x$enable_omx_tizonia" = xyes -o \
 "x$enable_va" = xyes; then
 need_gallium_vl=yes
 fi
@@ -2227,6 +2244,7 @@ AM_CONDITIONAL(NEED_GALLIUM_VL, test "x$need_gallium_vl" 
= xyes)
 if test "x$enable_xvmc" = xyes -o \
 "x$enable_vdpau" = xyes -o \
 "x$enable_omx_bellagio" = 

Mesa (master): st/omx/tizonia: Add entrypoint

2018-03-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 430ccdbcb9155c6f3f73451047ee70f4f10f7ae5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=430ccdbcb9155c6f3f73451047ee70f4f10f7ae5

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sat Jan 20 06:24:59 2018 +0530

st/omx/tizonia: Add entrypoint

Adds base files for adding components

Acked-by: Leo Liu <leo@amd.com>
Reviewed-by: Julien Isorce <julien.iso...@gmail.com>

---

 src/gallium/state_trackers/omx/meson.build |  4 ++-
 .../state_trackers/omx/tizonia/Makefile.sources|  4 ++-
 .../state_trackers/omx/tizonia/entrypoint.c| 37 ++
 .../state_trackers/omx/tizonia/entrypoint.h| 35 
 4 files changed, 78 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/omx/meson.build 
b/src/gallium/state_trackers/omx/meson.build
index 40f7284032..f669022219 100644
--- a/src/gallium/state_trackers/omx/meson.build
+++ b/src/gallium/state_trackers/omx/meson.build
@@ -28,7 +28,9 @@ files_omx = files(
   'bellagio/vid_enc.c'
 )
 elif gallium_omx == 'tizonia'
-files_omx = files()
+files_omx = files(
+  'tizonia/entrypoint.c',
+)
 endif
 
 libomx_st = static_library(
diff --git a/src/gallium/state_trackers/omx/tizonia/Makefile.sources 
b/src/gallium/state_trackers/omx/tizonia/Makefile.sources
index 9103ca899d..de6fcf926b 100644
--- a/src/gallium/state_trackers/omx/tizonia/Makefile.sources
+++ b/src/gallium/state_trackers/omx/tizonia/Makefile.sources
@@ -1 +1,3 @@
-C_SOURCES :=
+C_SOURCES := \
+   entrypoint.c \
+   entrypoint.h
diff --git a/src/gallium/state_trackers/omx/tizonia/entrypoint.c 
b/src/gallium/state_trackers/omx/tizonia/entrypoint.c
new file mode 100644
index 00..c89bdfdb10
--- /dev/null
+++ b/src/gallium/state_trackers/omx/tizonia/entrypoint.c
@@ -0,0 +1,37 @@
+/**
+ *
+ * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) 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.
+ *
+ **/
+
+#include 
+#include 
+#include 
+
+#include "entrypoint.h"
+
+OMX_ERRORTYPE OMX_ComponentInit (OMX_HANDLETYPE ap_hdl)
+{
+   return OMX_ErrorNone;
+}
diff --git a/src/gallium/state_trackers/omx/tizonia/entrypoint.h 
b/src/gallium/state_trackers/omx/tizonia/entrypoint.h
new file mode 100644
index 00..740a89dbff
--- /dev/null
+++ b/src/gallium/state_trackers/omx/tizonia/entrypoint.h
@@ -0,0 +1,35 @@
+/**
+ *
+ * Copyright 2013 Advanced Micro Devices, Inc.
+ * All Rights Reserved.
+ *
+ * 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, sub license, 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 NON-INFRINGEMENT.
+ * IN NO EVENT SHALL THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR
+ * ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
+ * TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTIO

Mesa (master): st/omx/tizonia/h264d: Add EGLImage support

2018-03-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: c62cf1f165919bc74296952452906b517d49b64a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=c62cf1f165919bc74296952452906b517d49b64a

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sat Jan 20 07:45:07 2018 +0530

st/omx/tizonia/h264d: Add EGLImage support

Example Gstreamer pipeline :
MESA_ENABLE_OMX_EGLIMAGE=1 GST_GL_API=gles2 GST_GL_PLATFORM=egl gst-launch-1.0 
filesrc location=movie.mp4 ! qtdemux ! h264parse ! omxh264dec ! glimagesink

Acked-by: Leo Liu <leo@amd.com>
Reviewed-by: Julien Isorce <julien.iso...@gmail.com>

---

 src/gallium/state_trackers/omx/Makefile.am |   1 +
 src/gallium/state_trackers/omx/meson.build |  18 +++-
 src/gallium/state_trackers/omx/tizonia/Makefile.am |  13 +++
 .../state_trackers/omx/tizonia/entrypoint.c|  44 
 src/gallium/state_trackers/omx/tizonia/h264dprc.c  | 116 -
 src/gallium/state_trackers/omx/vid_dec_common.c|  38 +++
 src/gallium/state_trackers/omx/vid_dec_common.h|   3 +
 7 files changed, 227 insertions(+), 6 deletions(-)

diff --git a/src/gallium/state_trackers/omx/Makefile.am 
b/src/gallium/state_trackers/omx/Makefile.am
index b25ad5d275..734ca0908e 100644
--- a/src/gallium/state_trackers/omx/Makefile.am
+++ b/src/gallium/state_trackers/omx/Makefile.am
@@ -37,6 +37,7 @@ SUBDIRS = tizonia
 
 AM_CFLAGS = \
$(GALLIUM_CFLAGS) \
+   $(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS) \
$(VL_CFLAGS) \
$(XCB_DRI3_CFLAGS) \
diff --git a/src/gallium/state_trackers/omx/meson.build 
b/src/gallium/state_trackers/omx/meson.build
index f2daf44117..84e5631d25 100644
--- a/src/gallium/state_trackers/omx/meson.build
+++ b/src/gallium/state_trackers/omx/meson.build
@@ -18,6 +18,9 @@
 # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
 # SOFTWARE.
 
+inc_st_omx = [inc_common]
+dep_st_omx = [dep_omx, dep_x11_xcb, dep_xcb, dep_xcb_dri2, dep_xcb_dri3]
+
 files_omx = files(
'vid_dec_common.c',
'vid_dec_h264_common.c',
@@ -45,12 +48,23 @@ files_omx += files(
'tizonia/h264einport.c',
'tizonia/h264eoutport.c'
 )
+inc_st_omx = [
+  inc_st_omx,
+  inc_dri_common,
+  include_directories('../../state_trackers/dri'),
+  include_directories('../../../egl/drivers/dri2'),
+  include_directories('../../../egl/main'),
+  include_directories('../../../gbm/backends/dri'),
+  include_directories('../../../gbm/main'),
+  include_directories('../../../loader')
+]
+dep_st_omx = [dep_st_omx, dep_omx_other, dep_libdrm]
 endif
 
 libomx_st = static_library(
   'omx_st',
   files_omx,
   c_args : [c_vis_args],
-  include_directories : [inc_common],
-  dependencies : [dep_omx, dep_omx_other, dep_x11_xcb, dep_xcb, dep_xcb_dri2, 
dep_xcb_dri3],
+  include_directories : inc_st_omx,
+  dependencies : dep_st_omx,
 )
diff --git a/src/gallium/state_trackers/omx/tizonia/Makefile.am 
b/src/gallium/state_trackers/omx/tizonia/Makefile.am
index 0f72e39369..3149afa7bb 100644
--- a/src/gallium/state_trackers/omx/tizonia/Makefile.am
+++ b/src/gallium/state_trackers/omx/tizonia/Makefile.am
@@ -22,8 +22,21 @@ include Makefile.sources
 include $(top_srcdir)/src/gallium/Automake.inc
 
 AM_CFLAGS = \
+   -I$(top_srcdir)/include \
+   -I$(top_srcdir)/src/mapi \
+   -I$(top_srcdir)/src/mesa \
+   -I$(top_builddir)/src/mesa/drivers/dri/common \
+   -I$(top_srcdir)/src/mesa/drivers/dri/common \
+   -I$(top_srcdir)/src/egl/drivers/dri2 \
+   -I$(top_srcdir)/src/egl/wayland/wayland-egl \
+   -I$(top_srcdir)/src/egl/main \
+   -I$(top_srcdir)/src/gbm/main \
+   -I$(top_srcdir)/src/loader \
+   -I$(top_srcdir)/src/gbm/backends/dri \
+   -I$(top_srcdir)/src/gallium/state_trackers/dri \
-I$(top_srcdir)/src/gallium/state_trackers/omx \
$(GALLIUM_CFLAGS) \
+   $(LIBDRM_CFLAGS) \
$(VISIBILITY_CFLAGS) \
$(VL_CFLAGS) \
$(XCB_DRI3_CFLAGS) \
diff --git a/src/gallium/state_trackers/omx/tizonia/entrypoint.c 
b/src/gallium/state_trackers/omx/tizonia/entrypoint.c
index dc81d5500a..a6c2c45b39 100644
--- a/src/gallium/state_trackers/omx/tizonia/entrypoint.c
+++ b/src/gallium/state_trackers/omx/tizonia/entrypoint.c
@@ -44,6 +44,40 @@
 #include "h264eoutport.h"
 #include "names.h"
 
+#include "util/u_debug.h"
+
+DEBUG_GET_ONCE_BOOL_OPTION(mesa_enable_omx_eglimage,
+   "MESA_ENABLE_OMX_EGLIMAGE",
+   false)
+
+static OMX_BOOL egl_image_validation_hook(const OMX_HANDLETYPE ap_hdl,
+  OMX_U32 pid, OMX_PTR ap_eglimage,
+  void *ap_args)
+{
+   const void * p_krn = NULL;
+   const tiz_port_t * p_port = NULL;
+
+   assert(ap_hdl);
+   assert(ap_eglimage);
+   assert(!ap_args);
+
+   if (!debug_get_option_mesa_enable_omx_eglimage()) {
+  return OMX_FALSE;
+   }
+
+   p_krn = tiz

Mesa (master): st/omx/bellagio: Rename st and target directories

2018-03-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: bb5e27fab6087a5c1528a5faf507acce700e883c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bb5e27fab6087a5c1528a5faf507acce700e883c

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sat Jan 20 05:30:06 2018 +0530

st/omx/bellagio: Rename st and target directories

v2: Refactor out screen functions to st/omx

Allows to keep all the code under st/omx (st/omx/tizonia and
st/omx/bellagio).
Reverts targets/omx_bellagio to omx as additions to existing files
is enough to compile for both bellagio and tizonia.

* autotools changes:
  --enable-omx -> --enable-omx-bellagio

* meson changes:
  -Dgallium-omx=false -> -Dgallium-omx=disabled
  -Dgallium-omx=true  -> -Dgallium-omx=bellagio

Acked-by: Leo Liu <leo@amd.com>
Reviewed-by: Julien Isorce <julien.iso...@gmail.com>

---

 configure.ac   |  5 ++-
 meson.build| 19 +
 meson_options.txt  |  6 +--
 src/gallium/Makefile.am|  2 +-
 src/gallium/meson.build|  4 +-
 src/gallium/state_trackers/omx/Makefile.am | 39 ++
 src/gallium/state_trackers/omx/Makefile.sources|  1 +
 .../{omx_bellagio => omx/bellagio}/Makefile.am |  3 +-
 .../bellagio}/Makefile.sources |  0
 .../{omx_bellagio => omx/bellagio}/entrypoint.c|  0
 .../{omx_bellagio => omx/bellagio}/entrypoint.h|  0
 .../{omx_bellagio => omx/bellagio}/vid_dec.c   |  0
 .../{omx_bellagio => omx/bellagio}/vid_dec.h   |  0
 .../{omx_bellagio => omx/bellagio}/vid_dec_h264.c  |  0
 .../{omx_bellagio => omx/bellagio}/vid_dec_h265.c  |  0
 .../bellagio}/vid_dec_mpeg12.c |  0
 .../{omx_bellagio => omx/bellagio}/vid_enc.c   |  2 +-
 .../{omx_bellagio => omx/bellagio}/vid_enc.h   | 46 +++---
 .../{omx_bellagio => omx}/meson.build  | 16 ++--
 .../targets/{omx-bellagio => omx}/Makefile.am  |  5 ++-
 .../targets/{omx-bellagio => omx}/meson.build  |  0
 src/gallium/targets/{omx-bellagio => omx}/omx.sym  |  0
 src/gallium/targets/{omx-bellagio => omx}/target.c |  0
 23 files changed, 98 insertions(+), 50 deletions(-)

diff --git a/configure.ac b/configure.ac
index d8093597dd..241b3c0e58 100644
--- a/configure.ac
+++ b/configure.ac
@@ -2975,7 +2975,8 @@ AC_CONFIG_FILES([Makefile
  src/gallium/state_trackers/dri/Makefile
  src/gallium/state_trackers/glx/xlib/Makefile
  src/gallium/state_trackers/nine/Makefile
- src/gallium/state_trackers/omx_bellagio/Makefile
+ src/gallium/state_trackers/omx/Makefile
+ src/gallium/state_trackers/omx/bellagio/Makefile
  src/gallium/state_trackers/osmesa/Makefile
  src/gallium/state_trackers/va/Makefile
  src/gallium/state_trackers/vdpau/Makefile
@@ -2986,7 +2987,7 @@ AC_CONFIG_FILES([Makefile
  src/gallium/targets/d3dadapter9/d3d.pc
  src/gallium/targets/dri/Makefile
  src/gallium/targets/libgl-xlib/Makefile
- src/gallium/targets/omx-bellagio/Makefile
+ src/gallium/targets/omx/Makefile
  src/gallium/targets/opencl/Makefile
  src/gallium/targets/opencl/mesa.icd
  src/gallium/targets/osmesa/Makefile
diff --git a/meson.build b/meson.build
index bb6a835084..9bb114056b 100644
--- a/meson.build
+++ b/meson.build
@@ -464,29 +464,28 @@ endif
 
 _omx = get_option('gallium-omx')
 if not system_has_kms_drm
-  if _omx == 'true'
+  if _omx != 'disabled'
 error('OMX state tracker can only be built on unix-like OSes.')
   else
-_omx = 'false'
+_omx = 'disabled'
   endif
 elif not (with_platform_x11 or with_platform_drm)
-  if _omx == 'true'
+  if _omx != 'disabled'
 error('OMX state tracker requires X11 or drm platform support.')
   else
-_omx = 'false'
+_omx = 'disabled'
   endif
 elif not (with_gallium_r600 or with_gallium_radeonsi or with_gallium_nouveau)
-  if _omx == 'true'
+  if _omx != 'disabled'
 error('OMX state tracker requires at least one of the following gallium 
drivers: r600, radeonsi, nouveau.')
   else
-_omx = 'false'
+_omx = 'disabled'
   endif
-elif _omx == 'auto'
-  _omx = 'true'
 endif
-with_gallium_omx = _omx == 'true'
+with_gallium_omx = _omx != 'disabled'
+gallium_omx = _omx
 dep_omx = []
-if with_gallium_omx
+if gallium_omx == 'bellagio'
   dep_omx = dependency('libomxil-bellagio')
 endif
 
diff --git a/meson_options.txt b/meson_options.txt
index 7fafe2deaa..f5705c2b3c 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -90,9 +90,9 @@ option(
 option(
   'gallium-omx',
   type : 'combo',
-  value : 'auto',
-  choices : ['auto', 'true', 'false'],
-  description

Mesa (master): i965: implement (un)mapImage

2017-11-14 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: b904ad7d21a5d0472ffb80b81abe24afb2da3289
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b904ad7d21a5d0472ffb80b81abe24afb2da3289

Author: Julien Isorce <jiso...@oblong.com>
Date:   Mon Nov  6 10:08:25 2017 +

i965: implement (un)mapImage

Already implemented for Gallium drivers.

Useful for gbm_bo_(un)map.

Tests:
  By porting wayland/weston/clients/simple-dmabuf-drm.c to GBM.
  kmscube --mode=rgba
  kmscube --mode=nv12-1img
  kmscube --mode=nv12-2img
  piglit ext_image_dma_buf_import-refcount -auto
  piglit ext_image_dma_buf_import-transcode-nv12-as-r8-gr88 -auto
  piglit ext_image_dma_buf_import-sample_rgb -fmt=XR24 -alpha-one -auto
  piglit ext_image_dma_buf_import-sample_rgb -fmt=AR24 -auto
  piglit ext_image_dma_buf_import-sample_yuv -fmt=NV12 -auto
  piglit ext_image_dma_buf_import-sample_yuv -fmt=YU12 -auto
  piglit ext_image_dma_buf_import-sample_yuv -fmt=YV12 -auto

v2: add early return if (flag & MAP_INTERNAL_MASK)
v3: take input rect into account and test with kmscube and piglit.
v4: handle wraparound and bo reference.
v5: indent, exclude 0 width and height on the boundary, map bo
independently of the image.

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Chris Wilson <ch...@chris-wilson.co.uk>

---

 src/mesa/drivers/dri/i965/intel_screen.c | 65 +++-
 1 file changed, 63 insertions(+), 2 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_screen.c 
b/src/mesa/drivers/dri/i965/intel_screen.c
index 3d238769ad..4e48a85605 100644
--- a/src/mesa/drivers/dri/i965/intel_screen.c
+++ b/src/mesa/drivers/dri/i965/intel_screen.c
@@ -755,6 +755,67 @@ intel_create_image(__DRIscreen *dri_screen,
loaderPrivate);
 }
 
+static void *
+intel_map_image(__DRIcontext *context, __DRIimage *image,
+int x0, int y0, int width, int height,
+unsigned int flags, int *stride, void **map_info)
+{
+   struct brw_context *brw = NULL;
+   struct brw_bo *bo = NULL;
+   void *raw_data = NULL;
+   GLuint pix_w = 1;
+   GLuint pix_h = 1;
+   GLint pix_bytes = 1;
+
+   if (!context || !image || !stride || !map_info || *map_info)
+  return NULL;
+
+   if (x0 < 0 || x0 >= image->width || width > image->width - x0)
+  return NULL;
+
+   if (y0 < 0 || y0 >= image->height || height > image->height - y0)
+  return NULL;
+
+   if (flags & MAP_INTERNAL_MASK)
+  return NULL;
+
+   brw = context->driverPrivate;
+   bo = image->bo;
+
+   assert(brw);
+   assert(bo);
+
+   /* DRI flags and GL_MAP.*_BIT flags are the same, so just pass them on. */
+   raw_data = brw_bo_map(brw, bo, flags);
+   if (!raw_data)
+  return NULL;
+
+   _mesa_get_format_block_size(image->format, _w, _h);
+   pix_bytes = _mesa_get_format_bytes(image->format);
+
+   assert(pix_w);
+   assert(pix_h);
+   assert(pix_bytes > 0);
+
+   raw_data += (x0 / pix_w) * pix_bytes + (y0 / pix_h) * image->pitch;
+
+   brw_bo_reference(bo);
+
+   *stride = image->pitch;
+   *map_info = bo;
+
+   return raw_data;
+}
+
+static void
+intel_unmap_image(__DRIcontext *context, __DRIimage *image, void *map_info)
+{
+   struct brw_bo *bo = map_info;
+
+   brw_bo_unmap(bo);
+   brw_bo_unreference(bo);
+}
+
 static __DRIimage *
 intel_create_image_with_modifiers(__DRIscreen *dri_screen,
   int width, int height, int format,
@@ -1305,8 +1366,8 @@ static const __DRIimageExtension intelImageExtension = {
 .createImageFromDmaBufs = intel_create_image_from_dma_bufs,
 .blitImage  = NULL,
 .getCapabilities= NULL,
-.mapImage   = NULL,
-.unmapImage = NULL,
+.mapImage   = intel_map_image,
+.unmapImage = intel_unmap_image,
 .createImageWithModifiers   = intel_create_image_with_modifiers,
 .createImageFromDmaBufs2= intel_create_image_from_dma_bufs2,
 .queryDmaBufFormats = intel_query_dma_buf_formats,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): gallium/hud: set the dump file streams to line buffered

2017-04-13 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 5589fd89e1337a03c947840b344f515cb1d3a96d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=5589fd89e1337a03c947840b344f515cb1d3a96d

Author: Edmondo Tommasina <edmondo.tommas...@gmail.com>
Date:   Wed Apr  5 21:03:55 2017 +0200

gallium/hud: set the dump file streams to line buffered

Flush the HUD value streams to the dump files after every newline.

v2: check that fopen succeeded  (Julien)

Reviewed-and-Tested-by: Julien Isorce <jiso...@oblong.com>

---

 src/gallium/auxiliary/hud/hud_context.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/gallium/auxiliary/hud/hud_context.c 
b/src/gallium/auxiliary/hud/hud_context.c
index 29ef9eee31..f492c81fe6 100644
--- a/src/gallium/auxiliary/hud/hud_context.c
+++ b/src/gallium/auxiliary/hud/hud_context.c
@@ -972,6 +972,8 @@ hud_graph_set_dump_file(struct hud_graph *gr)
  strcat(dump_file, "/");
  strcat_without_spaces(dump_file, gr->name);
  gr->fd = fopen(dump_file, "w+");
+ if (gr->fd)
+setvbuf(gr->fd, NULL, _IOLBF, 0);
  free(dump_file);
   }
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): si_compute: check NULL return from u_upload_alloc

2017-03-28 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 4a5e779b5f9d169fd043ffaead1525040af816f3
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=4a5e779b5f9d169fd043ffaead1525040af816f3

Author: Julien Isorce <jiso...@oblong.com>
Date:   Thu Mar 23 13:43:49 2017 +

si_compute: check NULL return from u_upload_alloc

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeonsi/si_compute.c | 14 +++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_compute.c 
b/src/gallium/drivers/radeonsi/si_compute.c
index 46476b68be..913a2ddbfe 100644
--- a/src/gallium/drivers/radeonsi/si_compute.c
+++ b/src/gallium/drivers/radeonsi/si_compute.c
@@ -579,7 +579,7 @@ static void si_setup_user_sgprs_co_v2(struct si_context 
*sctx,
}
 }
 
-static void si_upload_compute_input(struct si_context *sctx,
+static bool si_upload_compute_input(struct si_context *sctx,
const amd_kernel_code_t *code_object,
const struct pipe_grid_info *info)
 {
@@ -602,6 +602,9 @@ static void si_upload_compute_input(struct si_context *sctx,
   _args_offset,
   (struct pipe_resource**)_buffer, _args_ptr);
 
+   if (unlikely(!kernel_args_ptr))
+   return false;
+
kernel_args = (uint32_t*)kernel_args_ptr;
kernel_args_va = input_buffer->gpu_address + kernel_args_offset;
 
@@ -636,6 +639,8 @@ static void si_upload_compute_input(struct si_context *sctx,
}
 
r600_resource_reference(_buffer, NULL);
+
+   return true;
 }
 
 static void si_setup_tgsi_grid(struct si_context *sctx,
@@ -790,8 +795,11 @@ static void si_launch_grid(
si_set_atom_dirty(sctx, sctx->atoms.s.render_cond, false);
}
 
-   if (program->input_size || program->ir_type == PIPE_SHADER_IR_NATIVE)
-   si_upload_compute_input(sctx, code_object, info);
+   if ((program->input_size ||
+program->ir_type == PIPE_SHADER_IR_NATIVE) &&
+   unlikely(!si_upload_compute_input(sctx, code_object, info))) {
+   return;
+   }
 
/* Global buffers */
for (i = 0; i < MAX_GLOBAL_BUFFERS; i++) {

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): r600_shader.c: fix indentation

2017-03-23 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 48b5f1cca7deb666cf5b9f8e9dc8098b69ae0707
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=48b5f1cca7deb666cf5b9f8e9dc8098b69ae0707

Author: Julien Isorce <jiso...@oblong.com>
Date:   Wed Mar 22 13:43:45 2017 +

r600_shader.c: fix indentation

Introduced by ad13bd2e51a5dc01b0f8a0eb927022f0deac0a0c

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Nayan Deshmukh <nayan26deshm...@gmail.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/r600/r600_shader.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index 844650220b..41fabf3a31 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1113,8 +1113,8 @@ static int allocate_system_value_inputs(struct 
r600_shader_ctx *ctx, int gpr_off
 
interpolate = 
ctx->info.input_interpolate[inst->Src[0].Register.Index];
k = eg_get_interpolator_index(interpolate, 
location);
-if (k >= 0)
-ctx->eg_interpolators[k].enabled = 
true;
+   if (k >= 0)
+   ctx->eg_interpolators[k].enabled = true;
}
} else if (parse.FullToken.Token.Type == 
TGSI_TOKEN_TYPE_DECLARATION) {
struct tgsi_full_declaration *d = 

@@ -1210,8 +1210,8 @@ static int evergreen_gpr_count(struct r600_shader_ctx 
*ctx)
 
interpolate = 
ctx->info.input_interpolate[inst->Src[0].Register.Index];
k = eg_get_interpolator_index(interpolate, 
location);
-if (k >= 0)
-ctx->eg_interpolators[k].enabled = 
true;
+   if (k >= 0)
+   ctx->eg_interpolators[k].enabled = true;
}
}
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): r600_shader.c: check returned value of eg_get_interpolator_index

2017-03-21 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: ad13bd2e51a5dc01b0f8a0eb927022f0deac0a0c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ad13bd2e51a5dc01b0f8a0eb927022f0deac0a0c

Author: Julien Isorce <julien.iso...@gmail.com>
Date:   Thu Mar 16 14:25:24 2017 +

r600_shader.c: check returned value of eg_get_interpolator_index

Like done in another place in that same file.

CID 1250588

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/r600/r600_shader.c | 6 --
 1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/r600/r600_shader.c 
b/src/gallium/drivers/r600/r600_shader.c
index e97aa65141..844650220b 100644
--- a/src/gallium/drivers/r600/r600_shader.c
+++ b/src/gallium/drivers/r600/r600_shader.c
@@ -1113,7 +1113,8 @@ static int allocate_system_value_inputs(struct 
r600_shader_ctx *ctx, int gpr_off
 
interpolate = 
ctx->info.input_interpolate[inst->Src[0].Register.Index];
k = eg_get_interpolator_index(interpolate, 
location);
-   ctx->eg_interpolators[k].enabled = true;
+if (k >= 0)
+ctx->eg_interpolators[k].enabled = 
true;
}
} else if (parse.FullToken.Token.Type == 
TGSI_TOKEN_TYPE_DECLARATION) {
struct tgsi_full_declaration *d = 

@@ -1209,7 +1210,8 @@ static int evergreen_gpr_count(struct r600_shader_ctx 
*ctx)
 
interpolate = 
ctx->info.input_interpolate[inst->Src[0].Register.Index];
k = eg_get_interpolator_index(interpolate, 
location);
-   ctx->eg_interpolators[k].enabled = true;
+if (k >= 0)
+ctx->eg_interpolators[k].enabled = 
true;
}
}
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): si_descriptor: move velems nullity check before dereference

2017-03-20 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: a6e212440278df2bb0766a5cf745935d94809144
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a6e212440278df2bb0766a5cf745935d94809144

Author: Julien Isorce <jiso...@oblong.com>
Date:   Thu Mar 16 13:09:21 2017 +

si_descriptor: move velems nullity check before dereference

CID 1399479: Dereference before null check (REVERSE_INULL)
check_after_deref: Null-checking velems suggests that it may be null,
but it has already been dereferenced on all paths leading to the check.

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeonsi/si_descriptors.c | 15 +++
 1 file changed, 11 insertions(+), 4 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_descriptors.c 
b/src/gallium/drivers/radeonsi/si_descriptors.c
index eb79578b34..2e62725e9c 100644
--- a/src/gallium/drivers/radeonsi/si_descriptors.c
+++ b/src/gallium/drivers/radeonsi/si_descriptors.c
@@ -949,15 +949,22 @@ bool si_upload_vertex_buffer_descriptors(struct 
si_context *sctx)
 {
struct si_vertex_element *velems = sctx->vertex_elements;
struct si_descriptors *desc = >vertex_buffers;
-   unsigned i, count = velems->count;
-   unsigned desc_list_byte_size = velems->desc_list_byte_size;
+   unsigned i, count;
+   unsigned desc_list_byte_size;
+   unsigned first_vb_use_mask;
uint64_t va;
uint32_t *ptr;
 
-   if (!sctx->vertex_buffers_dirty || !count || !velems)
+   if (!sctx->vertex_buffers_dirty || !velems)
return true;
 
-   unsigned first_vb_use_mask = velems->first_vb_use_mask;
+   count = velems->count;
+
+   if (!count)
+   return true;
+
+   desc_list_byte_size = velems->desc_list_byte_size;
+   first_vb_use_mask = velems->first_vb_use_mask;
 
/* Vertex buffer descriptors are the only ones which are uploaded
 * directly through a staging buffer and don't go through

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): radeon: initialize hole variable before calling container_of

2017-03-20 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: ce27b27c38acd5a92cf45e7ddc2434f2c04191ee
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ce27b27c38acd5a92cf45e7ddc2434f2c04191ee

Author: Julien Isorce <jiso...@oblong.com>
Date:   Mon Feb 27 13:42:17 2017 +

radeon: initialize hole variable before calling container_of

Like in a few other places in that radeon_drm_bo.c file.

CID 715739.

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index d4f4763c2f..f4ed3ce632 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -258,7 +258,7 @@ static uint64_t radeon_bomgr_find_va(struct 
radeon_drm_winsys *rws,
 static void radeon_bomgr_free_va(struct radeon_drm_winsys *rws,
  uint64_t va, uint64_t size)
 {
-struct radeon_bo_va_hole *hole;
+struct radeon_bo_va_hole *hole = NULL;
 
 size = align(size, rws->info.gart_page_size);
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): si_pipe: remove nullity check after dereference

2017-03-20 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: dac124466ade5ebb2f7f2e8d68351890051a20f9
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dac124466ade5ebb2f7f2e8d68351890051a20f9

Author: Julien Isorce <jiso...@oblong.com>
Date:   Wed Mar 15 17:31:40 2017 +

si_pipe: remove nullity check after dereference

sscreen cannot be NULL

CID 1354483

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/drivers/radeonsi/si_pipe.c | 3 ---
 1 file changed, 3 deletions(-)

diff --git a/src/gallium/drivers/radeonsi/si_pipe.c 
b/src/gallium/drivers/radeonsi/si_pipe.c
index a3e001c747..277fa28641 100644
--- a/src/gallium/drivers/radeonsi/si_pipe.c
+++ b/src/gallium/drivers/radeonsi/si_pipe.c
@@ -684,9 +684,6 @@ static void si_destroy_screen(struct pipe_screen* pscreen)
};
unsigned i;
 
-   if (!sscreen)
-   return;
-
if (!sscreen->b.ws->unref(sscreen->b.ws))
return;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): radeon_drm_bo: explicitly check return value of drmCommandWriteRead

2017-03-20 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 521860b2a92bab6394546e6af8709c07e2292033
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=521860b2a92bab6394546e6af8709c07e2292033

Author: Julien Isorce <jiso...@oblong.com>
Date:   Wed Mar 15 17:40:25 2017 +

radeon_drm_bo: explicitly check return value of drmCommandWriteRead

CID 1313492

Signed-off-by: Julien Isorce <jiso...@oblong.com>
Reviewed-by: Marek Olšák <marek.ol...@amd.com>

---

 src/gallium/winsys/radeon/drm/radeon_drm_bo.c | 9 +++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c 
b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
index f4ed3ce632..f6d5c8a51c 100644
--- a/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
+++ b/src/gallium/winsys/radeon/drm/radeon_drm_bo.c
@@ -186,8 +186,13 @@ static enum radeon_bo_domain radeon_bo_get_initial_domain(
 args.handle = bo->handle;
 args.op = RADEON_GEM_OP_GET_INITIAL_DOMAIN;
 
-drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_OP,
-, sizeof(args));
+if (drmCommandWriteRead(bo->rws->fd, DRM_RADEON_GEM_OP,
+, sizeof(args))) {
+fprintf(stderr, "radeon: failed to get initial domain: %p 0x%08X\n",
+bo, bo->handle);
+/* Default domain as returned by get_valid_domain. */
+return RADEON_DOMAIN_VRAM_GTT;
+}
 
 /* GEM domains and winsys domains are defined the same. */
 return get_valid_domain(args.value);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: set default rt formats when calling vaCreateConfig

2016-10-18 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: dbc8e181166c96d8344355757e46c4cfc8f634e5
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=dbc8e181166c96d8344355757e46c4cfc8f634e5

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Mon Oct 17 17:33:36 2016 +0100

st/va: set default rt formats when calling vaCreateConfig

As specified in va.h, default value should be set on attributes
not present in the input list.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Mark Thompson <s...@jkqxz.net>

---

 src/gallium/state_trackers/va/config.c  | 9 +
 src/gallium/state_trackers/va/surface.c | 5 +++--
 2 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/va/config.c 
b/src/gallium/state_trackers/va/config.c
index 2f96eb6..da52a58 100644
--- a/src/gallium/state_trackers/va/config.c
+++ b/src/gallium/state_trackers/va/config.c
@@ -195,6 +195,11 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, 
VAEntrypoint entrypoin
 }
  }
   }
+
+  /* Default value if not specified in the input attributes. */
+  if (!config->rt_format)
+ config->rt_format = VA_RT_FORMAT_YUV420 | VA_RT_FORMAT_RGB32;
+
   pipe_mutex_lock(drv->mutex);
   *config_id = handle_table_add(drv->htab, config);
   pipe_mutex_unlock(drv->mutex);
@@ -256,6 +261,10 @@ vlVaCreateConfig(VADriverContextP ctx, VAProfile profile, 
VAEntrypoint entrypoin
   }
}
 
+   /* Default value if not specified in the input attributes. */
+   if (!config->rt_format)
+  config->rt_format = VA_RT_FORMAT_YUV420;
+
pipe_mutex_lock(drv->mutex);
*config_id = handle_table_add(drv->htab, config);
pipe_mutex_unlock(drv->mutex);
diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index 5e92980..f8513d9 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -419,7 +419,7 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID 
config_id,
/* vlVaCreateConfig returns PIPE_VIDEO_PROFILE_UNKNOWN
 * only for VAEntrypointVideoProc. */
if (config->profile == PIPE_VIDEO_PROFILE_UNKNOWN) {
-  if (config->rt_format == VA_RT_FORMAT_RGB32) {
+  if (config->rt_format & VA_RT_FORMAT_RGB32) {
  for (j = 0; j < ARRAY_SIZE(vpp_surface_formats); ++j) {
 attribs[i].type = VASurfaceAttribPixelFormat;
 attribs[i].value.type = VAGenericValueTypeInteger;
@@ -427,7 +427,8 @@ vlVaQuerySurfaceAttributes(VADriverContextP ctx, VAConfigID 
config_id,
 attribs[i].value.value.i = 
PipeFormatToVaFourcc(vpp_surface_formats[j]);
 i++;
  }
-  } else if (config->rt_format == VA_RT_FORMAT_YUV420) {
+  }
+  if (config->rt_format & VA_RT_FORMAT_YUV420) {
  attribs[i].type = VASurfaceAttribPixelFormat;
  attribs[i].value.type = VAGenericValueTypeInteger;
  attribs[i].flags = VA_SURFACE_ATTRIB_GETTABLE | 
VA_SURFACE_ATTRIB_SETTABLE;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: also honors interlaced preference when providing a video format

2016-09-12 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: bf901a2f8c8954e55a3eebc6cd1b725f18802012
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf901a2f8c8954e55a3eebc6cd1b725f18802012

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Sat Sep  3 09:10:21 2016 +0100

st/va: also honors interlaced preference when providing a video format

This fixes a crash when using the prefered video format with vaapisink
on Nvidia hardwares.
Also caught by the following assert:
  nouveau_vp3_video.c:91: Assertion `templat->interlaced' failed.

TEST= gst-launch-1.0 videotestsrc ! video/x-raw, format=NV12 ! vaapisink

Cc: <mesa-sta...@lists.freedesktop.org>
Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Tested-by: Víctor Manuel Jáquez Leal <vjaq...@igalia.com>
Tested-by: Boyuan Zhang <boyuan.zh...@amd.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/surface.c | 36 +
 1 file changed, 19 insertions(+), 17 deletions(-)

diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index 3ee1cdd..00df69d 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -632,24 +632,26 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int 
format,
 
memset(, 0, sizeof(templat));
 
+   templat.buffer_format = pscreen->get_video_param(
+  pscreen,
+  PIPE_VIDEO_PROFILE_UNKNOWN,
+  PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+  PIPE_VIDEO_CAP_PREFERED_FORMAT
+   );
+   templat.interlaced = pscreen->get_video_param(
+  pscreen,
+  PIPE_VIDEO_PROFILE_UNKNOWN,
+  PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+  PIPE_VIDEO_CAP_PREFERS_INTERLACED
+   );
+
if (expected_fourcc) {
-  templat.buffer_format = VaFourccToPipeFormat(expected_fourcc);
-  templat.interlaced = 0;
-   } else {
-  templat.buffer_format = pscreen->get_video_param
-(
-   pscreen,
-   PIPE_VIDEO_PROFILE_UNKNOWN,
-   PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
-   PIPE_VIDEO_CAP_PREFERED_FORMAT
-   );
-  templat.interlaced = pscreen->get_video_param
-(
-   pscreen,
-   PIPE_VIDEO_PROFILE_UNKNOWN,
-   PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
-   PIPE_VIDEO_CAP_PREFERS_INTERLACED
-   );
+  enum pipe_format expected_format = VaFourccToPipeFormat(expected_fourcc);
+
+  if (expected_format != templat.buffer_format || memory_attibute)
+templat.interlaced = 0;
+
+  templat.buffer_format = expected_format;
}
 
templat.chroma_format = ChromaToPipe(format);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/omx: retrieve preferred interlaced and buffer_formats

2016-06-27 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 23b7a83cc1484336e8af2b965d89ab532f4ee691
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=23b7a83cc1484336e8af2b965d89ab532f4ee691

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Tue Dec  1 08:10:42 2015 +

st/omx: retrieve preferred interlaced and buffer_formats

Interlaced can be true for nouveau driver.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/omx/vid_dec.c | 26 --
 1 file changed, 24 insertions(+), 2 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_dec.c 
b/src/gallium/state_trackers/omx/vid_dec.c
index 108a460..564ca2f 100644
--- a/src/gallium/state_trackers/omx/vid_dec.c
+++ b/src/gallium/state_trackers/omx/vid_dec.c
@@ -385,16 +385,38 @@ static OMX_ERRORTYPE 
vid_dec_MessageHandler(OMX_COMPONENTTYPE* comp, internalReq
 void vid_dec_NeedTarget(vid_dec_PrivateType *priv)
 {
struct pipe_video_buffer templat = {};
+   struct vl_screen *omx_screen;
+   struct pipe_screen *pscreen;
omx_base_video_PortType *port;
 
+   omx_screen = priv->screen;
port = (omx_base_video_PortType 
*)priv->ports[OMX_BASE_FILTER_INPUTPORT_INDEX];
 
+   assert(omx_screen);
+   assert(port);
+
+   pscreen = omx_screen->pscreen;
+
+   assert(pscreen);
+
if (!priv->target) {
-  templat.buffer_format = PIPE_FORMAT_NV12;
+  memset(, 0, sizeof(templat));
+
   templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
   templat.width = port->sPortParam.format.video.nFrameWidth;
   templat.height = port->sPortParam.format.video.nFrameHeight;
-  templat.interlaced = false;
+  templat.buffer_format = pscreen->get_video_param(
+pscreen,
+PIPE_VIDEO_PROFILE_UNKNOWN,
+PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+PIPE_VIDEO_CAP_PREFERED_FORMAT
+  );
+  templat.interlaced = pscreen->get_video_param(
+  pscreen,
+  PIPE_VIDEO_PROFILE_UNKNOWN,
+  PIPE_VIDEO_ENTRYPOINT_BITSTREAM,
+  PIPE_VIDEO_CAP_PREFERS_INTERLACED
+  );
   priv->target = priv->pipe->create_video_buffer(priv->pipe, );
}
 }

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/omx: count number of slices

2016-06-27 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 6e4cf937f8e742433a4320b1b847454a06dacf03
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6e4cf937f8e742433a4320b1b847454a06dacf03

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Mon Jan  4 22:17:59 2016 +

st/omx: count number of slices

Used by nouveau driver.
Similar patch was done for st/va:
851e7e12aa628d6781b5a3af2f2fc16ee73f435f

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/omx/vid_dec_h264.c | 3 +++
 1 file changed, 3 insertions(+)

diff --git a/src/gallium/state_trackers/omx/vid_dec_h264.c 
b/src/gallium/state_trackers/omx/vid_dec_h264.c
index 54f244b..bc7feaa 100644
--- a/src/gallium/state_trackers/omx/vid_dec_h264.c
+++ b/src/gallium/state_trackers/omx/vid_dec_h264.c
@@ -128,6 +128,7 @@ static void vid_dec_h264_BeginFrame(vid_dec_PrivateType 
*priv)
 
   priv->codec = priv->pipe->create_video_codec(priv->pipe, );
}
+   priv->picture.h264.slice_count = 0;
priv->codec->begin_frame(priv->codec, priv->target, >picture.base);
priv->frame_started = true;
 }
@@ -961,6 +962,7 @@ static void vid_dec_h264_Decode(vid_dec_PrivateType *priv, 
struct vl_vlc *vlc, u
 
if (priv->slice) {
   unsigned bytes = priv->bytes_left - (vl_vlc_bits_left(vlc) / 8);
+  ++priv->picture.h264.slice_count;
   priv->codec->decode_bitstream(priv->codec, priv->target, 
>picture.base,
 1, >slice, );
   priv->slice = NULL;
@@ -1018,6 +1020,7 @@ static void vid_dec_h264_Decode(vid_dec_PrivateType 
*priv, struct vl_vlc *vlc, u
 
   vid_dec_h264_BeginFrame(priv);
 
+  ++priv->picture.h264.slice_count;
   priv->codec->decode_bitstream(priv->codec, priv->target, 
>picture.base,
 1, , );
}

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/omx: add support for nouveau / interlaced

2016-06-27 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: e10f1fcebe28a3a37c143d33ff3be2ef0399e2e1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e10f1fcebe28a3a37c143d33ff3be2ef0399e2e1

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Tue Dec  8 21:50:03 2015 +

st/omx: add support for nouveau / interlaced

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/omx/vid_dec.c | 51 
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/src/gallium/state_trackers/omx/vid_dec.c 
b/src/gallium/state_trackers/omx/vid_dec.c
index 564ca2f..85ffb88 100644
--- a/src/gallium/state_trackers/omx/vid_dec.c
+++ b/src/gallium/state_trackers/omx/vid_dec.c
@@ -48,6 +48,7 @@
 #include "pipe/p_video_codec.h"
 #include "util/u_memory.h"
 #include "util/u_surface.h"
+#include "vl/vl_video_buffer.h"
 #include "vl/vl_vlc.h"
 
 #include "entrypoint.h"
@@ -515,34 +516,34 @@ static void vid_dec_FillOutput(vid_dec_PrivateType *priv, 
struct pipe_video_buff
OMX_VIDEO_PORTDEFINITIONTYPE *def = >sPortParam.format.video;
 
struct pipe_sampler_view **views;
-   struct pipe_transfer *transfer;
-   struct pipe_box box = { };
-   uint8_t *src, *dst;
+   unsigned i, j;
+   unsigned width, height;
 
views = buf->get_sampler_view_planes(buf);
 
-   dst = output->pBuffer;
-
-   box.width = def->nFrameWidth;
-   box.height = def->nFrameHeight;
-   box.depth = 1;
-
-   src = priv->pipe->transfer_map(priv->pipe, views[0]->texture, 0,
-  PIPE_TRANSFER_READ, , );
-   util_copy_rect(dst, views[0]->texture->format, def->nStride, 0, 0,
-  box.width, box.height, src, transfer->stride, 0, 0);
-   pipe_transfer_unmap(priv->pipe, transfer);
-
-   dst = ((uint8_t*)output->pBuffer) + (def->nStride * box.height);
-
-   box.width = def->nFrameWidth / 2;
-   box.height = def->nFrameHeight / 2;
-
-   src = priv->pipe->transfer_map(priv->pipe, views[1]->texture, 0,
-  PIPE_TRANSFER_READ, , );
-   util_copy_rect(dst, views[1]->texture->format, def->nStride, 0, 0,
-  box.width, box.height, src, transfer->stride, 0, 0);
-   pipe_transfer_unmap(priv->pipe, transfer);
+   for (i = 0; i < 2 /* NV12 */; i++) {
+  if (!views[i]) continue;
+  width = buf->width;
+  height = buf->height;
+  vl_video_buffer_adjust_size(, , i, buf->interlaced, 
buf->chroma_format);
+  for (j = 0; j < views[i]->texture->array_size; ++j) {
+ struct pipe_box box = {0, 0, j, width, height, 1};
+ struct pipe_transfer *transfer;
+ uint8_t *map, *dst;
+ map = priv->pipe->transfer_map(priv->pipe, views[i]->texture, 0,
+  PIPE_TRANSFER_READ, , );
+ if (!map)
+return;
+
+ dst = ((uint8_t*)output->pBuffer + output->nOffset) + j * 
def->nStride + i * buf->width * buf->height;
+ util_copy_rect(dst,
+views[i]->texture->format,
+def->nStride * views[i]->texture->array_size, 0, 0,
+box.width, box.height, map, transfer->stride, 0, 0);
+
+ pipe_transfer_unmap(priv->pipe, transfer);
+  }
+   }
 }
 
 static void vid_dec_FrameDecoded(OMX_COMPONENTTYPE *comp, 
OMX_BUFFERHEADERTYPE* input,

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: Check NULL pointer

2016-06-27 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 46dba701d81199e6450dc50ef3f0ff476dbfb17f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=46dba701d81199e6450dc50ef3f0ff476dbfb17f

Author: Gurkirpal Singh <gurkirpal...@gmail.com>
Date:   Sun Jun 26 12:50:25 2016 +0530

st/va: Check NULL pointer

Call to handle_table_get in vlVaDestroySurfaces can
return NULL on failure.

CID: 1243522

Signed-off-by: Gurkirpal Singh <gurkirpal...@gmail.com>
Reviewed-by: Julien Isorce <j.iso...@samsung.com>

---

 src/gallium/state_trackers/va/surface.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index 5efb893..3e74353 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -71,6 +71,10 @@ vlVaDestroySurfaces(VADriverContextP ctx, VASurfaceID 
*surface_list, int num_sur
pipe_mutex_lock(drv->mutex);
for (i = 0; i < num_surfaces; ++i) {
   vlVaSurface *surf = handle_table_get(drv->htab, surface_list[i]);
+  if (!surf) {
+ pipe_mutex_unlock(drv->mutex);
+ return VA_STATUS_ERROR_INVALID_SURFACE;
+  }
   if (surf->buffer)
  surf->buffer->destroy(surf->buffer);
   util_dynarray_fini(>subpics);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: ensure linear memory for dmabuf

2016-06-14 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 1cdb4da1d6ce94d947e41d4f0e568074f4f59577
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=1cdb4da1d6ce94d947e41d4f0e568074f4f59577

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Tue Jun 14 08:40:33 2016 +0100

st/va: ensure linear memory for dmabuf

In order to do zero-copy between two different devices
the memory should not be tiled.

Tested with GStreamer on a laptop that has 2 GPUs:
1- gstvaapidecode:
   HW decoding and dmabuf export with nouveau driver on Nvidia GPU.
2- glimagesink:
   EGLImage imports dmabuf on Intel GPU.

TEST: DRI_PRIME=1 gst-launch vaapidecodebin ! glimagesink

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/auxiliary/vl/vl_video_buffer.c | 2 +-
 src/gallium/include/pipe/p_video_codec.h   | 1 +
 src/gallium/state_trackers/va/surface.c| 8 
 3 files changed, 10 insertions(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c 
b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 4a68ac1..fdc9598 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -250,7 +250,7 @@ vl_video_buffer_template(struct pipe_resource *templ,
templ->height0 = tmpl->height;
templ->depth0 = depth;
templ->array_size = array_size;
-   templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET;
+   templ->bind = PIPE_BIND_SAMPLER_VIEW | PIPE_BIND_RENDER_TARGET | tmpl->bind;
templ->usage = usage;
 
vl_video_buffer_adjust_size(>width0, >height0, plane,
diff --git a/src/gallium/include/pipe/p_video_codec.h 
b/src/gallium/include/pipe/p_video_codec.h
index b5575ab..b4b2b9c 100644
--- a/src/gallium/include/pipe/p_video_codec.h
+++ b/src/gallium/include/pipe/p_video_codec.h
@@ -126,6 +126,7 @@ struct pipe_video_buffer
unsigned width;
unsigned height;
bool interlaced;
+   unsigned bind;
 
/**
 * destroy this video buffer
diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index 8a6a397..5efb893 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -621,6 +621,14 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int 
format,
 
   switch (memory_type) {
   case VA_SURFACE_ATTRIB_MEM_TYPE_VA:
+ /* The application will clear the TILING flag when the surface is
+  * intended to be exported as dmabuf. Adding shared flag because not
+  * null memory_attibute means VASurfaceAttribExternalBuffers is used.
+  */
+ if (memory_attibute &&
+ !(memory_attibute->flags & VA_SURFACE_EXTBUF_DESC_ENABLE_TILING))
+templat.bind = PIPE_BIND_LINEAR | PIPE_BIND_SHARED;
+
  surf->buffer = drv->pipe->create_video_buffer(drv->pipe, );
  if (!surf->buffer) {
 FREE(surf);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: use proper temp pipe_video_buffer template

2016-06-13 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: a04804746f6d05cda125a0778160d62c73a2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=a04804746f6d05cda125a0778160d62c73a2

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Thu Jun  2 15:03:34 2016 +0100

st/va: use proper temp pipe_video_buffer template

Instead of changing the format on the existing template
which makes error handling not nice and confuses coverity.

CoverityID: 1337953

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/image.c | 8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/va/image.c 
b/src/gallium/state_trackers/va/image.c
index 92d014c..1b956e3 100644
--- a/src/gallium/state_trackers/va/image.c
+++ b/src/gallium/state_trackers/va/image.c
@@ -473,19 +473,19 @@ vlVaPutImage(VADriverContextP ctx, VASurfaceID surface, 
VAImageID image,
 
if (format != surf->buffer->buffer_format) {
   struct pipe_video_buffer *tmp_buf;
-  enum pipe_format old_surf_format = surf->templat.buffer_format;
+  struct pipe_video_buffer templat = surf->templat;
 
-  surf->templat.buffer_format = format;
-  tmp_buf = drv->pipe->create_video_buffer(drv->pipe, >templat);
+  templat.buffer_format = format;
+  tmp_buf = drv->pipe->create_video_buffer(drv->pipe, );
 
   if (!tmp_buf) {
- surf->templat.buffer_format = old_surf_format;
  pipe_mutex_unlock(drv->mutex);
  return VA_STATUS_ERROR_ALLOCATION_FAILED;
   }
 
   surf->buffer->destroy(surf->buffer);
   surf->buffer = tmp_buf;
+  surf->templat.buffer_format = format;
}
 
views = surf->buffer->get_sampler_view_planes(surf->buffer);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: it is valid to release the VABuffer of an exported resource

2016-06-13 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 6c43e0016e344de3d7e82b098992cdfecbff2ab2
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=6c43e0016e344de3d7e82b098992cdfecbff2ab2

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Thu Jun  2 15:03:01 2016 +0100

st/va: it is valid to release the VABuffer of an exported resource

pipe_resource_reference(, NULL) will decrement reference counting,
i.e. p_atomic_dec(res->count). But the va surface still has the initial
reference since it has created the resource. So calling vaDestroyImage
on a derived image calls VaDestroyBuffer but the decrementation won't
reach 0. It is just wrong for vlVaDestroyBuffer to rely on the
export_refcount flag. Finally the vaapi intel driver has the same logic.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/buffer.c | 8 +---
 1 file changed, 1 insertion(+), 7 deletions(-)

diff --git a/src/gallium/state_trackers/va/buffer.c 
b/src/gallium/state_trackers/va/buffer.c
index 2fd8661..7d3167b 100644
--- a/src/gallium/state_trackers/va/buffer.c
+++ b/src/gallium/state_trackers/va/buffer.c
@@ -192,14 +192,8 @@ vlVaDestroyBuffer(VADriverContextP ctx, VABufferID buf_id)
   return VA_STATUS_ERROR_INVALID_BUFFER;
}
 
-   if (buf->derived_surface.resource) {
-  if (buf->export_refcount > 0) {
- pipe_mutex_unlock(drv->mutex);
- return VA_STATUS_ERROR_INVALID_BUFFER;
-  }
-
+   if (buf->derived_surface.resource)
   pipe_resource_reference(>derived_surface.resource, NULL);
-   }
 
FREE(buf->data);
FREE(buf);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): va: check null context in vlVaDestroyContext

2016-04-12 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 047e3264f67bc54365be7b0e163b6910a9e9de3a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=047e3264f67bc54365be7b0e163b6910a9e9de3a

Author: Iurie Salomov <iur...@gmail.com>
Date:   Tue Apr 12 23:24:30 2016 +0100

va: check null context in vlVaDestroyContext

Signed-off-by: Iurie Salomov <iur...@gmail.com>
Reviewed-by: Julien Isorce <j.iso...@samsung.com>

---

 src/gallium/state_trackers/va/context.c | 4 
 1 file changed, 4 insertions(+)

diff --git a/src/gallium/state_trackers/va/context.c 
b/src/gallium/state_trackers/va/context.c
index b25c381..25d587a 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -283,6 +283,10 @@ vlVaDestroyContext(VADriverContextP ctx, VAContextID 
context_id)
drv = VL_VA_DRIVER(ctx);
pipe_mutex_lock(drv->mutex);
context = handle_table_get(drv->htab, context_id);
+   if (!context) {
+  pipe_mutex_unlock(drv->mutex);
+  return VA_STATUS_ERROR_INVALID_CONTEXT;
+   }
 
if (context->decoder) {
   if (u_reduce_video_profile(context->decoder->profile) ==

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: avoid dereference after free in vlVaDestroyImage

2016-04-07 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: b9855dcdf7c94605305d6372d1f9883f76d10b6a
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b9855dcdf7c94605305d6372d1f9883f76d10b6a

Author: Thomas Hindoe Paaboel Andersen <pho...@gmail.com>
Date:   Sat Mar  5 13:07:07 2016 +0100

st/va: avoid dereference after free in vlVaDestroyImage

Cc: "11.1 11.2" <mesa-sta...@lists.freedesktop.org>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>
Tested-by: Julien Isorce <j.iso...@samsung.com>

---

 src/gallium/state_trackers/va/image.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/va/image.c 
b/src/gallium/state_trackers/va/image.c
index 2c42a98..92d014c 100644
--- a/src/gallium/state_trackers/va/image.c
+++ b/src/gallium/state_trackers/va/image.c
@@ -280,6 +280,7 @@ vlVaDestroyImage(VADriverContextP ctx, VAImageID image)
 {
vlVaDriver *drv;
VAImage  *vaimage;
+   VAStatus status;
 
if (!ctx)
   return VA_STATUS_ERROR_INVALID_CONTEXT;
@@ -294,8 +295,9 @@ vlVaDestroyImage(VADriverContextP ctx, VAImageID image)
 
handle_table_remove(VL_VA_DRIVER(ctx)->htab, image);
pipe_mutex_unlock(drv->mutex);
+   status = vlVaDestroyBuffer(ctx, vaimage->buf);
FREE(vaimage);
-   return vlVaDestroyBuffer(ctx, vaimage->buf);
+   return status;
 }
 
 VAStatus

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: count number of slices

2016-01-05 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 851e7e12aa628d6781b5a3af2f2fc16ee73f435f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=851e7e12aa628d6781b5a3af2f2fc16ee73f435f

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Tue Jan  5 15:02:47 2016 +

st/va: count number of slices

The counter was not set but used by the nouveau driver.
It is required otherwise visual output is garbage.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian Koenig <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/picture.c|8 
 src/gallium/state_trackers/va/picture_h264.c   |2 ++
 src/gallium/state_trackers/va/picture_mpeg12.c |6 ++
 src/gallium/state_trackers/va/picture_vc1.c|7 +++
 src/gallium/state_trackers/va/va_private.h |2 ++
 5 files changed, 25 insertions(+)

diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index 7b30bf8..da9ca5a 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -174,6 +174,14 @@ static void
 handleSliceParameterBuffer(vlVaContext *context, vlVaBuffer *buf)
 {
switch (u_reduce_video_profile(context->templat.profile)) {
+   case PIPE_VIDEO_FORMAT_MPEG12:
+  vlVaHandleSliceParameterBufferMPEG12(context, buf);
+  break;
+
+   case PIPE_VIDEO_FORMAT_VC1:
+  vlVaHandleSliceParameterBufferVC1(context, buf);
+  break;
+
case PIPE_VIDEO_FORMAT_MPEG4_AVC:
   vlVaHandleSliceParameterBufferH264(context, buf);
   break;
diff --git a/src/gallium/state_trackers/va/picture_h264.c 
b/src/gallium/state_trackers/va/picture_h264.c
index acbfe5d..883a94a 100644
--- a/src/gallium/state_trackers/va/picture_h264.c
+++ b/src/gallium/state_trackers/va/picture_h264.c
@@ -48,6 +48,7 @@ void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, 
vlVaContext *context,
unsigned i;
 
assert(buf->size >= sizeof(VAPictureParameterBufferH264) && 
buf->num_elements == 1);
+   context->desc.h264.slice_count = 0;
/*CurrPic*/
context->desc.h264.field_order_cnt[0] = h264->CurrPic.TopFieldOrderCnt;
context->desc.h264.field_order_cnt[1] = h264->CurrPic.BottomFieldOrderCnt;
@@ -162,6 +163,7 @@ void vlVaHandleSliceParameterBufferH264(vlVaContext 
*context, vlVaBuffer *buf)
VASliceParameterBufferH264 *h264 = buf->data;
 
assert(buf->size >= sizeof(VASliceParameterBufferH264) && buf->num_elements 
== 1);
+   context->desc.h264.slice_count += buf->num_elements;
context->desc.h264.num_ref_idx_l0_active_minus1 =
   h264->num_ref_idx_l0_active_minus1;
context->desc.h264.num_ref_idx_l1_active_minus1 =
diff --git a/src/gallium/state_trackers/va/picture_mpeg12.c 
b/src/gallium/state_trackers/va/picture_mpeg12.c
index e587b1e..812e9e5 100644
--- a/src/gallium/state_trackers/va/picture_mpeg12.c
+++ b/src/gallium/state_trackers/va/picture_mpeg12.c
@@ -32,6 +32,7 @@ void vlVaHandlePictureParameterBufferMPEG12(vlVaDriver *drv, 
vlVaContext *contex
VAPictureParameterBufferMPEG2 *mpeg2 = buf->data;
 
assert(buf->size >= sizeof(VAPictureParameterBufferMPEG2) && 
buf->num_elements == 1);
+   context->desc.mpeg12.num_slices = 0;
/*horizontal_size;*/
/*vertical_size;*/
vlVaGetReferenceFrame(drv, mpeg2->forward_reference_picture, 
>desc.mpeg12.ref[0]);
@@ -78,3 +79,8 @@ void vlVaHandleIQMatrixBufferMPEG12(vlVaContext *context, 
vlVaBuffer *buf)
   context->desc.mpeg12.non_intra_matrix = NULL;
 }
 
+void vlVaHandleSliceParameterBufferMPEG12(vlVaContext *context, vlVaBuffer 
*buf)
+{
+   assert(buf->size >= sizeof(VASliceParameterBufferMPEG2) && 
buf->num_elements == 1);
+   context->desc.mpeg12.num_slices += buf->num_elements;
+}
diff --git a/src/gallium/state_trackers/va/picture_vc1.c 
b/src/gallium/state_trackers/va/picture_vc1.c
index f95fd83..6ad1571 100644
--- a/src/gallium/state_trackers/va/picture_vc1.c
+++ b/src/gallium/state_trackers/va/picture_vc1.c
@@ -32,6 +32,7 @@ void vlVaHandlePictureParameterBufferVC1(vlVaDriver *drv, 
vlVaContext *context,
VAPictureParameterBufferVC1 * vc1 = buf->data;
 
assert(buf->size >= sizeof(VAPictureParameterBufferVC1) && 
buf->num_elements == 1);
+   context->desc.vc1.slice_count = 0;
vlVaGetReferenceFrame(drv, vc1->forward_reference_picture, 
>desc.vc1.ref[0]);
vlVaGetReferenceFrame(drv, vc1->backward_reference_picture, 
>desc.vc1.ref[1]);
context->desc.vc1.picture_type = vc1->picture_fields.bits.picture_type;
@@ -65,3 +66,9 @@ void vlVaHandlePictureParameterBufferVC1(vlVaDriver *drv, 
vlVaContext *context,
context->desc.vc1.deblockEnable = vc1->post_processing != 0;
context->desc.vc1.pquant = 
vc1->pic_quantizer_fields.bits.pic_quantizer_scale;
 }
+
+void vlVaHandleSliceParameterBufferVC1(vlVaContext *con

Mesa (master): st/va: retrieve size from the temporary img variable

2015-12-16 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 89eb342defb294400643759f2deb456a33b95e8f
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=89eb342defb294400643759f2deb456a33b95e8f

Author: Julien Isorce <julien.iso...@gmail.com>
Date:   Tue Dec 15 09:01:07 2015 +

st/va: retrieve size from the temporary img variable

"image" is not ready yet since it will be set at
the end of the function by: *image = *img;

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian Knig <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/image.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/state_trackers/va/image.c 
b/src/gallium/state_trackers/va/image.c
index ae07da8..8fb3c21 100644
--- a/src/gallium/state_trackers/va/image.c
+++ b/src/gallium/state_trackers/va/image.c
@@ -264,7 +264,7 @@ vlVaDeriveImage(VADriverContextP ctx, VASurfaceID surface, 
VAImage *image)
img->image_id = handle_table_add(drv->htab, img);
 
img_buf->type = VAImageBufferType;
-   img_buf->size = image->data_size;
+   img_buf->size = img->data_size;
img_buf->num_elements = 1;
img_buf->derived_surface.fence = surf->fence;
 

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: delay decoder creation until max_references is known

2015-12-01 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: b4fb6d76161d86c67697cf28a221d7913b8d084d
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=b4fb6d76161d86c67697cf28a221d7913b8d084d

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Thu Nov 26 08:29:54 2015 +

st/va: delay decoder creation until max_references is known

In general max_references cannot be based on num_render_targets.

This patch allows to allocate buffers with an accurate size.
I.e. no more than necessary. For other codecs it is a fixed
value 2.

This is similar behaviour as vaapi/vdpau-driver.

For now HEVC case defaults to num_render_targets as before.
But it could also benefits this change by setting a more
accurate max_references number in handlePictureParameterBuffer.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---

 src/gallium/state_trackers/va/context.c  |   48 --
 src/gallium/state_trackers/va/picture.c  |   48 +-
 src/gallium/state_trackers/va/picture_h264.c |4 +++
 src/gallium/state_trackers/va/va_private.h   |2 +-
 4 files changed, 68 insertions(+), 34 deletions(-)

diff --git a/src/gallium/state_trackers/va/context.c 
b/src/gallium/state_trackers/va/context.c
index f0051e5..192794f 100644
--- a/src/gallium/state_trackers/va/context.c
+++ b/src/gallium/state_trackers/va/context.c
@@ -187,7 +187,6 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID 
config_id, int picture_width,
   int picture_height, int flag, VASurfaceID *render_targets,
   int num_render_targets, VAContextID *context_id)
 {
-   struct pipe_video_codec templat = {};
vlVaDriver *drv;
vlVaContext *context;
int is_vpp;
@@ -213,27 +212,22 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID 
config_id, int picture_width,
  return VA_STATUS_ERROR_INVALID_CONTEXT;
   }
} else {
-  templat.profile = config_id;
-  templat.entrypoint = PIPE_VIDEO_ENTRYPOINT_BITSTREAM;
-  templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
-  templat.width = picture_width;
-  templat.height = picture_height;
-  templat.max_references = num_render_targets;
-  templat.expect_chunked_decode = true;
-
-  if (u_reduce_video_profile(templat.profile) ==
-PIPE_VIDEO_FORMAT_MPEG4_AVC)
-templat.level = u_get_h264_level(templat.width, templat.height,
- _references);
-
-  context->decoder = drv->pipe->create_video_codec(drv->pipe, );
-  if (!context->decoder) {
- FREE(context);
- return VA_STATUS_ERROR_ALLOCATION_FAILED;
-  }
-
-  if (u_reduce_video_profile(context->decoder->profile) ==
- PIPE_VIDEO_FORMAT_MPEG4_AVC) {
+  context->templat.profile = config_id;
+  context->templat.entrypoint = PIPE_VIDEO_ENTRYPOINT_BITSTREAM;
+  context->templat.chroma_format = PIPE_VIDEO_CHROMA_FORMAT_420;
+  context->templat.width = picture_width;
+  context->templat.height = picture_height;
+  context->templat.expect_chunked_decode = true;
+
+  switch (u_reduce_video_profile(context->templat.profile)) {
+  case PIPE_VIDEO_FORMAT_MPEG12:
+  case PIPE_VIDEO_FORMAT_VC1:
+  case PIPE_VIDEO_FORMAT_MPEG4:
+ context->templat.max_references = 2;
+ break;
+
+  case PIPE_VIDEO_FORMAT_MPEG4_AVC:
+ context->templat.max_references = 0;
  context->desc.h264.pps = CALLOC_STRUCT(pipe_h264_pps);
  if (!context->desc.h264.pps) {
 FREE(context);
@@ -245,10 +239,10 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID 
config_id, int picture_width,
 FREE(context);
 return VA_STATUS_ERROR_ALLOCATION_FAILED;
  }
-  }
+ break;
 
-  if (u_reduce_video_profile(context->decoder->profile) ==
-PIPE_VIDEO_FORMAT_HEVC) {
+ case PIPE_VIDEO_FORMAT_HEVC:
+ context->templat.max_references = num_render_targets;
  context->desc.h265.pps = CALLOC_STRUCT(pipe_h265_pps);
  if (!context->desc.h265.pps) {
 FREE(context);
@@ -260,6 +254,10 @@ vlVaCreateContext(VADriverContextP ctx, VAConfigID 
config_id, int picture_width,
 FREE(context);
 return VA_STATUS_ERROR_ALLOCATION_FAILED;
  }
+ break;
+
+  default:
+ break;
   }
}
 
diff --git a/src/gallium/state_trackers/va/picture.c 
b/src/gallium/state_trackers/va/picture.c
index 34e7d55..c7c377a 100644
--- a/src/gallium/state_trackers/va/picture.c
+++ b/src/gallium/state_trackers/va/picture.c
@@ -59,14 +59,17 @@ vlVaBeginPicture(VADriverContextP ctx, VAContextID 
context_id, VASurfaceID rende
   return VA_STATUS_ERROR_INVALID_SURFACE;
 
context->target = surf->buffer;
+
if (!context-&g

Mesa (master): st/va: also retrieve reference frames info for h264

2015-12-01 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: e483cba9f5ff45395fdb1cd40a796799707eb1e0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=e483cba9f5ff45395fdb1cd40a796799707eb1e0

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Thu Nov 26 08:30:30 2015 +

st/va: also retrieve reference frames info for h264

Other hardwares than AMD require to parse:
VAPictureParameterBufferH264.ReferenceFrames[16]

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/picture_h264.c |   52 ++
 1 file changed, 52 insertions(+)

diff --git a/src/gallium/state_trackers/va/picture_h264.c 
b/src/gallium/state_trackers/va/picture_h264.c
index f6e5b70..acbfe5d 100644
--- a/src/gallium/state_trackers/va/picture_h264.c
+++ b/src/gallium/state_trackers/va/picture_h264.c
@@ -29,9 +29,23 @@
 #include "util/u_video.h"
 #include "va_private.h"
 
+static void resetReferencePictureDesc(struct pipe_h264_picture_desc *h264,
+  unsigned int i)
+{
+   h264->ref[i] = NULL;
+   h264->frame_num_list[i] = 0;
+   h264->is_long_term[i] = 0;
+   h264->top_is_reference[i] = 0;
+   h264->bottom_is_reference[i] = 0;
+   h264->field_order_cnt_list[i][0] = 0;
+   h264->field_order_cnt_list[i][1] = 0;
+}
+
 void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, vlVaContext 
*context, vlVaBuffer *buf)
 {
VAPictureParameterBufferH264 *h264 = buf->data;
+   unsigned int top_or_bottom_field;
+   unsigned i;
 
assert(buf->size >= sizeof(VAPictureParameterBufferH264) && 
buf->num_elements == 1);
/*CurrPic*/
@@ -91,9 +105,47 @@ void vlVaHandlePictureParameterBufferH264(vlVaDriver *drv, 
vlVaContext *context,
   h264->pic_fields.bits.redundant_pic_cnt_present_flag;
/*reference_pic_flag*/
context->desc.h264.frame_num = h264->frame_num;
+   context->desc.h264.is_reference = h264->pic_fields.bits.reference_pic_flag;
+   context->desc.h264.bottom_field_flag =
+  h264->pic_fields.bits.field_pic_flag &&
+  (h264->CurrPic.flags & VA_PICTURE_H264_BOTTOM_FIELD) != 0;
 
if (!context->decoder && context->desc.h264.num_ref_frames > 0)
   context->templat.max_references = 
MIN2(context->desc.h264.num_ref_frames, 16);
+
+   for (i = 0; i < context->templat.max_references; ++i) {
+  if ((h264->ReferenceFrames[i].flags & VA_PICTURE_H264_INVALID) ||
+  (h264->ReferenceFrames[i].picture_id == VA_INVALID_SURFACE)) {
+ resetReferencePictureDesc(>desc.h264, i);
+ break;
+  }
+
+  vlVaGetReferenceFrame(drv, h264->ReferenceFrames[i].picture_id, 
>desc.h264.ref[i]);
+  context->desc.h264.frame_num_list[i] = 
h264->ReferenceFrames[i].frame_idx;
+
+  top_or_bottom_field = h264->ReferenceFrames[i].flags &
+ (VA_PICTURE_H264_TOP_FIELD | VA_PICTURE_H264_BOTTOM_FIELD);
+  context->desc.h264.is_long_term[i] = (h264->ReferenceFrames[i].flags &
+ (VA_PICTURE_H264_SHORT_TERM_REFERENCE |
+ VA_PICTURE_H264_LONG_TERM_REFERENCE)) !=
+ VA_PICTURE_H264_SHORT_TERM_REFERENCE;
+  context->desc.h264.top_is_reference[i] =
+ !context->desc.h264.is_long_term[i] ||
+ !!(h264->ReferenceFrames[i].flags & VA_PICTURE_H264_TOP_FIELD);
+  context->desc.h264.bottom_is_reference[i] =
+ !context->desc.h264.is_long_term[i] ||
+ !!(h264->ReferenceFrames[i].flags & VA_PICTURE_H264_BOTTOM_FIELD);
+  context->desc.h264.field_order_cnt_list[i][0] =
+ top_or_bottom_field != VA_PICTURE_H264_BOTTOM_FIELD ?
+ h264->ReferenceFrames[i].TopFieldOrderCnt: INT_MAX;
+  context->desc.h264.field_order_cnt_list[i][1] =
+ top_or_bottom_field != VA_PICTURE_H264_TOP_FIELD ?
+ h264->ReferenceFrames[i].BottomFieldOrderCnt: INT_MAX;
+   }
+
+   /* Make sure remaining elements are clean */
+   for (; i < 16; ++i)
+  resetReferencePictureDesc(>desc.h264, i);
 }
 
 void vlVaHandleIQMatrixBufferH264(vlVaContext *context, vlVaBuffer *buf)

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): vl/buffers: fixes vl_video_buffer_formats for RGBX

2015-11-30 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 10c14919c82b0fd209500d3ecd5a8bbb2653a5a1
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=10c14919c82b0fd209500d3ecd5a8bbb2653a5a1

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Fri Nov 27 08:55:55 2015 +

vl/buffers: fixes vl_video_buffer_formats for RGBX

Fixes: 42a5e143a8d "vl/buffers: add RGBX and BGRX to the supported formats"
Cc: mesa-sta...@lists.freedesktop.org
Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---

 src/gallium/auxiliary/vl/vl_video_buffer.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/auxiliary/vl/vl_video_buffer.c 
b/src/gallium/auxiliary/vl/vl_video_buffer.c
index 6cd2557..e8cd24d 100644
--- a/src/gallium/auxiliary/vl/vl_video_buffer.c
+++ b/src/gallium/auxiliary/vl/vl_video_buffer.c
@@ -115,7 +115,7 @@ vl_video_buffer_formats(struct pipe_screen *screen, enum 
pipe_format format)
   return const_resource_formats_VUYA;
 
case PIPE_FORMAT_R8G8B8X8_UNORM:
-  return const_resource_formats_VUYX;
+  return const_resource_formats_YUVX;
 
case PIPE_FORMAT_B8G8R8X8_UNORM:
   return const_resource_formats_VUYX;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: add missing profiles in PipeToProfile's switch.

2015-11-26 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: ca976e6900dc8ff457ed9dba661d037c616abc59
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=ca976e6900dc8ff457ed9dba661d037c616abc59

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Thu Nov 26 08:21:45 2015 +

st/va: add missing profiles in PipeToProfile's switch.

Otherwise assert is raised from vlVaQueryConfigProfiles's for loop.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian König <christian.koe...@amd.com>

---

 src/gallium/state_trackers/va/va_private.h |7 +++
 1 file changed, 7 insertions(+)

diff --git a/src/gallium/state_trackers/va/va_private.h 
b/src/gallium/state_trackers/va/va_private.h
index 6fb687b..98ca66a 100644
--- a/src/gallium/state_trackers/va/va_private.h
+++ b/src/gallium/state_trackers/va/va_private.h
@@ -148,6 +148,13 @@ PipeToProfile(enum pipe_video_profile profile)
case PIPE_VIDEO_PROFILE_HEVC_MAIN:
   return VAProfileHEVCMain;
case PIPE_VIDEO_PROFILE_MPEG4_AVC_EXTENDED:
+   case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH10:
+   case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH422:
+   case PIPE_VIDEO_PROFILE_MPEG4_AVC_HIGH444:
+   case PIPE_VIDEO_PROFILE_HEVC_MAIN_10:
+   case PIPE_VIDEO_PROFILE_HEVC_MAIN_12:
+   case PIPE_VIDEO_PROFILE_HEVC_MAIN_STILL:
+   case PIPE_VIDEO_PROFILE_HEVC_MAIN_444:
case PIPE_VIDEO_PROFILE_UNKNOWN:
   return VAProfileNone;
default:

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): nouveau: move interlaced assert down in nouveau_vp3_video_buffer_create

2015-11-25 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: 63c344d179a8bbfd56c5c08f576be728bfb3d6b0
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=63c344d179a8bbfd56c5c08f576be728bfb3d6b0

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Wed Nov 25 08:17:34 2015 +

nouveau: move interlaced assert down in nouveau_vp3_video_buffer_create

templat->interlaced is 0 if not NV12 which is the case currently
when using VPP.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Ilia Mirkin <imir...@alum.mit.edu>

---

 src/gallium/drivers/nouveau/nouveau_vp3_video.c |2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/gallium/drivers/nouveau/nouveau_vp3_video.c 
b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
index 4652e56..d76d932 100644
--- a/src/gallium/drivers/nouveau/nouveau_vp3_video.c
+++ b/src/gallium/drivers/nouveau/nouveau_vp3_video.c
@@ -83,10 +83,10 @@ nouveau_vp3_video_buffer_create(struct pipe_context *pipe,
struct pipe_sampler_view sv_templ;
struct pipe_surface surf_templ;
 
-   assert(templat->interlaced);
if (getenv("XVMC_VL") || templat->buffer_format != PIPE_FORMAT_NV12)
   return vl_video_buffer_create(pipe, templat);
 
+   assert(templat->interlaced);
assert(templat->chroma_format == PIPE_VIDEO_CHROMA_FORMAT_420);
 
buffer = CALLOC_STRUCT(nouveau_vp3_video_buffer);

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit


Mesa (master): st/va: properly use brackets in vlVaAcquireBufferHandle' s switch

2015-11-06 Thread Julien Isorce
Module: Mesa
Branch: master
Commit: bf6acbb2db4baaf18ae5a139142acf06e84d1b9c
URL:
http://cgit.freedesktop.org/mesa/mesa/commit/?id=bf6acbb2db4baaf18ae5a139142acf06e84d1b9c

Author: Julien Isorce <j.iso...@samsung.com>
Date:   Fri Nov  6 09:45:17 2015 +

st/va: properly use brackets in vlVaAcquireBufferHandle's switch

In "switch (mem_type)" the brackets were surrounding "case+default"
instead of "case" only.

Signed-off-by: Julien Isorce <j.iso...@samsung.com>
Reviewed-by: Christian Knig <christian.koe...@amd.com>
Reviewed-by: Emil Velikov <emil.l.veli...@gmail.com>

---

 src/gallium/state_trackers/va/buffer.c |9 -
 1 file changed, 4 insertions(+), 5 deletions(-)

diff --git a/src/gallium/state_trackers/va/buffer.c 
b/src/gallium/state_trackers/va/buffer.c
index 47bf35a..769305e 100644
--- a/src/gallium/state_trackers/va/buffer.c
+++ b/src/gallium/state_trackers/va/buffer.c
@@ -280,15 +280,14 @@ vlVaAcquireBufferHandle(VADriverContextP ctx, VABufferID 
buf_id,
 
  buf_info->handle = (intptr_t)whandle.handle;
  break;
+  }
   default:
  return VA_STATUS_ERROR_UNSUPPORTED_MEMORY_TYPE;
   }
-   }
-
-   buf_info->type = buf->type;
-   buf_info->mem_type = mem_type;
-   buf_info->mem_size = buf->num_elements * buf->size;
 
+  buf_info->type = buf->type;
+  buf_info->mem_type = mem_type;
+  buf_info->mem_size = buf->num_elements * buf->size;
}
 
buf->export_refcount++;

___
mesa-commit mailing list
mesa-commit@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-commit