drm_hwcomposer: CI: Upgrade clang-* to v12

- Enabling readability-ientifier-naming tidy check does require to specify
MacroDefinitionIgnoredRegexp key, which is available only in clang-tidy-12.

- Clang-12 isn't available on ubuntu 20.10, therefore upgrade to 21.04.

- "DEBIAN_FRONTEND: noninteractive" is required to prevent ubuntu 21.04
from hanging, presumably due to waiting for the user input.

- A positive side effect of upgrading to clang-12 is new clang-tidy-12,
which exposed new issues in the code which is also fixed by this commit,
e.g:

    Failed cppcoreguidelines-narrowing-conversions check with error:
    error: narrowing conversion from 'uint32_t' (aka 'unsigned int') to 'float'

require explicit casting to pass the check, while some of such fails are caused
by incorrect variable type and fixed by changing the type to correct one.

Signed-off-by: Roman Stratiienko <r.stratiienko@gmail.com>
diff --git a/compositor/DrmDisplayCompositor.cpp b/compositor/DrmDisplayCompositor.cpp
index a1fe50f..ff9f6ad 100644
--- a/compositor/DrmDisplayCompositor.cpp
+++ b/compositor/DrmDisplayCompositor.cpp
@@ -263,7 +263,7 @@
     DrmPlane *plane = comp_plane.plane();
     std::vector<size_t> &source_layers = comp_plane.source_layers();
 
-    int fb_id = -1;
+    uint32_t fb_id = UINT32_MAX;
     int fence_fd = -1;
     hwc_rect_t display_frame;
     hwc_frect_t source_crop;
@@ -346,7 +346,7 @@
         rotation |= DRM_MODE_ROTATE_0;
 
       if (fence_fd >= 0) {
-        int prop_id = plane->in_fence_fd_property().id();
+        uint32_t prop_id = plane->in_fence_fd_property().id();
         if (prop_id == 0) {
           ALOGE("Failed to get IN_FENCE_FD property id");
           break;
@@ -399,7 +399,7 @@
     }
 
     // Disable the plane if there's no framebuffer
-    if (fb_id < 0) {
+    if (fb_id == UINT32_MAX) {
       ret = drmModeAtomicAddProperty(pset, plane->id(),
                                      plane->crtc_property().id(), 0) < 0 ||
             drmModeAtomicAddProperty(pset, plane->id(),
@@ -754,7 +754,9 @@
 
   uint64_t cur_ts = ts.tv_sec * 1000 * 1000 * 1000 + ts.tv_nsec;
   uint64_t num_ms = (cur_ts - dump_last_timestamp_ns_) / (1000 * 1000);
-  float fps = num_ms ? (num_frames * 1000.0F) / (num_ms) : 0.0F;
+  float fps = num_ms ? static_cast<float>(num_frames) * 1000.0F /
+                           static_cast<float>(num_ms)
+                     : 0.0F;
 
   *out << "--DrmDisplayCompositor[" << display_
        << "]: num_frames=" << num_frames << " num_ms=" << num_ms