Multiple controller support can now auto-detect hardware capabilities at run-time.
Specific hardware support can still be turned off or on via macros in gfxconf.h to improve efficiency. Multiple Display demo updated to match.
This commit is contained in:
parent
3b8c572552
commit
86a5734912
@ -52,24 +52,37 @@
|
||||
#define GDISP_NEED_ASYNC FALSE
|
||||
#define GDISP_NEED_MSGAPI FALSE
|
||||
|
||||
#define GDISP_INCLUDE_FONT_UI2 TRUE
|
||||
#define GDISP_INCLUDE_FONT_UI2 TRUE
|
||||
|
||||
#define GDISP_TOTAL_DISPLAYS 2
|
||||
#define GDISP_TOTAL_DISPLAYS 2
|
||||
|
||||
/* Uncomment the following lines and alter the definitions to match your
|
||||
* hardware if you want to try multiple displays on different controllers.
|
||||
/* Uncomment the following lines if you want to use multiple displays on
|
||||
* different controllers.
|
||||
*
|
||||
* Change the definitions to suit your hardware.
|
||||
* Currently all controllers must use the same pixel format.
|
||||
*
|
||||
* Remember that GDISP_TOTAL_DISPLAYS above must match the **Total**
|
||||
* number of displays in your system across all controllers.
|
||||
*
|
||||
* Optionally, you can also specify hardware characteristics that are common to
|
||||
* all your controllers. This significantly improves code and speed efficiency
|
||||
* as the program doesn't have to detect the hardware method to use on each call.
|
||||
*
|
||||
* Hardware definitions can be set to:
|
||||
* - TRUE - all controllers support this routine
|
||||
* - FALSE - no controllers support this routine
|
||||
* - if not specified then the code auto-detects the hardware.
|
||||
*
|
||||
* e.g
|
||||
* #define GDISP_HARDWARE_STREAM_WRITE FALSE
|
||||
* #define GDISP_HARDWARE_STREAM_READ FALSE
|
||||
* #define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
* #define GDISP_HARDWARE_FILLS TRUE
|
||||
*/
|
||||
//#define GDISP_TOTAL_CONTROLLERS 2
|
||||
//#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32
|
||||
//#define GDISP_CONTROLLER_DISPLAYS 1, 1
|
||||
//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
|
||||
//#define GDISP_HARDWARE_DRAWPIXEL TRUE
|
||||
//#define GDISP_HARDWARE_FILLS TRUE
|
||||
//#define GDISP_HARDWARE_PIXELREAD TRUE
|
||||
//#define GDISP_HARDWARE_CONTROL TRUE
|
||||
//#define GDISP_HARDWARE_BITFILLS TRUE
|
||||
//#define GDISP_HARDWARE_SCROLL TRUE
|
||||
//#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32
|
||||
//#define GDISP_CONTROLLER_DISPLAYS 1, 1
|
||||
//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888
|
||||
|
||||
#endif /* _GFXCONF_H */
|
||||
|
@ -14,6 +14,7 @@
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_Win32
|
||||
#include "../drivers/multiple/Win32/gdisp_lld_config.h"
|
||||
#include "gdisp/lld/gdisp_lld.h"
|
||||
|
||||
#include <stdio.h>
|
||||
|
@ -15,6 +15,7 @@
|
||||
#if GFX_USE_GDISP
|
||||
|
||||
#define GDISP_DRIVER_VMT GDISPVMT_X11
|
||||
#include "../drivers/multiple/X/gdisp_lld_config.h"
|
||||
#include "gdisp/lld/gdisp_lld.h"
|
||||
|
||||
/**
|
||||
|
@ -22,107 +22,140 @@
|
||||
/* Error checks. */
|
||||
/*===========================================================================*/
|
||||
|
||||
#if GDISP_TOTAL_CONTROLLERS > 1 && !defined(GDISP_DRIVER_VMT)
|
||||
#define HARDWARE_AUTODETECT 2
|
||||
#define HARDWARE_DEFAULT HARDWARE_AUTODETECT
|
||||
#else
|
||||
#define HARDWARE_AUTODETECT 2
|
||||
#define HARDWARE_DEFAULT FALSE
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name GDISP hardware accelerated support
|
||||
* @{
|
||||
*/
|
||||
/**
|
||||
* @brief Hardware streaming writing is supported.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
* @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
* @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by each driver
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_STREAM_WRITE
|
||||
#define GDISP_HARDWARE_STREAM_WRITE FALSE
|
||||
#define GDISP_HARDWARE_STREAM_WRITE HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware streaming reading of the display surface is supported.
|
||||
* @details If set to @p FALSE this routine is not available.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_STREAM_READ
|
||||
#define GDISP_HARDWARE_STREAM_READ FALSE
|
||||
#define GDISP_HARDWARE_STREAM_READ HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware supports setting the cursor position within the stream window.
|
||||
* @details If set to @p FALSE this routine is not available.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
* @note This is used to optimise setting of individual pixels within a stream window.
|
||||
* It should therefore not be implemented unless it is cheaper than just setting
|
||||
* a new window.
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_STREAM_POS
|
||||
#define GDISP_HARDWARE_STREAM_POS FALSE
|
||||
#define GDISP_HARDWARE_STREAM_POS HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated draw pixel.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
* @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_DRAWPIXEL
|
||||
#define GDISP_HARDWARE_DRAWPIXEL FALSE
|
||||
#define GDISP_HARDWARE_DRAWPIXEL HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated screen clears.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
* @note This clears the entire display surface regardless of the clipping area currently set
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_CLEARS
|
||||
#define GDISP_HARDWARE_CLEARS FALSE
|
||||
#define GDISP_HARDWARE_CLEARS HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated rectangular fills.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_FILLS
|
||||
#define GDISP_HARDWARE_FILLS FALSE
|
||||
#define GDISP_HARDWARE_FILLS HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated fills from an image.
|
||||
* @details If set to @p FALSE software emulation is used.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_BITFILLS
|
||||
#define GDISP_HARDWARE_BITFILLS FALSE
|
||||
#define GDISP_HARDWARE_BITFILLS HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Hardware accelerated scrolling.
|
||||
* @details If set to @p FALSE there is no support for scrolling.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_SCROLL
|
||||
#define GDISP_HARDWARE_SCROLL FALSE
|
||||
#define GDISP_HARDWARE_SCROLL HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief Reading back of pixel values.
|
||||
* @details If set to @p FALSE there is no support for pixel read-back.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_PIXELREAD
|
||||
#define GDISP_HARDWARE_PIXELREAD FALSE
|
||||
#define GDISP_HARDWARE_PIXELREAD HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The driver supports one or more control commands.
|
||||
* @details If set to @p FALSE there is no support for control commands.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_CONTROL
|
||||
#define GDISP_HARDWARE_CONTROL FALSE
|
||||
#define GDISP_HARDWARE_CONTROL HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The driver supports a non-standard query.
|
||||
* @details If set to @p FALSE there is no support for non-standard queries.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_QUERY
|
||||
#define GDISP_HARDWARE_QUERY FALSE
|
||||
#define GDISP_HARDWARE_QUERY HARDWARE_DEFAULT
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @brief The driver supports a clipping in hardware.
|
||||
* @details If set to @p FALSE there is no support for non-standard queries.
|
||||
* @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
|
||||
*
|
||||
* @note HARDWARE_AUTODETECT is only meaningful when GDISP_TOTAL_CONTROLLERS > 1
|
||||
* @note If this is defined the driver must perform its own clipping on all calls to
|
||||
* the driver and respond appropriately if a parameter is outside the display area.
|
||||
* @note If this is not defined then the software ensures that all calls to the
|
||||
@ -130,7 +163,7 @@
|
||||
* has been set).
|
||||
*/
|
||||
#ifndef GDISP_HARDWARE_CLIP
|
||||
#define GDISP_HARDWARE_CLIP FALSE
|
||||
#define GDISP_HARDWARE_CLIP HARDWARE_DEFAULT
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
@ -159,7 +192,7 @@ typedef struct GDisplay {
|
||||
#endif
|
||||
|
||||
// Software clipping
|
||||
#if !GDISP_HARDWARE_CLIP && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)
|
||||
#if GDISP_HARDWARE_CLIP != TRUE && (GDISP_NEED_CLIP || GDISP_NEED_VALIDATION)
|
||||
coord_t clipx0, clipy0;
|
||||
coord_t clipx1, clipy1; /* not inclusive */
|
||||
#endif
|
||||
@ -464,6 +497,9 @@ typedef struct GDisplay {
|
||||
} GDISPVMT;
|
||||
|
||||
#if defined(GDISP_DRIVER_VMT)
|
||||
#if !GDISP_HARDWARE_STREAM_WRITE && !GDISP_HARDWARE_DRAWPIXEL
|
||||
#error "GDISP Driver: Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be TRUE"
|
||||
#endif
|
||||
const GDISPVMT const GDISP_DRIVER_VMT[1] = {{
|
||||
gdisp_lld_init,
|
||||
#if GDISP_HARDWARE_STREAM_WRITE
|
||||
|
1412
src/gdisp/gdisp.c
1412
src/gdisp/gdisp.c
File diff suppressed because it is too large
Load Diff
Loading…
Reference in New Issue
Block a user