• Miguel Casas's avatar
    vaapi: decode on client NativePixmaps (reduced) · 49dc6464
    Miguel Casas authored
    crrev.com/c/1171566 got reverted due to a mishmash of performance
    improvements and regressions.  Instead of relanding it verbatim, the
    innocent/innocuous parts were landed in crrev.com/c/1180295; this CL
    gets the tough parts, including restricting it to VP9 and Kabylakes.
    
    I also repeated the power consumption results (https://goo.gl/r88qPf),
    and in a nutshell I see improvements:
    w/ this CL:  1.88   0.63   0.41  0.52  (pkg - pp1 - gfx - dram)
    ToT       :  2.72   0.76   1.03  0.57
    Savings   : 30.78% 17.51% 59.95% 7.60%
    
    TBR=dcastagna@, hoegsberg@
    
    Original CL description -----------------------------------------------
    vaapi: decode on client NativePixmaps
    
    This CL teaches VaVDA to use client VASurfaceIDs to decode onto, saving
    a buffer copy and removing a costly blit (DownloadFromSurface) on the
    GPU Main thread.  Three groups of changes:
    
    1. In AssignPictureBuffers(): if |vaapi_picture_factory_| Create()s a
     VaapiPicture with a VASurfaceID, we use those to decode onto and set a new
     flag: |decode_using_client_picture_buffers_|
    
    2. When the decoder calls CreateVASurface(), instead of giving it the first
     |available_va_surfaces_|, we need to figure out the first VASurfaceID in
     this |available_va_surfaces_| such that the corresponding VaapiPicture in
     |pictures_| is available (i.e. in |available_picture_buffers_|).
     Reason: libva holds on to some VASurfaceIDs, there's no simple one-to-one
     correspondence like on ToT.
    
    3. When we're ready to OutputPicture() to |client_|, instead of using the first
     |available_picture_buffers_|, we find the corresponding one for the
     passed |va_surface_id| (we could search all over |pictures_| but there's
     always less |available_picture_buffers_|.
    
    Some other notable developments:
    
    - s/output_buffers_/available_picture_buffers_/
    - OutputPicture() loses a parameter.
    - |decode_using_client_picture_buffers_| is still false for e.g. VP9 Profile 2
     or the ImportBufferForPicture() path.
    
    Bug: 822346, 717265
    
    Cq-Include-Trybots: luci.chromium.try:android_optional_gpu_tests_rel;luci.chromium.try:linux_optional_gpu_tests_rel;luci.chromium.try:mac_optional_gpu_tests_rel;luci.chromium.try:win_optional_gpu_tests_rel
    Change-Id: Icf1a9a1fa71264a7367fa351e3b7d28fab346744
    Reviewed-on: https://chromium-review.googlesource.com/1181464Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
    Commit-Queue: Miguel Casas <mcasas@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#584553}
    49dc6464
vaapi_video_decode_accelerator.h 12.2 KB