Commit cde126fd authored by achaulk's avatar achaulk Committed by Commit bot

ozone: Add ability to set client capabilities which we will need for atomic

Committed: https://crrev.com/e5983b7fde9d576bd514490106564e2238eb0713
Cr-Commit-Position: refs/heads/master@{#326860}

Review URL: https://codereview.chromium.org/1100803004

Cr-Commit-Position: refs/heads/master@{#329907}
parent e544d83b
......@@ -575,6 +575,11 @@ bool DrmDevice::CommitProperties(drmModePropertySet* properties,
#endif // defined(USE_DRM_ATOMIC)
}
bool DrmDevice::SetCapability(uint64_t capability, uint64_t value) {
DCHECK(file_.IsValid());
return !drmSetClientCap(file_.GetPlatformFile(), capability, value);
}
bool DrmDevice::SetMaster() {
DCHECK(file_.IsValid());
return (drmSetMaster(file_.GetPlatformFile()) == 0);
......
......@@ -165,6 +165,8 @@ class OZONE_EXPORT DrmDevice : public base::RefCountedThreadSafe<DrmDevice> {
virtual bool SetGammaRamp(uint32_t crtc_id,
const std::vector<GammaRampRGBEntry>& lut);
virtual bool SetCapability(uint64_t capability, uint64_t value);
// Drm master related
virtual bool SetMaster();
virtual bool DropMaster();
......
......@@ -67,6 +67,14 @@ HardwareDisplayPlaneManager::~HardwareDisplayPlaneManager() {
bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) {
drm_ = drm;
// Try to get all of the planes if possible, so we don't have to try to
// discover hidden primary planes.
bool has_universal_planes = false;
#if defined(DRM_CLIENT_CAP_UNIVERSAL_PLANES)
has_universal_planes = drm->SetCapability(DRM_CLIENT_CAP_UNIVERSAL_PLANES, 1);
#endif // defined(DRM_CLIENT_CAP_UNIVERSAL_PLANES)
ScopedDrmResourcesPtr resources(drmModeGetResources(drm->get_fd()));
if (!resources) {
PLOG(ERROR) << "Failed to get resources";
......@@ -104,13 +112,15 @@ bool HardwareDisplayPlaneManager::Initialize(DrmDevice* drm) {
// dummy plane for which we can assign exactly one overlay.
// TODO(dnicoara): refactor this to simplify AssignOverlayPlanes and move
// this workaround into HardwareDisplayPlaneLegacy.
for (int i = 0; i < resources->count_crtcs; ++i) {
if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) {
scoped_ptr<HardwareDisplayPlane> dummy_plane(
CreatePlane(resources->crtcs[i] - 1, (1 << i)));
dummy_plane->set_is_dummy(true);
if (dummy_plane->Initialize(drm))
planes_.push_back(dummy_plane.release());
if (!has_universal_planes) {
for (int i = 0; i < resources->count_crtcs; ++i) {
if (plane_ids.find(resources->crtcs[i] - 1) == plane_ids.end()) {
scoped_ptr<HardwareDisplayPlane> dummy_plane(
CreatePlane(resources->crtcs[i] - 1, (1 << i)));
dummy_plane->set_is_dummy(true);
if (dummy_plane->Initialize(drm))
planes_.push_back(dummy_plane.release());
}
}
}
......
......@@ -245,6 +245,10 @@ bool MockDrmDevice::SetGammaRamp(uint32_t crtc_id,
return true;
}
bool MockDrmDevice::SetCapability(uint64_t capability, uint64_t value) {
return false;
}
void MockDrmDevice::RunCallbacks() {
while (!callbacks_.empty()) {
PageFlipCallback callback = callbacks_.front();
......
......@@ -111,6 +111,7 @@ class MockDrmDevice : public ui::DrmDevice {
const PageFlipCallback& callback) override;
bool SetGammaRamp(uint32_t crtc_id,
const std::vector<GammaRampRGBEntry>& lut) override;
bool SetCapability(uint64_t capability, uint64_t value) override;
private:
~MockDrmDevice() override;
......
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