Skip to content

Commit

Permalink
Fix for mir_performance_tests failure due to not cleaning up our disp…
Browse files Browse the repository at this point in the history
…lays (#3080)
  • Loading branch information
mattkae authored Oct 18, 2023
1 parent 7285052 commit 926748e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/platforms/eglstream-kms/server/display.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -181,6 +181,21 @@ class DisplayBuffer
pending_flip = satisfied_promise.get_future();
}

~DisplayBuffer()
{
if (output_stream != EGL_NO_STREAM_KHR)
{
eglDestroyStreamKHR(dpy, output_stream);
output_stream = nullptr;
}

if (ctx != EGL_NO_CONTEXT)
{
eglDestroyContext(dpy, ctx);
ctx = nullptr;
}
}

mir::geometry::Rectangle view_area() const override
{
return view_area_;
Expand Down
8 changes: 8 additions & 0 deletions src/platforms/eglstream-kms/server/platform.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -248,6 +248,14 @@ mge::DisplayPlatform::DisplayPlatform(
provider = std::make_shared<InterfaceProvider>(display);
}

mge::DisplayPlatform::~DisplayPlatform()
{
if (display != EGL_NO_DISPLAY)
{
eglTerminate(display);
}
}

auto mge::DisplayPlatform::create_display(
std::shared_ptr<DisplayConfigurationPolicy> const& configuration_policy,
std::shared_ptr<GLConfig> const& gl_config)
Expand Down
2 changes: 2 additions & 0 deletions src/platforms/eglstream-kms/server/platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class DisplayPlatform : public graphics::DisplayPlatform
EGLDeviceEXT device,
std::shared_ptr<DisplayReport> display_report);

~DisplayPlatform();

auto create_display(
std::shared_ptr<DisplayConfigurationPolicy> const& initial_conf_policy,
std::shared_ptr<GLConfig> const& gl_config)
Expand Down

0 comments on commit 926748e

Please sign in to comment.