Skip to content

Commit

Permalink
Ensure that vfb default options are always set
Browse files Browse the repository at this point in the history
  • Loading branch information
amadvance committed Feb 18, 2017
1 parent 847462a commit 5c2d15b
Show file tree
Hide file tree
Showing 4 changed files with 27 additions and 4 deletions.
6 changes: 4 additions & 2 deletions advance/linux/salsa.c
Original file line number Diff line number Diff line change
Expand Up @@ -123,9 +123,11 @@ adv_error soundb_alsa_init(int sound_id, unsigned* rate, adv_bool stereo_flag, d

log_std(("sound:alsa: soundb_alsa_init(id:%d, rate:%d, stereo:%d, buffer_time:%g)\n", sound_id, *rate, stereo_flag, buffer_time));

if (!alsa_option.initialized) {
if (!alsa_option.initialized)
soundb_alsa_default();
}

log_std(("sound:alsa: device_alsa_device %s\n", alsa_option.device_buffer));
log_std(("sound:alsa: device_alsa_mixed %s\n", alsa_option.mixer_buffer));

alsa_state.volume = ALSA_VOLUME_BASE;

Expand Down
17 changes: 17 additions & 0 deletions advance/linux/vfb.c
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ enum fb_wait_enum {
};

struct fb_option_struct {
adv_bool initialized;
unsigned hdmi_pclock_low;
unsigned dpi_pclock_low;
};
Expand Down Expand Up @@ -685,6 +686,12 @@ adv_error fb_init(int device_id, adv_output output, unsigned overlay_size, adv_c
return -1;
}

if (!fb_option.initialized)
fb_default();

log_std(("video:fb: device_hdmi_pclock_low %u\n", fb_option.hdmi_pclock_low));
log_std(("video:fb: devide_dpi_pclock_low %u\n", fb_option.dpi_pclock_low));

fb = getenv("FRAMEBUFFER");
if (fb && fb[0]) {
fb_state.fd = open(fb, O_RDWR);
Expand Down Expand Up @@ -1969,6 +1976,14 @@ int fb_mode_compare(const fb_video_mode* a, const fb_video_mode* b)
return crtc_compare(&a->crtc, &b->crtc);
}

void fb_default(void)
{
fb_option.hdmi_pclock_low = 0;
fb_option.dpi_pclock_low = 31250000;

fb_option.initialized = 1;
}

void fb_reg(adv_conf* context)
{
assert(!fb_is_active());
Expand All @@ -1984,6 +1999,8 @@ adv_error fb_load(adv_conf* context)
fb_option.hdmi_pclock_low = conf_int_get_default(context, "device_hdmi_pclock_low");
fb_option.dpi_pclock_low = conf_int_get_default(context, "device_dpi_pclock_low");

fb_option.initialized = 1;

return 0;
}

Expand Down
2 changes: 2 additions & 0 deletions advance/linux/vfb.h
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ typedef struct fb_video_mode_struct {
*/
extern adv_video_driver video_fb_driver;

void fb_default(void);

#ifdef __cplusplus
}
#endif
Expand Down
6 changes: 4 additions & 2 deletions advance/sdl/ssdl.c
Original file line number Diff line number Diff line change
Expand Up @@ -115,9 +115,10 @@ adv_error soundb_sdl_init(int sound_id, unsigned* rate, adv_bool stereo_flag, do
return -1;
}

if (!sdl_option.initialized) {
if (!sdl_option.initialized)
soundb_sdl_default();
}

log_std(("sound:sdl deviceo_sdl_samples %u\n", sdl_option.samples));

sdl_state.underflow_flag = 0;
sdl_state.fifo_pos = 0;
Expand Down Expand Up @@ -318,6 +319,7 @@ void soundb_sdl_default(void)
#else
sdl_option.samples = 512;
#endif

sdl_option.initialized = 1;
}

Expand Down

0 comments on commit 5c2d15b

Please sign in to comment.