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 @@
#include <utility>
#include "base/files/platform_file.h"
#include "ui/gfx/geometry/rect_conversions.h"
#include "ui/gfx/geometry/size_conversions.h"
#include "ui/gfx/gpu_fence.h"
#include "ui/ozone/common/linux/drm_util_linux.h"
......@@ -57,15 +58,15 @@ DrmOverlayValidator::DrmOverlayValidator(DrmWindow* window) : window_(window) {}
DrmOverlayValidator::~DrmOverlayValidator() {}
std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
const std::vector<OverlayCheck_Params>& params,
OverlayStatusList DrmOverlayValidator::TestPageFlip(
const OverlaySurfaceCandidateList& params,
const DrmOverlayPlaneList& last_used_planes) {
std::vector<OverlayCheckReturn_Params> returns(params.size());
OverlayStatusList returns(params.size());
HardwareDisplayController* controller = window_->GetController();
if (!controller) {
// The controller is not yet installed.
for (auto& param : returns)
param.status = OVERLAY_STATUS_NOT;
param = OVERLAY_STATUS_NOT;
return returns;
}
......@@ -78,8 +79,8 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
reusable_buffers.push_back(plane.buffer);
for (size_t i = 0; i < params.size(); ++i) {
if (!params[i].is_overlay_candidate) {
returns[i].status = OVERLAY_STATUS_NOT;
if (!params[i].overlay_handled) {
returns[i] = OVERLAY_STATUS_NOT;
continue;
}
......@@ -88,12 +89,13 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
GetFourCCFormatFromBufferFormat(params[i].format), &reusable_buffers);
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);
test_list.push_back(std::move(plane));
if (buffer && controller->TestPageFlip(test_list)) {
returns[i].status = OVERLAY_STATUS_ABLE;
returns[i] = OVERLAY_STATUS_ABLE;
} else {
// If test failed here, platform cannot support this configuration
// with current combination of layers. This is usually the case when this
......@@ -101,7 +103,7 @@ std::vector<OverlayCheckReturn_Params> DrmOverlayValidator::TestPageFlip(
// hardware resources and they might be already in use by other planes.
// For example this plane has requested scaling capabilities and all
// available scalars are already in use by other planes.
returns[i].status = OVERLAY_STATUS_NOT;
returns[i] = OVERLAY_STATUS_NOT;
test_list.pop_back();
}
}
......
......@@ -7,12 +7,11 @@
#include "base/containers/mru_cache.h"
#include "ui/ozone/platform/drm/gpu/drm_overlay_plane.h"
#include "ui/ozone/public/overlay_surface_candidate.h"
namespace ui {
class DrmWindow;
struct OverlayCheck_Params;
struct OverlayCheckReturn_Params;
class DrmOverlayValidator {
public:
......@@ -22,8 +21,7 @@ class DrmOverlayValidator {
// Tests if configurations |params| are compatible with |window_| and finds
// which of these configurations can be promoted to Overlay composition
// without failing the page flip. It expects |params| to be sorted by z_order.
std::vector<OverlayCheckReturn_Params> TestPageFlip(
const std::vector<OverlayCheck_Params>& params,
OverlayStatusList TestPageFlip(const OverlaySurfaceCandidateList& params,
const DrmOverlayPlaneList& last_used_planes);
private:
......
......@@ -303,11 +303,9 @@ void DrmThread::CheckOverlayCapabilities(
const OverlayStatusList&)> callback) {
TRACE_EVENT0("drm,hwoverlays", "DrmThread::CheckOverlayCapabilities");
auto params = CreateParamsFromOverlaySurfaceCandidate(overlays);
std::move(callback).Run(
widget, overlays,
CreateOverlayStatusListFrom(
screen_manager_->GetWindow(widget)->TestPageFlip(params)));
screen_manager_->GetWindow(widget)->TestPageFlip(overlays));
}
void DrmThread::GetDeviceCursor(
......
......@@ -128,8 +128,8 @@ void DrmWindow::SchedulePageFlip(
std::move(presentation_callback));
}
std::vector<OverlayCheckReturn_Params> DrmWindow::TestPageFlip(
const std::vector<OverlayCheck_Params>& overlay_params) {
OverlayStatusList DrmWindow::TestPageFlip(
const OverlaySurfaceCandidateList& overlay_params) {
return overlay_validator_->TestPageFlip(overlay_params,
last_submitted_planes_);
}
......
......@@ -17,6 +17,7 @@
#include "ui/gfx/vsync_provider.h"
#include "ui/ozone/platform/drm/gpu/drm_overlay_plane.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"
class SkBitmap;
......@@ -31,8 +32,6 @@ namespace ui {
class DrmDeviceManager;
class DrmOverlayValidator;
class HardwareDisplayController;
struct OverlayCheck_Params;
struct OverlayCheckReturn_Params;
class ScreenManager;
// The GPU object representing a window.
......@@ -82,8 +81,8 @@ class DrmWindow {
void SchedulePageFlip(std::vector<DrmOverlayPlane> planes,
SwapCompletionOnceCallback submission_callback,
PresentationOnceCallback presentation_callback);
std::vector<OverlayCheckReturn_Params> TestPageFlip(
const std::vector<OverlayCheck_Params>& overlay_params);
OverlayStatusList TestPageFlip(
const OverlaySurfaceCandidateList& overlay_params);
// Returns the last buffer associated with this window.
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