... | ... | @@ -87,7 +87,7 @@ Note that only 8/16/24/32 bpp RGB formats are supported. |
|
|
## Implementing DRI driver
|
|
|
|
|
|
The header file `<minigui/exstubs.h>` defines the external sutbs and
|
|
|
the driver operators (a set of callback functions) you need to implement
|
|
|
the driver operations (a set of callback functions) you need to implement
|
|
|
for your GPU externally.
|
|
|
|
|
|
First, you need to implement the following external stub:
|
... | ... | @@ -107,42 +107,42 @@ your implementation can support multiple GPUs. |
|
|
If the external stub returns NULL, MiniGUI will use the dumb frame buffer
|
|
|
instead.
|
|
|
|
|
|
The `DriDriverOps` is a struct type consisted by a set of operators
|
|
|
The `DriDriverOps` is a struct type consisted by a set of operations
|
|
|
(callbacks):
|
|
|
|
|
|
```cpp
|
|
|
/**
|
|
|
* The struct type defines the operators for a DRI driver.
|
|
|
* The struct type defines the operations for a DRI driver.
|
|
|
*/
|
|
|
typedef struct _DriDriverOps {
|
|
|
/**
|
|
|
* This operator creates the DriDriver object.
|
|
|
* This operation creates the DriDriver object.
|
|
|
*
|
|
|
* \note The driver must implement this operator.
|
|
|
* \note The driver must implement this operation.
|
|
|
*/
|
|
|
DriDriver* (*create_driver) (int device_fd);
|
|
|
|
|
|
/**
|
|
|
* This operator destroies the DriDriver object.
|
|
|
* This operation destroies the DriDriver object.
|
|
|
*
|
|
|
* \note The driver must implement this operator.
|
|
|
* \note The driver must implement this operation.
|
|
|
*/
|
|
|
void (*destroy_driver) (DriDriver *driver);
|
|
|
|
|
|
/**
|
|
|
* This operator flushs the batch buffer of the driver or the hardware cache.
|
|
|
* This operation flushs the batch buffer of the driver or the hardware cache.
|
|
|
*
|
|
|
* \note This operator can be NULL.
|
|
|
* \note This operation can be NULL.
|
|
|
*/
|
|
|
void (* flush_driver) (DriDriver *driver);
|
|
|
|
|
|
/**
|
|
|
* This operator creates a buffer with the specified pixel format,
|
|
|
* This operation creates a buffer with the specified pixel format,
|
|
|
* width, and height. If succeed, a valid (not zero) buffer identifier
|
|
|
* and the picth (row stride in bytes) will be returned.
|
|
|
* If failed, it returns 0.
|
|
|
*
|
|
|
* \note The driver must implement this operator.
|
|
|
* \note The driver must implement this operation.
|
|
|
*/
|
|
|
uint32_t (* create_buffer) (DriDriver *driver,
|
|
|
uint32_t drm_format,
|
... | ... | @@ -155,53 +155,53 @@ typedef struct _DriDriverOps { |
|
|
unsigned int *pitch);
|
|
|
|
|
|
/**
|
|
|
* This operator maps the buffer into the current process's virtual memory
|
|
|
* This operation maps the buffer into the current process's virtual memory
|
|
|
* space, and returns the virtual address. If failed, it returns NULL.
|
|
|
*
|
|
|
* \note The driver must implement this operator.
|
|
|
* \note The driver must implement this operation.
|
|
|
*/
|
|
|
DriSurfaceBuffer* (* map_buffer) (DriDriver *driver,
|
|
|
uint32_t buffer_id);
|
|
|
|
|
|
/**
|
|
|
* This operator un-maps a buffer.
|
|
|
* This operation un-maps a buffer.
|
|
|
*
|
|
|
* \note The driver must implement this operator.
|
|
|
* \note The driver must implement this operation.
|
|
|
*/
|
|
|
void (* unmap_buffer) (DriDriver *driver, DriSurfaceBuffer* buffer);
|
|
|
|
|
|
/**
|
|
|
* This operator destroies a buffer.
|
|
|
* This operation destroies a buffer.
|
|
|
*
|
|
|
* \note The driver must implement this operator.
|
|
|
* \note The driver must implement this operation.
|
|
|
*/
|
|
|
void (* destroy_buffer) (DriDriver *driver, uint32_t buffer_id);
|
|
|
|
|
|
/**
|
|
|
* This operator clears the specific rectangle area of a buffer
|
|
|
* This operation clears the specific rectangle area of a buffer
|
|
|
* with the specific pixel value. If succeed, it returns 0.
|
|
|
*
|
|
|
* \note If this operator is set as NULL, the driver does not support
|
|
|
* \note If this operation is set as NULL, the driver does not support
|
|
|
* hardware accelerated clear operation.
|
|
|
*/
|
|
|
int (* clear_buffer) (DriDriver *driver,
|
|
|
DriSurfaceBuffer* dst_buf, const GAL_Rect* rc, uint32_t pixel_value);
|
|
|
|
|
|
/**
|
|
|
* This operator checks whether a hardware accelerated blit
|
|
|
* This operation checks whether a hardware accelerated blit
|
|
|
* can be done between the source buffer and the destination buffer.
|
|
|
* If succeed, it returns 0.
|
|
|
*
|
|
|
* \note If this operator is set as NULL, it will be supposed that
|
|
|
* \note If this operation is set as NULL, it will be supposed that
|
|
|
* the driver does not support any hardware accelerated blit operation.
|
|
|
*/
|
|
|
int (* check_blit) (DriDriver *driver,
|
|
|
DriSurfaceBuffer* src_buf, DriSurfaceBuffer* dst_buf);
|
|
|
|
|
|
/**
|
|
|
* This operator copies bits from a source buffer to a destination buffer.
|
|
|
* This operation copies bits from a source buffer to a destination buffer.
|
|
|
*
|
|
|
* \note If this operator is set as NULL, the driver does not support
|
|
|
* \note If this operation is set as NULL, the driver does not support
|
|
|
* hardware accelerated copy blit.
|
|
|
*/
|
|
|
int (* copy_blit) (DriDriver *driver,
|
... | ... | @@ -210,10 +210,10 @@ typedef struct _DriDriverOps { |
|
|
enum DriColorLogicOp logic_op);
|
|
|
|
|
|
/**
|
|
|
* This operator blits pixles from a source buffer with the source alpha value
|
|
|
* This operation blits pixles from a source buffer with the source alpha value
|
|
|
* specified to a destination buffer.
|
|
|
*
|
|
|
* \note If this operator is set as NULL, the driver does not support
|
|
|
* \note If this operation is set as NULL, the driver does not support
|
|
|
* hardware accelerated blit with alpha.
|
|
|
*/
|
|
|
int (* alpha_blit) (DriDriver *driver,
|
... | ... | @@ -221,10 +221,10 @@ typedef struct _DriDriverOps { |
|
|
DriSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc, uint8_t alpha);
|
|
|
|
|
|
/**
|
|
|
* This operator blits pixles from a source buffer to a destination buffer,
|
|
|
* This operation blits pixles from a source buffer to a destination buffer,
|
|
|
* but skipping the pixel value specified by \a color_key.
|
|
|
*
|
|
|
* \note If this operator is set as NULL, the driver does not support
|
|
|
* \note If this operation is set as NULL, the driver does not support
|
|
|
* hardware accelerated blit with color key.
|
|
|
*/
|
|
|
int (* key_blit) (DriDriver *driver,
|
... | ... | @@ -232,10 +232,10 @@ typedef struct _DriDriverOps { |
|
|
DriSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc, uint32_t color_key);
|
|
|
|
|
|
/**
|
|
|
* This operator blits pixles from a source buffer with the source alpha value
|
|
|
* This operation blits pixles from a source buffer with the source alpha value
|
|
|
* specified to a destination buffer, but skipping the pixel value specified.
|
|
|
*
|
|
|
* \note If this operator is set as NULL, the driver does not support
|
|
|
* \note If this operation is set as NULL, the driver does not support
|
|
|
* hardware accelerated blit with alpha and color key.
|
|
|
*/
|
|
|
int (* alpha_key_blit) (DriDriver *driver,
|
... | ... | @@ -247,9 +247,9 @@ typedef struct _DriDriverOps { |
|
|
```
|
|
|
|
|
|
If the external stub `__dri_ex_driver_get` returns a valid pointer
|
|
|
of `DriDriverOps`, MiniGUI will call the operator `create_driver`
|
|
|
to initialize the DRI driver. The operator will return a pointer
|
|
|
to the type of `DriDriver`. All other operators of `DriDriverOps`
|
|
|
of `DriDriverOps`, MiniGUI will call the operation `create_driver`
|
|
|
to initialize the DRI driver. The operation will return a pointer
|
|
|
to the type of `DriDriver`. All other operations of `DriDriverOps`
|
|
|
need this pointer as the context of your DRI driver.
|
|
|
|
|
|
Note that MiniGUI does not defined the detailed structure of
|
... | ... | @@ -264,7 +264,7 @@ struct _DriDriver; |
|
|
typedef struct _DriDriver DriDriver;
|
|
|
```
|
|
|
|
|
|
For other operators, please see the comments above.
|
|
|
For other operations, please see the comments above.
|
|
|
|
|
|
## Restrictions
|
|
|
|
... | ... | |