...
下表列出了screen回调函数注册过程,从左至右注册,从右至左调用。为紧凑表格,将一些插件功能合成一列记录。DestroyWindow、DestroyPixmap和CloseScreen调用层次深在下表后单独列出。所有功能基本都须注册CloseScreen回调函数回收资源。
callback name | framebuffer / mi | damage / RandR | curse/ xfee86 / modesetting | composite | double buffer |
---|
CreateWindow | fbCreateWindow | | | compCreateWindow | |
PositionWindow | fbPositionWindow | | | compPositionWindow | miDbePositionWindow |
ChangeWindowAttributes | fbChangeWindowAttributes | | | compChangeWindowAttributes | |
RealizeWindow | fbRealizeWindow | | | compRealizeWindow | |
UnrealizeWindow | fbUnrealizeWindow | | | compUnrealizeWindow | |
CopyWindow | fbCopyWindow | damageCopyWindow | miSpriteCopyWindow | compCopyWindow | |
WindowExposures | miWindowExposures | | xf86XVWindowExposures | | |
MoveWindow | miMoveWindow | | | compResizeWindow | |
ReparentWindow | | | | compReparentWindow | |
ChangeBorderWidth | miChangeBorderWidth | | | compChangeBorderWidth | |
ConfigNotify | | | DRI2ConfigNotify | compConfigNotify | |
SetWindowPixmap | _fbSetWindowPixmap | damageSetWindowPixmap | | | |
ModifyPixmapHeader | miModifyPixmapHeader | | | | |
ReplaceScanoutPixmap | | RRReplaceScanoutPixmap | | | |
SharePixmapBacking | msSharePixmapBacking | | | | |
SetSharedPixmapBacking | msSetSharedPixmapBacking | | PixmapStartDirtyTracking | | |
StartPixmapTracking | StopPixmapTracking | | PixmapStopDirtyTracking | | |
SharedPixmapNotifyDamage | | | msSharedPixmapNotifyDamage | | |
RequestSharedPixmapNotifyDamage | | | msRequestSharedPixmapNotifyDamage | | |
PresentSharedPixmap | | | msPresentSharedPixmap | | |
StopFlippingPixmapTracking | | | msStopFlippingPixmapTracking | | |
DisplayCursor | miPointerDisplayCursor | | CursorDisplayCursor | | |
RecolorCursor | miRecolorCursor | | | | |
QueryBestSize | fbQueryBestSize | | xf86CursorQueryBestSize | | |
ConstrainCursorHarder | | RRConstrainCursorHarder | xf86RandR13ConstrainCursorHarder | | |
ClipNotify | | | xf86XVClipNotify | compClipNotify | |
CreateGC | fbCreateGC | damageCreateGC | | | |
CreateColormap | fbInitializeColormap | | CMapCreateColormap | | |
DestroyColormap | | | CMapDestroyColormap | | |
StoreColors | PictureStoreColors | | miSpriteStoreColors / CMapStoreColors | | |
SourceValidate | miSourceValidate | | miSpriteSourceValidate | | |
DestroyWindow : fbDestroyWindow -> PictureDestroyWindow -> damageDestroyWindow -> XvDestroyWindow -> xf86XVDestroyWindow -> compDestroyWindow -> DbeDestroyWindow
DestroyPixmap : fbDestroyPixmap -> glamor_egl_destroy_pixmap -> damageDestroyPixmap -> XvDestroyPixmap -> ShmDestroyPixmap
CloseScreen : fbCloseScreen -> PictureCloseScreen -> glamor_egl_close_screen -> dri3_close_screen -> miDCCloseScreen -> damageCloseScreen -> miPointerCloseScreen -> miSpriteCloseScreen -> xf86CursorCloseScreen -> CloseScreen -> RRCloseScreen -> CMapCloseScreen -> XvCloseScreen -> xf86XVCloseScreen -> xf86RandRCloseScreen -> CursorCloseScreen -> compCloseScreen -> dri3_close_screen
machine-indepent only
callback name | machine-indepent |
---|
ValidateTree | miValidateTree |
PaintWindow | miPaintWindow |
MarkWindow | miMarkWindow |
MarkOverlappedWindows | miMarkOverlappedWindows |
XYToWindow | miXYToWindow |
MarkUnrealizedWindow | miMarkUnrealizedWindow |
GetLayerWindow | miGetLayerWindow |
GetScreenPixmap | miGetScreenPixmap |
SetScreenPixmap | miSetScreenPixmap |
HandleExposures | miHandleValidateExposures |
ConstrainCursor | miPointerConstrainCursor |
CursorLimits | miPointerCursorLimits |
RealizeCursor | miPointerRealizeCursor |
UnrealizeCursor | miPointerUnrealizeCursor |
SetCursorPosition | miPointerSetCursorPosition |
DeviceCursorInitialize | miPointerDeviceInitialize |
DeviceCursorCleanup | miPointerDeviceCleanup |
SetShape | miSetShape |
ClearToBackground | miClearToBackground |
CreateScreenResources | miCreateScreenResources |
framebuffer only
callback name | framebuffer |
---|
CreatePixmap | fbCreatePixmap |
GetWindowPixmap | _fbGetWindowPixmap |
GetImage | fbGetImage |
GetSpans | fbGetSpans |
RealizeFont | fbRealizeFont |
UnrealizeFont | fbUnrealizeFont |
UninstallColormap | fbUninstallColormap |
ListInstalledColormaps | fbListInstalledColormaps |
ResolveColor | fbResolveColor |
BitmapToRegion | fbPixmapToRegion |
xfree86 only
callback name | xfree86 |
---|
LoadPalette | loadPalette |
SetOverscan | CMapEnterVT / xf86XVEnterVT |
LeaveVT | xf86XVLeaveVT |
SwitchMode | CMapSwitchMode |
ChangeGamma | CMapChangeGamma |
AdjustFrame | xf86XVAdjustFrame |
ModeSet | xf86XVModeSet |
EnableDisableFBAccess | xf86EnableDisableFBAccess |
SaveScreen | xf86SaveScreen |
附录
InitOutput函数调用流程
回调函数以实际调用函数代替。以xserver源码的xwayland-23版本为基础,显卡驱动为modesetting。若显卡驱动不同,如:Intel、amdgpu、nouveau,驱动相关驱动流程有差异。一般来说,modesetting驱动满足显示要求,渲染部分有OpenGL/EGL使用对应DRI驱动即可。
InitOutput (hw/xfree86/common/common/xf86Init.c) -> config_pre_init -> config_udev_pre_init -> LoaderSetPath -> dbus_core_init -> systemd_logind_init -> xf86BusProbe (discover display card) -> xf86AutoConfig (load modesetting drivers) -> xf86allocateConfig -> listPossibleVideoDrivers -> xf86AddMatchedDriver ("modesetting") -> xf86AddMatchedDriver ("fbdev") -> xf86AddMatchedDriver ("vesa") -> xf86initConfigFiles -> xf86setBuiltinConfig -> xf86HandleConfigFile -> xf86OSPMOpen -> xf86ExtensionInit (not load extension) -> autoConfigDevice -> xf86LoadModules (xf86DriverlistFromConfig, modesetting) -> Setup (hw/xfree86/drivers/modesetting/driver.c) -> xf86AddDriver (modesetting) -> Identify (hw/xfree86/drivers/modesetting/driver.c) -> ms_driver_func (hw/xfree86/drivers/modesetting/driver.c) -> xf86OpenConsole -> xf86BusConfig -> xf86CallDriverProbe -> xf86platformProbeDev -> xf86ConfigPciEntity -> xf86GetDevFromEntity -> xf86FindOptionValue -> probe_hw_pci -> ms_setup_scrn_hooks -> ms_setup_entity -> xf86platformAddGPUDevices -> xf86VGAarbiterInit -> xf86PostProbe -> PreInit (hw/xfree86/drivers/modesetting/driver.c) -> xf86SetPrimInitDone -> ms_get_drm_master_fd -> xf86_platform_device_odev_attributes -> open_hw (open) -> check_outputs -> drmModeGetResources -> drmmode_get_default_bpp -> xf86SetDepthBpp -> xf86CollectOptions -> xf86ProcessOptions -> xf86SetWeight -> xf86SetDefaultVisual -> xf86ReturnOptValBool (OPTION_SW_CURSOR) -> drmGetCap (DRM_CAP_CURSOR_WIDTH / DRM_CAP_CURSOR_HEIGHT) -> try_enable_glamor -> load_glamor -> xf86LoadSubModule ("glamoregl") -> glamor_egl_init -> xf86ProcessOptions -> xf86GetOptValString (GLAMOREGLOPT_VENDOR_LIBRARY) -> glamor_set_glvnd_vendor -> xf86GetOptValString (GLAMOREGLOPT_RENDERING_API) -> gbm_create_device -> glamor_egl_get_display -> eglInitialize -> glamor_egl_try_big_gl_api -> glGetString (GL_RENDERER) -> xf86GetOptValBool (OPTION_VARIABLE_REFRESH / OPTION_ASYNC_FLIP_SECONDARIES) -> xf86ReturnOptValBool (OPTION_PAGEFLIP) -> drmGetCap (DRM_CAP_PRIME) -> drmSetClientCap (DRM_CLIENT_CAP_ATOMIC / DRM_CLIENT_CAP_UNIVERSAL_PLANES) -> drmGetCap (DRM_CAP_ADDFB2_MODIFIERS) -> drmmode_pre_init -> drmGetCap (DRM_CAP_DUMB_BUFFER) -> xf86CrtcConfigInit (register drmmode_xf86crtc_config_funcs) -> drmModeGetResources -> drmmode_output_init -> xf86CrtcSetSizeRange -> drmmode_crtc_init -> drmmode_clones_init -> xf86ProviderSetup -> xf86InitialConfiguration -> xf86SetGamma -> xf86SetDpi -> xf86LoadSubModule ("fb") -> xf86InitViewport -> AddScreen -> init_screen -> xf86ScreenInit -> ScreenInit (hw/xfree86/drivers/modesetting/driver.c) -> SetMaster -> glamor_egl_get_gbm_device -> drmmode_create_initial_bos -> miSetVisualTypes -> miSetPixmapDepths -> fbScreenInit -> fbSetupScreen -> fbFinishScreenInit -> fbPictureInit -> miPictureInit -> GetPictureScreen -> drmmode_init -> glamor_init -> glamor_set_screen_private -> glamor_egl_screen_init -> gbm_device_get_backend_name -> glamor_set_glvnd_vendor -> glamor_enable_dri3 -> drmGetDeviceNameFromFd2 -> dri3_screen_init -> glamor_make_current -> epoxy_is_desktop_gl -> epoxy_gl_version -> epoxy_glsl_version -> glamor_check_instruction_count -> glamor_setup_debug_output -> glamor_setup_formats -> glamor_set_debug_level -> glamor_font_init -> glamor_composite_glyphs_init -> glamor_init_vbo -> glamor_init_gradient_shader -> glamor_pixmap_init -> glamor_sync_init -> glamor_set_drawable_modifiers_func (get_drawable_modifiers) -> xf86SetBlackWhitePixels -> xf86SetBackingStore -> xf86SetSilkenMouse -> xf86GetPointerScreenFuncs -> miDCInitialize -> xf86_cursors_init -> xf86CrtcScreenInit -> xf86RandR12Init -> RRScreenInit -> xf86RandR12Init12 -> xf86RandR12CreateObjects12 -> xf86RandR12SetInfo12 -> xf86RandR12InitGamma -> xf86RandR12SetRotations -> xf86RandR12SetTransformSupport-> -> drmmode_setup_colormap -> xf86DPMSInit -> xf86XVScreenInit -> XvScreenInit -> xf86XVInitAdaptors -> ms_vblank_screen_init -> ms_dri2_screen_init -> glamor_supports_pixmap_import_export -> ms_dri2_register_frame_event_resource_types -> DRI2ScreenInit -> ms_present_screen_init -> drmGetCap (DRM_CAP_ASYNC_PAGE_FLIP) -> present_screen_init -> present_screen_register_priv_keys -> present_screen_priv_init -> present_scmd_init_mode_hooks -> present_fake_screen_init -> update_desktop_dimensions -> PictureSetSubpixelOrder -> xf86EnsureRANDR -> xf86RandRInit -> RRScreenInit -> RRInit -> SetRRScreen -> RRMonitorInit -> dixSetPrivate (xf86RandRKey) -> xf86AutoConfigOutputDevices -> RRProviderAutoConfigGpuScreen -> xf86RandR14ProviderSetOutputSource -> RRInitPrimeSyncProps -> RRSetChanged -> xf86RandR14ProviderSetOffloadSink -> xf86VGAarbiterWrapFunctions -> xf86InitOrigins |