Mir

Merge lp:~robert-ancell/mir/lp-1185183 into lp:~mir-team/mir/trunk

Proposed by Robert Ancell
Status: Merged
Approved by: Alan Griffiths
Approved revision: no longer in the source branch.
Merged at revision: 705
Proposed branch: lp:~robert-ancell/mir/lp-1185183
Merge into: lp:~mir-team/mir/trunk
Diff against target: 36 lines (+8/-1)
2 files modified
src/server/graphics/gbm/gbm_buffer.cpp (+7/-1)
src/server/graphics/gbm/gbm_buffer.h (+1/-0)
To merge this branch: bzr merge lp:~robert-ancell/mir/lp-1185183
Reviewer Review Type Date Requested Status
Alan Griffiths Approve
Alexandros Frantzis (community) Approve
PS Jenkins bot (community) continuous-integration Approve
Review via email: mp+166167@code.launchpad.net

Commit message

Close dmabuf file descriptor when the GBMBuffer is destroyed

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Needs Fixing (continuous-integration)
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alexandros Frantzis (afrantzis) wrote :

This will work safely for now, although it would be preferable to wrap the fd in a RAII wrapper, but not a blocker in this case.

review: Approve
Revision history for this message
Alan Griffiths (alan-griffiths) wrote :

> This will work safely for now, although it would be preferable to wrap the fd
> in a RAII wrapper, but not a blocker in this case.

We should probably write a fd wrapper class and use it throughout.

But that's beyond the scope of this fix.

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'src/server/graphics/gbm/gbm_buffer.cpp'
2--- src/server/graphics/gbm/gbm_buffer.cpp 2013-05-14 21:39:52 +0000
3+++ src/server/graphics/gbm/gbm_buffer.cpp 2013-05-29 04:55:31 +0000
4@@ -79,7 +79,7 @@
5
6 mgg::GBMBuffer::GBMBuffer(std::shared_ptr<gbm_bo> const& handle,
7 std::unique_ptr<BufferTextureBinder> texture_binder)
8- : gbm_handle{handle}, texture_binder{std::move(texture_binder)}
9+ : gbm_handle{handle}, texture_binder{std::move(texture_binder)}, prime_fd{-1}
10 {
11 auto device = gbm_bo_get_device(gbm_handle.get());
12 auto gem_handle = gbm_bo_get_handle(gbm_handle.get()).u32;
13@@ -96,6 +96,12 @@
14 }
15 }
16
17+mgg::GBMBuffer::~GBMBuffer()
18+{
19+ if (prime_fd > 0)
20+ close(prime_fd);
21+}
22+
23 geom::Size mgg::GBMBuffer::size() const
24 {
25 return {geom::Width{gbm_bo_get_width(gbm_handle.get())},
26
27=== modified file 'src/server/graphics/gbm/gbm_buffer.h'
28--- src/server/graphics/gbm/gbm_buffer.h 2013-05-14 19:20:47 +0000
29+++ src/server/graphics/gbm/gbm_buffer.h 2013-05-29 04:55:31 +0000
30@@ -44,6 +44,7 @@
31 GBMBuffer(std::shared_ptr<gbm_bo> const& handle,
32 std::unique_ptr<BufferTextureBinder> texture_binder);
33 GBMBuffer(const GBMBuffer&) = delete;
34+ ~GBMBuffer();
35
36 GBMBuffer& operator=(const GBMBuffer&) = delete;
37

Subscribers

People subscribed via source and target branches