Commit 646dd5bc authored by Saman Sami's avatar Saman Sami Committed by Commit Bot

Don't use IPC structs in DrmWindow::TestPageFlip

Instead of OverlayCheck_Params and OverlayCheckReturn_Params, use
OverlaySurfaceCandidate and OverlayStatus respectively. The IPC structs
are going away in the long term with the switch to mojo and they
prevent us from adding more fields that may not be serializable (e.g.
NativePixmap).

Bug: 756454
Change-Id: I8fc8c975cd1f67706329c8ea9a38503e196068a0
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1850537
Commit-Queue: Saman Sami <samans@chromium.org>
Reviewed-by: default avatarRobert Kroeger <rjkroege@chromium.org>
Cr-Commit-Position: refs/heads/master@{#706575}
parent 93b6e358
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include <utility> #include <utility>
#include "base/files/platform_file.h" #include "base/files/platform_file.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h" #include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/gpu_fence.h" #include "ui/gfx/gpu_fence.h"
#include "ui/ozone/common/linux/drm_util_linux.h" #include "ui/ozone/common/linux/drm_util_linux.h"
...@@ -57,15 +58,15 @@ DrmOverlayValidator::DrmOverlayValidator(DrmWindow* window) : window_(window) {} ...@@ -57,15 +58,15 @@ DrmOverlayValidator::DrmOverlayValidator(DrmWindow* window) : window_(window) {}
DrmOverlayValidator::~DrmOverlayValidator() {} DrmOverlayValidator::~DrmOverlayValidator() {}
std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip( OverlayStatusList DrmOverlayValidator::TestPageFlip(
const std::vector<OverlayCheck_Params>& params, const OverlaySurfaceCandidateList& params,
const DrmOverlayPlaneList& last_used_planes) { const DrmOverlayPlaneList& last_used_planes) {
std::vector<OverlayCheckReturn_Params> returns(params.size()); OverlayStatusList returns(params.size());
HardwareDisplayController* controller = window_->GetController(); HardwareDisplayController* controller = window_->GetController();
if (!controller) { if (!controller) {
// The controller is not yet installed. // The controller is not yet installed.
for (auto& param : returns) for (auto& param : returns)
param.status = OVERLAY_STATUS_NOT; param = OVERLAY_STATUS_NOT;
return returns; return returns;
} }
...@@ -78,8 +79,8 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip( ...@@ -78,8 +79,8 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
reusable_buffers.push_back(plane.buffer); reusable_buffers.push_back(plane.buffer);
for (size_t i = 0; i < params.size(); ++i) { for (size_t i = 0; i < params.size(); ++i) {
if (!params[i].is_overlay_candidate) { if (!params[i].overlay_handled) {
returns[i].status = OVERLAY_STATUS_NOT; returns[i] = OVERLAY_STATUS_NOT;
continue; continue;
} }
...@@ -88,12 +89,13 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip( ...@@ -88,12 +89,13 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
GetFourCCFormatFromBufferFormat(params[i].format), &reusable_buffers); GetFourCCFormatFromBufferFormat(params[i].format), &reusable_buffers);
DrmOverlayPlane plane(buffer, params[i].plane_z_order, params[i].transform, DrmOverlayPlane plane(buffer, params[i].plane_z_order, params[i].transform,
params[i].display_rect, params[i].crop_rect, gfx::ToNearestRect(params[i].display_rect),
params[i].crop_rect,
/* enable_blend */ true, /* gpu_fence */ nullptr); /* enable_blend */ true, /* gpu_fence */ nullptr);
test_list.push_back(std::move(plane)); test_list.push_back(std::move(plane));
if (buffer && controller->TestPageFlip(test_list)) { if (buffer && controller->TestPageFlip(test_list)) {
returns[i].status = OVERLAY_STATUS_ABLE; returns[i] = OVERLAY_STATUS_ABLE;
} else { } else {
// If test failed here, platform cannot support this configuration // If test failed here, platform cannot support this configuration
// with current combination of layers. This is usually the case when this // with current combination of layers. This is usually the case when this
...@@ -101,7 +103,7 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip( ...@@ -101,7 +103,7 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
// hardware resources and they might be already in use by other planes. // hardware resources and they might be already in use by other planes.
// For example this plane has requested scaling capabilities and all // For example this plane has requested scaling capabilities and all
// available scalars are already in use by other planes. // available scalars are already in use by other planes.
returns[i].status = OVERLAY_STATUS_NOT; returns[i] = OVERLAY_STATUS_NOT;
test_list.pop_back(); test_list.pop_back();
} }
} }
......
...@@ -7,12 +7,11 @@ ...@@ -7,12 +7,11 @@
#include "base/containers/mru_cache.h" #include "base/containers/mru_cache.h"
#include "ui/ozone/platform/drm/gpu/drm_overlay_plane.h" #include "ui/ozone/platform/drm/gpu/drm_overlay_plane.h"
#include "ui/ozone/public/overlay_surface_candidate.h"
namespace ui { namespace ui {
class DrmWindow; class DrmWindow;
struct OverlayCheck_Params;
struct OverlayCheckReturn_Params;
class DrmOverlayValidator { class DrmOverlayValidator {
public: public:
...@@ -22,9 +21,8 @@ class DrmOverlayValidator { ...@@ -22,9 +21,8 @@ class DrmOverlayValidator {
// Tests if configurations |params| are compatible with |window_| and finds // Tests if configurations |params| are compatible with |window_| and finds
// which of these configurations can be promoted to Overlay composition // which of these configurations can be promoted to Overlay composition
// without failing the page flip. It expects |params| to be sorted by z_order. // without failing the page flip. It expects |params| to be sorted by z_order.
std::vector<OverlayCheckReturn_Params> TestPageFlip( OverlayStatusList TestPageFlip(const OverlaySurfaceCandidateList& params,
const std::vector<OverlayCheck_Params>& params, const DrmOverlayPlaneList& last_used_planes);
const DrmOverlayPlaneList& last_used_planes);
private: private:
DrmWindow* const window_; // Not owned. DrmWindow* const window_; // Not owned.
......
...@@ -303,11 +303,9 @@ void DrmThread::CheckOverlayCapabilities( ...@@ -303,11 +303,9 @@ void DrmThread::CheckOverlayCapabilities(
const OverlayStatusList&)> callback) { const OverlayStatusList&)> callback) {
TRACE_EVENT0("drm,hwoverlays", "DrmThread::CheckOverlayCapabilities"); TRACE_EVENT0("drm,hwoverlays", "DrmThread::CheckOverlayCapabilities");
auto params = CreateParamsFromOverlaySurfaceCandidate(overlays);
std::move(callback).Run( std::move(callback).Run(
widget, overlays, widget, overlays,
CreateOverlayStatusListFrom( screen_manager_->GetWindow(widget)->TestPageFlip(overlays));
screen_manager_->GetWindow(widget)->TestPageFlip(params)));
} }
void DrmThread::GetDeviceCursor( void DrmThread::GetDeviceCursor(
......
...@@ -128,8 +128,8 @@ void DrmWindow::SchedulePageFlip( ...@@ -128,8 +128,8 @@ void DrmWindow::SchedulePageFlip(
std::move(presentation_callback)); std::move(presentation_callback));
} }
std::vector<OverlayCheckReturn_Params> DrmWindow::TestPageFlip( OverlayStatusList DrmWindow::TestPageFlip(
const std::vector<OverlayCheck_Params>& overlay_params) { const OverlaySurfaceCandidateList& overlay_params) {
return overlay_validator_->TestPageFlip(overlay_params, return overlay_validator_->TestPageFlip(overlay_params,
last_submitted_planes_); last_submitted_planes_);
} }
......
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include "ui/gfx/vsync_provider.h" #include "ui/gfx/vsync_provider.h"
#include "ui/ozone/platform/drm/gpu/drm_overlay_plane.h" #include "ui/ozone/platform/drm/gpu/drm_overlay_plane.h"
#include "ui/ozone/platform/drm/gpu/page_flip_request.h" #include "ui/ozone/platform/drm/gpu/page_flip_request.h"
#include "ui/ozone/public/overlay_surface_candidate.h"
#include "ui/ozone/public/swap_completion_callback.h" #include "ui/ozone/public/swap_completion_callback.h"
class SkBitmap; class SkBitmap;
...@@ -31,8 +32,6 @@ namespace ui { ...@@ -31,8 +32,6 @@ namespace ui {
class DrmDeviceManager; class DrmDeviceManager;
class DrmOverlayValidator; class DrmOverlayValidator;
class HardwareDisplayController; class HardwareDisplayController;
struct OverlayCheck_Params;
struct OverlayCheckReturn_Params;
class ScreenManager; class ScreenManager;
// The GPU object representing a window. // The GPU object representing a window.
...@@ -82,8 +81,8 @@ class DrmWindow { ...@@ -82,8 +81,8 @@ class DrmWindow {
void SchedulePageFlip(std::vector<DrmOverlayPlane> planes, void SchedulePageFlip(std::vector<DrmOverlayPlane> planes,
SwapCompletionOnceCallback submission_callback, SwapCompletionOnceCallback submission_callback,
PresentationOnceCallback presentation_callback); PresentationOnceCallback presentation_callback);
std::vector<OverlayCheckReturn_Params> TestPageFlip( OverlayStatusList TestPageFlip(
const std::vector<OverlayCheck_Params>& overlay_params); const OverlaySurfaceCandidateList& overlay_params);
// Returns the last buffer associated with this window. // Returns the last buffer associated with this window.
const DrmOverlayPlane* GetLastModesetBuffer() const; const DrmOverlayPlane* GetLastModesetBuffer() const;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment