SDL  2.0
SDL_cpuinfo.c File Reference
#include "../SDL_internal.h"
#include "SDL_cpuinfo.h"
#include "SDL_assert.h"
+ Include dependency graph for SDL_cpuinfo.c:

Go to the source code of this file.

Macros

#define CPU_HAS_RDTSC   (1 << 0)
 
#define CPU_HAS_ALTIVEC   (1 << 1)
 
#define CPU_HAS_MMX   (1 << 2)
 
#define CPU_HAS_3DNOW   (1 << 3)
 
#define CPU_HAS_SSE   (1 << 4)
 
#define CPU_HAS_SSE2   (1 << 5)
 
#define CPU_HAS_SSE3   (1 << 6)
 
#define CPU_HAS_SSE41   (1 << 7)
 
#define CPU_HAS_SSE42   (1 << 8)
 
#define CPU_HAS_AVX   (1 << 9)
 
#define CPU_HAS_AVX2   (1 << 10)
 
#define CPU_HAS_NEON   (1 << 11)
 
#define CPU_HAS_AVX512F   (1 << 12)
 
#define CPU_HAS_ARM_SIMD   (1 << 13)
 
#define cpuid(func, a, b, c, d)   do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0)
 
#define CPU_haveRDTSC()   (CPU_CPUIDFeatures[3] & 0x00000010)
 
#define CPU_haveMMX()   (CPU_CPUIDFeatures[3] & 0x00800000)
 
#define CPU_haveSSE()   (CPU_CPUIDFeatures[3] & 0x02000000)
 
#define CPU_haveSSE2()   (CPU_CPUIDFeatures[3] & 0x04000000)
 
#define CPU_haveSSE3()   (CPU_CPUIDFeatures[2] & 0x00000001)
 
#define CPU_haveSSE41()   (CPU_CPUIDFeatures[2] & 0x00080000)
 
#define CPU_haveSSE42()   (CPU_CPUIDFeatures[2] & 0x00100000)
 
#define CPU_haveAVX()   (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000))
 
#define CPU_FEATURE_AVAILABLE(f)   ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE)
 

Functions

static int CPU_haveCPUID (void)
 
static void CPU_calcCPUIDFeatures (void)
 
static int CPU_haveAltiVec (void)
 
static int CPU_haveARMSIMD (void)
 
static int CPU_haveNEON (void)
 
static int CPU_have3DNow (void)
 
static int CPU_haveAVX2 (void)
 
static int CPU_haveAVX512F (void)
 
int SDL_GetCPUCount (void)
 
static const char * SDL_GetCPUType (void)
 
int SDL_GetCPUCacheLineSize (void)
 
static Uint32 SDL_GetCPUFeatures (void)
 
SDL_bool SDL_HasRDTSC (void)
 
SDL_bool SDL_HasAltiVec (void)
 
SDL_bool SDL_HasMMX (void)
 
SDL_bool SDL_Has3DNow (void)
 
SDL_bool SDL_HasSSE (void)
 
SDL_bool SDL_HasSSE2 (void)
 
SDL_bool SDL_HasSSE3 (void)
 
SDL_bool SDL_HasSSE41 (void)
 
SDL_bool SDL_HasSSE42 (void)
 
SDL_bool SDL_HasAVX (void)
 
SDL_bool SDL_HasAVX2 (void)
 
SDL_bool SDL_HasAVX512F (void)
 
SDL_bool SDL_HasARMSIMD (void)
 
SDL_bool SDL_HasNEON (void)
 
int SDL_GetSystemRAM (void)
 
size_t SDL_SIMDGetAlignment (void)
 Report the alignment this system needs for SIMD allocations. More...
 
voidSDL_SIMDAlloc (const size_t len)
 Allocate memory in a SIMD-friendly way. More...
 
void SDL_SIMDFree (void *ptr)
 Deallocate memory obtained from SDL_SIMDAlloc. More...
 

Variables

static int CPU_CPUIDFeatures [4]
 
static int CPU_CPUIDMaxFunction = 0
 
static SDL_bool CPU_OSSavesYMM = SDL_FALSE
 
static SDL_bool CPU_OSSavesZMM = SDL_FALSE
 
static int SDL_CPUCount = 0
 
static Uint32 SDL_CPUFeatures = 0xFFFFFFFF
 
static Uint32 SDL_SIMDAlignment = 0xFFFFFFFF
 
static int SDL_SystemRAM = 0
 

Macro Definition Documentation

◆ CPU_FEATURE_AVAILABLE

#define CPU_FEATURE_AVAILABLE (   f)    ((SDL_GetCPUFeatures() & f) ? SDL_TRUE : SDL_FALSE)

Definition at line 785 of file SDL_cpuinfo.c.

◆ CPU_HAS_3DNOW

#define CPU_HAS_3DNOW   (1 << 3)

Definition at line 102 of file SDL_cpuinfo.c.

◆ CPU_HAS_ALTIVEC

#define CPU_HAS_ALTIVEC   (1 << 1)

Definition at line 100 of file SDL_cpuinfo.c.

◆ CPU_HAS_ARM_SIMD

#define CPU_HAS_ARM_SIMD   (1 << 13)

Definition at line 112 of file SDL_cpuinfo.c.

◆ CPU_HAS_AVX

#define CPU_HAS_AVX   (1 << 9)

Definition at line 108 of file SDL_cpuinfo.c.

◆ CPU_HAS_AVX2

#define CPU_HAS_AVX2   (1 << 10)

Definition at line 109 of file SDL_cpuinfo.c.

◆ CPU_HAS_AVX512F

#define CPU_HAS_AVX512F   (1 << 12)

Definition at line 111 of file SDL_cpuinfo.c.

◆ CPU_HAS_MMX

#define CPU_HAS_MMX   (1 << 2)

Definition at line 101 of file SDL_cpuinfo.c.

◆ CPU_HAS_NEON

#define CPU_HAS_NEON   (1 << 11)

Definition at line 110 of file SDL_cpuinfo.c.

◆ CPU_HAS_RDTSC

#define CPU_HAS_RDTSC   (1 << 0)

Definition at line 99 of file SDL_cpuinfo.c.

