summaryrefslogtreecommitdiffstats
path: root/src/gallium/state_trackers/va/picture.c
Commit message (Collapse)AuthorAgeFilesLines
* st/va: parse VP9 uncompressed frame headerLeo Liu2018-04-121-1/+1
| | | | | | | To get some of UVD required parameters. Signed-off-by: Leo Liu <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: add handles for VP9 buffersLeo Liu2018-04-121-0/+11
| | | | | Signed-off-by: Leo Liu <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: add HEVC encode functionsBoyuan Zhang2018-02-051-3/+28
| | | | | | | Add a separate file for HEVC encode functions. Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: enable dual instances encode only for H264Boyuan Zhang2018-02-051-1/+2
| | | | | | | | Logics that related to dual instances encode should only be done for H264, not other codecs. Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: move H264 enc functions into separate fileBoyuan Zhang2018-02-051-138/+50
| | | | | | | | | Move all H264 encode related functions into separate file. Similar to VAAPI decode side, there will be separate file for each codec on encode side as well. Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: add break for MPEG4 data buffer handling caseLeo Liu2018-01-171-0/+1
| | | | Signed-off-by: Leo Liu <[email protected]>
* st/va: remove TODO line for JPEG data buffer handlingLeo Liu2018-01-171-1/+0
| | | | | | | Nothing to do Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: release held locks in error pathsGrazvydas Ignotas2018-01-171-1/+3
| | | | | | | | | | | | | | | | | | | | | | | | Found with the help of following Coccinelle semantic patch: // <smpl> @@ expression E; @@ \(pthread_mutex_lock\|mtx_lock\|simple_mtx_lock\)(E) ... ( \(pthread_mutex_unlock\|mtx_unlock\|simple_mtx_unlock\)(E); ... return ...; | + maybe need_unlock(E); return ...; ) // </smpl> Signed-off-by: Grazvydas Ignotas <[email protected]> Reviewed-by: Christian König <[email protected]> Cc: [email protected]
* st/va: clear pointers for mpeg2 quantiser matricesIndrajit Das2018-01-161-0/+5
| | | | | | | | | This is to fix VA-API issues with GStreamer and MPEG2. Since gstreamer does not pass quantiser matrices with each frame, invalid pointers were being passed to the driver. This patch addresses the same. Signed-off-by: Indrajit Das <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: directly use idr pic flagBoyuan Zhang2017-12-151-5/+3
| | | | | | | Remove is_idr flag, and use idr_pic_flag provided by vaapi directly Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: implement poc typeBoyuan Zhang2017-11-171-0/+1
| | | | | | | | | pic_order_cnt_type is a required variable when encoding both sps and slice header, therefore we need to get this value from st, e.g. vaapi interface, and then pass it to radeon driver for encoding headers. Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: add dst rect to avoid scale on deintLeo Liu2017-09-291-6/+6
| | | | | | | | | | | For 1080p video transcode, the height will be scaled to 1088 when deint to progressive buffer. Set dst rect to make sure no scale. Fixes: 3ad8687 "st/va: use new vl_compositor_yuv_deint_full() to deint" Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]> Acked-by: Andy Furniss <[email protected]>
* st/va: make internal func vlVaHandleSurfaceAllocate() call simplerLeo Liu2017-09-251-1/+1
| | | | Acked-by: Christian König <[email protected]>
* st/va: use new vl_compositor_yuv_deint_full() to deintLeo Liu2017-09-251-3/+11
| | | | | | | We also set src rectangle explicitly just in case of the mismatch of size between interlaced buffer and progressive buffer Acked-by: Christian König <[email protected]>
* st/va: move YUV content to deinterlaced buffer when reallocated for encoderLeo Liu2017-09-071-1/+10
| | | | | | | | v2: use deinterlace common function v3: make sure deinterlace only Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: reallocate the buffer if the layout isn't supportedLeo Liu2017-09-071-9/+12
| | | | | | | | So that it makes more clear for buffer reallocation based on buffers layout for both decoder and encoder. Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: exclude the buffer reallocation for encode caseLeo Liu2017-08-231-1/+1
| | | | | | | | | Since encoder only support de-interlaced buffers. v2: move to parameter call to tell dec/enc Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: enable P016 format i.e. reallocate buffer if format changedLeo Liu2017-08-221-0/+12
| | | | | Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: reallocate surface with YUYV streamLeo Liu2017-08-211-0/+17
| | | | | Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: detect MJPEG format from bitstreamLeo Liu2017-08-211-0/+1
| | | | | | | | | To find if the format is supported YUYV by sampling factor which is embedded from bitstream. So we could use this info for buffer reallocation on the correct format. Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: reallocate surface when interlacedLeo Liu2017-08-211-0/+22
| | | | | Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: add handles for MJPEG BuffersLeo Liu2017-08-211-0/+19
| | | | | Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: create decoder for MJPEG formatLeo Liu2017-08-211-3/+6
| | | | | | | Mjpeg doesn't need reference Signed-off-by: Leo Liu <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: change frame_idx from array to hash tableJulien Isorce2017-08-141-3/+8
| | | | | | | | | | | | | | | | | | | | | | | The picture_id was assumed to be a frame number so in 0-31. But the vaapi client gstreamer-vaapi uses the surfaces handles as identifier which are unsigned int. This bug can happen when using a lot of vaapi surfaces within the same process. Indeed Mesa/st/va increments a counter for the surface ID: mesa/util/u_handle_table.c::handle_table_add which starts from 0 and incremented by 1 at each call. So creating more than 32 surfaces was a problem. The following bug contains a test that reproduces the problem by running a couple of vaapih264enc in the same process. The above also explains why there was no pb when running them in separated processes. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=102006 Signed-off-by: Julien Isorce <[email protected]> Tested-by: Tomas Rataj <[email protected]> Acked-by: Christian König <[email protected]> Reviewed-and-tested-by: Boyuan Zhang <[email protected]>
* st/va: add support for P010 and P016 formats v3Christian König2017-03-131-1/+2
| | | | | | | | | | | | No hardware I know off can actually support P010 natively. But we can easily support P016 and as long as nobody decodes anything into the lower 6bits it doesn't make any difference to P010. v2: allow P0160 for post processing as well v3: fix post processing once more Signed-off-by: Christian König <[email protected]> Reviewed-by: Mark Thompson <[email protected]>
* gallium/util: replace pipe_mutex_unlock() with mtx_unlock()Timothy Arceri2017-03-071-7/+7
| | | | | | | | | | pipe_mutex_unlock() was made unnecessary with fd33a6bcd7f12. Replaced using: find ./src -type f -exec sed -i -- \ 's:pipe_mutex_unlock(\([^)]*\)):mtx_unlock(\&\1):g' {} \; Reviewed-by: Marek Olšák <[email protected]>
* gallium/util: replace pipe_mutex_lock() with mtx_lock()Timothy Arceri2017-03-071-4/+4
| | | | | | | | | | replace pipe_mutex_lock() was made unnecessary with fd33a6bcd7f12. Replaced using: find ./src -type f -exec sed -i -- \ 's:pipe_mutex_lock(\([^)]*\)):mtx_lock(\&\1):g' {} \; Reviewed-by: Marek Olšák <[email protected]>
* st/va: Support fractional framerate in misc parameterMark Thompson2017-03-061-1/+7
| | | | | Signed-off-by: Mark Thompson <[email protected]> Acked-by: Christian König <[email protected]>
* st/va encode handle ntsc framerate rate controlAndy Furniss2017-03-061-6/+13
| | | | | | | | | | | Tested with ffmpeg and gst-vaapi. Without this bits per frame is set way too low for fractional framerates. v2: Mark Thompson: simplify calculation. Use float. Signed-off-by: Andy Furniss <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: make sure that we call begin_frame() only once v2Christian König2017-01-231-3/+8
| | | | | | | | | | This fixes "st/va: delay calling begin_frame until we have all parameters". v2: call begin frame after decoder (re)creation as well. Signed-off-by: Christian König <[email protected]> Reviewed-by: Nayan Deshmukh <[email protected]> Tested-by: Andy Furniss <[email protected]>
* st/va: delay calling begin_frame until we have all parametersNayan Deshmukh2017-01-161-3/+3
| | | | | | | | | | If begin_frame is called before setting intra_matrix and non_intra_matrix it leads to segmentation faults when vl_mpeg12_decoder.c is used. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=92634 Signed-off-by: Nayan Deshmukh <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: fix gop size for rate controlBoyuan Zhang2016-12-051-6/+12
| | | | | | | | | | | | | The gop_size in rate control is the budget window for internal rate control calculation, and shouldn't always equal to idr period. Define a coefficient to let budget window contains a number of idr period for proper rate control calculation. Adjust the number of i/p frame remaining accordingly. Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005 Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: force to submit two consecutive single jobsBoyuan Zhang2016-12-051-5/+19
| | | | | | | | | | | | | | | The gop_size in rate control is the budget window for internal rate control calculation, and shouldn't always equal to idr period. Define a coefficient to let budget window contains a number of idr period for proper rate control calculation. Adjust the number of i/p frame remaining accordingly. v2: fixed regression issues introduced by previous version Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005 Signed-off-by: Boyuan Zhang <[email protected]> Acked-by: Christian König <[email protected]>
* st/va: force to flush the last p frame in idr periodBoyuan Zhang2016-10-181-0/+3
| | | | | | | | | | | | | | During dual instance encoding submission, if the second encode task and first encode task have no reference dependency, e.g. p following with idr-frame, there is a chance the second task will use for its reconstructed picture buffer the same buffer used by first task for its reference/reconstructed picture. In this case, buffer corruption may occur depending on encoding speed. Fix is to force flush these two tasks separately to avoid race condition Fixes: https://bugs.freedesktop.org/show_bug.cgi?id=98005 Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: Fix H.264 PicOrderCnt valueMark Thompson2016-10-141-1/+1
| | | | | | | TopFieldPicOrderCnt is exactly the PicOrderCnt value for a frame - see H.264 section 8.2.1. Reviewed-by: Christian König <[email protected]>
* st/va Avoid VBR bitrate calculation overflow v2Andy Furniss2016-09-271-1/+1
| | | | | | | | | | VBR bitrate calc needs 64 bits at high rates. v2: use float. Signed-off-by: Andy Furniss <[email protected]> Reviewed-by: Christian König <[email protected]> Cc: [email protected]
* st/va: enable vbr rate control for vaapi encodeBoyuan Zhang2016-09-121-1/+1
| | | | | | | | This patch enables variable bit-rate for vaapi encoding. According to va.h, target bit-rate equals to maximum bit-rate multiplies by target_percentage. Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: Remove unused variable coded_size from vlVaEndPicture()Kai Wasserbäch2016-08-241-1/+0
| | | | | | | | | | | | Removes the following GCC warning: ../../../../../src/gallium/state_trackers/va/picture.c:542:17: warning: unused variable 'coded_size' [-Wunused-variable] unsigned int coded_size; ^~~~~~~~~~ Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Christian König <[email protected]> Reviewed-by: Boyuan Zhang <[email protected]>
* st/va: Remove else case in vlVaEndPicture() made superfluous by c59628d11bKai Wasserbäch2016-08-241-3/+1
| | | | | | | | | | Commit c59628d11b134fc016388a170880f7646e100d6f made the else statement and duplication of the context->decoder->end_frame() call superfluous. Cc: Boyuan Zhang <[email protected]> Signed-off-by: Kai Wasserbäch <[email protected]> Reviewed-by: Christian König <[email protected]> Reviewed-by: Boyuan Zhang <[email protected]>
* st/va: enable dual instances encode by sync surfaceBoyuan Zhang2016-08-191-3/+9
| | | | | | | | | | | This patch improves the performance of Vaapi Encode by enabling dual instances encoding. flush function is not called after each end_frame call. radeon/vce will do flush whenever 2 frames are submitted for encoding. Implement sync surface function to flush only if the frame hasn't been flushed yet. Signed-off-by: Boyuan Zhang <[email protected]> Reviewed-by: Christian König <[email protected]>
* st/va: add function to handle misc param type frame rateBoyuan Zhang2016-07-251-5/+19
| | | | | | Frame rate can be passed to driver either through VAEncSequenceParameterBufferType or VAEncMiscParameterTypeFrameRate. Previous code only implement the former one, which is used by Gstreamer-Vaapi. Now adding implementation for VAEncMiscParameterTypeFrameRate. Also adding default frame rate as 30 just in case application never provides frame rate information to driver. Signed-off-by: Boyuan Zhang <[email protected]>
* st/va: add preset values for VAAPI encodeBoyuan Zhang2016-07-251-0/+27
| | | | | | Add some hardcoded values hardware needs mainly for rate control purpose. With previously hardcoded values for OMX, the rate control result is not correct. This change fixed the rate control result by setting correct values for Vaapi. Signed-off-by: Boyuan Zhang <[email protected]>
* st/va: add functions for VAAPI encodeBoyuan Zhang2016-07-251-2/+170
| | | | | | Add necessary functions/changes for VAAPI encoding to buffer and picture. These changes will allow driver to handle all Vaapi encode related operations. This patch doesn't change the Vaapi decode behaviour. Signed-off-by: Boyuan Zhang <[email protected]>
* st/va: add NV12 -> NV12 post processing v2Christian König2016-01-121-5/+5
| | | | | | | | | | Usefull for mpv and GStreamer. v2: use common functionality for size adjustment. Signed-off-by: Indrajit-kumar Das <[email protected]> Signed-off-by: Christian König <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* st/va: make the implementation thread safe v2Christian König2016-01-121-3/+16
| | | | | | | | | | | Otherwise we might crash with MPV. v2: minor cleanups suggested on the list. Signed-off-by: Christian König <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Reviewed-by: Julien Isorce <[email protected]> Tested-by: Julien Isorce <[email protected]>
* st/va: count number of slicesJulien Isorce2016-01-051-0/+8
| | | | | | | | The counter was not set but used by the nouveau driver. It is required otherwise visual output is garbage. Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Christian Koenig <[email protected]>
* st/va: fix unused variable warningChristian König2015-12-141-1/+0
| | | | | Signed-off-by: Christian König <[email protected]> Reviewed-by: Julien Isorce <[email protected]>
* st/va: move HEVC functions into separate file v2Christian König2015-12-071-168/+4
| | | | | | v2: actually copy all of it Signed-off-by: Christian König <[email protected]>
* st/va: delay decoder creation until max_references is knownJulien Isorce2015-12-011-8/+40
| | | | | | | | | | | | | | | | | | In general max_references cannot be based on num_render_targets. This patch allows to allocate buffers with an accurate size. I.e. no more than necessary. For other codecs it is a fixed value 2. This is similar behaviour as vaapi/vdpau-driver. For now HEVC case defaults to num_render_targets as before. But it could also benefits this change by setting a more accurate max_references number in handlePictureParameterBuffer. Signed-off-by: Julien Isorce <[email protected]> Reviewed-by: Christian König <[email protected]> Reviewed-by: Emil Velikov <[email protected]>
* st/va: add missing break statementEmil Velikov2015-11-291-0/+1
| | | | | | | | | | | | | | Earlier commit factored out the mpeg4 IQ matrix handling into separate function, although it forgot to add a break in its case statement. Thus the data ended up partially overwritten as the mpeg4 and h265 structs are members of the desc union. Spotted by Coverity (CID 1341052) Fixes: 64761a841db "st/va: move MPEG4 functions into separate file" Cc: Julien Isorce <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Reviewed-by: Christian König <[email protected]>