linux/drivers/gpu/drm/amd/amdgpu/amdgpu_vkms.c

// SPDX-License-Identifier: GPL-2.0+

#include <drm/drm_atomic_helper.h>
#include <drm/drm_edid.h>
#include <drm/drm_simple_kms_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_vblank.h>

#include "amdgpu.h"
#ifdef CONFIG_DRM_AMDGPU_SI
#include "dce_v6_0.h"
#endif
#ifdef CONFIG_DRM_AMDGPU_CIK
#include "dce_v8_0.h"
#endif
#include "dce_v10_0.h"
#include "dce_v11_0.h"
#include "ivsrcid/ivsrcid_vislands30.h"
#include "amdgpu_vkms.h"
#include "amdgpu_display.h"
#include "atom.h"
#include "amdgpu_irq.h"

/**
 * DOC: amdgpu_vkms
 *
 * The amdgpu vkms interface provides a virtual KMS interface for several use
 * cases: devices without display hardware, platforms where the actual display
 * hardware is not useful (e.g., servers), SR-IOV virtual functions, device
 * emulation/simulation, and device bring up prior to display hardware being
 * usable. We previously emulated a legacy KMS interface, but there was a desire
 * to move to the atomic KMS interface. The vkms driver did everything we
 * needed, but we wanted KMS support natively in the driver without buffer
 * sharing and the ability to support an instance of VKMS per device. We first
 * looked at splitting vkms into a stub driver and a helper module that other
 * drivers could use to implement a virtual display, but this strategy ended up
 * being messy due to driver specific callbacks needed for buffer management.
 * Ultimately, it proved easier to import the vkms code as it mostly used core
 * drm helpers anyway.
 */

static const u32 amdgpu_vkms_formats[] =;

static enum hrtimer_restart amdgpu_vkms_vblank_simulate(struct hrtimer *timer)
{}

static int amdgpu_vkms_enable_vblank(struct drm_crtc *crtc)
{}

static void amdgpu_vkms_disable_vblank(struct drm_crtc *crtc)
{}

static bool amdgpu_vkms_get_vblank_timestamp(struct drm_crtc *crtc,
					     int *max_error,
					     ktime_t *vblank_time,
					     bool in_vblank_irq)
{}

static const struct drm_crtc_funcs amdgpu_vkms_crtc_funcs =;

static void amdgpu_vkms_crtc_atomic_enable(struct drm_crtc *crtc,
					   struct drm_atomic_state *state)
{}

static void amdgpu_vkms_crtc_atomic_disable(struct drm_crtc *crtc,
					    struct drm_atomic_state *state)
{}

static void amdgpu_vkms_crtc_atomic_flush(struct drm_crtc *crtc,
					  struct drm_atomic_state *state)
{}

static const struct drm_crtc_helper_funcs amdgpu_vkms_crtc_helper_funcs =;

static int amdgpu_vkms_crtc_init(struct drm_device *dev, struct drm_crtc *crtc,
			  struct drm_plane *primary, struct drm_plane *cursor)
{}

static const struct drm_connector_funcs amdgpu_vkms_connector_funcs =;

static int amdgpu_vkms_conn_get_modes(struct drm_connector *connector)
{}

static const struct drm_connector_helper_funcs amdgpu_vkms_conn_helper_funcs =;

static const struct drm_plane_funcs amdgpu_vkms_plane_funcs =;

static void amdgpu_vkms_plane_atomic_update(struct drm_plane *plane,
					    struct drm_atomic_state *old_state)
{}

static int amdgpu_vkms_plane_atomic_check(struct drm_plane *plane,
					  struct drm_atomic_state *state)
{}

static int amdgpu_vkms_prepare_fb(struct drm_plane *plane,
				  struct drm_plane_state *new_state)
{}

static void amdgpu_vkms_cleanup_fb(struct drm_plane *plane,
				   struct drm_plane_state *old_state)
{}

static const struct drm_plane_helper_funcs amdgpu_vkms_primary_helper_funcs =;

static struct drm_plane *amdgpu_vkms_plane_init(struct drm_device *dev,
						enum drm_plane_type type,
						int index)
{}

static int amdgpu_vkms_output_init(struct drm_device *dev, struct
				   amdgpu_vkms_output *output, int index)
{}

const struct drm_mode_config_funcs amdgpu_vkms_mode_funcs =;

static int amdgpu_vkms_sw_init(void *handle)
{}

static int amdgpu_vkms_sw_fini(void *handle)
{}

static int amdgpu_vkms_hw_init(void *handle)
{}

static int amdgpu_vkms_hw_fini(void *handle)
{}

static int amdgpu_vkms_suspend(void *handle)
{}

static int amdgpu_vkms_resume(void *handle)
{}

static bool amdgpu_vkms_is_idle(void *handle)
{}

static int amdgpu_vkms_wait_for_idle(void *handle)
{}

static int amdgpu_vkms_soft_reset(void *handle)
{}

static int amdgpu_vkms_set_clockgating_state(void *handle,
					  enum amd_clockgating_state state)
{}

static int amdgpu_vkms_set_powergating_state(void *handle,
					  enum amd_powergating_state state)
{}

static const struct amd_ip_funcs amdgpu_vkms_ip_funcs =;

const struct amdgpu_ip_block_version amdgpu_vkms_ip_block =;