Skip to content

Commit

Permalink
Fix wayland capture on nvidia for kms
Browse files Browse the repository at this point in the history
  • Loading branch information
himekifee committed Feb 3, 2023
1 parent 09dff34 commit e1b7312
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
6 changes: 6 additions & 0 deletions src/platform/linux/kmsgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -755,6 +755,12 @@ class display_ram_t : public display_t {
auto &rgb = *rgb_opt;

gl::ctx.BindTexture(GL_TEXTURE_2D, rgb->tex[0]);

int w, h;
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h;

gl::ctx.GetTextureSubImage(rgb->tex[0], 0, img_offset_x, img_offset_y, 0, width, height, 1, GL_BGRA, GL_UNSIGNED_BYTE, img_out_base->height * img_out_base->row_pitch, img_out_base->data);

if(cursor_opt && cursor) {
Expand Down
2 changes: 1 addition & 1 deletion src/platform/linux/wlgrab.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ class wlr_ram_t : public wlr_t {

int w, h;
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &w);
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_WIDTH, &h);
gl::ctx.GetTexLevelParameteriv(GL_TEXTURE_2D, 0, GL_TEXTURE_HEIGHT, &h);
BOOST_LOG(debug) << "width and height: w "sv << w << " h "sv << h;

gl::ctx.GetTextureSubImage((*rgb_opt)->tex[0], 0, 0, 0, 0, width, height, 1, GL_BGRA, GL_UNSIGNED_BYTE, img_out_base->height * img_out_base->row_pitch, img_out_base->data);
Expand Down

0 comments on commit e1b7312

Please sign in to comment.