mirror of
https://github.com/game-stop/veejay.git
synced 2025-12-15 12:20:03 +01:00
drop VEEJAY_SET_CPU, does not work (anymore) . Fix composite mode bug in switching samples
git-svn-id: svn://code.dyne.org/veejay/trunk@1287 eb8d1916-c9e9-0310-b8de-cf0c9472ead5
This commit is contained in:
@@ -1433,12 +1433,20 @@ int sample_load_composite_config( void *compiz, int s1 )
|
|||||||
|
|
||||||
int val = 0;
|
int val = 0;
|
||||||
void *temp = composite_load_config( compiz, sample->viewport_config , &val );
|
void *temp = composite_load_config( compiz, sample->viewport_config , &val );
|
||||||
if( temp == NULL || val == -1 )
|
if( temp == NULL || val == -1 ) {
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
veejay_msg(VEEJAY_MSG_DEBUG,"No composite config for sample %d",s1);
|
||||||
|
#endif
|
||||||
return 0;
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
sample->composite = val;
|
sample->composite = val;
|
||||||
sample->viewport = temp;
|
sample->viewport = temp;
|
||||||
sample_update(sample,s1);
|
sample_update(sample,s1);
|
||||||
|
#ifdef STRICT_CHECKING
|
||||||
|
veejay_msg(VEEJAY_MSG_DEBUG, "Loaded config for sample %d, mode %d",
|
||||||
|
s1, val );
|
||||||
|
#endif
|
||||||
return sample->composite;
|
return sample->composite;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -116,7 +116,6 @@ void veejay_set_instance( veejay_t *info )
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static int veejay_pin_cpu( veejay_t *info, int cpu_num );
|
|
||||||
static void veejay_schedule_fifo( veejay_t *info, int pid );
|
static void veejay_schedule_fifo( veejay_t *info, int pid );
|
||||||
|
|
||||||
// following struct copied from ../utils/videodev.h
|
// following struct copied from ../utils/videodev.h
|
||||||
@@ -709,9 +708,8 @@ static int veejay_start_playing_sample( veejay_t *info, int sample_id )
|
|||||||
int cur_composite = info->settings->composite;
|
int cur_composite = info->settings->composite;
|
||||||
info->settings->composite = sample_load_composite_config( info->composite , sample_id );
|
info->settings->composite = sample_load_composite_config( info->composite , sample_id );
|
||||||
void *cur = sample_get_composite_view(sample_id);
|
void *cur = sample_get_composite_view(sample_id);
|
||||||
|
|
||||||
switch(info->settings->composite) {
|
switch(info->settings->composite) {
|
||||||
case 1:
|
case 1:
|
||||||
case 2:
|
case 2:
|
||||||
#ifdef STRICT_CHECKING
|
#ifdef STRICT_CHECKING
|
||||||
assert( cur != NULL );
|
assert( cur != NULL );
|
||||||
@@ -720,7 +718,7 @@ static int veejay_start_playing_sample( veejay_t *info, int sample_id )
|
|||||||
veejay_msg(VEEJAY_MSG_INFO, "Using perspective transform for this Sample");
|
veejay_msg(VEEJAY_MSG_INFO, "Using perspective transform for this Sample");
|
||||||
break;
|
break;
|
||||||
case 0:
|
case 0:
|
||||||
info->settings->composite = cur_composite;
|
info->settings->composite = 2; //cur_composite;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -787,7 +785,7 @@ static int veejay_start_playing_stream(veejay_t *info, int stream_id )
|
|||||||
composite_set_backing(info->composite,cur);
|
composite_set_backing(info->composite,cur);
|
||||||
veejay_msg(VEEJAY_MSG_INFO, "Using perspective transform for this Stream");
|
veejay_msg(VEEJAY_MSG_INFO, "Using perspective transform for this Stream");
|
||||||
break;
|
break;
|
||||||
case 0: info->settings->composite = cur_composite; break;
|
case 0: info->settings->composite = 2; break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2107,9 +2105,6 @@ int veejay_init(veejay_t * info, int x, int y,char *arg, int def_tags)
|
|||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
info->settings->zoom = 0;
|
info->settings->zoom = 0;
|
||||||
/* start with calibration on secundary inputs */
|
|
||||||
if(!has_config)
|
|
||||||
info->settings->composite = 2;
|
|
||||||
}
|
}
|
||||||
if(!has_config) {
|
if(!has_config) {
|
||||||
if(info->video_output_width <= 0 ) {
|
if(info->video_output_width <= 0 ) {
|
||||||
@@ -2375,64 +2370,6 @@ static void veejay_schedule_fifo(veejay_t *info, int pid )
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
|
||||||
* pin_cpu: snapped from lm-sensors project
|
|
||||||
*
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
|
|
||||||
static int veejay_pin_cpu( veejay_t *info, int cpu_num )
|
|
||||||
{
|
|
||||||
uint32_t st = sizeof(cpu_set_t);
|
|
||||||
|
|
||||||
int i,j,retval;
|
|
||||||
if( info->cpumask == NULL )
|
|
||||||
{
|
|
||||||
info->sz = 1 + (2 * sched_ncpus()) / (8 * sizeof(unsigned long));
|
|
||||||
info->mask = (unsigned long*) vj_calloc( st );
|
|
||||||
info->cpumask = (unsigned long*) vj_calloc( st);
|
|
||||||
retval = sched_getaffinity(0, st, info->cpumask );
|
|
||||||
if( retval < 0 )
|
|
||||||
{
|
|
||||||
veejay_msg(0,"sched_getaffinity()");
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
for( i = 0; i < st; ++ i )
|
|
||||||
{
|
|
||||||
int word = i / (8 * sizeof(unsigned long));
|
|
||||||
int bit = i % (8 * sizeof(unsigned long));
|
|
||||||
if( info->cpumask[word] & (1 << bit))
|
|
||||||
info->ncpus++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
cpu_num %= info->ncpus;
|
|
||||||
|
|
||||||
veejay_memset( info->mask, 0, st );
|
|
||||||
|
|
||||||
for ( i = 0, j = 0; i < st; ++ i )
|
|
||||||
{
|
|
||||||
int word = i / (8 * sizeof(unsigned long));
|
|
||||||
int bit = i % (8 * sizeof(unsigned long));
|
|
||||||
if( info->cpumask[word] & (1 << bit ))
|
|
||||||
{
|
|
||||||
if( j >= cpu_num ) {
|
|
||||||
info->mask[word] |= ( 1 << bit );
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
j++;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int pi = (int) getpid();
|
|
||||||
|
|
||||||
retval = sched_setaffinity( pi, st, info->mask );
|
|
||||||
|
|
||||||
return retval;
|
|
||||||
}
|
|
||||||
|
|
||||||
/******************************************************
|
/******************************************************
|
||||||
* veejay_playback_cycle()
|
* veejay_playback_cycle()
|
||||||
* the playback cycle
|
* the playback cycle
|
||||||
@@ -2453,26 +2390,9 @@ static void veejay_playback_cycle(veejay_t * info)
|
|||||||
|
|
||||||
veejay_set_instance( info );
|
veejay_set_instance( info );
|
||||||
|
|
||||||
int which_cpu = -1;
|
if( settings->ncpu > 1 )
|
||||||
char *env_value = getenv( "VEEJAY_SET_CPU" );
|
|
||||||
if( env_value )
|
|
||||||
{
|
{
|
||||||
if( sscanf( env_value, "%d", &which_cpu ))
|
veejay_msg(VEEJAY_MSG_INFO, "Found %d cores.", settings->ncpu);
|
||||||
{
|
|
||||||
if( which_cpu < 0 || which_cpu > settings->ncpu )
|
|
||||||
{
|
|
||||||
veejay_msg(VEEJAY_MSG_ERROR, "VEEJAY_SET_CPU valid values are [%d ... %d]", 0, settings->ncpu );
|
|
||||||
which_cpu = -1;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
veejay_msg(VEEJAY_MSG_INFO, "VEEJAY_SET_CPU set to CPU %d", which_cpu );
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( settings->ncpu > 1 && which_cpu >= 0 && which_cpu < settings->ncpu)
|
|
||||||
{
|
|
||||||
veejay_msg(VEEJAY_MSG_INFO, "Found %d cores, locking core %d for rendering purposes", settings->ncpu,which_cpu);
|
|
||||||
veejay_pin_cpu( info, which_cpu );
|
|
||||||
}
|
}
|
||||||
info->uc->playback_mode = info->settings->late[0];
|
info->uc->playback_mode = info->settings->late[0];
|
||||||
info->uc->sample_id = info->settings->late[1];
|
info->uc->sample_id = info->settings->late[1];
|
||||||
@@ -3131,7 +3051,7 @@ int veejay_main(veejay_t * info)
|
|||||||
veejay_msg(VEEJAY_MSG_INFO, "Starting playback thread. Giving control to main app");
|
veejay_msg(VEEJAY_MSG_INFO, "Starting playback thread. Giving control to main app");
|
||||||
|
|
||||||
/* fork ourselves to return control to the main app */
|
/* fork ourselves to return control to the main app */
|
||||||
if (pthread_create(&(settings->playback_thread), NULL,
|
if (pthread_create(&(settings->playback_thread),NULL,
|
||||||
veejay_playback_thread, (void *) info)) {
|
veejay_playback_thread, (void *) info)) {
|
||||||
veejay_msg(VEEJAY_MSG_ERROR, "Failed to create thread");
|
veejay_msg(VEEJAY_MSG_ERROR, "Failed to create thread");
|
||||||
return -1;
|
return -1;
|
||||||
|
|||||||
@@ -644,7 +644,7 @@ int main(int argc, char **argv)
|
|||||||
vj_osc_allocate(VJ_PORT+2);
|
vj_osc_allocate(VJ_PORT+2);
|
||||||
vj_event_dump();
|
vj_event_dump();
|
||||||
vj_effect_dump();
|
vj_effect_dump();
|
||||||
fprintf(stdout, "Environment variables:\n\tSDL_VIDEO_HWACCEL\t\tSet to 1 to use SDL video hardware accel (default=on)\n\tVEEJAY_PERFORMANCE\t\tSet to \"quality\" or \"fastest\" (default is fastest)\n\tVEEJAY_AUTO_SCALE_PIXELS\tSet to 1 to convert between CCIR 601 and JPEG automatically (default=dont care)\n\tVEEJAY_INTERPOLATE_CHROMA\tSet to 1 if you wish to interpolate every chroma sample when scaling (default=0)\n\tVEEJAY_SET_CPU\t\t\tLock the veejay render/playback thread to a specific core, use 0-[num cpu's] (default=dont lock)\n\tVEEJAY_CAPTURE_DRIVER\t\tSet to \"unicap\" or \"v4lutils\" (default=v4lutils)\n\tVEEJAY_SDL_KEY_REPEAT_INTERVAL\tinterval of key pressed to repeat while pressed down.\n\tVEEJAY_PLAYBACK_CACHE\t\tSample cache size in MB - by default, veejay takes 30 percent of total RAM\n\tVEEJAY_SDL_KEY_REPEAT_DELAY\tDelay key repeat in ms\n\tVEEJAY_FULLSCREEN\t\tStart in fullscreen (1) or windowed (0) mode\nVEEJAY_SCREEN_GEOMETRY\t\tSpecifiy a geometry for veejay to position the video window.\nVEEJAY_SCREEN_SIZE\t\tSize of video window, defaults to full screen size.\n");
|
fprintf(stdout, "Environment variables:\n\tSDL_VIDEO_HWACCEL\t\tSet to 1 to use SDL video hardware accel (default=on)\n\tVEEJAY_PERFORMANCE\t\tSet to \"quality\" or \"fastest\" (default is fastest)\n\tVEEJAY_AUTO_SCALE_PIXELS\tSet to 1 to convert between CCIR 601 and JPEG automatically (default=dont care)\n\tVEEJAY_INTERPOLATE_CHROMA\tSet to 1 if you wish to interpolate every chroma sample when scaling (default=0)\n\tVEEJAY_CAPTURE_DRIVER\t\tSet to \"unicap\" or \"v4lutils\" (default=v4lutils)\n\tVEEJAY_SDL_KEY_REPEAT_INTERVAL\tinterval of key pressed to repeat while pressed down.\n\tVEEJAY_PLAYBACK_CACHE\t\tSample cache size in MB - by default, veejay takes 30 percent of total RAM\n\tVEEJAY_SDL_KEY_REPEAT_DELAY\tDelay key repeat in ms\n\tVEEJAY_FULLSCREEN\t\tStart in fullscreen (1) or windowed (0) mode\nVEEJAY_SCREEN_GEOMETRY\t\tSpecifiy a geometry for veejay to position the video window.\nVEEJAY_SCREEN_SIZE\t\tSize of video window, defaults to full screen size.\n");
|
||||||
fprintf(stdout, "\n\n\tExample for bash:\n\t\t\t$ export VEEJAY_AUTO_SCALE_PIXEL=1\n");
|
fprintf(stdout, "\n\n\tExample for bash:\n\t\t\t$ export VEEJAY_AUTO_SCALE_PIXEL=1\n");
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -120,6 +120,7 @@ typedef struct
|
|||||||
|
|
||||||
typedef struct {
|
typedef struct {
|
||||||
pthread_t software_playback_thread; /* the thread for software playback */
|
pthread_t software_playback_thread; /* the thread for software playback */
|
||||||
|
pthread_attr_t playback_attr;
|
||||||
pthread_t geo_stat;
|
pthread_t geo_stat;
|
||||||
pthread_mutex_t valid_mutex;
|
pthread_mutex_t valid_mutex;
|
||||||
pthread_cond_t buffer_filled[MJPEG_MAX_BUF];
|
pthread_cond_t buffer_filled[MJPEG_MAX_BUF];
|
||||||
|
|||||||
Reference in New Issue
Block a user