clCreateBufferFromLibvaIntel mixes the bytes in the buffer
Submitted by Nikolai Lubiagov
Assigned to Zhigang Gong @gongzg
Link to original bug (#103669)
Description
Created attachment 135376 Modifyed example, to repeat bug
Hello! I'm trying to learn OpenCL, and in this case I'm interested in interacting with LibVA. And it seems to have found a bug. To repeat the bug, I wrote an example, libva_buffer_sharing.cpp. The meaning is that by the operation of the function clCreateBufferFromLibvaIntel, the bytes are very interestingly mixed.
To restore them, for the image, with a width of 640px, I was able to do this:
staus = clEnqueueReadBuffer (q, resmem, CL_TRUE, 0, total, datat, 0, NULL, NULL); CHECK_CLSTATUS (staus, "clEnqueueReadBuffer");
QFile f ("/ home / nick1710 / testimg2a.pgm"); f.open (QFile :: WriteOnly); f.write ("P5 \ n640 1440 \ n255 \ n");
for (int j = 0; j <640 * 480 * 3; j + = (640 * 32)) { for (int n = 0; n <32; ++ n) {// 0x200 / 0x10 (512/16) for (int k = 0; k <(640/16); ++ k) { f.write (& datat [j + (k * 512) + (n * 16)], 16); } } } f.close ();
ie the first 640 bytes, have blocks of 16 bytes in steps of 512 bytes. Next, 640, in the same memory, with a 10-byte offset. And so on, 32 times. Then the next blended block begins.
I wanted to use this memory object with OpenCV, but convertFromBuffer to UMat object, requires the CL_MEM_OBJECT_BUFFER memory type, by this reason try use this function.
The function, clCreateImageFromLibvaIntel work fine. In archive i am, also attach sample pgm images.
CPU: Intel Core i3-6098P (SkyLake) GPU: Intel HD Graphics 510 Motheboard: Gidabyte GA-H110M-S2V OS: Ubuntu 17.10, Beignet 1.3.1 from repo, and from sources, also Beignet 1.3.2.
Attachment 135376, "Modifyed example, to repeat bug":
bug.tar.gz