Commit Graph

15 Commits

Author SHA1 Message Date
Alistair Delva
7b989f91b5 ANDROID: Fix 64/32 compat issue with virtio_gpu_resource_create_blob
Fix 32-bit guest running in 64-bit crosvm.

Bug: 169430664
Change-Id: If7e41ce4156309439de4652e5f441d5eb6b22a7d
Signed-off-by: Alistair Delva <adelva@google.com>
2020-09-28 17:55:43 -07:00
Gurchetan Singh
869a7e5bbe ANDROID: virtio_gpu.h: move map/unmap to 3d group
This is an experimental UAPI, without which it would be impossible
to virtualize Vulkan on Android using virtgpu.

This matches virtio-spec and latest upstream proposals:

https://markmail.org/message/akx5yzrubjcutefl
https://gitlab.freedesktop.org/virgl/drm-misc-next/-/tree/resource-blob

crosvm has been updated to reflect the latest proposals. Once the
aosp crosvm is updated, Vulkan will break on Cuttlefish.  As such, we
must update crosvm and the respective kernels at the same time.

First step: update the kernels, as this change does.  This is not
a new feature, just maintainence and convergence on an existing
one.

Bug: 153580313
TEST=compile
Change-Id: I3305503264eb6859ace32376fdc91b2ee7cc10e7
Signed-off-by: Gurchetan Singh <gurchetansingh@google.com>
2020-08-25 23:45:20 +00:00
Gurchetan Singh
69b005be67 ANDROID: drm/virtio: rebase to latest virgl/drm-misc-next (take 2)
So ToT + v4.14 can share same hypercall interface.

TEST=compile

Signed-off-by: Gurchetan Singh <gurchetansingh@google.com>
Signed-off-by: Lingfeng Yang <lfy@google.com>
Bug: 153580313
Change-Id: Ifd6d8d50983461380f24988cef5a0435a2ecc59b
2020-04-28 19:37:50 -07:00
Lingfeng Yang
4d701a3899 CHROMIUM: drm/virtio: rebase zero-copy patches to virgl/drm-misc-next
* Adds RESOURCE_MAP/RESOURCE_UNMAP
* Removes guest_memory_type/guest_caching_type in favor of a bitmask
* Removes EXECBUFFER_v2 until Q3
* Renames HOST_COHERENT to HOST_VISIBLE

BUG=chromium:924405
TEST=compile

Test:
- dEQP-VK.smoke* pass w/ gfxstream and host coherent memory enabled
- launch_cvd with 2d, virgl, and gfxstream modes work with current
- launch_cvd with 2d, virgl, and gfxstream modes work w/ crosvm modified
for host coherent memory
(https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/2035595)

Signed-off-by: Lingfeng Yang <lfy@google.com>
Bug: 153580313
Change-Id: I04052c3d164c77c713bbc7251c357fd43653fa50
2020-04-17 15:31:01 -07:00
Lingfeng Yang
8c6da983ea CHROMIUM: virtio-gpu: add VIRTIO_GPU_F_RESOURCE_UUID feature
This feature allows the guest to request a UUID from the host for a
particular virtio_gpu resource. The UUID can then be shared with other
virtio devices, to allow the other host devices to access the
virtio_gpu's corresponding host resource.

