Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ndk/image_reader: Special-case return statuses in Image-acquire functions #457

Merged
merged 1 commit into from
Apr 26, 2024

Commits on Apr 26, 2024

  1. ndk/image_reader: Special-case return statuses in Image-acquire fun…

    …ctions
    
    Both async and non-async `acquire_next/latest_image()` functions will
    return `ImgreaderNoBufferAvailable` when the producer has not provided
    a buffer that is either ready for consumption or that can be blocked
    on (either inside a non-async method, or by returning the accompanying
    fence file descriptor).  But only the non-`_async()` functions were
    marked as if this is a common case by returning an `Option<>`, seemingly
    out of the assumption that the `_async()` functions can _always_ give
    you an image (if the `MaxImagesAcquired` limit is not reached) but with
    a file-descriptor sync fence to wait on.  This is not the case as the
    producer needs to submit a buffer together with a sync fence on the
    producer-end first.
    
    Hence the current API signatures create the false assumption that only
    non-async functions can "not have a buffer available at all", when
    the exact same is true for `_async()` functions, in order to provide
    an image buffer with a fence that is signalled when it is ready for
    reading.
    
    Instead of special-casing this error in the `_async()` functions,
    special-case both `NoBufferAvailable` and `MaxImagesAcquired` in a new
    `enum AcquireResult` and let it be returned by both non-async and async
    functions.
    MarijnS95 committed Apr 26, 2024
    Configuration menu
    Copy the full SHA
    3bd4388 View commit details
    Browse the repository at this point in the history