summaryrefslogtreecommitdiffstats
path: root/minui/graphics_drm.cpp
diff options
context:
space:
mode:
authorandroid-build-team Robot <android-build-team-robot@google.com>2018-10-24 05:11:46 +0200
committerandroid-build-team Robot <android-build-team-robot@google.com>2018-10-24 05:11:46 +0200
commit36c6222be4084180e7dc5a9ff3283c86fdcdc3a7 (patch)
treea911f5de7d3972133283298037554308d5ad5c0d /minui/graphics_drm.cpp
parentSnap for 5082210 from 3d5a941b0b1671c3ccc3dd25faa2cd7de738b0b0 to qt-release (diff)
parentMerge "Add a function to construct the GRSurface in test" am: ee9c65a38e am: e100c9f491 (diff)
downloadandroid_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.tar
android_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.tar.gz
android_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.tar.bz2
android_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.tar.lz
android_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.tar.xz
android_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.tar.zst
android_bootable_recovery-36c6222be4084180e7dc5a9ff3283c86fdcdc3a7.zip
Diffstat (limited to 'minui/graphics_drm.cpp')
-rw-r--r--minui/graphics_drm.cpp13
1 files changed, 6 insertions, 7 deletions
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp
index 630b80180..81b49fd95 100644
--- a/minui/graphics_drm.cpp
+++ b/minui/graphics_drm.cpp
@@ -70,8 +70,8 @@ void MinuiBackendDrm::Blank(bool blank) {
void MinuiBackendDrm::DrmDestroySurface(GRSurfaceDrm* surface) {
if (!surface) return;
- if (surface->data) {
- munmap(surface->data, surface->row_bytes * surface->height);
+ if (surface->mmapped_buffer_) {
+ munmap(surface->mmapped_buffer_, surface->row_bytes * surface->height);
}
if (surface->fb_id) {
@@ -172,15 +172,14 @@ GRSurfaceDrm* MinuiBackendDrm::DrmCreateSurface(int width, int height) {
surface->width = width;
surface->row_bytes = create_dumb.pitch;
surface->pixel_bytes = create_dumb.bpp / 8;
- surface->data = static_cast<unsigned char*>(mmap(nullptr, surface->height * surface->row_bytes,
- PROT_READ | PROT_WRITE, MAP_SHARED, drm_fd,
- map_dumb.offset));
- if (surface->data == MAP_FAILED) {
+ auto mmapped = mmap(nullptr, surface->height * surface->row_bytes, PROT_READ | PROT_WRITE,
+ MAP_SHARED, drm_fd, map_dumb.offset);
+ if (mmapped == MAP_FAILED) {
perror("mmap() failed");
DrmDestroySurface(surface);
return nullptr;
}
-
+ surface->mmapped_buffer_ = static_cast<uint8_t*>(mmapped);
return surface;
}