drivers/gpu/drm/xen/xen_drm_front_kms.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/xen/xen_drm_front_kms.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/xen/xen_drm_front_kms.c- Extension
.c- Size
- 10330 bytes
- Lines
- 384
- 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.hdrm/drm_atomic_helper.hdrm/drm_drv.hdrm/drm_fourcc.hdrm/drm_framebuffer.hdrm/drm_gem.hdrm/drm_gem_atomic_helper.hdrm/drm_gem_framebuffer_helper.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_vblank.hxen_drm_front.hxen_drm_front_conn.hxen_drm_front_kms.h
Detected Declarations
function Copyrightfunction fb_destroyfunction fb_createfunction send_pending_eventfunction display_enablefunction display_disablefunction xen_drm_front_kms_on_frame_donefunction pflip_to_workerfunction display_send_page_flipfunction display_checkfunction display_updatefunction display_mode_validfunction display_pipe_initfunction xen_drm_front_kms_initfunction xen_drm_front_kms_fini
Annotated Snippet
if (ret) {
DRM_ERROR("Failed to send page flip request to backend: %d\n", ret);
pipeline->conn_connected = false;
/*
* Report the flip not handled, so pending event is
* sent, unblocking user-space.
*/
return false;
}
/*
* Signal that page flip was handled, pending event will be sent
* on frame done event from the backend.
*/
return true;
}
return false;
}
static int display_check(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *plane_state,
struct drm_crtc_state *crtc_state)
{
/*
* Xen doesn't initialize vblanking via drm_vblank_init(), so
* DRM helpers assume that it doesn't handle vblanking and start
* sending out fake VBLANK events automatically.
*
* As xen contains it's own logic for sending out VBLANK events
* in send_pending_event(), disable no_vblank (i.e., the xen
* driver has vblanking support).
*/
crtc_state->no_vblank = false;
return 0;
}
static void display_update(struct drm_simple_display_pipe *pipe,
struct drm_plane_state *old_plane_state)
{
struct xen_drm_front_drm_pipeline *pipeline =
to_xen_drm_pipeline(pipe);
struct drm_crtc *crtc = &pipe->crtc;
struct drm_pending_vblank_event *event;
int idx;
event = crtc->state->event;
if (event) {
struct drm_device *dev = crtc->dev;
unsigned long flags;
WARN_ON(pipeline->pending_event);
spin_lock_irqsave(&dev->event_lock, flags);
crtc->state->event = NULL;
pipeline->pending_event = event;
spin_unlock_irqrestore(&dev->event_lock, flags);
}
if (!drm_dev_enter(pipe->crtc.dev, &idx)) {
send_pending_event(pipeline);
return;
}
/*
* Send page flip request to the backend *after* we have event cached
* above, so on page flip done event from the backend we can
* deliver it and there is no race condition between this code and
* event from the backend.
* If this is not a page flip, e.g. no flip done event from the backend
* is expected, then send now.
*/
if (!display_send_page_flip(pipe, old_plane_state))
send_pending_event(pipeline);
drm_dev_exit(idx);
}
static enum drm_mode_status
display_mode_valid(struct drm_simple_display_pipe *pipe,
const struct drm_display_mode *mode)
{
struct xen_drm_front_drm_pipeline *pipeline =
container_of(pipe, struct xen_drm_front_drm_pipeline,
pipe);
if (mode->hdisplay != pipeline->width)
return MODE_ERROR;
Annotation
- Immediate include surface: `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_drv.h`, `drm/drm_fourcc.h`, `drm/drm_framebuffer.h`, `drm/drm_gem.h`, `drm/drm_gem_atomic_helper.h`, `drm/drm_gem_framebuffer_helper.h`.
- Detected declarations: `function Copyright`, `function fb_destroy`, `function fb_create`, `function send_pending_event`, `function display_enable`, `function display_disable`, `function xen_drm_front_kms_on_frame_done`, `function pflip_to_worker`, `function display_send_page_flip`, `function display_check`.
- 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.