[Beignet] About "beignet-openCL and libva/VAAPI"
Weng, Chuanbo
chuanbo.weng at intel.com
Mon Aug 25 01:13:16 PDT 2014
Hi Tu,
It’s ok that just creating one surface NV12 surface, then always decoding H.264 frame
to this surface.
I’m not sure why your problem happened. Is it possible to send your code to us and
tell us the steps to reproduce your issue. Then I can dig into it.
Also cc Yakui.
Thanks,
Chuanbo Weng
From: Tu Muramastu [mailto:muramastu at gmail.com]
Sent: Thursday, August 21, 2014 18:00
To: Weng, Chuanbo
Subject: Re: About "beignet-openCL and libva/VAAPI"
Hi~ Chuanbo Wen,
I've tried to fill the attribute as your example and the vaSurface can be created successfully. (format is NV12)
I use ffmpeg with libva to decode H.264 frames on the vaSurface and call vaPutSurface() to show the surface on UI (refer to the sample in: https://gitorious.org/hwdecode-demos/). The frames look incorrectly at the first 20 frames and the 21th and following frames become correct, so I do a small test: fill the cl_mem as "000...000" (make the surface look green) before calling PutSuface(). Then, the first 20 frame indeed looks green as my expectation and the following frames become normal video content again. It looks like that they doesn't share memory anymore.
Do I need to create the new surface whenever before decoding a frame? (I though just one surface created at the beginning and the frames decoded on the same surface.)
Thanks for your time!
BR,
Tu
On Mon, Aug 18, 2014 at 4:43 PM, Tu Muramastu <muramastu at gmail.com<mailto:muramastu at gmail.com>> wrote:
Hi Chuanbo Weng,
Got it! Thanks for your helpful replying!
I will try it. Thanks again!
BR,
Tu
On Fri, Aug 15, 2014 at 6:34 PM, Weng, Chuanbo <chuanbo.weng at intel.com<mailto:chuanbo.weng at intel.com>> wrote:
Hi Tu,
If you are using the #1 way, using generic libva (master branch or release version) is
enough, no need to switch to a staging branch. (But there is a bug of libva when using the
#1 way if libva is not new enough. So please check your libva revision, if it is older than Feb
2014, you should update your libva.)
The reason you received VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT is that
you hadn’t filled the attribute structure correctly. Here are what I fill to it, you can take it as
a reference:
VASurfaceID bgra_surface_id;
int bgra_fd;
status = clGetMemObjectFd(context, (cl_mem)new_om.data, &bgra_fd);
CHECK_CLSTATUS(status, "clGetMemObjectFdIntel");
VASurfaceAttrib sa[2];
sa[0].type = VASurfaceAttribMemoryType;
sa[0].flags = VA_SURFACE_ATTRIB_SETTABLE;
sa[0].value.type = VAGenericValueTypeInteger;
sa[0].value.value.i = VA_SURFACE_ATTRIB_MEM_TYPE_DRM_PRIME;
sa[1].type = VASurfaceAttribExternalBufferDescriptor;
sa[1].flags = VA_SURFACE_ATTRIB_SETTABLE;
sa[1].value.type = VAGenericValueTypePointer;
VASurfaceAttribExternalBuffers sa_eb;
sa_eb.pixel_format = VA_FOURCC_BGRA;
sa_eb.width = new_om.cols;
sa_eb.height = new_om.rows;
sa_eb.data_size = new_om.step * new_om.rows;
sa_eb.num_planes = 1;
sa_eb.pitches[0] = new_om.step;
sa_eb.offsets[0] = 0;
sa_eb.num_buffers = 1;
sa_eb.buffers = (unsigned long *)malloc(sizeof(unsigned long)*sa_eb.num_buffers);
sa_eb.buffers[0] = bgra_fd;
sa_eb.flags = 0;
sa[1].value.value.p = &sa_eb;
va_status = vaCreateSurfaces(va_dpy, surface_type,
new_om.cols, new_om.rows,
&bgra_surface_id, 1, sa, 2);
Thanks,
Chuanbo Weng
From: Tu Muramastu [mailto:muramastu at gmail.com<mailto:muramastu at gmail.com>]
Sent: Friday, August 15, 2014 15:54
To: Weng, Chuanbo
Subject: About "beignet-openCL and libva/VAAPI"
Hi! Chuanbo Weng,
I'm find a way to share memory between libva and opencl without memory copy and just read the post you wrote "https://www.mail-archive.com/beignet@lists.freedesktop.org/msg02099.html" and thanks for your sharing.
Several things I want to make sure.Could you help me to figure them out?
1. For #1 way (using "clGetMemObjectFdIntel"), using generic libva is enough (no need to use the branch), right?
2. I filled the attribute structure as the following,
VASurfaceAttrib surfaceAttrib;
surfaceAttrib.type = VASurfaceAttribExternalBufferDescriptor; // ?? (not very sure)
surfaceAttrib.flags = VA_SURFACE_ATTRIB_SETTABLE;
surfaceAttrib.value.type = VASurfaceAttribUsageHint;
surfaceAttrib.value.value.p = vaapi->cl_fd;
Then, vaCreateSurfaces() returns "VA_STATUS_ERROR_UNSUPPORTED_RT_FORMAT". Do you know what mistake I did?
Thanks a lot !!
BR,
Tu
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/beignet/attachments/20140825/126ed3b3/attachment-0001.html>
More information about the Beignet
mailing list