Snap for 12517605 from d15890e6b99cf271d997c558838a55f55559a665 to 25Q1-release

Change-Id: I2f3077d6bbc56ac82b218be79c299d91a2d7ee9c
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..f58f7a3
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+.out/
+.vscode/
+.idea/
diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml
index da052c3..5863159 100644
--- a/.gitlab-ci.yml
+++ b/.gitlab-ci.yml
@@ -5,7 +5,7 @@
 
 variables:
   DEBIAN_FRONTEND: noninteractive
-  DOCKER_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
+  DOCKER_IMAGE_TAG: registry.freedesktop.org/drm-hwcomposer/drm-hwcomposer:latest
 
 stages:
   - build-container
@@ -20,13 +20,26 @@
     - docker:27.0.3-dind
   variables:
     DOCKER_TLS_CERTDIR: ""
+    # Use the fork's docker image when rebuilding the container
+    DOCKER_IMAGE_TAG: $CI_REGISTRY_IMAGE:latest
   before_script:
     - echo "$CI_JOB_TOKEN" | docker login $CI_REGISTRY -u $CI_REGISTRY_USER --password-stdin
   script:
     - docker build -t $DOCKER_IMAGE_TAG -f .ci/Dockerfile .
     - docker push $DOCKER_IMAGE_TAG
+    - echo "DOCKER_IMAGE_TAG=$DOCKER_IMAGE_TAG" >> build.env
   after_script:
     - docker logout
+  artifacts:
+    reports:
+      dotenv: build.env
+  rules:
+    - if: $CI_PIPELINE_SOURCE == 'merge_request_event'
+      changes:
+      - .ci/Dockerfile
+    - if: $CI_PIPELINE_SOURCE == 'push'
+      changes:
+      - .ci/Dockerfile
 
 build:
   stage: build
diff --git a/drm/DrmMode.h b/drm/DrmMode.h
index c5790a5..5450daf 100644
--- a/drm/DrmMode.h
+++ b/drm/DrmMode.h
@@ -48,6 +48,12 @@
            (float)(mode_.vtotal * mode_.htotal) * 1000.0F;
   }
 
+  auto GetVSyncPeriodNs() const {
+    static const int kNanosecondsPerSecond = 1E9;
+    return static_cast<int32_t>(kNanosecondsPerSecond *
+                                double(1 / GetVRefresh()));
+  }
+
   auto GetName() const {
     return std::string(mode_.name) + "@" + std::to_string(GetVRefresh());
   }
diff --git a/hwc2_device/HwcDisplay.cpp b/hwc2_device/HwcDisplay.cpp
index 36333d2..9a9761b 100644
--- a/hwc2_device/HwcDisplay.cpp
+++ b/hwc2_device/HwcDisplay.cpp
@@ -320,7 +320,7 @@
       break;
     case HWC2::Attribute::VsyncPeriod:
       // in nanoseconds
-      *value = static_cast<int>(1E9 / hwc_config.mode.GetVRefresh());
+      *value = hwc_config.mode.GetVSyncPeriodNs();
       break;
     case HWC2::Attribute::DpiY:
       // ideally this should be vdisplay/mm_heigth, however mm_height
diff --git a/hwc3/ComposerClient.cpp b/hwc3/ComposerClient.cpp
index 0736662..04cbbf1 100644
--- a/hwc3/ComposerClient.cpp
+++ b/hwc3/ComposerClient.cpp
@@ -202,9 +202,15 @@
     return Hwc2toHwc3Error(hwc2_error);
   }
 
+  hwc3::Error error = Hwc2toHwc3Error(
+      display.GetChangedCompositionTypes(&num_types, nullptr, nullptr));
+  if (error != hwc3::Error::kNone) {
+    return error;
+  }
+
   std::vector<hwc2_layer_t> hwc_changed_layers(num_types);
   std::vector<int32_t> hwc_composition_types(num_types);
-  hwc3::Error error = Hwc2toHwc3Error(
+  error = Hwc2toHwc3Error(
       display.GetChangedCompositionTypes(&num_types, hwc_changed_layers.data(),
                                          hwc_composition_types.data()));
   if (error != hwc3::Error::kNone) {
@@ -969,15 +975,13 @@
 
   const HwcDisplayConfigs& configs = display->GetDisplayConfigs();
   for (const auto& [id, config] : configs.hwc_configs) {
-    static const int kNanosecondsPerSecond = 1E9;
     configurations->emplace_back(
         DisplayConfiguration{.configId = static_cast<int32_t>(config.id),
                              .width = config.mode.GetRawMode().hdisplay,
                              .height = config.mode.GetRawMode().vdisplay,
                              .configGroup = static_cast<int32_t>(
                                  config.group_id),
-                             .vsyncPeriod = static_cast<int>(kNanosecondsPerSecond * double(
-                                 1 / config.mode.GetVRefresh()))});
+                             .vsyncPeriod = config.mode.GetVSyncPeriodNs()});
 
     if (configs.mm_width != 0) {
       // ideally this should be vdisplay/mm_heigth, however mm_height