Skip to content
This repository has been archived by the owner on Nov 1, 2021. It is now read-only.

drm: the wlr_output_commit after commiting mode fails #2492

Closed
maringuu opened this issue Nov 21, 2020 · 5 comments
Closed

drm: the wlr_output_commit after commiting mode fails #2492

maringuu opened this issue Nov 21, 2020 · 5 comments

Comments

@maringuu
Copy link
Contributor

maringuu commented Nov 21, 2020

Some pseudocode to demonstrate what I mean:

handleSomeEvent() { // e.g. From wlr_output_management
    wlr_output_set_mode(output, mode) // Set mode it is the same with custom mode
    wlr_output_commit(output) //  Does succeed
}

redneringCode() { // Frame handler for output
    wlr_renderer_begin()
    wlr_renderer_end()
    wlr_output_commit(output) // This commit failes when on drm backend
}

The error message is.
00:00:06.580 [ERROR] [backend/drm/atomic.c:36] eDP-1: Atomic commit failed (pageflip): Resource busy
This does not happen on the wayland backend so I assume this is a bug in the drm backend.

I hacked together a shitty patch to tinywl to demonstrate it.
The patch sets a custom mode to 1000x1000 on an output if a dpms request is send. (You can use the my also shitty wlr-dpms for testing. Use the hack_test branch.)

Tested on wlroots 0.12 with intel graphics.

I would be happy if someone could help me find the bug :)

