sdm: Add support for secondary vsync
Add support for enabling secondary vsync Change-Id: Ia2231a19292314513d613efbb6953b1943530af0 CRs-fixed: 2184506
This commit is contained in:
committed by
Gerrit - the friendly Code Review server
parent
58d0e0f083
commit
2d17974a41
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -498,6 +498,7 @@ struct DRMConnectorInfo {
|
|||||||
struct DRMDisplayToken {
|
struct DRMDisplayToken {
|
||||||
uint32_t conn_id;
|
uint32_t conn_id;
|
||||||
uint32_t crtc_id;
|
uint32_t crtc_id;
|
||||||
|
uint32_t crtc_index;
|
||||||
};
|
};
|
||||||
|
|
||||||
enum DRMPPFeatureID {
|
enum DRMPPFeatureID {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
/*
|
/*
|
||||||
* Copyright (c) 2017, The Linux Foundation. All rights reserved.
|
* Copyright (c) 2017-2018, The Linux Foundation. All rights reserved.
|
||||||
*
|
*
|
||||||
* Redistribution and use in source and binary forms, with or without
|
* Redistribution and use in source and binary forms, with or without
|
||||||
* modification, are permitted provided that the following conditions are
|
* modification, are permitted provided that the following conditions are
|
||||||
@@ -1484,8 +1484,7 @@ DisplayError HWDeviceDRM::GetMixerAttributes(HWMixerAttributes *mixer_attributes
|
|||||||
}
|
}
|
||||||
|
|
||||||
void HWDeviceDRM::GetDRMDisplayToken(sde_drm::DRMDisplayToken *token) const {
|
void HWDeviceDRM::GetDRMDisplayToken(sde_drm::DRMDisplayToken *token) const {
|
||||||
token->conn_id = token_.conn_id;
|
*token = token_;
|
||||||
token->crtc_id = token_.crtc_id;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void HWDeviceDRM::UpdateMixerAttributes() {
|
void HWDeviceDRM::UpdateMixerAttributes() {
|
||||||
|
|||||||
@@ -64,19 +64,18 @@ DisplayError HWEventsDRM::InitializePollFd() {
|
|||||||
|
|
||||||
switch (event_data.event_type) {
|
switch (event_data.event_type) {
|
||||||
case HWEvent::VSYNC: {
|
case HWEvent::VSYNC: {
|
||||||
if (!is_primary_) {
|
|
||||||
// TODO(user): Once secondary support is added, use a different fd by calling drmOpen
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
poll_fds_[i].events = POLLIN | POLLPRI | POLLERR;
|
poll_fds_[i].events = POLLIN | POLLPRI | POLLERR;
|
||||||
DRMMaster *master = nullptr;
|
if (is_primary_) {
|
||||||
int ret = DRMMaster::GetInstance(&master);
|
DRMMaster *master = nullptr;
|
||||||
if (ret < 0) {
|
int ret = DRMMaster::GetInstance(&master);
|
||||||
DLOGE("Failed to acquire DRMMaster instance");
|
if (ret < 0) {
|
||||||
return kErrorNotSupported;
|
DLOGE("Failed to acquire DRMMaster instance");
|
||||||
|
return kErrorNotSupported;
|
||||||
|
}
|
||||||
|
master->GetHandle(&poll_fds_[i].fd);
|
||||||
|
} else {
|
||||||
|
poll_fds_[i].fd = drmOpen("msm_drm", nullptr);
|
||||||
}
|
}
|
||||||
master->GetHandle(&poll_fds_[i].fd);
|
|
||||||
vsync_index_ = i;
|
vsync_index_ = i;
|
||||||
} break;
|
} break;
|
||||||
case HWEvent::EXIT: {
|
case HWEvent::EXIT: {
|
||||||
@@ -197,11 +196,8 @@ DisplayError HWEventsDRM::Init(int display_type, HWEventHandler *event_handler,
|
|||||||
return kErrorResources;
|
return kErrorResources;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (is_primary_) {
|
RegisterVSync();
|
||||||
RegisterVSync();
|
vsync_registered_ = true;
|
||||||
vsync_registered_ = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
RegisterPanelDead(true);
|
RegisterPanelDead(true);
|
||||||
RegisterIdleNotify(true);
|
RegisterIdleNotify(true);
|
||||||
RegisterIdlePowerCollapse(true);
|
RegisterIdlePowerCollapse(true);
|
||||||
@@ -226,9 +222,6 @@ DisplayError HWEventsDRM::SetEventState(HWEvent event, bool enable, void *arg) {
|
|||||||
switch (event) {
|
switch (event) {
|
||||||
case HWEvent::VSYNC: {
|
case HWEvent::VSYNC: {
|
||||||
std::lock_guard<std::mutex> lock(vsync_mutex_);
|
std::lock_guard<std::mutex> lock(vsync_mutex_);
|
||||||
if (!is_primary_) {
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
vsync_enabled_ = enable;
|
vsync_enabled_ = enable;
|
||||||
if (vsync_enabled_ && !vsync_registered_) {
|
if (vsync_enabled_ && !vsync_registered_) {
|
||||||
RegisterVSync();
|
RegisterVSync();
|
||||||
@@ -261,7 +254,9 @@ DisplayError HWEventsDRM::CloseFds() {
|
|||||||
for (uint32_t i = 0; i < event_data_list_.size(); i++) {
|
for (uint32_t i = 0; i < event_data_list_.size(); i++) {
|
||||||
switch (event_data_list_[i].event_type) {
|
switch (event_data_list_[i].event_type) {
|
||||||
case HWEvent::VSYNC:
|
case HWEvent::VSYNC:
|
||||||
// TODO(user): close for secondary
|
if (!is_primary_) {
|
||||||
|
Sys::close_(poll_fds_[i].fd);
|
||||||
|
}
|
||||||
poll_fds_[i].fd = -1;
|
poll_fds_[i].fd = -1;
|
||||||
break;
|
break;
|
||||||
case HWEvent::EXIT:
|
case HWEvent::EXIT:
|
||||||
@@ -347,9 +342,10 @@ void *HWEventsDRM::DisplayEventHandler() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
DisplayError HWEventsDRM::RegisterVSync() {
|
DisplayError HWEventsDRM::RegisterVSync() {
|
||||||
// TODO(user): For secondary use DRM_VBLANK_HIGH_CRTC_MASK and DRM_VBLANK_HIGH_CRTC_SHIFT
|
drmVBlank vblank {};
|
||||||
drmVBlank vblank{};
|
uint32_t high_crtc = token_.crtc_index << DRM_VBLANK_HIGH_CRTC_SHIFT;
|
||||||
vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT);
|
vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT |
|
||||||
|
(high_crtc & DRM_VBLANK_HIGH_CRTC_MASK));
|
||||||
vblank.request.sequence = 1;
|
vblank.request.sequence = 1;
|
||||||
// DRM hack to pass in context to unused field signal. Driver will write this to the node being
|
// DRM hack to pass in context to unused field signal. Driver will write this to the node being
|
||||||
// polled on, and will be read as part of drm event handling and sent to handler
|
// polled on, and will be read as part of drm event handling and sent to handler
|
||||||
|
|||||||
Reference in New Issue
Block a user