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
|
||||
* modification, are permitted provided that the following conditions are
|
||||
@@ -498,6 +498,7 @@ struct DRMConnectorInfo {
|
||||
struct DRMDisplayToken {
|
||||
uint32_t conn_id;
|
||||
uint32_t crtc_id;
|
||||
uint32_t crtc_index;
|
||||
};
|
||||
|
||||
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
|
||||
* 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 {
|
||||
token->conn_id = token_.conn_id;
|
||||
token->crtc_id = token_.crtc_id;
|
||||
*token = token_;
|
||||
}
|
||||
|
||||
void HWDeviceDRM::UpdateMixerAttributes() {
|
||||
|
||||
@@ -64,19 +64,18 @@ DisplayError HWEventsDRM::InitializePollFd() {
|
||||
|
||||
switch (event_data.event_type) {
|
||||
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;
|
||||
DRMMaster *master = nullptr;
|
||||
int ret = DRMMaster::GetInstance(&master);
|
||||
if (ret < 0) {
|
||||
DLOGE("Failed to acquire DRMMaster instance");
|
||||
return kErrorNotSupported;
|
||||
if (is_primary_) {
|
||||
DRMMaster *master = nullptr;
|
||||
int ret = DRMMaster::GetInstance(&master);
|
||||
if (ret < 0) {
|
||||
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;
|
||||
} break;
|
||||
case HWEvent::EXIT: {
|
||||
@@ -197,11 +196,8 @@ DisplayError HWEventsDRM::Init(int display_type, HWEventHandler *event_handler,
|
||||
return kErrorResources;
|
||||
}
|
||||
|
||||
if (is_primary_) {
|
||||
RegisterVSync();
|
||||
vsync_registered_ = true;
|
||||
}
|
||||
|
||||
RegisterVSync();
|
||||
vsync_registered_ = true;
|
||||
RegisterPanelDead(true);
|
||||
RegisterIdleNotify(true);
|
||||
RegisterIdlePowerCollapse(true);
|
||||
@@ -226,9 +222,6 @@ DisplayError HWEventsDRM::SetEventState(HWEvent event, bool enable, void *arg) {
|
||||
switch (event) {
|
||||
case HWEvent::VSYNC: {
|
||||
std::lock_guard<std::mutex> lock(vsync_mutex_);
|
||||
if (!is_primary_) {
|
||||
break;
|
||||
}
|
||||
vsync_enabled_ = enable;
|
||||
if (vsync_enabled_ && !vsync_registered_) {
|
||||
RegisterVSync();
|
||||
@@ -261,7 +254,9 @@ DisplayError HWEventsDRM::CloseFds() {
|
||||
for (uint32_t i = 0; i < event_data_list_.size(); i++) {
|
||||
switch (event_data_list_[i].event_type) {
|
||||
case HWEvent::VSYNC:
|
||||
// TODO(user): close for secondary
|
||||
if (!is_primary_) {
|
||||
Sys::close_(poll_fds_[i].fd);
|
||||
}
|
||||
poll_fds_[i].fd = -1;
|
||||
break;
|
||||
case HWEvent::EXIT:
|
||||
@@ -347,9 +342,10 @@ void *HWEventsDRM::DisplayEventHandler() {
|
||||
}
|
||||
|
||||
DisplayError HWEventsDRM::RegisterVSync() {
|
||||
// TODO(user): For secondary use DRM_VBLANK_HIGH_CRTC_MASK and DRM_VBLANK_HIGH_CRTC_SHIFT
|
||||
drmVBlank vblank{};
|
||||
vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT);
|
||||
drmVBlank vblank {};
|
||||
uint32_t high_crtc = token_.crtc_index << DRM_VBLANK_HIGH_CRTC_SHIFT;
|
||||
vblank.request.type = (drmVBlankSeqType)(DRM_VBLANK_RELATIVE | DRM_VBLANK_EVENT |
|
||||
(high_crtc & DRM_VBLANK_HIGH_CRTC_MASK));
|
||||
vblank.request.sequence = 1;
|
||||
// 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
|
||||
|
||||
Reference in New Issue
Block a user