[Libva] VAAPI encoding with Intel Sandybridge GPU

Ratin ratin3 at gmail.com
Fri Aug 10 18:27:18 PDT 2012


On Fri, Aug 10, 2012 at 5:59 PM, Xiang, Haihao <haihao.xiang at intel.com> wrote:
>
>
>> -----Original Message-----
>> From: Ratin [mailto:ratin3 at gmail.com]
>> Sent: Saturday, August 11, 2012 6:22 AM
>> To: Xiang, Haihao
>> Cc: Libva at lists.freedesktop.org
>> Subject: Re: [Libva] VAAPI encoding with Intel Sandybridge GPU
>>
>> Hi Haihao, Thanks a lot for your quick reply!
>>
>> On Thu, Aug 9, 2012 at 10:41 PM, Xiang, Haihao <haihao.xiang at intel.com>
>> wrote:
>> >
>> >> Hi,
>> >>
>> >> I am trying to use libva with Intel driver back-end for decode and
>> >> encode. Decoding works like charm, but when I try to encode, I get
>> >> some problems.
>> >
>> > Which branch are you using, staging or master ? Encoder on staging has
>> > more features.
>>
>> I was using an older version libva-1.0.15 and  intel-driver-1.0.17. I tried to
>> compile the latest versions (master branch?) from git repos
>> git://anongit.freedesktop.org/git/libva and
>> git://anongit.freedesktop.org/vaapi/intel-driver and  but met with some
>> compile errorrs in intel-driver:
>>
>> CC     i965_drv_video_la-gen6_mfc.lo
>> gen6_mfc.c: In function 'gen6_mfc_avc_pipeline_programing':
>> gen6_mfc.c:763:5: error: unknown type name
>> 'VAEncSequenceParameterBufferH264'
>> gen6_mfc.c:763:61: error: 'VAEncSequenceParameterBufferH264'
>> undeclared (first use in this function)
>> gen6_mfc.c:763:61: note: each undeclared identifier is reported only once for
>> each function it appears in
>> gen6_mfc.c:763:95: error: expected expression before ')' token
>> gen6_mfc.c:782:40: error: request for member 'initial_qp' in something not a
>> structure or union
>> gen6_mfc.c: In function 'gen6_mfc_avc_prepare':
>> gen6_mfc.c:848:5: error: unknown type name
>> 'VAEncPictureParameterBufferH264'
>> gen6_mfc.c:848:55: error: 'VAEncPictureParameterBufferH264' undeclared
>> (first use in this function)
>> gen6_mfc.c:848:88: error: expected expression before ')' token
>> gen6_mfc.c:852:19: error: request for member 'reconstructed_picture'
>> in something not a structure or union
>> gen6_mfc.c:863:19: error: request for member 'reference_picture' in
>> something not a structure or union
>> gen6_mfc.c:875:18: error: request for member 'coded_buf' in something not a
>> structure or union
>> gen6_mfc.c: At top level:
>> gen6_mfc.c:388:13: warning: 'gen6_mfc_avc_directmode_state' defined but
>> not used [-Wunused-function]
>> gen6_mfc.c:599:1: warning: 'gen6_mfc_avc_insert_object' defined but not
>> used [-Wunused-function]
>> make[3]: *** [i965_drv_video_la-gen6_mfc.lo] Error 1
>>
>> VAEncPictureParameterBufferH264 is declared in va.h but even if I explicitly
>> add the include file, it still cant find the struct.
>
> A strange error :(.  Could you use 'make V=1' to see what is the executing commands ?


Actually after getting the staging version as a zip file for the
intel-driver (as opposed to head version) solved the problem.

I do have multiple versions but there is only one version that I am
working with at any given point, I do a make install from respective
folder so
it copies the headers and libraries in /usr/local/lib and /usr/local/include.

So I guess the next step for me should be to apply the minimal amount
of changes in my code that will work like avcenc. I am working with
decoding frames from IP cameras and optionally re-encoding the decoded
surfaces (essentially sharing the surface between enc and dec
contexts), so its a bit more complicated than dumping YUV data from a
file.

Thanks,

Ratin

>>
>>
>>
>> >> I got the same errors using the sample code provided by Intel for
>> >> encoding , I get the error :
>> >>
>> >> video: 720x480; fourcc:0x56595559
>> >> negotiated frame resolution: 640x480
>> >> libva: VA-API version 0.32.0
>> >> libva: va_getDriverName() returns 0
>> >> libva: Trying to open /usr/local/lib/dri/i965_drv_video.so
>> >> libva: va_openDriver() returns 0
>> >> encode frame:0
>> >> h264enc: i965_drv_video.c:1408: i965_EndPicture: Assertion
>> >> `obj_context->codec_state.encode.seq_param' failed.
>> >> Aborted
>> >
>> > Try with avcenc in test/encode
>> >
>>
>> For now , I am just focusing on any successful encoding , so I recompiled the
>> older version of Intel  driver version and went ahead to encode an yuv video
>> file using avcenc. After some fixing here and there (mostly
>> rate_control_method defaulting to 16 which the older driver does not support )
>> I am stuck at a point where its trying to create the buffer inside begin_picture
>> function:
>
> The older driver should work. Could you double check whether there is another libva in your machine ?
>


>>  va_status = vaCreateBuffer(va_dpy,
>>                                    avcenc_context.context_id,
>>
>> VAEncPackedHeaderParameterBufferType,
>>                                    sizeof(packed_header_param_buffer),
>> 1, &packed_header_param_buffer,
>>
>> &avcenc_context.packed_seq_header_param_buf_id);
>>         CHECK_VASTATUS(va_status,"vaCreateBuffer");
>>
>> (gdb) p va_status
>> $6 = 15
>> (gdb) n
>> begin_picture:vaCreateBuffer (467) failed,exit [Inferior 1 (process 15135) exited
>> with code 01]
>> warning: Error removing breakpoint 0
>> warning: Error removing breakpoint 0
>> warning: Error removing breakpoint 0
>> warning: Error removing breakpoint 0
>> warning: Error removing breakpoint 0
>>
>> so I think I need to successfully compile the latest intel-driver. Is
>> git://anongit.freedesktop.org/git/libva and
>> git://anongit.freedesktop.org/vaapi/intel-driver the right repository to use?
>>
>
> Yes. Note you should use same branch name for libva and intel-driver.
>
> Thanks
> Haihao
>
>> Thanks and regards,
>>
>> Ratin


More information about the Libva mailing list