Exemplo n.º 1
0
void CEGLNativeTypeAmlogic::DisableFreeScale()
{
  // turn off frame buffer freescale
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_str("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");

  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
  aml_set_sysfs_int("/sys/class/video/disable_video", 0);
  // now default video display to off
  aml_set_sysfs_int("/sys/class/video/disable_video", 1);

  // revert display axis
  int fd0;
  std::string framebuffer = "/dev/" + m_framebuffer_name;

  if ((fd0 = open(framebuffer.c_str(), O_RDWR)) >= 0)
  {
    struct fb_var_screeninfo vinfo;
    if (ioctl(fd0, FBIOGET_VSCREENINFO, &vinfo) == 0)
    {
      char daxis_str[255] = {0};
      sprintf(daxis_str, "%d %d %d %d 0 0 0 0", 0, 0, vinfo.xres-1, vinfo.yres-1);
      aml_set_sysfs_str("/sys/class/display/axis", daxis_str);
    }
    close(fd0);
  }
}
Exemplo n.º 2
0
void CEGLNativeTypeAmlogic::DisableFreeScale()
{
  // turn off frame buffer freescale
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_str("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
  // revert to default video paths
  aml_set_sysfs_str("/sys/class/vfm/map", "rm all");
  aml_set_sysfs_str("/sys/class/vfm/map", "add default_osd osd amvideo");
  aml_set_sysfs_str("/sys/class/vfm/map", "add default decoder ppmgr amvideo");
  // disable post processing scaler and disable_video special mode
  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
  aml_set_sysfs_int("/sys/class/video/disable_video", 0);
  aml_set_sysfs_int("/sys/class/video/disable_video", 1);

  // revert display axis
  int fd0;
  std::string framebuffer = "/dev/" + m_framebuffer_name;

  if ((fd0 = open(framebuffer.c_str(), O_RDWR)) >= 0)
  {
    struct fb_var_screeninfo vinfo;
    if (ioctl(fd0, FBIOGET_VSCREENINFO, &vinfo) == 0)
    {
      char daxis_str[255] = {0};
      sprintf(daxis_str, "%d %d %d %d 0 0 0 0", 0, 0, vinfo.xres, vinfo.yres);
      aml_set_sysfs_str("/sys/class/display/axis", daxis_str);
    }
    close(fd0);
  }
}
Exemplo n.º 3
0
void aml_cpufreq_limit(bool limit)
{
  int cpufreq = 300000;
  if (limit)
    cpufreq = 600000;

  aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", cpufreq);
}
Exemplo n.º 4
0
void aml_set_audio_passthrough(bool passthrough)
{
  if (aml_present())
  {
    int raw = aml_get_cputype() < 3 ? 1:2;
    aml_set_sysfs_int("/sys/class/audiodsp/digital_raw", passthrough ? raw:0);
  }
}
Exemplo n.º 5
0
void CEGLNativeTypeAmlogic::SetupVideoScaling(const char *mode)
{
  aml_set_sysfs_int("/sys/class/graphics/fb0/blank",      1);
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler",          0);

  if (strstr(mode, "1080"))
  {
    aml_set_sysfs_str("/sys/class/graphics/fb0/request2XScale", "8");
    aml_set_sysfs_str("/sys/class/graphics/fb1/scale_axis",     "1280 720 1920 1080");
    aml_set_sysfs_str("/sys/class/graphics/fb1/scale",          "0x10001");
  }
  else
  {
    aml_set_sysfs_str("/sys/class/graphics/fb0/request2XScale", "16 1280 720");
  }

  aml_set_sysfs_int("/sys/class/graphics/fb0/blank", 0);
}
Exemplo n.º 6
0
void aml_cpufreq_max(bool limit)
{
  if (!aml_wired_present() && aml_get_cputype() > 3)
  {
    // this is a MX Stick, they cannot substain 1GHz
    // operation without overheating so limit them to 800MHz.
    int cpufreq = 1000000;
    if (limit)
      cpufreq = 800000;

    aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_max_freq", cpufreq);
    aml_set_sysfs_str("/sys/devices/system/cpu/cpu0/cpufreq/scaling_governor", "ondemand");
  }
}
Exemplo n.º 7
0
void aml_cpufreq_min(bool limit)
{
// do not touch scaling_min_freq on android
#if !defined(TARGET_ANDROID)
  // only needed for m1/m3 SoCs
  if (aml_get_cputype() <= 3)
  {
    int cpufreq = 300000;
    if (limit)
      cpufreq = 600000;

    aml_set_sysfs_int("/sys/devices/system/cpu/cpu0/cpufreq/scaling_min_freq", cpufreq);
  }
#endif
}
Exemplo n.º 8
0
void CEGLNativeTypeAmlogic::EnableFreeScale()
{
  // remove default OSD and video path (default_osd default)
  aml_set_sysfs_str("/sys/class/vfm/map", "rm all");

  // add OSD path
  aml_set_sysfs_str("/sys/class/vfm/map", "add osdpath osd amvideo");
  // enable OSD free scale using frame buffer size of 720p
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_height", 720);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_height", 720);
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 1);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 1);
  // remove OSD path
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_str("/sys/class/vfm/map", "rm osdpath");
  // add video path
  aml_set_sysfs_str("/sys/class/vfm/map", "add videopath decoder ppmgr amvideo");
  // enable video free scale (scaling to 1920x1080 with frame buffer size 1280x720)
  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
  aml_set_sysfs_int("/sys/class/video/disable_video", 1);
  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 1);
  aml_set_sysfs_str("/sys/class/ppmgr/ppscaler_rect", "0 0 1919 1079 0");
  aml_set_sysfs_str("/sys/class/ppmgr/disp", "1280 720");
  //
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_height", 720);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_height", 720);
  //
  aml_set_sysfs_int("/sys/class/video/disable_video", 2);
  aml_set_sysfs_str("/sys/class/display/axis", "0 0 1279 719 0 0 0 0");
  aml_set_sysfs_str("/sys/class/ppmgr/ppscaler_rect", "0 0 1279 719 1");
  //
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 1);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 1);
  aml_set_sysfs_str("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
}
Exemplo n.º 9
0
bool CEGLNativeTypeAmlogic::ShowWindow(bool show)
{
  std::string blank_framebuffer = "/sys/class/graphics/" + m_framebuffer_name + "/blank";
  aml_set_sysfs_int(blank_framebuffer.c_str(), show ? 0 : 1);
  return true;
}
Exemplo n.º 10
0
void aml_set_audio_passthrough(bool passthrough)
{
  if (aml_present())
    aml_set_sysfs_int("/sys/class/audiodsp/digital_raw", passthrough ? 1:0);
}
Exemplo n.º 11
0
void CEGLNativeTypeAmlogic::EnableFreeScale()
{
  // enable OSD free scale using frame buffer size of 720p
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 0);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_height", 720);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_height", 720);

  // enable video free scale (scaling to 1920x1080 with frame buffer size 1280x720)
  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 0);
  aml_set_sysfs_int("/sys/class/video/disable_video", 1);
  aml_set_sysfs_int("/sys/class/ppmgr/ppscaler", 1);
  aml_set_sysfs_str("/sys/class/ppmgr/ppscaler_rect", "0 0 1919 1079 0");
  aml_set_sysfs_str("/sys/class/ppmgr/disp", "1280 720");
  //
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb0/scale_height", 720);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_width",  1280);
  aml_set_sysfs_int("/sys/class/graphics/fb1/scale_height", 720);
  //
  aml_set_sysfs_int("/sys/class/video/disable_video", 2);
  aml_set_sysfs_str("/sys/class/display/axis", "0 0 1279 719 0 0 0 0");
  aml_set_sysfs_str("/sys/class/ppmgr/ppscaler_rect", "0 0 1279 719 1");
  //
  aml_set_sysfs_int("/sys/class/graphics/fb0/free_scale", 1);
  aml_set_sysfs_int("/sys/class/graphics/fb1/free_scale", 1);
  aml_set_sysfs_str("/sys/class/graphics/fb0/free_scale_axis", "0 0 1279 719");
}