Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
V
vlc-2-2
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Redmine
Redmine
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Metrics
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
videolan
vlc-2-2
Commits
e8b8ef77
Commit
e8b8ef77
authored
Aug 19, 2011
by
Rémi Denis-Courmont
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Clean up CPU flags one-time initialization
parent
78b320f2
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
18 additions
and
21 deletions
+18
-21
src/libvlc.c
src/libvlc.c
+0
-2
src/libvlc.h
src/libvlc.h
+1
-6
src/misc/cpu.c
src/misc/cpu.c
+16
-13
src/win32/thread.c
src/win32/thread.c
+1
-0
No files found.
src/libvlc.c
View file @
e8b8ef77
...
...
@@ -191,8 +191,6 @@ libvlc_int_t * libvlc_InternalCreate( void )
vlc_mutex_lock
(
&
global_lock
);
if
(
i_instances
==
0
)
{
/* Guess what CPU we have */
cpu_flags
=
CPUCapabilities
();
/* The module bank will be initialized later */
}
...
...
src/libvlc.h
View file @
e8b8ef77
...
...
@@ -41,6 +41,7 @@ void system_Init ( void );
void
system_Configure
(
libvlc_int_t
*
,
int
,
const
char
*
const
[]
);
void
system_End
(
void
);
void
vlc_CPU_init
(
void
);
void
vlc_CPU_dump
(
vlc_object_t
*
);
/*
...
...
@@ -65,12 +66,6 @@ void vlc_assert_locked (vlc_mutex_t *);
# define vlc_assert_locked( m ) (void)m
#endif
/*
* CPU capabilities
*/
extern
uint32_t
cpu_flags
;
uint32_t
CPUCapabilities
(
void
);
/*
* LibVLC exit event handling
*/
...
...
src/misc/cpu.c
View file @
e8b8ef77
...
...
@@ -49,6 +49,8 @@
#include "libvlc.h"
static
uint32_t
cpu_flags
;
#if defined( __i386__ ) || defined( __x86_64__ ) || defined( __powerpc__ ) \
|| defined( __ppc__ ) || defined( __ppc64__ ) || defined( __powerpc64__ )
# ifndef WIN32
...
...
@@ -90,12 +92,11 @@ static bool check_OS_capability( const char *psz_capability, pid_t pid )
# endif
#endif
/*****************************************************************************
* CPUCapabilities: get the CPU capabilities
*****************************************************************************
* This function is called to list extensions the CPU may have.
*****************************************************************************/
uint32_t
CPUCapabilities
(
void
)
/**
* Determines the CPU capabilities and stores them in cpu_flags.
* The result can be retrieved with vlc_CPU().
*/
void
vlc_CPU_init
(
void
)
{
uint32_t
i_capabilities
=
0
;
...
...
@@ -322,17 +323,19 @@ out:
# endif
#endif
return
i_capabilities
;
}
uint32_t
cpu_flags
=
0
;
cpu_flags
=
i_capabilities
;
}
/**
***************************************************************************
*
vlc_CPU: get
pre-computed CPU capability flags
*
***************************************************************************
/
/**
*
Retrieves
pre-computed CPU capability flags
*/
unsigned
vlc_CPU
(
void
)
{
#ifndef WIN32
/* On Windows, initialized from DllMain() instead */
static
pthread_once_t
once
=
PTHREAD_ONCE_INIT
;
pthread_once
(
&
once
,
vlc_CPU_init
);
#endif
return
cpu_flags
;
}
...
...
src/win32/thread.c
View file @
e8b8ef77
...
...
@@ -82,6 +82,7 @@ BOOL WINAPI DllMain (HINSTANCE hinstDll, DWORD fdwReason, LPVOID lpvReserved)
vlc_threadvar_create
(
&
thread_key
,
NULL
);
vlc_rwlock_init
(
&
config_lock
);
vlc_rwlock_init
(
&
msg_lock
);
vlc_CPU_init
();
break
;
case
DLL_PROCESS_DETACH
:
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment