/** * * @param driver - Driver object to be returned * @return the status of the initilization */ static gctBOOL SetupDriver ( OUT Viv2DDriverPtr * driver ) { TRACE_ENTER(); gceSTATUS status = gcvSTATUS_OK; Viv2DDriverPtr pDrvHandle = gcvNULL; gctPOINTER mHandle = gcvNULL; /*Allocating the driver*/ gcmASSERT(*driver == gcvNULL); status = gcoOS_Allocate(gcvNULL, sizeof (Viv2DDriver), &mHandle); if (status < 0) { TRACE_ERROR("Unable to allocate driver, status = %d\n", status); TRACE_EXIT(gcvFALSE); } pDrvHandle = (Viv2DDriverPtr) mHandle; status = gcoOS_Construct(gcvNULL, &(pDrvHandle->mOs)); if (status < 0) { TRACE_ERROR("Unable to construct OS object, status = %d\n", status); TRACE_EXIT(gcvFALSE); } status = gcoHAL_Construct(gcvNULL, pDrvHandle->mOs, &(pDrvHandle->mHal)); if (status < 0) { TRACE_ERROR("Unable to construct HAL object, status = %d\n", status); TRACE_EXIT(gcvFALSE); } /*If Seperated*/ pDrvHandle->mIsSeperated = gcoHAL_QuerySeparated3D2D(pDrvHandle->mHal) == gcvSTATUS_TRUE; if (pDrvHandle->mIsSeperated) { status = gcoHAL_SetHardwareType(pDrvHandle->mHal, gcvHARDWARE_2D); if (status < 0) { TRACE_ERROR("Unable to gcoHAL_SetHardwareType, status = %d\n", status); TRACE_EXIT(gcvFALSE); } } if (!gcoHAL_IsFeatureAvailable(pDrvHandle->mHal, gcvFEATURE_PIPE_2D)) { TRACE_ERROR("2D PIPE IS NOT AVAIBLE"); TRACE_EXIT(gcvFALSE); } /* Query the amount of video memory. */ status = gcoHAL_QueryVideoMemory (pDrvHandle->mHal, &pDrvHandle->g_InternalPhysical, &pDrvHandle->g_InternalSize, &pDrvHandle->g_ExternalPhysical, &pDrvHandle->g_ExternalSize, &pDrvHandle->g_ContiguousPhysical, &pDrvHandle->g_ContiguousSize ); if (status < 0) { TRACE_ERROR("gcoHAL_QueryVideoMemory failed, status = %d\n", status); TRACE_EXIT(gcvFALSE); } /* Map the local internal memory. */ if (pDrvHandle->g_InternalSize > 0) { status = gcoHAL_MapMemory( pDrvHandle->mHal, pDrvHandle->g_InternalPhysical, pDrvHandle-> g_InternalSize, &pDrvHandle->g_Internal ); if (status < 0) { TRACE_ERROR("gcoHAL_MapMemory failed, status = %d\n", status); TRACE_EXIT(gcvFALSE); } } /* Map the local external memory. */ if (pDrvHandle->g_ExternalSize > 0) { status = gcoHAL_MapMemory( pDrvHandle->mHal, pDrvHandle->g_ExternalPhysical, pDrvHandle->g_ExternalSize, &pDrvHandle->g_External ); if (status < 0) { TRACE_ERROR("gcoHAL_MapMemory failed, status = %d\n", status); TRACE_EXIT(gcvFALSE); } } /* Map the contiguous memory. */ if (pDrvHandle->g_ContiguousSize > 0) { status = gcoHAL_MapMemory (pDrvHandle->mHal, pDrvHandle->g_ContiguousPhysical, pDrvHandle->g_ContiguousSize, &pDrvHandle->g_Contiguous ); TRACE_INFO("Physcal : %d LOGICAL ADDR = %p SIZE = %d\n", pDrvHandle->g_ContiguousPhysical, pDrvHandle->g_Contiguous, pDrvHandle->g_ContiguousSize); if (status < 0) { TRACE_ERROR("gcoHAL_MapMemory failed, status = %d\n", status); TRACE_EXIT(gcvFALSE); } } /* Determine whether PE 2.0 is present. */ pDrvHandle->mIsPe20Supported = gcoHAL_IsFeatureAvailable(pDrvHandle ->mHal, gcvFEATURE_2DPE20) == gcvSTATUS_TRUE; /*Multi source options*/ pDrvHandle->mIsMultiSrcBltSupported = gcoHAL_IsFeatureAvailable(pDrvHandle->mHal, gcvFEATURE_2D_MULTI_SOURCE_BLT) == gcvSTATUS_TRUE; pDrvHandle->mIsMultiSrcBltExSupported = gcoHAL_IsFeatureAvailable(pDrvHandle->mHal, gcvFEATURE_2D_MULTI_SOURCE_BLT_EX) == gcvSTATUS_TRUE; pDrvHandle->mMaxSourceForMultiSrcOpt = pDrvHandle->mIsMultiSrcBltExSupported ? 8 : (pDrvHandle->mIsMultiSrcBltSupported ? 4 : 1); /*Getting the 2d engine*/ status = gcoHAL_Get2DEngine(pDrvHandle->mHal, &(pDrvHandle->m2DEngine)); if (status < 0) { TRACE_ERROR("Unable to construct 2DEngine object, status = %d\n", status); TRACE_EXIT(gcvFALSE); } *driver = pDrvHandle; TRACE_EXIT(gcvTRUE); }
VEGLThreadData veglGetThreadData( void ) { gcsTLS_PTR tls = gcvNULL; gceSTATUS status; #if gcdENABLE_VG gctINT32 i; #endif gcmHEADER(); gcmONERROR(gcoOS_GetTLS(&tls)); if (tls->context == gcvNULL) { gctPOINTER pointer = gcvNULL; VEGLThreadData thread; gcmONERROR(gcoOS_Allocate( gcvNULL, gcmSIZEOF(struct eglThreadData), &pointer )); gcmONERROR(gcoOS_ZeroMemory( pointer, gcmSIZEOF(struct eglThreadData) )); /* Initialize TLS record. */ tls->context = pointer; tls->destructor = _DestroyThreadData; /* Cast the pointer. */ thread = (VEGLThreadData) pointer; /* Initialize the thread data. */ thread->error = EGL_SUCCESS; thread->api = EGL_OPENGL_ES_API; thread->lastClient = 1; thread->worker = gcvNULL; tls->currentType = gcvHARDWARE_3D; #if veglUSE_HAL_DUMP /* Get the gcoDUMP object. */ gcmONERROR(gcoHAL_GetDump(thread->hal, &thread->dump)); #endif #if gcdENABLE_VG gcmONERROR(gcoHAL_QueryChipCount(gcvNULL, &thread->chipCount)); for (i = 0; i < thread->chipCount; i++) { gcmONERROR(gcoHAL_QueryChipLimits(gcvNULL, i, &thread->chipLimits[i])); } for (i = 0; i < thread->chipCount; i++) { thread->maxWidth = gcmMAX(thread->maxWidth, (gctINT32)thread->chipLimits[i].maxWidth); thread->maxHeight = gcmMAX(thread->maxHeight, (gctINT32)thread->chipLimits[i].maxHeight); thread->maxSamples = gcmMAX(thread->maxSamples, (gctINT32)thread->chipLimits[i].maxSamples); } for (i = 0; i < thread->chipCount; i++) { /* Query VAA support. */ if (gcoHAL_QueryChipFeature(gcvNULL, i, gcvFEATURE_VAA)) { thread->vaa = gcvTRUE; break; } } for (i = 0; i < thread->chipCount; i++) { if (gcoHAL_QueryChipFeature(gcvNULL, i, gcvFEATURE_PIPE_VG)) { thread->openVGpipe = _IsHWVGDriverAvailable(thread); break; } } #else /* Query the hardware identity. */ gcmONERROR(gcoHAL_QueryChipIdentity( gcvNULL, &thread->chipModel, gcvNULL, gcvNULL, gcvNULL )); /* Query the hardware capabilities. */ gcmONERROR(gcoHAL_QueryTargetCaps( gcvNULL, (gctUINT32_PTR) &thread->maxWidth, (gctUINT32_PTR) &thread->maxHeight, gcvNULL, (gctUINT32_PTR) &thread->maxSamples )); /* Query VAA support. */ thread->vaa = gcoHAL_IsFeatureAvailable(gcvNULL, gcvFEATURE_VAA) == gcvSTATUS_TRUE; /* Query OpenVG pipe support. */ thread->openVGpipe = gcoHAL_IsFeatureAvailable(gcvNULL, gcvFEATURE_PIPE_VG) == gcvSTATUS_TRUE; #endif gcmTRACE_ZONE( gcvLEVEL_VERBOSE, gcdZONE_EGL_API, "%s(%d): maxWidth=%d maxHeight=%d maxSamples=%d vaa=%d openVG=%d", __FUNCTION__, __LINE__, thread->maxWidth, thread->maxHeight, thread->maxSamples, thread->vaa, thread->openVGpipe ); }