Bug 103669 - clCreateBufferFromLibvaIntel mixes the bytes in the buffer
Summary: clCreateBufferFromLibvaIntel mixes the bytes in the buffer
Alias: None
Product: Beignet
Classification: Unclassified
Component: Beignet (show other bugs)
Version: unspecified
Hardware: x86-64 (AMD64) Linux (All)
: medium normal
Assignee: Zhigang Gong
QA Contact:
Depends on:
Reported: 2017-11-10 16:07 UTC by Nikolai Lubiagov
Modified: 2018-10-12 21:24 UTC (History)
1 user (show)

See Also:
i915 platform:
i915 features:

Modifyed example, to repeat bug (123.90 KB, application/gzip)
2017-11-10 16:07 UTC, Nikolai Lubiagov

Description Nikolai Lubiagov 2017-11-10 16:07:56 UTC
Created attachment 135376 [details]
Modifyed example, to repeat bug

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.
Comment 1 GitLab Migration User 2018-10-12 21:24:49 UTC
-- GitLab Migration Automatic Message --

This bug has been migrated to freedesktop.org's GitLab instance and has been closed from further activity.

You can subscribe and participate further through the new bug through this link to our GitLab instance: https://gitlab.freedesktop.org/beignet/beignet/issues/36.

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.