replaced SetGraphicDeviceName() by DEFAULT_GRAPHIC_DEVICE_DRM
This commit is contained in:
parent
560e82637e
commit
749edc1546
32
src/core.c
32
src/core.c
|
|
@ -350,7 +350,6 @@ typedef struct CoreData {
|
||||||
#endif
|
#endif
|
||||||
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM) || defined(PLATFORM_UWP)
|
#if defined(PLATFORM_ANDROID) || defined(PLATFORM_RPI) || defined(PLATFORM_DRM) || defined(PLATFORM_UWP)
|
||||||
#if defined(PLATFORM_DRM)
|
#if defined(PLATFORM_DRM)
|
||||||
const char *card; // /dev/dri/... file name
|
|
||||||
int fd; // /dev/dri/... file descriptor
|
int fd; // /dev/dri/... file descriptor
|
||||||
drmModeConnector *connector; // Direct Rendering Manager (DRM) mode connector
|
drmModeConnector *connector; // Direct Rendering Manager (DRM) mode connector
|
||||||
int modeIndex; // index of the used mode of connector->modes
|
int modeIndex; // index of the used mode of connector->modes
|
||||||
|
|
@ -3053,7 +3052,6 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(PLATFORM_DRM)
|
#if defined(PLATFORM_DRM)
|
||||||
CORE.Window.card = NULL;
|
|
||||||
CORE.Window.fd = -1;
|
CORE.Window.fd = -1;
|
||||||
CORE.Window.connector = NULL;
|
CORE.Window.connector = NULL;
|
||||||
CORE.Window.modeIndex = -1;
|
CORE.Window.modeIndex = -1;
|
||||||
|
|
@ -3063,23 +3061,9 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
CORE.Window.prevBO = NULL;
|
CORE.Window.prevBO = NULL;
|
||||||
CORE.Window.prevFB = 0;
|
CORE.Window.prevFB = 0;
|
||||||
|
|
||||||
if ((NULL != CORE.Window.card) && ('\0' != CORE.Window.card[0]))
|
#if defined(DEFAULT_GRAPHIC_DEVICE_DRM)
|
||||||
{
|
CORE.Window.fd = open(DEFAULT_GRAPHIC_DEVICE_DRM, O_RDWR);
|
||||||
char *base = "/dev/dri/";
|
#else
|
||||||
const int len = strlen(base) + strlen(CORE.Window.card);
|
|
||||||
char *path = malloc(len);
|
|
||||||
if (!path) {
|
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: failed to get memory for path");
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
path[0] = '\0';
|
|
||||||
strncpy(path, base, len - 1);
|
|
||||||
strncat(path, CORE.Window.card, len - strlen(base));
|
|
||||||
CORE.Window.fd = open(path, O_RDWR);
|
|
||||||
free(path);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: no graphic card set, trying card1");
|
TRACELOG(LOG_INFO, "DISPLAY: no graphic card set, trying card1");
|
||||||
CORE.Window.fd = open("/dev/dri/card1", O_RDWR); // VideoCore VI (Raspberry Pi 4)
|
CORE.Window.fd = open("/dev/dri/card1", O_RDWR); // VideoCore VI (Raspberry Pi 4)
|
||||||
if (-1 == CORE.Window.fd)
|
if (-1 == CORE.Window.fd)
|
||||||
|
|
@ -3087,14 +3071,13 @@ static bool InitGraphicsDevice(int width, int height)
|
||||||
TRACELOG(LOG_INFO, "DISPLAY: failed to open graphic card1, trying card0");
|
TRACELOG(LOG_INFO, "DISPLAY: failed to open graphic card1, trying card0");
|
||||||
CORE.Window.fd = open("/dev/dri/card0", O_RDWR); // VideoCore IV (Raspberry Pi 1-3)
|
CORE.Window.fd = open("/dev/dri/card0", O_RDWR); // VideoCore IV (Raspberry Pi 1-3)
|
||||||
}
|
}
|
||||||
}
|
#endif
|
||||||
if (-1 == CORE.Window.fd)
|
if (-1 == CORE.Window.fd)
|
||||||
{
|
{
|
||||||
TRACELOG(LOG_WARNING, "DISPLAY: failed to open graphic card");
|
TRACELOG(LOG_WARNING, "DISPLAY: failed to open graphic card");
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
drmModeRes *res = drmModeGetResources(CORE.Window.fd);
|
drmModeRes *res = drmModeGetResources(CORE.Window.fd);
|
||||||
if (!res)
|
if (!res)
|
||||||
{
|
{
|
||||||
|
|
@ -5759,13 +5742,6 @@ void UWPGestureTouch(int pointer, float x, float y, bool touch)
|
||||||
|
|
||||||
#endif // PLATFORM_UWP
|
#endif // PLATFORM_UWP
|
||||||
|
|
||||||
void SetGraphicDeviceName(const char *name)
|
|
||||||
{
|
|
||||||
#if defined(PLATFORM_DRM)
|
|
||||||
if ((name != NULL) && (name[0] != 0)) CORE.Window.card = name;
|
|
||||||
#endif
|
|
||||||
}
|
|
||||||
|
|
||||||
#if defined(PLATFORM_DRM)
|
#if defined(PLATFORM_DRM)
|
||||||
|
|
||||||
static int FindMatchingConnectorMode(const drmModeConnector *connector, const drmModeModeInfo *mode)
|
static int FindMatchingConnectorMode(const drmModeConnector *connector, const drmModeModeInfo *mode)
|
||||||
|
|
|
||||||
|
|
@ -866,7 +866,6 @@ extern "C" { // Prevents name mangling of functions
|
||||||
//------------------------------------------------------------------------------------
|
//------------------------------------------------------------------------------------
|
||||||
|
|
||||||
// Window-related functions
|
// Window-related functions
|
||||||
RLAPI void SetGraphicDeviceName(const char *name); // Set the name of the graphic device to use
|
|
||||||
RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
|
RLAPI void InitWindow(int width, int height, const char *title); // Initialize window and OpenGL context
|
||||||
RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed
|
RLAPI bool WindowShouldClose(void); // Check if KEY_ESCAPE pressed or Close icon pressed
|
||||||
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
RLAPI void CloseWindow(void); // Close window and unload OpenGL context
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user