diff options
author | Tao Bao <tbao@google.com> | 2018-10-23 19:06:35 +0200 |
---|---|---|
committer | Gerrit Code Review <noreply-gerritcodereview@google.com> | 2018-10-23 19:06:35 +0200 |
commit | 66a576b79c6cf629c439f02a37b824a1ec35ec19 (patch) | |
tree | 516cc6ee57b32a0354a9895e85d7238e6496b7fd /minui/graphics_drm.cpp | |
parent | Merge "Recovery now expects public keys in zipfile" (diff) | |
parent | minui: Move GRSurface into a class. (diff) | |
download | android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.tar android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.tar.gz android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.tar.bz2 android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.tar.lz android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.tar.xz android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.tar.zst android_bootable_recovery-66a576b79c6cf629c439f02a37b824a1ec35ec19.zip |
Diffstat (limited to 'minui/graphics_drm.cpp')
-rw-r--r-- | minui/graphics_drm.cpp | 13 |
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; } |