OSDN Git Service

drm_hwcomposer: fix small class consistency issues
authorZach Reizner <zachr@google.com>
Fri, 9 Oct 2015 20:02:55 +0000 (13:02 -0700)
committerZach Reizner <zachr@google.com>
Tue, 13 Oct 2015 02:04:25 +0000 (19:04 -0700)
This also fixes a typo in an error message.

Change-Id: Ie6c369f5eb2496ac3ebb342dbdcdd70f3a176495

drm_hwcomposer.h
hwcomposer.cpp

index fdf389b..1490438 100644 (file)
@@ -175,7 +175,7 @@ class DrmHwcBuffer {
     return importer_ != NULL;
   }
 
-  hwc_drm_bo *operator->();
+  const hwc_drm_bo *operator->() const;
 
   void Clear();
 
@@ -257,11 +257,12 @@ struct DrmHwcLayer {
   UniqueFd acquire_fence;
   OutputFd release_fence;
 
-  DrmHwcLayer() = default;
-  DrmHwcLayer(DrmHwcLayer &&rhs) = default;
-
   int InitFromHwcLayer(hwc_layer_1_t *sf_layer, Importer *importer,
                        const gralloc_module_t *gralloc);
+
+  buffer_handle_t get_usable_handle() const {
+    return handle.get() != NULL ? handle.get() : sf_handle;
+  }
 };
 
 struct DrmHwcDisplayContents {
index a7c9e43..fc421c3 100644 (file)
@@ -191,9 +191,9 @@ OutputFd &OutputFd::operator=(OutputFd &&rhs) {
   return *this;
 }
 
-hwc_drm_bo *DrmHwcBuffer::operator->() {
+const hwc_drm_bo *DrmHwcBuffer::operator->() const {
   if (importer_ == NULL) {
-    ALOGE("Access of nonexistent BO");
+    ALOGE("Access of non-existent BO");
     exit(1);
     return NULL;
   }