Merge pull request #196 from nowrep/wlsoftware
wlgrab: Fix ram (software encoding) snapshot
This commit is contained in:
@@ -168,7 +168,10 @@ void dmabuf_t::frame(
|
|||||||
next_frame->sd.width = width;
|
next_frame->sd.width = width;
|
||||||
next_frame->sd.height = height;
|
next_frame->sd.height = height;
|
||||||
next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low;
|
next_frame->sd.modifier = (((std::uint64_t)high) << 32) | low;
|
||||||
next_frame->obj_count = obj_count;
|
next_frame->sd.obj_count = obj_count;
|
||||||
|
|
||||||
|
next_frame->close_fds = true;
|
||||||
|
std::fill_n(next_frame->sd.fds + obj_count, 4 - obj_count, -1);
|
||||||
}
|
}
|
||||||
|
|
||||||
void dmabuf_t::object(
|
void dmabuf_t::object(
|
||||||
@@ -212,11 +215,15 @@ void dmabuf_t::cancel(
|
|||||||
}
|
}
|
||||||
|
|
||||||
void frame_t::destroy() {
|
void frame_t::destroy() {
|
||||||
for(auto x = 0; x < obj_count; ++x) {
|
if(!close_fds) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
for(auto x = 0; x < 4; ++x) {
|
||||||
|
if(sd.fds[x] >= 0) {
|
||||||
close(sd.fds[x]);
|
close(sd.fds[x]);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
obj_count = 0;
|
close_fds = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
std::vector<std::unique_ptr<monitor_t>> monitors(const char *display_name) {
|
std::vector<std::unique_ptr<monitor_t>> monitors(const char *display_name) {
|
||||||
|
|||||||
@@ -23,7 +23,7 @@ class frame_t {
|
|||||||
public:
|
public:
|
||||||
egl::surface_descriptor_t sd;
|
egl::surface_descriptor_t sd;
|
||||||
|
|
||||||
std::uint32_t obj_count;
|
bool close_fds = false;
|
||||||
|
|
||||||
void destroy();
|
void destroy();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -261,10 +261,9 @@ public:
|
|||||||
img->sequence = sequence;
|
img->sequence = sequence;
|
||||||
|
|
||||||
img->sd = current_frame->sd;
|
img->sd = current_frame->sd;
|
||||||
img->sd.obj_count = current_frame->obj_count;
|
|
||||||
|
|
||||||
// Prevent dmabuf from closing the file descriptors.
|
// Prevent dmabuf from closing the file descriptors.
|
||||||
current_frame->obj_count = 0;
|
current_frame->close_fds = false;
|
||||||
|
|
||||||
return platf::capture_e::ok;
|
return platf::capture_e::ok;
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user