// SPDX-License-Identifier: GPL-2.0 OR MIT /************************************************************************** * * Copyright 2009-2023 VMware, Inc., Palo Alto, CA., USA * * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the * "Software"), to deal in the Software without restriction, including * without limitation the rights to use, copy, modify, merge, publish, * distribute, sub license, and/or sell copies of the Software, and to * permit persons to whom the Software is furnished to do so, subject to * the following conditions: * * The above copyright notice and this permission notice (including the * next paragraph) shall be included in all copies or substantial portions * of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL * THE COPYRIGHT HOLDERS, AUTHORS AND/OR ITS SUPPLIERS BE LIABLE FOR ANY CLAIM, * DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR * OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE * USE OR OTHER DEALINGS IN THE SOFTWARE. * **************************************************************************/ #include "vmwgfx_bo.h" #include "vmwgfx_drv.h" #include "device_include/svga_overlay.h" #include "device_include/svga_escape.h" #include <drm/ttm/ttm_placement.h> #define VMW_MAX_NUM_STREAMS … #define VMW_OVERLAY_CAP_MASK … struct vmw_stream { … }; /* * Overlay control */ struct vmw_overlay { … }; struct vmw_escape_header { … }; struct vmw_escape_video_flush { … }; static inline void fill_escape(struct vmw_escape_header *header, uint32_t size) { … } static inline void fill_flush(struct vmw_escape_video_flush *cmd, uint32_t stream_id) { … } /* * Send put command to hw. * * Returns * -ERESTARTSYS if interrupted by a signal. */ static int vmw_overlay_send_put(struct vmw_private *dev_priv, struct vmw_bo *buf, struct drm_vmw_control_stream_arg *arg, bool interruptible) { … } /* * Send stop command to hw. * * Returns * -ERESTARTSYS if interrupted by a signal. */ static int vmw_overlay_send_stop(struct vmw_private *dev_priv, uint32_t stream_id, bool interruptible) { … } /* * Move a buffer to vram or gmr if @pin is set, else unpin the buffer. * * With the introduction of screen objects buffers could now be * used with GMRs instead of being locked to vram. */ static int vmw_overlay_move_buffer(struct vmw_private *dev_priv, struct vmw_bo *buf, bool pin, bool inter) { … } /* * Stop or pause a stream. * * If the stream is paused the no evict flag is removed from the buffer * but left in vram. This allows for instance mode_set to evict it * should it need to. * * The caller must hold the overlay lock. * * @stream_id which stream to stop/pause. * @pause true to pause, false to stop completely. */ static int vmw_overlay_stop(struct vmw_private *dev_priv, uint32_t stream_id, bool pause, bool interruptible) { … } /* * Update a stream and send any put or stop fifo commands needed. * * The caller must hold the overlay lock. * * Returns * -ENOMEM if buffer doesn't fit in vram. * -ERESTARTSYS if interrupted. */ static int vmw_overlay_update_stream(struct vmw_private *dev_priv, struct vmw_bo *buf, struct drm_vmw_control_stream_arg *arg, bool interruptible) { … } /* * Try to resume all paused streams. * * Used by the kms code after moving a new scanout buffer to vram. * * Takes the overlay lock. */ int vmw_overlay_resume_all(struct vmw_private *dev_priv) { … } /* * Pauses all active streams. * * Used by the kms code when moving a new scanout buffer to vram. * * Takes the overlay lock. */ int vmw_overlay_pause_all(struct vmw_private *dev_priv) { … } static bool vmw_overlay_available(const struct vmw_private *dev_priv) { … } int vmw_overlay_ioctl(struct drm_device *dev, void *data, struct drm_file *file_priv) { … } int vmw_overlay_num_overlays(struct vmw_private *dev_priv) { … } int vmw_overlay_num_free_overlays(struct vmw_private *dev_priv) { … } int vmw_overlay_claim(struct vmw_private *dev_priv, uint32_t *out) { … } int vmw_overlay_unref(struct vmw_private *dev_priv, uint32_t stream_id) { … } int vmw_overlay_init(struct vmw_private *dev_priv) { … } int vmw_overlay_close(struct vmw_private *dev_priv) { … }