OSDN Git Service

Gpudevice: Return total_displays_ as reference.
authorHarish Krupo <harish.krupo.kps@intel.com>
Tue, 5 Jun 2018 04:01:16 +0000 (09:31 +0530)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Sun, 10 Jun 2018 22:53:11 +0000 (15:53 -0700)
This is to avoid un-necessary copies of the vector.

Jira: None
Test: No regressions seen on Android and Linux.

Signed-off-by: Harish Krupo <harish.krupo.kps@intel.com>
common/core/gpudevice.cpp
os/alios/hwf_alioshal.cpp
os/android/iahwc1.cpp
os/android/iahwc2.cpp
os/linux/linux_frontend.cpp
public/gpudevice.h
tests/Makefile.am
tests/apps/jsonlayerstest.cpp
tests/apps/linux_frontend_test.cpp

index 37dbba4..6b3e211 100644 (file)
@@ -95,7 +95,7 @@ void GpuDevice::GetConnectedPhysicalDisplays(
   }
 }
 
-std::vector<NativeDisplay *> GpuDevice::GetAllDisplays() {
+const std::vector<NativeDisplay *> &GpuDevice::GetAllDisplays() {
   return total_displays_;
 }
 
index 1637515..0fe0785 100644 (file)
@@ -552,7 +552,7 @@ int32_t hwf_open(struct hwf_device_t **device, const VendorModule *module) {
     return -1;
   }
 
-  std::vector<hwcomposer::NativeDisplay *> displays =
+  const std::vector<hwcomposer::NativeDisplay *> &displays =
       p_gpu_device->GetAllDisplays();
 
   hwf_device->virtual_display_.display_ = p_gpu_device->GetVirtualDisplay();
index 22683da..19c20dd 100644 (file)
@@ -600,7 +600,7 @@ static int hwc_device_open(const struct hw_module_t *module, const char *name,
     return -1;
   }
 
-  std::vector<hwcomposer::NativeDisplay *> displays =
+  const std::vector<hwcomposer::NativeDisplay *> &displays =
       ctx->device_.GetAllDisplays();
   ctx->virtual_display_.display_ = ctx->device_.GetVirtualDisplay();
   ctx->virtual_display_.display_->SetExplicitSyncSupport(
index ce894b0..faa5e97 100644 (file)
@@ -159,7 +159,7 @@ HWC2::Error IAHWC2::Init() {
     return HWC2::Error::NoResources;
   }
 
-  std::vector<NativeDisplay *> displays = device_.GetAllDisplays();
+  const std::vector<NativeDisplay *> &displays = device_.GetAllDisplays();
   NativeDisplay *primary_display = displays.at(0);
   uint32_t external_display_id = 1;
   primary_display_.Init(primary_display, 0, disable_explicit_sync_,
index 8c1534e..a076d00 100644 (file)
@@ -104,7 +104,8 @@ int32_t IAHWC::Init() {
     return IAHWC_ERROR_NO_RESOURCES;
   }
 
-  std::vector<hwcomposer::NativeDisplay*> displays = device_.GetAllDisplays();
+  const std::vector<hwcomposer::NativeDisplay*>& displays =
+      device_.GetAllDisplays();
 
   for (hwcomposer::NativeDisplay* display : displays) {
     displays_.emplace_back(new IAHWCDisplay());
index f68ce79..7c9f0fc 100644 (file)
@@ -53,7 +53,7 @@ class GpuDevice : public HWCThread {
 
   void GetConnectedPhysicalDisplays(std::vector<NativeDisplay*>& displays);
 
-  std::vector<NativeDisplay*> GetAllDisplays();
+  const std::vector<NativeDisplay*>& GetAllDisplays();
 
   void RegisterHotPlugEventCallback(
       std::shared_ptr<DisplayHotPlugEventCallback> callback);
index 5ad8753..c4a9c90 100644 (file)
@@ -1,25 +1,17 @@
+# Copyright (c) 2016 Intel Corporation
 #
-#  Copyright (c) 2012 Rob Clark <rob@ti.com>
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
 #
-#  Permission is hereby granted, free of charge, to any person obtaining a
-#  copy of this software and associated documentation files (the "Software"),
-#  to deal in the Software without restriction, including without limitation
-#  the rights to use, copy, modify, merge, publish, distribute, sublicense,
-#  and/or sell copies of the Software, and to permit persons to whom the
-#  Software is furnished to do so, subject to the following conditions:
-#
-#  The above copyright notice and this permission notice (including the next
-#  paragraph) shall be included in all copies or substantial portions of the
-#  Software.
-#
-#  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
-#  IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
-#  FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
-#  THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
-#  LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
-#  OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
-#  SOFTWARE.
+#      http://www.apache.org/licenses/LICENSE-2.0
 #
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
 
 if ENABLE_DUMMY_COMPOSITOR
     AM_CPPFLAGS = -DUSE_DC
index 751a3ae..02d50b8 100644 (file)
@@ -1,26 +1,18 @@
 /*
- * Copyright (c) 2012 Arvin Schnell <arvin.schnell@gmail.com>
- * Copyright (c) 2012 Rob Clark <rob@ti.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
+// Copyright (c) 2016 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
 
 /* Based on a egl cube test app originally written by Arvin Schnell */
 
index 3fc00fd..ee9c4a1 100644 (file)
@@ -1,26 +1,18 @@
 /*
- * Copyright (c) 2012 Arvin Schnell <arvin.schnell@gmail.com>
- * Copyright (c) 2012 Rob Clark <rob@ti.com>
- *
- * Permission is hereby granted, free of charge, to any person obtaining a
- * copy of this software and associated documentation files (the "Software"),
- * to deal in the Software without restriction, including without limitation
- * the rights to use, copy, modify, merge, publish, distribute, sub license,
- * and/or sell copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following conditions:
- *
- * The above copyright notice and this permission notice (including the
- * next paragraph) shall be included in all copies or substantial portions
- * of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
- * FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT. IN NO EVENT SHALL
- * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
- * DEALINGS IN THE SOFTWARE.
- */
+// Copyright (c) 2016 Intel Corporation
+//
+// Licensed under the Apache License, Version 2.0 (the "License");
+// you may not use this file except in compliance with the License.
+// You may obtain a copy of the License at
+//
+//      http://www.apache.org/licenses/LICENSE-2.0
+//
+// Unless required by applicable law or agreed to in writing, software
+// distributed under the License is distributed on an "AS IS" BASIS,
+// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+// See the License for the specific language governing permissions and
+// limitations under the License.
+*/
 
 /* Based on a egl cube test app originally written by Arvin Schnell */