drivers/gpu/drm/drm_property.c
Source file repositories/reference/linux-study-clean/drivers/gpu/drm/drm_property.c
File Facts
- System
- Linux kernel
- Corpus path
drivers/gpu/drm/drm_property.c- Extension
.c- Size
- 30215 bytes
- Lines
- 1011
- Domain
- Driver Families
- Bucket
- drivers/gpu
- Inferred role
- Driver Families: exported/initcall integration point
- Status
- integration 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.
- Exports symbols or registers init work; inspect boot/module ordering and who consumes the exported contract.
- Touches user memory; correctness depends on fault-safe copying and privilege boundary handling.
- 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/export.hlinux/uaccess.hdrm/drm_crtc.hdrm/drm_drv.hdrm/drm_file.hdrm/drm_framebuffer.hdrm/drm_print.hdrm/drm_property.hdrm_crtc_internal.h
Detected Declarations
function Copyrightfunction drm_object_attach_propertyfunction drm_object_attach_propertyfunction drm_object_attach_propertyfunction drm_object_attach_propertyfunction drm_object_attach_propertyfunction drm_object_attach_propertyfunction drm_object_attach_propertyfunction drm_property_add_enumfunction list_for_each_entryfunction drm_property_destroyfunction list_for_each_entry_safefunction drm_mode_getproperty_ioctlfunction drm_property_free_blobfunction drm_property_create_blobfunction drm_property_blob_putfunction drm_property_destroy_user_blobsfunction drm_property_replace_global_blobfunction drm_property_replace_blobfunction drm_property_replace_blob_from_idfunction drm_mode_getblob_ioctlfunction drm_mode_createblob_ioctlfunction drm_mode_destroyblob_ioctlfunction issuesfunction drm_property_change_valid_putexport drm_property_createexport drm_property_create_enumexport drm_property_create_bitmaskexport drm_property_create_rangeexport drm_property_create_signed_rangeexport drm_property_create_objectexport drm_property_create_boolexport drm_property_add_enumexport drm_property_destroyexport drm_property_create_blobexport drm_property_blob_putexport drm_property_blob_getexport drm_property_lookup_blobexport drm_property_replace_global_blobexport drm_property_replace_blobexport drm_property_replace_blob_from_id
Annotated Snippet
if (ret) {
drm_property_destroy(dev, property);
return NULL;
}
}
return property;
}
EXPORT_SYMBOL(drm_property_create_enum);
/**
* drm_property_create_bitmask - create a new bitmask property type
* @dev: drm device
* @flags: flags specifying the property type
* @name: name of the property
* @props: enumeration lists with property bitflags
* @num_props: size of the @props array
* @supported_bits: bitmask of all supported enumeration values
*
* This creates a new bitmask drm property which can then be attached to a drm
* object with drm_object_attach_property(). The returned property object must
* be freed with drm_property_destroy(), which is done automatically when
* calling drm_mode_config_cleanup().
*
* Compared to plain enumeration properties userspace is allowed to set any
* or'ed together combination of the predefined property bitflag values
*
* Returns:
* A pointer to the newly created property on success, NULL on failure.
*/
struct drm_property *drm_property_create_bitmask(struct drm_device *dev,
u32 flags, const char *name,
const struct drm_prop_enum_list *props,
int num_props,
uint64_t supported_bits)
{
struct drm_property *property;
int i, ret;
int num_values = hweight64(supported_bits);
flags |= DRM_MODE_PROP_BITMASK;
property = drm_property_create(dev, flags, name, num_values);
if (!property)
return NULL;
for (i = 0; i < num_props; i++) {
if (!(supported_bits & (1ULL << props[i].type)))
continue;
ret = drm_property_add_enum(property,
props[i].type,
props[i].name);
if (ret) {
drm_property_destroy(dev, property);
return NULL;
}
}
return property;
}
EXPORT_SYMBOL(drm_property_create_bitmask);
static struct drm_property *property_create_range(struct drm_device *dev,
u32 flags, const char *name,
uint64_t min, uint64_t max)
{
struct drm_property *property;
property = drm_property_create(dev, flags, name, 2);
if (!property)
return NULL;
property->values[0] = min;
property->values[1] = max;
return property;
}
/**
* drm_property_create_range - create a new unsigned ranged property type
* @dev: drm device
* @flags: flags specifying the property type
* @name: name of the property
* @min: minimum value of the property
* @max: maximum value of the property
*
* This creates a new generic drm property which can then be attached to a drm
* object with drm_object_attach_property(). The returned property object must
* be freed with drm_property_destroy(), which is done automatically when
* calling drm_mode_config_cleanup().
Annotation
- Immediate include surface: `linux/export.h`, `linux/uaccess.h`, `drm/drm_crtc.h`, `drm/drm_drv.h`, `drm/drm_file.h`, `drm/drm_framebuffer.h`, `drm/drm_print.h`, `drm/drm_property.h`.
- Detected declarations: `function Copyright`, `function drm_object_attach_property`, `function drm_object_attach_property`, `function drm_object_attach_property`, `function drm_object_attach_property`, `function drm_object_attach_property`, `function drm_object_attach_property`, `function drm_object_attach_property`, `function drm_property_add_enum`, `function list_for_each_entry`.
- Atlas domain: Driver Families / drivers/gpu.
- Implementation status: integration implementation candidate.
- This snippet crosses the user/kernel memory boundary; validate fault handling and access checks before translating the pattern.
- 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.