• Sunny Sachanandani's avatar
    Force NV12 swap chain to have even width and height · c4720a76
    Sunny Sachanandani authored
    NV12 uses 4:2:0 subsampling which means there's one U and V sample per
    2x2 block of Y samples.  This means to have an integral number of U and
    V samples, both width and height of the surface (or Y plane) must be
    even.
    
    Scrolling on a page with video causes swap chain to be resized when the
    video's visible rect changes.  Without forcing even width and height for
    NV12 swap chains, creating the swap chain often fails with fallback to
    BGRA swap chain.  With this fix, creating the swap chain never fails.
    
    Includes a unit test for testing that swap chain is created with even
    dimensions after rounding, if necessary, and that the format of the swap
    chain is indeed NV12.
    
    Also, includes some minor cosmetic changes to logging to make clear that
    the errors codes are hexadecimal.
    
    Bug: 869677
    Change-Id: Ief5999149d438e4883fc9c2bb397ab8a7d2b294e
    Reviewed-on: https://chromium-review.googlesource.com/c/1308906Reviewed-by: default avatarZhenyao Mo <zmo@chromium.org>
    Commit-Queue: Sunny Sachanandani <sunnyps@chromium.org>
    Cr-Commit-Position: refs/heads/master@{#604112}
    c4720a76
direct_composition_surface_win.h 4.84 KB