aboutsummaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/virtio/virtgpu_plane.c
AgeCommit message (Collapse)AuthorFilesLines
2020-09-29drm/virtio: implement blob resources: blob display integrationGurchetan Singh1-6/+17
SCANOUT_BLOB forwards the DRM framebuffer metadata to the host. The modifier is intentionally left out -- it may be possible to query the host for that. We also assume one blob resource per DRM framebuffer. That too is an intentional simplification. Signed-off-by: Gurchetan Singh <[email protected]> Acked-by: Tomeu Vizoso <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2020-09-02drm/virtio: drop virtio_gpu_output->enabledGerd Hoffmann1-1/+1
Not needed, already tracked by drm_crtc_state->active. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-09-02drm/virtio: fix unblankGerd Hoffmann1-1/+3
When going through a disable/enable cycle without changing the framebuffer the optimization added by commit 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") causes the screen stay blank. Add a bool to force an update to fix that. v2: use drm_atomic_crtc_needs_modeset() (Daniel). Cc: [email protected] Fixes: 3954ff10e06e ("drm/virtio: skip set_scanout if framebuffer didn't change") Signed-off-by: Gerd Hoffmann <[email protected]> Tested-by: Jiri Slaby <[email protected]> Tested-by: Diego Viola <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2020-02-17drm/virtio: batch plane updates (pageflip)Gerd Hoffmann1-0/+3
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: rework notification for better batchingGerd Hoffmann1-4/+0
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-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]
2019-12-16drm/virtio: use damage info for display updates.Gerd Hoffmann1-17/+24
v2: remove shift by src_{x,y}, drm_atomic_helper_damage_merged() handles that for us (Chia-I Wu). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-16drm/virtio: batch display update commands.Gerd Hoffmann1-0/+4
When the driver submits multiple commands in a row it makes sense to notify the host only after submitting the last one, so the host can process them all at once, with a single vmexit. Add functions to enable/disable notifications to allow that. Use the new functions for primary plane updates. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-16drm/virtio: skip set_scanout if framebuffer didn't changeGerd Hoffmann1-14/+21
v2: also check src rect (Chia-I Wu). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-12-16drm/virtio: plane_state->fb iff plane_state->crtcDaniel Vetter1-1/+1
Checking both is one too much, so wrap a WARN_ON around it to stope the copypasta. Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Cc: David Airlie <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: [email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2019-11-20drm/virtio: factor out virtio_gpu_update_dumb_boGerd Hoffmann1-15/+21
No functional change. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-11-20drm/virtio: Simplify virtio_gpu_primary_plane_update workflow.Gerd Hoffmann1-30/+34
Return early for the no framebuffer (or disabled output) case. Results in a simpler code flow for the remaining cases. No functional change. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Gurchetan Singh <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-10-22drm/virtio: move byteorder handling into virtio_gpu_cmd_transfer_to_host_2d ↵Gerd Hoffmann1-6/+6
function Be consistent with the rest of the code base. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: rework virtio_gpu_transfer_to_host_ioctl fencingGerd Hoffmann1-4/+17
Switch to the virtio_gpu_array_* helper workflow. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-09-04drm/virtio: simplify cursor updatesGerd Hoffmann1-10/+3
No need to do the reservation dance, we can just wait on the fence directly. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Daniel Vetter <[email protected]> Reviewed-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-08-28drm/virtio: add plane checkGerd Hoffmann1-1/+16
Use drm_atomic_helper_check_plane_state() to sanity check the plane state. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Chia-I Wu <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-08-13dma-buf: rename reservation_object to dma_resvChristian König1-1/+1
Be more consistent with the naming of the other DMA-buf objects. Signed-off-by: Christian König <[email protected]> Reviewed-by: Chris Wilson <[email protected]> Link: https://patchwork.freedesktop.org/patch/323401/
2019-08-06drm/virtio: switch driver from bo->resv to bo->base.resvGerd Hoffmann1-1/+1
Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Christian König <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-07-15drm/virtgpu: drop use of drmP.hSam Ravnborg1-2/+4
Drop use of the deprecated drmP.h header file. Fix fallout by adding missing include files. Signed-off-by: Sam Ravnborg <[email protected]> Acked-by: Gerd Hoffmann <[email protected]> Acked-by: Emil Velikov <[email protected]> Cc: David Airlie <[email protected]> Cc: Daniel Vetter <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-01-08drm/virtio: drop virtio_gpu_fence_cleanup()Gerd Hoffmann1-2/+4
Just call drm_fence_put directly instead. Also set vgfb->fence to NULL after dropping the reference. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Ezequiel Garcia <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2019-01-08drm/virtio: fix pageflip flushGerd Hoffmann1-5/+6
Sending the flush command only makes sense if we actually have a framebuffer attached to the scanout (handle != 0). Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Ezequiel Garcia <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-11-29drm/virtio: fence: pass plain pointerGerd Hoffmann1-1/+1
Since commit "9fdd90c0f4 drm/virtio: add virtio_gpu_alloc_fence()" fences are not allocated any more by virtio_gpu_fence_emit(). So there is no need to pass down a reference to the fence pointer, a plain pointer is enough now. Convert virtio_gpu_fence_emit() and callers. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Robert Foss <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-11-14drm/virtio: add virtio_gpu_alloc_fence()Robert Foss1-5/+41
Refactor fence creation, add fences to relevant GPU operations and add cursor helper functions. This removes the potential for allocation failures from the cmd_submit and atomic_commit paths. Now a fence will be allocated first and only after that will we proceed with the rest of the execution. Signed-off-by: Gustavo Padovan <[email protected]> Signed-off-by: Robert Foss <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Suggested-by: Rob Herring <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]>
2018-09-25drm/virtio: fix DRM_FORMAT_* handlingGerd Hoffmann1-52/+2
Use DRM_FORMAT_HOST_XRGB8888, so we are using the correct format code on bigendian machines. Also set the quirk_addfb_prefer_host_byte_order mode_config bit so drm_mode_addfb() asks for the correct format code. Both DRM_FORMAT_* and VIRTIO_GPU_FORMAT_* are defined to be little endian, so using a different mapping on bigendian machines is wrong. It's there because of broken drm_mode_addfb() behavior. So with drm_mode_addfb() being fixed we can fix this too. While wading through the code I've noticed we have a little issue in virtio: We attach a format to the bo when it is created (DRM_IOCTL_MODE_CREATE_DUMB), not when we map it as framebuffer (DRM_IOCTL_MODE_ADDFB). Easy way out: Support a single format only. Pick DRM_FORMAT_HOST_XRGB8888, it is the only one actually used in practice. Drop unused mappings in virtio_gpu_translate_format(). With this patch applied both ADDFB and ADDFB2 ioctls work correctly in the virtio-gpu.ko driver on big endian machines. Without the patch only ADDFB (which still seems to be used by the majority of userspace) works correctly. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-25drm/virtio: pass virtio_gpu_object to virtio_gpu_cmd_transfer_to_host_{2d, 3d}Gerd Hoffmann1-2/+2
Pass virtio_gpu_object down to virtio_gpu_cmd_transfer_to_host_2d and virtio_gpu_cmd_transfer_to_host_3d functions, instead of passing just the virtio resource handle. This is needed to lookup the scatter list of the object, for dma sync. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Jiandi An <[email protected]> Tested-by: Jiandi An <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-09-05drm/virtio: track virtual output stateGerd Hoffmann1-1/+1
Track whenever an virtual output (crtc) is enabled or disabled. On atomic updates check for both framebuffer being present and crtc being enabled to figure whenever the output is active or not. Signed-off-by: Gerd Hoffmann <[email protected]> Reviewed-by: Dave Airlie <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2018-05-18drm/virtio: Place GEM BOs in drm_framebufferDaniel Stone1-2/+2
Since drm_framebuffer can now store GEM objects directly, place them there rather than in our own subclass. As this makes the framebuffer create_handle and destroy functions the same as the GEM framebuffer helper, we can reuse those. Signed-off-by: Daniel Stone <[email protected]> Reviewed-by: Thierry Reding <[email protected]> Cc: Dave Airlie <[email protected]> Cc: Gerd Hoffmann <[email protected]> Cc: [email protected] Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-08-01drm: Plumb modifiers through plane initBen Widawsky1-1/+1
This is the plumbing for supporting fb modifiers on planes. Modifiers have already been introduced to some extent, but this series will extend this to allow querying modifiers per plane. Based on this, the client to enable optimal modifications for framebuffers. This patch simply allows the DRM drivers to initialize their list of supported modifiers upon initializing the plane. v2: A minor addition from Daniel v3: * Updated commit message * s/INVALID/DRM_FORMAT_MOD_INVALID (Liviu) * Remove some excess newlines (Liviu) * Update comment for > 64 modifiers (Liviu) v4: Minor comment adjustments (Liviu) v5: Some new platforms added due to rebase v6: Add some missed plane inits (or maybe they're new - who knows at this point) (Daniel) Signed-off-by: Ben Widawsky <[email protected]> Reviewed-by: Daniel Stone <[email protected]> (v2) Reviewed-by: Liviu Dudau <[email protected]> Signed-off-by: Daniel Stone <[email protected]>
2017-04-06drm: virtio: fix virtio_gpu_cursor_formatsLaurent Vivier1-0/+4
When we use virtio-vga with a big-endian guest, the mouse pointer disappears. To fix that, on big-endian use DRM_FORMAT_BGRA8888 instead of DRM_FORMAT_ARGB8888. Signed-off-by: Laurent Vivier <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2017-04-04drm: virtio: add virtio_gpu_translate_formatGerd Hoffmann1-0/+68
Factors out code, no functional change. Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Daniel Vetter <[email protected]> Tested-by: Laurent Vivier <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2017-02-16drm/virtio: call drm_plane_cleanup() at destroy phaseGustavo Padovan1-0/+1
virtio was missing this call to clean up core plane usage. Signed-off-by: Gustavo Padovan <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2016-12-15drm/virtio: fix endianness in primary_plane_updateMichael S. Tsirkin1-2/+2
virtio_gpu_cmd_transfer_to_host_2d expects x and y parameters in LE, but virtio_gpu_primary_plane_update passes in the CPU format instead. Signed-off-by: Michael S. Tsirkin <[email protected]>
2016-10-25dma-buf: Rename struct fence to dma_fenceChris Wilson1-1/+1
I plan to usurp the short name of struct fence for a core kernel struct, and so I need to rename the specialised fence/timeline for DMA operations to make room. A consensus was reached in https://lists.freedesktop.org/archives/dri-devel/2016-July/113083.html that making clear this fence applies to DMA operations was a good thing. Since then the patch has grown a bit as usage increases, so hopefully it remains a good thing! (v2...: rebase, rerun spatch) v3: Compile on msm, spotted a manual fixup that I broke. v4: Try again for msm, sorry Daniel coccinelle script: @@ @@ - struct fence + struct dma_fence @@ @@ - struct fence_ops + struct dma_fence_ops @@ @@ - struct fence_cb + struct dma_fence_cb @@ @@ - struct fence_array + struct dma_fence_array @@ @@ - enum fence_flag_bits + enum dma_fence_flag_bits @@ @@ ( - fence_init + dma_fence_init | - fence_release + dma_fence_release | - fence_free + dma_fence_free | - fence_get + dma_fence_get | - fence_get_rcu + dma_fence_get_rcu | - fence_put + dma_fence_put | - fence_signal + dma_fence_signal | - fence_signal_locked + dma_fence_signal_locked | - fence_default_wait + dma_fence_default_wait | - fence_add_callback + dma_fence_add_callback | - fence_remove_callback + dma_fence_remove_callback | - fence_enable_sw_signaling + dma_fence_enable_sw_signaling | - fence_is_signaled_locked + dma_fence_is_signaled_locked | - fence_is_signaled + dma_fence_is_signaled | - fence_is_later + dma_fence_is_later | - fence_later + dma_fence_later | - fence_wait_timeout + dma_fence_wait_timeout | - fence_wait_any_timeout + dma_fence_wait_any_timeout | - fence_wait + dma_fence_wait | - fence_context_alloc + dma_fence_context_alloc | - fence_array_create + dma_fence_array_create | - to_fence_array + to_dma_fence_array | - fence_is_array + dma_fence_is_array | - trace_fence_emit + trace_dma_fence_emit | - FENCE_TRACE + DMA_FENCE_TRACE | - FENCE_WARN + DMA_FENCE_WARN | - FENCE_ERR + DMA_FENCE_ERR ) ( ... ) Signed-off-by: Chris Wilson <[email protected]> Reviewed-by: Gustavo Padovan <[email protected]> Acked-by: Sumit Semwal <[email protected]> Acked-by: Christian König <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2016-09-20virtio-gpu: avoid possible NULL pointer dereferenceHeinrich Schuchardt1-2/+4
If output is NULL it is not permissable to dereference it. So we should leave the respective function in this case. The inconsistency was indicated by cppcheck. No actual NULL pointer dereference was observed. Signed-off-by: Heinrich Schuchardt <[email protected]> Message-id: [email protected] Signed-off-by: Gerd Hoffmann <[email protected]>
2016-06-07virtio-gpu: use src not crtcGerd Hoffmann1-13/+18
Pick up the correct source rectangle from framebuffer. Without this multihead setups are not working correctly. Signed-off-by: Gerd Hoffmann <[email protected]>
2016-06-07virtio-gpu: pick up hotspot from framebufferGerd Hoffmann1-7/+13
Signed-off-by: Gerd Hoffmann <[email protected]>
2016-06-07virtio-gpu: switch to atomic cursor interfacesGerd Hoffmann1-9/+96
Signed-off-by: Gerd Hoffmann <[email protected]>
2016-06-07virtio-gpu: fix output lookupGerd Hoffmann1-1/+7
Needed for multihead setups where we can have disabled outputs and therefore plane->crtc can be NULL. Signed-off-by: Gerd Hoffmann <[email protected]>
2016-02-11drm: virtio-gpu: transfer dumb buffers to host on plane updateRob Herring1-0/+7
For dumb buffers, we need to transfer them to the host when updating a plane. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2016-02-11drm: virtio-gpu: ensure plane is flushed to host on atomic updateRob Herring1-0/+5
This fixes drawing updates when updating planes with atomic API. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2016-02-11drm: virtio-gpu: get the fb from the plane state for atomic updatesRob Herring1-2/+2
When using the atomic API, plane->fb is not set when calling virtio_gpu_plane_atomic_update. Use plane->state->fb instead. Signed-off-by: Rob Herring <[email protected]> Signed-off-by: Dave Airlie <[email protected]>
2015-12-11drm: Pass 'name' to drm_universal_plane_init()Ville Syrjälä1-1/+1
Done with coccinelle for the most part. It choked on msm/mdp/mdp5/mdp5_plane.c like so: "BAD:!!!!! enum drm_plane_type type;" No idea how to deal with that, so I just fixed that up by hand. Also it thinks '...' is part of the semantic patch, so I put an 'int DOTDOTDOT' placeholder in its place and got rid of it with sed afterwards. I didn't convert drm_plane_init() since passing the varargs through would mean either cpp macros or va_list, and I figured we don't care about these legacy functions enough to warrant the extra pain. @@ typedef uint32_t; identifier dev, plane, possible_crtcs, funcs, formats, format_count, type; @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, const struct drm_plane_funcs *funcs, const uint32_t *formats, unsigned int format_count, enum drm_plane_type type + ,const char *name, int DOTDOTDOT ) { ... } @@ identifier dev, plane, possible_crtcs, funcs, formats, format_count, type; @@ int drm_universal_plane_init(struct drm_device *dev, struct drm_plane *plane, unsigned long possible_crtcs, const struct drm_plane_funcs *funcs, const uint32_t *formats, unsigned int format_count, enum drm_plane_type type + ,const char *name, int DOTDOTDOT ); @@ expression E1, E2, E3, E4, E5, E6, E7; @@ drm_universal_plane_init(E1, E2, E3, E4, E5, E6, E7 + ,NULL ) v2: Split crtc and plane changes apart Pass NUL for no-name instead of "" Leave drm_plane_init() alone v3: Add ', or NULL...' to @name kernel doc (Jani) Annotate the function with __printf() attribute (Jani) Signed-off-by: Ville Syrjälä <[email protected]> Signed-off-by: Daniel Vetter <[email protected]> Link: http://patchwork.freedesktop.org/patch/msgid/[email protected]
2015-06-03Add virtio gpu driver.Dave Airlie1-0/+120
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 <[email protected]> Signed-off-by: Gerd Hoffmann <[email protected]> Acked-by: Michael S. Tsirkin <[email protected]>