void CEGLNativeTypeBoxee::Initialize()
{
  gdl_init();
  int enable = 1;

  gdl_rectangle_t srcRect, dstRect;
  gdl_display_info_t   display_info;
  gdl_get_display_info(GDL_DISPLAY_ID_0, &display_info);

  dstRect.origin.x = 0;
  dstRect.origin.y = 0;
  dstRect.width = display_info.tvmode.width;
  dstRect.height = display_info.tvmode.height;

  srcRect.origin.x = 0;
  srcRect.origin.y = 0;
  srcRect.width = display_info.tvmode.width;
  srcRect.height = display_info.tvmode.height;


  gdl_port_set_attr(GDL_PD_ID_HDMI, GDL_PD_ATTR_ID_POWER, &enable);
  gdl_plane_reset(GDL_GRAPHICS_PLANE);
  gdl_plane_config_begin(GDL_GRAPHICS_PLANE);
  gdl_plane_set_uint(GDL_PLANE_SRC_COLOR_SPACE, GDL_COLOR_SPACE_RGB);
  gdl_plane_set_uint(GDL_PLANE_PIXEL_FORMAT, GDL_PF_ARGB_32);
  gdl_plane_set_rect(GDL_PLANE_DST_RECT, &dstRect);
  gdl_plane_set_rect(GDL_PLANE_SRC_RECT, &srcRect);
  gdl_plane_config_end(GDL_FALSE);
  return;
}
Exemple #2
0
static CoglBool
gdl_plane_init (CoglDisplay *display, CoglError **error)
{
  CoglBool ret = TRUE;
  gdl_color_space_t colorSpace = GDL_COLOR_SPACE_RGB;
  gdl_pixel_format_t pixfmt = GDL_PF_ARGB_32;
  gdl_rectangle_t dstRect;
  gdl_display_info_t display_info;
  gdl_ret_t rc = GDL_SUCCESS;

  if (!display->gdl_plane)
    {
      _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
                   "No GDL plane specified with "
                   "cogl_gdl_display_set_plane");
      return FALSE;
    }

  rc = gdl_init (NULL);
  if (rc != GDL_SUCCESS)
    {
      _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
                   "GDL initialize failed. %s", gdl_get_error_string (rc));
      return FALSE;
    }

  rc = gdl_get_display_info (GDL_DISPLAY_ID_0, &display_info);
  if (rc != GDL_SUCCESS)
    {
      _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
                   "GDL failed to get display infomation: %s",
                   gdl_get_error_string (rc));
      gdl_close ();
      return FALSE;
    }

  dstRect.origin.x = 0;
  dstRect.origin.y = 0;
  dstRect.width = display_info.tvmode.width;
  dstRect.height = display_info.tvmode.height;

  /* Configure the plane attribute. */
  rc = gdl_plane_reset (display->gdl_plane);
  if (rc == GDL_SUCCESS)
    rc = gdl_plane_config_begin (display->gdl_plane);

  if (rc == GDL_SUCCESS)
    rc = gdl_plane_set_attr (GDL_PLANE_SRC_COLOR_SPACE, &colorSpace);

  if (rc == GDL_SUCCESS)
    rc = gdl_plane_set_attr (GDL_PLANE_PIXEL_FORMAT, &pixfmt);

  if (rc == GDL_SUCCESS)
    rc = gdl_plane_set_attr (GDL_PLANE_DST_RECT, &dstRect);

  if (rc == GDL_SUCCESS)
    rc = gdl_plane_set_uint (GDL_PLANE_NUM_GFX_SURFACES, 3);

  if (rc == GDL_SUCCESS)
    rc = gdl_plane_config_end (GDL_FALSE);
  else
    gdl_plane_config_end (GDL_TRUE);

  if (rc != GDL_SUCCESS)
    {
      _cogl_set_error (error, COGL_WINSYS_ERROR, COGL_WINSYS_ERROR_CREATE_CONTEXT,
                   "GDL configuration failed: %s.", gdl_get_error_string (rc));
      ret = FALSE;
    }

  gdl_close ();

  return ret;
}
/*!***********************************************************************
 @Function		OsInitOS
 @description	Saves instance handle and creates main window
				In this function, we save the instance handle in a global variable and
				create and display the main program window.
*************************************************************************/
bool PVRShellInit::OsInitOS()
{
#if defined(USE_GDL_PLANE)
	gdl_display_info_t di;
	gdl_get_display_info(GDL_DISPLAY_ID_0, &di);

	m_Plane = GDL_PLANE_ID_UPP_C;

 	gdl_pixel_format_t pixelFormat 	= GDL_PF_ARGB_32;

 	// Change the colour bpp default to 32 bits per pixel to match the GDL pixel format
 	m_pShell->m_pShellData->nColorBPP = 32;

    gdl_color_space_t colorSpace 	= GDL_COLOR_SPACE_RGB;
    gdl_rectangle_t srcRect, dstRect;

    gdl_ret_t rc = GDL_SUCCESS;

    rc = gdl_plane_config_begin(m_Plane);

    if(rc != GDL_SUCCESS)
    {
        m_pShell->PVRShellOutputDebug("Failed to begin config of GDL plane. (Error code 0x%x)\n", rc);
        return false;
    }

	if(m_pShell->m_pShellData->bFullScreen)
		dstRect.origin.x = dstRect.origin.y = 0;
	else
	{
		dstRect.origin.x = m_pShell->m_pShellData->nShellPosX;
		dstRect.origin.y = m_pShell->m_pShellData->nShellPosY;
	}

	srcRect.origin.x = srcRect.origin.y = 0;
    srcRect.width  = m_pShell->m_pShellData->nShellDimX;
    srcRect.height = m_pShell->m_pShellData->nShellDimY;

	bool bUpscaling = false;

	if(m_pShell->m_pShellData->bFullScreen)
	{
		dstRect.width = di.tvmode.width;
		bUpscaling = true;
	}
	else
		dstRect.width = srcRect.width;

	if(m_pShell->m_pShellData->bFullScreen)
	{
		dstRect.height = di.tvmode.height;
		bUpscaling = true;
	}
	else
		dstRect.height = srcRect.height;

	rc = gdl_plane_set_uint(GDL_PLANE_SCALE, bUpscaling ? GDL_TRUE : GDL_FALSE);

	if(rc != GDL_SUCCESS)
	{
		m_pShell->PVRShellOutputDebug("Failed to set upscale of GDL plane. (Error code 0x%x)\n", rc);
		return false;
	}

    rc = gdl_plane_set_attr(GDL_PLANE_SRC_COLOR_SPACE, &colorSpace);

    if(rc != GDL_SUCCESS)
    {
        m_pShell->PVRShellOutputDebug("Failed to set color space of GDL plane. (Error code 0x%x)\n", rc);
        return false;
	}

    rc = gdl_plane_set_attr(GDL_PLANE_PIXEL_FORMAT, &pixelFormat);

    if(rc != GDL_SUCCESS)
    {
        m_pShell->PVRShellOutputDebug("Failed to set pixel format of GDL plane. (Error code 0x%x)\n", rc);
        return false;
    }

    rc = gdl_plane_set_attr(GDL_PLANE_DST_RECT, &dstRect);

    if(rc != GDL_SUCCESS)
    {
        m_pShell->PVRShellOutputDebug("Failed to set dst rect of GDL plane. (Error code 0x%x)\n", rc);
        return false;
    }

    rc = gdl_plane_set_attr(GDL_PLANE_SRC_RECT, &srcRect);

    if(rc != GDL_SUCCESS)
    {
        m_pShell->PVRShellOutputDebug("Failed to set src rect of GDL plane. (Error code 0x%x)\n", rc);
        return false;
    }


    rc = gdl_plane_config_end(GDL_FALSE);

    if(rc != GDL_SUCCESS)
    {
        gdl_plane_config_end(GDL_TRUE);
        m_pShell->PVRShellOutputDebug("Failed to end config of GDL plane. (Error code 0x%x)\n", rc);
        return false;
	}
#endif
	return true;
}