Merge "sdm: Fix vector initialization"
diff --git a/libgralloc1/gr_device_impl.cpp b/libgralloc1/gr_device_impl.cpp
index 121d0cf..2bb66d1 100644
--- a/libgralloc1/gr_device_impl.cpp
+++ b/libgralloc1/gr_device_impl.cpp
@@ -100,16 +100,13 @@
}
void GrallocImpl::GetCapabilities(struct gralloc1_device *device, uint32_t *out_count,
- int32_t /*gralloc1_capability_t*/ *out_capabilities) {
- if (!device) {
- // Need to plan for adding more capabilities
- if (out_capabilities == NULL) {
- *out_count = 1;
- } else {
- *out_capabilities = GRALLOC1_CAPABILITY_TEST_ALLOCATE;
+ int32_t /*gralloc1_capability_t*/ *out_capabilities) {
+ if (device != nullptr) {
+ if (out_capabilities != nullptr && *out_count > 0) {
+ out_capabilities[0] = GRALLOC1_CAPABILITY_TEST_ALLOCATE;
}
+ *out_count = 1;
}
-
return;
}
diff --git a/libgralloc1/gr_priv_handle.h b/libgralloc1/gr_priv_handle.h
index 61190c2..9a7e7b6 100644
--- a/libgralloc1/gr_priv_handle.h
+++ b/libgralloc1/gr_priv_handle.h
@@ -175,7 +175,7 @@
gralloc1_producer_usage_t GetProducerUsage() const { return producer_usage; }
- int GetBackingstore() const { return fd; }
+ uint64_t GetBackingstore() const { return id; }
};
#endif // __GR_PRIV_HANDLE_H__
diff --git a/sdm/include/utils/rect.h b/sdm/include/utils/rect.h
index 16a9ba9..ea6edfb 100644
--- a/sdm/include/utils/rect.h
+++ b/sdm/include/utils/rect.h
@@ -57,7 +57,8 @@
bool flip_horizontal, LayerRect *out_rects);
void MapRect(const LayerRect &src_domain, const LayerRect &dst_domain, const LayerRect &in_rect,
LayerRect *out_rect);
- void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect, LayerRect *out_rect);
+ void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect,
+ const LayerTransform &transform, LayerRect *out_rect);
RectOrientation GetOrientation(const LayerRect &in_rect);
} // namespace sdm
diff --git a/sdm/libs/core/display_primary.cpp b/sdm/libs/core/display_primary.cpp
index 3a1541e..409d659 100644
--- a/sdm/libs/core/display_primary.cpp
+++ b/sdm/libs/core/display_primary.cpp
@@ -91,16 +91,19 @@
bool needs_hv_flip = hw_panel_info_.panel_orientation.flip_horizontal &&
hw_panel_info_.panel_orientation.flip_vertical;
LayerRect src_domain = {};
+ LayerTransform panel_transform = {};
DisplayConfigVariableInfo variable_info = {};
if (needs_hv_flip) {
DisplayBase::GetFrameBufferConfig(&variable_info);
src_domain.right = variable_info.x_pixels;
src_domain.bottom = variable_info.y_pixels;
+ panel_transform.flip_horizontal = hw_panel_info_.panel_orientation.flip_horizontal;
+ panel_transform.flip_vertical = hw_panel_info_.panel_orientation.flip_vertical;
for (Layer *layer : layer_stack->layers) {
// Modify destination based on panel flip
- TransformHV(src_domain, layer->dst_rect, &layer->dst_rect);
+ TransformHV(src_domain, layer->dst_rect, panel_transform, &layer->dst_rect);
if (layer->flags.solid_fill) {
continue;
diff --git a/sdm/libs/hwc/hwc_session.cpp b/sdm/libs/hwc/hwc_session.cpp
index a65e68d..27745d0 100644
--- a/sdm/libs/hwc/hwc_session.cpp
+++ b/sdm/libs/hwc/hwc_session.cpp
@@ -188,6 +188,13 @@
}
connected_displays_[HWC_DISPLAY_PRIMARY] = 1;
+ struct rlimit fd_limit = {};
+ getrlimit(RLIMIT_NOFILE, &fd_limit);
+ fd_limit.rlim_cur = fd_limit.rlim_cur * 2;
+ auto err = setrlimit(RLIMIT_NOFILE, &fd_limit);
+ if (err) {
+ DLOGW("Unable to increase fd limit - err: %d, %s", errno, strerror(errno));
+ }
return 0;
}
diff --git a/sdm/libs/hwc2/hwc_session.cpp b/sdm/libs/hwc2/hwc_session.cpp
index cc780d8..b497a36 100644
--- a/sdm/libs/hwc2/hwc_session.cpp
+++ b/sdm/libs/hwc2/hwc_session.cpp
@@ -134,6 +134,13 @@
return -errno;
}
+ struct rlimit fd_limit = {};
+ getrlimit(RLIMIT_NOFILE, &fd_limit);
+ fd_limit.rlim_cur = fd_limit.rlim_cur * 2;
+ auto err = setrlimit(RLIMIT_NOFILE, &fd_limit);
+ if (err) {
+ DLOGW("Unable to increase fd limit - err:%d, %s", errno, strerror(errno));
+ }
return 0;
}
diff --git a/sdm/libs/utils/rect.cpp b/sdm/libs/utils/rect.cpp
index dd5a872..b0cd536 100644
--- a/sdm/libs/utils/rect.cpp
+++ b/sdm/libs/utils/rect.cpp
@@ -223,18 +223,27 @@
out_rect->bottom = dst_domain.top + (height_ratio * modified_in_rect.bottom);
}
-void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect, LayerRect *out_rect) {
+void TransformHV(const LayerRect &src_domain, const LayerRect &in_rect,
+ const LayerTransform &transform, LayerRect *out_rect) {
if (!IsValid(src_domain) || !IsValid(in_rect)) {
return;
}
float in_width = in_rect.right - in_rect.left;
float in_height = in_rect.bottom - in_rect.top;
+ float x_offset = in_rect.left - src_domain.left;
+ float y_offset = in_rect.top - src_domain.top;
+ *out_rect = in_rect;
- out_rect->right = src_domain.right - in_rect.left;
- out_rect->bottom = src_domain.bottom - in_rect.top;
- out_rect->left = out_rect->right - in_width;
- out_rect->top = out_rect->bottom - in_height;
+ if (transform.flip_horizontal) {
+ out_rect->right = src_domain.right - x_offset;
+ out_rect->left = out_rect->right - in_width;
+ }
+
+ if (transform.flip_vertical) {
+ out_rect->bottom = src_domain.bottom - y_offset;
+ out_rect->top = out_rect->bottom - in_height;
+ }
}
RectOrientation GetOrientation(const LayerRect &in_rect) {