◆ CPU_HAS_SSE

#define CPU_HAS_SSE   (1 << 4)

Definition at line 103 of file SDL_cpuinfo.c.

◆ CPU_HAS_SSE2

#define CPU_HAS_SSE2   (1 << 5)

Definition at line 104 of file SDL_cpuinfo.c.

◆ CPU_HAS_SSE3

#define CPU_HAS_SSE3   (1 << 6)

Definition at line 105 of file SDL_cpuinfo.c.

◆ CPU_HAS_SSE41

#define CPU_HAS_SSE41   (1 << 7)

Definition at line 106 of file SDL_cpuinfo.c.

◆ CPU_HAS_SSE42

#define CPU_HAS_SSE42   (1 << 8)

Definition at line 107 of file SDL_cpuinfo.c.

◆ CPU_haveAVX

#define CPU_haveAVX ( )    (CPU_OSSavesYMM && (CPU_CPUIDFeatures[2] & 0x10000000))

Definition at line 520 of file SDL_cpuinfo.c.

◆ CPU_haveMMX

#define CPU_haveMMX ( )    (CPU_CPUIDFeatures[3] & 0x00800000)

Definition at line 514 of file SDL_cpuinfo.c.

◆ CPU_haveRDTSC

#define CPU_haveRDTSC ( )    (CPU_CPUIDFeatures[3] & 0x00000010)

Definition at line 513 of file SDL_cpuinfo.c.

◆ CPU_haveSSE

#define CPU_haveSSE ( )    (CPU_CPUIDFeatures[3] & 0x02000000)

Definition at line 515 of file SDL_cpuinfo.c.

◆ CPU_haveSSE2

#define CPU_haveSSE2 ( )    (CPU_CPUIDFeatures[3] & 0x04000000)

Definition at line 516 of file SDL_cpuinfo.c.

◆ CPU_haveSSE3

#define CPU_haveSSE3 ( )    (CPU_CPUIDFeatures[2] & 0x00000001)

Definition at line 517 of file SDL_cpuinfo.c.

◆ CPU_haveSSE41

#define CPU_haveSSE41 ( )    (CPU_CPUIDFeatures[2] & 0x00080000)

Definition at line 518 of file SDL_cpuinfo.c.

◆ CPU_haveSSE42

#define CPU_haveSSE42 ( )    (CPU_CPUIDFeatures[2] & 0x00100000)

Definition at line 519 of file SDL_cpuinfo.c.

◆ cpuid

#define cpuid (   func,
  a,
  b,
  c,
  d 
)    do { a = b = c = d = 0; (void) a; (void) b; (void) c; (void) d; } while (0)

Definition at line 264 of file SDL_cpuinfo.c.

Function Documentation

◆ CPU_calcCPUIDFeatures()

static void CPU_calcCPUIDFeatures ( void  )
static

Definition at line 273 of file SDL_cpuinfo.c.

274 {
275  static SDL_bool checked = SDL_FALSE;
276  if (!checked) {
277  checked = SDL_TRUE;
278  if (CPU_haveCPUID()) {
279  int a, b, c, d;
280  cpuid(0, a, b, c, d);
282  if (CPU_CPUIDMaxFunction >= 1) {
283  cpuid(1, a, b, c, d);
284  CPU_CPUIDFeatures[0] = a;
285  CPU_CPUIDFeatures[1] = b;
286  CPU_CPUIDFeatures[2] = c;
287  CPU_CPUIDFeatures[3] = d;
288 
289  /* Check to make sure we can call xgetbv */
290  if (c & 0x08000000) {
291  /* Call xgetbv to see if YMM (etc) register state is saved */
292 #if defined(__GNUC__) && (defined(i386) || defined(__x86_64__))
293  __asm__(".byte 0x0f, 0x01, 0xd0" : "=a" (a) : "c" (0) : "%edx");
294 #elif defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64)) && (_MSC_FULL_VER >= 160040219) /* VS2010 SP1 */
295  a = (int)_xgetbv(0);
296 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
297  __asm
298  {
299  xor ecx, ecx
300  _asm _emit 0x0f _asm _emit 0x01 _asm _emit 0xd0
301  mov a, eax
302  }
303 #endif
304  CPU_OSSavesYMM = ((a & 6) == 6) ? SDL_TRUE : SDL_FALSE;
305  CPU_OSSavesZMM = (CPU_OSSavesYMM && ((a & 0xe0) == 0xe0)) ? SDL_TRUE : SDL_FALSE;
306  }
307  }
308  }
309  }
310 }

References CPU_CPUIDFeatures, CPU_CPUIDMaxFunction, CPU_haveCPUID(), CPU_OSSavesYMM, CPU_OSSavesZMM, cpuid, d, mov, SDL_FALSE, and SDL_TRUE.

Referenced by SDL_GetCPUFeatures(), and SDL_GetCPUType().

◆ CPU_have3DNow()

static int CPU_have3DNow ( void  )
static

Definition at line 499 of file SDL_cpuinfo.c.

500 {
501  if (CPU_CPUIDMaxFunction > 0) { /* that is, do we have CPUID at all? */
502  int a, b, c, d;
503  cpuid(0x80000000, a, b, c, d);
504  if (a >= 0x80000001) {
505  cpuid(0x80000001, a, b, c, d);
506  return (d & 0x80000000);
507  }
508  }
509  return 0;
510 }

References CPU_CPUIDMaxFunction, cpuid, and d.

Referenced by SDL_GetCPUFeatures().

◆ CPU_haveAltiVec()

static int CPU_haveAltiVec ( void  )
static

Definition at line 313 of file SDL_cpuinfo.c.

