drivers/gpu/drm/xen/xen_drm_front_conn.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xen/xen_drm_front_conn.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xen/xen_drm_front_conn.c- Extension
.c- Size
- 3247 bytes
- Lines
- 118
- 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
drm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_fourcc.hdrm/drm_probe_helper.hvideo/videomode.hxen_drm_front.hxen_drm_front_conn.hxen_drm_front_kms.h
Detected Declarations
function Copyrightfunction connector_detectfunction connector_get_modesfunction xen_drm_front_conn_init
Annotated Snippet
// SPDX-License-Identifier: GPL-2.0 OR MIT
/*
* Xen para-virtual DRM device
*
* Copyright (C) 2016-2018 EPAM Systems Inc.
*
* Author: Oleksandr Andrushchenko <oleksandr_andrushchenko@epam.com>
*/
#include <drm/drm_atomic_helper.h>
#include <drm/drm_drv.h>
#include <drm/drm_fourcc.h>
#include <drm/drm_probe_helper.h>
#include <video/videomode.h>
#include "xen_drm_front.h"
#include "xen_drm_front_conn.h"
#include "xen_drm_front_kms.h"
static struct xen_drm_front_drm_pipeline *
to_xen_drm_pipeline(struct drm_connector *connector)
{
return container_of(connector, struct xen_drm_front_drm_pipeline, conn);
}
static const u32 plane_formats[] = {
DRM_FORMAT_RGB565,
DRM_FORMAT_RGB888,
DRM_FORMAT_XRGB8888,
DRM_FORMAT_ARGB8888,
DRM_FORMAT_XRGB4444,
DRM_FORMAT_ARGB4444,
DRM_FORMAT_XRGB1555,
DRM_FORMAT_ARGB1555,
DRM_FORMAT_YUYV,
};
const u32 *xen_drm_front_conn_get_formats(int *format_count)
{
*format_count = ARRAY_SIZE(plane_formats);
return plane_formats;
}
static int connector_detect(struct drm_connector *connector,
struct drm_modeset_acquire_ctx *ctx,
bool force)
{
struct xen_drm_front_drm_pipeline *pipeline =
to_xen_drm_pipeline(connector);
if (drm_dev_is_unplugged(connector->dev))
pipeline->conn_connected = false;
return pipeline->conn_connected ? connector_status_connected :
connector_status_disconnected;
}
#define XEN_DRM_CRTC_VREFRESH_HZ 60
static int connector_get_modes(struct drm_connector *connector)
{
struct xen_drm_front_drm_pipeline *pipeline =
to_xen_drm_pipeline(connector);
struct drm_display_mode *mode;
struct videomode videomode;
int width, height;
mode = drm_mode_create(connector->dev);
if (!mode)
return 0;
memset(&videomode, 0, sizeof(videomode));
videomode.hactive = pipeline->width;
videomode.vactive = pipeline->height;
width = videomode.hactive + videomode.hfront_porch +
videomode.hback_porch + videomode.hsync_len;
height = videomode.vactive + videomode.vfront_porch +
videomode.vback_porch + videomode.vsync_len;
videomode.pixelclock = width * height * XEN_DRM_CRTC_VREFRESH_HZ;
mode->type = DRM_MODE_TYPE_PREFERRED | DRM_MODE_TYPE_DRIVER;
drm_display_mode_from_videomode(&videomode, mode);
drm_mode_probed_add(connector, mode);
return 1;
}
static const struct drm_connector_helper_funcs connector_helper_funcs = {
.get_modes = connector_get_modes,
Annotation
- Immediate include surface: `drm/drm_atomic_helper.h`, `drm/drm_drv.h`, `drm/drm_fourcc.h`, `drm/drm_probe_helper.h`, `video/videomode.h`, `xen_drm_front.h`, `xen_drm_front_conn.h`, `xen_drm_front_kms.h`.
- Detected declarations: `function Copyright`, `function connector_detect`, `function connector_get_modes`, `function xen_drm_front_conn_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.