diff options
author | Tao Bao <tbao@google.com> | 2018-11-01 19:59:30 +0100 |
---|---|---|
committer | android-build-merger <android-build-merger@google.com> | 2018-11-01 19:59:30 +0100 |
commit | 492e87a40b6be5f68b0422beedfdf1737e6fe099 (patch) | |
tree | dc0e8b221eeb6154bdc661a68fa2b331ade0ac28 /minui/graphics_drm.cpp | |
parent | Merge "Refactor the code to check the metadata" am: cbdcfc0038 (diff) | |
parent | Merge changes I69ce001a,I14514017,I8e67cda7 (diff) | |
download | android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.tar android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.tar.gz android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.tar.bz2 android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.tar.lz android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.tar.xz android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.tar.zst android_bootable_recovery-492e87a40b6be5f68b0422beedfdf1737e6fe099.zip |
Diffstat (limited to 'minui/graphics_drm.cpp')
-rw-r--r-- | minui/graphics_drm.cpp | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp index f81fd9d5c..765e2625a 100644 --- a/minui/graphics_drm.cpp +++ b/minui/graphics_drm.cpp @@ -102,15 +102,15 @@ std::unique_ptr<GRSurfaceDrm> GRSurfaceDrm::Create(int drm_fd, int width, int he return nullptr; } - std::unique_ptr<GRSurfaceDrm> surface = std::make_unique<GRSurfaceDrm>(drm_fd); - surface->handle = create_dumb.handle; + // Cannot use std::make_unique to access non-public ctor. + auto surface = std::unique_ptr<GRSurfaceDrm>(new GRSurfaceDrm( + width, height, create_dumb.pitch, create_dumb.bpp / 8, drm_fd, create_dumb.handle)); uint32_t handles[4], pitches[4], offsets[4]; handles[0] = surface->handle; pitches[0] = create_dumb.pitch; offsets[0] = 0; - if (drmModeAddFB2(drm_fd, width, height, format, handles, pitches, offsets, &surface->fb_id, 0) != 0) { perror("Failed to drmModeAddFB2"); @@ -124,10 +124,6 @@ std::unique_ptr<GRSurfaceDrm> GRSurfaceDrm::Create(int drm_fd, int width, int he return nullptr; } - surface->height = height; - surface->width = width; - surface->row_bytes = create_dumb.pitch; - surface->pixel_bytes = create_dumb.bpp / 8; auto mmapped = mmap(nullptr, surface->height * surface->row_bytes, PROT_READ | PROT_WRITE, MAP_SHARED, drm_fd, map_dumb.offset); if (mmapped == MAP_FAILED) { |