314 {
315  volatile int altivec = 0;
316 #ifndef SDL_CPUINFO_DISABLED
317 #if (defined(__MACOSX__) && (defined(__ppc__) || defined(__ppc64__))) || (defined(__OpenBSD__) && defined(__powerpc__))
318 #ifdef __OpenBSD__
319  int selectors[2] = { CTL_MACHDEP, CPU_ALTIVEC };
320 #else
321  int selectors[2] = { CTL_HW, HW_VECTORUNIT };
322 #endif
323  int hasVectorUnit = 0;
324  size_t length = sizeof(hasVectorUnit);
325  int error = sysctl(selectors, 2, &hasVectorUnit, &length, NULL, 0);
326  if (0 == error)
327  altivec = (hasVectorUnit != 0);
328 #elif SDL_ALTIVEC_BLITTERS && HAVE_SETJMP
329  void (*handler) (int sig);
330  handler = signal(SIGILL, illegal_instruction);
331  if (setjmp(jmpbuf) == 0) {
332  asm volatile ("mtspr 256, %0\n\t" "vand %%v0, %%v0, %%v0"::"r" (-1));
333  altivec = 1;
334  }
335  signal(SIGILL, handler);
336 #endif
337 #endif
338  return altivec;
339 }

References NULL, and void.

Referenced by SDL_GetCPUFeatures().

◆ CPU_haveARMSIMD()

static int CPU_haveARMSIMD ( void  )
static

Definition at line 350 of file SDL_cpuinfo.c.

351 {
352  return 0;
353 }

Referenced by SDL_GetCPUFeatures().

◆ CPU_haveAVX2()

static int CPU_haveAVX2 ( void  )
static

Definition at line 522 of file SDL_cpuinfo.c.

