OSDN Git Service

Passing proper width height to create Virtual display.
authorarpallet <avinash.reddy.palleti@intel.com>
Tue, 7 Feb 2017 12:26:07 +0000 (17:56 +0530)
committerKalyan Kondapally <kalyan.kondapally@intel.com>
Wed, 8 Feb 2017 04:43:18 +0000 (20:43 -0800)
Getting proper width and height from CreateVirtualDisplay call and passing
them to InitVirtualDisplay function. This will fix the issue of creating
invalid back buffer.

Jira: https://01.org/jira/browse/AIA-99
Test: No Graphics regressions.

Signed-off-by: arpallet <avinash.reddy.palleti@intel.com>
os/android/drmhwctwo.cpp
os/android/drmhwctwo.h

index 0a9d4ba..25dc93f 100644 (file)
@@ -86,7 +86,7 @@ HWC2::Error DrmHwcTwo::CreateVirtualDisplay(uint32_t width, uint32_t height,
                     std::forward_as_tuple(&device_, HWC_DISPLAY_VIRTUAL,
                                           HWC2::DisplayType::Virtual));
   *display = (hwc2_display_t)HWC_DISPLAY_VIRTUAL;
-  displays_.at(*display).Init();
+  displays_.at(*display).Init(width, height);
   if (*format == HAL_PIXEL_FORMAT_IMPLEMENTATION_DEFINED) {
     // fallback to RGBA_8888, align with framework requirement
     *format = HAL_PIXEL_FORMAT_RGBA_8888;
@@ -146,19 +146,27 @@ DrmHwcTwo::HwcDisplay::HwcDisplay(hwcomposer::GpuDevice *device,
   supported(__func__);
 }
 
-HWC2::Error DrmHwcTwo::HwcDisplay::Init() {
+// This function will be called only for Virtual Display Init
+HWC2::Error DrmHwcTwo::HwcDisplay::Init(uint32_t width, uint32_t height) {
   supported(__func__);
-
-  int display = static_cast<int>(handle_);
   if (!device_->Initialize()) {
     ALOGE("Can't initialize drm object.");
     return HWC2::Error::NoResources;
   }
+  display_ = device_->GetVirtualDisplay();
+  display_->InitVirtualDisplay(width, height);
+  return Init();
+}
 
-  if (type_ == HWC2::DisplayType::Virtual) {
-    display_ = device_->GetVirtualDisplay();
-    display_->InitVirtualDisplay(1, 1);
-  } else {
+HWC2::Error DrmHwcTwo::HwcDisplay::Init() {
+  supported(__func__);
+
+  if (type_ != HWC2::DisplayType::Virtual) {
+    int display = static_cast<int>(handle_);
+    if (!device_->Initialize()) {
+      ALOGE("Can't initialize drm object.");
+      return HWC2::Error::NoResources;
+    }
     display_ = device_->GetDisplay(display);
     if (!display_) {
       ALOGE("Failed to retrieve display %d", display);
index ea4e029..0f0e43a 100644 (file)
@@ -123,6 +123,7 @@ class DrmHwcTwo : public hwc2_device_t {
                HWC2::DisplayType type);
     HwcDisplay(const HwcDisplay &) = delete;
     HWC2::Error Init();
+    HWC2::Error Init(uint32_t width, uint32_t height);
 
     HWC2::Error RegisterVsyncCallback(hwc2_callback_data_t data,
                                       hwc2_function_pointer_t func);