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.
ugfx_release_2.6
inmarket 2013-10-16 01:39:56 +10:00
parent 3b8c572552
commit 86a5734912
5 changed files with 988 additions and 553 deletions

View File

@ -52,24 +52,37 @@
#define GDISP_NEED_ASYNC FALSE #define GDISP_NEED_ASYNC FALSE
#define GDISP_NEED_MSGAPI 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 /* Uncomment the following lines if you want to use multiple displays on
* hardware if you want to try multiple displays on different controllers. * 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** * Remember that GDISP_TOTAL_DISPLAYS above must match the **Total**
* number of displays in your system across all controllers. * 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_TOTAL_CONTROLLERS 2
//#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32 //#define GDISP_CONTROLLER_LIST GDISPVMT_Win32, GDISPVMT_Win32
//#define GDISP_CONTROLLER_DISPLAYS 1, 1 //#define GDISP_CONTROLLER_DISPLAYS 1, 1
//#define GDISP_PIXELFORMAT GDISP_PIXELFORMAT_RGB888 //#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
#endif /* _GFXCONF_H */ #endif /* _GFXCONF_H */

View File

@ -14,6 +14,7 @@
#if GFX_USE_GDISP #if GFX_USE_GDISP
#define GDISP_DRIVER_VMT GDISPVMT_Win32 #define GDISP_DRIVER_VMT GDISPVMT_Win32
#include "../drivers/multiple/Win32/gdisp_lld_config.h"
#include "gdisp/lld/gdisp_lld.h" #include "gdisp/lld/gdisp_lld.h"
#include <stdio.h> #include <stdio.h>

View File

@ -15,6 +15,7 @@
#if GFX_USE_GDISP #if GFX_USE_GDISP
#define GDISP_DRIVER_VMT GDISPVMT_X11 #define GDISP_DRIVER_VMT GDISPVMT_X11
#include "../drivers/multiple/X/gdisp_lld_config.h"
#include "gdisp/lld/gdisp_lld.h" #include "gdisp/lld/gdisp_lld.h"
/** /**

View File

@ -22,107 +22,140 @@
/* Error checks. */ /* 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 * @name GDISP hardware accelerated support
* @{ * @{
*/ */
/** /**
* @brief Hardware streaming writing is supported. * @brief Hardware streaming writing is supported.
* @details If set to @p FALSE software emulation is used. * @details Can be set to TRUE, FALSE or HARDWARE_AUTODETECT
* @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver *
* @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 #ifndef GDISP_HARDWARE_STREAM_WRITE
#define GDISP_HARDWARE_STREAM_WRITE FALSE #define GDISP_HARDWARE_STREAM_WRITE HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware streaming reading of the display surface is supported. * @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 #ifndef GDISP_HARDWARE_STREAM_READ
#define GDISP_HARDWARE_STREAM_READ FALSE #define GDISP_HARDWARE_STREAM_READ HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware supports setting the cursor position within the stream window. * @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. * @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 * It should therefore not be implemented unless it is cheaper than just setting
* a new window. * a new window.
*/ */
#ifndef GDISP_HARDWARE_STREAM_POS #ifndef GDISP_HARDWARE_STREAM_POS
#define GDISP_HARDWARE_STREAM_POS FALSE #define GDISP_HARDWARE_STREAM_POS HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware accelerated draw pixel. * @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 * @note Either GDISP_HARDWARE_STREAM_WRITE or GDISP_HARDWARE_DRAWPIXEL must be provided by the driver
*/ */
#ifndef GDISP_HARDWARE_DRAWPIXEL #ifndef GDISP_HARDWARE_DRAWPIXEL
#define GDISP_HARDWARE_DRAWPIXEL FALSE #define GDISP_HARDWARE_DRAWPIXEL HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware accelerated screen clears. * @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 * @note This clears the entire display surface regardless of the clipping area currently set
*/ */
#ifndef GDISP_HARDWARE_CLEARS #ifndef GDISP_HARDWARE_CLEARS
#define GDISP_HARDWARE_CLEARS FALSE #define GDISP_HARDWARE_CLEARS HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware accelerated rectangular fills. * @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 #ifndef GDISP_HARDWARE_FILLS
#define GDISP_HARDWARE_FILLS FALSE #define GDISP_HARDWARE_FILLS HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware accelerated fills from an image. * @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 #ifndef GDISP_HARDWARE_BITFILLS
#define GDISP_HARDWARE_BITFILLS FALSE #define GDISP_HARDWARE_BITFILLS HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Hardware accelerated scrolling. * @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 #ifndef GDISP_HARDWARE_SCROLL
#define GDISP_HARDWARE_SCROLL FALSE #define GDISP_HARDWARE_SCROLL HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief Reading back of pixel values. * @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 #ifndef GDISP_HARDWARE_PIXELREAD
#define GDISP_HARDWARE_PIXELREAD FALSE #define GDISP_HARDWARE_PIXELREAD HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief The driver supports one or more control commands. * @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 #ifndef GDISP_HARDWARE_CONTROL
#define GDISP_HARDWARE_CONTROL FALSE #define GDISP_HARDWARE_CONTROL HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief The driver supports a non-standard query. * @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 #ifndef GDISP_HARDWARE_QUERY
#define GDISP_HARDWARE_QUERY FALSE #define GDISP_HARDWARE_QUERY HARDWARE_DEFAULT
#endif #endif
/** /**
* @brief The driver supports a clipping in hardware. * @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 * @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. * 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 * @note If this is not defined then the software ensures that all calls to the
@ -130,7 +163,7 @@
* has been set). * has been set).
*/ */
#ifndef GDISP_HARDWARE_CLIP #ifndef GDISP_HARDWARE_CLIP
#define GDISP_HARDWARE_CLIP FALSE #define GDISP_HARDWARE_CLIP HARDWARE_DEFAULT
#endif #endif
/** @} */ /** @} */
@ -159,7 +192,7 @@ typedef struct GDisplay {
#endif #endif
// Software clipping // 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 clipx0, clipy0;
coord_t clipx1, clipy1; /* not inclusive */ coord_t clipx1, clipy1; /* not inclusive */
#endif #endif
@ -464,6 +497,9 @@ typedef struct GDisplay {
} GDISPVMT; } GDISPVMT;
#if defined(GDISP_DRIVER_VMT) #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] = {{ const GDISPVMT const GDISP_DRIVER_VMT[1] = {{
gdisp_lld_init, gdisp_lld_init,
#if GDISP_HARDWARE_STREAM_WRITE #if GDISP_HARDWARE_STREAM_WRITE

File diff suppressed because it is too large Load Diff