523 {
524  if (CPU_OSSavesYMM && (CPU_CPUIDMaxFunction >= 7)) {
525  int a, b, c, d;
526  (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
527  cpuid(7, a, b, c, d);
528  return (b & 0x00000020);
529  }
530  return 0;
531 }

References CPU_CPUIDMaxFunction, CPU_OSSavesYMM, cpuid, d, and void.

Referenced by SDL_GetCPUFeatures().

◆ CPU_haveAVX512F()

static int CPU_haveAVX512F ( void  )
static

Definition at line 534 of file SDL_cpuinfo.c.

535 {
536  if (CPU_OSSavesZMM && (CPU_CPUIDMaxFunction >= 7)) {
537  int a, b, c, d;
538  (void) a; (void) b; (void) c; (void) d; /* compiler warnings... */
539  cpuid(7, a, b, c, d);
540  return (b & 0x00010000);
541  }
542  return 0;
543 }

References CPU_CPUIDMaxFunction, CPU_OSSavesZMM, cpuid, d, and void.

Referenced by SDL_GetCPUFeatures().

◆ CPU_haveCPUID()

static int CPU_haveCPUID ( void  )
static

Definition at line 126 of file SDL_cpuinfo.c.

127 {
128  int has_CPUID = 0;
129 
130 /* *INDENT-OFF* */
131 #ifndef SDL_CPUINFO_DISABLED
132 #if defined(__GNUC__) && defined(i386)
133  __asm__ (
134 " pushfl # Get original EFLAGS \n"
135 " popl %%eax \n"
136 " movl %%eax,%%ecx \n"
137 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
138 " pushl %%eax # Save new EFLAGS value on stack \n"
139 " popfl # Replace current EFLAGS value \n"
140 " pushfl # Get new EFLAGS \n"
141 " popl %%eax # Store new EFLAGS in EAX \n"
142 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
143 " jz 1f # Processor=80486 \n"
144 " movl $1,%0 # We have CPUID support \n"
145 "1: \n"
146  : "=m" (has_CPUID)
147  :
148  : "%eax", "%ecx"
149  );
150 #elif defined(__GNUC__) && defined(__x86_64__)
151 /* Technically, if this is being compiled under __x86_64__ then it has
152  CPUid by definition. But it's nice to be able to prove it. :) */
153  __asm__ (
154 " pushfq # Get original EFLAGS \n"
155 " popq %%rax \n"
156 " movq %%rax,%%rcx \n"
157 " xorl $0x200000,%%eax # Flip ID bit in EFLAGS \n"
158 " pushq %%rax # Save new EFLAGS value on stack \n"
159 " popfq # Replace current EFLAGS value \n"
160 " pushfq # Get new EFLAGS \n"
161 " popq %%rax # Store new EFLAGS in EAX \n"
162 " xorl %%ecx,%%eax # Can not toggle ID bit, \n"
163 " jz 1f # Processor=80486 \n"
164 " movl $1,%0 # We have CPUID support \n"
165 "1: \n"
166  : "=m" (has_CPUID)
167  :
168  : "%rax", "%rcx"
169  );
170 #elif (defined(_MSC_VER) && defined(_M_IX86)) || defined(__WATCOMC__)
171  __asm {
172  pushfd ; Get original EFLAGS
173  pop eax
174  mov ecx, eax
175  xor eax, 200000h ; Flip ID bit in EFLAGS
176  push eax ; Save new EFLAGS value on stack
177  popfd ; Replace current EFLAGS value
178  pushfd ; Get new EFLAGS
179  pop eax ; Store new EFLAGS in EAX
180  xor eax, ecx ; Can not toggle ID bit,
181  jz done ; Processor=80486
182  mov has_CPUID,1 ; We have CPUID support
183 done:
184  }
185 #elif defined(_MSC_VER) && defined(_M_X64)
186  has_CPUID = 1;
187 #elif defined(__sun) && defined(__i386)
188  __asm (
189 " pushfl \n"
190 " popl %eax \n"
191 " movl %eax,%ecx \n"
192 " xorl $0x200000,%eax \n"
193 " pushl %eax \n"
194 " popfl \n"
195 " pushfl \n"
196 " popl %eax \n"
197 " xorl %ecx,%eax \n"
198 " jz 1f \n"
199 " movl $1,-8(%ebp) \n"
200 "1: \n"
201  );
202 #elif defined(__sun) && defined(__amd64)
203  __asm (
204 " pushfq \n"
205 " popq %rax \n"
206 " movq %rax,%rcx \n"
207 " xorl $0x200000,%eax \n"
208 " pushq %rax \n"
209 " popfq \n"
210 " pushfq \n"
211 " popq %rax \n"
212 " xorl %ecx,%eax \n"
213 " jz 1f \n"
214 " movl $1,-8(%rbp) \n"
215 "1: \n"
216  );
217 #endif
218 #endif
219 /* *INDENT-ON* */
220  return has_CPUID;
221 }

References done, mov, and pop.

Referenced by CPU_calcCPUIDFeatures().

◆ CPU_haveNEON()

static int CPU_haveNEON ( void  )
static

Definition at line 439 of file SDL_cpuinfo.c.

440 {
441 /* The way you detect NEON is a privileged instruction on ARM, so you have
442  query the OS kernel in a platform-specific way. :/ */
443 #if defined(SDL_CPUINFO_DISABLED)
444  return 0; /* disabled */
445 #elif (defined(__WINDOWS__) || defined(__WINRT__)) && (defined(_M_ARM) || defined(_M_ARM64))
446 /* Visual Studio, for ARM, doesn't define __ARM_ARCH. Handle this first. */
447 /* Seems to have been removed */
448 # if !defined(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE)
449 # define PF_ARM_NEON_INSTRUCTIONS_AVAILABLE 19
450 # endif
451 /* All WinRT ARM devices are required to support NEON, but just in case. */
452  return IsProcessorFeaturePresent(PF_ARM_NEON_INSTRUCTIONS_AVAILABLE) != 0;
453 #elif defined(__ARM_ARCH) && (__ARM_ARCH >= 8)
454  return 1; /* ARMv8 always has non-optional NEON support. */
455 #elif defined(__APPLE__) && defined(__ARM_ARCH) && (__ARM_ARCH >= 7)
456  /* (note that sysctlbyname("hw.optional.neon") doesn't work!) */
457  return 1; /* all Apple ARMv7 chips and later have NEON. */
458 #elif defined(__APPLE__)
459  return 0; /* assume anything else from Apple doesn't have NEON. */
460 #elif !defined(__arm__)
461  return 0; /* not an ARM CPU at all. */
462 #elif defined(__QNXNTO__)
463  return SYSPAGE_ENTRY(cpuinfo)->flags & ARM_CPU_FLAG_NEON;
464 #elif (defined(__LINUX__) || defined(__ANDROID__)) && defined(HAVE_GETAUXVAL)
465  return ((getauxval(AT_HWCAP) & HWCAP_NEON) == HWCAP_NEON);
466 #elif defined(__LINUX__)
467  return readProcAuxvForNeon();
468 #elif defined(__ANDROID__)
469  /* Use NDK cpufeatures to read either /proc/self/auxv or /proc/cpuinfo */
470  {
471  AndroidCpuFamily cpu_family = android_getCpuFamily();
472  if (cpu_family == ANDROID_CPU_FAMILY_ARM) {
473  uint64_t cpu_features = android_getCpuFeatures();
474  if ((cpu_features & ANDROID_CPU_ARM_FEATURE_NEON) != 0) {
475  return 1;
476  }
477  }
478  return 0;
479  }
480 #elif defined(__RISCOS__)
481  /* Use the VFPSupport_Features SWI to access the MVFR registers */
482  {
483  _kernel_swi_regs regs;
484  regs.r[0] = 0;
485  if (_kernel_swi(VFPSupport_Features, &regs, &regs) == NULL) {
486  if ((regs.r[2] & 0xFFF000) == 0x111000) {
487  return 1;
488  }
489  }
490  return 0;
491  }
492 #else
493 #warning SDL_HasNEON is not implemented for this ARM platform. Write me.
494  return 0;
495 #endif
496 }

References NULL.

Referenced by SDL_GetCPUFeatures().

◆ SDL_GetCPUCacheLineSize()

int SDL_GetCPUCacheLineSize ( void  )

This function returns the L1 cache line size of the CPU

This is useful for determining multi-threaded structure padding or SIMD prefetch sizes.

Definition at line 698 of file SDL_cpuinfo.c.

699 {
700  const char *cpuType = SDL_GetCPUType();
701  int a, b, c, d;
702  (void) a; (void) b; (void) c; (void) d;
703  if (SDL_strcmp(cpuType, "GenuineIntel") == 0) {
704  cpuid(0x00000001, a, b, c, d);
705  return (((b >> 8) & 0xff) * 8);
706  } else if (SDL_strcmp(cpuType, "AuthenticAMD") == 0 || SDL_strcmp(cpuType, "HygonGenuine") == 0) {
707  cpuid(0x80000005, a, b, c, d);
708  return (c & 0xff);
709  } else {
710  /* Just make a guess here... */
711  return SDL_CACHELINE_SIZE;
712  }
713 }

References cpuid, d, SDL_CACHELINE_SIZE, SDL_GetCPUType(), SDL_strcmp, and void.

◆ SDL_GetCPUCount()

int SDL_GetCPUCount ( void  )

This function returns the number of CPU cores available.

Definition at line 548 of file SDL_cpuinfo.c.

549 {
550  if (!SDL_CPUCount) {
551 #ifndef SDL_CPUINFO_DISABLED
552 #if defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)
553  if (SDL_CPUCount <= 0) {
554  SDL_CPUCount = (int)sysconf(_SC_NPROCESSORS_ONLN);
555  }
556 #endif
557 #ifdef HAVE_SYSCTLBYNAME
558  if (SDL_CPUCount <= 0) {
559  size_t size = sizeof(SDL_CPUCount);
560  sysctlbyname("hw.ncpu", &SDL_CPUCount, &size, NULL, 0);
561  }
562 #endif
563 #ifdef __WIN32__
564  if (SDL_CPUCount <= 0) {
565  SYSTEM_INFO info;
566  GetSystemInfo(&info);
567  SDL_CPUCount = info.dwNumberOfProcessors;
568  }
569 #endif
570 #ifdef __OS2__
571  if (SDL_CPUCount <= 0) {
572  DosQuerySysInfo(QSV_NUMPROCESSORS, QSV_NUMPROCESSORS,
573  &SDL_CPUCount, sizeof(SDL_CPUCount) );
574  }
575 #endif
576 #endif
577  /* There has to be at least 1, right? :) */
578  if (SDL_CPUCount <= 0) {
579  SDL_CPUCount = 1;
580  }
581  }
582  return SDL_CPUCount;
583 }

References NULL, and SDL_CPUCount.

◆ SDL_GetCPUFeatures()

static Uint32 SDL_GetCPUFeatures ( void  )
static

Definition at line 719 of file SDL_cpuinfo.c.

720 {
721  if (SDL_CPUFeatures == 0xFFFFFFFF) {
723  SDL_CPUFeatures = 0;
724  SDL_SIMDAlignment = sizeof(void *); /* a good safe base value */
725  if (CPU_haveRDTSC()) {
727  }
728  if (CPU_haveAltiVec()) {
731  }
732  if (CPU_haveMMX()) {
735  }
736  if (CPU_have3DNow()) {
739  }
740  if (CPU_haveSSE()) {
743  }
744  if (CPU_haveSSE2()) {
747  }
748  if (CPU_haveSSE3()) {
751  }
752  if (CPU_haveSSE41()) {
755  }
756  if (CPU_haveSSE42()) {
759  }
760  if (CPU_haveAVX()) {
763  }
764  if (CPU_haveAVX2()) {
767  }
768  if (CPU_haveAVX512F()) {
771  }
772  if (CPU_haveARMSIMD()) {
775  }
776  if (CPU_haveNEON()) {
779  }
780  }
781  return SDL_CPUFeatures;
782 }

References CPU_calcCPUIDFeatures(), CPU_HAS_3DNOW, CPU_HAS_ALTIVEC, CPU_HAS_ARM_SIMD, CPU_HAS_AVX, CPU_HAS_AVX2, CPU_HAS_AVX512F, CPU_HAS_MMX, CPU_HAS_NEON, CPU_HAS_RDTSC, CPU_HAS_SSE, CPU_HAS_SSE2, CPU_HAS_SSE3, CPU_HAS_SSE41, CPU_HAS_SSE42, CPU_have3DNow(), CPU_haveAltiVec(), CPU_haveARMSIMD(), CPU_haveAVX, CPU_haveAVX2(), CPU_haveAVX512F(), CPU_haveMMX, CPU_haveNEON(), CPU_haveRDTSC, CPU_haveSSE, CPU_haveSSE2, CPU_haveSSE3, CPU_haveSSE41, CPU_haveSSE42, SDL_CPUFeatures, SDL_max, and SDL_SIMDAlignment.

Referenced by SDL_SIMDGetAlignment().

◆ SDL_GetCPUType()

static const char* SDL_GetCPUType ( void  )
static

Definition at line 587 of file SDL_cpuinfo.c.

588 {
589  static char SDL_CPUType[13];
590 
591  if (!SDL_CPUType[0]) {
592  int i = 0;
593 
595  if (CPU_CPUIDMaxFunction > 0) { /* do we have CPUID at all? */
596  int a, b, c, d;
597  cpuid(0x00000000, a, b, c, d);
598  (void) a;
599  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
600  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
601  SDL_CPUType[i++] = (char)(b & 0xff); b >>= 8;
602  SDL_CPUType[i++] = (char)(b & 0xff);
603 
604  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
605  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
606  SDL_CPUType[i++] = (char)(d & 0xff); d >>= 8;
607  SDL_CPUType[i++] = (char)(d & 0xff);
608 
609  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
610  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
611  SDL_CPUType[i++] = (char)(c & 0xff); c >>= 8;
612  SDL_CPUType[i++] = (char)(c & 0xff);
613  }
614  if (!SDL_CPUType[0]) {
615  SDL_strlcpy(SDL_CPUType, "Unknown", sizeof(SDL_CPUType));
616  }
617  }
618  return SDL_CPUType;
619 }

References CPU_calcCPUIDFeatures(), CPU_CPUIDMaxFunction, cpuid, d, i, SDL_strlcpy, and void.

Referenced by SDL_GetCPUCacheLineSize().

◆ SDL_GetSystemRAM()

int SDL_GetSystemRAM ( void  )

This function returns the amount of RAM configured in the system, in MB.

Definition at line 872 of file SDL_cpuinfo.c.

873 {
874  if (!SDL_SystemRAM) {
875 #ifndef SDL_CPUINFO_DISABLED
876 #if defined(HAVE_SYSCONF) && defined(_SC_PHYS_PAGES) && defined(_SC_PAGESIZE)
877  if (SDL_SystemRAM <= 0) {
878  SDL_SystemRAM = (int)((Sint64)sysconf(_SC_PHYS_PAGES) * sysconf(_SC_PAGESIZE) / (1024*1024));
879  }
880 #endif
881 #ifdef HAVE_SYSCTLBYNAME
882  if (SDL_SystemRAM <= 0) {
883 #if defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__NetBSD__)
884 #ifdef HW_REALMEM
885  int mib[2] = {CTL_HW, HW_REALMEM};
886 #else
887  /* might only report up to 2 GiB */
888  int mib[2] = {CTL_HW, HW_PHYSMEM};
889 #endif /* HW_REALMEM */
890 #else
891  int mib[2] = {CTL_HW, HW_MEMSIZE};
892 #endif /* __FreeBSD__ || __FreeBSD_kernel__ */
893  Uint64 memsize = 0;
894  size_t len = sizeof(memsize);
895 
896  if (sysctl(mib, 2, &memsize, &len, NULL, 0) == 0) {
897  SDL_SystemRAM = (int)(memsize / (1024*1024));
898  }
899  }
900 #endif
901 #ifdef __WIN32__
902  if (SDL_SystemRAM <= 0) {
903  MEMORYSTATUSEX stat;
904  stat.dwLength = sizeof(stat);
905  if (GlobalMemoryStatusEx(&stat)) {
906  SDL_SystemRAM = (int)(stat.ullTotalPhys / (1024 * 1024));
907  }
908  }
909 #endif
910 #ifdef __OS2__
911  if (SDL_SystemRAM <= 0) {
912  Uint32 sysram = 0;
913  DosQuerySysInfo(QSV_TOTPHYSMEM, QSV_TOTPHYSMEM, &sysram, 4);
914  SDL_SystemRAM = (int) (sysram / 0x100000U);
915  }
916 #endif
917 #ifdef __RISCOS__
918  if (SDL_SystemRAM <= 0) {
919  _kernel_swi_regs regs;
920  regs.r[0] = 0x108;
921  if (_kernel_swi(OS_Memory, &regs, &regs) == NULL) {
922  SDL_SystemRAM = (int)(regs.r[1] * regs.r[2] / (1024 * 1024));
923  }
924  }
925 #endif
926 #endif
927  }
928  return SDL_SystemRAM;
929 }

References NULL, and SDL_SystemRAM.

◆ SDL_Has3DNow()

SDL_bool SDL_Has3DNow ( void  )

This function returns true if the CPU has 3DNow! features.

Definition at line 804 of file SDL_cpuinfo.c.

805 {
807 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_3DNOW.

◆ SDL_HasAltiVec()

SDL_bool SDL_HasAltiVec ( void  )

This function returns true if the CPU has AltiVec features.

Definition at line 792 of file SDL_cpuinfo.c.

793 {
795 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_ALTIVEC.

◆ SDL_HasARMSIMD()

SDL_bool SDL_HasARMSIMD ( void  )

This function returns true if the CPU has ARM SIMD (ARMv6) features.

Definition at line 858 of file SDL_cpuinfo.c.

859 {
861 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_ARM_SIMD.

◆ SDL_HasAVX()

SDL_bool SDL_HasAVX ( void  )

This function returns true if the CPU has AVX features.

Definition at line 840 of file SDL_cpuinfo.c.

841 {
843 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_AVX.

◆ SDL_HasAVX2()

SDL_bool SDL_HasAVX2 ( void  )

This function returns true if the CPU has AVX2 features.

Definition at line 846 of file SDL_cpuinfo.c.

847 {
849 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_AVX2.

◆ SDL_HasAVX512F()

SDL_bool SDL_HasAVX512F ( void  )

This function returns true if the CPU has AVX-512F (foundation) features.

Definition at line 852 of file SDL_cpuinfo.c.

853 {
855 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_AVX512F.

◆ SDL_HasMMX()

SDL_bool SDL_HasMMX ( void  )

This function returns true if the CPU has MMX features.

Definition at line 798 of file SDL_cpuinfo.c.

799 {
801 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_MMX.

◆ SDL_HasNEON()

SDL_bool SDL_HasNEON ( void  )

This function returns true if the CPU has NEON (ARM SIMD) features.

Definition at line 864 of file SDL_cpuinfo.c.

865 {
867 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_NEON.

◆ SDL_HasRDTSC()

SDL_bool SDL_HasRDTSC ( void  )

This function returns true if the CPU has the RDTSC instruction.

Definition at line 786 of file SDL_cpuinfo.c.

787 {
789 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_RDTSC.

◆ SDL_HasSSE()

SDL_bool SDL_HasSSE ( void  )

This function returns true if the CPU has SSE features.

Definition at line 810 of file SDL_cpuinfo.c.

811 {
813 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE.

◆ SDL_HasSSE2()

SDL_bool SDL_HasSSE2 ( void  )

This function returns true if the CPU has SSE2 features.

Definition at line 816 of file SDL_cpuinfo.c.

817 {
819 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE2.

◆ SDL_HasSSE3()

SDL_bool SDL_HasSSE3 ( void  )

This function returns true if the CPU has SSE3 features.

Definition at line 822 of file SDL_cpuinfo.c.

823 {
825 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE3.

◆ SDL_HasSSE41()

SDL_bool SDL_HasSSE41 ( void  )

This function returns true if the CPU has SSE4.1 features.

Definition at line 828 of file SDL_cpuinfo.c.

829 {
831 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE41.

◆ SDL_HasSSE42()

SDL_bool SDL_HasSSE42 ( void  )

This function returns true if the CPU has SSE4.2 features.

Definition at line 834 of file SDL_cpuinfo.c.

835 {
837 }

References CPU_FEATURE_AVAILABLE, and CPU_HAS_SSE42.

◆ SDL_SIMDAlloc()

void* SDL_SIMDAlloc ( const size_t  len)

Allocate memory in a SIMD-friendly way.

This will allocate a block of memory that is suitable for use with SIMD instructions. Specifically, it will be properly aligned and padded for the system's supported vector instructions.

The memory returned will be padded such that it is safe to read or write an incomplete vector at the end of the memory block. This can be useful so you don't have to drop back to a scalar fallback at the end of your SIMD processing loop to deal with the final elements without overflowing the allocated buffer.

You must free this memory with SDL_FreeSIMD(), not free() or SDL_free() or delete[], etc.

Note that SDL will only deal with SIMD instruction sets it is aware of; for example, SDL 2.0.8 knows that SSE wants 16-byte vectors (SDL_HasSSE()), and AVX2 wants 32 bytes (SDL_HasAVX2()), but doesn't know that AVX-512 wants 64. To be clear: if you can't decide to use an instruction set with an SDL_Has*() function, don't use that instruction set with memory allocated through here.

SDL_AllocSIMD(0) will return a non-NULL pointer, assuming the system isn't out of memory.

Parameters
lenThe length, in bytes, of the block to allocated. The actual allocated block might be larger due to padding, etc.
Returns
Pointer to newly-allocated block, NULL if out of memory.
See also
SDL_SIMDAlignment
SDL_SIMDFree

Definition at line 943 of file SDL_cpuinfo.c.

944 {
945  const size_t alignment = SDL_SIMDGetAlignment();
946  const size_t padding = alignment - (len % alignment);
947  const size_t padded = (padding != alignment) ? (len + padding) : len;
948  Uint8 *retval = NULL;
949  Uint8 *ptr = (Uint8 *) SDL_malloc(padded + alignment + sizeof (void *));
950  if (ptr) {
951  /* store the actual malloc pointer right before our aligned pointer. */
952  retval = ptr + sizeof (void *);
953  retval += alignment - (((size_t) retval) % alignment);
954  *(((void **) retval) - 1) = ptr;
955  }
956  return retval;
957 }

References NULL, ptr, retval, SDL_malloc, and SDL_SIMDGetAlignment().

◆ SDL_SIMDFree()

void SDL_SIMDFree ( void ptr)

Deallocate memory obtained from SDL_SIMDAlloc.

It is not valid to use this function on a pointer from anything but SDL_SIMDAlloc(). It can't be used on pointers from malloc, realloc, SDL_malloc, memalign, new[], etc.

However, SDL_SIMDFree(NULL) is a legal no-op.

See also
SDL_SIMDAlloc

Definition at line 960 of file SDL_cpuinfo.c.

961 {
962  if (ptr) {
963  void **realptr = (void **) ptr;
964  realptr--;
965  SDL_free(*(((void **) ptr) - 1));
966  }
967 }

References ptr, and SDL_free.

◆ SDL_SIMDGetAlignment()

size_t SDL_SIMDGetAlignment ( void  )

Report the alignment this system needs for SIMD allocations.

This will return the minimum number of bytes to which a pointer must be aligned to be compatible with SIMD instructions on the current machine. For example, if the machine supports SSE only, it will return 16, but if it supports AVX-512F, it'll return 64 (etc). This only reports values for instruction sets SDL knows about, so if your SDL build doesn't have SDL_HasAVX512F(), then it might return 16 for the SSE support it sees and not 64 for the AVX-512 instructions that exist but SDL doesn't know about. Plan accordingly.

Definition at line 933 of file SDL_cpuinfo.c.

934 {
935  if (SDL_SIMDAlignment == 0xFFFFFFFF) {
936  SDL_GetCPUFeatures(); /* make sure this has been calculated */
937  }
939  return SDL_SIMDAlignment;
940 }

References SDL_assert, SDL_GetCPUFeatures(), and SDL_SIMDAlignment.

Referenced by SDL_SIMDAlloc().

Variable Documentation

◆ CPU_CPUIDFeatures

int CPU_CPUIDFeatures[4]
static

Definition at line 267 of file SDL_cpuinfo.c.

Referenced by CPU_calcCPUIDFeatures().

◆ CPU_CPUIDMaxFunction

int CPU_CPUIDMaxFunction = 0
static

◆ CPU_OSSavesYMM

SDL_bool CPU_OSSavesYMM = SDL_FALSE
static

Definition at line 269 of file SDL_cpuinfo.c.

Referenced by CPU_calcCPUIDFeatures(), and CPU_haveAVX2().

◆ CPU_OSSavesZMM

SDL_bool CPU_OSSavesZMM = SDL_FALSE
static

Definition at line 270 of file SDL_cpuinfo.c.

Referenced by CPU_calcCPUIDFeatures(), and CPU_haveAVX512F().

◆ SDL_CPUCount

int SDL_CPUCount = 0
static

Definition at line 545 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUCount().

◆ SDL_CPUFeatures

Uint32 SDL_CPUFeatures = 0xFFFFFFFF
static

Definition at line 715 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures().

◆ SDL_SIMDAlignment

Uint32 SDL_SIMDAlignment = 0xFFFFFFFF
static

Definition at line 716 of file SDL_cpuinfo.c.

Referenced by SDL_GetCPUFeatures(), and SDL_SIMDGetAlignment().

◆ SDL_SystemRAM

int SDL_SystemRAM = 0
static

Definition at line 869 of file SDL_cpuinfo.c.

Referenced by SDL_GetSystemRAM().

CPU_haveMMX
#define CPU_haveMMX()
Definition: SDL_cpuinfo.c:513
Uint8
uint8_t Uint8
Definition: SDL_stdinc.h:179
c
const GLubyte * c
Definition: SDL_opengl_glext.h:11096
SDL_CACHELINE_SIZE
#define SDL_CACHELINE_SIZE
Definition: SDL_cpuinfo.h:114
CPU_OSSavesZMM
static SDL_bool CPU_OSSavesZMM
Definition: SDL_cpuinfo.c:270
CPU_haveAltiVec
static int CPU_haveAltiVec(void)
Definition: SDL_cpuinfo.c:313
Sint64
int64_t Sint64
Definition: SDL_stdinc.h:210
SDL_GetCPUType
static const char * SDL_GetCPUType(void)
Definition: SDL_cpuinfo.c:587
SDL_strlcpy
#define SDL_strlcpy
Definition: SDL_dynapi_overrides.h:394
SDL_CPUFeatures
static Uint32 SDL_CPUFeatures
Definition: SDL_cpuinfo.c:715
SDL_GetCPUFeatures
static Uint32 SDL_GetCPUFeatures(void)
Definition: SDL_cpuinfo.c:719
CPU_HAS_SSE
#define CPU_HAS_SSE
Definition: SDL_cpuinfo.c:102
in
GLuint in
Definition: SDL_opengl_glext.h:7943
NULL
#define NULL
Definition: begin_code.h:167
b
GLboolean GLboolean GLboolean b
Definition: SDL_opengl_glext.h:1112
CPU_haveAVX
#define CPU_haveAVX()
Definition: SDL_cpuinfo.c:519
CPU_HAS_SSE41
#define CPU_HAS_SSE41
Definition: SDL_cpuinfo.c:105
size_t
unsigned int size_t
Definition: SDL_config_windows.h:68
CPU_HAS_AVX2
#define CPU_HAS_AVX2
Definition: SDL_cpuinfo.c:108
CPU_HAS_ALTIVEC
#define CPU_HAS_ALTIVEC
Definition: SDL_cpuinfo.c:99
SDL_SystemRAM
static int SDL_SystemRAM
Definition: SDL_cpuinfo.c:869
CPU_haveCPUID
static int CPU_haveCPUID(void)
Definition: SDL_cpuinfo.c:126
CPU_HAS_3DNOW
#define CPU_HAS_3DNOW
Definition: SDL_cpuinfo.c:101
Uint32
uint32_t Uint32
Definition: SDL_stdinc.h:203
CPU_FEATURE_AVAILABLE
#define CPU_FEATURE_AVAILABLE(f)
Definition: SDL_cpuinfo.c:784
a
GLboolean GLboolean GLboolean GLboolean a
Definition: SDL_opengl_glext.h:1112
h
GLfloat GLfloat GLfloat GLfloat h
Definition: SDL_opengl_glext.h:1949
length
GLuint GLsizei GLsizei * length
Definition: SDL_opengl_glext.h:672
CPU_HAS_NEON
#define CPU_HAS_NEON
Definition: SDL_cpuinfo.c:109
CPU_HAS_SSE42
#define CPU_HAS_SSE42
Definition: SDL_cpuinfo.c:106
SDL_SIMDAlignment
static Uint32 SDL_SIMDAlignment
Definition: SDL_cpuinfo.c:716
CPU_haveSSE
#define CPU_haveSSE()
Definition: SDL_cpuinfo.c:514
CPU_HAS_ARM_SIMD
#define CPU_HAS_ARM_SIMD
Definition: SDL_cpuinfo.c:111
len
GLenum GLsizei len
Definition: SDL_opengl_glext.h:2929
done
int done
Definition: checkkeys.c:28
retval
SDL_bool retval
Definition: testgamecontroller.c:65
SDL_free
#define SDL_free
Definition: SDL_dynapi_overrides.h:377
SDL_max
#define SDL_max(x, y)
Definition: SDL_stdinc.h:407
CPU_HAS_SSE2
#define CPU_HAS_SSE2
Definition: SDL_cpuinfo.c:103
mov
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF base if bpp PF set rept prefetch_distance PF set OFFSET endr endif endm macro preload_leading_step2 base if bpp ifc DST PF PF else if bpp lsl PF PF lsl PF PF lsl PF PF PF else PF mov
Definition: pixman-arm-simd-asm.h:214
CPU_haveSSE41
#define CPU_haveSSE41()
Definition: SDL_cpuinfo.c:517
CPU_HAS_RDTSC
#define CPU_HAS_RDTSC
Definition: SDL_cpuinfo.c:98
CPU_HAS_AVX512F
#define CPU_HAS_AVX512F
Definition: SDL_cpuinfo.c:110
CPU_haveNEON
static int CPU_haveNEON(void)
Definition: SDL_cpuinfo.c:439
SDL_SIMDGetAlignment
size_t SDL_SIMDGetAlignment(void)
Report the alignment this system needs for SIMD allocations.
Definition: SDL_cpuinfo.c:933
pop
#define pop
Definition: SDL_qsort.c:196
CPU_HAS_MMX
#define CPU_HAS_MMX
Definition: SDL_cpuinfo.c:100
SDL_TRUE
@ SDL_TRUE
Definition: SDL_stdinc.h:164
SDL_assert
#define SDL_assert(condition)
Definition: SDL_assert.h:169
CPU_calcCPUIDFeatures
static void CPU_calcCPUIDFeatures(void)
Definition: SDL_cpuinfo.c:273
size
GLsizeiptr size
Definition: SDL_opengl_glext.h:540
CPU_haveSSE2
#define CPU_haveSSE2()
Definition: SDL_cpuinfo.c:515
value
GLsizei const GLfloat * value
Definition: SDL_opengl_glext.h:701
CPU_CPUIDFeatures
static int CPU_CPUIDFeatures[4]
Definition: SDL_cpuinfo.c:267
Uint64
uint64_t Uint64
Definition: SDL_stdinc.h:216
CPU_haveSSE42
#define CPU_haveSSE42()
Definition: SDL_cpuinfo.c:518
CPU_OSSavesYMM
static SDL_bool CPU_OSSavesYMM
Definition: SDL_cpuinfo.c:269
CPU_HAS_SSE3
#define CPU_HAS_SSE3
Definition: SDL_cpuinfo.c:104
CPU_have3DNow
static int CPU_have3DNow(void)
Definition: SDL_cpuinfo.c:499
SDL_bool
SDL_bool
Definition: SDL_stdinc.h:162
SDL_FALSE
@ SDL_FALSE
Definition: SDL_stdinc.h:163
cpuid
#define cpuid(func, a, b, c, d)
Definition: SDL_cpuinfo.c:263
CPU_haveAVX512F
static int CPU_haveAVX512F(void)
Definition: SDL_cpuinfo.c:534
CPU_HAS_AVX
#define CPU_HAS_AVX
Definition: SDL_cpuinfo.c:107
SDL_malloc
#define SDL_malloc
Definition: SDL_dynapi_overrides.h:374
SDL_strcmp
#define SDL_strcmp
Definition: SDL_dynapi_overrides.h:417
void
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 void
Definition: SDL_dynapi_procs.h:89
CPU_haveARMSIMD
static int CPU_haveARMSIMD(void)
Definition: SDL_cpuinfo.c:350
ptr
set set set set set set set set set set set set set set set set set set set set *set set set macro pixldst op &r &cond WK op &r &cond WK op &r &cond WK else op &m &cond &ia op &r &cond WK else op &m &cond &ia elseif elseif else error unsupported base if elseif elseif else error unsupported unaligned pixldst unaligned endm macro pixst base base else pixldst base endif endm macro PF ptr
Definition: pixman-arm-simd-asm.h:171
CPU_haveAVX2
static int CPU_haveAVX2(void)
Definition: SDL_cpuinfo.c:522
uint64_t
unsigned long long uint64_t
Definition: SDL_config_windows.h:65
CPU_CPUIDMaxFunction
static int CPU_CPUIDMaxFunction
Definition: SDL_cpuinfo.c:268
i
return Display return Display Bool Bool int int int return Display XEvent Bool(*) XPointer return Display return Display Drawable _Xconst char unsigned int unsigned int return Display Pixmap Pixmap XColor XColor unsigned int unsigned int return Display _Xconst char char int char return Display Visual unsigned int int int char unsigned int unsigned int in i)
Definition: SDL_x11sym.h:50
CPU_haveSSE3
#define CPU_haveSSE3()
Definition: SDL_cpuinfo.c:516
d
SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char int SDL_PRINTF_FORMAT_STRING const char const char SDL_SCANF_FORMAT_STRING const char return SDL_ThreadFunction const char void return Uint32 return Uint32 SDL_AssertionHandler void SDL_SpinLock SDL_atomic_t int int return SDL_atomic_t return void void void return void return int return SDL_AudioSpec SDL_AudioSpec return int int return return int SDL_RWops int SDL_AudioSpec Uint8 ** d
Definition: SDL_dynapi_procs.h:117
SDL_CPUCount
static int SDL_CPUCount
Definition: SDL_cpuinfo.c:545
CPU_haveRDTSC
#define CPU_haveRDTSC()
Definition: SDL_cpuinfo.c:512