Edit: To clarify here is the control flow.

  1. Some event received (In my example it is wlr_output_power_manager.set_state
  2. The handler to this event calls wlr_output_set_mode and then wlr_output_commit
  3. wlr_output.events.frame is emitted.
  4. The handler of the frame events does do some rendering. wlr_renderer_begin, wlr_renderer_end`
  5. It calls wlr_output_commit. This commit will fail due to the error mentioned above

Here are the logs

00:00:00.001 [DEBUG] [backend/session/logind.c:254] Failed to set logind session type for session: Rejected send message, 2 matched rules; type="method_call", sender=":1.34" (uid=1000 pid=3602 comm="./tinywl -s wlr-dpms ") interface="org.freedesktop.login1.Session" member="SetType" error name="(unset)" requested_reply="0" destination="org.freedesktop.login1" (uid=0 pid=2933 comm="/usr/libexec/elogind/elogind ")
00:00:00.001 [INFO] [backend/session/logind.c:853] Successfully loaded logind session
00:00:00.002 [INFO] [backend/backend.c:157] Found 1 GPUs
00:00:00.002 [INFO] [backend/drm/backend.c:138] Initializing DRM backend for /dev/dri/card0 (i915)
00:00:00.002 [DEBUG] [backend/drm/drm.c:70] Using atomic DRM interface
00:00:00.002 [INFO] [backend/drm/drm.c:255] Found 3 DRM CRTCs
00:00:00.002 [INFO] [backend/drm/drm.c:176] Found 9 DRM planes
00:00:00.062 [INFO] [render/egl.c:297] Using EGL 1.5
00:00:00.062 [INFO] [render/egl.c:298] Supported EGL client extensions: EGL_EXT_client_extensions EGL_EXT_device_base EGL_EXT_device_enumeration EGL_EXT_device_query EGL_EXT_platform_base EGL_KHR_client_get_all_proc_addresses EGL_KHR_debug EGL_EXT_platform_wayland EGL_EXT_platform_x11 EGL_MESA_platform_gbm EGL_MESA_platform_surfaceless EGL_EXT_platform_device
00:00:00.062 [INFO] [render/egl.c:299] Supported EGL display extensions: EGL_ANDROID_blob_cache EGL_ANDROID_native_fence_sync EGL_EXT_buffer_age EGL_EXT_create_context_robustness EGL_EXT_image_dma_buf_import EGL_EXT_image_dma_buf_import_modifiers EGL_IMG_context_priority EGL_KHR_cl_event2 EGL_KHR_config_attribs EGL_KHR_create_context EGL_KHR_create_context_no_error EGL_KHR_fence_sync EGL_KHR_get_all_proc_addresses EGL_KHR_gl_colorspace EGL_KHR_gl_renderbuffer_image EGL_KHR_gl_texture_2D_image EGL_KHR_gl_texture_3D_image EGL_KHR_gl_texture_cubemap_image EGL_KHR_image EGL_KHR_image_base EGL_KHR_image_pixmap EGL_KHR_no_config_context EGL_KHR_reusable_sync EGL_KHR_surfaceless_context EGL_EXT_pixel_format_float EGL_KHR_wait_sync EGL_MESA_configless_context EGL_MESA_drm_image EGL_MESA_image_dma_buf_export EGL_MESA_query_driver EGL_WL_bind_wayland_display 
00:00:00.062 [INFO] [render/egl.c:300] EGL vendor: Mesa Project
00:00:00.062 [DEBUG] [render/egl.c:175] Supported dmabuf buffer formats: AB4H XB4H AR30 XR30 AB30 AR24 AB24 XR24 XB24 AR15 RG16 R8   R16  GR88 GR32 YUV9 YU11 YU12 YU16 YU24 YVU9 YV11 YV12 YV16 YV24 NV12 P010 P012 P016 NV16 AYUV XYUV YUYV UYVY 
00:00:00.063 [DEBUG] [render/egl.c:340] Obtained high priority context
00:00:00.063 [INFO] [render/gles2/renderer.c:674] Using OpenGL ES 3.2 Mesa 20.0.7 (git-53b2b224dc)
00:00:00.063 [INFO] [render/gles2/renderer.c:675] GL vendor: Intel
00:00:00.063 [INFO] [render/gles2/renderer.c:676] GL renderer: Mesa Intel(R) UHD Graphics 620 (KBL GT2)
00:00:00.063 [INFO] [render/gles2/renderer.c:677] Supported GLES2 extensions: GL_EXT_blend_minmax GL_EXT_multi_draw_arrays GL_EXT_texture_filter_anisotropic GL_EXT_texture_compression_s3tc GL_EXT_texture_compression_dxt1 GL_EXT_texture_compression_rgtc GL_EXT_texture_format_BGRA8888 GL_OES_compressed_ETC1_RGB8_texture GL_OES_depth24 GL_OES_element_index_uint GL_OES_fbo_render_mipmap GL_OES_mapbuffer GL_OES_rgb8_rgba8 GL_OES_standard_derivatives GL_OES_stencil8 GL_OES_texture_3D GL_OES_texture_float GL_OES_texture_float_linear GL_OES_texture_half_float GL_OES_texture_half_float_linear GL_OES_texture_npot GL_OES_vertex_half_float GL_EXT_texture_sRGB_decode GL_OES_EGL_image GL_OES_depth_texture GL_AMD_performance_monitor GL_OES_packed_depth_stencil GL_EXT_texture_type_2_10_10_10_REV GL_NV_conditional_render GL_OES_get_program_binary GL_APPLE_texture_max_level GL_EXT_discard_framebuffer GL_EXT_read_format_bgra GL_EXT_frag_depth GL_NV_fbo_color_attachments GL_OES_EGL_image_external GL_OES_EGL_sync GL_OES_vertex_array_object GL_OES_viewport_array GL_ANGLE_texture_compression_dxt3 GL_ANGLE_texture_compression_dxt5 GL_EXT_occlusion_query_boolean GL_EXT_robustness GL_EXT_texture_rg GL_EXT_unpack_subimage GL_NV_draw_buffers GL_NV_read_buffer GL_NV_read_depth GL_NV_read_depth_stencil GL_NV_read_stencil GL_EXT_draw_buffers GL_EXT_map_buffer_range GL_KHR_debug GL_KHR_robustness GL_KHR_texture_compression_astc_ldr GL_OES_depth_texture_cube_map GL_OES_required_internalformat GL_OES_surfaceless_context GL_EXT_color_buffer_float GL_EXT_sRGB_write_control GL_EXT_separate_shader_objects GL_EXT_shader_framebuffer_fetch GL_EXT_shader_implicit_conversions GL_EXT_shader_integer_mix GL_EXT_tessellation_point_size GL_EXT_tessellation_shader GL_INTEL_conservative_rasterization GL_INTEL_performance_query GL_ANDROID_extension_pack_es31a GL_EXT_base_instance GL_EXT_compressed_ETC1_RGB8_sub_texture GL_EXT_copy_image GL_EXT_draw_buffers_indexed GL_EXT_draw_elements_base_vertex GL_EXT_gpu_shader5 GL_EXT_polygon_offset_clamp GL_EXT_primitive_bounding_box GL_EXT_render_snorm GL_EXT_shader_io_blocks GL_EXT_texture_border_clamp GL_EXT_texture_buffer GL_EXT_texture_cube_map_array GL_EXT_texture_norm16 GL_EXT_texture_view GL_KHR_blend_equation_advanced GL_KHR_blend_equation_advanced_coherent GL_KHR_context_flush_control GL_KHR_robust_buffer_access_behavior GL_NV_image_formats GL_OES_copy_image GL_OES_draw_buffers_indexed GL_OES_draw_elements_base_vertex GL_OES_gpu_shader5 GL_OES_primitive_bounding_box GL_OES_sample_shading GL_OES_sample_variables GL_OES_shader_io_blocks GL_OES_shader_multisample_interpolation GL_OES_tessellation_point_size GL_OES_tessellation_shader GL_OES_texture_border_clamp GL_OES_texture_buffer GL_OES_texture_cube_map_array GL_OES_texture_stencil8 GL_OES_texture_storage_multisample_2d_array GL_OES_texture_view GL_EXT_blend_func_extended GL_EXT_buffer_storage GL_EXT_float_blend GL_EXT_geometry_point_size GL_EXT_geometry_shader GL_EXT_shader_samples_identical GL_KHR_no_error GL_KHR_texture_compression_astc_sliced_3d GL_NV_fragment_shader_interlock GL_OES_EGL_image_external_essl3 GL_OES_geometry_point_size GL_OES_geometry_shader GL_OES_shader_image_atomic GL_EXT_clip_cull_distance GL_EXT_disjoint_timer_query GL_EXT_texture_compression_s3tc_srgb GL_MESA_shader_integer_functions GL_EXT_clip_control GL_EXT_texture_compression_bptc GL_KHR_parallel_shader_compile GL_EXT_EGL_image_storage GL_EXT_shader_framebuffer_fetch_non_coherent GL_EXT_texture_sRGB_R8 GL_EXT_texture_shadow_lod GL_MESA_framebuffer_flip_y GL_NV_compute_shader_derivatives GL_EXT_demote_to_helper_invocation GL_EXT_depth_clamp GL_EXT_texture_query_lod 
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:243] Loaded cursor theme 'default', available cursors:
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] bottom_left_corner (1 images) 16x16+1,14
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] bottom_right_corner (1 images) 16x16+14,14
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] bottom_side (1 images) 15x16+7,14
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] grabbing (1 images) 16x16+8,8
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] left_ptr (1 images) 10x16+1,1
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] left_side (1 images) 16x15+1,7
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] right_side (1 images) 16x15+14,7
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] top_left_corner (1 images) 16x16+1,1
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] top_right_corner (1 images) 16x16+14,1
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] top_side (1 images) 15x16+7,1
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] xterm (1 images) 9x16+4,8
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] hand1 (1 images) 13x16+12,0
00:00:00.070 [DEBUG] [xcursor/wlr_xcursor.c:248] watch (1 images) 16x16+15,9
00:00:00.070 [INFO] [wayland] unable to lock lockfile /run/user/1000/wayland-0.lock, maybe another compositor is running
00:00:00.070 [DEBUG] [backend/libinput/backend.c:70] Initializing libinput
00:00:00.146 [DEBUG] [backend/libinput/events.c:94] Added Power Button [0:1]
00:00:00.152 [DEBUG] [backend/libinput/events.c:94] Added Video Bus [0:6]
00:00:00.158 [DEBUG] [backend/libinput/events.c:94] Added Power Button [0:1]
00:00:00.164 [DEBUG] [backend/libinput/events.c:94] Added Lid Switch [0:5]
00:00:00.164 [DEBUG] [backend/libinput/switch.c:20] Created switch for device Lid Switch
00:00:00.164 [DEBUG] [backend/libinput/events.c:94] Added Sleep Button [0:3]
00:00:00.170 [DEBUG] [backend/libinput/events.c:94] Added Integrated_Webcam_HD: Integrate [3034:22772]
00:00:00.176 [DEBUG] [backend/libinput/events.c:94] Added Integrated_Webcam_HD: Integrate [3034:22772]
00:00:00.182 [DEBUG] [backend/libinput/events.c:94] Added DELL07E6:00 06CB:76AF Mouse [1739:30383]
00:00:00.182 [DEBUG] [backend/libinput/events.c:94] Added DELL07E6:00 06CB:76AF Touchpad [1739:30383]
00:00:00.182 [DEBUG] [backend/libinput/events.c:94] Added Logitech M310 [1133:4132]
00:00:00.182 [DEBUG] [backend/libinput/events.c:94] Added Logitech K520 [1133:8209]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added HDA Intel PCH Headphone Mic [0:0]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added HDA Intel PCH HDMI/DP,pcm=3 [0:0]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added HDA Intel PCH HDMI/DP,pcm=7 [0:0]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added HDA Intel PCH HDMI/DP,pcm=8 [0:0]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added HDA Intel PCH HDMI/DP,pcm=9 [0:0]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added HDA Intel PCH HDMI/DP,pcm=10 [0:0]
00:00:00.188 [DEBUG] [backend/libinput/events.c:94] Added Intel HID events [0:0]
00:00:00.194 [DEBUG] [backend/libinput/events.c:94] Added Intel HID 5 button array [0:0]
00:00:00.200 [DEBUG] [backend/libinput/events.c:94] Added Dell WMI hotkeys [0:0]
00:00:00.206 [DEBUG] [backend/libinput/events.c:94] Added AT Translated Set 2 keyboard [1:1]
00:00:00.212 [DEBUG] [backend/libinput/events.c:94] Added PS/2 Synaptics TouchPad [2:1]
00:00:00.212 [DEBUG] [backend/libinput/backend.c:116] libinput successfully initialized
00:00:00.212 [INFO] [backend/drm/drm.c:1256] Scanning DRM connectors
00:00:00.213 [INFO] [backend/drm/drm.c:1315] Found connector 'eDP-1'
00:00:00.213 [INFO] [backend/drm/drm.c:1351] 'eDP-1' connected
00:00:00.213 [DEBUG] [backend/drm/drm.c:1352] Current CRTC: 48
00:00:00.213 [INFO] [backend/drm/drm.c:1357] Physical size: 290x170
00:00:00.213 [INFO] [backend/drm/drm.c:1375] Detected modes:
00:00:00.213 [INFO] [backend/drm/drm.c:1397]   1920x1080@59999 (preferred)
00:00:00.213 [INFO] [backend/drm/drm.c:1397]   1920x1080@47997 
00:00:00.259 [INFO] [backend/drm/drm.c:1315] Found connector 'DP-1'
00:00:00.259 [INFO] [backend/drm/drm.c:1351] 'DP-1' connected
00:00:00.259 [DEBUG] [backend/drm/drm.c:1352] Current CRTC: 66
00:00:00.259 [INFO] [backend/drm/drm.c:1357] Physical size: 600x340
00:00:00.259 [INFO] [backend/drm/drm.c:1375] Detected modes:
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   3840x2160@59997 (preferred)
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   3840x2160@30000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   2560x1440@59951 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1920x1080@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1920x1080@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1920x1080@59940 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1600x900@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1280x1024@60020 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1280x800@59810 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1152x864@59972 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1280x720@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1280x720@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1280x720@59940 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   1024x768@60004 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   800x600@60317 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   720x480@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   720x480@59940 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   640x480@60000 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   640x480@59940 
00:00:00.259 [INFO] [backend/drm/drm.c:1397]   640x480@59940 
00:00:00.259 [INFO] [backend/drm/drm.c:1315] Found connector 'DP-2'
00:00:00.259 [DEBUG] [backend/drm/drm.c:1088] Reallocating CRTCs
00:00:00.259 [DEBUG] [backend/drm/drm.c:1099] State before reallocation:
00:00:00.259 [DEBUG] [backend/drm/drm.c:1105]   'eDP-1' crtc=0 state=1 desired_enabled=1
00:00:00.259 [DEBUG] [backend/drm/drm.c:1105]   'DP-1' crtc=1 state=1 desired_enabled=1
00:00:00.259 [DEBUG] [backend/drm/drm.c:1105]   'DP-2' crtc=-1 state=0 desired_enabled=0
00:00:00.259 [DEBUG] [backend/drm/drm.c:1157] State after reallocation:
00:00:00.259 [DEBUG] [backend/drm/drm.c:1164]   'eDP-1' crtc=0 state=1 desired_enabled=1
00:00:00.259 [DEBUG] [backend/drm/drm.c:1164]   'DP-1' crtc=1 state=1 desired_enabled=1
00:00:00.259 [DEBUG] [backend/drm/drm.c:1164]   'DP-2' crtc=-1 state=0 desired_enabled=0
00:00:00.259 [INFO] [backend/drm/drm.c:1463] Requesting modeset for 'eDP-1'
00:00:00.259 [INFO] [backend/drm/drm.c:811] Modesetting 'eDP-1' with '1920x1080@59999mHz'
00:00:00.259 [DEBUG] [backend/drm/drm.c:693] Initializing renderer on connector 'eDP-1'
00:00:00.285 [INFO] [backend/drm/drm.c:1463] Requesting modeset for 'DP-1'
00:00:00.285 [INFO] [backend/drm/drm.c:811] Modesetting 'DP-1' with '3840x2160@59997mHz'
00:00:00.285 [DEBUG] [backend/drm/drm.c:693] Initializing renderer on connector 'DP-1'
00:00:01.491 [INFO] [tinywl.c:998] Running Wayland compositor on WAYLAND_DISPLAY=wayland-1
debug: 2
00:00:01.518 [INFO] [backend/drm/drm.c:860] Registered custom mode 1000x1000@59851
00:00:01.518 [INFO] [backend/drm/drm.c:811] Modesetting 'eDP-1' with '1000x1000@59851mHz'
00:00:01.518 [DEBUG] [backend/drm/drm.c:693] Initializing renderer on connector 'eDP-1'
00:00:01.562 [ERROR] [backend/drm/atomic.c:36] eDP-1: Atomic commit failed (pageflip): Resource busy
00:00:06.880 [INFO] [backend/drm/drm.c:1621] Emitting destruction signal for 'eDP-1'
00:00:06.880 [DEBUG] [backend/drm/drm.c:1062] De-allocating CRTC 0 for output 'eDP-1'
00:00:07.161 [INFO] [backend/drm/drm.c:1621] Emitting destruction signal for 'DP-1'
00:00:07.161 [DEBUG] [backend/drm/drm.c:1062] De-allocating CRTC 1 for output 'DP-1'
unexpected errno: 32
/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/std/debug.zig:406:19: 0x2095fc in std.debug.writeCurrentStackTrace (wlr-dpms)
/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/std/debug.zig:116:31: 0x206c10 in std.debug.dumpCurrentStackTrace (wlr-dpms)
/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/std/os.zig:4342:40: 0x207e1c in std.os.unexpectedErrno (wlr-dpms)
/home/maringuu/workspace/git/wlr-dpms/submodules/zig-wayland/wayland_client.zig:125:41: 0x205d81 in .wayland.wayland_client.Display.roundtrip (wlr-dpms)
        else => |err| os.unexpectedErrno(err),
                                        ^
/home/maringuu/workspace/git/wlr-dpms/src/main.zig:37:30: 0x2057ba in main (wlr-dpms)
    _ = try display.roundtrip();
                             ^
/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/std/start.zig:325:37: 0x2063c1 in std.start.main (wlr-dpms)
/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/libc/musl/src/env/__libc_start_main.c:94:7: 0x23bf17 in libc_start_main_stage2 (/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/libc/musl/src/env/__libc_start_main.c)
error: Unexpected
/home/maringuu/opt/zig-linux-x86_64-0.6.0+ddd39b994/lib/zig/std/os.zig:4344:5: 0x207e2b in std.os.unexpectedErrno (wlr-dpms)
/home/maringuu/workspace/git/wlr-dpms/submodules/zig-wayland/wayland_client.zig:122:5: 0x205db8 in .wayland.wayland_client.Display.roundtrip (wlr-dpms)
    return switch (os.errno(rc)) {
    ^
/home/maringuu/workspace/git/wlr-dpms/src/main.zig:37:9: 0x2056a2 in main (wlr-dpms)
    _ = try display.roundtrip();
        ^
@maringuu
Copy link
Contributor Author

I did some debugging with gdb and noticed something that might be related to the bug.

One breakpoint was set to tinywls output_frame which is the listener to wlr_output.events.frame and another one at the function I introduced handle_power_manager_set_mode.

After the mode was set in handle_power_manager_set_mode and the commit succeeded the screen was black. The screen stayed black even when the output emitted the next frame event. The modeset was finally visible after a call of drm_crtc_page_flip in the call of wlr_output_commit that fails normally due to the resource beeing busy.

The problem with this is that when debugging with gdb I don't get the resource busy. That lets me conclude that there is some kind of race condition in the backend code.

@emersion
Copy link
Member

You can't submit a new output commit before you receive a frame event. This is a limitation of the DRM API.

@maringuu
Copy link
Contributor Author

maringuu commented Nov 21, 2020

@emersion Thank you for the answer but, I don't quite understand.
Do you mean that everytime I submit a commit with a modeset to an output I have to wait for the next frame event before submitting another commit?

Also would there have been a quick way for me to find out about this without asking here?

Edit: Okay I think I understood it now and fixed in my usecase by skipping the frame event that comes directly after changing the mode. Why not just don't send the frame event in the first place?

@emersion
Copy link
Member

Okay I think I understood it now and fixed in my usecase by skipping the frame event that comes directly after changing the mode. Why not just don't send the frame event in the first place?

You shouldn't need to skip events. Just render in response to a frame event and nowhere else.

@maringuu
Copy link
Contributor Author

maringuu commented Nov 23, 2020

By rendering you mean calling wlr_output_commit?

For example if a request from a client of wlr_output_power_management_v1 comes in am I NOT supposed to call commit in the event handler?

handleOutputPowerMangerTurnOff() { // e.g. From wlr_output_power_management
    // Do anything but dont call wlr_output_commit
}

redneringCode() { // Frame handler for output
    // Somehow figure out that `handleOutputPowerMangerTurnOff`was called
    wlr_renderer_begin()
    wlr_renderer_end()
    wlr_output_commit(output)
}

Or do you mean I should not call wlr_renderer_begin outside of the frame handler?

If you mean the latter please note that I dont do that. I just set the mode for an output outside of the frame handler.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Development

No branches or pull requests

2 participants