]> git.sesse.net Git - nageru/commitdiff
Give in the right VAAPI context when encoding MJPEG.
authorSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 15 May 2020 17:52:56 +0000 (19:52 +0200)
committerSteinar H. Gunderson <sgunderson@bigfoot.com>
Fri, 15 May 2020 17:57:55 +0000 (19:57 +0200)
The context ID was typoed, and we used the config ID instead.
This seemingly worked with the older Intel drivers (they didn't care
about the context ID), but not with the newer ones.

nageru/mjpeg_encoder.cpp

index 4cc929b88d5083f0fb30b80a9b199c256cf8abe1..f991a4ba00c651620986a5a770c96fea56d20de8 100644 (file)
@@ -488,7 +488,7 @@ MJPEGEncoder::VAResources MJPEGEncoder::get_va_resources(unsigned width, unsigne
        va_status = vaCreateContext(va_dpy->va_dpy, config_id, width, height, 0, &ret.surface, 1, &ret.context);
        CHECK_VASTATUS(va_status, "vaCreateContext");
 
-       va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAEncCodedBufferType, width * height * 3 + 8192, 1, nullptr, &ret.data_buffer);
+       va_status = vaCreateBuffer(va_dpy->va_dpy, ret.context, VAEncCodedBufferType, width * height * 3 + 8192, 1, nullptr, &ret.data_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
 
        va_status = vaCreateImage(va_dpy->va_dpy, &uyvy_format, width, height, &ret.image);
@@ -790,22 +790,22 @@ void MJPEGEncoder::encode_jpeg_va(QueuedFrame &&qf)
        va_data.pic_param.coded_buf = resources.data_buffer;
 
        VABufferID pic_param_buffer;
-       VAStatus va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAEncPictureParameterBufferType, sizeof(va_data.pic_param), 1, &va_data.pic_param, &pic_param_buffer);
+       VAStatus va_status = vaCreateBuffer(va_dpy->va_dpy, resources.context, VAEncPictureParameterBufferType, sizeof(va_data.pic_param), 1, &va_data.pic_param, &pic_param_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
        VABufferDestroyer destroy_pic_param(va_dpy->va_dpy, pic_param_buffer);
 
        VABufferID q_buffer;
-       va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAQMatrixBufferType, sizeof(va_data.q), 1, &va_data.q, &q_buffer);
+       va_status = vaCreateBuffer(va_dpy->va_dpy, resources.context, VAQMatrixBufferType, sizeof(va_data.q), 1, &va_data.q, &q_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
        VABufferDestroyer destroy_iq(va_dpy->va_dpy, q_buffer);
 
        VABufferID huff_buffer;
-       va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAHuffmanTableBufferType, sizeof(va_data.huff), 1, &va_data.huff, &huff_buffer);
+       va_status = vaCreateBuffer(va_dpy->va_dpy, resources.context, VAHuffmanTableBufferType, sizeof(va_data.huff), 1, &va_data.huff, &huff_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
        VABufferDestroyer destroy_huff(va_dpy->va_dpy, huff_buffer);
 
        VABufferID slice_param_buffer;
-       va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAEncSliceParameterBufferType, sizeof(va_data.parms), 1, &va_data.parms, &slice_param_buffer);
+       va_status = vaCreateBuffer(va_dpy->va_dpy, resources.context, VAEncSliceParameterBufferType, sizeof(va_data.parms), 1, &va_data.parms, &slice_param_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
        VABufferDestroyer destroy_slice_param(va_dpy->va_dpy, slice_param_buffer);
 
@@ -848,12 +848,12 @@ void MJPEGEncoder::encode_jpeg_va(QueuedFrame &&qf)
        header_parm.bit_length = 8 * va_data.jpeg_header.size();
 
        VABufferID header_parm_buffer;
-       va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAEncPackedHeaderParameterBufferType, sizeof(header_parm), 1, &header_parm, &header_parm_buffer);
+       va_status = vaCreateBuffer(va_dpy->va_dpy, resources.context, VAEncPackedHeaderParameterBufferType, sizeof(header_parm), 1, &header_parm, &header_parm_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
        VABufferDestroyer destroy_header(va_dpy->va_dpy, header_parm_buffer);
 
        VABufferID header_data_buffer;
-       va_status = vaCreateBuffer(va_dpy->va_dpy, config_id, VAEncPackedHeaderDataBufferType, va_data.jpeg_header.size(), 1, va_data.jpeg_header.data(), &header_data_buffer);
+       va_status = vaCreateBuffer(va_dpy->va_dpy, resources.context, VAEncPackedHeaderDataBufferType, va_data.jpeg_header.size(), 1, va_data.jpeg_header.data(), &header_data_buffer);
        CHECK_VASTATUS(va_status, "vaCreateBuffer");
        VABufferDestroyer destroy_header_data(va_dpy->va_dpy, header_data_buffer);