void CompManager::ControlPartialUpdate(Handle display_ctx, bool enable) {
  SCOPE_LOCK(locker_);

  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);
  display_comp_ctx->partial_update_enable = enable;
}
DisplayError CompManager::UnregisterDisplay(Handle comp_handle) {
  SCOPE_LOCK(locker_);

  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(comp_handle);

  if (!display_comp_ctx) {
    return kErrorParameters;
  }

  resource_intf_->UnregisterDisplay(display_comp_ctx->display_resource_ctx);

  Strategy *&strategy = display_comp_ctx->strategy;
  strategy->Deinit();
  delete strategy;

  registered_displays_[display_comp_ctx->display_type] = 0;
  configured_displays_[display_comp_ctx->display_type] = 0;

  if (display_comp_ctx->display_type == kHDMI) {
    max_layers_ = kMaxSDELayers;
  }

  DLOGV_IF(kTagCompManager, "registered display bit mask 0x%x, configured display bit mask 0x%x, " \
           "display type %d", registered_displays_.to_ulong(), configured_displays_.to_ulong(),
           display_comp_ctx->display_type);

  delete display_comp_ctx;
  display_comp_ctx = NULL;
  return kErrorNone;
}
DisplayError CoreImpl::Init() {
  SCOPE_LOCK(locker_);

  DisplayError error = kErrorNone;

  error = HWInterface::Create(&hw_intf_, buffer_sync_handler_);
  if (UNLIKELY(error != kErrorNone)) {
    return error;
  }

  HWResourceInfo hw_res_info;
  error = hw_intf_->GetHWCapabilities(&hw_res_info);
  if (UNLIKELY(error != kErrorNone)) {
    HWInterface::Destroy(hw_intf_);
    return error;
  }

  error = comp_mgr_.Init(hw_res_info, buffer_allocator_, buffer_sync_handler_);
  if (UNLIKELY(error != kErrorNone)) {
    HWInterface::Destroy(hw_intf_);
    return error;
  }

  error = offline_ctrl_.Init(hw_intf_, hw_res_info);
  if (UNLIKELY(error != kErrorNone)) {
    comp_mgr_.Deinit();
    HWInterface::Destroy(hw_intf_);
    return error;
  }

  return kErrorNone;
}
int HWCColorManager::SetSolidFill(const void *params, bool enable, HWCDisplay *hwc_display) {
  SCOPE_LOCK(locker_);

  if (params) {
    solid_fill_params_ = *reinterpret_cast<const PPColorFillParams *>(params);
  } else {
    solid_fill_params_ = PPColorFillParams();
  }

  uint32_t solid_fill_color = Get8BitsARGBColorValue(solid_fill_params_);
  if (enable) {
    LayerRect solid_fill_rect = {
      FLOAT(solid_fill_params_.rect.x), FLOAT(solid_fill_params_.rect.y),
      FLOAT(solid_fill_params_.rect.x) + FLOAT(solid_fill_params_.rect.width),
      FLOAT(solid_fill_params_.rect.y) + FLOAT(solid_fill_params_.rect.height),
    };

    hwc_display->Perform(HWCDisplayPrimary::SET_QDCM_SOLID_FILL_INFO, solid_fill_color);
    hwc_display->Perform(HWCDisplayPrimary::SET_QDCM_SOLID_FILL_RECT, &solid_fill_rect);
  } else {
    hwc_display->Perform(HWCDisplayPrimary::UNSET_QDCM_SOLID_FILL_INFO, 0);
  }

  return 0;
}
DisplayError ResourceDefault::PostCommit(Handle display_ctx, HWLayers *hw_layers) {
  SCOPE_LOCK(locker_);
  DisplayResourceContext *display_resource_ctx =
                          reinterpret_cast<DisplayResourceContext *>(display_ctx);
  HWBlockType hw_block_id = display_resource_ctx->hw_block_id;
  uint64_t frame_count = display_resource_ctx->frame_count;

  DLOGV_IF(kTagResources, "Resource for hw_block = %d, frame_count = %d", hw_block_id, frame_count);

  // handoff pipes which are used by splash screen
  if ((frame_count == 0) && (hw_block_id == kHWPrimary)) {
    for (uint32_t i = 0; i < num_pipe_; i++) {
      if (src_pipes_[i].hw_block_id == hw_block_id && src_pipes_[i].owner == kPipeOwnerKernelMode) {
        src_pipes_[i].owner = kPipeOwnerUserMode;
      }
    }
  }

  if (hw_layers->info.sync_handle >= 0)
    Sys::close_(hw_layers->info.sync_handle);

  display_resource_ctx->frame_count++;

  return kErrorNone;
}
void CompManager::PrePrepare(Handle display_ctx, HWLayers *hw_layers) {
  SCOPE_LOCK(locker_);
  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);
  display_comp_ctx->strategy->Start(&hw_layers->info, &display_comp_ctx->max_strategies,
                                    display_comp_ctx->partial_update_enable);
  display_comp_ctx->remaining_strategies = display_comp_ctx->max_strategies;
}
Exemple #7
0
void CDecoder::OnDecodeResult( BOOL bSuccess, TVideoPicture *pPic, TVideoFrameInfo* pFrameInfo )
{
	SCOPE_LOCK( s_decoderNameTableLock );
	if ( bSuccess && this->m_pPicCallBack )
	{
		m_pPicCallBack( pPic, pFrameInfo, this->m_picCallbackParam );
	}
}
Exemple #8
0
BOOL CDecoder::SetPictueCallback( PictrueCallback pFun, void *param )
{	
	SCOPE_LOCK( s_decoderNameTableLock );

	m_pPicCallBack = pFun;
	m_picCallbackParam = param;
	return TRUE;
}
void CompManager::Purge(Handle display_ctx) {
  SCOPE_LOCK(locker_);

  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);

  resource_intf_->Purge(display_comp_ctx->display_resource_ctx);
}
DisplayError CompManager::RegisterDisplay(DisplayType type,
                                          const HWDisplayAttributes &display_attributes,
                                          const HWPanelInfo &hw_panel_info,
                                          const HWMixerAttributes &mixer_attributes,
                                          const DisplayConfigVariableInfo &fb_config,
                                          Handle *display_ctx) {
  SCOPE_LOCK(locker_);

  DisplayError error = kErrorNone;

  DisplayCompositionContext *display_comp_ctx = new DisplayCompositionContext();
  if (!display_comp_ctx) {
    return kErrorMemory;
  }

  Strategy *&strategy = display_comp_ctx->strategy;
  strategy = new Strategy(extension_intf_, type, hw_res_info_, hw_panel_info, mixer_attributes,
                          display_attributes, fb_config);
  if (!strategy) {
    DLOGE("Unable to create strategy");
    delete display_comp_ctx;
    return kErrorMemory;
  }

  error = strategy->Init();
  if (error != kErrorNone) {
    delete strategy;
    delete display_comp_ctx;
    return error;
  }

  error = resource_intf_->RegisterDisplay(type, display_attributes, hw_panel_info, mixer_attributes,
                                          &display_comp_ctx->display_resource_ctx);
  if (error != kErrorNone) {
    strategy->Deinit();
    delete strategy;
    delete display_comp_ctx;
    display_comp_ctx = NULL;
    return error;
  }

  registered_displays_[type] = 1;
  display_comp_ctx->is_primary_panel = hw_panel_info.is_primary_panel;
  display_comp_ctx->display_type = type;
  *display_ctx = display_comp_ctx;
  // New non-primary display device has been added, so move the composition mode to safe mode until
  // resources for the added display is configured properly.
  if (!display_comp_ctx->is_primary_panel) {
    safe_mode_ = true;
  }

  DLOGV_IF(kTagCompManager, "registered display bit mask 0x%x, configured display bit mask 0x%x, " \
           "display type %d", registered_displays_.to_ulong(), configured_displays_.to_ulong(),
           display_comp_ctx->display_type);

  return kErrorNone;
}
DisplayError CoreImpl::Deinit() {
  SCOPE_LOCK(locker_);

  offline_ctrl_.Deinit();
  comp_mgr_.Deinit();
  HWInterface::Destroy(hw_intf_);

  return kErrorNone;
}
Exemple #12
0
void CEncoder::RegDec( LPCTSTR lpName, CEncoder *pEnc )
{
	SCOPE_LOCK( s_encoderNameTableLock );

	if ( lpName && pEnc )
	{
		s_tEncoderNameTable[ lpName ]  = pEnc;
	}		
}
Exemple #13
0
void CDecoder::RegDec( LPCTSTR lpName, CDecoder *pDec )
{
	SCOPE_LOCK( s_decoderNameTableLock );

	if ( lpName && pDec )
	{
		s_tDecoderNameTable[ lpName ]  = pDec;
	}		
}
DisplayError CompManager::SetDetailEnhancerData(Handle display_ctx,
                                                const DisplayDetailEnhancerData &de_data) {
  SCOPE_LOCK(locker_);

  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);

  return resource_intf_->SetDetailEnhancerData(display_comp_ctx->display_resource_ctx, de_data);
}
Exemple #15
0
void CDecoder::ReleaseAll()
{
	SCOPE_LOCK( s_decoderNameTableLock );
	for ( TDecoderNameTable::iterator iter = s_tDecoderNameTable.begin(); iter != s_tDecoderNameTable.end(); ++iter )
	{
		delete iter->second;
		iter->second = NULL;
	}
}
Exemple #16
0
  void ObjectMemory::needs_finalization(Object* obj, FinalizerFunction func) {
    SCOPE_LOCK(ManagedThread::current(), finalizer_lock_);

    FinalizeObject fi;
    fi.object = obj;
    fi.status = FinalizeObject::eLive;
    fi.finalizer = func;

    // Makes a copy of fi.
    finalize_.push_back(fi);
  }
