diff options
author | Akhil Jaiswal <quic_akhijais@quicinc.com> | 2024-04-18 17:34:21 +0530 |
---|---|---|
committer | Murtuza Raja <quic_mraja@quicinc.com> | 2024-04-29 17:04:40 +0530 |
commit | c908a1f47df55e14e21a92511fbb440c374e1c57 (patch) | |
tree | 5363ea6d9cda6ce5e47cef8296c3a192b771278d | |
parent | dd25c9c2f6e8efbc1728d95a2d2243c5146444d0 (diff) |
minui: allocate pipes for recovery ui in reverse order of population
This ensures there is no shared pipe resource being used
between uefi display refresh and recovery ui
Change-Id: I988c3e9a4d58192ca46e47bfb1ddb7783b0b94a6
CRs-Fixed: 3774969
-rw-r--r-- | minui/graphics_drm.cpp | 53 |
1 files changed, 47 insertions, 6 deletions
diff --git a/minui/graphics_drm.cpp b/minui/graphics_drm.cpp index 9bb1e1b6..667e5ff9 100644 --- a/minui/graphics_drm.cpp +++ b/minui/graphics_drm.cpp @@ -148,6 +148,32 @@ static uint32_t get_topology_lm_number(int fd, uint32_t blob_id) { return num_lm; } +static bool is_primary_plane(int fd, uint32_t blob_id) { + + bool primary = false; + uint32_t master_plane_id_val = 0; + drmModePropertyBlobRes *blob = drmModeGetPropertyBlob(fd, blob_id); + if (!blob) + return false; + + const char *fmt_str = (const char *)(blob->data); + std::stringstream stream(fmt_str); + std::string line = {}; + const std::string master_plane = "primary_smart_plane_id="; + + while (std::getline(stream, line)) { + if (line.find(master_plane) != std::string::npos) { + line = std::string(line, master_plane.length()); + master_plane_id_val = std::atoi(line.c_str()); + break; + } + } + + drmModeFreePropertyBlob(blob); + primary = master_plane_id_val ? false : true; + return primary; +} + static int find_plane_prop_id(uint32_t obj_id, const char *prop_name, Plane *plane_res) { int i, j = 0; @@ -571,22 +597,37 @@ int MinuiBackendDrm::Initdisplay(DrmConnector index) { } } + printf("plane count:%d\n",plane_options->count_planes); + struct Plane *plane_all_res; + uint32_t counter = 0; + plane_all_res = static_cast<struct Plane *>( + calloc(plane_options->count_planes, sizeof(struct Plane))); /* Set plane resources */ - for (uint32_t i = 0; i < number_of_lms; ++i) { - plane_res[i].plane = drmModeGetPlane(drm_fd, plane_options->planes[i]); - if (!plane_res[i].plane) return -1; + for (uint32_t i = 0; i < plane_options->count_planes; ++i) { + plane_all_res[i].plane = drmModeGetPlane(drm_fd, plane_options->planes[i]); + if (!plane_all_res[i].plane)return -1; } - for (uint32_t i = 0; i < number_of_lms; ++i) { - struct Plane* obj = &plane_res[i]; + for (uint32_t i = plane_options->count_planes - 1; i >= 0; i--) { + struct Plane* obj = &plane_all_res[i]; unsigned int j; obj->props = drmModeObjectGetProperties(drm_fd, obj->plane->plane_id, DRM_MODE_OBJECT_PLANE); if (!obj->props) continue; obj->props_info = static_cast<drmModePropertyRes**>( calloc(obj->props->count_props, sizeof(*obj->props_info))); if (!obj->props_info) continue; - for (j = 0; j < obj->props->count_props; ++j) + for (j = 0; j < obj->props->count_props; ++j) { obj->props_info[j] = drmModeGetProperty(drm_fd, obj->props->props[j]); + + if (!strcmp(obj->props_info[j]->name, "capabilities")) { + if(is_primary_plane(drm_fd, obj->props->prop_values[j])) { + plane_res[counter] = plane_all_res[i]; + counter++; + } + } + } + if (counter == number_of_lms) + break; } drmModeFreePlaneResources(plane_options); |