void DisplayPlaneManager::EnsureOffScreenTarget(DisplayPlaneState &plane) {
NativeSurface *surface = NULL;
+ const HwcRect<int> &display_rect = plane.GetDisplayFrame();
+ uint32_t width = display_rect.right - display_rect.left;
+ uint32_t height = display_rect.bottom - display_rect.top;
for (auto &fb : surfaces_) {
- if (!fb->InUse()) {
+ if (!fb->InUse() && fb->GetWidth() == width && fb->GetHeight() == height) {
surface = fb.get();
break;
}
}
if (!surface) {
- NativeSurface *new_surface = CreateBackBuffer(width_, height_);
+ NativeSurface *new_surface = CreateBackBuffer(width, height);
new_surface->Init(buffer_handler_);
surfaces_.emplace_back(std::move(new_surface));
surface = surfaces_.back().get();
IDISPLAYMANAGERTRACE("buffer->GetFb() ---------------------- STARTS %d",
buffer->GetFb());
+
int success =
drmModeAtomicAddProperty(property_set, id_, crtc_prop_.id, crtc_id) < 0;
success |= drmModeAtomicAddProperty(property_set, id_, fb_prop_.id,
layer->GetDisplayFrameWidth()) < 0;
success |= drmModeAtomicAddProperty(property_set, id_, crtc_h_prop_.id,
layer->GetDisplayFrameHeight()) < 0;
+
+ int src_y = static_cast<int>(source_crop.top) << 16;
+ if (layer->GetSourceCropHeight() == layer->GetDisplayFrameHeight())
+ src_y = 0;
+
+ int src_x = static_cast<int>(source_crop.left) << 16;
+ if (layer->GetSourceCropWidth() == layer->GetDisplayFrameWidth())
+ src_x = 0;
+
success |=
- drmModeAtomicAddProperty(property_set, id_, src_x_prop_.id,
- static_cast<int>(source_crop.left) << 16) < 0;
+ drmModeAtomicAddProperty(property_set, id_, src_x_prop_.id, src_x) < 0;
success |=
- drmModeAtomicAddProperty(property_set, id_, src_y_prop_.id,
- static_cast<int>(source_crop.top) << 16) < 0;
+ drmModeAtomicAddProperty(property_set, id_, src_y_prop_.id, src_y) < 0;
success |= drmModeAtomicAddProperty(property_set, id_, src_w_prop_.id,
layer->GetSourceCropWidth() << 16) < 0;
success |= drmModeAtomicAddProperty(property_set, id_, src_h_prop_.id,