drm_hwcomposer: Remove HWC2 Dump interface
Rewrite DrmHwc::Dump to return a string, rather than directly implementing the HWC2 interface. Rewrite the HWC3 frontend Dump implementation to return this string. Rewrite the HWC2 frontend Dump implementation to cache the string in the frontend so that the dump string size/contents can be fetched separately. Change-Id: I9c286f047bb67a05ced4f0e9778679c32175084c Signed-off-by: Drew Davenport <ddavenport@google.com>
This commit is contained in:
parent
6066d0a628
commit
aeaddd3233
6 changed files with 38 additions and 21 deletions
|
|
@ -123,4 +123,9 @@ void DrmHwcTwo::SendRefreshEventToClient(hwc2_display_t displayid) {
|
|||
}
|
||||
}
|
||||
|
||||
const std::string& DrmHwcTwo::RefreshStateDump() {
|
||||
last_state_dump_ = DumpState();
|
||||
return last_state_dump_;
|
||||
}
|
||||
|
||||
} // namespace android
|
||||
|
|
|
|||
|
|
@ -39,6 +39,11 @@ class DrmHwcTwo : public DrmHwc {
|
|||
void SendHotplugEventToClient(hwc2_display_t displayid,
|
||||
DisplayStatus display_status) override;
|
||||
|
||||
const std::string& RefreshStateDump();
|
||||
const std::string& GetLastStateDump() const {
|
||||
return last_state_dump_;
|
||||
}
|
||||
|
||||
private:
|
||||
std::pair<HWC2_PFN_HOTPLUG, hwc2_callback_data_t> hotplug_callback_{};
|
||||
std::pair<HWC2_PFN_VSYNC, hwc2_callback_data_t> vsync_callback_{};
|
||||
|
|
@ -48,5 +53,7 @@ class DrmHwcTwo : public DrmHwc {
|
|||
period_timing_changed_callback_{};
|
||||
#endif
|
||||
std::pair<HWC2_PFN_REFRESH, hwc2_callback_data_t> refresh_callback_{};
|
||||
|
||||
std::string last_state_dump_;
|
||||
};
|
||||
} // namespace android
|
||||
|
|
|
|||
|
|
@ -281,6 +281,26 @@ static BufferSampleRange Hwc2ToSampleRange(int32_t dataspace) {
|
|||
}
|
||||
}
|
||||
|
||||
/* Device functions */
|
||||
static int32_t Dump(hwc2_device_t *device, uint32_t *out_size,
|
||||
char *out_buffer) {
|
||||
DrmHwcTwo *hwc = ToDrmHwcTwo(device);
|
||||
if (out_size == nullptr) {
|
||||
return static_cast<int32_t>(HWC2::Error::BadParameter);
|
||||
}
|
||||
|
||||
if (out_buffer != nullptr) {
|
||||
const std::string &last_dump = hwc->GetLastStateDump();
|
||||
auto copied_bytes = last_dump.copy(out_buffer, *out_size);
|
||||
*out_size = copied_bytes;
|
||||
return 0;
|
||||
}
|
||||
|
||||
const std::string &new_dump = hwc->RefreshStateDump();
|
||||
*out_size = static_cast<uint32_t>(new_dump.size());
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Display functions */
|
||||
static int32_t CreateLayer(hwc2_device_t *device, hwc2_display_t display,
|
||||
hwc2_layer_t *out_layer) {
|
||||
|
|
@ -1130,9 +1150,7 @@ static hwc2_function_pointer_t HookDevGetFunction(struct hwc2_device * /*dev*/,
|
|||
DeviceHook<int32_t, decltype(&DrmHwcTwo::DestroyVirtualDisplay),
|
||||
&DrmHwcTwo::DestroyVirtualDisplay, hwc2_display_t>);
|
||||
case HWC2::FunctionDescriptor::Dump:
|
||||
return ToHook<HWC2_PFN_DUMP>(
|
||||
DeviceHook<void, decltype(&DrmHwcTwo::Dump), &DrmHwcTwo::Dump,
|
||||
uint32_t *, char *>);
|
||||
return (hwc2_function_pointer_t)Dump;
|
||||
case HWC2::FunctionDescriptor::GetMaxVirtualDisplayCount:
|
||||
return ToHook<HWC2_PFN_GET_MAX_VIRTUAL_DISPLAY_COUNT>(
|
||||
DeviceHook<uint32_t, decltype(&DrmHwcTwo::GetMaxVirtualDisplayCount),
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue