mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-26 20:45:36 +08:00
user DRM/drm instead of DRI/dri for DRM engine and APIs
This commit is contained in:
+44
-44
@@ -76,7 +76,7 @@
|
||||
extern "C" {
|
||||
#endif /* __cplusplus */
|
||||
|
||||
#ifdef _MGGAL_DRI
|
||||
#ifdef _MGGAL_DRM
|
||||
|
||||
/**
|
||||
* \defgroup external_stubs_dri External Stubs for DRI sub driver
|
||||
@@ -88,14 +88,14 @@ extern "C" {
|
||||
* The struct type represents the DRI sub driver.
|
||||
* The concrete struct should be defined by the driver.
|
||||
*/
|
||||
struct _DriDriver;
|
||||
typedef struct _DriDriver DriDriver;
|
||||
struct _DrmDriver;
|
||||
typedef struct _DrmDriver DrmDriver;
|
||||
|
||||
/**
|
||||
* The struct type represents the bufffer can be used by
|
||||
* MiniGUI NEWGAL engine for hardware surface.
|
||||
*/
|
||||
typedef struct _DriSurfaceBuffer {
|
||||
typedef struct _DrmSurfaceBuffer {
|
||||
/** The handle of the buffer */
|
||||
uint32_t handle;
|
||||
/** The buffer identifier */
|
||||
@@ -120,12 +120,12 @@ typedef struct _DriSurfaceBuffer {
|
||||
unsigned long size;
|
||||
/** The mapped address of the buffer; NULL when the buffer is not mapped yet. */
|
||||
uint8_t* pixels;
|
||||
} DriSurfaceBuffer;
|
||||
} DrmSurfaceBuffer;
|
||||
|
||||
/**
|
||||
* The color logic operations.
|
||||
*/
|
||||
enum DriColorLogicOp {
|
||||
enum DrmColorLogicOp {
|
||||
COLOR_LOGICOP_CLEAR = 0,
|
||||
COLOR_LOGICOP_NOR = 1,
|
||||
COLOR_LOGICOP_AND_INVERTED = 2,
|
||||
@@ -147,70 +147,70 @@ enum DriColorLogicOp {
|
||||
/**
|
||||
* The struct type defines the operations for a DRI driver.
|
||||
*/
|
||||
typedef struct _DriDriverOps {
|
||||
typedef struct _DrmDriverOps {
|
||||
/**
|
||||
* This operation creates the DriDriver object.
|
||||
* This operation creates the DrmDriver object.
|
||||
*
|
||||
* \note The driver must implement this operation.
|
||||
*/
|
||||
DriDriver* (*create_driver) (int device_fd);
|
||||
DrmDriver* (*create_driver) (int device_fd);
|
||||
|
||||
/**
|
||||
* This operation destroies the DriDriver object.
|
||||
* This operation destroies the DrmDriver object.
|
||||
*
|
||||
* \note The driver must implement this operation.
|
||||
*/
|
||||
void (*destroy_driver) (DriDriver *driver);
|
||||
void (*destroy_driver) (DrmDriver *driver);
|
||||
|
||||
/**
|
||||
* This operation flushs the batch buffer of the driver or the hardware cache.
|
||||
*
|
||||
* \note This operation can be NULL.
|
||||
*/
|
||||
void (* flush_driver) (DriDriver *driver);
|
||||
void (* flush_driver) (DrmDriver *driver);
|
||||
|
||||
/**
|
||||
* This operation creates a buffer with the specified pixel format,
|
||||
* width, and height. If succeed, a valid DriSurfaceBuffer object will
|
||||
* width, and height. If succeed, a valid DrmSurfaceBuffer object will
|
||||
* be returned; NULL on error. Note that the field of `pixels` of the
|
||||
* DriSurfaceBuffer object is NULL until the \a map_buffer was called.
|
||||
* DrmSurfaceBuffer object is NULL until the \a map_buffer was called.
|
||||
*
|
||||
* \note The driver must implement this operation.
|
||||
*/
|
||||
DriSurfaceBuffer* (* create_buffer) (DriDriver *driver,
|
||||
DrmSurfaceBuffer* (* create_buffer) (DrmDriver *driver,
|
||||
uint32_t drm_format,
|
||||
unsigned int width, unsigned int height);
|
||||
|
||||
/**
|
||||
* This operation creates a buffer for the given handle
|
||||
* with the specified pixel format, width, and height. If succeed,
|
||||
* a valid DriSurfaceBuffer object will be returned; NULL on error.
|
||||
* a valid DrmSurfaceBuffer object will be returned; NULL on error.
|
||||
*
|
||||
* \note This operation can be NULL.
|
||||
*/
|
||||
DriSurfaceBuffer* (* create_buffer_from_handle) (DriDriver *driver,
|
||||
DrmSurfaceBuffer* (* create_buffer_from_handle) (DrmDriver *driver,
|
||||
uint32_t handle, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, unsigned int pitch);
|
||||
|
||||
/**
|
||||
* This operation creates a buffer for the given system global name
|
||||
* with the specified pixel format, width, and height. If succeed,
|
||||
* a valid DriSurfaceBuffer object will be returned; NULL on error.
|
||||
* a valid DrmSurfaceBuffer object will be returned; NULL on error.
|
||||
*
|
||||
* \note This operation can be NULL.
|
||||
*/
|
||||
DriSurfaceBuffer* (* create_buffer_from_name) (DriDriver *driver,
|
||||
DrmSurfaceBuffer* (* create_buffer_from_name) (DrmDriver *driver,
|
||||
uint32_t name, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, unsigned int pitch);
|
||||
|
||||
/**
|
||||
* This operation creates a buffer for the given PRIME file descriptor
|
||||
* with the specified pixel format, width, height, and pitch. If succeed,
|
||||
* a valid DriSurfaceBuffer object will be returned; NULL on error.
|
||||
* a valid DrmSurfaceBuffer object will be returned; NULL on error.
|
||||
*
|
||||
* \note This operation can be NULL.
|
||||
*/
|
||||
DriSurfaceBuffer* (* create_buffer_from_prime_fd) (DriDriver *driver,
|
||||
DrmSurfaceBuffer* (* create_buffer_from_prime_fd) (DrmDriver *driver,
|
||||
int prime_fd, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, unsigned int pitch);
|
||||
|
||||
@@ -220,21 +220,21 @@ typedef struct _DriDriverOps {
|
||||
*
|
||||
* \note The driver must implement this operation.
|
||||
*/
|
||||
uint8_t* (* map_buffer) (DriDriver *driver, DriSurfaceBuffer* buffer);
|
||||
uint8_t* (* map_buffer) (DrmDriver *driver, DrmSurfaceBuffer* buffer);
|
||||
|
||||
/**
|
||||
* This operation un-maps a buffer.
|
||||
*
|
||||
* \note The driver must implement this operation.
|
||||
*/
|
||||
void (* unmap_buffer) (DriDriver *driver, DriSurfaceBuffer* buffer);
|
||||
void (* unmap_buffer) (DrmDriver *driver, DrmSurfaceBuffer* buffer);
|
||||
|
||||
/**
|
||||
* This operation destroies a buffer.
|
||||
*
|
||||
* \note The driver must implement this operation.
|
||||
*/
|
||||
void (* destroy_buffer) (DriDriver *driver, DriSurfaceBuffer* buffer);
|
||||
void (* destroy_buffer) (DrmDriver *driver, DrmSurfaceBuffer* buffer);
|
||||
|
||||
/**
|
||||
* This operation clears the specific rectangle area of a buffer
|
||||
@@ -243,8 +243,8 @@ typedef struct _DriDriverOps {
|
||||
* \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);
|
||||
int (* clear_buffer) (DrmDriver *driver,
|
||||
DrmSurfaceBuffer* dst_buf, const GAL_Rect* rc, uint32_t pixel_value);
|
||||
|
||||
/**
|
||||
* This operation checks whether a hardware accelerated blit
|
||||
@@ -254,8 +254,8 @@ typedef struct _DriDriverOps {
|
||||
* \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);
|
||||
int (* check_blit) (DrmDriver *driver,
|
||||
DrmSurfaceBuffer* src_buf, DrmSurfaceBuffer* dst_buf);
|
||||
|
||||
/**
|
||||
* This operation copies bits from a source buffer to a destination buffer.
|
||||
@@ -263,10 +263,10 @@ typedef struct _DriDriverOps {
|
||||
* \note If this operation is set as NULL, the driver does not support
|
||||
* hardware accelerated copy blit.
|
||||
*/
|
||||
int (* copy_blit) (DriDriver *driver,
|
||||
DriSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DriSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc,
|
||||
enum DriColorLogicOp logic_op);
|
||||
int (* copy_blit) (DrmDriver *driver,
|
||||
DrmSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DrmSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc,
|
||||
enum DrmColorLogicOp logic_op);
|
||||
|
||||
/**
|
||||
* This operation blits pixles from a source buffer with the source alpha value
|
||||
@@ -275,9 +275,9 @@ typedef struct _DriDriverOps {
|
||||
* \note If this operation is set as NULL, the driver does not support
|
||||
* hardware accelerated blit with alpha.
|
||||
*/
|
||||
int (* alpha_blit) (DriDriver *driver,
|
||||
DriSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DriSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc, uint8_t alpha);
|
||||
int (* alpha_blit) (DrmDriver *driver,
|
||||
DrmSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DrmSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc, uint8_t alpha);
|
||||
|
||||
/**
|
||||
* This operation blits pixles from a source buffer to a destination buffer,
|
||||
@@ -286,9 +286,9 @@ typedef struct _DriDriverOps {
|
||||
* \note If this operation is set as NULL, the driver does not support
|
||||
* hardware accelerated blit with color key.
|
||||
*/
|
||||
int (* key_blit) (DriDriver *driver,
|
||||
DriSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DriSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc, uint32_t color_key);
|
||||
int (* key_blit) (DrmDriver *driver,
|
||||
DrmSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DrmSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc, uint32_t color_key);
|
||||
|
||||
/**
|
||||
* This operation blits pixles from a source buffer with the source alpha value
|
||||
@@ -297,19 +297,19 @@ typedef struct _DriDriverOps {
|
||||
* \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,
|
||||
DriSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DriSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc,
|
||||
int (* alpha_key_blit) (DrmDriver *driver,
|
||||
DrmSurfaceBuffer* src_buf, const GAL_Rect* src_rc,
|
||||
DrmSurfaceBuffer* dst_buf, const GAL_Rect* dst_rc,
|
||||
uint8_t alpha, uint32_t color_key);
|
||||
|
||||
} DriDriverOps;
|
||||
} DrmDriverOps;
|
||||
|
||||
/** Implement this stub to return the DRI driver operations */
|
||||
DriDriverOps* __dri_ex_driver_get (const char* driver_name, int device_fd);
|
||||
DrmDriverOps* __dri_ex_driver_get (const char* driver_name, int device_fd);
|
||||
|
||||
/** @} end of external_stubs_dri */
|
||||
|
||||
#endif /* _MGGAL_DRI */
|
||||
#endif /* _MGGAL_DRM */
|
||||
|
||||
#ifdef _MGGAL_COMMLCD
|
||||
|
||||
|
||||
+37
-37
@@ -13700,19 +13700,19 @@ MG_EXPORT int GUIAPI SetUserCompositionOps (HDC hdc,
|
||||
*/
|
||||
MG_EXPORT GHANDLE GetVideoHandle (HDC hdc);
|
||||
|
||||
#ifdef _MGGAL_DRI
|
||||
#ifdef _MGGAL_DRM
|
||||
|
||||
/**
|
||||
* \defgroup gdi_dri_fns Functions for Linux DRI integration
|
||||
* \defgroup gdi_drm_fns Functions for Linux DRM integration
|
||||
*
|
||||
* These functions can be used to get the DRI device file descriptor and the
|
||||
* These functions can be used to get the DRM device file descriptor and the
|
||||
* information of the hardware surface corresponding to the DC which is
|
||||
* created by the Linux DRI engine. By using the information, we can
|
||||
* created by the Linux DRM engine. By using the information, we can
|
||||
* integrate MiniGUI with other graphics libraries, such as Cairo
|
||||
* (vector graphics) and Mesa (3D graphics).
|
||||
*
|
||||
* \note Only available when support for Linuxe DRI NEWGAL engine
|
||||
* (`_MGGAL_DRI`) is enabled.
|
||||
* \note Only available when support for Linuxe DRM NEWGAL engine
|
||||
* (`_MGGAL_DRM`) is enabled.
|
||||
*
|
||||
* Since 4.0.4
|
||||
*
|
||||
@@ -13720,20 +13720,20 @@ MG_EXPORT GHANDLE GetVideoHandle (HDC hdc);
|
||||
*/
|
||||
|
||||
/**
|
||||
* This function gets the file descriptor opened by the Linux DRI engine.
|
||||
* This function gets the file descriptor opened by the Linux DRM engine.
|
||||
*
|
||||
* \param video The video handle returned by \a GetVideoHandle.
|
||||
*
|
||||
* \return The DRI device file descriptor opened by the Linux DRI engine;
|
||||
* \return The DRM device file descriptor opened by the Linux DRM engine;
|
||||
* >= 0 for success and < 0 on error. If \a surface is not a hardware
|
||||
* surface created by the DRI engine, this function returns -1.
|
||||
* surface created by the DRM engine, this function returns -1.
|
||||
*/
|
||||
MG_EXPORT int driGetDeviceFD (GHANDLE video);
|
||||
MG_EXPORT int drmGetDeviceFD (GHANDLE video);
|
||||
|
||||
/**
|
||||
* THe struct type defines the DRI surface information.
|
||||
* THe struct type defines the DRM surface information.
|
||||
*/
|
||||
typedef struct _DriSurfaceInfo {
|
||||
typedef struct _DrmSurfaceInfo {
|
||||
/** The local handle of the buffer object. */
|
||||
uint32_t handle;
|
||||
/** The buffer identifier. */
|
||||
@@ -13748,75 +13748,75 @@ typedef struct _DriSurfaceInfo {
|
||||
uint32_t drm_format;
|
||||
/** Size in bytes of the buffer object. */
|
||||
unsigned long size;
|
||||
} DriSurfaceInfo;
|
||||
} DrmSurfaceInfo;
|
||||
|
||||
/**
|
||||
* This function gets the DRI surface information from the handle of the surface.
|
||||
* This function gets the DRM surface information from the handle of the surface.
|
||||
*
|
||||
* \param surface The handle to the surface.
|
||||
* \param info The pointer to a DriSurfaceInfo structure to hold
|
||||
* \param info The pointer to a DrmSurfaceInfo structure to hold
|
||||
* the surface information.
|
||||
*
|
||||
* \return TRUE for success, FALSE for failure.
|
||||
*/
|
||||
MG_EXPORT BOOL driGetSurfaceInfo (GHANDLE video, HDC hdc, DriSurfaceInfo* info);
|
||||
MG_EXPORT BOOL drmGetSurfaceInfo (GHANDLE video, HDC hdc, DrmSurfaceInfo* info);
|
||||
|
||||
/**
|
||||
* This function creates a memory DC with a DRI surface which is created by
|
||||
* This function creates a memory DC with a DRM surface which is created by
|
||||
* a foreign process and identified by a global name handle.
|
||||
*
|
||||
* \param video The video handle.
|
||||
* \param name The name handle of the DRI surface.
|
||||
* \param name The name handle of the DRM surface.
|
||||
* \param drm_format The DRM pixel format.
|
||||
* \param width The width of the DRI surface.
|
||||
* \param height The height of the DRI surface.
|
||||
* \param pitch The pitch (row stride) of the DRI surface.
|
||||
* \param width The width of the DRM surface.
|
||||
* \param height The height of the DRM surface.
|
||||
* \param pitch The pitch (row stride) of the DRM surface.
|
||||
*
|
||||
* \return The handle to the memory DC for success, HDC_INVALID for failure.
|
||||
*/
|
||||
MG_EXPORT HDC driCreateDCFromName (GHANDLE video,
|
||||
MG_EXPORT HDC drmCreateDCFromName (GHANDLE video,
|
||||
uint32_t name, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
|
||||
/**
|
||||
* This function creates a memory DC with a DRI surface which is created by
|
||||
* This function creates a memory DC with a DRM surface which is created by
|
||||
* a foreign process and identified by a PRIME file descriptor.
|
||||
*
|
||||
* \param video The video handle.
|
||||
* \param prime_fd The PRIME file descriptor.
|
||||
* \param size The size of the DRI surface in bytes.
|
||||
* \param size The size of the DRM surface in bytes.
|
||||
* \param drm_format The DRM pixel format.
|
||||
* \param width The width of the DRI surface.
|
||||
* \param height The height of the DRI surface.
|
||||
* \param pitch The pitch (row stride) of the DRI surface.
|
||||
* \param width The width of the DRM surface.
|
||||
* \param height The height of the DRM surface.
|
||||
* \param pitch The pitch (row stride) of the DRM surface.
|
||||
*
|
||||
* \return The handle to the memory DC for success, HDC_INVALID for failure.
|
||||
*/
|
||||
MG_EXPORT HDC driCreateDCFromPrimeFd (GHANDLE video,
|
||||
MG_EXPORT HDC drmCreateDCFromPrimeFd (GHANDLE video,
|
||||
int prime_fd, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
|
||||
/**
|
||||
* This function creates a memory DC with a DRI surface which is created by
|
||||
* This function creates a memory DC with a DRM surface which is created by
|
||||
* a foreign graphics component.
|
||||
*
|
||||
* \param video The video handle.
|
||||
* \param handle The handle of the DRI surface.
|
||||
* \param size The size of the DRI surface in bytes.
|
||||
* \param handle The handle of the DRM surface.
|
||||
* \param size The size of the DRM surface in bytes.
|
||||
* \param drm_format The DRM pixel format.
|
||||
* \param width The width of the DRI surface.
|
||||
* \param height The height of the DRI surface.
|
||||
* \param pitch The pitch (row stride) of the DRI surface.
|
||||
* \param width The width of the DRM surface.
|
||||
* \param height The height of the DRM surface.
|
||||
* \param pitch The pitch (row stride) of the DRM surface.
|
||||
*
|
||||
* \return The handle to the memory DC for success, HDC_INVALID for failure.
|
||||
*/
|
||||
MG_EXPORT HDC driCreateDCFromHandle (GHANDLE video,
|
||||
MG_EXPORT HDC drmCreateDCFromHandle (GHANDLE video,
|
||||
uint32_t handle, unsigned long size, uint32_t drm_format,
|
||||
unsigned int width, unsigned int height, uint32_t pitch);
|
||||
|
||||
/** @} end of gdi_dri_fns */
|
||||
/** @} end of gdi_drm_fns */
|
||||
|
||||
#endif /* _MGGAL_DRI */
|
||||
#endif /* _MGGAL_DRM */
|
||||
|
||||
/** @} end of gdi_fns */
|
||||
|
||||
|
||||
Reference in New Issue
Block a user