Re: [Mesa-dev] [PATCH 08/11] st/va: clear the video surface on allocation

2017-03-24 Thread Andy Furniss

Andy Furniss wrote:

ping.


Christian König wrote:

From: Christian König 

This makes debugging of decoding problems quite a bit easier.


This breaks gstreamer encode for me.

ffmpeg is OK, but then IIRC ffmpeg only uses one of something that
gstreamer uses two of, not wishing to get too technical here :-)

Whatever the cause, gst is twice as fast as ffmpeg and with this
I get -

[drm:amdgpu_vce_cs_reloc [amdgpu]] *ERROR* BO to small for addr
0x01000b 48 47

andy [vce-tests]$ time gst-launch-1.0 -f filesrc
location=/mnt/ramdisk/trees-1440p50.nv12 blocksize=5529600 !
video/x-raw,format=NV12,width=2560,height=1440,framerate=50/1,pixel-aspect-ratio=1/1
! queue ! vaapih264enc  rate-control=cbr bitrate=1
keyframe-period=25 max-bframes=0 ! video/x-h264, profile=main ! filesink
location=/mnt/ramdisk/gst.264
libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_40
libva info: va_openDriver() returns 0
libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_40
libva info: va_openDriver() returns 0
Setting pipeline to PAUSED ...
libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_40
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context,
gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayGLX\)\
vaapidisplayglx1";
0:00:01.134997848   790  0x19310f0 ERROR   vaapivideomemory
gstvaapivideomemory.c:736:gst_video_info_update_from_surface: Cannot
create a VA derived image from surface 0x7fefcc002b70
amdgpu: The CS has been rejected, see dmesg for more information (-22).
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
0:00:01.157992874   790 0x7fefcc0028a0 ERRORvaapiencode
gstvaapiencode.c:210:gst_vaapiencode_default_alloc_buffer: invalid
GstVaapiCodedBuffer size (0 bytes)
amdgpu: The CS has been cancelled because the context is lost.
0:00:01.161509344   790 0x7fefcc0028a0 ERRORvaapiencode
gstvaapiencode.c:316:gst_vaapiencode_push_frame: failed to allocate
encoded buffer in system memory
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.




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


Re: [Mesa-dev] [PATCH 08/11] st/va: clear the video surface on allocation

2017-03-16 Thread Andy Furniss

Christian König wrote:

From: Christian König 

This makes debugging of decoding problems quite a bit easier.


This breaks gstreamer encode for me.

ffmpeg is OK, but then IIRC ffmpeg only uses one of something that
gstreamer uses two of, not wishing to get too technical here :-)

Whatever the cause, gst is twice as fast as ffmpeg and with this
I get -

[drm:amdgpu_vce_cs_reloc [amdgpu]] *ERROR* BO to small for addr 
0x01000b 48 47


andy [vce-tests]$ time gst-launch-1.0 -f filesrc 
location=/mnt/ramdisk/trees-1440p50.nv12 blocksize=5529600 ! 
video/x-raw,format=NV12,width=2560,height=1440,framerate=50/1,pixel-aspect-ratio=1/1 
! queue ! vaapih264enc  rate-control=cbr bitrate=1 
keyframe-period=25 max-bframes=0 ! video/x-h264, profile=main ! filesink 
location=/mnt/ramdisk/gst.264

libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_40
libva info: va_openDriver() returns 0
libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_40
libva info: va_openDriver() returns 0
Setting pipeline to PAUSED ...
libva info: VA-API version 0.40.0
libva info: va_getDriverName() returns 0
libva info: User requested driver 'radeonsi'
libva info: Trying to open /usr/lib/dri/radeonsi_drv_video.so
libva info: Found init function __vaDriverInit_0_40
libva info: va_openDriver() returns 0
Pipeline is PREROLLING ...
Got context from element 'vaapiencodeh264-0': gst.vaapi.Display=context, 
gst.vaapi.Display=(GstVaapiDisplay)"\(GstVaapiDisplayGLX\)\ 
vaapidisplayglx1";
0:00:01.134997848   790  0x19310f0 ERROR   vaapivideomemory 
gstvaapivideomemory.c:736:gst_video_info_update_from_surface: Cannot 
create a VA derived image from surface 0x7fefcc002b70

amdgpu: The CS has been rejected, see dmesg for more information (-22).
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
0:00:01.157992874   790 0x7fefcc0028a0 ERRORvaapiencode 
gstvaapiencode.c:210:gst_vaapiencode_default_alloc_buffer: invalid 
GstVaapiCodedBuffer size (0 bytes)

amdgpu: The CS has been cancelled because the context is lost.
0:00:01.161509344   790 0x7fefcc0028a0 ERRORvaapiencode 
gstvaapiencode.c:316:gst_vaapiencode_push_frame: failed to allocate 
encoded buffer in system memory

amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.
amdgpu: The CS has been cancelled because the context is lost.


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


[Mesa-dev] [PATCH 08/11] st/va: clear the video surface on allocation

2017-03-08 Thread Christian König
From: Christian König 

This makes debugging of decoding problems quite a bit easier.

Signed-off-by: Christian König 
---
 src/gallium/state_trackers/va/surface.c | 39 +
 1 file changed, 35 insertions(+), 4 deletions(-)

diff --git a/src/gallium/state_trackers/va/surface.c 
b/src/gallium/state_trackers/va/surface.c
index 3561117..543a00a 100644
--- a/src/gallium/state_trackers/va/surface.c
+++ b/src/gallium/state_trackers/va/surface.c
@@ -553,6 +553,39 @@ suface_from_external_memory(VADriverContextP ctx, 
vlVaSurface *surface,
return VA_STATUS_SUCCESS;
 }
 
+static VAStatus
+surface_allocate(VADriverContextP ctx, vlVaSurface *surface,
+struct pipe_video_buffer *templat)
+{
+   vlVaDriver *drv;
+   struct pipe_surface **surfaces;
+   unsigned i;
+
+   drv = VL_VA_DRIVER(ctx);
+
+   surface->buffer = drv->pipe->create_video_buffer(drv->pipe, templat);
+   if (!surface->buffer)
+  return VA_STATUS_ERROR_ALLOCATION_FAILED;
+
+   surfaces = surface->buffer->get_surfaces(surface->buffer);
+   for (i = 0; i < VL_MAX_SURFACES; ++i) {
+  union pipe_color_union c = {};
+
+  if (!surfaces[i])
+ continue;
+
+  if (i > !!surface->buffer->interlaced)
+ c.f[0] = c.f[1] = c.f[2] = c.f[3] = 0.5f;
+
+  drv->pipe->clear_render_target(drv->pipe, surfaces[i], &c, 0, 0,
+surfaces[i]->width, surfaces[i]->height,
+false);
+   }
+   drv->pipe->flush(drv->pipe, NULL, 0);
+
+   return VA_STATUS_SUCCESS;
+}
+
 VAStatus
 vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int format,
 unsigned int width, unsigned int height,
@@ -695,11 +728,9 @@ vlVaCreateSurfaces2(VADriverContextP ctx, unsigned int 
format,
  !(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, &templat);
- if (!surf->buffer) {
-vaStatus = VA_STATUS_ERROR_ALLOCATION_FAILED;
+vaStatus = surface_allocate(ctx, surf, &templat);
+ if (vaStatus != VA_STATUS_SUCCESS)
 goto free_surf;
- }
  break;
 
   case VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME:
-- 
2.7.4

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