drivers/gpu/drm/qxl/qxl_display.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/qxl/qxl_display.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/qxl/qxl_display.c- Extension
.c- Size
- 35745 bytes
- Lines
- 1320
- 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.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/crc32.hlinux/delay.hlinux/iosys-map.hdrm/drm_drv.hdrm/drm_atomic.hdrm/drm_atomic_helper.hdrm/drm_edid.hdrm/drm_framebuffer.hdrm/drm_gem_framebuffer_helper.hdrm/drm_plane_helper.hdrm/drm_print.hdrm/drm_probe_helper.hdrm/drm_simple_kms_helper.hdrm/drm_gem_atomic_helper.hdrm/drm_vblank.hdrm/drm_vblank_helper.hqxl_drv.hqxl_object.h
Detected Declarations
function filesfunction qxl_alloc_client_monitors_configfunction qxl_display_copy_rom_client_monitors_configfunction qxl_update_offset_propsfunction list_for_each_entryfunction qxl_display_read_client_monitors_configfunction qxl_check_modefunction qxl_check_framebufferfunction qxl_add_modefunction qxl_add_monitors_config_modesfunction qxl_add_extra_modesfunction qxl_send_monitors_configfunction qxl_crtc_update_monitors_configfunction qxl_crtc_atomic_flushfunction qxl_crtc_destroyfunction qxl_framebuffer_surface_dirtyfunction qxl_crtc_atomic_enablefunction qxl_crtc_atomic_disablefunction qxl_primary_atomic_checkfunction qxl_primary_apply_cursorfunction qxl_primary_move_cursorfunction qxl_free_cursorfunction qxl_primary_atomic_updatefunction qxl_primary_atomic_disablefunction qxl_cursor_atomic_updatefunction qxl_cursor_atomic_disablefunction qxl_update_dumb_headfunction qxl_calc_dumb_shadowfunction qxl_prepare_shadowfunction qxl_plane_prepare_fbfunction qxl_plane_cleanup_fbfunction qdev_crtc_initfunction qxl_conn_get_modesfunction qxl_conn_mode_validfunction qxl_conn_detectfunction qxl_conn_destroyfunction qxl_mode_create_hotplug_mode_update_propertyfunction qdev_output_initfunction qxl_user_framebuffer_createfunction qxl_create_monitors_objectfunction qxl_destroy_monitors_objectfunction qxl_modeset_initfunction qxl_modeset_fini
Annotated Snippet
if (client_head->x != c_rect->left) {
client_head->x = c_rect->left;
status = MONITORS_CONFIG_MODIFIED;
}
if (client_head->y != c_rect->top) {
client_head->y = c_rect->top;
status = MONITORS_CONFIG_MODIFIED;
}
if (client_head->width != c_rect->right - c_rect->left) {
client_head->width = c_rect->right - c_rect->left;
status = MONITORS_CONFIG_MODIFIED;
}
if (client_head->height != c_rect->bottom - c_rect->top) {
client_head->height = c_rect->bottom - c_rect->top;
status = MONITORS_CONFIG_MODIFIED;
}
if (client_head->surface_id != 0) {
client_head->surface_id = 0;
status = MONITORS_CONFIG_MODIFIED;
}
if (client_head->id != i) {
client_head->id = i;
status = MONITORS_CONFIG_MODIFIED;
}
if (client_head->flags != 0) {
client_head->flags = 0;
status = MONITORS_CONFIG_MODIFIED;
}
DRM_DEBUG_KMS("read %dx%d+%d+%d\n", client_head->width, client_head->height,
client_head->x, client_head->y);
}
return status;
}
static void qxl_update_offset_props(struct qxl_device *qdev)
{
struct drm_device *dev = &qdev->ddev;
struct drm_connector *connector;
struct qxl_output *output;
struct qxl_head *head;
list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
output = drm_connector_to_qxl_output(connector);
head = &qdev->client_monitors_config->heads[output->index];
drm_object_property_set_value(&connector->base,
dev->mode_config.suggested_x_property, head->x);
drm_object_property_set_value(&connector->base,
dev->mode_config.suggested_y_property, head->y);
}
}
void qxl_display_read_client_monitors_config(struct qxl_device *qdev)
{
struct drm_device *dev = &qdev->ddev;
struct drm_modeset_acquire_ctx ctx;
int status, retries, ret;
for (retries = 0; retries < 10; retries++) {
status = qxl_display_copy_rom_client_monitors_config(qdev);
if (status != MONITORS_CONFIG_BAD_CRC)
break;
udelay(5);
}
if (status == MONITORS_CONFIG_ERROR) {
DRM_DEBUG_KMS("ignoring client monitors config: error");
return;
}
if (status == MONITORS_CONFIG_BAD_CRC) {
DRM_DEBUG_KMS("ignoring client monitors config: bad crc");
return;
}
if (status == MONITORS_CONFIG_UNCHANGED) {
DRM_DEBUG_KMS("ignoring client monitors config: unchanged");
return;
}
DRM_MODESET_LOCK_ALL_BEGIN(dev, ctx, DRM_MODESET_ACQUIRE_INTERRUPTIBLE, ret);
qxl_update_offset_props(qdev);
DRM_MODESET_LOCK_ALL_END(dev, ctx, ret);
if (!drm_helper_hpd_irq_event(dev)) {
/* notify that the monitor configuration changed, to
adjust at the arbitrary resolution */
drm_kms_helper_hotplug_event(dev);
}
}
static int qxl_check_mode(struct qxl_device *qdev,
Annotation
- Immediate include surface: `linux/crc32.h`, `linux/delay.h`, `linux/iosys-map.h`, `drm/drm_drv.h`, `drm/drm_atomic.h`, `drm/drm_atomic_helper.h`, `drm/drm_edid.h`, `drm/drm_framebuffer.h`.
- Detected declarations: `function files`, `function qxl_alloc_client_monitors_config`, `function qxl_display_copy_rom_client_monitors_config`, `function qxl_update_offset_props`, `function list_for_each_entry`, `function qxl_display_read_client_monitors_config`, `function qxl_check_mode`, `function qxl_check_framebuffer`, `function qxl_add_mode`, `function qxl_add_monitors_config_modes`.
- 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.