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