Signed-off-by: David Stevens <stevensd@chromium.org>
(am from https://patchwork.kernel.org/patch/11431391/)
Fixes:
  - Renumber out-of-tree virtio_gpu resource v2 feature bits. Although
    that is technically a breaking change with respect to crosvm, all
    usage of the bits is currently hidden behind flags which aren't
    enabled outside of local builds.

BUG=b:136269340
TEST=boot ARCVM and launch play store

Signed-off-by: Keiichi Watanabe <keiichiw@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2090952
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Bug: 153580313
Signed-off-by: Lingfeng Yang <lfy@google.com>
Change-Id: Ie48129c56b521ded1d33c4b4d3ea6ae05104447d
2020-04-17 15:31:01 -07:00
Lingfeng Yang
c2d015d2d8 CHROMIUM: drm/virtgpu: add legacy VIRTIO_GPU_* values for non-upstream variants
Upstream is foolishly using values for VIRTIO_GPU_RESP_OK_* that we are
already using in crosvm's virtio-gpu impl. In order to work around this,
this change renumbers to values that are unlikely to collide with
existing ones, and renaming the existing ones as *_LEGACY so that the
kernel may be compatible with both old and new versions of crosvm.

BUG=chromium:1047867
TEST=glxgears on crostini

Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2051223
Reviewed-by: Daniel Verkamp <dverkamp@chromium.org>
Tested-by: Zach Reizner <zachr@chromium.org>
Commit-Queue: Daniel Verkamp <dverkamp@chromium.org>
Bug: 153580313
Signed-off-by: Lingfeng Yang <lfy@google.com>
Change-Id: I40d37c877d13392cc26274561f13684aabc54a23
2020-04-17 15:31:01 -07:00
Lingfeng Yang
08994a48fb CHROMIUM: drm/virtgpu: make memory and resource creation opaque
It's not necessary for the guest kernel to know about parameters
such as width, height, format, or queue indices (Vulkan).

BUG=chromium:924405
TEST=compile

Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1702156
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>

Conflicts:
	include/uapi/linux/virtio_gpu.h

[rebase54(groeck): Context conflicts]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Bug: 153580313
Signed-off-by: Lingfeng Yang <lfy@google.com>
Change-Id: I5582fbf1f623900564e90223d2806faefba247eb
2020-04-17 15:31:00 -07:00
Lingfeng Yang
8e25efaff4 CHROMIUM: virtio-gpu api: VIRTIO_GPU_F_MEMORY
Introduce the concept of memory types and memory regions to virtio-gpu.
Initially only memory regions composed of guest pages are supported
(VIRTIO_GPU_MEMORY_TRANSFER, pretty much like current backing storage
for resources).  I expect support for other memory types will be added
later on.

VIRTIO_GPU_CMD_MEMORY_CREATE:
    creates a new memory region.

VIRTIO_GPU_CMD_MEMORY_UNREF:
    destroys a memory region.

VIRTIO_GPU_CMD_RESOURCE_CREATE_V2 :
    new command to create resources.  It will (a) allow to specify the
    memory type, (b) adds support planar resources and (c) returns
    alignment, stride and size of the resource planes.  The later
    will be needed in case we support mapping host resources into the
    guest some day.

VIRTIO_GPU_CMD_RESOURCE_ATTACH_MEMORY:
    Use memory region as backing storage for the given resource.
    The existing VIRTIO_GPU_CMD_RESOURCE_DETACH_BACKING command
    can be used to detach.

Motivation: This separates storage management from resource management.
It allows memory pooling (vulkan support will most likely need this).
It makes things a bit more flexible in general, for example we can
represent gem objects as memory regions even if we don't know the format
yet (happens on dma-buf import for example).

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
(cherry picked from commit 8eefa19d3e2ace7047c0082bf601c6f4f36f37fd)
Signed-off-by: Gurchetan Singh <gurchetansingh@chromium.org>

BUG=chromium:924405
TEST=compile

Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/1591998
Reviewed-by: Robert Tarasov <tutankhamen@chromium.org>
Commit-Queue: Gurchetan Singh <gurchetansingh@chromium.org>
Tested-by: Gurchetan Singh <gurchetansingh@chromium.org>
[rebase54(groeck): Context conflicts
    Note that this patch does not match the patch with the same subject
    on the kernel mailing list (https://patchwork.kernel.org/patch/10893777/).
    No idea if that means that this version is more recent or older or
    inofficial, or that it was modified locally.
]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Bug: 153580313
Signed-off-by: Lingfeng Yang <lfy@google.com>
Change-Id: I258a3a735678ddefd75b968d3f6874f394ac3e46
2020-04-17 15:31:00 -07:00
Lingfeng Yang
9c350c6dbf CHROMIUM: virtwl: store plane info per virtio_gpu_object
This change extends the drm_virtgpu_resource_info struct to include that
plane info.

BUG=chromium:875998
TEST=wayland-simple-egl

Signed-off-by: Zach Reizner <zachr@google.com>
Reviewed-on: https://chromium-review.googlesource.com/1351813
Commit-Ready: David Riley <davidriley@chromium.org>
Tested-by: David Riley <davidriley@chromium.org>
Reviewed-by: Tomasz Figa <tfiga@chromium.org>
Reviewed-by: Zach Reizner <zachr@chromium.org>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
[rebase54(groeck): Context conflicts]
Signed-off-by: Guenter Roeck <groeck@chromium.org>
Bug: 153580313
Signed-off-by: Lingfeng Yang <lfy@google.com>
Change-Id: I1ef98e718a14204f6beb9fd81f48f15bda6052f9
2020-04-17 15:31:00 -07:00
Gerd Hoffmann
ffd01edc77 UPSTREAM: virtio-gpu api: comment feature flags
Add comments to the existing feature flags,
documenting which commands belong to them.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Gurchetan Singh <gurchetansingh@chromium.org>
Link: http://patchwork.freedesktop.org/patch/msgid/20190410114227.25846-2-kraxel@redhat.com
(cherry picked from commit beb941b970fb129dae206050593d3e768859b146)
Bug: 153580313
Signed-off-by: Alistair Delva <adelva@google.com>
Change-Id: I8130b6a04aea46f8f6ea8f4ab14acccf0c1932eb
2020-04-17 13:49:34 -07:00
Gerd Hoffmann
851e4de294 UPSTREAM: virtio-gpu: add VIRTIO_GPU_F_EDID feature
The feature allows the guest request an EDID blob (describing monitor
capabilities) for a given scanout (aka virtual monitor connector).

It brings a new command message, which has just a scanout field (beside
the standard virtio-gpu header) and a response message which carries the
EDID data.

Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Dave Airlie <airlied@redhat.com>
Link: http://patchwork.freedesktop.org/patch/msgid/20181030063206.19528-2-kraxel@redhat.com
(cherry picked from commit 610c0c2b2813c36dc16838bbdbba4c29f8680dde)
Signed-off-by: Greg Hartman <ghartman@google.com>
BUG: 139386237
Change-Id: I1d4c11844307845b5829f1220b35938823ac7924
2019-08-16 15:23:03 -07:00
Mikko Rapeli
89545d6d5c include/uapi/linux/virtio_gpu.h: use __u8 from <linux/types.h>
Kernel headers exported to userspace are should these types.

Fixes userspace compilation error:

error: unknown type name ‘uint8_t’

Signed-off-by: Mikko Rapeli <mikko.rapeli@iki.fi>
2015-12-10 12:33:23 +01:00
Gerd Hoffmann
62fb7a5e10 virtio-gpu: add 3d/virgl support
Add the bits needed for opengl rendering support: query
capabilities, new virtio commands, drm ioctls.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
2015-10-16 10:44:02 +02:00
Dave Airlie
ae45577324 virtgpu: include linux/types.h to avoid warning.
Signed-off-by: Dave Airlie <airlied@redhat.com>
2015-06-05 12:31:12 +10:00
Dave Airlie
dc5698e80c Add virtio gpu driver.
This patch adds a kms driver for the virtio gpu.  The xorg modesetting
driver can handle the device just fine, the framebuffer for fbcon is
there too.

Qemu patches for the host side are under review currently.

The pci version of the device comes in two variants: with and without
vga compatibility.  The former has a extra memory bar for the vga
framebuffer, the later is a pure virtio device.  The only concern for
this driver is that in the virtio-vga case we have to kick out the
firmware framebuffer.

Initial revision has only 2d support, 3d (virgl) support requires
some more work on the qemu side and will be added later.

Signed-off-by: Dave Airlie <airlied@redhat.com>
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Acked-by: Michael S. Tsirkin <mst@redhat.com>
2015-06-03 14:17:38 +02:00