Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(69)

Unified Diff: ui/ozone/platform/drm/gpu/drm_window.cc

Issue 1426993003: Ozone: Dont hardcode format to YUV when using Overlay Composition. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: cosmetic fixes Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
Index: ui/ozone/platform/drm/gpu/drm_window.cc
diff --git a/ui/ozone/platform/drm/gpu/drm_window.cc b/ui/ozone/platform/drm/gpu/drm_window.cc
index 29c9a8a58b54dd5748846260f219925aa33484f8..c553c0b81df5450710a38154b7d52942160335ab 100644
--- a/ui/ozone/platform/drm/gpu/drm_window.cc
+++ b/ui/ozone/platform/drm/gpu/drm_window.cc
@@ -4,20 +4,16 @@
#include "ui/ozone/platform/drm/gpu/drm_window.h"
-#include <drm_fourcc.h>
-
#include "base/time/time.h"
#include "base/trace_event/trace_event.h"
#include "third_party/skia/include/core/SkBitmap.h"
#include "third_party/skia/include/core/SkDevice.h"
#include "third_party/skia/include/core/SkSurface.h"
-#include "ui/ozone/common/gpu/ozone_gpu_message_params.h"
-#include "ui/ozone/platform/drm/common/drm_util.h"
#include "ui/ozone/platform/drm/gpu/crtc_controller.h"
#include "ui/ozone/platform/drm/gpu/drm_buffer.h"
#include "ui/ozone/platform/drm/gpu/drm_device.h"
#include "ui/ozone/platform/drm/gpu/drm_device_manager.h"
-#include "ui/ozone/platform/drm/gpu/scanout_buffer.h"
+#include "ui/ozone/platform/drm/gpu/drm_overlay_candidate.h"
#include "ui/ozone/platform/drm/gpu/screen_manager.h"
namespace ui {
@@ -64,6 +60,7 @@ void DrmWindow::Initialize() {
TRACE_EVENT1("drm", "DrmWindow::Initialize", "widget", widget_);
device_manager_->UpdateDrmDevice(widget_, nullptr);
+ overlay_validator_ = make_scoped_ptr(new DrmOverlayCandidate(this));
}
void DrmWindow::Shutdown() {
@@ -141,66 +138,12 @@ void DrmWindow::SchedulePageFlip(const std::vector<OverlayPlane>& planes,
}
std::vector<OverlayCheck_Params> DrmWindow::TestPageFlip(
- const std::vector<OverlayCheck_Params>& overlays,
+ const std::vector<OverlayCheck_Params>& current_combination,
+ const std::vector<OverlayCheck_Params>& new_combination,
ScanoutBufferGenerator* buffer_generator) {
- std::vector<OverlayCheck_Params> params;
- if (!controller_) {
- // Nothing much we can do here.
- return params;
- }
-
- OverlayPlaneList compatible_test_list;
- scoped_refptr<DrmDevice> drm = controller_->GetAllocationDrmDevice();
- for (const auto& overlay : overlays) {
- OverlayCheck_Params overlay_params(overlay);
- gfx::Size size =
- (overlay.plane_z_order == 0) ? bounds().size() : overlay.buffer_size;
- scoped_refptr<ScanoutBuffer> buffer;
- // Check if we can re-use existing buffers.
- for (const auto& plane : last_submitted_planes_) {
- uint32_t format = GetFourCCFormatFromBufferFormat(overlay.format);
- // We always use a storage type of XRGB, even if the pixel format
- // is ARGB.
- if (format == DRM_FORMAT_ARGB8888)
- format = DRM_FORMAT_XRGB8888;
-
- if (plane.buffer->GetFramebufferPixelFormat() == format &&
- plane.z_order == overlay.plane_z_order &&
- plane.display_bounds == overlay.display_rect &&
- plane.buffer->GetSize() == size) {
- buffer = plane.buffer;
- break;
- }
- }
-
- if (!buffer)
- buffer = buffer_generator->Create(drm, overlay.format, size);
-
- if (!buffer)
- continue;
-
- OverlayPlane plane(buffer, overlay.plane_z_order, overlay.transform,
- overlay.display_rect, overlay.crop_rect);
-
- // Buffer for Primary plane should always be present for compatibility test.
- if (!compatible_test_list.size() && overlay.plane_z_order != 0) {
- compatible_test_list.push_back(
- *OverlayPlane::GetPrimaryPlane(last_submitted_planes_));
- }
-
- compatible_test_list.push_back(plane);
-
- if (controller_->TestPageFlip(compatible_test_list)) {
- overlay_params.plane_ids =
- controller_->GetCompatibleHardwarePlaneIds(plane);
- params.push_back(overlay_params);
- }
-
- if (compatible_test_list.size() > 1)
- compatible_test_list.pop_back();
- }
-
- return params;
+ return overlay_validator_->TestPageFlip(current_combination, new_combination,
+ last_submitted_planes_,
+ buffer_generator);
}
const OverlayPlane* DrmWindow::GetLastModesetBuffer() {
@@ -229,6 +172,11 @@ void DrmWindow::GetVSyncParameters(
callback.Run(timebase, interval);
}
+void DrmWindow::GetOverlayBufferConfigurations(
+ const OverlayParamCallback& callback) const {
+ callback.Run(overlay_validator_->GetOverlayConfigurations());
+}
+
void DrmWindow::ResetCursor(bool bitmap_only) {
if (!controller_)
return;

Powered by Google App Engine
This is Rietveld 408576698