コード例 #1
0
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);
}
コード例 #2
0
DisplayError CompManager::PostCommit(Handle display_ctx, HWLayers *hw_layers) {
  SCOPE_LOCK(locker_);

  DisplayError error = kErrorNone;
  DisplayCompositionContext *display_comp_ctx =
                             reinterpret_cast<DisplayCompositionContext *>(display_ctx);
  configured_displays_[display_comp_ctx->display_type] = 1;
  if (configured_displays_ == registered_displays_) {
    safe_mode_ = false;
  }

  error = resource_intf_->PostCommit(display_comp_ctx->display_resource_ctx, hw_layers);
  if (error != kErrorNone) {
    return error;
  }

  display_comp_ctx->idle_fallback = false;

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

  return kErrorNone;
}
コード例 #3
0
DisplayError ResourceDefault::ValidateDimensions(const LayerRect &crop, const LayerRect &dst) {
  if (!IsValid(crop)) {
    Log(kTagResources, "Invalid crop rect", crop);
    return kErrorNotSupported;
  }

  if (!IsValid(dst)) {
    Log(kTagResources, "Invalid dst rect", dst);
    return kErrorNotSupported;
  }

  float crop_width = crop.right - crop.left;
  float crop_height = crop.bottom - crop.top;
  float dst_width = dst.right - dst.left;
  float dst_height = dst.bottom - dst.top;

  if ((UINT32(crop_width - dst_width) == 1) || (UINT32(crop_height - dst_height) == 1)) {
    DLOGV_IF(kTagResources, "One pixel downscaling detected crop_w = %.0f, dst_w = %.0f, " \
             "crop_h = %.0f, dst_h = %.0f", crop_width, dst_width, crop_height, dst_height);
    return kErrorNotSupported;
  }

  return kErrorNone;
}
コード例 #4
0
DisplayError ResourceDefault::Config(DisplayResourceContext *display_resource_ctx,
                                HWLayers *hw_layers) {
  HWLayersInfo &layer_info = hw_layers->info;
  DisplayError error = kErrorNone;
  const Layer &layer = layer_info.hw_layers.at(0);

  error = ValidateLayerParams(&layer);
  if (error != kErrorNone) {
    return error;
  }

  struct HWLayerConfig *layer_config = &hw_layers->config[0];
  HWPipeInfo &left_pipe = layer_config->left_pipe;
  HWPipeInfo &right_pipe = layer_config->right_pipe;

  LayerRect src_rect = layer.src_rect;
  LayerRect dst_rect = layer.dst_rect;

  error = ValidateDimensions(src_rect, dst_rect);
  if (error != kErrorNone) {
    return error;
  }

  BufferLayout layout = GetBufferLayout(layer.input_buffer.format);
  error = ValidateScaling(src_rect, dst_rect, false /*rotated90 */, layout,
                          false /* use_rotator_downscale */);
  if (error != kErrorNone) {
    return error;
  }

  if (hw_res_info_.is_src_split) {
    error = SrcSplitConfig(display_resource_ctx, src_rect, dst_rect, layer_config);
  } else {
    error = DisplaySplitConfig(display_resource_ctx, src_rect, dst_rect, layer_config);
  }

  if (error != kErrorNone) {
    return error;
  }

  error = AlignPipeConfig(&layer, &left_pipe, &right_pipe);
  if (error != kErrorNone) {
    return error;
  }

  // set z_order, left_pipe should always be valid
  left_pipe.z_order = 0;

  DLOGV_IF(kTagResources, "==== FB layer Config ====");
  Log(kTagResources, "input layer src_rect", layer.src_rect);
  Log(kTagResources, "input layer dst_rect", layer.dst_rect);
  Log(kTagResources, "cropped src_rect", src_rect);
  Log(kTagResources, "cropped dst_rect", dst_rect);
  Log(kTagResources, "left pipe src", layer_config->left_pipe.src_roi);
  Log(kTagResources, "left pipe dst", layer_config->left_pipe.dst_roi);
  if (right_pipe.valid) {
    right_pipe.z_order = 0;
    Log(kTagResources, "right pipe src", layer_config->right_pipe.src_roi);
    Log(kTagResources, "right pipe dst", layer_config->right_pipe.dst_roi);
  }

  return error;
}
コード例 #5
0
DisplayError ResourceDefault::Prepare(Handle display_ctx, HWLayers *hw_layers) {
  DisplayResourceContext *display_resource_ctx =
                          reinterpret_cast<DisplayResourceContext *>(display_ctx);

  DisplayError error = kErrorNone;
  const struct HWLayersInfo &layer_info = hw_layers->info;
  HWBlockType hw_block_id = display_resource_ctx->hw_block_id;

  DLOGV_IF(kTagResources, "==== Resource reserving start: hw_block = %d ====", hw_block_id);

  if (layer_info.hw_layers.size() > 1) {
    DLOGV_IF(kTagResources, "More than one FB layers");
    return kErrorResources;
  }

  const Layer &layer = layer_info.hw_layers.at(0);

  if (layer.composition != kCompositionGPUTarget) {
    DLOGV_IF(kTagResources, "Not an FB layer");
    return kErrorParameters;
  }

  error = Config(display_resource_ctx, hw_layers);
  if (error != kErrorNone) {
    DLOGV_IF(kTagResources, "Resource config failed");
    return error;
  }

  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();
    }
  }

  uint32_t left_index = num_pipe_;
  uint32_t right_index = num_pipe_;
  bool need_scale = false;

  struct HWLayerConfig &layer_config = hw_layers->config[0];

  HWPipeInfo *left_pipe = &layer_config.left_pipe;
  HWPipeInfo *right_pipe = &layer_config.right_pipe;

  // left pipe is needed
  if (left_pipe->valid) {
    need_scale = IsScalingNeeded(left_pipe);
    left_index = GetPipe(hw_block_id, need_scale);
    if (left_index >= num_pipe_) {
      DLOGV_IF(kTagResources, "Get left pipe failed: hw_block_id = %d, need_scale = %d",
               hw_block_id, need_scale);
      ResourceStateLog();
      goto CleanupOnError;
    }
  }

  error = SetDecimationFactor(left_pipe);
  if (error != kErrorNone) {
    goto CleanupOnError;
  }

  if (!right_pipe->valid) {
    // assign single pipe
    if (left_index < num_pipe_) {
      left_pipe->pipe_id = src_pipes_[left_index].mdss_pipe_id;
    }
    DLOGV_IF(kTagResources, "1 pipe acquired for FB layer, left_pipe = %x", left_pipe->pipe_id);
    return kErrorNone;
  }

  need_scale = IsScalingNeeded(right_pipe);

  right_index = GetPipe(hw_block_id, need_scale);
  if (right_index >= num_pipe_) {
    DLOGV_IF(kTagResources, "Get right pipe failed: hw_block_id = %d, need_scale = %d", hw_block_id,
             need_scale);
    ResourceStateLog();
    goto CleanupOnError;
  }

  if (src_pipes_[right_index].priority < src_pipes_[left_index].priority) {
    // Swap pipe based on priority
    std::swap(left_index, right_index);
  }

  // assign dual pipes
  left_pipe->pipe_id = src_pipes_[left_index].mdss_pipe_id;
  right_pipe->pipe_id = src_pipes_[right_index].mdss_pipe_id;

  error = SetDecimationFactor(right_pipe);
  if (error != kErrorNone) {
    goto CleanupOnError;
  }

  DLOGV_IF(kTagResources, "2 pipes acquired for FB layer, left_pipe = %x, right_pipe = %x",
           left_pipe->pipe_id,  right_pipe->pipe_id);

  return kErrorNone;

CleanupOnError:
  DLOGV_IF(kTagResources, "Resource reserving failed! hw_block = %d", hw_block_id);

  return kErrorResources;
}
コード例 #6
0
void Log(DebugTag debug_tag, const char *prefix, const LayerRect &roi) {
  DLOGV_IF(debug_tag, "%s: left = %.0f, top = %.0f, right = %.0f, bottom = %.0f",
           prefix, roi.left, roi.top, roi.right, roi.bottom);
}