aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/virtio
AgeCommit message (Collapse)AuthorFilesLines
2020-08-17drm/virtgpu: remove redundant assignments to width and heightColin Ian King1-2/+0
Variables width and height are being assigned values that are never read. The assignments are redundant and can be removed. Addresses-Coverity: ("Unused value") Signed-off-by: Colin Ian King <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-08-11Merge tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhostLinus Torvalds3-11/+11
Pull virtio updates from Michael Tsirkin: - IRQ bypass support for vdpa and IFC - MLX5 vdpa driver - Endianness fixes for virtio drivers - Misc other fixes * tag 'for_linus' of git://git.kernel.org/pub/scm/linux/kernel/git/mst/vhost: (71 commits) vdpa/mlx5: fix up endian-ness for mtu vdpa: Fix pointer math bug in vdpasim_get_config() vdpa/mlx5: Fix pointer math in mlx5_vdpa_get_config() vdpa/mlx5: fix memory allocation failure checks vdpa/mlx5: Fix uninitialised variable in core/mr.c vdpa_sim: init iommu lock virtio_config: fix up warnings on parisc vdpa/mlx5: Add VDPA driver for supported mlx5 devices vdpa/mlx5: Add shared memory registration code vdpa/mlx5: Add support library for mlx5 VDPA implementation vdpa/mlx5: Add hardware descriptive header file vdpa: Modify get_vq_state() to return error code net/vdpa: Use struct for set/get vq state vdpa: remove hard coded virtq num vdpasim: support batch updating vhost-vdpa: support IOTLB batching hints vhost-vdpa: support get/set backend features vhost: generialize backend features setting/getting vhost-vdpa: refine ioctl pre-processing vDPA: dont change vq irq after DRIVER_OK ...
2020-08-07drm/virtio: fix memory leak in virtio_gpu_cleanup_object()Xin He1-0/+1
Before setting shmem->pages to NULL, kfree() should be called. Signed-off-by: Xin He <[email protected]> Reviewed-by: Qi Liu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-08-07drm/virtio: fix missing dma_fence_put() in virtio_gpu_execbuffer_ioctl()Qi Liu1-0/+1
We should put the reference count of the fence after calling virtio_gpu_cmd_submit(). So add the missing dma_fence_put(). Fixes: 2cd7b6f08bc4 ("drm/virtio: add in/out fence support for explicit synchronization") Co-developed-by: Xin He <[email protected]> Signed-off-by: Xin He <[email protected]> Signed-off-by: Qi Liu <[email protected]> Reviewed-by: Muchun Song <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-08-05drm/virtio: convert to LE accessorsMichael S. Tsirkin1-8/+8
Virtgpu is modern-only. Use LE accessors for config space. Signed-off-by: Michael S. Tsirkin <[email protected]>
2020-08-03virtio: virtio_has_iommu_quirk -> virtio_has_dma_quirkMichael S. Tsirkin2-3/+3
Now that the corresponding feature bit has been renamed, rename the quirk too - it's about special ways to do DMA, not necessarily about the IOMMU. Signed-off-by: Michael S. Tsirkin <[email protected]>
2020-07-14drm/virtio: Remove open-coded commit-tail functionDaniel Vetter1-20/+0
Exactly matches the one in the helpers. This avoids me having to roll out dma-fence critical section annotations to this copy. Reviewed-by: Sam Ravnborg <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Cc: David Airlie <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-06-24Merge tag 'drm-misc-next-2020-06-19' of ↵Dave Airlie4-8/+8
git://anongit.freedesktop.org/drm/drm-misc into drm-next drm-misc-next for v5.9: UAPI Changes: - Add DRM_MODE_TYPE_USERDEF for video modes specified in cmdline. Cross-subsystem Changes: - Assorted devicetree binding updates. - Add might_sleep() to dma_fence_wait(). - Fix fbdev's get_user_pages_fast() handling, and use pin_user_pages. - Small cleanup with IS_BUILTIN in video/fbdev drivers. - Fix video/hdmi coding style for infoframe size. Core Changes: - Silence vblank output during init. - Fix DP-MST corruption during send msg timeout. - Clear leak in drm_gem_objecs_lookup(). - Make newlines work with force connector attribute. - Fix module refcounting error in drm_encoder_slave, and use new i2c api. - Header fix for drm_managed.c - More struct_mutex removal for !legacy drivers: - Remove gem_free_object() - Removal of drm_gem_object_put_unlocked(). - Show current->comm alongside pid in debug printfs. - Add drm_client_modeset_check() + drm_client_framebuffer_flush(). - Replace drm_fb_swab16 with drm_fb_swap that also supports 32-bits. - Remove mode->vrefresh, and compactify drm_display_mode. - Use drm_* macros for logging and warnings. - Add WARN when drm_gem_get_pages is used on a private obj. - Handle importing and imported dmabuf better in shmem helpers. - Small fix for drm/mm hole size comparison, and remove invalid entry optimization. - Add a drm/mm selftest. - Set DSI connector type for DSI panels. - Assorted small fixes and documentation updates. - Fix DDI I2C device registration for MST ports, and flushing on destroy. - Fix master_set return type, used by vmwgfx. - Make the drm_set/drop_master ioctl symmetrical. Driver Changes: Allow iommu in the sun4i driver and use it for sun8i. - Simplify backlight lookup for omap, amba-clcd and tilcdc. - Hold reg_lock for rockchip. - Add support for bridge gpio and lane reordering + polarity to ti-sn65dsi86, and fix clock choice. - Small assorted fixes to tilcdc, vc4, i915, omap, fbdev/sm712fb, fbdev/pxafb, console/newport_con, msm, virtio, udl, malidp, hdlcd, bridge/ti-sn65dsi86, panfrost. - Remove hw cursor support for mgag200, and use simple kms helper + shmem helpers. - Add support for KOE Allow iommu in the sun4i driver and use it for sun8i. - Simplify backlight lookup for omap, amba-clcd and tilcdc. - Hold reg_lock for rockchip. - Add support for bridge gpio and lane reordering + polarity to ti-sn65dsi86, and fix clock choice. - Small assorted fixes to tilcdc, vc4 (multiple), i915. - Remove hw cursor support for mgag200, and use simple kms helper + shmem helpers. - Add support for KOE TX26D202VM0BWA panel. - Use GEM CMA functions in arc, arm, atmel-hlcdc, fsi-dcu, hisilicon, imx, ingenic, komeda, malidp, mcde, meson, msxfb, rcar-du, shmobile, stm, sti, tilcdc, tve200, zte. - Remove gem_print_info. - Improve gem_create_object_helper so udl can use shmem helpers. - Convert vc4 dt bindings to schemas, and add clock properties. - Device initialization cleanups for mgag200. - Add a workaround to fix DP-MST short pulses handling on broken hardware in i915. - Allow build test compiling arm drivers. - Use managed pci functions in mgag200 and ast. - Use dev_groups in malidp. - Add per pixel alpha support for PX30 VOP in rockchip. - Silence deferred probe logs in panfrost. Signed-off-by: Dave Airlie <[email protected]> From: Maarten Lankhorst <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-06-03drm/virtio: Call the right shmem helpersDaniel Vetter1-1/+1
drm_gem_shmem_get_sg_table is meant to implement obj->funcs->get_sg_table, for prime exporting. The one we want is drm_gem_shmem_get_pages_sgt, which also handles imported dma-buf, not just native objects. v2: Rebase, this stuff moved around in commit 2f2aa13724d56829d910b2fa8e80c502d388f106 Author: Gerd Hoffmann <[email protected]> Date: Fri Feb 7 08:46:38 2020 +0100 drm/virtio: move virtio_gpu_mem_entry initialization to new function Acked-by: Thomas Zimmermann <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Cc: David Airlie <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-06-02Merge tag 'drm-next-2020-06-02' of git://anongit.freedesktop.org/drm/drmLinus Torvalds7-48/+29
Pull drm updates from Dave Airlie: "Highlights: - Core DRM had a lot of refactoring around managed drm resources to make drivers simpler. - Intel Tigerlake support is on by default - amdgpu now support p2p PCI buffer sharing and encrypted GPU memory Details: core: - uapi: error out EBUSY when existing master - uapi: rework SET/DROP MASTER permission handling - remove drm_pci.h - drm_pci* are now legacy - introduced managed DRM resources - subclassing support for drm_framebuffer - simple encoder helper - edid improvements - vblank + writeback documentation improved - drm/mm - optimise tree searches - port drivers to use devm_drm_dev_alloc dma-buf: - add flag for p2p buffer support mst: - ACT timeout improvements - remove drm_dp_mst_has_audio - don't use 2nd TX slot - spec recommends against it bridge: - dw-hdmi various improvements - chrontel ch7033 support - fix stack issues with old gcc hdmi: - add unpack function for drm infoframe fbdev: - misc fbdev driver fixes i915: - uapi: global sseu pinning - uapi: OA buffer polling - uapi: remove generated perf code - uapi: per-engine default property values in sysfs - Tigerlake GEN12 enabled. - Lots of gem refactoring - Tigerlake enablement patches - move to drm_device logging - Icelake gamma HW readout - push MST link retrain to hotplug work - bandwidth atomic helpers - ICL fixes - RPS/GT refactoring - Cherryview full-ppgtt support - i915 locking guidelines documented - require linear fb stride to be 512 multiple on gen9 - Tigerlake SAGV support amdgpu: - uapi: encrypted GPU memory handling - uapi: add MEM_SYNC IB flag - p2p dma-buf support - export VRAM dma-bufs - FRU chip access support - RAS/SR-IOV updates - Powerplay locking fixes - VCN DPG (powergating) enablement - GFX10 clockgating fixes - DC fixes - GPU reset fixes - navi SDMA fix - expose FP16 for modesetting - DP 1.4 compliance fixes - gfx10 soft recovery - Improved Critical Thermal Faults handling - resizable BAR on gmc10 amdkfd: - uapi: GWS resource management - track GPU memory per process - report PCI domain in topology radeon: - safe reg list generator fixes nouveau: - HD audio fixes on recent systems - vGPU detection (fail probe if we're on one, for now) - Interlaced mode fixes (mostly avoidance on Turing, which doesn't support it) - SVM improvements/fixes - NVIDIA format modifier support - Misc other fixes. adv7511: - HDMI SPDIF support ast: - allocate crtc state size - fix double assignment - fix suspend bochs: - drop connector register cirrus: - move to tiny drivers. exynos: - fix imported dma-buf mapping - enable runtime PM - fixes and cleanups mediatek: - DPI pin mode swap - config mipi_tx current/impedance lima: - devfreq + cooling device support - task handling improvements - runtime PM support pl111: - vexpress init improvements - fix module auto-load rcar-du: - DT bindings conversion to YAML - Planes zpos sanity check and fix - MAINTAINERS entry for LVDS panel driver mcde: - fix return value mgag200: - use managed config init stm: - read endpoints from DT vboxvideo: - use PCI managed functions - drop WC mtrr vkms: - enable cursor by default rockchip: - afbc support virtio: - various cleanups qxl: - fix cursor notify port hisilicon: - 128-byte stride alignment fix sun4i: - improved format handling" * tag 'drm-next-2020-06-02' of git://anongit.freedesktop.org/drm/drm: (1401 commits) drm/amd/display: Fix potential integer wraparound resulting in a hang drm/amd/display: drop cursor position check in atomic test drm/amdgpu: fix device attribute node create failed with multi gpu drm/nouveau: use correct conflicting framebuffer API drm/vblank: Fix -Wformat compile warnings on some arches drm/amdgpu: Sync with VM root BO when switching VM to CPU update mode drm/amd/display: Handle GPU reset for DC block drm/amdgpu: add apu flags (v2) drm/amd/powerpay: Disable gfxoff when setting manual mode on picasso and raven drm/amdgpu: fix pm sysfs node handling (v2) drm/amdgpu: move gpu_info parsing after common early init drm/amdgpu: move discovery gfx config fetching drm/nouveau/dispnv50: fix runtime pm imbalance on error drm/nouveau: fix runtime pm imbalance on error drm/nouveau: fix runtime pm imbalance on error drm/nouveau/debugfs: fix runtime pm imbalance on error drm/nouveau/nouveau/hmm: fix migrate zero page to GPU drm/nouveau/nouveau/hmm: fix nouveau_dmem_chunk allocations drm/nouveau/kms/nv50-: Share DP SST mode_valid() handling with MST drm/nouveau/kms/nv50-: Move 8BPC limit for MST into nv50_mstc_get_modes() ...
2020-05-19drm/virtio: remove _unlocked suffix in drm_gem_object_put_unlockedEmil Velikov3-7/+7
Spelling out _unlocked for each and every driver is a annoying. Especially if we consider how many drivers, do not know (or need to) about the horror stories involving struct_mutex. Just drop the suffix. It makes the API cleaner. Done via the following script: __from=drm_gem_object_put_unlocked __to=drm_gem_object_put for __file in $(git grep --name-only $__from); do sed -i "s/$__from/$__to/g" $__file; done Cc: David Airlie <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: Daniel Vetter <[email protected]> Signed-off-by: Emil Velikov <[email protected]> Acked-by: Sam Ravnborg <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Acked-by: Thomas Zimmermann <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-05-08Merge tag 'drm-misc-fixes-2020-05-07' of ↵Dave Airlie3-2/+5
git://anongit.freedesktop.org/drm/drm-misc into drm-fixes A few minor fixes for an ordering issue in virtio, an (old) gcc warning in sun4i, a probe issue in ingenic-drm and a regression in the HDCP support. Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-05-04drm/virtio: create context before RESOURCE_CREATE_2D in 3D modeGurchetan Singh3-2/+5
If 3D is enabled, but userspace requests a dumb buffer, we will call CTX_ATTACH_RESOURCE before actually creating the context. Fixes: 72b48ae800da ("drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl") Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-05-01Merge tag 'drm-misc-fixes-2020-04-30' of ↵Dave Airlie1-11/+6
git://anongit.freedesktop.org/drm/drm-misc into drm-fixes A few resources-related fixes for qxl, some doc build warnings and ioctl fixes for dma-buf, an off-by-one fix in edid, and a return code fix in DP-MST Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-04-28drm/virtio: only destroy created contextsGurchetan Singh1-11/+6
This can happen if userspace doesn't issue any 3D ioctls before closing the DRM fd. Fixes: 72b48ae800da ("drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctl") Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-04-17drm/virtio: fix up for include file changesStephen Rothwell1-0/+1
virtgpu_kms now uses VIRTIO_RING_F_INDIRECT_DESC, so it must include virtio_ring.h directly. Fixes: 5edbb5608256 ("drm/virtio: fix ring free check") Signed-off-by: Stephen Rothwell <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Michael S. Tsirkin <[email protected]>
2020-04-17virtgpu: pull in uaccess.hMichael S. Tsirkin1-0/+1
In preparation to virtio header changes, include uaccess.h directly as this file is using copy to/from user. Signed-off-by: Michael S. Tsirkin <[email protected]>
2020-04-06drm/virtio: fix OOB in virtio_gpu_object_createJiri Slaby1-6/+8
After commit f651c8b05542 ("drm/virtio: factor out the sg_table from virtio_gpu_object"), virtio_gpu_create_object allocates too small space to fit everything in. It is because it allocates struct virtio_gpu_object, but should allocate a newly added struct virtio_gpu_object_shmem which has 2 more members. So fix that by using correct type in virtio_gpu_create_object. Signed-off-by: Jiri Slaby <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Fixes: f651c8b05542 ("drm/virtio: factor out the sg_table from virtio_gpu_object") Cc: Gurchetan Singh <[email protected]> Cc: Gerd Hoffmann <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> (cherry picked from commit 0666a8d7f6a4530440e59f2d22ed4091f4d3818c)
2020-04-03drm/virtio: make virtio_gpu_object_attach voidGurchetan Singh3-14/+9
It always returns zero. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-04-03drm/virtio: delete notify in virtio_gpu_object_createGurchetan Singh2-2/+2
For 3D buffers, virtio_gpu_gem_object_open notifies. We can have the same behavior for dumb buffer. v2: virtio_gpu_gem_object_open always notifies v3: avoid boolean variable Signed-off-by: Gurchetan Singh <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-04-03drm/virtio: delete notify after virtio_gpu_cmd_context_createGurchetan Singh1-1/+0
The first 3D ioctl will take care of notification. Signed-off-by: Gurchetan Singh <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-04-03drm/virtio: random virtgpu_drv.h cleanupsGurchetan Singh2-22/+14
- Static-ify virtio_gpu_gem_create - Delete unused prototypes - Point to current implementation files Signed-off-by: Gurchetan Singh <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-04-02drm/virtgpu: Use simple encoderThomas Zimmermann1-6/+2
The virtgpu driver uses an empty implementation for its encoder. Replace the code with the generic simple encoder. Signed-off-by: Thomas Zimmermann <[email protected]> Reviewed-by: Laurent Pinchart <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-03-19drm/virtio: fix OOB in virtio_gpu_object_createJiri Slaby1-6/+8
After commit f651c8b05542 ("drm/virtio: factor out the sg_table from virtio_gpu_object"), virtio_gpu_create_object allocates too small space to fit everything in. It is because it allocates struct virtio_gpu_object, but should allocate a newly added struct virtio_gpu_object_shmem which has 2 more members. So fix that by using correct type in virtio_gpu_create_object. Signed-off-by: Jiri Slaby <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Fixes: f651c8b05542 ("drm/virtio: factor out the sg_table from virtio_gpu_object") Cc: Gurchetan Singh <[email protected]> Cc: Gerd Hoffmann <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]>
2020-03-18drm: convert .debugfs_init() hook to return void.Wambui Karuga2-3/+2
As a result of commit 987d65d01356 (drm: debugfs: make drm_debugfs_create_files() never fail) and changes to various debugfs functions in drm/core and across various drivers, there is no need for the drm_driver.debugfs_init() hook to have a return value. Therefore, declare it as void. This also includes refactoring all users of the .debugfs_init() hook to return void across the subsystem. v2: include changes to the hook and drivers that use it in one patch to prevent driver breakage and enable individual successful compilation of this change. References: https://lists.freedesktop.org/archives/dri-devel/2020-February/257183.html Signed-off-by: Wambui Karuga <[email protected]> Reviewed-by: Greg Kroah-Hartman <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-03-12Merge tag 'drm-misc-next-2020-03-09' of ↵Dave Airlie3-28/+43
git://anongit.freedesktop.org/drm/drm-misc into drm-next drm-misc-next for 5.7: UAPI Changes: Cross-subsystem Changes: Core Changes: Driver Changes: - fb-helper: Remove drm_fb_helper_{add,add_all,remove}_one_connector - fbdev: some cleanups and dead-code removal - Conversions to simple-encoder - zero-length array removal - Panel: panel-dpi support in panel-simple, Novatek NT35510, Elida KD35T133, Signed-off-by: Dave Airlie <[email protected]> From: Maxime Ripard <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/20200309135439.dicfnbo4ikj4tkz7@gilmour
2020-03-11Merge v5.6-rc5 into drm-nextDave Airlie1-2/+3
Requested my mripard for some misc patches that need this as a base. Signed-off-by: Dave Airlie <[email protected]>
2020-03-09drm/virtio: add case for shmem objects in virtio_gpu_cleanup_object(..)Gurchetan Singh2-15/+20
This function can be reused for hostmem objects. v2: move virtio_gpu_is_shmem() check to virtio_gpu_cleanup_object() v3: use-after free fix Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-03-09drm/virtio: factor out the sg_table from virtio_gpu_objectGurchetan Singh3-20/+30
A resource will be a shmem based resource or a (planned) vram based resource, so it makes sense to factor out common fields (resource handle, dumb). v2: move mapped field to shmem object Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-27drm/virtio: fix mmap page attributesGerd Hoffmann1-0/+1
virtio-gpu uses cached mappings, set drm_gem_shmem_object.map_cached accordingly. Cc: [email protected] Fixes: c66df701e783 ("drm/virtio: switch from ttm to gem shmem helpers") Reported-by: Gurchetan Singh <[email protected]> Reported-by: Guillaume Gardet <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Tested-by: Guillaume Gardet <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-27drm/virtio: add virtio_gpu_is_shmem helperGurchetan Singh2-2/+10
The plan is use have both shmem and virtual "vram" running side-by-side in virtio-gpu. It looks like we'll eventually use struct drm_gem_object as a base class, and we'll need to convert to shmem and vram objects on the fly. As a first step, add a virtio_gpu_is_shmem helper. Thanks to kraxel for suggesting this approach on Gitlab. Suggested-by: Gerd Hoffman <[email protected]> Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-27drm/virtio: make mmap callback consistent with callbacksGurchetan Singh1-1/+1
This is a very, very minor cleanup. Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-25drm/virtio: enqueue virtio_gpu_create_context after the first 3D ioctlGurchetan Singh3-16/+16
For old userspace, initialization will still be implicit. For backwards compatibility, enqueue virtio_gpu_cmd_context_create after the first 3D ioctl. v3: staticify virtio_gpu_create_context remove notify to batch vm-exit v6: Remove nested 3D checks (emil.velikov): - unify 3D check in resource create v7: Remove check when getting capabilities Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-25drm/virtio: track whether or not a context has been initiatedGurchetan Singh3-0/+13
Use an boolean variable to track whether a context has been initiated. v5: Fix possible race and sleep via mutex (olv) Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-25drm/virtio: factor out context create hypercallGurchetan Singh3-20/+21
We currently create an OpenGL context when opening the DRM fd if 3D is available. We may need other context types (VK,..) in the future, and the plan is to have explicit initialization for that. For explicit initialization to work, we need to factor out virtio_gpu_create_context from driver initialization. v2: Move context handle initialization too (olv) v6: Remove redundant 3D check (emil.velikov) Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-25drm/virtio: use consistent names for drm_filesGurchetan Singh1-10/+10
Minor cleanup, change: - file_priv--> file, - drm_file --> file. Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Emil Velikov <[email protected]> Signed-off-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-24drm/virtio: fix resource id creation raceJohn Bates1-2/+2
The previous code was not thread safe and caused undefined behavior from spurious duplicate resource IDs. In this patch, an atomic_t is used instead. We no longer see any duplicate IDs in tests with this change. Fixes: 16065fcdd19d ("drm/virtio: do NOT reuse resource ids") Signed-off-by: John Bates <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-02-17drm/virtio: move remaining virtio_gpu_notify callsGerd Hoffmann5-9/+9
Move all remaining virtio_gpu_notify() calls from virtio_gpu_cmd_* to the callers, for consistency reasons. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17drm/virtio: batch display queryGerd Hoffmann2-2/+2
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_get_display_info() and virtio_gpu_cmd_get_edids(). virtio_gpu_config_changed_work_func() and virtio_gpu_init() will batch commands and notify only once per update Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17drm/virtio: batch resource creationGerd Hoffmann2-3/+1
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_create_resource(), virtio_gpu_cmd_resource_create_3d() and virtio_gpu_cmd_resource_attach_backing(). virtio_gpu_object_create() will batch commands and notify only once when creating a resource. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17drm/virtio: batch plane updates (pageflip)Gerd Hoffmann4-4/+6
Move virtio_gpu_notify() to higher-level functions for virtio_gpu_cmd_resource_flush(), virtio_gpu_cmd_set_scanout() and virtio_gpu_cmd_transfer_to_host_{2d,3d}(). virtio_gpu_primary_plane_update() will notify only once for a series of commands (restores plane update command batching). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17drm/virtio: notify before waitingGerd Hoffmann1-0/+1
Before we are going to wait for virtqueue entries becoming available call virtio_gpu_notify() to make sure the host has seen everything we've submitted. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17drm/virtio: rework notification for better batchingGerd Hoffmann3-27/+33
Drop the virtio_gpu_{disable,enable}_notify(). Add a new virtio_gpu_notify() call instead, which must be called whenever the driver wants make sure the host is notified needed. Drop automatic notification from command submission. Add virtio_gpu_notify() calls after each command query instead. This allows more fine-grained control over host notification and can move around the notify calls in subsequent patches to batch command submissions. With this in place it is also possible to make notification optional for userspace ioctls. Page flip batching goes away (temporarely). v3: - move batching to separate patches. v2: - rebase to latest drm-misc-next. - use "if (!atomic_read())". - add review & test tags. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Tested-by: Gurchetan Singh <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-14drm/virtio: fix error checkGerd Hoffmann1-1/+1
The >= compare op must happen in cpu byte order, doing it in little endian fails on big endian machines like s390. Reported-by: Sebastian Mitterle <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Cornelia Huck <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-13drm/virtio: fix virtio_gpu_cursor_plane_update().Gerd Hoffmann1-0/+1
Add missing virtio_gpu_array_lock_resv() call. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-13drm/virtio: fix virtio_gpu_execbuffer_ioctl lockingGerd Hoffmann1-10/+10
Lockdep says we can't call vmemdup() while having objects reserved because it needs the mmap semaphore. So reorder the calls reserve the objects later. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-12drm/virtio: add drm_driver.release callback.Gerd Hoffmann5-17/+27
Split virtio_gpu_deinit(), move the drm shutdown and release to virtio_gpu_release(). Drop vqs_ready variable, instead use drm_dev_{enter,exit,unplug} to avoid touching hardware after device removal. Tidy up here and there. v4: add changelog. v3: use drm_dev_*(). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-10drm/virtio: move virtio_gpu_mem_entry initialization to new functionGerd Hoffmann3-50/+60
Introduce new virtio_gpu_object_shmem_init() helper function which will create the virtio_gpu_mem_entry array, containing the backing storage information for the host. For the most path this just moves code from virtio_gpu_object_attach(). Signed-off-by: Gerd Hoffmann <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Chia-I Wu <[email protected]>
2020-02-10drm/virtio: move mapping teardown to virtio_gpu_cleanup_object()Gerd Hoffmann3-50/+12
Stop sending DETACH_BACKING commands, that will happening anyway when releasing resources via UNREF. Handle guest-side cleanup in virtio_gpu_cleanup_object(), called when the host finished processing the UNREF command. Signed-off-by: Gerd Hoffmann <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Chia-I Wu <[email protected]>
2020-02-10drm/virtio: resource teardown tweaksGerd Hoffmann3-9/+43
Add new virtio_gpu_cleanup_object() helper function for object cleanup. Wire up callback function for resource unref, do cleanup from callback when we know the host stopped using the resource. Signed-off-by: Gerd Hoffmann <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Reviewed-by: Chia-I Wu <[email protected]>