DisplayError CompManager::Deinit() {
  SCOPE_LOCK(locker_);

  if (extension_intf_) {
    extension_intf_->DestroyResourceExtn(resource_intf_);
  } else {
    resource_default_.Deinit();
  }

  return kErrorNone;
}
Exemple #18
0
void CDecoder::OnDecodeResult( BOOL bSuccess, TVideoPicture *pPic, TVideoFrameInfo* pFrameInfo )
{
//    Log() << _T( "OnDecodeResult call" ) << endl;

	SCOPE_LOCK( s_decoderNameTableLock );
	if ( bSuccess && this->m_pPicCallBack )
	{
		m_pPicCallBack( pPic, pFrameInfo, this->m_picCallbackParam );
	}

//    Log() << _T( "OnDecodeResult over" ) << endl;
}
void CompManager::ProcessIdleTimeout(Handle display_ctx) {
  SCOPE_LOCK(locker_);

  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);

  if (!display_comp_ctx) {
    return;
  }

  display_comp_ctx->idle_fallback = true;
}
void CompManager::ProcessThermalEvent(Handle display_ctx, int64_t thermal_level) {
  SCOPE_LOCK(locker_);

  DisplayCompositionContext *display_comp_ctx =
          reinterpret_cast<DisplayCompositionContext *>(display_ctx);

  if (thermal_level >= kMaxThermalLevel) {
    display_comp_ctx->fallback_ = true;
  } else {
    display_comp_ctx->fallback_ = false;
  }
}
DisplayError CoreImpl::DestroyDisplay(DisplayInterface *intf) {
  SCOPE_LOCK(locker_);

  if (UNLIKELY(!intf)) {
    return kErrorParameters;
  }

  DisplayBase *display_base = static_cast<DisplayBase *>(intf);
  display_base->Deinit();
  delete display_base;

  return kErrorNone;
}
BOOL CH264Decoder::Init( int nBandWidth )
{
	SCOPE_LOCK( this->m_threadSafeLock );

	this->m_nBandWidth = nBandWidth;

	if ( NULL == m_pKdvDecoder )
	{
		m_pKdvDecoder = CKDVDecoderImpl::GetDecoder( CBaseCodec::CODEC_H264, MAIN_KEDA_DECODER_NAME );
	}

	return ( NULL != m_pKdvDecoder );
}
Exemple #23
0
CDecoder *CDecoder::FindDecoder( LPCTSTR strName )
{
	SCOPE_LOCK( s_decoderNameTableLock );
	TDecoderNameTable::iterator iter = s_tDecoderNameTable.find( strName );
	if ( iter != s_tDecoderNameTable.end() )
	{
		return iter->second;
	}
	else
	{
		return NULL;
	}
}
Exemple #24
0
void CDecoder::Release( CDecoder *pDecoder )
{
	SCOPE_LOCK( s_decoderNameTableLock );
	for ( TDecoderNameTable::iterator iter = s_tDecoderNameTable.begin(); iter != s_tDecoderNameTable.end(); ++iter )
	{
		if ( iter->second == pDecoder )
		{
			s_tDecoderNameTable.erase( iter );
			break;
		}
	}
	delete pDecoder;
	pDecoder = NULL;
}
BOOL CH264Decoder::CapturePic(LPCTSTR strPicPath, CEncoder *pEnc)
{
	SCOPE_LOCK( this->m_threadSafeLock );

	if ( m_pKdvDecoder )
	{
		return m_pKdvDecoder->CapturePic( strPicPath, pEnc );
	}
	else
	{
		Log() << _T( "CH264Decoder::CapturePic decoder not created!" ) << endl;
		return FALSE;
	}
}
DisplayError ResourceDefault::ReconfigureDisplay(Handle display_ctx,
                                                 const HWDisplayAttributes &display_attributes,
                                                 const HWPanelInfo &hw_panel_info,
                                                 const HWMixerAttributes &mixer_attributes) {
  SCOPE_LOCK(locker_);

  DisplayResourceContext *display_resource_ctx =
                          reinterpret_cast<DisplayResourceContext *>(display_ctx);

  display_resource_ctx->display_attributes = display_attributes;
  display_resource_ctx->mixer_attributes = mixer_attributes;

  return kErrorNone;
}
void ResourceDefault::Purge(Handle display_ctx) {
  SCOPE_LOCK(locker_);

  DisplayResourceContext *display_resource_ctx =
                          reinterpret_cast<DisplayResourceContext *>(display_ctx);
  HWBlockType hw_block_id = display_resource_ctx->hw_block_id;

  for (uint32_t i = 0; i < num_pipe_; i++) {
    if (src_pipes_[i].hw_block_id == hw_block_id && src_pipes_[i].owner == kPipeOwnerUserMode) {
      src_pipes_[i].ResetState();
    }
  }
  DLOGV_IF(kTagResources, "display id = %d", display_resource_ctx->hw_block_id);
}
DisplayError CompManager::SetMaxMixerStages(Handle display_ctx, uint32_t max_mixer_stages) {
  SCOPE_LOCK(locker_);

  DisplayError error = kErrorNone;
  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);

  if (display_comp_ctx) {
    error = resource_intf_->SetMaxMixerStages(display_comp_ctx->display_resource_ctx,
                                              max_mixer_stages);
  }

  return error;
}
Exemple #29
0
  void ObjectMemory::run_finalizers(STATE, CallFrame* call_frame) {
    {
      SCOPE_LOCK(state->vm(), finalizer_lock_);
      if(running_finalizers_) return;
      running_finalizers_ = true;
    }

    for(std::list<FinalizeObject*>::iterator i = to_finalize_.begin();
        i != to_finalize_.end(); ) {
      FinalizeObject* fi = *i;

      if(fi->finalizer) {
        (*fi->finalizer)(state, fi->object);
        // Unhook any handle used by fi->object so that we don't accidentally
        // try and mark it later (after we've finalized it)
        if(capi::Handle* handle = fi->object->handle(state)) {
          handle->forget_object();
          fi->object->clear_handle(state);
        }

        // If the object was remembered, unremember it.
        if(fi->object->remembered_p()) {
          unremember_object(fi->object);
        }
      } else if(fi->ruby_finalizer) {
        // Rubinius specific code. If the finalizer is cTrue, then
        // send the object the finalize message
        if(fi->ruby_finalizer == cTrue) {
          fi->object->send(state, call_frame, state->symbol("__finalize__"));
        } else {
          Array* ary = Array::create(state, 1);
          ary->set(state, 0, fi->object->id(state));

          OnStack<1> os(state, ary);

          fi->ruby_finalizer->send(state, call_frame, G(sym_call), ary);
        }
      } else {
        std::cerr << "Unsupported object to be finalized: "
                  << fi->object->to_s(state)->c_str(state) << std::endl;
      }

      fi->status = FinalizeObject::eFinalized;

      i = to_finalize_.erase(i);
    }

    running_finalizers_ = false;
  }
BOOL CH264Decoder::StartRecord( LPCTSTR strFileName )
{
	SCOPE_LOCK( this->m_threadSafeLock );

	if ( m_bRecording )
	{
		return FALSE;
	}
	
	BOOL bResult = m_cFFRecoder.Init( CBaseCodec::CODEC_H264, m_nBandWidth, strFileName );
	
	m_bRecording = bResult;

	return bResult;
}