OSDN Git Service

minigbm: virtio-gpu: wait for transfers when necessary
authorDavid Stevens <stevensd@chromium.org>
Wed, 26 Feb 2020 08:14:43 +0000 (17:14 +0900)
committerCommit Bot <commit-bot@chromium.org>
Thu, 27 Feb 2020 15:10:49 +0000 (15:10 +0000)
commitbaab6c8488b9f670c6109fe71d902417f7740217
treeb5279583b0a4d18bd313b14cea6940acfa9bc1a9
parente3cd0d38dc5039421e5d110887586afe16002f01
minigbm: virtio-gpu: wait for transfers when necessary

There are two situations where guest access and host access to buffers
need to be synchronized to ensure consistency:

  - If the guest CPU can write to the mapping and something in the host
    besides the GPU might access the buffer, flush must be synchronous
    to ensure the host sees any guest changes. Waiting is not necessary
    if only the GPU can access the buffer because any subsequent
    commands will be properly ordered.
  - If the guest CPU can access the mapping and something in the host
    can write to the buffer, then invalidate must be synchronous to
    ensure the guest sees any host changes.

To perform this synchronization, have the virtio_gpu backend wait for
the transfer to/from the host to complete before returning from
flush/invalidate. In the future, support for fence-based synchronization
should also be added.

BUG=b:120456557 b:136733358
TEST=arc-codec-test, ArcVideoPlayer

Change-Id: If4ad293886a67d93d85b0d4a682b31c66597d4ef
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/minigbm/+/1687736
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Commit-Queue: David Stevens <stevensd@chromium.org>
Tested-by: David Stevens <stevensd@chromium.org>
drv_priv.h
virtio_gpu.c