[Beignet] About "beignet-openCL and libva/VAAPI"
Weng, Chuanbo
chuanbo.weng at intel.com
Fri Aug 15 03:34:17 PDT 2014
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]
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/20140815/5ce9834e/attachment-0001.html>
More information about the Beignet
mailing list