3 * Copyright (C) 1999-2000 Aaron Holtzman <aholtzma@ess.engr.uvic.ca>
5 * This file is part of mpeg2dec, a free MPEG-2 video stream decoder.
7 * mpeg2dec is free software; you can redistribute it and/or modify
8 * it under the terms of the GNU General Public License as published by
9 * the Free Software Foundation; either version 2 of the License, or
10 * (at your option) any later version.
12 * mpeg2dec is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15 * GNU General Public License for more details.
17 * You should have received a copy of the GNU General Public License
18 * along with this program; if not, write to the Free Software
19 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
25 #include "cpu_accel.h"
28 static int x86_accel (void)
30 int eax, ebx, ecx, edx;
34 #define cpuid(op,eax,ebx,ecx,edx) \
46 "xorl $0x200000,%0\n\t"
56 if (eax == ebx) // no cpuid
59 cpuid (0x00000000, eax, ebx, ecx, edx);
60 if (!eax) // vendor string only
63 AMD = (ebx == 0x68747541) && (ecx == 0x444d4163) && (edx == 0x69746e65);
65 cpuid (0x00000001, eax, ebx, ecx, edx);
66 if (! (edx & 0x00800000)) // no MMX
70 if (edx & 0x02000000) // SSE - identical to AMD MMX extensions
71 caps = ACCEL_X86_MMX | ACCEL_X86_MMXEXT;
73 cpuid (0x80000000, eax, ebx, ecx, edx);
74 if (eax < 0x80000001) // no extended capabilities
77 cpuid (0x80000001, eax, ebx, ecx, edx);
80 caps |= ACCEL_X86_3DNOW;
82 if (AMD && (edx & 0x00400000)) // AMD MMX extensions
84 caps |= ACCEL_X86_MMXEXT;
94 static int got_accel = 0;