1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/media/libvpx/vpx_ports/x86_cpuid.c Wed Dec 31 06:09:35 2014 +0100 1.3 @@ -0,0 +1,49 @@ 1.4 +/* 1.5 + * Copyright (c) 2010 The WebM project authors. All Rights Reserved. 1.6 + * 1.7 + * Use of this source code is governed by a BSD-style license 1.8 + * that can be found in the LICENSE file in the root of the source 1.9 + * tree. An additional intellectual property rights grant can be found 1.10 + * in the file PATENTS. All contributing project authors may 1.11 + * be found in the AUTHORS file in the root of the source tree. 1.12 + */ 1.13 + 1.14 +#include <string.h> 1.15 +#include "x86.h" 1.16 + 1.17 +struct cpuid_vendors { 1.18 + char vendor_string[12]; 1.19 + vpx_cpu_t vendor_id; 1.20 +}; 1.21 + 1.22 +static struct cpuid_vendors cpuid_vendor_list[VPX_CPU_LAST] = { 1.23 + { "AuthenticAMD", VPX_CPU_AMD }, 1.24 + { "AMDisbetter!", VPX_CPU_AMD_OLD }, 1.25 + { "CentaurHauls", VPX_CPU_CENTAUR }, 1.26 + { "CyrixInstead", VPX_CPU_CYRIX }, 1.27 + { "GenuineIntel", VPX_CPU_INTEL }, 1.28 + { "NexGenDriven", VPX_CPU_NEXGEN }, 1.29 + { "Geode by NSC", VPX_CPU_NSC }, 1.30 + { "RiseRiseRise", VPX_CPU_RISE }, 1.31 + { "SiS SiS SiS ", VPX_CPU_SIS }, 1.32 + { "GenuineTMx86", VPX_CPU_TRANSMETA }, 1.33 + { "TransmetaCPU", VPX_CPU_TRANSMETA_OLD }, 1.34 + { "UMC UMC UMC ", VPX_CPU_UMC }, 1.35 + { "VIA VIA VIA ", VPX_CPU_VIA }, 1.36 +}; 1.37 + 1.38 +vpx_cpu_t vpx_x86_vendor(void) { 1.39 + unsigned int reg_eax; 1.40 + unsigned int vs[3]; 1.41 + int i; 1.42 + 1.43 + /* Get the Vendor String from the CPU */ 1.44 + cpuid(0, reg_eax, vs[0], vs[2], vs[1]); 1.45 + 1.46 + for (i = 0; i < VPX_CPU_LAST; i++) { 1.47 + if (strncmp((const char *)vs, cpuid_vendor_list[i].vendor_string, 12) == 0) 1.48 + return (cpuid_vendor_list[i].vendor_id); 1.49 + } 1.50 + 1.51 + return VPX_CPU_UNKNOWN; 1.52 +}