summaryrefslogtreecommitdiffstats
path: root/minui/graphics_drm.cpp
diff options
context:
space:
mode:
authorTianjie Xu <xunchang@google.com>2018-06-06 22:32:54 +0200
committerandroid-build-merger <android-build-merger@google.com>2018-06-06 22:32:54 +0200
commitc8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b (patch)
treed6d714915fdd9bb45275a1ff2f1e1a99251a9959 /minui/graphics_drm.cpp
parentMerge "ui: join only if joinable." (diff)
parentMerge "minui: Handle the failures from the drm backend in gr_init" (diff)
downloadandroid_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.tar
android_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.tar.gz
android_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.tar.bz2
android_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.tar.lz
android_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.tar.xz
android_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.tar.zst
android_bootable_recovery-c8d9d6ca17ff7a3059002ff12ac23d00b8c25f6b.zip
Diffstat (limited to 'minui/graphics_drm.cpp')
-rw-r--r--minui/graphics_drm.cpp17
1 files changed, 11 insertions, 6 deletions
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp
index e7d4b38ef..4c98507f6 100644
--- a/minui/graphics_drm.cpp
+++ b/minui/graphics_drm.cpp
@@ -45,15 +45,17 @@ void MinuiBackendDrm::DrmDisableCrtc(int drm_fd, drmModeCrtc* crtc) {
}
}
-void MinuiBackendDrm::DrmEnableCrtc(int drm_fd, drmModeCrtc* crtc, GRSurfaceDrm* surface) {
- int32_t ret = drmModeSetCrtc(drm_fd, crtc->crtc_id, surface->fb_id, 0, 0, // x,y
- &main_monitor_connector->connector_id,
- 1, // connector_count
- &main_monitor_crtc->mode);
+int MinuiBackendDrm::DrmEnableCrtc(int drm_fd, drmModeCrtc* crtc, GRSurfaceDrm* surface) {
+ int ret = drmModeSetCrtc(drm_fd, crtc->crtc_id, surface->fb_id, 0, 0, // x,y
+ &main_monitor_connector->connector_id,
+ 1, // connector_count
+ &main_monitor_crtc->mode);
if (ret) {
printf("drmModeSetCrtc failed ret=%d\n", ret);
}
+
+ return ret;
}
void MinuiBackendDrm::Blank(bool blank) {
@@ -368,7 +370,10 @@ GRSurface* MinuiBackendDrm::Init() {
current_buffer = 0;
- DrmEnableCrtc(drm_fd, main_monitor_crtc, GRSurfaceDrms[1]);
+ // We will likely encounter errors in the backend functions (i.e. Flip) if EnableCrtc fails.
+ if (DrmEnableCrtc(drm_fd, main_monitor_crtc, GRSurfaceDrms[1]) != 0) {
+ return nullptr;
+ }
return GRSurfaceDrms[0];
}