Skip to content

Commit

Permalink
Update API doc
Browse files Browse the repository at this point in the history
  • Loading branch information
ehopperdietzel committed Jul 7, 2024
1 parent 3e174f1 commit 45604ac
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 30 deletions.
6 changes: 3 additions & 3 deletions src/lib/SRMConnector.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ SRMDevice *srmConnectorGetDevice(SRMConnector *connector);
* This function returns the device responsible for rendering operations for the connector.
*
* When the **ITSELF** rendering mode is used, this device is the same as the one obtained with srmConnectorGetDevice().
* However, in the **DUMB** or **CPU** modes, it differs.
* However, in the **PRIME**, **DUMB** or **CPU** modes, it differs.
*
* @param connector Pointer to the @ref SRMConnector for which you want to obtain the renderer device.
* @return Pointer to the @ref SRMDevice responsible for rendering operations for the connector.
Expand Down Expand Up @@ -513,9 +513,9 @@ UInt32 srmConnectorGetCurrentBufferIndex(SRMConnector *connector);
* @brief Returns the number of framebuffers.
*
* This function returns the number of framebuffers available for the given @ref SRMConnector.
* The count may be 1, 2, or 3, depending on the configuration (e.g., single, double or triple buffering).
* The count may be 2 or 3, depending on the configuration (double or triple buffering).
*
* The number of framebuffers can be modified by setting the **SRM_RENDER_MODE_{ITSELF, DUMB, CPU}_FB_COUNT** environment variables.
* The number of framebuffers can be modified by setting the **SRM_RENDER_MODE_{ITSELF, PRIME, DUMB, CPU}_FB_COUNT** environment variables.
*
* @param connector Pointer to the @ref SRMConnector to query for the number of framebuffers.
* @return The number of framebuffers.
Expand Down
23 changes: 1 addition & 22 deletions src/lib/SRMCore.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,9 @@ extern "C" {
*
* @warning You must create a single @ref SRMCore instance per process, creating more than one could lead to undefined behavior.
*
* ### Automatic Configuration
*
* Here are the steps in which SRM internally finds the best configuration:
*
* @li Obtains the resources and capabilities of each GPU.
* @li Determines which GPU will be used as an allocator, giving priority to allowing as many GPUs as possible to access textures through DMA.
* @li Identifies which GPUs are capable of rendering (the ones that can import textures from the allocator GPU).
* @li If a GPU cannot import textures from the allocator, another GPU is assigned to render for it.
* @li In that case, to display the rendered buffer from the renderer GPU on the connector of the non renderer GPU, SRM prioritizes the use of DUMB BUFFERS and, as a last resort, CPU copying (all this is handled internally by SRM).
* @li When initiating a connector, SRM searches for the best possible combination of ENCODER, CRTC, and PRIMARY PLANE.
* @li SRM also looks for a CURSOR PLANE, which, if available, can assign its pixels and position using the srmConnectorSetCursor() and srmConnectorSetCursorPos() functions.
* @li If no CURSOR PLANE is found because they are all being used by other connectors, the CURSOR PLANE will be automatically added to the connector that needs it once one of those connectors is uninitialized.
*
* ### Connectors Render Modes
*
* These are the possible connectors rendering modes form best to worst case:
*
* @li **ITSELF** : The connector's GPU can directly render into it.
* @li **DUMB** : The connector' GPU creates dumb buffers and DMA map or `glReadPixels()` is used to copy the buffers rendered by another GPU.
* @li **CPU** : Renderer GPU > CPU (DMA map or glReadPixels) > connector GPU (`glTexImage2D()`) > render.
*
* ### Framebuffer damage
*
* **DUMB** and **CPU** modes can greatly benefit from receiving information about the changes occurring in the buffer within a frame, commonly known as "damage." By providing this damage information, we can optimize the performance of these modes.
* **PRIME**, **DUMB** and **CPU** modes can greatly benefit from receiving information about the changes occurring in the buffer within a frame, commonly known as "damage." By providing this damage information, we can optimize the performance of these modes.
* To define the generated damage, after rendering within a `paintGL()` event, you can add an array of rectangles (@ref SRMRect) with the damage area using the srmConnectorSetBufferDamage() function.
* It is important to ensure that the coordinates of these rectangles originate from the top-left corner of the framebuffer and do not extend beyond its boundaries to avoid segmentation errors.
* The **ITSELF** mode does not benefit from buffer damages, and therefore, calling the function in that case is a no-op. To determine if a connector supports buffer damages, use the srmConnectorHasBufferDamageSupport() function.
Expand Down
8 changes: 3 additions & 5 deletions src/lib/SRMDevice.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ extern "C" {
* @brief Representation of an open DRM device, typically a GPU.
*
* An @ref SRMDevice represents a DRM device, typically a GPU, which can contain multiple connectors
* and a specific rendering mode (**ITSELF**, **DUMB** or **CPU**).
* and a specific rendering mode (**ITSELF**, **PRIME**, **DUMB** or **CPU**).
*
* @{
*/
Expand Down Expand Up @@ -179,8 +179,7 @@ UInt8 srmDeviceIsRenderer(SRMDevice *device);
/**
* @brief Get the device that performs rendering for this device.
*
* If the rendering device is equal to this device, then this device's rendering mode is **ITSELF**.
* Otherwise, this device's rendering mode could be **DUMB** or **CPU**, depending on whether it can create DUMB buffers.
* The rendering device is equal to this device only when the **ITSELF** rendering mode is used.
*
* @param device A pointer to the @ref SRMDevice instance.
*
Expand All @@ -191,8 +190,7 @@ SRMDevice *srmDeviceGetRendererDevice(SRMDevice *device);
/**
* @brief Get the rendering mode of the device.
*
* If the rendering device is equal to this device, then this device's rendering mode is **ITSELF**.
* Otherwise, this device's rendering mode could be **DUMB** or **CPU**, depending on whether it can create DUMB buffers.
* If the rendering device is equal to this device, then the rendering mode is **ITSELF**.
*
* @param device A pointer to the @ref SRMDevice instance.
*
Expand Down

0 comments on commit 45604ac

Please sign in to comment.