### Configure Build Prefix with Meson Source: https://github.com/mesa/libdrm/blob/main/README.rst Configures the installation prefix for the project after initial Meson setup. This example sets the prefix to /usr. ```bash meson configure builddir/ -Dprefix=/usr ``` -------------------------------- ### Build and Install with Ninja Source: https://github.com/mesa/libdrm/blob/main/README.rst Builds and installs the project using Ninja after Meson setup. If installing to a system location, root privileges may be required for the install step. ```bash ninja -C builddir/ install ``` -------------------------------- ### Configure Build Directory with Meson Source: https://github.com/mesa/libdrm/blob/main/README.rst Sets up the build directory for the project using Meson. The default installation prefix is /usr/local, but can be changed. ```bash meson builddir/ ``` -------------------------------- ### Example Commit Message Subject Line Source: https://github.com/mesa/libdrm/blob/main/CONTRIBUTING.rst Illustrates the recommended format for the first line of a commit message, including a component prefix and a concise description of the change. ```git commit amdgpu: Use uint32_t i in amdgpu_find_bo_by_cpu_mapping ``` -------------------------------- ### GEM Buffer Operations Source: https://github.com/mesa/libdrm/blob/main/radeon/radeon-symbols.txt Functions for specific GEM buffer operations, including opening prime buffers, getting kernel names, and setting domains. ```APIDOC ## GEM Buffer Operations ### Description Provides specialized functions for GEM buffer operations, including inter-process communication via PRIME and setting memory domains. ### Functions - **radeon_bo_open_prime**: Opens a GEM buffer object using PRIME file descriptor. - **radeon_gem_bo_open_prime**: Opens a GEM buffer object using PRIME file descriptor (alternative name). - **radeon_gem_get_kernel_name**: Retrieves the kernel name of a GEM buffer object. - **radeon_gem_get_reloc_in_cs**: Gets relocation information for a GEM buffer in a command submission. - **radeon_gem_name_bo**: Names a GEM buffer object. - **radeon_gem_prime_share_bo**: Shares a GEM buffer object via PRIME. - **radeon_gem_set_domain**: Sets the memory domain for a GEM buffer object. ``` -------------------------------- ### Create and Map a Dumb-Buffer Source: https://github.com/mesa/libdrm/blob/main/man/drm-memory.7.rst Demonstrates the process of creating a driver-independent dumb-buffer, binding it to a DRM framebuffer, and memory-mapping it for direct access. This is useful for scanout or when a driver-specific buffer object is not required. ```c struct drm_mode_create_dumb creq; struct drm_mode_destroy_dumb dreq; struct drm_mode_map_dumb mreq; uint32_t fb; int ret; void *map; /* create dumb buffer */ memset(&creq, 0, sizeof(creq)); creq.width = 1920; creq.height = 1080; creq.bpp = 32; ret = drmIoctl(fd, DRM_IOCTL_MODE_CREATE_DUMB, &creq); if (ret < 0) { /* buffer creation failed; see "errno" for more error codes */ ... } /* creq.pitch, creq.handle and creq.size are filled by this ioctl with * the requested values and can be used now. */ /* create framebuffer object for the dumb-buffer */ ret = drmModeAddFB(fd, 1920, 1080, 24, 32, creq.pitch, creq.handle, &fb); if (ret) { /* frame buffer creation failed; see "errno" */ ... } /* the framebuffer "fb" can now used for scanout with KMS */ /* prepare buffer for memory mapping */ memset(&mreq, 0, sizeof(mreq)); mreq.handle = creq.handle; ret = drmIoctl(fd, DRM_IOCTL_MODE_MAP_DUMB, &mreq); if (ret) { /* DRM buffer preparation failed; see "errno" */ ... } /* mreq.offset now contains the new offset that can be used with mmap() */ /* perform actual memory mapping */ map = mmap(0, creq.size, PROT_READ | PROT_WRITE, MAP_SHARED, fd, mreq.offset); if (map == MAP_FAILED) { /* memory-mapping failed; see "errno" */ ... } /* clear the framebuffer to 0 */ memset(map, 0, creq.size); ``` -------------------------------- ### Exynos Video Connection Source: https://github.com/mesa/libdrm/blob/main/exynos/exynos-symbols.txt Function for establishing a video connection. ```APIDOC ## Exynos Video Connection ### Description Establishes a video connection within the Exynos system. ### Function - **exynos_vidi_connection**: Establishes a video connection. ``` -------------------------------- ### Device Management Functions Source: https://github.com/mesa/libdrm/blob/main/amdgpu/amdgpu-symbols.txt Functions for initializing, deinitializing, and querying information about the AMDGPU device. ```APIDOC ## Device Management ### Functions - `amdgpu_device_deinitialize`: Deinitializes the AMDGPU device. - `amdgpu_device_get_fd`: Gets the file descriptor for the AMDGPU device. - `amdgpu_device_initialize`: Initializes the AMDGPU device. - `amdgpu_device_initialize2`: Initializes the AMDGPU device (version 2). ``` -------------------------------- ### Surface Operations Source: https://github.com/mesa/libdrm/blob/main/radeon/radeon-symbols.txt Functions for initializing and managing Radeon surfaces. ```APIDOC ## Surface Operations ### Description Functions related to the initialization and management of Radeon surfaces. ### Functions - **radeon_surface_best**: Determines the best surface configuration. - **radeon_surface_init**: Initializes a surface. - **radeon_surface_manager_free**: Frees resources associated with the surface manager. - **radeon_surface_manager_new**: Creates a new surface manager. ``` -------------------------------- ### Client and Device Operations Source: https://github.com/mesa/libdrm/blob/main/nouveau/nouveau-symbols.txt Functions for managing clients and devices, including opening, closing, and creating them. ```APIDOC ## Client and Device Operations ### Description Functions for managing clients and devices, including opening, closing, and creating them. ### Functions - **nouveau_check_dead_channel**: Check for a dead channel. - **nouveau_client_del**: Delete a client. - **nouveau_client_new**: Create a new client. - **nouveau_device_del**: Delete a device. - **nouveau_device_new**: Create a new device. - **nouveau_device_open**: Open a device. - **nouveau_device_open_existing**: Open an existing device. - **nouveau_device_wrap**: Wrap an existing device. ``` -------------------------------- ### Exynos Prime Buffer Sharing Source: https://github.com/mesa/libdrm/blob/main/exynos/exynos-symbols.txt Functions for converting between file descriptors and handles for Exynos Prime buffers, enabling efficient buffer sharing. ```APIDOC ## Exynos Prime Buffer Sharing Functions ### Description Functions for interoperability with PRIME buffers, allowing conversion between file descriptors and handles. ### Functions - **exynos_prime_fd_to_handle**: Converts a PRIME buffer file descriptor to a handle. - **exynos_prime_handle_to_fd**: Converts a handle to a PRIME buffer file descriptor. ``` -------------------------------- ### Set AMDGPU ASIC ID Table Paths Source: https://github.com/mesa/libdrm/blob/main/README.rst Specifies alternative paths for the amdgpu.ids file at runtime by setting the AMDGPU_ASIC_ID_TABLE_PATHS environment variable. This feature requires the C library's secure_getenv() function. ```bash export AMDGPU_ASIC_ID_TABLE_PATHS=/path/to/tables:/another/path ``` -------------------------------- ### Command Submission and Synchronization Functions Source: https://github.com/mesa/libdrm/blob/main/amdgpu/amdgpu-symbols.txt Functions for creating, submitting, and synchronizing command submissions, including fences and sync objects. ```APIDOC ## Command Submission and Synchronization ### Functions - `amdgpu_cs_chunk_fence_info_to_data`: Converts fence information to data. - `amdgpu_cs_chunk_fence_to_dep`: Converts fence to dependency. - `amdgpu_cs_create_semaphore`: Creates a semaphore. - `amdgpu_cs_create_syncobj`: Creates a sync object. - `amdgpu_cs_create_syncobj2`: Creates a sync object (version 2). - `amdgpu_cs_ctx_create`: Creates a command submission context. - `amdgpu_cs_ctx_create2`: Creates a command submission context (version 2). - `amdgpu_cs_ctx_free`: Frees a command submission context. - `amdgpu_cs_ctx_override_priority`: Overrides the priority of a command submission context. - `amdgpu_cs_ctx_stable_pstate`: Sets the stable power state for a command submission context. - `amdgpu_cs_destroy_semaphore`: Destroys a semaphore. - `amdgpu_cs_destroy_syncobj`: Destroys a sync object. - `amdgpu_cs_export_syncobj`: Exports a sync object. - `amdgpu_cs_fence_to_handle`: Converts a fence to a handle. - `amdgpu_cs_import_syncobj`: Imports a sync object. - `amdgpu_cs_query_fence_status`: Queries the status of a fence. - `amdgpu_cs_query_reset_state`: Queries the reset state. - `amdgpu_cs_query_reset_state2`: Queries the reset state (version 2). - `amdgpu_query_sw_info`: Queries software information. - `amdgpu_cs_signal_semaphore`: Signals a semaphore. - `amdgpu_cs_submit`: Submits commands to the GPU. - `amdgpu_cs_submit_raw`: Submits raw commands to the GPU. - `amdgpu_cs_submit_raw2`: Submits raw commands to the GPU (version 2). - `amdgpu_cs_syncobj_export_sync_file`: Exports a sync object to a file descriptor. - `amdgpu_cs_syncobj_export_sync_file2`: Exports a sync object to a file descriptor (version 2). - `amdgpu_cs_syncobj_import_sync_file`: Imports a sync object from a file descriptor. - `amdgpu_cs_syncobj_import_sync_file2`: Imports a sync object from a file descriptor (version 2). - `amdgpu_cs_syncobj_query`: Queries a sync object. - `amdgpu_cs_syncobj_query2`: Queries a sync object (version 2). - `amdgpu_cs_syncobj_reset`: Resets a sync object. - `amdgpu_cs_syncobj_signal`: Signals a sync object. - `amdgpu_cs_syncobj_timeline_signal`: Signals a timeline sync object. - `amdgpu_cs_syncobj_timeline_wait`: Waits on a timeline sync object. - `amdgpu_cs_syncobj_transfer`: Transfers a sync object. - `amdgpu_cs_syncobj_wait`: Waits on a sync object. - `amdgpu_cs_wait_fences`: Waits for multiple fences. - `amdgpu_cs_wait_semaphore`: Waits on a semaphore. ``` -------------------------------- ### Device Management Functions Source: https://github.com/mesa/libdrm/blob/main/etnaviv/etnaviv-symbols.txt Functions for creating, referencing, and deleting Etnaviv devices, as well as retrieving the device file descriptor. ```APIDOC ## Device Management Functions ### Description Functions for managing Etnaviv devices. ### Functions - **etna_device_new** - **etna_device_new_dup** - **etna_device_ref** - **etna_device_del** - **etna_device_fd** ``` -------------------------------- ### User Queue Functions Source: https://github.com/mesa/libdrm/blob/main/amdgpu/amdgpu-symbols.txt Functions for creating and managing user-space queues for command submission. ```APIDOC ## User Queue Functions ### Functions - `amdgpu_create_userqueue`: Creates a user queue. - `amdgpu_free_userqueue`: Frees a user queue. - `amdgpu_userq_signal`: Signals a user queue. - `amdgpu_userq_wait`: Waits on a user queue. ``` -------------------------------- ### Buffer Object Manager (GEM) Source: https://github.com/mesa/libdrm/blob/main/radeon/radeon-symbols.txt Functions for initializing and destroying the GEM-based buffer object manager. ```APIDOC ## Buffer Object Manager (GEM) ### Description Manages the creation and destruction of GEM-based buffer objects. ### Functions - **radeon_bo_manager_gem_ctor**: Constructor for the GEM-based buffer object manager. - **radeon_bo_manager_gem_dtor**: Destructor for the GEM-based buffer object manager. ``` -------------------------------- ### Exynos Event Handling Source: https://github.com/mesa/libdrm/blob/main/exynos/exynos-symbols.txt Function for handling Exynos events. ```APIDOC ## Exynos Event Handling ### Description Handles events related to the Exynos DRM system. ### Function - **exynos_handle_event**: Processes Exynos events. ``` -------------------------------- ### Virtual Address Manager (VAM) Functions Source: https://github.com/mesa/libdrm/blob/main/amdgpu/amdgpu-symbols.txt Functions for managing virtual address spaces. ```APIDOC ## Virtual Address Manager (VAM) ### Functions - `amdgpu_va_manager_alloc`: Allocates a virtual address manager. - `amdgpu_va_manager_init`: Initializes a virtual address manager. - `amdgpu_va_manager_init2`: Initializes a virtual address manager (version 2). - `amdgpu_va_manager_deinit`: Deinitializes a virtual address manager. - `amdgpu_va_manager_query_sw_info`: Queries software information for the VAM. - `amdgpu_va_range_alloc`: Allocates a virtual address range. - `amdgpu_va_range_alloc2`: Allocates a virtual address range (version 2). - `amdgpu_va_range_free`: Frees a virtual address range. - `amdgpu_va_get_start_addr`: Gets the start address of a virtual address range. - `amdgpu_va_range_query`: Queries a virtual address range. - `amdgpu_vm_reserve_vmid`: Reserves a Virtual Machine ID (VMID). - `amdgpu_vm_unreserve_vmid`: Unreserves a Virtual Machine ID (VMID). ``` -------------------------------- ### Buffer Object (BO) Functions Source: https://github.com/mesa/libdrm/blob/main/etnaviv/etnaviv-symbols.txt Functions for creating, managing, and accessing buffer objects, including creation from names, dmabufs, and mapping memory. ```APIDOC ## Buffer Object (BO) Functions ### Description Functions for creating, managing, and accessing buffer objects. ### Functions - **etna_bo_new** - **etna_bo_from_name** - **etna_bo_from_dmabuf** - **etna_bo_ref** - **etna_bo_del** - **etna_bo_get_name** - **etna_bo_handle** - **etna_bo_dmabuf** - **etna_bo_size** - **etna_bo_map** - **etna_bo_cpu_prep** - **etna_bo_cpu_fini** ``` -------------------------------- ### Command Submission Manager (GEM) Source: https://github.com/mesa/libdrm/blob/main/radeon/radeon-symbols.txt Functions for initializing and destroying the GEM-based command submission manager. ```APIDOC ## Command Submission Manager (GEM) ### Description Manages the creation and destruction of GEM-based command submission contexts. ### Functions - **radeon_cs_manager_gem_ctor**: Constructor for the GEM-based command submission manager. - **radeon_cs_manager_gem_dtor**: Destructor for the GEM-based command submission manager. ``` -------------------------------- ### Command Submission (CS) Operations Source: https://github.com/mesa/libdrm/blob/main/radeon/radeon-symbols.txt Functions for creating, managing, and submitting command streams (CSs) to the Radeon hardware. ```APIDOC ## Command Submission (CS) Operations ### Description Provides a set of functions for managing command streams (CSs) and submitting them for execution. This includes creating, emitting commands, checking space, and managing buffer references within the command stream. ### Functions - **radeon_cs_begin**: Begins a new command submission sequence. - **radeon_cs_create**: Creates a new command submission context. - **radeon_cs_destroy**: Destroys a command submission context. - **radeon_cs_emit**: Emits a command into the command stream. - **radeon_cs_end**: Ends the current command submission sequence. - **radeon_cs_erase**: Erases a command submission. - **radeon_cs_get_id**: Retrieves the ID of the command submission. - **radeon_cs_need_flush**: Checks if a flush is needed for the command submission. - **radeon_cs_print**: Prints the contents of a command submission. - **radeon_cs_set_limit**: Sets a limit for the command submission. - **radeon_cs_space_add_persistent_bo**: Adds a persistent buffer object to the command submission space. - **radeon_cs_space_check**: Checks the available space in the command submission. - **radeon_cs_space_check_with_bo**: Checks space with a specific buffer object. - **radeon_cs_space_reset_bos**: Resets buffer objects in the command submission space. - **radeon_cs_space_set_flush**: Sets the flush behavior for the command submission space. - **radeon_cs_write_reloc**: Writes a relocation entry into the command stream. ``` -------------------------------- ### Information Query Functions Source: https://github.com/mesa/libdrm/blob/main/amdgpu/amdgpu-symbols.txt Functions for querying various hardware and software information related to the AMDGPU device. ```APIDOC ## Information Query ### Functions - `amdgpu_find_bo_by_cpu_mapping`: Finds a buffer object by its CPU mapping. - `amdgpu_get_marketing_name`: Gets the marketing name of the GPU. - `amdgpu_query_buffer_size_alignment`: Queries buffer size and alignment. - `amdgpu_query_crtc_from_id`: Queries the CRTC from its ID. - `amdgpu_query_firmware_version`: Queries the firmware version. - `amdgpu_query_gds_info`: Queries Graphics Data Store (GDS) information. - `amdgpu_query_gpu_info`: Queries general GPU information. - `amdgpu_query_gpuvm_fault_info`: Queries GPU VM fault information. - `amdgpu_query_heap_info`: Queries heap information. - `amdgpu_query_hw_ip_count`: Queries the count of hardware IP blocks. - `amdgpu_query_hw_ip_info`: Queries information about a hardware IP block. - `amdgpu_query_info`: Queries general information. - `amdgpu_query_sensor_info`: Queries sensor information. - `amdgpu_query_uq_fw_area_info`: Queries firmware update area information. - `amdgpu_query_video_caps_info`: Queries video capabilities information. - `amdgpu_read_mm_registers`: Reads memory-mapped registers. ``` -------------------------------- ### Buffer Context Operations Source: https://github.com/mesa/libdrm/blob/main/nouveau/nouveau-symbols.txt Functions for managing buffer contexts, including creation, deletion, and referencing. ```APIDOC ## Buffer Context Operations ### Description Functions for managing buffer contexts, including creation, deletion, and referencing. ### Functions - **nouveau_bufctx_del**: Delete a buffer context. - **nouveau_bufctx_mthd**: Execute a method within a buffer context. - **nouveau_bufctx_new**: Create a new buffer context. - **nouveau_bufctx_refn**: Reference a buffer context. - **nouveau_bufctx_reset**: Reset a buffer context. ``` -------------------------------- ### Exynos Device Management Source: https://github.com/mesa/libdrm/blob/main/exynos/exynos-symbols.txt Functions for creating and destroying Exynos DRM devices, which represent the graphics hardware. ```APIDOC ## Exynos Device Functions ### Description Functions for managing Exynos DRM devices. ### Functions - **exynos_device_create**: Creates a new Exynos DRM device. - **exynos_device_destroy**: Destroys an Exynos DRM device. ``` -------------------------------- ### Pipe Management Functions Source: https://github.com/mesa/libdrm/blob/main/etnaviv/etnaviv-symbols.txt Functions for creating, deleting, and waiting on Etnaviv pipes. ```APIDOC ## Pipe Management Functions ### Description Functions for managing Etnaviv pipes and synchronization. ### Functions - **etna_pipe_new** - **etna_pipe_del** - **etna_pipe_wait** - **etna_pipe_wait_ns** ``` -------------------------------- ### drmModeGetResources Source: https://github.com/mesa/libdrm/blob/main/man/drmModeGetResources.3.rst Allocates, populates, and returns a drmModeRes structure containing information about the current display configuration. This includes details on framebuffers, CRTCs, connectors, encoders, and supported framebuffer dimensions. ```APIDOC ## drmModeGetResources ### Description Retrieves current display configuration information. ### Synopsis ```c #include #include drmModeResPtr drmModeGetResources(int fd); ``` ### Details This function allocates and populates a `drmModeRes` structure with the following fields: - `count_fbs`: Number of currently allocated framebuffer objects. - `fbs`: Array of framebuffer object IDs. - `count_crtcs`: Number of available CRTCs. - `crtcs`: Array of CRTC IDs. - `count_connectors`: Number of available physical connectors. - `connectors`: Array of connector IDs. - `count_encoders`: Number of available encoders. - `encoders`: Array of encoder IDs. - `min_width`, `max_width`: Minimum and maximum supported framebuffer width. - `min_height`, `max_height`: Minimum and maximum supported framebuffer height. ### Parameters #### Path Parameters None #### Query Parameters None #### Request Body None ### Return Value - On success: A pointer to a `drmModeRes` structure. - On failure: NULL. ### Notes The returned structure must be freed using `drmModeFreeResources`. ``` -------------------------------- ### Exynos Buffer Object Management Source: https://github.com/mesa/libdrm/blob/main/exynos/exynos-symbols.txt Functions for creating, destroying, and managing Exynos Buffer Objects (BOs). This includes operations for retrieving buffer information, handling names, and mapping buffers. ```APIDOC ## Exynos Buffer Object Functions ### Description Provides functions to manage Exynos Buffer Objects (BOs), which are used for memory allocation and sharing. ### Functions - **exynos_bo_create**: Creates a new Exynos Buffer Object. - **exynos_bo_destroy**: Destroys an existing Exynos Buffer Object. - **exynos_bo_from_name**: Retrieves an Exynos Buffer Object from its name. - **exynos_bo_get_info**: Gets information about an Exynos Buffer Object. - **exynos_bo_get_name**: Gets the name of an Exynos Buffer Object. - **exynos_bo_handle**: Retrieves the handle of an Exynos Buffer Object. - **exynos_bo_map**: Maps an Exynos Buffer Object into the application's address space. ``` -------------------------------- ### Buffer Object Management Functions Source: https://github.com/mesa/libdrm/blob/main/amdgpu/amdgpu-symbols.txt Functions for allocating, managing, and exporting buffer objects. ```APIDOC ## Buffer Object Management ### Functions - `amdgpu_bo_alloc`: Allocates a buffer object. - `amdgpu_bo_cpu_map`: Maps a buffer object to CPU accessible memory. - `amdgpu_bo_cpu_unmap`: Unmaps a buffer object from CPU memory. - `amdgpu_bo_export`: Exports a buffer object for use by other processes or hardware. - `amdgpu_bo_free`: Frees a buffer object. - `amdgpu_bo_import`: Imports a buffer object from an external source. - `amdgpu_bo_inc_ref`: Increments the reference count of a buffer object. - `amdgpu_bo_list_create_raw`: Creates a raw buffer object list. - `amdgpu_bo_list_destroy_raw`: Destroys a raw buffer object list. - `amdgpu_bo_list_create`: Creates a buffer object list. - `amdgpu_bo_list_destroy`: Destroys a buffer object list. - `amdgpu_bo_list_update`: Updates a buffer object list. - `amdgpu_bo_query_info`: Queries information about a buffer object. - `amdgpu_bo_set_metadata`: Sets metadata for a buffer object. - `amdgpu_bo_va_op`: Performs a virtual address operation on a buffer object. - `amdgpu_bo_va_op_raw`: Performs a raw virtual address operation on a buffer object. - `amdgpu_bo_va_op_raw2`: Performs a raw virtual address operation on a buffer object (version 2). - `amdgpu_bo_wait_for_idle`: Waits for a buffer object to become idle. - `amdgpu_create_bo_from_user_mem`: Creates a buffer object from user-provided memory. ``` -------------------------------- ### Buffer Object Operations Source: https://github.com/mesa/libdrm/blob/main/nouveau/nouveau-symbols.txt Functions for managing buffer objects, including creation, mapping, naming, referencing, and prime handle operations. ```APIDOC ## Buffer Object Operations ### Description Functions for managing buffer objects, including creation, mapping, naming, referencing, and prime handle operations. ### Functions - **nouveau_bo_make_global**: Make a buffer object global. - **nouveau_bo_map**: Map a buffer object into the client's address space. - **nouveau_bo_name_get**: Get the name of a buffer object. - **nouveau_bo_name_ref**: Reference a buffer object by its name. - **nouveau_bo_new**: Create a new buffer object. - **nouveau_bo_prime_handle_ref**: Reference a buffer object using a prime handle. - **nouveau_bo_ref**: Reference a buffer object. - **nouveau_bo_set_prime**: Set the prime capabilities of a buffer object. - **nouveau_bo_wait**: Wait for a buffer object to become available. - **nouveau_bo_wrap**: Wrap an existing buffer object. ``` -------------------------------- ### GPU Management Functions Source: https://github.com/mesa/libdrm/blob/main/etnaviv/etnaviv-symbols.txt Functions for creating, deleting, and querying parameters of Etnaviv GPUs. ```APIDOC ## GPU Management Functions ### Description Functions for managing Etnaviv GPU resources. ### Functions - **etna_gpu_new** - **etna_gpu_del** - **etna_gpu_get_param** ``` -------------------------------- ### General Tegra DRM Functions Source: https://github.com/mesa/libdrm/blob/main/tegra/tegra-symbols.txt Core functions for initializing, closing, and managing Tegra DRM contexts. ```APIDOC ## General Tegra DRM Functions Core functions for interacting with the Tegra DRM device. ### `drm_tegra_close` Closes the connection to the Tegra DRM device. ### `drm_tegra_new` Initializes a new connection to the Tegra DRM device. ``` -------------------------------- ### Command Stream Functions Source: https://github.com/mesa/libdrm/blob/main/etnaviv/etnaviv-symbols.txt Functions for creating, deleting, flushing, and finishing command streams, including timestamping and performance monitoring. ```APIDOC ## Command Stream Functions ### Description Functions for managing and interacting with command streams. ### Functions - **etna_cmd_stream_new** - **etna_cmd_stream_del** - **etna_cmd_stream_timestamp** - **etna_cmd_stream_flush** - **etna_cmd_stream_flush2** - **etna_cmd_stream_finish** - **etna_cmd_stream_perf** - **etna_cmd_stream_reloc** ``` -------------------------------- ### Performance Monitoring Functions Source: https://github.com/mesa/libdrm/blob/main/etnaviv/etnaviv-symbols.txt Functions for creating, deleting, and querying performance monitoring data. ```APIDOC ## Performance Monitoring Functions ### Description Functions for creating, deleting, and querying performance monitoring resources. ### Functions - **etna_perfmon_create** - **etna_perfmon_del** - **etna_perfmon_get_dom_by_name** - **etna_perfmon_get_sig_by_name** ``` -------------------------------- ### Core libdrm Functions Source: https://github.com/mesa/libdrm/blob/main/core-symbols.txt This section details various core functions for buffer management, context handling, device interaction, and memory operations within the libdrm library. ```APIDOC ## Core libdrm Functions This section details various core functions for buffer management, context handling, device interaction, and memory operations within the libdrm library. ### Description Provides fundamental operations for interacting with DRM devices, including buffer allocation, context management, device information retrieval, and memory mapping. ### Functions - **drmAddBufs**: Add buffers to a drawable. - **drmAddContextPrivateMapping**: Add a private mapping for a context. - **drmAddContextTag**: Add a tag to a context. - **drmAddMap**: Add a memory mapping. - **drmAgpAcquire**: Acquire AGP resources. - **drmAgpAlloc**: Allocate AGP memory. - **drmAgpBase**: Get the AGP base address. - **drmAgpBind**: Bind AGP memory. - **drmAgpDeviceId**: Get the AGP device ID. - **drmAgpEnable**: Enable AGP. - **drmAgpFree**: Free AGP memory. - **drmAgpGetMode**: Get the AGP mode. - **drmAgpMemoryAvail**: Get available AGP memory. - **drmAgpMemoryUsed**: Get used AGP memory. - **drmAgpRelease**: Release AGP resources. - **drmAgpSize**: Get the AGP size. - **drmAgpUnbind**: Unbind AGP memory. - **drmAgpVendorId**: Get the AGP vendor ID. - **drmAgpVersionMajor**: Get the AGP major version. - **drmAgpVersionMinor**: Get the AGP minor version. - **drmAuthMagic**: Authenticate a magic number. - **drmAvailable**: Check if DRM is available. - **drmCheckModesettingSupported**: Check if modesetting is supported. - **drmClose**: Close a DRM device. - **drmCloseBufferHandle**: Close a buffer handle. - **drmCloseOnce**: Close a DRM device once. - **drmCommandNone**: No command. - **drmCommandRead**: Read from a command buffer. - **drmCommandWrite**: Write to a command buffer. - **drmCommandWriteRead**: Write and read from a command buffer. - **drmCreateContext**: Create a DRM context. - **drmCreateDrawable**: Create a DRM drawable. - **drmCrtcGetSequence**: Get CRTC sequence. - **drmCrtcQueueSequence**: Queue CRTC sequence. - **drmCtlInstHandler**: Install a control handler. - **drmCtlUninstHandler**: Uninstall a control handler. - **drmDelContextTag**: Delete a context tag. - **drmDestroyContext**: Destroy a DRM context. - **drmDestroyDrawable**: Destroy a DRM drawable. - **drmDevicesEqual**: Check if two devices are equal. - **drmDMA**: Perform a DMA operation. - **drmDropMaster**: Drop master status. - **drmError**: Get the last DRM error. - **drmFinish**: Finish DRM operations. - **drmFree**: Free DRM memory. - **drmFreeBufs**: Free buffers. - **drmFreeBusid**: Free a bus ID. - **drmFreeDevice**: Free a DRM device. - **drmFreeDevices**: Free DRM devices. - **drmFreeReservedContextList**: Free reserved context list. - **drmFreeVersion**: Free DRM version information. - **drmGetBufInfo**: Get buffer information. - **drmGetBusid**: Get the bus ID. - **drmGetCap**: Get a DRM capability. - **drmGetClient**: Get client information. - **drmGetContextFlags**: Get context flags. - **drmGetContextPrivateMapping**: Get private context mapping. - **drmGetContextTag**: Get context tag. - **drmGetDevice**: Get a DRM device. - **drmGetDevice2**: Get a DRM device (version 2). - **drmGetDeviceFromDevId**: Get a DRM device from device ID. - **drmGetDeviceNameFromFd**: Get device name from file descriptor. - **drmGetDeviceNameFromFd2**: Get device name from file descriptor (version 2). - **drmGetDevices**: Get a list of DRM devices. - **drmGetDevices2**: Get a list of DRM devices (version 2). - **drmGetEntry**: Get a DRM device entry. - **drmGetHashTable**: Get the hash table. - **drmGetInterruptFromBusID**: Get interrupt from bus ID. - **drmGetLibVersion**: Get the libdrm version. - **drmGetLock**: Get a DRM lock. - **drmGetMagic**: Get the magic number. - **drmGetMap**: Get a memory mapping. - **drmGetNodeTypeFromDevId**: Get node type from device ID. - **drmGetNodeTypeFromFd**: Get node type from file descriptor. - **drmGetPrimaryDeviceNameFromFd**: Get primary device name from file descriptor. - **drmGetRenderDeviceNameFromFd**: Get render device name from file descriptor. - **drmGetReservedContextList**: Get reserved context list. - **drmGetStats**: Get DRM statistics. - **drmGetVersion**: Get the DRM version. - **drmHandleEvent**: Handle a DRM event. - **drmHashCreate**: Create a hash table. - **drmHashDelete**: Delete an entry from the hash table. - **drmHashDestroy**: Destroy a hash table. - **drmHashFirst**: Get the first entry in the hash table. - **drmHashInsert**: Insert an entry into the hash table. - **drmHashLookup**: Look up an entry in the hash table. - **drmHashNext**: Get the next entry in the hash table. - **drmIoctl**: Perform a generic DRM ioctl. - **drmIsKMS**: Check if KMS is enabled. - **drmIsMaster**: Check if the current client is master. - **drmMalloc**: Allocate DRM memory. - **drmMap**: Map memory. - **drmMapBufs**: Map buffers. - **drmMarkBufs**: Mark buffers. - **drmMsg**: Send a DRM message. - **drmOpen**: Open a DRM device. - **drmOpenControl**: Open a DRM control device. - **drmOpenOnce**: Open a DRM device once. - **drmOpenOnceWithType**: Open a DRM device once with type. - **drmOpenRender**: Open a DRM render device. - **drmOpenWithType**: Open a DRM device with type. - **drmPrimeFDToHandle**: Convert a prime FD to a handle. - **drmPrimeHandleToFD**: Convert a handle to a prime FD. - **drmRandom**: Generate random data. - **drmRandomCreate**: Create a random number generator. - **drmRandomDestroy**: Destroy a random number generator. - **drmRandomDouble**: Generate a random double. - **drmRmMap**: Remove a memory mapping. - **drmScatterGatherAlloc**: Allocate scatter-gather memory. - **drmScatterGatherFree**: Free scatter-gather memory. - **drmSetBusid**: Set the bus ID. - **drmSetClientCap**: Set a client capability. - **drmSetContextFlags**: Set context flags. - **drmSetInterfaceVersion**: Set the interface version. - **drmSetMaster**: Set master status. - **drmSetServerInfo**: Set server information. - **drmSLCreate**: Create a sorted list. - **drmSLDelete**: Delete an entry from a sorted list. - **drmSLDestroy**: Destroy a sorted list. - **drmSLDump**: Dump a sorted list. - **drmSLFirst**: Get the first entry in a sorted list. - **drmSLInsert**: Insert an entry into a sorted list. - **drmSLLookup**: Look up an entry in a sorted list. - **drmSLLookupNeighbors**: Look up neighbors in a sorted list. - **drmSLNext**: Get the next entry in a sorted list. - **drmSwitchToContext**: Switch to a DRM context. - **drmSyncobjCreate**: Create a syncobj. - **drmSyncobjDestroy**: Destroy a syncobj. - **drmSyncobjEventfd**: Get an eventfd for a syncobj. - **drmSyncobjExportSyncFile**: Export a syncobj to a sync file. - **drmSyncobjFDToHandle**: Convert a sync file FD to a syncobj handle. - **drmSyncobjHandleToFD**: Convert a syncobj handle to a sync file FD. - **drmSyncobjImportSyncFile**: Import a sync file into a syncobj. - **drmSyncobjQuery**: Query a syncobj. - **drmSyncobjQuery2**: Query a syncobj (version 2). - **drmSyncobjReset**: Reset a syncobj. - **drmSyncobjSignal**: Signal a syncobj. - **drmSyncobjTimelineSignal**: Signal a timeline syncobj. - **drmSyncobjTimelineWait**: Wait on a timeline syncobj. - **drmSyncobjTransfer**: Transfer a syncobj. - **drmSyncobjWait**: Wait on a syncobj. - **drmUnlock**: Unlock a DRM resource. - **drmUnmap**: Unmap memory. - **drmUnmapBufs**: Unmap buffers. - **drmUpdateDrawableInfo**: Update drawable information. - **drmWaitVBlank**: Wait for a vertical blank. - **drmGetFormatModifierName**: Get the name of a format modifier. - **drmGetFormatModifierVendor**: Get the vendor of a format modifier. - **drmGetFormatName**: Get the name of a format. ``` -------------------------------- ### Push Buffer Operations Source: https://github.com/mesa/libdrm/blob/main/tegra/tegra-symbols.txt Functions for managing push buffers, which are used to send commands to the hardware. ```APIDOC ## Push Buffer Operations API for managing and interacting with push buffers. ### `drm_tegra_pushbuf_begin` Begins a new push buffer sequence. ### `drm_tegra_pushbuf_end` Ends the current push buffer sequence. ### `drm_tegra_pushbuf_relocate` Relocates data within a push buffer. ### `drm_tegra_pushbuf_sync` Synchronizes operations within a push buffer. ### `drm_tegra_pushbuf_sync_cond` Performs conditional synchronization within a push buffer. ### `drm_tegra_pushbuf_wait` Waits for push buffer operations to complete. ``` -------------------------------- ### Find Suitable CRTC for Connector Source: https://github.com/mesa/libdrm/blob/main/man/drm-kms.7.rst This C function iterates through available encoders and CRTCs to find a CRTC that can drive a given connector. It requires the DRM device file descriptor, DRM resources, and connector information. Ensure the CRTC is not already in use by another connector if managing multiple displays. ```c static int modeset_find_crtc(int fd, drmModeRes *res, drmModeConnector *conn) { drmModeEncoder *enc; unsigned int i, j; /* iterate all encoders of this connector */ for (i = 0; i < conn->count_encoders; ++i) { enc = drmModeGetEncoder(fd, conn->encoders[i]); if (!enc) { /* cannot retrieve encoder, ignoring... */ continue; } /* iterate all global CRTCs */ for (j = 0; j < res->count_crtcs; ++j) { /* check whether this CRTC works with the encoder */ if (!(enc->possible_crtcs & (1 << j))) continue; /* Here you need to check that no other connector * currently uses the CRTC with id "crtc". If you intend * to drive one connector only, then you can skip this * step. Otherwise, simply scan your list of configured * connectors and CRTCs whether this CRTC is already * used. If it is, then simply continue the search here. */ if (res->crtcs[j] "is unused") { drmModeFreeEncoder(enc); return res->crtcs[j]; } } drmModeFreeEncoder(enc); } /* cannot find a suitable CRTC */ return -ENOENT; } ``` -------------------------------- ### Buffer Object Operations Source: https://github.com/mesa/libdrm/blob/main/radeon/radeon-symbols.txt Functions for managing Radeon buffer objects (BOs), including debugging, retrieving information, mapping, referencing, and tiling. ```APIDOC ## Buffer Object Operations ### Description Provides a set of functions to interact with Radeon buffer objects (BOs). These functions allow for debugging, retrieving buffer handles and properties, managing memory mapping, and controlling buffer references. ### Functions - **radeon_bo_debug**: Debugging utility for buffer objects. - **radeon_bo_get_handle**: Retrieves the handle for a buffer object. - **radeon_bo_get_src_domain**: Gets the source domain of the buffer object. - **radeon_bo_get_tiling**: Retrieves the tiling information for the buffer object. - **radeon_bo_is_busy**: Checks if the buffer object is currently busy. - **radeon_bo_is_referenced_by_cs**: Checks if the buffer object is referenced by a command submission. - **radeon_bo_is_static**: Checks if the buffer object is static. - **radeon_bo_map**: Maps the buffer object into the CPU's address space. - **radeon_bo_open**: Opens a buffer object. - **radeon_bo_ref**: Increments the reference count of a buffer object. - **radeon_bo_set_tiling**: Sets the tiling information for the buffer object. - **radeon_bo_unmap**: Unmaps the buffer object from the CPU's address space. - **radeon_bo_unref**: Decrements the reference count of a buffer object. - **radeon_bo_wait**: Waits for the buffer object to become idle. ``` -------------------------------- ### DRM_IOCTL_MODE_CREATE_DUMB Structure Source: https://github.com/mesa/libdrm/blob/main/man/drm-memory.7.rst Defines the structure used to request the creation of a dumb buffer. Caller provides height, width, bpp, and flags; kernel returns handle, pitch, and size. ```c struct drm_mode_create_dumb { __u32 height; __u32 width; __u32 bpp; __u32 flags; __u32 handle; __u32 pitch; __u64 size; }; ``` -------------------------------- ### GEM Object OPEN Structure Source: https://github.com/mesa/libdrm/blob/main/man/drm-memory.7.rst Defines the structure used with the DRM_IOCTL_GEM_OPEN ioctl to import a GEM object by its name, retrieving a new handle and its size. ```c struct drm_gem_open { __u32 name; __u32 handle; __u32 size; }; ``` -------------------------------- ### DRM and Object Operations Source: https://github.com/mesa/libdrm/blob/main/nouveau/nouveau-symbols.txt Functions for interacting with Direct Rendering Manager (DRM) and managing objects. ```APIDOC ## DRM and Object Operations ### Description Functions for interacting with Direct Rendering Manager (DRM) and managing objects. ### Functions - **nouveau_drm_del**: Delete a DRM resource. - **nouveau_drm_new**: Create a new DRM resource. - **nouveau_getparam**: Get a parameter from the device. - **nouveau_object_del**: Delete an object. - **nouveau_object_mclass**: Get the class of an object. - **nouveau_object_mthd**: Get the method of an object. - **nouveau_object_new**: Create a new object. - **nouveau_object_sclass_get**: Get the subclass of an object. - **nouveau_object_sclass_put**: Put the subclass of an object. - **nouveau_setparam**: Set a parameter for the device. ``` -------------------------------- ### Configure Git for libdrm Patch Subject Prefix Source: https://github.com/mesa/libdrm/blob/main/CONTRIBUTING.rst Set a local Git configuration to automatically prefix libdrm patch subjects. This helps in easily identifying libdrm-related patches on the mailing list. ```bash git config --local format.subjectprefix "PATCH libdrm" ``` -------------------------------- ### drmHandleEvent Source: https://github.com/mesa/libdrm/blob/main/man/drmHandleEvent.3.rst Handles pending DRM events by reading them from the file descriptor and dispatching them to registered handlers via the drmEventContext structure. ```APIDOC ## drmHandleEvent ### Description Processes outstanding DRM events on the DRM file-descriptor passed as `fd`. This function should be called after the DRM file-descriptor has polled readable; it will read the events and use the passed-in `evctx` structure to call function pointers. ### Function Signature ```c int drmHandleEvent(int fd, drmEventContextPtr evctx); ``` ### Parameters #### Path Parameters - **fd** (int) - The DRM file descriptor. - **evctx** (drmEventContextPtr) - A pointer to a `drmEventContext` structure containing handler function pointers. ### Return Value - **0** on success, or if there is no data to read from the file-descriptor. - **-1** if the read on the file-descriptor fails or returns less than a full event record. ### Event Context Structure ```c typedef struct _drmEventContext { int version; void (*vblank_handler) (int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data); void (*page_flip_handler) (int fd, unsigned int sequence, unsigned int tv_sec, unsigned int tv_usec, void *user_data); } drmEventContext, *drmEventContextPtr; ``` ``` -------------------------------- ### Mode Setting Functions Source: https://github.com/mesa/libdrm/blob/main/core-symbols.txt This section covers functions related to DRM Mode Setting, including framebuffer management, connector, CRTC, and plane operations. ```APIDOC ## Mode Setting Functions This section covers functions related to DRM Mode Setting, including framebuffer management, connector, CRTC, and plane operations. ### Description Provides a comprehensive set of functions for managing display modes, framebuffers, connectors, CRTCs, and planes, enabling dynamic control over display output. ### Functions - **drmModeAddFB**: Add a framebuffer. - **drmModeAddFB2**: Add a framebuffer (version 2). - **drmModeAddFB2WithModifiers**: Add a framebuffer with modifiers. - **drmModeAtomicAddProperty**: Add a property to an atomic commit. - **drmModeAtomicAlloc**: Allocate an atomic commit. - **drmModeAtomicCommit**: Commit an atomic configuration. - **drmModeAtomicDuplicate**: Duplicate an atomic configuration. - **drmModeAtomicFree**: Free an atomic configuration. - **drmModeAtomicGetCursor**: Get cursor information from an atomic commit. - **drmModeAtomicMerge**: Merge atomic configurations. - **drmModeAtomicSetCursor**: Set cursor information in an atomic commit. - **drmModeAttachMode**: Attach a mode to a connector. - **drmModeCloseFB**: Close a framebuffer. - **drmModeConnectorGetPossibleCrtcs**: Get possible CRTCs for a connector. - **drmModeConnectorSetProperty**: Set a property on a connector. - **drmModeCreateDumbBuffer**: Create a dumb buffer. - **drmModeCreateLease**: Create a lease. - **drmModeCreatePropertyBlob**: Create a property blob. - **drmModeCrtcGetGamma**: Get CRTC gamma settings. - **drmModeCrtcSetGamma**: Set CRTC gamma settings. - **drmModeDestroyDumbBuffer**: Destroy a dumb buffer. - **drmModeDestroyPropertyBlob**: Destroy a property blob. - **drmModeDetachMode**: Detach a mode from a connector. - **drmModeDirtyFB**: Mark a framebuffer as dirty. - **drmModeFormatModifierBlobIterNext**: Iterate through format modifier blobs. - **drmModeFreeConnector**: Free connector information. - **drmModeFreeCrtc**: Free CRTC information. - **drmModeFreeEncoder**: Free encoder information. - **drmModeFreeFB**: Free framebuffer information. - **drmModeFreeFB2**: Free framebuffer information (version 2). - **drmModeFreeModeInfo**: Free mode information. - **drmModeFreeObjectProperties**: Free object properties. - **drmModeFreePlane**: Free plane information. - **drmModeFreePlaneResources**: Free plane resources. - **drmModeFreeProperty**: Free property information. - **drmModeFreePropertyBlob**: Free property blob. - **drmModeFreeResources**: Free resources. - **drmModeGetConnector**: Get connector information. - **drmModeGetConnectorCurrent**: Get the current connector information. - **drmModeGetConnectorTypeName**: Get the type name of a connector. - **drmModeGetCrtc**: Get CRTC information. - **drmModeGetEncoder**: Get encoder information. - **drmModeGetFB**: Get framebuffer information. - **drmModeGetFB2**: Get framebuffer information (version 2). - **drmModeGetLease**: Get lease information. - **drmModeGetPlane**: Get plane information. - **drmModeGetPlaneResources**: Get plane resources. - **drmModeGetProperty**: Get property information. - **drmModeGetPropertyBlob**: Get property blob. - **drmModeGetResources**: Get DRM resources. - **drmModeListLessees**: List lessees. - **drmModeMapDumbBuffer**: Map a dumb buffer. - **drmModeMoveCursor**: Move the cursor. - **drmModeObjectGetProperties**: Get properties of an object. - **drmModeObjectSetProperty**: Set a property on an object. - **drmModePageFlip**: Perform a page flip. - **drmModePageFlipTarget**: Perform a page flip with target. - **drmModeRevokeLease**: Revoke a lease. - **drmModeRmFB**: Remove a framebuffer. - **drmModeSetCrtc**: Set CRTC settings. - **drmModeSetCursor**: Set the cursor. - **drmModeSetCursor2**: Set the cursor (version 2). - **drmModeSetPlane**: Set plane settings. ```