drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/hyperv/hyperv_drm_modeset.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/hyperv/hyperv_drm_modeset.c- Extension
.c- Size
- 9552 bytes
- Lines
- 341
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Uses kernel synchronization; read lock ordering, sleepability, and interrupt context assumptions before translating.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/hyperv.hdrm/drm_atomic.hdrm/drm_crtc_helper.hdrm/drm_damage_helper.hdrm/drm_drv.hdrm/drm_edid.hdrm/drm_format_helper.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_gem_shmem_helper.hdrm/drm_probe_helper.hdrm/drm_panic.hdrm/drm_plane.hdrm/drm_print.hdrm/drm_vblank.hdrm/drm_vblank_helper.hhyperv_drm.h
Detected Declarations
function hyperv_blit_to_vram_rectfunction hyperv_connector_get_modesfunction hyperv_conn_initfunction hyperv_check_sizefunction hyperv_crtc_helper_atomic_enablefunction hyperv_plane_atomic_checkfunction hyperv_plane_atomic_updatefunction hyperv_plane_get_scanout_bufferfunction hyperv_plane_panic_flushfunction hyperv_pipe_initfunction hyperv_mode_validfunction hyperv_mode_config_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright 2021 Microsoft
*/
#include <linux/hyperv.h>
#include <drm/drm_atomic.h>
#include <drm/drm_crtc_helper.h>
#include <drm/drm_damage_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_edid.h>
#include <drm/drm_format_helper.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_framebuffer.h>
#include <drm/drm_gem_atomic_helper.h>
#include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_gem_shmem_helper.h>
#include <drm/drm_probe_helper.h>
#include <drm/drm_panic.h>
#include <drm/drm_plane.h>
#include <drm/drm_print.h>
#include <drm/drm_vblank.h>
#include <drm/drm_vblank_helper.h>
#include "hyperv_drm.h"
static int hyperv_blit_to_vram_rect(struct drm_framebuffer *fb,
const struct iosys_map *vmap,
struct drm_rect *rect)
{
struct hyperv_drm_device *hv = to_hv(fb->dev);
struct iosys_map dst = IOSYS_MAP_INIT_VADDR_IOMEM(hv->vram);
int idx;
if (!drm_dev_enter(&hv->dev, &idx))
return -ENODEV;
iosys_map_incr(&dst, drm_fb_clip_offset(fb->pitches[0], fb->format, rect));
drm_fb_memcpy(&dst, fb->pitches, vmap, fb, rect);
drm_dev_exit(idx);
return 0;
}
static int hyperv_connector_get_modes(struct drm_connector *connector)
{
struct hyperv_drm_device *hv = to_hv(connector->dev);
int count;
count = drm_add_modes_noedid(connector,
connector->dev->mode_config.max_width,
connector->dev->mode_config.max_height);
drm_set_preferred_mode(connector, hv->preferred_width,
hv->preferred_height);
return count;
}
static const struct drm_connector_helper_funcs hyperv_connector_helper_funcs = {
.get_modes = hyperv_connector_get_modes,
};
static const struct drm_connector_funcs hyperv_connector_funcs = {
.fill_modes = drm_helper_probe_single_connector_modes,
.destroy = drm_connector_cleanup,
.reset = drm_atomic_helper_connector_reset,
.atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state,
.atomic_destroy_state = drm_atomic_helper_connector_destroy_state,
};
static inline int hyperv_conn_init(struct hyperv_drm_device *hv)
{
drm_connector_helper_add(&hv->connector, &hyperv_connector_helper_funcs);
return drm_connector_init(&hv->dev, &hv->connector,
&hyperv_connector_funcs,
DRM_MODE_CONNECTOR_VIRTUAL);
}
static int hyperv_check_size(struct hyperv_drm_device *hv, int w, int h,
struct drm_framebuffer *fb)
{
u32 pitch = w * (hv->screen_depth / 8);
if (fb)
pitch = fb->pitches[0];
if (pitch * h > hv->fb_size)
return -EINVAL;
Annotation
- Immediate include surface: `linux/hyperv.h`, `drm/drm_atomic.h`, `drm/drm_crtc_helper.h`, `drm/drm_damage_helper.h`, `drm/drm_drv.h`, `drm/drm_edid.h`, `drm/drm_format_helper.h`, `drm/drm_fourcc.h`.
- Detected declarations: `function hyperv_blit_to_vram_rect`, `function hyperv_connector_get_modes`, `function hyperv_conn_init`, `function hyperv_check_size`, `function hyperv_crtc_helper_atomic_enable`, `function hyperv_plane_atomic_check`, `function hyperv_plane_atomic_update`, `function hyperv_plane_get_scanout_buffer`, `function hyperv_plane_panic_flush`, `function hyperv_pipe_init`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: source implementation candidate.
- Synchronization appears in or near this file; preserve lock ordering, sleepability, and interrupt-context constraints.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.