diff options
author | alk3pInjection <webmaster@raspii.tech> | 2024-05-08 22:21:24 +0800 |
---|---|---|
committer | alk3pInjection <webmaster@raspii.tech> | 2024-05-08 22:21:24 +0800 |
commit | 1756bc4740ed0ff87f1d5e7b13aef84c45352212 (patch) | |
tree | 1a8f23a08b39c7746b3b38f894fb50e27133703c | |
parent | 849ced54ad51fb9da2da94f597ecc80524d553a4 (diff) | |
parent | c908a1f47df55e14e21a92511fbb440c374e1c57 (diff) |
Merge tag 'LA.QSSI.14.0.r1-14600-qssi.0' into umineko
LA.QSSI.14.0.r1-14600-qssi.0
Change-Id: I4e2f1d52ea12069250360739a11c2cbd0818b27a
-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); |