mirror of
https://github.com/libsdl-org/SDL.git
synced 2026-09-17 02:32:04 +00:00
Replace debug printf's with SDL_Log
This commit is contained in:
committed by
Anonymous Maarten
parent
04b2fb8046
commit
bfd81a0da4
@@ -110,50 +110,56 @@ static void SDL_EVDEV_dump_accents(SDL_EVDEV_keyboard_state *kbd)
|
||||
{
|
||||
unsigned int i;
|
||||
|
||||
printf("static struct kbdiacrs default_accents = {\n");
|
||||
printf(" %d,\n", kbd->accents->kb_cnt);
|
||||
printf(" {\n");
|
||||
SDL_Log("static struct kbdiacrs default_accents = {");
|
||||
SDL_Log(" %d,", kbd->accents->kb_cnt);
|
||||
SDL_Log(" {");
|
||||
for (i = 0; i < kbd->accents->kb_cnt; ++i) {
|
||||
struct kbdiacr *diacr = &kbd->accents->kbdiacr[i];
|
||||
printf(" { 0x%.2x, 0x%.2x, 0x%.2x },\n",
|
||||
SDL_Log(" { 0x%.2x, 0x%.2x, 0x%.2x },",
|
||||
diacr->diacr, diacr->base, diacr->result);
|
||||
}
|
||||
while (i < 256) {
|
||||
printf(" { 0x00, 0x00, 0x00 },\n");
|
||||
SDL_Log(" { 0x00, 0x00, 0x00 },");
|
||||
++i;
|
||||
}
|
||||
printf(" }\n");
|
||||
printf("};\n");
|
||||
SDL_Log(" }");
|
||||
SDL_Log("};");
|
||||
}
|
||||
#endif // DUMP_ACCENTS
|
||||
|
||||
#ifdef DUMP_KEYMAP
|
||||
SDL_COMPILE_TIME_ASSERT(NR_KEYS_MULTIPLE_OF_8, NR_KEYS % 8 == 0);
|
||||
static void SDL_EVDEV_dump_keymap(SDL_EVDEV_keyboard_state *kbd)
|
||||
{
|
||||
int i, j;
|
||||
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
|
||||
if (kbd->key_maps[i]) {
|
||||
printf("static unsigned short default_key_map_%d[NR_KEYS] = {", i);
|
||||
for (j = 0; j < NR_KEYS; ++j) {
|
||||
if ((j % 8) == 0) {
|
||||
printf("\n ");
|
||||
}
|
||||
printf("0x%.4x, ", kbd->key_maps[i][j]);
|
||||
SDL_Log("static unsigned short default_key_map_%d[NR_KEYS] = {", i);
|
||||
for (j = 0; j < NR_KEYS; j += 8) {
|
||||
SDL_Log(" 0x%.4x, 0x%.4x, 0x%.4x, 0x%.4x, 0x%.4x, 0x%.4x, 0x%.4x, 0x%.4x,",
|
||||
kbd->key_maps[i][j + 0],
|
||||
kbd->key_maps[i][j + 1],
|
||||
kbd->key_maps[i][j + 2],
|
||||
kbd->key_maps[i][j + 3],
|
||||
kbd->key_maps[i][j + 4],
|
||||
kbd->key_maps[i][j + 5],
|
||||
kbd->key_maps[i][j + 6],
|
||||
kbd->key_maps[i][j + 7]);
|
||||
}
|
||||
printf("\n};\n");
|
||||
SDL_Log("};");
|
||||
}
|
||||
}
|
||||
printf("\n");
|
||||
printf("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {\n");
|
||||
SDL_Log(" ");
|
||||
SDL_Log("static unsigned short *default_key_maps[MAX_NR_KEYMAPS] = {");
|
||||
for (i = 0; i < MAX_NR_KEYMAPS; ++i) {
|
||||
if (kbd->key_maps[i]) {
|
||||
printf(" default_key_map_%d,\n", i);
|
||||
SDL_Log(" default_key_map_%d,", i);
|
||||
} else {
|
||||
printf(" NULL,\n");
|
||||
SDL_Log(" NULL,");
|
||||
}
|
||||
}
|
||||
printf("};\n");
|
||||
SDL_Log("};");
|
||||
}
|
||||
#endif // DUMP_KEYMAP
|
||||
|
||||
|
||||
@@ -534,7 +534,7 @@ void SDL_SendTouchMotion(Uint64 timestamp, SDL_TouchID id, SDL_FingerID fingerid
|
||||
// Drop events that don't change state
|
||||
if (xrel == 0.0f && yrel == 0.0f && prel == 0.0f) {
|
||||
#if 0
|
||||
printf("Touch event didn't change state - dropped!\n");
|
||||
SDL_Log("Touch event didn't change state - dropped!");
|
||||
#endif
|
||||
SDL_UnlockTouch();
|
||||
return;
|
||||
|
||||
@@ -260,7 +260,7 @@ static bool MaybeAddDevice(const char *path)
|
||||
}
|
||||
|
||||
#ifdef DEBUG_INPUT_EVENTS
|
||||
printf("Checking %s\n", path);
|
||||
SDL_Log("Checking %s", path);
|
||||
#endif
|
||||
|
||||
// see if it works
|
||||
|
||||
@@ -167,7 +167,7 @@ typedef struct
|
||||
#define offsetof(s, m) (size_t) & (((s *)0)->m)
|
||||
|
||||
#ifdef DEBUG_STEAM_CONTROLLER
|
||||
#define DPRINTF(format, ...) printf(format, ##__VA_ARGS__)
|
||||
#define DPRINTF(format, ...) SDL_Log(format, ##__VA_ARGS__)
|
||||
#define HEXDUMP(ptr, len) hexdump(ptr, len)
|
||||
#else
|
||||
#define DPRINTF(format, ...)
|
||||
@@ -243,7 +243,7 @@ static int WriteSegmentToSteamControllerPacketAssembler(SteamControllerPacketAss
|
||||
}
|
||||
|
||||
if (nSegmentLength != MAX_REPORT_SEGMENT_SIZE) {
|
||||
printf("Bad segment size! %d\n", nSegmentLength);
|
||||
SDL_Log("Bad segment size! %d", nSegmentLength);
|
||||
hexdump(pSegment, nSegmentLength);
|
||||
ResetSteamControllerPacketAssembler(pAssembler);
|
||||
return -1;
|
||||
@@ -391,7 +391,7 @@ static int GetFeatureReport(SDL_HIDAPI_Device *dev, unsigned char uBuffer[65])
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("Could not get a full ble packet after %d retries\n", nRetries);
|
||||
SDL_Log("Could not get a full ble packet after %d retries", nRetries);
|
||||
return -1;
|
||||
} else {
|
||||
SDL_memset(uBuffer, 0, 65);
|
||||
@@ -457,7 +457,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
res = SetFeatureReport(dev, buf, 2);
|
||||
if (res < 0) {
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("GET_ATTRIBUTES_VALUES failed for controller %p\n", dev);
|
||||
SDL_Log("GET_ATTRIBUTES_VALUES failed for controller %p", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -468,7 +468,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
if (res < 0 || buf[1] != ID_GET_ATTRIBUTES_VALUES) {
|
||||
HEXDUMP(buf, res);
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("Bad GET_ATTRIBUTES_VALUES response for controller %p\n", dev);
|
||||
SDL_Log("Bad GET_ATTRIBUTES_VALUES response for controller %p", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -476,7 +476,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
nAttributesLength = buf[2];
|
||||
if (nAttributesLength > res) {
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("Bad GET_ATTRIBUTES_VALUES response for controller %p\n", dev);
|
||||
SDL_Log("Bad GET_ATTRIBUTES_VALUES response for controller %p", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -511,7 +511,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
res = SetFeatureReport(dev, buf, 2);
|
||||
if (res < 0) {
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("CLEAR_DIGITAL_MAPPINGS failed for controller %p\n", dev);
|
||||
SDL_Log("CLEAR_DIGITAL_MAPPINGS failed for controller %p", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -523,7 +523,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
res = SetFeatureReport(dev, buf, 3);
|
||||
if (res < 0) {
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("LOAD_DEFAULT_SETTINGS failed for controller %p\n", dev);
|
||||
SDL_Log("LOAD_DEFAULT_SETTINGS failed for controller %p\n", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -553,7 +553,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
res = SetFeatureReport(dev, buf, 3 + nSettings * 3);
|
||||
if (res < 0) {
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("SET_SETTINGS failed for controller %p\n", dev);
|
||||
SDL_Log("SET_SETTINGS failed for controller %p", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
@@ -569,13 +569,13 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
buf[3] = 0;
|
||||
res = SetFeatureReport(dev, buf, 4);
|
||||
if (res < 0) {
|
||||
printf("GET_DIGITAL_MAPPINGS failed for controller %p\n", dev);
|
||||
SDL_Log("GET_DIGITAL_MAPPINGS failed for controller %p\n", dev);
|
||||
return false;
|
||||
}
|
||||
|
||||
res = ReadResponse(dev, buf, ID_GET_DIGITAL_MAPPINGS);
|
||||
if (res < 0 || buf[1] != ID_GET_DIGITAL_MAPPINGS) {
|
||||
printf("Bad GET_DIGITAL_MAPPINGS response for controller %p\n", dev);
|
||||
SDL_Log("Bad GET_DIGITAL_MAPPINGS response for controller %p", dev);
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -588,7 +588,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
}
|
||||
|
||||
if (!bMappingsCleared && !bSuppressErrorSpew) {
|
||||
printf("Warning: CLEAR_DIGITAL_MAPPINGS never completed for controller %p\n", dev);
|
||||
SDL_Log("Warning: CLEAR_DIGITAL_MAPPINGS never completed for controller %p", dev);
|
||||
}
|
||||
|
||||
// Set our new mappings
|
||||
@@ -605,7 +605,7 @@ static bool ResetSteamController(SDL_HIDAPI_Device *dev, bool bSuppressErrorSpew
|
||||
res = SetFeatureReport(dev, buf, 9);
|
||||
if (res < 0) {
|
||||
if (!bSuppressErrorSpew) {
|
||||
printf("SET_DIGITAL_MAPPINGS failed for controller %p\n", dev);
|
||||
SDL_Log("SET_DIGITAL_MAPPINGS failed for controller %p", dev);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -1366,7 +1366,6 @@ static void Blit_RGB565_32(SDL_BlitInfo *info, const Uint32 *map)
|
||||
// This is the code used to generate the lookup tables below:
|
||||
#if 0
|
||||
#include <SDL3/SDL.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#define GENERATE_SHIFTS
|
||||
|
||||
@@ -1377,6 +1376,7 @@ static Uint32 Calculate(int v, int bits, int vmax, int shift)
|
||||
#elif defined(GENERATE_ROUND)
|
||||
return (Uint32)SDL_roundf(v * 255.0f / vmax) << shift;
|
||||
#elif defined(GENERATE_SHIFTS)
|
||||
(void)vmax;
|
||||
switch (bits) {
|
||||
case 1:
|
||||
v = (v << 7) | (v << 6) | (v << 5) | (v << 4) | (v << 3) | (v << 2) | (v << 1) | v;
|
||||
@@ -1424,32 +1424,36 @@ static void GenerateLUT(SDL_PixelFormat src, SDL_PixelFormat dst)
|
||||
const char *dst_name = SDL_GetPixelFormatName(dst) + 16;
|
||||
const SDL_PixelFormatDetails *sfmt = SDL_GetPixelFormatDetails(src);
|
||||
const SDL_PixelFormatDetails *dfmt = SDL_GetPixelFormatDetails(dst);
|
||||
int i;
|
||||
SDL_IOStream *io = SDL_IOFromDynamicMem();
|
||||
size_t i;
|
||||
|
||||
for (i = 0; i < 256; ++i) {
|
||||
for (i = 0; i < 256u; ++i) {
|
||||
lut[i * 2] = CalculateARGB(i, sfmt, dfmt);
|
||||
lut[i * 2 + 1] = CalculateARGB(i << 8, sfmt, dfmt);
|
||||
}
|
||||
|
||||
printf("// Special optimized blit for %s -> %s\n\n", src_name, dst_name);
|
||||
printf("static const Uint32 %s_%s_LUT[%d] = {", src_name, dst_name, (int)SDL_arraysize(lut));
|
||||
SDL_IOprintf(io, "// Special optimized blit for %s -> %s\n\n", src_name, dst_name);
|
||||
SDL_IOprintf(io, "static const Uint32 %s_%s_LUT[%d] = {", src_name, dst_name, (int)SDL_arraysize(lut));
|
||||
for (i = 0; i < SDL_arraysize(lut); ++i) {
|
||||
if ((i % 8) == 0) {
|
||||
printf("\n ");
|
||||
SDL_IOprintf(io, "\n ");
|
||||
}
|
||||
printf("0x%.8x", lut[i]);
|
||||
SDL_IOprintf(io, "0x%.8x", lut[i]);
|
||||
if (i < (SDL_arraysize(lut) - 1)) {
|
||||
printf(",");
|
||||
SDL_IOprintf(io, ",");
|
||||
if (((i + 1) % 8) != 0) {
|
||||
printf(" ");
|
||||
SDL_IOprintf(io, " ");
|
||||
}
|
||||
}
|
||||
}
|
||||
printf("\n};\n\n");
|
||||
SDL_Log("%s\n};\n\n", (const char *)SDL_GetPointerProperty(SDL_GetIOProperties(io), SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, NULL));
|
||||
SDL_CloseIO(io);
|
||||
}
|
||||
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
GenerateLUT(SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_ARGB8888);
|
||||
GenerateLUT(SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_ABGR8888);
|
||||
GenerateLUT(SDL_PIXELFORMAT_RGB565, SDL_PIXELFORMAT_RGBA8888);
|
||||
|
||||
@@ -30,7 +30,6 @@
|
||||
|
||||
// This is the code used to generate the lookup tables below:
|
||||
#if 0
|
||||
#include <stdio.h>
|
||||
#include <SDL3/SDL.h>
|
||||
|
||||
#define GENERATE_SHIFTS
|
||||
@@ -38,10 +37,13 @@
|
||||
static Uint32 Calculate(int v, int bits, int vmax, int shift)
|
||||
{
|
||||
#if defined(GENERATE_FLOOR)
|
||||
(void)bits;
|
||||
return (Uint32)SDL_floor(v * 255.0f / vmax) << shift;
|
||||
#elif defined(GENERATE_ROUND)
|
||||
(void)bits;
|
||||
return (Uint32)SDL_roundf(v * 255.0f / vmax) << shift;
|
||||
#elif defined(GENERATE_SHIFTS)
|
||||
(void)vmax;
|
||||
switch (bits) {
|
||||
case 1:
|
||||
v = (v << 7) | (v << 6) | (v << 5) | (v << 4) | (v << 3) | (v << 2) | (v << 1) | v;
|
||||
@@ -74,16 +76,22 @@ static Uint32 Calculate(int v, int bits, int vmax, int shift)
|
||||
int main(int argc, char *argv[])
|
||||
{
|
||||
int i, b;
|
||||
SDL_IOStream *io = SDL_IOFromDynamicMem();
|
||||
|
||||
(void)argc;
|
||||
(void)argv;
|
||||
for (b = 1; b <= 8; ++b) {
|
||||
printf("static const Uint8 lookup_%d[] = {\n ", b);
|
||||
SDL_IOprintf(io, "static const Uint8 lookup_%d[] = {\n ", b);
|
||||
for (i = 0; i < (1 << b); ++i) {
|
||||
if (i > 0) {
|
||||
printf(", ");
|
||||
SDL_IOprintf(io, ", ");
|
||||
}
|
||||
printf("%d", Calculate(i, b, (1 << b) - 1, 0));
|
||||
SDL_IOprintf(io, "%d", Calculate(i, b, (1 << b) - 1, 0));
|
||||
}
|
||||
printf("\n};\n\n");
|
||||
SDL_Log("%s\n};\n\n", (const char *)SDL_GetPointerProperty(SDL_GetIOProperties(io), SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, NULL));
|
||||
SDL_SeekIO(io, 0, SDL_IO_SEEK_SET);
|
||||
SDL_WriteIO(io, "", 1);
|
||||
SDL_SeekIO(io, 0, SDL_IO_SEEK_SET);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
@@ -1599,11 +1607,12 @@ bool SDL_ValidateMap(SDL_Surface *src, SDL_Surface *dst)
|
||||
if (!SDL_MapSurface(src, dst)) {
|
||||
return false;
|
||||
}
|
||||
#if 0
|
||||
// just here for debugging
|
||||
// printf
|
||||
// ("src = 0x%08X src->flags = %08X map->info.flags = %08x\ndst = 0x%08X dst->flags = %08X dst->map.info.flags = %08X\nmap->blit = 0x%08x\n",
|
||||
// src, dst->flags, map->info.flags, dst, dst->flags,
|
||||
// dst->map.info.flags, map->blit);
|
||||
SDL_Log("src = %p src->flags = %08X map->info.flags = %08x\ndst = %p dst->flags = %08X dst->map.info.flags = %08X\nmap->blit = %p",
|
||||
src, dst->flags, map->info.flags, dst, dst->flags,
|
||||
dst->map.info.flags, map->blit);
|
||||
#endif
|
||||
} else {
|
||||
map->info.dst_surface = dst;
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@
|
||||
//#define USE_GCMOUSE_SCROLL
|
||||
|
||||
#ifdef DEBUG_COCOAMOUSE
|
||||
#define DLog(fmt, ...) printf("%s: " fmt "\n", SDL_FUNCTION, ##__VA_ARGS__)
|
||||
#define DLog(fmt, ...) SDL_Log("%s: " fmt, SDL_FUNCTION, ##__VA_ARGS__)
|
||||
#else
|
||||
#define DLog(...) \
|
||||
do { \
|
||||
|
||||
@@ -41,7 +41,7 @@
|
||||
#endif
|
||||
|
||||
#ifdef DEBUG_COCOAWINDOW
|
||||
#define DLog(fmt, ...) printf("%s: " fmt "\n", SDL_FUNCTION, ##__VA_ARGS__)
|
||||
#define DLog(fmt, ...) SDL_Log("%s: " fmt, SDL_FUNCTION, ##__VA_ARGS__)
|
||||
#else
|
||||
#define DLog(...) \
|
||||
do { \
|
||||
|
||||
@@ -81,55 +81,55 @@ static void get_refresh_rate(display_mode &mode, int *numerator, int *denominato
|
||||
*/
|
||||
void _SpoutModeData(display_mode *bmode)
|
||||
{
|
||||
printf("BMode:\n");
|
||||
printf("\tw,h = (%i,%i)\n", bmode->virtual_width, bmode->virtual_height);
|
||||
printf("\th,v = (%i,%i)\n", bmode->h_display_start,
|
||||
SDL_Log("BMode:");
|
||||
SDL_Log("\tw,h = (%i,%i)", bmode->virtual_width, bmode->virtual_height);
|
||||
SDL_Log("\th,v = (%i,%i)", bmode->h_display_start,
|
||||
bmode->v_display_start);
|
||||
if (bmode->flags) {
|
||||
printf("\tFlags:\n");
|
||||
SDL_Log("\tFlags:");
|
||||
if (bmode->flags & B_SCROLL) {
|
||||
printf("\t\tB_SCROLL\n");
|
||||
SDL_Log("\t\tB_SCROLL");
|
||||
}
|
||||
if (bmode->flags & B_8_BIT_DAC) {
|
||||
printf("\t\tB_8_BIT_DAC\n");
|
||||
SDL_Log("\t\tB_8_BIT_DAC");
|
||||
}
|
||||
if (bmode->flags & B_HARDWARE_CURSOR) {
|
||||
printf("\t\tB_HARDWARE_CURSOR\n");
|
||||
SDL_Log("\t\tB_HARDWARE_CURSOR");
|
||||
}
|
||||
if (bmode->flags & B_PARALLEL_ACCESS) {
|
||||
printf("\t\tB_PARALLEL_ACCESS\n");
|
||||
SDL_Log("\t\tB_PARALLEL_ACCESS");
|
||||
}
|
||||
if (bmode->flags & B_DPMS) {
|
||||
printf("\t\tB_DPMS\n");
|
||||
SDL_Log("\t\tB_DPMS");
|
||||
}
|
||||
if (bmode->flags & B_IO_FB_NA) {
|
||||
printf("\t\tB_IO_FB_NA\n");
|
||||
SDL_Log("\t\tB_IO_FB_NA");
|
||||
}
|
||||
}
|
||||
printf("\tTiming:\n");
|
||||
printf("\t\tpx clock: %i\n", bmode->timing.pixel_clock);
|
||||
printf("\t\th - display: %i sync start: %i sync end: %i total: %i\n",
|
||||
SDL_Log("\tTiming:");
|
||||
SDL_Log("\t\tpx clock: %i", bmode->timing.pixel_clock);
|
||||
SDL_Log("\t\th - display: %i sync start: %i sync end: %i total: %i",
|
||||
bmode->timing.h_display, bmode->timing.h_sync_start,
|
||||
bmode->timing.h_sync_end, bmode->timing.h_total);
|
||||
printf("\t\tv - display: %i sync start: %i sync end: %i total: %i\n",
|
||||
SDL_Log("\t\tv - display: %i sync start: %i sync end: %i total: %i",
|
||||
bmode->timing.v_display, bmode->timing.v_sync_start,
|
||||
bmode->timing.v_sync_end, bmode->timing.v_total);
|
||||
if (bmode->timing.flags) {
|
||||
printf("\t\tFlags:\n");
|
||||
SDL_Log("\t\tFlags:");
|
||||
if (bmode->timing.flags & B_BLANK_PEDESTAL) {
|
||||
printf("\t\t\tB_BLANK_PEDESTAL\n");
|
||||
SDL_Log("\t\t\tB_BLANK_PEDESTAL");
|
||||
}
|
||||
if (bmode->timing.flags & B_TIMING_INTERLACED) {
|
||||
printf("\t\t\tB_TIMING_INTERLACED\n");
|
||||
SDL_Log("\t\t\tB_TIMING_INTERLACED");
|
||||
}
|
||||
if (bmode->timing.flags & B_POSITIVE_HSYNC) {
|
||||
printf("\t\t\tB_POSITIVE_HSYNC\n");
|
||||
SDL_Log("\t\t\tB_POSITIVE_HSYNC");
|
||||
}
|
||||
if (bmode->timing.flags & B_POSITIVE_VSYNC) {
|
||||
printf("\t\t\tB_POSITIVE_VSYNC\n");
|
||||
SDL_Log("\t\t\tB_POSITIVE_VSYNC");
|
||||
}
|
||||
if (bmode->timing.flags & B_SYNC_ON_GREEN) {
|
||||
printf("\t\t\tB_SYNC_ON_GREEN\n");
|
||||
SDL_Log("\t\t\tB_SYNC_ON_GREEN");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -297,15 +297,17 @@ static void print_plane_info(SDL_VideoDevice *_this, drmModePlanePtr plane)
|
||||
/* Now we look for the CRTCs supported by the plane. */
|
||||
drmModeRes *resources = KMSDRM_drmModeGetResources(viddata->drm_fd);
|
||||
if (resources) {
|
||||
printf("--PLANE ID: %d\nPLANE TYPE: %s\nCRTC READING THIS PLANE: %d\nCRTCS SUPPORTED BY THIS PLANE: ", plane->plane_id, plane_type, plane->crtc_id);
|
||||
SDL_IOStream *io = SDL_IOFromDynamicMem();
|
||||
SDL_IOprintf(io, "--PLANE ID: %d\nPLANE TYPE: %s\nCRTC READING THIS PLANE: %d\nCRTCS SUPPORTED BY THIS PLANE: ", plane->plane_id, plane_type, plane->crtc_id);
|
||||
for (int i = 0; i < resources->count_crtcs; i++) {
|
||||
if (plane->possible_crtcs & (1 << i)) {
|
||||
uint32_t crtc_id = resources->crtcs[i];
|
||||
printf ("%d", crtc_id);
|
||||
SDL_IOprintf(io, " %d", crtc_id);
|
||||
break;
|
||||
}
|
||||
}
|
||||
printf ("\n\n");
|
||||
SDL_Log("%s\n\n", (const char *)SDL_GetPointerProperty(SDL_GetIOProperties(io), SDL_PROP_IOSTREAM_DYNAMIC_MEMORY_POINTER, ""));
|
||||
SDL_CloseIO(io);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -315,12 +317,12 @@ static void get_planes_info(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
||||
|
||||
drmModePlaneResPtr plane_resources = KMSDRM_drmModeGetPlaneResources(viddata->drm_fd);
|
||||
if (!plane_resources) {
|
||||
printf("drmModeGetPlaneResources failed: %s\n", strerror(errno));
|
||||
SDL_Log("drmModeGetPlaneResources failed: %s", strerror(errno));
|
||||
return;
|
||||
}
|
||||
|
||||
printf("--Number of planes found: %d-- \n", plane_resources->count_planes);
|
||||
printf("--Usable CRTC that we have chosen: %d-- \n", dispdata->crtc.crtc->crtc_id);
|
||||
SDL_Log("--Number of planes found: %d--", plane_resources->count_planes);
|
||||
SDL_Log("--Usable CRTC that we have chosen: %d--", dispdata->crtc.crtc->crtc_id);
|
||||
|
||||
/* Iterate on all the available planes. */
|
||||
for (uint32_t i = 0; (i < plane_resources->count_planes); i++) {
|
||||
@@ -328,7 +330,7 @@ static void get_planes_info(SDL_VideoDevice *_this, SDL_DisplayData *dispdata)
|
||||
|
||||
drmModePlanePtr plane = KMSDRM_drmModeGetPlane(viddata->drm_fd, plane_id);
|
||||
if (!plane) {
|
||||
printf("drmModeGetPlane(%u) failed: %s\n", plane_id, strerror(errno));
|
||||
SDL_Log("drmModeGetPlane(%u) failed: %s", plane_id, strerror(errno));
|
||||
continue;
|
||||
}
|
||||
|
||||
@@ -545,7 +547,7 @@ int drm_atomic_commit(SDL_VideoDevice *_this, SDL_DisplayData *dispdata, bool bl
|
||||
SDL_SetError("Atomic commit failed, returned %d.", ret);
|
||||
/* Uncomment this for fast-debugging */
|
||||
#if 0
|
||||
printf("ATOMIC COMMIT FAILED: %s.\n", strerror(errno));
|
||||
SDL_Log("ATOMIC COMMIT FAILED: %s.", strerror(errno));
|
||||
#endif
|
||||
goto out;
|
||||
}
|
||||
|
||||
@@ -147,10 +147,11 @@ static void *X11_GetSym(const char *fnname, int *pHasModule)
|
||||
}
|
||||
|
||||
#if DEBUG_DYNAMIC_X11
|
||||
if (fn)
|
||||
printf("X11: Found '%s' in %s (%p)\n", fnname, x11libs[i].libname, fn);
|
||||
else
|
||||
printf("X11: Symbol '%s' NOT FOUND!\n", fnname);
|
||||
if (fn) {
|
||||
SDL_Log("X11: Found '%s' in %s (%p)", fnname, x11libs[i].libname, fn);
|
||||
} else {
|
||||
SDL_Log("X11: Symbol '%s' NOT FOUND!", fnname);
|
||||
}
|
||||
#endif
|
||||
|
||||
if (!fn) {
|
||||
|
||||
@@ -1857,7 +1857,7 @@ static void X11_DispatchEvent(SDL_VideoDevice *_this, XEvent *xevent)
|
||||
(xevent->xclient.data.l[0] == videodata->atoms._NET_WM_SYNC_REQUEST)) {
|
||||
|
||||
#ifdef DEBUG_XEVENTS
|
||||
printf("window %p: _NET_WM_SYNC_REQUEST\n", data);
|
||||
SDL_Log("window %p: _NET_WM_SYNC_REQUEST", data);
|
||||
#endif
|
||||
#ifdef SDL_VIDEO_DRIVER_X11_XSYNC
|
||||
X11_HandleSyncRequest(data->window, &xevent->xclient);
|
||||
|
||||
@@ -356,7 +356,7 @@ static void X11_CheckWindowManager(SDL_VideoDevice *_this)
|
||||
|
||||
if (!wm_window) {
|
||||
#ifdef DEBUG_WINDOW_MANAGER
|
||||
printf("Couldn't get _NET_SUPPORTING_WM_CHECK property\n");
|
||||
SDL_Log("Couldn't get _NET_SUPPORTING_WM_CHECK property");
|
||||
#endif
|
||||
return;
|
||||
}
|
||||
@@ -364,7 +364,7 @@ static void X11_CheckWindowManager(SDL_VideoDevice *_this)
|
||||
|
||||
#ifdef DEBUG_WINDOW_MANAGER
|
||||
wm_name = X11_GetWindowTitle(_this, wm_window);
|
||||
printf("Window manager: %s\n", wm_name);
|
||||
SDL_Log("Window manager: %s", wm_name);
|
||||
SDL_free(wm_name);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -2151,7 +2151,7 @@ run_test(void)
|
||||
unsigned long rel[NBITS(REL_MAX)];
|
||||
} caps;
|
||||
|
||||
printf("%s...\n", t->name);
|
||||
SDL_Log("%s...", t->name);
|
||||
|
||||
SDL_memset(&caps, '\0', sizeof(caps));
|
||||
SDL_memcpy(caps.props, t->props, sizeof(t->props));
|
||||
@@ -2184,28 +2184,28 @@ run_test(void)
|
||||
caps.keys, caps.rel);
|
||||
|
||||
if (actual == t->expected) {
|
||||
printf("\tOK\n");
|
||||
SDL_Log("\tOK");
|
||||
} else {
|
||||
printf("\tExpected 0x%08x\n", t->expected);
|
||||
SDL_Log("\tExpected 0x%08x", t->expected);
|
||||
|
||||
for (j = 0; device_classes[j].code != 0; j++) {
|
||||
if (t->expected & device_classes[j].code) {
|
||||
printf("\t\t%s\n", device_classes[j].name);
|
||||
SDL_Log("\t\t%s", device_classes[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
printf("\tGot 0x%08x\n", actual);
|
||||
SDL_Log("\tGot 0x%08x", actual);
|
||||
|
||||
for (j = 0; device_classes[j].code != 0; j++) {
|
||||
if (actual & device_classes[j].code) {
|
||||
printf("\t\t%s\n", device_classes[j].name);
|
||||
SDL_Log("\t\t%s", device_classes[j].name);
|
||||
}
|
||||
}
|
||||
|
||||
if (t->todo) {
|
||||
printf("\tKnown issue, ignoring: %s\n", t->todo);
|
||||
SDL_Log("\tKnown issue, ignoring: %s", t->todo);
|
||||
} else {
|
||||
printf("\tFailed\n");
|
||||
SDL_Log("\tFailed");
|
||||
success = 0;
|
||||
}
|
||||
}
|
||||
@@ -2219,7 +2219,7 @@ run_test(void)
|
||||
static int
|
||||
run_test(void)
|
||||
{
|
||||
printf("SDL compiled without evdev capability check.\n");
|
||||
SDL_Log("SDL compiled without evdev capability check.");
|
||||
return 1;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user